Skip to content

Commit

Permalink
Fix compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
slime73 committed Feb 5, 2024
1 parent d528233 commit 8d73622
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/modules/filesystem/physfs/PhysfsIo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ int64 StripSuffixIo::seek(uint64 offset)
PHYSFS_setErrorCode(PHYSFS_ERR_OS_ERROR);
return 0;
}
bool success = file->seek(offset);
bool success = file->seek(offset, Stream::SEEKORIGIN_BEGIN);
PHYSFS_setErrorCode(success ? PHYSFS_ERR_OK : PHYSFS_ERR_OS_ERROR);
return success ? 1 : 0;
}
Expand Down
17 changes: 4 additions & 13 deletions src/modules/filesystem/physfs/PhysfsIo.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

#include "libraries/physfs/physfs.h"
#include "common/int.h"
#include "filesystem/DroppedFile.h"
#include "filesystem/NativeFile.h"

#include <string>

Expand Down Expand Up @@ -119,7 +119,7 @@ struct StripSuffixIo : public PhysfsIo<StripSuffixIo>
static const uint32 version = 0;

std::string filename;
DroppedFile *file = nullptr;
NativeFile *file = nullptr;

// The constructor is private in favor of this function to prevent stack allocation
// because Physfs will take ownership of this object and call destroy on it later.
Expand Down Expand Up @@ -151,23 +151,14 @@ struct StripSuffixIo : public PhysfsIo<StripSuffixIo>

StripSuffixIo(const std::string &f)
: filename(f)
, file(new DroppedFile(f))
, file(nullptr)
{
bool success = false;

try
{
success = file->open(File::MODE_READ);
file = new NativeFile(f, File::MODE_READ);
}
catch (love::Exception &)
{
success = false;
}

if (!success)
{
file->release();
file = nullptr;
}
}

Expand Down

0 comments on commit 8d73622

Please sign in to comment.