Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/windirstat/simpleini.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrodie Thiesfield <brofield@gmail.com>2012-02-27 04:19:12 +0400
committerBrodie Thiesfield <brofield@gmail.com>2012-02-27 04:19:12 +0400
commit4f125d4da840cab8ee5553162dc071ac9486fb53 (patch)
tree362c7bc1c5b3c14b49a93d2fe4a353844e0080b4
parentec8ea4a2dde9e4412d5c685f8cc8461ff06547cd (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
-rw-r--r--SimpleIni.h10
-rw-r--r--package.cmd2
-rw-r--r--test1-expected.ini3
-rw-r--r--test1-input.ini3
-rw-r--r--test1.cpp3
5 files changed, 12 insertions, 9 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);
diff --git a/package.cmd b/package.cmd
index f46da2c..2ae29db 100644
--- a/package.cmd
+++ b/package.cmd
@@ -1,4 +1,4 @@
-set VERSION=4.14
+set VERSION=4.15
set SEVENZIP="C:\Program Files\7-Zip\7z.exe"
diff --git a/test1-expected.ini b/test1-expected.ini
index ca2216c..dde335d 100644
--- a/test1-expected.ini
+++ b/test1-expected.ini
@@ -13,6 +13,9 @@
lonely-key = nosection
another = nosection either
+; This key has no value
+empty =
+
; This should be joined with the comment below about japanese.
; Another line which will be un-indented.
diff --git a/test1-input.ini b/test1-input.ini
index 6b5f7fd..6d27681 100644
--- a/test1-input.ini
+++ b/test1-input.ini
@@ -11,6 +11,9 @@
lonely-key = nosection
another = nosection either
+; This key has no value
+empty =
+
; This should be joined with the comment below about japanese.
; Another line which will be un-indented.
diff --git a/test1.cpp b/test1.cpp
index ef7e336..3dd7800 100644
--- a/test1.cpp
+++ b/test1.cpp
@@ -10,6 +10,7 @@
#endif
#ifdef _WIN32
+# include <windows.h>
# define DELETE_FILE DeleteFileA
#else
# include <unistd.h>
@@ -121,7 +122,7 @@ bool TestStreams()
Test oTest("TestStreams");
- CSimpleIniA ini;
+ CSimpleIniW ini;
ini.SetUnicode(true);
ini.SetMultiKey(true);
ini.SetMultiLine(true);