From c7d98d66de76f0e3cfd4ef8a369846d8d0c95ee5 Mon Sep 17 00:00:00 2001 From: "darin%meer.net" Date: Thu, 22 Jan 2004 22:42:23 +0000 Subject: [PATCH] fixing bustage git-svn-id: svn://10.0.0.236/branches/STRING_20040119_BRANCH@151721 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/xpcom/build/Makefile.in | 1 + mozilla/xpcom/build/dlldeps.cpp | 23 +++++- mozilla/xpcom/ds/nsIAtom.idl | 1 - mozilla/xpcom/ds/nsIVariant.idl | 4 - mozilla/xpcom/ds/nsVariant.cpp | 2 +- mozilla/xpcom/ds/nsVariant.h | 1 + mozilla/xpcom/ds/nsVoidArray.h | 3 +- mozilla/xpcom/glue/nsGenericFactory.cpp | 6 +- mozilla/xpcom/glue/standalone/Makefile.in | 2 - mozilla/xpcom/io/nsILocalFile.idl | 1 - mozilla/xpcom/string/embed/nsEmbedString.h | 88 +++++++-------------- mozilla/xpcom/string/minapi/Makefile.in | 3 +- mozilla/xpcom/string/minapi/nsStringAPI.cpp | 6 +- mozilla/xpcom/string/minapi/nsStringAPI.h | 78 +++++++++++------- mozilla/xpcom/string/public/nsTAString.h | 2 +- mozilla/xpcom/string/public/nsTString.h | 2 +- mozilla/xpcom/string/public/nsTStringBase.h | 17 ---- mozilla/xpcom/string/src/nsTAString.cpp | 8 ++ mozilla/xpcom/tools/registry/Makefile.in | 4 +- mozilla/xpcom/tools/registry/regxpcom.cpp | 9 ++- 20 files changed, 132 insertions(+), 129 deletions(-) diff --git a/mozilla/xpcom/build/Makefile.in b/mozilla/xpcom/build/Makefile.in index 3d322c24d5d..a518936f3c9 100644 --- a/mozilla/xpcom/build/Makefile.in +++ b/mozilla/xpcom/build/Makefile.in @@ -41,6 +41,7 @@ endif GRE_MODULE = 1 REQUIRES = string \ + embedstring \ $(NULL) # pull in MoreFiles for MacOSX diff --git a/mozilla/xpcom/build/dlldeps.cpp b/mozilla/xpcom/build/dlldeps.cpp index 8640212b059..e183525c349 100644 --- a/mozilla/xpcom/build/dlldeps.cpp +++ b/mozilla/xpcom/build/dlldeps.cpp @@ -76,7 +76,6 @@ #include "nsReadableUtils.h" #include "nsStaticNameTable.h" #include "nsProcess.h" -#include "nsSlidingString.h" #include "nsStringEnumerator.h" #include "nsIInputStreamTee.h" #include "nsCheapSets.h" @@ -90,6 +89,10 @@ #include "nsEscape.h" #include "nsStreamUtils.h" +#define nsAString_external nsAString_external_ +#define nsACString_external nsACString_external_ +#include "nsStringAPI.h" + void XXXNeverCalled() { nsTextFormatter::snprintf(nsnull,0,nsnull); @@ -151,13 +154,13 @@ void XXXNeverCalled() new nsProcess(); nsStaticCaseInsensitiveNameTable(); nsAutoString str1; + str1.AssignWithConversion(nsnull, 0); nsCAutoString str2; ToNewUnicode(str1); ToNewUnicode(str2); ToNewCString(str1); ToNewCString(str2); PL_DHashTableFinish(nsnull); - nsSlidingString sliding(nsnull, nsnull, nsnull); NS_NewInputStreamTee(nsnull, nsnull, nsnull); NS_NewArray(nsnull); nsCOMArray dummyArray; @@ -173,4 +176,20 @@ void XXXNeverCalled() NS_NewUTF8StringEnumerator(nsnull, &carray); NS_NewAdoptingUTF8StringEnumerator(nsnull, &carray); nsVoidableString str3; + nsCStringContainer sc1; + NS_CStringContainerInit(sc1); + NS_CStringContainerFinish(sc1); + NS_CStringGetLength(str2); + NS_CStringGetDataPtr(str2); + NS_CStringGetData(str2, nsnull, 0); + NS_CStringSetData(str2, nsnull, 0); + NS_CStringCopy(str2, str2, 0, 0); + nsStringContainer sc2; + NS_StringContainerInit(sc2); + NS_StringContainerFinish(sc2); + NS_StringGetLength(str1); + NS_StringGetDataPtr(str1); + NS_StringGetData(str1, nsnull, 0); + NS_StringSetData(str1, nsnull, 0); + NS_StringCopy(str1, str1, 0, 0); } diff --git a/mozilla/xpcom/ds/nsIAtom.idl b/mozilla/xpcom/ds/nsIAtom.idl index 0ca26cd5c04..fd4f32cd486 100644 --- a/mozilla/xpcom/ds/nsIAtom.idl +++ b/mozilla/xpcom/ds/nsIAtom.idl @@ -24,7 +24,6 @@ #include "nsISupports.idl" %{C++ -#include "nsAString.h" #include "nsCOMPtr.h" %} diff --git a/mozilla/xpcom/ds/nsIVariant.idl b/mozilla/xpcom/ds/nsIVariant.idl index 571100d7792..0789b3e5e80 100644 --- a/mozilla/xpcom/ds/nsIVariant.idl +++ b/mozilla/xpcom/ds/nsIVariant.idl @@ -25,10 +25,6 @@ #include "nsISupports.idl" -%{ C++ -#include "nsString.h" // needed for AString -> nsAString, unfortunately -%} - [scriptable,uuid(4d12e540-83d7-11d5-90ed-0010a4e73d9a)] interface nsIDataType : nsISupports { diff --git a/mozilla/xpcom/ds/nsVariant.cpp b/mozilla/xpcom/ds/nsVariant.cpp index f6aa032a1c7..963f2ceb4ae 100644 --- a/mozilla/xpcom/ds/nsVariant.cpp +++ b/mozilla/xpcom/ds/nsVariant.cpp @@ -24,7 +24,7 @@ /* The long avoided variant support for xpcom. */ #include "nsVariant.h" -#include "nsReadableUtils.h" +#include "nsString.h" #include "prprf.h" #include "prdtoa.h" #include diff --git a/mozilla/xpcom/ds/nsVariant.h b/mozilla/xpcom/ds/nsVariant.h index 92d3ee2fc99..826311d4726 100644 --- a/mozilla/xpcom/ds/nsVariant.h +++ b/mozilla/xpcom/ds/nsVariant.h @@ -24,6 +24,7 @@ /* The long avoided variant support for xpcom. */ #include "nsIVariant.h" +#include "nsStringFwd.h" #include "xpt_struct.h" /** diff --git a/mozilla/xpcom/ds/nsVoidArray.h b/mozilla/xpcom/ds/nsVoidArray.h index c78a6434184..79501b7f25b 100644 --- a/mozilla/xpcom/ds/nsVoidArray.h +++ b/mozilla/xpcom/ds/nsVoidArray.h @@ -40,7 +40,8 @@ //#define DEBUG_VOIDARRAY 1 #include "nscore.h" -#include "nsAString.h" +#include "nsStringFwd.h" +#include "nsDebug.h" // Comparator callback function for sorting array values. typedef int (* PR_CALLBACK nsVoidArrayComparatorFunc) diff --git a/mozilla/xpcom/glue/nsGenericFactory.cpp b/mozilla/xpcom/glue/nsGenericFactory.cpp index f51f3df96a3..ce62e221cac 100644 --- a/mozilla/xpcom/glue/nsGenericFactory.cpp +++ b/mozilla/xpcom/glue/nsGenericFactory.cpp @@ -49,10 +49,10 @@ #include "nsXPCOMGlue.h" #include "nsXPCOMPrivate.h" #include "nsIServiceManager.h" -#include "nsIFile.h" +#include "nsILocalFile.h" #include "nsDirectoryServiceDefs.h" -#include "nsDirectoryService.h" -#include "nsEmbedString.h" +#include "nsStringAPI.h" +#include "prlink.h" #else #include "nsIInterfaceRequestorUtils.h" #include "nsINativeComponentLoader.h" diff --git a/mozilla/xpcom/glue/standalone/Makefile.in b/mozilla/xpcom/glue/standalone/Makefile.in index ef0035becf8..1aeede4742b 100644 --- a/mozilla/xpcom/glue/standalone/Makefile.in +++ b/mozilla/xpcom/glue/standalone/Makefile.in @@ -87,5 +87,3 @@ export:: $(XPCOM_GLUE_SRC_CSRCS) $(INSTALL) $^ . DEFINES += -DXPCOM_GLUE - - diff --git a/mozilla/xpcom/io/nsILocalFile.idl b/mozilla/xpcom/io/nsILocalFile.idl index 0215d6d8c96..c3f078bc413 100644 --- a/mozilla/xpcom/io/nsILocalFile.idl +++ b/mozilla/xpcom/io/nsILocalFile.idl @@ -29,7 +29,6 @@ #include "prio.h" #include "prlink.h" #include -#include "nsAString.h" %} [ptr] native PRFileDescStar(PRFileDesc); diff --git a/mozilla/xpcom/string/embed/nsEmbedString.h b/mozilla/xpcom/string/embed/nsEmbedString.h index afeb26fc3fe..a0de806f9e8 100644 --- a/mozilla/xpcom/string/embed/nsEmbedString.h +++ b/mozilla/xpcom/string/embed/nsEmbedString.h @@ -42,11 +42,8 @@ #include "nsStringAPI.h" -class nsEmbedString +class nsEmbedString : public nsStringContainer { - protected: - nsStringContainer mImpl; - public: typedef PRUnichar char_type; typedef nsEmbedString self_type; @@ -56,73 +53,62 @@ class nsEmbedString nsEmbedString() { - NS_StringContainerInit(mImpl); + NS_StringContainerInit(*this); } nsEmbedString(const self_type& aString) { - NS_StringContainerInit(mImpl); - NS_StringCopy(mImpl, aString); + NS_StringContainerInit(*this); + NS_StringCopy(*this, aString); } explicit nsEmbedString(const abstract_string_type& aReadable) { - NS_StringContainerInit(mImpl); - NS_StringCopy(mImpl, aReadable); + NS_StringContainerInit(*this); + NS_StringCopy(*this, aReadable); } explicit nsEmbedString(const char_type* aData, size_type aLength = PR_UINT32_MAX) { - //NS_StringContainerInit(mImpl, aData, aLength); - NS_StringContainerInit(mImpl); - NS_StringSetData(mImpl, aData, aLength); + NS_StringContainerInit(*this); + NS_StringSetData(*this, aData, aLength); } ~nsEmbedString() { - NS_StringContainerFinish(mImpl); + NS_StringContainerFinish(*this); } - operator const abstract_string_type&() const - { - return mImpl; - } - - operator abstract_string_type&() - { - return mImpl; - } - const char_type* get() const { - return NS_StringGetDataPtr(mImpl); + return NS_StringGetDataPtr(*this); } size_type Length() const { - return NS_StringGetLength(mImpl); + return NS_StringGetLength(*this); } void Assign(const self_type& aString) { - NS_StringCopy(mImpl, aString); + NS_StringCopy(*this, aString); } void Assign(const abstract_string_type& aReadable) { - NS_StringCopy(mImpl, aReadable); + NS_StringCopy(*this, aReadable); } void Assign(const char_type* aData, size_type aLength = PR_UINT32_MAX) { - NS_StringSetData(mImpl, aData, aLength); + NS_StringSetData(*this, aData, aLength); } void Assign(char_type aChar) { - NS_StringSetData(mImpl, &aChar, 1); + NS_StringSetData(*this, &aChar, 1); } self_type& operator=(const self_type& aString) { Assign(aString); return *this; } @@ -131,11 +117,8 @@ class nsEmbedString self_type& operator=(char_type aChar) { Assign(aChar); return *this; } }; -class nsEmbedCString +class nsEmbedCString : public nsCStringContainer { - protected: - nsCStringContainer mImpl; - public: typedef char char_type; typedef nsEmbedCString self_type; @@ -145,73 +128,62 @@ class nsEmbedCString nsEmbedCString() { - NS_CStringContainerInit(mImpl); + NS_CStringContainerInit(*this); } nsEmbedCString(const self_type& aString) { - NS_CStringContainerInit(mImpl); - NS_CStringCopy(mImpl, aString); + NS_CStringContainerInit(*this); + NS_CStringCopy(*this, aString); } explicit nsEmbedCString(const abstract_string_type& aReadable) { - NS_CStringContainerInit(mImpl); - NS_CStringCopy(mImpl, aReadable); + NS_CStringContainerInit(*this); + NS_CStringCopy(*this, aReadable); } explicit nsEmbedCString(const char_type* aData, size_type aLength = PR_UINT32_MAX) { - //NS_CStringContainerInit(mImpl, aData, aLength); - NS_CStringContainerInit(mImpl); - NS_CStringSetData(mImpl, aData, aLength); + NS_CStringContainerInit(*this); + NS_CStringSetData(*this, aData, aLength); } ~nsEmbedCString() { - NS_CStringContainerFinish(mImpl); + NS_CStringContainerFinish(*this); } - operator const abstract_string_type&() const - { - return mImpl; - } - - operator abstract_string_type&() - { - return mImpl; - } - const char_type* get() const { - return NS_CStringGetDataPtr(mImpl); + return NS_CStringGetDataPtr(*this); } size_type Length() const { - return NS_CStringGetLength(mImpl); + return NS_CStringGetLength(*this); } void Assign(const self_type& aString) { - NS_CStringCopy(mImpl, aString); + NS_CStringCopy(*this, aString); } void Assign(const abstract_string_type& aReadable) { - NS_CStringCopy(mImpl, aReadable); + NS_CStringCopy(*this, aReadable); } void Assign(const char_type* aData, size_type aLength = PR_UINT32_MAX) { - NS_CStringSetData(mImpl, aData, aLength); + NS_CStringSetData(*this, aData, aLength); } void Assign(char_type aChar) { - NS_CStringSetData(mImpl, &aChar, 1); + NS_CStringSetData(*this, &aChar, 1); } self_type& operator=(const self_type& aString) { Assign(aString); return *this; } diff --git a/mozilla/xpcom/string/minapi/Makefile.in b/mozilla/xpcom/string/minapi/Makefile.in index 2c41fad6e04..bb13def2686 100644 --- a/mozilla/xpcom/string/minapi/Makefile.in +++ b/mozilla/xpcom/string/minapi/Makefile.in @@ -42,10 +42,11 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk -MODULE = string +MODULE = embedstring LIBRARY_NAME = string_minapi_s REQUIRES = xpcom \ + string \ $(NULL) CPPSRCS = \ diff --git a/mozilla/xpcom/string/minapi/nsStringAPI.cpp b/mozilla/xpcom/string/minapi/nsStringAPI.cpp index fefbc1b77b2..3c5b74e570c 100644 --- a/mozilla/xpcom/string/minapi/nsStringAPI.cpp +++ b/mozilla/xpcom/string/minapi/nsStringAPI.cpp @@ -35,11 +35,15 @@ * * ***** END LICENSE BLOCK ***** */ -#include "nsStringAPI.h" #include "nsString.h" #include "nsString2.h" #include "nsCharTraits.h" +#define nsAString_external nsAString_external_ +#define nsACString_external nsACString_external_ + +#include "nsStringAPI.h" + /* ------------------------------------------------------------------------- */ NS_STRINGAPI(PRBool) diff --git a/mozilla/xpcom/string/minapi/nsStringAPI.h b/mozilla/xpcom/string/minapi/nsStringAPI.h index dfbb07768b1..a9ebd89a846 100644 --- a/mozilla/xpcom/string/minapi/nsStringAPI.h +++ b/mozilla/xpcom/string/minapi/nsStringAPI.h @@ -46,12 +46,40 @@ * dependency on the implementation details of the abstract string types. */ -#include "nsStringFwd.h" - +#include "nscore.h" #define NS_STRINGAPI(x) extern "C" NS_COM x /* ------------------------------------------------------------------------- */ +/** + * There are dummy class definitions for the abstract string types used in + * XPIDL generated header files. Do not count on the structure of these + * classes, and do not try to mix these definitions with the internal + * definition of these classes used within the mozilla codebase. + */ + +#ifndef nsAString_external +#define nsAString_external nsAString +#endif + +class nsAString_external + { + private: + void *v; + }; + +#ifndef nsACString_external +#define nsACString_external nsACString +#endif + +class nsACString_external + { + private: + void *v; + }; + +/* ------------------------------------------------------------------------- */ + /** * nsStringContainer * @@ -106,21 +134,16 @@ * } * } */ -class nsStringContainer -{ - private: - void *d1,*d2; - PRUint32 d3, d4; +class nsStringContainer : public nsAString_external + { + private: + void *d1; + PRUint32 d2; + void *d3; - public: - /** - * A nsStringContainer can be automatically cast to a nsAString. - */ - operator const nsAString&() const - { return *NS_REINTERPRET_CAST(const nsAString *, this); } - operator nsAString&() - { return *NS_REINTERPRET_CAST(nsAString *, this); } -}; + public: + nsStringContainer() {} // MSVC6 needs this + }; /** * NS_StringContainerInit @@ -234,21 +257,16 @@ NS_StringCopy(nsAString &aDest, const nsAString &aSrc, * * @see nsStringContainer for use cases and further documentation. */ -class nsCStringContainer -{ - private: - void *d1,*d2; - PRUint32 d3, d4; +class nsCStringContainer : public nsACString_external + { + private: + void *d1; + PRUint32 d2; + void *d3; - public: - /** - * A nsStringContainer can be automatically cast to a nsAString. - */ - operator const nsACString&() const - { return *NS_REINTERPRET_CAST(const nsACString *, this); } - operator nsACString&() - { return *NS_REINTERPRET_CAST(nsACString *, this); } -}; + public: + nsCStringContainer() {} // MSVC6 needs this + }; /** * NS_CStringContainerInit diff --git a/mozilla/xpcom/string/public/nsTAString.h b/mozilla/xpcom/string/public/nsTAString.h index a879885a082..cc5d34d6291 100644 --- a/mozilla/xpcom/string/public/nsTAString.h +++ b/mozilla/xpcom/string/public/nsTAString.h @@ -340,7 +340,7 @@ class NS_COM nsTAString_CharT /** * we can be converted to a const nsTStringBase (dependent on this) */ - inline const string_base_type ToString() const; + const string_base_type ToString() const; private: diff --git a/mozilla/xpcom/string/public/nsTString.h b/mozilla/xpcom/string/public/nsTString.h index 239664b7b6f..5e05ed0a481 100644 --- a/mozilla/xpcom/string/public/nsTString.h +++ b/mozilla/xpcom/string/public/nsTString.h @@ -42,7 +42,7 @@ * promise null-terminated storage. Instances of this class allocate * strings on the heap. */ -class nsTString_CharT : public nsTStringBase_CharT +class NS_COM nsTString_CharT : public nsTStringBase_CharT { public: diff --git a/mozilla/xpcom/string/public/nsTStringBase.h b/mozilla/xpcom/string/public/nsTStringBase.h index 57f317dbe35..8f1280548f9 100644 --- a/mozilla/xpcom/string/public/nsTStringBase.h +++ b/mozilla/xpcom/string/public/nsTStringBase.h @@ -368,20 +368,3 @@ class NS_COM nsTStringBase_CharT : public nsTAString_CharT F_FIXED = 1 << 4 // mData is pointing at nsTAutoString::mFixedBuf }; }; - - - - /** - * nsTAString::ToString - * - * defined here since it depends on nsStringBase class definition. - */ - -inline -const nsTAString_CharT::string_base_type -nsTAString_CharT::ToString() const - { - const char_type* data; - size_type length = GetReadableBuffer(&data); - return string_base_type(NS_CONST_CAST(char_type*, data), length, 0); - } diff --git a/mozilla/xpcom/string/src/nsTAString.cpp b/mozilla/xpcom/string/src/nsTAString.cpp index 75e3464fbc7..281bd117a5c 100644 --- a/mozilla/xpcom/string/src/nsTAString.cpp +++ b/mozilla/xpcom/string/src/nsTAString.cpp @@ -413,3 +413,11 @@ nsTAString_CharT::IsDependentOn(const char_type* start, const char_type *end) co return ToString().IsDependentOn(start, end); } + +const nsTAString_CharT::string_base_type +nsTAString_CharT::ToString() const + { + const char_type* data; + size_type length = GetReadableBuffer(&data); + return string_base_type(NS_CONST_CAST(char_type*, data), length, 0); + } diff --git a/mozilla/xpcom/tools/registry/Makefile.in b/mozilla/xpcom/tools/registry/Makefile.in index cb40ddafb7a..1208783a5d0 100644 --- a/mozilla/xpcom/tools/registry/Makefile.in +++ b/mozilla/xpcom/tools/registry/Makefile.in @@ -31,11 +31,11 @@ CPPSRCS = regxpcom.cpp DEFINES += -DXPCOM_GLUE -REQUIRES = string \ +REQUIRES = \ + string \ embedstring \ $(NULL) - LOCAL_INCLUDES = \ -I$(srcdir)/../../build \ $(NULL) diff --git a/mozilla/xpcom/tools/registry/regxpcom.cpp b/mozilla/xpcom/tools/registry/regxpcom.cpp index 73b17400a05..0ea898c119e 100644 --- a/mozilla/xpcom/tools/registry/regxpcom.cpp +++ b/mozilla/xpcom/tools/registry/regxpcom.cpp @@ -101,7 +101,8 @@ DirectoryServiceProvider::GetFile(const char *prop, PRBool *persistant, nsIFile else return NS_ERROR_FAILURE; - rv = NS_NewNativeLocalFile(nsEmbedCString(fileLocation), PR_TRUE, getter_AddRefs(localFile)); + nsEmbedCString temp(fileLocation); + rv = NS_NewNativeLocalFile(temp, PR_TRUE, getter_AddRefs(localFile)); if (NS_FAILED(rv)) return rv; return localFile->QueryInterface(NS_GET_IID(nsIFile), (void**)_retval); @@ -158,7 +159,8 @@ int startup_xpcom() nsCOMPtr file; if (gXPCOMLocation) { - rv = NS_NewNativeLocalFile(nsEmbedCString(gXPCOMLocation), + nsEmbedCString temp(gXPCOMLocation); + rv = NS_NewNativeLocalFile(temp, PR_TRUE, getter_AddRefs(file)); } @@ -204,7 +206,8 @@ nsresult Register(const char *path) nsCOMPtr spec; if (path) { - rv = NS_NewNativeLocalFile(nsEmbedCString(path), + //nsEmbedCString temp(path); + rv = NS_NewNativeLocalFile(nsEmbedCString(path), PR_TRUE, getter_AddRefs(spec)); }