Fixed compile issues I missed
This commit is contained in:
1 parent
d820153a61
commit
8789991f9a
4 files changed
+44
-45
No files matched your search
@@ -134,47 +134,6 @@ extern "C" void InitGraphics(int argc, char **argv, char *script_cmds_file, char
|
||||
gui = new ProxGuiQT(argc, argv, main_loop_thread);
|
||||
}
|
||||
|
||||
void add_temporary_marker(uint32_t position, const char *label) {
|
||||
if (g_TempMarkerSize == 0) { //Initialize the marker array
|
||||
g_TempMarkers = (marker_t *)calloc(1, sizeof(marker_t));
|
||||
} else { //add more space to the marker array using realloc()
|
||||
marker_t *temp = (marker_t *)realloc(g_TempMarkers, ((g_TempMarkerSize + 1) * sizeof(marker_t)));
|
||||
|
||||
if (temp == NULL) { //Unable to reallocate memory for a new marker
|
||||
PrintAndLogEx(FAILED, "Unable to allocate memory for a new temporary marker!");
|
||||
free(temp);
|
||||
return;
|
||||
} else {
|
||||
//Set g_TempMarkers to the new pointer
|
||||
g_TempMarkers = temp;
|
||||
}
|
||||
}
|
||||
|
||||
g_TempMarkers[g_TempMarkerSize].pos = position;
|
||||
|
||||
char *markerLabel = (char *)calloc(1, strlen(label) + 1);
|
||||
strcpy(markerLabel, label);
|
||||
|
||||
if (strlen(markerLabel) > 30) {
|
||||
PrintAndLogEx(WARNING, "Label for temporary marker too long! Trunicating...");
|
||||
markerLabel[30] = '\0';
|
||||
}
|
||||
|
||||
strncpy(g_TempMarkers[g_TempMarkerSize].label, markerLabel, 30);
|
||||
g_TempMarkerSize++;
|
||||
|
||||
memset(markerLabel, 0x00, strlen(label));
|
||||
free(markerLabel);
|
||||
}
|
||||
|
||||
void remove_temporary_markers(void) {
|
||||
if (g_TempMarkerSize == 0) return;
|
||||
|
||||
memset(g_TempMarkers, 0x00, (g_TempMarkerSize * sizeof(marker_t)));
|
||||
free(g_TempMarkers);
|
||||
g_TempMarkerSize = 0;
|
||||
}
|
||||
|
||||
extern "C" void ExitGraphics(void) {
|
||||
if (!gui)
|
||||
return;
|
||||
|
||||
Reference in new issue
Block a user