diff options
author | Jack Lloyd <[email protected]> | 2016-12-11 15:28:38 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2016-12-18 16:48:24 -0500 |
commit | f3cb3edb512bdcab498d825886c3366c341b3f78 (patch) | |
tree | 645c73ec295a5a34f25d99903b6d9fa9751e86d3 /src/lib/utils/charset.cpp | |
parent | c1dd21253c1f3188ff45d3ad47698efd08235ae8 (diff) |
Convert to using standard uintN_t integer types
Renames a couple of functions for somewhat better name consistency,
eg make_u32bit becomes make_uint32. The old typedefs remain for now
since probably lots of application code uses them.
Diffstat (limited to 'src/lib/utils/charset.cpp')
-rw-r--r-- | src/lib/utils/charset.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/lib/utils/charset.cpp b/src/lib/utils/charset.cpp index cb106d6e9..72db6c792 100644 --- a/src/lib/utils/charset.cpp +++ b/src/lib/utils/charset.cpp @@ -28,8 +28,8 @@ std::string ucs2_to_latin1(const std::string& ucs2) for(size_t i = 0; i != ucs2.size(); i += 2) { - const byte c1 = ucs2[i]; - const byte c2 = ucs2[i+1]; + const uint8_t c1 = ucs2[i]; + const uint8_t c2 = ucs2[i+1]; if(c1 != 0) throw Decoding_Error("UCS-2 has non-Latin1 characters"); @@ -50,7 +50,7 @@ std::string utf8_to_latin1(const std::string& utf8) size_t position = 0; while(position != utf8.size()) { - const byte c1 = static_cast<byte>(utf8[position++]); + const uint8_t c1 = static_cast<uint8_t>(utf8[position++]); if(c1 <= 0x7F) iso8859 += static_cast<char>(c1); @@ -59,8 +59,8 @@ std::string utf8_to_latin1(const std::string& utf8) if(position == utf8.size()) throw Decoding_Error("UTF-8: sequence truncated"); - const byte c2 = static_cast<byte>(utf8[position++]); - const byte iso_char = ((c1 & 0x07) << 6) | (c2 & 0x3F); + const uint8_t c2 = static_cast<uint8_t>(utf8[position++]); + const uint8_t iso_char = ((c1 & 0x07) << 6) | (c2 & 0x3F); if(iso_char <= 0x7F) throw Decoding_Error("UTF-8: sequence longer than needed"); @@ -82,7 +82,7 @@ std::string latin1_to_utf8(const std::string& iso8859) std::string utf8; for(size_t i = 0; i != iso8859.size(); ++i) { - const byte c = static_cast<byte>(iso8859[i]); + const uint8_t c = static_cast<uint8_t>(iso8859[i]); if(c <= 0x7F) utf8 += static_cast<char>(c); @@ -146,7 +146,7 @@ bool is_space(char c) /* * Convert a character to a digit */ -byte char2digit(char c) +uint8_t char2digit(char c) { switch(c) { @@ -168,7 +168,7 @@ byte char2digit(char c) /* * Convert a digit to a character */ -char digit2char(byte b) +char digit2char(uint8_t b) { switch(b) { |