[nostalgia] Remove nodiscards from Error and ValErr functions

This commit is contained in:
Gary Talent 2020-10-15 23:58:49 -05:00
parent 75814a2896
commit d2eea8c2ec
6 changed files with 17 additions and 17 deletions

View File

@ -18,9 +18,9 @@ namespace nostalgia::core {
using event_handler = int(*)(Context*); using event_handler = int(*)(Context*);
[[nodiscard]] ox::Error init(Context *ctx); ox::Error init(Context *ctx);
[[nodiscard]] ox::Error run(Context *ctx); ox::Error run(Context *ctx);
// Sets event handler that sleeps for the time given in the return value. The // Sets event handler that sleeps for the time given in the return value. The
// sleep time is a minimum of ~16 milliseconds. // sleep time is a minimum of ~16 milliseconds.

View File

@ -66,18 +66,18 @@ ox::Error model(T *io, NostalgiaGraphic *ng) {
return OxError(0); return OxError(0);
} }
[[nodiscard]] ox::Error initGfx(Context *ctx); ox::Error initGfx(Context *ctx);
[[nodiscard]] ox::Error shutdownGfx(Context*); ox::Error shutdownGfx(Context*);
[[nodiscard]] ox::Error initConsole(Context *ctx); ox::Error initConsole(Context *ctx);
/** /**
* @param section describes which section of the selected TileSheetSpace to use (e.g. MEM_PALLETE_BG[section]) * @param section describes which section of the selected TileSheetSpace to use (e.g. MEM_PALLETE_BG[section])
*/ */
[[nodiscard]] ox::Error loadBgTileSheet(Context *ctx, int section, ox::FileAddress tilesheet, ox::FileAddress palette = nullptr); ox::Error loadBgTileSheet(Context *ctx, int section, ox::FileAddress tilesheet, ox::FileAddress palette = nullptr);
[[nodiscard]] ox::Error loadSpriteTileSheet(Context *ctx, ox::Error loadSpriteTileSheet(Context *ctx,
int section, int section,
ox::FileAddress tilesheetAddr, ox::FileAddress tilesheetAddr,
ox::FileAddress paletteAddr); ox::FileAddress paletteAddr);

View File

