Bug 288626 - Switch the strict API from opt-in (MOZILLA_STRICT_API) to opt-out (MOZILLA_INTERNAL_API) r=darin

This commit is contained in:
bsmedberg%covad.net 2005-04-06 03:35:24 +00:00
Родитель c97e986ee8
Коммит 564337d16d
28 изменённых файлов: 90 добавлений и 65 удалений

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

@ -471,6 +471,11 @@ ifdef MOZ_PROFILE_USE
DSO_PIC_CFLAGS += $(PROFILE_USE_CFLAGS)
endif
# Does the makefile specifies the internal XPCOM API linkage?
ifneq (,$(MOZILLA_INTERNAL_API)$(LIBXUL_LIBRARY))
DEFINES += -DMOZILLA_INTERNAL_API
endif
# Force XPCOM/widget/gfx methods to be _declspec(dllexport) when we're
# building libxul libraries
ifdef MOZ_ENABLE_LIBXUL
@ -534,6 +539,10 @@ REQ_INCLUDES = $(foreach d,$(REQUIRES),-I$(DIST)/include/$d)
INCLUDES = $(LOCAL_INCLUDES) $(REQ_INCLUDES) -I$(PUBLIC) -I$(DIST)/include $(OS_INCLUDES)
ifndef MOZILLA_INTERNAL_API
INCLUDES += -I$(DIST)/sdk/include
endif
CFLAGS = $(OS_CFLAGS)
CXXFLAGS = $(OS_CXXFLAGS)
LDFLAGS = $(OS_LDFLAGS)

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

@ -49,6 +49,7 @@
#include "nsXPIDLString.h"
#include "nsCRT.h"
#include "nsCOMArray.h"
#include "nsXPCOMCID.h"
#include "nsQuickSort.h"
#include "prmem.h"
@ -756,8 +757,7 @@ static nsresult pref_InitInitialObjects()
// xxxbsmedberg: TODO load default prefs from a category
// but the architecture is not quite there yet
static NS_DEFINE_CID(kDirectoryServiceCID, NS_DIRECTORY_SERVICE_CID);
nsCOMPtr<nsIProperties> dirSvc(do_GetService(kDirectoryServiceCID, &rv));
nsCOMPtr<nsIProperties> dirSvc(do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv));
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsISimpleEnumerator> dirList;

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

@ -40,11 +40,15 @@
#include "nsIDirectoryService.h"
#include "nsILocalFile.h"
#ifdef STANDALONE_PROFILEDIRSERVICE
#define MOZILLA_STRICT_API
#include "nsEmbedString.h"
#else
#include "nsCOMPtr.h"
#include "nsDirectoryServiceUtils.h"
#include "nsComponentManagerUtils.h"
#include "nsServiceManagerUtils.h"
#ifdef MOZILLA_INTERNAL_API
#include "nsString.h"
#else
#include "nsEmbedString.h"
#endif
// Forward Declarations
@ -112,7 +116,7 @@ protected:
PRPackedBool mNotifyObservers;
PRPackedBool mSharingEnabled;
#ifdef STANDALONE_PROFILEDIRSERVICE
#ifndef MOZILLA_INTERNAL_API
nsEmbedString mNonSharedDirName;
#else
nsString mNonSharedDirName;

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

@ -49,9 +49,8 @@
* embed strings APIs.
*/
#ifdef STANDALONE_PROFILEDIRSERVICE
#ifndef MOZILLA_INTERNAL_API
#define MOZILLA_STRICT_API
#include "nsStringAPI.h"
typedef nsCString nsPromiseFlatCString;

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

@ -61,8 +61,6 @@ FORCE_STATIC_LIB = 1
include $(topsrcdir)/config/rules.mk
DEFINES += -DSTANDALONE_PROFILEDIRSERVICE
LOCAL_INCLUDES = -I$(srcdir)/../src
export:: $(MODULES_PROFILEDIRSERVICE_SRC_CSRCS)

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

@ -95,7 +95,7 @@ interface nsISupportsWeakReference : nsISupports
%{C++
#ifndef MOZILLA_STRICT_API
#ifdef MOZILLA_INTERNAL_API
#include "nsIWeakReferenceUtils.h"
#endif
%}

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

@ -253,10 +253,10 @@
#define NS_COM NS_IMPORT
#endif
#ifdef MOZILLA_STRICT_API
#define NS_COM_GLUE
#else
#ifdef MOZILLA_INTERNAL_API
#define NS_COM_GLUE NS_COM
#else
#define NS_COM_GLUE
#endif

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

