Don't bother logging errors for closing readonly files

This commit is contained in:
UnknownShadow200 2021-11-21 17:55:35 +11:00
parent 84356f0847
commit a761f2718b
5 changed files with 13 additions and 11 deletions

View File

@ -925,9 +925,10 @@ static cc_result Sound_ReadWave(const cc_string* path, struct Sound* snd) {
res = Stream_OpenFile(&stream, path);
if (res) return res;
res = Sound_ReadWaveData(&stream, snd);
if (res) { stream.Close(&stream); return res; }
return stream.Close(&stream);
/* No point logging error for closing readonly file */
(void)stream.Close(&stream);
return res;
}
static struct SoundGroup* Soundboard_Find(struct Soundboard* board, const cc_string* name) {

View File

@ -71,8 +71,8 @@ void Map_LoadFrom(const cc_string* path) {
Logger_SysWarn2(res, "decoding", path);
}
res = stream.Close(&stream);
if (res) { Logger_SysWarn2(res, "closing", path); }
/* No point logging error for closing readonly file */
stream.Close(&stream);
World_SetNewMap(World.Blocks, World.Width, World.Height, World.Length);
LocalPlayer_MoveToSpawn();

View File

@ -466,7 +466,8 @@ static void ExtractTexturePack(const cc_string* path) {
res = Zip_Extract(&state);
if (res) { Logger_SysWarn(res, "extracting texture pack"); }
stream.Close(&stream);
/* No point logging error for closing readonly file */
(void)stream.Close(&stream);
}
void Launcher_TryLoadTexturePack(void) {

View File

@ -349,8 +349,8 @@ static void ExtractFromFile(const cc_string* filename) {
}
ExtractFrom(&stream, &path);
res = stream.Close(&stream);
if (res) { Logger_SysWarn2(res, "closing", &path); }
/* No point logging error for closing readonly file */
(void)stream.Close(&stream);
}
static void ExtractDefault(void) {
@ -377,8 +377,8 @@ void TexturePack_ExtractCurrent(cc_bool forceReload) {
ExtractFrom(&stream, &url);
usingDefault = false;
res = stream.Close(&stream);
if (res) Logger_SysWarn2(res, "closing cache for", &url);
/* No point logging error for closing readonly file */
(void)stream.Close(&stream);
}
}

View File

@ -264,8 +264,8 @@ cc_result EntryList_Load(struct StringsBuffer* list, const char* file, char sepa
}
}
res = stream.Close(&stream);
if (res) { Logger_SysWarn2(res, "closing", &path); }
/* No point logging error for closing readonly file */
(void)stream.Close(&stream);
return res;
}