]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/stringops.cpp
Applied #13738: Make a wxRichTextImage's box display around the image (dghart)
[wxWidgets.git] / src / common / stringops.cpp
index 9ccd34d95cba6554e405d8e9094be392bf6c1bf1..599c05c1d02cb685cc85c2929328a4bf317b1ba8 100644 (file)
@@ -191,14 +191,6 @@ bool wxStringOperationsUtf8::IsValidUtf8String(const char *str, size_t len)
     return true;
 }
 
-#ifdef __WXDEBUG__
-bool wxStringOperationsUtf8::IsValidUtf8LeadByte(unsigned char c)
-{
-    return (c <= 0x7F) || (c >= 0xC2 && c <= 0xF4);
-}
-#endif
-
-
 // NB: this is in this file and not unichar.cpp to keep all UTF-8 encoding
 //     code in single place
 wxUniChar::Utf8CharBuffer wxUniChar::AsUTF8() const
@@ -250,7 +242,7 @@ wxUniChar::Utf8CharBuffer wxUniChar::AsUTF8() const
     }
     else
     {
-        wxFAIL_MSG( _T("trying to encode undefined Unicode character") );
+        wxFAIL_MSG( wxT("trying to encode undefined Unicode character") );
         out[0] = 0;
     }
 
@@ -264,7 +256,7 @@ wxStringOperationsUtf8::DecodeNonAsciiChar(wxStringImpl::const_iterator i)
 
     wxUniChar::value_type code = 0;
     size_t len = GetUtf8CharLength(*i);
-    wxASSERT_MSG( len <= 4, _T("invalid UTF-8 sequence length") );
+    wxASSERT_MSG( len <= 4, wxT("invalid UTF-8 sequence length") );
 
     //    Char. number range   |        UTF-8 octet sequence
     //       (hexadecimal)     |              (binary)
@@ -280,7 +272,7 @@ wxStringOperationsUtf8::DecodeNonAsciiChar(wxStringImpl::const_iterator i)
 
     // mask to extract lead byte's value ('x' bits above), by sequence's length:
     static const unsigned char s_leadValueMask[4] =  { 0x7F, 0x1F, 0x0F, 0x07 };
-#ifdef __WXDEBUG__
+#if wxDEBUG_LEVEL
     // mask and value of lead byte's most significant bits, by length:
     static const unsigned char s_leadMarkerMask[4] = { 0x80, 0xE0, 0xF0, 0xF8 };
     static const unsigned char s_leadMarkerVal[4] =  { 0x00, 0xC0, 0xE0, 0xF0 };
@@ -289,7 +281,7 @@ wxStringOperationsUtf8::DecodeNonAsciiChar(wxStringImpl::const_iterator i)
     // extract the lead byte's value bits:
     wxASSERT_MSG( ((unsigned char)*i & s_leadMarkerMask[len-1]) ==
                   s_leadMarkerVal[len-1],
-                  _T("invalid UTF-8 lead byte") );
+                  wxT("invalid UTF-8 lead byte") );
     code = (unsigned char)*i & s_leadValueMask[len-1];
 
     // all remaining bytes, if any, are handled in the same way regardless of
@@ -297,7 +289,7 @@ wxStringOperationsUtf8::DecodeNonAsciiChar(wxStringImpl::const_iterator i)
     for ( ++i ; len > 1; --len, ++i )
     {
         wxASSERT_MSG( ((unsigned char)*i & 0xC0) == 0x80,
-                      _T("invalid UTF-8 byte") );
+                      wxT("invalid UTF-8 byte") );
 
         code <<= 6;
         code |= (unsigned char)*i & 0x3F;