diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2012-04-08 03:12:29 +0900 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2012-04-08 03:12:29 +0900 |
| commit | d9bb24a2e090febb6ff152ca3db075eab5f724fb (patch) | |
| tree | 9d530736fb6e6fa35b5e03d13eaed6680ee03ccd /src/json.cc | |
| parent | fcbdecfd1e6aaa92cb1769ed1d395d59648ad5a6 (diff) | |
Fixed gcc-4.7 warnings
Diffstat (limited to 'src/json.cc')
| -rw-r--r-- | src/json.cc | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/src/json.cc b/src/json.cc index 9094bcbb..81341ee6 100644 --- a/src/json.cc +++ b/src/json.cc @@ -159,11 +159,13 @@ decodeString(InputIterator first, InputIterator last) checkEof(first, last); uint16_t codepoint = util::parseUInt(std::string(uchars, first), 16); if(codepoint <= 0x007fu) { - unsigned char temp[1] = { static_cast<char>(codepoint) }; + unsigned char temp[1]; + temp[0] = static_cast<char>(codepoint); s.append(&temp[0], &temp[sizeof(temp)]); } else if(codepoint <= 0x07ffu) { - unsigned char temp[2] = { 0xC0u | (codepoint >> 6), - 0x80u | (codepoint & 0x003fu) }; + unsigned char temp[2]; + temp[0] = 0xC0u | (codepoint >> 6); + temp[1] = 0x80u | (codepoint & 0x003fu); s.append(&temp[0], &temp[sizeof(temp)]); } else if(in(codepoint, 0xD800u, 0xDBFFu)) { // surrogate pair @@ -186,15 +188,17 @@ decodeString(InputIterator first, InputIterator last) uint32_t fullcodepoint = 0x010000u; fullcodepoint += (codepoint & 0x03FFu) << 10; fullcodepoint += (codepoint2 & 0x03FFu); - unsigned char temp[4] = { 0xf0u | (fullcodepoint >> 18), - 0x80u | ((fullcodepoint >> 12) & 0x003Fu), - 0x80u | ((fullcodepoint >> 6) & 0x003Fu), - 0x80u | (fullcodepoint & 0x003Fu) }; + unsigned char temp[4]; + temp[0] = 0xf0u | (fullcodepoint >> 18); + temp[1] = 0x80u | ((fullcodepoint >> 12) & 0x003Fu); + temp[2] = 0x80u | ((fullcodepoint >> 6) & 0x003Fu); + temp[3] = 0x80u | (fullcodepoint & 0x003Fu); s.append(&temp[0], &temp[sizeof(temp)]); } else { - unsigned char temp[3] = { 0xE0u | (codepoint >> 12), - 0x80u | ((codepoint >> 6) & 0x003Fu), - 0x80u | (codepoint & 0x003Fu) }; + unsigned char temp[3]; + temp[0] = 0xE0u | (codepoint >> 12); + temp[1] = 0x80u | ((codepoint >> 6) & 0x003Fu); + temp[2] = 0x80u | (codepoint & 0x003Fu); s.append(&temp[0], &temp[sizeof(temp)]); } offset = first; |
