]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/filename.cpp
applied patch 1683441
[wxWidgets.git] / src / common / filename.cpp
index e8c8fda9437037878e91f6db2a762c17b83ae914..3c5764a6bb7a4b0061ef60eaba6fdf15ae929f2d 100644 (file)
@@ -175,9 +175,12 @@ public:
 
         if ( m_hFile == INVALID_HANDLE_VALUE )
         {
-            wxLogSysError(_("Failed to open '%s' for %s"),
-                          filename.c_str(),
-                          mode == Read ? _("reading") : _("writing"));
+            if ( mode == Read )
+                wxLogSysError(_("Failed to open '%s' for reading"),
+                              filename.c_str());
+            else
+                wxLogSysError(_("Failed to open '%s' for writing"),
+                              filename.c_str());
         }
     }
 
@@ -2328,14 +2331,11 @@ wxULongLong wxFileName::GetSize(const wxString &filename)
 
     DWORD lpFileSizeHigh;
     DWORD ret = GetFileSize(f, &lpFileSizeHigh);
-    if (ret == INVALID_FILE_SIZE)
+    if ( ret == INVALID_FILE_SIZE && ::GetLastError() != NO_ERROR )
         return wxInvalidSize;
 
-    // compose the low-order and high-order byte sizes
-    return wxULongLong(ret | (lpFileSizeHigh << sizeof(WORD)*2));
-
-#else           // ! __WIN32__
-
+    return wxULongLong(lpFileSizeHigh, ret);
+#else // ! __WIN32__
     wxStructStat st;
 #ifndef wxNEED_WX_UNISTD_H
     if (wxStat( filename.fn_str() , &st) != 0)