From 6638941c9dfd0c3c98c15b971dfa2377cbfc8ce8 Mon Sep 17 00:00:00 2001 From: James Alan Nguyen Date: Sun, 24 Apr 2022 04:34:32 +1000 Subject: [PATCH] Address unused stuff and CI fix --- src/engine/engine.h | 1 - src/engine/fileOpsIns.cpp | 12 +++++++----- src/engine/safeReader.cpp | 5 +++++ src/engine/safeReader.h | 3 ++- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/engine/engine.h b/src/engine/engine.h index 5e840362e..b76e271e2 100644 --- a/src/engine/engine.h +++ b/src/engine/engine.h @@ -31,7 +31,6 @@ #include #include #include -#include #define addWarning(x) \ if (warnings.empty()) { \ diff --git a/src/engine/fileOpsIns.cpp b/src/engine/fileOpsIns.cpp index d541a9df2..d913d96d4 100644 --- a/src/engine/fileOpsIns.cpp +++ b/src/engine/fileOpsIns.cpp @@ -646,7 +646,11 @@ void DivEngine::loadOPLI(SafeReader& reader, std::vector& ret, S String header = reader.readString(11); if (header.compare("WOPL3-INST") == 0) { uint16_t version = reader.readS(); - bool isPerc = (reader.readC() == 1); + if (version > 3) { + logW("Unknown OPLI version."); + } + + reader.readC(); // skip isPerc field ins->type = DIV_INS_OPL; String insName = reader.readString(32); @@ -655,7 +659,6 @@ void DivEngine::loadOPLI(SafeReader& reader, std::vector& ret, S reader.seek(7, SEEK_CUR); // skip MIDI params uint8_t instTypeFlags = reader.readC(); // [0EEEDCBA] - see WOPL/OPLI spec - bool is_2op = ((instTypeFlags & 0x3) == 0); bool is_4op = ((instTypeFlags & 0x1) == 1); bool is_2x2op = (((instTypeFlags>>1) & 0x1) == 1); bool is_rhythm = (((instTypeFlags>>4) & 0x7) > 0); @@ -740,7 +743,7 @@ void DivEngine::loadOPNI(SafeReader& reader, std::vector& ret, S reader.seek(-2, SEEK_CUR); } - bool is_perc = (reader.readC() == 0x1); + reader.readC(); // skip isPerc ins->type = DIV_INS_FM; ins->fm.ops = 4; @@ -1006,7 +1009,6 @@ void DivEngine::loadFF(SafeReader& reader, std::vector& ret, Str void DivEngine::loadOPM(SafeReader& reader, std::vector& ret, String& stripPath) { std::vector insList; - std::stringstream ss; int readCount = 0; @@ -1027,7 +1029,7 @@ void DivEngine::loadOPM(SafeReader& reader, std::vector& ret, St patchNameRead = lfoRead = characteristicRead = m1Read = c1Read = m2Read = c2Read = false; newPatch = nullptr; }; - auto readIntStrWithinRange = [](String& input, int limitLow, int limitHigh) { + auto readIntStrWithinRange = [](String&& input, int limitLow, int limitHigh) { int x = atoi(input.c_str()); return (x>limitHigh) ? limitHigh : (x= len; diff --git a/src/engine/safeReader.h b/src/engine/safeReader.h index 9fd0282b3..4216a5969 100644 --- a/src/engine/safeReader.h +++ b/src/engine/safeReader.h @@ -67,7 +67,8 @@ class SafeReader { String readString(); String readString(size_t len); String readString_Line(); - String readString_Token(unsigned char delim=' '); + String readString_Token(unsigned char delim); + String readString_Token(); bool isEOF(); SafeReader(void* b, size_t l):