diff options
author | Pale Moon <git-repo@palemoon.org> | 2014-09-24 16:59:47 +0200 |
---|---|---|
committer | Pale Moon <git-repo@palemoon.org> | 2014-09-24 16:59:47 +0200 |
commit | 93b9490b500d9c053c236452df373bc46cae85c5 (patch) | |
tree | 9d57a2935bd7e4279b866b465a585be1714aeb87 | |
parent | f89dce3c82db7fabe2d3a933618f4d89a121ed2b (diff) | |
download | palemoon-gre-93b9490b500d9c053c236452df373bc46cae85c5.tar.gz |
Remove OS/2 code part 1
183 files changed, 418 insertions, 7389 deletions
diff --git a/b2g/app/nsBrowserApp.cpp b/b2g/app/nsBrowserApp.cpp index e1a4875b2..a9865d0a3 100644 --- a/b2g/app/nsBrowserApp.cpp +++ b/b2g/app/nsBrowserApp.cpp @@ -71,7 +71,7 @@ static bool IsArg(const char* arg, const char* s) return !strcasecmp(arg, s); } -#if defined(XP_WIN) || defined(XP_OS2) +#if defined(XP_WIN) if (*arg == '/') return !strcasecmp(++arg, s); #endif diff --git a/b2g/installer/package-manifest.in b/b2g/installer/package-manifest.in index fa9159cc7..c18937ce9 100644 --- a/b2g/installer/package-manifest.in +++ b/b2g/installer/package-manifest.in @@ -111,13 +111,9 @@ #endif @BINPATH@/application.ini @BINPATH@/platform.ini -#ifndef XP_OS2 #ifndef MOZ_FOLD_LIBS @BINPATH@/@DLL_PREFIX@mozsqlite3@DLL_SUFFIX@ #endif -#else -@BINPATH@/mozsqlt3@DLL_SUFFIX@ -#endif @BINPATH@/blocklist.xml #ifdef XP_UNIX #ifndef XP_MACOSX @@ -415,11 +411,7 @@ @BINPATH@/components/nsSessionStore.js @BINPATH@/components/nsURLFormatter.manifest @BINPATH@/components/nsURLFormatter.js -#ifndef XP_OS2 @BINPATH@/components/@DLL_PREFIX@browsercomps@DLL_SUFFIX@ -#else -@BINPATH@/components/brwsrcmp@DLL_SUFFIX@ -#endif @BINPATH@/components/txEXSLTRegExFunctions.manifest @BINPATH@/components/txEXSLTRegExFunctions.js @BINPATH@/components/toolkitplaces.manifest @@ -711,11 +703,6 @@ bin/libfreebl_32int64_3.so bin/components/@DLL_PREFIX@nkgnomevfs@DLL_SUFFIX@ #endif -; [OS/2] -#ifdef XP_OS2 -@BINPATH@/MozSounds.cmd -#endif - [b2g] @BINPATH@/chrome/icons/ @BINPATH@/chrome/chrome@JAREXT@ diff --git a/browser/app/Makefile.in b/browser/app/Makefile.in index c4a5de582..9a92a4260 100644 --- a/browser/app/Makefile.in +++ b/browser/app/Makefile.in @@ -97,12 +97,6 @@ RCFLAGS += -DMOZ_PHOENIX --include-dir $(srcdir) endif endif -ifeq ($(OS_ARCH),OS2) -RESFILE=splashos2.res -RCFLAGS += -DMOZ_PHOENIX -RCFLAGS += -DFIREFOX_ICO=\"$(DIST)/branding/firefox-os2.ico\" -DDOCUMENT_ICO=\"$(DIST)/branding/document-os2.ico\" -endif - PROGRAMS_DEST = $(DIST)/bin include $(topsrcdir)/config/rules.mk @@ -123,7 +117,7 @@ LDFLAGS += /HEAP:0x40000 endif #} endif #} -ifneq (,$(filter-out OS2 WINNT,$(OS_ARCH))) +ifneq (,$(filter-out WINNT,$(OS_ARCH))) libs:: cp -p $(MOZ_APP_NAME)$(BIN_SUFFIX) $(DIST)/bin/$(MOZ_APP_NAME)-bin$(BIN_SUFFIX) diff --git a/browser/app/nsBrowserApp.cpp b/browser/app/nsBrowserApp.cpp index 9de3fead8..929933c3f 100644 --- a/browser/app/nsBrowserApp.cpp +++ b/browser/app/nsBrowserApp.cpp @@ -99,7 +99,7 @@ static bool IsArg(const char* arg, const char* s) return !strcasecmp(arg, s); } -#if defined(XP_WIN) || defined(XP_OS2) +#if defined(XP_WIN) if (*arg == '/') return !strcasecmp(++arg, s); #endif diff --git a/browser/app/splashos2.rc b/browser/app/splashos2.rc deleted file mode 100644 index f2dd04f3d..000000000 --- a/browser/app/splashos2.rc +++ /dev/null @@ -1,24 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include <os2.h> - -// Splash screen dialog ID. -#define IDD_SPLASH 100 - -// Splash screen bitmap ID. -#define IDB_SPLASH 101 - -ICON 1 FIREFOX_ICO - -DLGTEMPLATE IDD_SPLASH DISCARDABLE -BEGIN - DIALOG "", IDD_SPLASH, 0, 0, 390, 261, , FCF_BORDER - BEGIN - END -END - -//BITMAP IDB_SPLASH "splash.bmp" diff --git a/browser/components/preferences/preferences.xul b/browser/components/preferences/preferences.xul index 1fe2a825a..02c98e31a 100644 --- a/browser/components/preferences/preferences.xul +++ b/browser/components/preferences/preferences.xul @@ -27,9 +27,6 @@ #ifdef XP_WIN #define USE_WIN_TITLE_STYLE #endif -#ifdef XP_OS2 -#define USE_WIN_TITLE_STYLE -#endif #ifdef XP_MACOSX <?xul-overlay href="chrome://browser/content/macBrowserOverlay.xul"?> diff --git a/browser/installer/package-manifest.in b/browser/installer/package-manifest.in index e8a8f467c..8ae87e32c 100644 --- a/browser/installer/package-manifest.in +++ b/browser/installer/package-manifest.in @@ -120,15 +120,11 @@ @BINPATH@/update-settings.ini #endif @BINPATH@/platform.ini -#ifndef XP_OS2 #ifndef MOZ_NATIVE_SQLITE #ifndef MOZ_FOLD_LIBS @BINPATH@/@DLL_PREFIX@mozsqlite3@DLL_SUFFIX@ #endif #endif -#else -@BINPATH@/mozsqlt3@DLL_SUFFIX@ -#endif @BINPATH@/browser/blocklist.xml #ifdef XP_UNIX #ifndef XP_MACOSX @@ -402,11 +398,7 @@ @BINPATH@/browser/components/nsSessionStore.js @BINPATH@/components/nsURLFormatter.manifest @BINPATH@/components/nsURLFormatter.js -#ifndef XP_OS2 @BINPATH@/browser/components/@DLL_PREFIX@browsercomps@DLL_SUFFIX@ -#else -@BINPATH@/browser/components/brwsrcmp@DLL_SUFFIX@ -#endif @BINPATH@/components/txEXSLTRegExFunctions.manifest @BINPATH@/components/txEXSLTRegExFunctions.js @BINPATH@/components/toolkitplaces.manifest @@ -741,13 +733,6 @@ bin/libfreebl_32int64_3.so #endif #endif -; [OS/2] -#ifdef XP_OS2 -@BINPATH@/MozSounds.cmd -@BINPATH@/*.xqs -@BINPATH@/components/*.xqs -#endif - #ifdef MOZ_WEBAPP_RUNTIME [WebappRuntime] #ifdef XP_WIN diff --git a/build/binary-location.mk b/build/binary-location.mk index 7713e1a0c..e3c14ac85 100644 --- a/build/binary-location.mk +++ b/build/binary-location.mk @@ -4,7 +4,7 @@ # finds the location of the browser and puts it in the variable $(browser_path) -ifneq (,$(filter OS2 WINNT,$(OS_ARCH))) +ifneq (,$(filter WINNT,$(OS_ARCH))) PROGRAM = $(MOZ_APP_NAME)$(BIN_SUFFIX) else PROGRAM = $(MOZ_APP_NAME)-bin$(BIN_SUFFIX) diff --git a/build/moz.build b/build/moz.build index f873ef09b..6d6e8ecbb 100644 --- a/build/moz.build +++ b/build/moz.build @@ -4,10 +4,10 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -if CONFIG['OS_ARCH'] not in ('WINNT', 'OS2'): - DIRS += ['unix'] -elif CONFIG['OS_ARCH'] == 'WINNT': +if CONFIG['OS_ARCH'] == 'WINNT': DIRS += ['win32'] +else: + DIRS += ['unix'] if CONFIG['STLPORT_SOURCES']: DIRS += ['stlport'] diff --git a/build/os2/test_os2.cmd b/build/os2/test_os2.cmd deleted file mode 100644 index 389dea091..000000000 --- a/build/os2/test_os2.cmd +++ /dev/null @@ -1,21 +0,0 @@ -REM This Source Code Form is subject to the terms of the Mozilla Public -REM License, v. 2.0. If a copy of the MPL was not distributed with this -REM file, You can obtain one at http://mozilla.org/MPL/2.0/. - -/* Invoke unit tests on OS/2 */ -PARSE ARG dist prog parm -dist=forwardtoback(dist); -prog=forwardtoback(prog); -'set BEGINLIBPATH='dist'\bin;%BEGINLIBPATH%' -'set LIBPATHSTRICT=T' -prog parm -exit - -forwardtoback: procedure - arg pathname - parse var pathname pathname'/'rest - do while (rest <> "") - pathname = pathname'\'rest - parse var pathname pathname'/'rest - end - return pathname diff --git a/chrome/src/nsChromeRegistry.cpp b/chrome/src/nsChromeRegistry.cpp index 9f42314ce..c51721c6b 100644 --- a/chrome/src/nsChromeRegistry.cpp +++ b/chrome/src/nsChromeRegistry.cpp @@ -292,7 +292,7 @@ nsChromeRegistry::ConvertChromeURL(nsIURI* aChromeURI, nsIURI* *aResult) return rv; if (flags & PLATFORM_PACKAGE) { -#if defined(XP_WIN) || defined(XP_OS2) +#if defined(XP_WIN) path.Insert("win/", 0); #elif defined(XP_MACOSX) path.Insert("mac/", 0); diff --git a/config/Makefile.in b/config/Makefile.in index 9355888c0..f0a7b339c 100644 --- a/config/Makefile.in +++ b/config/Makefile.in @@ -158,7 +158,7 @@ check-jar-mn:: $(MAKE) -C tests/src-simple check-jar $(MAKE) -C tests/src-simple check-flat $(MAKE) -C tests/src-simple check-flat USE_EXTENSION_MANIFEST=1 -ifneq (,$(filter-out WINNT OS2,$(OS_ARCH))) +ifneq (,$(filter-out WINNT,$(OS_ARCH))) $(MAKE) -C tests/src-simple check-symlink endif diff --git a/config/config.mk b/config/config.mk index 1b8fa0817..efd5dd615 100644 --- a/config/config.mk +++ b/config/config.mk @@ -361,11 +361,6 @@ endif TAR_CREATE_FLAGS = -cvhf TAR_CREATE_FLAGS_QUIET = -chf -ifeq ($(OS_ARCH),OS2) -TAR_CREATE_FLAGS = -cvf -TAR_CREATE_FLAGS_QUIET = -cf -endif - # # Personal makefile customizations go in these optional make include files. # @@ -547,11 +542,7 @@ DEPENDENCIES = .md MOZ_COMPONENT_LIBS=$(XPCOM_LIBS) $(MOZ_COMPONENT_NSPR_LIBS) -ifeq ($(OS_ARCH),OS2) -ELF_DYNSTR_GC = echo -else ELF_DYNSTR_GC = : -endif ifndef CROSS_COMPILE ifdef USE_ELF_DYNSTR_GC @@ -574,9 +565,6 @@ endif # Set link flags according to whether we want a console. ifdef MOZ_WINCONSOLE ifeq ($(MOZ_WINCONSOLE),1) -ifeq ($(OS_ARCH),OS2) -BIN_FLAGS += -Zlinker -PM:VIO -endif ifeq ($(OS_ARCH),WINNT) ifdef GNU_CC WIN32_EXE_LDFLAGS += -mconsole @@ -585,9 +573,6 @@ WIN32_EXE_LDFLAGS += -SUBSYSTEM:CONSOLE endif endif else # MOZ_WINCONSOLE -ifeq ($(OS_ARCH),OS2) -BIN_FLAGS += -Zlinker -PM:PM -endif ifeq ($(OS_ARCH),WINNT) ifdef GNU_CC WIN32_EXE_LDFLAGS += -mwindows @@ -642,19 +627,15 @@ NSINSTALL_NATIVECMD := %nsinstall nsinstall ifdef NSINSTALL_BIN NSINSTALL = $(NSINSTALL_BIN) else -ifeq (OS2,$(CROSS_COMPILE)$(OS_ARCH)) -NSINSTALL = $(MOZ_TOOLS_DIR)/nsinstall -else ifeq ($(HOST_OS_ARCH),WINNT) NSINSTALL = $(NSINSTALL_PY) else NSINSTALL = $(CONFIG_TOOLS)/nsinstall$(HOST_BIN_SUFFIX) endif # WINNT -endif # OS2 endif # NSINSTALL_BIN -ifeq (,$(CROSS_COMPILE)$(filter-out WINNT OS2, $(OS_ARCH))) +ifeq (,$(CROSS_COMPILE)$(filter-out WINNT, $(OS_ARCH))) INSTALL = $(NSINSTALL) -t ifdef .PYMAKE install_cmd = $(NSINSTALL_NATIVECMD) -t $(1) @@ -666,7 +647,7 @@ else # target-specific. INSTALL = $(if $(filter copy, $(NSDISTMODE)), $(NSINSTALL) -t, $(if $(filter absolute_symlink, $(NSDISTMODE)), $(NSINSTALL) -L $(PWD), $(NSINSTALL) -R)) -endif # WINNT/OS2 +endif # WINNT # The default for install_cmd is simply INSTALL install_cmd ?= $(INSTALL) $(1) @@ -723,13 +704,9 @@ MERGE_FILE = $(LOCALE_SRCDIR)/$(1) endif MERGE_FILES = $(foreach f,$(1),$(call MERGE_FILE,$(f))) -ifeq (OS2,$(OS_ARCH)) -RUN_TEST_PROGRAM = $(topsrcdir)/build/os2/test_os2.cmd "$(LIBXUL_DIST)" -else ifneq (WINNT,$(OS_ARCH)) RUN_TEST_PROGRAM = $(LIBXUL_DIST)/bin/run-mozilla.sh endif # ! WINNT -endif # ! OS2 # # Java macros diff --git a/config/makefiles/target_libs.mk b/config/makefiles/target_libs.mk index a295e74a7..2b5ceffc2 100644 --- a/config/makefiles/target_libs.mk +++ b/config/makefiles/target_libs.mk @@ -90,7 +90,7 @@ SHARED_LIBRARY_FILES = $(SHARED_LIBRARY) SHARED_LIBRARY_DEST ?= $(FINAL_TARGET) INSTALL_TARGETS += SHARED_LIBRARY -ifneq (,$(filter OS2 WINNT,$(OS_ARCH))) +ifneq (,$(filter WINNT,$(OS_ARCH))) ifndef NO_INSTALL_IMPORT_LIBRARY IMPORT_LIB_FILES = $(IMPORT_LIBRARY) endif # NO_INSTALL_IMPORT_LIBRARY diff --git a/config/nspr/Makefile.in b/config/nspr/Makefile.in index 1594d1fff..355f021b1 100644 --- a/config/nspr/Makefile.in +++ b/config/nspr/Makefile.in @@ -39,7 +39,7 @@ libs:: $(MAKE) -C $(DEPTH)/nsprpub install prefix=$(ABS_DIST)/sdk exec_prefix=$(ABS_DIST)/sdk bindir=$(ABS_DIST)/sdk/dummy includedir=$(ABS_DIST)/include/nspr libdir=$(ABS_DIST)/sdk/lib datadir=$(ABS_DIST)/sdk/dummy DESTDIR= $(EXTRA_MAKE_FLAGS) $(INSTALL) $(DEPTH)/nsprpub/config/nspr-config $(DIST)/sdk/bin $(RM) -rf $(DIST)/sdk/dummy -ifneq (,$(filter OS2 WINNT,$(OS_ARCH))) # { +ifneq (,$(filter WINNT,$(OS_ARCH))) # { $(RM) -f $(DIST)/sdk/lib/$(DLL_PREFIX)nspr4$(DLL_SUFFIX) $(DIST)/sdk/lib/$(DLL_PREFIX)plc4$(DLL_SUFFIX) $(DIST)/sdk/lib/$(DLL_PREFIX)plds4$(DLL_SUFFIX) $(RM) -f $(DIST)/sdk/lib/$(LIB_PREFIX)nspr4_s.$(LIB_SUFFIX) $(DIST)/sdk/lib/$(LIB_PREFIX)plc4_s.$(LIB_SUFFIX) $(DIST)/sdk/lib/$(LIB_PREFIX)plds4_s.$(LIB_SUFFIX) else # } { diff --git a/config/rules.mk b/config/rules.mk index f64edab10..59436c779 100644 --- a/config/rules.mk +++ b/config/rules.mk @@ -87,11 +87,7 @@ endif REPORT_BUILD = $(info $(notdir $<)) -ifeq ($(OS_ARCH),OS2) -EXEC = -else EXEC = exec -endif # Don't copy xulrunner files at install time, when using system xulrunner ifdef SYSTEM_LIBXUL @@ -235,26 +231,16 @@ ifdef LIB_IS_C_ONLY MKSHLIB = $(MKCSHLIB) endif -ifneq (,$(filter OS2 WINNT,$(OS_ARCH))) +ifneq (,$(filter WINNT,$(OS_ARCH))) IMPORT_LIBRARY := $(LIB_PREFIX)$(SHARED_LIBRARY_NAME).$(IMPORT_LIB_SUFFIX) endif -ifeq (OS2,$(OS_ARCH)) -ifdef SHORT_LIBNAME -SHARED_LIBRARY_NAME := $(SHORT_LIBNAME) -endif -endif - ifdef MAKE_FRAMEWORK SHARED_LIBRARY := $(SHARED_LIBRARY_NAME) else SHARED_LIBRARY := $(DLL_PREFIX)$(SHARED_LIBRARY_NAME)$(DLL_SUFFIX) endif -ifeq ($(OS_ARCH),OS2) -DEF_FILE := $(SHARED_LIBRARY:.dll=.def) -endif - EMBED_MANIFEST_AT=2 endif # MKSHLIB @@ -842,9 +828,6 @@ distclean:: $(SUBMAKEFILES) $(wildcard *.$(OBJ_SUFFIX)) $(wildcard *.ho) $(wildcard host_*.o*) \ $(wildcard *.$(LIB_SUFFIX)) $(wildcard *$(DLL_SUFFIX)) \ $(wildcard *.$(IMPORT_LIB_SUFFIX)) -ifeq ($(OS_ARCH),OS2) - -$(RM) $(PROGRAM:.exe=.map) -endif alltags: $(RM) TAGS @@ -980,23 +963,6 @@ ifeq ($(OS_ARCH),WINNT) $(IMPORT_LIBRARY): $(SHARED_LIBRARY) ; endif -ifeq ($(OS_ARCH),OS2) -$(DEF_FILE): $(OBJS) $(SHARED_LIBRARY_LIBS) - $(RM) $@ - echo LIBRARY $(SHARED_LIBRARY_NAME) INITINSTANCE TERMINSTANCE > $@ - echo PROTMODE >> $@ - echo CODE LOADONCALL MOVEABLE DISCARDABLE >> $@ - echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $@ - echo EXPORTS >> $@ - - $(ADD_TO_DEF_FILE) - -$(IMPORT_LIBRARY): $(SHARED_LIBRARY) - $(RM) $@ - $(IMPLIB) $@ $^ - $(RANLIB) $@ -endif # OS/2 - $(HOST_LIBRARY): $(HOST_OBJS) Makefile $(RM) $@ $(HOST_AR) $(HOST_AR_FLAGS) $(HOST_OBJS) @@ -1172,15 +1138,11 @@ $(CMOBJS): $(OBJ_PREFIX)%.$(OBJ_SUFFIX): %.m $(call mkdir_deps,$(MDDEPDIR)) %.res: %.rc @echo Creating Resource file: $@ -ifeq ($(OS_ARCH),OS2) - $(RC) $(RCFLAGS:-D%=-d %) -i $(subst /,\,$(srcdir)) -r $< $@ -else ifdef GNU_CC $(RC) $(RCFLAGS) $(filter-out -U%,$(DEFINES)) $(INCLUDES:-I%=--include-dir %) $(OUTOPTION)$@ $(_VPATH_SRCS) else $(RC) $(RCFLAGS) -r $(DEFINES) $(INCLUDES) $(OUTOPTION)$@ $(_VPATH_SRCS) endif -endif # need 3 separate lines for OS/2 %:: %.pl @@ -1206,7 +1168,7 @@ endif ############################################################################### # Java rules ############################################################################### -ifneq (,$(filter OS2 WINNT,$(OS_ARCH))) +ifneq (,$(filter WINNT,$(OS_ARCH))) SEP := ; else SEP := : diff --git a/config/system-headers b/config/system-headers index 17f338ce0..ba2472888 100644 --- a/config/system-headers +++ b/config/system-headers @@ -221,7 +221,6 @@ cairo-atsui.h cairo-beos.h cairo-ft.h cairo-glitz.h -cairo-os2.h cairo-pdf.h cairo-ps.h cairo-tee.h @@ -689,7 +688,6 @@ oleidl.h OpenGL/OpenGL.h OpenTptInternet.h OpenTransport.h -os2.h OS.h osreldate.h ostream diff --git a/configure.in b/configure.in index a21da20e2..759655f9c 100644 --- a/configure.in +++ b/configure.in @@ -1078,9 +1078,6 @@ solaris*) AC_SUBST(SOLARIS_SUNPRO_CC) AC_SUBST(SOLARIS_SUNPRO_CXX) ;; -OS_2) - HOST_OS_ARCH=OS2 - ;; esac case "$OS_ARCH" in @@ -1119,11 +1116,6 @@ AIX) OS_RELEASE=`uname -v`.`uname -r` OS_TEST=${target_cpu} ;; -OS_2) - OS_ARCH=OS2 - OS_TARGET=OS2 - OS_RELEASE=`uname -v` - ;; Darwin) case "${target_cpu}" in powerpc*) @@ -1549,16 +1541,6 @@ AC_LANG_RESTORE fi # COMPILE_ENVIRONMENT dnl ======================================================== -dnl Enable high-memory support on OS/2 by default. -dnl ======================================================== -MOZ_OS2_HIGH_MEMORY=1 -MOZ_ARG_DISABLE_BOOL(os2-high-mem, -[ --disable-os2-high-mem Disable high-memory support on OS/2], - MOZ_OS2_HIGH_MEMORY=, - MOZ_OS2_HIGH_MEMORY=1 ) -AC_SUBST(MOZ_OS2_HIGH_MEMORY) - -dnl ======================================================== dnl = Use profiling compile flags dnl ======================================================== MOZ_ARG_ENABLE_BOOL(profiling, @@ -1781,14 +1763,6 @@ case "$host" in HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}" ;; -*os2*) - HOST_CFLAGS="$HOST_CFLAGS -DXP_OS2 -DNO_X11 -Zomf" - HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"' - HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}" - HOST_BIN_SUFFIX=.exe - MOZ_FIX_LINK_PATHS= - ;; - *) HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX" HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}" @@ -2298,72 +2272,6 @@ ia64*-hpux*) fi ;; -*-os2*) - MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@' - MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@' - AC_DEFINE(OS2) - AC_DEFINE(XP_OS2) - AC_DEFINE(OS2EMX_PLAIN_CHAR) - AC_DEFINE(TCPV40HDRS) - DLL_PREFIX= - LIB_PREFIX= - LIB_SUFFIX=lib - BIN_SUFFIX=".exe" - DLL_SUFFIX=".dll" - IMPORT_LIB_SUFFIX=lib - DSO_PIC_CFLAGS= - AR=emxomfar - AR_FLAGS='r $@' - CFLAGS="$CFLAGS -Zomf" - CXXFLAGS="$CXXFLAGS -Zomf" - DSO_LDOPTS='-Zdll' - BIN_FLAGS='-Zlinker /ST:0x100000' - IMPLIB='emximp -o' - FILTER='true' - LDFLAGS='-Zmap' - WARNINGS_AS_ERRORS='-Werror' - MOZ_DEBUG_FLAGS="-g -fno-inline" - MOZ_OPTIMIZE_FLAGS="-O2" - MOZ_OPTIMIZE_LDFLAGS="-s -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA" - DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib' - LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib' - TARGET_MD_ARCH=os2 - _PLATFORM_DEFAULT_TOOLKIT="cairo-os2" - RC=rc.exe - MC=mc.exe - RCFLAGS='-n' - MOZ_USER_DIR="Mozilla" - ZIP="$ZIP -X" - STRIP=lxlite - STRIP_FLAGS="/yua /ydd /yxd /ynl /anp /b- /cs+ /d /i- /ml1 /mr2 /mf2 /r+ /u+ /x- /zs:0 /zx /zd" - - if test "$MOZTOOLS"; then - MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'` - else - AC_MSG_ERROR([MOZTOOLS is not set]) - fi - if test -n "$MOZ_OS2_HIGH_MEMORY"; then - DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem" - LDFLAGS="$LDFLAGS -Zhigh-mem" - MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -Zhigh-mem" - AC_DEFINE(MOZ_OS2_HIGH_MEMORY) - fi - - # GCC for OS/2 currently predefines these, but we don't want them - _DEFINES_CFLAGS="$_DEFINES_CFLAGS -Uunix -U__unix -U__unix__" - _DEFINES_CXXFLAGS="$_DEFINES_CXXFLAGS -Uunix -U__unix -U__unix__" - - AC_CACHE_CHECK(for __declspec(dllexport), - ac_os2_declspec, - [AC_TRY_COMPILE([__declspec(dllexport) void ac_os2_declspec(void) {}], - [return 0;], - ac_os2_declspec="yes", - ac_os2_declspec="no")]) - if test "$ac_os2_declspec" != "yes"; then - AC_MSG_ERROR([Compiler does not support __declspec(dllexport), install GCC-4.3.2 or newer]) - fi - ;; - *-solaris*) AC_DEFINE(SOLARIS) TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"' @@ -2459,10 +2367,6 @@ ia64*-hpux*) esac ;; -*-os2*) - HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"' - ;; - esac AC_SUBST(MOZ_LINKER) @@ -2488,9 +2392,6 @@ if test -z "$MKSHLIB_FORCE_ALL" -o -z "$MKSHLIB_UNFORCE_ALL"; then NO_LD_ARCHIVE_FLAGS=1 fi case "$target" in -*-os2*) - NO_LD_ARCHIVE_FLAGS= - ;; *-aix4.3*|*-aix5*) NO_LD_ARCHIVE_FLAGS= ;; @@ -3038,8 +2939,6 @@ dnl against libSystem causes issues when debugging (see bug 299601). case $target in *-darwin*) ;; -*-os2*) - ;; *) AC_SEARCH_LIBS(dlopen, dl, MOZ_CHECK_HEADER(dlfcn.h, @@ -3064,13 +2963,7 @@ if test ! "$GNU_CXX"; then esac fi -dnl OS/2 has socket in libc. -case $target in -*-os2*) - ;; -*) - AC_CHECK_LIB(socket, socket) -esac +AC_CHECK_LIB(socket, socket) XLDFLAGS="$X_LIBS" XLIBS="$X_EXTRA_LIBS" @@ -3361,7 +3254,7 @@ if test "$ac_cv_func_gnu_get_libc_version" = "yes"; then fi case $target_os in - darwin*|mingw*|os2*) + darwin*|mingw*) ;; *) @@ -3952,7 +3845,7 @@ if test -n "$MOZ_NATIVE_NSS"; then else NSS_CFLAGS='-I$(LIBXUL_DIST)/include/nss' - if test -z "$GNU_CC" -a "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "OS2"; then + if test -z "$GNU_CC" -a "$OS_ARCH" = "WINNT"; then NSS_LIBS="\ \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \ \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)smime$NSS_VERSION.\$(LIB_SUFFIX) \ @@ -4470,7 +4363,6 @@ MOZ_ARG_HEADER(Toolkit Options) Select default toolkit Platform specific defaults: Mac OS X - cairo-cocoa - OS/2 - cairo-os2 Win32 - cairo-windows * - cairo-gtk2 * - cairo-gtk3 @@ -4483,7 +4375,6 @@ MOZ_ARG_HEADER(Toolkit Options) -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \ -o "$_DEFAULT_TOOLKIT" = "cairo-gtk3" \ -o "$_DEFAULT_TOOLKIT" = "cairo-qt" \ - -o "$_DEFAULT_TOOLKIT" = "cairo-os2" \ -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa" \ -o "$_DEFAULT_TOOLKIT" = "cairo-uikit" \ -o "$_DEFAULT_TOOLKIT" = "cairo-android" \ @@ -4580,14 +4471,6 @@ cairo-qt) AC_DEFINE(QT_NO_KEYWORDS) ;; -cairo-os2) - MOZ_WIDGET_TOOLKIT=os2 - USE_FC_FREETYPE=1 - TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)' - TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)' - MOZ_PDF_PRINTING=1 - ;; - cairo-cocoa) MOZ_WIDGET_TOOLKIT=cocoa AC_DEFINE(MOZ_WIDGET_COCOA) @@ -7167,8 +7050,8 @@ fi if test "${OS_TARGET}" = "Android"; then dnl On Android, we use WRAP_LDFLAGS to link everything to mozglue : -elif test "${OS_TARGET}" = "WINNT" -o "${OS_TARGET}" = "Darwin" -o "${OS_TARGET}" = "OS2"; then - dnl On Windows, OSX and OS2, we want to link all our binaries against mozglue +elif test "${OS_TARGET}" = "WINNT" -o "${OS_TARGET}" = "Darwin"; then + dnl On Windows and OSX, we want to link all our binaries against mozglue if test -z "$GNU_CC"; then MOZ_GLUE_LDFLAGS='$(call EXPAND_LIBNAME_PATH,mozglue,$(LIBXUL_DIST)/lib)' else @@ -7841,7 +7724,7 @@ if test "$MOZ_CHROME_FILE_FORMAT" = "omni"; then AC_DEFINE(MOZ_OMNIJAR) fi MOZ_PACKAGER_FORMAT="$MOZ_CHROME_FILE_FORMAT" -if test "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "OS2" -o "$MOZ_WIDGET_TOOLKIT" = "android"; then +if test "$OS_ARCH" = "WINNT" -o "$MOZ_WIDGET_TOOLKIT" = "android"; then MOZ_CHROME_FILE_FORMAT=flat else MOZ_CHROME_FILE_FORMAT=symlink @@ -8284,14 +8167,6 @@ if test "$MOZ_TREE_CAIRO"; then MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1) fi ;; - os2) - OS2_SURFACE_FEATURE="#define CAIRO_HAS_OS2_SURFACE 1" - FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1" - MOZ_ENABLE_CAIRO_FT=1 - CAIRO_FT_CFLAGS="-I${MZFTCFGFT2}/include" - CAIRO_FT_OSLIBS="-L${MZFTCFGFT2}/lib -lmozft -lmzfntcfg" - CAIRO_FT_LIBS="" - ;; esac if test "$USE_FC_FREETYPE"; then FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1" @@ -8311,7 +8186,6 @@ if test "$MOZ_TREE_CAIRO"; then AC_SUBST(QUARTZ_SURFACE_FEATURE) AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE) AC_SUBST(WIN32_SURFACE_FEATURE) - AC_SUBST(OS2_SURFACE_FEATURE) AC_SUBST(DIRECTFB_SURFACE_FEATURE) AC_SUBST(FT_FONT_FEATURE) AC_SUBST(FC_FONT_FEATURE) @@ -8470,10 +8344,6 @@ MOZ_ARG_DISABLE_BOOL(necko-wifi, NECKO_WIFI=, NECKO_WIFI=1) -if test "$OS_ARCH" = "OS2"; then - dnl OS/2 implementation of Necko-WiFi support will be added in bug 506566 - NECKO_WIFI= -fi if test "$NECKO_WIFI" -a \ "$OS_ARCH" != "Linux" -a \ "$OS_ARCH" != "Darwin" -a \ @@ -8696,7 +8566,6 @@ AC_SUBST(XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS) AC_SUBST(USE_DEPENDENT_LIBS) AC_SUBST(MOZ_BUILD_ROOT) -AC_SUBST(MOZ_OS2_TOOLS) AC_SUBST(MOZ_POST_DSO_LIB_COMMAND) AC_SUBST(MOZ_POST_PROGRAM_COMMAND) @@ -9067,7 +8936,7 @@ dnl ======================================================== if test "$OS_ARCH" = "Darwin"; then AC_DEFINE(XP_UNIX) -elif test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2"; then +elif test "$OS_ARCH" != "WINNT"; then AC_DEFINE(XP_UNIX) fi diff --git a/content/base/public/nsContentUtils.h b/content/base/public/nsContentUtils.h index 1f7c2ee28..dfcd3f5fb 100644 --- a/content/base/public/nsContentUtils.h +++ b/content/base/public/nsContentUtils.h @@ -10,7 +10,7 @@ #define nsContentUtils_h___ #include <math.h> -#if defined(XP_WIN) || defined(XP_OS2) +#if defined(XP_WIN) #include <float.h> #endif diff --git a/content/xul/content/src/nsXULPopupListener.cpp b/content/xul/content/src/nsXULPopupListener.cpp index 5368d5ed7..76e385978 100644 --- a/content/xul/content/src/nsXULPopupListener.cpp +++ b/content/xul/content/src/nsXULPopupListener.cpp @@ -50,7 +50,7 @@ using namespace mozilla::dom; // on win32 and os/2, context menus come up on mouse up. On other platforms, // they appear on mouse down. Certain bits of code care about this difference. -#if defined(XP_WIN) || defined(XP_OS2) +#if defined(XP_WIN) #define NS_CONTEXT_MENU_IS_MOUSEUP 1 #endif diff --git a/db/sqlite3/src/Makefile.in b/db/sqlite3/src/Makefile.in index 92766806b..f6563bd76 100644 --- a/db/sqlite3/src/Makefile.in +++ b/db/sqlite3/src/Makefile.in @@ -104,12 +104,6 @@ ifdef SOLARIS_SUNPRO_CC NO_PROFILE_GUIDED_OPTIMIZE = 1 endif -ifeq ($(OS_ARCH),OS2) -ifdef MOZ_OS2_HIGH_MEMORY -DEFINES += -DOS2_HIGH_MEMORY -endif -endif - ifeq ($(OS_TARGET),Android) # default to user readable only to fit Android security model DEFINES += -DSQLITE_DEFAULT_FILE_PERMISSIONS=0600 @@ -130,9 +124,3 @@ include $(topsrcdir)/config/rules.mk # next line allows use of MOZ_OBJDIR in .mozconfig with older gcc on BeOS, maybe others LOCAL_INCLUDES += -I$(srcdir) - -ifeq ($(OS_ARCH),OS2) -ADD_TO_DEF_FILE = $(PYTHON) $(topsrcdir)/config/Preprocessor.py $(DEFINES) \ - $(srcdir)/sqlite.def | sed -e '1,/^EXPORTS$$/ d' -e 's,sqlite3,_\0,' \ - -e 's,\ DATA.*$$,,' >> $(DEF_FILE) -endif diff --git a/docshell/base/nsDefaultURIFixup.cpp b/docshell/base/nsDefaultURIFixup.cpp index e0be3504b..6d51e930f 100644 --- a/docshell/base/nsDefaultURIFixup.cpp +++ b/docshell/base/nsDefaultURIFixup.cpp @@ -161,7 +161,7 @@ nsDefaultURIFixup::CreateFixupURI(const nsACString& aStringURI, uint32_t aFixupF if(*aURI) return NS_OK; -#if defined(XP_WIN) || defined(XP_OS2) +#if defined(XP_WIN) // Not a file URL, so translate '\' to '/' for convenience in the common protocols // e.g. catch // @@ -550,7 +550,7 @@ nsresult nsDefaultURIFixup::ConvertFileToStringURI(const nsACString& aIn, { bool attemptFixup = false; -#if defined(XP_WIN) || defined(XP_OS2) +#if defined(XP_WIN) // Check for \ in the url-string or just a drive (PC) if(kNotFound != aIn.FindChar('\\') || (aIn.Length() == 2 && (aIn.Last() == ':' || aIn.Last() == '|'))) diff --git a/dom/base/Navigator.cpp b/dom/base/Navigator.cpp index 93eba9422..398d69dc5 100644 --- a/dom/base/Navigator.cpp +++ b/dom/base/Navigator.cpp @@ -1698,8 +1698,6 @@ NS_GetNavigatorPlatform(nsAString& aPlatform) aPlatform.AssignLiteral("MacIntel"); #elif defined(XP_MACOSX) && defined(__x86_64__) aPlatform.AssignLiteral("MacIntel"); -#elif defined(XP_OS2) - aPlatform.AssignLiteral("OS/2"); #else // XXX Communicator uses compiled-in build-time string defines // to indicate the platform it was compiled *for*, not what it is diff --git a/dom/base/nsFocusManager.cpp b/dom/base/nsFocusManager.cpp index ea176945c..74cded176 100644 --- a/dom/base/nsFocusManager.cpp +++ b/dom/base/nsFocusManager.cpp @@ -1956,7 +1956,7 @@ nsFocusManager::RaiseWindow(nsPIDOMWindow* aWindow) return; } -#if defined(XP_WIN) || defined(XP_OS2) +#if defined(XP_WIN) // Windows would rather we focus the child widget, otherwise, the toplevel // widget will always end up being focused. Fortunately, focusing the child // widget will also have the effect of raising the window this widget is in. diff --git a/dom/moz.build b/dom/moz.build index 0f5199a21..b868b0cb3 100644 --- a/dom/moz.build +++ b/dom/moz.build @@ -104,7 +104,7 @@ TEST_DIRS += [ 'bindings/test', ] -if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk2', 'cocoa', 'windows', 'android', 'qt', 'os2'): +if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk2', 'cocoa', 'windows', 'android', 'qt'): TEST_DIRS += ['plugins/test'] MODULE = 'dom' diff --git a/dom/plugins/base/PluginPRLibrary.cpp b/dom/plugins/base/PluginPRLibrary.cpp index 964082fe6..7bba81abb 100644 --- a/dom/plugins/base/PluginPRLibrary.cpp +++ b/dom/plugins/base/PluginPRLibrary.cpp @@ -165,7 +165,7 @@ PluginPRLibrary::NP_GetValue(void *future, NPPVariable aVariable, #endif } -#if defined(XP_WIN) || defined(XP_MACOSX) || defined(XP_OS2) +#if defined(XP_WIN) || defined(XP_MACOSX) nsresult PluginPRLibrary::NP_GetEntryPoints(NPPluginFuncs* pFuncs, NPError* error) { diff --git a/dom/plugins/base/PluginPRLibrary.h b/dom/plugins/base/PluginPRLibrary.h index bb8ee0384..b2f6e9313 100644 --- a/dom/plugins/base/PluginPRLibrary.h +++ b/dom/plugins/base/PluginPRLibrary.h @@ -27,7 +27,7 @@ public: #if defined(XP_UNIX) && !defined(XP_MACOSX) mNP_GetValue(nullptr), #endif -#if defined(XP_WIN) || defined(XP_MACOSX) || defined(XP_OS2) +#if defined(XP_WIN) || defined(XP_MACOSX) mNP_GetEntryPoints(nullptr), #endif mNPP_New(nullptr), @@ -72,7 +72,7 @@ public: return false; #endif -#if defined(XP_WIN) || defined(XP_MACOSX) || defined(XP_OS2) +#if defined(XP_WIN) || defined(XP_MACOSX) mNP_GetEntryPoints = (NP_GetEntryPointsFunc) PR_FindFunctionSymbol(mLibrary, "NP_GetEntryPoints"); if (!mNP_GetEntryPoints) @@ -95,7 +95,7 @@ public: virtual nsresult NP_GetValue(void *future, NPPVariable aVariable, void *aValue, NPError* error); -#if defined(XP_WIN) || defined(XP_MACOSX) || defined(XP_OS2) +#if defined(XP_WIN) || defined(XP_MACOSX) virtual nsresult NP_GetEntryPoints(NPPluginFuncs* pFuncs, NPError* error); #endif @@ -135,7 +135,7 @@ private: #if defined(XP_UNIX) && !defined(XP_MACOSX) NP_GetValueFunc mNP_GetValue; #endif -#if defined(XP_WIN) || defined(XP_MACOSX) || defined(XP_OS2) +#if defined(XP_WIN) || defined(XP_MACOSX) NP_GetEntryPointsFunc mNP_GetEntryPoints; #endif NPP_NewProcPtr mNPP_New; diff --git a/dom/plugins/base/moz.build b/dom/plugins/base/moz.build index 7b11cde4a..74decdaaf 100644 --- a/dom/plugins/base/moz.build +++ b/dom/plugins/base/moz.build @@ -62,11 +62,6 @@ if CONFIG['OS_ARCH'] == 'WINNT': 'nsPluginNativeWindowWin.cpp', 'nsPluginDirServiceProvider.cpp', ] -elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'os2': - CPP_SOURCES += [ - 'nsPluginsDirOS2.cpp', - 'nsPluginNativeWindowOS2.cpp', - ] elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa': CPP_SOURCES += [ 'nsPluginsDirDarwin.cpp', diff --git a/dom/plugins/base/npapi.h b/dom/plugins/base/npapi.h index 3d08b2cae..3872efe59 100644 --- a/dom/plugins/base/npapi.h +++ b/dom/plugins/base/npapi.h @@ -6,18 +6,8 @@ #ifndef npapi_h_ #define npapi_h_ -#if defined(__OS2__) -#pragma pack(1) -#endif - #include "nptypes.h" -#if defined(__OS2__) || defined(OS2) -#ifndef XP_OS2 -#define XP_OS2 1 -#endif -#endif - #if defined(_WIN32) && !defined(__SYMBIAN32__) #include <windef.h> #ifndef XP_WIN @@ -543,13 +533,6 @@ typedef struct _NPEvent uintptr_t wParam; uintptr_t lParam; } NPEvent; -#elif defined(XP_OS2) -typedef struct _NPEvent -{ - uint32_t event; - uint32_t wParam; - uint32_t lParam; -} NPEvent; #elif defined(XP_UNIX) && defined(MOZ_X11) typedef XEvent NPEvent; #else @@ -791,12 +774,6 @@ enum NPEventType { /* Function Prototypes */ /*----------------------------------------------------------------------*/ -#if defined(__OS2__) -#define NP_LOADDS _System -#else -#define NP_LOADDS -#endif - #ifdef __cplusplus extern "C" { #endif @@ -807,81 +784,81 @@ extern "C" { const char* NPP_GetMIMEDescription(void); #endif -NPError NP_LOADDS NPP_New(NPMIMEType pluginType, NPP instance, +NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData* saved); -NPError NP_LOADDS NPP_Destroy(NPP instance, NPSavedData** save); -NPError NP_LOADDS NPP_SetWindow(NPP instance, NPWindow* window); -NPError NP_LOADDS NPP_NewStream(NPP instance, NPMIMEType type, +NPError NPP_Destroy(NPP instance, NPSavedData** save); +NPError NPP_SetWindow(NPP instance, NPWindow* window); +NPError NPP_NewStream(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16_t* stype); -NPError NP_LOADDS NPP_DestroyStream(NPP instance, NPStream* stream, +NPError NPP_DestroyStream(NPP instance, NPStream* stream, NPReason reason); -int32_t NP_LOADDS NPP_WriteReady(NPP instance, NPStream* stream); -int32_t NP_LOADDS NPP_Write(NPP instance, NPStream* stream, int32_t offset, +int32_t NPP_WriteReady(NPP instance, NPStream* stream); +int32_t NPP_Write(NPP instance, NPStream* stream, int32_t offset, int32_t len, void* buffer); -void NP_LOADDS NPP_StreamAsFile(NPP instance, NPStream* stream, +void NPP_StreamAsFile(NPP instance, NPStream* stream, const char* fname); -void NP_LOADDS NPP_Print(NPP instance, NPPrint* platformPrint); -int16_t NP_LOADDS NPP_HandleEvent(NPP instance, void* event); -void NP_LOADDS NPP_URLNotify(NPP instance, const char* url, +void NPP_Print(NPP instance, NPPrint* platformPrint); +int16_t NPP_HandleEvent(NPP instance, void* event); +void NPP_URLNotify(NPP instance, const char* url, NPReason reason, void* notifyData); -NPError NP_LOADDS NPP_GetValue(NPP instance, NPPVariable variable, void *value); -NPError NP_LOADDS NPP_SetValue(NPP instance, NPNVariable variable, void *value); -NPBool NP_LOADDS NPP_GotFocus(NPP instance, NPFocusDirection direction); -void NP_LOADDS NPP_LostFocus(NPP instance); -void NP_LOADDS NPP_URLRedirectNotify(NPP instance, const char* url, int32_t status, void* notifyData); -NPError NP_LOADDS NPP_ClearSiteData(const char* site, uint64_t flags, uint64_t maxAge); -char** NP_LOADDS NPP_GetSitesWithData(void); -void NP_LOADDS NPP_DidComposite(NPP instance); +NPError NPP_GetValue(NPP instance, NPPVariable variable, void *value); +NPError NPP_SetValue(NPP instance, NPNVariable variable, void *value); +NPBool NPP_GotFocus(NPP instance, NPFocusDirection direction); +void NPP_LostFocus(NPP instance); +void NPP_URLRedirectNotify(NPP instance, const char* url, int32_t status, void* notifyData); +NPError NPP_ClearSiteData(const char* site, uint64_t flags, uint64_t maxAge); +char** NPP_GetSitesWithData(void); +void NPP_DidComposite(NPP instance); /* NPN_* functions are provided by the navigator and called by the plugin. */ -void NP_LOADDS NPN_Version(int* plugin_major, int* plugin_minor, +void NPN_Version(int* plugin_major, int* plugin_minor, int* netscape_major, int* netscape_minor); -NPError NP_LOADDS NPN_GetURLNotify(NPP instance, const char* url, +NPError NPN_GetURLNotify(NPP instance, const char* url, const char* target, void* notifyData); -NPError NP_LOADDS NPN_GetURL(NPP instance, const char* url, +NPError NPN_GetURL(NPP instance, const char* url, const char* target); -NPError NP_LOADDS NPN_PostURLNotify(NPP instance, const char* url, +NPError NPN_PostURLNotify(NPP instance, const char* url, const char* target, uint32_t len, const char* buf, NPBool file, void* notifyData); -NPError NP_LOADDS NPN_PostURL(NPP instance, const char* url, +NPError NPN_PostURL(NPP instance, const char* url, const char* target, uint32_t len, const char* buf, NPBool file); -NPError NP_LOADDS NPN_RequestRead(NPStream* stream, NPByteRange* rangeList); -NPError NP_LOADDS NPN_NewStream(NPP instance, NPMIMEType type, +NPError NPN_RequestRead(NPStream* stream, NPByteRange* rangeList); +NPError NPN_NewStream(NPP instance, NPMIMEType type, const char* target, NPStream** stream); -int32_t NP_LOADDS NPN_Write(NPP instance, NPStream* stream, int32_t len, +int32_t NPN_Write(NPP instance, NPStream* stream, int32_t len, void* buffer); -NPError NP_LOADDS NPN_DestroyStream(NPP instance, NPStream* stream, +NPError NPN_DestroyStream(NPP instance, NPStream* stream, NPReason reason); -void NP_LOADDS NPN_Status(NPP instance, const char* message); -const char* NP_LOADDS NPN_UserAgent(NPP instance); -void* NP_LOADDS NPN_MemAlloc(uint32_t size); -void NP_LOADDS NPN_MemFree(void* ptr); -uint32_t NP_LOADDS NPN_MemFlush(uint32_t size); -void NP_LOADDS NPN_ReloadPlugins(NPBool reloadPages); -NPError NP_LOADDS NPN_GetValue(NPP instance, NPNVariable variable, +void NPN_Status(NPP instance, const char* message); +const char* NPN_UserAgent(NPP instance); +void* NPN_MemAlloc(uint32_t size); +void NPN_MemFree(void* ptr); +uint32_t NPN_MemFlush(uint32_t size); +void NPN_ReloadPlugins(NPBool reloadPages); +NPError NPN_GetValue(NPP instance, NPNVariable variable, void *value); -NPError NP_LOADDS NPN_SetValue(NPP instance, NPPVariable variable, +NPError NPN_SetValue(NPP instance, NPPVariable variable, void *value); -void NP_LOADDS NPN_InvalidateRect(NPP instance, NPRect *invalidRect); -void NP_LOADDS NPN_InvalidateRegion(NPP instance, +void NPN_InvalidateRect(NPP instance, NPRect *invalidRect); +void NPN_InvalidateRegion(NPP instance, NPRegion invalidRegion); -void NP_LOADDS NPN_ForceRedraw(NPP instance); -void NP_LOADDS NPN_PushPopupsEnabledState(NPP instance, NPBool enabled); -void NP_LOADDS NPN_PopPopupsEnabledState(NPP instance); -void NP_LOADDS NPN_PluginThreadAsyncCall(NPP instance, +void NPN_ForceRedraw(NPP instance); +void NPN_PushPopupsEnabledState(NPP instance, NPBool enabled); +void NPN_PopPopupsEnabledState(NPP instance); +void NPN_PluginThreadAsyncCall(NPP instance, void (*func) (void *), void *userData); -NPError NP_LOADDS NPN_GetValueForURL(NPP instance, NPNURLVariable variable, +NPError NPN_GetValueForURL(NPP instance, NPNURLVariable variable, const char *url, char **value, uint32_t *len); -NPError NP_LOADDS NPN_SetValueForURL(NPP instance, NPNURLVariable variable, +NPError NPN_SetValueForURL(NPP instance, NPNURLVariable variable, const char *url, const char *value, uint32_t len); -NPError NP_LOADDS NPN_GetAuthenticationInfo(NPP instance, +NPError NPN_GetAuthenticationInfo(NPP instance, const char *protocol, const char *host, int32_t port, const char *scheme, @@ -889,26 +866,23 @@ NPError NP_LOADDS NPN_GetAuthenticationInfo(NPP instance, char **username, uint32_t *ulen, char **password, uint32_t *plen); -uint32_t NP_LOADDS NPN_ScheduleTimer(NPP instance, uint32_t interval, NPBool repeat, void (*timerFunc)(NPP npp, uint32_t timerID)); -void NP_LOADDS NPN_UnscheduleTimer(NPP instance, uint32_t timerID); -NPError NP_LOADDS NPN_PopUpContextMenu(NPP instance, NPMenu* menu); -NPBool NP_LOADDS NPN_ConvertPoint(NPP instance, double sourceX, double sourceY, NPCoordinateSpace sourceSpace, double *destX, double *destY, NPCoordinateSpace destSpace); -NPBool NP_LOADDS NPN_HandleEvent(NPP instance, void *event, NPBool handled); -NPBool NP_LOADDS NPN_UnfocusInstance(NPP instance, NPFocusDirection direction); -void NP_LOADDS NPN_URLRedirectResponse(NPP instance, void* notifyData, NPBool allow); -NPError NP_LOADDS NPN_InitAsyncSurface(NPP instance, NPSize *size, +uint32_t NPN_ScheduleTimer(NPP instance, uint32_t interval, NPBool repeat, void (*timerFunc)(NPP npp, uint32_t timerID)); +void NPN_UnscheduleTimer(NPP instance, uint32_t timerID); +NPError NPN_PopUpContextMenu(NPP instance, NPMenu* menu); +NPBool NPN_ConvertPoint(NPP instance, double sourceX, double sourceY, NPCoordinateSpace sourceSpace, double *destX, double *destY, NPCoordinateSpace destSpace); +NPBool NPN_HandleEvent(NPP instance, void *event, NPBool handled); +NPBool NPN_UnfocusInstance(NPP instance, NPFocusDirection direction); +void NPN_URLRedirectResponse(NPP instance, void* notifyData, NPBool allow); +NPError NPN_InitAsyncSurface(NPP instance, NPSize *size, NPImageFormat format, void *initData, NPAsyncSurface *surface); -NPError NP_LOADDS NPN_FinalizeAsyncSurface(NPP instance, NPAsyncSurface *surface); -void NP_LOADDS NPN_SetCurrentAsyncSurface(NPP instance, NPAsyncSurface *surface, NPRect *changed); +NPError NPN_FinalizeAsyncSurface(NPP instance, NPAsyncSurface *surface); +void NPN_SetCurrentAsyncSurface(NPP instance, NPAsyncSurface *surface, NPRect *changed); #ifdef __cplusplus } /* end extern "C" */ #endif #endif /* RC_INVOKED */ -#if defined(__OS2__) -#pragma pack() -#endif #endif /* npapi_h_ */ diff --git a/dom/plugins/base/npfunctions.h b/dom/plugins/base/npfunctions.h index 5207d3e40..2eaa94021 100644 --- a/dom/plugins/base/npfunctions.h +++ b/dom/plugins/base/npfunctions.h @@ -6,13 +6,6 @@ #ifndef npfunctions_h_ #define npfunctions_h_ -#ifdef __OS2__ -#pragma pack(1) -#define NP_LOADDS _System -#else -#define NP_LOADDS -#endif - #include "npapi.h" #include "npruntime.h" @@ -20,27 +13,27 @@ #include <jni.h> #endif -typedef NPError (* NP_LOADDS NPP_NewProcPtr)(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData* saved); -typedef NPError (* NP_LOADDS NPP_DestroyProcPtr)(NPP instance, NPSavedData** save); -typedef NPError (* NP_LOADDS NPP_SetWindowProcPtr)(NPP instance, NPWindow* window); -typedef NPError (* NP_LOADDS NPP_NewStreamProcPtr)(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16_t* stype); -typedef NPError (* NP_LOADDS NPP_DestroyStreamProcPtr)(NPP instance, NPStream* stream, NPReason reason); -typedef int32_t (* NP_LOADDS NPP_WriteReadyProcPtr)(NPP instance, NPStream* stream); -typedef int32_t (* NP_LOADDS NPP_WriteProcPtr)(NPP instance, NPStream* stream, int32_t offset, int32_t len, void* buffer); -typedef void (* NP_LOADDS NPP_StreamAsFileProcPtr)(NPP instance, NPStream* stream, const char* fname); -typedef void (* NP_LOADDS NPP_PrintProcPtr)(NPP instance, NPPrint* platformPrint); -typedef int16_t (* NP_LOADDS NPP_HandleEventProcPtr)(NPP instance, void* event); -typedef void (* NP_LOADDS NPP_URLNotifyProcPtr)(NPP instance, const char* url, NPReason reason, void* notifyData); +typedef NPError (* NPP_NewProcPtr)(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData* saved); +typedef NPError (* NPP_DestroyProcPtr)(NPP instance, NPSavedData** save); +typedef NPError (* NPP_SetWindowProcPtr)(NPP instance, NPWindow* window); +typedef NPError (* NPP_NewStreamProcPtr)(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16_t* stype); +typedef NPError (* NPP_DestroyStreamProcPtr)(NPP instance, NPStream* stream, NPReason reason); +typedef int32_t (* NPP_WriteReadyProcPtr)(NPP instance, NPStream* stream); +typedef int32_t (* NPP_WriteProcPtr)(NPP instance, NPStream* stream, int32_t offset, int32_t len, void* buffer); +typedef void (* NPP_StreamAsFileProcPtr)(NPP instance, NPStream* stream, const char* fname); +typedef void (* NPP_PrintProcPtr)(NPP instance, NPPrint* platformPrint); +typedef int16_t (* NPP_HandleEventProcPtr)(NPP instance, void* event); +typedef void (* NPP_URLNotifyProcPtr)(NPP instance, const char* url, NPReason reason, void* notifyData); /* Any NPObjects returned to the browser via NPP_GetValue should be retained by the plugin on the way out. The browser is responsible for releasing. */ -typedef NPError (* NP_LOADDS NPP_GetValueProcPtr)(NPP instance, NPPVariable variable, void *ret_value); -typedef NPError (* NP_LOADDS NPP_SetValueProcPtr)(NPP instance, NPNVariable variable, void *value); -typedef NPBool (* NP_LOADDS NPP_GotFocusPtr)(NPP instance, NPFocusDirection direction); -typedef void (* NP_LOADDS NPP_LostFocusPtr)(NPP instance); -typedef void (* NP_LOADDS NPP_URLRedirectNotifyPtr)(NPP instance, const char* url, int32_t status, void* notifyData); -typedef NPError (* NP_LOADDS NPP_ClearSiteDataPtr)(const char* site, uint64_t flags, uint64_t maxAge); -typedef char** (* NP_LOADDS NPP_GetSitesWithDataPtr)(void); -typedef void (* NP_LOADDS NPP_DidCompositePtr)(NPP instance); +typedef NPError (* NPP_GetValueProcPtr)(NPP instance, NPPVariable variable, void *ret_value); +typedef NPError (* NPP_SetValueProcPtr)(NPP instance, NPNVariable variable, void *value); +typedef NPBool (* NPP_GotFocusPtr)(NPP instance, NPFocusDirection direction); +typedef void (* NPP_LostFocusPtr)(NPP instance); +typedef void (* NPP_URLRedirectNotifyPtr)(NPP instance, const char* url, int32_t status, void* notifyData); +typedef NPError (* NPP_ClearSiteDataPtr)(const char* site, uint64_t flags, uint64_t maxAge); +typedef char** (* NPP_GetSitesWithDataPtr)(void); +typedef void (* NPP_DidCompositePtr)(NPP instance); typedef NPError (*NPN_GetValueProcPtr)(NPP instance, NPNVariable variable, void *ret_value); typedef NPError (*NPN_SetValueProcPtr)(NPP instance, NPPVariable variable, void *value); @@ -219,12 +212,8 @@ typedef OSErr (*BP_GetSupportedMIMETypesProcPtr)(BPSupportedMIMETypes*, UInt32); #if defined(_WIN32) #define OSCALL WINAPI #else -#if defined(__OS2__) -#define OSCALL _System -#else #define OSCALL #endif -#endif #if defined(XP_UNIX) /* GCC 3.3 and later support the visibility attribute. */ @@ -238,24 +227,11 @@ typedef OSErr (*BP_GetSupportedMIMETypesProcPtr)(BPSupportedMIMETypes*, UInt32); #define NP_EXPORT(__type) NP_VISIBILITY_DEFAULT __type #endif -#if defined(_WIN32) || defined (__OS2__) +#if defined(_WIN32) #ifdef __cplusplus extern "C" { #endif /* plugin meta member functions */ -#if defined(__OS2__) -typedef struct _NPPluginData { /* Alternate OS2 Plugin interface */ - char *pMimeTypes; - char *pFileExtents; - char *pFileOpenTemplate; - char *pProductName; - char *pProductDescription; - unsigned long dwProductVersionMS; - unsigned long dwProductVersionLS; -} NPPluginData; -typedef NPError (OSCALL *NP_GetPluginDataFunc)(NPPluginData*); -NPError OSCALL NP_GetPluginData(NPPluginData * pPluginData); -#endif typedef NPError (OSCALL *NP_GetEntryPointsFunc)(NPPluginFuncs*); NPError OSCALL NP_GetEntryPoints(NPPluginFuncs* pFuncs); typedef NPError (OSCALL *NP_InitializeFunc)(NPNetscapeFuncs*); @@ -269,10 +245,6 @@ const char* NP_GetMIMEDescription(void); #endif #endif -#if defined(__OS2__) -#pragma pack() -#endif - #ifdef XP_UNIX #ifdef __cplusplus extern "C" { diff --git a/dom/plugins/base/nptypes.h b/dom/plugins/base/nptypes.h index 6fbc7d115..12a5fb78e 100644 --- a/dom/plugins/base/nptypes.h +++ b/dom/plugins/base/nptypes.h @@ -11,7 +11,7 @@ * true/false macros are available. */ -#if defined(WIN32) || defined(OS2) +#if defined(WIN32) /* * Win32 and OS/2 don't know C99, so define [u]int_16/32/64 here. The bool * is predefined tho, both in C and C++. diff --git a/dom/plugins/base/nsNPAPIPlugin.cpp b/dom/plugins/base/nsNPAPIPlugin.cpp index c1a104859..f20e843b2 100644 --- a/dom/plugins/base/nsNPAPIPlugin.cpp +++ b/dom/plugins/base/nsNPAPIPlugin.cpp @@ -62,12 +62,6 @@ #endif #endif -#ifdef XP_OS2 -#define INCL_DOS -#define INCL_DOSERRORS -#include <os2.h> -#endif - #include "nsJSNPRuntime.h" #include "nsIHttpAuthManager.h" #include "nsICookieService.h" @@ -432,7 +426,7 @@ nsNPAPIPlugin::CreatePlugin(nsPluginTag *aPluginTag, nsNPAPIPlugin** aResult) nsresult rv; // Exchange NPAPI entry points. -#if defined(XP_WIN) || defined(XP_OS2) +#if defined(XP_WIN) // NP_GetEntryPoints must be called before NP_Initialize on Windows. rv = pluginLib->NP_GetEntryPoints(&plugin->mPluginFuncs, &pluginCallError); if (rv != NS_OK || pluginCallError != NPERR_NO_ERROR) { @@ -864,7 +858,7 @@ namespace mozilla { namespace plugins { namespace parent { -NPError NP_CALLBACK +NPError _geturl(NPP npp, const char* relativeURL, const char* target) { if (!NS_IsMainThread()) { @@ -900,7 +894,7 @@ _geturl(NPP npp, const char* relativeURL, const char* target) eNPPStreamTypeInternal_Get); } -NPError NP_CALLBACK +NPError _geturlnotify(NPP npp, const char* relativeURL, const char* target, void* notifyData) { @@ -920,7 +914,7 @@ _geturlnotify(NPP npp, const char* relativeURL, const char* target, notifyData); } -NPError NP_CALLBACK +NPError _posturlnotify(NPP npp, const char *relativeURL, const char *target, uint32_t len, const char *buf, NPBool file, void *notifyData) { @@ -944,7 +938,7 @@ _posturlnotify(NPP npp, const char *relativeURL, const char *target, notifyData, len, buf, file); } -NPError NP_CALLBACK +NPError _posturl(NPP npp, const char *relativeURL, const char *target, uint32_t len, const char *buf, NPBool file) { @@ -964,7 +958,7 @@ _posturl(NPP npp, const char *relativeURL, const char *target, len, buf, file); } -NPError NP_CALLBACK +NPError _newstream(NPP npp, NPMIMEType type, const char* target, NPStream* *result) { if (!NS_IsMainThread()) { @@ -998,7 +992,7 @@ _newstream(NPP npp, NPMIMEType type, const char* target, NPStream* *result) return err; } -int32_t NP_CALLBACK +int32_t _write(NPP npp, NPStream *pstream, int32_t len, void *buffer) { if (!NS_IsMainThread()) { @@ -1035,7 +1029,7 @@ _write(NPP npp, NPStream *pstream, int32_t len, void *buffer) return (int32_t)count; } -NPError NP_CALLBACK +NPError _destroystream(NPP npp, NPStream *pstream, NPError reason) { if (!NS_IsMainThread()) { @@ -1085,7 +1079,7 @@ _destroystream(NPP npp, NPStream *pstream, NPError reason) return NPERR_NO_ERROR; } -void NP_CALLBACK +void _status(NPP npp, const char *message) { if (!NS_IsMainThread()) { @@ -1107,7 +1101,7 @@ _status(NPP npp, const char *message) inst->ShowStatus(message); } -void NP_CALLBACK +void _memfree (void *ptr) { if (!NS_IsMainThread()) { @@ -1119,7 +1113,7 @@ _memfree (void *ptr) nsMemory::Free(ptr); } -uint32_t NP_CALLBACK +uint32_t _memflush(uint32_t size) { if (!NS_IsMainThread()) { @@ -1131,7 +1125,7 @@ _memflush(uint32_t size) return 0; } -void NP_CALLBACK +void _reloadplugins(NPBool reloadPages) { if (!NS_IsMainThread()) { @@ -1148,7 +1142,7 @@ _reloadplugins(NPBool reloadPages) pluginHost->ReloadPlugins(); } -void NP_CALLBACK +void _invalidaterect(NPP npp, NPRect *invalidRect) { if (!NS_IsMainThread()) { @@ -1172,7 +1166,7 @@ _invalidaterect(NPP npp, NPRect *invalidRect) inst->InvalidateRect((NPRect *)invalidRect); } -void NP_CALLBACK +void _invalidateregion(NPP npp, NPRegion invalidRegion) { if (!NS_IsMainThread()) { @@ -1195,12 +1189,12 @@ _invalidateregion(NPP npp, NPRegion invalidRegion) inst->InvalidateRegion((NPRegion)invalidRegion); } -void NP_CALLBACK +void _forceredraw(NPP npp) { } -NPObject* NP_CALLBACK +NPObject* _getwindowobject(NPP npp) { if (!NS_IsMainThread()) { @@ -1220,7 +1214,7 @@ _getwindowobject(NPP npp) return nsJSObjWrapper::GetNewOrUsed(npp, cx, global); } -NPObject* NP_CALLBACK +NPObject* _getpluginelement(NPP npp) { if (!NS_IsMainThread()) { @@ -1257,7 +1251,7 @@ _getpluginelement(NPP npp) return nsJSObjWrapper::GetNewOrUsed(npp, cx, obj); } -NPIdentifier NP_CALLBACK +NPIdentifier _getstringidentifier(const NPUTF8* name) { if (!name) { @@ -1272,7 +1266,7 @@ _getstringidentifier(const NPUTF8* name) return doGetIdentifier(cx, name); } -void NP_CALLBACK +void _getstringidentifiers(const NPUTF8** names, int32_t nameCount, NPIdentifier *identifiers) { @@ -1292,7 +1286,7 @@ _getstringidentifiers(const NPUTF8** names, int32_t nameCount, } } -NPIdentifier NP_CALLBACK +NPIdentifier _getintidentifier(int32_t intid) { if (!NS_IsMainThread()) { @@ -1301,7 +1295,7 @@ _getintidentifier(int32_t intid) return IntToNPIdentifier(intid); } -NPUTF8* NP_CALLBACK +NPUTF8* _utf8fromidentifier(NPIdentifier id) { if (!NS_IsMainThread()) { @@ -1321,7 +1315,7 @@ _utf8fromidentifier(NPIdentifier id) ::JS_GetStringLength(str))); } -int32_t NP_CALLBACK +int32_t _intfromidentifier(NPIdentifier id) { if (!NS_IsMainThread()) { @@ -1335,7 +1329,7 @@ _intfromidentifier(NPIdentifier id) return NPIdentifierToInt(id); } -bool NP_CALLBACK +bool _identifierisstring(NPIdentifier id) { if (!NS_IsMainThread()) { @@ -1345,7 +1339,7 @@ _identifierisstring(NPIdentifier id) return NPIdentifierIsString(id); } -NPObject* NP_CALLBACK +NPObject* _createobject(NPP npp, NPClass* aClass) { if (!NS_IsMainThread()) { @@ -1388,7 +1382,7 @@ _createobject(NPP npp, NPClass* aClass) return npobj; } -NPObject* NP_CALLBACK +NPObject* _retainobject(NPObject* npobj) { if (!NS_IsMainThread()) { @@ -1405,7 +1399,7 @@ _retainobject(NPObject* npobj) return npobj; } -void NP_CALLBACK +void _releaseobject(NPObject* npobj) { if (!NS_IsMainThread()) { @@ -1431,7 +1425,7 @@ _releaseobject(NPObject* npobj) } } -bool NP_CALLBACK +bool _invoke(NPP npp, NPObject* npobj, NPIdentifier method, const NPVariant *args, uint32_t argCount, NPVariant *result) { @@ -1454,7 +1448,7 @@ _invoke(NPP npp, NPObject* npobj, NPIdentifier method, const NPVariant *args, return npobj->_class->invoke(npobj, method, args, argCount, result); } -bool NP_CALLBACK +bool _invokeDefault(NPP npp, NPObject* npobj, const NPVariant *args, uint32_t argCount, NPVariant *result) { @@ -1475,7 +1469,7 @@ _invokeDefault(NPP npp, NPObject* npobj, const NPVariant *args, return npobj->_class->invokeDefault(npobj, args, argCount, result); } -bool NP_CALLBACK +bool _evaluate(NPP npp, NPObject* npobj, NPString *script, NPVariant *result) { if (!NS_IsMainThread()) { @@ -1571,7 +1565,7 @@ _evaluate(NPP npp, NPObject* npobj, NPString *script, NPVariant *result) (!result || JSValToNPVariant(npp, cx, *rval, result)); } -bool NP_CALLBACK +bool _getproperty(NPP npp, NPObject* npobj, NPIdentifier property, NPVariant *result) { @@ -1677,7 +1671,7 @@ _getproperty(NPP npp, NPObject* npobj, NPIdentifier property, return true; } -bool NP_CALLBACK +bool _setproperty(NPP npp, NPObject* npobj, NPIdentifier property, const NPVariant *value) { @@ -1698,7 +1692,7 @@ _setproperty(NPP npp, NPObject* npobj, NPIdentifier property, return npobj->_class->setProperty(npobj, property, value); } -bool NP_CALLBACK +bool _removeproperty(NPP npp, NPObject* npobj, NPIdentifier property) { if (!NS_IsMainThread()) { @@ -1718,7 +1712,7 @@ _removeproperty(NPP npp, NPObject* npobj, NPIdentifier property) return npobj->_class->removeProperty(npobj, property); } -bool NP_CALLBACK +bool _hasproperty(NPP npp, NPObject* npobj, NPIdentifier propertyName) { if (!NS_IsMainThread()) { @@ -1738,7 +1732,7 @@ _hasproperty(NPP npp, NPObject* npobj, NPIdentifier propertyName) return npobj->_class->hasProperty(npobj, propertyName); } -bool NP_CALLBACK +bool _hasmethod(NPP npp, NPObject* npobj, NPIdentifier methodName) { if (!NS_IsMainThread()) { @@ -1758,7 +1752,7 @@ _hasmethod(NPP npp, NPObject* npobj, NPIdentifier methodName) return npobj->_class->hasMethod(npobj, methodName); } -bool NP_CALLBACK +bool _enumerate(NPP npp, NPObject *npobj, NPIdentifier **identifier, uint32_t *count) { @@ -1785,7 +1779,7 @@ _enumerate(NPP npp, NPObject *npobj, NPIdentifier **identifier, return npobj->_class->enumerate(npobj, identifier, count); } -bool NP_CALLBACK +bool _construct(NPP npp, NPObject* npobj, const NPVariant *args, uint32_t argCount, NPVariant *result) { @@ -1805,7 +1799,7 @@ _construct(NPP npp, NPObject* npobj, const NPVariant *args, return npobj->_class->construct(npobj, args, argCount, result); } -void NP_CALLBACK +void _releasevariantvalue(NPVariant* variant) { if (!NS_IsMainThread()) { @@ -1862,7 +1856,7 @@ _releasevariantvalue(NPVariant* variant) VOID_TO_NPVARIANT(*variant); } -void NP_CALLBACK +void _setexception(NPObject* npobj, const NPUTF8 *message) { if (!NS_IsMainThread()) { @@ -1881,7 +1875,7 @@ _setexception(NPObject* npobj, const NPUTF8 *message) gNPPException = strdup(message); } -NPError NP_CALLBACK +NPError _getvalue(NPP npp, NPNVariable variable, void *result) { if (!NS_IsMainThread()) { @@ -1944,7 +1938,7 @@ _getvalue(NPP npp, NPNVariable variable, void *result) return NPERR_GENERIC_ERROR; #endif -#if defined(XP_WIN) || defined(XP_OS2) || defined(MOZ_WIDGET_GTK2) \ +#if defined(XP_WIN) || defined(MOZ_WIDGET_GTK2) \ || defined(MOZ_WIDGET_QT) case NPNVnetscapeWindow: { if (!npp || !npp->ndata) @@ -2356,7 +2350,7 @@ _getvalue(NPP npp, NPNVariable variable, void *result) } } -NPError NP_CALLBACK +NPError _setvalue(NPP npp, NPPVariable variable, void *result) { if (!NS_IsMainThread()) { @@ -2452,7 +2446,7 @@ _setvalue(NPP npp, NPPVariable variable, void *result) } } -NPError NP_CALLBACK +NPError _requestread(NPStream *pstream, NPByteRange *rangeList) { if (!NS_IsMainThread()) { @@ -2498,14 +2492,14 @@ _requestread(NPStream *pstream, NPByteRange *rangeList) } // Deprecated, only stubbed out -void* NP_CALLBACK /* OJI type: JRIEnv* */ +void* /* OJI type: JRIEnv* */ _getJavaEnv() { NPN_PLUGIN_LOG(PLUGIN_LOG_NORMAL, ("NPN_GetJavaEnv\n")); return NULL; } -const char * NP_CALLBACK +const char * _useragent(NPP npp) { if (!NS_IsMainThread()) { @@ -2528,7 +2522,7 @@ _useragent(NPP npp) return retstr; } -void * NP_CALLBACK +void * _memalloc (uint32_t size) { if (!NS_IsMainThread()) { @@ -2539,14 +2533,14 @@ _memalloc (uint32_t size) } // Deprecated, only stubbed out -void* NP_CALLBACK /* OJI type: jref */ +void* /* OJI type: jref */ _getJavaPeer(NPP npp) { NPN_PLUGIN_LOG(PLUGIN_LOG_NORMAL, ("NPN_GetJavaPeer: npp=%p\n", (void*)npp)); return NULL; } -void NP_CALLBACK +void _pushpopupsenabledstate(NPP npp, NPBool enabled) { if (!NS_IsMainThread()) { @@ -2560,7 +2554,7 @@ _pushpopupsenabledstate(NPP npp, NPBool enabled) inst->PushPopupsEnabledState(enabled); } -void NP_CALLBACK +void _poppopupsenabledstate(NPP npp) { if (!NS_IsMainThread()) { @@ -2574,7 +2568,7 @@ _poppopupsenabledstate(NPP npp) inst->PopPopupsEnabledState(); } -void NP_CALLBACK +void _pluginthreadasynccall(NPP instance, PluginThreadCallback func, void *userData) { if (NS_IsMainThread()) { @@ -2590,7 +2584,7 @@ _pluginthreadasynccall(NPP instance, PluginThreadCallback func, void *userData) } } -NPError NP_CALLBACK +NPError _getvalueforurl(NPP instance, NPNURLVariable variable, const char *url, char **value, uint32_t *len) { @@ -2649,7 +2643,7 @@ _getvalueforurl(NPP instance, NPNURLVariable variable, const char *url, return NPERR_GENERIC_ERROR; } -NPError NP_CALLBACK +NPError _setvalueforurl(NPP instance, NPNURLVariable variable, const char *url, const char *value, uint32_t len) { @@ -2706,7 +2700,7 @@ _setvalueforurl(NPP instance, NPNURLVariable variable, const char *url, return NPERR_GENERIC_ERROR; } -NPError NP_CALLBACK +NPError _getauthenticationinfo(NPP instance, const char *protocol, const char *host, int32_t port, const char *scheme, const char *realm, char **username, uint32_t *ulen, char **password, @@ -2765,7 +2759,7 @@ _getauthenticationinfo(NPP instance, const char *protocol, const char *host, return NPERR_NO_ERROR; } -uint32_t NP_CALLBACK +uint32_t _scheduletimer(NPP instance, uint32_t interval, NPBool repeat, PluginTimerFunc timerFunc) { nsNPAPIPluginInstance *inst = (nsNPAPIPluginInstance *)instance->ndata; @@ -2775,7 +2769,7 @@ _scheduletimer(NPP instance, uint32_t interval, NPBool repeat, PluginTimerFunc t return inst->ScheduleTimer(interval, repeat, timerFunc); } -void NP_CALLBACK +void _unscheduletimer(NPP instance, uint32_t timerID) { #ifdef MOZ_WIDGET_ANDROID @@ -2791,7 +2785,7 @@ _unscheduletimer(NPP instance, uint32_t timerID) inst->UnscheduleTimer(timerID); } -NPError NP_CALLBACK +NPError _popupcontextmenu(NPP instance, NPMenu* menu) { nsNPAPIPluginInstance *inst = (nsNPAPIPluginInstance *)instance->ndata; @@ -2801,7 +2795,7 @@ _popupcontextmenu(NPP instance, NPMenu* menu) return inst->PopUpContextMenu(menu); } -NPError NP_CALLBACK +NPError _initasyncsurface(NPP instance, NPSize *size, NPImageFormat format, void *initData, NPAsyncSurface *surface) { nsNPAPIPluginInstance *inst = (nsNPAPIPluginInstance *)instance->ndata; @@ -2811,7 +2805,7 @@ _initasyncsurface(NPP instance, NPSize *size, NPImageFormat format, void *initDa return inst->InitAsyncSurface(size, format, initData, surface); } -NPError NP_CALLBACK +NPError _finalizeasyncsurface(NPP instance, NPAsyncSurface *surface) { nsNPAPIPluginInstance *inst = (nsNPAPIPluginInstance *)instance->ndata; @@ -2821,7 +2815,7 @@ _finalizeasyncsurface(NPP instance, NPAsyncSurface *surface) return inst->FinalizeAsyncSurface(surface); } -void NP_CALLBACK +void _setcurrentasyncsurface(NPP instance, NPAsyncSurface *surface, NPRect *changed) { nsNPAPIPluginInstance *inst = (nsNPAPIPluginInstance *)instance->ndata; @@ -2831,7 +2825,7 @@ _setcurrentasyncsurface(NPP instance, NPAsyncSurface *surface, NPRect *changed) inst->SetCurrentAsyncSurface(surface, changed); } -NPBool NP_CALLBACK +NPBool _convertpoint(NPP instance, double sourceX, double sourceY, NPCoordinateSpace sourceSpace, double *destX, double *destY, NPCoordinateSpace destSpace) { nsNPAPIPluginInstance *inst = (nsNPAPIPluginInstance *)instance->ndata; @@ -2841,7 +2835,7 @@ _convertpoint(NPP instance, double sourceX, double sourceY, NPCoordinateSpace so return inst->ConvertPoint(sourceX, sourceY, sourceSpace, destX, destY, destSpace); } -void NP_CALLBACK +void _urlredirectresponse(NPP instance, void* notifyData, NPBool allow) { nsNPAPIPluginInstance *inst = (nsNPAPIPluginInstance *)instance->ndata; diff --git a/dom/plugins/base/nsNPAPIPlugin.h b/dom/plugins/base/nsNPAPIPlugin.h index 37587f77e..c07b8b6e1 100644 --- a/dom/plugins/base/nsNPAPIPlugin.h +++ b/dom/plugins/base/nsNPAPIPlugin.h @@ -15,18 +15,8 @@ #include "mozilla/PluginLibrary.h" -/* - * Use this macro before each exported function - * (between the return address and the function - * itself), to ensure that the function has the - * right calling conventions on OS/2. - */ -#define NP_CALLBACK NP_LOADDS - #if defined(XP_WIN) #define NS_NPAPIPLUGIN_CALLBACK(_type, _name) _type (__stdcall * _name) -#elif defined(XP_OS2) -#define NS_NPAPIPLUGIN_CALLBACK(_type, _name) _type (_System * _name) #else #define NS_NPAPIPLUGIN_CALLBACK(_type, _name) _type (* _name) #endif @@ -144,103 +134,103 @@ NPStringIdentifierIsPermanent(NPP npp, NPIdentifier id) #define NPIdentifier_VOID (JSIdToNPIdentifier(JSID_VOID)) -NPObject* NP_CALLBACK +NPObject* _getwindowobject(NPP npp); -NPObject* NP_CALLBACK +NPObject* _getpluginelement(NPP npp); -NPIdentifier NP_CALLBACK +NPIdentifier _getstringidentifier(const NPUTF8* name); -void NP_CALLBACK +void _getstringidentifiers(const NPUTF8** names, int32_t nameCount, NPIdentifier *identifiers); -bool NP_CALLBACK +bool _identifierisstring(NPIdentifier identifiers); -NPIdentifier NP_CALLBACK +NPIdentifier _getintidentifier(int32_t intid); -NPUTF8* NP_CALLBACK +NPUTF8* _utf8fromidentifier(NPIdentifier identifier); -int32_t NP_CALLBACK +int32_t _intfromidentifier(NPIdentifier identifier); -NPObject* NP_CALLBACK +NPObject* _createobject(NPP npp, NPClass* aClass); -NPObject* NP_CALLBACK +NPObject* _retainobject(NPObject* npobj); -void NP_CALLBACK +void _releaseobject(NPObject* npobj); -bool NP_CALLBACK +bool _invoke(NPP npp, NPObject* npobj, NPIdentifier method, const NPVariant *args, uint32_t argCount, NPVariant *result); -bool NP_CALLBACK +bool _invokeDefault(NPP npp, NPObject* npobj, const NPVariant *args, uint32_t argCount, NPVariant *result); -bool NP_CALLBACK +bool _evaluate(NPP npp, NPObject* npobj, NPString *script, NPVariant *result); -bool NP_CALLBACK +bool _getproperty(NPP npp, NPObject* npobj, NPIdentifier property, NPVariant *result); -bool NP_CALLBACK +bool _setproperty(NPP npp, NPObject* npobj, NPIdentifier property, const NPVariant *value); -bool NP_CALLBACK +bool _removeproperty(NPP npp, NPObject* npobj, NPIdentifier property); -bool NP_CALLBACK +bool _hasproperty(NPP npp, NPObject* npobj, NPIdentifier propertyName); -bool NP_CALLBACK +bool _hasmethod(NPP npp, NPObject* npobj, NPIdentifier methodName); -bool NP_CALLBACK +bool _enumerate(NPP npp, NPObject *npobj, NPIdentifier **identifier, uint32_t *count); -bool NP_CALLBACK +bool _construct(NPP npp, NPObject* npobj, const NPVariant *args, uint32_t argCount, NPVariant *result); -void NP_CALLBACK +void _releasevariantvalue(NPVariant *variant); -void NP_CALLBACK +void _setexception(NPObject* npobj, const NPUTF8 *message); -void NP_CALLBACK +void _pushpopupsenabledstate(NPP npp, NPBool enabled); -void NP_CALLBACK +void _poppopupsenabledstate(NPP npp); typedef void(*PluginThreadCallback)(void *); -void NP_CALLBACK +void _pluginthreadasynccall(NPP instance, PluginThreadCallback func, void *userData); -NPError NP_CALLBACK +NPError _getvalueforurl(NPP instance, NPNURLVariable variable, const char *url, char **value, uint32_t *len); -NPError NP_CALLBACK +NPError _setvalueforurl(NPP instance, NPNURLVariable variable, const char *url, const char *value, uint32_t len); -NPError NP_CALLBACK +NPError _getauthenticationinfo(NPP instance, const char *protocol, const char *host, int32_t port, const char *scheme, const char *realm, char **username, uint32_t *ulen, char **password, @@ -248,95 +238,95 @@ _getauthenticationinfo(NPP instance, const char *protocol, const char *host, typedef void(*PluginTimerFunc)(NPP npp, uint32_t timerID); -uint32_t NP_CALLBACK +uint32_t _scheduletimer(NPP instance, uint32_t interval, NPBool repeat, PluginTimerFunc timerFunc); -void NP_CALLBACK +void _unscheduletimer(NPP instance, uint32_t timerID); -NPError NP_CALLBACK +NPError _popupcontextmenu(NPP instance, NPMenu* menu); -NPError NP_CALLBACK +NPError _initasyncsurface(NPP instance, NPSize *size, NPImageFormat format, void *initData, NPAsyncSurface *surface); -NPError NP_CALLBACK +NPError _finalizeasyncsurface(NPP instance, NPAsyncSurface *surface); -void NP_CALLBACK +void _setcurrentasyncsurface(NPP instance, NPAsyncSurface *surface, NPRect *changed); -NPBool NP_CALLBACK +NPBool _convertpoint(NPP instance, double sourceX, double sourceY, NPCoordinateSpace sourceSpace, double *destX, double *destY, NPCoordinateSpace destSpace); -NPError NP_CALLBACK +NPError _requestread(NPStream *pstream, NPByteRange *rangeList); -NPError NP_CALLBACK +NPError _geturlnotify(NPP npp, const char* relativeURL, const char* target, void* notifyData); -NPError NP_CALLBACK +NPError _getvalue(NPP npp, NPNVariable variable, void *r_value); -NPError NP_CALLBACK +NPError _setvalue(NPP npp, NPPVariable variable, void *r_value); -NPError NP_CALLBACK +NPError _geturl(NPP npp, const char* relativeURL, const char* target); -NPError NP_CALLBACK +NPError _posturlnotify(NPP npp, const char* relativeURL, const char *target, uint32_t len, const char *buf, NPBool file, void* notifyData); -NPError NP_CALLBACK +NPError _posturl(NPP npp, const char* relativeURL, const char *target, uint32_t len, const char *buf, NPBool file); -NPError NP_CALLBACK +NPError _newstream(NPP npp, NPMIMEType type, const char* window, NPStream** pstream); -int32_t NP_CALLBACK +int32_t _write(NPP npp, NPStream *pstream, int32_t len, void *buffer); -NPError NP_CALLBACK +NPError _destroystream(NPP npp, NPStream *pstream, NPError reason); -void NP_CALLBACK +void _status(NPP npp, const char *message); -void NP_CALLBACK +void _memfree (void *ptr); -uint32_t NP_CALLBACK +uint32_t _memflush(uint32_t size); -void NP_CALLBACK +void _reloadplugins(NPBool reloadPages); -void NP_CALLBACK +void _invalidaterect(NPP npp, NPRect *invalidRect); -void NP_CALLBACK +void _invalidateregion(NPP npp, NPRegion invalidRegion); -void NP_CALLBACK +void _forceredraw(NPP npp); -const char* NP_CALLBACK +const char* _useragent(NPP npp); -void* NP_CALLBACK +void* _memalloc (uint32_t size); // Deprecated entry points for the old Java plugin. -void* NP_CALLBACK /* OJI type: JRIEnv* */ +void* /* OJI type: JRIEnv* */ _getJavaEnv(); -void* NP_CALLBACK /* OJI type: jref */ +void* /* OJI type: jref */ _getJavaPeer(NPP npp); -void NP_CALLBACK +void _urlredirectresponse(NPP instance, void* notifyData, NPBool allow); } /* namespace parent */ diff --git a/dom/plugins/base/nsNPAPIPluginInstance.cpp b/dom/plugins/base/nsNPAPIPluginInstance.cpp index abd2e143e..c5dac521a 100644 --- a/dom/plugins/base/nsNPAPIPluginInstance.cpp +++ b/dom/plugins/base/nsNPAPIPluginInstance.cpp @@ -690,7 +690,7 @@ nsresult nsNPAPIPluginInstance::HandleEvent(void* event, int16_t* result, if (pluginFunctions->event) { mCurrentPluginEvent = event; -#if defined(XP_WIN) || defined(XP_OS2) +#if defined(XP_WIN) NS_TRY_SAFE_CALL_RETURN(tmpResult, (*pluginFunctions->event)(&mNPP, event), this, aSafeToReenterGecko); #else diff --git a/dom/plugins/base/nsNPAPIPluginStreamListener.cpp b/dom/plugins/base/nsNPAPIPluginStreamListener.cpp index c87d8b4a4..3518d349f 100644 --- a/dom/plugins/base/nsNPAPIPluginStreamListener.cpp +++ b/dom/plugins/base/nsNPAPIPluginStreamListener.cpp @@ -866,7 +866,7 @@ nsNPAPIPluginStreamListener::HandleRedirectNotification(nsIChannel *oldChannel, NPP npp; mInst->GetNPP(&npp); -#if defined(XP_WIN) || defined(XP_OS2) +#if defined(XP_WIN) NS_TRY_SAFE_CALL_VOID((*pluginFunctions->urlredirectnotify)(npp, spec.get(), static_cast<int32_t>(status), mNPStreamWrapper->mNPStream.notifyData), mInst, NS_PLUGIN_CALL_UNSAFE_TO_REENTER_GECKO); #else diff --git a/dom/plugins/base/nsPluginInstanceOwner.cpp b/dom/plugins/base/nsPluginInstanceOwner.cpp index 00ecbc27f..36ecaff57 100644 --- a/dom/plugins/base/nsPluginInstanceOwner.cpp +++ b/dom/plugins/base/nsPluginInstanceOwner.cpp @@ -654,7 +654,7 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetNetscapeWindow(void *value) return NS_ERROR_FAILURE; } -#if defined(XP_WIN) || defined(XP_OS2) +#if defined(XP_WIN) void** pvalue = (void**)value; nsViewManager* vm = mObjectFrame->PresContext()->GetPresShell()->GetViewManager(); if (!vm) @@ -2664,32 +2664,6 @@ void nsPluginInstanceOwner::Paint(const RECT& aDirty, HDC aDC) } #endif -#ifdef XP_OS2 -void nsPluginInstanceOwner::Paint(const nsRect& aDirtyRect, HPS aHPS) -{ - if (!mInstance || !mObjectFrame) - return; - - NPWindow *window; - GetWindow(window); - nsIntRect relDirtyRect = aDirtyRect.ToOutsidePixels(mObjectFrame->PresContext()->AppUnitsPerDevPixel()); - - // we got dirty rectangle in relative window coordinates, but we - // need it in absolute units and in the (left, top, right, bottom) form - RECTL rectl; - rectl.xLeft = relDirtyRect.x + window->x; - rectl.yBottom = relDirtyRect.y + window->y; - rectl.xRight = rectl.xLeft + relDirtyRect.width; - rectl.yTop = rectl.yBottom + relDirtyRect.height; - - NPEvent pluginEvent; - pluginEvent.event = WM_PAINT; - pluginEvent.wParam = (uint32_t)aHPS; - pluginEvent.lParam = (uint32_t)&rectl; - mInstance->HandleEvent(&pluginEvent, nullptr); -} -#endif - #ifdef MOZ_WIDGET_ANDROID void nsPluginInstanceOwner::Paint(gfxContext* aContext, diff --git a/dom/plugins/base/nsPluginInstanceOwner.h b/dom/plugins/base/nsPluginInstanceOwner.h index 88b15e189..2035debf8 100644 --- a/dom/plugins/base/nsPluginInstanceOwner.h +++ b/dom/plugins/base/nsPluginInstanceOwner.h @@ -39,12 +39,6 @@ class gfxXlibSurface; #endif #endif -#ifdef XP_OS2 -#define INCL_PM -#define INCL_GPI -#include <os2.h> -#endif - class nsPluginInstanceOwner : public nsIPluginInstanceOwner, public nsIPluginTagInfo, public nsIDOMEventListener, @@ -99,8 +93,6 @@ public: void Paint(gfxContext* aContext, const gfxRect& aFrameRect, const gfxRect& aDirtyRect); -#elif defined(XP_OS2) - void Paint(const nsRect& aDirtyRect, HPS aHPS); #endif //locals diff --git a/dom/plugins/base/nsPluginNativeWindowOS2.cpp b/dom/plugins/base/nsPluginNativeWindowOS2.cpp deleted file mode 100644 index de6c9bfef..000000000 --- a/dom/plugins/base/nsPluginNativeWindowOS2.cpp +++ /dev/null @@ -1,524 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -/*****************************************************************************/ - -#define INCL_WIN -#include "os2.h" - -#include "nsDebug.h" -#include "nsGUIEvent.h" -#include "nsPluginNativeWindow.h" -#include "nsThreadUtils.h" -#include "nsAutoPtr.h" -#include "nsTWeakRef.h" - -#define NS_PLUGIN_WINDOW_PROPERTY_ASSOCIATION "MozillaPluginWindowPropertyAssociation" -#define NS_PLUGIN_CUSTOM_MSG_ID "MozFlashUserRelay" -#define WM_USER_FLASH WM_USER+1 -#ifndef WM_FOCUSCHANGED -#define WM_FOCUSCHANGED 0x000E -#endif - -#define NP_POPUP_API_VERSION 16 - -#define nsMajorVersion(v) (((int32_t)(v) >> 16) & 0xffff) -#define nsMinorVersion(v) ((int32_t)(v) & 0xffff) -#define versionOK(suppliedV, requiredV) \ - (nsMajorVersion(suppliedV) == nsMajorVersion(requiredV) \ - && nsMinorVersion(suppliedV) >= nsMinorVersion(requiredV)) - -typedef nsTWeakRef<class nsPluginNativeWindowOS2> PluginWindowWeakRef; - -extern "C" { -PVOID APIENTRY WinQueryProperty(HWND hwnd, PCSZ pszNameOrAtom); - -PVOID APIENTRY WinRemoveProperty(HWND hwnd, PCSZ pszNameOrAtom); - -BOOL APIENTRY WinSetProperty(HWND hwnd, PCSZ pszNameOrAtom, - PVOID pvData, ULONG ulFlags); -} - -/*****************************************************************************/ - -static ULONG sWM_FLASHBOUNCEMSG = 0; - -/*****************************************************************************/ -/** - * PLEvent handling code - */ - -class PluginWindowEvent : public nsRunnable -{ -public: - PluginWindowEvent(); - void Init(const PluginWindowWeakRef &ref, HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2); - void Clear(); - HWND GetWnd() { return mWnd; }; - ULONG GetMsg() { return mMsg; }; - MPARAM GetWParam() { return mWParam; }; - MPARAM GetLParam() { return mLParam; }; - bool InUse() { return (mWnd!=NULL); }; - - NS_DECL_NSIRUNNABLE - -protected: - PluginWindowWeakRef mPluginWindowRef; - HWND mWnd; - ULONG mMsg; - MPARAM mWParam; - MPARAM mLParam; -}; - -PluginWindowEvent::PluginWindowEvent() -{ - Clear(); -} - -void PluginWindowEvent::Clear() -{ - mWnd = NULL; - mMsg = 0; - mWParam = 0; - mLParam = 0; -} - -void PluginWindowEvent::Init(const PluginWindowWeakRef &ref, HWND aWnd, - ULONG aMsg, MPARAM mp1, MPARAM mp2) -{ - NS_ASSERTION(aWnd != NULL, "invalid plugin event value"); - NS_ASSERTION(mWnd == NULL, "event already in use"); - mPluginWindowRef = ref; - mWnd = aWnd; - mMsg = aMsg; - mWParam = mp1; - mLParam = mp2; -} - -/*****************************************************************************/ - -class nsDelayedPopupsEnabledEvent : public nsRunnable -{ -public: - nsDelayedPopupsEnabledEvent(nsNPAPIPluginInstance *inst) - : mInst(inst) - {} - - NS_DECL_NSIRUNNABLE - -private: - nsRefPtr<nsNPAPIPluginInstance> mInst; -}; - -NS_IMETHODIMP nsDelayedPopupsEnabledEvent::Run() -{ - mInst->PushPopupsEnabledState(false); - return NS_OK; -} - -/*****************************************************************************/ -/** - * nsPluginNativeWindow OS/2-specific class declaration - */ - -typedef enum { - nsPluginType_Unknown = 0, - nsPluginType_Flash, - nsPluginType_Java_vm, - nsPluginType_Other -} nsPluginType; - -class nsPluginNativeWindowOS2 : public nsPluginNativeWindow -{ -public: - nsPluginNativeWindowOS2(); - virtual ~nsPluginNativeWindowOS2(); - - virtual nsresult CallSetWindow(nsRefPtr<nsNPAPIPluginInstance> &aPluginInstance); - -private: - nsresult SubclassAndAssociateWindow(); - nsresult UndoSubclassAndAssociateWindow(); - -public: - // locals - PFNWP GetWindowProc(); - PluginWindowEvent* GetPluginWindowEvent(HWND aWnd, - ULONG aMsg, - MPARAM mp1, - MPARAM mp2); - -private: - PFNWP mPluginWinProc; - PluginWindowWeakRef mWeakRef; - nsRefPtr<PluginWindowEvent> mCachedPluginWindowEvent; - -public: - nsPluginType mPluginType; -}; - -/*****************************************************************************/ - -static bool ProcessFlashMessageDelayed(nsPluginNativeWindowOS2 * aWin, - nsNPAPIPluginInstance * aInst, - HWND hWnd, ULONG msg, - MPARAM mp1, MPARAM mp2) -{ - NS_ENSURE_TRUE(aWin, NS_ERROR_NULL_POINTER); - NS_ENSURE_TRUE(aInst, NS_ERROR_NULL_POINTER); - - if (msg == sWM_FLASHBOUNCEMSG) { - // See PluginWindowEvent::Run() below. - NS_TRY_SAFE_CALL_VOID((aWin->GetWindowProc())(hWnd, WM_USER_FLASH, mp1, mp2), - inst, - NS_PLUGIN_CALL_UNSAFE_TO_REENTER_GECKO); - return TRUE; - } - - if (msg != WM_USER_FLASH) - return false; // no need to delay - - // do stuff - nsCOMPtr<nsIRunnable> pwe = aWin->GetPluginWindowEvent(hWnd, msg, mp1, mp2); - if (pwe) { - NS_DispatchToCurrentThread(pwe); - return true; - } - return false; -} - -/*****************************************************************************/ -/** - * New plugin window procedure - */ - -static MRESULT EXPENTRY PluginWndProc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) -{ - nsPluginNativeWindowOS2 * win = (nsPluginNativeWindowOS2 *) - ::WinQueryProperty(hWnd, NS_PLUGIN_WINDOW_PROPERTY_ASSOCIATION); - if (!win) - return (MRESULT)TRUE; - - // The DispatchEvent(NS_PLUGIN_ACTIVATE) below can trigger a reentrant focus - // event which might destroy us. Hold a strong ref on the plugin instance - // to prevent that, bug 374229. - nsRefPtr<nsNPAPIPluginInstance> inst; - win->GetPluginInstance(inst); - - // check plugin mime type and cache whether it is Flash or java-vm or not; - // flash and java-vm will need special treatment later - if (win->mPluginType == nsPluginType_Unknown) { - if (inst) { - const char* mimetype = nullptr; - inst->GetMIMEType(&mimetype); - if (mimetype) { - if (!strcmp(mimetype, "application/x-shockwave-flash")) - win->mPluginType = nsPluginType_Flash; - else if (!strcmp(mimetype, "application/x-java-vm")) - win->mPluginType = nsPluginType_Java_vm; - else - win->mPluginType = nsPluginType_Other; - } - } - } - - bool enablePopups = false; - - // Activate/deactivate mouse capture on the plugin widget - // here, before we pass the Windows event to the plugin - // because its possible our widget won't get paired events - // (see bug 131007) and we'll look frozen. Note that this - // is also done in ChildWindow::DispatchMouseEvent. - switch (msg) { - case WM_BUTTON1DOWN: - case WM_BUTTON2DOWN: - case WM_BUTTON3DOWN: { - nsCOMPtr<nsIWidget> widget; - win->GetPluginWidget(getter_AddRefs(widget)); - if (widget) - widget->CaptureMouse(true); - break; - } - - case WM_BUTTON1UP: - case WM_BUTTON2UP: - case WM_BUTTON3UP: { - if (msg == WM_BUTTON1UP) - enablePopups = true; - - nsCOMPtr<nsIWidget> widget; - win->GetPluginWidget(getter_AddRefs(widget)); - if (widget) - widget->CaptureMouse(false); - break; - } - - case WM_CHAR: - // Ignore repeating keydown messages... - if (SHORT1FROMMP(mp1) & KC_PREVDOWN) - break; - enablePopups = true; - break; - - // When the child of a plugin gets the focus, nsWindow doesn't get - // a WM_FOCUSCHANGED msg, so plugin and window activation events - // don't happen. This fixes the problem by synthesizing a msg - // that makes it look like the plugin widget just got the focus. - case WM_FOCUSCHANGE: { - - // Some plugins don't pass this msg on. If the default window proc - // doesn't receive it, window activation/deactivation won't happen. - WinDefWindowProc(hWnd, msg, mp1, mp2); - - // If focus is being gained, and the plugin widget neither lost nor - // gained the focus, then a child just got it from some other window. - // If that other window was neither a child of the widget nor owned - // by a child of the widget (e.g. a popup menu), post a WM_FOCUSCHANGED - // msg that identifies the child as the window losing focus. After - // nsWindow:: ActivatePlugin() activates the plugin, it will restore - // the focus to the child. - if (SHORT1FROMMP(mp2) && (HWND)mp1 != hWnd) { - HWND hFocus = WinQueryFocus(HWND_DESKTOP); - if (hFocus != hWnd && - WinIsChild(hFocus, hWnd) && - !WinIsChild((HWND)mp1, hWnd) && - !WinIsChild(WinQueryWindow((HWND)mp1, QW_OWNER), hWnd)) { - WinPostMsg(hWnd, WM_FOCUSCHANGED, (MPARAM)hFocus, mp2); - } - } - break; - } - } - - // Macromedia Flash plugin may flood the message queue with some special messages - // (WM_USER+1) causing 100% CPU consumption and GUI freeze, see mozilla bug 132759; - // we can prevent this from happening by delaying the processing such messages; - if (win->mPluginType == nsPluginType_Flash) { - if (ProcessFlashMessageDelayed(win, inst, hWnd, msg, mp1, mp2)) - return (MRESULT)TRUE; - } - - if (enablePopups && inst) { - uint16_t apiVersion; - if (NS_SUCCEEDED(inst->GetPluginAPIVersion(&apiVersion)) && - !versionOK(apiVersion, NP_POPUP_API_VERSION)) - inst->PushPopupsEnabledState(true); - } - - MRESULT res = (MRESULT)TRUE; - if (win->mPluginType == nsPluginType_Java_vm) - NS_TRY_SAFE_CALL_RETURN(res, ::WinDefWindowProc(hWnd, msg, mp1, mp2), inst, - NS_PLUGIN_CALL_UNSAFE_TO_REENTER_GECKO); - else - NS_TRY_SAFE_CALL_RETURN(res, (win->GetWindowProc())(hWnd, msg, mp1, mp2), inst, - NS_PLUGIN_CALL_UNSAFE_TO_REENTER_GECKO); - - if (inst) { - // Popups are enabled (were enabled before the call to - // CallWindowProc()). Some plugins (at least the flash player) - // post messages from their key handlers etc that delay the actual - // processing, so we need to delay the disabling of popups so that - // popups remain enabled when the flash player ends up processing - // the actual key handlers. We do this by posting an event that - // does the disabling, this way our disabling will happen after - // the handlers in the plugin are done. - - // Note that it's not fatal if any of this fails (which won't - // happen unless we're out of memory anyways) since the plugin - // code will pop any popup state pushed by this plugin on - // destruction. - - nsCOMPtr<nsIRunnable> event = new nsDelayedPopupsEnabledEvent(inst); - if (event) - NS_DispatchToCurrentThread(event); - } - - return res; -} - -/*****************************************************************************/ -/** - * nsPluginNativeWindowOS2 implementation - */ - -nsPluginNativeWindowOS2::nsPluginNativeWindowOS2() : nsPluginNativeWindow() -{ - // initialize the struct fields - window = nullptr; - x = 0; - y = 0; - width = 0; - height = 0; - - mPluginWinProc = NULL; - mPluginType = nsPluginType_Unknown; - - // once the atom has been added, it won't be deleted - if (!sWM_FLASHBOUNCEMSG) { - sWM_FLASHBOUNCEMSG = ::WinFindAtom(WinQuerySystemAtomTable(), - NS_PLUGIN_CUSTOM_MSG_ID); - if (!sWM_FLASHBOUNCEMSG) - sWM_FLASHBOUNCEMSG = ::WinAddAtom(WinQuerySystemAtomTable(), - NS_PLUGIN_CUSTOM_MSG_ID); - } -} - -nsPluginNativeWindowOS2::~nsPluginNativeWindowOS2() -{ - // clear weak reference to self to prevent any pending events from - // dereferencing this. - mWeakRef.forget(); -} - -PFNWP nsPluginNativeWindowOS2::GetWindowProc() -{ - return mPluginWinProc; -} - -NS_IMETHODIMP PluginWindowEvent::Run() -{ - nsPluginNativeWindowOS2 *win = mPluginWindowRef.get(); - if (!win) - return NS_OK; - - HWND hWnd = GetWnd(); - if (!hWnd) - return NS_OK; - - nsRefPtr<nsNPAPIPluginInstance> inst; - win->GetPluginInstance(inst); - - if (GetMsg() == WM_USER_FLASH) - // XXX Unwind issues related to runnable event callback depth for this - // event and destruction of the plugin. (Bug 493601) - ::WinPostMsg(hWnd, sWM_FLASHBOUNCEMSG, GetWParam(), GetLParam()); - else - // Currently not used, but added so that processing events here - // is more generic. - NS_TRY_SAFE_CALL_VOID((win->GetWindowProc()) - (hWnd, GetMsg(), GetWParam(), GetLParam()), - inst, - NS_PLUGIN_CALL_UNSAFE_TO_REENTER_GECKO); - - Clear(); - return NS_OK; -} - -PluginWindowEvent* -nsPluginNativeWindowOS2::GetPluginWindowEvent(HWND aWnd, ULONG aMsg, MPARAM aMp1, MPARAM aMp2) -{ - if (!mWeakRef) { - mWeakRef = this; - if (!mWeakRef) - return nullptr; - } - - PluginWindowEvent *event; - - // We have the ability to alloc if needed in case in the future some plugin - // should post multiple PostMessages. However, this could lead to many - // alloc's per second which could become a performance issue. See bug 169247. - if (!mCachedPluginWindowEvent) { - event = new PluginWindowEvent(); - if (!event) - return nullptr; - mCachedPluginWindowEvent = event; - } - else - if (mCachedPluginWindowEvent->InUse()) { - event = new PluginWindowEvent(); - if (!event) - return nullptr; - } - else - event = mCachedPluginWindowEvent; - - event->Init(mWeakRef, aWnd, aMsg, aMp1, aMp2); - return event; -} - -nsresult nsPluginNativeWindowOS2::CallSetWindow(nsRefPtr<nsNPAPIPluginInstance> &aPluginInstance) -{ - // check the incoming instance, null indicates that window is going away and we are - // not interested in subclassing business any more, undo and don't subclass - if (!aPluginInstance) { - UndoSubclassAndAssociateWindow(); - } - - nsPluginNativeWindow::CallSetWindow(aPluginInstance); - - if (aPluginInstance) - SubclassAndAssociateWindow(); - - return NS_OK; -} - -nsresult nsPluginNativeWindowOS2::SubclassAndAssociateWindow() -{ - if (type != NPWindowTypeWindow) - return NS_ERROR_FAILURE; - - HWND hWnd = (HWND)window; - if (!hWnd) - return NS_ERROR_FAILURE; - - // check if we need to re-subclass - PFNWP currentWndProc = (PFNWP)::WinQueryWindowPtr(hWnd, QWP_PFNWP); - if (PluginWndProc == currentWndProc) - return NS_OK; - - mPluginWinProc = ::WinSubclassWindow(hWnd, PluginWndProc); - if (!mPluginWinProc) - return NS_ERROR_FAILURE; - -#ifdef DEBUG - nsPluginNativeWindowOS2 * win = (nsPluginNativeWindowOS2 *) - ::WinQueryProperty(hWnd, NS_PLUGIN_WINDOW_PROPERTY_ASSOCIATION); - NS_ASSERTION(!win || (win == this), "plugin window already has property and this is not us"); -#endif - - if (!::WinSetProperty(hWnd, NS_PLUGIN_WINDOW_PROPERTY_ASSOCIATION, (PVOID)this, 0)) - return NS_ERROR_FAILURE; - - return NS_OK; -} - -nsresult nsPluginNativeWindowOS2::UndoSubclassAndAssociateWindow() -{ - // release plugin instance - SetPluginInstance(nullptr); - - // remove window property - HWND hWnd = (HWND)window; - if (::WinIsWindow(/*HAB*/0, hWnd)) - ::WinRemoveProperty(hWnd, NS_PLUGIN_WINDOW_PROPERTY_ASSOCIATION); - - // restore the original win proc - // but only do this if this were us last time - if (mPluginWinProc) { - PFNWP currentWndProc = (PFNWP)::WinQueryWindowPtr(hWnd, QWP_PFNWP); - if (currentWndProc == PluginWndProc) - ::WinSubclassWindow(hWnd, mPluginWinProc); - } - - return NS_OK; -} - -nsresult PLUG_NewPluginNativeWindow(nsPluginNativeWindow ** aPluginNativeWindow) -{ - NS_ENSURE_ARG_POINTER(aPluginNativeWindow); - - *aPluginNativeWindow = new nsPluginNativeWindowOS2(); - - return *aPluginNativeWindow ? NS_OK : NS_ERROR_OUT_OF_MEMORY; -} - -nsresult PLUG_DeletePluginNativeWindow(nsPluginNativeWindow * aPluginNativeWindow) -{ - NS_ENSURE_ARG_POINTER(aPluginNativeWindow); - nsPluginNativeWindowOS2 *p = (nsPluginNativeWindowOS2 *)aPluginNativeWindow; - delete p; - return NS_OK; -} diff --git a/dom/plugins/base/nsPluginsDirOS2.cpp b/dom/plugins/base/nsPluginsDirOS2.cpp deleted file mode 100644 index 523b1c628..000000000 --- a/dom/plugins/base/nsPluginsDirOS2.cpp +++ /dev/null @@ -1,274 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -// OS/2 plugin-loading code. - -#define INCL_DOS -#define INCL_DOSERRORS -#include <os2.h> - -#include "nsPluginsDir.h" -#include "prlink.h" -#include "plstr.h" -#include "prmem.h" -#include "prprf.h" -#include "npapi.h" - -#include "nsString.h" - -/* Load a string stored as RCDATA in a resource segment */ -/* Returned string needs to be PR_Free'd by caller */ -static char *LoadRCDATAString( HMODULE hMod, ULONG resid) -{ - APIRET rc; - ULONG ulSize = 0; - char *string = 0; - - rc = DosQueryResourceSize( hMod, RT_RCDATA, resid, &ulSize); - - if( rc == NO_ERROR) - { - char *readOnlyString = 0; - rc = DosGetResource( hMod, RT_RCDATA, resid, (void**) &readOnlyString); - - /* allow for 0-termination if user hasn't got it right */ - if( readOnlyString[ ulSize - 1] != '\0') - ulSize++; - - if( rc == NO_ERROR) - { - /* copy string & zero-terminate */ - string = (char*) PR_Malloc( ulSize); - memcpy( string, readOnlyString, ulSize - 1); - string[ ulSize - 1] = '\0'; - - DosFreeResource( readOnlyString); - } - } - - return string; -} - -/* Load a version string stored as RCDATA in a resource segment */ -/* Returned string needs to be PR_Free'd by caller */ -static char *LoadRCDATAVersion(HMODULE hMod, ULONG resid) -{ - APIRET rc; - ULONG ulSize = 0; - char *string = 0; - - rc = DosQueryResourceSize(hMod, RT_RCDATA, resid, &ulSize); - - // version info is should be 8 chars - if (rc == NO_ERROR && ulSize == 8) - { - char *version = NULL; - rc = DosGetResource(hMod, RT_RCDATA, resid, (void**) &version); - - if (rc == NO_ERROR) - { - string = PR_smprintf("%d.%d.%d.%d\n", - version[0], version[2], version[4], version[6]); - - DosFreeResource(version); - } - } - - return string; -} - -static uint32_t CalculateVariantCount(char* mimeTypes) -{ - uint32_t variants = 1; - - if(mimeTypes == nullptr) - return 0; - - char* index = mimeTypes; - while (*index) - { - if (*index == '|') - variants++; - - ++index; - } - return variants; -} - -static char** MakeStringArray(uint32_t variants, char* data) -{ - if((variants <= 0) || (data == nullptr)) - return nullptr; - - char ** array = (char **)PR_Calloc(variants, sizeof(char *)); - if(array == nullptr) - return nullptr; - - char * start = data; - for(uint32_t i = 0; i < variants; i++) - { - char * p = PL_strchr(start, '|'); - if(p != nullptr) - *p = 0; - - array[i] = PL_strdup(start); - start = ++p; - } - return array; -} - -static void FreeStringArray(uint32_t variants, char ** array) -{ - if((variants == 0) || (array == nullptr)) - return; - - for(uint32_t i = 0; i < variants; i++) - { - if(array[i] != nullptr) - { - PL_strfree(array[i]); - array[i] = nullptr; - } - } - PR_Free(array); -} - -// nsPluginsDir class - -bool nsPluginsDir::IsPluginFile(nsIFile* file) -{ - nsAutoCString leaf; - if (NS_FAILED(file->GetNativeLeafName(leaf))) - return false; - - const char *leafname = leaf.get(); - - if( nullptr != leafname) - { - int len = strlen( leafname); - if( len > 6 && // np*.dll - (0 == strnicmp( &(leafname[len - 4]), ".dll", 4)) && - (0 == strnicmp( leafname, "np", 2))) - { - return true; - } - } - return false; -} - -// nsPluginFile implementation - -nsPluginFile::nsPluginFile(nsIFile* file) -: mPlugin(file) -{} - -nsPluginFile::~nsPluginFile() -{} - -// Loads the plugin into memory using NSPR's shared-library loading -nsresult nsPluginFile::LoadPlugin(PRLibrary **outLibrary) -{ - if (!mPlugin) - return NS_ERROR_NULL_POINTER; - - nsAutoCString temp; - mPlugin->GetNativePath(temp); - - *outLibrary = PR_LoadLibrary(temp.get()); - return *outLibrary == nullptr ? NS_ERROR_FAILURE : NS_OK; -} - -// Obtains all of the information currently available for this plugin. -nsresult nsPluginFile::GetPluginInfo(nsPluginInfo &info, PRLibrary **outLibrary) -{ - *outLibrary = nullptr; - - nsresult rv = NS_ERROR_FAILURE; - HMODULE hPlug = 0; // Need a HMODULE to query resource statements - char failure[ CCHMAXPATH] = ""; - APIRET ret; - - nsAutoCString path; - if (NS_FAILED(rv = mPlugin->GetNativePath(path))) - return rv; - - nsAutoCString fileName; - if (NS_FAILED(rv = mPlugin->GetNativeLeafName(fileName))) - return rv; - - ret = DosLoadModule( failure, CCHMAXPATH, path.get(), &hPlug); - info.fVersion = nullptr; - - while( ret == NO_ERROR) - { - info.fName = LoadRCDATAString( hPlug, NP_INFO_ProductName); - - info.fVersion = LoadRCDATAVersion( hPlug, NP_INFO_ProductVersion); - - // get description (doesn't matter if it's missing)... - info.fDescription = LoadRCDATAString( hPlug, NP_INFO_FileDescription); - - char * mimeType = LoadRCDATAString( hPlug, NP_INFO_MIMEType); - if( nullptr == mimeType) break; - - char * mimeDescription = LoadRCDATAString( hPlug, NP_INFO_FileOpenName); - if( nullptr == mimeDescription) break; - - char * extensions = LoadRCDATAString( hPlug, NP_INFO_FileExtents); - if( nullptr == extensions) break; - - info.fVariantCount = CalculateVariantCount(mimeType); - - info.fMimeTypeArray = MakeStringArray(info.fVariantCount, mimeType); - if( info.fMimeTypeArray == nullptr) break; - - info.fMimeDescriptionArray = MakeStringArray(info.fVariantCount, mimeDescription); - if( nullptr == info.fMimeDescriptionArray) break; - - info.fExtensionArray = MakeStringArray(info.fVariantCount, extensions); - if( nullptr == info.fExtensionArray) break; - - info.fFullPath = PL_strdup(path.get()); - info.fFileName = PL_strdup(fileName.get()); - - rv = NS_OK; - break; - } - - if( 0 != hPlug) - DosFreeModule( hPlug); - - return rv; -} - -nsresult nsPluginFile::FreePluginInfo(nsPluginInfo& info) -{ - if(info.fName != nullptr) - PL_strfree(info.fName); - - if(info.fFullPath != nullptr) - PL_strfree(info.fFullPath); - - if(info.fFileName != nullptr) - PL_strfree(info.fFileName); - - if(info.fVersion != nullptr) - PL_strfree(info.fVersion); - - if(info.fDescription != nullptr) - PL_strfree(info.fDescription); - - if(info.fMimeTypeArray != nullptr) - FreeStringArray(info.fVariantCount, info.fMimeTypeArray); - - if(info.fMimeDescriptionArray != nullptr) - FreeStringArray(info.fVariantCount, info.fMimeDescriptionArray); - - if(info.fExtensionArray != nullptr) - FreeStringArray(info.fVariantCount, info.fExtensionArray); - - memset((void *)&info, 0, sizeof(info)); - - return NS_OK; -} diff --git a/dom/plugins/ipc/PluginLibrary.h b/dom/plugins/ipc/PluginLibrary.h index def54fca7..3cc8b94db 100644 --- a/dom/plugins/ipc/PluginLibrary.h +++ b/dom/plugins/ipc/PluginLibrary.h @@ -54,7 +54,7 @@ public: virtual nsresult NP_GetMIMEDescription(const char** mimeDesc) = 0; virtual nsresult NP_GetValue(void *future, NPPVariable aVariable, void *aValue, NPError* error) = 0; -#if defined(XP_WIN) || defined(XP_MACOSX) || defined(XP_OS2) +#if defined(XP_WIN) || defined(XP_MACOSX) virtual nsresult NP_GetEntryPoints(NPPluginFuncs* pFuncs, NPError* error) = 0; #endif virtual nsresult NPP_New(NPMIMEType pluginType, NPP instance, diff --git a/dom/plugins/ipc/PluginMessageUtils.h b/dom/plugins/ipc/PluginMessageUtils.h index 23da0f233..28b4d3d42 100644 --- a/dom/plugins/ipc/PluginMessageUtils.h +++ b/dom/plugins/ipc/PluginMessageUtils.h @@ -905,8 +905,6 @@ struct ParamTraits<NPCoordinateSpace> # include "mozilla/plugins/NPEventOSX.h" #elif defined(XP_WIN) # include "mozilla/plugins/NPEventWindows.h" -#elif defined(XP_OS2) -# error Sorry, OS/2 is not supported #elif defined(ANDROID) # include "mozilla/plugins/NPEventAndroid.h" #elif defined(XP_UNIX) diff --git a/dom/plugins/ipc/PluginModuleChild.cpp b/dom/plugins/ipc/PluginModuleChild.cpp index 1f15265e8..0c01f4ccb 100644 --- a/dom/plugins/ipc/PluginModuleChild.cpp +++ b/dom/plugins/ipc/PluginModuleChild.cpp @@ -786,168 +786,168 @@ namespace mozilla { namespace plugins { namespace child { -static NPError NP_CALLBACK +static NPError _requestread(NPStream *pstream, NPByteRange *rangeList); -static NPError NP_CALLBACK +static NPError _geturlnotify(NPP aNPP, const char* relativeURL, const char* target, void* notifyData); -static NPError NP_CALLBACK +static NPError _getvalue(NPP aNPP, NPNVariable variable, void *r_value); -static NPError NP_CALLBACK +static NPError _setvalue(NPP aNPP, NPPVariable variable, void *r_value); -static NPError NP_CALLBACK +static NPError _geturl(NPP aNPP, const char* relativeURL, const char* target); -static NPError NP_CALLBACK +static NPError _posturlnotify(NPP aNPP, const char* relativeURL, const char *target, uint32_t len, const char *buf, NPBool file, void* notifyData); -static NPError NP_CALLBACK +static NPError _posturl(NPP aNPP, const char* relativeURL, const char *target, uint32_t len, const char *buf, NPBool file); -static NPError NP_CALLBACK +static NPError _newstream(NPP aNPP, NPMIMEType type, const char* window, NPStream** pstream); -static int32_t NP_CALLBACK +static int32_t _write(NPP aNPP, NPStream *pstream, int32_t len, void *buffer); -static NPError NP_CALLBACK +static NPError _destroystream(NPP aNPP, NPStream *pstream, NPError reason); -static void NP_CALLBACK +static void _status(NPP aNPP, const char *message); -static void NP_CALLBACK +static void _memfree (void *ptr); -static uint32_t NP_CALLBACK +static uint32_t _memflush(uint32_t size); -static void NP_CALLBACK +static void _reloadplugins(NPBool reloadPages); -static void NP_CALLBACK +static void _invalidaterect(NPP aNPP, NPRect *invalidRect); -static void NP_CALLBACK +static void _invalidateregion(NPP aNPP, NPRegion invalidRegion); -static void NP_CALLBACK +static void _forceredraw(NPP aNPP); -static const char* NP_CALLBACK +static const char* _useragent(NPP aNPP); -static void* NP_CALLBACK +static void* _memalloc (uint32_t size); // Deprecated entry points for the old Java plugin. -static void* NP_CALLBACK /* OJI type: JRIEnv* */ +static void* /* OJI type: JRIEnv* */ _getjavaenv(void); // Deprecated entry points for the old Java plugin. -static void* NP_CALLBACK /* OJI type: jref */ +static void* /* OJI type: jref */ _getjavapeer(NPP aNPP); -static bool NP_CALLBACK +static bool _invoke(NPP aNPP, NPObject* npobj, NPIdentifier method, const NPVariant *args, uint32_t argCount, NPVariant *result); -static bool NP_CALLBACK +static bool _invokedefault(NPP aNPP, NPObject* npobj, const NPVariant *args, uint32_t argCount, NPVariant *result); -static bool NP_CALLBACK +static bool _evaluate(NPP aNPP, NPObject* npobj, NPString *script, NPVariant *result); -static bool NP_CALLBACK +static bool _getproperty(NPP aNPP, NPObject* npobj, NPIdentifier property, NPVariant *result); -static bool NP_CALLBACK +static bool _setproperty(NPP aNPP, NPObject* npobj, NPIdentifier property, const NPVariant *value); -static bool NP_CALLBACK +static bool _removeproperty(NPP aNPP, NPObject* npobj, NPIdentifier property); -static bool NP_CALLBACK +static bool _hasproperty(NPP aNPP, NPObject* npobj, NPIdentifier propertyName); -static bool NP_CALLBACK +static bool _hasmethod(NPP aNPP, NPObject* npobj, NPIdentifier methodName); -static bool NP_CALLBACK +static bool _enumerate(NPP aNPP, NPObject *npobj, NPIdentifier **identifier, uint32_t *count); -static bool NP_CALLBACK +static bool _construct(NPP aNPP, NPObject* npobj, const NPVariant *args, uint32_t argCount, NPVariant *result); -static void NP_CALLBACK +static void _releasevariantvalue(NPVariant *variant); -static void NP_CALLBACK +static void _setexception(NPObject* npobj, const NPUTF8 *message); -static void NP_CALLBACK +static void _pushpopupsenabledstate(NPP aNPP, NPBool enabled); -static void NP_CALLBACK +static void _poppopupsenabledstate(NPP aNPP); -static void NP_CALLBACK +static void _pluginthreadasynccall(NPP instance, PluginThreadCallback func, void *userData); -static NPError NP_CALLBACK +static NPError _getvalueforurl(NPP npp, NPNURLVariable variable, const char *url, char **value, uint32_t *len); -static NPError NP_CALLBACK +static NPError _setvalueforurl(NPP npp, NPNURLVariable variable, const char *url, const char *value, uint32_t len); -static NPError NP_CALLBACK +static NPError _getauthenticationinfo(NPP npp, const char *protocol, const char *host, int32_t port, const char *scheme, const char *realm, char **username, uint32_t *ulen, char **password, uint32_t *plen); -static uint32_t NP_CALLBACK +static uint32_t _scheduletimer(NPP instance, uint32_t interval, NPBool repeat, void (*timerFunc)(NPP npp, uint32_t timerID)); -static void NP_CALLBACK +static void _unscheduletimer(NPP instance, uint32_t timerID); -static NPError NP_CALLBACK +static NPError _popupcontextmenu(NPP instance, NPMenu* menu); -static NPBool NP_CALLBACK +static NPBool _convertpoint(NPP instance, double sourceX, double sourceY, NPCoordinateSpace sourceSpace, double *destX, double *destY, NPCoordinateSpace destSpace); -static void NP_CALLBACK +static void _urlredirectresponse(NPP instance, void* notifyData, NPBool allow); -static NPError NP_CALLBACK +static NPError _initasyncsurface(NPP instance, NPSize *size, NPImageFormat format, void *initData, NPAsyncSurface *surface); -static NPError NP_CALLBACK +static NPError _finalizeasyncsurface(NPP instance, NPAsyncSurface *surface); -static void NP_CALLBACK +static void _setcurrentasyncsurface(NPP instance, NPAsyncSurface *surface, NPRect *changed); } /* namespace child */ @@ -1028,7 +1028,7 @@ namespace mozilla { namespace plugins { namespace child { -NPError NP_CALLBACK +NPError _requestread(NPStream* aStream, NPByteRange* aRangeList) { @@ -1041,7 +1041,7 @@ _requestread(NPStream* aStream, return bs->NPN_RequestRead(aRangeList); } -NPError NP_CALLBACK +NPError _geturlnotify(NPP aNPP, const char* aRelativeURL, const char* aTarget, @@ -1069,7 +1069,7 @@ _geturlnotify(NPP aNPP, return err; } -NPError NP_CALLBACK +NPError _getvalue(NPP aNPP, NPNVariable aVariable, void* aValue) @@ -1125,7 +1125,7 @@ _getvalue(NPP aNPP, return NPERR_GENERIC_ERROR; } -NPError NP_CALLBACK +NPError _setvalue(NPP aNPP, NPPVariable aVariable, void* aValue) @@ -1135,7 +1135,7 @@ _setvalue(NPP aNPP, return InstCast(aNPP)->NPN_SetValue(aVariable, aValue); } -NPError NP_CALLBACK +NPError _geturl(NPP aNPP, const char* aRelativeURL, const char* aTarget) @@ -1149,7 +1149,7 @@ _geturl(NPP aNPP, return err; } -NPError NP_CALLBACK +NPError _posturlnotify(NPP aNPP, const char* aRelativeURL, const char* aTarget, @@ -1181,7 +1181,7 @@ _posturlnotify(NPP aNPP, return err; } -NPError NP_CALLBACK +NPError _posturl(NPP aNPP, const char* aRelativeURL, const char* aTarget, @@ -1201,7 +1201,7 @@ _posturl(NPP aNPP, return err; } -NPError NP_CALLBACK +NPError _newstream(NPP aNPP, NPMIMEType aMIMEType, const char* aWindow, @@ -1212,7 +1212,7 @@ _newstream(NPP aNPP, return InstCast(aNPP)->NPN_NewStream(aMIMEType, aWindow, aStream); } -int32_t NP_CALLBACK +int32_t _write(NPP aNPP, NPStream* aStream, int32_t aLength, @@ -1228,7 +1228,7 @@ _write(NPP aNPP, return ps->NPN_Write(aLength, aBuffer); } -NPError NP_CALLBACK +NPError _destroystream(NPP aNPP, NPStream* aStream, NPError aReason) @@ -1251,7 +1251,7 @@ _destroystream(NPP aNPP, return NPERR_NO_ERROR; } -void NP_CALLBACK +void _status(NPP aNPP, const char* aMessage) { @@ -1260,7 +1260,7 @@ _status(NPP aNPP, NS_WARNING("Not yet implemented!"); } -void NP_CALLBACK +void _memfree(void* aPtr) { PLUGIN_LOG_DEBUG_FUNCTION; @@ -1269,7 +1269,7 @@ _memfree(void* aPtr) NS_Free(aPtr); } -uint32_t NP_CALLBACK +uint32_t _memflush(uint32_t aSize) { PLUGIN_LOG_DEBUG_FUNCTION; @@ -1278,7 +1278,7 @@ _memflush(uint32_t aSize) return 0; } -void NP_CALLBACK +void _reloadplugins(NPBool aReloadPages) { PLUGIN_LOG_DEBUG_FUNCTION; @@ -1287,7 +1287,7 @@ _reloadplugins(NPBool aReloadPages) PluginModuleChild::current()->SendNPN_ReloadPlugins(!!aReloadPages); } -void NP_CALLBACK +void _invalidaterect(NPP aNPP, NPRect* aInvalidRect) { @@ -1299,7 +1299,7 @@ _invalidaterect(NPP aNPP, } } -void NP_CALLBACK +void _invalidateregion(NPP aNPP, NPRegion aInvalidRegion) { @@ -1308,7 +1308,7 @@ _invalidateregion(NPP aNPP, NS_WARNING("Not yet implemented!"); } -void NP_CALLBACK +void _forceredraw(NPP aNPP) { PLUGIN_LOG_DEBUG_FUNCTION; @@ -1318,7 +1318,7 @@ _forceredraw(NPP aNPP) // never be necessary. } -const char* NP_CALLBACK +const char* _useragent(NPP aNPP) { PLUGIN_LOG_DEBUG_FUNCTION; @@ -1326,7 +1326,7 @@ _useragent(NPP aNPP) return PluginModuleChild::current()->GetUserAgent(); } -void* NP_CALLBACK +void* _memalloc(uint32_t aSize) { PLUGIN_LOG_DEBUG_FUNCTION; @@ -1336,21 +1336,21 @@ _memalloc(uint32_t aSize) } // Deprecated entry points for the old Java plugin. -void* NP_CALLBACK /* OJI type: JRIEnv* */ +void* /* OJI type: JRIEnv* */ _getjavaenv(void) { PLUGIN_LOG_DEBUG_FUNCTION; return 0; } -void* NP_CALLBACK /* OJI type: jref */ +void* /* OJI type: jref */ _getjavapeer(NPP aNPP) { PLUGIN_LOG_DEBUG_FUNCTION; return 0; } -bool NP_CALLBACK +bool _invoke(NPP aNPP, NPObject* aNPObj, NPIdentifier aMethod, @@ -1367,7 +1367,7 @@ _invoke(NPP aNPP, return aNPObj->_class->invoke(aNPObj, aMethod, aArgs, aArgCount, aResult); } -bool NP_CALLBACK +bool _invokedefault(NPP aNPP, NPObject* aNPObj, const NPVariant* aArgs, @@ -1383,7 +1383,7 @@ _invokedefault(NPP aNPP, return aNPObj->_class->invokeDefault(aNPObj, aArgs, aArgCount, aResult); } -bool NP_CALLBACK +bool _evaluate(NPP aNPP, NPObject* aObject, NPString* aScript, @@ -1414,7 +1414,7 @@ _evaluate(NPP aNPP, return actor->Evaluate(aScript, aResult); } -bool NP_CALLBACK +bool _getproperty(NPP aNPP, NPObject* aNPObj, NPIdentifier aPropertyName, @@ -1429,7 +1429,7 @@ _getproperty(NPP aNPP, return aNPObj->_class->getProperty(aNPObj, aPropertyName, aResult); } -bool NP_CALLBACK +bool _setproperty(NPP aNPP, NPObject* aNPObj, NPIdentifier aPropertyName, @@ -1444,7 +1444,7 @@ _setproperty(NPP aNPP, return aNPObj->_class->setProperty(aNPObj, aPropertyName, aValue); } -bool NP_CALLBACK +bool _removeproperty(NPP aNPP, NPObject* aNPObj, NPIdentifier aPropertyName) @@ -1458,7 +1458,7 @@ _removeproperty(NPP aNPP, return aNPObj->_class->removeProperty(aNPObj, aPropertyName); } -bool NP_CALLBACK +bool _hasproperty(NPP aNPP, NPObject* aNPObj, NPIdentifier aPropertyName) @@ -1472,7 +1472,7 @@ _hasproperty(NPP aNPP, return aNPObj->_class->hasProperty(aNPObj, aPropertyName); } -bool NP_CALLBACK +bool _hasmethod(NPP aNPP, NPObject* aNPObj, NPIdentifier aMethodName) @@ -1486,7 +1486,7 @@ _hasmethod(NPP aNPP, return aNPObj->_class->hasMethod(aNPObj, aMethodName); } -bool NP_CALLBACK +bool _enumerate(NPP aNPP, NPObject* aNPObj, NPIdentifier** aIdentifiers, @@ -1508,7 +1508,7 @@ _enumerate(NPP aNPP, return aNPObj->_class->enumerate(aNPObj, aIdentifiers, aCount); } -bool NP_CALLBACK +bool _construct(NPP aNPP, NPObject* aNPObj, const NPVariant* aArgs, @@ -1527,7 +1527,7 @@ _construct(NPP aNPP, return aNPObj->_class->construct(aNPObj, aArgs, aArgCount, aResult); } -void NP_CALLBACK +void _releasevariantvalue(NPVariant* aVariant) { PLUGIN_LOG_DEBUG_FUNCTION; @@ -1547,7 +1547,7 @@ _releasevariantvalue(NPVariant* aVariant) VOID_TO_NPVARIANT(*aVariant); } -void NP_CALLBACK +void _setexception(NPObject* aNPObj, const NPUTF8* aMessage) { @@ -1568,7 +1568,7 @@ _setexception(NPObject* aNPObj, NullableString(aMessage)); } -void NP_CALLBACK +void _pushpopupsenabledstate(NPP aNPP, NPBool aEnabled) { @@ -1578,7 +1578,7 @@ _pushpopupsenabledstate(NPP aNPP, InstCast(aNPP)->CallNPN_PushPopupsEnabledState(aEnabled ? true : false); } -void NP_CALLBACK +void _poppopupsenabledstate(NPP aNPP) { PLUGIN_LOG_DEBUG_FUNCTION; @@ -1587,7 +1587,7 @@ _poppopupsenabledstate(NPP aNPP) InstCast(aNPP)->CallNPN_PopPopupsEnabledState(); } -void NP_CALLBACK +void _pluginthreadasynccall(NPP aNPP, PluginThreadCallback aFunc, void* aUserData) @@ -1599,7 +1599,7 @@ _pluginthreadasynccall(NPP aNPP, InstCast(aNPP)->AsyncCall(aFunc, aUserData); } -NPError NP_CALLBACK +NPError _getvalueforurl(NPP npp, NPNURLVariable variable, const char *url, char **value, uint32_t *len) { @@ -1629,7 +1629,7 @@ _getvalueforurl(NPP npp, NPNURLVariable variable, const char *url, return NPERR_INVALID_PARAM; } -NPError NP_CALLBACK +NPError _setvalueforurl(NPP npp, NPNURLVariable variable, const char *url, const char *value, uint32_t len) { @@ -1655,7 +1655,7 @@ _setvalueforurl(NPP npp, NPNURLVariable variable, const char *url, return NPERR_INVALID_PARAM; } -NPError NP_CALLBACK +NPError _getauthenticationinfo(NPP npp, const char *protocol, const char *host, int32_t port, const char *scheme, const char *realm, @@ -1688,7 +1688,7 @@ _getauthenticationinfo(NPP npp, const char *protocol, return result; } -uint32_t NP_CALLBACK +uint32_t _scheduletimer(NPP npp, uint32_t interval, NPBool repeat, void (*timerFunc)(NPP npp, uint32_t timerID)) { @@ -1697,7 +1697,7 @@ _scheduletimer(NPP npp, uint32_t interval, NPBool repeat, return InstCast(npp)->ScheduleTimer(interval, repeat, timerFunc); } -void NP_CALLBACK +void _unscheduletimer(NPP npp, uint32_t timerID) { PLUGIN_LOG_DEBUG_FUNCTION; @@ -1717,7 +1717,7 @@ static void ProcessBrowserEvents(void* pluginModule) { } #endif -NPError NP_CALLBACK +NPError _popupcontextmenu(NPP instance, NPMenu* menu) { PLUGIN_LOG_DEBUG_FUNCTION; @@ -1768,7 +1768,7 @@ _popupcontextmenu(NPP instance, NPMenu* menu) #endif } -NPBool NP_CALLBACK +NPBool _convertpoint(NPP instance, double sourceX, double sourceY, NPCoordinateSpace sourceSpace, double *destX, double *destY, NPCoordinateSpace destSpace) @@ -1796,13 +1796,13 @@ _convertpoint(NPP instance, return result; } -void NP_CALLBACK +void _urlredirectresponse(NPP instance, void* notifyData, NPBool allow) { InstCast(instance)->NPN_URLRedirectResponse(notifyData, allow); } -NPError NP_CALLBACK +NPError _initasyncsurface(NPP instance, NPSize *size, NPImageFormat format, void *initData, NPAsyncSurface *surface) @@ -1810,13 +1810,13 @@ _initasyncsurface(NPP instance, NPSize *size, return InstCast(instance)->NPN_InitAsyncSurface(size, format, initData, surface); } -NPError NP_CALLBACK +NPError _finalizeasyncsurface(NPP instance, NPAsyncSurface *surface) { return InstCast(instance)->NPN_FinalizeAsyncSurface(surface); } -void NP_CALLBACK +void _setcurrentasyncsurface(NPP instance, NPAsyncSurface *surface, NPRect *changed) { InstCast(instance)->NPN_SetCurrentAsyncSurface(surface, changed); @@ -2086,7 +2086,7 @@ PluginModuleChild::DeallocPPluginInstance(PPluginInstanceChild* aActor) return true; } -NPObject* NP_CALLBACK +NPObject* PluginModuleChild::NPN_CreateObject(NPP aNPP, NPClass* aClass) { PLUGIN_LOG_DEBUG_FUNCTION; @@ -2120,7 +2120,7 @@ PluginModuleChild::NPN_CreateObject(NPP aNPP, NPClass* aClass) return newObject; } -NPObject* NP_CALLBACK +NPObject* PluginModuleChild::NPN_RetainObject(NPObject* aNPObj) { AssertPluginThread(); @@ -2134,7 +2134,7 @@ PluginModuleChild::NPN_RetainObject(NPObject* aNPObj) return aNPObj; } -void NP_CALLBACK +void PluginModuleChild::NPN_ReleaseObject(NPObject* aNPObj) { AssertPluginThread(); @@ -2201,7 +2201,7 @@ PluginModuleChild::CollectForInstance(NPObjectData* d, void* userArg) return PL_DHASH_NEXT; } -NPIdentifier NP_CALLBACK +NPIdentifier PluginModuleChild::NPN_GetStringIdentifier(const NPUTF8* aName) { PLUGIN_LOG_DEBUG_FUNCTION; @@ -2224,7 +2224,7 @@ PluginModuleChild::NPN_GetStringIdentifier(const NPUTF8* aName) return ident; } -void NP_CALLBACK +void PluginModuleChild::NPN_GetStringIdentifiers(const NPUTF8** aNames, int32_t aNameCount, NPIdentifier* aIdentifiers) @@ -2256,7 +2256,7 @@ PluginModuleChild::NPN_GetStringIdentifiers(const NPUTF8** aNames, } } -bool NP_CALLBACK +bool PluginModuleChild::NPN_IdentifierIsString(NPIdentifier aIdentifier) { PLUGIN_LOG_DEBUG_FUNCTION; @@ -2266,7 +2266,7 @@ PluginModuleChild::NPN_IdentifierIsString(NPIdentifier aIdentifier) return ident->IsString(); } -NPIdentifier NP_CALLBACK +NPIdentifier PluginModuleChild::NPN_GetIntIdentifier(int32_t aIntId) { PLUGIN_LOG_DEBUG_FUNCTION; @@ -2286,7 +2286,7 @@ PluginModuleChild::NPN_GetIntIdentifier(int32_t aIntId) return ident; } -NPUTF8* NP_CALLBACK +NPUTF8* PluginModuleChild::NPN_UTF8FromIdentifier(NPIdentifier aIdentifier) { PLUGIN_LOG_DEBUG_FUNCTION; @@ -2297,7 +2297,7 @@ PluginModuleChild::NPN_UTF8FromIdentifier(NPIdentifier aIdentifier) return nullptr; } -int32_t NP_CALLBACK +int32_t PluginModuleChild::NPN_IntFromIdentifier(NPIdentifier aIdentifier) { PLUGIN_LOG_DEBUG_FUNCTION; diff --git a/dom/plugins/ipc/PluginModuleChild.h b/dom/plugins/ipc/PluginModuleChild.h index d47a6bd40..048dbe860 100644 --- a/dom/plugins/ipc/PluginModuleChild.h +++ b/dom/plugins/ipc/PluginModuleChild.h @@ -34,18 +34,8 @@ // NOTE: stolen from nsNPAPIPlugin.h -/* - * Use this macro before each exported function - * (between the return address and the function - * itself), to ensure that the function has the - * right calling conventions on OS/2. - */ -#define NP_CALLBACK NP_LOADDS - #if defined(XP_WIN) #define NS_NPAPIPLUGIN_CALLBACK(_type, _name) _type (__stdcall * _name) -#elif defined(XP_OS2) -#define NS_NPAPIPLUGIN_CALLBACK(_type, _name) _type (_System * _name) #else #define NS_NPAPIPLUGIN_CALLBACK(_type, _name) _type (* _name) #endif @@ -197,27 +187,27 @@ public: /** * The child implementation of NPN_CreateObject. */ - static NPObject* NP_CALLBACK NPN_CreateObject(NPP aNPP, NPClass* aClass); + static NPObject* NPN_CreateObject(NPP aNPP, NPClass* aClass); /** * The child implementation of NPN_RetainObject. */ - static NPObject* NP_CALLBACK NPN_RetainObject(NPObject* aNPObj); + static NPObject* NPN_RetainObject(NPObject* aNPObj); /** * The child implementation of NPN_ReleaseObject. */ - static void NP_CALLBACK NPN_ReleaseObject(NPObject* aNPObj); + static void NPN_ReleaseObject(NPObject* aNPObj); /** * The child implementations of NPIdentifier-related functions. */ - static NPIdentifier NP_CALLBACK NPN_GetStringIdentifier(const NPUTF8* aName); - static void NP_CALLBACK NPN_GetStringIdentifiers(const NPUTF8** aNames, + static NPIdentifier NPN_GetStringIdentifier(const NPUTF8* aName); + static void NPN_GetStringIdentifiers(const NPUTF8** aNames, int32_t aNameCount, NPIdentifier* aIdentifiers); - static NPIdentifier NP_CALLBACK NPN_GetIntIdentifier(int32_t aIntId); - static bool NP_CALLBACK NPN_IdentifierIsString(NPIdentifier aIdentifier); - static NPUTF8* NP_CALLBACK NPN_UTF8FromIdentifier(NPIdentifier aIdentifier); - static int32_t NP_CALLBACK NPN_IntFromIdentifier(NPIdentifier aIdentifier); + static NPIdentifier NPN_GetIntIdentifier(int32_t aIntId); + static bool NPN_IdentifierIsString(NPIdentifier aIdentifier); + static NPUTF8* NPN_UTF8FromIdentifier(NPIdentifier aIdentifier); + static int32_t NPN_IntFromIdentifier(NPIdentifier aIdentifier); #ifdef MOZ_WIDGET_COCOA void ProcessNativeEvents(); diff --git a/dom/plugins/ipc/PluginModuleParent.cpp b/dom/plugins/ipc/PluginModuleParent.cpp index 44661cdda..d800d440f 100644 --- a/dom/plugins/ipc/PluginModuleParent.cpp +++ b/dom/plugins/ipc/PluginModuleParent.cpp @@ -1285,7 +1285,7 @@ PluginModuleParent::NP_GetValue(void *future, NPPVariable aVariable, return NS_OK; } -#if defined(XP_WIN) || defined(XP_MACOSX) || defined(XP_OS2) +#if defined(XP_WIN) || defined(XP_MACOSX) nsresult PluginModuleParent::NP_GetEntryPoints(NPPluginFuncs* pFuncs, NPError* error) { diff --git a/dom/plugins/ipc/PluginModuleParent.h b/dom/plugins/ipc/PluginModuleParent.h index ea4aac98e..bcb333ebf 100644 --- a/dom/plugins/ipc/PluginModuleParent.h +++ b/dom/plugins/ipc/PluginModuleParent.h @@ -269,7 +269,7 @@ private: virtual nsresult NP_GetMIMEDescription(const char** mimeDesc); virtual nsresult NP_GetValue(void *future, NPPVariable aVariable, void *aValue, NPError* error); -#if defined(XP_WIN) || defined(XP_MACOSX) || defined(XP_OS2) +#if defined(XP_WIN) || defined(XP_MACOSX) virtual nsresult NP_GetEntryPoints(NPPluginFuncs* pFuncs, NPError* error); #endif virtual nsresult NPP_New(NPMIMEType pluginType, NPP instance, diff --git a/dom/plugins/test/testplugin/nptest.cpp b/dom/plugins/test/testplugin/nptest.cpp index f52937e87..3a8df0514 100644 --- a/dom/plugins/test/testplugin/nptest.cpp +++ b/dom/plugins/test/testplugin/nptest.cpp @@ -647,7 +647,7 @@ extern const char *sMimeDescription; #if defined(XP_UNIX) NP_EXPORT(const char*) NP_GetMIMEDescription() -#elif defined(XP_WIN) || defined(XP_OS2) +#elif defined(XP_WIN) const char* NP_GetMIMEDescription() #endif { @@ -701,7 +701,7 @@ static bool fillPluginFunctionTable(NPPluginFuncs* pFuncs) #if defined(XP_MACOSX) NP_EXPORT(NPError) NP_Initialize(NPNetscapeFuncs* bFuncs) -#elif defined(XP_WIN) || defined(XP_OS2) +#elif defined(XP_WIN) NPError OSCALL NP_Initialize(NPNetscapeFuncs* bFuncs) #elif defined(XP_UNIX) NP_EXPORT(NPError) NP_Initialize(NPNetscapeFuncs* bFuncs, NPPluginFuncs* pFuncs) @@ -741,10 +741,10 @@ NP_EXPORT(NPError) NP_Initialize(NPNetscapeFuncs* bFuncs, NPPluginFuncs* pFuncs) #if defined(XP_MACOSX) NP_EXPORT(NPError) NP_GetEntryPoints(NPPluginFuncs* pFuncs) -#elif defined(XP_WIN) || defined(XP_OS2) +#elif defined(XP_WIN) NPError OSCALL NP_GetEntryPoints(NPPluginFuncs* pFuncs) #endif -#if defined(XP_MACOSX) || defined(XP_WIN) || defined(XP_OS2) +#if defined(XP_MACOSX) || defined(XP_WIN) { if (!fillPluginFunctionTable(pFuncs)) { return NPERR_INVALID_FUNCTABLE_ERROR; @@ -756,7 +756,7 @@ NPError OSCALL NP_GetEntryPoints(NPPluginFuncs* pFuncs) #if defined(XP_UNIX) NP_EXPORT(NPError) NP_Shutdown() -#elif defined(XP_WIN) || defined(XP_OS2) +#elif defined(XP_WIN) NPError OSCALL NP_Shutdown() #endif { diff --git a/dom/plugins/test/testplugin/nptest_os2.cpp b/dom/plugins/test/testplugin/nptest_os2.cpp deleted file mode 100644 index 041d1001c..000000000 --- a/dom/plugins/test/testplugin/nptest_os2.cpp +++ /dev/null @@ -1,105 +0,0 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * - * Copyright (c) 2008, Mozilla Corporation - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * * Neither the name of the Mozilla Corporation nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Contributor(s): - * Josh Aas <josh@mozilla.com> - * - * ***** END LICENSE BLOCK ***** */ - -#include "nptest_platform.h" - - using namespace std; - -bool -pluginSupportsWindowMode() -{ - return false; -} - -bool -pluginSupportsWindowlessMode() -{ - return true; -} - -bool -pluginSupportsAsyncBitmapDrawing() -{ - return false; -} - -NPError -pluginInstanceInit(InstanceData* instanceData) -{ - return NPERR_NO_ERROR; -} - -void -pluginInstanceShutdown(InstanceData* instanceData) -{ -} - -void -pluginDoSetWindow(InstanceData* instanceData, NPWindow* newWindow) -{ - instanceData->window = *newWindow; -} - -void -pluginWidgetInit(InstanceData* instanceData, void* oldWindow) -{ -} - -int16_t -pluginHandleEvent(InstanceData* instanceData, void* event) -{ - return 0; -} - -int32_t pluginGetEdge(InstanceData* instanceData, RectEdge edge) -{ - // XXX nothing here yet since we don't support windowed plugins - return NPTEST_INT32_ERROR; -} - -int32_t pluginGetClipRegionRectCount(InstanceData* instanceData) -{ - // XXX nothing here yet since we don't support windowed plugins - return NPTEST_INT32_ERROR; -} - -int32_t pluginGetClipRegionRectEdge(InstanceData* instanceData, - int32_t rectIndex, RectEdge edge) -{ - // XXX nothing here yet since we don't support windowed plugins - return NPTEST_INT32_ERROR; -} - -void pluginDoInternalConsistencyCheck(InstanceData* instanceData, string& error) -{ -} diff --git a/dom/plugins/test/testplugin/testplugin.mk b/dom/plugins/test/testplugin/testplugin.mk index 96642b9f2..2e40a6e56 100644 --- a/dom/plugins/test/testplugin/testplugin.mk +++ b/dom/plugins/test/testplugin/testplugin.mk @@ -35,10 +35,6 @@ ifeq ($(MOZ_WIDGET_TOOLKIT),android) CPPSRCS += $(RELATIVE_PATH)/nptest_droid.cpp endif -ifeq ($(MOZ_WIDGET_TOOLKIT),os2) -CPPSRCS += $(RELATIVE_PATH)/nptest_os2.cpp -endif - ifeq ($(MOZ_WIDGET_TOOLKIT),qt) CPPSRCS += $(RELATIVE_PATH)/nptest_qt.cpp include $(topsrcdir)/config/config.mk diff --git a/editor/libeditor/html/nsHTMLEditorEventListener.cpp b/editor/libeditor/html/nsHTMLEditorEventListener.cpp index e6eda3ab6..b3453a9f8 100644 --- a/editor/libeditor/html/nsHTMLEditorEventListener.cpp +++ b/editor/libeditor/html/nsHTMLEditorEventListener.cpp @@ -204,9 +204,7 @@ nsHTMLEditorEventListener::MouseDown(nsIDOMEvent* aMouseEvent) // for all context clicks if (element || isContextClick) { - #ifndef XP_OS2 mouseEvent->PreventDefault(); - #endif return NS_OK; } } diff --git a/embedding/browser/webBrowser/nsIPrintingPrompt.idl b/embedding/browser/webBrowser/nsIPrintingPrompt.idl index 08b8da6f8..0e346ce59 100644 --- a/embedding/browser/webBrowser/nsIPrintingPrompt.idl +++ b/embedding/browser/webBrowser/nsIPrintingPrompt.idl @@ -92,15 +92,6 @@ interface nsIPrintingPrompt : nsISupports * showProgress - displays a XUL dialog * showPrinterProperties - displays a XUL dialog * - * OS2: - * - * Defaults for platform service: - * showPrintDialog - displays a XUL dialog - * showPageSetup - displays a XUL dialog - * showProgress - displays a XUL dialog - * showPrinterProperties - displays a native dialog - * - * */ diff --git a/embedding/browser/webBrowser/nsIPrintingPromptService.idl b/embedding/browser/webBrowser/nsIPrintingPromptService.idl index 63a7886ab..b97052043 100644 --- a/embedding/browser/webBrowser/nsIPrintingPromptService.idl +++ b/embedding/browser/webBrowser/nsIPrintingPromptService.idl @@ -88,15 +88,6 @@ interface nsIPrintingPromptService : nsISupports * showProgress - displays a XUL dialog * showPrinterProperties - displays a XUL dialog * - * OS2: - * - * Defaults for platform service: - * showPrintDialog - displays a XUL dialog - * showPageSetup - displays a XUL dialog - * showProgress - displays a XUL dialog - * showPrinterProperties - displays a native dialog - * - * */ diff --git a/embedding/components/build/Makefile.in b/embedding/components/build/Makefile.in index aefb05e74..656f38398 100644 --- a/embedding/components/build/Makefile.in +++ b/embedding/components/build/Makefile.in @@ -38,10 +38,6 @@ LOCAL_INCLUDES = \ -I$(srcdir)/../commandhandler/src \ $(NULL) -ifeq ($(MOZ_WIDGET_TOOLKIT),os2) -LOCAL_INCLUDES += -I$(srcdir)/../printingui/src/os2 -endif - ifdef MOZ_PDF_PRINTING LOCAL_INCLUDES += -I$(srcdir)/../printingui/src/unixshared endif diff --git a/embedding/components/printingui/src/moz.build b/embedding/components/printingui/src/moz.build index a7588782f..760fa9a2b 100644 --- a/embedding/components/printingui/src/moz.build +++ b/embedding/components/printingui/src/moz.build @@ -6,9 +6,7 @@ toolkit = CONFIG['MOZ_WIDGET_TOOLKIT'] -if toolkit == 'os2': - DIRS += ['os2'] -elif toolkit == 'windows': +if toolkit == 'windows': DIRS += ['win'] elif toolkit == 'cocoa': DIRS += ['mac'] diff --git a/embedding/components/printingui/src/os2/Makefile.in b/embedding/components/printingui/src/os2/Makefile.in deleted file mode 100644 index e710e153d..000000000 --- a/embedding/components/printingui/src/os2/Makefile.in +++ /dev/null @@ -1,21 +0,0 @@ -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -DEPTH = @DEPTH@ -topsrcdir = @top_srcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ - -include $(DEPTH)/config/autoconf.mk - -EXPORT_LIBRARY = .. -LIBXUL_LIBRARY = 1 - -# we don't want the shared lib, but we want to force the creation of a -# static lib. -FORCE_STATIC_LIB = 1 - -include $(topsrcdir)/config/rules.mk - diff --git a/embedding/components/printingui/src/os2/moz.build b/embedding/components/printingui/src/os2/moz.build deleted file mode 100644 index e1747e7c8..000000000 --- a/embedding/components/printingui/src/os2/moz.build +++ /dev/null @@ -1,16 +0,0 @@ -# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*- -# vim: set filetype=python: -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -MODULE = 'embedcomponents' - -CPP_SOURCES += [ - 'nsPrintProgress.cpp', - 'nsPrintProgressParams.cpp', - 'nsPrintingPromptService.cpp', -] - -LIBRARY_NAME = 'printingui_s' - diff --git a/embedding/components/printingui/src/os2/nsPrintProgress.cpp b/embedding/components/printingui/src/os2/nsPrintProgress.cpp deleted file mode 100644 index 969a6bf4d..000000000 --- a/embedding/components/printingui/src/os2/nsPrintProgress.cpp +++ /dev/null @@ -1,254 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "nsPrintProgress.h" - -#include "nsIBaseWindow.h" -#include "nsISupportsArray.h" -#include "nsXPCOM.h" -#include "nsISupportsPrimitives.h" -#include "nsIComponentManager.h" - -NS_IMPL_THREADSAFE_ADDREF(nsPrintProgress) -NS_IMPL_THREADSAFE_RELEASE(nsPrintProgress) - -NS_INTERFACE_MAP_BEGIN(nsPrintProgress) - NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIPrintStatusFeedback) - NS_INTERFACE_MAP_ENTRY(nsIPrintProgress) - NS_INTERFACE_MAP_ENTRY(nsIPrintStatusFeedback) - NS_INTERFACE_MAP_ENTRY(nsIWebProgressListener) -NS_INTERFACE_MAP_END_THREADSAFE - - -nsPrintProgress::nsPrintProgress() -{ - m_closeProgress = false; - m_processCanceled = false; - m_pendingStateFlags = -1; - m_pendingStateValue = 0; -} - -nsPrintProgress::~nsPrintProgress() -{ - (void)ReleaseListeners(); -} - -/* void openProgressDialog (in nsIDOMWindow parent, in string dialogURL, in nsISupports parameters); */ -NS_IMETHODIMP nsPrintProgress::OpenProgressDialog(nsIDOMWindow *parent, - const char *dialogURL, - nsISupports *parameters, - nsIObserver *openDialogObserver, - bool *notifyOnOpen) -{ - *notifyOnOpen = true; - m_observer = openDialogObserver; - nsresult rv = NS_ERROR_FAILURE; - - if (m_dialog) - return NS_ERROR_ALREADY_INITIALIZED; - - if (!dialogURL || !*dialogURL) - return NS_ERROR_INVALID_ARG; - - if (parent) - { - // Set up window.arguments[0]... - nsCOMPtr<nsISupportsArray> array; - rv = NS_NewISupportsArray(getter_AddRefs(array)); - NS_ENSURE_SUCCESS(rv, rv); - - nsCOMPtr<nsISupportsInterfacePointer> ifptr = - do_CreateInstance(NS_SUPPORTS_INTERFACE_POINTER_CONTRACTID, &rv); - NS_ENSURE_SUCCESS(rv, rv); - - ifptr->SetData(static_cast<nsIPrintProgress*>(this)); - ifptr->SetDataIID(&NS_GET_IID(nsIPrintProgress)); - - array->AppendElement(ifptr); - - array->AppendElement(parameters); - - // Open the dialog. - nsCOMPtr<nsIDOMWindow> newWindow; - rv = parent->OpenDialog(NS_ConvertASCIItoUTF16(dialogURL), - NS_LITERAL_STRING("_blank"), - NS_LITERAL_STRING("chrome,titlebar,dependent,centerscreen"), - array, getter_AddRefs(newWindow)); - } - - return rv; -} - -/* void closeProgressDialog (in boolean forceClose); */ -NS_IMETHODIMP nsPrintProgress::CloseProgressDialog(bool forceClose) -{ - m_closeProgress = true; - return OnStateChange(nullptr, nullptr, nsIWebProgressListener::STATE_STOP, forceClose); -} - -/* nsIPrompt GetPrompter (); */ -NS_IMETHODIMP nsPrintProgress::GetPrompter(nsIPrompt **_retval) -{ - NS_ENSURE_ARG_POINTER(_retval); - *_retval = nullptr; - - if (! m_closeProgress && m_dialog) - return m_dialog->GetPrompter(_retval); - - return NS_ERROR_FAILURE; -} - -/* attribute boolean processCanceledByUser; */ -NS_IMETHODIMP nsPrintProgress::GetProcessCanceledByUser(bool *aProcessCanceledByUser) -{ - NS_ENSURE_ARG_POINTER(aProcessCanceledByUser); - *aProcessCanceledByUser = m_processCanceled; - return NS_OK; -} -NS_IMETHODIMP nsPrintProgress::SetProcessCanceledByUser(bool aProcessCanceledByUser) -{ - m_processCanceled = aProcessCanceledByUser; - OnStateChange(nullptr, nullptr, nsIWebProgressListener::STATE_STOP, false); - return NS_OK; -} - -/* void RegisterListener (in nsIWebProgressListener listener); */ -NS_IMETHODIMP nsPrintProgress::RegisterListener(nsIWebProgressListener * listener) -{ - if (!listener) //Nothing to do with a null listener! - return NS_OK; - - m_listenerList.AppendObject(listener); - if (m_closeProgress || m_processCanceled) - listener->OnStateChange(nullptr, nullptr, nsIWebProgressListener::STATE_STOP, 0); - else - { - listener->OnStatusChange(nullptr, nullptr, 0, m_pendingStatus.get()); - if (m_pendingStateFlags != -1) - listener->OnStateChange(nullptr, nullptr, m_pendingStateFlags, m_pendingStateValue); - } - - return NS_OK; -} - -/* void UnregisterListener (in nsIWebProgressListener listener); */ -NS_IMETHODIMP nsPrintProgress::UnregisterListener(nsIWebProgressListener *listener) -{ - if (listener) - m_listenerList.RemoveObject(listener); - - return NS_OK; -} - -/* void doneIniting (); */ -NS_IMETHODIMP nsPrintProgress::DoneIniting() -{ - if (m_observer) { - m_observer->Observe(nullptr, nullptr, nullptr); - } - return NS_OK; -} - -/* void onStateChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in unsigned long aStateFlags, in nsresult aStatus); */ -NS_IMETHODIMP nsPrintProgress::OnStateChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, uint32_t aStateFlags, nsresult aStatus) -{ - m_pendingStateFlags = aStateFlags; - m_pendingStateValue = aStatus; - - uint32_t count = m_listenerList.Count(); - for (uint32_t i = count - 1; i < count; i --) - { - nsCOMPtr<nsIWebProgressListener> progressListener = m_listenerList.SafeObjectAt(i); - if (progressListener) - progressListener->OnStateChange(aWebProgress, aRequest, aStateFlags, aStatus); - } - - return NS_OK; -} - -/* void onProgressChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in long aCurSelfProgress, in long aMaxSelfProgress, in long aCurTotalProgress, in long aMaxTotalProgress); */ -NS_IMETHODIMP nsPrintProgress::OnProgressChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, int32_t aCurSelfProgress, int32_t aMaxSelfProgress, int32_t aCurTotalProgress, int32_t aMaxTotalProgress) -{ - uint32_t count = m_listenerList.Count(); - for (uint32_t i = count - 1; i < count; i --) - { - nsCOMPtr<nsIWebProgressListener> progressListener = m_listenerList.safeObjectAt(i); - if (progressListener) - progressListener->OnProgressChange(aWebProgress, aRequest, aCurSelfProgress, aMaxSelfProgress, aCurTotalProgress, aMaxTotalProgress); - } - - return NS_OK; -} - -/* void onLocationChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsIURI location, in unsigned long aFlags); */ -NS_IMETHODIMP nsPrintProgress::OnLocationChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsIURI *location, uint32_t aFlags) -{ - return NS_OK; -} - -/* void onStatusChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsresult aStatus, in wstring aMessage); */ -NS_IMETHODIMP nsPrintProgress::OnStatusChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsresult aStatus, const PRUnichar *aMessage) -{ - if (aMessage && *aMessage) - m_pendingStatus = aMessage; - - uint32_t count = m_listenerList.Count(); - for (uint32_t i = count - 1; i < count; i --) - { - nsCOMPtr<nsIWebProgressListener> progressListener = m_listenerList.SafeObjectAt(i); - if (progressListener) - progressListener->OnStatusChange(aWebProgress, aRequest, aStatus, aMessage); - } - - return NS_OK; -} - -/* void onSecurityChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in unsigned long state); */ -NS_IMETHODIMP nsPrintProgress::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, uint32_t state) -{ - return NS_OK; -} - -nsresult nsPrintProgress::ReleaseListeners() -{ - m_listenerList.Clear(); - return NS_OK; -} - -NS_IMETHODIMP nsPrintProgress::ShowStatusString(const PRUnichar *status) -{ - return OnStatusChange(nullptr, nullptr, NS_OK, status); -} - -/* void startMeteors (); */ -NS_IMETHODIMP nsPrintProgress::StartMeteors() -{ - return NS_ERROR_NOT_IMPLEMENTED; -} - -/* void stopMeteors (); */ -NS_IMETHODIMP nsPrintProgress::StopMeteors() -{ - return NS_ERROR_NOT_IMPLEMENTED; -} - -/* void showProgress (in long percent); */ -NS_IMETHODIMP nsPrintProgress::ShowProgress(int32_t percent) -{ - return NS_ERROR_NOT_IMPLEMENTED; -} - -/* [noscript] void setDocShell (in nsIDocShell shell, in nsIDOMWindow window); */ -NS_IMETHODIMP nsPrintProgress::SetDocShell(nsIDocShell *shell, nsIDOMWindow *window) -{ - return NS_ERROR_NOT_IMPLEMENTED; -} - -/* void closeWindow (); */ -NS_IMETHODIMP nsPrintProgress::CloseWindow() -{ - return NS_ERROR_NOT_IMPLEMENTED; -} - diff --git a/embedding/components/printingui/src/os2/nsPrintProgress.h b/embedding/components/printingui/src/os2/nsPrintProgress.h deleted file mode 100644 index db698ca04..000000000 --- a/embedding/components/printingui/src/os2/nsPrintProgress.h +++ /dev/null @@ -1,42 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifndef __nsPrintProgress_h -#define __nsPrintProgress_h - -#include "nsIPrintProgress.h" - -#include "nsCOMArray.h" -#include "nsCOMPtr.h" -#include "nsIDOMWindow.h" -#include "nsIPrintStatusFeedback.h" -#include "nsIObserver.h" -#include "nsString.h" - -class nsPrintProgress : public nsIPrintProgress, public nsIPrintStatusFeedback -{ -public: - NS_DECL_ISUPPORTS - NS_DECL_NSIPRINTPROGRESS - NS_DECL_NSIWEBPROGRESSLISTENER - NS_DECL_NSIPRINTSTATUSFEEDBACK - - nsPrintProgress(); - virtual ~nsPrintProgress(); - -private: - nsresult ReleaseListeners(); - - bool m_closeProgress; - bool m_processCanceled; - nsString m_pendingStatus; - int32_t m_pendingStateFlags; - int32_t m_pendingStateValue; - nsCOMPtr<nsIDOMWindow> m_dialog; - nsCOMArray<nsIWebProgressListener> m_listenerList; - nsCOMPtr<nsIObserver> m_observer; -}; - -#endif diff --git a/embedding/components/printingui/src/os2/nsPrintProgressParams.cpp b/embedding/components/printingui/src/os2/nsPrintProgressParams.cpp deleted file mode 100644 index 2b31b1344..000000000 --- a/embedding/components/printingui/src/os2/nsPrintProgressParams.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "nsPrintProgressParams.h" -#include "nsReadableUtils.h" - - -NS_IMPL_ISUPPORTS1(nsPrintProgressParams, nsIPrintProgressParams) - -nsPrintProgressParams::nsPrintProgressParams() -{ -} - -nsPrintProgressParams::~nsPrintProgressParams() -{ -} - -/* attribute wstring docTitle; */ -NS_IMETHODIMP nsPrintProgressParams::GetDocTitle(PRUnichar * *aDocTitle) -{ - NS_ENSURE_ARG(aDocTitle); - - *aDocTitle = ToNewUnicode(mDocTitle); - return NS_OK; -} - -NS_IMETHODIMP nsPrintProgressParams::SetDocTitle(const PRUnichar * aDocTitle) -{ - mDocTitle = aDocTitle; - return NS_OK; -} - -/* attribute wstring docURL; */ -NS_IMETHODIMP nsPrintProgressParams::GetDocURL(PRUnichar * *aDocURL) -{ - NS_ENSURE_ARG(aDocURL); - - *aDocURL = ToNewUnicode(mDocURL); - return NS_OK; -} - -NS_IMETHODIMP nsPrintProgressParams::SetDocURL(const PRUnichar * aDocURL) -{ - mDocURL = aDocURL; - return NS_OK; -} - diff --git a/embedding/components/printingui/src/os2/nsPrintProgressParams.h b/embedding/components/printingui/src/os2/nsPrintProgressParams.h deleted file mode 100644 index b041aae8a..000000000 --- a/embedding/components/printingui/src/os2/nsPrintProgressParams.h +++ /dev/null @@ -1,26 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifndef __nsPrintProgressParams_h -#define __nsPrintProgressParams_h - -#include "nsIPrintProgressParams.h" -#include "nsString.h" - -class nsPrintProgressParams : public nsIPrintProgressParams -{ -public: - NS_DECL_ISUPPORTS - NS_DECL_NSIPRINTPROGRESSPARAMS - - nsPrintProgressParams(); - virtual ~nsPrintProgressParams(); - -private: - nsString mDocTitle; - nsString mDocURL; -}; - -#endif diff --git a/embedding/components/printingui/src/os2/nsPrintingPromptService.cpp b/embedding/components/printingui/src/os2/nsPrintingPromptService.cpp deleted file mode 100644 index a2ac83789..000000000 --- a/embedding/components/printingui/src/os2/nsPrintingPromptService.cpp +++ /dev/null @@ -1,288 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "nsPrintingPromptService.h" - -#include "nsIComponentManager.h" -#include "nsIDialogParamBlock.h" -#include "nsIDOMWindow.h" -#include "nsIServiceManager.h" -#include "nsISupportsUtils.h" -#include "nsISupportsArray.h" -#include "nsString.h" - -// Printing Progress Includes -#include "nsPrintProgress.h" -#include "nsPrintProgressParams.h" - -// Print Service Includes -#include "nsIPrintOptions.h" -#include "nsIServiceManager.h" -#include "nsGfxCIID.h" -static const char sPrintOptionsContractID[] = "@mozilla.org/gfx/printsettings-service;1"; - -static const char *kPrintDialogURL = "chrome://global/content/printdialog.xul"; -static const char *kPrintProgressDialogURL = "chrome://global/content/printProgress.xul"; -static const char *kPrtPrvProgressDialogURL = "chrome://global/content/printPreviewProgress.xul"; -static const char *kPageSetupDialogURL = "chrome://global/content/printPageSetup.xul"; - -/**************************************************************** - ************************* ParamBlock *************************** - ****************************************************************/ - -class ParamBlock { - -public: - ParamBlock() - { - mBlock = 0; - } - ~ParamBlock() - { - NS_IF_RELEASE(mBlock); - } - nsresult Init() { - return CallCreateInstance(NS_DIALOGPARAMBLOCK_CONTRACTID, &mBlock); - } - nsIDialogParamBlock * operator->() const { return mBlock; } - operator nsIDialogParamBlock * const () { return mBlock; } - -private: - nsIDialogParamBlock *mBlock; -}; - -/**************************************************************** - ***************** nsPrintingPromptService ********************** - ****************************************************************/ - -NS_IMPL_ISUPPORTS2(nsPrintingPromptService, nsIPrintingPromptService, nsIWebProgressListener) - -nsPrintingPromptService::nsPrintingPromptService() -{ -} - -nsPrintingPromptService::~nsPrintingPromptService() -{ -} - -nsresult -nsPrintingPromptService::Init() -{ - nsresult rv; - mWatcher = do_GetService(NS_WINDOWWATCHER_CONTRACTID, &rv); - return rv; -} - -/* void showPrintDialog (in nsIDOMWindow parent, in nsIWebBrowserPrint webBrowserPrint, in nsIPrintSettings printSettings); */ -NS_IMETHODIMP -nsPrintingPromptService::ShowPrintDialog(nsIDOMWindow *parent, nsIWebBrowserPrint *webBrowserPrint, nsIPrintSettings *printSettings) -{ - NS_ENSURE_ARG(webBrowserPrint); - NS_ENSURE_ARG(printSettings); - - ParamBlock block; - nsresult rv = block.Init(); - if (NS_FAILED(rv)) - return rv; - - block->SetInt(0, 0); - return DoDialog(parent, block, webBrowserPrint, printSettings, kPrintDialogURL); -} - -/* void showProgress (in nsIDOMWindow parent, in nsIWebBrowserPrint webBrowserPrint, in nsIPrintSettings printSettings, in nsIObserver openDialogObserver, in boolean isForPrinting, out nsIWebProgressListener webProgressListener, out nsIPrintProgressParams printProgressParams, out boolean notifyOnOpen); */ -NS_IMETHODIMP -nsPrintingPromptService::ShowProgress(nsIDOMWindow* parent, - nsIWebBrowserPrint* webBrowserPrint, // ok to be null - nsIPrintSettings* printSettings, // ok to be null - nsIObserver* openDialogObserver, // ok to be null - bool isForPrinting, - nsIWebProgressListener** webProgressListener, - nsIPrintProgressParams** printProgressParams, - bool* notifyOnOpen) -{ - NS_ENSURE_ARG(webProgressListener); - NS_ENSURE_ARG(printProgressParams); - NS_ENSURE_ARG(notifyOnOpen); - - *notifyOnOpen = false; - - nsPrintProgress* prtProgress = new nsPrintProgress(); - mPrintProgress = prtProgress; - mWebProgressListener = prtProgress; - - nsCOMPtr<nsIPrintProgressParams> prtProgressParams = new nsPrintProgressParams(); - - nsCOMPtr<nsIDOMWindow> parentWindow = parent; - - if (mWatcher && !parentWindow) { - mWatcher->GetActiveWindow(getter_AddRefs(parentWindow)); - } - - if (parentWindow) { - mPrintProgress->OpenProgressDialog(parentWindow, - isForPrinting ? kPrintProgressDialogURL : kPrtPrvProgressDialogURL, - prtProgressParams, openDialogObserver, notifyOnOpen); - } - - prtProgressParams.forget(printProgressParams); - nsCOMPtr<nsIWebProgressListener> myWebProgressListener = this; - myWebProgressListener.forget(webProgressListener); - - return NS_OK; -} - -/* void showPageSetup (in nsIDOMWindow parent, in nsIPrintSettings printSettings); */ -NS_IMETHODIMP -nsPrintingPromptService::ShowPageSetup(nsIDOMWindow *parent, nsIPrintSettings *printSettings, nsIObserver *aObs) -{ - NS_ENSURE_ARG(printSettings); - - ParamBlock block; - nsresult rv = block.Init(); - if (NS_FAILED(rv)) - return rv; - - block->SetInt(0, 0); - return DoDialog(parent, block, nullptr, printSettings, kPageSetupDialogURL); -} - -/* void showPrinterProperties (in nsIDOMWindow parent, in wstring printerName, in nsIPrintSettings printSettings); */ -NS_IMETHODIMP -nsPrintingPromptService::ShowPrinterProperties(nsIDOMWindow *parent, const PRUnichar *printerName, nsIPrintSettings *printSettings) -{ - nsresult rv = NS_ERROR_FAILURE; - nsCOMPtr<nsIPrintOptions> printService = do_GetService(sPrintOptionsContractID, &rv); - if (NS_SUCCEEDED(rv)) { - bool displayed; - rv = printService->DisplayJobProperties(printerName, printSettings, &displayed); - } - return rv; -} - -nsresult -nsPrintingPromptService::DoDialog(nsIDOMWindow *aParent, - nsIDialogParamBlock *aParamBlock, - nsIWebBrowserPrint *aWebBrowserPrint, - nsIPrintSettings* aPS, - const char *aChromeURL) -{ - NS_ENSURE_ARG(aParamBlock); - NS_ENSURE_ARG(aPS); - NS_ENSURE_ARG(aChromeURL); - - if (!mWatcher) - return NS_ERROR_FAILURE; - - nsresult rv = NS_OK; - - // get a parent, if at all possible - // (though we'd rather this didn't fail, it's OK if it does. so there's - // no failure or null check.) - nsCOMPtr<nsIDOMWindow> activeParent; // retain ownership for method lifetime - if (!aParent) - { - mWatcher->GetActiveWindow(getter_AddRefs(activeParent)); - aParent = activeParent; - } - - // create a nsISupportsArray of the parameters - // being passed to the window - nsCOMPtr<nsISupportsArray> array; - NS_NewISupportsArray(getter_AddRefs(array)); - if (!array) return NS_ERROR_FAILURE; - - nsCOMPtr<nsISupports> psSupports(do_QueryInterface(aPS)); - NS_ASSERTION(psSupports, "PrintSettings must be a supports"); - array->AppendElement(psSupports); - - if (aWebBrowserPrint) { - nsCOMPtr<nsISupports> wbpSupports(do_QueryInterface(aWebBrowserPrint)); - NS_ASSERTION(wbpSupports, "nsIWebBrowserPrint must be a supports"); - array->AppendElement(wbpSupports); - } - - nsCOMPtr<nsISupports> blkSupps(do_QueryInterface(aParamBlock)); - NS_ASSERTION(blkSupps, "IOBlk must be a supports"); - array->AppendElement(blkSupps); - - nsCOMPtr<nsISupports> arguments(do_QueryInterface(array)); - NS_ASSERTION(array, "array must be a supports"); - - - nsCOMPtr<nsIDOMWindow> dialog; - rv = mWatcher->OpenWindow(aParent, aChromeURL, "_blank", - "centerscreen,chrome,modal,titlebar", arguments, - getter_AddRefs(dialog)); - - // if aWebBrowserPrint is not null then we are printing - // so we want to pass back NS_ERROR_ABORT on cancel - if (NS_SUCCEEDED(rv) && aWebBrowserPrint) - { - int32_t status; - aParamBlock->GetInt(0, &status); - return status == 0?NS_ERROR_ABORT:NS_OK; - } - - return rv; -} - -////////////////////////////////////////////////////////////////////// -// nsIWebProgressListener -////////////////////////////////////////////////////////////////////// - -/* void onStateChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in unsigned long aStateFlags, in nsresult aStatus); */ -NS_IMETHODIMP -nsPrintingPromptService::OnStateChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, uint32_t aStateFlags, nsresult aStatus) -{ - if ((aStateFlags & STATE_STOP) && mWebProgressListener) { - mWebProgressListener->OnStateChange(aWebProgress, aRequest, aStateFlags, aStatus); - if (mPrintProgress) { - mPrintProgress->CloseProgressDialog(true); - } - mPrintProgress = nullptr; - mWebProgressListener = nullptr; - } - return NS_OK; -} - -/* void onProgressChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in long aCurSelfProgress, in long aMaxSelfProgress, in long aCurTotalProgress, in long aMaxTotalProgress); */ -NS_IMETHODIMP -nsPrintingPromptService::OnProgressChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, int32_t aCurSelfProgress, int32_t aMaxSelfProgress, int32_t aCurTotalProgress, int32_t aMaxTotalProgress) -{ - if (mWebProgressListener) { - return mWebProgressListener->OnProgressChange(aWebProgress, aRequest, aCurSelfProgress, aMaxSelfProgress, aCurTotalProgress, aMaxTotalProgress); - } - return NS_OK; -} - -/* void onLocationChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsIURI location, in unsigned long aFlags); */ -NS_IMETHODIMP -nsPrintingPromptService::OnLocationChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsIURI *location, uint32_t aFlags) -{ - if (mWebProgressListener) { - return mWebProgressListener->OnLocationChange(aWebProgress, aRequest, location, aFlags); - } - return NS_OK; -} - -/* void onStatusChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsresult aStatus, in wstring aMessage); */ -NS_IMETHODIMP -nsPrintingPromptService::OnStatusChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsresult aStatus, const PRUnichar *aMessage) -{ - if (mWebProgressListener) { - return mWebProgressListener->OnStatusChange(aWebProgress, aRequest, aStatus, aMessage); - } - return NS_OK; -} - -/* void onSecurityChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in unsigned long state); */ -NS_IMETHODIMP -nsPrintingPromptService::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, uint32_t state) -{ - if (mWebProgressListener) { - return mWebProgressListener->OnSecurityChange(aWebProgress, aRequest, state); - } - return NS_OK; -} diff --git a/embedding/components/printingui/src/os2/nsPrintingPromptService.h b/embedding/components/printingui/src/os2/nsPrintingPromptService.h deleted file mode 100644 index df759d613..000000000 --- a/embedding/components/printingui/src/os2/nsPrintingPromptService.h +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifndef __nsPrintingPromptService_h -#define __nsPrintingPromptService_h - -// {E042570C-62DE-4bb6-A6E0-798E3C07B4DF} -#define NS_PRINTINGPROMPTSERVICE_CID \ - {0xe042570c, 0x62de, 0x4bb6, { 0xa6, 0xe0, 0x79, 0x8e, 0x3c, 0x7, 0xb4, 0xdf}} -#define NS_PRINTINGPROMPTSERVICE_CONTRACTID \ - "@mozilla.org/embedcomp/printingprompt-service;1" - -#include "nsCOMPtr.h" -#include "nsIPrintingPromptService.h" -#include "nsPIPromptService.h" -#include "nsIWindowWatcher.h" - -// Printing Progress Includes -#include "nsPrintProgress.h" -#include "nsPrintProgressParams.h" -#include "nsIWebProgressListener.h" - -class nsIDOMWindow; -class nsIDialogParamBlock; - -class nsPrintingPromptService: public nsIPrintingPromptService, - public nsIWebProgressListener -{ - -public: - - nsPrintingPromptService(); - virtual ~nsPrintingPromptService(); - - nsresult Init(); - - NS_DECL_NSIPRINTINGPROMPTSERVICE - NS_DECL_NSIWEBPROGRESSLISTENER - NS_DECL_ISUPPORTS - -private: - nsresult DoDialog(nsIDOMWindow *aParent, - nsIDialogParamBlock *aParamBlock, - nsIWebBrowserPrint *aWebBrowserPrint, - nsIPrintSettings* aPS, - const char *aChromeURL); - - nsCOMPtr<nsIWindowWatcher> mWatcher; - nsCOMPtr<nsIPrintProgress> mPrintProgress; - nsCOMPtr<nsIWebProgressListener> mWebProgressListener; -}; - -#endif - diff --git a/embedding/components/webbrowserpersist/src/nsWebBrowserPersist.cpp b/embedding/components/webbrowserpersist/src/nsWebBrowserPersist.cpp index 31d5a3d3d..793b3cc12 100644 --- a/embedding/components/webbrowserpersist/src/nsWebBrowserPersist.cpp +++ b/embedding/components/webbrowserpersist/src/nsWebBrowserPersist.cpp @@ -10,10 +10,6 @@ #include "nsIFileStreams.h" // New Necko file streams #include <algorithm> -#ifdef XP_OS2 -#include "nsILocalFileOS2.h" -#endif - #include "nsNetUtil.h" #include "nsComponentManagerUtils.h" #include "nsIComponentRegistrar.h" @@ -701,29 +697,9 @@ NS_IMETHODIMP nsWebBrowserPersist::OnStopRequest( if (NS_SUCCEEDED(mPersistResult) && NS_FAILED(status)) SendErrorStatusChange(true, status, request, data->mFile); -#if defined(XP_OS2) - // delete 'data'; this will close the stream and let - // us tag the file it created with its source URI - nsCOMPtr<nsIURI> uriSource = data->mOriginalLocation; - nsCOMPtr<nsIFile> localFile; - GetLocalFileFromURI(data->mFile, getter_AddRefs(localFile)); - delete data; - mOutputMap.Remove(&key); - if (localFile) - { - nsCOMPtr<nsILocalFileOS2> localFileOS2 = do_QueryInterface(localFile); - if (localFileOS2) - { - nsAutoCString url; - uriSource->GetSpec(url); - localFileOS2->SetFileSource(url); - } - } -#else // This will close automatically close the output stream delete data; mOutputMap.Remove(&key); -#endif } else { @@ -1673,16 +1649,6 @@ nsresult nsWebBrowserPersist::SaveDocumentInternal( cleanupData->mIsDirectory = true; mCleanupList.AppendElement(cleanupData); } -#if defined(XP_OS2) - // tag the directory with the URI that originated its contents - nsCOMPtr<nsILocalFileOS2> localFileOS2 = do_QueryInterface(localDataPath); - if (localFileOS2) - { - nsAutoCString url; - mCurrentBaseURI->GetSpec(url); - localFileOS2->SetFileSource(url); - } -#endif } } @@ -3778,20 +3744,6 @@ nsWebBrowserPersist::SaveDocumentWithFixup( NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE); } } -#if defined(XP_OS2) - else - { - // close the stream, then tag the file it created with its source URI - outputStream->Close(); - nsCOMPtr<nsILocalFileOS2> localFileOS2 = do_QueryInterface(localFile); - if (localFileOS2) - { - nsAutoCString url; - mCurrentBaseURI->GetSpec(url); - localFileOS2->SetFileSource(url); - } - } -#endif return rv; } diff --git a/extensions/pref/autoconfig/src/Makefile.in b/extensions/pref/autoconfig/src/Makefile.in index 9b42df969..f74332c9d 100644 --- a/extensions/pref/autoconfig/src/Makefile.in +++ b/extensions/pref/autoconfig/src/Makefile.in @@ -28,9 +28,6 @@ else ifeq ($(MOZ_WIDGET_TOOLKIT), windows) AUTOCFG_JS_EXPORTS += $(srcdir)/win/platform.js else -ifeq ($(MOZ_WIDGET_TOOLKIT), os2) -AUTOCFG_JS_EXPORTS += $(srcdir)/os2/platform.js -else ifeq ($(MOZ_WIDGET_TOOLKIT), beos) AUTOCFG_JS_EXPORTS += $(srcdir)/beos/platform.js else diff --git a/extensions/pref/autoconfig/src/os2/platform.js b/extensions/pref/autoconfig/src/os2/platform.js deleted file mode 100644 index 1f554ed29..000000000 --- a/extensions/pref/autoconfig/src/os2/platform.js +++ /dev/null @@ -1,6 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -// OS2 specific auto configuration preference defaults -platform.value = "windows"; diff --git a/gfx/cairo/cairo/src/moz.build b/gfx/cairo/cairo/src/moz.build index b5af1f746..706fe2ed9 100644 --- a/gfx/cairo/cairo/src/moz.build +++ b/gfx/cairo/cairo/src/moz.build @@ -32,12 +32,6 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows': CPP_SOURCES += [ 'cairo-d2d-surface.cpp', ] -elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'os2': - EXPORTS.cairo += [ - 'cairo-os2.h', - 'cairo-os2-private.h', - 'cairo-pdf.h', - ] elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa': EXPORTS.cairo += [ 'cairo-quartz-image.h', diff --git a/gfx/cairo/libpixman/src/Makefile.in b/gfx/cairo/libpixman/src/Makefile.in index 750fbb937..ba07e8cda 100644 --- a/gfx/cairo/libpixman/src/Makefile.in +++ b/gfx/cairo/libpixman/src/Makefile.in @@ -64,10 +64,8 @@ endif ifdef USE_SSE2 SSE2_CFLAGS=-msse -msse2 -Winline endif -ifneq ($(MOZ_WIDGET_TOOLKIT),os2) MMX_CFLAGS+=--param inline-unit-growth=10000 --param large-function-growth=10000 endif -endif ifeq (arm,$(findstring arm,$(OS_TEST))) # Apple's arm assembler doesn't support the same syntax as # the standard GNU assembler, so use the C fallback paths for now. diff --git a/gfx/src/Makefile.in b/gfx/src/Makefile.in index 9295aade1..b22eae387 100644 --- a/gfx/src/Makefile.in +++ b/gfx/src/Makefile.in @@ -25,10 +25,6 @@ ifdef MOZ_WIDGET_GTK CXXFLAGS += $(MOZ_PANGO_CFLAGS) endif -ifeq ($(MOZ_WIDGET_TOOLKIT),os2) -CXXFLAGS += $(CAIRO_FT_CFLAGS) -endif - ifeq ($(MOZ_WIDGET_TOOLKIT),qt) CXXFLAGS += $(MOZ_QT_CFLAGS) endif diff --git a/gfx/src/nsDeviceContext.cpp b/gfx/src/nsDeviceContext.cpp index dc917ab76..266713f99 100644 --- a/gfx/src/nsDeviceContext.cpp +++ b/gfx/src/nsDeviceContext.cpp @@ -28,8 +28,6 @@ #include "gfxPSSurface.h" #elif XP_WIN #include "gfxWindowsSurface.h" -#elif defined(XP_OS2) -#include "gfxOS2Surface.h" #elif XP_MACOSX #include "gfxQuartzSurface.h" #endif @@ -303,15 +301,6 @@ nsDeviceContext::SetDPI() break; } #endif -#ifdef XP_OS2 - case gfxASurface::SurfaceTypeOS2: { - LONG lDPI; - HDC dc = GpiQueryDevice(reinterpret_cast<gfxOS2Surface*>(mPrintingSurface.get())->GetPS()); - if (DevQueryCaps(dc, CAPS_VERTICAL_FONT_RES, 1, &lDPI)) - dpi = lDPI; - break; - } -#endif default: NS_NOTREACHED("Unexpected printing surface type"); break; @@ -677,26 +666,6 @@ nsDeviceContext::CalcPrintingSize() } #endif -#ifdef XP_OS2 - case gfxASurface::SurfaceTypeOS2: - { - inPoints = false; - // we already set the size in the surface constructor we set for - // printing, so just get those values here - size = reinterpret_cast<gfxOS2Surface*>(mPrintingSurface.get())->GetSize(); - // as they are in pixels we need to scale them to app units - size.width = NSFloatPixelsToAppUnits(size.width, AppUnitsPerDevPixel()); - size.height = NSFloatPixelsToAppUnits(size.height, AppUnitsPerDevPixel()); - // still need to get the depth from the device context - HDC dc = GpiQueryDevice(reinterpret_cast<gfxOS2Surface*>(mPrintingSurface.get())->GetPS()); - LONG value; - if (DevQueryCaps(dc, CAPS_COLOR_BITCOUNT, 1, &value)) - mDepth = value; - else - mDepth = 8; // default to 8bpp, should be enough for printers - break; - } -#endif default: NS_ERROR("trying to print to unknown surface type"); } diff --git a/gfx/thebes/Makefile.in b/gfx/thebes/Makefile.in index 4d5c1e481..1602edf91 100644 --- a/gfx/thebes/Makefile.in +++ b/gfx/thebes/Makefile.in @@ -92,10 +92,6 @@ ifdef MOZ_WIDGET_GTK CXXFLAGS += $(MOZ_PANGO_CFLAGS) endif -ifeq ($(MOZ_WIDGET_TOOLKIT),os2) -CXXFLAGS += $(CAIRO_FT_CFLAGS) -endif - ifeq ($(MOZ_WIDGET_TOOLKIT),qt) CXXFLAGS += $(CAIRO_FT_CFLAGS) $(MOZ_PANGO_CFLAGS) endif diff --git a/gfx/thebes/gfxOS2Fonts.cpp b/gfx/thebes/gfxOS2Fonts.cpp deleted file mode 100644 index 39b0f1e00..000000000 --- a/gfx/thebes/gfxOS2Fonts.cpp +++ /dev/null @@ -1,850 +0,0 @@ -/* vim: set sw=4 sts=4 et cin: */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "gfxContext.h" - -#include "gfxOS2Platform.h" -#include "gfxOS2Surface.h" -#include "gfxOS2Fonts.h" -#include "nsTArray.h" -#include "nsGkAtoms.h" - -#include "nsIPlatformCharset.h" - -#include "mozilla/Preferences.h" -#include <algorithm> - -using namespace mozilla; - -/********************************************************************** - * class gfxOS2Font - **********************************************************************/ - -gfxOS2Font::gfxOS2Font(gfxOS2FontEntry *aFontEntry, const gfxFontStyle *aFontStyle) - : gfxFont(aFontEntry, aFontStyle), - mFontFace(nullptr), - mMetrics(nullptr), mAdjustedSize(0), - mHinting(FC_HINT_MEDIUM), mAntialias(FcTrue) -{ -#ifdef DEBUG_thebes_2 - printf("gfxOS2Font[%p]::gfxOS2Font(%p \"%s\", aFontStyle)\n", - (void *)this, (void *)aFontEntry, - NS_LossyConvertUTF16toASCII(aFontEntry->Name()).get()); -#endif - // try to get the preferences for hinting, antialias, and embolden options - int32_t value; - nsresult rv = Preferences::GetInt("gfx.os2.font.hinting", &value); - if (NS_SUCCEEDED(rv) && value >= FC_HINT_NONE && value <= FC_HINT_FULL) { - mHinting = value; - } - - mAntialias = Preferences::GetBool("gfx.os2.font.antialiasing", mAntialias); - -#ifdef DEBUG_thebes_2 - printf(" font display options: hinting=%d, antialiasing=%s\n", - mHinting, mAntialias ? "on" : "off"); -#endif -} - -gfxOS2Font::~gfxOS2Font() -{ -#ifdef DEBUG_thebes_2 - printf("gfxOS2Font[%#x]::~gfxOS2Font()\n", (unsigned)this); -#endif - if (mFontFace) { - cairo_font_face_destroy(mFontFace); - } - if (mScaledFont) { - cairo_scaled_font_destroy(mScaledFont); - } - delete mMetrics; - mFontFace = nullptr; - mScaledFont = nullptr; - mMetrics = nullptr; -} - -// fill font metrics structure with default values in case of error -static void FillMetricsDefaults(gfxFont::Metrics *aMetrics) -{ - aMetrics->emAscent = 0.8 * aMetrics->emHeight; - aMetrics->emDescent = 0.2 * aMetrics->emHeight; - aMetrics->maxAscent = aMetrics->emAscent; - aMetrics->maxDescent = aMetrics->maxDescent; - aMetrics->maxHeight = aMetrics->emHeight; - aMetrics->internalLeading = 0.0; - aMetrics->externalLeading = 0.2 * aMetrics->emHeight; - aMetrics->spaceWidth = 0.5 * aMetrics->emHeight; - aMetrics->maxAdvance = aMetrics->spaceWidth; - aMetrics->aveCharWidth = aMetrics->spaceWidth; - aMetrics->zeroOrAveCharWidth = aMetrics->spaceWidth; - aMetrics->xHeight = 0.5 * aMetrics->emHeight; - aMetrics->underlineSize = aMetrics->emHeight / 14.0; - aMetrics->underlineOffset = -aMetrics->underlineSize; - aMetrics->strikeoutOffset = 0.25 * aMetrics->emHeight; - aMetrics->strikeoutSize = aMetrics->underlineSize; - aMetrics->superscriptOffset = aMetrics->xHeight; - aMetrics->subscriptOffset = aMetrics->xHeight; -} - -// Snap a line to pixels while keeping the center and size of the -// line as close to the original position as possible. -static void SnapLineToPixels(gfxFloat& aOffset, gfxFloat& aSize) -{ - gfxFloat snappedSize = std::max(floor(aSize + 0.5), 1.0); - // Correct offset for change in size - gfxFloat offset = aOffset - 0.5 * (aSize - snappedSize); - // Snap offset - aOffset = floor(offset + 0.5); - aSize = snappedSize; -} - -// gfxOS2Font::GetMetrics() -// return the metrics of the current font using the gfxFont metrics structure. -// If the metrics are not available yet, compute them using the FreeType -// function on the font. (This is partly based on the respective function from -// gfxPangoFonts) -const gfxFont::Metrics& gfxOS2Font::GetMetrics() -{ -#ifdef DEBUG_thebes_1 - printf("gfxOS2Font[%#x]::GetMetrics()\n", (unsigned)this); -#endif - if (mMetrics) { - return *mMetrics; - } - - // whatever happens below, we can always create the metrics - mMetrics = new gfxFont::Metrics; - mSpaceGlyph = 0; - - // round size to integer pixels, this is to get full pixels for layout - // together with internal/external leading (see below) - mMetrics->emHeight = floor(GetStyle()->size + 0.5); - - cairo_scaled_font_t* scaledFont = CairoScaledFont(); - if (!scaledFont) { - FillMetricsDefaults(mMetrics); - return *mMetrics; - } - - FT_Face face = cairo_ft_scaled_font_lock_face(scaledFont); - if (!face) { - // Abort here already, otherwise we crash in the following - // this can happen if the font-size requested is zero. - FillMetricsDefaults(mMetrics); - return *mMetrics; - } - if (!face->charmap) { - // Also abort, if the charmap isn't loaded; then the char - // lookups won't work. This happens for fonts without Unicode - // charmap. - cairo_ft_scaled_font_unlock_face(scaledFont); - FillMetricsDefaults(mMetrics); - return *mMetrics; - } - - // compute font scaling factors - gfxFloat emUnit = 1.0 * face->units_per_EM; - gfxFloat xScale = face->size->metrics.x_ppem / emUnit; - gfxFloat yScale = face->size->metrics.y_ppem / emUnit; - - FT_UInt gid; // glyph ID - - // properties of space - gid = FT_Get_Char_Index(face, ' '); - if (gid) { - // Load glyph into glyph slot. Use load_default here to get results in - // 26.6 fractional pixel format which is what is used for all other - // characters in gfxOS2FontGroup::CreateGlyphRunsFT. - FT_Load_Glyph(face, gid, FT_LOAD_DEFAULT); - // glyph width doesn't work for spaces, use advance instead - mMetrics->spaceWidth = face->glyph->advance.x >> 6; - // save the space glyph - mSpaceGlyph = gid; - } else { - NS_ASSERTION(gid, "this font doesn't have a space glyph!"); - mMetrics->spaceWidth = face->max_advance_width * xScale; - } - - // properties of 'x', also use its width as average width - gid = FT_Get_Char_Index(face, 'x'); // select the glyph - if (gid) { - // Load glyph into glyph slot. Here, use no_scale to get font units. - FT_Load_Glyph(face, gid, FT_LOAD_NO_SCALE); - mMetrics->xHeight = face->glyph->metrics.height * yScale; - mMetrics->aveCharWidth = face->glyph->metrics.horiAdvance * xScale; - } else { - // this font doesn't have an 'x'... - // fake these metrics using a fraction of the font size - mMetrics->xHeight = mMetrics->emHeight * 0.5; - mMetrics->aveCharWidth = mMetrics->emHeight * 0.5; - } - - // properties of '0', for 'ch' units - gid = FT_Get_Char_Index(face, '0'); - if (gid) { - FT_Load_Glyph(face, gid, FT_LOAD_NO_SCALE); - mMetrics->zeroOrAveCharWidth = face->glyph->metrics.horiAdvance * xScale; - } else { - // this font doesn't have a '0' - mMetrics->zeroOrAveCharWidth = mMetrics->aveCharWidth; - } - - // compute an adjusted size if we need to - if (mAdjustedSize == 0 && GetStyle()->sizeAdjust != 0) { - gfxFloat aspect = mMetrics->xHeight / GetStyle()->size; - mAdjustedSize = GetStyle()->GetAdjustedSize(aspect); - mMetrics->emHeight = mAdjustedSize; - } - - // now load the OS/2 TrueType table to access some more properties - TT_OS2 *os2 = (TT_OS2 *)FT_Get_Sfnt_Table(face, ft_sfnt_os2); - if (os2 && os2->version != 0xFFFF) { // should be there if not old Mac font - // if we are here we can improve the avgCharWidth - mMetrics->aveCharWidth = std::max(mMetrics->aveCharWidth, - os2->xAvgCharWidth * xScale); - - mMetrics->superscriptOffset = std::max(os2->ySuperscriptYOffset * yScale, 1.0); - // some fonts have the incorrect sign (from gfxPangoFonts) - mMetrics->subscriptOffset = std::max(fabs(os2->ySubscriptYOffset * yScale), - 1.0); - mMetrics->strikeoutOffset = os2->yStrikeoutPosition * yScale; - mMetrics->strikeoutSize = os2->yStrikeoutSize * yScale; - } else { - // use fractions of emHeight instead of xHeight for these to be more robust - mMetrics->superscriptOffset = mMetrics->emHeight * 0.5; - mMetrics->subscriptOffset = mMetrics->emHeight * 0.2; - mMetrics->strikeoutOffset = mMetrics->emHeight * 0.3; - mMetrics->strikeoutSize = face->underline_thickness * yScale; - } - SnapLineToPixels(mMetrics->strikeoutOffset, mMetrics->strikeoutSize); - - // seems that underlineOffset really has to be negative - mMetrics->underlineOffset = face->underline_position * yScale; - mMetrics->underlineSize = face->underline_thickness * yScale; - - // descents are negative in FT but Thebes wants them positive - mMetrics->emAscent = face->ascender * yScale; - mMetrics->emDescent = -face->descender * yScale; - mMetrics->maxHeight = face->height * yScale; - // the max units determine frame heights, better be generous - mMetrics->maxAscent = std::max(face->bbox.yMax * yScale, - mMetrics->emAscent); - mMetrics->maxDescent = std::max(-face->bbox.yMin * yScale, - mMetrics->emDescent); - mMetrics->maxAdvance = std::max(face->max_advance_width * xScale, - mMetrics->aveCharWidth); - - // leadings are not available directly (only for WinFNTs); - // better compute them on our own, to get integer values and make - // layout happy (see // LockedFTFace::GetMetrics in gfxPangoFonts.cpp) - mMetrics->internalLeading = floor(mMetrics->maxHeight - - mMetrics->emHeight + 0.5); - gfxFloat lineHeight = floor(mMetrics->maxHeight + 0.5); - mMetrics->externalLeading = lineHeight - - mMetrics->internalLeading - mMetrics->emHeight; - - SanitizeMetrics(mMetrics, false); - -#ifdef DEBUG_thebes_1 - printf("gfxOS2Font[%#x]::GetMetrics():\n" - " %s (%s)\n" - " emHeight=%f == %f=gfxFont::style.size == %f=adjSz\n" - " maxHeight=%f xHeight=%f\n" - " aveCharWidth=%f(x) zeroOrAveWidth=%f(0) spaceWidth=%f\n" - " supOff=%f SubOff=%f strOff=%f strSz=%f\n" - " undOff=%f undSz=%f intLead=%f extLead=%f\n" - " emAsc=%f emDesc=%f maxH=%f\n" - " maxAsc=%f maxDes=%f maxAdv=%f\n", - (unsigned)this, - NS_LossyConvertUTF16toASCII(GetName()).get(), - os2 && os2->version != 0xFFFF ? "has OS/2 table" : "no OS/2 table!", - mMetrics->emHeight, GetStyle()->size, mAdjustedSize, - mMetrics->maxHeight, mMetrics->xHeight, - mMetrics->aveCharWidth, mMetrics->zeroOrAveCharWidth, mMetrics->spaceWidth, - mMetrics->superscriptOffset, mMetrics->subscriptOffset, - mMetrics->strikeoutOffset, mMetrics->strikeoutSize, - mMetrics->underlineOffset, mMetrics->underlineSize, - mMetrics->internalLeading, mMetrics->externalLeading, - mMetrics->emAscent, mMetrics->emDescent, mMetrics->maxHeight, - mMetrics->maxAscent, mMetrics->maxDescent, mMetrics->maxAdvance - ); -#endif - cairo_ft_scaled_font_unlock_face(scaledFont); - return *mMetrics; -} - -// weight list copied from fontconfig.h -// unfortunately, the OS/2 version so far only supports regular and bold -static const int8_t nFcWeight = 2; // 10; // length of weight list -static const int fcWeight[] = { - //FC_WEIGHT_THIN, - //FC_WEIGHT_EXTRALIGHT, // == FC_WEIGHT_ULTRALIGHT - //FC_WEIGHT_LIGHT, - //FC_WEIGHT_BOOK, - FC_WEIGHT_REGULAR, // == FC_WEIGHT_NORMAL - //FC_WEIGHT_MEDIUM, - //FC_WEIGHT_DEMIBOLD, // == FC_WEIGHT_SEMIBOLD - FC_WEIGHT_BOLD, - //FC_WEIGHT_EXTRABOLD, // == FC_WEIGHT_ULTRABOLD - //FC_WEIGHT_BLACK // == FC_WEIGHT_HEAVY -}; - -// gfxOS2Font::CairoFontFace() -// return a font face usable by cairo for font rendering -// if none was created yet, use FontConfig patterns based on the current style -// to create a new font face -cairo_font_face_t *gfxOS2Font::CairoFontFace() -{ -#ifdef DEBUG_thebes_2 - printf("gfxOS2Font[%#x]::CairoFontFace()\n", (unsigned)this); -#endif - if (!mFontFace) { -#ifdef DEBUG_thebes - printf("gfxOS2Font[%#x]::CairoFontFace(): create it for %s, %f\n", - (unsigned)this, NS_LossyConvertUTF16toASCII(GetName()).get(), GetStyle()->size); -#endif - FcPattern *fcPattern = FcPatternCreate(); - - // add (family) name to pattern - // convert name because FC stores it in UTF8 while we have it in UTF16 - FcPatternAddString(fcPattern, FC_FAMILY, - (FcChar8 *)NS_ConvertUTF16toUTF8(GetName()).get()); - - // The requirements outlined in gfxFont.h are difficult to meet without - // having a table of available font weights, so we map the gfxFont - // weight to possible FontConfig weights. - int8_t weight = GetStyle()->ComputeWeight(); - // gfxFont weight FC weight - // 400 80 - // 700 200 - int16_t fcW = 40 * weight - 80; // match gfxFont weight to base FC weight - // find the correct weight in the list - int8_t i = 0; - while (i < nFcWeight && fcWeight[i] < fcW) { - i++; - } - if (i < 0) { - i = 0; - } else if (i >= nFcWeight) { - i = nFcWeight - 1; - } - fcW = fcWeight[i]; - - // add weight to pattern - FcPatternAddInteger(fcPattern, FC_WEIGHT, fcW); - - uint8_t fcProperty; - // add style to pattern - switch (GetStyle()->style) { - case NS_FONT_STYLE_ITALIC: - fcProperty = FC_SLANT_ITALIC; - break; - case NS_FONT_STYLE_OBLIQUE: - fcProperty = FC_SLANT_OBLIQUE; - break; - case NS_FONT_STYLE_NORMAL: - default: - fcProperty = FC_SLANT_ROMAN; - } - FcPatternAddInteger(fcPattern, FC_SLANT, fcProperty); - - // add the size we want - FcPatternAddDouble(fcPattern, FC_PIXEL_SIZE, - mAdjustedSize ? mAdjustedSize : GetStyle()->size); - - // finally find a matching font - FcResult fcRes; - FcPattern *fcMatch = FcFontMatch(NULL, fcPattern, &fcRes); - - // Most code that depends on FcFontMatch() assumes it won't fail, - // then crashes when it does. For now, at least, substitute the - // default serif font when it fails to avoid those crashes. - if (!fcMatch) { -//#ifdef DEBUG - printf("Could not match font for:\n" - " family=%s, weight=%d, slant=%d, size=%f\n", - NS_LossyConvertUTF16toASCII(GetName()).get(), - GetStyle()->weight, GetStyle()->style, GetStyle()->size); -//#endif - // FcPatternAddString() will free the existing FC_FAMILY string - FcPatternAddString(fcPattern, FC_FAMILY, (FcChar8*)"SERIF"); - fcMatch = FcFontMatch(NULL, fcPattern, &fcRes); -//#ifdef DEBUG - printf("Attempt to substitute default SERIF font %s\n", - fcMatch ? "succeeded" : "failed"); -//#endif - } - FcPatternDestroy(fcPattern); - - if (fcMatch) { - int w = FC_WEIGHT_REGULAR; - FcPatternGetInteger(fcMatch, FC_WEIGHT, 0, &w); - if (fcW >= FC_WEIGHT_DEMIBOLD && w < FC_WEIGHT_DEMIBOLD) { - // if we want a bold font, but the selected font doesn't have a - // bold counterpart, artificially embolden it - FcPatternAddBool(fcMatch, FC_EMBOLDEN, FcTrue); - } - FcPatternAddBool(fcMatch, FC_ANTIALIAS, mAntialias); - FcPatternAddInteger(fcMatch, FC_HINT_STYLE, mHinting); - - // and ask cairo to return a font face for this - mFontFace = cairo_ft_font_face_create_for_pattern(fcMatch); - - FcPatternDestroy(fcMatch); - } - } - - NS_ASSERTION(mFontFace, "Failed to make font face"); - return mFontFace; -} - -cairo_scaled_font_t *gfxOS2Font::CairoScaledFont() -{ -#ifdef DEBUG_thebes_2 - printf("gfxOS2Font[%#x]::CairoScaledFont()\n", (unsigned)this); -#endif - if (mScaledFont) { - return mScaledFont; - } -#ifdef DEBUG_thebes_2 - printf("gfxOS2Font[%#x]::CairoScaledFont(): create it for %s, %f\n", - (unsigned)this, NS_LossyConvertUTF16toASCII(GetName()).get(), GetStyle()->size); -#endif - - double size = mAdjustedSize ? mAdjustedSize : GetStyle()->size; - cairo_matrix_t identityMatrix; - cairo_matrix_init_identity(&identityMatrix); - cairo_matrix_t fontMatrix; - // synthetic oblique by skewing via the font matrix - if (!mFontEntry->mItalic && - (mStyle.style & (NS_FONT_STYLE_ITALIC | NS_FONT_STYLE_OBLIQUE))) - { - const double kSkewFactor = 0.2126; // 12 deg skew as used in e.g. ftview - cairo_matrix_init(&fontMatrix, size, 0, -kSkewFactor*size, size, 0, 0); - } else { - cairo_matrix_init_scale(&fontMatrix, size, size); - } - - cairo_font_face_t * face = CairoFontFace(); - if (!face) - return nullptr; - - cairo_font_options_t *fontOptions = cairo_font_options_create(); - mScaledFont = cairo_scaled_font_create(face, &fontMatrix, - &identityMatrix, fontOptions); - cairo_font_options_destroy(fontOptions); - - NS_ASSERTION(cairo_scaled_font_status(mScaledFont) == CAIRO_STATUS_SUCCESS, - "Failed to make scaled font"); - return mScaledFont; -} - -bool gfxOS2Font::SetupCairoFont(gfxContext *aContext) -{ -#ifdef DEBUG_thebes_2 - printf("gfxOS2Font[%#x]::SetupCairoFont(%#x)\n", - (unsigned)this, (unsigned) aContext); -#endif - // gfxPangoFont checks the CTM but Windows doesn't so leave away here, too - - // this implicitely ensures that mScaledFont is created if NULL - cairo_scaled_font_t *scaledFont = CairoScaledFont(); - if (!scaledFont || cairo_scaled_font_status(scaledFont) != CAIRO_STATUS_SUCCESS) { - // Don't cairo_set_scaled_font as that would propagate the error to - // the cairo_t, precluding any further drawing. - return false; - } - cairo_set_scaled_font(aContext->GetCairo(), scaledFont); - return true; -} - -/** - * Look up the font in the gfxFont cache. If we don't find it, create one. - * In either case, add a ref and return it --- - * except for OOM in which case we do nothing and return null. - */ -already_AddRefed<gfxOS2Font> gfxOS2Font::GetOrMakeFont(const nsAString& aName, - const gfxFontStyle *aStyle) -{ - nsRefPtr<gfxOS2FontEntry> fe = new gfxOS2FontEntry(aName); - nsRefPtr<gfxFont> font = - gfxFontCache::GetCache()->Lookup(static_cast<gfxFontEntry *>(fe), aStyle); - if (!font) { - font = new gfxOS2Font(fe, aStyle); - if (!font) - return nullptr; - gfxFontCache::GetCache()->AddNew(font); - } - gfxFont *f = nullptr; - font.swap(f); - return static_cast<gfxOS2Font *>(f); -} - -/********************************************************************** - * class gfxOS2FontGroup - **********************************************************************/ - -gfxOS2FontGroup::gfxOS2FontGroup(const nsAString& aFamilies, - const gfxFontStyle* aStyle, - gfxUserFontSet *aUserFontSet) - : gfxFontGroup(aFamilies, aStyle, aUserFontSet) -{ -#ifdef DEBUG_thebes_2 - printf("gfxOS2FontGroup[%#x]::gfxOS2FontGroup(\"%s\", %#x)\n", - (unsigned)this, NS_LossyConvertUTF16toASCII(aFamilies).get(), - (unsigned)aStyle); -#endif - - // check for WarpSans and as we cannot display that (yet), replace - // it with Workplace Sans - int pos = 0; - if ((pos = mFamilies.Find("WarpSans", false, 0, -1)) > -1) { - mFamilies.Replace(pos, 8, NS_LITERAL_STRING("Workplace Sans")); - } - - nsTArray<nsString> familyArray; - ForEachFont(FontCallback, &familyArray); - - // To be able to easily search for glyphs in other fonts, append a few good - // replacement candidates to the list. The best ones are the Unicode fonts that - // are set up, and if the user was so clever to set up the User Defined fonts, - // then these are probable candidates, too. - nsString fontString; - gfxPlatform::GetPlatform()->GetPrefFonts(nsGkAtoms::Unicode, fontString, false); - ForEachFont(fontString, nsGkAtoms::Unicode, FontCallback, &familyArray); - gfxPlatform::GetPlatform()->GetPrefFonts(nsGkAtoms::x_user_def, fontString, false); - ForEachFont(fontString, nsGkAtoms::x_user_def, FontCallback, &familyArray); - - // Should append some default font if there are no available fonts. - // Let's use Helv which should be available on any OS/2 system; if - // it's not there, Fontconfig replaces it with something else... - if (familyArray.Length() == 0) { - familyArray.AppendElement(NS_LITERAL_STRING("Helv")); - } - - for (uint32_t i = 0; i < familyArray.Length(); i++) { - nsRefPtr<gfxOS2Font> font = gfxOS2Font::GetOrMakeFont(familyArray[i], &mStyle); - if (font) { - mFonts.AppendElement(font); - } - } -} - -gfxOS2FontGroup::~gfxOS2FontGroup() -{ -#ifdef DEBUG_thebes_2 - printf("gfxOS2FontGroup[%#x]::~gfxOS2FontGroup()\n", (unsigned)this); -#endif -} - -gfxFontGroup *gfxOS2FontGroup::Copy(const gfxFontStyle *aStyle) -{ - return new gfxOS2FontGroup(mFamilies, aStyle, mUserFontSet); -} - -/** - * We use this to append an LTR or RTL Override character to the start of the - * string. This forces Pango to honour our direction even if there are neutral - * characters in the string. - */ -static int32_t AppendDirectionalIndicatorUTF8(bool aIsRTL, nsACString& aString) -{ - static const PRUnichar overrides[2][2] = { { 0x202d, 0 }, { 0x202e, 0 }}; // LRO, RLO - AppendUTF16toUTF8(overrides[aIsRTL], aString); - return 3; // both overrides map to 3 bytes in UTF8 -} - -gfxTextRun *gfxOS2FontGroup::MakeTextRun(const PRUnichar* aString, uint32_t aLength, - const Parameters* aParams, uint32_t aFlags) -{ - NS_ASSERTION(aLength > 0, "should use MakeEmptyTextRun for zero-length text"); - gfxTextRun *textRun = gfxTextRun::Create(aParams, aLength, this, aFlags); - if (!textRun) - return nullptr; - - mEnableKerning = !(aFlags & gfxTextRunFactory::TEXT_OPTIMIZE_SPEED); - - nsAutoCString utf8; - int32_t headerLen = AppendDirectionalIndicatorUTF8(textRun->IsRightToLeft(), utf8); - AppendUTF16toUTF8(Substring(aString, aString + aLength), utf8); - -#ifdef DEBUG_thebes_2 - NS_ConvertUTF8toUTF16 u16(utf8); - printf("gfxOS2FontGroup[%#x]::MakeTextRun(PRUnichar %s, %d, %#x, %d)\n", - (unsigned)this, NS_LossyConvertUTF16toASCII(u16).get(), aLength, (unsigned)aParams, aFlags); -#endif - - InitTextRun(textRun, (uint8_t *)utf8.get(), utf8.Length(), headerLen); - - textRun->FetchGlyphExtents(aParams->mContext); - - return textRun; -} - -gfxTextRun *gfxOS2FontGroup::MakeTextRun(const uint8_t* aString, uint32_t aLength, - const Parameters* aParams, uint32_t aFlags) -{ -#ifdef DEBUG_thebes_2 - const char *cStr = reinterpret_cast<const char *>(aString); - NS_ConvertASCIItoUTF16 us(cStr, aLength); - printf("gfxOS2FontGroup[%#x]::MakeTextRun(uint8_t %s, %d, %#x, %d)\n", - (unsigned)this, NS_LossyConvertUTF16toASCII(us).get(), aLength, (unsigned)aParams, aFlags); -#endif - NS_ASSERTION(aLength > 0, "should use MakeEmptyTextRun for zero-length text"); - NS_ASSERTION(aFlags & TEXT_IS_8BIT, "8bit should have been set"); - gfxTextRun *textRun = gfxTextRun::Create(aParams, aLength, this, aFlags); - if (!textRun) - return nullptr; - - mEnableKerning = !(aFlags & gfxTextRunFactory::TEXT_OPTIMIZE_SPEED); - - const char *chars = reinterpret_cast<const char *>(aString); - bool isRTL = textRun->IsRightToLeft(); - if ((aFlags & TEXT_IS_ASCII) && !isRTL) { - // We don't need to send an override character here, the characters must be all - // LTR - InitTextRun(textRun, (uint8_t *)chars, aLength, 0); - } else { - // Although chars in not necessarily ASCII (as it may point to the low - // bytes of any UCS-2 characters < 256), NS_ConvertASCIItoUTF16 seems - // to DTRT. - NS_ConvertASCIItoUTF16 unicodeString(chars, aLength); - nsAutoCString utf8; - int32_t headerLen = AppendDirectionalIndicatorUTF8(isRTL, utf8); - AppendUTF16toUTF8(unicodeString, utf8); - InitTextRun(textRun, (uint8_t *)utf8.get(), utf8.Length(), headerLen); - } - - textRun->FetchGlyphExtents(aParams->mContext); - - return textRun; -} - -void gfxOS2FontGroup::InitTextRun(gfxTextRun *aTextRun, const uint8_t *aUTF8Text, - uint32_t aUTF8Length, - uint32_t aUTF8HeaderLength) -{ - CreateGlyphRunsFT(aTextRun, aUTF8Text + aUTF8HeaderLength, - aUTF8Length - aUTF8HeaderLength); -} - -// Helper function to return the leading UTF-8 character in a char pointer -// as 32bit number. Also sets the length of the current character (i.e. the -// offset to the next one) in the second argument -uint32_t getUTF8CharAndNext(const uint8_t *aString, uint8_t *aLength) -{ - *aLength = 1; - if (aString[0] < 0x80) { // normal 7bit ASCII char - return aString[0]; - } - if ((aString[0] >> 5) == 6) { // two leading ones -> two bytes - *aLength = 2; - return ((aString[0] & 0x1F) << 6) + (aString[1] & 0x3F); - } - if ((aString[0] >> 4) == 14) { // three leading ones -> three bytes - *aLength = 3; - return ((aString[0] & 0x0F) << 12) + ((aString[1] & 0x3F) << 6) + - (aString[2] & 0x3F); - } - if ((aString[0] >> 4) == 15) { // four leading ones -> four bytes - *aLength = 4; - return ((aString[0] & 0x07) << 18) + ((aString[1] & 0x3F) << 12) + - ((aString[2] & 0x3F) << 6) + (aString[3] & 0x3F); - } - return aString[0]; -} - -void gfxOS2FontGroup::CreateGlyphRunsFT(gfxTextRun *aTextRun, const uint8_t *aUTF8, - uint32_t aUTF8Length) -{ -#ifdef DEBUG_thebes_2 - printf("gfxOS2FontGroup::CreateGlyphRunsFT(%#x, _aUTF8_, %d)\n", - (unsigned)aTextRun, /*aUTF8,*/ aUTF8Length); - for (uint32_t i = 0; i < FontListLength(); i++) { - gfxOS2Font *font = GetFontAt(i); - printf(" i=%d, name=%s, size=%f\n", i, NS_LossyConvertUTF16toASCII(font->GetName()).get(), - font->GetStyle()->size); - } -#endif - uint32_t lastFont = FontListLength()-1; - gfxOS2Font *font0 = GetFontAt(0); - const uint8_t *p = aUTF8; - uint32_t utf16Offset = 0; - gfxTextRun::CompressedGlyph g; - const uint32_t appUnitsPerDevUnit = aTextRun->GetAppUnitsPerDevUnit(); - gfxOS2Platform *platform = gfxOS2Platform::GetPlatform(); - - aTextRun->AddGlyphRun(font0, gfxTextRange::kFontGroup, 0, false); - // a textRun likely has the same font for most of the characters, so we can - // lock it before the loop for efficiency - FT_Face face0 = cairo_ft_scaled_font_lock_face(font0->CairoScaledFont()); - while (p < aUTF8 + aUTF8Length) { - bool glyphFound = false; - // convert UTF-8 character and step to the next one in line - uint8_t chLen; - uint32_t ch = getUTF8CharAndNext(p, &chLen); - p += chLen; // move to next char -#ifdef DEBUG_thebes_2 - printf("\'%c\' (%d, %#x, %s) [%#x %#x]:", (char)ch, ch, ch, ch >=0x10000 ? "non-BMP!" : "BMP", ch >=0x10000 ? H_SURROGATE(ch) : 0, ch >=0x10000 ? L_SURROGATE(ch) : 0); -#endif - - if (ch == 0 || platform->noFontWithChar(ch)) { - // null bytes or missing characters cannot be displayed - aTextRun->SetMissingGlyph(utf16Offset, ch); - } else { - // Try to get a glyph from all fonts available to us. - // Once we found it in one of the fonts we quit the loop early. - // If we don't find the glyph even in the last font, we will fall - // back to searching all fonts on the system and finally set the - // missing glyph symbol after trying the last font. - for (uint32_t i = 0; i <= lastFont; i++) { - gfxOS2Font *font = font0; - FT_Face face = face0; - if (i > 0) { - font = GetFontAt(i); - face = cairo_ft_scaled_font_lock_face(font->CairoScaledFont()); -#ifdef DEBUG_thebes_2 - if (i == lastFont) { - printf("Last font %d (%s) for ch=%#x (pos=%d)", - i, NS_LossyConvertUTF16toASCII(font->GetName()).get(), ch, utf16Offset); - } -#endif - } - if (!face || !face->charmap) { // don't try to use fonts with non-Unicode charmaps - if (face && face != face0) - cairo_ft_scaled_font_unlock_face(font->CairoScaledFont()); - continue; // next font - } - - NS_ASSERTION(!IsInvalidChar(ch), "Invalid char detected"); - FT_UInt gid = FT_Get_Char_Index(face, ch); // find the glyph id - - if (gid == 0 && i == lastFont) { - // missing glyph, try to find a replacement in another font - nsRefPtr<gfxOS2Font> fontX = platform->FindFontForChar(ch, font0); - if (fontX) { - font = fontX; // replace current font - cairo_ft_scaled_font_unlock_face(font->CairoScaledFont()); - face = cairo_ft_scaled_font_lock_face(fontX->CairoScaledFont()); - gid = FT_Get_Char_Index(face, ch); - // likely to find more chars in this font, append it - // to the font list to find it quicker next time - mFonts.AppendElement(fontX); - lastFont = FontListLength()-1; - } - } - - // select the current font into the text run - aTextRun->AddGlyphRun(font, gfxTextRange::kFontGroup, utf16Offset, false); - - int32_t advance = 0; - if (gid == font->GetSpaceGlyph()) { - advance = (int)(font->GetMetrics().spaceWidth * appUnitsPerDevUnit); - } else if (gid == 0) { - advance = -1; // trigger the missing glyphs case below - } else { - // find next character and its glyph -- in case they exist - // and exist in the current font face -- to compute kerning - uint32_t chNext = 0; - FT_UInt gidNext = 0; - FT_Pos lsbDeltaNext = 0; -#ifdef DEBUG_thebes_2 - printf("(kerning=%s/%s)", mEnableKerning ? "enable" : "disable", FT_HAS_KERNING(face) ? "yes" : "no"); -#endif - if (mEnableKerning && FT_HAS_KERNING(face) && p < aUTF8 + aUTF8Length) { - chNext = getUTF8CharAndNext(p, &chLen); - if (chNext) { - gidNext = FT_Get_Char_Index(face, chNext); - if (gidNext && gidNext != font->GetSpaceGlyph()) { - FT_Load_Glyph(face, gidNext, FT_LOAD_DEFAULT); - lsbDeltaNext = face->glyph->lsb_delta; - } - } - } - - // now load the current glyph - FT_Load_Glyph(face, gid, FT_LOAD_DEFAULT); // load glyph into the slot - advance = face->glyph->advance.x; - - // now add kerning to the current glyph's advance - if (chNext && gidNext) { - FT_Vector kerning; - FT_Get_Kerning(face, gid, gidNext, FT_KERNING_DEFAULT, &kerning); - advance += kerning.x; - if (face->glyph->rsb_delta - lsbDeltaNext >= 32) { - advance -= 64; - } else if (face->glyph->rsb_delta - lsbDeltaNext < -32) { - advance += 64; - } - } - - // now apply unit conversion and scaling - advance = (advance >> 6) * appUnitsPerDevUnit; - } -#ifdef DEBUG_thebes_2 - printf(" gid=%d, advance=%d (%s)\n", gid, advance, - NS_LossyConvertUTF16toASCII(font->GetName()).get()); -#endif - - if (advance >= 0 && - gfxTextRun::CompressedGlyph::IsSimpleAdvance(advance) && - gfxTextRun::CompressedGlyph::IsSimpleGlyphID(gid)) - { - aTextRun->SetSimpleGlyph(utf16Offset, - g.SetSimpleGlyph(advance, gid)); - glyphFound = true; - } else if (gid == 0) { - // gid = 0 only happens when the glyph is missing from the font - if (i == lastFont) { - // set the missing glyph only when it's missing from the very - // last font - aTextRun->SetMissingGlyph(utf16Offset, ch); - } - glyphFound = false; - } else { - gfxTextRun::DetailedGlyph details; - details.mGlyphID = gid; - NS_ASSERTION(details.mGlyphID == gid, "Seriously weird glyph ID detected!"); - details.mAdvance = advance; - details.mXOffset = 0; - details.mYOffset = 0; - g.SetComplex(aTextRun->IsClusterStart(utf16Offset), true, 1); - aTextRun->SetGlyphs(utf16Offset, g, &details); - glyphFound = true; - } - - if (i > 0) { - cairo_ft_scaled_font_unlock_face(font->CairoScaledFont()); - } - - if (glyphFound) { - break; - } - } - } // for all fonts - - NS_ASSERTION(!IS_SURROGATE(ch), "Surrogates shouldn't appear in UTF8"); - if (ch >= 0x10000) { - // This character is a surrogate pair in UTF16 - ++utf16Offset; - } - - ++utf16Offset; - } - cairo_ft_scaled_font_unlock_face(font0->CairoScaledFont()); -} - -// append aFontName to aClosure string array, if not already present -bool gfxOS2FontGroup::FontCallback(const nsAString& aFontName, - const nsACString& aGenericName, - bool aUseFontSet, - void *aClosure) -{ - nsTArray<nsString> *sa = static_cast<nsTArray<nsString>*>(aClosure); - if (!aFontName.IsEmpty() && !sa->Contains(aFontName)) { - sa->AppendElement(aFontName); - } - return true; -} diff --git a/gfx/thebes/gfxOS2Fonts.h b/gfx/thebes/gfxOS2Fonts.h deleted file mode 100644 index b353c4770..000000000 --- a/gfx/thebes/gfxOS2Fonts.h +++ /dev/null @@ -1,105 +0,0 @@ -/* vim: set sw=4 sts=4 et cin: */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifndef GFX_OS2_FONTS_H -#define GFX_OS2_FONTS_H - -#include "gfxTypes.h" -#include "gfxFont.h" -#include "gfxMatrix.h" -#include "nsDataHashtable.h" - -#define INCL_GPI -#include <os2.h> -#include <cairo-os2.h> -#include "cairo-ft.h" // includes fontconfig.h, too -#include <freetype/tttables.h> - -#include "nsICharsetConverterManager.h" - -class gfxOS2FontEntry : public gfxFontEntry { -public: - gfxOS2FontEntry(const nsAString& aName) : gfxFontEntry(aName) {} - ~gfxOS2FontEntry() {} -}; - -class gfxOS2Font : public gfxFont { -public: - gfxOS2Font(gfxOS2FontEntry *aFontEntry, const gfxFontStyle *aFontStyle); - virtual ~gfxOS2Font(); - - virtual const gfxFont::Metrics& GetMetrics(); - cairo_font_face_t *CairoFontFace(); - cairo_scaled_font_t *CairoScaledFont(); - - // Get the glyphID of a space - virtual uint32_t GetSpaceGlyph() { - if (!mMetrics) - GetMetrics(); - return mSpaceGlyph; - } - - static already_AddRefed<gfxOS2Font> GetOrMakeFont(const nsAString& aName, - const gfxFontStyle *aStyle); - -protected: - virtual bool SetupCairoFont(gfxContext *aContext); - - virtual FontType GetType() const { return FONT_TYPE_OS2; } - -private: - cairo_font_face_t *mFontFace; - Metrics *mMetrics; - gfxFloat mAdjustedSize; - uint32_t mSpaceGlyph; - int mHinting; - bool mAntialias; -}; - - -class gfxOS2FontGroup : public gfxFontGroup { -public: - gfxOS2FontGroup(const nsAString& aFamilies, const gfxFontStyle* aStyle, gfxUserFontSet *aUserFontSet); - virtual ~gfxOS2FontGroup(); - - virtual gfxFontGroup *Copy(const gfxFontStyle *aStyle); - - // create and initialize the textRun using FreeType font - virtual gfxTextRun *MakeTextRun(const PRUnichar* aString, uint32_t aLength, - const Parameters* aParams, uint32_t aFlags); - virtual gfxTextRun *MakeTextRun(const uint8_t* aString, uint32_t aLength, - const Parameters* aParams, uint32_t aFlags); - - gfxOS2Font *GetFontAt(int32_t i) { - // If it turns out to be hard for all clients that cache font - // groups to call UpdateFontList at appropriate times, we could - // instead consider just calling UpdateFontList from someplace - // more central (such as here). - NS_ASSERTION(!mUserFontSet || mCurrGeneration == GetGeneration(), - "Whoever was caching this font group should have " - "called UpdateFontList on it"); - -#ifdef DEBUG_thebes_2 - printf("gfxOS2FontGroup[%#x]::GetFontAt(%d), %#x, %#x\n", - (unsigned)this, i, (unsigned)&mFonts, (unsigned)&mFonts[i]); -#endif - return static_cast<gfxOS2Font*>(static_cast<gfxFont*>(mFonts[i])); - } - -protected: - void InitTextRun(gfxTextRun *aTextRun, const uint8_t *aUTF8Text, - uint32_t aUTF8Length, uint32_t aUTF8HeaderLength); - void CreateGlyphRunsFT(gfxTextRun *aTextRun, const uint8_t *aUTF8, - uint32_t aUTF8Length); - static bool FontCallback(const nsAString& aFontName, - const nsACString& aGenericName, - bool aUseFontSet, - void *aClosure); - -private: - bool mEnableKerning; -}; - -#endif /* GFX_OS2_FONTS_H */ diff --git a/gfx/thebes/gfxOS2Platform.cpp b/gfx/thebes/gfxOS2Platform.cpp deleted file mode 100644 index f8eee640a..000000000 --- a/gfx/thebes/gfxOS2Platform.cpp +++ /dev/null @@ -1,188 +0,0 @@ -/* vim: set sw=4 sts=4 et cin: */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "gfxOS2Platform.h" -#include "gfxOS2Surface.h" -#include "gfxImageSurface.h" -#include "gfxOS2Fonts.h" -#include "nsTArray.h" - -#include "gfxFontconfigUtils.h" -//#include <fontconfig/fontconfig.h> - -/********************************************************************** - * class gfxOS2Platform - **********************************************************************/ -gfxFontconfigUtils *gfxOS2Platform::sFontconfigUtils = nullptr; - -gfxOS2Platform::gfxOS2Platform() -{ -#ifdef DEBUG_thebes - printf("gfxOS2Platform::gfxOS2Platform()\n"); -#endif - // this seems to be reasonably early in the process and only once, - // so it's a good place to initialize OS/2 cairo stuff - cairo_os2_init(); -#ifdef DEBUG_thebes - printf(" cairo_os2_init() was called\n"); -#endif - if (!sFontconfigUtils) { - sFontconfigUtils = gfxFontconfigUtils::GetFontconfigUtils(); - } -} - -gfxOS2Platform::~gfxOS2Platform() -{ -#ifdef DEBUG_thebes - printf("gfxOS2Platform::~gfxOS2Platform()\n"); -#endif - gfxFontconfigUtils::Shutdown(); - sFontconfigUtils = nullptr; - - // clean up OS/2 cairo stuff - cairo_os2_fini(); -#ifdef DEBUG_thebes - printf(" cairo_os2_fini() was called\n"); -#endif -} - -already_AddRefed<gfxASurface> -gfxOS2Platform::CreateOffscreenSurface(const gfxIntSize& aSize, - gfxASurface::gfxContentType contentType) -{ -#ifdef DEBUG_thebes_2 - printf("gfxOS2Platform::CreateOffscreenSurface(%d/%d, %d)\n", - aSize.width, aSize.height, aImageFormat); -#endif - gfxASurface *newSurface = nullptr; - - // we only ever seem to get aImageFormat=0 or ImageFormatARGB32 but - // I don't really know if we need to differ between ARGB32 and RGB24 here - if (contentType == gfxASurface::CONTENT_COLOR_ALPHA || - contentType == gfxASurface::CONTENT_COLOR) - { - newSurface = new gfxOS2Surface(aSize, OptimalFormatForContent(contentType)); - } else if (contentType == gfxASurface::CONTENT_ALPHA) { - newSurface = new gfxImageSurface(aSize, OptimalFormatForContent(contentType)); - } else { - return nullptr; - } - - NS_IF_ADDREF(newSurface); - return newSurface; -} - -nsresult -gfxOS2Platform::GetFontList(nsIAtom *aLangGroup, - const nsACString& aGenericFamily, - nsTArray<nsString>& aListOfFonts) -{ -#ifdef DEBUG_thebes - const char *langgroup = "(null)"; - if (aLangGroup) { - aLangGroup->GetUTF8String(&langgroup); - } - char *family = ToNewCString(aGenericFamily); - printf("gfxOS2Platform::GetFontList(%s, %s, ..)\n", - langgroup, family); - free(family); -#endif - return sFontconfigUtils->GetFontList(aLangGroup, aGenericFamily, - aListOfFonts); -} - -nsresult gfxOS2Platform::UpdateFontList() -{ -#ifdef DEBUG_thebes - printf("gfxOS2Platform::UpdateFontList()\n"); -#endif - mCodepointsWithNoFonts.reset(); - - nsresult rv = sFontconfigUtils->UpdateFontList(); - - // initialize ranges of characters for which system-wide font search should be skipped - mCodepointsWithNoFonts.SetRange(0,0x1f); // C0 controls - mCodepointsWithNoFonts.SetRange(0x7f,0x9f); // C1 controls - return rv; -} - -nsresult -gfxOS2Platform::ResolveFontName(const nsAString& aFontName, - FontResolverCallback aCallback, - void *aClosure, bool& aAborted) -{ -#ifdef DEBUG_thebes - char *fontname = ToNewCString(aFontName); - printf("gfxOS2Platform::ResolveFontName(%s, ...)\n", fontname); - free(fontname); -#endif - return sFontconfigUtils->ResolveFontName(aFontName, aCallback, aClosure, - aAborted); -} - -nsresult -gfxOS2Platform::GetStandardFamilyName(const nsAString& aFontName, nsAString& aFamilyName) -{ - return sFontconfigUtils->GetStandardFamilyName(aFontName, aFamilyName); -} - -gfxFontGroup * -gfxOS2Platform::CreateFontGroup(const nsAString &aFamilies, - const gfxFontStyle *aStyle, - gfxUserFontSet *aUserFontSet) -{ - return new gfxOS2FontGroup(aFamilies, aStyle, aUserFontSet); -} - -already_AddRefed<gfxOS2Font> -gfxOS2Platform::FindFontForChar(uint32_t aCh, gfxOS2Font *aFont) -{ -#ifdef DEBUG_thebes - printf("gfxOS2Platform::FindFontForChar(%d, ...)\n", aCh); -#endif - - // is codepoint with no matching font? return null immediately - if (mCodepointsWithNoFonts.test(aCh)) { - return nullptr; - } - - // the following is not very clever but it's a quick fix to search all fonts - // (one should instead cache the charmaps as done on Mac and Win) - - // just continue to append all fonts known to the system - nsTArray<nsString> fontList; - nsAutoCString generic; - nsresult rv = GetFontList(aFont->GetStyle()->language, generic, fontList); - if (NS_SUCCEEDED(rv)) { - // start at 3 to skip over the generic entries - for (uint32_t i = 3; i < fontList.Length(); i++) { -#ifdef DEBUG_thebes - printf("searching in entry i=%d (%s)\n", - i, NS_LossyConvertUTF16toASCII(fontList[i]).get()); -#endif - nsRefPtr<gfxOS2Font> font = - gfxOS2Font::GetOrMakeFont(fontList[i], aFont->GetStyle()); - if (!font) - continue; - FT_Face face = cairo_ft_scaled_font_lock_face(font->CairoScaledFont()); - if (!face || !face->charmap) { - if (face) - cairo_ft_scaled_font_unlock_face(font->CairoScaledFont()); - continue; - } - - FT_UInt gid = FT_Get_Char_Index(face, aCh); // find the glyph id - if (gid != 0) { - // this is the font - cairo_ft_scaled_font_unlock_face(font->CairoScaledFont()); - return font.forget(); - } - } - } - - // no match found, so add to the set of non-matching codepoints - mCodepointsWithNoFonts.set(aCh); - return nullptr; -} diff --git a/gfx/thebes/gfxOS2Platform.h b/gfx/thebes/gfxOS2Platform.h deleted file mode 100644 index 2c2a2c034..000000000 --- a/gfx/thebes/gfxOS2Platform.h +++ /dev/null @@ -1,65 +0,0 @@ -/* vim: set sw=4 sts=4 et cin: */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifndef GFX_OS2_PLATFORM_H -#define GFX_OS2_PLATFORM_H - -#define INCL_GPIBITMAPS -#include <os2.h> - -#include "gfxPlatform.h" -#include "gfxOS2Fonts.h" -#include "gfxFontUtils.h" -#include "nsTArray.h" - -class gfxFontconfigUtils; - -class gfxOS2Platform : public gfxPlatform { - -public: - gfxOS2Platform(); - virtual ~gfxOS2Platform(); - - static gfxOS2Platform *GetPlatform() { - return (gfxOS2Platform*) gfxPlatform::GetPlatform(); - } - - already_AddRefed<gfxASurface> - CreateOffscreenSurface(const gfxIntSize& size, - gfxASurface::gfxContentType contentType); - - nsresult GetFontList(nsIAtom *aLangGroup, - const nsACString& aGenericFamily, - nsTArray<nsString>& aListOfFonts); - nsresult UpdateFontList(); - nsresult ResolveFontName(const nsAString& aFontName, - FontResolverCallback aCallback, - void *aClosure, bool& aAborted); - nsresult GetStandardFamilyName(const nsAString& aFontName, nsAString& aFamilyName); - - gfxFontGroup *CreateFontGroup(const nsAString &aFamilies, - const gfxFontStyle *aStyle, - gfxUserFontSet *aUserFontSet); - - // Given a string and a font we already have, find the font that - // supports the most code points and most closely resembles aFont. - // This simple version involves looking at the fonts on the machine to see - // which code points they support. - already_AddRefed<gfxOS2Font> FindFontForChar(uint32_t aCh, gfxOS2Font *aFont); - - // return true if it's already known that we don't have a font for this char - bool noFontWithChar(uint32_t aCh) { - return mCodepointsWithNoFonts.test(aCh); - } - -protected: - static gfxFontconfigUtils *sFontconfigUtils; - -private: - // when font lookup fails for a character, cache it to skip future searches - gfxSparseBitSet mCodepointsWithNoFonts; -}; - -#endif /* GFX_OS2_PLATFORM_H */ diff --git a/gfx/thebes/gfxOS2Surface.cpp b/gfx/thebes/gfxOS2Surface.cpp deleted file mode 100644 index 18098617f..000000000 --- a/gfx/thebes/gfxOS2Surface.cpp +++ /dev/null @@ -1,203 +0,0 @@ -/* vim: set sw=4 sts=4 et cin: */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "gfxOS2Surface.h" - -#include <stdio.h> - -/********************************************************************** - * class gfxOS2Surface - **********************************************************************/ - -gfxOS2Surface::gfxOS2Surface(const gfxIntSize& aSize, - gfxASurface::gfxImageFormat aImageFormat) - : mWnd(0), mSize(aSize) -{ -#ifdef DEBUG_thebes_2 - printf("gfxOS2Surface[%#x]::gfxOS2Surface(Size=%dx%d, %d)\n", (unsigned int)this, - aSize.width, aSize.height, aImageFormat); -#endif - // in this case we don't have a window, so we create a memory presentation - // space to construct the cairo surface on - - // create a PS, partly taken from nsOffscreenSurface::Init(), i.e. nsDrawingSurfaceOS2.cpp - DEVOPENSTRUC dop = { 0, 0, 0, 0, 0 }; - SIZEL sizel = { 0, 0 }; // use same page size as device - mDC = DevOpenDC(0, OD_MEMORY, (PSZ)"*", 5, (PDEVOPENDATA)&dop, NULLHANDLE); - NS_ASSERTION(mDC != DEV_ERROR, "Could not create memory DC"); - - mPS = GpiCreatePS(0, mDC, &sizel, PU_PELS | GPIT_MICRO | GPIA_ASSOC); - NS_ASSERTION(mPS != GPI_ERROR, "Could not create PS on memory DC!"); - - // now create a bitmap of the right size - BITMAPINFOHEADER2 hdr = { 0 }; - hdr.cbFix = sizeof(BITMAPINFOHEADER2); - hdr.cx = mSize.width; - hdr.cy = mSize.height; - hdr.cPlanes = 1; - - // find bit depth - LONG lBitCount = 0; - DevQueryCaps(mDC, CAPS_COLOR_BITCOUNT, 1, &lBitCount); - hdr.cBitCount = (USHORT)lBitCount; - - mBitmap = GpiCreateBitmap(mPS, &hdr, 0, 0, 0); - NS_ASSERTION(mBitmap != GPI_ERROR, "Could not create bitmap in memory!"); - // set final stats & select bitmap into PS - GpiSetBitmap(mPS, mBitmap); - - // now we can finally create the cairo surface on the in-memory PS - cairo_surface_t *surf = cairo_os2_surface_create(mPS, mSize.width, mSize.height); -#ifdef DEBUG_thebes_2 - printf(" type(%#x)=%d (ID=%#x, h/w=%d/%d)\n", (unsigned int)surf, - cairo_surface_get_type(surf), (unsigned int)mPS, mSize.width, mSize.height); -#endif - // Normally, OS/2 cairo surfaces have to be forced to redraw completely - // by calling cairo_surface_mark_dirty(surf), but Mozilla paints them in - // full, so that is not necessary here. - - // manual refresh is done from nsWindow::OnPaint - cairo_os2_surface_set_manual_window_refresh(surf, 1); - - Init(surf); -} - -gfxOS2Surface::gfxOS2Surface(HWND aWnd) - : mWnd(aWnd), mDC(nullptr), mPS(nullptr), mBitmap(nullptr) -{ -#ifdef DEBUG_thebes_2 - printf("gfxOS2Surface[%#x]::gfxOS2Surface(HWND=%#x)\n", (unsigned int)this, - (unsigned int)aWnd); -#endif - - RECTL rectl; - WinQueryWindowRect(aWnd, &rectl); - mSize.width = rectl.xRight - rectl.xLeft; - mSize.height = rectl.yTop - rectl.yBottom; - if (mSize.width == 0) mSize.width = 1; // fake a minimal surface area to let - if (mSize.height == 0) mSize.height = 1; // cairo_os2_surface_create() return something - - // This variation on cairo_os2_surface_create() avoids creating a - // persistent HPS that may never be used. It also enables manual - // refresh so nsWindow::OnPaint() controls when the screen is updated. - cairo_surface_t *surf = - cairo_os2_surface_create_for_window(mWnd, mSize.width, mSize.height); -#ifdef DEBUG_thebes_2 - printf(" type(%#x)=%d (ID=%#x, h/w=%d/%d)\n", (unsigned int)surf, - cairo_surface_get_type(surf), (unsigned int)mPS, mSize.width, mSize.height); -#endif - - Init(surf); -} - -gfxOS2Surface::gfxOS2Surface(HDC aDC, const gfxIntSize& aSize) - : mWnd(0), mDC(aDC), mBitmap(nullptr), mSize(aSize) -{ -#ifdef DEBUG_thebes_2 - printf("gfxOS2Surface[%#x]::gfxOS2Surface(HDC=%#x, Size=%dx%d)\n", (unsigned int)this, - (unsigned int)aDC, aSize.width, aSize.height); -#endif - SIZEL sizel = { 0, 0 }; // use same page size as device - mPS = GpiCreatePS(0, mDC, &sizel, PU_PELS | GPIT_MICRO | GPIA_ASSOC); - NS_ASSERTION(mPS != GPI_ERROR, "Could not create PS on print DC!"); - - // now create a bitmap of the right size - BITMAPINFOHEADER2 hdr = { 0 }; - hdr.cbFix = sizeof(BITMAPINFOHEADER2); - hdr.cx = mSize.width; - hdr.cy = mSize.height; - hdr.cPlanes = 1; - - // find bit depth - LONG lBitCount = 0; - DevQueryCaps(mDC, CAPS_COLOR_BITCOUNT, 1, &lBitCount); - hdr.cBitCount = (USHORT)lBitCount; - - mBitmap = GpiCreateBitmap(mPS, &hdr, 0, 0, 0); - NS_ASSERTION(mBitmap != GPI_ERROR, "Could not create bitmap for printer!"); - // set final stats & select bitmap into PS - GpiSetBitmap(mPS, mBitmap); - - // now we can finally create the cairo surface on the in-memory PS - cairo_surface_t *surf = cairo_os2_surface_create(mPS, mSize.width, mSize.height); -#ifdef DEBUG_thebes_2 - printf(" type(%#x)=%d (ID=%#x, h/w=%d/%d)\n", (unsigned int)surf, - cairo_surface_get_type(surf), (unsigned int)mPS, mSize.width, mSize.height); -#endif - // Normally, OS/2 cairo surfaces have to be forced to redraw completely - // by calling cairo_surface_mark_dirty(surf), but Mozilla paints them in - // full, so that is not necessary here. - - Init(surf); -} - -gfxOS2Surface::~gfxOS2Surface() -{ -#ifdef DEBUG_thebes_2 - printf("gfxOS2Surface[%#x]::~gfxOS2Surface()\n", (unsigned int)this); -#endif - - // Surfaces connected to a window were created using WinGetPS so we should - // release it again with WinReleasePS. Memory or printer surfaces on the - // other hand were created on device contexts with the GPI functions, so - // use those to clean up stuff. - if (mWnd) { - if (mPS) { - WinReleasePS(mPS); - } - } else { - if (mBitmap) { - GpiSetBitmap(mPS, NULL); - GpiDeleteBitmap(mBitmap); - } - if (mPS) { - GpiDestroyPS(mPS); - } - if (mDC) { - DevCloseDC(mDC); - } - } -} - -void gfxOS2Surface::Refresh(RECTL *aRect, HPS aPS) -{ -#ifdef DEBUG_thebes_2 - printf("gfxOS2Surface[%#x]::Refresh(x=%ld,%ld/y=%ld,%ld, HPS=%#x), mPS=%#x\n", - (unsigned int)this, - aRect->xLeft, aRect->xRight, aRect->yBottom, aRect->yTop, - (unsigned int)aPS, (unsigned int)mPS); -#endif - cairo_os2_surface_refresh_window(CairoSurface(), (aPS ? aPS : mPS), aRect); -} - -int gfxOS2Surface::Resize(const gfxIntSize& aSize) -{ -#ifdef DEBUG_thebes_2 - printf("gfxOS2Surface[%#x]::Resize(%dx%d)\n", (unsigned int)this, - aSize.width, aSize.height); -#endif - mSize = aSize; // record the new size - // hardcode mutex timeout to 50ms for now - return cairo_os2_surface_set_size(CairoSurface(), mSize.width, mSize.height, 50); -} - -HPS gfxOS2Surface::GetPS() -{ - // Creating an HPS on-the-fly should never be needed because GetPS() - // is only called for printing surfaces & mPS should only be null for - // window surfaces. It would be a bug if Cairo had an HPS but Thebes - // didn't, but we'll check anyway to avoid leakage. As a last resort, - // if this is a window surface we'll create one & hang on to it. - if (!mPS) { - cairo_os2_surface_get_hps(CairoSurface(), &mPS); - if (!mPS && mWnd) { - mPS = WinGetPS(mWnd); - cairo_os2_surface_set_hps(CairoSurface(), mPS); - } - } - - return mPS; -} - diff --git a/gfx/thebes/gfxOS2Surface.h b/gfx/thebes/gfxOS2Surface.h deleted file mode 100644 index 85f8ca466..000000000 --- a/gfx/thebes/gfxOS2Surface.h +++ /dev/null @@ -1,48 +0,0 @@ -/* vim: set sw=4 sts=4 et cin: */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifndef GFX_OS2_SURFACE_H -#define GFX_OS2_SURFACE_H - -#include "gfxASurface.h" - -#define INCL_GPIBITMAPS -#include <os2.h> -#include <cairo-os2.h> - -class gfxOS2Surface : public gfxASurface { - -public: - // constructor used to create a memory surface of given size - gfxOS2Surface(const gfxIntSize& aSize, - gfxASurface::gfxImageFormat aImageFormat); - // constructor for surface connected to an onscreen window - gfxOS2Surface(HWND aWnd); - // constructor for surface connected to a printing device context - gfxOS2Surface(HDC aDC, const gfxIntSize& aSize); - virtual ~gfxOS2Surface(); - - // Special functions that only make sense for the OS/2 port of cairo: - - // Update the cairo surface. - // While gfxOS2Surface keeps track of the presentation handle itself, - // use the one from WinBeginPaint() here. - void Refresh(RECTL *aRect, HPS aPS); - - // Reset the cairo surface to the given size. - int Resize(const gfxIntSize& aSize); - - HPS GetPS(); - virtual const gfxIntSize GetSize() const { return mSize; } - -private: - HWND mWnd; // non-null if created through the HWND constructor - HDC mDC; // memory device context - HPS mPS; // presentation space connected to window or memory device - HBITMAP mBitmap; // bitmap for initialization of memory surface - gfxIntSize mSize; // current size of the surface -}; - -#endif /* GFX_OS2_SURFACE_H */ diff --git a/gfx/thebes/gfxPlatform.cpp b/gfx/thebes/gfxPlatform.cpp index 43e9d2560..73601d43c 100644 --- a/gfx/thebes/gfxPlatform.cpp +++ b/gfx/thebes/gfxPlatform.cpp @@ -27,8 +27,6 @@ #include "gfxPlatformGtk.h" #elif defined(MOZ_WIDGET_QT) #include "gfxQtPlatform.h" -#elif defined(XP_OS2) -#include "gfxOS2Platform.h" #elif defined(ANDROID) #include "gfxAndroidPlatform.h" #endif @@ -320,8 +318,6 @@ gfxPlatform::Init() gPlatform = new gfxPlatformGtk; #elif defined(MOZ_WIDGET_QT) gPlatform = new gfxQtPlatform; -#elif defined(XP_OS2) - gPlatform = new gfxOS2Platform; #elif defined(ANDROID) gPlatform = new gfxAndroidPlatform; #else diff --git a/gfx/thebes/gfxPlatform.h b/gfx/thebes/gfxPlatform.h index 6ddd0330e..03e5e3c4a 100644 --- a/gfx/thebes/gfxPlatform.h +++ b/gfx/thebes/gfxPlatform.h @@ -21,10 +21,6 @@ #include "mozilla/RefPtr.h" #include "GfxInfoCollector.h" -#ifdef XP_OS2 -#undef OS2EMX_PLAIN_CHAR -#endif - class gfxImageSurface; class gfxFont; class gfxFontGroup; diff --git a/gfx/thebes/moz.build b/gfx/thebes/moz.build index 991378da0..a38ecd837 100644 --- a/gfx/thebes/moz.build +++ b/gfx/thebes/moz.build @@ -136,21 +136,6 @@ elif CONFIG['MOZ_WIDGET_GTK']: CPP_SOURCES += [ 'gfxPangoFonts.cpp', ] -elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'os2': - EXPORTS += [ - 'gfxOS2Fonts.h', - 'gfxOS2Platform.h', - 'gfxOS2Surface.h', - 'gfxPDFSurface.h', - ] - CPP_SOURCES += [ - 'gfxOS2Fonts.cpp', - 'gfxOS2Platform.cpp', - 'gfxOS2Surface.cpp', - 'nsUnicodeRange.cpp', - 'gfxFontconfigUtils.cpp', - 'gfxPDFSurface.cpp' - ] elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'qt': EXPORTS += [ 'gfxFT2FontBase.h', diff --git a/image/decoders/icon/Makefile.in b/image/decoders/icon/Makefile.in index 73fccce8a..2207dcc67 100644 --- a/image/decoders/icon/Makefile.in +++ b/image/decoders/icon/Makefile.in @@ -28,10 +28,6 @@ ifeq ($(OS_ARCH),WINNT) PLATFORM = win endif -ifeq ($(OS_ARCH),OS2) -PLATFORM = os2 -endif - ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT)) PLATFORM = mac endif diff --git a/image/decoders/icon/os2/Makefile.in b/image/decoders/icon/os2/Makefile.in deleted file mode 100644 index 79f28f22d..000000000 --- a/image/decoders/icon/os2/Makefile.in +++ /dev/null @@ -1,19 +0,0 @@ -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -DEPTH = @DEPTH@ -topsrcdir = @top_srcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ - -include $(DEPTH)/config/autoconf.mk - -LIBXUL_LIBRARY = 1 - -# we don't want the shared lib, but we want to force the creation of a static lib. -FORCE_STATIC_LIB = 1 - -include $(topsrcdir)/config/rules.mk - diff --git a/image/decoders/icon/os2/moz.build b/image/decoders/icon/os2/moz.build deleted file mode 100644 index 4e03b68de..000000000 --- a/image/decoders/icon/os2/moz.build +++ /dev/null @@ -1,14 +0,0 @@ -# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*- -# vim: set filetype=python: -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -MODULE = 'imgicon' - -CPP_SOURCES += [ - 'nsIconChannel.cpp', -] - -LIBRARY_NAME = 'imgiconos2_s' - diff --git a/image/decoders/icon/os2/nsIconChannel.cpp b/image/decoders/icon/os2/nsIconChannel.cpp deleted file mode 100644 index e8823cc13..000000000 --- a/image/decoders/icon/os2/nsIconChannel.cpp +++ /dev/null @@ -1,716 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set sw=2 sts=2 et cin: */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -//------------------------------------------------------------------------ - -#include "nsIconChannel.h" -#include "nsIIconURI.h" -#include "nsReadableUtils.h" -#include "nsMemory.h" -#include "nsNetUtil.h" -#include "nsMimeTypes.h" -#include "nsIFile.h" -#include "nsIFileURL.h" -#include "nsDirectoryServiceDefs.h" -#include "nsIRwsService.h" - -#define INCL_PM -#include <os2.h> - -//------------------------------------------------------------------------ - -// Due to byte swap, the second nibble is the first pixel of the pair -#define FIRSTPEL(x) (0xF & (x >> 4)) -#define SECONDPEL(x) (0xF & x) - -// nbr of bytes per row, rounded up to the nearest dword boundary -#define ALIGNEDBPR(cx,bits) ((( ((cx)*(bits)) + 31) / 32) * 4) - -// nbr of bytes per row, rounded up to the nearest byte boundary -#define UNALIGNEDBPR(cx,bits) (( ((cx)*(bits)) + 7) / 8) - -// native icon functions -static HPOINTER GetIcon(nsCString& file, bool fExists, - bool fMini, bool *fWpsIcon); -static void DestroyIcon(HPOINTER hIcon, bool fWpsIcon); - -void ConvertColorBitMap(uint8_t *inBuf, PBITMAPINFO2 pBMInfo, - uint8_t *outBuf, bool fShrink); -void ConvertMaskBitMap(uint8_t *inBuf, PBITMAPINFO2 pBMInfo, - uint8_t *outBuf, bool fShrink); - -//------------------------------------------------------------------------ - -// reduces overhead by preventing calls to nsRws when it isn't present -static bool sUseRws = true; - -//------------------------------------------------------------------------ -// nsIconChannel methods - -nsIconChannel::nsIconChannel() -{ -} - -nsIconChannel::~nsIconChannel() -{} - -NS_IMPL_THREADSAFE_ISUPPORTS4(nsIconChannel, - nsIChannel, - nsIRequest, - nsIRequestObserver, - nsIStreamListener) - -nsresult nsIconChannel::Init(nsIURI* uri) -{ - NS_ASSERTION(uri, "no uri"); - mUrl = uri; - mOriginalURI = uri; - nsresult rv; - mPump = do_CreateInstance(NS_INPUTSTREAMPUMP_CONTRACTID, &rv); - return rv; -} - -//------------------------------------------------------------------------ -// nsIRequest methods: - -NS_IMETHODIMP nsIconChannel::GetName(nsACString &result) -{ - return mUrl->GetSpec(result); -} - -NS_IMETHODIMP nsIconChannel::IsPending(bool *result) -{ - return mPump->IsPending(result); -} - -NS_IMETHODIMP nsIconChannel::GetStatus(nsresult *status) -{ - return mPump->GetStatus(status); -} - -NS_IMETHODIMP nsIconChannel::Cancel(nsresult status) -{ - return mPump->Cancel(status); -} - -NS_IMETHODIMP nsIconChannel::Suspend(void) -{ - return mPump->Suspend(); -} - -NS_IMETHODIMP nsIconChannel::Resume(void) -{ - return mPump->Resume(); -} - -NS_IMETHODIMP nsIconChannel::GetLoadGroup(nsILoadGroup* *aLoadGroup) -{ - *aLoadGroup = mLoadGroup; - NS_IF_ADDREF(*aLoadGroup); - return NS_OK; -} - -NS_IMETHODIMP nsIconChannel::SetLoadGroup(nsILoadGroup* aLoadGroup) -{ - mLoadGroup = aLoadGroup; - return NS_OK; -} - -NS_IMETHODIMP nsIconChannel::GetLoadFlags(uint32_t *aLoadAttributes) -{ - return mPump->GetLoadFlags(aLoadAttributes); -} - -NS_IMETHODIMP nsIconChannel::SetLoadFlags(uint32_t aLoadAttributes) -{ - return mPump->SetLoadFlags(aLoadAttributes); -} - -//------------------------------------------------------------------------ -// nsIChannel methods: - -NS_IMETHODIMP nsIconChannel::GetOriginalURI(nsIURI* *aURI) -{ - *aURI = mOriginalURI; - NS_ADDREF(*aURI); - return NS_OK; -} - -NS_IMETHODIMP nsIconChannel::SetOriginalURI(nsIURI* aURI) -{ - NS_ENSURE_ARG_POINTER(aURI); - mOriginalURI = aURI; - return NS_OK; -} - -NS_IMETHODIMP nsIconChannel::GetURI(nsIURI* *aURI) -{ - *aURI = mUrl; - NS_IF_ADDREF(*aURI); - return NS_OK; -} - -NS_IMETHODIMP -nsIconChannel::Open(nsIInputStream **_retval) -{ - return MakeInputStream(_retval, false); -} - -NS_IMETHODIMP nsIconChannel::AsyncOpen(nsIStreamListener *aListener, nsISupports *ctxt) -{ - nsCOMPtr<nsIInputStream> inStream; - nsresult rv = MakeInputStream(getter_AddRefs(inStream), true); - if (NS_FAILED(rv)) - return rv; - - // Init our streampump - rv = mPump->Init(inStream, int64_t(-1), int64_t(-1), 0, 0, false); - if (NS_FAILED(rv)) - return rv; - - rv = mPump->AsyncRead(this, ctxt); - if (NS_SUCCEEDED(rv)) { - // Store our real listener - mListener = aListener; - // Add ourself to the load group, if available - if (mLoadGroup) - mLoadGroup->AddRequest(this, nullptr); - } - return rv; -} - -nsresult nsIconChannel::ExtractIconInfoFromUrl(nsIFile ** aLocalFile, uint32_t * aDesiredImageSize, nsACString &aContentType, nsACString &aFileExtension) -{ - nsresult rv = NS_OK; - nsCOMPtr<nsIMozIconURI> iconURI (do_QueryInterface(mUrl, &rv)); - NS_ENSURE_SUCCESS(rv, rv); - - iconURI->GetImageSize(aDesiredImageSize); - iconURI->GetContentType(aContentType); - iconURI->GetFileExtension(aFileExtension); - - nsCOMPtr<nsIURL> url; - rv = iconURI->GetIconURL(getter_AddRefs(url)); - if (NS_FAILED(rv) || !url) return NS_OK; - - nsCOMPtr<nsIFileURL> fileURL = do_QueryInterface(url, &rv); - if (NS_FAILED(rv) || !fileURL) return NS_OK; - - nsCOMPtr<nsIFile> file; - rv = fileURL->GetFile(getter_AddRefs(file)); - if (NS_FAILED(rv) || !file) return NS_OK; - - *aLocalFile = file; - NS_IF_ADDREF(*aLocalFile); - return NS_OK; -} - -//------------------------------------------------------------------------ - -// retrieves a native icon with 16, 256, or 16M colors and converts it to cairo -// format; Note: this implementation ignores the file's MIME-type because -// using it virtually guarantees we'll end up with an inappropriate icon (i.e. -// an .exe icon) - -nsresult nsIconChannel::MakeInputStream(nsIInputStream **_retval, - bool nonBlocking) -{ - - // get some details about this icon - nsCOMPtr<nsIFile> localFile; - uint32_t desiredImageSize; - nsXPIDLCString contentType; - nsAutoCString filePath; - nsresult rv = ExtractIconInfoFromUrl(getter_AddRefs(localFile), - &desiredImageSize, contentType, - filePath); - NS_ENSURE_SUCCESS(rv, rv); - - // if the file exists, get its path - bool fileExists = false; - if (localFile) { - localFile->GetNativePath(filePath); - localFile->Exists(&fileExists); - } - - // get the file's icon from either the WPS or PM - bool fWpsIcon = false; - HPOINTER hIcon = GetIcon(filePath, fileExists, - desiredImageSize <= 16, &fWpsIcon); - if (hIcon == NULLHANDLE) - return NS_ERROR_FAILURE; - - // get the color & mask bitmaps used by the icon - POINTERINFO IconInfo; - if (!WinQueryPointerInfo(hIcon, &IconInfo)) { - DestroyIcon(hIcon, fWpsIcon); - return NS_ERROR_FAILURE; - } - - // if we need a mini-icon, use those bitmaps if present; - // otherwise, signal that the icon needs to be shrunk - bool fShrink = FALSE; - if (desiredImageSize <= 16) { - if (IconInfo.hbmMiniPointer) { - IconInfo.hbmColor = IconInfo.hbmMiniColor; - IconInfo.hbmPointer = IconInfo.hbmMiniPointer; - } else { - fShrink = TRUE; - } - } - - // various resources to be allocated - PBITMAPINFO2 pBMInfo = 0; - uint8_t* pInBuf = 0; - uint8_t* pOutBuf = 0; - HDC hdc = 0; - HPS hps = 0; - - // using this dummy do{...}while(0) "loop" guarantees that resources will - // be deallocated, but eliminates the need for nesting, and generally makes - // testing for & dealing with errors pretty painless (just 'break') - do { - rv = NS_ERROR_FAILURE; - - // get the details for the color bitmap; if there isn't one - // or this is 1-bit color, exit - BITMAPINFOHEADER2 BMHeader; - BMHeader.cbFix = sizeof(BMHeader); - if (!IconInfo.hbmColor || - !GpiQueryBitmapInfoHeader(IconInfo.hbmColor, &BMHeader) || - BMHeader.cBitCount == 1) - break; - - // alloc space for the color bitmap's info, including its color table - uint32_t cbBMInfo = sizeof(BITMAPINFO2) + (sizeof(RGB2) * 255); - pBMInfo = (PBITMAPINFO2)nsMemory::Alloc(cbBMInfo); - if (!pBMInfo) - break; - - // alloc space for the color bitmap data - uint32_t cbInRow = ALIGNEDBPR(BMHeader.cx, BMHeader.cBitCount); - uint32_t cbInBuf = cbInRow * BMHeader.cy; - pInBuf = (uint8_t*)nsMemory::Alloc(cbInBuf); - if (!pInBuf) - break; - memset(pInBuf, 0, cbInBuf); - - // alloc space for the BGRA32 bitmap we're creating - uint32_t cxOut = fShrink ? BMHeader.cx / 2 : BMHeader.cx; - uint32_t cyOut = fShrink ? BMHeader.cy / 2 : BMHeader.cy; - uint32_t cbOutBuf = 2 + ALIGNEDBPR(cxOut, 32) * cyOut; - pOutBuf = (uint8_t*)nsMemory::Alloc(cbOutBuf); - if (!pOutBuf) - break; - memset(pOutBuf, 0, cbOutBuf); - - // create a DC and PS - DEVOPENSTRUC dop = {NULL, "DISPLAY", NULL, NULL, NULL, NULL, NULL, NULL, NULL}; - hdc = DevOpenDC((HAB)0, OD_MEMORY, "*", 5L, (PDEVOPENDATA)&dop, NULLHANDLE); - if (!hdc) - break; - - SIZEL sizel = {0,0}; - hps = GpiCreatePS((HAB)0, hdc, &sizel, GPIA_ASSOC | PU_PELS | GPIT_MICRO); - if (!hps) - break; - - // get the color bits - memset(pBMInfo, 0, cbBMInfo); - *((PBITMAPINFOHEADER2)pBMInfo) = BMHeader; - GpiSetBitmap(hps, IconInfo.hbmColor); - if (GpiQueryBitmapBits(hps, 0L, (LONG)BMHeader.cy, - (BYTE*)pInBuf, pBMInfo) <= 0) - break; - - // The first 2 bytes are the width & height of the icon in pixels, - // the remaining bytes are BGRA32 (B in first byte, A in last) - uint8_t* outPtr = pOutBuf; - *outPtr++ = (uint8_t)cxOut; - *outPtr++ = (uint8_t)cyOut; - - // convert the color bitmap - pBMInfo->cbImage = cbInBuf; - ConvertColorBitMap(pInBuf, pBMInfo, outPtr, fShrink); - - // now we need to tack on the alpha data, so jump back to the first - // pixel in the output buffer - outPtr = pOutBuf+2; - - // Get the mask info - BMHeader.cbFix = sizeof(BMHeader); - if (!GpiQueryBitmapInfoHeader(IconInfo.hbmPointer, &BMHeader)) - break; - - // if the existing input buffer isn't large enough, reallocate it - cbInRow = ALIGNEDBPR(BMHeader.cx, BMHeader.cBitCount); - if ((cbInRow * BMHeader.cy) > cbInBuf) // Need more for mask - { - cbInBuf = cbInRow * BMHeader.cy; - nsMemory::Free(pInBuf); - pInBuf = (uint8_t*)nsMemory::Alloc(cbInBuf); - memset(pInBuf, 0, cbInBuf); - } - - // get the mask/alpha bits - memset(pBMInfo, 0, cbBMInfo); - *((PBITMAPINFOHEADER2)pBMInfo) = BMHeader; - GpiSetBitmap(hps, IconInfo.hbmPointer); - if (GpiQueryBitmapBits(hps, 0L, (LONG)BMHeader.cy, - (BYTE*)pInBuf, pBMInfo) <= 0) - break; - - // convert the mask/alpha bitmap - pBMInfo->cbImage = cbInBuf; - ConvertMaskBitMap(pInBuf, pBMInfo, outPtr, fShrink); - - // create a pipe - nsCOMPtr<nsIInputStream> inStream; - nsCOMPtr<nsIOutputStream> outStream; - rv = NS_NewPipe(getter_AddRefs(inStream), getter_AddRefs(outStream), - cbOutBuf, cbOutBuf, nonBlocking); - if (NS_FAILED(rv)) - break; - - // put our data into the pipe - uint32_t written; - rv = outStream->Write(reinterpret_cast<const char*>(pOutBuf), - cbOutBuf, &written); - if (NS_FAILED(rv)) - break; - - // success! so addref the pipe - NS_ADDREF(*_retval = inStream); - } while (0); - - // free all the resources we allocated - if (pOutBuf) - nsMemory::Free(pOutBuf); - if (pInBuf) - nsMemory::Free(pInBuf); - if (pBMInfo) - nsMemory::Free(pBMInfo); - if (hps) { - GpiAssociate(hps, NULLHANDLE); - GpiDestroyPS(hps); - } - if (hdc) - DevCloseDC(hdc); - if (hIcon) - DestroyIcon(hIcon, fWpsIcon); - - return rv; -} - -//------------------------------------------------------------------------ - -// get the file's icon from either the WPS or PM - -static HPOINTER GetIcon(nsCString& file, bool fExists, - bool fMini, bool *fWpsIcon) -{ - HPOINTER hRtn = 0; - *fWpsIcon = false; - - if (file.IsEmpty()) { - // append something so that we get at least the generic icon - file.Append("pmwrlw"); - } - - // if RWS is enabled, try to get the icon from the WPS - if (sUseRws) { - nsCOMPtr<nsIRwsService> rwsSvc(do_GetService("@mozilla.org/rwsos2;1")); - if (!rwsSvc) - sUseRws = false; - else { - if (fExists) { - rwsSvc->IconFromPath(file.get(), false, fMini, (uint32_t*)&hRtn); - } else { - const char *ptr = file.get(); - if (*ptr == '.') - ptr++; - rwsSvc->IconFromExtension(ptr, fMini, (uint32_t*)&hRtn); - } - } - } - - // if we got an icon from the WPS, set the flag & exit - if (hRtn) { - *fWpsIcon = true; - return hRtn; - } - - // if the file exists already, get its icon - if (fExists) - return WinLoadFileIcon(file.get(), FALSE); - - // otherwise, create a temporary file with the correct extension, - // then retrieve whatever icon PM assigns it - if (file.First() == '.') - file.Insert("moztmp", 0); - - nsCOMPtr<nsIFile> tempPath; - if (NS_FAILED(NS_GetSpecialDirectory(NS_OS_TEMP_DIR, getter_AddRefs(tempPath))) || - NS_FAILED(tempPath->AppendNative(file))) - return 0; - - nsAutoCString pathStr; - tempPath->GetNativePath(pathStr); - FILE* fp = fopen(pathStr.get(), "wb+"); - if (fp) { - fclose(fp); - hRtn = WinLoadFileIcon(pathStr.get(), FALSE); - remove(pathStr.get()); - } - - return hRtn; -} - -//------------------------------------------------------------------------ - -static void DestroyIcon(HPOINTER hIcon, bool fWpsIcon) -{ - if (fWpsIcon) - WinDestroyPointer(hIcon); - else - WinFreeFileIcon(hIcon); - - return; -} - -//------------------------------------------------------------------------ - -// converts 16, 256, & 16M color bitmaps to BGRA32 format; the alpha -// channel byte is left open & will be filled in by ConvertMaskBitMap(); -// since the scanlines in OS/2 bitmaps run bottom-to-top, it starts at the -// end of the input buffer & works its way back; Note: only 4-bit, 20x20 -// icons contain input padding that has to be ignored - -void ConvertColorBitMap(uint8_t *inBuf, PBITMAPINFO2 pBMInfo, - uint8_t *outBuf, bool fShrink) -{ - uint32_t next = fShrink ? 2 : 1; - uint32_t bprIn = ALIGNEDBPR(pBMInfo->cx, pBMInfo->cBitCount); - uint8_t *pIn = inBuf + (pBMInfo->cy - 1) * bprIn; - uint8_t *pOut = outBuf; - PRGB2 pColorTable = &pBMInfo->argbColor[0]; - - if (pBMInfo->cBitCount == 4) { - uint32_t ubprIn = UNALIGNEDBPR(pBMInfo->cx, pBMInfo->cBitCount); - uint32_t padIn = bprIn - ubprIn; - - for (uint32_t row = pBMInfo->cy; row > 0; row -= next) { - for (uint32_t ndx = 0; ndx < ubprIn; ndx++, pIn++) { - pOut = 4 + (uint8_t*)memcpy(pOut, &pColorTable[FIRSTPEL(*pIn)], 3); - if (!fShrink) { - pOut = 4 + (uint8_t*)memcpy(pOut, &pColorTable[SECONDPEL(*pIn)], 3); - } - } - pIn -= ((next + 1) * bprIn) - padIn; - } - } else if (pBMInfo->cBitCount == 8) { - for (uint32_t row = pBMInfo->cy; row > 0; row -= next) { - for (uint32_t ndx = 0; ndx < bprIn; ndx += next, pIn += next) { - pOut = 4 + (uint8_t*)memcpy(pOut, &pColorTable[*pIn], 3); - } - pIn -= (next + 1) * bprIn; - } - } else if (pBMInfo->cBitCount == 24) { - uint32_t next3 = next * 3; - for (uint32_t row = pBMInfo->cy; row > 0; row -= next) { - for (uint32_t ndx = 0; ndx < bprIn; ndx += next3, pIn += next3) { - pOut = 4 + (uint8_t*)memcpy(pOut, pIn, 3); - } - pIn -= (next + 1) * bprIn; - } - } -} - -//------------------------------------------------------------------------ - -// converts an icon's AND mask into 8-bit alpha data and stores it in the -// high-order bytes of the BGRA32 bitmap created by ConvertColorBitMap(); -// the AND mask is the 2nd half of a pair of bitmaps & the scanlines run -// bottom-to-top - starting at the end and working back to the midpoint -// converts the entire bitmap; since each row is dword-aligned, 16, 20, -// and 40-pixel icons all have padding bits at the end of every row that -// must be skipped over - -void ConvertMaskBitMap(uint8_t *inBuf, PBITMAPINFO2 pBMInfo, - uint8_t *outBuf, bool fShrink) -{ - uint32_t next = (fShrink ? 2 : 1); - uint32_t bprIn = ALIGNEDBPR(pBMInfo->cx, pBMInfo->cBitCount); - uint32_t padIn = bprIn - UNALIGNEDBPR(pBMInfo->cx, pBMInfo->cBitCount); - uint8_t *pIn = inBuf + (pBMInfo->cy - 1) * bprIn; - uint8_t *pOut = outBuf + 3; - - // for each row or every other row - for (uint32_t row = pBMInfo->cy/2; row > 0; row -= next) { - - // for all of the non-padding bits in the row - for (uint32_t bits = pBMInfo->cx; bits; pIn++) { - uint8_t src = ~(*pIn); - uint8_t srcMask = 0x80; - - // for each bit or every other bit in the current byte - for ( ; srcMask && bits; srcMask >>= next, bits -= next, pOut += 4) { - if (src & srcMask) { - *pOut = 0xff; - } - } - } - - // if the row just completed had padding, pIn won't be pointing - // at the first byte in the next row; padIn compensates for this - pIn -= ((next + 1) * bprIn) - padIn; - } -} - -//------------------------------------------------------------------------ - -NS_IMETHODIMP nsIconChannel::GetContentType(nsACString &aContentType) -{ - aContentType.AssignLiteral(IMAGE_ICON_MS); - return NS_OK; -} - -NS_IMETHODIMP -nsIconChannel::SetContentType(const nsACString &aContentType) -{ - // It doesn't make sense to set the content-type on this type - // of channel... - return NS_ERROR_FAILURE; -} - -NS_IMETHODIMP nsIconChannel::GetContentCharset(nsACString &aContentCharset) -{ - aContentCharset.Truncate(); - return NS_OK; -} - -NS_IMETHODIMP -nsIconChannel::SetContentCharset(const nsACString &aContentCharset) -{ - // It doesn't make sense to set the content-charset on this type - // of channel... - return NS_ERROR_FAILURE; -} - -NS_IMETHODIMP -nsIconChannel::GetContentDisposition(uint32_t *aContentDisposition) -{ - return NS_ERROR_NOT_AVAILABLE; -} - -NS_IMETHODIMP -nsIconChannel::SetContentDisposition(uint32_t aContentDisposition) -{ - return NS_ERROR_NOT_AVAILABLE; -} - -NS_IMETHODIMP -nsIconChannel::GetContentDispositionFilename(nsAString &aContentDispositionFilename) -{ - return NS_ERROR_NOT_AVAILABLE; -} - -NS_IMETHODIMP -nsIconChannel::SetContentDispositionFilename(const nsAString &aContentDispositionFilename) -{ - return NS_ERROR_NOT_AVAILABLE; -} - -NS_IMETHODIMP -nsIconChannel::GetContentDispositionHeader(nsACString &aContentDispositionHeader) -{ - return NS_ERROR_NOT_AVAILABLE; -} - -NS_IMETHODIMP nsIconChannel::GetContentLength(int64_t *aContentLength) -{ - *aContentLength = mContentLength; - return NS_OK; -} - -NS_IMETHODIMP nsIconChannel::SetContentLength(int64_t aContentLength) -{ - NS_NOTREACHED("nsIconChannel::SetContentLength"); - return NS_ERROR_NOT_IMPLEMENTED; -} - -NS_IMETHODIMP nsIconChannel::GetOwner(nsISupports* *aOwner) -{ - *aOwner = mOwner.get(); - NS_IF_ADDREF(*aOwner); - return NS_OK; -} - -NS_IMETHODIMP nsIconChannel::SetOwner(nsISupports* aOwner) -{ - mOwner = aOwner; - return NS_OK; -} - -NS_IMETHODIMP nsIconChannel::GetNotificationCallbacks(nsIInterfaceRequestor* *aNotificationCallbacks) -{ - *aNotificationCallbacks = mCallbacks.get(); - NS_IF_ADDREF(*aNotificationCallbacks); - return NS_OK; -} - -NS_IMETHODIMP nsIconChannel::SetNotificationCallbacks(nsIInterfaceRequestor* aNotificationCallbacks) -{ - mCallbacks = aNotificationCallbacks; - return NS_OK; -} - -NS_IMETHODIMP nsIconChannel::GetSecurityInfo(nsISupports * *aSecurityInfo) -{ - *aSecurityInfo = nullptr; - return NS_OK; -} - -// nsIRequestObserver methods -NS_IMETHODIMP nsIconChannel::OnStartRequest(nsIRequest* aRequest, nsISupports* aContext) -{ - if (mListener) - return mListener->OnStartRequest(this, aContext); - return NS_OK; -} - -NS_IMETHODIMP nsIconChannel::OnStopRequest(nsIRequest* aRequest, nsISupports* aContext, nsresult aStatus) -{ - if (mListener) { - mListener->OnStopRequest(this, aContext, aStatus); - mListener = nullptr; - } - - // Remove from load group - if (mLoadGroup) - mLoadGroup->RemoveRequest(this, nullptr, aStatus); - - // Drop notification callbacks to prevent cycles. - mCallbacks = nullptr; - - return NS_OK; -} - -//------------------------------------------------------------------------ -// nsIStreamListener methods -NS_IMETHODIMP nsIconChannel::OnDataAvailable(nsIRequest* aRequest, - nsISupports* aContext, - nsIInputStream* aStream, - uint64_t aOffset, - uint32_t aCount) -{ - if (mListener) - return mListener->OnDataAvailable(this, aContext, aStream, aOffset, aCount); - return NS_OK; -} - -//------------------------------------------------------------------------ - diff --git a/image/decoders/icon/os2/nsIconChannel.h b/image/decoders/icon/os2/nsIconChannel.h deleted file mode 100644 index 7714e6cf3..000000000 --- a/image/decoders/icon/os2/nsIconChannel.h +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifndef nsIconChannel_h___ -#define nsIconChannel_h___ - -#include "mozilla/Attributes.h" - -#include "nsCOMPtr.h" -#include "nsXPIDLString.h" -#include "nsIChannel.h" -#include "nsILoadGroup.h" -#include "nsIInterfaceRequestor.h" -#include "nsIInterfaceRequestorUtils.h" -#include "nsIURI.h" -#include "nsIInputStreamPump.h" -#include "nsIStreamListener.h" - -class nsIFile; - -class nsIconChannel MOZ_FINAL : public nsIChannel, public nsIStreamListener -{ -public: - NS_DECL_ISUPPORTS - NS_DECL_NSIREQUEST - NS_DECL_NSICHANNEL - NS_DECL_NSIREQUESTOBSERVER - NS_DECL_NSISTREAMLISTENER - - nsIconChannel(); - virtual ~nsIconChannel(); - - nsresult Init(nsIURI* uri); - -protected: - nsCOMPtr<nsIURI> mUrl; - nsCOMPtr<nsIURI> mOriginalURI; - int64_t mContentLength; - nsCOMPtr<nsILoadGroup> mLoadGroup; - nsCOMPtr<nsIInterfaceRequestor> mCallbacks; - nsCOMPtr<nsISupports> mOwner; - - nsCOMPtr<nsIInputStreamPump> mPump; - nsCOMPtr<nsIStreamListener> mListener; - - nsresult ExtractIconInfoFromUrl(nsIFile ** aLocalFile, uint32_t * aDesiredImageSize, nsACString &aContentType, nsACString &aFileExtension); - nsresult MakeInputStream(nsIInputStream** _retval, bool nonBlocking); -}; - -#define ID_ICO_FILE 5800 -#define ID_ICO_FOLDER 5801 - -#endif /* nsIconChannel_h___ */ diff --git a/image/decoders/moz.build b/image/decoders/moz.build index 0aa6482d5..0bb8552f2 100644 --- a/image/decoders/moz.build +++ b/image/decoders/moz.build @@ -15,8 +15,6 @@ elif toolkit == 'qt': if CONFIG['OS_ARCH'] == 'WINNT': DIRS += ['icon/win', 'icon'] -elif CONFIG['OS_ARCH'] == 'OS2': - DIRS += ['icon/os2', 'icon'] if toolkit == 'cocoa': DIRS += ['icon/mac', 'icon'] diff --git a/intl/build/nsI18nModule.cpp b/intl/build/nsI18nModule.cpp index b71d96902..66623b7fa 100644 --- a/intl/build/nsI18nModule.cpp +++ b/intl/build/nsI18nModule.cpp @@ -72,11 +72,6 @@ NS_DEFINE_NAMED_CID(NS_DATETIMEFORMAT_CID); NS_DEFINE_NAMED_CID(NS_COLLATION_CID); NS_DEFINE_NAMED_CID(NS_DATETIMEFORMAT_CID); #endif -#ifdef XP_OS2 -NS_DEFINE_NAMED_CID(NS_OS2LOCALE_CID); -NS_DEFINE_NAMED_CID(NS_COLLATION_CID); -NS_DEFINE_NAMED_CID(NS_DATETIMEFORMAT_CID); -#endif static const mozilla::Module::CIDEntry kIntlCIDs[] = { { &kNS_LBRK_CID, false, nullptr, nsJISx4051LineBreakerConstructor }, @@ -106,11 +101,6 @@ static const mozilla::Module::CIDEntry kIntlCIDs[] = { { &kNS_COLLATION_CID, false, nullptr, nsCollationMacUCConstructor }, { &kNS_DATETIMEFORMAT_CID, false, nullptr, nsDateTimeFormatMacConstructor }, #endif -#ifdef XP_OS2 - { &kNS_OS2LOCALE_CID, false, nullptr, nsOS2LocaleConstructor }, - { &kNS_COLLATION_CID, false, nullptr, nsCollationOS2Constructor }, - { &kNS_DATETIMEFORMAT_CID, false, nullptr, nsDateTimeFormatOS2Constructor }, -#endif { nullptr } }; @@ -142,11 +132,6 @@ static const mozilla::Module::ContractIDEntry kIntlContracts[] = { { NS_COLLATION_CONTRACTID, &kNS_COLLATION_CID }, { NS_DATETIMEFORMAT_CONTRACTID, &kNS_DATETIMEFORMAT_CID }, #endif -#ifdef XP_OS2 - { NS_OS2LOCALE_CONTRACTID, &kNS_OS2LOCALE_CID }, - { NS_COLLATION_CONTRACTID, &kNS_COLLATION_CID }, - { NS_DATETIMEFORMAT_CONTRACTID, &kNS_DATETIMEFORMAT_CID }, -#endif { nullptr } }; diff --git a/intl/chardet/tools/GenCyrillicClass.cpp b/intl/chardet/tools/GenCyrillicClass.cpp index f52cf5b4c..06ec7afac 100644 --- a/intl/chardet/tools/GenCyrillicClass.cpp +++ b/intl/chardet/tools/GenCyrillicClass.cpp @@ -12,7 +12,7 @@ #include "nsCRT.h" #include <stdio.h> #include <stdlib.h> -#if defined(XP_WIN) || defined(XP_OS2) +#if defined(XP_WIN) #include <io.h> #endif #ifdef XP_UNIX diff --git a/intl/locale/public/moz.build b/intl/locale/public/moz.build index 1285ec577..63fcb7645 100644 --- a/intl/locale/public/moz.build +++ b/intl/locale/public/moz.build @@ -12,9 +12,7 @@ EXPORTS += [ 'nsDateTimeFormatCID.h', 'nsIDateTimeFormat.h', 'nsILanguageAtomService.h', - 'nsIOS2Locale.h', 'nsIPlatformCharset.h', - 'nsLocaleCID.h', 'nsPosixLocale.h', 'nsWin32Locale.h', ] diff --git a/intl/locale/public/nsIOS2Locale.h b/intl/locale/public/nsIOS2Locale.h deleted file mode 100644 index 2c1379a3c..000000000 --- a/intl/locale/public/nsIOS2Locale.h +++ /dev/null @@ -1,34 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifndef _nsios2locale_h_ -#define _nsios2locale_h_ - -#include "nsISupports.h" -#include "nscore.h" -#include "nsString.h" -#include <os2.h> - -// {F25F74F0-FB59-11d3-A9F2-00203522A03C} -#define NS_IOS2LOCALE_IID \ -{ 0xf25f74f0, 0xfb59, 0x11d3, \ -{ 0xa9, 0xf2, 0x0, 0x20, 0x35, 0x22, 0xa0, 0x3c }} - -#define MAX_LANGUAGE_CODE_LEN 3 -#define MAX_COUNTRY_CODE_LEN 3 -#define MAX_EXTRA_LEN 65 -#define MAX_LOCALE_LEN 128 - -class nsIOS2Locale : public nsISupports -{ - public: - NS_DECLARE_STATIC_IID_ACCESSOR(NS_IOS2LOCALE_IID) - - NS_IMETHOD GetPlatformLocale(const nsAString& locale, PULONG os2Codepage) = 0; - NS_IMETHOD GetXPLocale(const char* os2Locale, nsAString& locale)=0; -}; - -NS_DEFINE_STATIC_IID_ACCESSOR(nsIOS2Locale, NS_IOS2LOCALE_IID) - -#endif diff --git a/intl/locale/public/nsLocaleCID.h b/intl/locale/public/nsLocaleCID.h deleted file mode 100644 index bb8ebeb69..000000000 --- a/intl/locale/public/nsLocaleCID.h +++ /dev/null @@ -1,16 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#ifndef nsLocaleCID_h__ -#define nsLocaleCID_h__ - -// {F25F74F1-FB59-11d3-A9F2-00203522A03C} -#define NS_OS2LOCALE_CID \ -{ 0xf25f74f1, 0xfb59, 0x11d3, \ -{ 0xa9, 0xf2, 0x0, 0x20, 0x35, 0x22, 0xa0, 0x3c }} - -#define NS_OS2LOCALE_CONTRACTID "@mozilla.org/locale/os2-locale;1" - -#endif // nsLocaleCID_h__ - diff --git a/intl/locale/src/mac/nsDateTimeFormatMac.cpp b/intl/locale/src/mac/nsDateTimeFormatMac.cpp index 14e3f4aad..ffbbcb898 100644 --- a/intl/locale/src/mac/nsDateTimeFormatMac.cpp +++ b/intl/locale/src/mac/nsDateTimeFormatMac.cpp @@ -8,7 +8,6 @@ #include "nsDateTimeFormatMac.h" #include <CoreFoundation/CFDateFormatter.h> #include "nsIComponentManager.h" -#include "nsLocaleCID.h" #include "nsILocaleService.h" #include "nsCRT.h" #include "plstr.h" diff --git a/intl/locale/src/mac/nsMacCharset.cpp b/intl/locale/src/mac/nsMacCharset.cpp index 27f26c52d..593161a2d 100644 --- a/intl/locale/src/mac/nsMacCharset.cpp +++ b/intl/locale/src/mac/nsMacCharset.cpp @@ -8,7 +8,6 @@ #include "pratom.h" #include "nsCOMPtr.h" #include "nsIServiceManager.h" -#include "nsLocaleCID.h" #include "nsReadableUtils.h" #include "nsPlatformCharset.h" #include "nsEncoderDecoderUtils.h" diff --git a/intl/locale/src/moz.build b/intl/locale/src/moz.build index 7501d33af..a5cd25a51 100644 --- a/intl/locale/src/moz.build +++ b/intl/locale/src/moz.build @@ -6,8 +6,8 @@ toolkit = CONFIG['MOZ_WIDGET_TOOLKIT'] -if toolkit in ('os2', 'windows'): - DIRS += [toolkit] +if toolkit == 'windows': + DIRS += ['windows'] elif toolkit == 'cocoa': DIRS += ['mac'] else: diff --git a/intl/locale/src/nsLocaleConstructors.h b/intl/locale/src/nsLocaleConstructors.h index ba501f8c5..f1a087df9 100644 --- a/intl/locale/src/nsLocaleConstructors.h +++ b/intl/locale/src/nsLocaleConstructors.h @@ -14,7 +14,6 @@ #include "nsIServiceManager.h" #include "nsLanguageAtomService.h" #include "nsPlatformCharset.h" -#include "nsLocaleCID.h" #if defined(XP_MACOSX) #define USE_MAC_LOCALE @@ -29,12 +28,6 @@ #include "nsDateTimeFormatWin.h" #endif -#ifdef XP_OS2 -#include "nsOS2Locale.h" -#include "nsCollationOS2.h" -#include "nsDateTimeFormatOS2.h" -#endif - #ifdef USE_MAC_LOCALE #include "nsCollationMacUC.h" #include "nsDateTimeFormatMac.h" @@ -83,10 +76,4 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsCollationMacUC) NS_GENERIC_FACTORY_CONSTRUCTOR(nsDateTimeFormatMac) #endif -#ifdef XP_OS2 -NS_GENERIC_FACTORY_CONSTRUCTOR(nsOS2Locale) -NS_GENERIC_FACTORY_CONSTRUCTOR(nsCollationOS2) -NS_GENERIC_FACTORY_CONSTRUCTOR(nsDateTimeFormatOS2) -#endif - #endif diff --git a/intl/locale/src/nsLocaleService.cpp b/intl/locale/src/nsLocaleService.cpp index ea613e7e6..e7ab2776a 100644 --- a/intl/locale/src/nsLocaleService.cpp +++ b/intl/locale/src/nsLocaleService.cpp @@ -24,9 +24,6 @@ #if defined(XP_WIN) # include "nsWin32Locale.h" -#elif defined(XP_OS2) -# include "unidef.h" -# include "nsIOS2Locale.h" #elif defined(XP_MACOSX) # include <Carbon/Carbon.h> #elif defined(XP_UNIX) @@ -51,7 +48,7 @@ const char* LocaleList[LocaleListLength] = #define NSILOCALE_MAX_ACCEPT_LANGUAGE 16 #define NSILOCALE_MAX_ACCEPT_LENGTH 18 -#if (defined(XP_UNIX) && !defined(XP_MACOSX)) || defined(XP_OS2) +#if (defined(XP_UNIX) && !defined(XP_MACOSX)) static int posix_locale_category[LocaleListLength] = { LC_COLLATE, @@ -167,54 +164,6 @@ nsLocaleService::nsLocaleService(void) mApplicationLocale = do_QueryInterface(resultLocale); #endif // XP_UNIX -#ifdef XP_OS2 - nsCOMPtr<nsIOS2Locale> os2Converter = do_GetService(NS_OS2LOCALE_CONTRACTID); - nsAutoString xpLocale; - if (os2Converter) { - nsAutoString category; - int i; - - nsRefPtr<nsLocale> resultLocale(new nsLocale()); - - LocaleObject locale_object = NULL; - int result = UniCreateLocaleObject(UNI_UCS_STRING_POINTER, - (UniChar *)L"", &locale_object); - if (result != ULS_SUCCESS) { - int result = UniCreateLocaleObject(UNI_UCS_STRING_POINTER, - (UniChar *)L"en_US", &locale_object); - } - char* lc_temp; - for( i = 0; i < LocaleListLength; i++ ) { - lc_temp = nullptr; - UniQueryLocaleObject(locale_object, - posix_locale_category[i], - UNI_MBS_STRING_POINTER, - (void **)&lc_temp); - category.AssignASCII(LocaleList[i]); - nsresult result; - if (lc_temp != nullptr) - result = os2Converter->GetXPLocale(lc_temp, xpLocale); - else { - char* lang = getenv("LANG"); - if ( lang == nullptr ) { - result = os2Converter->GetXPLocale("en-US", xpLocale); - } - else - result = os2Converter->GetXPLocale(lang, xpLocale); - } - if (NS_FAILED(result)) { - UniFreeMem(lc_temp); - UniFreeLocaleObject(locale_object); - return; - } - resultLocale->AddCategory(category, xpLocale); - UniFreeMem(lc_temp); - } - UniFreeLocaleObject(locale_object); - mSystemLocale = do_QueryInterface(resultLocale); - mApplicationLocale = do_QueryInterface(resultLocale); - } // if ( NS_SUCCEEDED )... -#endif // XP_OS2 #ifdef XP_MACOSX // Get string representation of user's current locale diff --git a/intl/locale/src/os2/Makefile.in b/intl/locale/src/os2/Makefile.in deleted file mode 100644 index be245b349..000000000 --- a/intl/locale/src/os2/Makefile.in +++ /dev/null @@ -1,29 +0,0 @@ -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -DEPTH = @DEPTH@ -topsrcdir = @top_srcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ - -include $(DEPTH)/config/autoconf.mk - -EXPORT_LIBRARY = 1 -FORCE_STATIC_LIB = 1 -LIBXUL_LIBRARY = 1 - - -include $(topsrcdir)/config/rules.mk - -INCLUDES += -I$(srcdir)/.. - -nsOS2Charset.$(OBJ_SUFFIX): os2charset.properties.h - -os2charset.properties.h: $(srcdir)/../props2arrays.py os2charset.properties - $(PYTHON) $^ $@ - -GARBAGE += \ - os2charset.properties.h \ - $(NULL) diff --git a/intl/locale/src/os2/moz.build b/intl/locale/src/os2/moz.build deleted file mode 100644 index a59ed2a29..000000000 --- a/intl/locale/src/os2/moz.build +++ /dev/null @@ -1,17 +0,0 @@ -# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*- -# vim: set filetype=python: -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -MODULE = 'locale' - -CPP_SOURCES += [ - 'nsCollationOS2.cpp', - 'nsDateTimeFormatOS2.cpp', - 'nsOS2Charset.cpp', - 'nsOS2Locale.cpp', -] - -LIBRARY_NAME = 'platlocale_s' - diff --git a/intl/locale/src/os2/nsCollationOS2.cpp b/intl/locale/src/os2/nsCollationOS2.cpp deleted file mode 100644 index a1700b325..000000000 --- a/intl/locale/src/os2/nsCollationOS2.cpp +++ /dev/null @@ -1,151 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * This Original Code has been modified by IBM Corporation. - * Modifications made by IBM described herein are - * Copyright (c) International Business Machines - * Corporation, 2000 - * - * Modifications to Mozilla code or documentation - * identified per MPL Section 3.3 - * - * Date Modified by Description of modification - * 07/05/2000 IBM Corp. Reworked file. - */ - -#include "unidef.h" -#include "prmem.h" -#include "nsCollationOS2.h" -#include "nsIServiceManager.h" -#include "nsIComponentManager.h" -#include "nsLocaleCID.h" -#include "nsIPlatformCharset.h" -#include "nsIOS2Locale.h" -#include "nsCOMPtr.h" -#include "nsString.h" -#include "nsCRT.h" - -NS_IMPL_ISUPPORTS1(nsCollationOS2, nsICollation) - -nsCollationOS2::nsCollationOS2() : mCollation(nullptr) -{ -} - -nsCollationOS2::~nsCollationOS2() -{ - if (mCollation) - delete mCollation; -} - -/* Workaround for GCC problem */ -#ifndef LOCI_iCodepage -#define LOCI_iCodepage ((LocaleItem)111) -#endif - -nsresult nsCollationOS2::Initialize(nsILocale *locale) -{ - NS_ASSERTION(!mCollation, "Should only be initialized once"); - - mCollation = new nsCollation; - - return NS_OK; -} - - -nsresult nsCollationOS2::CompareString(int32_t strength, - const nsAString& string1, const nsAString& string2, int32_t* result) -{ - nsAutoString stringNormalized1, stringNormalized2; - if (strength != kCollationCaseSensitive) { - nsresult res; - res = mCollation->NormalizeString(string1, stringNormalized1); - if (NS_FAILED(res)) { - return res; - } - res = mCollation->NormalizeString(string2, stringNormalized2); - if (NS_FAILED(res)) { - return res; - } - } else { - stringNormalized1 = string1; - stringNormalized2 = string2; - } - - LocaleObject locObj = NULL; - int ret = UniCreateLocaleObject(UNI_UCS_STRING_POINTER, (UniChar *)L"", &locObj); - if (ret != ULS_SUCCESS) - UniCreateLocaleObject(UNI_UCS_STRING_POINTER, (UniChar *)L"C", &locObj); - - *result = UniStrcoll(locObj, (UniChar *)stringNormalized1.get(), (UniChar *)stringNormalized2.get()); - - UniFreeLocaleObject(locObj); - - return NS_OK; -} - - -nsresult nsCollationOS2::AllocateRawSortKey(int32_t strength, - const nsAString& stringIn, uint8_t** key, uint32_t* outLen) -{ - nsresult res = NS_OK; - - nsAutoString stringNormalized; - if (strength != kCollationCaseSensitive) { - res = mCollation->NormalizeString(stringIn, stringNormalized); - if (NS_FAILED(res)) - return res; - } else { - stringNormalized = stringIn; - } - - LocaleObject locObj = NULL; - int ret = UniCreateLocaleObject(UNI_UCS_STRING_POINTER, (UniChar *)L"", &locObj); - if (ret != ULS_SUCCESS) - UniCreateLocaleObject(UNI_UCS_STRING_POINTER, (UniChar *)L"C", &locObj); - - res = NS_ERROR_FAILURE; // From here on out assume failure... - int length = UniStrxfrm(locObj, NULL, reinterpret_cast<const UniChar *>(stringNormalized.get()),0); - if (length >= 0) { - length += 5; // Allow for the "extra" chars UniStrxfrm() - // will out put (overrunning the buffer if - // you let it...) - // Magic, persistent buffer. If it's not twice the size we need, - // we grow/reallocate it 4X so it doesn't grow often. - static UniChar* pLocalBuffer = nullptr; - static int iBufferLength = 100; - if (iBufferLength < length*2) { - if ( pLocalBuffer ) { - free(pLocalBuffer); - pLocalBuffer = nullptr; - } - iBufferLength = length*4; - } - if (!pLocalBuffer) - pLocalBuffer = (UniChar*) malloc(sizeof(UniChar) * iBufferLength); - if (pLocalBuffer) { - // Do the Xfrm - int uLen = UniStrxfrm(locObj, pLocalBuffer, reinterpret_cast<const UniChar *>(stringNormalized.get()), iBufferLength); - // See how big the result really is - uLen = UniStrlen(pLocalBuffer); - // make sure it will fit in the output buffer... - if (uLen < iBufferLength) { - // Success! - // Give 'em the real size in bytes... - *key = (uint8_t *)nsCRT::strdup((PRUnichar*) pLocalBuffer); - *outLen = uLen * 2 + 2; - res = NS_OK; - } - } - } - UniFreeLocaleObject(locObj); - - return res; -} - -nsresult nsCollationOS2::CompareRawSortKey(const uint8_t* key1, uint32_t len1, - const uint8_t* key2, uint32_t len2, - int32_t* result) -{ - *result = PL_strcmp((const char *)key1, (const char *)key2); - return NS_OK; -} diff --git a/intl/locale/src/os2/nsCollationOS2.h b/intl/locale/src/os2/nsCollationOS2.h deleted file mode 100644 index 4d8e4f555..000000000 --- a/intl/locale/src/os2/nsCollationOS2.h +++ /dev/null @@ -1,33 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#ifndef _nscollationos2_h_ -#define _nscollationos2_h_ - - -#include "nsICollation.h" -#include "nsCollation.h" // static library -#include "nsCRT.h" - - - -class nsCollationOS2 : public nsICollation { - -protected: - nsCollation *mCollation; - nsString mLocale; - nsString mSavedLocale; - -public: - nsCollationOS2(); - ~nsCollationOS2(); - - // nsISupports interface - NS_DECL_ISUPPORTS - - // nsICollation interface - NS_DECL_NSICOLLATION - -}; - -#endif /* nsCollationOS2_h__ */ diff --git a/intl/locale/src/os2/nsDateTimeFormatOS2.cpp b/intl/locale/src/os2/nsDateTimeFormatOS2.cpp deleted file mode 100644 index 2c5865ea1..000000000 --- a/intl/locale/src/os2/nsDateTimeFormatOS2.cpp +++ /dev/null @@ -1,187 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include <unidef.h> -#include "nsDateTimeFormatOS2.h" - -NS_IMPL_THREADSAFE_ISUPPORTS1(nsDateTimeFormatOS2,nsIDateTimeFormat) - -#define NSDATETIME_FORMAT_BUFFER_LEN 80 - -#ifndef LOCI_iTime -#define LOCI_iTime ((LocaleItem)73) -#endif - -nsresult nsDateTimeFormatOS2::FormatTime(nsILocale* locale, - const nsDateFormatSelector dateFormatSelector, - const nsTimeFormatSelector timeFormatSelector, - const time_t timetTime, - nsAString &stringOut) -{ - return FormatTMTime(locale, dateFormatSelector, timeFormatSelector, localtime( &timetTime ), stringOut); -} - -// performs a locale sensitive date formatting operation on the struct tm parameter -nsresult nsDateTimeFormatOS2::FormatTMTime(nsILocale* locale, - const nsDateFormatSelector dateFormatSelector, - const nsTimeFormatSelector timeFormatSelector, - const struct tm* tmTime, - nsAString &stringOut) -{ - - nsresult rc = NS_ERROR_FAILURE; - UniChar uFmtD[NSDATETIME_FORMAT_BUFFER_LEN] = { 0 }; - UniChar uFmtT[NSDATETIME_FORMAT_BUFFER_LEN] = { 0 }; - UniChar *pString = nullptr; - LocaleObject locObj = NULL; - int ret = UniCreateLocaleObject(UNI_UCS_STRING_POINTER, (UniChar *)L"", &locObj); - if (ret != ULS_SUCCESS) - UniCreateLocaleObject(UNI_UCS_STRING_POINTER, (UniChar *)L"C", &locObj); - - bool f24Hour = false; - - UniQueryLocaleItem(locObj, LOCI_iTime, &pString); - - if (pString[0] == '1') { - f24Hour = true; - } - - // set date format - switch (dateFormatSelector) { - case kDateFormatNone: - UniStrcat( uFmtD, (UniChar*)L""); - break; - case kDateFormatLong: - case kDateFormatShort: - UniStrcat( uFmtD, (UniChar*)L"%x"); - break; - case kDateFormatYearMonth: - UniQueryLocaleItem( locObj, DATESEP, &pString); - UniStrcat( uFmtD, (UniChar*)L"%Y"); - UniStrcat( uFmtD, pString); - UniStrcat( uFmtD, (UniChar*)L"%m"); - UniFreeMem(pString); - break; - case kDateFormatWeekday: - UniStrcat( uFmtD, (UniChar*)L"%a"); - break; - default: - UniStrcat( uFmtD, (UniChar*)L""); - } - - // set time format - switch (timeFormatSelector) { - case kTimeFormatNone: - UniStrcat( uFmtT, (UniChar*)L""); - break; - case kTimeFormatSeconds: - UniQueryLocaleItem( locObj, TIMESEP, &pString); - if (f24Hour) - UniStrcat( uFmtT, (UniChar*)L"%H"); - else - UniStrcat( uFmtT, (UniChar*)L"%I"); - UniStrcat( uFmtT, pString); - UniStrcat( uFmtT, (UniChar*)L"%M"); - UniStrcat( uFmtT, pString); - UniStrcat( uFmtT, (UniChar*)L"%S"); - if (!f24Hour) - UniStrcat( uFmtT, (UniChar*)L" %p"); - UniFreeMem(pString); - break; - case kTimeFormatNoSeconds: - UniQueryLocaleItem( locObj, TIMESEP, &pString); - if (f24Hour) - UniStrcat( uFmtT, (UniChar*)L"%H"); - else - UniStrcat( uFmtT, (UniChar*)L"%I"); - UniStrcat( uFmtT, pString); - UniStrcat( uFmtT, (UniChar*)L"%M"); - if (!f24Hour) - UniStrcat( uFmtT, (UniChar*)L" %p"); - UniFreeMem(pString); - break; - case kTimeFormatSecondsForce24Hour: - UniQueryLocaleItem( locObj, TIMESEP, &pString); - UniStrcat( uFmtT, (UniChar*)L"%H"); - UniStrcat( uFmtT, pString); - UniStrcat( uFmtT, (UniChar*)L"%M"); - UniStrcat( uFmtT, pString); - UniStrcat( uFmtT, (UniChar*)L"%S"); - UniFreeMem(pString); - break; - case kTimeFormatNoSecondsForce24Hour: - UniQueryLocaleItem( locObj, TIMESEP, &pString); - UniStrcat( uFmtT, (UniChar*)L"%H"); - UniStrcat( uFmtT, pString); - UniStrcat( uFmtT, (UniChar*)L"%M"); - UniFreeMem(pString); - break; - default: - UniStrcat( uFmtT, (UniChar*)L""); - } - - PRUnichar buffer[NSDATETIME_FORMAT_BUFFER_LEN] = {0}; - if ((dateFormatSelector != kDateFormatNone) && (timeFormatSelector != kTimeFormatNone)) { - UniStrcat( uFmtD, (UniChar*)L" "); - } - UniStrcat( uFmtD, uFmtT); - int length = UniStrftime(locObj, reinterpret_cast<UniChar *>(buffer), - NSDATETIME_FORMAT_BUFFER_LEN, uFmtD, tmTime); - UniFreeLocaleObject(locObj); - - if ( length != 0) { - stringOut.Assign(buffer, length); - rc = NS_OK; - } - - return rc; -} - -// performs a locale sensitive date formatting operation on the PRTime parameter -nsresult nsDateTimeFormatOS2::FormatPRTime(nsILocale* locale, - const nsDateFormatSelector dateFormatSelector, - const nsTimeFormatSelector timeFormatSelector, - const PRTime prTime, - nsAString& stringOut) -{ - PRExplodedTime explodedTime; - PR_ExplodeTime(prTime, PR_LocalTimeParameters, &explodedTime); - - return FormatPRExplodedTime(locale, dateFormatSelector, timeFormatSelector, &explodedTime, stringOut); -} - -// performs a locale sensitive date formatting operation on the PRExplodedTime parameter -nsresult nsDateTimeFormatOS2::FormatPRExplodedTime(nsILocale* locale, - const nsDateFormatSelector dateFormatSelector, - const nsTimeFormatSelector timeFormatSelector, - const PRExplodedTime* explodedTime, - nsAString& stringOut) -{ - struct tm tmTime; - /* be safe and set all members of struct tm to zero - * - * there are other fields in the tm struct that we aren't setting - * (tm_isdst, tm_gmtoff, tm_zone, should we set these?) and since - * tmTime is on the stack, it may be filled with garbage, but - * the garbage may vary. (this may explain why some saw bug #10412, and - * others did not. - * - * when tmTime is passed to strftime() with garbage bad things may happen. - * see bug #10412 - */ - memset( &tmTime, 0, sizeof(tmTime) ); - - tmTime.tm_yday = explodedTime->tm_yday; - tmTime.tm_wday = explodedTime->tm_wday; - tmTime.tm_year = explodedTime->tm_year; - tmTime.tm_year -= 1900; - tmTime.tm_mon = explodedTime->tm_month; - tmTime.tm_mday = explodedTime->tm_mday; - tmTime.tm_hour = explodedTime->tm_hour; - tmTime.tm_min = explodedTime->tm_min; - tmTime.tm_sec = explodedTime->tm_sec; - - return FormatTMTime(locale, dateFormatSelector, timeFormatSelector, &tmTime, stringOut); -} - diff --git a/intl/locale/src/os2/nsDateTimeFormatOS2.h b/intl/locale/src/os2/nsDateTimeFormatOS2.h deleted file mode 100644 index 2201f780e..000000000 --- a/intl/locale/src/os2/nsDateTimeFormatOS2.h +++ /dev/null @@ -1,47 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#ifndef _nsdatetimeformatos2_h_ -#define _nsdatetimeformatos2_h_ - -#include "nsIDateTimeFormat.h" - -class nsDateTimeFormatOS2 : public nsIDateTimeFormat { - - public: - NS_DECL_ISUPPORTS - - // performs a locale sensitive date formatting operation on the time_t parameter - NS_IMETHOD FormatTime(nsILocale* locale, - const nsDateFormatSelector dateFormatSelector, - const nsTimeFormatSelector timeFormatSelector, - const time_t timetTime, - nsAString& stringOut); - - // performs a locale sensitive date formatting operation on the struct tm parameter - NS_IMETHOD FormatTMTime(nsILocale* locale, - const nsDateFormatSelector dateFormatSelector, - const nsTimeFormatSelector timeFormatSelector, - const struct tm* tmTime, - nsAString& stringOut); - - // performs a locale sensitive date formatting operation on the PRTime parameter - NS_IMETHOD FormatPRTime(nsILocale* locale, - const nsDateFormatSelector dateFormatSelector, - const nsTimeFormatSelector timeFormatSelector, - const PRTime prTime, - nsAString& stringOut); - - // performs a locale sensitive date formatting operation on the PRExplodedTime parameter - NS_IMETHOD FormatPRExplodedTime(nsILocale* locale, - const nsDateFormatSelector dateFormatSelector, - const nsTimeFormatSelector timeFormatSelector, - const PRExplodedTime* explodedTime, - nsAString& stringOut); - - nsDateTimeFormatOS2() {} - - virtual ~nsDateTimeFormatOS2() {} -}; - -#endif /* nsDateTimeFormatOS2_h__ */ diff --git a/intl/locale/src/os2/nsOS2Charset.cpp b/intl/locale/src/os2/nsOS2Charset.cpp deleted file mode 100644 index 48c02fa76..000000000 --- a/intl/locale/src/os2/nsOS2Charset.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "mozilla/Util.h" - -#include "nsIPlatformCharset.h" -#include "nsUConvPropertySearch.h" -#include "pratom.h" -#define INCL_WIN -#include <os2.h> -#include "nsIOS2Locale.h" -#include "nsCOMPtr.h" -#include "nsReadableUtils.h" -#include "nsLocaleCID.h" -#include "nsIServiceManager.h" -#include "nsPlatformCharset.h" - -using namespace mozilla; - -static const char* kOS2Charsets[][3] = { -#include "os2charset.properties.h" -}; - -NS_IMPL_ISUPPORTS1(nsPlatformCharset, nsIPlatformCharset) - -nsPlatformCharset::nsPlatformCharset() -{ - UINT acp = ::WinQueryCp(HMQ_CURRENT); - int32_t acpint = (int32_t)(acp & 0x00FFFF); - nsAutoString acpKey(NS_LITERAL_STRING("os2.")); - acpKey.AppendInt(acpint, 10); - nsresult res = MapToCharset(acpKey, mCharset); -} - -nsPlatformCharset::~nsPlatformCharset() -{ -} - -nsresult -nsPlatformCharset::MapToCharset(nsAString& inANSICodePage, nsACString& outCharset) -{ - nsAutoCString key; - LossyCopyUTF16toASCII(inANSICodePage, key); - - nsresult rv = nsUConvPropertySearch::SearchPropertyValue(kOS2Charsets, - ArrayLength(kOS2Charsets), key, outCharset); - if (NS_FAILED(rv)) { - outCharset.AssignLiteral("IBM850"); - } - return rv; -} - -NS_IMETHODIMP -nsPlatformCharset::GetCharset(nsPlatformCharsetSel selector, - nsACString& oResult) -{ - if ((selector == kPlatformCharsetSel_4xBookmarkFile) || (selector == kPlatformCharsetSel_4xPrefsJS)) { - if ((mCharset.Find("IBM850", IGNORE_CASE) != -1) || (mCharset.Find("IBM437", IGNORE_CASE) != -1)) - oResult.AssignLiteral("ISO-8859-1"); - else if (mCharset.Find("IBM852", IGNORE_CASE) != -1) - oResult.AssignLiteral("windows-1250"); - else if ((mCharset.Find("IBM855", IGNORE_CASE) != -1) || (mCharset.Find("IBM866", IGNORE_CASE) != -1)) - oResult.AssignLiteral("windows-1251"); - else if ((mCharset.Find("IBM869", IGNORE_CASE) != -1) || (mCharset.Find("IBM813", IGNORE_CASE) != -1)) - oResult.AssignLiteral("windows-1253"); - else if (mCharset.Find("IBM857", IGNORE_CASE) != -1) - oResult.AssignLiteral("windows-1254"); - else - oResult = mCharset; - } else { - oResult = mCharset; - } - return NS_OK; -} - -NS_IMETHODIMP -nsPlatformCharset::GetDefaultCharsetForLocale(const nsAString& localeName, nsACString &oResult) -{ - nsCOMPtr<nsIOS2Locale> os2Locale; - ULONG codepage; - char acp_name[6]; - - // - // convert locale name to a code page - // - nsresult rv; - oResult.Truncate(); - - os2Locale = do_GetService(NS_OS2LOCALE_CONTRACTID, &rv); - if (NS_FAILED(rv)) { return rv; } - - rv = os2Locale->GetPlatformLocale(localeName, &codepage); - if (NS_FAILED(rv)) { return rv; } - - nsAutoString os2_key(NS_LITERAL_STRING("os2.")); - os2_key.AppendInt((uint32_t)codepage); - - return MapToCharset(os2_key, oResult); - -} - -NS_IMETHODIMP -nsPlatformCharset::Init() -{ - return NS_OK; -} - -nsresult -nsPlatformCharset::InitGetCharset(nsACString &oString) -{ - return NS_OK; -} - -nsresult -nsPlatformCharset::VerifyCharset(nsCString &aCharset) -{ - return NS_OK; -} diff --git a/intl/locale/src/os2/nsOS2Locale.cpp b/intl/locale/src/os2/nsOS2Locale.cpp deleted file mode 100644 index 28c3a267f..000000000 --- a/intl/locale/src/os2/nsOS2Locale.cpp +++ /dev/null @@ -1,264 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * This Original Code has been modified by IBM Corporation. - * Modifications made by IBM described herein are - * Copyright (c) International Business Machines - * Corporation, 2000 - * - * Modifications to Mozilla code or documentation - * identified per MPL Section 3.3 - * - * Date Modified by Description of modification - * - * 07/05/2000 IBM Corp. renamed file to nsOS2Locale.cpp from ns LocaleOS2.cpp - * added implementation for GetPlatformLocale, and GetXPlatformLocale using Unix model - * created ParseLocaleString method - */ - -#include "nsISupports.h" -#include "nscore.h" -#include "nsString.h" -#include "nsOS2Locale.h" -#include "nsLocaleCID.h" -#include "prprf.h" -#include "nsReadableUtils.h" -#include <unidef.h> - -extern "C" { -#include <callconv.h> -int APIENTRY UniQueryLocaleValue ( const LocaleObject locale_object, - LocaleItem item, - int *info_item); -} - -/* nsOS2Locale ISupports */ -NS_IMPL_ISUPPORTS1(nsOS2Locale,nsIOS2Locale) - -nsOS2Locale::nsOS2Locale(void) -{ -} - -nsOS2Locale::~nsOS2Locale(void) -{ - -} - -/* Workaround for GCC problem */ -#ifndef LOCI_sName -#define LOCI_sName ((LocaleItem)100) -#endif - -NS_IMETHODIMP -nsOS2Locale::GetPlatformLocale(const nsAString& locale, PULONG os2Codepage) -{ - LocaleObject locObj = NULL; - int codePage; - nsAutoString tempLocale(locale); - tempLocale.ReplaceChar('-', '_'); - - - int ret = UniCreateLocaleObject(UNI_UCS_STRING_POINTER, (UniChar *)PromiseFlatString(tempLocale).get(), &locObj); - if (ret != ULS_SUCCESS) - UniCreateLocaleObject(UNI_UCS_STRING_POINTER, (UniChar *)L"C", &locObj); - - ret = UniQueryLocaleValue(locObj, LOCI_iCodepage, &codePage); - if (ret != ULS_SUCCESS) - return NS_ERROR_FAILURE; - - if (codePage == 437) { - *os2Codepage = 850; - } else { - *os2Codepage = codePage; - } - UniFreeLocaleObject(locObj); - - return NS_OK; -} - -NS_IMETHODIMP -nsOS2Locale::GetXPLocale(const char* os2Locale, nsAString& locale) -{ - char country_code[MAX_COUNTRY_CODE_LEN]; - char lang_code[MAX_LANGUAGE_CODE_LEN]; - char extra[MAX_EXTRA_LEN]; - char os2_locale[MAX_LOCALE_LEN]; - - if (os2Locale!=nullptr) { - if (strcmp(os2Locale,"C")==0 || strcmp(os2Locale,"OS2")==0) { - locale.AssignLiteral("en-US"); - return NS_OK; - } - if (!ParseLocaleString(os2Locale,lang_code,country_code,extra,'_')) { -// * locale = "x-user-defined"; - // use os2 if parse failed - CopyASCIItoUTF16(nsDependentCString(os2Locale), locale); - return NS_OK; - } - - if (*country_code) { - if (*extra) { - PR_snprintf(os2_locale,MAX_LOCALE_LEN,"%s-%s.%s",lang_code,country_code,extra); - } - else { - PR_snprintf(os2_locale,MAX_LOCALE_LEN,"%s-%s",lang_code,country_code); - } - } - else { - if (*extra) { - PR_snprintf(os2_locale,MAX_LOCALE_LEN,"%s.%s",lang_code,extra); - } - else { - PR_snprintf(os2_locale,MAX_LOCALE_LEN,"%s",lang_code); - } - } - - CopyASCIItoUTF16(nsDependentCString(os2_locale), locale); - return NS_OK; - - } - - return NS_ERROR_FAILURE; -} - -// copied from nsPosixLocale::ParseLocaleString: -// returns false/true depending on if it was of the form LL-CC.Extra -// or possibly ll_CC_Extra (depending on the separator, which happens on OS/2 -bool -nsOS2Locale::ParseLocaleString(const char* locale_string, char* language, char* country, char* extra, char separator) -{ - const char *src = locale_string; - char modifier[MAX_EXTRA_LEN+1]; - char *dest; - int dest_space, len; - - *language = '\0'; - *country = '\0'; - *extra = '\0'; - if (strlen(locale_string) < 2) { - return(false); - } - - // - // parse the language part - // - dest = language; - dest_space = MAX_LANGUAGE_CODE_LEN; - while ((*src) && (isalpha(*src)) && (dest_space--)) { - *dest++ = tolower(*src++); - } - *dest = '\0'; - len = dest - language; - if ((len != 2) && (len != 3)) { - NS_ASSERTION((len == 2) || (len == 3), "language code too short"); - NS_ASSERTION(len < 3, "reminder: verify we can handle 3+ character language code in all parts of the system; eg: language packs"); - *language = '\0'; - return(false); - } - - // check if all done - if (*src == '\0') { - return(true); - } - - if ((*src != '_') && (*src != '-') && (*src != '.') && (*src != '@')) { - NS_ASSERTION(isalpha(*src), "language code too long"); - NS_ASSERTION(!isalpha(*src), "unexpected language/country separator"); - *language = '\0'; - return(false); - } - - // - // parse the country part - // - if ((*src == '_') || (*src == '-')) { - src++; - dest = country; - dest_space = MAX_COUNTRY_CODE_LEN; - while ((*src) && (isalpha(*src)) && (dest_space--)) { - *dest++ = toupper(*src++); - } - *dest = '\0'; - len = dest - country; - if (len != 2) { - NS_ASSERTION(len == 2, "unexpected country code length"); - *language = '\0'; - *country = '\0'; - return(false); - } - } - - // check if all done - if (*src == '\0') { - return(true); - } - - if ((*src != '.') && (*src != '@') && (*src != separator)) { - NS_ASSERTION(isalpha(*src), "country code too long"); - NS_ASSERTION(!isalpha(*src), "unexpected country/extra separator"); - *language = '\0'; - *country = '\0'; - return(false); - } - - // - // handle the extra part - // - if (*src == '.') { - src++; // move past the extra part separator - dest = extra; - dest_space = MAX_EXTRA_LEN; - while ((*src) && (*src != '@') && (dest_space--)) { - *dest++ = *src++; - } - *dest = '\0'; - len = dest - extra; - if (len < 1) { - NS_ASSERTION(len > 0, "found country/extra separator but no extra code"); - *language = '\0'; - *country = '\0'; - *extra = '\0'; - return(false); - } - } - - // check if all done - if (*src == '\0') { - return(true); - } - - // - // handle the modifier part - // - if ((*src == '@') || (*src == separator)) { - src++; // move past the modifier separator - NS_ASSERTION(stricmp("euro",src) == 0, "found non euro modifier"); - dest = modifier; - dest_space = MAX_EXTRA_LEN; - while ((*src) && (dest_space--)) { - *dest++ = *src++; - } - *dest = '\0'; - len = dest - modifier; - if (len < 1) { - NS_ASSERTION(len > 0, "found modifier separator but no modifier code"); - *language = '\0'; - *country = '\0'; - *extra = '\0'; - *modifier = '\0'; - return(false); - } - } - - // check if all done - if (*src == '\0') { - return(true); - } - - NS_ASSERTION(*src == '\0', "extra/modifier code too long"); - *language = '\0'; - *country = '\0'; - *extra = '\0'; - - return(false); -} diff --git a/intl/locale/src/os2/nsOS2Locale.h b/intl/locale/src/os2/nsOS2Locale.h deleted file mode 100644 index 592eb9569..000000000 --- a/intl/locale/src/os2/nsOS2Locale.h +++ /dev/null @@ -1,32 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#ifndef _nslocaleos2_h_ -#define _nslocaleos2_h_ - - -#include "nsISupports.h" -#include "nscore.h" -#include "nsString.h" -#include "nsIOS2Locale.h" -#include <os2.h> - - -class nsOS2Locale : public nsIOS2Locale { - - NS_DECL_ISUPPORTS - -public: - - nsOS2Locale(); - virtual ~nsOS2Locale(); - - NS_IMETHOD GetPlatformLocale(const nsAString& locale, PULONG os2Codepage); - NS_IMETHOD GetXPLocale(const char* os2Locale, nsAString& locale); - -protected: - inline bool ParseLocaleString(const char* locale_string, char* language, char* country, char* extra, char separator); - -}; - -#endif diff --git a/intl/locale/src/os2/os2charset.properties b/intl/locale/src/os2/os2charset.properties deleted file mode 100644 index 12641acd6..000000000 --- a/intl/locale/src/os2/os2charset.properties +++ /dev/null @@ -1,28 +0,0 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# This file map an OS/2 codepage to a charset name -# We use this to figure out the charset of file system, clipboard, etc -# - -os2.850=IBM850 -os2.852=IBM852 -os2.855=IBM855 -os2.857=IBM857 -os2.862=IBM862 -os2.864=IBM864 -os2.866=IBM866 -os2.874=TIS-620 -os2.932=Shift_JIS -os2.936=GB2312 -os2.949=EUC-KR -os2.950=Big5 -os2.1381=GB2312 -os2.1386=gbk -os2.813=ISO-8859-7 -os2.915=ISO-8859-5 -os2.1004=ISO-8859-1 -os2.921=ISO-8859-13 -os2.1125=IBM1125 -os2.1131=IBM1131 diff --git a/intl/locale/src/windows/nsCollationWin.cpp b/intl/locale/src/windows/nsCollationWin.cpp index 8114a0bf4..8b0f5f767 100644 --- a/intl/locale/src/windows/nsCollationWin.cpp +++ b/intl/locale/src/windows/nsCollationWin.cpp @@ -7,7 +7,6 @@ #include "nsCollationWin.h" #include "nsIServiceManager.h" #include "nsIComponentManager.h" -#include "nsLocaleCID.h" #include "nsILocaleService.h" #include "nsIPlatformCharset.h" #include "nsWin32Locale.h" diff --git a/intl/locale/src/windows/nsDateTimeFormatWin.cpp b/intl/locale/src/windows/nsDateTimeFormatWin.cpp index 1d27115b3..acc9781ca 100644 --- a/intl/locale/src/windows/nsDateTimeFormatWin.cpp +++ b/intl/locale/src/windows/nsDateTimeFormatWin.cpp @@ -6,7 +6,6 @@ #include "nsDateTimeFormatWin.h" #include "nsIServiceManager.h" #include "nsIComponentManager.h" -#include "nsLocaleCID.h" #include "nsILocaleService.h" #include "nsWin32Locale.h" #include "nsUnicharUtils.h" diff --git a/intl/locale/src/windows/nsWin32Locale.cpp b/intl/locale/src/windows/nsWin32Locale.cpp index 55fd56bcb..afd6f4a4e 100644 --- a/intl/locale/src/windows/nsWin32Locale.cpp +++ b/intl/locale/src/windows/nsWin32Locale.cpp @@ -10,7 +10,6 @@ #include "nsXPCOMStrings.h" #include "nsReadableUtils.h" #include "nsWin32Locale.h" -#include "nsLocaleCID.h" #include "prprf.h" #include <windows.h> #include "nsCRT.h" diff --git a/intl/locale/src/windows/nsWinCharset.cpp b/intl/locale/src/windows/nsWinCharset.cpp index d2e4e773e..e7422598a 100644 --- a/intl/locale/src/windows/nsWinCharset.cpp +++ b/intl/locale/src/windows/nsWinCharset.cpp @@ -12,7 +12,6 @@ #include "nsWin32Locale.h" #include "nsCOMPtr.h" #include "nsReadableUtils.h" -#include "nsLocaleCID.h" #include "nsServiceManagerUtils.h" #include "nsPlatformCharset.h" #include "nsEncoderDecoderUtils.h" diff --git a/intl/locale/tests/unit/xpcshell.ini b/intl/locale/tests/unit/xpcshell.ini index d0ce9bdcf..9c0d69f47 100644 --- a/intl/locale/tests/unit/xpcshell.ini +++ b/intl/locale/tests/unit/xpcshell.ini @@ -7,7 +7,7 @@ run-if = toolkit == "windows" || toolkit == "cocoa" [test_bug371611.js] [test_bug374040.js] -skip-if = toolkit == "windows" || toolkit == "cocoa" || toolkit == "os2" +skip-if = toolkit == "windows" || toolkit == "cocoa" [test_pluralForm.js] [test_pluralForm_english.js] diff --git a/intl/uconv/src/nsUConvModule.cpp b/intl/uconv/src/nsUConvModule.cpp index a13d578df..6650ec1a5 100644 --- a/intl/uconv/src/nsUConvModule.cpp +++ b/intl/uconv/src/nsUConvModule.cpp @@ -163,22 +163,12 @@ #include "nsCP857ToUnicode.h" #include "nsCP862ToUnicode.h" #include "nsCP864ToUnicode.h" -#ifdef XP_OS2 -#include "nsCP869ToUnicode.h" -#include "nsCP1125ToUnicode.h" -#include "nsCP1131ToUnicode.h" -#endif #include "nsUnicodeToCP850.h" #include "nsUnicodeToCP852.h" #include "nsUnicodeToCP855.h" #include "nsUnicodeToCP857.h" #include "nsUnicodeToCP862.h" #include "nsUnicodeToCP864.h" -#ifdef XP_OS2 -#include "nsUnicodeToCP869.h" -#include "nsUnicodeToCP1125.h" -#include "nsUnicodeToCP1131.h" -#endif // ucvja #include "nsUCVJACID.h" @@ -303,11 +293,6 @@ NS_UCONV_REG_UNREG("IBM855", NS_CP855TOUNICODE_CID, NS_UNICODETOCP855_CID) NS_UCONV_REG_UNREG("IBM857", NS_CP857TOUNICODE_CID, NS_UNICODETOCP857_CID) NS_UCONV_REG_UNREG("IBM862", NS_CP862TOUNICODE_CID, NS_UNICODETOCP862_CID) NS_UCONV_REG_UNREG("IBM864", NS_CP864TOUNICODE_CID, NS_UNICODETOCP864_CID) -#ifdef XP_OS2 -NS_UCONV_REG_UNREG("IBM869", NS_CP869TOUNICODE_CID, NS_UNICODETOCP869_CID) -NS_UCONV_REG_UNREG("IBM1125", NS_CP1125TOUNICODE_CID, NS_UNICODETOCP1125_CID) -NS_UCONV_REG_UNREG("IBM1131", NS_CP1131TOUNICODE_CID, NS_UNICODETOCP1131_CID) -#endif // ucvja NS_UCONV_REG_UNREG("Shift_JIS", NS_SJISTOUNICODE_CID, NS_UNICODETOSJIS_CID) @@ -647,22 +632,12 @@ NS_DEFINE_NAMED_CID(NS_CP855TOUNICODE_CID); NS_DEFINE_NAMED_CID(NS_CP857TOUNICODE_CID); NS_DEFINE_NAMED_CID(NS_CP862TOUNICODE_CID); NS_DEFINE_NAMED_CID(NS_CP864TOUNICODE_CID); -#ifdef XP_OS2 -NS_DEFINE_NAMED_CID(NS_CP869TOUNICODE_CID); -NS_DEFINE_NAMED_CID(NS_CP1125TOUNICODE_CID); -NS_DEFINE_NAMED_CID(NS_CP1131TOUNICODE_CID); -#endif NS_DEFINE_NAMED_CID(NS_UNICODETOCP850_CID); NS_DEFINE_NAMED_CID(NS_UNICODETOCP852_CID); NS_DEFINE_NAMED_CID(NS_UNICODETOCP855_CID); NS_DEFINE_NAMED_CID(NS_UNICODETOCP857_CID); NS_DEFINE_NAMED_CID(NS_UNICODETOCP862_CID); NS_DEFINE_NAMED_CID(NS_UNICODETOCP864_CID); -#ifdef XP_OS2 -NS_DEFINE_NAMED_CID(NS_UNICODETOCP869_CID); -NS_DEFINE_NAMED_CID(NS_UNICODETOCP1125_CID); -NS_DEFINE_NAMED_CID(NS_UNICODETOCP1131_CID); -#endif NS_DEFINE_NAMED_CID(NS_SJISTOUNICODE_CID); NS_DEFINE_NAMED_CID(NS_EUCJPTOUNICODE_CID); NS_DEFINE_NAMED_CID( NS_ISO2022JPTOUNICODE_CID); @@ -832,22 +807,12 @@ static const mozilla::Module::CIDEntry kUConvCIDs[] = { { &kNS_CP857TOUNICODE_CID, false, nullptr, nsCP857ToUnicodeConstructor }, { &kNS_CP862TOUNICODE_CID, false, nullptr, nsCP862ToUnicodeConstructor }, { &kNS_CP864TOUNICODE_CID, false, nullptr, nsCP864ToUnicodeConstructor }, -#ifdef XP_OS2 - { &kNS_CP869TOUNICODE_CID, false, nullptr, nsCP869ToUnicodeConstructor }, - { &kNS_CP1125TOUNICODE_CID, false, nullptr, nsCP1125ToUnicodeConstructor }, - { &kNS_CP1131TOUNICODE_CID, false, nullptr, nsCP1131ToUnicodeConstructor }, -#endif { &kNS_UNICODETOCP850_CID, false, nullptr, nsUnicodeToCP850Constructor }, { &kNS_UNICODETOCP852_CID, false, nullptr, nsUnicodeToCP852Constructor }, { &kNS_UNICODETOCP855_CID, false, nullptr, nsUnicodeToCP855Constructor }, { &kNS_UNICODETOCP857_CID, false, nullptr, nsUnicodeToCP857Constructor }, { &kNS_UNICODETOCP862_CID, false, nullptr, nsUnicodeToCP862Constructor }, { &kNS_UNICODETOCP864_CID, false, nullptr, nsUnicodeToCP864Constructor }, -#ifdef XP_OS2 - { &kNS_UNICODETOCP869_CID, false, nullptr, nsUnicodeToCP869Constructor }, - { &kNS_UNICODETOCP1125_CID, false, nullptr, nsUnicodeToCP1125Constructor }, - { &kNS_UNICODETOCP1131_CID, false, nullptr, nsUnicodeToCP1131Constructor }, -#endif { &kNS_SJISTOUNICODE_CID, false, nullptr, nsShiftJISToUnicodeConstructor }, { &kNS_EUCJPTOUNICODE_CID, false, nullptr, nsEUCJPToUnicodeV2Constructor }, { &kNS_ISO2022JPTOUNICODE_CID, false, nullptr, nsISO2022JPToUnicodeV2Constructor }, @@ -1019,22 +984,12 @@ static const mozilla::Module::ContractIDEntry kUConvContracts[] = { { NS_UNICODEDECODER_CONTRACTID_BASE "IBM857", &kNS_CP857TOUNICODE_CID }, { NS_UNICODEDECODER_CONTRACTID_BASE "IBM862", &kNS_CP862TOUNICODE_CID }, { NS_UNICODEDECODER_CONTRACTID_BASE "IBM864", &kNS_CP864TOUNICODE_CID }, -#ifdef XP_OS2 - { NS_UNICODEDECODER_CONTRACTID_BASE "IBM869", &kNS_CP869TOUNICODE_CID }, - { NS_UNICODEDECODER_CONTRACTID_BASE "IBM1125", &kNS_CP1125TOUNICODE_CID }, - { NS_UNICODEDECODER_CONTRACTID_BASE "IBM1131", &kNS_CP1131TOUNICODE_CID }, -#endif { NS_UNICODEENCODER_CONTRACTID_BASE "IBM850", &kNS_UNICODETOCP850_CID }, { NS_UNICODEENCODER_CONTRACTID_BASE "IBM852", &kNS_UNICODETOCP852_CID }, { NS_UNICODEENCODER_CONTRACTID_BASE "IBM855", &kNS_UNICODETOCP855_CID }, { NS_UNICODEENCODER_CONTRACTID_BASE "IBM857", &kNS_UNICODETOCP857_CID }, { NS_UNICODEENCODER_CONTRACTID_BASE "IBM862", &kNS_UNICODETOCP862_CID }, { NS_UNICODEENCODER_CONTRACTID_BASE "IBM864", &kNS_UNICODETOCP864_CID }, -#ifdef XP_OS2 - { NS_UNICODEENCODER_CONTRACTID_BASE "IBM869", &kNS_UNICODETOCP869_CID }, - { NS_UNICODEENCODER_CONTRACTID_BASE "IBM1125", &kNS_UNICODETOCP1125_CID }, - { NS_UNICODEENCODER_CONTRACTID_BASE "IBM1131", &kNS_UNICODETOCP1131_CID }, -#endif { NS_UNICODEDECODER_CONTRACTID_BASE "Shift_JIS", &kNS_SJISTOUNICODE_CID }, { NS_UNICODEDECODER_CONTRACTID_BASE "EUC-JP", &kNS_EUCJPTOUNICODE_CID }, { NS_UNICODEDECODER_CONTRACTID_BASE "ISO-2022-JP", &kNS_ISO2022JPTOUNICODE_CID }, diff --git a/intl/uconv/tests/plattest.cpp b/intl/uconv/tests/plattest.cpp index 69ada9a72..4fbe932e6 100644 --- a/intl/uconv/tests/plattest.cpp +++ b/intl/uconv/tests/plattest.cpp @@ -6,7 +6,6 @@ #include "nsILocaleService.h" #include "nsCOMPtr.h" #include "nsReadableUtils.h" -#include "nsLocaleCID.h" #include "nsIComponentManager.h" #include <stdio.h> diff --git a/intl/uconv/ucvibm/nsCP1125ToUnicode.cpp b/intl/uconv/ucvibm/nsCP1125ToUnicode.cpp deleted file mode 100644 index ed6a3f53a..000000000 --- a/intl/uconv/ucvibm/nsCP1125ToUnicode.cpp +++ /dev/null @@ -1,24 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "nsUCConstructors.h" -#include "nsCP1125ToUnicode.h" - -//---------------------------------------------------------------------- -// Global functions and data [declaration] - -static const uint16_t g_utMappingTable[] = { -#include "cp1125.ut" -}; - -//---------------------------------------------------------------------- -// Class nsCP1125ToUnicode [implementation] - -nsresult -nsCP1125ToUnicodeConstructor(nsISupports* aOuter, REFNSIID aIID, - void **aResult) -{ - return CreateOneByteDecoder((uMappingTable*) &g_utMappingTable, - aOuter, aIID, aResult); -} diff --git a/intl/uconv/ucvibm/nsCP1125ToUnicode.h b/intl/uconv/ucvibm/nsCP1125ToUnicode.h deleted file mode 100644 index ba95b4788..000000000 --- a/intl/uconv/ucvibm/nsCP1125ToUnicode.h +++ /dev/null @@ -1,17 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifndef nsCP1125ToUnicode_h___ -#define nsCP1125ToUnicode_h___ - -#include "nsISupports.h" -/** - * A character set converter from CP1125 to Unicode. - */ -nsresult -nsCP1125ToUnicodeConstructor(nsISupports *aOuter, REFNSIID aIID, - void **aResult); - - -#endif /* !nsCP1125ToUnicode_h___ */ diff --git a/intl/uconv/ucvibm/nsCP1131ToUnicode.cpp b/intl/uconv/ucvibm/nsCP1131ToUnicode.cpp deleted file mode 100644 index 7698b0ff6..000000000 --- a/intl/uconv/ucvibm/nsCP1131ToUnicode.cpp +++ /dev/null @@ -1,24 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "nsUCConstructors.h" -#include "nsCP1131ToUnicode.h" - -//---------------------------------------------------------------------- -// Global functions and data [declaration] - -static const uint16_t g_utMappingTable[] = { -#include "cp1131.ut" -}; - -//---------------------------------------------------------------------- -// Class nsCP1131ToUnicode [implementation] - -nsresult -nsCP1131ToUnicodeConstructor(nsISupports* aOuter, REFNSIID aIID, - void **aResult) -{ - return CreateOneByteDecoder((uMappingTable*) &g_utMappingTable, - aOuter, aIID, aResult); -} diff --git a/intl/uconv/ucvibm/nsCP1131ToUnicode.h b/intl/uconv/ucvibm/nsCP1131ToUnicode.h deleted file mode 100644 index bef71017c..000000000 --- a/intl/uconv/ucvibm/nsCP1131ToUnicode.h +++ /dev/null @@ -1,17 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifndef nsCP1131ToUnicode_h___ -#define nsCP1131ToUnicode_h___ - -#include "nsISupports.h" -/** - * A character set converter from CP1131 to Unicode. - */ -nsresult -nsCP1131ToUnicodeConstructor(nsISupports *aOuter, REFNSIID aIID, - void **aResult); - - -#endif /* !nsCP1131ToUnicode_h___ */ diff --git a/intl/uconv/ucvibm/nsCP869ToUnicode.cpp b/intl/uconv/ucvibm/nsCP869ToUnicode.cpp deleted file mode 100644 index aa63133fe..000000000 --- a/intl/uconv/ucvibm/nsCP869ToUnicode.cpp +++ /dev/null @@ -1,22 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "nsUCConstructors.h" -#include "nsCP869ToUnicode.h" - -//---------------------------------------------------------------------- -// Global functions and data [declaration] - -static const uint16_t g_utMappingTable[] = { -#include "cp869.ut" -}; - -nsresult -nsCP869ToUnicodeConstructor(nsISupports *aOuter, REFNSIID aIID, - void **aResult) -{ - return CreateOneByteDecoder((uMappingTable*) &g_utMappingTable, - aOuter, aIID, aResult); -} - diff --git a/intl/uconv/ucvibm/nsCP869ToUnicode.h b/intl/uconv/ucvibm/nsCP869ToUnicode.h deleted file mode 100644 index 601515022..000000000 --- a/intl/uconv/ucvibm/nsCP869ToUnicode.h +++ /dev/null @@ -1,18 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifndef nsCP869ToUnicode_h___ -#define nsCP869ToUnicode_h___ - -#include "nsISupports.h" - -/** - * A character set converter from CP869 to Unicode. - */ -nsresult -nsCP869ToUnicodeConstructor(nsISupports *aOuter, REFNSIID aIID, - void **aResult); - - -#endif /* nsCP869ToUnicode_h___ */ diff --git a/intl/uconv/ucvibm/nsUnicodeToCP1125.cpp b/intl/uconv/ucvibm/nsUnicodeToCP1125.cpp deleted file mode 100644 index c1d382d8d..000000000 --- a/intl/uconv/ucvibm/nsUnicodeToCP1125.cpp +++ /dev/null @@ -1,23 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "nsUCConstructors.h" -#include "nsUnicodeToCP1125.h" - -//---------------------------------------------------------------------- -// Global functions and data [declaration] - -static const uint16_t g_ufMappingTable[] = { -#include "cp1125.uf" -}; - -nsresult -nsUnicodeToCP1125Constructor(nsISupports *aOuter, REFNSIID aIID, - void **aResult) -{ - return CreateTableEncoder(u1ByteCharset, - (uMappingTable*) &g_ufMappingTable, 1, - aOuter, aIID, aResult); -} - diff --git a/intl/uconv/ucvibm/nsUnicodeToCP1125.h b/intl/uconv/ucvibm/nsUnicodeToCP1125.h deleted file mode 100644 index e69163851..000000000 --- a/intl/uconv/ucvibm/nsUnicodeToCP1125.h +++ /dev/null @@ -1,19 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifndef nsUnicodeToCP1125_h___ -#define nsUnicodeToCP1125_h___ - -#include "nsISupports.h" - - -/** - * A character set converter from Unicode to CP1125. - */ -nsresult -nsUnicodeToCP1125Constructor(nsISupports *aOuter, REFNSIID aIID, - void **aResult); - - -#endif /* !nsUnicodeToCP1125_h___ */ diff --git a/intl/uconv/ucvibm/nsUnicodeToCP1131.cpp b/intl/uconv/ucvibm/nsUnicodeToCP1131.cpp deleted file mode 100644 index b185565c2..000000000 --- a/intl/uconv/ucvibm/nsUnicodeToCP1131.cpp +++ /dev/null @@ -1,23 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "nsUCConstructors.h" -#include "nsUnicodeToCP1131.h" - -//---------------------------------------------------------------------- -// Global functions and data [declaration] - -static const uint16_t g_ufMappingTable[] = { -#include "cp1131.uf" -}; - -nsresult -nsUnicodeToCP1131Constructor(nsISupports *aOuter, REFNSIID aIID, - void **aResult) -{ - return CreateTableEncoder(u1ByteCharset, - (uMappingTable*) &g_ufMappingTable, 1, - aOuter, aIID, aResult); -} - diff --git a/intl/uconv/ucvibm/nsUnicodeToCP1131.h b/intl/uconv/ucvibm/nsUnicodeToCP1131.h deleted file mode 100644 index 8710e1dea..000000000 --- a/intl/uconv/ucvibm/nsUnicodeToCP1131.h +++ /dev/null @@ -1,19 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifndef nsUnicodeToCP1131_h___ -#define nsUnicodeToCP1131_h___ - -#include "nsISupports.h" - - -/** - * A character set converter from Unicode to CP1131. - */ -nsresult -nsUnicodeToCP1131Constructor(nsISupports *aOuter, REFNSIID aIID, - void **aResult); - - -#endif /* !nsUnicodeToCP1131_h___ */ diff --git a/intl/uconv/ucvibm/nsUnicodeToCP869.cpp b/intl/uconv/ucvibm/nsUnicodeToCP869.cpp deleted file mode 100644 index 7a28359d8..000000000 --- a/intl/uconv/ucvibm/nsUnicodeToCP869.cpp +++ /dev/null @@ -1,23 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "nsUCConstructors.h" -#include "nsUnicodeToCP869.h" - -//---------------------------------------------------------------------- -// Global functions and data [declaration] - -static const uint16_t g_ufMappingTable[] = { -#include "cp869.uf" -}; - -nsresult -nsUnicodeToCP869Constructor(nsISupports *aOuter, REFNSIID aIID, - void **aResult) -{ - return CreateTableEncoder(u1ByteCharset, - (uMappingTable*) &g_ufMappingTable, 1, - aOuter, aIID, aResult); -} - diff --git a/intl/uconv/ucvibm/nsUnicodeToCP869.h b/intl/uconv/ucvibm/nsUnicodeToCP869.h deleted file mode 100644 index 7c0f810b3..000000000 --- a/intl/uconv/ucvibm/nsUnicodeToCP869.h +++ /dev/null @@ -1,17 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifndef nsUnicodeToCP869_h___ -#define nsUnicodeToCP869_h___ - -#include "nsISupports.h" - -/** - * A character set converter from Unicode to CP869. - */ -nsresult -nsUnicodeToCP869Constructor(nsISupports *aOuter, REFNSIID aIID, - void **aResult); - -#endif /* nsUnicodeToCP869_h___ */ diff --git a/intl/uconv/ucvja/nsJapaneseToUnicode.cpp b/intl/uconv/ucvja/nsJapaneseToUnicode.cpp index c4277182b..07f5c49f0 100644 --- a/intl/uconv/ucvja/nsJapaneseToUnicode.cpp +++ b/intl/uconv/ucvja/nsJapaneseToUnicode.cpp @@ -15,18 +15,9 @@ static NS_DEFINE_CID(kCharsetConverterManagerCID, NS_ICHARSETCONVERTERMANAGER_CID); -#ifdef XP_OS2 - // HTML5-incompliant behavior for OS/2, see bug 108136 - // This is bogus. The right fix would be working around the font problems - // in OS/2 gfx, since this "fix" introduces script-visible DOM differences - // between the platforms. - #define SJIS_INDEX gIBM943Index[0] - #define JIS0208_INDEX gIBM943Index[1] -#else - // HTML5 says to use Windows-31J instead of the real Shift_JIS for decoding - #define SJIS_INDEX gCP932Index[0] - #define JIS0208_INDEX gCP932Index[1] -#endif +// HTML5 says to use Windows-31J instead of the real Shift_JIS for decoding +#define SJIS_INDEX gCP932Index[0] +#define JIS0208_INDEX gCP932Index[1] #define JIS0212_INDEX gJIS0212Index #define SJIS_UNMAPPED 0x30fb diff --git a/js/src/Makefile.in b/js/src/Makefile.in index 9c23736fc..5c7ba63e4 100644 --- a/js/src/Makefile.in +++ b/js/src/Makefile.in @@ -125,16 +125,10 @@ LOCAL_INCLUDES += \ ifdef MOZ_NATIVE_FFI EXTRA_DSO_LDOPTS += $(MOZ_FFI_LIBS) else -ifeq ($(OS_ARCH),OS2) -SHARED_LIBRARY_LIBS += \ - ctypes/libffi/.libs/ffi.a \ - $(NULL) -else SHARED_LIBRARY_LIBS += \ ctypes/libffi/.libs/libffi.$(LIB_SUFFIX) \ $(NULL) endif -endif endif # JS_HAS_CTYPES @@ -148,7 +142,7 @@ VPATH += $(srcdir)/perf DASH_R = -r -ifneq (,$(filter OS2 WINNT,$(OS_ARCH))) +ifneq (,$(filter WINNT,$(OS_ARCH))) SDK_LIBRARY = $(IMPORT_LIBRARY) else SDK_LIBRARY = $(SHARED_LIBRARY) @@ -192,7 +186,7 @@ endif default:: -ifneq (,$(CROSS_COMPILE)$(filter-out WINNT OS2,$(OS_ARCH))) +ifneq (,$(CROSS_COMPILE)$(filter-out WINNT,$(OS_ARCH))) # nsinstall doesn't get built until we enter config/ in the exports phase, # so we'll have to manually ensure it gets built here if we want to use # $(EXPORTS) @@ -400,7 +394,7 @@ RESFILE = ETWProvider.res endif # HP-UX does not require the extra linking of "-lm" -ifeq (,$(filter HP-UX WINNT OS2,$(OS_ARCH))) +ifeq (,$(filter HP-UX WINNT,$(OS_ARCH))) EXTRA_LIBS += -lm endif diff --git a/js/src/assembler/jit/ExecutableAllocatorOS2.cpp b/js/src/assembler/jit/ExecutableAllocatorOS2.cpp deleted file mode 100644 index b0879c8ac..000000000 --- a/js/src/assembler/jit/ExecutableAllocatorOS2.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (C) 2008 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -#include "ExecutableAllocator.h" - -#if ENABLE_ASSEMBLER && WTF_OS_OS2 - -#define INCL_DOS -#include <os2.h> - -namespace JSC { - -size_t ExecutableAllocator::determinePageSize() -{ - return 4096u; -} - -ExecutablePool::Allocation ExecutableAllocator::systemAlloc(size_t n) -{ - void* allocation = NULL; - if (DosAllocMem(&allocation, n, OBJ_ANY|PAG_COMMIT|PAG_READ|PAG_WRITE) && - DosAllocMem(&allocation, n, PAG_COMMIT|PAG_READ|PAG_WRITE)) - CRASH(); - ExecutablePool::Allocation alloc = { reinterpret_cast<char*>(allocation), n }; - return alloc; -} - -void ExecutableAllocator::systemRelease(const ExecutablePool::Allocation& alloc) -{ - DosFreeMem(alloc.pages); -} - -#if ENABLE_ASSEMBLER_WX_EXCLUSIVE -#error "ASSEMBLER_WX_EXCLUSIVE not yet suported on this platform." -#endif - -} - -#endif // HAVE(ASSEMBLER) diff --git a/js/src/configure.in b/js/src/configure.in index 1575d3b7d..317396a7b 100644 --- a/js/src/configure.in +++ b/js/src/configure.in @@ -907,9 +907,6 @@ solaris*) AC_SUBST(SOLARIS_SUNPRO_CC) AC_SUBST(SOLARIS_SUNPRO_CXX) ;; -OS_2) - HOST_OS_ARCH=OS2 - ;; esac case "$OS_ARCH" in @@ -953,11 +950,6 @@ AIX) fi fi ;; -OS_2) - OS_ARCH=OS2 - OS_TARGET=OS2 - OS_RELEASE=`uname -v` - ;; Darwin) case "${target_cpu}" in powerpc*) @@ -1340,16 +1332,6 @@ AC_LANG_RESTORE fi # COMPILE_ENVIRONMENT dnl ======================================================== -dnl Enable high-memory support on OS/2 by default. -dnl ======================================================== -MOZ_OS2_HIGH_MEMORY=1 -MOZ_ARG_DISABLE_BOOL(os2-high-mem, -[ --disable-os2-high-mem Disable high-memory support on OS/2], - MOZ_OS2_HIGH_MEMORY=, - MOZ_OS2_HIGH_MEMORY=1 ) -AC_SUBST(MOZ_OS2_HIGH_MEMORY) - -dnl ======================================================== dnl = Use profiling compile flags dnl ======================================================== MOZ_ARG_ENABLE_BOOL(profiling, @@ -1407,14 +1389,6 @@ case "$host" in HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}" ;; -*os2*) - HOST_CFLAGS="$HOST_CFLAGS -DXP_OS2 -DNO_X11 -Zomf" - HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"' - HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}" - HOST_BIN_SUFFIX=.exe - MOZ_FIX_LINK_PATHS= - ;; - *) HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX" HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}" @@ -1843,69 +1817,6 @@ ia64*-hpux*) fi ;; -*-os2*) - MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@' - MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@' - AC_DEFINE(OS2) - AC_DEFINE(XP_OS2) - AC_DEFINE(OS2EMX_PLAIN_CHAR) - AC_DEFINE(TCPV40HDRS) - DLL_PREFIX= - LIB_PREFIX= - LIB_SUFFIX=lib - BIN_SUFFIX=".exe" - DLL_SUFFIX=".dll" - IMPORT_LIB_SUFFIX=lib - DSO_PIC_CFLAGS= - AR=emxomfar - AR_FLAGS='r $@' - CFLAGS="$CFLAGS -Zomf" - CXXFLAGS="$CXXFLAGS -Zomf" - DSO_LDOPTS='-Zdll' - BIN_FLAGS='-Zlinker /ST:0x100000' - IMPLIB='emximp -o' - FILTER='true' - LDFLAGS='-Zmap' - WARNINGS_AS_ERRORS='-Werror' - MOZ_DEBUG_FLAGS="-g -fno-inline" - MOZ_OPTIMIZE_FLAGS="-O2" - MOZ_OPTIMIZE_LDFLAGS="-s -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA" - DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib' - LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib' - TARGET_MD_ARCH=os2 - _PLATFORM_DEFAULT_TOOLKIT="cairo-os2" - RC=rc.exe - MC=mc.exe - RCFLAGS='-n' - MOZ_USER_DIR="Mozilla" - - if test "$MOZTOOLS"; then - MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'` - else - AC_MSG_ERROR([MOZTOOLS is not set]) - fi - if test -n "$MOZ_OS2_HIGH_MEMORY"; then - DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem" - LDFLAGS="$LDFLAGS -Zhigh-mem" - MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -Zhigh-mem" - AC_DEFINE(MOZ_OS2_HIGH_MEMORY) - fi - - # GCC for OS/2 currently predefines these, but we don't want them - _DEFINES_CFLAGS="$_DEFINES_CFLAGS -Uunix -U__unix -U__unix__" - _DEFINES_CXXFLAGS="$_DEFINES_CXXFLAGS -Uunix -U__unix -U__unix__" - - AC_CACHE_CHECK(for __declspec(dllexport), - ac_os2_declspec, - [AC_TRY_COMPILE([__declspec(dllexport) void ac_os2_declspec(void) {}], - [return 0;], - ac_os2_declspec="yes", - ac_os2_declspec="no")]) - if test "$ac_os2_declspec" != "yes"; then - AC_MSG_ERROR([Compiler does not support __declspec(dllexport), install GCC-4.3.2 or newer]) - fi - ;; - *-solaris*) AC_DEFINE(SOLARIS) TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"' @@ -2006,10 +1917,6 @@ ia64*-hpux*) esac ;; -*-os2*) - HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"' - ;; - esac dnl Only one oddball right now (QNX), but this gives us flexibility @@ -2030,9 +1937,6 @@ if test -z "$MKSHLIB_FORCE_ALL" -o -z "$MKSHLIB_UNFORCE_ALL"; then NO_LD_ARCHIVE_FLAGS=1 fi case "$target" in -*-os2*) - NO_LD_ARCHIVE_FLAGS= - ;; *-aix4.3*|*-aix5*) NO_LD_ARCHIVE_FLAGS= ;; @@ -2544,8 +2448,6 @@ dnl against libSystem causes issues when debugging (see bug 299601). case $target in *-darwin*) ;; -*-os2*) - ;; *) AC_SEARCH_LIBS(dlopen, dl, MOZ_CHECK_HEADER(dlfcn.h, @@ -2570,13 +2472,7 @@ if test ! "$GNU_CXX"; then esac fi -dnl OS/2 has socket in libc. -case $target in -*-os2*) - ;; -*) - AC_CHECK_LIB(socket, socket) -esac +AC_CHECK_LIB(socket, socket) dnl ======================================================== dnl = pthread support @@ -4235,7 +4131,6 @@ AC_SUBST(MOZ_FIX_LINK_PATHS) AC_SUBST(USE_DEPENDENT_LIBS) AC_SUBST(MOZ_BUILD_ROOT) -AC_SUBST(MOZ_OS2_TOOLS) AC_SUBST(MOZ_POST_DSO_LIB_COMMAND) AC_SUBST(MOZ_POST_PROGRAM_COMMAND) @@ -4394,7 +4289,7 @@ dnl ======================================================== if test "$OS_ARCH" = "Darwin"; then AC_DEFINE(XP_MACOSX) AC_DEFINE(XP_UNIX) -elif test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2"; then +elif test "$OS_ARCH" != "WINNT"; then AC_DEFINE(XP_UNIX) fi @@ -4595,9 +4490,6 @@ if test "$JS_HAS_CTYPES" -a -z "$MOZ_NATIVE_FFI"; then ac_configure_args="$ac_configure_args CC=gcc CFLAGS=-maix64" fi fi - if test "$OS_ARCH" = "OS2"; then - ac_configure_args="$ac_configure_args CFLAGS=-Zomf AR=emxomfar" - fi # Use a separate cache file for libffi, since it does things differently # from our configure. diff --git a/js/src/ctypes/CTypes.cpp b/js/src/ctypes/CTypes.cpp index 230ceffd5..61db3460f 100644 --- a/js/src/ctypes/CTypes.cpp +++ b/js/src/ctypes/CTypes.cpp @@ -12,7 +12,7 @@ #include <limits> #include <math.h> -#if defined(XP_WIN) || defined(XP_OS2) +#if defined(XP_WIN) #include <float.h> #endif diff --git a/js/src/gc/Memory.cpp b/js/src/gc/Memory.cpp index 153ccb46b..4336bc309 100644 --- a/js/src/gc/Memory.cpp +++ b/js/src/gc/Memory.cpp @@ -108,138 +108,6 @@ gc::GetPageFaultCount() return pmc.PageFaultCount; } -#elif defined(XP_OS2) - -#define INCL_DOSMEMMGR -#include <os2.h> - -#define JS_GC_HAS_MAP_ALIGN 1 -#define OS2_MAX_RECURSIONS 16 - -void -gc::InitMemorySubsystem(JSRuntime *rt) -{ - rt->gcSystemPageSize = rt->gcSystemAllocGranularity = ArenaSize; -} - -void -gc::UnmapPages(JSRuntime *rt, void *addr, size_t size) -{ - if (!DosFreeMem(addr)) - return; - - /* - * If DosFreeMem() failed, 'addr' is probably part of an "expensive" - * allocation, so calculate the base address and try again. - */ - unsigned long cb = 2 * size; - unsigned long flags; - if (DosQueryMem(addr, &cb, &flags) || cb < size) - return; - - uintptr_t base = reinterpret_cast<uintptr_t>(addr) - ((2 * size) - cb); - DosFreeMem(reinterpret_cast<void*>(base)); - - return; -} - -static void * -MapAlignedPagesRecursively(JSRuntime *rt, size_t size, size_t alignment, int& recursions) -{ - if (++recursions >= OS2_MAX_RECURSIONS) - return NULL; - - void *tmp; - if (DosAllocMem(&tmp, size, - OBJ_ANY | PAG_COMMIT | PAG_READ | PAG_WRITE)) { - JS_ALWAYS_TRUE(DosAllocMem(&tmp, size, - PAG_COMMIT | PAG_READ | PAG_WRITE) == 0); - } - size_t offset = reinterpret_cast<uintptr_t>(tmp) & (alignment - 1); - if (!offset) - return tmp; - - /* - * If there are 'filler' bytes of free space above 'tmp', free 'tmp', - * then reallocate it as a 'filler'-sized block; assuming we're not - * in a race with another thread, the next recursion should succeed. - */ - size_t filler = size + alignment - offset; - unsigned long cb = filler; - unsigned long flags = 0; - unsigned long rc = DosQueryMem(&(static_cast<char*>(tmp))[size], - &cb, &flags); - if (!rc && (flags & PAG_FREE) && cb >= filler) { - UnmapPages(rt, tmp, 0); - if (DosAllocMem(&tmp, filler, - OBJ_ANY | PAG_COMMIT | PAG_READ | PAG_WRITE)) { - JS_ALWAYS_TRUE(DosAllocMem(&tmp, filler, - PAG_COMMIT | PAG_READ | PAG_WRITE) == 0); - } - } - - void *p = MapAlignedPagesRecursively(rt, size, alignment, recursions); - UnmapPages(rt, tmp, 0); - - return p; -} - -void * -gc::MapAlignedPages(JSRuntime *rt, size_t size, size_t alignment) -{ - JS_ASSERT(size >= alignment); - JS_ASSERT(size % alignment == 0); - JS_ASSERT(size % rt->gcSystemPageSize == 0); - JS_ASSERT(alignment % rt->gcSystemAllocGranularity == 0); - - int recursions = -1; - - /* - * Make up to OS2_MAX_RECURSIONS attempts to get an aligned block - * of the right size by recursively allocating blocks of unaligned - * free memory until only an aligned allocation is possible. - */ - void *p = MapAlignedPagesRecursively(rt, size, alignment, recursions); - if (p) - return p; - - /* - * If memory is heavily fragmented, the recursive strategy may fail; - * instead, use the "expensive" strategy: allocate twice as much - * as requested and return an aligned address within this block. - */ - if (DosAllocMem(&p, 2 * size, - OBJ_ANY | PAG_COMMIT | PAG_READ | PAG_WRITE)) { - JS_ALWAYS_TRUE(DosAllocMem(&p, 2 * size, - PAG_COMMIT | PAG_READ | PAG_WRITE) == 0); - } - - uintptr_t addr = reinterpret_cast<uintptr_t>(p); - addr = (addr + (alignment - 1)) & ~(alignment - 1); - - return reinterpret_cast<void *>(addr); -} - -bool -gc::MarkPagesUnused(JSRuntime *rt, void *p, size_t size) -{ - JS_ASSERT(uintptr_t(p) % rt->gcSystemPageSize == 0); - return true; -} - -bool -gc::MarkPagesInUse(JSRuntime *rt, void *p, size_t size) -{ - JS_ASSERT(uintptr_t(p) % rt->gcSystemPageSize == 0); - return true; -} - -size_t -gc::GetPageFaultCount() -{ - return 0; -} - #elif defined(SOLARIS) #include <sys/mman.h> diff --git a/js/src/jscpucfg.h b/js/src/jscpucfg.h index c79bd7ad1..3dcefa499 100644 --- a/js/src/jscpucfg.h +++ b/js/src/jscpucfg.h @@ -20,7 +20,7 @@ # error "CPU type is unknown" # endif /* !(defined(_M_X64) || defined(_M_AMD64) || defined(_AMD64_)) */ -#elif defined(_WIN32) || defined(XP_OS2) +#elif defined(_WIN32) # ifdef __WATCOMC__ # define HAVE_VA_LIST_AS_ARRAY 1 diff --git a/js/src/jsdtoa.cpp b/js/src/jsdtoa.cpp index 1511211a0..9229f3df8 100644 --- a/js/src/jsdtoa.cpp +++ b/js/src/jsdtoa.cpp @@ -302,7 +302,7 @@ js_dtobasestr(DtoaState *state, int base, double dinput) p = buffer; if (dval(d) < 0.0 -#if defined(XP_WIN) || defined(XP_OS2) +#if defined(XP_WIN) && !((word0(d) & Exp_mask) == Exp_mask && ((word0(d) & Frac_mask) || word1(d))) /* Visual C++ doesn't know how to compare against NaN */ #endif ) { diff --git a/js/src/jsnativestack.cpp b/js/src/jsnativestack.cpp index 562c89a58..f98b96752 100644 --- a/js/src/jsnativestack.cpp +++ b/js/src/jsnativestack.cpp @@ -9,10 +9,6 @@ #ifdef XP_WIN # include "jswin.h" -#elif defined(XP_OS2) -# define INCL_DOSPROCESS -# include <os2.h> - #elif defined(XP_MACOSX) || defined(DARWIN) || defined(XP_UNIX) # include <pthread.h> @@ -88,18 +84,6 @@ js::GetNativeStackBaseImpl() context.uc_stack.ss_size; } -#elif defined(XP_OS2) - -void * -js::GetNativeStackBaseImpl() -{ - PTIB ptib; - PPIB ppib; - - DosGetInfoBlocks(&ptib, &ppib); - return ptib->tib_pstacklimit; -} - #else /* XP_UNIX */ void * diff --git a/js/src/jsnum.cpp b/js/src/jsnum.cpp index a62e33d6c..76e95563d 100644 --- a/js/src/jsnum.cpp +++ b/js/src/jsnum.cpp @@ -16,11 +16,6 @@ #include "double-conversion.h" -#ifdef XP_OS2 -#define _PC_53 PC_53 -#define _MCW_EM MCW_EM -#define _MCW_PC MCW_PC -#endif #include <locale.h> #include <math.h> #include <string.h> diff --git a/js/src/moz.build b/js/src/moz.build index 253c241bc..fdea8c6fe 100644 --- a/js/src/moz.build +++ b/js/src/moz.build @@ -296,11 +296,6 @@ if CONFIG['OS_ARCH'] == 'WINNT': 'ExecutableAllocatorWin.cpp', 'OSAllocatorWin.cpp', ] -elif CONFIG['OS_ARCH'] == 'OS2': - CPP_SOURCES += [ - 'ExecutableAllocatorOS2.cpp', - 'OSAllocatorOS2.cpp', - ] else: CPP_SOURCES += [ 'ExecutableAllocatorPosix.cpp', diff --git a/js/src/prmjtime.cpp b/js/src/prmjtime.cpp index 4fa2ae235..705dbf354 100644 --- a/js/src/prmjtime.cpp +++ b/js/src/prmjtime.cpp @@ -23,9 +23,6 @@ #define PRMJ_DO_MILLISECONDS 1 -#ifdef XP_OS2 -#include <sys/timeb.h> -#endif #ifdef XP_WIN #include <windef.h> #include <winbase.h> @@ -182,17 +179,7 @@ static PRCallOnceType calibrationOnce = { 0 }; #endif /* XP_WIN */ - -#if defined(XP_OS2) -int64_t -PRMJ_Now(void) -{ - struct timeb b; - ftime(&b); - return (int64_t(b.time) * PRMJ_USEC_PER_SEC) + (int64_t(b.millitm) * PRMJ_USEC_PER_MSEC); -} - -#elif defined(XP_UNIX) +#if defined(XP_UNIX) int64_t PRMJ_Now(void) { @@ -417,7 +404,7 @@ size_t PRMJ_FormatTime(char *buf, int buflen, const char *fmt, PRMJTime *prtm) { size_t result = 0; -#if defined(XP_UNIX) || defined(XP_WIN) || defined(XP_OS2) +#if defined(XP_UNIX) || defined(XP_WIN) struct tm a; int fake_tm_year = 0; #ifdef NS_HAVE_INVALID_PARAMETER_HANDLER diff --git a/js/src/shell/js.cpp b/js/src/shell/js.cpp index 7aa9380d9..f01cf855f 100644 --- a/js/src/shell/js.cpp +++ b/js/src/shell/js.cpp @@ -63,7 +63,7 @@ #include <sys/wait.h> #endif -#if defined(XP_WIN) || defined(XP_OS2) +#if defined(XP_WIN) #include <io.h> /* for isatty() */ #endif @@ -4419,7 +4419,7 @@ static JSBool env_setProperty(JSContext *cx, HandleObject obj, HandleId id, JSBool strict, MutableHandleValue vp) { /* XXX porting may be easy, but these don't seem to supply setenv by default */ -#if !defined XP_OS2 && !defined SOLARIS +#if !defined SOLARIS int rv; ToStringHelper idstr(cx, id, true); @@ -4455,7 +4455,7 @@ env_setProperty(JSContext *cx, HandleObject obj, HandleId id, JSBool strict, Mut return false; } vp.set(valstr.getJSVal()); -#endif /* !defined XP_OS2 && !defined SOLARIS */ +#endif /* !defined SOLARIS */ return true; } @@ -5215,13 +5215,6 @@ main(int argc, char **argv, char **envp) gStackBase = (uintptr_t) &stackDummy; #endif -#ifdef XP_OS2 - /* these streams are normally line buffered on OS/2 and need a \n, * - * so we need to unbuffer then to get a reasonable prompt */ - setbuf(stdout,0); - setbuf(stderr,0); -#endif - MaybeOverrideOutFileFromEnv("JS_STDERR", stderr, &gErrFile); MaybeOverrideOutFileFromEnv("JS_STDOUT", stdout, &gOutFile); diff --git a/js/src/yarr/OSAllocatorOS2.cpp b/js/src/yarr/OSAllocatorOS2.cpp deleted file mode 100644 index 466b9e949..000000000 --- a/js/src/yarr/OSAllocatorOS2.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- - * vim: set ts=8 sts=4 et sw=4 tw=99: - * - * ***** BEGIN LICENSE BLOCK ***** - * Copyright (C) 2010 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - * - * ***** END LICENSE BLOCK ***** */ - -#include "assembler/wtf/Platform.h" - -#if ENABLE_ASSEMBLER && WTF_OS_OS2 - -#define INCL_DOS -#include <os2.h> - -#include "wtf/Assertions.h" - -#include "OSAllocator.h" - -namespace WTF { - -static inline ULONG protection(bool writable, bool executable) -{ - return (PAG_READ | (writable ? PAG_WRITE : 0) | (executable ? PAG_EXECUTE : 0)); -} - -void* OSAllocator::reserveUncommitted(size_t bytes, Usage, bool writable, bool executable) -{ - void* result = NULL; - if (DosAllocMem(&result, bytes, OBJ_ANY | protection(writable, executable)) && - DosAllocMem(&result, bytes, protection(writable, executable))) - { CRASH(); - } - return result; -} - -void* OSAllocator::reserveAndCommit(size_t bytes, Usage, bool writable, bool executable) -{ - void* result = NULL; - if (DosAllocMem(&result, bytes, OBJ_ANY | PAG_COMMIT | protection(writable, executable)) && - DosAllocMem(&result, bytes, PAG_COMMIT | protection(writable, executable))) - { CRASH(); - } - return result; - -} - -void OSAllocator::commit(void* address, size_t bytes, bool writable, bool executable) -{ -if (DosSetMem(address, bytes, PAG_COMMIT | protection(writable, executable))) - CRASH(); -} - -void OSAllocator::decommit(void* address, size_t bytes) -{ -if (DosSetMem(address, bytes, PAG_DECOMMIT)) - CRASH(); -} - -void OSAllocator::releaseDecommitted(void* address, size_t bytes) -{ -if (DosFreeMem(address)) - CRASH(); -} - -} // namespace WTF - -#endif diff --git a/js/xpconnect/loader/mozJSComponentLoader.cpp b/js/xpconnect/loader/mozJSComponentLoader.cpp index ddc74efff..df89ffd8c 100644 --- a/js/xpconnect/loader/mozJSComponentLoader.cpp +++ b/js/xpconnect/loader/mozJSComponentLoader.cpp @@ -95,10 +95,7 @@ static const char kXPConnectServiceContractID[] = "@mozilla.org/js/xpc/XPConnect static const char kObserverServiceContractID[] = "@mozilla.org/observer-service;1"; static const char kJSCachePrefix[] = "jsloader"; -/* Some platforms don't have an implementation of PR_MemMap(). */ -#ifndef XP_OS2 #define HAVE_PR_MEMMAP -#endif /** * Buffer sizes for serialization and deserialization of scripts. diff --git a/layout/forms/nsListControlFrame.cpp b/layout/forms/nsListControlFrame.cpp index 60168d7a5..dbe180236 100644 --- a/layout/forms/nsListControlFrame.cpp +++ b/layout/forms/nsListControlFrame.cpp @@ -2392,7 +2392,7 @@ nsListControlFrame::KeyPress(nsIDOMEvent* aKeyEvent) 0, -1); } break; -#if defined(XP_WIN) || defined(XP_OS2) +#if defined(XP_WIN) case nsIDOMKeyEvent::DOM_VK_F4: { DropDownToggleKey(aKeyEvent); return NS_OK; diff --git a/layout/generic/nsObjectFrame.cpp b/layout/generic/nsObjectFrame.cpp index c0a4a300c..521018957 100644 --- a/layout/generic/nsObjectFrame.cpp +++ b/layout/generic/nsObjectFrame.cpp @@ -137,13 +137,6 @@ using mozilla::DefaultXDisplay; #include <winuser.h> #endif -#ifdef XP_OS2 -#define INCL_PM -#define INCL_GPI -#include <os2.h> -#include "gfxOS2Surface.h" -#endif - #ifdef MOZ_WIDGET_ANDROID #include "AndroidBridge.h" #include "GLContext.h" @@ -1291,19 +1284,6 @@ nsObjectFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, } } -#ifdef XP_OS2 -static void * -GetPSFromRC(nsRenderingContext& aRenderingContext) -{ - nsRefPtr<gfxASurface> - surf = aRenderingContext.ThebesContext()->CurrentSurface(); - if (!surf || surf->CairoStatus()) - return nullptr; - return (void *)(static_cast<gfxOS2Surface*> - (static_cast<gfxASurface*>(surf.get()))->GetPS()); -} -#endif - void nsObjectFrame::PrintPlugin(nsRenderingContext& aRenderingContext, const nsRect& aDirtyRect) @@ -1456,15 +1436,6 @@ nsObjectFrame::PrintPlugin(nsRenderingContext& aRenderingContext, (void)window; (void)npprint; -#elif defined(XP_OS2) - void *hps = GetPSFromRC(aRenderingContext); - if (!hps) - return; - - npprint.print.embedPrint.platformPrint = hps; - npprint.print.embedPrint.window = window; - // send off print info to plugin - pi->Print(&npprint); #elif defined(XP_WIN) /* On Windows, we use the win32 printing surface to print. This, in @@ -1920,98 +1891,6 @@ nsObjectFrame::PaintPlugin(nsDisplayListBuilder* aBuilder, ctx->SetMatrix(currentMatrix); } -#elif defined(XP_OS2) - nsRefPtr<nsNPAPIPluginInstance> inst; - GetPluginInstance(getter_AddRefs(inst)); - if (inst) { - // Look if it's windowless - NPWindow *window; - mInstanceOwner->GetWindow(window); - - if (window->type == NPWindowTypeDrawable) { - // FIXME - Bug 385435: Doesn't aDirtyRect need translating too? - nsRenderingContext::AutoPushTranslation - translate(&aRenderingContext, aPluginRect.TopLeft()); - - // check if we need to call SetWindow with updated parameters - bool doupdatewindow = false; - // the offset of the DC - nsIntPoint origin; - - /* - * Layout now has an optimized way of painting. Now we always get - * a new drawing surface, sized to be just what's needed. Windowless - * plugins need a transform applied to their origin so they paint - * in the right place. Since |SetWindow| is no longer being used - * to tell the plugin where it is, we dispatch a NPWindow through - * |HandleEvent| to tell the plugin when its window moved - */ - gfxContext *ctx = aRenderingContext.ThebesContext(); - - gfxMatrix ctxMatrix = ctx->CurrentMatrix(); - if (ctxMatrix.HasNonTranslation()) { - // soo; in the future, we should be able to render - // the object content to an offscreen DC, and then - // composite it in with the right transforms. - - // But, we don't bother doing that, because we don't - // have the event handling story figured out yet. - // Instead, let's just bail. - - return; - } - - origin.x = NSToIntRound(ctxMatrix.GetTranslation().x); - origin.y = NSToIntRound(ctxMatrix.GetTranslation().y); - - /* Need to force the clip to be set */ - ctx->UpdateSurfaceClip(); - - /* Set the device offsets as appropriate, for whatever our current group offsets might be */ - gfxFloat xoff, yoff; - nsRefPtr<gfxASurface> surf = ctx->CurrentSurface(&xoff, &yoff); - - if (surf->CairoStatus() != 0) { - NS_WARNING("Plugin is being asked to render to a surface that's in error!"); - return; - } - - // check if we need to update the PS - HPS hps = (HPS)GetPSFromRC(aRenderingContext); - if (reinterpret_cast<HPS>(window->window) != hps) { - window->window = reinterpret_cast<void*>(hps); - doupdatewindow = true; - } - LONG lPSid = GpiSavePS(hps); - RECTL rclViewport; - if (GpiQueryDevice(hps) != NULLHANDLE) { // ensure that we have an associated HDC - if (GpiQueryPageViewport(hps, &rclViewport)) { - rclViewport.xLeft += (LONG)xoff; - rclViewport.xRight += (LONG)xoff; - rclViewport.yBottom += (LONG)yoff; - rclViewport.yTop += (LONG)yoff; - GpiSetPageViewport(hps, &rclViewport); - } - } - - if ((window->x != origin.x) || (window->y != origin.y)) { - window->x = origin.x; - window->y = origin.y; - doupdatewindow = true; - } - - // if our location or visible area has changed, we need to tell the plugin - if (doupdatewindow) { - inst->SetWindow(window); - } - - mInstanceOwner->Paint(aDirtyRect, hps); - if (lPSid >= 1) { - GpiRestorePS(hps, lPSid); - } - surf->MarkDirty(); - } - } #endif } diff --git a/layout/printing/nsPrintEngine.cpp b/layout/printing/nsPrintEngine.cpp index 5593dd9ff..74ba2be5d 100644 --- a/layout/printing/nsPrintEngine.cpp +++ b/layout/printing/nsPrintEngine.cpp @@ -1662,7 +1662,7 @@ nsPrintEngine::ShowPrintErrorDialog(nsresult aPrintError, bool aIsPrinting) nsresult nsPrintEngine::ReconstructAndReflow(bool doSetPixelScale) { -#if (defined(XP_WIN) || defined(XP_OS2)) && defined(EXTENDED_DEBUG_PRINTING) +#if defined(XP_WIN) && defined(EXTENDED_DEBUG_PRINTING) // We need to clear all the output files here // because they will be re-created with second reflow of the docs if (kPrintingLogMod && kPrintingLogMod->level == DUMP_LAYOUT_LEVEL) { @@ -3677,7 +3677,7 @@ nsPrintEngine::FirePrintCompletionEvent() //-- Debug helper routines //--------------------------------------------------------------- //--------------------------------------------------------------- -#if (defined(XP_WIN) || defined(XP_OS2)) && defined(EXTENDED_DEBUG_PRINTING) +#if defined(XP_WIN) && defined(EXTENDED_DEBUG_PRINTING) #include "windows.h" #include "process.h" #include "direct.h" diff --git a/layout/style/forms.css b/layout/style/forms.css index 64f33548d..7906dc952 100644 --- a/layout/style/forms.css +++ b/layout/style/forms.css @@ -825,24 +825,3 @@ input[type=range]::-moz-range-thumb { /* Prevent nsFrame::HandlePress setting mouse capture to this element. */ -moz-user-select: none ! important; } - -%ifdef XP_OS2 -input { - font: medium serif; font-family: inherit -} - -select { - font: medium serif; font-family: inherit -} - -optgroup { - font: medium serif; font-family: inherit -} - -input[type="reset"], -input[type="button"], -input[type="submit"] { - font: medium serif; font-family: inherit -} - -%endif diff --git a/layout/xul/base/src/nsMenuFrame.cpp b/layout/xul/base/src/nsMenuFrame.cpp index 2c31aa832..5390736a1 100644 --- a/layout/xul/base/src/nsMenuFrame.cpp +++ b/layout/xul/base/src/nsMenuFrame.cpp @@ -48,7 +48,7 @@ using namespace mozilla; #define NS_MENU_POPUP_LIST_INDEX 0 -#if defined(XP_WIN) || defined(XP_OS2) +#if defined(XP_WIN) #define NSCONTEXTMENUISMOUSEUP 1 #endif diff --git a/layout/xul/base/src/nsMenuPopupFrame.cpp b/layout/xul/base/src/nsMenuPopupFrame.cpp index 52bf2eab7..8cd5cd1d0 100644 --- a/layout/xul/base/src/nsMenuPopupFrame.cpp +++ b/layout/xul/base/src/nsMenuPopupFrame.cpp @@ -1474,7 +1474,7 @@ bool nsMenuPopupFrame::ConsumeOutsideClicks() nsINodeInfo *ni = parentContent->NodeInfo(); if (ni->Equals(nsGkAtoms::menulist, kNameSpaceID_XUL)) return true; // Consume outside clicks for combo boxes on all platforms -#if defined(XP_WIN) || defined(XP_OS2) +#if defined(XP_WIN) // Don't consume outside clicks for menus in Windows if (ni->Equals(nsGkAtoms::menu, kNameSpaceID_XUL) || ni->Equals(nsGkAtoms::splitmenu, kNameSpaceID_XUL) || diff --git a/memory/mozalloc/Makefile.in b/memory/mozalloc/Makefile.in index cd8c062f5..75899b13e 100644 --- a/memory/mozalloc/Makefile.in +++ b/memory/mozalloc/Makefile.in @@ -29,12 +29,10 @@ ifeq ($(OS_ARCH),Linux) DEFINES += -DXP_LINUX endif -ifeq (,$(filter-out OS2,$(OS_ARCH))) # The strndup declaration in string.h is in an ifdef __USE_GNU section DEFINES += -D_GNU_SOURCE -endif -ifneq (,$(filter OS2 WINNT,$(OS_ARCH))) +ifneq (,$(filter WINNT,$(OS_ARCH))) SDK_LIBRARY = $(IMPORT_LIBRARY) else SDK_LIBRARY = $(SHARED_LIBRARY) diff --git a/memory/mozalloc/mozalloc.cpp b/memory/mozalloc/mozalloc.cpp index 5da994372..016db9245 100644 --- a/memory/mozalloc/mozalloc.cpp +++ b/memory/mozalloc/mozalloc.cpp @@ -20,7 +20,7 @@ # include <unistd.h> // for valloc on *BSD #endif //if defined(XP_UNIX) -#if defined(XP_WIN) || (defined(XP_OS2) && defined(__declspec)) +#if defined(XP_WIN) # define MOZALLOC_EXPORT __declspec(dllexport) #endif diff --git a/memory/mozalloc/mozalloc.h b/memory/mozalloc/mozalloc.h index 7d0f07316..35d2b3634 100644 --- a/memory/mozalloc/mozalloc.h +++ b/memory/mozalloc/mozalloc.h @@ -29,7 +29,7 @@ #if defined(MOZALLOC_EXPORT) /* do nothing: it's been defined to __declspec(dllexport) by * mozalloc*.cpp on platforms where that's required. */ -#elif defined(XP_WIN) || (defined(XP_OS2) && defined(__declspec)) +#elif defined(XP_WIN) # define MOZALLOC_EXPORT __declspec(dllimport) #elif defined(HAVE_VISIBILITY_ATTRIBUTE) /* Make sure symbols are still exported even if we're wrapped in a diff --git a/memory/mozalloc/mozalloc_abort.cpp b/memory/mozalloc/mozalloc_abort.cpp index e1513f027..12149505e 100644 --- a/memory/mozalloc/mozalloc_abort.cpp +++ b/memory/mozalloc/mozalloc_abort.cpp @@ -5,7 +5,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#if defined(XP_WIN) || defined(XP_OS2) +#if defined(XP_WIN) # define MOZALLOC_EXPORT __declspec(dllexport) #endif diff --git a/memory/mozalloc/mozalloc_abort.h b/memory/mozalloc/mozalloc_abort.h index 08ee39925..bf9d73c89 100644 --- a/memory/mozalloc/mozalloc_abort.h +++ b/memory/mozalloc/mozalloc_abort.h @@ -13,7 +13,7 @@ #if defined(MOZALLOC_EXPORT) // do nothing: it's been defined to __declspec(dllexport) by // mozalloc*.cpp on platforms where that's required -#elif defined(XP_WIN) || (defined(XP_OS2) && defined(__declspec)) +#elif defined(XP_WIN) # define MOZALLOC_EXPORT __declspec(dllimport) #elif defined(HAVE_VISIBILITY_ATTRIBUTE) /* Make sure symbols are still exported even if we're wrapped in a diff --git a/memory/mozalloc/mozalloc_oom.cpp b/memory/mozalloc/mozalloc_oom.cpp index 4ad241424..d6b914bac 100644 --- a/memory/mozalloc/mozalloc_oom.cpp +++ b/memory/mozalloc/mozalloc_oom.cpp @@ -5,7 +5,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#if defined(XP_WIN) || defined(XP_OS2) +#if defined(XP_WIN) # define MOZALLOC_EXPORT __declspec(dllexport) #endif diff --git a/memory/mozalloc/mozalloc_oom.h b/memory/mozalloc/mozalloc_oom.h index 75b356a4c..bd3daec08 100644 --- a/memory/mozalloc/mozalloc_oom.h +++ b/memory/mozalloc/mozalloc_oom.h @@ -13,7 +13,7 @@ #if defined(MOZALLOC_EXPORT) // do nothing: it's been defined to __declspec(dllexport) by // mozalloc*.cpp on platforms where that's required -#elif defined(XP_WIN) || (defined(XP_OS2) && defined(__declspec)) +#elif defined(XP_WIN) # define MOZALLOC_EXPORT __declspec(dllimport) #elif defined(HAVE_VISIBILITY_ATTRIBUTE) /* Make sure symbols are still exported even if we're wrapped in a diff --git a/memory/mozalloc/msvc_raise_wrappers.cpp b/memory/mozalloc/msvc_raise_wrappers.cpp index cbdc4527f..1675f96ca 100644 --- a/memory/mozalloc/msvc_raise_wrappers.cpp +++ b/memory/mozalloc/msvc_raise_wrappers.cpp @@ -7,7 +7,7 @@ #include <stdio.h> -#if defined(XP_WIN) || defined(XP_OS2) +#if defined(XP_WIN) # define MOZALLOC_EXPORT __declspec(dllexport) #endif diff --git a/memory/mozalloc/msvc_throw_wrapper.cpp b/memory/mozalloc/msvc_throw_wrapper.cpp index 6e403cfa5..14c3692b1 100644 --- a/memory/mozalloc/msvc_throw_wrapper.cpp +++ b/memory/mozalloc/msvc_throw_wrapper.cpp @@ -7,7 +7,7 @@ #include <exception> -#if defined(XP_WIN) || defined(XP_OS2) +#if defined(XP_WIN) # define MOZALLOC_EXPORT __declspec(dllexport) #endif diff --git a/mfbt/Types.h b/mfbt/Types.h index 1ba98e5b0..0eb47f005 100644 --- a/mfbt/Types.h +++ b/mfbt/Types.h @@ -43,7 +43,7 @@ * These macros are designed for use by library interfaces -- not for normal * methods or data used cross-file. */ -#if defined(WIN32) || defined(XP_OS2) +#if defined(WIN32) # define MOZ_EXPORT __declspec(dllexport) #else /* Unix */ # ifdef HAVE_VISIBILITY_ATTRIBUTE @@ -69,16 +69,12 @@ # else # define MOZ_IMPORT_API __declspec(dllimport) # endif -#elif defined(XP_OS2) -# define MOZ_IMPORT_API __declspec(dllimport) #else # define MOZ_IMPORT_API MOZ_EXPORT #endif #if defined(_WIN32) && !defined(__MWERKS__) # define MOZ_IMPORT_DATA __declspec(dllimport) -#elif defined(XP_OS2) -# define MOZ_IMPORT_DATA __declspec(dllimport) #else # define MOZ_IMPORT_DATA MOZ_EXPORT #endif diff --git a/mfbt/tests/TestPoisonArea.cpp b/mfbt/tests/TestPoisonArea.cpp index cf2417a24..3292c268d 100644 --- a/mfbt/tests/TestPoisonArea.cpp +++ b/mfbt/tests/TestPoisonArea.cpp @@ -102,12 +102,6 @@ typedef unsigned int uint32_t; #ifdef _WIN32 #include <windows.h> -#elif defined(__OS2__) -#include <sys/types.h> -#include <unistd.h> -#include <setjmp.h> -#define INCL_DOS -#include <os2.h> #else #include <sys/types.h> #include <fcntl.h> @@ -247,75 +241,6 @@ MakeRegionExecutable(void *) #undef MAP_FAILED #define MAP_FAILED 0 -#elif defined(__OS2__) - -// page size is always 4k -#undef PAGESIZE -#define PAGESIZE 0x1000 -static unsigned long rc = 0; - -char * LastErrMsg() -{ - char * errmsg = (char *)malloc(16); - sprintf(errmsg, "rc= %ld", rc); - rc = 0; - return errmsg; -} - -static void * -ReserveRegion(uintptr_t request, bool accessible) -{ - // OS/2 doesn't support allocation at an arbitrary address, - // so return an address that is known to be invalid. - if (request) { - return (void*)0xFFFD0000; - } - void * mem = 0; - rc = DosAllocMem(&mem, PAGESIZE, - (accessible ? PAG_COMMIT : 0) | PAG_READ | PAG_WRITE); - return rc ? 0 : mem; -} - -static void -ReleaseRegion(void *page) -{ - return; -} - -static bool -ProbeRegion(uintptr_t page) -{ - // There's no reliable way to probe an address in the system - // arena other than by touching it and seeing if a trap occurs. - return false; -} - -static bool -MakeRegionExecutable(void *page) -{ - rc = DosSetMem(page, PAGESIZE, PAG_READ | PAG_WRITE | PAG_EXECUTE); - return rc ? true : false; -} - -typedef struct _XCPT { - EXCEPTIONREGISTRATIONRECORD regrec; - jmp_buf jmpbuf; -} XCPT; - -static unsigned long _System -ExceptionHandler(PEXCEPTIONREPORTRECORD pReport, - PEXCEPTIONREGISTRATIONRECORD pRegRec, - PCONTEXTRECORD pContext, PVOID pVoid) -{ - if (pReport->fHandlerFlags == 0) { - longjmp(((XCPT*)pRegRec)->jmpbuf, pReport->ExceptionNum); - } - return XCPT_CONTINUE_SEARCH; -} - -#undef MAP_FAILED -#define MAP_FAILED 0 - #else // Unix #define LastErrMsg() (strerror(errno)) @@ -538,41 +463,6 @@ TestPage(const char *pagelabel, uintptr_t pageaddr, int should_succeed) failed = true; } } -#elif defined(__OS2__) - XCPT xcpt; - volatile int code = setjmp(xcpt.jmpbuf); - - if (!code) { - xcpt.regrec.prev_structure = 0; - xcpt.regrec.ExceptionHandler = ExceptionHandler; - DosSetExceptionHandler(&xcpt.regrec); - unsigned char scratch; - switch (test) { - case 0: scratch = *(volatile unsigned char *)opaddr; break; - case 1: ((void (*)())opaddr)(); break; - case 2: *(volatile unsigned char *)opaddr = 0; break; - default: abort(); - } - } - - if (code) { - if (should_succeed) { - printf("TEST-UNEXPECTED-FAIL | %s %s | exception code %x\n", - oplabel, pagelabel, code); - failed = true; - } else { - printf("TEST-PASS | %s %s | exception code %x\n", - oplabel, pagelabel, code); - } - } else { - if (should_succeed) { - printf("TEST-PASS | %s %s\n", oplabel, pagelabel); - } else { - printf("TEST-UNEXPECTED-FAIL | %s %s\n", oplabel, pagelabel); - failed = true; - } - DosUnsetExceptionHandler(&xcpt.regrec); - } #else pid_t pid = fork(); if (pid == -1) { @@ -634,7 +524,7 @@ main() { #ifdef _WIN32 GetSystemInfo(&_sinfo); -#elif !defined(__OS2__) +#else _pagesize = sysconf(_SC_PAGESIZE); #endif diff --git a/modules/libjar/nsJAR.cpp b/modules/libjar/nsJAR.cpp index 358859c50..b246e10c7 100644 --- a/modules/libjar/nsJAR.cpp +++ b/modules/libjar/nsJAR.cpp @@ -13,7 +13,7 @@ #ifdef XP_UNIX #include <sys/stat.h> -#elif defined (XP_WIN) || defined(XP_OS2) +#elif defined (XP_WIN) #include <io.h> #endif diff --git a/modules/libjar/nsZipArchive.cpp b/modules/libjar/nsZipArchive.cpp index e945091a3..ff92d98ff 100644 --- a/modules/libjar/nsZipArchive.cpp +++ b/modules/libjar/nsZipArchive.cpp @@ -35,7 +35,7 @@ #include <sys/stat.h> #include <limits.h> #include <unistd.h> -#elif defined(XP_WIN) || defined(XP_OS2) +#elif defined(XP_WIN) #include <io.h> #endif diff --git a/modules/libmar/sign/nss_secutil.c b/modules/libmar/sign/nss_secutil.c index 8eb055fc3..31906914b 100644 --- a/modules/libmar/sign/nss_secutil.c +++ b/modules/libmar/sign/nss_secutil.c @@ -18,12 +18,8 @@ static char consoleName[] = { #ifdef XP_UNIX "/dev/tty" #else -#ifdef XP_OS2 - "\\DEV\\CON" -#else "CON:" #endif -#endif }; #if defined(_WINDOWS) diff --git a/modules/libpref/src/Makefile.in b/modules/libpref/src/Makefile.in index 442a31708..5b4e767d8 100644 --- a/modules/libpref/src/Makefile.in +++ b/modules/libpref/src/Makefile.in @@ -27,7 +27,7 @@ include $(topsrcdir)/config/rules.mk GARBAGE += $(addprefix $(DIST)/bin/defaults/pref/, \ mailnews.js editor.js \ - aix.js unix.js winpref.js os2prefs.js) + aix.js unix.js winpref.js) GARBAGE += greprefs.js diff --git a/modules/libpref/src/Preferences.cpp b/modules/libpref/src/Preferences.cpp index 7c9155dd2..23cee758b 100644 --- a/modules/libpref/src/Preferences.cpp +++ b/modules/libpref/src/Preferences.cpp @@ -1111,8 +1111,6 @@ static nsresult pref_InitInitialObjects() #elif defined(_AIX) , "aix.js" #endif -#elif defined(XP_OS2) - "os2pref.js" #elif defined(XP_BEOS) "beos.js" #endif diff --git a/modules/libpref/src/init/all.js b/modules/libpref/src/init/all.js index c41acd9e2..2bf7d39de 100644 --- a/modules/libpref/src/init/all.js +++ b/modules/libpref/src/init/all.js @@ -3000,202 +3000,6 @@ pref("mousewheel.enable_pixel_scrolling", true); # XP_MACOSX #endif -#ifdef XP_OS2 - -pref("ui.key.menuAccessKeyFocuses", true); - -pref("font.alias-list", "sans,sans-serif,serif,monospace,Tms Rmn,Helv,Courier,Times New Roman"); - -pref("font.mathfont-family", "MathJax_Main, STIXNonUnicode, STIXSizeOneSym, STIXSize1, STIXGeneral, Asana Math, DejaVu Sans"); - -// Languages only need lists if we have a default that might not be available. -// Tms Rmn and Helv cannot be used by Thebes but the OS/2 version of FontConfig -// maps them to Times New Roman and Helvetica, respectively. Those fonts and -// Courier are available on OS/2 by default. - -pref("font.name.serif.ar", "Tms Rmn"); -pref("font.name.sans-serif.ar", "Helv"); -pref("font.name.monospace.ar", "Courier"); - -pref("font.name.serif.el", "Tms Rmn"); -pref("font.name.sans-serif.el", "Helv"); -pref("font.name.monospace.el", "Courier"); - -pref("font.name.serif.he", "Tms Rmn"); -pref("font.name.sans-serif.he", "Helv"); -pref("font.name.monospace.he", "Courier"); - -pref("font.name.serif.ja", "Times New Roman WT J"); -pref("font.name-list.serif.ja", "Times New Roman WT J, Times New Roman WT, Times New Roman MT 30, Tms Rmn"); -pref("font.name.sans-serif.ja", "Helv"); -pref("font.name.monospace.ja", "Kochi Gothic"); -pref("font.name-list.monospace.ja", "Kochi Gothic, Kochi Mincho, Courier New, Courier"); - -pref("font.name.serif.ko", "Times New Roman WT K"); -pref("font.name-list.serif.ko", "Times New Roman WT K, Times New Roman WT, Times New Roman MT 30, Tms Rmn"); -pref("font.name.sans-serif.ko", "Helv"); -pref("font.name.monospace.ko", "Courier"); - -pref("font.name.serif.th", "Tms Rmn"); -pref("font.name.sans-serif.th", "Helv"); -pref("font.name.monospace.th", "Courier"); - -pref("font.name.serif.tr", "Tms Rmn"); -pref("font.name.sans-serif.tr", "Helv"); -pref("font.name.monospace.tr", "Courier"); - -pref("font.name.serif.x-baltic", "Tms Rmn"); -pref("font.name.sans-serif.x-baltic", "Helv"); -pref("font.name.monospace.x-baltic", "Courier"); - -pref("font.name.serif.x-central-euro", "Tms Rmn"); -pref("font.name.sans-serif.x-central-euro", "Helv"); -pref("font.name.monospace.x-central-euro", "Courier"); - -pref("font.name.serif.x-cyrillic", "Tms Rmn"); -pref("font.name.sans-serif.x-cyrillic", "Helv"); -pref("font.name.monospace.x-cyrillic", "Courier"); - -// Unicode fonts -// Fontconfig will match substrings, so that we only need to list e.g. -// Times New Roman WT and it will search for the J, SC, TC, K variants. -// The DejaVu fonts are shipped with eCS, so list them first but include other -// fonts that OS/2 users are likely to have. -pref("font.name.serif.x-unicode", "Times New Roman MT 30"); -pref("font.name-list.serif.x-unicode", "DejaVu Serif, FreeSerif, Times New Roman WT, Times New Roman MT 30, Tms Rmn"); -pref("font.name.sans-serif.x-unicode", "Lucida Sans Unicode"); -pref("font.name-list.sans-serif.x-unicode", "DejaVu Sans, FreeSans, Arial Unicode, Lucida Sans Unicode, Helv"); -pref("font.name.monospace.x-unicode", "DejaVu Sans Mono"); -pref("font.name-list.monospace.x-unicode", "DejaVu Sans Mono, FreeMono, Andale Mono, Courier New, Courier"); -pref("font.name.fantasy.x-unicode", "Times New Roman MT 30"); -pref("font.name-list.fantasy.x-unicode", "DejaVu Serif, FreeSerif, Times New Roman WT, Times New Roman MT 30"); -pref("font.name.cursive.x-unicode", "Times New Roman MT 30"); -pref("font.name-list.cursive.x-unicode", "DejaVu Serif, FreeSerif, Times New Roman WT, Times New Roman MT 30"); - -pref("font.name.serif.x-western", "Tms Rmn"); -pref("font.name.sans-serif.x-western", "Helv"); -pref("font.name.monospace.x-western", "Courier"); - -pref("font.name.serif.zh-CN", "Times New Roman WT SC"); -pref("font.name-list.serif.zh_CN", "Times New Roman WT SC, Times New Roman MT 30, Times New Roman WT, Tms Rmn"); -pref("font.name.sans-serif.zh-CN", "Helv"); -pref("font.name.monospace.zh-CN", "Courier"); - -pref("font.name.serif.zh-TW", "Times New Roman WT TC"); -pref("font.name-list.serif.zh-TW", "Times New Roman WT TC, Times New Roman MT 30, Times New Roman WT, Tms Rmn"); -pref("font.name.sans-serif.zh-TW", "Helv"); -pref("font.name.monospace.zh-TW", "Courier"); - -// just copied values from zh-TW -pref("font.name.serif.zh-HK", "Times New Roman WT TC"); -pref("font.name-list.serif.zh-HK", "Times New Roman WT TC, Times New Roman MT 30, Times New Roman WT, Tms Rmn"); -pref("font.name.sans-serif.zh-HK", "Helv"); -pref("font.name.monospace.zh-HK", "Courier"); - -pref("font.default", "serif"); - -pref("font.default.ar", "serif"); -pref("font.size.variable.ar", 16); -pref("font.size.fixed.ar", 13); - -pref("font.default.el", "serif"); -pref("font.size.variable.el", 16); -pref("font.size.fixed.el", 13); - -pref("font.default.he", "serif"); -pref("font.size.variable.he", 16); -pref("font.size.fixed.he", 13); - -pref("font.default.ja", "serif"); -pref("font.size.variable.ja", 16); -pref("font.size.fixed.ja", 16); - -pref("font.default.ko", "serif"); -pref("font.size.variable.ko", 16); -pref("font.size.fixed.ko", 16); - -pref("font.default.th", "serif"); -pref("font.size.variable.th", 16); -pref("font.size.fixed.th", 13); - -pref("font.default.tr", "serif"); -pref("font.size.variable.tr", 16); -pref("font.size.fixed.tr", 13); - -pref("font.default.x-baltic", "serif"); -pref("font.size.variable.x-baltic", 16); -pref("font.size.fixed.x-baltic", 13); - -pref("font.default.x-central-euro", "serif"); -pref("font.size.variable.x-central-euro", 16); -pref("font.size.fixed.x-central-euro", 13); - -pref("font.default.x-cyrillic", "serif"); -pref("font.size.variable.x-cyrillic", 16); -pref("font.size.fixed.x-cyrillic", 13); - -pref("font.default.x-devanagari", "serif"); -pref("font.size.variable.x-devanagari", 16); -pref("font.size.fixed.x-devanagari", 13); - -pref("font.default.x-tamil", "serif"); -pref("font.size.variable.x-tamil", 16); -pref("font.size.fixed.x-tamil", 13); - -pref("font.default.x-unicode", "serif"); -pref("font.size.variable.x-unicode", 16); -pref("font.size.fixed.x-unicode", 13); - -pref("font.default.x-western", "serif"); -pref("font.size.variable.x-western", 16); -pref("font.size.fixed.x-western", 13); - -pref("font.default.zh-CN", "serif"); -pref("font.size.variable.zh-CN", 16); -pref("font.size.fixed.zh-CN", 16); - -pref("font.default.zh-TW", "serif"); -pref("font.size.variable.zh-TW", 16); -pref("font.size.fixed.zh-TW", 16); - -pref("font.default.zh-HK", "serif"); -pref("font.size.variable.zh-HK", 16); -pref("font.size.fixed.zh-HK", 16); - -pref("netinst.profile.show_profile_wizard", true); - -pref("middlemouse.paste", true); - -// override double-click word selection behavior. -pref("layout.word_select.eat_space_to_next_word", true); -pref("layout.word_select.stop_at_punctuation", false); - -// If false, will always use closest matching size for a given -// image font. If true, will substitute a vector font for a given -// image font if the given size is smaller/larger than can be handled -// by the image font. -pref("browser.display.substitute_vector_fonts", true); - -// print_extra_margin enables platforms to specify an extra gap or margin -// around the content of the page for Print Preview only -pref("print.print_extra_margin", 90); // twips (90 twips is an eigth of an inch) - -pref("mail.compose.max_recycled_windows", 0); - -// Disable IPv6 name lookups by default. -// This is because OS/2 doesn't support IPv6 -pref("network.dns.disableIPv6", true); - -// IMEs of OS/2 might use non-topmost windows for topmost <panel> element, -// see bug 451015. If there are other problems by this value, we may need to -// change this value. -pref("ui.panel.default_level_parent", false); - -pref("mousewheel.system_scroll_override_on_root_content.enabled", false); - -# OS2 -#endif - #ifdef ANDROID // Handled differently under Mac/Windows pref("network.protocol-handler.warn-external.file", false); diff --git a/modules/libpref/src/prefapi.cpp b/modules/libpref/src/prefapi.cpp index cec84da69..fafeb7167 100644 --- a/modules/libpref/src/prefapi.cpp +++ b/modules/libpref/src/prefapi.cpp @@ -14,9 +14,6 @@ #define PL_ARENA_CONST_ALIGN_MASK 3 #include "plarena.h" -#ifdef XP_OS2 - #include <sys/types.h> -#endif #ifdef _WIN32 #include "windows.h" #endif /* _WIN32 */ @@ -32,11 +29,6 @@ #include "nsPrintfCString.h" #include "prlink.h" -#ifdef XP_OS2 -#define INCL_DOS -#include <os2.h> -#endif - using namespace mozilla; static void diff --git a/mozglue/build/Makefile.in b/mozglue/build/Makefile.in index 33c19d641..70c90dc68 100644 --- a/mozglue/build/Makefile.in +++ b/mozglue/build/Makefile.in @@ -27,7 +27,7 @@ else # Temporary, until bug 662814 lands VISIBILITY_FLAGS = -ifneq (,$(filter OS2 WINNT,$(OS_ARCH))) +ifneq (,$(filter WINNT,$(OS_ARCH))) SDK_LIBRARY = $(IMPORT_LIBRARY) else ifdef FORCE_SHARED_LIB diff --git a/netwerk/base/src/moz.build b/netwerk/base/src/moz.build index 760c1c146..f29e8fd17 100644 --- a/netwerk/base/src/moz.build +++ b/netwerk/base/src/moz.build @@ -72,11 +72,7 @@ CPP_SOURCES += [ 'nsUnicharStreamLoader.cpp', ] -if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'os2': - CPP_SOURCES += [ - 'nsURLHelperOS2.cpp', - ] -elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows': +if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows': CPP_SOURCES += [ 'nsURLHelperWin.cpp', 'nsNativeConnectionHelper.cpp', diff --git a/netwerk/base/src/nsFileStreams.cpp b/netwerk/base/src/nsFileStreams.cpp index ecc26aa19..2adb0e2ac 100644 --- a/netwerk/base/src/nsFileStreams.cpp +++ b/netwerk/base/src/nsFileStreams.cpp @@ -9,9 +9,6 @@ #include <unistd.h> #elif defined(XP_WIN) #include <windows.h> -#elif defined(XP_OS2) -#define INCL_DOSERRORS -#include <os2.h> #else // XXX add necessary include file for ftruncate (or equivalent) #endif @@ -97,7 +94,7 @@ nsFileStreamBase::SetEOF() if (mFD == nullptr) return NS_BASE_STREAM_CLOSED; -#if defined(XP_UNIX) || defined(XP_OS2) || defined(XP_BEOS) +#if defined(XP_UNIX) || defined(XP_BEOS) // Some system calls require an EOF offset. int64_t offset; rv = Tell(&offset); @@ -114,11 +111,6 @@ nsFileStreamBase::SetEOF() NS_ERROR("SetEndOfFile failed"); return NS_ERROR_FAILURE; } -#elif defined(XP_OS2) - if (DosSetFileSize((HFILE) PR_FileDesc2NativeHandle(mFD), offset) != NO_ERROR) { - NS_ERROR("DosSetFileSize failed"); - return NS_ERROR_FAILURE; - } #else // XXX not implemented #endif diff --git a/netwerk/base/src/nsNetAddr.cpp b/netwerk/base/src/nsNetAddr.cpp index efbf7c2ec..5815d7059 100644 --- a/netwerk/base/src/nsNetAddr.cpp +++ b/netwerk/base/src/nsNetAddr.cpp @@ -30,7 +30,7 @@ NS_IMETHODIMP nsNetAddr::GetFamily(uint16_t *aFamily) case AF_INET6: *aFamily = nsINetAddr::FAMILY_INET6; break; -#if defined(XP_UNIX) || defined(XP_OS2) +#if defined(XP_UNIX) case AF_LOCAL: *aFamily = nsINetAddr::FAMILY_LOCAL; break; @@ -57,12 +57,12 @@ NS_IMETHODIMP nsNetAddr::GetAddress(nsACString & aAddress) NetAddrToString(&mAddr, aAddress.BeginWriting(), kIPv6CStrBufSize); aAddress.SetLength(strlen(aAddress.BeginReading())); break; -#if defined(XP_UNIX) || defined(XP_OS2) +#if defined(XP_UNIX) case AF_LOCAL: aAddress.Assign(mAddr.local.path); break; #endif - // PR_AF_LOCAL falls through to default when not XP_UNIX || XP_OS2 + // PR_AF_LOCAL falls through to default when not XP_UNIX default: return NS_ERROR_UNEXPECTED; } @@ -80,7 +80,7 @@ NS_IMETHODIMP nsNetAddr::GetPort(uint16_t *aPort) case AF_INET6: *aPort = ntohs(mAddr.inet6.port); break; -#if defined(XP_UNIX) || defined(XP_OS2) +#if defined(XP_UNIX) case AF_LOCAL: // There is no port number for local / connections. return NS_ERROR_NOT_AVAILABLE; @@ -100,7 +100,7 @@ NS_IMETHODIMP nsNetAddr::GetFlow(uint32_t *aFlow) *aFlow = ntohl(mAddr.inet6.flowinfo); break; case AF_INET: -#if defined(XP_UNIX) || defined(XP_OS2) +#if defined(XP_UNIX) case AF_LOCAL: #endif // only for IPv6 @@ -120,7 +120,7 @@ NS_IMETHODIMP nsNetAddr::GetScope(uint32_t *aScope) *aScope = ntohl(mAddr.inet6.scope_id); break; case AF_INET: -#if defined(XP_UNIX) || defined(XP_OS2) +#if defined(XP_UNIX) case AF_LOCAL: #endif // only for IPv6 @@ -140,7 +140,7 @@ NS_IMETHODIMP nsNetAddr::GetIsV4Mapped(bool *aIsV4Mapped) *aIsV4Mapped = IPv6ADDR_IS_V4MAPPED(&mAddr.inet6.ip); break; case AF_INET: -#if defined(XP_UNIX) || defined(XP_OS2) +#if defined(XP_UNIX) case AF_LOCAL: #endif // only for IPv6 diff --git a/netwerk/base/src/nsURLHelper.cpp b/netwerk/base/src/nsURLHelper.cpp index f2c3bbe54..b57467c55 100644 --- a/netwerk/base/src/nsURLHelper.cpp +++ b/netwerk/base/src/nsURLHelper.cpp @@ -622,7 +622,7 @@ net_FilterURIString(const char *str, nsACString& result) return writing; } -#if defined(XP_WIN) || defined(XP_OS2) +#if defined(XP_WIN) bool net_NormalizeFileURL(const nsACString &aURL, nsCString &aResultBuf) { diff --git a/netwerk/base/src/nsURLHelper.h b/netwerk/base/src/nsURLHelper.h index d5d9e0063..c84391f64 100644 --- a/netwerk/base/src/nsURLHelper.h +++ b/netwerk/base/src/nsURLHelper.h @@ -118,7 +118,7 @@ inline bool net_IsValidScheme(const nsAFlatCString &scheme) */ NS_HIDDEN_(bool) net_FilterURIString(const char *str, nsACString& result); -#if defined(XP_WIN) || defined(XP_OS2) +#if defined(XP_WIN) /** * On Win32 and OS/2 system's a back-slash in a file:// URL is equivalent to a * forward-slash. This function maps any back-slashes to forward-slashes. diff --git a/netwerk/base/src/nsURLHelperOS2.cpp b/netwerk/base/src/nsURLHelperOS2.cpp deleted file mode 100644 index fb7f0b20f..000000000 --- a/netwerk/base/src/nsURLHelperOS2.cpp +++ /dev/null @@ -1,110 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* vim:set ts=4 sw=4 et cindent: */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -/* OS/2-specific local file uri parsing */ -#define INCL_DOSERRORS -#define INCL_DOS -#include <os2.h> -#include "nsURLHelper.h" -#include "nsEscape.h" -#include "nsIFile.h" - -nsresult -net_GetURLSpecFromActualFile(nsIFile *aFile, nsACString &result) -{ - nsresult rv; - nsAutoString path; - - // construct URL spec from file path - rv = aFile->GetPath(path); - if (NS_FAILED(rv)) return rv; - - // Replace \ with / to convert to an url - path.ReplaceChar(PRUnichar(0x5Cu), PRUnichar(0x2Fu)); - - nsAutoCString escPath; - NS_NAMED_LITERAL_CSTRING(prefix, "file:///"); - - // Escape the path with the directory mask - NS_ConvertUTF16toUTF8 ePath(path); - if (NS_EscapeURL(ePath.get(), -1, esc_Directory+esc_Forced, escPath)) - escPath.Insert(prefix, 0); - else - escPath.Assign(prefix + ePath); - - // esc_Directory does not escape the semicolons, so if a filename - // contains semicolons we need to manually escape them. - // This replacement should be removed in bug #473280 - escPath.ReplaceSubstring(";", "%3b"); - - result = escPath; - return NS_OK; -} - -nsresult -net_GetFileFromURLSpec(const nsACString &aURL, nsIFile **result) -{ - nsresult rv; - - nsCOMPtr<nsIFile> localFile( - do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv)); - if (NS_FAILED(rv)) { - NS_ERROR("Only nsIFile supported right now"); - return rv; - } - - const nsACString *specPtr; - - nsAutoCString buf; - if (net_NormalizeFileURL(aURL, buf)) - specPtr = &buf; - else - specPtr = &aURL; - - nsAutoCString directory, fileBaseName, fileExtension; - - rv = net_ParseFileURL(*specPtr, directory, fileBaseName, fileExtension); - if (NS_FAILED(rv)) return rv; - - nsAutoCString path; - - if (!directory.IsEmpty()) { - NS_EscapeURL(directory, esc_Directory|esc_AlwaysCopy, path); - if (path.Length() > 2 && path.CharAt(2) == '|') - path.SetCharAt(':', 2); - path.ReplaceChar('/', '\\'); - } - if (!fileBaseName.IsEmpty()) - NS_EscapeURL(fileBaseName, esc_FileBaseName|esc_AlwaysCopy, path); - if (!fileExtension.IsEmpty()) { - path += '.'; - NS_EscapeURL(fileExtension, esc_FileExtension|esc_AlwaysCopy, path); - } - - NS_UnescapeURL(path); - if (path.Length() != strlen(path.get())) - return NS_ERROR_FILE_INVALID_PATH; - - // remove leading '\' - if (path.CharAt(0) == '\\') - path.Cut(0, 1); - - if (IsUTF8(path)) - rv = localFile->InitWithPath(NS_ConvertUTF8toUTF16(path)); - // XXX In rare cases, a valid UTF-8 string can be valid as a native - // encoding (e.g. 0xC5 0x83 is valid both as UTF-8 and Windows-125x). - // However, the chance is very low that a meaningful word in a legacy - // encoding is valid as UTF-8. - else - // if path is not in UTF-8, assume it is encoded in the native charset - rv = localFile->InitWithNativePath(path); - - if (NS_FAILED(rv)) return rv; - - NS_ADDREF(*result = localFile); - return NS_OK; -} - diff --git a/netwerk/base/src/nsURLParsers.cpp b/netwerk/base/src/nsURLParsers.cpp index 03cfd7428..3e6d8db68 100644 --- a/netwerk/base/src/nsURLParsers.cpp +++ b/netwerk/base/src/nsURLParsers.cpp @@ -373,7 +373,7 @@ nsNoAuthURLParser::ParseAfterScheme(const char *spec, int32_t specLen, const char *p = nullptr; if (specLen > 2) { // looks like there is an authority section -#if defined(XP_WIN) || defined(XP_OS2) +#if defined(XP_WIN) // if the authority looks like a drive number then we // really want to treat it as part of the path // [a-zA-Z][:|]{/\} @@ -406,7 +406,7 @@ nsNoAuthURLParser::ParseAfterScheme(const char *spec, int32_t specLen, SET_RESULT(path, pos, specLen - pos); } -#if defined(XP_WIN) || defined(XP_OS2) +#if defined(XP_WIN) NS_IMETHODIMP nsNoAuthURLParser::ParseFilePath(const char *filepath, int32_t filepathLen, uint32_t *directoryPos, int32_t *directoryLen, diff --git a/netwerk/base/src/nsURLParsers.h b/netwerk/base/src/nsURLParsers.h index e3849dd2c..221f3d98d 100644 --- a/netwerk/base/src/nsURLParsers.h +++ b/netwerk/base/src/nsURLParsers.h @@ -45,7 +45,7 @@ class nsNoAuthURLParser MOZ_FINAL : public nsBaseURLParser public: NS_DECL_ISUPPORTS -#if defined(XP_WIN) || defined(XP_OS2) +#if defined(XP_WIN) NS_IMETHOD ParseFilePath(const char *, int32_t, uint32_t *, int32_t *, uint32_t *, int32_t *, diff --git a/netwerk/cache/nsDiskCacheDevice.cpp b/netwerk/cache/nsDiskCacheDevice.cpp index 998e01693..06a6d5440 100644 --- a/netwerk/cache/nsDiskCacheDevice.cpp +++ b/netwerk/cache/nsDiskCacheDevice.cpp @@ -16,9 +16,6 @@ #include <unistd.h> #elif defined(XP_WIN) #include <windows.h> -#elif defined(XP_OS2) -#define INCL_DOSERRORS -#include <os2.h> #else // XXX add necessary include file for ftruncate (or equivalent) #endif @@ -353,11 +350,6 @@ nsDiskCache::Truncate(PRFileDesc * fd, uint32_t newEOF) return NS_ERROR_FAILURE; } -#elif defined(XP_OS2) - if (DosSetFileSize((HFILE) PR_FileDesc2NativeHandle(fd), newEOF) != NO_ERROR) { - NS_ERROR("DosSetFileSize failed"); - return NS_ERROR_FAILURE; - } #else // add implementations for other platforms here #endif diff --git a/netwerk/dns/DNS.cpp b/netwerk/dns/DNS.cpp index 973ce247c..3b994ff83 100644 --- a/netwerk/dns/DNS.cpp +++ b/netwerk/dns/DNS.cpp @@ -62,7 +62,7 @@ void PRNetAddrToNetAddr(const PRNetAddr *prAddr, NetAddr *addr) memcpy(&addr->inet6.ip, &prAddr->ipv6.ip, sizeof(addr->inet6.ip.u8)); addr->inet6.scope_id = prAddr->ipv6.scope_id; } -#if defined(XP_UNIX) || defined(XP_OS2) +#if defined(XP_UNIX) else if (prAddr->raw.family == PR_AF_LOCAL) { addr->local.family = AF_LOCAL; memcpy(addr->local.path, prAddr->local.path, sizeof(addr->local.path)); @@ -86,7 +86,7 @@ void NetAddrToPRNetAddr(const NetAddr *addr, PRNetAddr *prAddr) memcpy(&prAddr->ipv6.ip, &addr->inet6.ip, sizeof(addr->inet6.ip.u8)); prAddr->ipv6.scope_id = addr->inet6.scope_id; } -#if defined(XP_UNIX) || defined(XP_OS2) +#if defined(XP_UNIX) else if (addr->raw.family == AF_LOCAL) { prAddr->local.family = PR_AF_LOCAL; memcpy(prAddr->local.path, addr->local.path, sizeof(addr->local.path)); @@ -112,7 +112,7 @@ bool NetAddrToString(const NetAddr *addr, char *buf, uint32_t bufSize) memcpy(&nativeAddr.s6_addr, &addr->inet6.ip, sizeof(addr->inet6.ip.u8)); return !!inet_ntop_internal(AF_INET6, &nativeAddr, buf, bufSize); } -#if defined(XP_UNIX) || defined(XP_OS2) +#if defined(XP_UNIX) else if (addr->raw.family == AF_LOCAL) { if (bufSize < sizeof(addr->local.path)) { return false; diff --git a/netwerk/dns/DNS.h b/netwerk/dns/DNS.h index 53841a0ff..1f0fcd46b 100644 --- a/netwerk/dns/DNS.h +++ b/netwerk/dns/DNS.h @@ -10,7 +10,7 @@ #include "prnetdb.h" #include "mozilla/LinkedList.h" -#if !defined(XP_WIN) && !defined(XP_OS2) +#if !defined(XP_WIN) #include <arpa/inet.h> #endif @@ -96,14 +96,10 @@ union NetAddr { IPv6Addr ip; /* the actual 128 bits of address */ uint32_t scope_id; /* set of interfaces for a scope */ } inet6; -#if defined(XP_UNIX) || defined(XP_OS2) +#if defined(XP_UNIX) struct { /* Unix domain socket address */ uint16_t family; /* address family (AF_UNIX) */ -#ifdef XP_OS2 - char path[108]; /* null-terminated pathname */ -#else char path[104]; /* null-terminated pathname */ -#endif } local; #endif }; diff --git a/netwerk/ipc/NeckoMessageUtils.h b/netwerk/ipc/NeckoMessageUtils.h index 93528608b..5509ecd0c 100644 --- a/netwerk/ipc/NeckoMessageUtils.h +++ b/netwerk/ipc/NeckoMessageUtils.h @@ -102,7 +102,7 @@ struct ParamTraits<mozilla::net::NetAddr> WriteParam(aMsg, aParam.inet6.ip.u64[0]); WriteParam(aMsg, aParam.inet6.ip.u64[1]); WriteParam(aMsg, aParam.inet6.scope_id); -#if defined(XP_UNIX) || defined(XP_OS2) +#if defined(XP_UNIX) } else if (aParam.raw.family == AF_LOCAL) { // Train's already off the rails: let's get a stack trace at least... NS_RUNTIMEABORT("Error: please post stack trace to " @@ -133,7 +133,7 @@ struct ParamTraits<mozilla::net::NetAddr> ReadParam(aMsg, aIter, &aResult->inet6.ip.u64[0]) && ReadParam(aMsg, aIter, &aResult->inet6.ip.u64[1]) && ReadParam(aMsg, aIter, &aResult->inet6.scope_id); -#if defined(XP_UNIX) || defined(XP_OS2) +#if defined(XP_UNIX) } else if (aResult->raw.family == AF_LOCAL) { return aMsg->ReadBytes(aIter, reinterpret_cast<const char**>(&aResult->local.path), diff --git a/netwerk/protocol/file/nsFileProtocolHandler.cpp b/netwerk/protocol/file/nsFileProtocolHandler.cpp index eab73befe..32853d3ea 100644 --- a/netwerk/protocol/file/nsFileProtocolHandler.cpp +++ b/netwerk/protocol/file/nsFileProtocolHandler.cpp @@ -26,13 +26,6 @@ #endif #endif -// URL file handling for OS/2 -#ifdef XP_OS2 -#include "prio.h" -#include "nsIFileURL.h" -#include "nsILocalFileOS2.h" -#endif - // URL file handling for freedesktop.org #ifdef XP_UNIX #include "nsINIParser.h" @@ -104,50 +97,6 @@ nsFileProtocolHandler::ReadURLFile(nsIFile* aFile, nsIURI** aURI) return rv; } -#elif defined(XP_OS2) -NS_IMETHODIMP -nsFileProtocolHandler::ReadURLFile(nsIFile* aFile, nsIURI** aURI) -{ - nsresult rv; - - nsCOMPtr<nsILocalFileOS2> os2File (do_QueryInterface(aFile, &rv)); - if (NS_FAILED(rv)) - return NS_ERROR_NOT_AVAILABLE; - - // see if this file is a WPS UrlObject - bool isUrl; - rv = os2File->IsFileType(NS_LITERAL_CSTRING("UniformResourceLocator"), - &isUrl); - if (NS_FAILED(rv) || !isUrl) - return NS_ERROR_NOT_AVAILABLE; - - // if so, open it & get its size - PRFileDesc *file; - rv = os2File->OpenNSPRFileDesc(PR_RDONLY, 0, &file); - if (NS_FAILED(rv)) - return NS_ERROR_NOT_AVAILABLE; - - int64_t fileSize; - os2File->GetFileSize(&fileSize); - rv = NS_ERROR_NOT_AVAILABLE; - - // get a buffer, read the entire file, then create - // an nsURI; we assume the string is already escaped - char * buffer = (char*)NS_Alloc(fileSize+1); - if (buffer) { - int32_t cnt = PR_Read(file, buffer, fileSize); - if (cnt > 0) { - buffer[cnt] = '\0'; - if (NS_SUCCEEDED(NS_NewURI(aURI, nsDependentCString(buffer)))) - rv = NS_OK; - } - NS_Free(buffer); - } - PR_Close(file); - - return rv; -} - #elif defined(XP_UNIX) NS_IMETHODIMP nsFileProtocolHandler::ReadURLFile(nsIFile* aFile, nsIURI** aURI) @@ -219,7 +168,7 @@ nsFileProtocolHandler::NewURI(const nsACString &spec, const nsACString *specPtr = &spec; -#if defined(XP_WIN) || defined(XP_OS2) +#if defined(XP_WIN) nsAutoCString buf; if (net_NormalizeFileURL(spec, buf)) specPtr = &buf; diff --git a/netwerk/protocol/http/nsHttpHandler.cpp b/netwerk/protocol/http/nsHttpHandler.cpp index 022bc1b4c..07feeab0f 100644 --- a/netwerk/protocol/http/nsHttpHandler.cpp +++ b/netwerk/protocol/http/nsHttpHandler.cpp @@ -60,11 +60,6 @@ #include <CoreServices/CoreServices.h> #endif -#if defined(XP_OS2) -#define INCL_DOSMISC -#include <os2.h> -#endif - //----------------------------------------------------------------------------- using namespace mozilla; using namespace mozilla::net; @@ -648,8 +643,6 @@ nsHttpHandler::InitUserAgentComponents() mPlatform.AssignLiteral( #if defined(ANDROID) "Android" -#elif defined(XP_OS2) - "OS/2" #elif defined(XP_WIN) "Windows" #elif defined(XP_MACOSX) @@ -676,20 +669,7 @@ nsHttpHandler::InitUserAgentComponents() #ifndef MOZ_UA_OS_AGNOSTIC // Gather OS/CPU. -#if defined(XP_OS2) - ULONG os2ver = 0; - DosQuerySysInfo(QSV_VERSION_MINOR, QSV_VERSION_MINOR, - &os2ver, sizeof(os2ver)); - if (os2ver == 11) - mOscpu.AssignLiteral("2.11"); - else if (os2ver == 30) - mOscpu.AssignLiteral("Warp 3"); - else if (os2ver == 40) - mOscpu.AssignLiteral("Warp 4"); - else if (os2ver == 45) - mOscpu.AssignLiteral("Warp 4.5"); - -#elif defined(XP_WIN) +#if defined(XP_WIN) OSVERSIONINFO info = { sizeof(OSVERSIONINFO) }; if (GetVersionEx(&info)) { const char *format; diff --git a/netwerk/streamconv/test/TestStreamConv.cpp b/netwerk/streamconv/test/TestStreamConv.cpp index 0a3c7d26e..df32e90b2 100644 --- a/netwerk/streamconv/test/TestStreamConv.cpp +++ b/netwerk/streamconv/test/TestStreamConv.cpp @@ -28,9 +28,6 @@ #ifdef XP_WIN #include <windows.h> #endif -#ifdef XP_OS2 -#include <os2.h> -#endif static int gKeepRunning = 0; ///////////////////////////////// diff --git a/netwerk/test/TestOverlappedIO.cpp b/netwerk/test/TestOverlappedIO.cpp index c4bfd670d..59417147d 100644 --- a/netwerk/test/TestOverlappedIO.cpp +++ b/netwerk/test/TestOverlappedIO.cpp @@ -9,9 +9,6 @@ #ifdef WIN32 #include <windows.h> #endif -#ifdef OS2 -#include <os2.h> -#endif #include "nspr.h" #include "nscore.h" diff --git a/netwerk/test/TestSocketIO.cpp b/netwerk/test/TestSocketIO.cpp index 0c9cd4d9f..5da97bffb 100644 --- a/netwerk/test/TestSocketIO.cpp +++ b/netwerk/test/TestSocketIO.cpp @@ -8,9 +8,6 @@ #ifdef WIN32 #include <windows.h> #endif -#ifdef OS2 -#include <os2.h> -#endif #include "nspr.h" #include "nscore.h" diff --git a/netwerk/test/TestSocketInput.cpp b/netwerk/test/TestSocketInput.cpp index 05ad71781..e06026a07 100644 --- a/netwerk/test/TestSocketInput.cpp +++ b/netwerk/test/TestSocketInput.cpp @@ -7,9 +7,6 @@ #ifdef WIN32 #include <windows.h> #endif -#ifdef XP_OS2 -#include <os2.h> -#endif #include "nscore.h" #include "nsCOMPtr.h" diff --git a/python/mozbuild/mozpack/executables.py b/python/mozbuild/mozpack/executables.py index 22f0a0d96..d2b04fa3d 100644 --- a/python/mozbuild/mozpack/executables.py +++ b/python/mozbuild/mozpack/executables.py @@ -62,13 +62,13 @@ def is_executable(path): ''' Return whether a given file path points to an executable or a library, where an executable or library is identified by: - - the file extension on OS/2 and WINNT + - the file extension on WINNT - the file signature on OS/X and ELF systems (GNU/Linux, Android, BSD, Solaris) As this function is intended for use to choose between the ExecutableFile and File classes in FileFinder, and choosing ExecutableFile only matters - on OS/2, OS/X, ELF and WINNT (in GCC build) systems, we don't bother + on OS/X, ELF and WINNT (in GCC build) systems, we don't bother detecting other kind of executables. ''' if not os.path.exists(path): diff --git a/python/mozbuild/mozpack/files.py b/python/mozbuild/mozpack/files.py index 5c7b21cc9..254bc14ab 100644 --- a/python/mozbuild/mozpack/files.py +++ b/python/mozbuild/mozpack/files.py @@ -137,7 +137,7 @@ class File(BaseFile): class ExecutableFile(File): ''' - File class for executable and library files on OS/2, OS/X and ELF systems. + File class for executable and library files on OS/X and ELF systems. (see mozpack.executables.is_executable documentation). ''' def copy(self, dest, skip_if_older=True): |