diff --git a/src/diskfile.cpp b/src/diskfile.cpp index 50ece580..4832aa7a 100644 --- a/src/diskfile.cpp +++ b/src/diskfile.cpp @@ -43,7 +43,7 @@ static char THIS_FILE[]=__FILE__; DiskFile::DiskFile(void) { - filename; + filename = ""; filesize = 0; offset = 0; @@ -112,8 +112,9 @@ bool DiskFile::Create(string _filename, u64 _filesize) if (filesize > 0) { // Seek to the end of the file - LONG lowoffset = ((LONG*)&filesize)[0]; - LONG highoffset = ((LONG*)&filesize)[1]; + LONG* ptrfilesize = (LONG*)&filesize; + LONG lowoffset = ptrfilesize[0]; + LONG highoffset = ptrfilesize[1]; if (INVALID_SET_FILE_POINTER == SetFilePointer(hFile, lowoffset, &highoffset, FILE_BEGIN)) { @@ -157,8 +158,9 @@ bool DiskFile::Write(u64 _offset, const void *buffer, size_t length) if (offset != _offset) { - LONG lowoffset = ((LONG*)&_offset)[0]; - LONG highoffset = ((LONG*)&_offset)[1]; + LONG* ptrfilesize = (LONG*)&filesize; + LONG lowoffset = ptrfilesize[0]; + LONG highoffset = ptrfilesize[1]; // Seek to the required offset if (INVALID_SET_FILE_POINTER == SetFilePointer(hFile, lowoffset, &highoffset, FILE_BEGIN)) @@ -242,8 +244,9 @@ bool DiskFile::Read(u64 _offset, void *buffer, size_t length) if (offset != _offset) { - LONG lowoffset = ((LONG*)&_offset)[0]; - LONG highoffset = ((LONG*)&_offset)[1]; + LONG* ptrfilesize = (LONG*)&filesize; + LONG lowoffset = ptrfilesize[0]; + LONG highoffset = ptrfilesize[1]; // Seek to the required offset if (INVALID_SET_FILE_POINTER == SetFilePointer(hFile, lowoffset, &highoffset, FILE_BEGIN)) @@ -297,7 +300,7 @@ string DiskFile::GetCanonicalPathname(string filename) char *filepart; // Resolve a relative path to a full path - int length = ::GetFullPathName(filename.c_str(), sizeof(fullname), fullname, &filepart); + unsigned int length = ::GetFullPathName(filename.c_str(), sizeof(fullname), fullname, &filepart); if (length <= 0 || sizeof(fullname) < length) return filename; @@ -1073,7 +1076,7 @@ string DiskFile::ErrorMessage(DWORD error) else { char message[40]; - snprintf(message, sizeof(message), "Unknown error code (%d)", error); + snprintf(message, sizeof(message), "Unknown error code (%lu)", error); result = message; } diff --git a/src/par2cmdline.h b/src/par2cmdline.h index 12c96ecd..119e490f 100644 --- a/src/par2cmdline.h +++ b/src/par2cmdline.h @@ -52,8 +52,8 @@ typedef unsigned char u8; typedef signed char i8; typedef unsigned short u16; typedef signed short i16; -typedef unsigned long u32; -typedef signed long i32; +typedef unsigned int u32; +typedef signed int i32; typedef unsigned __int64 u64; typedef signed __int64 i64;