Codechange: replace error/usererror printf variant with fmt variant and rename

This commit is contained in:
Rubidium
2023-04-19 22:47:36 +02:00
committed by rubidium42
parent 43c65a3fec
commit f74e26ca7e
39 changed files with 176 additions and 131 deletions

View File

@@ -11,6 +11,7 @@
#include "random_access_file_type.h"
#include "debug.h"
#include "error_func.h"
#include "fileio_func.h"
#include "string_func.h"
@@ -24,11 +25,11 @@
RandomAccessFile::RandomAccessFile(const std::string &filename, Subdirectory subdir) : filename(filename)
{
this->file_handle = FioFOpenFile(filename, "rb", subdir);
if (this->file_handle == nullptr) usererror("Cannot open file '%s'", filename.c_str());
if (this->file_handle == nullptr) UserError("Cannot open file '{}'", filename);
/* When files are in a tar-file, the begin of the file might not be at 0. */
long pos = ftell(this->file_handle);
if (pos < 0) usererror("Cannot read file '%s'", filename.c_str());
if (pos < 0) UserError("Cannot read file '{}'", filename);
/* Store the filename without path and extension */
auto t = filename.rfind(PATHSEPCHAR);