Skip to content

Commit

Permalink
Merge pull request #107 from Parchive/windows
Browse files Browse the repository at this point in the history
Windows
  • Loading branch information
BlackIkeEagle authored Jun 3, 2017
2 parents 3fda427 + 1713190 commit c582fbc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
21 changes: 12 additions & 9 deletions src/diskfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ static char THIS_FILE[]=__FILE__;

DiskFile::DiskFile(void)
{
filename;
filename = "";
filesize = 0;
offset = 0;

Expand Down Expand Up @@ -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))
{
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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;
}

Expand Down
4 changes: 2 additions & 2 deletions src/par2cmdline.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit c582fbc

Please sign in to comment.