Current News
Archived News
Search News
Discussion Forum


Old Forum
Install Programs More Downloads...
Troubleshooting
Source Code
Format Specs.
Misc. Information
Non-SF Stuff
Links




ShadowFlare [Wed, 16 Jan 2013 05:49:30 +0000 (22:49 -0700)]
SFmpqapi.cpp [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index faf2701..56cca21
@@ -1136,21 +1136,18 @@ DWORD SFMPQAPI WINAPI SFileSetFilePointer(MPQHANDLE hFile, LONG lDistanceToMove,
                long fsz = mpqOpenFile->lpBlockEntry->dwFullSize;
                long cpos = mpqOpenFile->dwFilePointer;
                switch (dwMoveMethod) {
-               case FILE_BEGIN:
-                       if (lDistanceToMove<0 || lDistanceToMove>fsz) return (DWORD)-1;
-                       mpqOpenFile->dwFilePointer = lDistanceToMove;
-                       break;
                case FILE_CURRENT:
-                       if (lDistanceToMove<cpos || cpos+lDistanceToMove>fsz) return (DWORD)-1;
+                       if (cpos + lDistanceToMove < 0 || cpos + lDistanceToMove > fsz) return (DWORD)-1;
                        mpqOpenFile->dwFilePointer += lDistanceToMove;
                        break;
 
                case FILE_END:
-                       if (lDistanceToMove<fsz || lDistanceToMove>0) return (DWORD)-1;
-                       mpqOpenFile->dwFilePointer = fsz+lDistanceToMove;
+                       if (fsz + lDistanceToMove < 0 || lDistanceToMove > 0) return (DWORD)-1;
+                       mpqOpenFile->dwFilePointer = fsz + lDistanceToMove;
                        break;
+               case FILE_BEGIN:
                default:
-                       if (lDistanceToMove<0 || lDistanceToMove>fsz) return (DWORD)-1;
+                       if (lDistanceToMove < 0 || lDistanceToMove > fsz) return (DWORD)-1;
                        mpqOpenFile->dwFilePointer = lDistanceToMove;
                }
                if (lplDistanceToMoveHigh!=0) *lplDistanceToMoveHigh = 0;