mirror of
https://github.com/kevinbentley/Descent3.git
synced 2025-01-22 11:28:56 +00:00
Convert cfile to use new logging facility
This commit is contained in:
parent
c76637d97f
commit
9d2aaf12f2
@ -13,6 +13,7 @@ target_link_libraries(cfile PRIVATE
|
|||||||
ddio
|
ddio
|
||||||
mem
|
mem
|
||||||
misc
|
misc
|
||||||
|
plog::plog
|
||||||
)
|
)
|
||||||
target_include_directories(cfile PUBLIC
|
target_include_directories(cfile PUBLIC
|
||||||
$<BUILD_INTERFACE:
|
$<BUILD_INTERFACE:
|
||||||
|
@ -29,12 +29,13 @@
|
|||||||
|
|
||||||
#include "byteswap.h"
|
#include "byteswap.h"
|
||||||
#include "crossplat.h"
|
#include "crossplat.h"
|
||||||
#include "pserror.h"
|
|
||||||
#include "ddio.h"
|
|
||||||
#include "psglob.h"
|
|
||||||
#include "cfile.h"
|
#include "cfile.h"
|
||||||
|
#include "ddio.h"
|
||||||
#include "hogfile.h" //info about library file
|
#include "hogfile.h" //info about library file
|
||||||
|
#include "log.h"
|
||||||
#include "mem.h"
|
#include "mem.h"
|
||||||
|
#include "pserror.h"
|
||||||
|
#include "psglob.h"
|
||||||
|
|
||||||
// Library structures
|
// Library structures
|
||||||
struct library_entry {
|
struct library_entry {
|
||||||
@ -275,8 +276,8 @@ CFILE *cf_OpenFileInLibrary(const std::filesystem::path &filename, int libhandle
|
|||||||
} else {
|
} else {
|
||||||
fp = fopen(lib->name.u8string().c_str(), "rb");
|
fp = fopen(lib->name.u8string().c_str(), "rb");
|
||||||
if (!fp) {
|
if (!fp) {
|
||||||
mprintf(1, "Error opening library <%s> when opening file <%s>; errno=%d.",
|
LOG_ERROR.printf("Error opening library <%s> when opening file <%s>; errno=%d.",
|
||||||
lib->name.u8string().c_str(), filename.u8string().c_str(), errno);
|
lib->name.u8string().c_str(), filename.u8string().c_str(), errno);
|
||||||
Int3();
|
Int3();
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@ -328,8 +329,8 @@ CFILE *open_file_in_lib(const char *filename) {
|
|||||||
} else {
|
} else {
|
||||||
fp = fopen(lib->name.u8string().c_str(), "rb");
|
fp = fopen(lib->name.u8string().c_str(), "rb");
|
||||||
if (!fp) {
|
if (!fp) {
|
||||||
mprintf(1, "Error opening library <%s> when opening file <%s>; errno=%d.", lib->name.u8string().c_str(),
|
LOG_ERROR.printf("Error opening library <%s> when opening file <%s>; errno=%d.",
|
||||||
filename, errno);
|
lib->name.u8string().c_str(), filename, errno);
|
||||||
Int3();
|
Int3();
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@ -657,7 +658,8 @@ int cf_ReadBytes(uint8_t *buf, int count, CFILE *cfp) {
|
|||||||
if (!feof(cfp->file))
|
if (!feof(cfp->file))
|
||||||
error_msg = strerror(errno);
|
error_msg = strerror(errno);
|
||||||
}
|
}
|
||||||
mprintf(1, "Error reading %d bytes from position %d of file <%s>; errno=%d.", count, cfp->position, cfp->name, errno);
|
LOG_ERROR.printf("Error reading %d bytes from position %d of file <%s>; errno=%d.",
|
||||||
|
count, cfp->position, cfp->name, errno);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
// The following functions read numeric vales from a CFILE. All values are
|
// The following functions read numeric vales from a CFILE. All values are
|
||||||
|
Loading…
Reference in New Issue
Block a user