Commits

Oleg Oshmyan  committed 013cd44

Make file size variables 64 bits wide also on Win32

  • Participants
  • Parent commits b1d040c

Comments (0)

Files changed (4)

File src/nsimage.mm

 		}
 	}
 	
-	off_t pic_file_size = findFileSize(filePath);
+	uint64_t pic_file_size = findFileSize(filePath);
 	if ( ( (int)pic_file_size > myPicPrefs.max_Kbytes) && ( myPicPrefs.max_Kbytes != 0) ) {
 		resize = true;
 	}

File src/parsley.cpp

 void APar_MetaData_atomLyrics_Set(const char* lyricsPath) {
 	if (metadata_style == ITUNES_STYLE) {
 		TestFileExistence(lyricsPath, true);
-		off_t file_len = findFileSize(lyricsPath);
+		uint64_t file_len = findFileSize(lyricsPath);
 
 		APar_Verify__udta_meta_hdlr__atom();
 		modified_atoms = true;
 		APar_MetaData_atom_QuickInit(lyricsData_atom->AtomicNumber, AtomFlags_Data_Text, 0, file_len + 1);
 
 		FILE* lyrics_file = APar_OpenFile(lyricsPath, "rb");
-		off_t remaining = file_len;
+		uint64_t remaining = file_len;
 		char* dest = lyricsData_atom->AtomicData + 4;
 		char* sol;
 		while (remaining && (sol = fgets(dest, remaining + 1, lyrics_file))) {
 ----------------------*/
 void APar_MetaData_atomArtwork_Init(short atom_num, const char* artworkPath) {
 	TestFileExistence(artworkPath, true);
-	off_t picture_size = findFileSize(artworkPath);
+	uint64_t picture_size = findFileSize(artworkPath);
 
 	if (picture_size > 0) {
 		APar_MetaData_atom_QuickInit(atom_num, APar_TestArtworkBinaryData(artworkPath), 0, picture_size );

File src/util.cpp

 		AP is running on a unicode enabled Win32 OS. If it is and converted to utf8 (rather than just stripped), convert the utf8 filepath to a utf16 
 		(native-endian) filepath & pass that to a wide stat. Or stat it with a utf8 filepath on Unixen & win32 (stripped utf8).
 ----------------------*/
-off_t findFileSize(const char *utf8_filepath) {
+uint64_t findFileSize(const char *utf8_filepath) {
 #if defined (_WIN32) && !defined (__CYGWIN__)
 	if ( IsUnicodeWinOS() && UnicodeOutputStatus == WIN32_UTF16) {
 		wchar_t* utf16_filepath = Convert_multibyteUTF8_to_wchar(utf8_filepath);
 		
 		struct _stat fileStats;
-		_wstat(utf16_filepath, &fileStats);
+		_wstati64(utf16_filepath, &fileStats);
 		
 		free(utf16_filepath);
 		utf16_filepath = NULL;
 
 #define MAXTIME_32 6377812095ULL
 
-off_t findFileSize(const char *utf8_filepath);
+uint64_t findFileSize(const char *utf8_filepath);
 FILE* APar_OpenFile(const char* utf8_filepath, const char* file_flags);
 FILE* APar_OpenISOBaseMediaFile(const char* file, bool open); //openSomeFile
 void TestFileExistence(const char *filePath, bool errorOut);