diff options
author | Brodie Thiesfield <brofield@gmail.com> | 2012-02-27 04:19:12 +0400 |
---|---|---|
committer | Brodie Thiesfield <brofield@gmail.com> | 2012-02-27 04:19:12 +0400 |
commit | 4f125d4da840cab8ee5553162dc071ac9486fb53 (patch) | |
tree | 362c7bc1c5b3c14b49a93d2fe4a353844e0080b4 /SimpleIni.h | |
parent | ec8ea4a2dde9e4412d5c685f8cc8461ff06547cd (diff) |
Fix a bug reported by andreaplanet in the ICU processing that caused conversion of zero-length strings (like empty values) to fail.
See http://www.codeproject.com/Articles/13881/Cross-platform-INI-Configuration-Files-Win32-Un-x?msg=4148327#xx4148327xx
Diffstat (limited to 'SimpleIni.h')
-rw-r--r-- | SimpleIni.h | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/SimpleIni.h b/SimpleIni.h index beaa107..4d1d077 100644 --- a/SimpleIni.h +++ b/SimpleIni.h @@ -5,7 +5,7 @@ <tr><th>File <td>SimpleIni.h <tr><th>Author <td>Brodie Thiesfield [code at jellycan dot com] <tr><th>Source <td>http://code.jellycan.com/simpleini/ - <tr><th>Version <td>4.14 + <tr><th>Version <td>4.15 </table> Jump to the @link CSimpleIniTempl CSimpleIni @endlink interface documentation. @@ -3039,10 +3039,9 @@ public: } nError = U_ZERO_ERROR; - ucnv_resetToUnicode(m_pConverter); int32_t nLen = ucnv_toUChars(m_pConverter, NULL, 0, a_pInputData, (int32_t) a_uInputDataLen, &nError); - if (nError != U_BUFFER_OVERFLOW_ERROR) { + if (U_FAILURE(nError) && nError != U_BUFFER_OVERFLOW_ERROR) { return (size_t) -1; } @@ -3079,7 +3078,6 @@ public: } nError = U_ZERO_ERROR; - ucnv_resetToUnicode(m_pConverter); ucnv_toUChars(m_pConverter, a_pOutputData, (int32_t) a_uOutputDataSize, a_pInputData, (int32_t) a_uInputDataLen, &nError); @@ -3114,10 +3112,9 @@ public: } nError = U_ZERO_ERROR; - ucnv_resetFromUnicode(m_pConverter); int32_t nLen = ucnv_fromUChars(m_pConverter, NULL, 0, a_pInputData, -1, &nError); - if (nError != U_BUFFER_OVERFLOW_ERROR) { + if (U_FAILURE(nError) && nError != U_BUFFER_OVERFLOW_ERROR) { return (size_t) -1; } @@ -3153,7 +3150,6 @@ public: } nError = U_ZERO_ERROR; - ucnv_resetFromUnicode(m_pConverter); ucnv_fromUChars(m_pConverter, a_pOutputData, (int32_t) a_uOutputDataSize, a_pInputData, -1, &nError); |