]> git.saurik.com Git - wxWidgets.git/commitdiff
Initialize variable in UTF{16,32} conversion code to avoid warnings.
authorVadim Zeitlin <vadim@wxwidgets.org>
Thu, 30 Jun 2011 12:20:54 +0000 (12:20 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Thu, 30 Jun 2011 12:20:54 +0000 (12:20 +0000)
In optimized build g++ warned about the second element of two-element array
passed to encode_utf16() being possibly uninitialized. This wasn't really the
case but change the code just to avoid the warnings.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68112 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/strconv.cpp

index 8fc90a869e1e5eb78da1dedea668bd17c5f215c9..170ad719bdbd0380c6d06b8de8cf8aaedb37e9d6 100644 (file)
@@ -1645,7 +1645,7 @@ wxMBConvUTF16straight::FromWChar(char *dst, size_t dstLen,
     wxUint16 *outBuff = reinterpret_cast<wxUint16 *>(dst);
     for ( size_t n = 0; n < srcLen; n++ )
     {
-        wxUint16 cc[2];
+        wxUint16 cc[2] = { 0 };
         const size_t numChars = encode_utf16(*src++, cc);
         if ( numChars == wxCONV_FAILED )
             return wxCONV_FAILED;
@@ -1728,7 +1728,7 @@ wxMBConvUTF16swap::FromWChar(char *dst, size_t dstLen,
     wxUint16 *outBuff = reinterpret_cast<wxUint16 *>(dst);
     for ( const wchar_t *srcEnd = src + srcLen; src < srcEnd; src++ )
     {
-        wxUint16 cc[2];
+        wxUint16 cc[2] = { 0 };
         const size_t numChars = encode_utf16(*src, cc);
         if ( numChars == wxCONV_FAILED )
             return wxCONV_FAILED;
@@ -1812,7 +1812,7 @@ wxMBConvUTF32straight::ToWChar(wchar_t *dst, size_t dstLen,
     size_t outLen = 0;
     for ( size_t n = 0; n < inLen; n++ )
     {
-        wxUint16 cc[2];
+        wxUint16 cc[2] = { 0 };
         const size_t numChars = encode_utf16(*inBuff++, cc);
         if ( numChars == wxCONV_FAILED )
             return wxCONV_FAILED;
@@ -1890,7 +1890,7 @@ wxMBConvUTF32swap::ToWChar(wchar_t *dst, size_t dstLen,
     size_t outLen = 0;
     for ( size_t n = 0; n < inLen; n++, inBuff++ )
     {
-        wxUint16 cc[2];
+        wxUint16 cc[2] = { 0 };
         const size_t numChars = encode_utf16(wxUINT32_SWAP_ALWAYS(*inBuff), cc);
         if ( numChars == wxCONV_FAILED )
             return wxCONV_FAILED;