@ -39,7 +39,7 @@
#define nsXPCOM_h__
// Map frozen functions to private symbol names if not using strict API.
#ifndef MOZILLA_STRICT_API
#ifdef MOZILLA_INTERNAL_API
# define NS_InitXPCOM2 NS_InitXPCOM2_P
# define NS_ShutdownXPCOM NS_ShutdownXPCOM_P
# define NS_GetServiceManager NS_GetServiceManager_P

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

@ -40,7 +40,7 @@
#define nsXPComPrivate_h__
// Map frozen functions to private symbol names if not using strict API.
#ifndef MOZILLA_STRICT_API
#ifdef MOZILLA_INTERNAL_API
# define NS_RegisterXPCOMExitRoutine NS_RegisterXPCOMExitRoutine_P
# define NS_UnregisterXPCOMExitRoutine NS_UnregisterXPCOMExitRoutine_P
#endif

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

@ -104,7 +104,7 @@ interface nsIComponentManager : nsISupports
%{ C++
#ifndef MOZILLA_STRICT_API
#ifdef MOZILLA_INTERNAL_API
#include "nsComponentManagerUtils.h"
#endif
%} C++

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

@ -110,7 +110,7 @@ interface nsIServiceManager : nsISupports
// Observing xpcom autoregistration. Topics will be 'start' and 'stop'.
#define NS_XPCOM_AUTOREGISTRATION_OBSERVER_ID "xpcom-autoregistration"
#ifndef MOZILLA_STRICT_API
#ifdef MOZILLA_INTERNAL_API
#include "nsXPCOM.h"
#include "nsServiceManagerUtils.h"
#include "nsIServiceManagerObsolete.h"

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

@ -84,5 +84,3 @@ include $(topsrcdir)/config/rules.mk
# hack to work around objdir bustage
export::
rm -f $(XPCOM_GLUE_SRC_CSRCS:.cpp=.$(OBJ_SUFFIX))
DEFINES += -DMOZILLA_STRICT_API

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

@ -46,7 +46,9 @@
#include "nsComponentManagerUtils.h"
#include "nsServiceManagerUtils.h"
#ifdef MOZILLA_STRICT_API
#include "nsIComponentManager.h"
#ifndef MOZILLA_INTERNAL_API
nsresult
CallGetService(const nsCID &aCID, const nsIID &aIID, void **aResult)
@ -94,7 +96,7 @@ CallGetService(const char *aContractID, const nsIID &aIID, void **aResult)
#endif
#ifdef MOZILLA_STRICT_API
#ifndef MOZILLA_INTERNAL_API
nsresult
CallCreateInstance(const nsCID &aCID, nsISupports *aDelegate,

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

@ -39,7 +39,6 @@
#define nsServiceManagerUtils_h__
#include "nsIServiceManager.h"
#include "nsIServiceManagerObsolete.h"
#include "nsCOMPtr.h"
inline

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

@ -82,4 +82,4 @@ include $(topsrcdir)/config/rules.mk
export:: $(XPCOM_GLUE_SRC_CSRCS)
$(INSTALL) $^ .
DEFINES += -DXPCOM_GLUE -DMOZILLA_STRICT_API
DEFINES += -DXPCOM_GLUE

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

@ -94,7 +94,6 @@ endif # OS2
EXPORTS = \
nsAppDirectoryServiceDefs.h \
nsDirectoryService.h \
nsDirectoryServiceUtils.h \
nsEscape.h \
nsFastLoadPtr.h \
nsFastLoadService.h \
@ -160,6 +159,7 @@ SDK_XPIDLSRCS = \
SDK_HEADERS = \
nsDirectoryServiceDefs.h \
nsDirectoryServiceUtils.h \
$(NULL)
EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS))

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

