diff --git a/src/Audio.c b/src/Audio.c index 1c8e788de..1325c3e2e 100644 --- a/src/Audio.c +++ b/src/Audio.c @@ -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) { diff --git a/src/Formats.c b/src/Formats.c index 3feed7739..750bb7428 100644 --- a/src/Formats.c +++ b/src/Formats.c @@ -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(); diff --git a/src/Launcher.c b/src/Launcher.c index d24eac962..66dcaff3e 100644 --- a/src/Launcher.c +++ b/src/Launcher.c @@ -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) { diff --git a/src/TexturePack.c b/src/TexturePack.c index f1863e67f..57b3b91c7 100644 --- a/src/TexturePack.c +++ b/src/TexturePack.c @@ -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); } } diff --git a/src/Utils.c b/src/Utils.c index c2b9bd22f..245504aeb 100644 --- a/src/Utils.c +++ b/src/Utils.c @@ -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; }