PKGBUILDs/aur/par2cmdline/01-Use-_stati64-under-WIN32-to-get-file-size.patch
2011-06-09 17:56:14 -04:00

59 lines
1.3 KiB
Diff

--- a/diskfile.cpp
+++ b/diskfile.cpp
@@ -340,7 +340,18 @@ list<string>* DiskFile::FindFiles(string path, string wildcard)
return matches;
}
-
+u64 DiskFile::GetFileSize(string filename)
+{
+ struct _stati64 st;
+ if ((0 == _stati64(filename.c_str(), &st)) && (0 != (st.st_mode & S_IFREG)))
+ {
+ return st.st_size;
+ }
+ else
+ {
+ return 0;
+ }
+}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -689,6 +700,18 @@ list<string>* DiskFile::FindFiles(string path, string wildcard)
return matches;
}
+u64 DiskFile::GetFileSize(string filename)
+{
+ struct stat st;
+ if ((0 == stat(filename.c_str(), &st)) && (0 != (st.st_mode & S_IFREG)))
+ {
+ return st.st_size;
+ }
+ else
+ {
+ return 0;
+ }
+}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#endif
@@ -802,18 +825,6 @@ bool DiskFile::FileExists(string filename)
return ((0 == stat(filename.c_str(), &st)) && (0 != (st.st_mode & S_IFREG)));
}
-u64 DiskFile::GetFileSize(string filename)
-{
- struct stat st;
- if ((0 == stat(filename.c_str(), &st)) && (0 != (st.st_mode & S_IFREG)))
- {
- return st.st_size;
- }
- else
- {
- return 0;
- }
-}