@ -47,6 +47,7 @@
#define NS_XPCOM_INIT_CURRENT_PROCESS_DIR "MozBinD" // Can be used to set NS_XPCOM_CURRENT_PROCESS_DIR
// CANNOT be used to GET a location
#define NS_DIRECTORY_SERVICE_CID {0xf00152d0,0xb40b,0x11d3,{0x8c, 0x9c, 0x00, 0x00, 0x64, 0x65, 0x73, 0x74}}
class nsDirectoryService : public nsIDirectoryService,
public nsIProperties,
@ -54,8 +55,6 @@ class nsDirectoryService : public nsIDirectoryService,
{
public:
NS_DEFINE_STATIC_CID_ACCESSOR(NS_DIRECTORY_SERVICE_CID);
// nsISupports interface
NS_DECL_ISUPPORTS

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

@ -41,16 +41,15 @@
#include "nsIServiceManager.h"
#include "nsIProperties.h"
#include "nsServiceManagerUtils.h"
#include "nsCOMPtr.h"
#define NS_DIRECTORY_SERVICE_CID {0xf00152d0,0xb40b,0x11d3,{0x8c, 0x9c, 0x00, 0x00, 0x64, 0x65, 0x73, 0x74}}
#include "nsXPCOMCID.h"
inline nsresult
NS_GetSpecialDirectory(const char* specialDirName, nsIFile* *result)
{
nsresult rv;
static NS_DEFINE_CID(kDirectoryServiceCID, NS_DIRECTORY_SERVICE_CID);
nsCOMPtr<nsIProperties> serv(do_GetService(kDirectoryServiceCID, &rv));
nsCOMPtr<nsIProperties> serv(do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv));
if (NS_FAILED(rv))
return rv;

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

@ -337,7 +337,7 @@ interface nsIFile : nsISupports
};
%{C++
#ifndef MOZILLA_STRICT_API
#ifdef MOZILLA_INTERNAL_API
#include "nsDirectoryServiceUtils.h"
#endif
%}

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

@ -42,46 +42,63 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
# MODULE specifies where header files from this Makefile are installed,
# i.e. dist/include/xpcomsample
MODULE = xpcomsample
# XPIDL_MODULE names the .xpt file generated from IDL files
# i.e. dist/bin/components/xpcomsample.xpt
XPIDL_MODULE = xpcomsample
# LIBRARY_NAME names the library generated by this makefile,
# i.e. dist/bin/components/libxpcomsample.so
LIBRARY_NAME = xpcomsample
# On MS Windows and OS/2, SHORT_LIBNAME is used to generate a library
# with an 8.3 filename, e.g. dist/bin/components/xpcomsmp.dll
SHORT_LIBNAME = xpcomsmp
# IS_COMPONENT indicates that this makefile builds a component shared library.
IS_COMPONENT = 1
# If this is Makefile builds a component, MODULE_NAME must match the module
# name specified in NS_IMPL_NSGETMODULE
MODULE_NAME = nsSampleModule
# Ensure that the xpcom classes that we build
# do not export themselves
DEFINES += -DMOZILLA_STRICT_API -DXPCOM_GLUE
REQUIRES = string \
xpcom \
$(NULL)
DEFINES += -DXPCOM_GLUE
# CPPSRCS specifies C++ files to be built into a library.
CPPSRCS = \
nsSample.cpp \
nsSampleModule.cpp \
$(NULL)
# XPIDLSRCS specified IDL files. The build system runs the xpidl tool on these
# files to generate C++ headers and .xpt typelib files.
XPIDLSRCS = nsISample.idl
TESTCPPSRCS = nsTestSample.cpp
CPPSRCS += $(TESTCPPSRCS)
# SIMPLE_PROGRAMS builds an executable program from a single source file.
SIMPLE_PROGRAMS = $(TESTCPPSRCS:.cpp=$(BIN_SUFFIX))
include $(topsrcdir)/config/config.mk
# EXTRA_COMPONENTS installs components written JavaScript to
# dist/bin/components
EXTRA_COMPONENTS = nsSample.js
# separate libraries linked in.
# EXTRA_DSO_LDOPTS specifies linker flags when building a shared library
# from this Makefile
EXTRA_DSO_LDOPTS = \
$(DIST)/lib/$(LIB_PREFIX)xpcomglue.$(LIB_SUFFIX) \
$(NSPR_LIBS) \
$(NULL)
# LIBS specifies linker flags when building an executable program from
# this Makefile.
LIBS = \
$(DIST)/lib/$(LIB_PREFIX)xpcomglue.$(LIB_SUFFIX) \
$(NSPR_LIBS) \

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

