diff --git a/base/macbuild/base.mcp b/base/macbuild/base.mcp index 2b2a344a0c7..c46ac17b79e 100644 Binary files a/base/macbuild/base.mcp and b/base/macbuild/base.mcp differ diff --git a/base/src/nscore.h b/base/src/nscore.h index 2eecf758a4d..2cba7e48115 100644 --- a/base/src/nscore.h +++ b/base/src/nscore.h @@ -73,8 +73,8 @@ typedef PRUcs2 PRUnichar; #undef NS_EXPORT #undef NS_EXPORT_ -#define NS_EXPORT -#define NS_EXPORT_(type) type +#define NS_EXPORT __declspec(export) +#define NS_EXPORT_(type) type __declspec(export) #else /* XXX do something useful? */ diff --git a/build/mac/NGLayoutBuildList.pm b/build/mac/NGLayoutBuildList.pm index edc6519feb1..32038db9f7d 100644 --- a/build/mac/NGLayoutBuildList.pm +++ b/build/mac/NGLayoutBuildList.pm @@ -117,8 +117,12 @@ sub Checkout() #// if ($main::pull{all}) { - $session->checkout("RaptorMac") || die "checkout failure"; - $session->checkout("mozilla/modules/libpref") || die "checkout failure"; + $session->checkout("RaptorMac") || die "checkout failure"; + #//$session->checkout("mozilla/modules/libpref") || die "checkout failure"; + + #// beard: additional libraries needed to make shared libraries link. + #//$session->checkout("mozilla/lib/mac/PowerPlant") || die "checkout failure"; + #//$session->checkout("mozilla/lib/xlate") || die "checkout failure"; } } @@ -141,21 +145,21 @@ sub BuildDist() #MAC_COMMON InstallFromManifest(":mozilla:build:mac:MANIFEST", "$distdirectory:mac:common:"); InstallFromManifest(":mozilla:lib:mac:NSStdLib:include:MANIFEST", "$distdirectory:mac:common:"); - InstallFromManifest(":mozilla:lib:mac:MacMemoryAllocator:include:MANIFEST", "$distdirectory:mac:common:"); + InstallFromManifest(":mozilla:lib:mac:MacMemoryAllocator:include:MANIFEST", "$distdirectory:mac:common:"); InstallFromManifest(":mozilla:lib:mac:Misc:MANIFEST", "$distdirectory:mac:common:"); InstallFromManifest(":mozilla:lib:mac:MoreFiles:MANIFEST", "$distdirectory:mac:common:morefiles:"); #INCLUDE - InstallFromManifest(":mozilla:config:mac:MANIFEST", "$distdirectory:config:"); + InstallFromManifest(":mozilla:config:mac:MANIFEST", "$distdirectory:config:"); InstallFromManifest(":mozilla:config:mac:MANIFEST_config", "$distdirectory:config:"); InstallFromManifest(":mozilla:include:MANIFEST", "$distdirectory:include:"); InstallFromManifest(":mozilla:cmd:macfe:pch:MANIFEST", "$distdirectory:include:"); InstallFromManifest(":mozilla:cmd:macfe:utility:MANIFEST", "$distdirectory:include:"); #NSPR - InstallFromManifest(":mozilla:nsprpub:pr:include:MANIFEST", "$distdirectory:nspr:"); + InstallFromManifest(":mozilla:nsprpub:pr:include:MANIFEST", "$distdirectory:nspr:"); InstallFromManifest(":mozilla:nsprpub:pr:src:md:mac:MANIFEST", "$distdirectory:nspr:mac:"); - InstallFromManifest(":mozilla:nsprpub:lib:ds:MANIFEST", "$distdirectory:nspr:"); + InstallFromManifest(":mozilla:nsprpub:lib:ds:MANIFEST", "$distdirectory:nspr:"); InstallFromManifest(":mozilla:nsprpub:lib:libc:include:MANIFEST", "$distdirectory:nspr:"); InstallFromManifest(":mozilla:nsprpub:lib:msgc:include:MANIFEST", "$distdirectory:nspr:"); @@ -163,58 +167,58 @@ sub BuildDist() InstallFromManifest(":mozilla:jpeg:MANIFEST", "$distdirectory:jpeg:"); #LIBREG - InstallFromManifest(":mozilla:modules:libreg:include:MANIFEST", "$distdirectory:libreg:"); + InstallFromManifest(":mozilla:modules:libreg:include:MANIFEST", "$distdirectory:libreg:"); #XPCOM - InstallFromManifest(":mozilla:xpcom:public:MANIFEST", "$distdirectory:xpcom:"); + InstallFromManifest(":mozilla:xpcom:public:MANIFEST", "$distdirectory:xpcom:"); #ZLIB InstallFromManifest(":mozilla:modules:zlib:src:MANIFEST", "$distdirectory:zlib:"); #LIBUTIL - InstallFromManifest(":mozilla:modules:libutil:public:MANIFEST", "$distdirectory:libutil:"); + InstallFromManifest(":mozilla:modules:libutil:public:MANIFEST", "$distdirectory:libutil:"); #SUN_JAVA - InstallFromManifest(":mozilla:sun-java:stubs:include:MANIFEST", "$distdirectory:sun-java:"); + InstallFromManifest(":mozilla:sun-java:stubs:include:MANIFEST", "$distdirectory:sun-java:"); InstallFromManifest(":mozilla:sun-java:stubs:macjri:MANIFEST", "$distdirectory:sun-java:"); #NAV_JAVA - InstallFromManifest(":mozilla:nav-java:stubs:include:MANIFEST", "$distdirectory:nav-java:"); + InstallFromManifest(":mozilla:nav-java:stubs:include:MANIFEST", "$distdirectory:nav-java:"); InstallFromManifest(":mozilla:nav-java:stubs:macjri:MANIFEST", "$distdirectory:nav-java:"); #JS - InstallFromManifest(":mozilla:js:src:MANIFEST", "$distdirectory:js:"); + InstallFromManifest(":mozilla:js:src:MANIFEST", "$distdirectory:js:"); #SECURITY_freenav InstallFromManifest(":mozilla:modules:security:freenav:MANIFEST", "$distdirectory:security:"); #LIBPREF - InstallFromManifest(":mozilla:modules:libpref:public:MANIFEST", "$distdirectory:libpref:"); + InstallFromManifest(":mozilla:modules:libpref:public:MANIFEST", "$distdirectory:libpref:"); #LIBIMAGE - InstallFromManifest(":mozilla:modules:libimg:png:MANIFEST", "$distdirectory:libimg:"); - InstallFromManifest(":mozilla:modules:libimg:src:MANIFEST", "$distdirectory:libimg:"); + InstallFromManifest(":mozilla:modules:libimg:png:MANIFEST", "$distdirectory:libimg:"); + InstallFromManifest(":mozilla:modules:libimg:src:MANIFEST", "$distdirectory:libimg:"); InstallFromManifest(":mozilla:modules:libimg:public:MANIFEST", "$distdirectory:libimg:"); #PLUGIN InstallFromManifest(":mozilla:modules:plugin:nglsrc:MANIFEST", "$distdirectory:plugin:"); InstallFromManifest(":mozilla:modules:plugin:public:MANIFEST", "$distdirectory:plugin:"); - InstallFromManifest(":mozilla:modules:plugin:src:MANIFEST", "$distdirectory:plugin:"); + InstallFromManifest(":mozilla:modules:plugin:src:MANIFEST", "$distdirectory:plugin:"); InstallFromManifest(":mozilla:modules:oji:src:MANIFEST", "$distdirectory:oji:"); - InstallFromManifest(":mozilla:modules:oji:public:MANIFEST", "$distdirectory:oji:"); + InstallFromManifest(":mozilla:modules:oji:public:MANIFEST", "$distdirectory:oji:"); #LAYERS (IS THIS STILL NEEDED) InstallFromManifest(":mozilla:lib:liblayer:include:MANIFEST", "$distdirectory:layers:"); #NETWORK InstallFromManifest(":mozilla:network:cache:MANIFEST", "$distdirectory:network:"); - InstallFromManifest(":mozilla:network:client:MANIFEST", "$distdirectory:network:"); + InstallFromManifest(":mozilla:network:client:MANIFEST", "$distdirectory:network:"); InstallFromManifest(":mozilla:network:cnvts:MANIFEST", "$distdirectory:network:"); InstallFromManifest(":mozilla:network:cstream:MANIFEST", "$distdirectory:network:"); InstallFromManifest(":mozilla:network:main:MANIFEST", "$distdirectory:network:"); InstallFromManifest(":mozilla:network:mimetype:MANIFEST", "$distdirectory:network:"); InstallFromManifest(":mozilla:network:util:MANIFEST", "$distdirectory:network:"); - InstallFromManifest(":mozilla:network:protocol:about:MANIFEST", "$distdirectory:network:"); + InstallFromManifest(":mozilla:network:protocol:about:MANIFEST", "$distdirectory:network:"); InstallFromManifest(":mozilla:network:protocol:certld:MANIFEST", "$distdirectory:network:"); InstallFromManifest(":mozilla:network:protocol:dataurl:MANIFEST", "$distdirectory:network:"); InstallFromManifest(":mozilla:network:protocol:file:MANIFEST", "$distdirectory:network:"); @@ -228,7 +232,7 @@ sub BuildDist() InstallFromManifest(":mozilla:network:protocol:pop3:MANIFEST", "$distdirectory:network:"); InstallFromManifest(":mozilla:network:protocol:remote:MANIFEST", "$distdirectory:network:"); InstallFromManifest(":mozilla:network:protocol:smtp:MANIFEST", "$distdirectory:network:"); - InstallFromManifest(":mozilla:network:module:MANIFEST", "$distdirectory:network:module"); + InstallFromManifest(":mozilla:network:module:MANIFEST", "$distdirectory:network:module"); #BASE InstallFromManifest(":mozilla:base:src:MANIFEST", "$distdirectory:base:"); @@ -239,7 +243,7 @@ sub BuildDist() #LAYOUT InstallFromManifest(":mozilla:layout:build:MANIFEST", "$distdirectory:layout:"); - InstallFromManifest(":mozilla:layout:base:public:MANIFEST", "$distdirectory:layout:"); + InstallFromManifest(":mozilla:layout:base:public:MANIFEST", "$distdirectory:layout:"); InstallFromManifest(":mozilla:layout:html:style:public:MANIFEST", "$distdirectory:layout:"); InstallFromManifest(":mozilla:layout:html:base:src:MANIFEST", "$distdirectory:layout:"); InstallFromManifest(":mozilla:layout:base:src:MANIFEST", "$distdirectory:layout:"); @@ -248,10 +252,10 @@ sub BuildDist() #WIDGET InstallFromManifest(":mozilla:widget:public:MANIFEST", "$distdirectory:widget:"); - InstallFromManifest(":mozilla:widget:src:mac:MANIFEST", "$distdirectory:widget:"); + InstallFromManifest(":mozilla:widget:src:mac:MANIFEST", "$distdirectory:widget:"); #GFX - InstallFromManifest(":mozilla:gfx:src:MANIFEST", "$distdirectory:gfx:"); + InstallFromManifest(":mozilla:gfx:src:MANIFEST", "$distdirectory:gfx:"); InstallFromManifest(":mozilla:gfx:public:MANIFEST", "$distdirectory:gfx:"); #VIEW @@ -262,7 +266,7 @@ sub BuildDist() InstallFromManifest(":mozilla:dom:public:coreDom:MANIFEST", "$distdirectory:dom:"); InstallFromManifest(":mozilla:dom:public:coreEvents:MANIFEST", "$distdirectory:dom:"); InstallFromManifest(":mozilla:dom:public:events:MANIFEST", "$distdirectory:dom:"); - InstallFromManifest(":mozilla:dom:public:html:MANIFEST", "$distdirectory:dom:"); + InstallFromManifest(":mozilla:dom:public:html:MANIFEST", "$distdirectory:dom:"); InstallFromManifest(":mozilla:dom:public:css:MANIFEST", "$distdirectory:dom:"); InstallFromManifest(":mozilla:dom:src:jsurl:MANIFEST", "$distdirectory:dom:"); @@ -298,6 +302,11 @@ sub BuildCommonProjects() Moz::BuildProjectClean(":mozilla:lib:mac:NSRuntime:NSRuntime.mcp", "Stubs"); Moz::BuildProjectClean(":mozilla:cmd:macfe:projects:client:Client.mcp", "Stubs"); + #// + #// Stub libraries + #// + BuildProject(":mozilla:modules:security:freenav:macbuild:NoSecurity.mcp", "Security.o"); + #// #// Shared libraries #// @@ -341,30 +350,14 @@ sub BuildCommonProjects() BuildProject(":mozilla:modules:zlib:macbuild:zlib.mcp", "zlib$D.shlb"); MakeAlias(":mozilla:modules:zlib:macbuild:zlib$D.shlb", "$dist_dir"); $main::DEBUG ? MakeAlias(":mozilla:modules:zlib:macbuild:zlib$D.shlb.xSYM", "$dist_dir") : 0; - - #// - #// Static libraries - #// - if ($main::SHARED) - { - BuildProject(":mozilla:xpcom:macbuild:xpcomPPC.mcp", "xpcom$D.shlb"); - $main::DEBUG ? MakeAlias(":mozilla:xpcom:macbuild:xpcom$D.shlb.xSYM", "$dist_dir") : 0; - BuildProject(":mozilla:modules:security:freenav:macbuild:NoSecurity.mcp", "Security.o"); - BuildProject(":mozilla:modules:libimg:macbuild:png.mcp", "png$D.o"); - BuildProject(":mozilla:modules:libimg:macbuild:libimg.mcp", "libimg$D.o (standalone)"); + BuildProject(":mozilla:xpcom:macbuild:xpcomPPC.mcp", "xpcom$D.shlb"); + MakeAlias(":mozilla:xpcom:macbuild:xpcom$D.shlb", "$dist_dir"); + $main::DEBUG ? MakeAlias(":mozilla:xpcom:macbuild:xpcom$D.shlb.xSYM", "$dist_dir") : 0; - BuildProject(":mozilla:network:macbuild:network.mcp", "network$D.shlb"); - $main::DEBUG ? MakeAlias(":mozilla:network:macbuild:network$D.shlb.xSYM", "$dist_dir") : 0; - } - else - { - BuildProject(":mozilla:xpcom:macbuild:xpcomPPC.mcp", "xpcom$D.o"); - BuildProject(":mozilla:modules:security:freenav:macbuild:NoSecurity.mcp", "Security.o"); - BuildProject(":mozilla:modules:libimg:macbuild:png.mcp", "png$D.o"); - BuildProject(":mozilla:modules:libimg:macbuild:libimg.mcp", "libimg$D.o (standalone)"); - BuildProject(":mozilla:network:macbuild:network.mcp", "NetworkModular$D.o"); - } + BuildProject(":mozilla:modules:libpref:macbuild:libpref.mcp", "libpref$D.shlb"); + MakeAlias(":mozilla:modules:libpref:macbuild:libpref$D.shlb", "$dist_dir"); + $main::DEBUG ? MakeAlias(":mozilla:modules:libpref:macbuild:libpref$D.shlb.xSYM", "$dist_dir") : 0; } @@ -400,72 +393,76 @@ sub BuildLayoutProjects() # $D becomes a suffix to target names for selecting either the debug or non-debug target of a project my($D) = $main::DEBUG ? "Debug" : ""; my($dist_dir) = _getDistDirectory(); - + #// #// Make aliases of resource files #// my($resource_dir) = "$dist_dir" . "res:"; - MakeAlias(":mozilla:layout:html:document:src:ua.css", "$resource_dir"); + MakeAlias(":mozilla:layout:html:document:src:ua.css", "$resource_dir"); my($html_dir) = "$resource_dir" . "html:"; - MakeAlias(":mozilla:layout:html:base:src:broken-image.gif", "$html_dir"); + MakeAlias(":mozilla:layout:html:base:src:broken-image.gif", "$html_dir"); my($throbber_dir) = "$resource_dir" . "throbber:"; - BuildResourceAliases(":mozilla:webshell:tests:viewer:throbber:", "$throbber_dir"); + BuildResourceAliases(":mozilla:webshell:tests:viewer:throbber:", "$throbber_dir"); my($samples_dir) = "$resource_dir" . "samples:"; - BuildResourceAliases(":mozilla:webshell:tests:viewer:samples:", "$samples_dir"); + BuildResourceAliases(":mozilla:webshell:tests:viewer:samples:", "$samples_dir"); my($chrome_dir) = "$resource_dir" . "chrome:"; - BuildResourceAliases(":mozilla:xpfe:xpviewer:src:resources:chrome:", "$chrome_dir"); + BuildResourceAliases(":mozilla:xpfe:xpviewer:src:resources:chrome:", "$chrome_dir"); my($toolbar_dir) = "$resource_dir" . "toolbar:"; - BuildResourceAliases(":mozilla:xpfe:xpviewer:src:resources:toolbar:", "$toolbar_dir"); + BuildResourceAliases(":mozilla:xpfe:xpviewer:src:resources:toolbar:", "$toolbar_dir"); #// #// Build Layout projects #// - if ($main::SHARED) - { - BuildProject(":mozilla:base:macbuild:base.mcp", "base$D.o"); - #BuildProject(":mozilla:base:macbuild:base.mcp", "base$D.shlb"); - #$main::DEBUG ? MakeAlias(":mozilla:base:macbuild:base$D.shlb.xSYM", "$dist_dir") : 0; + BuildProject(":mozilla:base:macbuild:base.mcp", "base$D.shlb"); + MakeAlias(":mozilla:base:macbuild:base$D.shlb", "$dist_dir"); + + BuildProject(":mozilla:modules:libutil:macbuild:libutil.mcp", "libutil$D.shlb"); + MakeAlias(":mozilla:modules:libutil:macbuild:libutil$D.shlb", "$dist_dir"); + $main::DEBUG ? MakeAlias(":mozilla:modules:libutil:macbuild:libutil$D.shlb.xSYM", "$dist_dir") : 0; - BuildProject(":mozilla:htmlparser:macbuild:htmlparser.mcp", "htmlparser$D.shlb"); - $main::DEBUG ? MakeAlias(":mozilla:htmlparser:macbuild:htmlparser$D.shlb.xSYM", "$dist_dir") : 0; - - BuildProject(":mozilla:dom:macbuild:dom.mcp", "dom$D.shlb"); - $main::DEBUG ? MakeAlias(":mozilla:dom:macbuild:dom$D.shlb.xSYM", "$dist_dir") : 0; + BuildProject(":mozilla:modules:libimg:macbuild:png.mcp", "png$D.o"); + BuildProject(":mozilla:modules:libimg:macbuild:libimg.mcp", "libimg$D.shlb"); + MakeAlias(":mozilla:modules:libimg:macbuild:libimg$D.shlb", "$dist_dir"); + $main::DEBUG ? MakeAlias(":mozilla:modules:libimg:macbuild:libimg$D.shlb.xSYM", "$dist_dir") : 0; - BuildProject(":mozilla:gfx:macbuild:gfx.mcp", "gfx$D.shlb"); - $main::DEBUG ? MakeAlias(":mozilla:gfx:macbuild:gfx$D.shlb.xSYM", "$dist_dir") : 0; + #// beard: now depends on libimg. + BuildProject(":mozilla:network:macbuild:network.mcp", "NetworkModular$D.shlb"); + MakeAlias(":mozilla:network:macbuild:NetworkModular$D.shlb", "$dist_dir"); + $main::DEBUG ? MakeAlias(":mozilla:network:macbuild:NetworkModular$D.shlb", "$dist_dir") : 0; - BuildProject(":mozilla:layout:macbuild:layout.mcp", "layout$D.shlb"); - $main::DEBUG ? MakeAlias(":mozilla:layout:macbuild:layout$D.shlb.xSYM", "$dist_dir") : 0; + BuildProject(":mozilla:htmlparser:macbuild:htmlparser.mcp", "htmlparser$D.shlb"); + MakeAlias(":mozilla:htmlparser:macbuild:htmlparser$D.shlb", "$dist_dir"); + + BuildProject(":mozilla:dom:macbuild:dom.mcp", "dom$D.shlb"); + MakeAlias(":mozilla:dom:macbuild:dom$D.shlb", "$dist_dir") ; - BuildProject(":mozilla:view:macbuild:view.mcp", "view$D.shlb"); - $main::DEBUG ? MakeAlias(":mozilla:view:macbuild:view$D.shlb.xSYM", "$dist_dir") : 0; + BuildProject(":mozilla:gfx:macbuild:gfx.mcp", "gfx$D.shlb"); + MakeAlias(":mozilla:gfx:macbuild:gfx$D.shlb", "$dist_dir"); + + BuildProject(":mozilla:layout:macbuild:layout.mcp", "layout$D.shlb"); + MakeAlias(":mozilla:layout:macbuild:layout$D.shlb", "$dist_dir"); + + BuildProject(":mozilla:view:macbuild:view.mcp", "view$D.shlb"); + MakeAlias(":mozilla:view:macbuild:view$D.shlb", "$dist_dir"); + $main::DEBUG ? MakeAlias(":mozilla:view:macbuild:view$D.shlb.xSYM", "$dist_dir") : 0; - BuildProject(":mozilla:widget:macbuild:widget.mcp", "widget$D.shlb"); - $main::DEBUG ? MakeAlias(":mozilla:widget:macbuild:widget$D.shlb.xSYM", "$dist_dir") : 0; + #// PowerPlant now used by widget, etc. + BuildProject(":mozilla:lib:mac:PowerPlant:PowerPlant.mcp", "PowerPlant$D.shlb"); + MakeAlias(":mozilla:lib:mac:PowerPlant:PowerPlant$D.shlb", "$dist_dir"); - BuildProject(":mozilla:webshell:macbuild:webshell.mcp", "webshell$D.shlb"); - $main::DEBUG ? MakeAlias(":mozilla:webshell:macbuild:webshell$D.shlb.xSYM", "$dist_dir") : 0; - } - else - { - BuildProject(":mozilla:base:macbuild:base.mcp", "base$D.o"); - BuildProject(":mozilla:htmlparser:macbuild:htmlparser.mcp", "htmlparser$D.o"); - BuildProject(":mozilla:dom:macbuild:dom.mcp", "dom$D.o"); - BuildProject(":mozilla:gfx:macbuild:gfx.mcp", "gfx$D.o"); - BuildProject(":mozilla:layout:macbuild:layout.mcp", "layout$D.o"); - BuildProject(":mozilla:view:macbuild:view.mcp", "view$D.o"); - BuildProject(":mozilla:widget:macbuild:widget.mcp", "widget$D.o"); - BuildProject(":mozilla:webshell:macbuild:webshell.mcp", "webshell$D.o"); - } - - BuildProject(":mozilla:webshell:tests:viewer:mac:viewer.mcp", "viewer$D"); - BuildProject(":mozilla:xpfe:macbuild:xpfeviewer.mcp", "xpfeViewer$D"); + BuildProject(":mozilla:widget:macbuild:widget.mcp", "widget$D.shlb"); + MakeAlias(":mozilla:widget:macbuild:widget$D.shlb", "$dist_dir"); + + BuildProject(":mozilla:webshell:macbuild:webshell.mcp", "webshell$D.shlb"); + MakeAlias(":mozilla:webshell:macbuild:webshell$D.shlb", "$dist_dir"); + + BuildProject(":mozilla:webshell:tests:viewer:mac:viewer.mcp", "viewer$D"); + BuildProject(":mozilla:xpfe:macbuild:xpfeviewer.mcp", "xpfeViewer$D"); } diff --git a/cmd/macfe/utility/xp_file_mac.cp b/cmd/macfe/utility/xp_file_mac.cp index 4556694c926..e69de29bb2d 100644 --- a/cmd/macfe/utility/xp_file_mac.cp +++ b/cmd/macfe/utility/xp_file_mac.cp @@ -1,1341 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * - * The contents of this file are subject to the Netscape Public License - * Version 1.0 (the "NPL"); you may not use this file except in - * compliance with the NPL. You may obtain a copy of the NPL at - * http://www.mozilla.org/NPL/ - * - * Software distributed under the NPL is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL - * for the specific language governing rights and limitations under the - * NPL. - * - * The Initial Developer of this code under the NPL is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All Rights - * Reserved. - */ - -/* xp_file_mac.h - * Mac-only xp_file functions - */ - #include "xp_file_mac.h" - - /* macfe */ -#include "resgui.h" -#include "ufilemgr.h" -#include "uprefd.h" - - /* utilities */ -#include "MoreFilesExtras.h" -#include "FSpCompat.h" -#include "FileCopy.h" -#include "PascalString.h" -#include "Files.h" -#include -#include "cstring.h" - -// validation flags for overloaded ConvertURLToSpec -enum ConvertURLValidationFlags { - validateValFlag = 0x00000001, - stripValFlag = 0x00000002, - appendValFlag = 0x00000004, - stripAndAppendValFlag = (stripValFlag | appendValFlag) }; - -// Prototypes -OSErr ConvertURLToSpec - (const char* inName, - FSSpec* outSpec, - ResIDT resid = 0, - Boolean validate = false); -OSErr ConvertURLToSpec( - const char* inName, - FSSpec* outSpec, - const char* suffix = nil, - ConvertURLValidationFlags validate = validateValFlag); - -/************************************************************************************** - * See xp_file.h for full documentation. BE SURE TO READ THAT FILE. - **************************************************************************************/ - -//----------------------------------- -OSErr ConvertURLToSpec(const char* inName, FSSpec* outSpec, ResIDT resid, Boolean validate) -// Returns a file spec given a name (URL form), and resid of an extension to add. -// If ResID is zero, just convert. -// If resid is nonzero and validate is true, check the input name and return an error -// if the name does NOT have the suffix. -// If resid is nonzero and validate is false, append the suffix to the input name -//----------------------------------- -{ - if (!inName) - return bdNamErr; -#ifdef DEBUG - if (XP_STRCHR(inName, ':')) - XP_ASSERT(0); // Are they passing us a Mac path? -#endif - - OSErr err = CFileMgr::FSSpecFromLocalUnixPath(inName, outSpec); - if (err && err != fnfErr) /* fnfErr is OK */ - return err; - if (resid) - { - CStr255 extension; - ::GetIndString(extension, 300, resid); - if (validate) - { - SInt32 suffixPosition = (XP_STRLEN(inName) - XP_STRLEN(extension)); - if (suffixPosition < 0) - return bdNamErr; - if (XP_STRCASECMP(extension, inName + suffixPosition) != 0) - return bdNamErr; - } - else - *(CStr63*)(outSpec->name) += extension; - } - return noErr; -} // ConvertURLToSpec - -//----------------------------------- -OSErr ConvertURLToSpec(const char* inName, FSSpec* outSpec, const char* suffix, - ConvertURLValidationFlags validate) -// Returns a file spec given a name (URL form), and resid of an extension to add. -// If ResID is zero, just convert. -// If resid is nonzero and validate is true, check the input name and return an error -// if the name does NOT have the suffix. -// If resid is nonzero and validate is false, append the suffix to the input name -//----------------------------------- -{ - if (!inName) - return bdNamErr; -#ifdef DEBUG - if (XP_STRCHR(inName, ':')) - XP_ASSERT(0); // Are they passing us a Mac path? -#endif - - if(validate & stripValFlag) { - char *dot = XP_STRRCHR(inName, '.'); - if(dot) - { - *dot = '\0'; - } - } - - OSErr err = CFileMgr::FSSpecFromLocalUnixPath(inName, outSpec); - if (err && err != fnfErr) /* fnfErr is OK */ - return err; - if (validate & validateValFlag) - { - if (suffix) - { - CStr255 extension = suffix; - SInt32 suffixPosition = (XP_STRLEN(inName) - XP_STRLEN(extension)); - if (suffixPosition < 0) - return bdNamErr; - if (XP_STRCASECMP(extension, inName + suffixPosition) != 0) - return bdNamErr; - } - } - if(validate & appendValFlag) - { - if (suffix) - { - CStr31 extension = suffix; - CStr63& specName = *(CStr63*)(outSpec->name); - /* If the total length is greater than 31, we want to - * truncate the filename on the right-hand side by the - * appropriate amount. - */ - if(specName.Length() + extension.Length() > 31) - { - specName.Length() = 31 - extension.Length(); - } - specName += extension; - } else { - XP_ASSERT(0); - } - } - - return noErr; -} // ConvertURLToSpec - -const char* CacheFilePrefix = "cache"; - -extern long _fcreator, _ftype; /* Creator and Type for files created by the open function */ - -//----------------------------------- -OSErr XP_FileSpec(const char *inName, XP_FileType type, FSSpec* outSpec) -// For the Mac, get the Mac specs first -//----------------------------------- -{ - CStr255 tempName(inName); - OSErr err = noErr; - _fcreator = emSignature; - switch (type) { -/* MAIN FOLDER */ - case xpUserPrefs: /* Ignored by MacFE */ - err = fnfErr; - break; - case xpGlobalHistory: /* Simple */ - _ftype = emGlobalHistory; - *outSpec = CPrefs::GetFilePrototype( CPrefs::MainFolder ); - GetIndString(outSpec->name, 300, globHistoryName); - break; -#ifdef MOZ_MAIL_NEWS - case xpImapRootDirectory: - _ftype = emMailSubdirectory; - *outSpec = CPrefs::GetFilePrototype( CPrefs::MainFolder ); - *(CStr63*)(outSpec->name) = "\pIMAPmail"; - break; - case xpImapServerDirectory: - _ftype = emMailSubdirectory; - *outSpec = CPrefs::GetFilePrototype( CPrefs::MainFolder ); - *(CStr63*)(outSpec->name) = "\pIMAPmail"; - - FSSpec tempSpec; - OSErr getInfoErr = FSMakeFSSpec( - outSpec->vRefNum, - outSpec->parID, - outSpec->name, - &tempSpec); - if (getInfoErr == fnfErr) - { - // We have to make the root imap directory ourselves. - long ignored; - err = FSpDirCreate(outSpec, smSystemScript, &ignored); - if (err) - break; - } - CInfoPBRec infoRecord; - XP_MEMSET(&infoRecord, 0, sizeof(infoRecord)); - infoRecord.dirInfo.ioDrDirID = outSpec->parID; - infoRecord.dirInfo.ioVRefNum = outSpec->vRefNum; - infoRecord.dirInfo.ioNamePtr = outSpec->name; - getInfoErr = PBGetCatInfoSync(&infoRecord); - if (getInfoErr == noErr) - { - /* any error here is handled by the caller */ - /* fnfErr is in fact ok for XP_Stat */ - FSMakeFSSpec( - outSpec->vRefNum, - infoRecord.dirInfo.ioDrDirID, - tempName, - outSpec); - } - - break; -#endif - case xpBookmarks: - _ftype = emTextType; - err = ConvertURLToSpec(inName, outSpec, (ResIDT)0); - break; -/* MISC */ - case xpTemporary: - _ftype = emTextType; - XP_ASSERT(tempName[0] != '/'); - *outSpec = CPrefs::GetTempFilePrototype(); - *(CStr63*)(outSpec->name) = tempName; - break; - case xpFileToPost: - _ftype = emTextType; - err = ConvertURLToSpec(inName, outSpec, (ResIDT)0); - break; - case xpURL: - case xpExtCache: - // This does not work if file name contains %. - // The problem is that netlib hex-decodes the file names before - // passing them to XP_File, while other libraries do not - // Windows has the same bug. atotic - _ftype = emTextType; - err = CFileMgr::FSSpecFromLocalUnixPath( inName, outSpec); - break; - case xpMimeTypes: - *outSpec = CPrefs::GetFilePrototype( CPrefs::MainFolder ); - GetIndString(outSpec->name, 300, mimeTypes); - break; - case xpHTTPCookie: - _ftype = emMagicCookie; - *outSpec = CPrefs::GetFilePrototype( CPrefs::MainFolder ); - GetIndString(outSpec->name, 300, magicCookie); - break; -#ifdef CookieManagement - case xpHTTPCookiePermission: - _ftype = emMagicCookie; // is this right? - *outSpec = CPrefs::GetFilePrototype( CPrefs::MainFolder ); - GetIndString(outSpec->name, 300, cookiePermissions); - break; -#endif - case xpJSCookieFilters: - _ftype = emTextType; - *outSpec = CPrefs::GetFilePrototype( CPrefs::MainFolder ); - *(CStr63*)(outSpec->name) = ":cookies.js"; - break; -#ifdef SingleSignon - case xpHTTPSingleSignon: - _ftype = emMagicCookie; // is this right? - *outSpec = CPrefs::GetFilePrototype( CPrefs::MainFolder ); - GetIndString(outSpec->name, 300, singleSignons); - break; -#endif - case xpProxyConfig: - _ftype = emTextType; - *outSpec = CPrefs::GetFilePrototype( CPrefs::MainFolder ); - GetIndString(outSpec->name, 300, proxyConfig); - break; - case xpJSConfig: - _ftype = emTextType; - *outSpec = CPrefs::GetFilePrototype( CPrefs::MainFolder ); - GetIndString(outSpec->name, 300, jsConfig); - break; - - - - - case xpSocksConfig: - _ftype = emTextType; - *outSpec = CPrefs::GetFilePrototype( CPrefs::MainFolder ); - GetIndString(outSpec->name, 300, socksConfig); - break; - case xpSignature: - _ftype = emTextType; - *outSpec = CPrefs::GetFolderSpec( CPrefs::SignatureFile ); - break; - case xpHTMLAddressBook: - _ftype = emTextType; // irrelevant - *outSpec = CPrefs::GetFilePrototype( CPrefs::MainFolder ); - GetIndString(outSpec->name, 300, htmlAddressBook); - break; -#ifdef MOZ_MAIL_NEWS - case xpAddrBookNew: - case xpAddrBook: - _ftype = emAddressBookDB; - *outSpec = CPrefs::GetFilePrototype( CPrefs::MainFolder ); - *(CStr63*)(outSpec->name) = tempName; - break; -#endif - case xpRegistry: - _ftype = emRegistry; - err = FindFolder( kOnSystemDisk, kPreferencesFolderType, TRUE, &outSpec->vRefNum, &outSpec->parID); - GetIndString(outSpec->name, 300, theRegistry); - break; - -/* SECURITY */ - case xpKeyChain: /* Should probably be the default name instead */ - _ftype = emKeyChain; - *outSpec = CPrefs::GetFilePrototype( CPrefs::SecurityFolder ); - *(CStr63*)(outSpec->name) = tempName; - break; - case xpCertDB: - _ftype = emCertificates; - *outSpec = CPrefs::GetFilePrototype( CPrefs::SecurityFolder ); - GetIndString(tempName, 300, certDB); - if (inName != NULL) - tempName += inName; - *(CStr63*)(outSpec->name) = tempName; - break; - case xpCertDBNameIDX: - _ftype = emCertIndex; - *outSpec = CPrefs::GetFilePrototype( CPrefs::SecurityFolder ); - GetIndString(outSpec->name, 300, certDBNameIDX); - break; - case xpKeyDB: - _ftype = emTextType; - *outSpec = CPrefs::GetFilePrototype( CPrefs::SecurityFolder ); - GetIndString(tempName, 300, keyDb); - if (inName != NULL) - tempName += inName; - *(CStr63*)(outSpec->name) = tempName; - break; - case xpSecModuleDB: - _ftype = emTextType; - *outSpec = CPrefs::GetFilePrototype( CPrefs::SecurityFolder ); - GetIndString(tempName, 300, secModuleDb); - break; - case xpSignedAppletDB: - _ftype = emTextType; - *outSpec = CPrefs::GetFilePrototype( CPrefs::SecurityFolder ); - GetIndString(tempName, 300, signedAppletDb); - if (inName != NULL) - tempName += inName; - *(CStr63*)(outSpec->name) = tempName; - break; - case xpCryptoPolicy: - _ftype = emTextType; - *outSpec = CPrefs::GetFilePrototype( CPrefs::RequiredGutsFolder); - GetIndString(outSpec->name, 300, cryptoPolicy); - break; -/* CACHE */ - case xpCache: - _ftype = emTextType; - *outSpec = CPrefs::GetFilePrototype( CPrefs::DiskCacheFolder ); - *(CStr63*)(outSpec->name) = tempName; - break; - case xpCacheFAT: - _ftype = emCacheFat; - *outSpec = CPrefs::GetFilePrototype( CPrefs::DiskCacheFolder ); - GetIndString(outSpec->name, 300, cacheLog); - break; - case xpExtCacheIndex: - _ftype = emExtCache; - *outSpec = CPrefs::GetFilePrototype( CPrefs::MainFolder ); - GetIndString(outSpec->name, 300, extCacheFile); - break; - case xpSARCache: - _ftype = emTextType; - *outSpec = CPrefs::GetFilePrototype( CPrefs::SARCacheFolder ); - *(CStr63*)(outSpec->name) = tempName; - break; - case xpSARCacheIndex: - _ftype = emExtCache; - *outSpec = CPrefs::GetFilePrototype( CPrefs::SARCacheFolder ); - GetIndString(outSpec->name, 300, sarCacheIndex); - break; -/* NEWS */ - case xpNewsRC: - case xpSNewsRC: -#ifdef MOZ_MAIL_NEWS - _ftype = emNewsrcFile; - *outSpec = CPrefs::GetFilePrototype( CPrefs::NewsFolder ); - if ( (inName == NULL) || (*inName == 0)) - { - GetIndString( tempName, 300, newsrc ); - NET_RegisterNewsrcFile( tempName, inName, type == xpSNewsRC, FALSE ); - } - else - { - tempName = NET_MapNewsrcHostToFilename( (char*)inName, type == xpSNewsRC, FALSE ); - if ( tempName.IsEmpty() ) - { - // 3.0 -> 4.02 conversion hack: - // The missing newsrc file from 3.0 probably is "newsrc" - // If we're looking for a file that's not there, try it with "newsrc". - // That's because if "foo" is the default host for 3.0, then these things - // are true: - // (1) When 4.0 is first launched, there is no is no entry in the host - // NewsFAT for foo, and hence no entry in the mapping table for foo. - // (2) The entry that SHOULD be in the table for foo is "newsrc". - // (3) The entry that 4.0 WOULD make, if the user hadn't run 3.0, is - // newsrc-foo. - tempName = "newsrc"; - *(CStr63*)(outSpec->name) = tempName; - FInfo fndrInfo; - if (::FSpGetFInfo(outSpec, &fndrInfo) == fnfErr) - { - char * cstr = CStr255(inName); // when we have , - char* macptr = XP_STRCHR(cstr, ':'); // ...replace ':' with '.' - if (macptr) *macptr = '.'; - - CFileMgr::UniqueFileSpec( *outSpec, cstr, *outSpec ); - tempName = outSpec->name; - } - NET_RegisterNewsrcFile( tempName, (char*)inName, type == xpSNewsRC, FALSE ); - } - } - *(CStr63*)(outSpec->name) = tempName; - break; - case xpNewsgroups: - _ftype = emTextType; - *outSpec = CPrefs::GetFilePrototype( CPrefs::NewsFolder ); - tempName = NET_MapNewsrcHostToFilename((char*)inName, FALSE, TRUE ); - if ( tempName.IsEmpty() ) - { - CStr63 newName( "groups-" ); - newName += inName; - tempName = newName; - CFileMgr::UniqueFileSpec( *outSpec, CStr31( tempName ), *outSpec ); - tempName = outSpec->name; - NET_RegisterNewsrcFile( tempName, (char*)inName, FALSE, TRUE ); - } - *(CStr63*)(outSpec->name) = tempName; - break; - case xpSNewsgroups: - _ftype = emTextType; - *outSpec = CPrefs::GetFilePrototype( CPrefs::NewsFolder ); - tempName = NET_MapNewsrcHostToFilename((char*)inName, TRUE, TRUE ); - if ( tempName.IsEmpty() ) - { - CStr63 newName( "sgroups-" ); - newName += inName; - tempName = newName; - CFileMgr::UniqueFileSpec( *outSpec, CStr31( tempName ), *outSpec ); - tempName = outSpec->name; - NET_RegisterNewsrcFile( tempName, (char*)inName, TRUE, TRUE ); - } - *(CStr63*)(outSpec->name) = tempName; - break; - case xpTemporaryNewsRC: - _ftype = emNewsrcFile; - *outSpec = CPrefs::GetFilePrototype( CPrefs::NewsFolder ); - tempName = "temp newsrc"; - *(CStr63*)(outSpec->name) = tempName; - break; - case xpNewsrcFileMap: - _ftype = emNewsrcDatabase; - *outSpec = CPrefs::GetFilePrototype( CPrefs::NewsFolder ); - GetIndString(outSpec->name, 300, newsFileMap); - break; - case xpXoverCache: - _ftype = emNewsXoverCache; - *outSpec = CPrefs::GetFilePrototype(CPrefs::NewsFolder); -// Boolean isDirectory; -// long dirID; -// // Convert the outSpec of the news folder to a dir ID -// err = FSpGetDirectoryID(outSpec, &dirID, &isDirectory); - if (!err) - { -// Assert_(isDirectory); -// outSpec->parID = dirID; - // Name can contain a slash, so be prepared - - err = CFileMgr::FSSpecFromLocalUnixPath(inName, outSpec); - -// // name is now a native partial path -// err = FSMakeFSSpec( -// outSpec->vRefNum, -// outSpec->parID, -// tempName, -// outSpec); - if (err == fnfErr) err = noErr; - } - break; - case xpNewsSort: - _ftype = emMailFilterRules; - *outSpec = CPrefs::GetFilePrototype(CPrefs::NewsFolder); - err = CFileMgr::FSSpecFromLocalUnixPath(inName, outSpec); - if (err == fnfErr) err = noErr; - break; - case xpNewsHostDatabase: - _ftype = emNewsHostDatabase; - *outSpec = CPrefs::GetFilePrototype(CPrefs::NewsFolder); - GetIndString(outSpec->name, 300, newsHostDatabase); - break; - - case xpJSMailFilters: - _ftype = emTextType; - *outSpec = CPrefs::GetFilePrototype(CPrefs::MailFolder); - if (inName && *inName) - { - // Make sure there are no colons in the server name - char* cp = (char*)&tempName[1]; - for (int i = 1; i < tempName[0]; i++,cp++) - if (*cp == ':') *cp = '.'; - *(CStr63*)(outSpec->name) += (":" + tempName + ".filters.js"); // in parent of mail folder. - } - else - *(CStr63*)(outSpec->name) = ":filters.js"; // in parent of mail folder. - break; - case xpMailSort: // normal filters - { - _ftype = emMailFilterRules; - *outSpec = CPrefs::GetFilePrototype(CPrefs::MailFolder); - if (inName && *inName) - { - // In 5.0, there are rules for each server. - // Make sure there are no colons in the server name - char* cp = (char*)&tempName[1]; - for (int i = 1; i < tempName[0]; i++,cp++) - if (*cp == ':') *cp = '.'; - *(CStr63*)(outSpec->name) = (":" + tempName + " Rules"); // in parent of mail folder. - } - else - GetIndString(outSpec->name, 300, mailFilterFile);// in parent of mail folder. - break; - } - case xpMailFilterLog: - _ftype = emMailFilterLog; - *outSpec = CPrefs::GetFilePrototype(CPrefs::MailFolder); - GetIndString(outSpec->name, 300, mailFilterLog);// in parent of mail folder. - break; - case xpMailFolder: - _ftype = emTextType; - err = ConvertURLToSpec(inName, outSpec, (ResIDT)0); - break; - case xpMailFolderSummary: - _ftype = emMailFolderSummary; - err = ConvertURLToSpec(inName, outSpec, mailBoxExt); - break; - case xpMailPopState: - _ftype = emTextType; - *outSpec = CPrefs::GetFilePrototype(CPrefs::MainFolder); - GetIndString(outSpec->name, 300, mailPopState); - break; - case xpMailSubdirectory: - _ftype = emMailSubdirectory; - err = ConvertURLToSpec(inName, outSpec, subdirExt); - break; - case xpVCardFile: - _ftype = emTextType; - // We are required to check for a '.vcf' - err = ConvertURLToSpec(inName, outSpec, vCardExt, true); - break; - case xpLDIFFile: - _ftype = emTextType; - // We are required to check for a '.ldi', '.ldif' - err = ConvertURLToSpec(inName, outSpec, ldifExt1, true); - if (err == bdNamErr) - err = ConvertURLToSpec(inName, outSpec, ldifExt2, true); - if ( err == bdNamErr ) - { - ConvertURLToSpec(inName, outSpec, 0, false); - short refNum; - err = ::FSpOpenDF( outSpec, fsRdPerm, &refNum); - FSClose( refNum ); - if (err == fnfErr) - err = ConvertURLToSpec(inName, outSpec, ".ldif", stripAndAppendValFlag); - else - err = bdNamErr; - } - break; - case xpPKCS12File: - _ftype = emTextType; - // We are required to check for a '.ldi', '.ldif' - err = ConvertURLToSpec(inName, outSpec, ".p12", stripAndAppendValFlag); - break; - case xpFolderCache: - _ftype = emTextType; - *outSpec = CPrefs::GetFilePrototype(CPrefs::MainFolder); - GetIndString(outSpec->name, 300, mailFolderCache); - break; - case xpLIClientDB: - _ftype = emTextType; - *outSpec = CPrefs::GetFilePrototype( CPrefs::MainFolder ); - *(CStr63*)(outSpec->name) = "LIClientdb.dat"; - break; - case xpLIPrefs: - _ftype = emTextType; - *outSpec = CPrefs::GetFilePrototype(CPrefs::MainFolder); - *(CStr63*)(outSpec->name) = "liprefs.js"; - break; -#endif // ifdef MOZ_MAILNEWS - - default: - XP_ASSERT( false ); // Whoever added the enum, it is time to implement it on the Mac - err = bdNamErr; - break; - } - if ( (err == fnfErr) ) - err = noErr; - //XP_ASSERT( err == noErr); - // Don't assert, sometimes normal flow of control involves an err here. - return err; -} // XP_FileSpec - -//----------------------------------- -char* xp_FileName( const char* name, XP_FileType type, char* buf, char* /* unixConfigBuf */ ) -//----------------------------------- -{ - FSSpec macSpec; - OSErr err = noErr; - - if ( ( type == xpCache ) && name) - { - char * cachePath = CPrefs::GetCachePath(); - if (cachePath == NULL) - err = fnfErr; - else - { - XP_STRCPY(buf, cachePath); - XP_STRCAT(buf, name); - } - } - -#ifdef _XP_TMP_FILENAME_FOR_LDAP_ - /* this is for address book to have a way of getting a temp file - * name for each ldap server, yet preserve the temp file name for - * later use on the same ldap server. we expect name to be unique - * to each ldap server and the return would be a temp file name - * associated with the ldap server - benjie - */ - else if ( ( type == xpAddrBook ) && name) - { - return FE_GetFileName(name, type); - } -#endif - - else - { - char* path = NULL; - - err = XP_FileSpec( name, type, &macSpec ); - - if (err != noErr) - return NULL; - - path = CFileMgr::PathNameFromFSSpec( macSpec, TRUE ); - - if ( !path ) - return NULL; - - if ((strlen(path) > 1000) ) - { - XP_ASSERT(FALSE); - XP_FREE( path ); - return NULL; - } - - XP_STRCPY( buf, path ); - XP_FREE( path ); - } - if ( err != noErr ) - return NULL; - return buf; -} // XP_FileSpec - -//----------------------------------- -char* XP_TempDirName(void) -//----------------------------------- -{ - FSSpec spec = CPrefs::GetTempFilePrototype(); - char* path = CFileMgr::PathNameFromFSSpec(spec, TRUE); - if (strlen(path) > 1000) - { - XP_ASSERT(FALSE); - return NULL; - } - return path; -} - -//----------------------------------- -char * xp_FilePlatformName(const char * name, char* path) -//----------------------------------- -{ - FSSpec spec; - OSErr err; - char * fullPath; - - if (name == NULL) - return NULL; - - // Initialize spec, because FSSpecFromLocalUnixPath might use it. - spec.vRefNum = 0; - spec.parID = 0; - err = CFileMgr::FSSpecFromLocalUnixPath(name, &spec); - // ¥¥¥NOTE: rjc, pchen, and pinkerton changed the behavior of this so that it will no - // longer return NULL when the file does not exist. If this is a problem, come tell us - // because we need to change other code. - if (err != noErr && err != fnfErr && err != dirNFErr ) - return NULL; - fullPath = CFileMgr::PathNameFromFSSpec( spec, TRUE ); - if (fullPath && (XP_STRLEN(fullPath) < 300)) - XP_STRCPY(path, fullPath); - else - return NULL; - if (fullPath) - XP_FREE(fullPath); - return path; -} - - -//----------------------------------- -char *XP_PlatformFileToURL(const char * inName) -//----------------------------------- -{ - char *retVal = NULL; - const char *prefix = "file://"; - /* The inName parameter MUST be a native path, ie colons, spaces, etc. - ** This assert will help us fix all the various "doubly-encoded path" - ** bugs - jrm 97/02/10 */ -#ifdef DEBUG - FSSpec tempSpec; - OSErr err = ::FSMakeFSSpec(0, 0, CStr255(inName), &tempSpec); - Boolean nativeMacPath = (err == noErr || err == fnfErr || err == dirNFErr); - Assert_(nativeMacPath); -#endif - char *duplicatedName = XP_STRDUP(inName); - if (duplicatedName) - { /* YUCK! duplicatedName deleted by CFileMgr::EncodeMacPath */ - char *xp_path = CFileMgr::EncodeMacPath(duplicatedName); - retVal = (char *) XP_ALLOC (XP_STRLEN(xp_path) + XP_STRLEN(prefix) + 1); - if (retVal) - { - XP_STRCPY (retVal, prefix); - XP_STRCAT (retVal, xp_path); - } - if (xp_path) - XP_FREE(xp_path); - } - return retVal; -} - -char *XP_PlatformPartialPathToXPPartialPath(const char *sourceStringWithSpaces) -{ - // convert spaces back to %20 quote char - int numberOfSpaces = 0; - const char *currentSpace = XP_STRSTR(sourceStringWithSpaces, " "); - while (currentSpace) - { - numberOfSpaces++; - currentSpace = XP_STRSTR(currentSpace + 1, " "); - } - - char *escapedReturnString = (char *) XP_ALLOC(XP_STRLEN(sourceStringWithSpaces) + (numberOfSpaces*2) + 1); - if (escapedReturnString) - { - XP_STRCPY(escapedReturnString, sourceStringWithSpaces); - if (numberOfSpaces) - { - char *currentSpace = XP_STRSTR(escapedReturnString, " "); - while (currentSpace) - { - XP_MEMMOVE(currentSpace+3,currentSpace+1,XP_STRLEN(currentSpace+1) + 1); - *currentSpace++ = '%'; - *currentSpace++ = '2'; - *currentSpace++ = '0'; - currentSpace = XP_STRSTR(currentSpace, " "); - } - } - } - - return escapedReturnString; -} - -/* Needs to deal with both CR, CRLF, and LF end-of-line */ -extern char * XP_FileReadLine(char * dest, int32 bufferSize, XP_File file) -{ - char * retBuf = fgets(dest, bufferSize, file); - if (retBuf == NULL) /* EOF */ - return NULL; - char * LFoccurence = (char *)strchr(retBuf, LF); - if (LFoccurence != NULL) /* We have hit LF before CR, */ - { - fseek(file, -(strlen(retBuf) - (LFoccurence - retBuf))+1, SEEK_CUR); - LFoccurence[1] = 0; - } - else /* We have CR, check if the next character is LF */ - { - int c; - - c = fgetc(file); - - if (c == EOF) - ; /* Do nothing, end of file */ - else if (c == LF) /* Swallow CR/LF */ - { - int len = strlen(retBuf); - if (len < bufferSize) /* Append LF to our buffer if we can */ - { - retBuf[len++] = LF; - retBuf[len] = 0; - } - } - else /* No LF, just clean up the seek */ - { - fseek(file, -1, SEEK_CUR); - } - } - return retBuf; -} - -static counter = 1; /* temporary name suffix */ - -/* Returns a temp name given a path - */ -char * xp_TempName(XP_FileType type, const char * prefix, char* buf, char* /* buf2 */, unsigned int * /* count */) -{ - FSSpec tempSpec; - CStr255 defaultName(prefix); - OSErr err = noErr; - - switch (type) { - case xpTemporaryNewsRC: - defaultName = "temp newsrc"; - break; - break; - case xpCache: - defaultName = CacheFilePrefix; - CStr255 dateString; - ::NumToString (::TickCount(), dateString); - defaultName += dateString; - break; - case xpBookmarks: - defaultName += ".bak"; - break; - case xpJPEGFile: - defaultName += ".jpeg"; - break; - case xpMailFolder: /* Ugly. MailFolder callers for temporary names pass in the full path */ - case xpMailFolderSummary: /* Ugly. MailFolder callers for temporary names pass in the full path */ - { - FSSpec temp; - err = XP_FileSpec(prefix, xpMailFolder, &temp); - if (err == noErr) - defaultName = temp.name; - } - case xpFileToPost: /* Temporary files to post return the full path */ - - case xpTemporary: - default: - if ( (type == xpURL) && prefix ) - { - if ( XP_STRRCHR(prefix, '/') ) - { - XP_StatStruct st; - if (XP_Stat (defaultName, &st, xpURL)) - XP_MakeDirectoryR (defaultName, xpURL); - defaultName += "su"; - } - } - - if (defaultName.IsEmpty()) - defaultName = "nstemp"; - CStr255 counterS; - ::NumToString(counter++, counterS); - defaultName += counterS; /* Need counter to guarantee uniqueness if called several times in a row */ - break; - } - if (type == xpFileToPost || type == xpMailFolder || type == xpMailFolderSummary || ((type == xpURL) && !prefix)) - { - if (defaultName.Length() > 30) // Someone has passed in something weird as a prefix - { - XP_ASSERT(false); - defaultName.Delete(30, 1000); - } - err = XP_FileSpec(defaultName, xpTemporary, &tempSpec); - } - else - err = XP_FileSpec(defaultName, type, &tempSpec); - - if (err && err != fnfErr) - return NULL; - - FSSpec finalSpec; - err = CFileMgr::UniqueFileSpec(tempSpec, tempSpec.name, finalSpec); - if (err != noErr) - { - XP_ASSERT(FALSE); - return NULL; - } - if ((type == xpFileToPost) || - (type == xpBookmarks) || - (type == xpMailFolder) || - (type == xpURL) || - (type == xpMailFolderSummary)) - /* These files needs full pathname */ - { - char* tempPath = CFileMgr::PathNameFromFSSpec( finalSpec, TRUE ); - tempPath = CFileMgr::EncodeMacPath(tempPath); - if (tempPath == NULL) - return NULL; - else if (XP_STRLEN(tempPath) > 500) /* Buffer overflow check */ - { - XP_FREE(tempPath); - return NULL; - } - XP_STRCPY(buf, tempPath); - XP_FREE(tempPath); - } - else - XP_STRCPY(buf, CStr63(finalSpec.name)); - return buf; -} /* xp_TempName */ - - - -/* XP_OpenDir is not handling different directories yet. */ -XP_Dir XP_OpenDir( const char* name, XP_FileType type ) -{ - CInfoPBRec pb; - OSErr err; - DirInfo* dipb; - struct dirstruct * dir = XP_NEW(struct dirstruct); - - if (dir == NULL) - return NULL; - - XP_TRACE(( "opening file: %s", name )); - dir->type = type; - - err = XP_FileSpec( name, type, &dir->dirSpecs ); - if ( err != noErr ) - { - XP_DELETE(dir); - return NULL; - } - - dipb = (DirInfo*)&pb; - - pb.hFileInfo.ioNamePtr = dir->dirSpecs.name; - pb.hFileInfo.ioVRefNum = dir->dirSpecs.vRefNum; - pb.hFileInfo.ioDirID = dir->dirSpecs.parID; - pb.hFileInfo.ioFDirIndex = 0; /* use ioNamePtr and ioDirID */ - - err = PBGetCatInfoSync( &pb ); - - /* test that we have gotten a directory back, not a file */ - if ( (err != noErr ) || !( dipb->ioFlAttrib & 0x0010 ) ) - { - XP_DELETE( dir ); - return NULL; - } - dir->dirSpecs.parID = pb.hFileInfo.ioDirID; - dir->index = pb.dirInfo.ioDrNmFls; - - return (XP_Dir)dir; -} - -void XP_CloseDir( XP_Dir dir ) -{ - if ( dir ) - XP_DELETE(dir); -} - -int XP_FileNumberOfFilesInDirectory(const char * dir_name, XP_FileType type) -{ - FSSpec spec; - OSErr err = XP_FileSpec(dir_name, type, &spec); - if ((err != noErr) && (err != fnfErr)) - goto loser; - CInfoPBRec pb; - pb.hFileInfo.ioNamePtr = spec.name; - pb.hFileInfo.ioVRefNum = spec.vRefNum; - pb.hFileInfo.ioDirID = spec.parID; - pb.hFileInfo.ioFDirIndex = 0; /* use ioNamePtr and ioDirID */ - err = PBGetCatInfoSync(&pb); - if (err != noErr) - goto loser; - return pb.dirInfo.ioDrNmFls; -loser: - return 10000; /* ???? */ -} - -XP_DirEntryStruct * XP_ReadDir(XP_Dir dir) -{ -tryagain: - if (dir->index <= 0) - return NULL; - CInfoPBRec cipb; - DirInfo *dipb=(DirInfo *)&cipb; - dipb->ioCompletion = NULL; - dipb->ioFDirIndex = dir->index; - dipb->ioVRefNum = dir->dirSpecs.vRefNum; /* Might need to use vRefNum, not sure*/ - dipb->ioDrDirID = dir->dirSpecs.parID; - dipb->ioNamePtr = (StringPtr)&dir->dirent.d_name; - OSErr err = PBGetCatInfoSync (&cipb); - /* We are traversing the directory backwards */ - if (err != noErr) - { - if (dir->index > 1) - { - dir->index--; - goto tryagain; - } - else - return NULL; - } - p2cstr((StringPtr)&dir->dirent.d_name); - - /* Mail folders are treated in a special way */ - - if ((dir->type == xpMailFolder) || - (dir->type == xpMailFolderSummary) || - (dir->type == xpMailSubdirectory) ) - { - char * newName = XP_STRDUP(dir->dirent.d_name); - newName = CFileMgr::EncodeMacPath(newName); - if (newName) - { - XP_STRCPY(dir->dirent.d_name, newName); - XP_FREE(newName); - } - } - - dir->index--; - return &dir->dirent; -} - -int XP_MakeDirectory(const char* name, XP_FileType type) -{ - FSSpec spec; - OSErr err = XP_FileSpec(name, type, &spec); - if ((err != noErr) && (err != fnfErr)) /* Should not happen */ - return -1; - short refNum; - long dirID; - err = CFileMgr::CreateFolderInFolder( - spec.vRefNum, spec.parID, spec.name, /* Name of the new folder */ - &refNum, &dirID); - if (err != noErr) - return -1; - return 0; -} - -/* Recursively create all the directories - */ -int XP_MakeDirectoryR(const char* name, XP_FileType type) -{ - char separator; - int result = 0; - XP_FILE_NATIVE_PATH finalNameNative = NULL; - XP_FILE_URL_PATH finalName = NULL; - char * dirPath = NULL; - separator = '/'; - - if ( type == xpURL) - finalNameNative = CFileMgr::MacPathFromUnixPath(name); - else - finalNameNative = WH_FileName(name, type); - - if ( finalNameNative == NULL ) - { - result = -1; - goto done; - } - finalName = XP_PlatformFileToURL(finalNameNative); - if ( finalName ) - { - char * currentEnd; - int err = 0; - XP_StatStruct s; - dirPath = XP_STRDUP( &finalName[7] ); // Skip the file:// - if (dirPath == NULL) - { - result = -1; - goto done; - } - - currentEnd = XP_STRCHR(dirPath, separator); - if (currentEnd) - currentEnd = XP_STRCHR(¤tEnd[1], separator); - /* Loop through every part of the directory path */ - while (currentEnd != 0) - { - char savedChar; - savedChar = currentEnd[1]; - currentEnd[1] = 0; - if ( XP_Stat(dirPath, &s, xpURL ) != 0) - err = XP_MakeDirectory(dirPath, xpURL); - if ( err != 0) - { - XP_ASSERT( FALSE ); /* Could not create the directory? */ - break; - } - currentEnd[1] = savedChar; - currentEnd = XP_STRCHR( ¤tEnd[1], separator); - } - if ( err == 0 ) - /* If the path is not terminated with / */ - { - if ( dirPath[XP_STRLEN( dirPath) - 1] != separator ) - if ( XP_Stat(dirPath, &s, xpURL ) != 0) - err = XP_MakeDirectory(dirPath, xpURL); - } - if ( 0 != err ) - result = err; - } - else - result = -1; -done: - XP_FREEIF(finalName); - XP_FREEIF(finalNameNative); - XP_FREEIF(dirPath); - XP_ASSERT( result == 0 ); /* For debugging only */ - return result; -} - -int XP_RemoveDirectory (const char* name, XP_FileType type) -{ - FSSpec spec; - OSErr err = XP_FileSpec(name, type, &spec); - if ((err != noErr) && (err != fnfErr)) - return -1; - err = ::FSpDelete(&spec); - if (err != noErr) - return -1; - return 0; -} - -// Removes the directory and its contents. -int XP_RemoveDirectoryRecursive(const char *name, XP_FileType type) -{ - OSErr err; - FSSpec dirSpec; - - err = XP_FileSpec(name, type, &dirSpec); - if ((err != noErr) && (err != fnfErr)) - return -1; - err = DeleteDirectory(dirSpec.vRefNum, dirSpec.parID, dirSpec.name); - return (err == noErr) ? 0 : -1; -} - -int XP_FileRename( const char* from, XP_FileType fromtype, - const char* to, XP_FileType totype ) -{ - OSErr err = noErr; - - char* fromName = WH_FileName( from, fromtype ); - char* toName = WH_FileName( to, totype ); - - if ( fromName && toName ) - { - FSSpec toSpec; - err = CFileMgr::FSSpecFromPathname( toName, &toSpec ); - if (err == noErr || err == fnfErr) - { - FSSpec fromSpec; - err = CFileMgr::FSSpecFromPathname( fromName, &fromSpec ); - if (err == noErr || err == fnfErr) - { - - if (fromSpec.vRefNum == toSpec.vRefNum) - /* Same volume */ - { - /* But, er, is it the same file (jrm 97/08/20)? */ - if (fromSpec.parID == toSpec.parID - && *(CStr63*)fromSpec.name == *(CStr63*)toSpec.name) - goto Cleanup; // YOW! Don't delete it! - - /* Delete the file */ - ::FSpDelete( &toSpec ); /* ignore error if not there */ - if (fromSpec.parID == toSpec.parID) - { - /* this is a flat node rename use ::FSpRename */ - err = ::FSpRename(&fromSpec, toSpec.name); - } - else - { - /* we are moving a file between dirs so use HMoveRenameCompat */ - err = ::HMoveRenameCompat( - fromSpec.vRefNum, - fromSpec.parID, (ConstStr255Param)fromSpec.name, - toSpec.parID, nil, (StringPtr)toSpec.name); - } - } - else - /* Different volumes */ - { - FSSpec toDir; - err = CFileMgr::FolderSpecFromFolderID(toSpec.vRefNum, toSpec.parID, toDir); - if (err == noErr) - { - ::FSpDelete( &toSpec ); - err = FSpFileCopy( &fromSpec, &toDir, toSpec.name, NULL, 0, true ); - if ( err == noErr) - ::FSpDelete( &fromSpec ); - } - } - } - } - - } - else - err = -1; -Cleanup: - if ( fromName ) - XP_FREE( fromName ); - if ( toName ) - XP_FREE( toName ); - if (err != noErr) - return -1; - return 0; -} - -int XP_FileRemove( const char* name, XP_FileType type ) -{ - FSSpec spec; - OSErr err; - - err = XP_FileSpec( name, type, &spec); - - if ( err == noErr ) - { - err = ::FSpDelete( &spec ); -#ifdef MOZ_MAIL_NEWS - if ( type == xpNewsRC || type == xpNewsgroups ) - NET_UnregisterNewsHost( name, FALSE ); - else if ( type == xpSNewsRC || type == xpSNewsgroups) - NET_UnregisterNewsHost( name, TRUE ); -#endif - } - - if ( err == noErr ) - return 0; - return -1; -} - -int XP_FileTruncate( const char* name, XP_FileType type, int32 len ) -{ - FSSpec spec; - OSErr err, err2; - short refNum; - - if (len < 0) - return EINVAL; - - err = XP_FileSpec( name, type, &spec); - if (err != noErr) - return EINVAL; - - err = FSpOpenDF(&spec, fsRdWrPerm, &refNum); - if (err != noErr) - return EACCES; - - err = SetEOF(refNum, len); - - err2 = FSClose(refNum); - if ((err != noErr) || (err2 != noErr)) - return EIO; - return 0; -} - - -int XP_FileDuplicateResourceFork( const char* oldFilePath, XP_FileType oldType, - const char* newFilePath, XP_FileType newType ) -{ - OSErr err; - FSSpec oldfs, newfs; - err = XP_FileSpec( oldFilePath, oldType, &oldfs); - if (err != noErr) - return EINVAL; - - err = XP_FileSpec( newFilePath, newType, &newfs); - if (err != noErr) - return EINVAL; - - short oldFileRefNum = -1, newFileRefNum = -1; - oldFileRefNum = FSpOpenResFileCompat( &oldfs, fsCurPerm ); - err = ResError(); - if ( err || ( oldFileRefNum == -1 ) ) - { - return EACCES; - } - - // assume we need to create the new resource fork - // (may not be valid assumption for other uses of this function) - FSpCreateResFileCompat( &newfs, emSignature, emTextType, smSystemScript ); - err = ResError(); - - newFileRefNum = FSpOpenResFileCompat( &newfs, fsRdWrPerm ); - err = ResError(); - if ( err || ( newFileRefNum == -1 ) ) - { - err = FSClose( oldFileRefNum ); - XP_ASSERT(0); - return EACCES; - } - - long buffsize = 1024; - char buff[ 1024 ]; - err = CopyFork( oldFileRefNum, newFileRefNum, buff, buffsize); - - FSClose( oldFileRefNum ); - FSClose( newFileRefNum ); - - if ( err ) - return EIO; - - return 0; -} - -//====================================== -// I put these stubs here. They can go away when we move to MSL. -//====================================== - -#include "prenv.h" /* For PR_GetEnv */ -extern "C" { - char* getenv(const char *var); -} - -char* getenv(const char *var) -{ - return PR_GetEnv(var); -} - diff --git a/dom/macbuild/dom.mcp b/dom/macbuild/dom.mcp index bc46c047b37..e08d8cb361e 100644 Binary files a/dom/macbuild/dom.mcp and b/dom/macbuild/dom.mcp differ diff --git a/dom/src/build/nsDOMFactory.cpp b/dom/src/build/nsDOMFactory.cpp index e07d4c2fd1e..f2ace3f306f 100644 --- a/dom/src/build/nsDOMFactory.cpp +++ b/dom/src/build/nsDOMFactory.cpp @@ -660,10 +660,10 @@ nsresult nsDOMFactory::LockFactory(PRBool aLock) } // return the proper factory to the caller -#ifdef XP_MAC +#if defined(XP_MAC) && defined(MAC_STATIC) extern "C" NS_DOM nsresult NSGetFactory_DOM_DLL(const nsCID &aClass, nsIFactory **aFactory) #else -extern "C" NS_DOM nsresult NSGetFactory(const nsCID &aClass, nsIFactory **aFactory) +extern "C" NS_DOM NS_EXPORT_(nsresult) NSGetFactory(const nsCID &aClass, nsIFactory **aFactory) #endif { if (nsnull == aFactory) { diff --git a/gfx/macbuild/GFXSharedDebugPrefix.h b/gfx/macbuild/GFXSharedDebugPrefix.h index c217a4f93fc..e03bec4fbab 100644 --- a/gfx/macbuild/GFXSharedDebugPrefix.h +++ b/gfx/macbuild/GFXSharedDebugPrefix.h @@ -16,6 +16,6 @@ * Reserved. */ -#define GFX_SHARED 1 +#define _IMPL_NS_GFX 1 #include "MacPrefix_debug.h" \ No newline at end of file diff --git a/gfx/macbuild/GFXSharedPrefix.h b/gfx/macbuild/GFXSharedPrefix.h index c7152329892..2e4f7799227 100644 --- a/gfx/macbuild/GFXSharedPrefix.h +++ b/gfx/macbuild/GFXSharedPrefix.h @@ -16,6 +16,6 @@ * Reserved. */ -#define GFX_SHARED 1 +#define _IMPL_NS_GFX 1 -#include "MacPrefix.h" \ No newline at end of file +#include "MacSharedPrefix.h" diff --git a/gfx/macbuild/gfx.mcp b/gfx/macbuild/gfx.mcp index e077ce0a611..24a5826a350 100644 Binary files a/gfx/macbuild/gfx.mcp and b/gfx/macbuild/gfx.mcp differ diff --git a/gfx/src/mac/nsFontMetricsMac.cpp b/gfx/src/mac/nsFontMetricsMac.cpp index a35e35c02bd..23414d336a6 100644 --- a/gfx/src/mac/nsFontMetricsMac.cpp +++ b/gfx/src/mac/nsFontMetricsMac.cpp @@ -179,7 +179,7 @@ NS_IMETHODIMP nsFontMetricsMac :: GetFontHandle(nsFontHandle &aHandle) //------------------------------------------------------------------------ -void nsFontMetricsMac :: SetFont(const nsFont& aFont, nsIDeviceContext* aContext) +NS_GFX void nsFontMetricsMac :: SetFont(const nsFont& aFont, nsIDeviceContext* aContext) { short fontNum; //¥TODO?: This is not very efficient. Look in nsDeviceContextMac::GetMacFontNumber() diff --git a/gfx/src/mac/nsGfxFactoryMac.cpp b/gfx/src/mac/nsGfxFactoryMac.cpp index e2322a6c2e9..a232444bae8 100644 --- a/gfx/src/mac/nsGfxFactoryMac.cpp +++ b/gfx/src/mac/nsGfxFactoryMac.cpp @@ -160,12 +160,10 @@ nsresult nsGfxFactoryMac::LockFactory(PRBool aLock) } // return the proper factory to the caller -#ifdef MAC_STATIC -extern "C" NS_GFXNONXP nsresult NSGetFactory_GFXWIN_DLL(const nsCID &aClass, nsIFactory **aFactory) -#elif defined(MAC_SHARED) -#pragma export on -extern "C" NS_GFXNONXP nsresult NSGetFactory(const nsCID &aClass, nsIFactory **aFactory) -#pragma export off +#if defined(XP_MAC) && defined(MAC_STATIC) +extern "C" NS_GFX nsresult NSGetFactory_GFXWIN_DLL(const nsCID &aClass, nsIFactory **aFactory) +#else +extern "C" NS_GFX nsresult NSGetFactory(const nsCID &aClass, nsIFactory **aFactory) #endif { if (nsnull == aFactory) { diff --git a/htmlparser/macbuild/htmlparser.mcp b/htmlparser/macbuild/htmlparser.mcp index b09981ee3f9..366a4f01a1e 100644 Binary files a/htmlparser/macbuild/htmlparser.mcp and b/htmlparser/macbuild/htmlparser.mcp differ diff --git a/htmlparser/src/nsParserFactory.cpp b/htmlparser/src/nsParserFactory.cpp index ac27179b434..a3e5540234f 100644 --- a/htmlparser/src/nsParserFactory.cpp +++ b/htmlparser/src/nsParserFactory.cpp @@ -158,7 +158,7 @@ nsresult nsParserFactory::LockFactory(PRBool aLock) } // return the proper factory to the caller -#ifdef XP_MAC +#if defined(XP_MAC) && defined(MAC_STATIC) extern "C" NS_EXPORT nsresult NSGetFactory_PARSER_DLL(const nsCID &aClass, nsIFactory **aFactory) #else extern "C" NS_EXPORT nsresult NSGetFactory(const nsCID &aClass, nsIFactory **aFactory) diff --git a/jpeg/macbuild/JPEG.mcp b/jpeg/macbuild/JPEG.mcp index dbf74ce88d9..e1fa0448447 100644 Binary files a/jpeg/macbuild/JPEG.mcp and b/jpeg/macbuild/JPEG.mcp differ diff --git a/layout/build/nsLayoutFactory.cpp b/layout/build/nsLayoutFactory.cpp index eb7e147bb82..5e3c4979fdf 100644 --- a/layout/build/nsLayoutFactory.cpp +++ b/layout/build/nsLayoutFactory.cpp @@ -257,13 +257,8 @@ nsIDOMNativeObjectRegistry *NativeObjectRegistryManager::gRegistry = nsnull; static NativeObjectRegistryManager gManager; // return the proper factory to the caller -#ifdef MAC_STATIC +#if defined(XP_MAC) && defined(MAC_STATIC) extern "C" NS_LAYOUT nsresult NSGetFactory_LAYOUT_DLL(const nsCID &aClass, nsIFactory **aFactory) -#elif defined(MAC_SHARED) -#pragma export on -extern "C" NS_LAYOUT nsresult NSGetFactory(const nsCID &aClass, nsIFactory **aFactory) -#pragma export off -// for non-mac platforms: #else extern "C" NS_LAYOUT nsresult NSGetFactory(const nsCID &aClass, nsIFactory **aFactory) #endif diff --git a/layout/macbuild/layout.mcp b/layout/macbuild/layout.mcp index 07d583cbae8..ed36d58f62c 100644 Binary files a/layout/macbuild/layout.mcp and b/layout/macbuild/layout.mcp differ diff --git a/lib/mac/Misc/mactime.c b/lib/mac/Misc/mactime.c index e5882f0c92c..a4f58a5a329 100644 --- a/lib/mac/Misc/mactime.c +++ b/lib/mac/Misc/mactime.c @@ -31,6 +31,13 @@ _END_C_LIB_DECL #endif #include +#ifndef __OSUTILS__ +#include +#endif +#ifndef __TOOLUTILS__ +#include +#endif + // Because serial port and SLIP conflict with ReadXPram calls, // we cache the call here // The symptoms are the @@ -41,11 +48,11 @@ long GMTDelta(); void MyReadLocation(MachineLocation * loc) { static MachineLocation storedLoc; // InsideMac, OSUtilities, page 4-20 - static Boolean didReadLocation = FALSE; + static Boolean didReadLocation = false; if (!didReadLocation) { ReadLocation(&storedLoc); - didReadLocation = TRUE; + didReadLocation = true; } *loc = storedLoc; } diff --git a/lib/xp/xp_stub.c b/lib/xp/xp_stub.c index d85cffbf7e2..37cf00c6f5d 100644 --- a/lib/xp/xp_stub.c +++ b/lib/xp/xp_stub.c @@ -31,10 +31,12 @@ NOT_NULL (const char *x) #endif +#ifdef DEBUG void XP_AssertAtLine( char *pFileName, int iLine ) { PR_Assert("XP Assert", pFileName, iLine); } +#endif /* XP_GetString * diff --git a/modules/libimg/macbuild/libimg.mcp b/modules/libimg/macbuild/libimg.mcp index d2514222f1b..a163391d172 100644 Binary files a/modules/libimg/macbuild/libimg.mcp and b/modules/libimg/macbuild/libimg.mcp differ diff --git a/modules/libimg/src/xpcompat.cpp b/modules/libimg/src/xpcompat.cpp index a5c5008a91e..24502e86f94 100644 --- a/modules/libimg/src/xpcompat.cpp +++ b/modules/libimg/src/xpcompat.cpp @@ -25,6 +25,7 @@ * of the XP_ library. */ #include "xpcompat.h" +#include "xp_mcom.h" #include /* BSDI did not have this header and we do not need it here. -slamm */ /* #include */ @@ -41,7 +42,6 @@ extern ilISystemServices *il_ss; #include #endif /* XP_PC */ -#ifndef XP_MAC PR_BEGIN_EXTERN_C int MK_UNABLE_TO_LOCATE_FILE = -1; int MK_OUT_OF_MEMORY = -2; @@ -68,7 +68,6 @@ int XP_MSG_COMMENT = -25; int XP_MSG_UNKNOWN = -26; int XP_MSG_COMPRESS_REMOVE = -27; PR_END_EXTERN_C -#endif /* XP_MAC */ char *XP_GetString(int i) { @@ -120,8 +119,8 @@ static void swap(char *p, char *q, unsigned int width); void XP_QSORT ( void *base, - unsigned num, - unsigned width, + size_t num, + size_t width, int ( *comp)(const void *, const void *) ) { @@ -369,10 +368,60 @@ static void swap ( #endif /* SOLARIS or XP_MAC */ +#ifdef XP_MAC +#include + +static void MyReadLocation(MachineLocation * loc) +{ + static MachineLocation storedLoc; // InsideMac, OSUtilities, page 4-20 + static Boolean didReadLocation = FALSE; + if (!didReadLocation) + { + ReadLocation(&storedLoc); + didReadLocation = TRUE; + } + *loc = storedLoc; +} + +// current local time = GMTDelta() + GMT +// GMT = local time - GMTDelta() +static long GMTDelta() +{ + MachineLocation loc; + long gmtDelta; + + MyReadLocation(&loc); + gmtDelta = loc.u.gmtDelta & 0x00FFFFFF; + if ((gmtDelta & 0x00800000) != 0) + gmtDelta |= 0xFF000000; + return gmtDelta; +} + +// This routine simulates stdclib time(), time in seconds since 1.1.1970 +// The time is in GMT +time_t GetTimeMac() +{ + unsigned long maclocal; + // Get Mac local time + GetDateTime(&maclocal); + // Get Mac GMT + maclocal -= GMTDelta(); + // return unix GMT + return (maclocal - UNIXMINUSMACTIME); +} + +// Returns the GMT times +time_t Mactime(time_t *timer) +{ + time_t t = GetTimeMac(); + if (timer != NULL) + *timer = t; + return t; +} +#endif /* XP_MAC */ /* Allocate a new copy of a block of binary data, and returns it */ -#ifndef XP_MAC char * NET_BACopy (char **destination, const char *source, size_t length) { @@ -395,7 +444,6 @@ NET_BACopy (char **destination, const char *source, size_t length) } return *destination; } -#endif /* XP_MAC */ /* binary block Allocate and Concatenate * @@ -403,7 +451,6 @@ NET_BACopy (char **destination, const char *source, size_t length) * source_length is the length of the block being added to the * destination block */ -#ifndef XP_MAC char * NET_BACat (char **destination, size_t destination_length, @@ -433,11 +480,9 @@ NET_BACat (char **destination, return *destination; } -#endif /* XP_MAC */ /* Very similar to strdup except it free's too */ -#ifndef XP_MAC char * NET_SACopy (char **destination, const char *source) { @@ -460,11 +505,9 @@ NET_SACopy (char **destination, const char *source) } return *destination; } -#endif /* XP_MAC */ /* Again like strdup but it concatinates and free's and uses Realloc */ -#ifndef XP_MAC char * NET_SACat (char **destination, const char *source) { @@ -490,7 +533,6 @@ NET_SACat (char **destination, const char *source) } return *destination; } -#endif /* XP_MAC */ #if 0 #include @@ -770,14 +812,14 @@ static void wfe_ProcessTimeouts(DWORD dwNow) dwSyncHack = 0; } #else -void * +NS_EXPORT void * FE_SetTimeout(TimeoutCallbackFunction func, void * closure, uint32 msecs) { return il_ss->SetTimeout((ilTimeoutCallbackFunction)func, closure, msecs); } -void +NS_EXPORT void FE_ClearTimeout(void *timer_id) { il_ss->ClearTimeout(timer_id); diff --git a/modules/libpref/macbuild/libpref.mcp b/modules/libpref/macbuild/libpref.mcp index 1e70636d7ad..c13104103da 100644 Binary files a/modules/libpref/macbuild/libpref.mcp and b/modules/libpref/macbuild/libpref.mcp differ diff --git a/modules/libpref/src/mac/MacPrefUtils.cpp b/modules/libpref/src/mac/MacPrefUtils.cpp index 82458b63ccc..fb196ae73af 100644 --- a/modules/libpref/src/mac/MacPrefUtils.cpp +++ b/modules/libpref/src/mac/MacPrefUtils.cpp @@ -26,7 +26,9 @@ #include #include "prmem.h" +#include "plstr.h" #include "FullPath.h" +#include "net.h" // Returns a full pathname to the given file // Returned value is allocated with XP_ALLOC, and must be freed with XP_FREE @@ -175,8 +177,8 @@ static char* encodeMacPath(char* inPath, Boolean prependSlash) if (newPath != NULL) { swapSlashColon(newPath); - // finalPath = NET_Escape(newPath, URL_PATH); - // XP_FREE(newPath); + finalPath = NET_Escape(newPath, URL_PATH); + XP_FREE(newPath); } PR_Free( inPath ); @@ -201,7 +203,7 @@ static char* macPathFromUnixPath(const char* unixPath) else if (strchr(src, '/')) // ¥ partial path, and not just a leaf name *dst++ = ':'; strcpy(dst, src); - // NET_UnEscape(dst); // Hex Decode + NET_UnEscape(dst); // Hex Decode swapSlashColon(dst); } return result; @@ -275,3 +277,137 @@ Boolean FileExists(const FSSpec& fsSpec) return (err == noErr); } + + +// beard: brought over from mkparse.c to break dependency. + +/* encode illegal characters into % escaped hex codes. + * + * mallocs and returns a string that must be freed + */ +static int netCharType[256] = +/* Bit 0 xalpha -- the alphas +** Bit 1 xpalpha -- as xalpha but +** converts spaces to plus and plus to %20 +** Bit 3 ... path -- as xalphas but doesn't escape '/' +*/ + /* 0 1 2 3 4 5 6 7 8 9 A B C D E F */ + { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0x */ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 1x */ + 0,0,0,0,0,0,0,0,0,0,7,4,0,7,7,4, /* 2x !"#$%&'()*+,-./ */ + 7,7,7,7,7,7,7,7,7,7,0,0,0,0,0,0, /* 3x 0123456789:;<=>? */ + 0,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, /* 4x @ABCDEFGHIJKLMNO */ + /* bits for '@' changed from 7 to 0 so '@' can be escaped */ + /* in usernames and passwords in publishing. */ + 7,7,7,7,7,7,7,7,7,7,7,0,0,0,0,7, /* 5X PQRSTUVWXYZ[\]^_ */ + 0,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, /* 6x `abcdefghijklmno */ + 7,7,7,7,7,7,7,7,7,7,7,0,0,0,0,0, /* 7X pqrstuvwxyz{\}~ DEL */ + 0, }; + +#define HEX_ESCAPE '%' + +#define IS_OK(C) (netCharType[((unsigned int) (C))] & (mask)) + +PUBLIC char * +NET_Escape (const char * str, int mask) +{ + if(!str) + return NULL; + return NET_EscapeBytes (str, (int32)PL_strlen(str), mask, NULL); +} + +PUBLIC char * +NET_EscapeBytes (const char * str, int32 len, int mask, int32 * out_len) +{ + register const unsigned char *src; + register unsigned char *dst; + char *result; + int32 i, extra = 0; + char *hexChars = "0123456789ABCDEF"; + + if(!str) + return(0); + + src = (unsigned char *) str; + for(i = 0; i < len; i++) + { + if (!IS_OK(src[i])) + extra+=2; /* the escape, plus an extra byte for each nibble */ + } + + if(!(result = (char *) PR_Malloc(len + extra + 1))) + return(0); + + dst = (unsigned char *) result; + for(i = 0; i < len; i++) + { + unsigned char c = src[i]; + if (IS_OK(c)) + { + *dst++ = c; + } + else if(mask == URL_XPALPHAS && c == ' ') + { + *dst++ = '+'; /* convert spaces to pluses */ + } + else + { + *dst++ = HEX_ESCAPE; + *dst++ = hexChars[c >> 4]; /* high nibble */ + *dst++ = hexChars[c & 0x0f]; /* low nibble */ + } + } + + *dst = '\0'; /* tack on eos */ + if(out_len) + *out_len = dst - (unsigned char *) result; + return result; +} + +/* decode % escaped hex codes into character values + */ +#define UNHEX(C) \ + ((C >= '0' && C <= '9') ? C - '0' : \ + ((C >= 'A' && C <= 'F') ? C - 'A' + 10 : \ + ((C >= 'a' && C <= 'f') ? C - 'a' + 10 : 0))) + +PUBLIC int +NET_UnEscapeCnt (char * str) +{ + register char *src = str; + register char *dst = str; + + while(*src) + if (*src != HEX_ESCAPE) + { + *dst++ = *src++; + } + else + { + src++; /* walk over escape */ + if (*src) + { + *dst = UNHEX(*src) << 4; + src++; + } + if (*src) + { + *dst = (*dst + UNHEX(*src)); + src++; + } + dst++; + } + + *dst = 0; + + return (int)(dst - str); + +} /* NET_UnEscapeCnt */ + +PUBLIC char * +NET_UnEscape(char * str) +{ + (void)NET_UnEscapeCnt(str); + + return str; +} diff --git a/modules/libpref/src/mac/macpref.cp b/modules/libpref/src/mac/macpref.cp index 8ddf7795f5b..32c1174ce93 100644 --- a/modules/libpref/src/mac/macpref.cp +++ b/modules/libpref/src/mac/macpref.cp @@ -20,13 +20,26 @@ #include "prefapi.h" #include "jsapi.h" #include "prlink.h" + +#if 0 +// beard these are old world APIs that must be excised in the new world. +#include "LString.h" #include "ufilemgr.h" #include "uprefd.h" -#include "LString.h" +#endif -#include +#include "MacPrefUtils.h" + +#ifndef __RESOURCES__ #include +#endif +#ifndef __MEMORY__ #include +#endif +#ifndef __ALIASES__ +#include +#endif + /* * Mac-specific libpref routines @@ -111,7 +124,7 @@ PREF_CopyPathPref(const char *pref_name, char ** return_buffer) if (err != noErr) return PREF_ERROR; // bad alias - *return_buffer = CFileMgr::EncodedPathNameFromFSSpec(fileSpec, TRUE); + *return_buffer = EncodedPathNameFromFSSpec(fileSpec, TRUE); return PREF_NOERROR; } @@ -121,7 +134,7 @@ PREF_SetPathPref(const char *pref_name, const char *path, PRBool set_default) { FSSpec fileSpec; AliasHandle aliasH; - OSErr err = CFileMgr::FSSpecFromLocalUnixPath(path, &fileSpec); + OSErr err = FSSpecFromLocalUnixPath(path, &fileSpec); if (err != noErr) return PREF_ERROR; @@ -142,6 +155,7 @@ PREF_SetPathPref(const char *pref_name, const char *path, PRBool set_default) return result; } +#if 0 /* Looks for AutoAdminLib in Essential Files and returns FSSpec */ Boolean pref_FindAutoAdminLib(FSSpec& spec) @@ -154,10 +168,14 @@ pref_FindAutoAdminLib(FSSpec& spec) return CFileMgr::FileExists(spec); } +#endif PR_IMPLEMENT(PRBool) PREF_IsAutoAdminEnabled() { +#if 0 FSSpec spec; return (XP_Bool) pref_FindAutoAdminLib(spec); +#endif + return PR_FALSE; } diff --git a/modules/libpref/src/nsPref.cpp b/modules/libpref/src/nsPref.cpp index 8120fc9451f..5c5901d1904 100644 --- a/modules/libpref/src/nsPref.cpp +++ b/modules/libpref/src/nsPref.cpp @@ -586,11 +586,7 @@ nsresult nsPrefFactory::CreateInstance(nsISupports *aDelegate, return res; } -#ifdef XP_MAC -extern "C" NS_EXPORT nsresult NSGetFactory_PREF_DLL(const nsCID &aCID, nsIFactory **aFactory) -#else extern "C" NS_EXPORT nsresult NSGetFactory(const nsCID &aCID, nsIFactory **aFactory) -#endif { if (aFactory == NULL) { return NS_ERROR_NULL_POINTER; @@ -607,11 +603,7 @@ extern "C" NS_EXPORT nsresult NSGetFactory(const nsCID &aCID, nsIFactory **aFact return NS_NOINTERFACE; } -#ifdef XP_MAC -extern "C" NS_EXPORT PRBool NSCanUnload_PREF_DLL() -#else extern "C" NS_EXPORT PRBool NSCanUnload() -#endif { return PRBool(g_InstanceCount == 0 && g_LockCount == 0); } diff --git a/modules/libpref/src/prefapi.c b/modules/libpref/src/prefapi.c index 0c974f64162..05f314ca7be 100644 --- a/modules/libpref/src/prefapi.c +++ b/modules/libpref/src/prefapi.c @@ -2225,10 +2225,26 @@ pref_ErrorReporter(JSContext *cx, const char *message, } } +#if defined(XP_MAC) + +#include +#include + +void pref_Alert(char* msg) +{ + Str255 pmsg; + SInt16 itemHit; + pmsg[0] = strlen(msg); + BlockMoveData(msg, pmsg + 1, pmsg[0]); + StandardAlert(kAlertPlainAlert, "\pNetscape -- JS Preference Warning", pmsg, NULL, &itemHit); +} + +#else + /* Platform specific alert messages */ void pref_Alert(char* msg) { -#if defined(XP_MAC) || defined(XP_UNIX) || defined(XP_OS2) +#if defined(XP_UNIX) || defined(XP_OS2) #if defined(XP_UNIX) if ( getenv("NO_PREF_SPAM") == NULL ) #endif @@ -2239,6 +2255,7 @@ void pref_Alert(char* msg) #endif } +#endif #ifdef XP_WIN16 #define ADMNLIBNAME "adm1640.dll" diff --git a/modules/libpref/src/prefapi.cpp b/modules/libpref/src/prefapi.cpp index 0c974f64162..05f314ca7be 100644 --- a/modules/libpref/src/prefapi.cpp +++ b/modules/libpref/src/prefapi.cpp @@ -2225,10 +2225,26 @@ pref_ErrorReporter(JSContext *cx, const char *message, } } +#if defined(XP_MAC) + +#include +#include + +void pref_Alert(char* msg) +{ + Str255 pmsg; + SInt16 itemHit; + pmsg[0] = strlen(msg); + BlockMoveData(msg, pmsg + 1, pmsg[0]); + StandardAlert(kAlertPlainAlert, "\pNetscape -- JS Preference Warning", pmsg, NULL, &itemHit); +} + +#else + /* Platform specific alert messages */ void pref_Alert(char* msg) { -#if defined(XP_MAC) || defined(XP_UNIX) || defined(XP_OS2) +#if defined(XP_UNIX) || defined(XP_OS2) #if defined(XP_UNIX) if ( getenv("NO_PREF_SPAM") == NULL ) #endif @@ -2239,6 +2255,7 @@ void pref_Alert(char* msg) #endif } +#endif #ifdef XP_WIN16 #define ADMNLIBNAME "adm1640.dll" diff --git a/network/macbuild/network.mcp b/network/macbuild/network.mcp index 3cdd0c50265..3cbb2946f02 100644 Binary files a/network/macbuild/network.mcp and b/network/macbuild/network.mcp differ diff --git a/network/module/nsNetFactory.cpp b/network/module/nsNetFactory.cpp index 6b63603f4e3..166b73a432a 100644 --- a/network/module/nsNetFactory.cpp +++ b/network/module/nsNetFactory.cpp @@ -15,6 +15,7 @@ * Copyright (C) 1998 Netscape Communications Corporation. All Rights * Reserved. */ + #include "nscore.h" #include "nsIFactory.h" #include "nsISupports.h" @@ -143,7 +144,7 @@ nsresult nsNetFactory::LockFactory(PRBool aLock) } // return the proper factory to the caller -#ifdef XP_MAC +#if defined(XP_MAC) && defined(MAC_STATIC) extern "C" NS_NET nsresult NSGetFactory_NETLIB_DLL(const nsCID &aClass, nsIFactory **aFactory) #else extern "C" NS_NET nsresult NSGetFactory(const nsCID &aClass, nsIFactory **aFactory) diff --git a/parser/htmlparser/macbuild/htmlparser.mcp b/parser/htmlparser/macbuild/htmlparser.mcp index b09981ee3f9..366a4f01a1e 100644 Binary files a/parser/htmlparser/macbuild/htmlparser.mcp and b/parser/htmlparser/macbuild/htmlparser.mcp differ diff --git a/parser/htmlparser/src/nsParserFactory.cpp b/parser/htmlparser/src/nsParserFactory.cpp index ac27179b434..a3e5540234f 100644 --- a/parser/htmlparser/src/nsParserFactory.cpp +++ b/parser/htmlparser/src/nsParserFactory.cpp @@ -158,7 +158,7 @@ nsresult nsParserFactory::LockFactory(PRBool aLock) } // return the proper factory to the caller -#ifdef XP_MAC +#if defined(XP_MAC) && defined(MAC_STATIC) extern "C" NS_EXPORT nsresult NSGetFactory_PARSER_DLL(const nsCID &aClass, nsIFactory **aFactory) #else extern "C" NS_EXPORT nsresult NSGetFactory(const nsCID &aClass, nsIFactory **aFactory) diff --git a/view/macbuild/view.mcp b/view/macbuild/view.mcp index 2da763ba1bf..8547b432ae0 100644 Binary files a/view/macbuild/view.mcp and b/view/macbuild/view.mcp differ diff --git a/view/src/nsViewFactory.cpp b/view/src/nsViewFactory.cpp index 63557db3dc5..d78d56c9d03 100644 --- a/view/src/nsViewFactory.cpp +++ b/view/src/nsViewFactory.cpp @@ -150,12 +150,8 @@ nsresult nsViewFactory::LockFactory(PRBool aLock) } // return the proper factory to the caller -#ifdef MAC_STATIC +#if defined(XP_MAC) && defined(MAC_STATIC) extern "C" NS_VIEW nsresult NSGetFactory_VIEW_DLL(const nsCID &aClass, nsIFactory **aFactory) -#elif defined(MAC_SHARED) -#pragma export on -extern "C" NS_VIEW nsresult NSGetFactory(const nsCID &aClass, nsIFactory **aFactory) -#pragma export off #else extern "C" NS_VIEW nsresult NSGetFactory(const nsCID &aClass, nsIFactory **aFactory) #endif diff --git a/webshell/macbuild/webshell.mcp b/webshell/macbuild/webshell.mcp index 6a3ec3655fe..efa1fa6f645 100644 Binary files a/webshell/macbuild/webshell.mcp and b/webshell/macbuild/webshell.mcp differ diff --git a/webshell/src/nsDLLFactory.cpp b/webshell/src/nsDLLFactory.cpp index ee9c0da0940..20b2084d7f3 100644 --- a/webshell/src/nsDLLFactory.cpp +++ b/webshell/src/nsDLLFactory.cpp @@ -27,12 +27,8 @@ static NS_DEFINE_IID(kThrobberCID, NS_THROBBER_CID); static NS_DEFINE_IID(kWebShellCID, NS_WEB_SHELL_CID); -#ifdef MAC_STATIC +#if defined(XP_MAC) && defined(MAC_STATIC) extern "C" NS_WEB nsresult NSGetFactory_WEB_DLL(const nsCID& aClass, nsIFactory** aFactory) -#elif defined(MAC_SHARED) -#pragma export on -extern "C" NS_WEB nsresult NSGetFactory(const nsCID& aClass, nsIFactory** aFactory) -#pragma export on #else extern "C" NS_WEB nsresult NSGetFactory(const nsCID& aClass, nsIFactory** aFactory) #endif diff --git a/webshell/tests/viewer/mac/viewer.mcp b/webshell/tests/viewer/mac/viewer.mcp index a7cbeb5ca78..6fd137f48d9 100644 Binary files a/webshell/tests/viewer/mac/viewer.mcp and b/webshell/tests/viewer/mac/viewer.mcp differ diff --git a/webshell/tests/viewer/macToBeImplemented.cp b/webshell/tests/viewer/macToBeImplemented.cp index d02a4f7e45a..72c8a1aec3c 100644 --- a/webshell/tests/viewer/macToBeImplemented.cp +++ b/webshell/tests/viewer/macToBeImplemented.cp @@ -47,3 +47,79 @@ char * XP_FileReadLine(char * dest, int32 bufferSize, XP_File file) return NULL; } +#include "il_strm.h" + +/* Given the first few bytes of a stream, identify the image format */ +static int +il_type(int suspected_type, const char *buf, int32 len) +{ + int i; + + if (len >= 4 && !strncmp(buf, "GIF8", 4)) + { + return IL_GIF; + } + + /* for PNG */ + if (len >= 4 && ((unsigned char)buf[0]==0x89 && + (unsigned char)buf[1]==0x50 && + (unsigned char)buf[2]==0x4E && + (unsigned char)buf[3]==0x47)) + { + return IL_PNG; + } + + + /* JFIF files start with SOI APP0 but older files can start with SOI DQT + * so we test for SOI followed by any marker, i.e. FF D8 FF + * this will also work for SPIFF JPEG files if they appear in the future. + * + * (JFIF is 0XFF 0XD8 0XFF 0XE0 0X4A 0X46 0X49 0X46 0X00) + */ + if (len >= 3 && + ((unsigned char)buf[0])==0xFF && + ((unsigned char)buf[1])==0xD8 && + ((unsigned char)buf[2])==0xFF) + { + return IL_JPEG; + } + + /* no simple test for XBM vs, say, XPM so punt for now */ + if (len >= 8 && !strncmp(buf, "#define ", 8) ) + { + /* Don't contradict the given type, since this ID isn't definitive */ + if ((suspected_type == IL_UNKNOWN) || (suspected_type == IL_XBM)) + return IL_XBM; + } + + if (len < 35) + { + /* ILTRACE(1,("il: too few bytes to determine type")); */ + return suspected_type; + } + + /* all the servers return different formats so root around */ + for (i=0; i<28; i++) + { + if (!strncmp(&buf[i], "Not Fou", 7)) + return IL_NOTFOUND; + } + + return suspected_type; +} + +/* + * determine what kind of image data we are dealing with + */ +extern "C" +int IL_Type(const char *buf, int32 len) +{ + return il_type(IL_UNKNOWN, buf, len); +} + +/* Set limit on approximate size, in bytes, of all pixmap storage used + by the imagelib. */ +extern "C" +void IL_SetCacheSize(uint32 new_size) +{ +} diff --git a/webshell/tests/viewer/nsSetupRegistry.cpp b/webshell/tests/viewer/nsSetupRegistry.cpp index 18b4fdd21f9..a5ba0bdfaf9 100644 --- a/webshell/tests/viewer/nsSetupRegistry.cpp +++ b/webshell/tests/viewer/nsSetupRegistry.cpp @@ -16,14 +16,8 @@ * Corporation. Portions created by Netscape are Copyright (C) 1998 * Netscape Communications Corporation. All Rights Reserved. */ -#ifdef XP_MAC -#include "nsIPref.h" -#define NS_IMPL_IDS -#else #define NS_IMPL_IDS #include "nsIPref.h" -#endif - #include "nsRepository.h" #include "nsWidgetsCID.h" #include "nsGfxCIID.h" diff --git a/widget/macbuild/WidgetSharedDebugPrefix.h b/widget/macbuild/WidgetSharedDebugPrefix.h index e88b07244fa..465e3fb085e 100644 --- a/widget/macbuild/WidgetSharedDebugPrefix.h +++ b/widget/macbuild/WidgetSharedDebugPrefix.h @@ -17,5 +17,6 @@ */ #define MAC_SHARED 1 +#define _IMPL_NS_WIDGET 1 -#include "WidgetDebug.prefix" \ No newline at end of file +#include "WidgetDebug.prefix" diff --git a/widget/macbuild/WidgetSharedPrefix.h b/widget/macbuild/WidgetSharedPrefix.h index 6e439546916..8d654d09c04 100644 --- a/widget/macbuild/WidgetSharedPrefix.h +++ b/widget/macbuild/WidgetSharedPrefix.h @@ -17,5 +17,6 @@ */ #define MAC_SHARED 1 +#define _IMPL_NS_WIDGET 1 -#include "Widget.prefix" \ No newline at end of file +#include "Widget.prefix" diff --git a/widget/macbuild/widget.mcp b/widget/macbuild/widget.mcp index c99472a55a6..2df4b5ef235 100644 Binary files a/widget/macbuild/widget.mcp and b/widget/macbuild/widget.mcp differ diff --git a/widget/src/mac/nsMacMessagePump.cpp b/widget/src/mac/nsMacMessagePump.cpp index 32acbdeb844..9a13556a73e 100644 --- a/widget/src/mac/nsMacMessagePump.cpp +++ b/widget/src/mac/nsMacMessagePump.cpp @@ -51,7 +51,7 @@ const char MOUSEMOVEDMESSAGE = 0xFA; //nsWindow* nsMacMessagePump::gGrabWindow = nsnull; // need this for grabmouse //static NS_DEFINE_IID(kITEXTWIDGETIID, NS_TEXTFIELD_CID); -nsMacMessagePump::nsWindowlessMenuEventHandler nsMacMessagePump::gWindowlessMenuEventHandler = nsnull; +NS_WIDGET nsMacMessagePump::nsWindowlessMenuEventHandler nsMacMessagePump::gWindowlessMenuEventHandler = nsnull; bool IsUserWindow ( WindowPtr ) ; diff --git a/widget/src/mac/nsWidgetFactory.cpp b/widget/src/mac/nsWidgetFactory.cpp index 4cad9ea6b63..84e1c397cfc 100644 --- a/widget/src/mac/nsWidgetFactory.cpp +++ b/widget/src/mac/nsWidgetFactory.cpp @@ -106,7 +106,8 @@ private: nsWidgetFactory::nsWidgetFactory(const nsCID &aClass) -{ +{ + NS_INIT_REFCNT(); mClassID = aClass; } @@ -261,12 +262,10 @@ nsresult nsWidgetFactory::LockFactory(PRBool aLock) } // return the proper factory to the caller -#ifdef MAC_STATIC +#if defined(XP_MAC) && defined(MAC_STATIC) extern "C" NS_WIDGET nsresult NSGetFactory_WIDGET_DLL(const nsCID &aClass, nsIFactory **aFactory) -#elif defined(MAC_SHARED) -#pragma export on +#else extern "C" NS_WIDGET nsresult NSGetFactory(const nsCID &aClass, nsIFactory **aFactory) -#pragma export off #endif { if (nsnull == aFactory) { @@ -281,5 +280,3 @@ extern "C" NS_WIDGET nsresult NSGetFactory(const nsCID &aClass, nsIFactory **aFa return (*aFactory)->QueryInterface(kIFactoryIID, (void**)aFactory); } - - diff --git a/xpcom/components/nsMacRepository.h b/xpcom/components/nsMacRepository.h index 7ead8aa1b1f..689230d582b 100644 --- a/xpcom/components/nsMacRepository.h +++ b/xpcom/components/nsMacRepository.h @@ -68,6 +68,7 @@ extern "C" PRBool NSCanUnload_PREF_DLL(void); // library list static MacLibrary libraries[] = { +#if 0 WIDGET_DLL, NSGetFactory_WIDGET_DLL, NULL, GFXWIN_DLL, NSGetFactory_GFXWIN_DLL, NULL, VIEW_DLL, NSGetFactory_VIEW_DLL, NULL, @@ -79,7 +80,9 @@ static MacLibrary libraries[] = { LAYOUT_DLL, NSGetFactory_LAYOUT_DLL, NULL, NETLIB_DLL, NSGetFactory_NETLIB_DLL, NULL, //EDITOR_DLL, NSGetFactory_EDITOR_DLL, NULL, // FIX ME - NULL}; +#endif + NULL +}; static void* FindMacSymbol(char* libName, const char *symbolName) { diff --git a/xpcom/components/nsRepository.cpp b/xpcom/components/nsRepository.cpp index d7370d4a763..206489f966a 100644 --- a/xpcom/components/nsRepository.cpp +++ b/xpcom/components/nsRepository.cpp @@ -37,12 +37,14 @@ #include "NSReg.h" #endif +#if 0 #ifdef XP_MAC #ifdef MOZ_NGLAYOUT #define IMPL_MAC_REPOSITORY #include "nsMacRepository.h" #endif #endif +#endif nsHashtable *nsRepository::factories = NULL; PRMonitor *nsRepository::monitor = NULL; diff --git a/xpcom/macbuild/xpcom.exp b/xpcom/macbuild/xpcom.exp index f45c0f14112..dac25b442e1 100644 --- a/xpcom/macbuild/xpcom.exp +++ b/xpcom/macbuild/xpcom.exp @@ -83,3 +83,9 @@ PL_NewVector # nsServiceManager static method exports. ReleaseService__16nsServiceManagerFRC4nsIDP11nsISupportsP19nsIShutdownListener GetService__16nsServiceManagerFRC4nsIDRC4nsIDPP11nsISupportsP19nsIShutdownListener + +# nsTraceRefcnt +Destroy__13nsTraceRefcntFPvPCci +Create__13nsTraceRefcntFPvPCcPCci +Release__13nsTraceRefcntFPvUlPCci +AddRef__13nsTraceRefcntFPvUlPCci diff --git a/xpcom/macbuild/xpcomPPC.mcp b/xpcom/macbuild/xpcomPPC.mcp index 744d9e32dcd..75864c19ce8 100644 Binary files a/xpcom/macbuild/xpcomPPC.mcp and b/xpcom/macbuild/xpcomPPC.mcp differ diff --git a/xpcom/public/nsMacRepository.h b/xpcom/public/nsMacRepository.h index 7ead8aa1b1f..689230d582b 100644 --- a/xpcom/public/nsMacRepository.h +++ b/xpcom/public/nsMacRepository.h @@ -68,6 +68,7 @@ extern "C" PRBool NSCanUnload_PREF_DLL(void); // library list static MacLibrary libraries[] = { +#if 0 WIDGET_DLL, NSGetFactory_WIDGET_DLL, NULL, GFXWIN_DLL, NSGetFactory_GFXWIN_DLL, NULL, VIEW_DLL, NSGetFactory_VIEW_DLL, NULL, @@ -79,7 +80,9 @@ static MacLibrary libraries[] = { LAYOUT_DLL, NSGetFactory_LAYOUT_DLL, NULL, NETLIB_DLL, NSGetFactory_NETLIB_DLL, NULL, //EDITOR_DLL, NSGetFactory_EDITOR_DLL, NULL, // FIX ME - NULL}; +#endif + NULL +}; static void* FindMacSymbol(char* libName, const char *symbolName) { diff --git a/xpcom/src/nsRepository.cpp b/xpcom/src/nsRepository.cpp index d7370d4a763..206489f966a 100644 --- a/xpcom/src/nsRepository.cpp +++ b/xpcom/src/nsRepository.cpp @@ -37,12 +37,14 @@ #include "NSReg.h" #endif +#if 0 #ifdef XP_MAC #ifdef MOZ_NGLAYOUT #define IMPL_MAC_REPOSITORY #include "nsMacRepository.h" #endif #endif +#endif nsHashtable *nsRepository::factories = NULL; PRMonitor *nsRepository::monitor = NULL; diff --git a/xpfe/macbuild/xpfeviewer.mcp b/xpfe/macbuild/xpfeviewer.mcp index b0dfcf51e82..bb284a2d752 100644 Binary files a/xpfe/macbuild/xpfeviewer.mcp and b/xpfe/macbuild/xpfeviewer.mcp differ diff --git a/xpfe/xpviewer/src/nsSetupRegistry.cpp b/xpfe/xpviewer/src/nsSetupRegistry.cpp index d29656af1d0..a22a6e64467 100644 --- a/xpfe/xpviewer/src/nsSetupRegistry.cpp +++ b/xpfe/xpviewer/src/nsSetupRegistry.cpp @@ -16,14 +16,8 @@ * Corporation. Portions created by Netscape are Copyright (C) 1998 * Netscape Communications Corporation. All Rights Reserved. */ -#ifdef XP_MAC -#include "nsIPref.h" -#define NS_IMPL_IDS -#else #define NS_IMPL_IDS #include "nsIPref.h" -#endif - #include "nsRepository.h" #include "nsWidgetsCID.h" #include "nsGfxCIID.h"