- Timestamp:
- Mar 31, 2013 12:07:11 AM (12 years ago)
- Location:
- trunk/src/VBox/Runtime
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r3/posix/utf8-posix.cpp
r43363 r45260 194 194 const void *pvInputLeft = pvInput; 195 195 void *pvOutputLeft = pvOutput; 196 size_t cchNonRev; 196 197 #if defined(RT_OS_LINUX) || defined(RT_OS_HAIKU) || defined(RT_OS_SOLARIS) || (defined(RT_OS_DARWIN) && defined(_DARWIN_FEATURE_UNIX_CONFORMANCE)) /* there are different opinions about the constness of the input buffer. */ 197 if (iconv(hIconv, (char **)&pvInputLeft, &cbInLeft, (char **)&pvOutputLeft, &cbOutLeft) != (size_t)-1)198 cchNonRev = iconv(hIconv, (char **)&pvInputLeft, &cbInLeft, (char **)&pvOutputLeft, &cbOutLeft); 198 199 #else 199 if (iconv(hIconv, (const char **)&pvInputLeft, &cbInLeft, (char **)&pvOutputLeft, &cbOutLeft) != (size_t)-1) 200 #endif 200 cchNonRev = iconv(hIconv, (const char **)&pvInputLeft, &cbInLeft, (char **)&pvOutputLeft, &cbOutLeft); 201 #endif 202 if (cchNonRev != (size_t)-1) 201 203 { 202 204 if (!cbInLeft) … … 210 212 ((char *)pvOutputLeft)[1] = '\0'; 211 213 *ppvOutput = pvOutput; 212 return VINF_SUCCESS; 214 if (cchNonRev == 0) 215 return VINF_SUCCESS; 216 return VWRN_NO_TRANSLATION; 213 217 } 214 218 errno = E2BIG; … … 320 324 const void *pvInputLeft = pvInput; 321 325 void *pvOutputLeft = pvOutput; 326 size_t cchNonRev; 322 327 #if defined(RT_OS_LINUX) || defined(RT_OS_HAIKU) || defined(RT_OS_SOLARIS) || (defined(RT_OS_DARWIN) && defined(_DARWIN_FEATURE_UNIX_CONFORMANCE)) /* there are different opinions about the constness of the input buffer. */ 323 if (iconv(icHandle, (char **)&pvInputLeft, &cbInLeft, (char **)&pvOutputLeft, &cbOutLeft) != (size_t)-1)328 cchNonRev = iconv(icHandle, (char **)&pvInputLeft, &cbInLeft, (char **)&pvOutputLeft, &cbOutLeft); 324 329 #else 325 if (iconv(icHandle, (const char **)&pvInputLeft, &cbInLeft, (char **)&pvOutputLeft, &cbOutLeft) != (size_t)-1) 326 #endif 330 cchNonRev = iconv(icHandle, (const char **)&pvInputLeft, &cbInLeft, (char **)&pvOutputLeft, &cbOutLeft); 331 #endif 332 if (cchNonRev != (size_t)-1) 327 333 { 328 334 if (!cbInLeft) … … 337 343 ((char *)pvOutputLeft)[1] = '\0'; 338 344 *ppvOutput = pvOutput; 339 return VINF_SUCCESS; 345 if (cchNonRev == 0) 346 return VINF_SUCCESS; 347 return VWRN_NO_TRANSLATION; 340 348 } 341 349 errno = E2BIG; -
trunk/src/VBox/Runtime/testcase/tstUtf8.cpp
r45257 r45260 1397 1397 char *pszOut; 1398 1398 rc = RTStrUtf8ToCurrentCP(&pszOut, pszTest1); 1399 if ( RT_SUCCESS(rc))1399 if (rc == VINF_SUCCESS) 1400 1400 { 1401 1401 RTTESTI_CHECK(!strcmp(pszOut, pszTest1)); … … 1405 1405 } 1406 1406 else 1407 RTTESTI_CHECK_ RC(rc, VERR_NO_TRANSLATION);1407 RTTESTI_CHECK_MSG(rc == VWRN_NO_TRANSLATION || rc == VERR_NO_TRANSLATION, ("rc=%Rrc\n", rc)); 1408 1408 1409 1409 RTTestSub(hTest, "VERR_NO_TRANSLATION/RTUtf16ToLatin1");
Note:
See TracChangeset
for help on using the changeset viewer.