@ -33,7 +33,7 @@ struct SdlImplData {
constexpr auto Scale = 5; constexpr auto Scale = 5;
[[nodiscard]] static ox::ValErr<ox::Vector<char>> readFile(Context *ctx, const ox::FileAddress &file) { static ox::ValErr<ox::Vector<char>> readFile(Context *ctx, const ox::FileAddress &file) {
auto [stat, err] = ctx->rom->stat(file); auto [stat, err] = ctx->rom->stat(file);
oxReturnError(err); oxReturnError(err);
ox::Vector<char> buff(stat.size); ox::Vector<char> buff(stat.size);
@ -42,7 +42,7 @@ constexpr auto Scale = 5;
} }
template<typename T> template<typename T>
[[nodiscard]] ox::ValErr<T> readObj(Context *ctx, const ox::FileAddress &file) { ox::ValErr<T> readObj(Context *ctx, const ox::FileAddress &file) {
auto [buff, err] = readFile(ctx, file); auto [buff, err] = readFile(ctx, file);
oxReturnError(err); oxReturnError(err);
T t; T t;

View File

@ -18,7 +18,7 @@
namespace nostalgia::core { namespace nostalgia::core {
template<typename T> template<typename T>
[[nodiscard]] ox::ValErr<std::vector<uint8_t>> toBuffer(T *data, std::size_t buffSize = ox::units::MB) { ox::ValErr<std::vector<uint8_t>> toBuffer(T *data, std::size_t buffSize = ox::units::MB) {
std::vector<uint8_t> buff(buffSize); std::vector<uint8_t> buff(buffSize);
std::size_t sz = 0; std::size_t sz = 0;
oxReturnError(ox::writeMC(buff.data(), buff.size(), data, &sz)); oxReturnError(ox::writeMC(buff.data(), buff.size(), data, &sz));

View File

@ -32,12 +32,12 @@ static_assert(!endsWith("asdf", "eu"));
* @return error * @return error
* stub for now * stub for now
*/ */
[[nodiscard]] ox::Error pathToInode(std::vector<uint8_t>*) { ox::Error pathToInode(std::vector<uint8_t>*) {
return OxError(0); return OxError(0);
} }
// stub for now // stub for now
[[nodiscard]] ox::Error toMetalClaw(std::vector<uint8_t> *buff) { ox::Error toMetalClaw(std::vector<uint8_t> *buff) {
auto [mc, err] = ox::stripClawHeader(ox::bit_cast<char*>(buff->data()), buff->size()); auto [mc, err] = ox::stripClawHeader(ox::bit_cast<char*>(buff->data()), buff->size());
oxReturnError(err); oxReturnError(err);
buff->resize(mc.size()); buff->resize(mc.size());
@ -47,7 +47,7 @@ static_assert(!endsWith("asdf", "eu"));
// claw file transformations are broken out because path to inode // claw file transformations are broken out because path to inode
// transformations need to be done after the copy to the new FS is complete // transformations need to be done after the copy to the new FS is complete
[[nodiscard]] ox::Error transformClaw(ox::FileSystem32 *dest, std::string path) { ox::Error transformClaw(ox::FileSystem32 *dest, std::string path) {
// copy // copy
oxTrace("pack::transformClaw") << "path:" << path.c_str(); oxTrace("pack::transformClaw") << "path:" << path.c_str();
return dest->ls(path.c_str(), [dest, path](const char *name, ox::InodeId_t) { return dest->ls(path.c_str(), [dest, path](const char *name, ox::InodeId_t) {
@ -74,7 +74,7 @@ static_assert(!endsWith("asdf", "eu"));
}); });
} }
[[nodiscard]] ox::Error verifyFile(ox::FileSystem32 *fs, const std::string &path, const std::vector<uint8_t> &expected) noexcept { ox::Error verifyFile(ox::FileSystem32 *fs, const std::string &path, const std::vector<uint8_t> &expected) noexcept {
std::vector<uint8_t> buff(expected.size()); std::vector<uint8_t> buff(expected.size());
oxReturnError(fs->read(path.c_str(), buff.data(), buff.size())); oxReturnError(fs->read(path.c_str(), buff.data(), buff.size()));
return OxError(buff == expected ? 0 : 1); return OxError(buff == expected ? 0 : 1);
@ -85,7 +85,7 @@ struct VerificationPair {
std::vector<uint8_t> buff; std::vector<uint8_t> buff;
}; };
[[nodiscard]] ox::Error copy(ox::PassThroughFS *src, ox::FileSystem32 *dest, std::string path) { ox::Error copy(ox::PassThroughFS *src, ox::FileSystem32 *dest, std::string path) {
std::cout << "copying directory: " << path << '\n'; std::cout << "copying directory: " << path << '\n';
std::vector<VerificationPair> verficationPairs; std::vector<VerificationPair> verficationPairs;
// copy // copy
@ -126,7 +126,7 @@ struct VerificationPair {
} }
[[nodiscard]] ox::Error pack(ox::PassThroughFS *src, ox::FileSystem32 *dest) { ox::Error pack(ox::PassThroughFS *src, ox::FileSystem32 *dest) {
oxReturnError(copy(src, dest, "/")); oxReturnError(copy(src, dest, "/"));
oxReturnError(transformClaw(dest, "/")); oxReturnError(transformClaw(dest, "/"));
return OxError(0); return OxError(0);

View File

@ -51,7 +51,7 @@ struct Zone {
~Zone(); ~Zone();
[[nodiscard]] ox::Error init(core::Context *ctx, common::Bounds bnds, ox::FileAddress tileSheet, ox::FileAddress palette = {}); ox::Error init(core::Context *ctx, common::Bounds bnds, ox::FileAddress tileSheet, ox::FileAddress palette = {});
void draw(core::Context *ctx); void draw(core::Context *ctx);