]> git.sesse.net Git - vlc/commitdiff
* src/misc/modules.c, modules/access/directory.c: Win32 fixes (GetFileAttributes...
authorGildas Bazin <gbazin@videolan.org>
Mon, 21 Feb 2005 17:50:54 +0000 (17:50 +0000)
committerGildas Bazin <gbazin@videolan.org>
Mon, 21 Feb 2005 17:50:54 +0000 (17:50 +0000)
modules/access/directory.c
src/misc/modules.c

index b258abe5a7926054644b861893d64c2d50cff760..64475e7eec2b125000ee84333b00111ec09e990e 100644 (file)
@@ -129,15 +129,19 @@ static int Open( vlc_object_t *p_this )
         !S_ISDIR( stat_info.st_mode ) )
 
 #elif defined(WIN32)
+    int i_ret;
+
 #   ifdef UNICODE
-    wchar_t pwsz_path[MAX_PATH];
-    mbstowcs( pwsz_path, p_access->psz_path, MAX_PATH );
-    pwsz_path[MAX_PATH-1] = 0;
-    if( !(GetFileAttributes( pwsz_path ) & FILE_ATTRIBUTE_DIRECTORY) )
+    wchar_t psz_path[MAX_PATH];
+    mbstowcs( psz_path, p_access->psz_path, MAX_PATH );
+    psz_path[MAX_PATH-1] = 0;
 #   else
-    if( !(GetFileAttributes( p_access->psz_path ) & FILE_ATTRIBUTE_DIRECTORY) )
+    char *psz_path = p_access->psz_path;
 #   endif
 
+    i_ret = GetFileAttributes( psz_path );
+    if( i_ret == -1 || !(i_ret & FILE_ATTRIBUTE_DIRECTORY) )
+
 #else
     if( strcmp( p_access->psz_access, "dir") &&
         strcmp( p_access->psz_access, "directory") )
index c3f62f921decf1ac0579e93800a01906501a0282..3e04dd4a8952dcced465d94f48472039316ac950 100644 (file)
@@ -820,7 +820,7 @@ static void AllocatePluginDir( vlc_object_t *p_this, const char *psz_dir,
     char psz_path[MAX_PATH + 256];
     WIN32_FIND_DATA finddata;
     HANDLE handle;
-    unsigned int rc;
+    int rc;
 #else
     int    i_dirlen;
     DIR *  dir;
@@ -838,13 +838,13 @@ static void AllocatePluginDir( vlc_object_t *p_this, const char *psz_dir,
     MultiByteToWideChar( CP_ACP, 0, psz_dir, -1, psz_wdir, MAX_PATH );
 
     rc = GetFileAttributes( psz_wdir );
-    if( !(rc & FILE_ATTRIBUTE_DIRECTORY) ) return; /* Not a directory */
+    if( rc<0 || !(rc&FILE_ATTRIBUTE_DIRECTORY) ) return; /* Not a directory */
 
     /* Parse all files in the directory */
     swprintf( psz_wpath, L"%ls\\*", psz_wdir );
 #else
     rc = GetFileAttributes( psz_dir );
-    if( !(rc & FILE_ATTRIBUTE_DIRECTORY) ) return; /* Not a directory */
+    if( rc<0 || !(rc&FILE_ATTRIBUTE_DIRECTORY) ) return; /* Not a directory */
 #endif
 
     /* Parse all files in the directory */