remove unneeded debug prints

This commit is contained in:
Martin Michelsen
2023-11-25 16:26:19 -08:00
parent 46c3a44b41
commit 9c403e9107
+13 -53
View File
@@ -351,8 +351,6 @@ struct pstring {
break;
}
case TextEncoding::MARKED: {
fprintf(stderr, "pstring encode MARKED\n");
print_data(stderr, s);
if (client_language == 0) {
try {
auto ret = tt_utf8_to_sjis(this->data, Bytes, s.data(), s.size(), true);
@@ -374,7 +372,6 @@ struct pstring {
this->clear_after_bytes(ret.bytes_written + 2);
}
}
print_data(stderr, this->data, Bytes);
break;
}
default:
@@ -414,61 +411,26 @@ struct pstring {
try {
switch (Encoding) {
case TextEncoding::CHALLENGE8: {
fprintf(stderr, "pstring decode CHALLENGE8\n");
print_data(stderr, this->data, this->used_chars_8());
std::string decrypted(reinterpret_cast<const char*>(this->data), this->used_chars_8());
decrypt_challenge_rank_text_t<uint8_t>(decrypted.data(), decrypted.size());
std::string ret = tt_ascii_to_utf8(decrypted.data(), decrypted.size());
print_data(stderr, ret);
return ret;
}
case TextEncoding::ASCII: {
fprintf(stderr, "pstring decode ASCII\n");
print_data(stderr, this->data, this->used_chars_8());
std::string ret = tt_ascii_to_utf8(this->data, this->used_chars_8());
print_data(stderr, ret);
return ret;
}
case TextEncoding::ISO8859: {
fprintf(stderr, "pstring decode ISO8859\n");
print_data(stderr, this->data, this->used_chars_8());
std::string ret = tt_8859_to_utf8(this->data, this->used_chars_8());
print_data(stderr, ret);
return ret;
}
case TextEncoding::SJIS: {
fprintf(stderr, "pstring decode SJIS\n");
print_data(stderr, this->data, this->used_chars_8());
std::string ret = tt_sjis_to_utf8(this->data, this->used_chars_8());
print_data(stderr, ret);
return ret;
}
case TextEncoding::UTF16: {
fprintf(stderr, "pstring decode UTF16\n");
print_data(stderr, this->data, this->used_chars_16() * 2);
std::string ret = tt_utf16_to_utf8(this->data, this->used_chars_16() * 2);
print_data(stderr, ret);
return ret;
}
case TextEncoding::UTF8: {
fprintf(stderr, "pstring decode UTF8\n");
print_data(stderr, this->data, this->used_chars_8());
std::string ret = std::string(reinterpret_cast<const char*>(&this->data[0]), this->used_chars_8());
print_data(stderr, ret);
return ret;
return tt_ascii_to_utf8(decrypted.data(), decrypted.size());
}
case TextEncoding::ASCII:
return tt_ascii_to_utf8(this->data, this->used_chars_8());
case TextEncoding::ISO8859:
return tt_8859_to_utf8(this->data, this->used_chars_8());
case TextEncoding::SJIS:
return tt_sjis_to_utf8(this->data, this->used_chars_8());
case TextEncoding::UTF16:
return tt_utf16_to_utf8(this->data, this->used_chars_16() * 2);
case TextEncoding::UTF8:
return std::string(reinterpret_cast<const char*>(&this->data[0]), this->used_chars_8());
case TextEncoding::CHALLENGE16: {
fprintf(stderr, "pstring decode CHALLENGE16\n");
print_data(stderr, this->data, this->used_chars_8());
std::string decrypted(reinterpret_cast<const char*>(&this->data[0]), this->used_chars_16() * 2);
decrypt_challenge_rank_text_t<le_uint16_t>(decrypted.data(), decrypted.size());
std::string ret = tt_utf16_to_utf8(decrypted.data(), decrypted.size());
print_data(stderr, ret);
return ret;
return tt_utf16_to_utf8(decrypted.data(), decrypted.size());
}
case TextEncoding::MARKED: {
fprintf(stderr, "pstring decode MARKED\n");
print_data(stderr, this->data, this->used_chars_8());
size_t offset = 0;
if (this->data[0] == '\t') {
if (this->data[1] == 'J') {
@@ -479,11 +441,9 @@ struct pstring {
offset = 2;
}
}
std::string ret = client_language
return client_language
? tt_8859_to_utf8(&this->data[offset], this->used_chars_8() - offset)
: tt_sjis_to_utf8(&this->data[offset], this->used_chars_8() - offset);
print_data(stderr, ret);
return ret;
}
default:
throw std::logic_error("unknown text encoding");