Fix bug with FindDictionaryEntry return type to int8_t
This commit is contained in:
@@ -18,7 +18,7 @@ uint8_t FindMatchingCharacter(char value) {
|
|||||||
return 0xFF;
|
return 0xFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t FindDictionaryEntry(uint8_t value) {
|
int8_t FindDictionaryEntry(uint8_t value) {
|
||||||
if (value < DICTOFF || value == 0xFF) {
|
if (value < DICTOFF || value == 0xFF) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -51,8 +51,8 @@ ParsedElement FindMatchingElement(const std::string &str) {
|
|||||||
match = text_element.MatchMe(str);
|
match = text_element.MatchMe(str);
|
||||||
if (match.size() > 0) {
|
if (match.size() > 0) {
|
||||||
if (text_element.HasArgument) {
|
if (text_element.HasArgument) {
|
||||||
return ParsedElement(text_element,
|
std::string arg = match[1].str().substr(1);
|
||||||
std::stoi(match[1].str(), nullptr, 16));
|
return ParsedElement(text_element, std::stoi(arg, nullptr, 16));
|
||||||
} else {
|
} else {
|
||||||
return ParsedElement(text_element, 0);
|
return ParsedElement(text_element, 0);
|
||||||
}
|
}
|
||||||
@@ -93,7 +93,7 @@ std::string ParseTextDataByte(uint8_t value) {
|
|||||||
// Check for dictionary.
|
// Check for dictionary.
|
||||||
int dictionary = FindDictionaryEntry(value);
|
int dictionary = FindDictionaryEntry(value);
|
||||||
if (dictionary >= 0) {
|
if (dictionary >= 0) {
|
||||||
return absl::StrFormat("[%s:%X]", DICTIONARYTOKEN, dictionary);
|
return absl::StrFormat("[%s:%2X]", DICTIONARYTOKEN, dictionary);
|
||||||
}
|
}
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ static const std::unordered_map<uint8_t, wchar_t> CharEncoder = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
uint8_t FindMatchingCharacter(char value);
|
uint8_t FindMatchingCharacter(char value);
|
||||||
uint8_t FindDictionaryEntry(uint8_t value);
|
int8_t FindDictionaryEntry(uint8_t value);
|
||||||
std::vector<uint8_t> ParseMessageToData(std::string str);
|
std::vector<uint8_t> ParseMessageToData(std::string str);
|
||||||
|
|
||||||
struct DictionaryEntry {
|
struct DictionaryEntry {
|
||||||
@@ -52,7 +52,7 @@ struct DictionaryEntry {
|
|||||||
DictionaryEntry() = default;
|
DictionaryEntry() = default;
|
||||||
DictionaryEntry(uint8_t i, std::string s)
|
DictionaryEntry(uint8_t i, std::string s)
|
||||||
: Contents(s), ID(i), Length(s.length()) {
|
: Contents(s), ID(i), Length(s.length()) {
|
||||||
Token = absl::StrFormat("[%s:%00X]", DICTIONARYTOKEN, ID);
|
Token = absl::StrFormat("[%s:%02X]", DICTIONARYTOKEN, ID);
|
||||||
Data = ParseMessageToData(Contents);
|
Data = ParseMessageToData(Contents);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,7 +73,7 @@ struct DictionaryEntry {
|
|||||||
|
|
||||||
constexpr int kTextData = 0xE0000;
|
constexpr int kTextData = 0xE0000;
|
||||||
constexpr int kTextDataEnd = 0xE7FFF;
|
constexpr int kTextDataEnd = 0xE7FFF;
|
||||||
constexpr int kNumDictionaryEntries = 97;
|
constexpr int kNumDictionaryEntries = 0x61;
|
||||||
constexpr int kPointersDictionaries = 0x74703;
|
constexpr int kPointersDictionaries = 0x74703;
|
||||||
constexpr uint8_t kScrollVertical = 0x73;
|
constexpr uint8_t kScrollVertical = 0x73;
|
||||||
constexpr uint8_t kLine1 = 0x74;
|
constexpr uint8_t kLine1 = 0x74;
|
||||||
|
|||||||
Reference in New Issue
Block a user