mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-02 05:27:41 -05:00
fix: Project file creation issues
This commit is contained in:
35
lib/external/microtar/source/microtar.c
vendored
35
lib/external/microtar/source/microtar.c
vendored
@@ -207,41 +207,6 @@ int mtar_open(mtar_t *tar, const char *filename, const char *mode) {
|
||||
return MTAR_ESUCCESS;
|
||||
}
|
||||
|
||||
#if defined (_WIN32)
|
||||
int mtar_wopen(mtar_t *tar, const wchar_t *filename, const wchar_t *mode) {
|
||||
int err;
|
||||
mtar_header_t h;
|
||||
|
||||
/* Init tar struct and functions */
|
||||
memset(tar, 0, sizeof(*tar));
|
||||
tar->write = file_write;
|
||||
tar->read = file_read;
|
||||
tar->seek = file_seek;
|
||||
tar->close = file_close;
|
||||
|
||||
/* Assure mode is always binary */
|
||||
if ( filename[0] == L'r' ) mode = L"rb";
|
||||
if ( filename[0] == L'w' ) mode = L"wb";
|
||||
if ( filename[0] == L'a' ) mode = L"ab";
|
||||
/* Open file */
|
||||
tar->stream = _wfopen(filename, mode);
|
||||
if (!tar->stream) {
|
||||
return MTAR_EOPENFAIL;
|
||||
}
|
||||
/* Read first header to check it is valid if mode is `r` */
|
||||
if (*mode == L'r') {
|
||||
err = mtar_read_header(tar, &h);
|
||||
if (err != MTAR_ESUCCESS) {
|
||||
mtar_close(tar);
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
||||
/* Return ok */
|
||||
return MTAR_ESUCCESS;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
int mtar_close(mtar_t *tar) {
|
||||
return tar->close(tar);
|
||||
|
||||
Reference in New Issue
Block a user