fix compilation error for non-english windows (like cjk)

add /utf-8 switch for msvc build. source code has several utf-8 characters
fix C2001 error. escape non-printable ascii code generated by embed_test_data.go
fix C4819 warning. add u8 keyword on utf-8 string literal (ripemd_test.cc)

Change-Id: I8c04dc7f0359e6ee27efada066863826d263d5cd
Reviewed-on: https://boringssl-review.googlesource.com/26484
Reviewed-by: David Benjamin <davidben@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
CQ-Verified: CQ bot account: commit-bot@chromium.org <commit-bot@chromium.org>
This commit is contained in:
sphawk 2018-03-11 19:20:51 +09:00 committed by CQ bot account: commit-bot@chromium.org
parent fa3e9c3385
commit 3ab1a69545
3 changed files with 5 additions and 5 deletions

View File

@ -160,8 +160,8 @@ elseif(MSVC)
${MSVC_DISABLED_WARNINGS_LIST})
string(REPLACE "C" " -w4" MSVC_LEVEL4_WARNINGS_STR
${MSVC_LEVEL4_WARNINGS_LIST})
set(CMAKE_C_FLAGS "-Wall -WX ${MSVC_DISABLED_WARNINGS_STR} ${MSVC_LEVEL4_WARNINGS_STR}")
set(CMAKE_CXX_FLAGS "-Wall -WX ${MSVC_DISABLED_WARNINGS_STR} ${MSVC_LEVEL4_WARNINGS_STR}")
set(CMAKE_C_FLAGS "-utf-8 -Wall -WX ${MSVC_DISABLED_WARNINGS_STR} ${MSVC_LEVEL4_WARNINGS_STR}")
set(CMAKE_CXX_FLAGS "-utf-8 -Wall -WX ${MSVC_DISABLED_WARNINGS_STR} ${MSVC_LEVEL4_WARNINGS_STR}")
endif()
if(WIN32)

View File

@ -109,7 +109,7 @@ TEST(RIPEMDTest, RunTest) {
0x37, 0xf9, 0x7f, 0x68, 0xf0, 0x83, 0x25, 0xdc, 0x15, 0x28};
if (OPENSSL_memcmp(digest, kMillionADigest, sizeof(digest)) != 0) {
fprintf(stderr, "Digest incorrect for “million a's” test: ");
fprintf(stderr, u8"Digest incorrect for “million a's” test: ");
hexdump(stderr, "", digest, sizeof(digest));
ok = 0;
}

View File

@ -21,7 +21,6 @@ import (
"fmt"
"io/ioutil"
"os"
"unicode"
)
func quote(in []byte) string {
@ -46,7 +45,8 @@ func quote(in []byte) string {
case '"':
buf.WriteString(`\"`)
default:
if rune(b) > 127 || unicode.IsPrint(rune(b)) {
// printable ascii code [32, 126]
if 32 <= b && b <= 126 {
buf.WriteByte(b)
} else {
fmt.Fprintf(&buf, "\\x%02x", b)