ICU-2815 ucnv_flushCache should close the cached default converter.

X-SVN-Rev: 11585
This commit is contained in:
George Rhoten 2003-04-18 20:31:45 +00:00
parent be0a7c7d1e
commit 4f532d0425
5 changed files with 6 additions and 18 deletions

View File

@ -67,7 +67,6 @@ u_cleanup(void)
unames_cleanup();
pname_cleanup();
uchar_cleanup();
ustring_cleanup();
ucnv_cleanup();
ucnv_io_cleanup();
udata_cleanup();

View File

@ -33,8 +33,6 @@ U_CFUNC UBool locale_cleanup(void);
U_CFUNC UBool uloc_cleanup(void);
U_CFUNC UBool ustring_cleanup(void);
U_CFUNC UBool breakiterator_cleanup(void);
U_CFUNC UBool ustrprep_cleanup(void);

View File

@ -33,6 +33,7 @@
#include "cstring.h"
#include "cmemory.h"
#include "ucln_cmn.h"
#include "ustr_imp.h"
#if 0
@ -711,6 +712,10 @@ ucnv_flushCache ()
int32_t pos = -1;
int32_t tableDeletedNum = 0;
const UHashElement *e;
UErrorCode status = U_ILLEGAL_ARGUMENT_ERROR;
/* Close the default converter without creating a new one so that everything will be flushed. */
ucnv_close(u_getDefaultConverter(&status));
/*if shared data hasn't even been lazy evaluated yet
* return 0

View File

@ -26,7 +26,6 @@
#include "cmemory.h"
#include "umutex.h"
#include "ustr_imp.h"
#include "ucln_cmn.h"
/* forward declaractions of definitions for the shared default converter */
@ -1313,16 +1312,6 @@ u_austrcpy(char *s1,
/* mutexed access to a shared default converter ----------------------------- */
UBool ustring_cleanup(void) {
if (gDefaultConverter) {
ucnv_close(gDefaultConverter);
gDefaultConverter = NULL;
}
/* it's safe to close a 0 converter */
return TRUE;
}
U_CAPI UConverter* U_EXPORT2
u_getDefaultConverter(UErrorCode *status)
{

View File

@ -22,7 +22,7 @@
#include "unicode/ustring.h"
#include "cstring.h"
#include "cmemory.h"
#include "ustr_imp.h"
#define LENGTHOF(array) (int32_t)(sizeof(array)/sizeof((array)[0]))
@ -176,9 +176,6 @@ static void TestFlushCache(void) {
UConverter* someConverters[5];
int flushCount = 0;
/* Close the default converter just in case one of the tested converters is also the default converter. */
ucnv_close(u_getDefaultConverter(&err));
/* flush the converter cache to get a consistent state before the flushing is tested */
ucnv_flushCache();