@ -47,7 +47,7 @@
*/
// Map frozen functions to private symbol names if not using strict API.
#ifndef MOZILLA_STRICT_API
#ifdef MOZILLA_INTERNAL_API
# define NS_StringContainerInit NS_StringContainerInit_P
# define NS_StringContainerInit2 NS_StringContainerInit2_P
# define NS_StringContainerFinish NS_StringContainerFinish_P
@ -753,14 +753,14 @@ NS_UTF16ToCString(const nsAString &aSource, nsCStringEncoding aDestEncoding,
* internal definition of these classes from nsAString.h in the Mozilla tree.
*/
#ifdef MOZILLA_STRICT_API
#ifndef MOZILLA_INTERNAL_API
#define nsAString_external nsAString
#define nsACString_external nsACString
#endif
class nsAString_external
{
#ifdef MOZILLA_STRICT_API
#ifndef MOZILLA_INTERNAL_API
public:
typedef PRUnichar char_type;
@ -839,7 +839,7 @@ public:
NS_HIDDEN_(void) Cut( index_type cutStart, size_type cutLength ) { Replace(cutStart, cutLength, nsnull, 0); }
#endif // MOZILLA_STRICT_API
#endif // MOZILLA_INTERNAL_API
private:
void *v;
@ -847,7 +847,7 @@ private:
class nsACString_external
{
#ifdef MOZILLA_STRICT_API
#ifndef MOZILLA_INTERNAL_API
public:
typedef char char_type;
@ -926,7 +926,7 @@ public:
NS_HIDDEN_(void) Cut( index_type cutStart, size_type cutLength ) { Replace(cutStart, cutLength, nsnull, 0); }
#endif // MOZILLA_STRICT_API
#endif // MOZILLA_INTERNAL_API
private:
void *v;
@ -970,7 +970,7 @@ public:
* string API easier to use.
*/
#ifdef MOZILLA_STRICT_API
#ifndef MOZILLA_INTERNAL_API
#include "nsDebug.h"
/**
@ -1602,6 +1602,6 @@ StringTail( const nsACString& str, PRUint32 count )
#define EmptyCString() nsCString()
#define EmptyString() nsString()
#endif // MOZILLA_STRICT_API
#endif // MOZILLA_INTERNAL_API
#endif // nsStringAPI_h__

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

@ -37,6 +37,9 @@
*
* ***** END LICENSE BLOCK ***** */
#ifndef MOZILLA_INTERNAL_API
#error Cannot use internal string classes without MOZILLA_INTERNAL_API defined. Use the frozen header nsStringAPI.h instead.
#endif
/**
* The base for string comparators

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

@ -35,7 +35,9 @@
*
* ***** END LICENSE BLOCK ***** */
#define MOZILLA_STRICT_API
#ifdef MOZILLA_INTERNAL_API
#undef MOZILLA_INTERNAL_API
#endif
#include <stdio.h>
#include "nsStringAPI.h"

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

@ -45,11 +45,7 @@ include $(DEPTH)/config/autoconf.mk
MODULE = xpcom
CPPSRCS = regxpcom.cpp
DEFINES += -DXPCOM_GLUE -DMOZILLA_STRICT_API
REQUIRES = \
string \
$(NULL)
DEFINES += -DXPCOM_GLUE
LOCAL_INCLUDES = \
-I$(srcdir)/../../build \

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

@ -65,7 +65,7 @@ endif
endif
ifdef GRE_BUILD
DEFINES += -DXPCOM_GLUE -DMOZILLA_STRICT_API
DEFINES += -DXPCOM_GLUE
else
MOZILLA_INTERNAL_API = 1
endif

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

@ -826,7 +826,7 @@ static char kMatchOSLocalePref[] = "intl.locale.matchOS";
nsresult
getCountry(const nsAString& lc_name, nsAString& aCountry)
{
#ifdef MOZILLA_STRICT_API
#ifndef MOZILLA_INTERNAL_API
const PRUnichar *begin = lc_name.BeginReading();
const PRUnichar *end = lc_name.EndReading();
while (begin != end) {

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

@ -37,7 +37,7 @@
#ifndef nsStringSupport_h__
#define nsStringSupport_h__
#ifdef MOZILLA_STRICT_API
#ifndef MOZILLA_INTERNAL_API
#include "nsStringAPI.h"
#include "nsMemory.h"
@ -106,7 +106,7 @@ typedef nsString nsAutoString;
typedef nsCString nsXPIDLCString;
typedef nsString nsXPIDLString;
#else // MOZILLA_STRICT_API
#else // MOZILLA_INTERNAL_API
#include "nsString.h"
#include "nsNativeCharsetUtils.h"
@ -136,6 +136,6 @@ FindInString(nsCString &str, const char *needle, PRBool ignoreCase = PR_FALSE)
return str.Find(needle, ignoreCase);
}
#endif // MOZILLA_STRICT_API
#endif // MOZILLA_INTERNAL_API
#endif // !nsStringSupport_h__