Skip to content

Commit

Permalink
Fix issue MoarVM#1163
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhongnianTao authored and Kaiepi committed Sep 6, 2019
1 parent 15c0251 commit 0cfedee
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/strings/gb18030.c
Expand Up @@ -170,7 +170,7 @@ MVMuint32 MVM_string_gb18030_decodestream(MVMThreadContext *tc, MVMDecodeStream
is_len4 = 0;
} else {
MVM_exception_throw_adhoc(tc,
"Error decoding gb18030 string: invalid gb18030 format. Last four bytes seen was 0x%hhX, 0x%hhX, 0x%hhX, 0x%hhX\n",
"Error decoding gb18030 string: invalid gb18030 format. Last four bytes seen was 0x%x, 0x%x, 0x%x, 0x%x\n",
len4_byte1, len4_byte2, len4_byte3, len4_byte4);
}
}
Expand Down Expand Up @@ -207,7 +207,7 @@ MVMuint32 MVM_string_gb18030_decodestream(MVMThreadContext *tc, MVMDecodeStream
graph = gb18030_index_to_cp_len2(last_codepoint, codepoint);
if (graph == GB18030_NULL) {
MVM_exception_throw_adhoc(tc,
"Error decoding gb18030 string: invalid gb18030 format. Last two bytes seen was 0x%hhX, 0x%hhX\n",
"Error decoding gb18030 string: invalid gb18030 format. Last two bytes seen was 0x%x, 0x%x\n",
last_codepoint, codepoint);
}
last_was_first_byte = 0;
Expand Down Expand Up @@ -320,7 +320,7 @@ char * MVM_string_gb18030_encode_substr(MVMThreadContext *tc, MVMString *str,
}
else {
MVM_free(result);
MVM_exception_throw_adhoc(tc, "Error encoding gb18030 string: could not encode codepoint 0x%hhX", codepoint);
MVM_exception_throw_adhoc(tc, "Error encoding gb18030 string: could not encode codepoint 0x%x", codepoint);
}
}
if (gb18030_cp <= 0xffff) {
Expand Down
8 changes: 4 additions & 4 deletions src/strings/gb2312.c
Expand Up @@ -33,7 +33,7 @@ MVMString * MVM_string_gb2312_decode(MVMThreadContext *tc, const MVMObject *resu
i++;
}
else {
MVM_exception_throw_adhoc(tc, "Error decoding gb2312 string: could not decode codepoint 0x%hhX", codepoint);
MVM_exception_throw_adhoc(tc, "Error decoding gb2312 string: could not decode codepoint 0x%x", codepoint);
}
}
else {
Expand Down Expand Up @@ -132,7 +132,7 @@ MVMuint32 MVM_string_gb2312_decodestream(MVMThreadContext *tc, MVMDecodeStream *
last_codepoint);
}
else if (handler_rtrn == GB2312_DECODE_CODEPOINT_EXCEPTION) {
MVM_exception_throw_adhoc(tc, "Error decoding gb2312 string: could not decode codepoint 0x%hhX",
MVM_exception_throw_adhoc(tc, "Error decoding gb2312 string: could not decode codepoint 0x%x",
last_codepoint * 256 + codepoint);
}
else if (handler_rtrn == GB2312_DECODE_CONTINUE) {
Expand Down Expand Up @@ -258,7 +258,7 @@ char * MVM_string_gb2312_encode_substr(MVMThreadContext *tc, MVMString *str,
continue;
}
MVM_free(result);
MVM_exception_throw_adhoc(tc, "Error encoding gb2312 string: could not encode codepoint 0x%hhX", codepoint);
MVM_exception_throw_adhoc(tc, "Error encoding gb2312 string: could not encode codepoint 0x%x", codepoint);
}
result[out_pos++] = gb2312_cp / 256;
result[out_pos++] = gb2312_cp % 256;
Expand All @@ -270,4 +270,4 @@ char * MVM_string_gb2312_encode_substr(MVMThreadContext *tc, MVMString *str,
}
MVM_free(repl_bytes);
return (char *)result;
}
}

0 comments on commit 0cfedee

Please sign in to comment.