changeset 34093:b37fbbc09921

Simplify building filename by using strcpy(). Additionally, don't add filespec if it's empty.
author ib
date Thu, 06 Oct 2011 12:21:46 +0000
parents dbf5042ab255
children c366199552d1
files gui/win32/dialogs.c
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/gui/win32/dialogs.c	Thu Oct 06 12:09:05 2011 +0000
+++ b/gui/win32/dialogs.c	Thu Oct 06 12:21:46 2011 +0000
@@ -127,10 +127,13 @@
         do
         {
             filespec = &fileopen.lpstrFile[fileopen.nFileOffset];
-            filename[0] = 0;
-            strcat(filename, directory);
+            strcpy(filename, directory);
+
+            if (*filespec)
+            {
             strcat(filename, "/");
             strcat(filename, filespec);
+            }
 
             if (GetFileAttributes(filename) & FILE_ATTRIBUTE_DIRECTORY)
                 mp_msg(MSGT_GPLAYER, MSGL_V, "[GUI] %s is a directory, skipping...\n", filename);