Error report in SDL 1.2.x Win32 Drag&Drop handling

This commit is contained in:
Thomas Bernard 2019-01-22 12:09:53 +01:00
parent 5377b8c9fe
commit 1b43b58fdd
No known key found for this signature in database
GPG Key ID: 0FF11B67A5C0863C

View File

@ -1383,16 +1383,16 @@ int Get_input(int sleep_time)
{ {
long len; long len;
// Query filename length // Query filename length
len = DragQueryFile(hdrop,0 ,NULL ,0); len = DragQueryFile(hdrop, 0, NULL, 0);
if (len) if (len)
{ {
Drop_file_name=calloc(len+1,1); Drop_file_name = calloc(len+1, 1);
if (Drop_file_name) if (Drop_file_name)
{ {
#ifdef UNICODE #ifdef UNICODE
TCHAR LongDropFileName[MAX_PATH]; TCHAR LongDropFileName[MAX_PATH];
TCHAR ShortDropFileName[MAX_PATH]; TCHAR ShortDropFileName[MAX_PATH];
if (DragQueryFile(hdrop, 0 , LongDropFileName ,(UINT) MAX_PATH) if (DragQueryFile(hdrop, 0, LongDropFileName, (UINT)MAX_PATH)
&& GetShortPathName(LongDropFileName, ShortDropFileName, MAX_PATH)) && GetShortPathName(LongDropFileName, ShortDropFileName, MAX_PATH))
{ {
int i; int i;
@ -1401,7 +1401,7 @@ int Get_input(int sleep_time)
Drop_file_name[i] = 0; Drop_file_name[i] = 0;
} }
#else #else
if (DragQueryFile(hdrop,0 ,(LPTSTR) Drop_file_name ,(UINT) MAX_PATH)) if (DragQueryFile(hdrop, 0, (LPTSTR)Drop_file_name, (UINT)MAX_PATH))
{ {
// Success // Success
} }
@ -1409,12 +1409,12 @@ int Get_input(int sleep_time)
else else
{ {
free(Drop_file_name); free(Drop_file_name);
// Don't report name copy error GFX2_Log(GFX2_ERROR, "Failed to get Drag filename\n");
} }
} }
else else
{ {
// Don't report alloc error (for a file name? :/ ) GFX2_Log(GFX2_ERROR, "Failed to allocate %ld bytes\n", len + 1);
} }
} }
else else