Bug 305949 Part 1 - Separate the frozen XPCOM exports with the XPCOM_API macro; add compatibility methods to the frozen string API; convert most of the tests/tools to use the xpcom glue when appropriate r=darin This checking does not actually stop exporting the nonfrozen methods yet, pending a bunch of test cleanup throughout the tree.

This commit is contained in:
bsmedberg%covad.net 2005-11-08 18:17:49 +00:00
parent 9caff24082
commit a7253270ad
44 changed files with 359 additions and 254 deletions

View File

@ -81,9 +81,15 @@ TOOL_DIRS += \
tests \
sample \
typelib/xpt/tests \
proxy/tests
# Can't build internal xptcall tests that use symbols which are not exported.
ifndef MOZ_ENABLE_LIBXUL
TOOL_DIRS += \
reflect/xptinfo/tests \
reflect/xptcall/tests \
proxy/tests
$(NULL)
endif
endif
# xpcom-config.h is generated by configure

View File

@ -329,7 +329,7 @@ nsMemoryImpl::sIsFlushing = PR_FALSE;
nsMemoryImpl::FlushEvent
nsMemoryImpl::sFlushEvent;
extern "C" NS_EXPORT void*
XPCOM_API(void*)
NS_Alloc(PRSize size)
{
NS_ASSERTION(size, "NS_Alloc of size 0");
@ -342,7 +342,7 @@ NS_Alloc(PRSize size)
return result;
}
extern "C" NS_EXPORT void*
XPCOM_API(void*)
NS_Realloc(void* ptr, PRSize size)
{
NS_ASSERTION(size, "NS_Realloc of size 0");
@ -354,7 +354,7 @@ NS_Realloc(void* ptr, PRSize size)
return result;
}
extern "C" NS_EXPORT void
XPCOM_API(void)
NS_Free(void* ptr)
{
PR_Free(ptr);

View File

@ -159,14 +159,15 @@
#ifdef NS_WIN32
#define NS_IMPORT __declspec(dllimport)
#define NS_IMPORT_(type) type __declspec(dllimport) __stdcall
#define NS_IMPORT_(type) __declspec(dllimport) type __stdcall
#define NS_EXPORT __declspec(dllexport)
#define NS_EXPORT_(type) type __declspec(dllexport) __stdcall
#define NS_EXPORT_(type) __declspec(dllexport) type __stdcall
#define NS_IMETHOD_(type) virtual type __stdcall
#define NS_IMETHODIMP_(type) type __stdcall
#define NS_METHOD_(type) type __stdcall
#define NS_CALLBACK_(_type, _name) _type (__stdcall * _name)
#define NS_STDCALL __stdcall
#define NS_FROZENCALL __cdecl
/*
These are needed to mark static members in exported classes, due to
@ -187,6 +188,7 @@
#define NS_METHOD_(type) type
#define NS_CALLBACK_(_type, _name) _type (* _name)
#define NS_STDCALL
#define NS_FROZENCALL
#define NS_EXPORT_STATIC_MEMBER_(type) NS_EXTERNAL_VIS_(type)
#define NS_IMPORT_STATIC_MEMBER_(type) NS_EXTERNAL_VIS_(type)
@ -231,11 +233,25 @@
* Import/Export macros for XPCOM APIs
*/
#define EXPORT_XPCOM_API(type) extern "C" NS_EXPORT type NS_FROZENCALL
#define IMPORT_XPCOM_API(type) extern "C" NS_IMPORT type NS_FROZENCALL
#define GLUE_XPCOM_API(type) NS_HIDDEN_(type) NS_FROZENCALL
#ifdef _IMPL_NS_COM
#define NS_COM NS_EXPORT
#elif _IMPL_NS_COM_OFF
#define XPCOM_API(type) EXPORT_XPCOM_API(type)
#elif defined(XPCOM_GLUE)
#define XPCOM_API(type) GLUE_XPCOM_API(type)
#else
#define XPCOM_API(type) IMPORT_XPCOM_API(type)
#endif
#if 0
// This will become #ifdef MOZ_ENABLE_LIBXUL when various in-tree code is
// fixed up. See bug 305949
#define NS_COM
#elif XPCOM_GLUE
#elif defined(_IMPL_NS_COM)
#define NS_COM NS_EXPORT
#elif defined(XPCOM_GLUE)
#define NS_COM
#else
#define NS_COM NS_IMPORT

View File

@ -125,6 +125,7 @@ LOCAL_INCLUDES = \
-I$(srcdir)/../threads \
-I$(srcdir)/../threads/_xpidlgen \
-I$(srcdir)/../proxy/src \
-I$(srcdir)/../reflect/xptinfo/src \
$(NULL)
SDK_HEADERS = \

View File

@ -43,7 +43,7 @@
/* ------------------------------------------------------------------------- */
NS_STRINGAPI(nsresult)
XPCOM_API(nsresult)
NS_StringContainerInit(nsStringContainer &aContainer)
{
NS_ASSERTION(sizeof(nsStringContainer) >= sizeof(nsString),
@ -55,7 +55,7 @@ NS_StringContainerInit(nsStringContainer &aContainer)
return NS_OK;
}
NS_STRINGAPI(nsresult)
XPCOM_API(nsresult)
NS_StringContainerInit2(nsStringContainer &aContainer,
const PRUnichar *aData,
PRUint32 aDataLength,
@ -100,7 +100,7 @@ NS_StringContainerInit2(nsStringContainer &aContainer,
return NS_OK;
}
NS_STRINGAPI(void)
XPCOM_API(void)
NS_StringContainerFinish(nsStringContainer &aContainer)
{
// call the nsString dtor
@ -109,7 +109,7 @@ NS_StringContainerFinish(nsStringContainer &aContainer)
/* ------------------------------------------------------------------------- */
NS_STRINGAPI(PRUint32)
XPCOM_API(PRUint32)
NS_StringGetData(const nsAString &aStr, const PRUnichar **aData,
PRBool *aTerminated)
{
@ -122,7 +122,7 @@ NS_StringGetData(const nsAString &aStr, const PRUnichar **aData,
return begin.size_forward();
}
NS_STRINGAPI(PRUint32)
XPCOM_API(PRUint32)
NS_StringGetMutableData(nsAString &aStr, PRUint32 aDataLength,
PRUnichar **aData)
{
@ -140,20 +140,20 @@ NS_StringGetMutableData(nsAString &aStr, PRUint32 aDataLength,
return begin.size_forward();
}
NS_STRINGAPI(PRUnichar *)
XPCOM_API(PRUnichar *)
NS_StringCloneData(const nsAString &aStr)
{
return ToNewUnicode(aStr);
}
NS_STRINGAPI(nsresult)
XPCOM_API(nsresult)
NS_StringSetData(nsAString &aStr, const PRUnichar *aData, PRUint32 aDataLength)
{
aStr.Assign(aData, aDataLength);
return NS_OK; // XXX report errors
}
NS_STRINGAPI(nsresult)
XPCOM_API(nsresult)
NS_StringSetDataRange(nsAString &aStr,
PRUint32 aCutOffset, PRUint32 aCutLength,
const PRUnichar *aData, PRUint32 aDataLength)
@ -182,7 +182,7 @@ NS_StringSetDataRange(nsAString &aStr,
return NS_OK; // XXX report errors
}
NS_STRINGAPI(nsresult)
XPCOM_API(nsresult)
NS_StringCopy(nsAString &aDest, const nsAString &aSrc)
{
aDest.Assign(aSrc);
@ -191,7 +191,7 @@ NS_StringCopy(nsAString &aDest, const nsAString &aSrc)
/* ------------------------------------------------------------------------- */
NS_STRINGAPI(nsresult)
XPCOM_API(nsresult)
NS_CStringContainerInit(nsCStringContainer &aContainer)
{
NS_ASSERTION(sizeof(nsCStringContainer) >= sizeof(nsCString),
@ -203,7 +203,7 @@ NS_CStringContainerInit(nsCStringContainer &aContainer)
return NS_OK;
}
NS_STRINGAPI(nsresult)
XPCOM_API(nsresult)
NS_CStringContainerInit2(nsCStringContainer &aContainer,
const char *aData,
PRUint32 aDataLength,
@ -248,7 +248,7 @@ NS_CStringContainerInit2(nsCStringContainer &aContainer,
return NS_OK;
}
NS_STRINGAPI(void)
XPCOM_API(void)
NS_CStringContainerFinish(nsCStringContainer &aContainer)
{
// call the nsCString dtor
@ -257,7 +257,7 @@ NS_CStringContainerFinish(nsCStringContainer &aContainer)
/* ------------------------------------------------------------------------- */
NS_STRINGAPI(PRUint32)
XPCOM_API(PRUint32)
NS_CStringGetData(const nsACString &aStr, const char **aData,
PRBool *aTerminated)
{
@ -270,7 +270,7 @@ NS_CStringGetData(const nsACString &aStr, const char **aData,
return begin.size_forward();
}
NS_STRINGAPI(PRUint32)
XPCOM_API(PRUint32)
NS_CStringGetMutableData(nsACString &aStr, PRUint32 aDataLength, char **aData)
{
if (aDataLength != PR_UINT32_MAX) {
@ -287,20 +287,20 @@ NS_CStringGetMutableData(nsACString &aStr, PRUint32 aDataLength, char **aData)
return begin.size_forward();
}
NS_STRINGAPI(char *)
XPCOM_API(char *)
NS_CStringCloneData(const nsACString &aStr)
{
return ToNewCString(aStr);
}
NS_STRINGAPI(nsresult)
XPCOM_API(nsresult)
NS_CStringSetData(nsACString &aStr, const char *aData, PRUint32 aDataLength)
{
aStr.Assign(aData, aDataLength);
return NS_OK; // XXX report errors
}
NS_STRINGAPI(nsresult)
XPCOM_API(nsresult)
NS_CStringSetDataRange(nsACString &aStr,
PRUint32 aCutOffset, PRUint32 aCutLength,
const char *aData, PRUint32 aDataLength)
@ -329,7 +329,7 @@ NS_CStringSetDataRange(nsACString &aStr,
return NS_OK; // XXX report errors
}
NS_STRINGAPI(nsresult)
XPCOM_API(nsresult)
NS_CStringCopy(nsACString &aDest, const nsACString &aSrc)
{
aDest.Assign(aSrc);
@ -338,7 +338,7 @@ NS_CStringCopy(nsACString &aDest, const nsACString &aSrc)
/* ------------------------------------------------------------------------- */
NS_STRINGAPI(nsresult)
XPCOM_API(nsresult)
NS_CStringToUTF16(const nsACString &aSrc,
nsCStringEncoding aSrcEncoding,
nsAString &aDest)
@ -361,7 +361,7 @@ NS_CStringToUTF16(const nsACString &aSrc,
return NS_OK; // XXX report errors
}
NS_STRINGAPI(nsresult)
XPCOM_API(nsresult)
NS_UTF16ToCString(const nsAString &aSrc,
nsCStringEncoding aDestEncoding,
nsACString &aDest)

View File

@ -118,7 +118,7 @@ typedef nsresult (PR_CALLBACK *nsGetModuleProc)(nsIComponentManager *aCompMgr,
* shutdown. Other error codes indicate a failure during
* initialisation.
*/
extern "C" NS_COM nsresult
XPCOM_API(nsresult)
NS_InitXPCOM2(nsIServiceManager* *result,
nsIFile* binDirectory,
nsIDirectoryServiceProvider* appFileLocationProvider);
@ -175,7 +175,7 @@ struct nsStaticModuleInfo {
* shutdown. Other error codes indicate a failure during
* initialisation.
*/
extern "C" NS_COM nsresult
XPCOM_API(nsresult)
NS_InitXPCOM3(nsIServiceManager* *result,
nsIFile* binDirectory,
nsIDirectoryServiceProvider* appFileLocationProvider,
@ -195,7 +195,7 @@ NS_InitXPCOM3(nsIServiceManager* *result,
* other error codes indicate a failure during initialisation.
*
*/
extern "C" NS_COM nsresult
XPCOM_API(nsresult)
NS_ShutdownXPCOM(nsIServiceManager* servMgr);
@ -209,7 +209,7 @@ NS_ShutdownXPCOM(nsIServiceManager* servMgr);
* other error codes indicate a failure during initialisation.
*
*/
extern "C" NS_COM nsresult
XPCOM_API(nsresult)
NS_GetServiceManager(nsIServiceManager* *result);
/**
@ -222,7 +222,7 @@ NS_GetServiceManager(nsIServiceManager* *result);
* other error codes indicate a failure during initialisation.
*
*/
extern "C" NS_COM nsresult
XPCOM_API(nsresult)
NS_GetComponentManager(nsIComponentManager* *result);
/**
@ -235,7 +235,7 @@ NS_GetComponentManager(nsIComponentManager* *result);
* other error codes indicate a failure during initialisation.
*
*/
extern "C" NS_COM nsresult
XPCOM_API(nsresult)
NS_GetComponentRegistrar(nsIComponentRegistrar* *result);
/**
@ -248,7 +248,7 @@ NS_GetComponentRegistrar(nsIComponentRegistrar* *result);
* other error codes indicate a failure during initialisation.
*
*/
extern "C" NS_COM nsresult
XPCOM_API(nsresult)
NS_GetMemoryManager(nsIMemory* *result);
/**
@ -274,12 +274,12 @@ NS_GetMemoryManager(nsIMemory* *result);
* other error codes indicate a failure.
*/
extern "C" NS_COM nsresult
XPCOM_API(nsresult)
NS_NewLocalFile(const nsAString &path,
PRBool followLinks,
nsILocalFile* *result);
extern "C" NS_COM nsresult
XPCOM_API(nsresult)
NS_NewNativeLocalFile(const nsACString &path,
PRBool followLinks,
nsILocalFile* *result);
@ -294,7 +294,7 @@ NS_NewNativeLocalFile(const nsACString &path,
* @result The block of memory
* @note This function is thread-safe.
*/
extern "C" NS_COM void*
XPCOM_API(void*)
NS_Alloc(PRSize size);
/**
@ -315,7 +315,7 @@ NS_Alloc(PRSize size);
* allocation fails, ptr is not freed and null is returned. The returned
* value may be the same as ptr.
*/
extern "C" NS_COM void*
XPCOM_API(void*)
NS_Realloc(void* ptr, PRSize size);
/**
@ -328,7 +328,7 @@ NS_Realloc(void* ptr, PRSize size);
* been allocated by NS_Alloc or NS_Realloc
* @note This function is thread-safe.
*/
extern "C" NS_COM void
XPCOM_API(void)
NS_Free(void* ptr);
@ -413,10 +413,10 @@ NS_Free(void* ptr);
*/
#define NS_XPCOM_CATEGORY_CLEARED_OBSERVER_ID "xpcom-category-cleared"
extern "C" NS_COM nsresult
XPCOM_API(nsresult)
NS_GetDebug(nsIDebug* *result);
extern "C" NS_COM nsresult
XPCOM_API(nsresult)
NS_GetTraceRefcnt(nsITraceRefcnt* *result);
#endif

View File

@ -76,10 +76,10 @@ class nsIComponentLoader;
*/
typedef NS_CALLBACK(XPCOMExitRoutine)(void);
extern "C" NS_COM nsresult
XPCOM_API(nsresult)
NS_RegisterXPCOMExitRoutine(XPCOMExitRoutine exitRoutine, PRUint32 priority);
extern "C" NS_COM nsresult
XPCOM_API(nsresult)
NS_UnregisterXPCOMExitRoutine(XPCOMExitRoutine exitRoutine);
@ -178,7 +178,7 @@ typedef struct XPCOMFunctions{
} XPCOMFunctions;
typedef nsresult (PR_CALLBACK *GetFrozenFunctionsFunc)(XPCOMFunctions *entryPoints, const char* libraryPath);
extern "C" NS_COM nsresult
XPCOM_API(nsresult)
NS_GetFrozenFunctions(XPCOMFunctions *entryPoints, const char* libraryPath);
// think hard before changing this

View File

@ -78,6 +78,7 @@
#include "xptinfo.h"
#include "nsIInterfaceInfoManager.h"
#include "xptiprivate.h"
#include "nsTimerImpl.h"
#include "TimerThread.h"
@ -214,13 +215,13 @@ nsXPTIInterfaceInfoManagerGetSingleton(nsISupports* outer,
const nsIID& aIID,
void* *aInstancePtr)
{
NS_ENSURE_ARG_POINTER(aInstancePtr);
NS_ASSERTION(aInstancePtr, "null outptr");
NS_ENSURE_TRUE(!outer, NS_ERROR_NO_AGGREGATION);
nsCOMPtr<nsIInterfaceInfoManager> iim(dont_AddRef(XPTI_GetInterfaceInfoManager()));
if (!iim) {
nsCOMPtr<nsIInterfaceInfoManager> iim
(xptiInterfaceInfoManager::GetInterfaceInfoManagerNoAddRef());
if (!iim)
return NS_ERROR_FAILURE;
}
return iim->QueryInterface(aIID, aInstancePtr);
}
@ -403,7 +404,9 @@ const int components_length = sizeof(components) / sizeof(components[0]);
// gDebug will be freed during shutdown.
static nsIDebug* gDebug = nsnull;
nsresult NS_COM NS_GetDebug(nsIDebug** result)
EXPORT_XPCOM_API(nsresult)
NS_GetDebug(nsIDebug** result)
{
nsresult rv = NS_OK;
if (!gDebug)
@ -421,7 +424,8 @@ nsresult NS_COM NS_GetDebug(nsIDebug** result)
static nsITraceRefcnt* gTraceRefcnt = nsnull;
#endif
nsresult NS_COM NS_GetTraceRefcnt(nsITraceRefcnt** result)
EXPORT_XPCOM_API(nsresult)
NS_GetTraceRefcnt(nsITraceRefcnt** result)
{
#ifdef NS_BUILD_REFCNT_LOGGING
nsresult rv = NS_OK;
@ -438,20 +442,23 @@ nsresult NS_COM NS_GetTraceRefcnt(nsITraceRefcnt** result)
#endif
}
nsresult NS_COM NS_InitXPCOM(nsIServiceManager* *result,
EXPORT_XPCOM_API(nsresult)
NS_InitXPCOM(nsIServiceManager* *result,
nsIFile* binDirectory)
{
return NS_InitXPCOM3(result, binDirectory, nsnull, nsnull, 0);
}
nsresult NS_COM NS_InitXPCOM2(nsIServiceManager* *result,
EXPORT_XPCOM_API(nsresult)
NS_InitXPCOM2(nsIServiceManager* *result,
nsIFile* binDirectory,
nsIDirectoryServiceProvider* appFileLocationProvider)
{
return NS_InitXPCOM3(result, binDirectory, appFileLocationProvider, nsnull, 0);
}
nsresult NS_COM NS_InitXPCOM3(nsIServiceManager* *result,
EXPORT_XPCOM_API(nsresult)
NS_InitXPCOM3(nsIServiceManager* *result,
nsIFile* binDirectory,
nsIDirectoryServiceProvider* appFileLocationProvider,
nsStaticModuleInfo const *staticComponents,
@ -694,8 +701,7 @@ nsresult NS_COM NS_InitXPCOM3(nsIServiceManager* *result,
}
// Pay the cost at startup time of starting this singleton.
nsIInterfaceInfoManager* iim = XPTI_GetInterfaceInfoManager();
NS_IF_RELEASE(iim);
(void) xptiInterfaceInfoManager::GetInterfaceInfoManagerNoAddRef();
// After autoreg, but before we actually instantiate any components,
// add any services listed in the "xpcom-directory-providers" category
@ -728,7 +734,7 @@ static void CallExitRoutines()
gExitRoutines = nsnull;
}
nsresult NS_COM
EXPORT_XPCOM_API(nsresult)
NS_RegisterXPCOMExitRoutine(XPCOMExitRoutine exitRoutine, PRUint32 priority)
{
// priority are not used right now. It will need to be implemented as more
@ -745,7 +751,7 @@ NS_RegisterXPCOMExitRoutine(XPCOMExitRoutine exitRoutine, PRUint32 priority)
return okay ? NS_OK : NS_ERROR_FAILURE;
}
nsresult NS_COM
EXPORT_XPCOM_API(nsresult)
NS_UnregisterXPCOMExitRoutine(XPCOMExitRoutine exitRoutine)
{
if (!gExitRoutines)
@ -772,7 +778,8 @@ NS_UnregisterXPCOMExitRoutine(XPCOMExitRoutine exitRoutine)
// - Release the Registry held by Component Manager
// - Finally, release the component manager itself
//
nsresult NS_COM NS_ShutdownXPCOM(nsIServiceManager* servMgr)
EXPORT_XPCOM_API(nsresult)
NS_ShutdownXPCOM(nsIServiceManager* servMgr)
{
// Notify observers of xpcom shutting down
@ -856,7 +863,7 @@ nsresult NS_COM NS_ShutdownXPCOM(nsIServiceManager* servMgr)
// Do this _after_ shutting down the component manager, because the
// JS component loader will use XPConnect to call nsIModule::canUnload,
// and that will spin up the InterfaceInfoManager again -- bad mojo
XPTI_FreeInterfaceInfoManager();
xptiInterfaceInfoManager::FreeInterfaceInfoManager();
// Finally, release the component manager last because it unloads the
// libraries:

View File

@ -87,7 +87,14 @@ SDK_XPIDLSRCS = \
EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS))
LOCAL_INCLUDES = -I$(srcdir)/../base -I$(srcdir)/../thread -I$(srcdir)/../ds -I$(srcdir)/../build -I..
LOCAL_INCLUDES = \
-I$(srcdir)/../reflect/xptinfo/src \
-I$(srcdir)/../base \
-I$(srcdir)/../thread \
-I$(srcdir)/../ds \
-I$(srcdir)/../build \
-I.. \
$(NULL)
# we don't want the shared lib, but we want to force the creation of a static lib.
FORCE_STATIC_LIB = 1
@ -96,4 +103,4 @@ FORCE_STATIC_LIB = 1
FORCE_USE_PIC = 1
include $(topsrcdir)/config/rules.mk
DEFINES += -D_IMPL_NS_COM -DEXPORT_XPTI_API
DEFINES += -D_IMPL_NS_COM

View File

@ -67,7 +67,7 @@
#include "nsCategoryManagerUtils.h"
#include "nsIComponentLoader.h"
#include "nsIEnumerator.h"
#include "nsIInterfaceInfoManager.h"
#include "xptiprivate.h"
#include "nsIModule.h"
#include "nsIObserverService.h"
#include "nsISimpleEnumerator.h"
@ -3171,9 +3171,8 @@ nsComponentManagerImpl::AutoRegisterImpl(PRInt32 when,
return NS_ERROR_NOT_INITIALIZED;
}
nsCOMPtr<nsIInterfaceInfoManager> iim =
dont_AddRef(XPTI_GetInterfaceInfoManager());
nsIInterfaceInfoManager* iim =
xptiInterfaceInfoManager::GetInterfaceInfoManagerNoAddRef();
if (!iim)
return NS_ERROR_UNEXPECTED;

View File

@ -38,7 +38,7 @@
#include "nsISupports.idl"
%{C++
#include "nsAString.h"
#include "nsStringGlue.h"
#include "nsCOMPtr.h"
%}

View File

@ -80,6 +80,7 @@ EXPORTS = \
nsQuickSort.h \
nsStringGlue.h \
nsRefPtrHashtable.h \
nsStringGlue.h \
nsTHashtable.h \
nsVoidArray.h \
$(NULL)

View File

@ -46,6 +46,7 @@ PR_STATIC_CALLBACK(PRBool) ReleaseObjects(void* aElement, void*);
// copy constructor - we can't just memcpy here, because
// we have to make sure we own our own array buffer, and that each
// object gets another AddRef()
NS_COM_GLUE
nsCOMArray_base::nsCOMArray_base(const nsCOMArray_base& aOther)
{
// make sure we do only one allocation
@ -53,6 +54,7 @@ nsCOMArray_base::nsCOMArray_base(const nsCOMArray_base& aOther)
AppendObjects(aOther);
}
NS_COM_GLUE
nsCOMArray_base::~nsCOMArray_base()
{
PRInt32 count = Count(), i;
@ -62,7 +64,7 @@ nsCOMArray_base::~nsCOMArray_base()
}
}
PRInt32
NS_COM_GLUE PRInt32
nsCOMArray_base::IndexOfObject(nsISupports* aObject) const {
NS_ENSURE_TRUE(aObject, -1);
nsCOMPtr<nsISupports> supports = do_QueryInterface(aObject);
@ -82,7 +84,7 @@ nsCOMArray_base::IndexOfObject(nsISupports* aObject) const {
return retval;
}
PRBool
NS_COM_GLUE PRBool
nsCOMArray_base::InsertObjectAt(nsISupports* aObject, PRInt32 aIndex) {
PRBool result = mArray.InsertElementAt(aObject, aIndex);
if (result)
@ -90,7 +92,7 @@ nsCOMArray_base::InsertObjectAt(nsISupports* aObject, PRInt32 aIndex) {
return result;
}
PRBool
NS_COM_GLUE PRBool
nsCOMArray_base::InsertObjectsAt(const nsCOMArray_base& aObjects, PRInt32 aIndex) {
PRBool result = mArray.InsertElementsAt(aObjects.mArray, aIndex);
if (result) {
@ -103,7 +105,7 @@ nsCOMArray_base::InsertObjectsAt(const nsCOMArray_base& aObjects, PRInt32 aIndex
return result;
}
PRBool
NS_COM_GLUE PRBool
nsCOMArray_base::ReplaceObjectAt(nsISupports* aObject, PRInt32 aIndex)
{
// its ok if oldObject is null here
@ -122,7 +124,7 @@ nsCOMArray_base::ReplaceObjectAt(nsISupports* aObject, PRInt32 aIndex)
return result;
}
PRBool
NS_COM_GLUE PRBool
nsCOMArray_base::RemoveObject(nsISupports *aObject)
{
PRBool result = mArray.RemoveElement(aObject);
@ -131,7 +133,7 @@ nsCOMArray_base::RemoveObject(nsISupports *aObject)
return result;
}
PRBool
NS_COM_GLUE PRBool
nsCOMArray_base::RemoveObjectAt(PRInt32 aIndex)
{
nsISupports* element = ObjectAt(aIndex);
@ -150,7 +152,7 @@ ReleaseObjects(void* aElement, void*)
return PR_TRUE;
}
void
NS_COM_GLUE void
nsCOMArray_base::Clear()
{
mArray.EnumerateForwards(ReleaseObjects, nsnull);

View File

@ -46,7 +46,7 @@
// a class that's nsISupports-specific, so that we can contain the
// work of this class in the XPCOM dll
class NS_COM nsCOMArray_base
class NS_COM_GLUE nsCOMArray_base
{
friend class nsArray;
protected:

View File

@ -49,7 +49,7 @@
* @param delims The set of delimiters (null-terminated)
* @param str The string to search (null-terminated)
*/
const char* NS_COM_GLUE
NS_COM_GLUE const char*
NS_strspnp(const char *delims, const char *str);
/**
@ -68,7 +68,7 @@ NS_strspnp(const char *delims, const char *str);
* @return The token. If no token is found (the string is only
* delimiter characters), NULL is returned.
*/
char* NS_COM_GLUE
NS_COM_GLUE char*
NS_strtok(const char *delims, char **str);
#endif // nsCRTGlue_h__

View File

@ -47,6 +47,7 @@
#ifdef MOZILLA_INTERNAL_API
#include "nsString.h"
#include "nsReadableUtils.h"
#else
#include "nsStringAPI.h"
#endif

View File

@ -140,7 +140,7 @@ nsresult XPCOMGlueShutdown()
return NS_OK;
}
extern "C" NS_COM nsresult
XPCOM_API(nsresult)
NS_InitXPCOM2(nsIServiceManager* *result,
nsIFile* binDirectory,
nsIDirectoryServiceProvider* appFileLocationProvider)
@ -150,7 +150,7 @@ NS_InitXPCOM2(nsIServiceManager* *result,
return xpcomFunctions.init(result, binDirectory, appFileLocationProvider);
}
extern "C" NS_COM nsresult
XPCOM_API(nsresult)
NS_InitXPCOM3(nsIServiceManager* *result,
nsIFile* binDirectory,
nsIDirectoryServiceProvider* appFileLocationProvider,
@ -163,7 +163,7 @@ NS_InitXPCOM3(nsIServiceManager* *result,
staticComponents, componentCount);
}
extern "C" NS_COM nsresult
XPCOM_API(nsresult)
NS_ShutdownXPCOM(nsIServiceManager* servMgr)
{
if (!xpcomFunctions.shutdown)
@ -171,7 +171,7 @@ NS_ShutdownXPCOM(nsIServiceManager* servMgr)
return xpcomFunctions.shutdown(servMgr);
}
extern "C" NS_COM nsresult
XPCOM_API(nsresult)
NS_GetServiceManager(nsIServiceManager* *result)
{
if (!xpcomFunctions.getServiceManager)
@ -179,7 +179,7 @@ NS_GetServiceManager(nsIServiceManager* *result)
return xpcomFunctions.getServiceManager(result);
}
extern "C" NS_COM nsresult
XPCOM_API(nsresult)
NS_GetComponentManager(nsIComponentManager* *result)
{
if (!xpcomFunctions.getComponentManager)
@ -187,7 +187,7 @@ NS_GetComponentManager(nsIComponentManager* *result)
return xpcomFunctions.getComponentManager(result);
}
extern "C" NS_COM nsresult
XPCOM_API(nsresult)
NS_GetComponentRegistrar(nsIComponentRegistrar* *result)
{
if (!xpcomFunctions.getComponentRegistrar)
@ -195,7 +195,7 @@ NS_GetComponentRegistrar(nsIComponentRegistrar* *result)
return xpcomFunctions.getComponentRegistrar(result);
}
extern "C" NS_COM nsresult
XPCOM_API(nsresult)
NS_GetMemoryManager(nsIMemory* *result)
{
if (!xpcomFunctions.getMemoryManager)
@ -203,7 +203,7 @@ NS_GetMemoryManager(nsIMemory* *result)
return xpcomFunctions.getMemoryManager(result);
}
extern "C" NS_COM nsresult
XPCOM_API(nsresult)
NS_NewLocalFile(const nsAString &path, PRBool followLinks, nsILocalFile* *result)
{
if (!xpcomFunctions.newLocalFile)
@ -211,7 +211,7 @@ NS_NewLocalFile(const nsAString &path, PRBool followLinks, nsILocalFile* *result
return xpcomFunctions.newLocalFile(path, followLinks, result);
}
extern "C" NS_COM nsresult
XPCOM_API(nsresult)
NS_NewNativeLocalFile(const nsACString &path, PRBool followLinks, nsILocalFile* *result)
{
if (!xpcomFunctions.newNativeLocalFile)
@ -219,7 +219,7 @@ NS_NewNativeLocalFile(const nsACString &path, PRBool followLinks, nsILocalFile*
return xpcomFunctions.newNativeLocalFile(path, followLinks, result);
}
extern "C" NS_COM nsresult
XPCOM_API(nsresult)
NS_RegisterXPCOMExitRoutine(XPCOMExitRoutine exitRoutine, PRUint32 priority)
{
if (!xpcomFunctions.registerExitRoutine)
@ -227,7 +227,7 @@ NS_RegisterXPCOMExitRoutine(XPCOMExitRoutine exitRoutine, PRUint32 priority)
return xpcomFunctions.registerExitRoutine(exitRoutine, priority);
}
extern "C" NS_COM nsresult
XPCOM_API(nsresult)
NS_UnregisterXPCOMExitRoutine(XPCOMExitRoutine exitRoutine)
{
if (!xpcomFunctions.unregisterExitRoutine)
@ -235,7 +235,7 @@ NS_UnregisterXPCOMExitRoutine(XPCOMExitRoutine exitRoutine)
return xpcomFunctions.unregisterExitRoutine(exitRoutine);
}
extern "C" NS_COM nsresult
XPCOM_API(nsresult)
NS_GetDebug(nsIDebug* *result)
{
if (!xpcomFunctions.getDebug)
@ -244,7 +244,7 @@ NS_GetDebug(nsIDebug* *result)
}
extern "C" NS_COM nsresult
XPCOM_API(nsresult)
NS_GetTraceRefcnt(nsITraceRefcnt* *result)
{
if (!xpcomFunctions.getTraceRefcnt)
@ -253,7 +253,7 @@ NS_GetTraceRefcnt(nsITraceRefcnt* *result)
}
extern "C" NS_COM nsresult
XPCOM_API(nsresult)
NS_StringContainerInit(nsStringContainer &aStr)
{
if (!xpcomFunctions.stringContainerInit)
@ -261,7 +261,7 @@ NS_StringContainerInit(nsStringContainer &aStr)
return xpcomFunctions.stringContainerInit(aStr);
}
extern "C" NS_COM nsresult
XPCOM_API(nsresult)
NS_StringContainerInit2(nsStringContainer &aStr,
const PRUnichar *aData,
PRUint32 aDataLength,
@ -272,14 +272,14 @@ NS_StringContainerInit2(nsStringContainer &aStr,
return xpcomFunctions.stringContainerInit2(aStr, aData, aDataLength, aFlags);
}
extern "C" NS_COM void
XPCOM_API(void)
NS_StringContainerFinish(nsStringContainer &aStr)
{
if (xpcomFunctions.stringContainerFinish)
xpcomFunctions.stringContainerFinish(aStr);
}
extern "C" NS_COM PRUint32
XPCOM_API(PRUint32)
NS_StringGetData(const nsAString &aStr, const PRUnichar **aBuf, PRBool *aTerm)
{
if (!xpcomFunctions.stringGetData) {
@ -289,7 +289,7 @@ NS_StringGetData(const nsAString &aStr, const PRUnichar **aBuf, PRBool *aTerm)
return xpcomFunctions.stringGetData(aStr, aBuf, aTerm);
}
extern "C" NS_COM PRUint32
XPCOM_API(PRUint32)
NS_StringGetMutableData(nsAString &aStr, PRUint32 aLen, PRUnichar **aBuf)
{
if (!xpcomFunctions.stringGetMutableData) {
@ -299,7 +299,7 @@ NS_StringGetMutableData(nsAString &aStr, PRUint32 aLen, PRUnichar **aBuf)
return xpcomFunctions.stringGetMutableData(aStr, aLen, aBuf);
}
extern "C" NS_COM PRUnichar *
XPCOM_API(PRUnichar*)
NS_StringCloneData(const nsAString &aStr)
{
if (!xpcomFunctions.stringCloneData)
@ -307,7 +307,7 @@ NS_StringCloneData(const nsAString &aStr)
return xpcomFunctions.stringCloneData(aStr);
}
extern "C" NS_COM nsresult
XPCOM_API(nsresult)
NS_StringSetData(nsAString &aStr, const PRUnichar *aBuf, PRUint32 aCount)
{
if (!xpcomFunctions.stringSetData)
@ -316,7 +316,7 @@ NS_StringSetData(nsAString &aStr, const PRUnichar *aBuf, PRUint32 aCount)
return xpcomFunctions.stringSetData(aStr, aBuf, aCount);
}
extern "C" NS_COM nsresult
XPCOM_API(nsresult)
NS_StringSetDataRange(nsAString &aStr, PRUint32 aCutStart, PRUint32 aCutLength,
const PRUnichar *aBuf, PRUint32 aCount)
{
@ -325,7 +325,7 @@ NS_StringSetDataRange(nsAString &aStr, PRUint32 aCutStart, PRUint32 aCutLength,
return xpcomFunctions.stringSetDataRange(aStr, aCutStart, aCutLength, aBuf, aCount);
}
extern "C" NS_COM nsresult
XPCOM_API(nsresult)
NS_StringCopy(nsAString &aDest, const nsAString &aSrc)
{
if (!xpcomFunctions.stringCopy)
@ -334,7 +334,7 @@ NS_StringCopy(nsAString &aDest, const nsAString &aSrc)
}
extern "C" NS_COM nsresult
XPCOM_API(nsresult)
NS_CStringContainerInit(nsCStringContainer &aStr)
{
if (!xpcomFunctions.cstringContainerInit)
@ -342,7 +342,7 @@ NS_CStringContainerInit(nsCStringContainer &aStr)
return xpcomFunctions.cstringContainerInit(aStr);
}
extern "C" NS_COM nsresult
XPCOM_API(nsresult)
NS_CStringContainerInit2(nsCStringContainer &aStr,
const char *aData,
PRUint32 aDataLength,
@ -353,14 +353,14 @@ NS_CStringContainerInit2(nsCStringContainer &aStr,
return xpcomFunctions.cstringContainerInit2(aStr, aData, aDataLength, aFlags);
}
extern "C" NS_COM void
XPCOM_API(void)
NS_CStringContainerFinish(nsCStringContainer &aStr)
{
if (xpcomFunctions.cstringContainerFinish)
xpcomFunctions.cstringContainerFinish(aStr);
}
extern "C" NS_COM PRUint32
XPCOM_API(PRUint32)
NS_CStringGetData(const nsACString &aStr, const char **aBuf, PRBool *aTerm)
{
if (!xpcomFunctions.cstringGetData) {
@ -370,7 +370,7 @@ NS_CStringGetData(const nsACString &aStr, const char **aBuf, PRBool *aTerm)
return xpcomFunctions.cstringGetData(aStr, aBuf, aTerm);
}
extern "C" NS_COM PRUint32
XPCOM_API(PRUint32)
NS_CStringGetMutableData(nsACString &aStr, PRUint32 aLen, char **aBuf)
{
if (!xpcomFunctions.cstringGetMutableData) {
@ -380,7 +380,7 @@ NS_CStringGetMutableData(nsACString &aStr, PRUint32 aLen, char **aBuf)
return xpcomFunctions.cstringGetMutableData(aStr, aLen, aBuf);
}
extern "C" NS_COM char *
XPCOM_API(char*)
NS_CStringCloneData(const nsACString &aStr)
{
if (!xpcomFunctions.cstringCloneData)
@ -388,7 +388,7 @@ NS_CStringCloneData(const nsACString &aStr)
return xpcomFunctions.cstringCloneData(aStr);
}
extern "C" NS_COM nsresult
XPCOM_API(nsresult)
NS_CStringSetData(nsACString &aStr, const char *aBuf, PRUint32 aCount)
{
if (!xpcomFunctions.cstringSetData)
@ -396,7 +396,7 @@ NS_CStringSetData(nsACString &aStr, const char *aBuf, PRUint32 aCount)
return xpcomFunctions.cstringSetData(aStr, aBuf, aCount);
}
extern "C" NS_COM nsresult
XPCOM_API(nsresult)
NS_CStringSetDataRange(nsACString &aStr, PRUint32 aCutStart, PRUint32 aCutLength,
const char *aBuf, PRUint32 aCount)
{
@ -405,7 +405,7 @@ NS_CStringSetDataRange(nsACString &aStr, PRUint32 aCutStart, PRUint32 aCutLength
return xpcomFunctions.cstringSetDataRange(aStr, aCutStart, aCutLength, aBuf, aCount);
}
extern "C" NS_COM nsresult
XPCOM_API(nsresult)
NS_CStringCopy(nsACString &aDest, const nsACString &aSrc)
{
if (!xpcomFunctions.cstringCopy)
@ -413,7 +413,7 @@ NS_CStringCopy(nsACString &aDest, const nsACString &aSrc)
return xpcomFunctions.cstringCopy(aDest, aSrc);
}
extern "C" NS_COM nsresult
XPCOM_API(nsresult)
NS_CStringToUTF16(const nsACString &aSrc, nsCStringEncoding aSrcEncoding, nsAString &aDest)
{
if (!xpcomFunctions.cstringToUTF16)
@ -421,7 +421,7 @@ NS_CStringToUTF16(const nsACString &aSrc, nsCStringEncoding aSrcEncoding, nsAStr
return xpcomFunctions.cstringToUTF16(aSrc, aSrcEncoding, aDest);
}
extern "C" NS_COM nsresult
XPCOM_API(nsresult)
NS_UTF16ToCString(const nsAString &aSrc, nsCStringEncoding aDestEncoding, nsACString &aDest)
{
if (!xpcomFunctions.utf16ToCString)
@ -429,7 +429,7 @@ NS_UTF16ToCString(const nsAString &aSrc, nsCStringEncoding aDestEncoding, nsACSt
return xpcomFunctions.utf16ToCString(aSrc, aDestEncoding, aDest);
}
extern "C" NS_COM void*
XPCOM_API(void*)
NS_Alloc(PRSize size)
{
if (!xpcomFunctions.allocFunc)
@ -437,7 +437,7 @@ NS_Alloc(PRSize size)
return xpcomFunctions.allocFunc(size);
}
extern "C" NS_COM void*
XPCOM_API(void*)
NS_Realloc(void* ptr, PRSize size)
{
if (!xpcomFunctions.reallocFunc)
@ -445,7 +445,7 @@ NS_Realloc(void* ptr, PRSize size)
return xpcomFunctions.reallocFunc(ptr, size);
}
extern "C" NS_COM void
XPCOM_API(void)
NS_Free(void* ptr)
{
if (xpcomFunctions.freeFunc)

View File

@ -98,7 +98,7 @@ interface nsIStringInputStream : nsIInputStream
//-----------------------------------------------------------------------------
#include "nsIInputStream.h"
#include "nsString.h"
#include "nsStringGlue.h"
//-----------------------------------------------------------------------------
// Factory method to get an nsInputStream from an nsAString. Result will

View File

@ -57,7 +57,7 @@ CPPSRCS = \
nsProxyRelease.cpp \
$(NULL)
DEFINES += -D_IMPL_NS_COM -DEXPORT_XPTC_API -DEXPORT_XPTI_API
DEFINES += -D_IMPL_NS_COM -DEXPORT_XPTC_API
# No shared lib; Force creation of static lib
FORCE_STATIC_LIB = 1
@ -66,3 +66,5 @@ FORCE_STATIC_LIB = 1
FORCE_USE_PIC = 1
include $(topsrcdir)/config/rules.mk
LOCAL_INCLUDES += -I$(srcdir)/../../reflect/xptinfo/src

View File

@ -29,11 +29,6 @@ class nsIProxyCreateInstance : public nsISupports {
/* void CreateInstanceByContractID (in string aContractID, in nsISupports aOuter, in nsIIDRef iid, out voidStar result); */
NS_IMETHOD CreateInstanceByContractID(const char *aContractID, nsISupports *aOuter, const nsIID & iid, void * *result) = 0;
#ifdef XPIDL_JS_STUBS
static NS_EXPORT_(JSObject *) InitJSClass(JSContext *cx);
static NS_EXPORT_(JSObject *) GetJSObject(JSContext *cx, nsIProxyCreateInstance *priv);
#endif
};
#endif /* __gen_nsIProxyCreateInstance_h__ */

View File

@ -49,7 +49,7 @@
#include "nsHashtable.h"
#include "nsAutoLock.h"
#include "nsIInterfaceInfoManager.h"
#include "xptiprivate.h"
#include "xptcall.h"
// LIFETIME_CACHE will cache class for the entire cyle of the application.
@ -109,7 +109,9 @@ nsProxyEventClass::GetNewOrUsedClass(REFNSIID aIID)
}
else
{
nsCOMPtr<nsIInterfaceInfoManager> iimgr = getter_AddRefs(XPTI_GetInterfaceInfoManager());
nsIInterfaceInfoManager* iimgr =
xptiInterfaceInfoManager::GetInterfaceInfoManagerNoAddRef();
if(iimgr)
{
nsCOMPtr<nsIInterfaceInfo> info;
@ -251,7 +253,8 @@ nsProxyEventClass::CallQueryInterfaceOnProxy(nsProxyEventObject* self, REFNSIID
nsCOMPtr<nsIInterfaceInfo> interfaceInfo;
const nsXPTMethodInfo *mi;
nsCOMPtr<nsIInterfaceInfoManager> iim = getter_AddRefs(XPTI_GetInterfaceInfoManager());
nsIInterfaceInfoManager* iim =
xptiInterfaceInfoManager::GetInterfaceInfoManagerNoAddRef();
if (!iim) return NS_NOINTERFACE;
iim->GetInfoForName("nsISupports", getter_AddRefs(interfaceInfo));

View File

@ -45,7 +45,6 @@ include $(DEPTH)/config/autoconf.mk
MODULE = xpcom_tests
XPIDL_MODULE = proxytest
REQUIRES = xpcom
MOZILLA_INTERNAL_API = 1
CPPSRCS = proxytests.cpp
XPIDLSRCS = nsITestProxy.idl
@ -53,6 +52,7 @@ XPIDLSRCS = nsITestProxy.idl
SIMPLE_PROGRAMS = $(CPPSRCS:.cpp=$(BIN_SUFFIX))
LIBS = \
$(DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) \
$(XPCOM_LIBS) \
$(NSPR_LIBS) \
$(NULL)

View File

@ -52,6 +52,8 @@
#include "nsIProxyObjectManager.h"
#include "nsIEventQueueService.h"
#include "nsComponentManagerUtils.h"
#include "nsServiceManagerUtils.h"
static NS_DEFINE_CID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID);

View File

@ -58,5 +58,5 @@ FORCE_USE_PIC = 1
include $(topsrcdir)/config/rules.mk
DEFINES += -DEXPORT_XPTC_API -D_IMPL_NS_COM -D_IMPL_NS_BASE
DEFINES += -DEXPORT_XPTC_API -D_IMPL_NS_COM

View File

@ -109,6 +109,6 @@ FORCE_STATIC_LIB = 1
include $(topsrcdir)/config/rules.mk
DEFINES += -DEXPORT_XPTC_API -D_IMPL_NS_COM -D_IMPL_NS_BASE
DEFINES += -DEXPORT_XPTC_API -D_IMPL_NS_COM
LOCAL_INCLUDES += -I$(srcdir)/../..

View File

@ -60,12 +60,6 @@ LIBS = \
$(XPCOM_STANDALONE_GLUE_LDOPTS) \
$(NULL)
# XXXbsmedberg temporary hack! The standalone glue still depends on NSPR
# except on mac; this will be fixed soon!
ifneq (Darwin,$(OS_ARCH))
LIBS += $(NSPR_LIBS)
endif
# Need to link with CoreFoundation on Mac
ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT)))
LIBS += \

View File

@ -39,6 +39,7 @@
#define nsStringAPI_h__
#include <string.h>
#include "nscore.h"
/**
* nsStringAPI.h
@ -74,14 +75,6 @@
#include "nscore.h"
#if defined( XPCOM_GLUE )
#define NS_STRINGAPI(type) extern "C" NS_HIDDEN_(type)
#elif defined( _IMPL_NS_STRINGAPI )
#define NS_STRINGAPI(type) extern "C" NS_EXPORT type
#else
#define NS_STRINGAPI(type) extern "C" NS_IMPORT type
#endif
/* The base string types */
class nsAString;
class nsACString;
@ -186,7 +179,7 @@ enum {
*
* @status FROZEN
*/
NS_STRINGAPI(nsresult)
XPCOM_API(nsresult)
NS_StringContainerInit(nsStringContainer &aContainer);
/**
@ -210,7 +203,7 @@ NS_StringContainerInit(nsStringContainer &aContainer);
*
* @status FROZEN
*/
NS_STRINGAPI(nsresult)
XPCOM_API(nsresult)
NS_StringContainerInit2
(nsStringContainer &aContainer, const PRUnichar *aData = nsnull,
PRUint32 aDataLength = PR_UINT32_MAX, PRUint32 aFlags = 0);
@ -224,7 +217,7 @@ NS_StringContainerInit2
*
* @status FROZEN
*/
NS_STRINGAPI(void)
XPCOM_API(void)
NS_StringContainerFinish(nsStringContainer &aContainer);
/* ------------------------------------------------------------------------- */
@ -246,7 +239,7 @@ NS_StringContainerFinish(nsStringContainer &aContainer);
*
* @status FROZEN
*/
NS_STRINGAPI(PRUint32)
XPCOM_API(PRUint32)
NS_StringGetData
(const nsAString &aStr, const PRUnichar **aData,
PRBool *aTerminated = nsnull);
@ -280,7 +273,7 @@ NS_StringGetData
*
* @status FROZEN
*/
NS_STRINGAPI(PRUint32)
XPCOM_API(PRUint32)
NS_StringGetMutableData
(nsAString &aStr, PRUint32 aDataLength, PRUnichar **aData);
@ -296,7 +289,7 @@ NS_StringGetMutableData
*
* @status FROZEN
*/
NS_STRINGAPI(PRUnichar *)
XPCOM_API(PRUnichar *)
NS_StringCloneData
(const nsAString &aStr);
@ -319,7 +312,7 @@ NS_StringCloneData
*
* @status FROZEN
*/
NS_STRINGAPI(nsresult)
XPCOM_API(nsresult)
NS_StringSetData
(nsAString &aStr, const PRUnichar *aData,
PRUint32 aDataLength = PR_UINT32_MAX);
@ -352,7 +345,7 @@ NS_StringSetData
*
* @status FROZEN
*/
NS_STRINGAPI(nsresult)
XPCOM_API(nsresult)
NS_StringSetDataRange
(nsAString &aStr, PRUint32 aCutOffset, PRUint32 aCutLength,
const PRUnichar *aData, PRUint32 aDataLength = PR_UINT32_MAX);
@ -374,7 +367,7 @@ NS_StringSetDataRange
*
* @status FROZEN
*/
NS_STRINGAPI(nsresult)
XPCOM_API(nsresult)
NS_StringCopy
(nsAString &aDestStr, const nsAString &aSrcStr);
@ -491,7 +484,7 @@ enum {
*
* @status FROZEN
*/
NS_STRINGAPI(nsresult)
XPCOM_API(nsresult)
NS_CStringContainerInit(nsCStringContainer &aContainer);
/**
@ -515,7 +508,7 @@ NS_CStringContainerInit(nsCStringContainer &aContainer);
*
* @status FROZEN
*/
NS_STRINGAPI(nsresult)
XPCOM_API(nsresult)
NS_CStringContainerInit2
(nsCStringContainer &aContainer, const char *aData = nsnull,
PRUint32 aDataLength = PR_UINT32_MAX, PRUint32 aFlags = 0);
@ -529,7 +522,7 @@ NS_CStringContainerInit2
*
* @status FROZEN
*/
NS_STRINGAPI(void)
XPCOM_API(void)
NS_CStringContainerFinish(nsCStringContainer &aContainer);
/* ------------------------------------------------------------------------- */
@ -551,7 +544,7 @@ NS_CStringContainerFinish(nsCStringContainer &aContainer);
*
* @status FROZEN
*/
NS_STRINGAPI(PRUint32)
XPCOM_API(PRUint32)
NS_CStringGetData
(const nsACString &aStr, const char **aData,
PRBool *aTerminated = nsnull);
@ -585,7 +578,7 @@ NS_CStringGetData
*
* @status FROZEN
*/
NS_STRINGAPI(PRUint32)
XPCOM_API(PRUint32)
NS_CStringGetMutableData
(nsACString &aStr, PRUint32 aDataLength, char **aData);
@ -601,7 +594,7 @@ NS_CStringGetMutableData
*
* @status FROZEN
*/
NS_STRINGAPI(char *)
XPCOM_API(char *)
NS_CStringCloneData
(const nsACString &aStr);
@ -624,7 +617,7 @@ NS_CStringCloneData
*
* @status FROZEN
*/
NS_STRINGAPI(nsresult)
XPCOM_API(nsresult)
NS_CStringSetData
(nsACString &aStr, const char *aData,
PRUint32 aDataLength = PR_UINT32_MAX);
@ -657,7 +650,7 @@ NS_CStringSetData
*
* @status FROZEN
*/
NS_STRINGAPI(nsresult)
XPCOM_API(nsresult)
NS_CStringSetDataRange
(nsACString &aStr, PRUint32 aCutOffset, PRUint32 aCutLength,
const char *aData, PRUint32 aDataLength = PR_UINT32_MAX);
@ -679,7 +672,7 @@ NS_CStringSetDataRange
*
* @status FROZEN
*/
NS_STRINGAPI(nsresult)
XPCOM_API(nsresult)
NS_CStringCopy
(nsACString &aDestStr, const nsACString &aSrcStr);
@ -784,7 +777,7 @@ enum nsCStringEncoding {
*
* @status FROZEN
*/
NS_STRINGAPI(nsresult)
XPCOM_API(nsresult)
NS_CStringToUTF16(const nsACString &aSource, nsCStringEncoding aSrcEncoding,
nsAString &aDest);
@ -803,7 +796,7 @@ NS_CStringToUTF16(const nsACString &aSource, nsCStringEncoding aSrcEncoding,
*
* @status FROZEN
*/
NS_STRINGAPI(nsresult)
XPCOM_API(nsresult)
NS_UTF16ToCString(const nsAString &aSource, nsCStringEncoding aDestEncoding,
nsACString &aDest);
@ -1071,8 +1064,8 @@ private:
/**
* Below we define nsStringContainer and nsCStringContainer. These classes
* have unspecified structure. In most cases, your code should use
* nsEmbedString instead of these classes; however, if you prefer C-style
* programming, then look no further...
* nsString/nsCString instead of these classes; if you prefer C-style
* programming, then look no further.
*/
class nsStringContainer : public nsAString_external
@ -1097,16 +1090,15 @@ public:
nsCStringContainer() {} // MSVC6 needs this
};
/* ------------------------------------------------------------------------- */
#ifndef MOZILLA_INTERNAL_API
#include "nsDebug.h"
/**
* Below we define a number of inlined helper classes that make the frozen
* string API easier to use.
* The following classes are C++ helper classes that make the frozen string
* API easier to use.
*/
#ifndef MOZILLA_INTERNAL_API
#include "nsDebug.h"
/**
* Rename symbols to avoid conflicting with internal versions.
*/
@ -1308,6 +1300,38 @@ private:
* conversion classes
*/
inline void
CopyUTF16toUTF8(const nsAString& aSource, nsACString& aDest)
{
NS_UTF16ToCString(aSource, NS_CSTRING_ENCODING_UTF8, aDest);
}
inline void
CopyUTF8toUTF16(const nsACString& aSource, nsAString& aDest)
{
NS_CStringToUTF16(aSource, NS_CSTRING_ENCODING_UTF8, aDest);
}
inline void
LossyCopyUTF16toASCII(const nsAString& aSource, nsACString& aDest)
{
NS_UTF16ToCString(aSource, NS_CSTRING_ENCODING_ASCII, aDest);
}
inline void
CopyASCIItoUTF16(const nsACString& aSource, nsAString& aDest)
{
NS_CStringToUTF16(aSource, NS_CSTRING_ENCODING_ASCII, aDest);
}
inline char*
ToNewUTF8String(const nsAString& aSource)
{
nsCString temp;
CopyUTF16toUTF8(aSource, temp);
return NS_CStringCloneData(temp);
}
class NS_ConvertASCIItoUTF16 : public nsString
{
public:
@ -1728,14 +1752,33 @@ StringTail( const nsACString& str, PRUint32 count )
return nsDependentCSubstring(str, str.Length() - count, count);
}
/*
* Canonical empty strings
*/
#define EmptyCString() nsCString()
#define EmptyString() nsString()
/**
* The following declarations are *deprecated*, and are included here only
* to make porting from existing code that doesn't use the frozen string API
* easier. They may disappear in the future.
*/
inline char*
ToNewCString(const nsACString& aStr)
{
return NS_CStringCloneData(aStr);
}
inline PRUnichar*
ToNewUnicode(const nsAString& aStr)
{
return NS_StringCloneData(aStr);
}
typedef nsString PromiseFlatString;
typedef nsCString PromiseFlatCString;
typedef nsCString nsCAutoString;
typedef nsString nsAutoString;
#endif // MOZILLA_INTERNAL_API
#endif // nsStringAPI_h__

View File

@ -88,7 +88,7 @@ static const XPCOMFunctions kFrozenFunctions = {
&NS_InitXPCOM3_P
};
extern "C" NS_EXPORT nsresult
EXPORT_XPCOM_API(nsresult)
NS_GetFrozenFunctions(XPCOMFunctions *functions, const char* /* libraryPath */)
{
if (!functions)
@ -113,7 +113,7 @@ NS_GetFrozenFunctions(XPCOMFunctions *functions, const char* /* libraryPath */)
*/
#undef NS_InitXPCOM2
extern "C" NS_EXPORT nsresult
EXPORT_XPCOM_API(nsresult)
NS_InitXPCOM2(nsIServiceManager **result,
nsIFile *binDirectory,
nsIDirectoryServiceProvider *dirProvider)
@ -122,7 +122,7 @@ NS_InitXPCOM2(nsIServiceManager **result,
}
#undef NS_InitXPCOM3
extern "C" NS_EXPORT nsresult
EXPORT_XPCOM_API(nsresult)
NS_InitXPCOM3(nsIServiceManager **result,
nsIFile *binDirectory,
nsIDirectoryServiceProvider *dirProvider,
@ -134,42 +134,42 @@ NS_InitXPCOM3(nsIServiceManager **result,
}
#undef NS_ShutdownXPCOM
extern "C" NS_EXPORT nsresult
EXPORT_XPCOM_API(nsresult)
NS_ShutdownXPCOM(nsIServiceManager *svcMgr)
{
return NS_ShutdownXPCOM_P(svcMgr);
}
#undef NS_GetServiceManager
extern "C" NS_EXPORT nsresult
EXPORT_XPCOM_API(nsresult)
NS_GetServiceManager(nsIServiceManager* *result)
{
return NS_GetServiceManager_P(result);
}
#undef NS_GetComponentManager
extern "C" NS_EXPORT nsresult
EXPORT_XPCOM_API(nsresult)
NS_GetComponentManager(nsIComponentManager* *result)
{
return NS_GetComponentManager_P(result);
}
#undef NS_GetComponentRegistrar
extern "C" NS_EXPORT nsresult
EXPORT_XPCOM_API(nsresult)
NS_GetComponentRegistrar(nsIComponentRegistrar* *result)
{
return NS_GetComponentRegistrar_P(result);
}
#undef NS_GetMemoryManager
extern "C" NS_EXPORT nsresult
EXPORT_XPCOM_API(nsresult)
NS_GetMemoryManager(nsIMemory* *result)
{
return NS_GetMemoryManager_P(result);
}
#undef NS_NewLocalFile
extern "C" NS_EXPORT nsresult
EXPORT_XPCOM_API(nsresult)
NS_NewLocalFile(const nsAString &path,
PRBool followLinks,
nsILocalFile **result)
@ -178,7 +178,7 @@ NS_NewLocalFile(const nsAString &path,
}
#undef NS_NewNativeLocalFile
extern "C" NS_EXPORT nsresult
EXPORT_XPCOM_API(nsresult)
NS_NewNativeLocalFile(const nsACString &path,
PRBool followLinks,
nsILocalFile **result)
@ -187,35 +187,35 @@ NS_NewNativeLocalFile(const nsACString &path,
}
#undef NS_GetDebug
extern "C" NS_EXPORT nsresult
EXPORT_XPCOM_API(nsresult)
NS_GetDebug(nsIDebug **result)
{
return NS_GetDebug_P(result);
}
#undef NS_GetTraceRefcnt
extern "C" NS_EXPORT nsresult
EXPORT_XPCOM_API(nsresult)
NS_GetTraceRefcnt(nsITraceRefcnt **result)
{
return NS_GetTraceRefcnt_P(result);
}
#undef NS_Alloc
extern "C" NS_EXPORT void*
EXPORT_XPCOM_API(void*)
NS_Alloc(PRSize size)
{
return NS_Alloc_P(size);
}
#undef NS_Realloc
extern "C" NS_EXPORT void*
EXPORT_XPCOM_API(void*)
NS_Realloc(void* ptr, PRSize size)
{
return NS_Realloc_P(ptr, size);
}
#undef NS_Free
extern "C" NS_EXPORT void
EXPORT_XPCOM_API(void)
NS_Free(void* ptr)
{
NS_Free_P(ptr);
@ -226,14 +226,14 @@ NS_Free(void* ptr)
*/
#undef NS_RegisterXPCOMExitRoutine
extern "C" NS_EXPORT nsresult
EXPORT_XPCOM_API(nsresult)
NS_RegisterXPCOMExitRoutine(XPCOMExitRoutine exitRoutine, PRUint32 priority)
{
return NS_RegisterXPCOMExitRoutine_P(exitRoutine, priority);
}
#undef NS_UnregisterXPCOMExitRoutine
extern "C" NS_EXPORT nsresult
EXPORT_XPCOM_API(nsresult)
NS_UnregisterXPCOMExitRoutine(XPCOMExitRoutine exitRoutine)
{
return NS_UnregisterXPCOMExitRoutine_P(exitRoutine);
@ -244,14 +244,14 @@ NS_UnregisterXPCOMExitRoutine(XPCOMExitRoutine exitRoutine)
*/
#undef NS_StringContainerInit
extern "C" NS_EXPORT nsresult
EXPORT_XPCOM_API(nsresult)
NS_StringContainerInit(nsStringContainer &aStr)
{
return NS_StringContainerInit_P(aStr);
}
#undef NS_StringContainerInit2
extern "C" NS_EXPORT nsresult
EXPORT_XPCOM_API(nsresult)
NS_StringContainerInit2(nsStringContainer &aStr,
const PRUnichar *aData,
PRUint32 aDataLength,
@ -261,42 +261,42 @@ NS_StringContainerInit2(nsStringContainer &aStr,
}
#undef NS_StringContainerFinish
extern "C" NS_EXPORT void
EXPORT_XPCOM_API(void)
NS_StringContainerFinish(nsStringContainer &aStr)
{
NS_StringContainerFinish_P(aStr);
}
#undef NS_StringGetData
extern "C" NS_EXPORT PRUint32
EXPORT_XPCOM_API(PRUint32)
NS_StringGetData(const nsAString &aStr, const PRUnichar **aBuf, PRBool *aTerm)
{
return NS_StringGetData_P(aStr, aBuf, aTerm);
}
#undef NS_StringGetMutableData
extern "C" NS_EXPORT PRUint32
EXPORT_XPCOM_API(PRUint32)
NS_StringGetMutableData(nsAString &aStr, PRUint32 aLen, PRUnichar **aBuf)
{
return NS_StringGetMutableData_P(aStr, aLen, aBuf);
}
#undef NS_StringCloneData
extern "C" NS_EXPORT PRUnichar *
EXPORT_XPCOM_API(PRUnichar *)
NS_StringCloneData(const nsAString &aStr)
{
return NS_StringCloneData_P(aStr);
}
#undef NS_StringSetData
extern "C" NS_EXPORT nsresult
EXPORT_XPCOM_API(nsresult)
NS_StringSetData(nsAString &aStr, const PRUnichar *aBuf, PRUint32 aCount)
{
return NS_StringSetData_P(aStr, aBuf, aCount);
}
#undef NS_StringSetDataRange
extern "C" NS_EXPORT nsresult
EXPORT_XPCOM_API(nsresult)
NS_StringSetDataRange(nsAString &aStr, PRUint32 aCutStart, PRUint32 aCutLength,
const PRUnichar *aBuf, PRUint32 aCount)
{
@ -304,21 +304,21 @@ NS_StringSetDataRange(nsAString &aStr, PRUint32 aCutStart, PRUint32 aCutLength,
}
#undef NS_StringCopy
extern "C" NS_EXPORT nsresult
EXPORT_XPCOM_API(nsresult)
NS_StringCopy(nsAString &aDest, const nsAString &aSrc)
{
return NS_StringCopy_P(aDest, aSrc);
}
#undef NS_CStringContainerInit
extern "C" NS_EXPORT nsresult
EXPORT_XPCOM_API(nsresult)
NS_CStringContainerInit(nsCStringContainer &aStr)
{
return NS_CStringContainerInit_P(aStr);
}
#undef NS_CStringContainerInit2
extern "C" NS_EXPORT nsresult
EXPORT_XPCOM_API(nsresult)
NS_CStringContainerInit2(nsCStringContainer &aStr,
const char *aData,
PRUint32 aDataLength,
@ -328,42 +328,42 @@ NS_CStringContainerInit2(nsCStringContainer &aStr,
}
#undef NS_CStringContainerFinish
extern "C" NS_EXPORT void
EXPORT_XPCOM_API(void)
NS_CStringContainerFinish(nsCStringContainer &aStr)
{
NS_CStringContainerFinish_P(aStr);
}
#undef NS_CStringGetData
extern "C" NS_EXPORT PRUint32
EXPORT_XPCOM_API(PRUint32)
NS_CStringGetData(const nsACString &aStr, const char **aBuf, PRBool *aTerm)
{
return NS_CStringGetData_P(aStr, aBuf, aTerm);
}
#undef NS_CStringGetMutableData
extern "C" NS_EXPORT PRUint32
EXPORT_XPCOM_API(PRUint32)
NS_CStringGetMutableData(nsACString &aStr, PRUint32 aLen, char **aBuf)
{
return NS_CStringGetMutableData_P(aStr, aLen, aBuf);
}
#undef NS_CStringCloneData
extern "C" NS_EXPORT char *
EXPORT_XPCOM_API(char *)
NS_CStringCloneData(const nsACString &aStr)
{
return NS_CStringCloneData_P(aStr);
}
#undef NS_CStringSetData
extern "C" NS_EXPORT nsresult
EXPORT_XPCOM_API(nsresult)
NS_CStringSetData(nsACString &aStr, const char *aBuf, PRUint32 aCount)
{
return NS_CStringSetData_P(aStr, aBuf, aCount);
}
#undef NS_CStringSetDataRange
extern "C" NS_EXPORT nsresult
EXPORT_XPCOM_API(nsresult)
NS_CStringSetDataRange(nsACString &aStr, PRUint32 aCutStart, PRUint32 aCutLength,
const char *aBuf, PRUint32 aCount)
{
@ -371,21 +371,21 @@ NS_CStringSetDataRange(nsACString &aStr, PRUint32 aCutStart, PRUint32 aCutLength
}
#undef NS_CStringCopy
extern "C" NS_EXPORT nsresult
EXPORT_XPCOM_API(nsresult)
NS_CStringCopy(nsACString &aDest, const nsACString &aSrc)
{
return NS_CStringCopy_P(aDest, aSrc);
}
#undef NS_CStringToUTF16
extern "C" NS_EXPORT nsresult
EXPORT_XPCOM_API(nsresult)
NS_CStringToUTF16(const nsACString &aSrc, nsCStringEncoding aSrcEncoding, nsAString &aDest)
{
return NS_CStringToUTF16_P(aSrc, aSrcEncoding, aDest);
}
#undef NS_UTF16ToCString
extern "C" NS_EXPORT nsresult
EXPORT_XPCOM_API(nsresult)
NS_UTF16ToCString(const nsAString &aSrc, nsCStringEncoding aDestEncoding, nsACString &aDest)
{
return NS_UTF16ToCString_P(aSrc, aDestEncoding, aDest);

View File

@ -43,7 +43,10 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = xpcom
ifndef MOZ_ENABLE_LIBXUL
MOZILLA_INTERNAL_API = 1
endif
DIRS = dynamic services
ifeq ($(OS_ARCH),WINNT)
@ -57,30 +60,35 @@ REQUIRES = \
CPPSRCS = \
nsIFileEnumerator.cpp \
nsIFileTest.cpp \
TestArray.cpp \
TestAtoms.cpp \
TestAutoLock.cpp \
TestCallTemplates.cpp \
TestCOMPtr.cpp \
TestCOMPtrEq.cpp \
TestCRT.cpp \
TestFactory.cpp \
TestHashtables.cpp \
TestID.cpp \
TestINIParser.cpp \
TestObserverService.cpp \
TestServMgr.cpp \
TestAutoPtr.cpp \
TestMinStringAPI.cpp \
TestVersionComparator.cpp \
$(NULL)
ifndef MOZ_ENABLE_LIBXUL
CPPSRCS += \
TestArray.cpp \
TestAtoms.cpp \
TestAutoLock.cpp \
TestCRT.cpp \
TestPermanentAtoms.cpp \
TestPipes.cpp \
TestServMgr.cpp \
TestThreads.cpp \
TestXPIDLString.cpp \
TestDeque.cpp \
TestAutoPtr.cpp \
TestMinStringAPI.cpp \
TestStrings.cpp \
TestStorageStream.cpp \
TestVersionComparator.cpp \
$(NULL)
endif
#CPPSRCS += TimerTest.cpp
@ -88,6 +96,10 @@ SIMPLE_PROGRAMS = $(CPPSRCS:.cpp=$(BIN_SUFFIX))
include $(topsrcdir)/config/config.mk
ifndef MOZILLA_INTERNAL_API
LIBS += $(DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX)
endif
LIBS += \
$(XPCOM_LIBS) \
$(NSPR_LIBS) \

View File

@ -50,6 +50,8 @@
#include "nsWeakReference.h"
#include "nsIInterfaceRequestor.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsComponentManagerUtils.h"
#include "nsServiceManagerUtils.h"
#define NS_ITESTSERVICE_IID \
{0x127b5253, 0x37b1, 0x43c7, \

View File

@ -37,11 +37,15 @@
* ***** END LICENSE BLOCK ***** */
#include <stdio.h>
#include "nsXPCOM.h"
#include "TestFactory.h"
#include "nsISupports.h"
#include "nsIComponentManager.h"
#include "nsIComponentRegistrar.h"
#include "nsIServiceManager.h"
#include "nsComponentManagerUtils.h"
#include "nsServiceManagerUtils.h"
#include "nsCOMPtr.h"
NS_DEFINE_CID(kTestFactoryCID, NS_TESTFACTORY_CID);
NS_DEFINE_CID(kTestLoadedFactoryCID, NS_TESTLOADEDFACTORY_CID);

View File

@ -43,9 +43,10 @@
#include "nsCOMPtr.h"
#include "nsISupports.h"
#include "nsCRT.h"
#include "nsCOMArray.h"
#include <stdio.h>
class TestUniChar // for nsClassHashtable
{
public:
@ -105,7 +106,7 @@ public:
const char* GetKeyPointer() const { return mNode->mStr; }
PRBool KeyEquals(const char* aEntity) const { return !strcmp(mNode->mStr, aEntity); }
static const char* KeyToPointer(const char* aEntity) { return aEntity; }
static PLDHashNumber HashKey(const char* aEntity) { return nsCRT::HashCode(aEntity); }
static PLDHashNumber HashKey(const char* aEntity) { return HashCString(aEntity); }
enum { ALLOW_MEMMOVE = PR_TRUE };
const EntityNode* mNode;

View File

@ -37,6 +37,7 @@
#include <string.h>
#include "nsXPCOM.h"
#include "nsINIParser.h"
#include "nsILocalFile.h"

View File

@ -40,8 +40,10 @@
#endif
#include <stdio.h>
#include <stdlib.h>
#include "nsStringAPI.h"
#include "nsCRT.h"
#include "nsXPCOM.h"
#include "nsMemory.h"
static const char kAsciiData[] = "hello world";
@ -83,7 +85,7 @@ static PRBool test_basic_1()
NS_ERROR("unexpected result");
return PR_FALSE;
}
nsMemory::Free(clone);
NS_Free(clone);
nsCStringContainer temp;
NS_CStringContainerInit(temp);
@ -125,36 +127,36 @@ static PRBool test_basic_2()
NS_StringSetData(s, kUnicodeData, PR_UINT32_MAX);
len = NS_StringGetData(s, &ptr);
if (ptr == nsnull || nsCRT::strcmp(ptr, kUnicodeData) != 0)
if (len != sizeof(kUnicodeData)/2 - 1)
{
NS_ERROR("unexpected result");
return PR_FALSE;
}
if (len != sizeof(kUnicodeData)/2 - 1)
if (ptr == nsnull || memcmp(ptr, kUnicodeData, sizeof(kUnicodeData)) != 0)
{
NS_ERROR("unexpected result");
return PR_FALSE;
}
clone = NS_StringCloneData(s);
if (ptr == nsnull || nsCRT::strcmp(ptr, kUnicodeData) != 0)
if (ptr == nsnull || memcmp(ptr, kUnicodeData, sizeof(kUnicodeData)) != 0)
{
NS_ERROR("unexpected result");
return PR_FALSE;
}
nsMemory::Free(clone);
NS_Free(clone);
nsStringContainer temp;
NS_StringContainerInit(temp);
NS_StringCopy(temp, s);
len = NS_StringGetData(temp, &ptr);
if (ptr == nsnull || nsCRT::strcmp(ptr, kUnicodeData) != 0)
if (len != sizeof(kUnicodeData)/2 - 1)
{
NS_ERROR("unexpected result");
return PR_FALSE;
}
if (len != sizeof(kUnicodeData)/2 - 1)
if (ptr == nsnull || memcmp(ptr, kUnicodeData, sizeof(kUnicodeData)) != 0)
{
NS_ERROR("unexpected result");
return PR_FALSE;

View File

@ -41,10 +41,11 @@
#include "nsIObserverService.h"
#include "nsIObserver.h"
#include "nsIEnumerator.h"
#include "nsString.h"
#include "nsReadableUtils.h"
#include "prprf.h"
#include "nsStringGlue.h"
#include "nsWeakReference.h"
#include "nsComponentManagerUtils.h"
#include <stdio.h>
static nsIObserverService *anObserverService = NULL;
@ -58,9 +59,7 @@ static void testResult( nsresult rv ) {
}
void printString(nsString &str) {
const char *cstr = ToNewCString(str);
printf("%s", cstr);
delete [] (char*)cstr;
printf("%s", str.get());
}
class TestObserver : public nsIObserver, public nsSupportsWeakReference {

View File

@ -40,6 +40,7 @@
#include "nsXPCOM.h"
#include "nsIServiceManager.h"
#include "nsIComponentManager.h"
#include "nsServiceManagerUtils.h"
#include <stdio.h>
static NS_DEFINE_CID(kIMyServiceCID, NS_IMYSERVICE_CID);

View File

@ -43,6 +43,7 @@
#include "nspr.h"
#include "nsCOMPtr.h"
#include "nsIServiceManager.h"
#include "nsXPCOM.h"
class nsRunner : public nsIRunnable {
public:

View File

@ -47,7 +47,6 @@ MODULE_NAME = nsTestDynamicModule
MODULE = xpcom
LIBRARY_NAME = testdynamic
SHORT_LIBNAME = tdynamic
MOZILLA_INTERNAL_API = 1
CPPSRCS = TestDynamic.cpp
@ -57,6 +56,7 @@ LOCAL_INCLUDES = -I$(srcdir)/.. -I$(srcdir)/../../public
include $(topsrcdir)/config/rules.mk
EXTRA_DSO_LDOPTS += $(MOZ_COMPONENT_LIBS)
EXTRA_DSO_LDOPTS += \
$(DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) \
$(MOZ_COMPONENT_LIBS) \
$(NULL)

View File

@ -1,15 +1,13 @@
#include "nsILocalFile.h"
#include "nsDependentString.h"
#include "nsString.h"
#include "nsStringGlue.h"
#include <stdio.h>
#include "nsIComponentRegistrar.h"
#include "nsIComponentManager.h"
#include "nsIServiceManager.h"
#include "nsMemory.h"
#include "nsXPIDLString.h"
#include "nsISimpleEnumerator.h"
#include "nsCOMPtr.h"
PRBool LoopInDir(nsILocalFile* file)
{

View File

@ -1,5 +1,5 @@
#include "nsILocalFile.h"
#include "nsString.h"
#include "nsStringGlue.h"
#include <stdio.h>
#include "nsXPCOM.h"
@ -7,7 +7,9 @@
#include "nsIComponentRegistrar.h"
#include "nsIServiceManager.h"
#include "nsIMemory.h"
#include "nsXPIDLString.h"
#include "nsComponentManagerUtils.h"
#include "nsCOMPtr.h"
void Passed();
void Failed(const char* explanation = nsnull);

View File

@ -47,13 +47,15 @@ IS_COMPONENT = 1
MODULE_NAME = MyService
LIBRARY_NAME = MyService
SHORT_LIBNAME = MyServce
MOZILLA_INTERNAL_API = 1
CPPSRCS = MyService.cpp
LOCAL_INCLUDES = -I$(srcdir)/..
EXTRA_DSO_LDOPTS += $(MOZ_COMPONENT_LIBS)
EXTRA_DSO_LDOPTS += \
$(DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) \
$(MOZ_COMPONENT_LIBS) \
$(NULL)
include $(topsrcdir)/config/rules.mk

View File

@ -43,12 +43,10 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = xpcom
MOZILLA_INTERNAL_API = 1
REQUIRES = string
CPPSRCS = TestCOM.cpp
#TestHelloXPLoop.cpp nsStringTest.cpp
SIMPLE_PROGRAMS = $(CPPSRCS:.cpp=$(BIN_SUFFIX))
@ -58,4 +56,8 @@ include $(topsrcdir)/config/rules.mk
OS_LIBS = $(call EXPAND_LIBNAME,rpcrt4 uuid)
LIBS = $(XPCOM_LIBS) $(NSPR_LIBS)
LIBS = \
$(DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) \
$(XPCOM_LIBS) \
$(NSPR_LIBS) \
$(NULL)

View File

@ -284,13 +284,13 @@ PL_CreateEventQueue(const char* name, PRThread* handlerThread)
return( _pl_CreateEventQueue( name, handlerThread, EventQueueIsNative ));
}
PR_EXTERN(PLEventQueue *)
PLEventQueue *
PL_CreateNativeEventQueue(const char *name, PRThread *handlerThread)
{
return( _pl_CreateEventQueue( name, handlerThread, EventQueueIsNative ));
}
PR_EXTERN(PLEventQueue *)
PLEventQueue *
PL_CreateMonitoredEventQueue(const char *name, PRThread *handlerThread)
{
return( _pl_CreateEventQueue( name, handlerThread, EventQueueIsMonitored ));
@ -1386,7 +1386,7 @@ PL_IsQueueOnCurrentThread( PLEventQueue *queue )
return me == queue->handlerThread;
}
PR_EXTERN(PRBool)
PRBool
PL_IsQueueNative(PLEventQueue *queue)
{
return queue->type == EventQueueIsNative ? PR_TRUE : PR_FALSE;

View File

@ -55,7 +55,6 @@ SIMPLE_PROGRAMS = $(CPPSRCS:.cpp=$(BIN_SUFFIX))
LIBS = \
$(XPCOM_STANDALONE_GLUE_LDOPTS) \
$(NSPR_LIBS) \
$(NULL)
# Need to link with CoreFoundation on Mac