mirror of https://github.com/encounter/SDL.git
visualtest: use SDL_malloc
This commit is contained in:
parent
30338beb61
commit
5699e0fa0c
|
@ -54,7 +54,7 @@ SDLVisualTest_EnqueueAction(SDLVisualTest_ActionQueue* queue,
|
||||||
sizeof(SDLVisualTest_ActionNode));
|
sizeof(SDLVisualTest_ActionNode));
|
||||||
if(!node)
|
if(!node)
|
||||||
{
|
{
|
||||||
SDLTest_LogError("malloc() failed");
|
SDLTest_LogError("SDL_malloc() failed");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
node->action = action;
|
node->action = action;
|
||||||
|
@ -220,10 +220,10 @@ SDLVisualTest_InsertIntoActionQueue(SDLVisualTest_ActionQueue* queue,
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
newnode = (SDLVisualTest_ActionNode*)malloc(sizeof(SDLVisualTest_ActionNode));
|
newnode = (SDLVisualTest_ActionNode*)SDL_malloc(sizeof(SDLVisualTest_ActionNode));
|
||||||
if(!newnode)
|
if(!newnode)
|
||||||
{
|
{
|
||||||
SDLTest_LogError("malloc() failed");
|
SDLTest_LogError("SDL_malloc() failed");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
newnode->action = action;
|
newnode->action = action;
|
||||||
|
@ -344,7 +344,7 @@ SDLVisualTest_ParseActionConfig(char* file, SDLVisualTest_ActionQueue* queue)
|
||||||
path = (char*)SDL_malloc(sizeof(char) * (len + 1));
|
path = (char*)SDL_malloc(sizeof(char) * (len + 1));
|
||||||
if(!path)
|
if(!path)
|
||||||
{
|
{
|
||||||
SDLTest_LogError("malloc() failed");
|
SDLTest_LogError("SDL_malloc() failed");
|
||||||
SDLVisualTest_EmptyActionQueue(queue);
|
SDLVisualTest_EmptyActionQueue(queue);
|
||||||
SDL_RWclose(rw);
|
SDL_RWclose(rw);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -358,7 +358,7 @@ SDLVisualTest_ParseActionConfig(char* file, SDLVisualTest_ActionQueue* queue)
|
||||||
args = (char*)SDL_malloc(sizeof(char) * (len + 1));
|
args = (char*)SDL_malloc(sizeof(char) * (len + 1));
|
||||||
if(!args)
|
if(!args)
|
||||||
{
|
{
|
||||||
SDLTest_LogError("malloc() failed");
|
SDLTest_LogError("SDL_malloc() failed");
|
||||||
SDL_free(path);
|
SDL_free(path);
|
||||||
SDLVisualTest_EmptyActionQueue(queue);
|
SDLVisualTest_EmptyActionQueue(queue);
|
||||||
SDL_RWclose(rw);
|
SDL_RWclose(rw);
|
||||||
|
@ -393,4 +393,4 @@ SDLVisualTest_ParseActionConfig(char* file, SDLVisualTest_ActionQueue* queue)
|
||||||
|
|
||||||
SDL_RWclose(rw);
|
SDL_RWclose(rw);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -234,7 +234,7 @@ ParseConfig(char* file, SDLVisualTest_HarnessState* state)
|
||||||
argv = (char**)SDL_malloc((num_params + 1) * sizeof(char*));
|
argv = (char**)SDL_malloc((num_params + 1) * sizeof(char*));
|
||||||
if(!argv)
|
if(!argv)
|
||||||
{
|
{
|
||||||
SDLTest_LogError("malloc() failed.");
|
SDLTest_LogError("SDL_malloc() failed.");
|
||||||
SDL_RWclose(rw);
|
SDL_RWclose(rw);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -355,4 +355,4 @@ SDLVisualTest_FreeHarnessState(SDLVisualTest_HarnessState* state)
|
||||||
SDLVisualTest_EmptyActionQueue(&state->action_queue);
|
SDLVisualTest_EmptyActionQueue(&state->action_queue);
|
||||||
SDLVisualTest_FreeSUTConfig(&state->sut_config);
|
SDLVisualTest_FreeSUTConfig(&state->sut_config);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,7 +96,7 @@ TokenizeHelper(char* str, char** tokens, int num_tokens, int max_token_len)
|
||||||
if(!tokens[index])
|
if(!tokens[index])
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
SDLTest_LogError("malloc() failed.");
|
SDLTest_LogError("SDL_malloc() failed.");
|
||||||
for(i = 0; i < index; i++)
|
for(i = 0; i < index; i++)
|
||||||
SDL_free(tokens[i]);
|
SDL_free(tokens[i]);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -215,7 +215,7 @@ SDLVisualTest_ParseArgsToArgv(char* args)
|
||||||
argv = (char**)SDL_malloc((num_tokens + 2) * sizeof(char*));
|
argv = (char**)SDL_malloc((num_tokens + 2) * sizeof(char*));
|
||||||
if(!argv)
|
if(!argv)
|
||||||
{
|
{
|
||||||
SDLTest_LogError("malloc() failed.");
|
SDLTest_LogError("SDL_malloc() failed.");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ SDLVisualTest_VerifyScreenshots(char* args, char* test_dir, char* verify_dir)
|
||||||
verify_path = (char*)SDL_malloc(verify_len * sizeof(char));
|
verify_path = (char*)SDL_malloc(verify_len * sizeof(char));
|
||||||
if(!verify_path)
|
if(!verify_path)
|
||||||
{
|
{
|
||||||
SDLTest_LogError("malloc() failed");
|
SDLTest_LogError("SDL_malloc() failed");
|
||||||
return_code = -1;
|
return_code = -1;
|
||||||
goto verifyscreenshots_cleanup_generic;
|
goto verifyscreenshots_cleanup_generic;
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ SDLVisualTest_VerifyScreenshots(char* args, char* test_dir, char* verify_dir)
|
||||||
test_path = (char*)SDL_malloc(test_len * sizeof(char));
|
test_path = (char*)SDL_malloc(test_len * sizeof(char));
|
||||||
if(!test_path)
|
if(!test_path)
|
||||||
{
|
{
|
||||||
SDLTest_LogError("malloc() failed");
|
SDLTest_LogError("SDL_malloc() failed");
|
||||||
return_code = -1;
|
return_code = -1;
|
||||||
goto verifyscreenshots_cleanup_verifybmp;
|
goto verifyscreenshots_cleanup_verifybmp;
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,7 @@ SDLVisualTest_ParseSUTConfig(char* file, SDLVisualTest_SUTConfig* config)
|
||||||
sizeof(SDLVisualTest_SUTOption));
|
sizeof(SDLVisualTest_SUTOption));
|
||||||
if(!config->options)
|
if(!config->options)
|
||||||
{
|
{
|
||||||
SDLTest_LogError("malloc() failed");
|
SDLTest_LogError("SDL_malloc() failed");
|
||||||
SDL_RWclose(rw);
|
SDL_RWclose(rw);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -189,7 +189,7 @@ SDLVisualTest_InitVariation(SDLVisualTest_Variation* variation,
|
||||||
sizeof(SDLVisualTest_SUTOptionValue));
|
sizeof(SDLVisualTest_SUTOptionValue));
|
||||||
if(!variation->vars)
|
if(!variation->vars)
|
||||||
{
|
{
|
||||||
SDLTest_LogError("malloc() failed");
|
SDLTest_LogError("SDL_malloc() failed");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
variation->num_vars = config->num_options;
|
variation->num_vars = config->num_options;
|
||||||
|
@ -222,4 +222,4 @@ SDLVisualTest_InitVariation(SDLVisualTest_Variation* variation,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,7 @@ SDL_LaunchProcess(char* file, char* args, SDL_ProcessInfo* pinfo)
|
||||||
working_directory = (char*)SDL_malloc(path_length + 1);
|
working_directory = (char*)SDL_malloc(path_length + 1);
|
||||||
if(!working_directory)
|
if(!working_directory)
|
||||||
{
|
{
|
||||||
SDLTest_LogError("Could not allocate working_directory - malloc() failed.");
|
SDLTest_LogError("Could not allocate working_directory - SDL_malloc() failed.");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ SDL_LaunchProcess(char* file, char* args, SDL_ProcessInfo* pinfo)
|
||||||
command_line = (char*)SDL_malloc(path_length + args_length + 2);
|
command_line = (char*)SDL_malloc(path_length + args_length + 2);
|
||||||
if(!command_line)
|
if(!command_line)
|
||||||
{
|
{
|
||||||
SDLTest_LogError("Could not allocate command_line - malloc() failed.");
|
SDLTest_LogError("Could not allocate command_line - SDL_malloc() failed.");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
SDL_memcpy(command_line, file, path_length);
|
SDL_memcpy(command_line, file, path_length);
|
||||||
|
|
|
@ -241,7 +241,7 @@ ScreenshotWindow(HWND hwnd, char* filename, SDL_bool only_client_area)
|
||||||
goto screenshotwindow_cleanup_capturebitmap;
|
goto screenshotwindow_cleanup_capturebitmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* free resources */
|
/* Free resources */
|
||||||
|
|
||||||
screenshotwindow_cleanup_capturebitmap:
|
screenshotwindow_cleanup_capturebitmap:
|
||||||
if(!DeleteObject(capturebitmap))
|
if(!DeleteObject(capturebitmap))
|
||||||
|
@ -297,7 +297,7 @@ ScreenshotHwnd(HWND hwnd, LPARAM lparam)
|
||||||
filename = (char*)SDL_malloc(len * sizeof(char));
|
filename = (char*)SDL_malloc(len * sizeof(char));
|
||||||
if(!filename)
|
if(!filename)
|
||||||
{
|
{
|
||||||
SDLTest_LogError("malloc() failed");
|
SDLTest_LogError("SDL_malloc() failed");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue