Changeset View
Changeset View
Standalone View
Standalone View
source/graphics/TextureConverter.cpp
/* Copyright (C) 2015 Wildfire Games. | /* Copyright (C) 2019 Wildfire Games. | ||||
elexis: Do you happen to know which return value is triggered for you precisely?
Relevant definitions… | |||||
Done Inline Actions
I can't remember it - and at the moment I also can't reproduce it..
Originally it wasn't. I just made it more "sensitive" to find all possible sources. Now I'm not sure as I can't remember which status actually got returned LukeV1: > Do you happen to know which return value is triggered for you precisely?
I can't remember it… | |||||
Not Done Inline ActionsThe return value is 1 LukeV1: **The return value is `1`** | |||||
Not Done Inline Actionsshould this set ok = true? Actually it looks like ok is uninitialized elexis: should this set `ok = true`?
Actually it looks like `ok` is **uninitialized** | |||||
Done Inline ActionsIf the return value is false ok doesn't get used by the caller - so it doesn't necessarily needs to be set.. LukeV1: If the return value is false ok doesn't get used by the caller - so it doesn't necessarily… | |||||
* This file is part of 0 A.D. | * This file is part of 0 A.D. | ||||
* | * | ||||
* 0 A.D. is free software: you can redistribute it and/or modify | * 0 A.D. is free software: you can redistribute it and/or modify | ||||
* it under the terms of the GNU General Public License as published by | * it under the terms of the GNU General Public License as published by | ||||
* the Free Software Foundation, either version 2 of the License, or | * the Free Software Foundation, either version 2 of the License, or | ||||
* (at your option) any later version. | * (at your option) any later version. | ||||
* | * | ||||
* 0 A.D. is distributed in the hope that it will be useful, | * 0 A.D. is distributed in the hope that it will be useful, | ||||
▲ Show 20 Lines • Show All 495 Lines • ▼ Show 20 Lines | if (!result->ret) | ||||
return true; | return true; | ||||
} | } | ||||
// Move output into a correctly-aligned buffer | // Move output into a correctly-aligned buffer | ||||
size_t size = result->output.buffer.size(); | size_t size = result->output.buffer.size(); | ||||
shared_ptr<u8> file; | shared_ptr<u8> file; | ||||
AllocateAligned(file, size, maxSectorSize); | AllocateAligned(file, size, maxSectorSize); | ||||
memcpy(file.get(), &result->output.buffer[0], size); | memcpy(file.get(), &result->output.buffer[0], size); | ||||
if (m_VFS->CreateFile(result->dest, file, size) < 0) | if (m_VFS->CreateFile(result->dest, file, size) != INFO::OK) | ||||
{ | { | ||||
// error writing file | // error writing file | ||||
ok = false; | ok = false; | ||||
return true; | return true; | ||||
} | } | ||||
// Succeeded in converting texture | // Succeeded in converting texture | ||||
texture = result->texture; | texture = result->texture; | ||||
▲ Show 20 Lines • Show All 85 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
Do you happen to know which return value is triggered for you precisely?
Relevant definitions in vfs.cpp and status.h.
Errors are negative, INFO::OK is 0,
INFO::SKIPPED, INFO::CANNOT_HANDLE, INFO::ALL_COMPLETE are positive.
INFO::SKIPPED is returned from AddFileOrMemory from archive_zip.cpp which is called from AddFile, which is called from CreateFile.
It's triggered for 0 sizes.
But I think this shouldn't happen, because it doesnt write to a zip file.
INFO::ALL_COMPLETE is called from the zip_reader on LoadFile.
This is called from `CTextureConverter::ConvertTexture.
if (m_VFS->LoadFile(src, file, fileSize) < 0) in L312.
But there it is actually correct I suppose.
And LoadFile is not called from CreateFile, so its not the return value here.
INFO::CANNOT_HANDLE only happens when reading a zip file but not being able to locate the dictionary, which I suppose is also not happening here, since it caches a png file for svn.
Well which of the three is it? Or is this change cleanup not strictly necessary to fix the reported issue?