remove unneeded debug prints
This commit is contained in:
+13
-53
@@ -351,8 +351,6 @@ struct pstring {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TextEncoding::MARKED: {
|
case TextEncoding::MARKED: {
|
||||||
fprintf(stderr, "pstring encode MARKED\n");
|
|
||||||
print_data(stderr, s);
|
|
||||||
if (client_language == 0) {
|
if (client_language == 0) {
|
||||||
try {
|
try {
|
||||||
auto ret = tt_utf8_to_sjis(this->data, Bytes, s.data(), s.size(), true);
|
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);
|
this->clear_after_bytes(ret.bytes_written + 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
print_data(stderr, this->data, Bytes);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@@ -414,61 +411,26 @@ struct pstring {
|
|||||||
try {
|
try {
|
||||||
switch (Encoding) {
|
switch (Encoding) {
|
||||||
case TextEncoding::CHALLENGE8: {
|
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());
|
std::string decrypted(reinterpret_cast<const char*>(this->data), this->used_chars_8());
|
||||||
decrypt_challenge_rank_text_t<uint8_t>(decrypted.data(), decrypted.size());
|
decrypt_challenge_rank_text_t<uint8_t>(decrypted.data(), decrypted.size());
|
||||||
std::string ret = tt_ascii_to_utf8(decrypted.data(), decrypted.size());
|
return 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;
|
|
||||||
}
|
}
|
||||||
|
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: {
|
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);
|
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());
|
decrypt_challenge_rank_text_t<le_uint16_t>(decrypted.data(), decrypted.size());
|
||||||
std::string ret = tt_utf16_to_utf8(decrypted.data(), decrypted.size());
|
return tt_utf16_to_utf8(decrypted.data(), decrypted.size());
|
||||||
print_data(stderr, ret);
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
case TextEncoding::MARKED: {
|
case TextEncoding::MARKED: {
|
||||||
fprintf(stderr, "pstring decode MARKED\n");
|
|
||||||
print_data(stderr, this->data, this->used_chars_8());
|
|
||||||
size_t offset = 0;
|
size_t offset = 0;
|
||||||
if (this->data[0] == '\t') {
|
if (this->data[0] == '\t') {
|
||||||
if (this->data[1] == 'J') {
|
if (this->data[1] == 'J') {
|
||||||
@@ -479,11 +441,9 @@ struct pstring {
|
|||||||
offset = 2;
|
offset = 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
std::string ret = client_language
|
return client_language
|
||||||
? tt_8859_to_utf8(&this->data[offset], this->used_chars_8() - offset)
|
? tt_8859_to_utf8(&this->data[offset], this->used_chars_8() - offset)
|
||||||
: tt_sjis_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:
|
default:
|
||||||
throw std::logic_error("unknown text encoding");
|
throw std::logic_error("unknown text encoding");
|
||||||
|
|||||||
Reference in New Issue
Block a user