Port fix for bug 206775 (can't search NLS characters in history) to firebird. Patch by gelsoft@mx4.tiki.ne.jp.

This commit is contained in:
bryner%netscape.com 2003-06-17 18:23:53 +00:00
Родитель 45fde5c69a
Коммит cc80d85925
2 изменённых файлов: 9 добавлений и 5 удалений

Просмотреть файл

@ -40,6 +40,7 @@ REQUIRES = xpcom \
intl \
unicharutil \
autocomplete \
uconv \
$(NULL)
CPPSRCS = nsGlobalHistory.cpp \

Просмотреть файл

@ -84,6 +84,7 @@
#include "nsIPrefBranchInternal.h"
#include "nsIObserverService.h"
#include "nsITextToSubURI.h"
PRInt32 nsGlobalHistory::gRefCnt;
nsIRDFService* nsGlobalHistory::gRDFService;
@ -181,9 +182,10 @@ public:
method(aMethod, aMethod+aMethodLen)
{
MOZ_COUNT_CTOR(searchTerm);
// need to do UTF8-conversion/unescaping here, using
// nsITextToSubURI
text.AssignWithConversion(aText, aTextLen);
nsresult rv;
nsCOMPtr<nsITextToSubURI> textToSubURI = do_GetService(NS_ITEXTTOSUBURI_CONTRACTID, &rv);
if (NS_SUCCEEDED(rv))
textToSubURI->UnEscapeAndConvert("UTF-8", PromiseFlatCString(Substring(aText, aText + aTextLen)).get(), getter_Copies(text));
}
~searchTerm() {
MOZ_COUNT_DTOR(searchTerm);
@ -192,7 +194,7 @@ public:
nsDependentSingleFragmentCSubstring datasource; // should always be "history" ?
nsDependentSingleFragmentCSubstring property; // AgeInDays, Hostname, etc
nsDependentSingleFragmentCSubstring method; // is, isgreater, isless
nsAutoString text; // text to match
nsXPIDLString text; // text to match
rowMatchCallback match; // matching callback if needed
};
@ -338,7 +340,8 @@ matchAgeInDaysCallback(nsIMdbRow *row, void *aClosure)
// this saves us from recalculating this stuff on every row
if (!matchSearchTerm->haveClosure) {
PRInt32 err;
matchSearchTerm->intValue = term->text.ToInteger(&err);
// Need to create an nsAutoString to use ToInteger
matchSearchTerm->intValue = nsAutoString(term->text).ToInteger(&err);
matchSearchTerm->now = NormalizeTime(PR_Now());
if (err != 0) return PR_FALSE;
matchSearchTerm->haveClosure = PR_TRUE;