diff --git a/mozilla/netwerk/protocol/gopher/src/nsGopherChannel.cpp b/mozilla/netwerk/protocol/gopher/src/nsGopherChannel.cpp index 02fdb066665..3afd7fefbc6 100644 --- a/mozilla/netwerk/protocol/gopher/src/nsGopherChannel.cpp +++ b/mozilla/netwerk/protocol/gopher/src/nsGopherChannel.cpp @@ -111,7 +111,7 @@ nsGopherChannel::Init(nsIURI* uri) mSelector.Adopt(nsCRT::strdup("")); } else { mType = buffer[1]; // Ignore leading '/' - mSelector.Adopt(nsCRT::strdup(nsUnescape(NS_CONST_CAST(char*,&buffer[2])))); + mSelector.Adopt(nsCRT::strdup(nsUnescape(NS_CONST_CAST(char*,buffer.get()+2)))); } PR_LOG(gGopherLog, diff --git a/mozilla/string/macbuild/string.mcp b/mozilla/string/macbuild/string.mcp index 4191b939b0e..74a50134c2a 100644 Binary files a/mozilla/string/macbuild/string.mcp and b/mozilla/string/macbuild/string.mcp differ diff --git a/mozilla/string/obsolete/MANIFEST b/mozilla/string/obsolete/MANIFEST index 2163e7e71a3..fdd6d7a70ad 100644 --- a/mozilla/string/obsolete/MANIFEST +++ b/mozilla/string/obsolete/MANIFEST @@ -24,4 +24,3 @@ nsStr.h nsString.h nsString2.h -nsXPIDLString.h diff --git a/mozilla/string/obsolete/Makefile.in b/mozilla/string/obsolete/Makefile.in index 424af3d252b..892fea02da0 100644 --- a/mozilla/string/obsolete/Makefile.in +++ b/mozilla/string/obsolete/Makefile.in @@ -36,14 +36,12 @@ CPPSRCS = \ nsStr.cpp \ nsString.cpp \ nsString2.cpp \ - nsXPIDLString.cpp \ $(NULL) EXPORTS = \ nsStr.h \ nsString.h \ nsString2.h \ - nsXPIDLString.h \ $(NULL) EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS)) diff --git a/mozilla/string/obsolete/bufferRoutines.h b/mozilla/string/obsolete/bufferRoutines.h index 541d192358d..32798265208 100644 --- a/mozilla/string/obsolete/bufferRoutines.h +++ b/mozilla/string/obsolete/bufferRoutines.h @@ -28,6 +28,11 @@ #ifndef _BUFFERROUTINES_H #define _BUFFERROUTINES_H +#ifndef nsStringDefines_h___ +#include "nsStringDefines.h" +#endif + + /****************************************************************************************** MODULE NOTES: @@ -155,6 +160,7 @@ inline PRUnichar GetCharAt(const char* aString,PRUint32 anIndex) { * @param anOffset is the index into aDest where shifting shall begin * @param aCount is the number of chars to be "cut" */ +void ShiftCharsLeft(char* aDest,PRUint32 aLength,PRUint32 anOffset,PRUint32 aCount); void ShiftCharsLeft(char* aDest,PRUint32 aLength,PRUint32 anOffset,PRUint32 aCount) { char* dst = aDest+anOffset; char* src = aDest+anOffset+aCount; @@ -170,6 +176,7 @@ void ShiftCharsLeft(char* aDest,PRUint32 aLength,PRUint32 anOffset,PRUint32 aCou * @param anOffset is the index into aDest where shifting shall begin * @param aCount is the number of chars to be "inserted" */ +void ShiftCharsRight(char* aDest,PRUint32 aLength,PRUint32 anOffset,PRUint32 aCount); void ShiftCharsRight(char* aDest,PRUint32 aLength,PRUint32 anOffset,PRUint32 aCount) { char* src = aDest+anOffset; char* dst = aDest+anOffset+aCount; @@ -185,6 +192,7 @@ void ShiftCharsRight(char* aDest,PRUint32 aLength,PRUint32 anOffset,PRUint32 aCo * @param anOffset is the index into aDest where shifting shall begin * @param aCount is the number of chars to be "cut" */ +void ShiftDoubleCharsLeft(char* aDest,PRUint32 aLength,PRUint32 anOffset,PRUint32 aCount); void ShiftDoubleCharsLeft(char* aDest,PRUint32 aLength,PRUint32 anOffset,PRUint32 aCount) { PRUnichar* root=(PRUnichar*)aDest; PRUnichar* dst = root+anOffset; @@ -202,6 +210,7 @@ void ShiftDoubleCharsLeft(char* aDest,PRUint32 aLength,PRUint32 anOffset,PRUint3 * @param anOffset is the index into aDest where shifting shall begin * @param aCount is the number of chars to be "inserted" */ +void ShiftDoubleCharsRight(char* aDest,PRUint32 aLength,PRUint32 anOffset,PRUint32 aCount); void ShiftDoubleCharsRight(char* aDest,PRUint32 aLength,PRUint32 anOffset,PRUint32 aCount) { PRUnichar* root=(PRUnichar*)aDest; PRUnichar* src = root+anOffset; @@ -236,6 +245,7 @@ ShiftChars gShiftChars[2][2]= { * @param anOffset is the offset to start copying from in the source buffer * @param aCount is the (max) number of chars to copy */ +void CopyChars1To1(char* aDest,PRInt32 anDestOffset,const char* aSource,PRUint32 anOffset,PRUint32 aCount); void CopyChars1To1(char* aDest,PRInt32 anDestOffset,const char* aSource,PRUint32 anOffset,PRUint32 aCount) { char* dst = aDest+anDestOffset; @@ -252,6 +262,7 @@ void CopyChars1To1(char* aDest,PRInt32 anDestOffset,const char* aSource,PRUint32 * @param anOffset is the offset to start copying from in the source buffer * @param aCount is the (max) number of chars to copy */ +void CopyChars1To2(char* aDest,PRInt32 anDestOffset,const char* aSource,PRUint32 anOffset,PRUint32 aCount); void CopyChars1To2(char* aDest,PRInt32 anDestOffset,const char* aSource,PRUint32 anOffset,PRUint32 aCount) { PRUnichar* theDest=(PRUnichar*)aDest; @@ -288,6 +299,7 @@ void CopyChars1To2(char* aDest,PRInt32 anDestOffset,const char* aSource,PRUint32 * @param anOffset is the offset to start copying from in the source buffer * @param aCount is the (max) number of chars to copy */ +void CopyChars2To1(char* aDest,PRInt32 anDestOffset,const char* aSource,PRUint32 anOffset,PRUint32 aCount); void CopyChars2To1(char* aDest,PRInt32 anDestOffset,const char* aSource,PRUint32 anOffset,PRUint32 aCount) { char* to = aDest+anDestOffset; PRUnichar* theSource=(PRUnichar*)aSource; @@ -333,6 +345,7 @@ void CopyChars2To1(char* aDest,PRInt32 anDestOffset,const char* aSource,PRUint32 * @param anOffset is the offset to start copying from in the source buffer * @param aCount is the (max) number of chars to copy */ +void CopyChars2To2(char* aDest,PRInt32 anDestOffset,const char* aSource,PRUint32 anOffset,PRUint32 aCount); void CopyChars2To2(char* aDest,PRInt32 anDestOffset,const char* aSource,PRUint32 anOffset,PRUint32 aCount) { PRUnichar* theDest=(PRUnichar*)aDest; PRUnichar* to = theDest+anDestOffset; @@ -490,7 +503,7 @@ inline PRInt32 RFindChar1(const char* aDest,PRUint32 aDestLength,PRInt32 anOffse anOffset=(PRInt32)aDestLength-1; if(aCount<0) - aCount = aDestLength; + aCount = PRInt32(aDestLength); if((aChar<256) && (0 */ +PRInt32 Compare1To1(const char* aStr1,const char* aStr2,PRUint32 aCount,PRBool aIgnoreCase); PRInt32 Compare1To1(const char* aStr1,const char* aStr2,PRUint32 aCount,PRBool aIgnoreCase){ PRInt32 result=0; if(aIgnoreCase) @@ -619,6 +633,7 @@ PRInt32 Compare1To1(const char* aStr1,const char* aStr2,PRUint32 aCount,PRBool a * @param aIgnorecase tells us whether to use a case-sensitive comparison * @return -1,0,1 depending on <,==,> */ +PRInt32 Compare2To2(const char* aStr1,const char* aStr2,PRUint32 aCount,PRBool aIgnoreCase); PRInt32 Compare2To2(const char* aStr1,const char* aStr2,PRUint32 aCount,PRBool aIgnoreCase){ PRInt32 result=0; if(aIgnoreCase) @@ -637,6 +652,7 @@ PRInt32 Compare2To2(const char* aStr1,const char* aStr2,PRUint32 aCount,PRBool a * @param aIgnorecase tells us whether to use a case-sensitive comparison * @return -1,0,1 depending on <,==,> */ +PRInt32 Compare2To1(const char* aStr1,const char* aStr2,PRUint32 aCount,PRBool aIgnoreCase); PRInt32 Compare2To1(const char* aStr1,const char* aStr2,PRUint32 aCount,PRBool aIgnoreCase){ PRInt32 result; if(aIgnoreCase) @@ -655,6 +671,7 @@ PRInt32 Compare2To1(const char* aStr1,const char* aStr2,PRUint32 aCount,PRBool a * @param aIgnorecase tells us whether to use a case-sensitive comparison * @return -1,0,1 depending on <,==,> */ +PRInt32 Compare1To2(const char* aStr1,const char* aStr2,PRUint32 aCount,PRBool aIgnoreCase); PRInt32 Compare1To2(const char* aStr1,const char* aStr2,PRUint32 aCount,PRBool aIgnoreCase){ PRInt32 result; if(aIgnoreCase) @@ -685,6 +702,7 @@ CompareChars gCompare[2][2]={ * @param aToUpper tells us whether to convert to upper or lower * @return 0 */ +PRInt32 ConvertCase1(char* aString,PRUint32 aCount,PRBool aToUpper); PRInt32 ConvertCase1(char* aString,PRUint32 aCount,PRBool aToUpper){ PRInt32 result=0; @@ -695,12 +713,12 @@ PRInt32 ConvertCase1(char* aString,PRUint32 aCount,PRBool aToUpper){ chartype ch = *cp; if(aToUpper) { if ((ch >= 'a') && (ch <= 'z')) { - *cp = 'A' + (ch - 'a'); + *cp = chartype('A' + (ch - 'a')); } } else { if ((ch >= 'A') && (ch <= 'Z')) { - *cp = 'a' + (ch - 'A'); + *cp = chartype('a' + (ch - 'A')); } } cp++; @@ -762,6 +780,7 @@ public: * @param aToUpper tells us whether to convert to upper or lower * @return 0 */ +PRInt32 ConvertCase2(char* aString,PRUint32 aCount,PRBool aToUpper); PRInt32 ConvertCase2(char* aString,PRUint32 aCount,PRBool aToUpper){ PRUnichar* cp = (PRUnichar*)aString; PRUnichar* end = cp + aCount-1; @@ -786,12 +805,12 @@ PRInt32 ConvertCase2(char* aString,PRUint32 aCount,PRBool aToUpper){ PRUnichar ch = *cp; if(aToUpper) { if ((ch >= 'a') && (ch <= 'z')) { - *cp = 'A' + (ch - 'a'); + *cp = PRUnichar('A' + (ch - 'a')); } } else { if ((ch >= 'A') && (ch <= 'Z')) { - *cp = 'a' + (ch - 'A'); + *cp = PRUnichar('a' + (ch - 'A')); } } cp++; @@ -822,6 +841,7 @@ CaseConverters gCaseConverters[]={&ConvertCase1,&ConvertCase2}; * @param aEliminateTrailing tells us whether to strip chars from the start of the buffer * @return the new length of the given buffer */ +PRInt32 CompressChars1(char* aString,PRUint32 aLength,const char* aSet); PRInt32 CompressChars1(char* aString,PRUint32 aLength,const char* aSet){ char* from = aString; @@ -866,6 +886,7 @@ PRInt32 CompressChars1(char* aString,PRUint32 aLength,const char* aSet){ * @param aEliminateTrailing tells us whether to strip chars from the start of the buffer * @return the new length of the given buffer */ +PRInt32 CompressChars2(char* aString,PRUint32 aLength,const char* aSet); PRInt32 CompressChars2(char* aString,PRUint32 aLength,const char* aSet){ PRUnichar* from = (PRUnichar*)aString; @@ -911,6 +932,7 @@ CompressChars gCompressChars[]={&CompressChars1,&CompressChars2}; * @param aEliminateTrailing tells us whether to strip chars from the start of the buffer * @return the new length of the given buffer */ +PRInt32 StripChars1(char* aString,PRUint32 aLength,const char* aSet); PRInt32 StripChars1(char* aString,PRUint32 aLength,const char* aSet){ char* to = aString; @@ -942,6 +964,7 @@ PRInt32 StripChars1(char* aString,PRUint32 aLength,const char* aSet){ * @param aEliminateTrailing tells us whether to strip chars from the start of the buffer * @return the new length of the given buffer */ +PRInt32 StripChars2(char* aString,PRUint32 aLength,const char* aSet); PRInt32 StripChars2(char* aString,PRUint32 aLength,const char* aSet){ PRUnichar* to = (PRUnichar*)aString; diff --git a/mozilla/string/obsolete/makefile.win b/mozilla/string/obsolete/makefile.win index 1f185b1aea5..e778b9e954f 100644 --- a/mozilla/string/obsolete/makefile.win +++ b/mozilla/string/obsolete/makefile.win @@ -27,7 +27,6 @@ EXPORTS = \ nsStr.h \ nsString.h \ nsString2.h \ - nsXPIDLString.h \ $(NULL) LIBRARY_NAME=string_obsolete_s @@ -39,7 +38,6 @@ CPP_OBJS = \ .\$(OBJDIR)\nsStr.obj \ .\$(OBJDIR)\nsString.obj \ .\$(OBJDIR)\nsString2.obj \ - .\$(OBJDIR)\nsXPIDLString.obj \ $(NULL) include <$(DEPTH)\config\rules.mak> diff --git a/mozilla/string/obsolete/nsStr.h b/mozilla/string/obsolete/nsStr.h index 4348d7ea9de..3f78e41e378 100644 --- a/mozilla/string/obsolete/nsStr.h +++ b/mozilla/string/obsolete/nsStr.h @@ -29,6 +29,11 @@ #ifndef _nsStr #define _nsStr +#ifndef nsStringDefines_h___ +#include "nsStringDefines.h" +#endif + + /*********************************************************************** MODULE NOTES: diff --git a/mozilla/string/public/MANIFEST b/mozilla/string/public/MANIFEST index e87dd826f05..5cbd1883403 100644 --- a/mozilla/string/public/MANIFEST +++ b/mozilla/string/public/MANIFEST @@ -43,8 +43,10 @@ nsReadableUtils.h nsSharableString.h nsSharedBufferList.h nsSlidingString.h +nsStringDefines.h nsStringFragment.h nsStringFwd.h nsStringIterator.h nsStringIteratorUtils.h nsStringTraits.h +nsXPIDLString.h diff --git a/mozilla/string/public/Makefile.in b/mozilla/string/public/Makefile.in index 09103b73948..7506c81592f 100644 --- a/mozilla/string/public/Makefile.in +++ b/mozilla/string/public/Makefile.in @@ -53,11 +53,13 @@ EXPORTS = \ nsSharableString.h \ nsSharedBufferList.h \ nsSlidingString.h \ + nsStringDefines.h \ nsStringFragment.h \ nsStringFwd.h \ nsStringIterator.h \ nsStringIteratorUtils.h \ nsStringTraits.h \ + nsXPIDLString.h \ $(NULL) EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS)) diff --git a/mozilla/string/public/makefile.win b/mozilla/string/public/makefile.win index 4ea88569843..97e7d4f6300 100644 --- a/mozilla/string/public/makefile.win +++ b/mozilla/string/public/makefile.win @@ -47,11 +47,13 @@ EXPORTS = \ nsSharableString.h \ nsSharedBufferList.h \ nsSlidingString.h \ + nsStringDefines.h \ nsStringFragment.h \ nsStringFwd.h \ nsStringIterator.h \ nsStringIteratorUtils.h \ nsStringTraits.h \ + nsXPIDLString.h \ $(NULL) include <$(DEPTH)\config\rules.mak> diff --git a/mozilla/string/public/nsAFlatString.h b/mozilla/string/public/nsAFlatString.h index c197bbf32ed..79fe6be866b 100644 --- a/mozilla/string/public/nsAFlatString.h +++ b/mozilla/string/public/nsAFlatString.h @@ -36,7 +36,7 @@ class NS_COM nsAFlatString public: // don't really want this to be virtual, and won't after |obsolete_nsString| is really dead virtual const PRUnichar* get() const; - PRUnichar operator[]( PRUint32 i ) const { return get()[ i ]; } + PRUnichar operator[]( int i ) const { return get()[ i ]; } PRUnichar CharAt( PRUint32 ) const; virtual PRUint32 Length() const; @@ -53,7 +53,7 @@ class NS_COM nsAFlatCString public: // don't really want this to be virtual, and won't after |obsolete_nsCString| is really dead virtual const char* get() const; - char operator[]( PRUint32 i ) const { return get()[ i ]; } + char operator[]( int i ) const { return get()[ i ]; } char CharAt( PRUint32 ) const; virtual PRUint32 Length() const; @@ -69,7 +69,7 @@ PRUnichar nsAFlatString::CharAt( PRUint32 i ) const { NS_ASSERTION(i // for |ptrdiff_t| diff --git a/mozilla/string/public/nsCharTraits.h b/mozilla/string/public/nsCharTraits.h index 32f0fb58c4e..842b752e715 100644 --- a/mozilla/string/public/nsCharTraits.h +++ b/mozilla/string/public/nsCharTraits.h @@ -24,6 +24,10 @@ #ifndef nsCharTraits_h___ #define nsCharTraits_h___ +#ifndef nsStringDefines_h___ +#include "nsStringDefines.h" +#endif + #include // for |EOF|, |WEOF| diff --git a/mozilla/string/public/nsSharableString.h b/mozilla/string/public/nsSharableString.h index 8a62223854a..9fec3209445 100644 --- a/mozilla/string/public/nsSharableString.h +++ b/mozilla/string/public/nsSharableString.h @@ -66,7 +66,7 @@ class NS_COM nsSharableString void assign( const string_type& ); virtual const nsSharedBufferHandle* GetSharedBufferHandle() const; - private: + protected: nsAutoBufferHandle mBuffer; }; @@ -96,7 +96,7 @@ class NS_COM nsSharableCString void assign( const string_type& ); virtual const nsSharedBufferHandle* GetSharedBufferHandle() const; - private: + protected: nsAutoBufferHandle mBuffer; }; diff --git a/mozilla/string/public/nsStringFragment.h b/mozilla/string/public/nsStringFragment.h index 0a8238023e9..d54287965d3 100644 --- a/mozilla/string/public/nsStringFragment.h +++ b/mozilla/string/public/nsStringFragment.h @@ -26,6 +26,9 @@ #ifndef nsStringFragment_h___ #define nsStringFragment_h___ +#ifndef nsStringDefines_h___ +#include "nsStringDefines.h" +#endif /** diff --git a/mozilla/string/public/nsStringFwd.h b/mozilla/string/public/nsStringFwd.h index ce7d32849df..4f68b5febb5 100644 --- a/mozilla/string/public/nsStringFwd.h +++ b/mozilla/string/public/nsStringFwd.h @@ -26,6 +26,10 @@ #ifndef nsStringFwd_h___ #define nsStringFwd_h___ +#ifndef nsStringDefines_h___ +#include "nsStringDefines.h" +#endif + /** * @see nsAString.h diff --git a/mozilla/string/public/nsStringIteratorUtils.h b/mozilla/string/public/nsStringIteratorUtils.h index 0d74365c1eb..ee07075a313 100644 --- a/mozilla/string/public/nsStringIteratorUtils.h +++ b/mozilla/string/public/nsStringIteratorUtils.h @@ -24,6 +24,10 @@ #ifndef nsStringIteratorUtils_h___ #define nsStringIteratorUtils_h___ +#ifndef nsStringDefines_h___ +#include "nsStringDefines.h" +#endif + template inline PRBool diff --git a/mozilla/string/src/Makefile.in b/mozilla/string/src/Makefile.in index 18983106d97..dca0a65c6de 100644 --- a/mozilla/string/src/Makefile.in +++ b/mozilla/string/src/Makefile.in @@ -47,6 +47,7 @@ CPPSRCS = \ nsSharableString.cpp \ nsSharedBufferList.cpp \ nsSlidingString.cpp \ + nsXPIDLString.cpp \ $(NULL) EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS)) diff --git a/mozilla/string/src/makefile.win b/mozilla/string/src/makefile.win index 1edabfe5682..624f3ed2596 100644 --- a/mozilla/string/src/makefile.win +++ b/mozilla/string/src/makefile.win @@ -42,6 +42,7 @@ CPP_OBJS = \ .\$(OBJDIR)\nsSharableString.obj \ .\$(OBJDIR)\nsSharedBufferList.obj \ .\$(OBJDIR)\nsSlidingString.obj \ + .\$(OBJDIR)\nsXPIDLString.obj \ $(NULL) include <$(DEPTH)\config\rules.mak> diff --git a/mozilla/string/src/nsAFlatString.cpp b/mozilla/string/src/nsAFlatString.cpp index 114d01ad1b2..d9f7b1607a8 100644 --- a/mozilla/string/src/nsAFlatString.cpp +++ b/mozilla/string/src/nsAFlatString.cpp @@ -133,7 +133,7 @@ const PRUnichar* nsAFlatString::get() const { const nsBufferHandle* handle = GetBufferHandle(); - NS_ASSERTION(handle, "handle is null!"); + // NS_ASSERTION(handle, "handle is null!"); return handle ? handle->DataStart() : 0; } @@ -141,6 +141,6 @@ const char* nsAFlatCString::get() const { const nsBufferHandle* handle = GetBufferHandle(); - NS_ASSERTION(handle, "handle is null!"); + // NS_ASSERTION(handle, "handle is null!"); return handle ? handle->DataStart() : 0; } diff --git a/mozilla/xpcom/string/macbuild/string.mcp b/mozilla/xpcom/string/macbuild/string.mcp index 4191b939b0e..74a50134c2a 100644 Binary files a/mozilla/xpcom/string/macbuild/string.mcp and b/mozilla/xpcom/string/macbuild/string.mcp differ diff --git a/mozilla/xpcom/string/obsolete/MANIFEST b/mozilla/xpcom/string/obsolete/MANIFEST index 2163e7e71a3..fdd6d7a70ad 100644 --- a/mozilla/xpcom/string/obsolete/MANIFEST +++ b/mozilla/xpcom/string/obsolete/MANIFEST @@ -24,4 +24,3 @@ nsStr.h nsString.h nsString2.h -nsXPIDLString.h diff --git a/mozilla/xpcom/string/obsolete/Makefile.in b/mozilla/xpcom/string/obsolete/Makefile.in index 424af3d252b..892fea02da0 100644 --- a/mozilla/xpcom/string/obsolete/Makefile.in +++ b/mozilla/xpcom/string/obsolete/Makefile.in @@ -36,14 +36,12 @@ CPPSRCS = \ nsStr.cpp \ nsString.cpp \ nsString2.cpp \ - nsXPIDLString.cpp \ $(NULL) EXPORTS = \ nsStr.h \ nsString.h \ nsString2.h \ - nsXPIDLString.h \ $(NULL) EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS)) diff --git a/mozilla/xpcom/string/obsolete/bufferRoutines.h b/mozilla/xpcom/string/obsolete/bufferRoutines.h index 541d192358d..32798265208 100644 --- a/mozilla/xpcom/string/obsolete/bufferRoutines.h +++ b/mozilla/xpcom/string/obsolete/bufferRoutines.h @@ -28,6 +28,11 @@ #ifndef _BUFFERROUTINES_H #define _BUFFERROUTINES_H +#ifndef nsStringDefines_h___ +#include "nsStringDefines.h" +#endif + + /****************************************************************************************** MODULE NOTES: @@ -155,6 +160,7 @@ inline PRUnichar GetCharAt(const char* aString,PRUint32 anIndex) { * @param anOffset is the index into aDest where shifting shall begin * @param aCount is the number of chars to be "cut" */ +void ShiftCharsLeft(char* aDest,PRUint32 aLength,PRUint32 anOffset,PRUint32 aCount); void ShiftCharsLeft(char* aDest,PRUint32 aLength,PRUint32 anOffset,PRUint32 aCount) { char* dst = aDest+anOffset; char* src = aDest+anOffset+aCount; @@ -170,6 +176,7 @@ void ShiftCharsLeft(char* aDest,PRUint32 aLength,PRUint32 anOffset,PRUint32 aCou * @param anOffset is the index into aDest where shifting shall begin * @param aCount is the number of chars to be "inserted" */ +void ShiftCharsRight(char* aDest,PRUint32 aLength,PRUint32 anOffset,PRUint32 aCount); void ShiftCharsRight(char* aDest,PRUint32 aLength,PRUint32 anOffset,PRUint32 aCount) { char* src = aDest+anOffset; char* dst = aDest+anOffset+aCount; @@ -185,6 +192,7 @@ void ShiftCharsRight(char* aDest,PRUint32 aLength,PRUint32 anOffset,PRUint32 aCo * @param anOffset is the index into aDest where shifting shall begin * @param aCount is the number of chars to be "cut" */ +void ShiftDoubleCharsLeft(char* aDest,PRUint32 aLength,PRUint32 anOffset,PRUint32 aCount); void ShiftDoubleCharsLeft(char* aDest,PRUint32 aLength,PRUint32 anOffset,PRUint32 aCount) { PRUnichar* root=(PRUnichar*)aDest; PRUnichar* dst = root+anOffset; @@ -202,6 +210,7 @@ void ShiftDoubleCharsLeft(char* aDest,PRUint32 aLength,PRUint32 anOffset,PRUint3 * @param anOffset is the index into aDest where shifting shall begin * @param aCount is the number of chars to be "inserted" */ +void ShiftDoubleCharsRight(char* aDest,PRUint32 aLength,PRUint32 anOffset,PRUint32 aCount); void ShiftDoubleCharsRight(char* aDest,PRUint32 aLength,PRUint32 anOffset,PRUint32 aCount) { PRUnichar* root=(PRUnichar*)aDest; PRUnichar* src = root+anOffset; @@ -236,6 +245,7 @@ ShiftChars gShiftChars[2][2]= { * @param anOffset is the offset to start copying from in the source buffer * @param aCount is the (max) number of chars to copy */ +void CopyChars1To1(char* aDest,PRInt32 anDestOffset,const char* aSource,PRUint32 anOffset,PRUint32 aCount); void CopyChars1To1(char* aDest,PRInt32 anDestOffset,const char* aSource,PRUint32 anOffset,PRUint32 aCount) { char* dst = aDest+anDestOffset; @@ -252,6 +262,7 @@ void CopyChars1To1(char* aDest,PRInt32 anDestOffset,const char* aSource,PRUint32 * @param anOffset is the offset to start copying from in the source buffer * @param aCount is the (max) number of chars to copy */ +void CopyChars1To2(char* aDest,PRInt32 anDestOffset,const char* aSource,PRUint32 anOffset,PRUint32 aCount); void CopyChars1To2(char* aDest,PRInt32 anDestOffset,const char* aSource,PRUint32 anOffset,PRUint32 aCount) { PRUnichar* theDest=(PRUnichar*)aDest; @@ -288,6 +299,7 @@ void CopyChars1To2(char* aDest,PRInt32 anDestOffset,const char* aSource,PRUint32 * @param anOffset is the offset to start copying from in the source buffer * @param aCount is the (max) number of chars to copy */ +void CopyChars2To1(char* aDest,PRInt32 anDestOffset,const char* aSource,PRUint32 anOffset,PRUint32 aCount); void CopyChars2To1(char* aDest,PRInt32 anDestOffset,const char* aSource,PRUint32 anOffset,PRUint32 aCount) { char* to = aDest+anDestOffset; PRUnichar* theSource=(PRUnichar*)aSource; @@ -333,6 +345,7 @@ void CopyChars2To1(char* aDest,PRInt32 anDestOffset,const char* aSource,PRUint32 * @param anOffset is the offset to start copying from in the source buffer * @param aCount is the (max) number of chars to copy */ +void CopyChars2To2(char* aDest,PRInt32 anDestOffset,const char* aSource,PRUint32 anOffset,PRUint32 aCount); void CopyChars2To2(char* aDest,PRInt32 anDestOffset,const char* aSource,PRUint32 anOffset,PRUint32 aCount) { PRUnichar* theDest=(PRUnichar*)aDest; PRUnichar* to = theDest+anDestOffset; @@ -490,7 +503,7 @@ inline PRInt32 RFindChar1(const char* aDest,PRUint32 aDestLength,PRInt32 anOffse anOffset=(PRInt32)aDestLength-1; if(aCount<0) - aCount = aDestLength; + aCount = PRInt32(aDestLength); if((aChar<256) && (0 */ +PRInt32 Compare1To1(const char* aStr1,const char* aStr2,PRUint32 aCount,PRBool aIgnoreCase); PRInt32 Compare1To1(const char* aStr1,const char* aStr2,PRUint32 aCount,PRBool aIgnoreCase){ PRInt32 result=0; if(aIgnoreCase) @@ -619,6 +633,7 @@ PRInt32 Compare1To1(const char* aStr1,const char* aStr2,PRUint32 aCount,PRBool a * @param aIgnorecase tells us whether to use a case-sensitive comparison * @return -1,0,1 depending on <,==,> */ +PRInt32 Compare2To2(const char* aStr1,const char* aStr2,PRUint32 aCount,PRBool aIgnoreCase); PRInt32 Compare2To2(const char* aStr1,const char* aStr2,PRUint32 aCount,PRBool aIgnoreCase){ PRInt32 result=0; if(aIgnoreCase) @@ -637,6 +652,7 @@ PRInt32 Compare2To2(const char* aStr1,const char* aStr2,PRUint32 aCount,PRBool a * @param aIgnorecase tells us whether to use a case-sensitive comparison * @return -1,0,1 depending on <,==,> */ +PRInt32 Compare2To1(const char* aStr1,const char* aStr2,PRUint32 aCount,PRBool aIgnoreCase); PRInt32 Compare2To1(const char* aStr1,const char* aStr2,PRUint32 aCount,PRBool aIgnoreCase){ PRInt32 result; if(aIgnoreCase) @@ -655,6 +671,7 @@ PRInt32 Compare2To1(const char* aStr1,const char* aStr2,PRUint32 aCount,PRBool a * @param aIgnorecase tells us whether to use a case-sensitive comparison * @return -1,0,1 depending on <,==,> */ +PRInt32 Compare1To2(const char* aStr1,const char* aStr2,PRUint32 aCount,PRBool aIgnoreCase); PRInt32 Compare1To2(const char* aStr1,const char* aStr2,PRUint32 aCount,PRBool aIgnoreCase){ PRInt32 result; if(aIgnoreCase) @@ -685,6 +702,7 @@ CompareChars gCompare[2][2]={ * @param aToUpper tells us whether to convert to upper or lower * @return 0 */ +PRInt32 ConvertCase1(char* aString,PRUint32 aCount,PRBool aToUpper); PRInt32 ConvertCase1(char* aString,PRUint32 aCount,PRBool aToUpper){ PRInt32 result=0; @@ -695,12 +713,12 @@ PRInt32 ConvertCase1(char* aString,PRUint32 aCount,PRBool aToUpper){ chartype ch = *cp; if(aToUpper) { if ((ch >= 'a') && (ch <= 'z')) { - *cp = 'A' + (ch - 'a'); + *cp = chartype('A' + (ch - 'a')); } } else { if ((ch >= 'A') && (ch <= 'Z')) { - *cp = 'a' + (ch - 'A'); + *cp = chartype('a' + (ch - 'A')); } } cp++; @@ -762,6 +780,7 @@ public: * @param aToUpper tells us whether to convert to upper or lower * @return 0 */ +PRInt32 ConvertCase2(char* aString,PRUint32 aCount,PRBool aToUpper); PRInt32 ConvertCase2(char* aString,PRUint32 aCount,PRBool aToUpper){ PRUnichar* cp = (PRUnichar*)aString; PRUnichar* end = cp + aCount-1; @@ -786,12 +805,12 @@ PRInt32 ConvertCase2(char* aString,PRUint32 aCount,PRBool aToUpper){ PRUnichar ch = *cp; if(aToUpper) { if ((ch >= 'a') && (ch <= 'z')) { - *cp = 'A' + (ch - 'a'); + *cp = PRUnichar('A' + (ch - 'a')); } } else { if ((ch >= 'A') && (ch <= 'Z')) { - *cp = 'a' + (ch - 'A'); + *cp = PRUnichar('a' + (ch - 'A')); } } cp++; @@ -822,6 +841,7 @@ CaseConverters gCaseConverters[]={&ConvertCase1,&ConvertCase2}; * @param aEliminateTrailing tells us whether to strip chars from the start of the buffer * @return the new length of the given buffer */ +PRInt32 CompressChars1(char* aString,PRUint32 aLength,const char* aSet); PRInt32 CompressChars1(char* aString,PRUint32 aLength,const char* aSet){ char* from = aString; @@ -866,6 +886,7 @@ PRInt32 CompressChars1(char* aString,PRUint32 aLength,const char* aSet){ * @param aEliminateTrailing tells us whether to strip chars from the start of the buffer * @return the new length of the given buffer */ +PRInt32 CompressChars2(char* aString,PRUint32 aLength,const char* aSet); PRInt32 CompressChars2(char* aString,PRUint32 aLength,const char* aSet){ PRUnichar* from = (PRUnichar*)aString; @@ -911,6 +932,7 @@ CompressChars gCompressChars[]={&CompressChars1,&CompressChars2}; * @param aEliminateTrailing tells us whether to strip chars from the start of the buffer * @return the new length of the given buffer */ +PRInt32 StripChars1(char* aString,PRUint32 aLength,const char* aSet); PRInt32 StripChars1(char* aString,PRUint32 aLength,const char* aSet){ char* to = aString; @@ -942,6 +964,7 @@ PRInt32 StripChars1(char* aString,PRUint32 aLength,const char* aSet){ * @param aEliminateTrailing tells us whether to strip chars from the start of the buffer * @return the new length of the given buffer */ +PRInt32 StripChars2(char* aString,PRUint32 aLength,const char* aSet); PRInt32 StripChars2(char* aString,PRUint32 aLength,const char* aSet){ PRUnichar* to = (PRUnichar*)aString; diff --git a/mozilla/xpcom/string/obsolete/makefile.win b/mozilla/xpcom/string/obsolete/makefile.win index 1f185b1aea5..e778b9e954f 100644 --- a/mozilla/xpcom/string/obsolete/makefile.win +++ b/mozilla/xpcom/string/obsolete/makefile.win @@ -27,7 +27,6 @@ EXPORTS = \ nsStr.h \ nsString.h \ nsString2.h \ - nsXPIDLString.h \ $(NULL) LIBRARY_NAME=string_obsolete_s @@ -39,7 +38,6 @@ CPP_OBJS = \ .\$(OBJDIR)\nsStr.obj \ .\$(OBJDIR)\nsString.obj \ .\$(OBJDIR)\nsString2.obj \ - .\$(OBJDIR)\nsXPIDLString.obj \ $(NULL) include <$(DEPTH)\config\rules.mak> diff --git a/mozilla/xpcom/string/obsolete/nsStr.h b/mozilla/xpcom/string/obsolete/nsStr.h index 4348d7ea9de..3f78e41e378 100644 --- a/mozilla/xpcom/string/obsolete/nsStr.h +++ b/mozilla/xpcom/string/obsolete/nsStr.h @@ -29,6 +29,11 @@ #ifndef _nsStr #define _nsStr +#ifndef nsStringDefines_h___ +#include "nsStringDefines.h" +#endif + + /*********************************************************************** MODULE NOTES: diff --git a/mozilla/xpcom/string/public/MANIFEST b/mozilla/xpcom/string/public/MANIFEST index e87dd826f05..5cbd1883403 100644 --- a/mozilla/xpcom/string/public/MANIFEST +++ b/mozilla/xpcom/string/public/MANIFEST @@ -43,8 +43,10 @@ nsReadableUtils.h nsSharableString.h nsSharedBufferList.h nsSlidingString.h +nsStringDefines.h nsStringFragment.h nsStringFwd.h nsStringIterator.h nsStringIteratorUtils.h nsStringTraits.h +nsXPIDLString.h diff --git a/mozilla/xpcom/string/public/Makefile.in b/mozilla/xpcom/string/public/Makefile.in index 09103b73948..7506c81592f 100644 --- a/mozilla/xpcom/string/public/Makefile.in +++ b/mozilla/xpcom/string/public/Makefile.in @@ -53,11 +53,13 @@ EXPORTS = \ nsSharableString.h \ nsSharedBufferList.h \ nsSlidingString.h \ + nsStringDefines.h \ nsStringFragment.h \ nsStringFwd.h \ nsStringIterator.h \ nsStringIteratorUtils.h \ nsStringTraits.h \ + nsXPIDLString.h \ $(NULL) EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS)) diff --git a/mozilla/xpcom/string/public/makefile.win b/mozilla/xpcom/string/public/makefile.win index 4ea88569843..97e7d4f6300 100644 --- a/mozilla/xpcom/string/public/makefile.win +++ b/mozilla/xpcom/string/public/makefile.win @@ -47,11 +47,13 @@ EXPORTS = \ nsSharableString.h \ nsSharedBufferList.h \ nsSlidingString.h \ + nsStringDefines.h \ nsStringFragment.h \ nsStringFwd.h \ nsStringIterator.h \ nsStringIteratorUtils.h \ nsStringTraits.h \ + nsXPIDLString.h \ $(NULL) include <$(DEPTH)\config\rules.mak> diff --git a/mozilla/xpcom/string/public/nsAFlatString.h b/mozilla/xpcom/string/public/nsAFlatString.h index c197bbf32ed..79fe6be866b 100644 --- a/mozilla/xpcom/string/public/nsAFlatString.h +++ b/mozilla/xpcom/string/public/nsAFlatString.h @@ -36,7 +36,7 @@ class NS_COM nsAFlatString public: // don't really want this to be virtual, and won't after |obsolete_nsString| is really dead virtual const PRUnichar* get() const; - PRUnichar operator[]( PRUint32 i ) const { return get()[ i ]; } + PRUnichar operator[]( int i ) const { return get()[ i ]; } PRUnichar CharAt( PRUint32 ) const; virtual PRUint32 Length() const; @@ -53,7 +53,7 @@ class NS_COM nsAFlatCString public: // don't really want this to be virtual, and won't after |obsolete_nsCString| is really dead virtual const char* get() const; - char operator[]( PRUint32 i ) const { return get()[ i ]; } + char operator[]( int i ) const { return get()[ i ]; } char CharAt( PRUint32 ) const; virtual PRUint32 Length() const; @@ -69,7 +69,7 @@ PRUnichar nsAFlatString::CharAt( PRUint32 i ) const { NS_ASSERTION(i // for |ptrdiff_t| diff --git a/mozilla/xpcom/string/public/nsCharTraits.h b/mozilla/xpcom/string/public/nsCharTraits.h index 32f0fb58c4e..842b752e715 100644 --- a/mozilla/xpcom/string/public/nsCharTraits.h +++ b/mozilla/xpcom/string/public/nsCharTraits.h @@ -24,6 +24,10 @@ #ifndef nsCharTraits_h___ #define nsCharTraits_h___ +#ifndef nsStringDefines_h___ +#include "nsStringDefines.h" +#endif + #include // for |EOF|, |WEOF| diff --git a/mozilla/xpcom/string/public/nsSharableString.h b/mozilla/xpcom/string/public/nsSharableString.h index 8a62223854a..9fec3209445 100644 --- a/mozilla/xpcom/string/public/nsSharableString.h +++ b/mozilla/xpcom/string/public/nsSharableString.h @@ -66,7 +66,7 @@ class NS_COM nsSharableString void assign( const string_type& ); virtual const nsSharedBufferHandle* GetSharedBufferHandle() const; - private: + protected: nsAutoBufferHandle mBuffer; }; @@ -96,7 +96,7 @@ class NS_COM nsSharableCString void assign( const string_type& ); virtual const nsSharedBufferHandle* GetSharedBufferHandle() const; - private: + protected: nsAutoBufferHandle mBuffer; }; diff --git a/mozilla/xpcom/string/public/nsStringFragment.h b/mozilla/xpcom/string/public/nsStringFragment.h index 0a8238023e9..d54287965d3 100644 --- a/mozilla/xpcom/string/public/nsStringFragment.h +++ b/mozilla/xpcom/string/public/nsStringFragment.h @@ -26,6 +26,9 @@ #ifndef nsStringFragment_h___ #define nsStringFragment_h___ +#ifndef nsStringDefines_h___ +#include "nsStringDefines.h" +#endif /** diff --git a/mozilla/xpcom/string/public/nsStringFwd.h b/mozilla/xpcom/string/public/nsStringFwd.h index ce7d32849df..4f68b5febb5 100644 --- a/mozilla/xpcom/string/public/nsStringFwd.h +++ b/mozilla/xpcom/string/public/nsStringFwd.h @@ -26,6 +26,10 @@ #ifndef nsStringFwd_h___ #define nsStringFwd_h___ +#ifndef nsStringDefines_h___ +#include "nsStringDefines.h" +#endif + /** * @see nsAString.h diff --git a/mozilla/xpcom/string/public/nsStringIteratorUtils.h b/mozilla/xpcom/string/public/nsStringIteratorUtils.h index 0d74365c1eb..ee07075a313 100644 --- a/mozilla/xpcom/string/public/nsStringIteratorUtils.h +++ b/mozilla/xpcom/string/public/nsStringIteratorUtils.h @@ -24,6 +24,10 @@ #ifndef nsStringIteratorUtils_h___ #define nsStringIteratorUtils_h___ +#ifndef nsStringDefines_h___ +#include "nsStringDefines.h" +#endif + template inline PRBool diff --git a/mozilla/xpcom/string/src/Makefile.in b/mozilla/xpcom/string/src/Makefile.in index 18983106d97..dca0a65c6de 100644 --- a/mozilla/xpcom/string/src/Makefile.in +++ b/mozilla/xpcom/string/src/Makefile.in @@ -47,6 +47,7 @@ CPPSRCS = \ nsSharableString.cpp \ nsSharedBufferList.cpp \ nsSlidingString.cpp \ + nsXPIDLString.cpp \ $(NULL) EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS)) diff --git a/mozilla/xpcom/string/src/makefile.win b/mozilla/xpcom/string/src/makefile.win index 1edabfe5682..624f3ed2596 100644 --- a/mozilla/xpcom/string/src/makefile.win +++ b/mozilla/xpcom/string/src/makefile.win @@ -42,6 +42,7 @@ CPP_OBJS = \ .\$(OBJDIR)\nsSharableString.obj \ .\$(OBJDIR)\nsSharedBufferList.obj \ .\$(OBJDIR)\nsSlidingString.obj \ + .\$(OBJDIR)\nsXPIDLString.obj \ $(NULL) include <$(DEPTH)\config\rules.mak> diff --git a/mozilla/xpcom/string/src/nsAFlatString.cpp b/mozilla/xpcom/string/src/nsAFlatString.cpp index 114d01ad1b2..d9f7b1607a8 100644 --- a/mozilla/xpcom/string/src/nsAFlatString.cpp +++ b/mozilla/xpcom/string/src/nsAFlatString.cpp @@ -133,7 +133,7 @@ const PRUnichar* nsAFlatString::get() const { const nsBufferHandle* handle = GetBufferHandle(); - NS_ASSERTION(handle, "handle is null!"); + // NS_ASSERTION(handle, "handle is null!"); return handle ? handle->DataStart() : 0; } @@ -141,6 +141,6 @@ const char* nsAFlatCString::get() const { const nsBufferHandle* handle = GetBufferHandle(); - NS_ASSERTION(handle, "handle is null!"); + // NS_ASSERTION(handle, "handle is null!"); return handle ? handle->DataStart() : 0; }