mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-21 12:40:02 +00:00
ICU-7520 merge r27818 r27821 r27822 for milestone:4.4
X-SVN-Rev: 27824
This commit is contained in:
parent
0355090076
commit
28a123d296
4 changed files with 82 additions and 6 deletions
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
******************************************************************************
|
||||
* Copyright (C) 1997-2009, International Business Machines Corporation and *
|
||||
* Copyright (C) 1997-2010, International Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
******************************************************************************
|
||||
*
|
||||
|
@ -213,6 +213,44 @@ static int32_t ures_flushCache()
|
|||
return rbDeletedNum;
|
||||
}
|
||||
|
||||
#ifdef URES_DEBUG
|
||||
#include <stdio.h>
|
||||
|
||||
U_CAPI UBool U_EXPORT2 ures_dumpCacheContents(void) {
|
||||
UBool cacheNotEmpty = FALSE;
|
||||
int32_t pos = -1;
|
||||
const UHashElement *e;
|
||||
UResourceDataEntry *resB;
|
||||
|
||||
umtx_lock(&resbMutex);
|
||||
if (cache == NULL) {
|
||||
umtx_unlock(&resbMutex);
|
||||
fprintf(stderr,"%s:%d: RB Cache is NULL.\n", __FILE__, __LINE__);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
while ((e = uhash_nextElement(cache, &pos)) != NULL) {
|
||||
cacheNotEmpty=TRUE;
|
||||
resB = (UResourceDataEntry *) e->value.pointer;
|
||||
fprintf(stderr,"%s:%d: RB Cache: Entry @0x%p, refcount %d, name %s:%s. Pool 0x%p, alias 0x%p, parent 0x%p\n",
|
||||
__FILE__, __LINE__,
|
||||
(void*)resB, resB->fCountExisting,
|
||||
resB->fName?resB->fName:"NULL",
|
||||
resB->fPath?resB->fPath:"NULL",
|
||||
(void*)resB->fPool,
|
||||
(void*)resB->fAlias,
|
||||
(void*)resB->fParent);
|
||||
}
|
||||
|
||||
fprintf(stderr,"%s:%d: RB Cache still contains %d items.\n", __FILE__, __LINE__, uhash_count(cache));
|
||||
|
||||
umtx_unlock(&resbMutex);
|
||||
|
||||
return cacheNotEmpty;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static UBool U_CALLCONV ures_cleanup(void)
|
||||
{
|
||||
if (cache != NULL) {
|
||||
|
@ -522,9 +560,15 @@ static UResourceDataEntry *entryOpen(const char* path, const char* localeID, UEr
|
|||
hasRealData = TRUE;
|
||||
if ( usingUSRData ) { /* This code inserts user override data into the inheritance chain */
|
||||
u1 = init_entry(t1->fName, usrDataPath, &usrStatus);
|
||||
if ( u1 != NULL && u1->fBogus == U_ZERO_ERROR) {
|
||||
if ( u1 != NULL ) {
|
||||
if(u1->fBogus == U_ZERO_ERROR) {
|
||||
u1->fParent = t1;
|
||||
r = u1;
|
||||
} else {
|
||||
/* the USR override data wasn't found, delete it */
|
||||
uhash_remove(cache, u1);
|
||||
free_entry(u1);
|
||||
}
|
||||
}
|
||||
}
|
||||
while (hasChopped && !isRoot && t1->fParent == NULL && !t1->fData.noFallback) {
|
||||
|
@ -546,8 +590,18 @@ static UResourceDataEntry *entryOpen(const char* path, const char* localeID, UEr
|
|||
u2->fParent = t2;
|
||||
} else {
|
||||
t1->fParent = t2;
|
||||
if(usingUSRData) {
|
||||
/* the USR override data wasn't found, delete it */
|
||||
uhash_remove(cache, u2);
|
||||
free_entry(u2);
|
||||
}
|
||||
}
|
||||
t1 = t2;
|
||||
} else {
|
||||
/* t2->fCountExisting have to be decremented since the call to init_entry increments
|
||||
* it and if we hit this code, that means it is not set as the parent.
|
||||
*/
|
||||
t2->fCountExisting--;
|
||||
}
|
||||
hasChopped = chopLocale(name);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
**********************************************************************
|
||||
* Copyright (C) 2000-2009, International Business Machines
|
||||
* Copyright (C) 2000-2010, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
**********************************************************************
|
||||
*/
|
||||
|
@ -93,6 +93,11 @@ U_CAPI void U_EXPORT2 ures_initStackObject(UResourceBundle* resB);
|
|||
U_CFUNC const char* ures_getName(const UResourceBundle* resB);
|
||||
#ifdef URES_DEBUG
|
||||
U_CFUNC const char* ures_getPath(const UResourceBundle* resB);
|
||||
/**
|
||||
* If anything was in the RB cache, dump it to the screen.
|
||||
* @return TRUE if there was anything into the cache
|
||||
*/
|
||||
U_CAPI UBool U_EXPORT2 ures_dumpCacheContents(void);
|
||||
#endif
|
||||
/*U_CFUNC void ures_appendResPath(UResourceBundle *resB, const char* toAdd, int32_t lenToAdd);*/
|
||||
/*U_CFUNC void ures_setResPath(UResourceBundle *resB, const char* toAdd);*/
|
||||
|
|
|
@ -667,8 +667,11 @@ UBool RegexMatcher::find() {
|
|||
for (;;) {
|
||||
c = UTEXT_NEXT32(fInputText);
|
||||
pos = UTEXT_GETNATIVEINDEX(fInputText);
|
||||
if (c<256 && fPattern->fInitialChars8->contains(c) ||
|
||||
c>=256 && fPattern->fInitialChars->contains(c)) {
|
||||
// c will be -1 (U_SENTINEL) at end of text, in which case we
|
||||
// skip this next block (so we don't have a negative array index)
|
||||
// and handle end of text in the following block.
|
||||
if (c >= 0 && (c<256 && fPattern->fInitialChars8->contains(c) ||
|
||||
c>=256 && fPattern->fInitialChars->contains(c))) {
|
||||
MatchAt(startPos, FALSE, fDeferredStatus);
|
||||
if (U_FAILURE(fDeferredStatus)) {
|
||||
return FALSE;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/********************************************************************
|
||||
* COPYRIGHT:
|
||||
* Copyright (c) 1997-2009, International Business Machines Corporation and
|
||||
* Copyright (c) 1997-2010, International Business Machines Corporation and
|
||||
* others. All Rights Reserved.
|
||||
********************************************************************/
|
||||
/********************************************************************************
|
||||
|
@ -33,6 +33,9 @@
|
|||
#include "unicode/ucal.h"
|
||||
#include "uoptions.h"
|
||||
#include "putilimp.h" /* for uprv_getUTCtime() */
|
||||
#ifdef URES_DEBUG
|
||||
#include "uresimp.h" /* for ures_dumpCacheContents() */
|
||||
#endif
|
||||
|
||||
#ifdef XP_MAC_CONSOLE
|
||||
# include <console.h>
|
||||
|
@ -104,6 +107,9 @@ int main(int argc, const char* const argv[])
|
|||
defaultDataFound = FALSE;
|
||||
}
|
||||
u_cleanup();
|
||||
#ifdef URES_DEBUG
|
||||
fprintf(stderr, "After initial u_cleanup: RB cache %s empty.\n", ures_dumpCacheContents()?"WAS NOT":"was");
|
||||
#endif
|
||||
|
||||
while (REPEAT_TESTS > 0) { /* Loop runs once per complete execution of the tests
|
||||
* used for -r (repeat) test option. */
|
||||
|
@ -203,6 +209,14 @@ int main(int argc, const char* const argv[])
|
|||
ctst_freeAll();
|
||||
/* To check for leaks */
|
||||
u_cleanup(); /* nuke the hashtable.. so that any still-open cnvs are leaked */
|
||||
#ifdef URES_DEBUG
|
||||
if(ures_dumpCacheContents()) {
|
||||
fprintf(stderr, "Error: After final u_cleanup, RB cache was not empty.\n");
|
||||
nerrors++;
|
||||
} else {
|
||||
fprintf(stderr,"OK: After final u_cleanup, RB cache was empty.\n");
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
} /* End of loop that repeats the entire test, if requested. (Normally doesn't loop) */
|
||||
|
|
Loading…
Add table
Reference in a new issue