[Common-dev] CR-Client: Common Cleanup (OS X, 64-bit)
Bob Clark bobclark at real.comModified by: bobclark at real.com Date: 12/15/08 Project: Mac RealPlayer Synopsis: 64-bit cleanliness, general cleanup on 150Cay branch Overview: For the background to the general Mac OS X cleanup, see: http://lists.helixcommunity.org/pipermail/client-dev/2008-December/004967.html I'm also making changes necessary for 64-bit cleanliness. In fact, 64- bit cleanliness is the reason I started touching this creaky old code. On the Mac, the 64-bit system libraries have dropped many deprecated APIs. This is forcing us to revisit a lot of old code, and for that old code that isn't used I'm just ripping it out. The only non-Mac-specific 64-bit compliance changes are adding an "interim" cast to several places that cast pointers to integers. These diffs look something like this: - INT32 nSomething = (INT32)pSomePointer; + INT32 nSomething = (INT32)(PTR_INT)pSomePointer; Files Modified for 64-bit compliance: common/fileio/mmapmgr.cpp common/include/hxtypes.h common/log/logsystem/hxtdeliverymanager.cpp common/log/logsystem/hxtlogfilter.cpp common/log/logsystem/hxtthreadtracker.cpp common/netio/platform/posix/hxsocketselector.cpp common/system/platform/unix/pthreadthreads.cpp Files Modified for OS X cleanup: common/container/hxguid.cpp common/container/hxslist.cpp common/container/hxstradv.cpp common/container/hxstring.cpp common/container/pub/hxguid.h common/container/pub/hxstring.h common/container/test/string_test.cpp common/dbgtool/hxassert.cpp common/dbgtool/memprb.cpp common/dbgtool/platform/default/debug.cpp common/dbgtool/pub/debugout.h common/dbgtool/pub/hxassert.h common/dbgtool/pub/hxprofile.h common/dbgtool/pub/hxstat.h common/dbgtool/pub/platform/default/debug.h common/fileio/chunkres.cpp common/fileio/datffact.cpp common/fileio/findfile.cpp common/fileio/fsio.cpp common/fileio/hxxfile.cpp common/fileio/mmapmgr.cpp common/fileio/platform/mac/cmacfile.cp common/fileio/platform/mac/copyfile.cpp common/fileio/platform/mac/filespec_carbon.cpp common/fileio/platform/mac/filespecutils.cpp common/fileio/platform/mac/filespecutils_carbon.cpp common/fileio/platform/mac/hx_morefiles.cpp common/fileio/platform/mac/hxdir.cpp common/fileio/platform/mac/macasyncfile.cpp common/fileio/platform/mac/macdir.cc common/fileio/platform/mac/macff.cpp common/fileio/platform/mac/macff_carbon.cpp common/fileio/pub/filespec.h common/fileio/pub/filespecutils.h common/fileio/pub/findfile.h common/fileio/pub/hxdir.h common/fileio/pub/platform/mac/cmacfile.h common/fileio/pub/platform/mac/filespecmac.h common/fileio/pub/platform/mac/filespecmac_carbon.h common/fileio/pub/platform/mac/fio.h common/fileio/pub/platform/mac/hx_morefiles.h common/fileio/pub/platform/mac/hxdir.h common/fileio/pub/platform/mac/macFD.h common/fileio/pub/platform/mac/macff.h common/include/atomicbase.h common/include/chxxtype.h common/include/hxauth.h common/include/hxcore.h common/include/hxencod.h common/include/hxhpbase.h common/include/hxplugn.h common/include/hxtypes.h common/include/hxver.h common/include/platform.h common/include/rmfftype.h common/include/rnver.h common/lang/xml/xmlconfig.cpp common/lang/xml/xmlwrite.cpp common/log/logsystem/hxtdeliverymanager.cpp common/log/logsystem/hxtlogfilter.cpp common/log/logsystem/hxtthreadtracker.cpp common/log/logutil/pub/hxtlogutil.h common/netio/conn.cpp common/netio/thrdconn.cpp common/netio/threngin.cpp common/netio/platform/posix/hxsocketselector.cpp common/netio/pub/conn.h common/netio/pub/sockio.h common/netio/pub/threngin.h common/netio/pub/platform/mac/socketerrors.h common/netio/pub/platform/mac/sockio.h common/runtime/hlxosstr.cpp common/runtime/platform/mac/hxcrt.cpp common/runtime/pub/hlxclib/fcntl.h common/runtime/pub/hlxclib/io.h common/runtime/pub/hlxclib/malloc.h common/runtime/pub/hlxclib/memory.h common/runtime/pub/hlxclib/stdlib.h common/runtime/pub/hlxclib/string.h common/runtime/pub/hlxclib/sys/socket.h common/runtime/pub/hlxclib/sys/stat.h common/runtime/pub/hlxclib/sys/types.h common/runtime/pub/platform/mac/hxmm.h common/system/dllpath.cpp common/system/genthrd.cpp common/system/hxdate.cpp common/system/hxthread.cpp common/system/stataccs.cpp common/system/platform/mac/carbthrd.cpp common/system/platform/mac/mac_dll.cpp common/system/platform/unix/pthreadthreads.cpp common/system/pub/dllacces.h common/system/pub/dllpath.h common/system/pub/genthrd.h common/system/pub/hxtick.h common/system/pub/hxtime.h common/system/pub/microsleep.h common/system/pub/staticff.h common/system/pub/platform/mac/carbthrd.h common/util/cookies.cpp common/util/dbcs.cpp common/util/hxstrutl.cpp common/util/hxwinver.cpp common/util/localrep.c common/util/netbyte.cpp common/util/pref.cpp common/util/platform/mac/MoreFilesX.c common/util/platform/mac/cfwrappers.cpp common/util/platform/mac/cresload.cpp common/util/platform/mac/fullpathname.cp common/util/platform/mac/hurl.cpp common/util/platform/mac/hx_moreprocesses.c common/util/platform/mac/hxinternetconfigutils.cpp common/util/platform/mac/maclibrary.cp common/util/pub/cookies.h common/util/pub/hxstrutl.h common/util/pub/platform.h common/util/pub/pref.h common/util/pub/timeval.h common/util/pub/platform/mac/MoreFilesX.h common/util/pub/platform/mac/cfwrappers.h common/util/pub/platform/mac/fullpathname.h common/util/pub/platform/mac/hurl.h common/util/pub/platform/mac/hx_moreprocesses.h common/util/pub/platform/mac/mac_pref_cf.h Image Size and Heap Use impact (Client -Only): Negligible decrease Platforms and Profiles Affected: Mac OS X only Platforms and Profiles Build Verified: Mac OS X Platforms and Profiles Functionality verified: Mac OS X Branch: 150Cay Copyright assignment: I am a RealNetworks employee -- Bob Clark Lead Software Development Engineer RealPlayer Mac/Unix RealNetworks, Inc. -------------- next part -------------- Index: container/hxguid.cpp =================================================================== RCS file: /cvsroot/common/container/hxguid.cpp,v retrieving revision 1.11 diff -u -w -r1.11 hxguid.cpp --- container/hxguid.cpp 9 Jul 2004 18:21:35 -0000 1.11 +++ container/hxguid.cpp 16 Dec 2008 04:09:11 -0000 @@ -53,7 +53,7 @@ #include "hxstrutl.h" #if defined(HELIX_FEATURE_FULLGUID) -#if defined _MACINTOSH || defined _UNIX || defined _SYMBIAN +#if defined _UNIX || defined _SYMBIAN const GUID GUID_NULL = {0, 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0}}; #endif #endif Index: container/hxslist.cpp =================================================================== RCS file: /cvsroot/common/container/hxslist.cpp,v retrieving revision 1.10.6.2 diff -u -w -r1.10.6.2 hxslist.cpp --- container/hxslist.cpp 13 Jan 2007 12:22:46 -0000 1.10.6.2 +++ container/hxslist.cpp 16 Dec 2008 04:09:12 -0000 @@ -51,9 +51,7 @@ #include "debug.h" #include "hlxclib/ctype.h" -#ifndef _MACINTOSH #include "hlxclib/string.h" -#endif CHXSimpleList::CHXSimpleList() Index: container/hxstradv.cpp =================================================================== RCS file: /cvsroot/common/container/hxstradv.cpp,v retrieving revision 1.13.6.4 diff -u -w -r1.13.6.4 hxstradv.cpp --- container/hxstradv.cpp 24 Jun 2005 16:56:23 -0000 1.13.6.4 +++ container/hxstradv.cpp 16 Dec 2008 04:09:12 -0000 @@ -156,8 +156,6 @@ { #if defined(_WINDOWS) || defined(_SYMBIAN) *this += "\r\n"; -#elif defined(_MACINTOSH) - *this += '\r'; #else *this += '\n'; #endif /* defined(_WINDOWS) */ Index: container/hxstring.cpp =================================================================== RCS file: /cvsroot/common/container/hxstring.cpp,v retrieving revision 1.19 diff -u -w -r1.19 hxstring.cpp --- container/hxstring.cpp 9 Jul 2004 18:21:35 -0000 1.19 +++ container/hxstring.cpp 16 Dec 2008 04:09:12 -0000 @@ -584,119 +584,12 @@ return ret; } -#if defined(_MACINTOSH) || defined(_MAC_UNIX) +#if defined(_MAC_UNIX) #include "platform/mac/fullpathname.h" #include "platform/mac/cfwrappers.h" -const CHXString& CHXString::SetFromStr255(const Str255 src) -{ - char temp[256]; /* Flawfinder: ignore */ - - if (src==NULL) - { - Empty(); - } - else - { - memcpy (temp, &src[1], src[0]); /* Flawfinder: ignore */ - temp[src[0]] = 0; - *this = CHXString( temp, src[0]); - } - - return *this; -} - -const CHXString& CHXString::AppendFromStr255(const Str255 src) -{ - char temp[256]; /* Flawfinder: ignore */ - - if (src!=NULL) - { - memcpy (temp, &src[1], src[0]); /* Flawfinder: ignore */ - temp[src[0]] = 0; - - CHXString tempS; - tempS = temp; - *this = *this + tempS; - } - return *this; -} - -const CHXString& CHXString::InsertFromStr255(const Str255 src) -{ - char temp[256]; /* Flawfinder: ignore */ - - if (src!=NULL) - { - memcpy (temp, &src[1], src[0]); /* Flawfinder: ignore */ - temp[src[0]] = 0; - - CHXString tempS; - tempS = temp; - *this = tempS + *this; - } - - return *this; -} - -const CHXString& CHXString::SetFromIndString(short strlist, short item) -{ - Str255 theStr; - - GetIndString(theStr,strlist,item); - - SetFromStr255(theStr); - - return *this; -} - -const CHXString& CHXString::operator =(FSSpec spec) -{ - CHXString temp; - - PathNameFromFSSpec(&spec, temp); - - *this=temp; - return *this; -} - -CHXString::operator const FSSpec(void) -{ - FSSpec spec; - (void) FSSpecFromPathName((const char*)(*this), &spec); - return spec; -} - -HX_RESULT CHXString::MakeStr255(Str255& outPascalString) const -{ - UINT32 len = GetLength(); - - if (m_pRep) - c2pstrcpy(outPascalString, m_pRep->GetBuffer()); - - return (len <= 255 ? HXR_OK : HXR_FAIL); -} - -#if !defined(_CARBON) && !defined(_MAC_UNIX) -CHXString::operator Str255* (void) -{ -#error "Not Implemented" -} - -CHXString::operator const Str255* (void) const -{ -#error "Not Implemented" -} - -CHXString::operator ConstStr255Param (void) const -{ -#error "Not Implemented" -} - -#else - const CHXString& CHXString::operator =(const FSRef& ref) { CHXString temp; @@ -718,11 +611,7 @@ const CHXString& CHXString::operator =(CFStringRef ref) { -#ifdef _MAC_CFM - CFStringEncoding encoding = CFStringGetSystemEncoding(); -#else CFStringEncoding encoding = kCFStringEncodingUTF8; -#endif // we need the string to be canonically decomposed Unicode in case it'll be used as a path on // an HFS disk, so we'll make a mutable copy of the string, normalize it, and then encode that as UTF-8 @@ -731,10 +620,7 @@ CFMutableStringRef mutableRef = CFStringCreateMutableCopy(kCFAllocatorDefault, kNoMaxLength, ref); -#ifndef __MWERKS__ - // our version of CodeWarrior doesn't have CFStringNormalize in the headers since they are pre-10.2 headers, alas CFStringNormalize(mutableRef, kCFStringNormalizationFormD); -#endif (void) SetFromCFString(mutableRef, encoding); @@ -794,9 +680,7 @@ return HXR_FAIL; } -#endif /* _CARBON || _MAC_UNIX */ - -#endif /* _MACINTOSH || _MAC_UNIX */ +#endif /* _MAC_UNIX */ void CHXString::Init(const char* pStr, UINT32 size) { Index: container/pub/hxguid.h =================================================================== RCS file: /cvsroot/common/container/pub/hxguid.h,v retrieving revision 1.7 diff -u -w -r1.7 hxguid.h --- container/pub/hxguid.h 9 Jul 2004 18:21:27 -0000 1.7 +++ container/pub/hxguid.h 16 Dec 2008 04:09:12 -0000 @@ -53,7 +53,7 @@ #include "hxcom.h" #if defined(HELIX_FEATURE_FULLGUID) -#if defined _MACINTOSH || defined _UNIX || defined _SYMBIAN || defined _OPENWAVE +#if defined _UNIX || defined _SYMBIAN || defined _OPENWAVE extern const GUID GUID_NULL; #endif #endif Index: container/pub/hxstring.h =================================================================== RCS file: /cvsroot/common/container/pub/hxstring.h,v retrieving revision 1.12.6.1 diff -u -w -r1.12.6.1 hxstring.h --- container/pub/hxstring.h 6 Dec 2005 18:38:26 -0000 1.12.6.1 +++ container/pub/hxstring.h 16 Dec 2008 04:09:12 -0000 @@ -204,24 +204,8 @@ INT32 GetAllocLength() const; INT32 SetMinBufSize(INT32 minSize); -#if defined(_MACINTOSH) || defined(_MAC_UNIX) - const CHXString& SetFromStr255(const Str255 ); +#if defined(_MAC_UNIX) - const CHXString& AppendFromStr255(const Str255 ); - const CHXString& InsertFromStr255(const Str255 ); - - const CHXString& SetFromIndString(short , short ); - - const CHXString& operator =(FSSpec ); - operator const FSSpec(void); - - HX_RESULT MakeStr255(Str255& ) const; - -#if !defined(_CARBON) && !defined(_MAC_UNIX) - operator Str255* (void); - operator const Str255* (void) const; - operator ConstStr255Param (void) const; -#else const CHXString& operator =(const FSRef& ); // ConstStr255Param operator disallowed since // it's not implemented in Carbon @@ -234,9 +218,7 @@ HX_RESULT SetFromHFSUniStr255(const HFSUniStr255& , CFStringEncoding ); HX_RESULT MakeHFSUniStr255(HFSUniStr255& , CFStringEncoding ) const; -#endif /* !defined(_CARBON) */ - -#endif /* _MACINTOSH */ +#endif /* _MAC_UNIX */ protected: Index: container/test/string_test.cpp =================================================================== RCS file: /cvsroot/common/container/test/string_test.cpp,v retrieving revision 1.10 diff -u -w -r1.10 string_test.cpp --- container/test/string_test.cpp 9 Jul 2004 18:21:31 -0000 1.10 +++ container/test/string_test.cpp 16 Dec 2008 04:09:12 -0000 @@ -2066,9 +2066,6 @@ #if defined(_UNIX) ret = (*pEnd == '\n') && (pStr->GetLength() == (beforeLength+1)); -#elif defined(_MACINTOSH) - ret = (*pEnd == '\r') && - (pStr->GetLength() == (beforeLength+1)); #elif defined(_WINDOWS) || defined(_SYMBIAN) ret = (*(pEnd-1) == '\r' && *pEnd == '\n') && (pStr->GetLength() == (beforeLength+2)); Index: dbgtool/hxassert.cpp =================================================================== RCS file: /cvsroot/common/dbgtool/hxassert.cpp,v retrieving revision 1.20 diff -u -w -r1.20 hxassert.cpp --- dbgtool/hxassert.cpp 9 Jul 2004 18:21:53 -0000 1.20 +++ dbgtool/hxassert.cpp 16 Dec 2008 04:09:12 -0000 @@ -90,14 +90,6 @@ #if defined (DEBUG) || defined (_DEBUG) -#ifdef _MACINTOSH -#include <stdarg.h> -#include <string.h> -#include "platform/mac/hxcrt_assert.h" -#define IDIGNORE 2 -#define IDRETRY 1 -#endif - #ifdef _UNIX #include <stdarg.h> #define IDIGNORE 0 @@ -138,16 +130,7 @@ if (HXWantTraceMessages()) { -#if _MACINTOSH - Str255 pstr = {0x00}; - char *p = (char*)pString; - while (*p && pstr[0] < 253) // interrupt safe c2pstr, and we don't mess with pString - pstr[++pstr[0]] = *p++; - pstr[++pstr[0]] = ';'; // add go command so we don't stay in MacsBug - pstr[++pstr[0]] = 'g'; - DebugStr(pstr); - -#elif defined( DEBUG ) && (defined( _WIN32 ) || defined( _WINDOWS )) +#if defined( DEBUG ) && (defined( _WIN32 ) || defined( _WINDOWS )) // This is the Windows/Win 95 version OutputDebugString(OS_STRING(pString)); @@ -388,9 +371,6 @@ ); #endif /* !defined(WIN32_PLATFORM_PSPC) */ -#elif defined (_MACINTOSH) - int nCode = HXCRT_ASSERT(z_szAssertMessage); - #elif defined (_UNIX) const char *debugopts; int debuglevel = 0; Index: dbgtool/memprb.cpp =================================================================== RCS file: /cvsroot/common/dbgtool/memprb.cpp,v retrieving revision 1.5 diff -u -w -r1.5 memprb.cpp --- dbgtool/memprb.cpp 9 Jul 2004 18:21:53 -0000 1.5 +++ dbgtool/memprb.cpp 16 Dec 2008 04:09:12 -0000 @@ -60,6 +60,6 @@ */ #include "hxmemprb.h" -#if !defined(_MACINTOSH) && !defined(_WINCE) +#if !defined(_WINCE) #include "platform/win/memprb.cpp" #endif Index: dbgtool/platform/default/debug.cpp =================================================================== RCS file: /cvsroot/common/dbgtool/platform/default/debug.cpp,v retrieving revision 1.3 diff -u -w -r1.3 debug.cpp --- dbgtool/platform/default/debug.cpp 9 Jul 2004 18:21:38 -0000 1.3 +++ dbgtool/platform/default/debug.cpp 16 Dec 2008 04:09:12 -0000 @@ -61,10 +61,6 @@ #include "hxstrutl.h" #include "hlxclib/time.h" -#ifdef _MACINTOSH -#include <stdlib.h> /* for exit */ -#endif - #if (defined WIN32 && defined _SERVER) #include "messages.h" #endif @@ -137,26 +133,7 @@ return; } -#if (defined _MACINTOSH) -// The implementation of time on the mac is quite different from UNIX. -// For now, I hacked the debug time to not include the milliseconds. -// I call time() to get the actual date. - - struct tm* tm; - time_t now; - ::time(&now); - tm = localtime(&now); - strftime(buf, BUF_SIZE, "%d-%b-%y %H:%M:%S", tm); - - ProcessSerialNumber process_id; - GetCurrentProcess(&process_id); - - int len = SafeSprintf(buf, BUF_SIZE, "%s %s(%ld): ", buf, progname, process_id.lowLongOfPSN); - - if (len < 0) len = 0; - vsprintf(&buf[len], fmt, args); - -#elif defined(_WINDOWS) && (!defined(WIN32) || defined(WIN32_PLATFORM_PSPC)) +#if defined(_WINDOWS) && (!defined(WIN32) || defined(WIN32_PLATFORM_PSPC)) // for the win 16 implementation we just skip line headers to avoid linking // in a library that messes up the client core for win 16. vsprintf(buf, fmt, args); @@ -194,23 +171,11 @@ #endif -#if !defined( _MACINTOSH) if (err) { fprintf(stderr, "***"); } fprintf(stderr, "%s", buf); -#endif - -// For the macintosh using printf with the debug.console.c, will display the -// debug messages to a window as well, when using the dummy console for linking -// this function does nothing. -#if (defined _MACINTOSH && defined _DEBUG) - if (err) - fprintf(stderr, "***"); - fprintf(stderr, "%s", buf); - printf("%s",buf); -#endif fflush(stderr); Index: dbgtool/pub/debugout.h =================================================================== RCS file: /cvsroot/common/dbgtool/pub/debugout.h,v retrieving revision 1.5 diff -u -w -r1.5 debugout.h --- dbgtool/pub/debugout.h 9 Jul 2004 18:21:50 -0000 1.5 +++ dbgtool/pub/debugout.h 16 Dec 2008 04:09:12 -0000 @@ -67,16 +67,7 @@ extern "C" { #endif -#if _MACINTOSH - // This is the macintosh version, I'm not sure what it should look like - // exactly. - #if defined( Debug_Signal ) - #define DEBUGOUTSTR( DEBUG_STR ) {DebugStr(c2pstr(DEBUG_STR));\ - p2cstr((unsigned char *)DEBUG_STR); } - #else - #define DEBUGOUTSTR( DEBUG_STR ) - #endif -#elif defined( _DEBUG ) && (defined( _WIN32 ) || defined( _WINDOWS )) +#if defined( _DEBUG ) && (defined( _WIN32 ) || defined( _WINDOWS )) // This is the Windows/Win 95 version #if defined( _DEBUG ) #include "hxassert.h" // Needed for HXOutputDebugString() @@ -125,8 +116,6 @@ #else #define DEBUGGER() _asm { int 3 } #endif // _M_ALPHA - #elif defined( _MACINTOSH ) - #define DEBUGGER() Debugger(); #elif defined( _UNIX ) // NEED a definition for UNIX #define DEBUGGER() Index: dbgtool/pub/hxassert.h =================================================================== RCS file: /cvsroot/common/dbgtool/pub/hxassert.h,v retrieving revision 1.18.2.2 diff -u -w -r1.18.2.2 hxassert.h --- dbgtool/pub/hxassert.h 5 Dec 2006 21:45:01 -0000 1.18.2.2 +++ dbgtool/pub/hxassert.h 16 Dec 2008 04:09:12 -0000 @@ -140,9 +140,7 @@ // Diagnostic support // For _MAX_PATH -#if defined ( _MACINTOSH ) -#include "platform/mac/maclibrary.h" -#elif defined (_UNIX) +#if defined (_UNIX) #include <stdlib.h> #if !defined(_VXWORKS) #include <sys/param.h> @@ -165,9 +163,6 @@ #if defined (DEBUG) || defined (_DEBUG) -#ifdef _MACINTOSH -# define MAX_TRACE_OUTPUT 255 -#else # ifdef _UNIX # define MAX_TRACE_OUTPUT 255 # elif _WIN16 @@ -177,7 +172,6 @@ # else # define MAX_TRACE_OUTPUT (_MAX_PATH*2 + 20) # endif -#endif ///////////////////////////////////////////////////////////////////////////// @@ -282,8 +276,6 @@ #else #define HXDebugBreak() _asm { int 3 } #endif // _M_ALPHA -#elif defined( _MACINTOSH ) -#define HXDebugBreak() Debugger() #elif defined(_OPENWAVE) #if defined(_OPENWAVE_SIMULATOR) // windows app... #define HXDebugBreak() _asm { int 3 } @@ -341,8 +333,6 @@ #elif defined(_OPENWAVE) // XXXSAB is this right?? # define HXAbort() exit(1) -#elif defined ( _MACINTOSH ) -# define HXAbort() DebugStr("\pHXAbort: Please exit this program.") #elif defined ( _UNIX ) # define HXAbort() printf("\npnabort: Please exit this program.\n") #endif // end of#if defined(_WIN32) || defined(_WINDOWS) @@ -563,13 +553,7 @@ #define REQUIRE_REPORT(targ,file,line) ((int)0) -#if defined (_MACINTOSH) -// this is the proper release version of HX_VERIFY that preserves the syntactic -// role of the debug version; it's necessary to quiet warnings on the Mac -#define HX_VERIFY(f) do { if (!(f)) {} } while (0) -#else #define HX_VERIFY(f) ((void)(f)) -#endif #if defined (_WINDOWS) static __inline void HXTraceNull(const char* x, ...) { }; @@ -711,7 +695,7 @@ do { if ((ptr) == 0L) {{action;} goto target;} } while (0) // lower case versions make source code more readable -#if defined(_CARBON) || defined(_MAC_MACHO) +#if defined(_MAC_MACHO) #undef check #undef require #undef require_action Index: dbgtool/pub/hxprofile.h =================================================================== RCS file: /cvsroot/common/dbgtool/pub/hxprofile.h,v retrieving revision 1.4 diff -u -w -r1.4 hxprofile.h --- dbgtool/pub/hxprofile.h 9 Jul 2004 18:21:50 -0000 1.4 +++ dbgtool/pub/hxprofile.h 16 Dec 2008 04:09:12 -0000 @@ -54,62 +54,10 @@ #ifdef _DEBUG -#ifdef _MACINTOSH - -#include "Profiler.h" - -#define HX_CODE_PROFILE_INIT( inNumFunctions, inStackSize ) \ -static short hx_code_profile_numFunctions = inNumFunctions; \ -static short hx_code_profile_stackSize = inStackSize; - -#define HX_CODE_PROFILE_START \ -OSErr hx_code_profile_start_error = ::ProfilerInit( collectDetailed, bestTimeBase, hx_code_profile_numFunctions, hx_code_profile_stackSize ); \ -if ( noErr != hx_code_profile_start_error ) \ -{ \ - Str255 hx_code_profile_errorString; \ - ::sprintf( ( char* ) hx_code_profile_errorString, "ProfilerInit() error: %d", hx_code_profile_start_error ); /* Flawfinder: ignore */ \ - ::c2pstr( ( char* ) hx_code_profile_errorString ); \ - ::DebugStr( hx_code_profile_errorString ); \ -} \ -::ProfilerSetStatus( true ); - -#define HX_CODE_PROFILE_STOP( inFilename ) \ -long hx_code_profile_checkNrFunctions; \ -long hx_code_profile_checkStackSize; \ -::ProfilerSetStatus( false ); \ -::ProfilerGetDataSizes( &hx_code_profile_checkNrFunctions, &hx_code_profile_checkStackSize ); \ -if ( hx_code_profile_checkNrFunctions >= hx_code_profile_numFunctions ) \ -{ \ - Str255 hx_code_profile_errorString; \ - ::sprintf( ( char* ) hx_code_profile_errorString, "Num Functions: %d >= Allocated Functions: %d", hx_code_profile_checkNrFunctions, hx_code_profile_numFunctions ); /* Flawfinder: ignore */ \ - ::c2pstr( ( char* ) hx_code_profile_errorString ); \ - ::DebugStr( hx_code_profile_errorString ); \ -} \ -if ( hx_code_profile_checkStackSize >= hx_code_profile_stackSize ) \ -{ \ - Str255 hx_code_profile_errorString; \ - ::sprintf( ( char* ) hx_code_profile_errorString, "Stack size: %d >= Allocated Stack size: %d", hx_code_profile_checkStackSize, hx_code_profile_stackSize ); /* Flawfinder: ignore */ \ - ::c2pstr( ( char* ) hx_code_profile_errorString ); \ - ::DebugStr( hx_code_profile_errorString ); \ -} \ -OSErr hx_code_profile_stop_error = ::ProfilerDump( "\p"inFilename ); \ -if ( noErr != hx_code_profile_stop_error ) \ -{ \ - Str255 hx_code_profile_errorString; \ - ::sprintf( ( char* ) hx_code_profile_errorString, "ProfilerInit() error: %d", hx_code_profile_stop_error ); /* Flawfinder: ignore */ \ - ::c2pstr( ( char* ) hx_code_profile_errorString ); \ - ::DebugStr( hx_code_profile_errorString ); \ -} \ -::ProfilerTerm(); - -#else - #define HX_CODE_PROFILE_INIT( inNumFunctions, inStackSize ) #define HX_CODE_PROFILE_START #define HX_CODE_PROFILE_STOP( inFilename ) -#endif - #else #define HX_CODE_PROFILE_INIT( inNumFunctions, inStackSize ) Index: dbgtool/pub/hxstat.h =================================================================== RCS file: /cvsroot/common/dbgtool/pub/hxstat.h,v retrieving revision 1.7 diff -u -w -r1.7 hxstat.h --- dbgtool/pub/hxstat.h 9 Jul 2004 18:21:50 -0000 1.7 +++ dbgtool/pub/hxstat.h 16 Dec 2008 04:09:12 -0000 @@ -50,10 +50,6 @@ #ifndef _HXSTATLOG_ #define _HXSTATLOG_ -#ifdef _MACINTOSH -#include <stdlib.h> -#endif - #ifdef _WINDOWS #include <stdio.h> #endif @@ -180,7 +176,6 @@ if (!LogFileInstance()) return HXR_INVALID_FILE; HX_RESULT theErr = HXR_OK; -#ifndef _MACINTOSH char buf[8096]; /* Flawfinder: ignore */ LONG32 bytes_written = 0; LONG32 bytes_towrite = 0; @@ -197,7 +192,6 @@ if (bytes_written != bytes_towrite) theErr = HXR_INVALID_PATH; } -#endif return theErr; } Index: dbgtool/pub/platform/default/debug.h =================================================================== RCS file: /cvsroot/common/dbgtool/pub/platform/default/debug.h,v retrieving revision 1.4 diff -u -w -r1.4 debug.h --- dbgtool/pub/platform/default/debug.h 9 Jul 2004 18:21:47 -0000 1.4 +++ dbgtool/pub/platform/default/debug.h 16 Dec 2008 04:09:12 -0000 @@ -167,9 +167,6 @@ #endif /* DEVEL_DEBUG */ #else /* No Debuggging */ -#ifdef _CARBON -#undef DPRINTF -#endif #define DPRINTF(mask,x) #endif Index: fileio/chunkres.cpp =================================================================== RCS file: /cvsroot/common/fileio/chunkres.cpp,v retrieving revision 1.20.4.3 diff -u -w -r1.20.4.3 chunkres.cpp --- fileio/chunkres.cpp 17 Mar 2005 17:53:07 -0000 1.20.4.3 +++ fileio/chunkres.cpp 16 Dec 2008 04:09:12 -0000 @@ -59,15 +59,6 @@ #include "chxdataf.h" // cross platform file object -#ifdef _MACINTOSH -#ifdef _MAC_MACHO -#include <unistd.h> // for unlink call -#else -#include <unix.h> // for unlink call -#undef _UNIX //defined in unixmac.h -#endif -#endif - #ifdef _UNIX #include <unistd.h> // for unlink #ifndef _MAX_PATH @@ -2040,7 +2031,7 @@ if (pFileName && *pFileName) { int nRet = 0; -#if defined (_MACINTOSH) || defined (_UNIX) || defined(_SYMBIAN) || defined(_OPENWAVE) +#if defined (_UNIX) || defined(_SYMBIAN) || defined(_OPENWAVE) nRet = unlink(pFileName); #else nRet =-1; @@ -2077,7 +2068,7 @@ // a file. if (!pFileName || !*pFileName) { -#if defined(_MAC_MACHO) || defined(_MAC_CFM) // GR 7/15/03 other platforms may want a clearer name here too, since 8.3 restrictions don't apply +#if defined(_MAC_UNIX) // GR 7/15/03 other platforms may want a clearer name here too, since 8.3 restrictions don't apply if(!pFile->GetTemporaryFileName("Helix", szTempFileName, _MAX_PATH)) #else if(!pFile->GetTemporaryFileName("PNX",szTempFileName, _MAX_PATH)) Index: fileio/datffact.cpp =================================================================== RCS file: /cvsroot/common/fileio/datffact.cpp,v retrieving revision 1.8 diff -u -w -r1.8 datffact.cpp --- fileio/datffact.cpp 9 Jul 2004 18:20:35 -0000 1.8 +++ fileio/datffact.cpp 16 Dec 2008 04:09:12 -0000 @@ -47,7 +47,6 @@ * * ***** END LICENSE BLOCK ***** */ -#ifndef _MACINTOSH //#include "hlxclib/stdio.h" #include "hxtypes.h" @@ -157,4 +156,3 @@ return retVal; } -#endif Index: fileio/findfile.cpp =================================================================== RCS file: /cvsroot/common/fileio/findfile.cpp,v retrieving revision 1.11 diff -u -w -r1.11 findfile.cpp --- fileio/findfile.cpp 9 Jul 2004 18:20:35 -0000 1.11 +++ fileio/findfile.cpp 16 Dec 2008 04:09:12 -0000 @@ -63,8 +63,6 @@ #include "platform/symbian/symbianff.h" #elif defined (_OPENWAVE) #include "platform/openwave/opwaveff.h" -#elif defined (_MACINTOSH) -#include "platform/mac/macff.h" #endif #ifdef _UNIX @@ -92,8 +90,6 @@ pFindFile = new CWinFindFile(path, delimiter, pattern); #elif defined (_UNIX) pFindFile = new CUnixFindFile(path, delimiter, pattern); -#elif defined (_MACINTOSH) - pFindFile = new CMacFindFile(path, delimiter, pattern); #elif defined (_SYMBIAN) pFindFile = new CSymbianFindFile(path, delimiter, pattern, ppCommonObj); #endif Index: fileio/fsio.cpp =================================================================== RCS file: /cvsroot/common/fileio/fsio.cpp,v retrieving revision 1.11 diff -u -w -r1.11 fsio.cpp --- fileio/fsio.cpp 15 Nov 2004 17:46:37 -0000 1.11 +++ fileio/fsio.cpp 16 Dec 2008 04:09:12 -0000 @@ -56,9 +56,7 @@ #include "roundup.h" -#ifndef _MACINTOSH // if hxheap.h is included here, OpenTransport.h will not compile #include "hxheap.h" -#endif #ifdef _DEBUG #undef HX_THIS_FILE static const char HX_THIS_FILE[] = __FILE__; @@ -72,10 +70,6 @@ #include "hxassert.h" -#ifdef _MACINTOSH // so we include it here -#include "hxheap.h" -#endif - FSIO::FSIO(IO* i, int bsize) { would_block = 0; Index: fileio/hxxfile.cpp =================================================================== RCS file: /cvsroot/common/fileio/hxxfile.cpp,v retrieving revision 1.10.6.2 diff -u -w -r1.10.6.2 hxxfile.cpp --- fileio/hxxfile.cpp 12 Jan 2007 20:40:32 -0000 1.10.6.2 +++ fileio/hxxfile.cpp 16 Dec 2008 04:09:12 -0000 @@ -61,7 +61,7 @@ static const char HX_THIS_FILE[] = __FILE__; #endif -#if defined(_MAC_UNIX) || defined(_CARBON) +#if defined(_MAC_UNIX) #include "platform/mac/fullpathname.h" #include "filespecutils.h" // for an assert in GetReasonableLocalFileName #endif @@ -93,7 +93,7 @@ // void HXXFile::GetReasonableLocalFileName(CHXString& fileName) { -#if defined(_MAC_UNIX) || defined(_CARBON) +#if defined(_MAC_UNIX) #ifdef _DEBUG CHXString debugSaveURL = (const char*) fileName; #endif @@ -160,18 +160,14 @@ // Replace all directory markers with correct platform // specific directory markers! // -#if defined (_MACINTOSH) || defined (_WINDOWS) +#if defined (_WINDOWS) int nFoundAt = 0; do { nFoundAt = fileName.Find('/'); if (nFoundAt != -1) { -#ifdef _MACINTOSH - fileName.SetAt(nFoundAt,':'); -#else fileName.SetAt(nFoundAt,'\\'); -#endif } } @@ -213,9 +209,7 @@ GetReasonableLocalFileName(strURL); // trim off relative path if there is -#if defined (_MACINTOSH) - nSep = strURL.ReverseFind(':'); -#elif defined (_WINDOWS) +#if defined (_WINDOWS) nSep = strURL.ReverseFind('\\'); #else nSep = strURL.ReverseFind('/'); @@ -318,9 +312,7 @@ void HXXFile::ExtractFileAndPath(const char* pFullPath, char* pFileName, UINT32 ulFileNameBufLen, char* pPath, UINT32 ulPathBufLen) { -#ifdef _MACINTOSH - UCHAR delim = ':'; -#elif defined(_WINDOWS) +#if defined(_WINDOWS) UCHAR delim = '\\'; #else UCHAR delim = '/'; @@ -334,14 +326,7 @@ { strFile = strPath.Mid(nEndOfPath+1); -#ifndef _MACINTOSH strPath = strPath.Left(nEndOfPath); -#else - // on the Mac, let's have the : at the end to ensure - // it's taken as a directory (otherwise a hard drive name, - // with no colon, becomes a relative path) - strPath = strPath.Left(nEndOfPath+1); -#endif } SafeStrCpy(pPath,strPath, ulPathBufLen); SafeStrCpy(pFileName,strFile, ulFileNameBufLen); Index: fileio/mmapmgr.cpp =================================================================== RCS file: /cvsroot/common/fileio/mmapmgr.cpp,v retrieving revision 1.12.4.1 diff -u -w -r1.12.4.1 mmapmgr.cpp --- fileio/mmapmgr.cpp 6 Aug 2005 02:43:17 -0000 1.12.4.1 +++ fileio/mmapmgr.cpp 16 Dec 2008 04:09:12 -0000 @@ -56,7 +56,6 @@ #define _WIN32_USE_INTERLOCKED_INCREMENT #include "hxcom.h" #include "hxtypes.h" -#ifndef _MACINTOSH #include <stdio.h> #include <stdlib.h> @@ -224,7 +223,6 @@ m_bDisableMemoryMappedIO = bDisableMemoryMappedIO; } - MemoryMapManager::~MemoryMapManager() { /* This had better be empty by now!! */ @@ -337,7 +335,7 @@ /* Why make devices 64 bit??? */ sprintf (pLookup, "%lld,%ld", s.st_dev, s.st_ino); /* Flawfinder: ignore */ #else - sprintf (pLookup, "%d,%ld", s.st_dev, s.st_ino); /* Flawfinder: ignore */ + sprintf (pLookup, "%d,%ld", s.st_dev, (PTR_INT)s.st_ino); /* Flawfinder: ignore */ #endif ASSERT(s.st_dev); ASSERT(s.st_ino); @@ -397,7 +395,7 @@ /* Why make devices 64 bit??? */ sprintf (pLookup, "%lld,%ld", s.st_dev, s.st_ino); /* Flawfinder: ignore */ #else - sprintf (pLookup, "%d,%ld", s.st_dev, s.st_ino); /* Flawfinder: ignore */ + sprintf (pLookup, "%d,%ld", s.st_dev, (PTR_INT)s.st_ino); /* Flawfinder: ignore */ #endif ASSERT(s.st_dev); ASSERT(s.st_ino); @@ -1193,6 +1191,5 @@ return HXR_OK; } -#endif #endif /* _VXWORKS */ Index: fileio/platform/mac/cmacfile.cp =================================================================== RCS file: /cvsroot/common/fileio/platform/mac/cmacfile.cp,v retrieving revision 1.3 diff -u -w -r1.3 cmacfile.cp --- fileio/platform/mac/cmacfile.cp 9 Jul 2004 18:19:54 -0000 1.3 +++ fileio/platform/mac/cmacfile.cp 16 Dec 2008 04:09:12 -0000 @@ -61,12 +61,8 @@ #include "hxmm.h" #include "hxfiles.h" /* for HX_FILE_WRITE */ -#ifndef _CARBON #include "FSpCompat.h" #include "MoreFilesExtras.h" -#else -#include "MoreFilesX.h" -#endif OSType CMacFile::sCreator = 'PNst'; OSType CMacFile::sFileType = 'PNRA'; @@ -80,11 +76,7 @@ pascal void ReadCallback(ParamBlockRec* pb); // async callback UPP -#ifdef _CARBON -static IOCompletionUPP gReadCallbackUPP=NewIOCompletionUPP(ReadCallback); -#else static IOCompletionUPP gReadCallbackUPP=NewIOCompletionProc(ReadCallback); -#endif CHXDataFile* @@ -773,17 +765,7 @@ { OSErr theErr = noErr; -#ifndef _CARBON theErr = FSpChangeCreatorType(theSpec, creator, type); -#else - FSRef ref; - - theErr = FSpMakeFSRef(theSpec, &ref); - if (theErr == noErr) - { - theErr = FSChangeCreatorType(&ref, creator, type); - } -#endif return(theErr); } @@ -983,11 +965,7 @@ if(!theErr) { // Build an FSSpec for the temp file in the Temporary Folder -#ifdef _CARBON - c2pstrcpy((StringPtr)tempFileName, (char*)tempFileName); -#else ::c2pstr((char *)tempFileName); -#endif theErr = ::FSMakeFSSpec(tempVRefNum,tempDirID,tempFileName,&tempSpec); } Index: fileio/platform/mac/copyfile.cpp =================================================================== RCS file: /cvsroot/common/fileio/platform/mac/copyfile.cpp,v retrieving revision 1.5 diff -u -w -r1.5 copyfile.cpp --- fileio/platform/mac/copyfile.cpp 2 Nov 2004 22:56:04 -0000 1.5 +++ fileio/platform/mac/copyfile.cpp 16 Dec 2008 04:09:12 -0000 @@ -171,28 +171,6 @@ long GetVolumeFreeSpace(short vRefNum) { -#ifdef _CARBON - // xxxbobclark PBXGetVolInfoSync exists in OS 8.5 and later, but still - // I'll leave the old code there for all non-Carbon. By only using it - // in Carbon code we'll never even risk calling it accidentally. - - XVolumeParam xpb; - xpb.ioCompletion = NULL; - xpb.ioNamePtr = NULL; - xpb.ioVRefNum = vRefNum; - - OSErr err = PBXGetVolInfoSync(&xpb); - - if (err) return 0; - - if (xpb.ioVFreeBytes > 0x000000007fffffff) - { - return 0x7fffffff; - } - - return (long)xpb.ioVFreeBytes; - -#else HVolumeParam block; OSErr err; long freeSpace = 0L; @@ -205,7 +183,6 @@ err = GetVInfo(block.ioVDrvInfo,volname,&vRefNum,&freeSpace); } return freeSpace; -#endif } Boolean EqualFSSpec(FSSpec &srcSpec, FSSpec &dstSpec) Index: fileio/platform/mac/filespec_carbon.cpp =================================================================== RCS file: /cvsroot/common/fileio/platform/mac/filespec_carbon.cpp,v retrieving revision 1.7 diff -u -w -r1.7 filespec_carbon.cpp --- fileio/platform/mac/filespec_carbon.cpp 9 Jul 2004 18:19:54 -0000 1.7 +++ fileio/platform/mac/filespec_carbon.cpp 16 Dec 2008 04:09:12 -0000 @@ -52,10 +52,7 @@ #include "hxstring.h" #include "platform/mac/fullpathname.h" -#ifndef _MAC_UNIX #include "platform/mac/maclibrary.h" // for ResolveIndependentPath -#endif - #include "platform/mac/hx_moreprocesses.h" // for GetCurrentAppSpec #include "platform/mac/cfwrappers.h" @@ -67,12 +64,7 @@ { // Mach-O path elements are always UTF 8; CFM path elements we // system double-byte encoded -#ifdef _MAC_CFM - return CFStringGetSystemEncoding(); -#else return kCFStringEncodingUTF8; -#endif - } @@ -94,12 +86,14 @@ (void) SetFromFSRef(ref); } // ------------------------------------------------------------------------------------ +/* CHXMacInternalSpec::CHXMacInternalSpec(const FSSpec& spec) { InitSpec(); (void) SetFromFSSpec(spec); } +*/ // ------------------------------------------------------------------------------------ CHXMacInternalSpec::CHXMacInternalSpec(AliasHandle alias) { @@ -174,70 +168,8 @@ // ------------------------------------------------------------------------------------ OSErr CHXMacInternalSpec::SetFromPath(const char *pszPath) { -#ifdef _MAC_CFM - return SetFromHFSPath(pszPath); -#else return SetFromPOSIXPath(pszPath); -#endif -} -// ------------------------------------------------------------------------------------ -HX_RESULT CHXMacInternalSpec::SetFromHFSPath(const char *pszPath) -{ - OSErr err; - - ClearSpec(); - - if (pszPath && strlen(pszPath)) - { - FSRef ref; - - err = FSRefFromHFSPath(pszPath, &ref); - if (err == noErr) - { - err = SetFromFSRef(ref); - } - - if (err != noErr) - { - // we couldn't set it that way; try to make - // an FSRef for the portion excluding the leaf name - CHXString strPath, strParent, strLeaf; - - (void) FullFromPartialHFSPath(pszPath, strPath); - - SplitPath((const char *) strPath, ':', strParent, strLeaf); - - if (strParent.IsEmpty()) - { - // there's only a leaf; we can't deal with it since we can't - // make an FSRef for it - err = paramErr; - } - else - { - err = FSRefFromHFSPath((const char *) strParent, &ref); - if (err == noErr) - { - err = SetFromParentAndLeaf(ref, (const char *) strLeaf, - CFStringGetSystemEncoding()); - } - } - - - } - - } - else - { - err = paramErr; } - - UpdateDebugOnlyPath(); // for debugging - - return err; - -} - // ------------------------------------------------------------------------------------ OSErr CHXMacInternalSpec::SetFromParentAndLeaf(const FSRef& parentRef, const char * pszName, CFStringEncoding encoding) @@ -303,6 +235,7 @@ return err; } // ------------------------------------------------------------------------------------ +/* OSErr CHXMacInternalSpec::SetFromFSSpec(const FSSpec& spec) { OSErr err; @@ -348,6 +281,8 @@ return err; } +*/ + // ------------------------------------------------------------------------------------ OSErr CHXMacInternalSpec::SetFromAlias(AliasHandle alias) { @@ -369,13 +304,13 @@ { // the item may not exist; try to make an FSSpec // from the alias and set from that - FSSpec fsspec; + FSRef target; - err = ResolveAliasWithMountFlags(NULL, alias, - &fsspec, &changed, kResolveAliasFileNoUI); + err = FSResolveAliasWithMountFlags(NULL, alias, + &target, &changed, kResolveAliasFileNoUI); if (err == noErr || err == fnfErr) { - SetFromFSSpec(fsspec); + SetFromFSRef(target); } } } @@ -560,7 +495,9 @@ sHexBuffSize = GetHandleSize(hHexBuffer); pBuff = str.GetBuffer(sHexBuffSize + 1); // leave space for terminating null - BlockMoveData(*hHexBuffer, pBuff, sHexBuffSize); + //BlockMoveData(*hHexBuffer, pBuff, sHexBuffSize); + memmove(pBuff, *hHexBuffer, sHexBuffSize); + pBuff[sHexBuffSize] = 0; // make it a C-string str.ReleaseBuffer(); @@ -663,37 +600,10 @@ // ------------------------------------------------------------------------------------ CHXString CHXMacInternalSpec::GetPathName() const { -#ifdef _MAC_CFM - return GetHFSPath(); -#else return GetPOSIXPath(); -#endif } // ------------------------------------------------------------------------------------ -CHXString CHXMacInternalSpec::GetHFSPath() const -{ - CHXString str; - OSErr err; - - if (mbRefSet) - { - err = HFSPathFromFSRef(&mItemRef, str); - } - else if (mbParentAndLeafSet) - { - err = HFSPathFromFSRef(&mParentAndLeaf.mItemParentRef, str); - if (err == noErr) - { - CHXString strLeaf; - - strLeaf.SetFromHFSUniStr255(*mParentAndLeaf.mpLeafName, CFStringGetSystemEncoding()); - str += strLeaf; - } - } - return str; -} -// ------------------------------------------------------------------------------------ CHXString CHXMacInternalSpec::GetPOSIXPath() const { CHXString str; @@ -710,7 +620,7 @@ { CHXString strLeaf; - strLeaf.SetFromHFSUniStr255(*mParentAndLeaf.mpLeafName, kCFStringEncodingUTF8); + strLeaf.SetFromCFString(FSCreateStringFromHFSUniStr(NULL, mParentAndLeaf.mpLeafName), kCFStringEncodingUTF8); if (str.Right(1) != "/") { @@ -846,6 +756,7 @@ return strName; } // ------------------------------------------------------------------------------------ +/* OSErr CHXMacInternalSpec::GetFSSpec(FSSpec& outSpec) const { OSErr err; @@ -886,6 +797,7 @@ return err; } +*/ // ------------------------------------------------------------------------------------ OSErr CHXMacInternalSpec::GetFSRef(FSRef& outRef) const { @@ -1139,74 +1051,47 @@ // CHXFileSpecifier // // ------------------------------------------------------------------------------------ -CHXFileSpecifier::CHXFileSpecifier() : m_pTempSpec(nil), m_pTempRef(nil) +CHXFileSpecifier::CHXFileSpecifier() : m_pTempRef(nil) { } // ------------------------------------------------------------------------------------ +/* CHXFileSpecifier::CHXFileSpecifier(const FSSpec &file) : m_pTempSpec(nil), m_pTempRef(nil) { m_MacInternalSpec.SetFromFSSpec(file); } +*/ // ------------------------------------------------------------------------------------ -CHXFileSpecifier::CHXFileSpecifier(AliasHandle alias) : m_pTempSpec(nil), m_pTempRef(nil) +CHXFileSpecifier::CHXFileSpecifier(AliasHandle alias) : m_pTempRef(nil) { m_MacInternalSpec.SetFromAlias(alias); } // ------------------------------------------------------------------------------------ -CHXFileSpecifier::CHXFileSpecifier(const CHXString &str) : m_pTempSpec(nil), m_pTempRef(nil) +CHXFileSpecifier::CHXFileSpecifier(const CHXString &str) : m_pTempRef(nil) { m_MacInternalSpec.SetFromPath((const char *) str); } // ------------------------------------------------------------------------------------ -CHXFileSpecifier::CHXFileSpecifier(const char* psz) : m_pTempSpec(nil), m_pTempRef(nil) +CHXFileSpecifier::CHXFileSpecifier(const char* psz) : m_pTempRef(nil) { m_MacInternalSpec.SetFromPath(psz); } // ------------------------------------------------------------------------------------ -CHXFileSpecifier::CHXFileSpecifier(const FSRef &ref) : m_pTempSpec(nil), m_pTempRef(nil) +CHXFileSpecifier::CHXFileSpecifier(const FSRef &ref) : m_pTempRef(nil) { m_MacInternalSpec.SetFromFSRef(ref); } // ------------------------------------------------------------------------------------ -CHXFileSpecifier::CHXFileSpecifier(const CHXFileSpecifier &other) : m_pTempSpec(nil), m_pTempRef(nil) +CHXFileSpecifier::CHXFileSpecifier(const CHXFileSpecifier &other) : m_pTempRef(nil) { *this = other; } // ------------------------------------------------------------------------------------ CHXFileSpecifier::~CHXFileSpecifier() { - HX_DELETE(m_pTempSpec); HX_DELETE(m_pTempRef); } // ------------------------------------------------------------------------------------ -CHXFileSpecifier::operator FSSpec() const -{ - FSSpec spec; - OSErr err; - - err = m_MacInternalSpec.GetFSSpec(spec); - - return spec; -} -// ------------------------------------------------------------------------------------ -CHXFileSpecifier::operator FSSpec*() const -{ - if (m_pTempSpec == NULL) - { - m_pTempSpec = new FSSpec; - check_nonnull(m_pTempSpec); - } - - if (m_pTempSpec) - { - OSErr err; - - err = m_MacInternalSpec.GetFSSpec(*m_pTempSpec); - } - - return m_pTempSpec; -} -// ------------------------------------------------------------------------------------ CHXFileSpecifier::operator FSRef() const { FSRef ref; @@ -1285,21 +1170,25 @@ return m_MacInternalSpec.SetFromPOSIXPath(pPosixPath); } // ------------------------------------------------------------------------------------ -CHXString CHXFileSpecifier::GetHFSPath() const +CHXString CHXFileSpecifier::GetURL() const { - return m_MacInternalSpec.GetHFSPath(); + const BOOL kIsNotDirectory = FALSE; + + return m_MacInternalSpec.GetURL(kIsNotDirectory); } // ------------------------------------------------------------------------------------ -HX_RESULT CHXFileSpecifier::SetFromHFSPath(const char *pHFSPath) +HFSUniStr255 CHXFileSpecifier::GetNameHFSUniStr255() const { - return m_MacInternalSpec.SetFromHFSPath(pHFSPath); -} -// ------------------------------------------------------------------------------------ -CHXString CHXFileSpecifier::GetURL() const + OSErr err; + HFSUniStr255 hfsUni; + + err = m_MacInternalSpec.GetHFSUniLeafName(hfsUni); + if (err != noErr) { - const BOOL kIsNotDirectory = FALSE; + hfsUni.length = 0; + } - return m_MacInternalSpec.GetURL(kIsNotDirectory); + return hfsUni; } // ------------------------------------------------------------------------------------ CHXString CHXFileSpecifier::GetExtension() const @@ -1416,20 +1305,6 @@ return m_MacInternalSpec.GetName(); } // ------------------------------------------------------------------------------------ -HFSUniStr255 CHXFileSpecifier::GetNameHFSUniStr255() const -{ - OSErr err; - HFSUniStr255 hfsUni; - - err = m_MacInternalSpec.GetHFSUniLeafName(hfsUni); - if (err != noErr) - { - hfsUni.length = 0; - } - - return hfsUni; -} -// ------------------------------------------------------------------------------------ FSVolumeRefNum CHXFileSpecifier::GetVRefNum() const { FSVolumeRefNum vRefNum; @@ -1487,74 +1362,40 @@ // // ------------------------------------------------------------------------------------ -CHXDirSpecifier::CHXDirSpecifier() : m_pTempSpec(nil), m_pTempRef(nil) +CHXDirSpecifier::CHXDirSpecifier() : m_pTempRef(nil) { } // ------------------------------------------------------------------------------------ -CHXDirSpecifier::CHXDirSpecifier(const FSRef &ref) : m_pTempSpec(nil), m_pTempRef(nil) +CHXDirSpecifier::CHXDirSpecifier(const FSRef &ref) : m_pTempRef(nil) { m_MacInternalSpec.SetFromFSRef(ref); } // ------------------------------------------------------------------------------------ -CHXDirSpecifier::CHXDirSpecifier(const char* psz) : m_pTempSpec(nil), m_pTempRef(nil) +CHXDirSpecifier::CHXDirSpecifier(const char* psz) : m_pTempRef(nil) { m_MacInternalSpec.SetFromPath(psz); } // ------------------------------------------------------------------------------------ -CHXDirSpecifier::CHXDirSpecifier(const FSSpec &folder) : m_pTempSpec(nil), m_pTempRef(nil) -{ - m_MacInternalSpec.SetFromFSSpec(folder); -} -// ------------------------------------------------------------------------------------ -CHXDirSpecifier::CHXDirSpecifier(AliasHandle dirAlias) : m_pTempSpec(nil), m_pTempRef(nil) +CHXDirSpecifier::CHXDirSpecifier(AliasHandle dirAlias) : m_pTempRef(nil) { m_MacInternalSpec.SetFromAlias(dirAlias); } // ------------------------------------------------------------------------------------ -CHXDirSpecifier::CHXDirSpecifier(const CHXString& str) : m_pTempSpec(nil), m_pTempRef(nil) +CHXDirSpecifier::CHXDirSpecifier(const CHXString& str) : m_pTempRef(nil) { m_MacInternalSpec.SetFromPath((const char *) str); } // ------------------------------------------------------------------------------------ -CHXDirSpecifier::CHXDirSpecifier(const CHXDirSpecifier &other) : m_pTempSpec(nil), m_pTempRef(nil) +CHXDirSpecifier::CHXDirSpecifier(const CHXDirSpecifier &other) : m_pTempRef(nil) { *this = other; } // ------------------------------------------------------------------------------------ CHXDirSpecifier::~CHXDirSpecifier() { - HX_DELETE(m_pTempSpec); HX_DELETE(m_pTempRef); } // ------------------------------------------------------------------------------------ -CHXDirSpecifier::operator FSSpec() const -{ - FSSpec spec; - OSErr err; - - err = m_MacInternalSpec.GetFSSpec(spec); - - return spec; -} -// ------------------------------------------------------------------------------------ -CHXDirSpecifier::operator FSSpec*() const -{ - if (m_pTempSpec == NULL) - { - m_pTempSpec = new FSSpec; - check_nonnull(m_pTempSpec); - } - - if (m_pTempSpec) - { - OSErr err; - - err = m_MacInternalSpec.GetFSSpec(*m_pTempSpec); - } - - return m_pTempSpec; -} -// ------------------------------------------------------------------------------------ CHXDirSpecifier::operator FSRef() const { FSRef ref; @@ -1622,11 +1463,6 @@ return m_MacInternalSpec.GetPathName(); } // ------------------------------------------------------------------------------------ -CHXString CHXDirSpecifier::GetHFSPath() const -{ - return m_MacInternalSpec.GetHFSPath(); -} -// ------------------------------------------------------------------------------------ CHXString CHXDirSpecifier::GetURL() const { const BOOL kIsDirectory = TRUE; @@ -1634,11 +1470,6 @@ return m_MacInternalSpec.GetURL(kIsDirectory); } // ------------------------------------------------------------------------------------ -HX_RESULT CHXDirSpecifier::SetFromHFSPath(const char *pHFSPath) -{ - return m_MacInternalSpec.SetFromHFSPath(pHFSPath); -} -// ------------------------------------------------------------------------------------ CHXString CHXDirSpecifier::GetPOSIXPath() const { return m_MacInternalSpec.GetPOSIXPath(); @@ -1762,32 +1593,6 @@ } // ------------------------------------------------------------------------------------ -CHXFileSpecifier CHXDirSpecifier::SpecifyChildFileHFSUniStr255(HFSUniStr255 hfsUni) const -{ - CHXFileSpecifier resultSpec; - FSRef currRef; - OSErr err; - - err = m_MacInternalSpec.GetFSRef(currRef); - require_noerr(err, CantGetFSRef); - - err = resultSpec.m_MacInternalSpec.SetFromParentAndLeafHFSUni(currRef, hfsUni); - require_noerr(err, CantSetSpec); - -CantSetSpec: -CantGetFSRef: - return resultSpec; -} -// ------------------------------------------------------------------------------------ -CHXFileSpecifier CHXDirSpecifier::SpecifyChildFileStr255(ConstStr255Param child) const -{ - CHXString str; - - str.SetFromStr255(child); - - return SpecifyChildFile((const char *) str); -} -// ------------------------------------------------------------------------------------ CHXDirSpecifier CHXDirSpecifier::SpecifyChildDirectory(const char *child) const { CHXDirSpecifier resultSpec; @@ -1807,50 +1612,6 @@ } // ------------------------------------------------------------------------------------ -CHXDirSpecifier CHXDirSpecifier::SpecifyChildDirectoryHFSUniStr255(HFSUniStr255 hfsUni) const -{ - CHXDirSpecifier resultSpec; - FSRef currRef; - OSErr err; - - err = m_MacInternalSpec.GetFSRef(currRef); - require_noerr(err, CantGetFSRef); - - err = resultSpec.m_MacInternalSpec.SetFromParentAndLeafHFSUni(currRef, hfsUni); - require_noerr(err, CantSetSpec); - - -CantSetSpec: -CantGetFSRef: - return resultSpec; -} -// ------------------------------------------------------------------------------------ -CHXDirSpecifier CHXDirSpecifier::SpecifyChildDirectoryStr255(ConstStr255Param child) const -{ - CHXString str; - - str.SetFromStr255(child); - return SpecifyChildDirectory((const char *) str); -} -// ------------------------------------------------------------------------------------ -/* -CHXString CHXDirSpecifier::GetDisplayString() const -{ - CHXString strDisplay; - - if (IsSet()) - { - FSSpec spec; - - spec = m_macentity; // coerce to FSSpec - - strDisplay.SetFromStr255(spec.name); - } - return strDisplay; - -} -*/ -// ------------------------------------------------------------------------------------ CHXString CHXDirSpecifier::GetPersistentString() const { return m_MacInternalSpec.GetPersistentString(); Index: fileio/platform/mac/filespecutils.cpp =================================================================== RCS file: /cvsroot/common/fileio/platform/mac/filespecutils.cpp,v retrieving revision 1.3 diff -u -w -r1.3 filespecutils.cpp --- fileio/platform/mac/filespecutils.cpp 9 Jul 2004 18:19:54 -0000 1.3 +++ fileio/platform/mac/filespecutils.cpp 16 Dec 2008 04:09:12 -0000 @@ -55,11 +55,7 @@ #include "hxrand.h" #include "carray.h" -#ifndef _CARBON #include "morefilesextras.h" -#else -#include "MoreFilesX.h" -#endif // ------------------------------------------------------------------------------------ // @@ -71,14 +67,9 @@ { HX_RESULT err; FSSpec targetSpec; -#ifdef _CARBON - UInt64 freeBytes; - UInt64 totalBytes; -#else short foundVRefNum; UnsignedWide freeBytes; UnsignedWide totalBytes; -#endif require_return(volSpec.IsSet(), HXR_INVALID_PARAMETER); @@ -86,11 +77,7 @@ const StringPtr kDontCareVolName = NULL; -#ifndef _CARBON err = XGetVInfo(targetSpec.vRefNum, kDontCareVolName, &foundVRefNum, &freeBytes, &totalBytes); -#else - err = FSGetVInfo(targetSpec.vRefNum, (HFSUniStr255*) kDontCareVolName, &freeBytes, &totalBytes); -#endif if (err == noErr) { freeSpace = *(long long *) &freeBytes; @@ -109,14 +96,9 @@ { HX_RESULT err; FSSpec targetSpec; -#ifdef _CARBON - UInt64 freeBytes; - UInt64 totalBytes; -#else UnsignedWide freeBytes; UnsignedWide totalBytes; short foundVRefNum; -#endif require_return(volSpec.IsSet(), HXR_INVALID_PARAMETER); @@ -124,11 +106,7 @@ const StringPtr kDontCareVolName = NULL; -#ifndef _CARBON err = XGetVInfo(targetSpec.vRefNum, kDontCareVolName, &foundVRefNum, &freeBytes, &totalBytes); -#else - err = FSGetVInfo(targetSpec.vRefNum, (HFSUniStr255*) kDontCareVolName, &freeBytes, &totalBytes); -#endif if (err == noErr) { totalSpace = *(long long *) &totalBytes; @@ -187,39 +165,6 @@ BOOL CHXFileSpecUtils::IsDiskEjectable(const CHXDirSpecifier& volSpec) { -#ifdef _CARBON - - OSErr err; - FSSpec targetSpec; - GetVolParmsInfoBuffer volParmsInfo; - HParamBlockRec pb; - - require_return(volSpec.IsSet(), FALSE); - - targetSpec = volSpec; - - ZeroInit(&volParmsInfo); - ZeroInit(&pb); - - pb.ioParam.ioVRefNum = targetSpec.vRefNum; - pb.ioParam.ioBuffer = (Ptr) &volParmsInfo; - pb.ioParam.ioReqCount = sizeof(volParmsInfo); - err = PBHGetVolParmsSync(&pb); - if (err == noErr) - { - // we require version 3 of the info buffer to rely on the vMExtendedAttributes - if (volParmsInfo.vMVersion >= 3) - { - if (volParmsInfo.vMExtendedAttributes & (1L << bIsEjectable)) - { - return TRUE; - } - } - } - - return FALSE; - -#else HX_RESULT err; FSSpec targetSpec; Boolean driverWantsEject, driveEjectable, volumeEjected, volumeOnline; @@ -241,7 +186,6 @@ { return FALSE; } -#endif } // ------------------------------------------------------------------------------------ Index: fileio/platform/mac/filespecutils_carbon.cpp =================================================================== RCS file: /cvsroot/common/fileio/platform/mac/filespecutils_carbon.cpp,v retrieving revision 1.7 diff -u -w -r1.7 filespecutils_carbon.cpp --- fileio/platform/mac/filespecutils_carbon.cpp 19 Jul 2004 16:57:31 -0000 1.7 +++ fileio/platform/mac/filespecutils_carbon.cpp 16 Dec 2008 04:09:12 -0000 @@ -134,7 +134,6 @@ BOOL CHXFileSpecUtils::IsDiskLocal(const CHXDirSpecifier& volSpec) { - HParamBlockRec pb; HX_RESULT err; GetVolParmsInfoBuffer buff; BOOL bLocalVol; @@ -152,16 +151,11 @@ return TRUE; } - ZeroInit(&pb); - pb.ioParam.ioVRefNum = vRefNum; - pb.ioParam.ioBuffer = (Ptr) &buff; - pb.ioParam.ioReqCount = sizeof(buff); - - err = PBHGetVolParmsSync(&pb); + err = FSGetVolumeParms(vRefNum, &buff, sizeof(buff)); if (err == noErr) { - bLocalVol = (buff.vMServerAdr == 0); + bLocalVol = (buff.vMExtendedAttributes & (1L << bIsOnInternalBus)) || (buff.vMExtendedAttributes & (1L << bIsOnExternalBus)); } else { @@ -173,7 +167,6 @@ } - // ------------------------------------------------------------------------------------ // // IsDiskEjectable @@ -182,40 +175,29 @@ BOOL CHXFileSpecUtils::IsDiskEjectable(const CHXDirSpecifier& volSpec) { - OSErr err; + HX_RESULT err; + GetVolParmsInfoBuffer buff; short vRefNum; - GetVolParmsInfoBuffer volParmsInfo; - HParamBlockRec pb; - FSRef volRef; require_return(volSpec.IsSet(), FALSE); + FSRef volRef; + volRef = (FSRef) volSpec; err = FSGetVRefNum(&volRef, &vRefNum); - require_noerr_return(err, FALSE); + if (err != noErr) + { + return TRUE; + } - ZeroInit(&volParmsInfo); - ZeroInit(&pb); + err = FSGetVolumeParms(vRefNum, &buff, sizeof(buff)); - pb.ioParam.ioVRefNum = vRefNum; - pb.ioParam.ioBuffer = (Ptr) &volParmsInfo; - pb.ioParam.ioReqCount = sizeof(volParmsInfo); - err = PBHGetVolParmsSync(&pb); - if (err == noErr) - { - // we require version 3 of the info buffer to rely on the vMExtendedAttributes - if (volParmsInfo.vMVersion >= 3) - { - if (volParmsInfo.vMExtendedAttributes & (1L << bIsEjectable)) + if (buff.vMExtendedAttributes & (1L << bIsRemovable)) { return TRUE; } - } - } - return FALSE; - } // ------------------------------------------------------------------------------------ @@ -294,6 +276,7 @@ // // ------------------------------------------------------------------------------------ +/* HX_RESULT CHXFileSpecUtils::GetDirectorySize(const CHXDirSpecifier& dirSpec, BOOL shouldDescend, INT64& fSize) { // TODO: revise for Carbon @@ -404,6 +387,7 @@ fSize = totalSize; return HXR_OK; } +*/ // ------------------------------------------------------------------------------------ // @@ -412,6 +396,7 @@ // // ------------------------------------------------------------------------------------ +/* CHXFileSpecifier CHXFileSpecUtils::GetCurrentApplication() { // TODO revise for Carbon, perhaps with GetProcessBundleLocation @@ -436,7 +421,9 @@ } return appSpec; } +*/ +/* CHXDirSpecifier CHXFileSpecUtils::GetCurrentApplicationDir() { CHXFileSpecifier appSpec; @@ -449,6 +436,7 @@ } return dirSpec; } +*/ // ------------------------------------------------------------------------------------ // @@ -581,6 +569,7 @@ // // ------------------------------------------------------------------------------------ +/* HX_RESULT CHXFileSpecUtils::MakeFileReadOnly(const CHXFileSpecifier& fileSpec) { FSSpec fileFSSpec; @@ -619,6 +608,7 @@ return err; } +*/ // ------------------------------------------------------------------------------------ // @@ -803,7 +793,7 @@ Boolean targetAlreadyExists; HFSUniStr255 uniName, dataForkName; FSRef fileFSRef; - SInt16 forkRefNum; + FSIORefNum forkRefNum; OSErr err; // if an item is there already, bail if we're in dont replace mode @@ -843,9 +833,9 @@ fsWrPerm, &forkRefNum); if (err == noErr) { - long ioBytes = length; + ByteCount ioBytes = length; - err = FSWrite(forkRefNum, &ioBytes, pBuff); + err = FSWriteFork(forkRefNum, fsFromStart, 0, ioBytes, pBuff, &ioBytes); check_noerr(err); FSCloseFork(forkRefNum); @@ -895,7 +885,7 @@ HFSUniStr255 dataForkName; FSRef fileFSRef; - SInt16 forkRefNum = -1; + FSIORefNum forkRefNum = -1; SInt64 forkSize; OSStatus err; @@ -922,9 +912,9 @@ require_noerr(err, Bail); { - long ioBytes = forkSize; + ByteCount ioBytes = forkSize; - err = FSRead(forkRefNum, &ioBytes, pOutBuffer->GetBuffer()); + err = FSReadFork(forkRefNum, fsFromStart, 0, ioBytes, pOutBuffer->GetBuffer(), &ioBytes); require_noerr(err, Bail); (void) FSCloseFork(forkRefNum); Index: fileio/platform/mac/hx_morefiles.cpp =================================================================== RCS file: /cvsroot/common/fileio/platform/mac/hx_morefiles.cpp,v retrieving revision 1.5 diff -u -w -r1.5 hx_morefiles.cpp --- fileio/platform/mac/hx_morefiles.cpp 9 Jul 2004 18:19:54 -0000 1.5 +++ fileio/platform/mac/hx_morefiles.cpp 16 Dec 2008 04:09:12 -0000 @@ -55,15 +55,8 @@ #include "hx_morefiles.h" #include <string.h> -#ifndef _MAC_MACHO #include "datetimeutils.h" -#endif -#ifndef _CARBON #include "MoreFilesExtras.h" -#else -#include "MoreFilesX.h" -#include "hxassert.h" -#endif #include "hxstrutl.h" // FSpGetItemSpec @@ -342,11 +335,7 @@ BlockMove(*r,message,sizeof(Str255)); -#ifdef _CARBON - p2cstrcpy((char*)message, message); -#else p2cstr(message); -#endif SafeStrCpy(theversion,(char *)message, ulBufLen); @@ -444,198 +433,3 @@ return err; } -#ifdef _CARBON -// Stuff that used to be in MoreFilesExtras but isn't in MoreFilesX in FSSpec form - -OSErr FSpGetDirectoryID(const FSSpec* pDirSpec, long *pDirID, Boolean *pIsDir) -{ - FSRef dirRef; - Boolean isDir = false; - long dirID = 0; - OSErr err; - - err = FSpMakeFSRef(pDirSpec, &dirRef); - if (err == noErr) - { - err = FSGetNodeID(&dirRef, &dirID, &isDir); - } - - if (pDirID) *pDirID = dirID; - if (pIsDir) *pIsDir = isDir; - return err; -} - -OSErr FSpMoveRenameCompat(const FSSpec * srcSpec, const FSSpec * dstSpec, ConstStr255Param copyName) -{ - FSRef srcRef, destDirRef, newRef; - HFSUniStr255 hfsUniName; - OSErr err; - - err = FSpMakeFSRef(srcSpec, &srcRef); - require_noerr(err, CantMakeSrcRef); - - err = FSpMakeFSRef(dstSpec, &destDirRef); - require_noerr(err, CantMakeDestRef); - - if (copyName) - { - err = HFSNameGetUnicodeName(copyName, kTextEncodingUnknown, &hfsUniName); - require_noerr(err, CantMakeUnicodeName); - } - - err = FSMoveRename(&srcRef, &destDirRef, hfsUniName.length, copyName ? hfsUniName.unicode : NULL, - kTextEncodingUnknown, &newRef); - require_noerr(err, CantMoveRename); - - return noErr; - -// reverse-order cleanup - -CantMoveRename: -CantMakeUnicodeName: -CantMakeDestRef: -CantMakeSrcRef: - - return err; -} - -OSErr DeleteDirectory(short vRefNum, long dirID, ConstStr255Param name) -{ - FSRef dirRef; - OSErr err; - - err = FSMakeFSRef(vRefNum, dirID, name, &dirRef); - if (err == noErr) - { - err = FSDeleteContainerContents(&dirRef); - } - return err; -} - - -OSErr FSpFileCopy(const FSSpec *srcSpec, const FSSpec *dstSpec, ConstStr255Param copyName, - void *copyBufferPtr, long copyBufferSize, Boolean preflight) -{ - // Ultimately, this should be replaced with a new one that accompanies MoreFilesX, but that's not - // yet available from Apple - void *pBuff = NULL; - long dirID; - Str255 newName; - FSSpec newSpec; - short srcRefNum = -1; - short destRefNum = -1; - FInfo fInfo; - OSErr err; - - // get a buffer to use for copying - if (copyBufferPtr) - { - pBuff = copyBufferPtr; - } - else - { - copyBufferSize = 16*1024; - pBuff = NewPtr(copyBufferSize); - } - require_nonnull(pBuff, CantGetBuffer); - - - // copy the name of the new file - if (copyName) - { - BlockMoveData(©Name[0], &newName[0], 1 + copyName[0]); - } - else - { - BlockMoveData(&srcSpec->name[0], &newName[0], 1 + srcSpec->name[0]); - } - - // make a new file; bail if it already exists - err = FSpGetDirectoryID(dstSpec, &dirID, NULL); - require_noerr(err, CantGetDirID); - - err = FSMakeFSSpec(dstSpec->vRefNum, dirID, newName, &newSpec); - require(err == fnfErr, FileExistsAlready); - - // create the file - - err = FSpCreate(&newSpec, 0, 0, smSystemScript); - require_noerr(err, CantMakeNewFile); - - // copy the data forks - - err = FSpOpenDF(srcSpec, fsRdPerm, &srcRefNum); - require_noerr(err, CantOpenSourceDF); - - err = FSpOpenDF(&newSpec, fsRdWrPerm, &destRefNum); - require_noerr(err, CantOpenDestDF); - - err = FSCopyFork(srcRefNum, destRefNum, pBuff, copyBufferSize); - require_noerr(err, CantCopyDataFork); - - FSClose(srcRefNum); - FSClose(destRefNum); - - srcRefNum = -1; - destRefNum = -1; - - // copy the resource forks - - err = FSpOpenRF(srcSpec, fsRdPerm, &srcRefNum); - require_noerr(err, CantOpenSourceRF); - - err = FSpOpenRF(&newSpec, fsRdWrPerm, &destRefNum); - require_noerr(err, CantOpenDestRF); - - err = FSCopyFork(srcRefNum, destRefNum, pBuff, copyBufferSize); - require_noerr(err, CantCopyResourceFork); - - FSClose(srcRefNum); - FSClose(destRefNum); - - srcRefNum = -1; - destRefNum = -1; - - // copy Finder info - err = FSpGetFInfo(srcSpec, &fInfo); - require_noerr(err, CantGetFInfo); - - fInfo.fdLocation.h = fInfo.fdLocation.v = 0; - fInfo.fdFldr = 0; - fInfo.fdFlags &= ~kHasBeenInited; - err = FSpSetFInfo(&newSpec, &fInfo); - require_noerr(err, CantSetFInfo); - - // we're done with the buffer; dispose it if we allocated it here - if (copyBufferPtr == NULL) - { - DisposePtr((Ptr) pBuff); - } - return noErr; - -// reverse-order cleanup - -CantSetFInfo: -CantGetFInfo: -CantCopyResourceFork: -CantOpenDestRF: -CantOpenSourceRF: -CantCopyDataFork: - if (destRefNum != -1) FSClose(destRefNum); -CantOpenDestDF: - if (srcRefNum != -1) FSClose(srcRefNum); -CantOpenSourceDF: - FSpDelete(&newSpec); -CantMakeNewFile: -FileExistsAlready: -CantGetDirID: - if (pBuff && !copyBufferPtr) - { - DisposePtr((Ptr) pBuff); - } -CantGetBuffer: - return err; - -} - -#endif Index: fileio/platform/mac/hxdir.cpp =================================================================== RCS file: /cvsroot/common/fileio/platform/mac/hxdir.cpp,v retrieving revision 1.6 diff -u -w -r1.6 hxdir.cpp --- fileio/platform/mac/hxdir.cpp 9 Jul 2004 18:19:54 -0000 1.6 +++ fileio/platform/mac/hxdir.cpp 16 Dec 2008 04:09:12 -0000 @@ -53,13 +53,8 @@ #include "fullpathname.h" #include "hxstrutl.h" -#ifndef _CARBON #include "morefilesextras.h" #include "filecopy.h" -#else -#include "MoreFilesX.h" -#include "filespecutils.h" -#endif #include "hxheap.h" #ifdef _DEBUG @@ -878,50 +873,9 @@ BOOL CHXDirectory::IsRemovable() { -#ifdef _CARBON - if (EnsureValidPathSpec()) { return CHXFileSpecUtils::IsDiskEjectable(m_dirSpec); } return FALSE; - -#else - OSErr err; - HParamBlockRec hpb; - - - DrvQElPtr queueElPtr; - QHdrPtr queueHeader; - Ptr p; - - if (EnsureValidPathSpec()) - { - hpb.volumeParam.ioVRefNum = m_dirSpec.vRefNum; - hpb.volumeParam.ioNamePtr = NULL; - hpb.volumeParam.ioVolIndex = 0; // use vRefNum only - - err = PBHGetVInfoSync(&hpb); - check_noerr(err); - - if (err != noErr) return false; - - // check the flag bits in the drive queue (from Technote FL 530) - queueHeader = GetDrvQHdr(); - queueElPtr = (DrvQElPtr) queueHeader->qHead; - - while (queueElPtr != nil) - { - if (queueElPtr->dQDrive == hpb.volumeParam.ioVDrvInfo) - { - p = (Ptr) queueElPtr; - p -= 3; /* to get to the byte with eject info */ - if ((*p) & 8) return false; // non-ejectable - else return true; // ejectable - } - queueElPtr = (DrvQElPtr) queueElPtr->qLink; - } - } - return false; // we can't find this drive -#endif } Index: fileio/platform/mac/macasyncfile.cpp =================================================================== RCS file: /cvsroot/common/fileio/platform/mac/macasyncfile.cpp,v retrieving revision 1.6 diff -u -w -r1.6 macasyncfile.cpp --- fileio/platform/mac/macasyncfile.cpp 9 Jul 2004 18:19:54 -0000 1.6 +++ fileio/platform/mac/macasyncfile.cpp 16 Dec 2008 04:09:12 -0000 @@ -121,11 +121,7 @@ m_DeferredTaskStruct.dtReserved = 0; m_DeferredTaskStruct.dtFlags = 0; -#ifdef _CARBON - m_DeferredTaskStruct.dtAddr = NewDeferredTaskUPP(CMacAsyncFile::DeferredTaskProc); -#else m_DeferredTaskStruct.dtAddr = NewDeferredTaskProc(CMacAsyncFile::DeferredTaskProc); -#endif m_DeferredTaskStruct.dtParam = (long) this; m_DeferredTaskStruct.qType = dtQType; @@ -144,11 +140,7 @@ { if (m_DeferredTaskStruct.dtAddr != NULL) { -#ifdef _CARBON - DisposeDeferredTaskUPP(m_DeferredTaskStruct.dtAddr); -#else DisposeRoutineDescriptor(m_DeferredTaskStruct.dtAddr); -#endif m_DeferredTaskStruct.dtAddr = NULL; } @@ -722,11 +714,7 @@ // Static Initializers // -#ifdef _CARBON -IOCompletionUPP CMacAsyncFile::zmIOCallbackUPP = NewIOCompletionUPP((IOCompletionProcPtr)CMacAsyncFile::zmIOCallback); -#else IOCompletionUPP CMacAsyncFile::zmIOCallbackUPP = NewIOCompletionProc(CMacAsyncFile::zmIOCallback); -#endif // // Tell @@ -781,11 +769,7 @@ if ( !fileobj->m_bIsQuitting ) { fileobj->m_bDeferredTaskPending = TRUE; -#ifdef _CARBON - DeferredTaskProc(fileobj->m_DeferredTaskStruct.dtParam); -#else DTInstall(&fileobj->m_DeferredTaskStruct); -#endif } } } Index: fileio/platform/mac/macdir.cc =================================================================== RCS file: /cvsroot/common/fileio/platform/mac/macdir.cc,v retrieving revision 1.4 diff -u -w -r1.4 macdir.cc --- fileio/platform/mac/macdir.cc 9 Jul 2004 18:19:54 -0000 1.4 +++ fileio/platform/mac/macdir.cc 16 Dec 2008 04:09:12 -0000 @@ -89,11 +89,7 @@ ::memset(filepath,0,256); SafeStrCpy(temp,path, 256); -#ifdef _CARBON - c2pstrcpy((StringPtr)temp, (char*)temp); -#else c2pstr(temp); -#endif CreateFSSpecList(&filelist); Index: fileio/platform/mac/macff.cpp =================================================================== RCS file: /cvsroot/common/fileio/platform/mac/macff.cpp,v retrieving revision 1.5 diff -u -w -r1.5 macff.cpp --- fileio/platform/mac/macff.cpp 9 Jul 2004 18:19:54 -0000 1.5 +++ fileio/platform/mac/macff.cpp 16 Dec 2008 04:09:12 -0000 @@ -54,9 +54,7 @@ #include "hxstring.h" #include "fullpathname.h" -#ifndef _CARBON #include "morefilesextras.h" // for FSpGetDirectoryID, which is in pn_morefiles under Carbon -#endif #ifndef _MAX_PATH #define _MAX_PATH 255 @@ -262,21 +260,7 @@ m_pNextFileName = 0; } } -#ifdef _CARBON - //xxxbobclark I think this is crashing because on the final iteration - // it's an empty string and is thus returning nil somehow. - - static char* sEmptyString = "\0"; - - char* curFName = m_pCurrentFileName; - if (!curFName) - { - curFName = sEmptyString; - } - char* fName = strrchr(curFName,':'); -#else char* fName = strrchr(m_pCurrentFileName,':'); -#endif if (fName) ++fName; else Index: fileio/platform/mac/macff_carbon.cpp =================================================================== RCS file: /cvsroot/common/fileio/platform/mac/macff_carbon.cpp,v retrieving revision 1.6 diff -u -w -r1.6 macff_carbon.cpp --- fileio/platform/mac/macff_carbon.cpp 9 Jul 2004 18:19:54 -0000 1.6 +++ fileio/platform/mac/macff_carbon.cpp 16 Dec 2008 04:09:12 -0000 @@ -47,7 +47,7 @@ * * ***** END LICENSE BLOCK ***** */ -#if !defined(_CARBON) && !defined(_MAC_UNIX) +#if !defined(_MAC_UNIX) #error requires Carbon #endif Index: fileio/pub/filespec.h =================================================================== RCS file: /cvsroot/common/fileio/pub/filespec.h,v retrieving revision 1.9 diff -u -w -r1.9 filespec.h --- fileio/pub/filespec.h 9 Jul 2004 18:20:29 -0000 1.9 +++ fileio/pub/filespec.h 16 Dec 2008 04:09:12 -0000 @@ -53,12 +53,6 @@ // include the platform-specific private data types #if defined(_MAC_UNIX) #include "platform/mac/filespecmac_carbon.h" -#elif defined(_MACINTOSH) - #ifdef _CARBON - #include "platform/mac/filespecmac_carbon.h" - #else - #include "platform/mac/filespecmac.h" - #endif #elif defined(_WINDOWS) || defined(_SYMBIAN) #include "platform/win/filespecwin.h" #elif defined _UNIX @@ -113,45 +107,28 @@ HX_RESULT SetFromURL(const char *pBuffer); -#if defined(_MACINTOSH) || defined(_MAC_UNIX) - CHXFileSpecifier(const FSSpec &file); // Mac-specific +#if defined(_MAC_UNIX) CHXFileSpecifier(AliasHandle alias); CHXString GetRelativePersistentString(const CHXFileSpecifier& fromFileSpec) const; - operator FSSpec() const; - operator FSSpec*() const; - - #if defined(_CARBON) || defined(_MAC_UNIX) CHXFileSpecifier(const FSRef &ref); operator FSRef() const; operator FSRef*() const; CHXString GetPOSIXPath() const; HX_RESULT SetFromPOSIXPath(const char *pPosixPath); - CHXString GetHFSPath() const; - HX_RESULT SetFromHFSPath(const char *pHFSPath); - HFSUniStr255 GetNameHFSUniStr255() const; FSVolumeRefNum GetVRefNum() const; friend class CHXDirSpecifier; #endif -#endif private: // private data is platform-specific -#if defined(_MACINTOSH) || defined(_MAC_UNIX) - #if defined(_CARBON) || defined(_MAC_UNIX) +#if defined(_MAC_UNIX) CHXMacInternalSpec m_MacInternalSpec; - mutable FSSpec* m_pTempSpec; // for (FSSpec*) only mutable FSRef* m_pTempRef; // for (FSRef*) only - #else - CAliasHandler m_macentity; - - mutable FSSpec* m_pTempSpec; // for (FSSpec*) only - mutable void* m_pTempRef; - #endif #elif defined( _WINDOWS ) || defined( _UNIX ) || defined(_SYMBIAN) CHXPathParser m_parser; @@ -203,21 +180,11 @@ CHXString GetPersistentString() const; HX_RESULT SetFromPersistentString(const char *pBuffer); -#if defined(_MACINTOSH) || defined(_MAC_UNIX) +#if defined(_MAC_UNIX) // Mac-specific - CHXDirSpecifier(const FSSpec &folder); // Mac-specific CHXDirSpecifier(AliasHandle dirAlias); // Mac-specific - CHXFileSpecifier SpecifyChildFileStr255(ConstStr255Param child) const; - CHXDirSpecifier SpecifyChildDirectoryStr255(ConstStr255Param child) const; - long GetDirID() const; - operator FSSpec() const; // note the parID is the folder's - operator FSSpec*() const; // parent's dirID, not the folder's dirID - - #if defined(_CARBON) || defined(_MAC_UNIX) - CHXFileSpecifier SpecifyChildFileHFSUniStr255(HFSUniStr255 hfsUni) const; - CHXDirSpecifier SpecifyChildDirectoryHFSUniStr255(HFSUniStr255 hfsUni) const; HFSUniStr255 GetNameHFSUniStr255() const; FSVolumeRefNum GetVRefNum() const; @@ -227,9 +194,6 @@ operator FSRef*() const; CHXString GetPOSIXPath() const; HX_RESULT SetFromPOSIXPath(const char *pPosixPath); - CHXString GetHFSPath() const; - HX_RESULT SetFromHFSPath(const char *pHFSPath); - #endif #endif @@ -237,22 +201,10 @@ private: // private data is platform-specific -#if defined(_MACINTOSH) || defined(_MAC_UNIX) - - #if defined(_CARBON) || defined(_MAC_UNIX) +#if defined(_MAC_UNIX) CHXMacInternalSpec m_MacInternalSpec; - mutable FSSpec* m_pTempSpec; // for (FSSpec*) only mutable FSRef* m_pTempRef; // for (FSRef*) only - #else - CAliasHandler m_macentity; - - mutable FSSpec* m_pTempSpec; // for (FSSpec*) only - mutable void* m_pTempRef; - #endif -#ifndef USE_FSREFS - static OSErr FSpGetDirectoryID(const FSSpec *spec, long *theDirID, Boolean *isDirectory); -#endif #elif defined( _WINDOWS ) || defined( _UNIX ) || defined(_SYMBIAN) Index: fileio/pub/filespecutils.h =================================================================== RCS file: /cvsroot/common/fileio/pub/filespecutils.h,v retrieving revision 1.8.6.1 diff -u -w -r1.8.6.1 filespecutils.h --- fileio/pub/filespecutils.h 21 Apr 2005 19:58:01 -0000 1.8.6.1 +++ fileio/pub/filespecutils.h 16 Dec 2008 04:09:12 -0000 @@ -71,7 +71,7 @@ // file/dir utilities static HX_RESULT GetFileSize(const CHXFileSpecifier& fileSpec, INT64& fSize); - static HX_RESULT GetDirectorySize(const CHXDirSpecifier& dirSpec, BOOL shouldDescend, INT64& fSize); +// static HX_RESULT GetDirectorySize(const CHXDirSpecifier& dirSpec, BOOL shouldDescend, INT64& fSize); static BOOL FileExists(const CHXFileSpecifier& fileSpec); // returns TRUE only if exists & is a file static BOOL DirectoryExists(const CHXDirSpecifier& dirSpec); // returns TRUE only if exists & is a directory @@ -81,10 +81,12 @@ static HX_RESULT RemoveDir(const CHXDirSpecifier& dirSpec); // deletes an empty directory static HX_RESULT RemoveFile(const CHXFileSpecifier& fileSpec); -#if defined(_MACINTOSH) || defined(_MAC_UNIX) +#if defined(_MAC_UNIX) // these should be implemented on other platforms too, eventually +/* static HX_RESULT MakeFileReadOnly(const CHXFileSpecifier& fileSpec); static HX_RESULT MakeFileNotReadOnly(const CHXFileSpecifier& fileSpec); +*/ static BOOL IsDiskAudioCD(const CHXDirSpecifier& volSpec); #endif @@ -137,13 +139,13 @@ // application utilities - static CHXFileSpecifier GetCurrentApplication(void); - static CHXDirSpecifier GetCurrentApplicationDir(void); +// static CHXFileSpecifier GetCurrentApplication(void); +// static CHXDirSpecifier GetCurrentApplicationDir(void); static CHXDirSpecifier GetAppDataDir(const char* szAppName); // Macintosh-specific utilities -#if defined(_MACINTOSH) || defined(_MAC_UNIX) +#if defined(_MAC_UNIX) static FOURCC GetFileType(const CHXFileSpecifier& fileSpec); static CHXDirSpecifier MacFindFolder(short vRefNum, FolderType foldType); @@ -187,7 +189,7 @@ static void TestMacFileSpecUtils(); #endif -#endif // _MACINTOSH +#endif }; Index: fileio/pub/findfile.h =================================================================== RCS file: /cvsroot/common/fileio/pub/findfile.h,v retrieving revision 1.8 diff -u -w -r1.8 findfile.h --- fileio/pub/findfile.h 9 Jul 2004 18:20:29 -0000 1.8 +++ fileio/pub/findfile.h 16 Dec 2008 04:09:12 -0000 @@ -94,8 +94,6 @@ # define OS_PATH_DELIMITER "\\" #elif defined (_UNIX) || defined (_OPENWAVE) # define OS_PATH_DELIMITER "/" -#elif defined (_MACINTOSH) -# define OS_PATH_DELIMITER ":" #else # define OS_PATH_DELIMITER "/" #endif Index: fileio/pub/hxdir.h =================================================================== RCS file: /cvsroot/common/fileio/pub/hxdir.h,v retrieving revision 1.8 diff -u -w -r1.8 hxdir.h --- fileio/pub/hxdir.h 9 Jul 2004 18:20:29 -0000 1.8 +++ fileio/pub/hxdir.h 16 Dec 2008 04:09:12 -0000 @@ -51,8 +51,6 @@ #include "platform/unix/hxdir.h" #elif defined(_WINDOWS) #include "platform/win/hxdir.h" -#elif defined(_MACINTOSH) -#include "platform/mac/hxdir.h" #elif defined(_SYMBIAN) #include "platform/symbian/symbhxdir.h" #elif defined(_OPENWAVE) Index: fileio/pub/platform/mac/cmacfile.h =================================================================== RCS file: /cvsroot/common/fileio/pub/platform/mac/cmacfile.h,v retrieving revision 1.4 diff -u -w -r1.4 cmacfile.h --- fileio/pub/platform/mac/cmacfile.h 9 Jul 2004 18:20:14 -0000 1.4 +++ fileio/pub/platform/mac/cmacfile.h 16 Dec 2008 04:09:12 -0000 @@ -121,7 +121,6 @@ /* This write function is used in the pnlib implementation*/ INT16 Write(const char *buf, INT32 count, INT32 *actualCount); -#ifndef _CARBON static OSErr FSOpenFile (FSSpec *theSpec, short perm, short *fRefNum); @@ -141,7 +140,6 @@ static OSErr FSSetFilePos (short fRefNum, short fromWhere, long offset); -#endif static void SetFileType (OSType creator, OSType type); @@ -164,11 +162,7 @@ long Copy (Ptr destBuf, long numBytes); -#ifdef _CARBON - FSRef mFile; -#else FSSpec mFile; -#endif short mRefNum; // file refnum (-1 if not open) Boolean mAppendMode; Index: fileio/pub/platform/mac/filespecmac.h =================================================================== RCS file: /cvsroot/common/fileio/pub/platform/mac/filespecmac.h,v retrieving revision 1.3 diff -u -w -r1.3 filespecmac.h --- fileio/pub/platform/mac/filespecmac.h 9 Jul 2004 18:20:14 -0000 1.3 +++ fileio/pub/platform/mac/filespecmac.h 16 Dec 2008 04:09:12 -0000 @@ -50,10 +50,6 @@ #ifndef FILESPECMAC_H #define FILESPECMAC_H -#ifdef _CARBON -#define USE_FSREFS 1 -#endif - #include "hxstring.h" // CAliasHandler are the internal component of CHXFileSpecifier and CHXDirSpecifier Index: fileio/pub/platform/mac/filespecmac_carbon.h =================================================================== RCS file: /cvsroot/common/fileio/pub/platform/mac/filespecmac_carbon.h,v retrieving revision 1.5 diff -u -w -r1.5 filespecmac_carbon.h --- fileio/pub/platform/mac/filespecmac_carbon.h 9 Jul 2004 18:20:14 -0000 1.5 +++ fileio/pub/platform/mac/filespecmac_carbon.h 16 Dec 2008 04:09:12 -0000 @@ -99,7 +99,7 @@ public: CHXMacInternalSpec(); - CHXMacInternalSpec(const FSSpec& spec); +// CHXMacInternalSpec(const FSSpec& spec); CHXMacInternalSpec(AliasHandle alis); CHXMacInternalSpec(const char* psz); CHXMacInternalSpec(const FSRef& ref); @@ -113,16 +113,13 @@ CHXString GetPOSIXPath() const; HX_RESULT SetFromPOSIXPath(const char *pPosixPath); - CHXString GetHFSPath() const; - HX_RESULT SetFromHFSPath(const char *pHFSPath); - BOOL IsSet() const; // object has been set to a file (which may or may not exist) void CopyInternalSpec(const CHXMacInternalSpec& otherToBeCopied); OSErr SetFromPath(const char *pszPath); OSErr SetFromFSRef(const FSRef& ref); - OSErr SetFromFSSpec(const FSSpec& spec); +// OSErr SetFromFSSpec(const FSSpec& spec); OSErr SetFromAlias(AliasHandle alias); OSErr SetFromParentAndLeaf(const FSRef& parentRef, const char *pszName, CFStringEncoding encoding); OSErr SetFromParentAndLeafHFSUni(const FSRef& parentRef, const HFSUniStr255& leafName); @@ -136,7 +133,7 @@ OSErr GetParentDirectoryRef(FSRef &outParentRef) const; OSErr GetVolumeRef(FSRef& outVolumeRef) const; // get a specifier for the disk OSErr GetFSRef(FSRef& outRef) const; - OSErr GetFSSpec(FSSpec& outSpec) const; +// OSErr GetFSSpec(FSSpec& outSpec) const; OSErr GetVRefNum(FSVolumeRefNum& outVRefNum) const; Index: fileio/pub/platform/mac/fio.h =================================================================== RCS file: /cvsroot/common/fileio/pub/platform/mac/fio.h,v retrieving revision 1.5 diff -u -w -r1.5 fio.h --- fileio/pub/platform/mac/fio.h 9 Jul 2004 18:20:14 -0000 1.5 +++ fileio/pub/platform/mac/fio.h 16 Dec 2008 04:09:12 -0000 @@ -106,10 +106,8 @@ }; -#ifndef _CARBON #define ENFILE 23 /* Too many open files in system */ #define ENOSPC 28 /* No space left on device */ -#endif #define EROFS 30 /* Read-only file system */ inline int Index: fileio/pub/platform/mac/hx_morefiles.h =================================================================== RCS file: /cvsroot/common/fileio/pub/platform/mac/hx_morefiles.h,v retrieving revision 1.5 diff -u -w -r1.5 hx_morefiles.h --- fileio/pub/platform/mac/hx_morefiles.h 9 Jul 2004 18:20:14 -0000 1.5 +++ fileio/pub/platform/mac/hx_morefiles.h 16 Dec 2008 04:09:12 -0000 @@ -78,15 +78,6 @@ OSErr GetMoreVInfo(short volref, StringPtr name, unsigned long *volcreated, Boolean *islocked); -#ifdef _CARBON -// routines not present in MoreFilesX... -OSErr FSpGetDirectoryID(const FSSpec* pDirSpec, long *pDirID, Boolean *pIsDir); -OSErr FSpMoveRenameCompat(const FSSpec * srcSpec, const FSSpec * dstSpec, ConstStr255Param copyName); -OSErr DeleteDirectory(short vRefNum, long dirID, ConstStr255Param name); -OSErr FSpFileCopy(const FSSpec *srcSpec, const FSSpec *dstSpec, ConstStr255Param copyName, - void *copyBufferPtr, long copyBufferSize, Boolean preflight); -#endif - #ifdef __cplusplus } #endif Index: fileio/pub/platform/mac/hxdir.h =================================================================== RCS file: /cvsroot/common/fileio/pub/platform/mac/hxdir.h,v retrieving revision 1.5 diff -u -w -r1.5 hxdir.h --- fileio/pub/platform/mac/hxdir.h 9 Jul 2004 18:20:14 -0000 1.5 +++ fileio/pub/platform/mac/hxdir.h 16 Dec 2008 04:09:12 -0000 @@ -52,17 +52,8 @@ #include"hxbasedir.h" -#ifdef _CARBON - #include "filespec.h" -#endif - -#ifdef _MAC_MACHO #define OS_SEPARATOR_CHAR '/' #define OS_SEPARATOR_STRING "/" -#else -#define OS_SEPARATOR_CHAR ':' -#define OS_SEPARATOR_STRING ":" -#endif class CHXDirectory : public XHXDirectory { @@ -114,23 +105,11 @@ /* gets a FSSpec for this directory */ virtual FSSpec GetFSSpec(void) { -#ifdef _CARBON - return (FSSpec) CHXDirSpecifier(m_strPath); -#else return m_dirSpec; -#endif } -#if defined(_DEBUG) && defined(_CARBON) - static void TestHXDir(); -#endif - protected: -#ifdef _CARBON - FSIterator m_FSIterator; - CHXString m_strFindPattern; -#else // To keep the directory object valid even if the user renames // the drive or the parent folders, we rely on the FSSpec // rather than the path name internally. This should always @@ -151,7 +130,6 @@ INT16 m_nDefaultVRefNum; UINT16 m_nDirItems; virtual BOOL EnsureValidPathSpec(); -#endif /* Deletes empty directory. */ virtual BOOL DeleteDirectory(); Index: fileio/pub/platform/mac/macFD.h =================================================================== RCS file: /cvsroot/common/fileio/pub/platform/mac/macFD.h,v retrieving revision 1.5 diff -u -w -r1.5 macFD.h --- fileio/pub/platform/mac/macFD.h 9 Jul 2004 18:20:14 -0000 1.5 +++ fileio/pub/platform/mac/macFD.h 16 Dec 2008 04:09:12 -0000 @@ -49,10 +49,6 @@ #define USE_MAC_FD 1 -#if _MACINTOSH -#pragma once -#endif - #ifndef __MACFD__ #define __MACFD__ Index: fileio/pub/platform/mac/macff.h =================================================================== RCS file: /cvsroot/common/fileio/pub/platform/mac/macff.h,v retrieving revision 1.5 diff -u -w -r1.5 macff.h --- fileio/pub/platform/mac/macff.h 9 Jul 2004 18:20:14 -0000 1.5 +++ fileio/pub/platform/mac/macff.h 16 Dec 2008 04:09:12 -0000 @@ -53,9 +53,7 @@ #include "hxtypes.h" #include "findfile.h" -#if defined(_CARBON) || defined(_MAC_UNIX) #include "hxstring.h" -#endif class CMacFindFile : public CFindFile { @@ -85,25 +83,9 @@ virtual BOOL OS_FileMatchesPattern (const char * fname); virtual void OS_FreePattern (); -#if defined(_CARBON) || defined(_MAC_UNIX) // for macff_carbon.cpp - FSIterator m_FSIterator; char * m_pszOutFileName; -#else // !defined _CARBON, for macff.cpp - - // throw OS-specific directory and pattern-matching - // variables here! - char* m_pCurrentDirectory; - char* m_pCurrentFileName; - char* m_pNextFileName; - -// FSSpec m_DirSpec; - INT32 m_DirID; - INT16 m_VRefNum; - INT16 m_nIndex; -#endif - }; #endif // __MACFINDFILE_H Index: include/atomicbase.h =================================================================== RCS file: /cvsroot/common/include/atomicbase.h,v retrieving revision 1.36.2.7 diff -u -w -r1.36.2.7 atomicbase.h --- include/atomicbase.h 14 Mar 2007 06:07:41 -0000 1.36.2.7 +++ include/atomicbase.h 16 Dec 2008 04:09:13 -0000 @@ -1044,66 +1044,67 @@ /*********************************************************************** - * MAC / PowerPC (CW) - * - * Implementation Notes: + * Macintosh OS X -- Intel * - * This will need to be rewritten, probably, once we move away from CW to PB. + * Uses OStomic APIs, available on OS X 10.4 Tiger and later * - * Note: This is an imcompletely-defined platform, be aware that - * not all standard HXAtomic operators are defined! + * Although PPC (32-bit) could use (and has used) the PPC assembly + * language implementation below, it's simpler and more maintainable + * to have all Mac architectures use the same API here. * */ -#elif defined(_MACINTOSH) && defined(__MWERKS__) +#elif defined(_MAC_UNIX) -inline UINT32 -HXAtomicIncRetUINT32(register UINT32* pNum) -{ - register UINT32 zeroOffset = 0; - register UINT32 temp; +#include "libkern/OSAtomic.h" - asm +static inline UINT32 +HXAtomicIncRetUINT32(UINT32* pNum) { - again: - lwarx temp, zeroOffset, pNum - addi temp, temp, 1 - stwcx. temp, zeroOffset, pNum - bne- again + return (UINT32)(OSAtomicIncrement32((int32_t*)pNum)); } - return temp; +static inline UINT32 +HXAtomicDecRetUINT32(UINT32* pNum) +{ + return (UINT32)(OSAtomicDecrement32((int32_t*)pNum)); } -inline UINT32 -HXAtomicDecRetUINT32(register UINT32* pNum) +static inline UINT32 +HXAtomicAddRetUINT32(UINT32* pNum, UINT32 ulNum) { - register UINT32 zeroOffset = 0; - register UINT32 temp; + return (UINT32)(OSAtomicAdd32((int32_t)ulNum, (int32_t*)pNum)); +} - asm +static inline UINT32 +HXAtomicSubRetUINT32(UINT32* pNum, UINT32 ulNum) { - again: - lwarx temp, zeroOffset, pNum - subi temp, temp, 1 - stwcx. temp, zeroOffset, pNum - bne- again + return (UINT32)(OSAtomicAdd32(-(int32_t)ulNum, (int32_t*)pNum)); } - return temp; -} +// the rest of these atomic operations can be implemented in terms of the four above. +static inline void HXAtomicIncINT32(INT32* p) { (void)HXAtomicIncRetUINT32((UINT32*)p); } +static inline void HXAtomicDecINT32(INT32* p) { (void)HXAtomicDecRetUINT32((UINT32*)p); } +static inline void HXAtomicAddINT32(INT32* p, INT32 n) { (void)HXAtomicAddRetUINT32((UINT32*)p, (UINT32)n); } +static inline void HXAtomicSubINT32(INT32* p, INT32 n) { (void)HXAtomicSubRetUINT32((UINT32*)p, (UINT32)n); } +static inline INT32 HXAtomicIncRetINT32(INT32* p) { return (INT32)HXAtomicIncRetUINT32((UINT32*)p); } +static inline INT32 HXAtomicDecRetINT32(INT32* p) { return (INT32)HXAtomicDecRetUINT32((UINT32*)p); } +static inline INT32 HXAtomicAddRetINT32(INT32* p, INT32 n) { return (INT32)HXAtomicAddRetUINT32((UINT32*)p, (UINT32)n); } +static inline INT32 HXAtomicSubRetINT32(INT32* p, INT32 n) { return (INT32)HXAtomicSubRetUINT32((UINT32*)p, (UINT32)n); } +static inline void HXAtomicIncUINT32(UINT32* p) { (void)HXAtomicIncRetUINT32(p); } +static inline void HXAtomicDecUINT32(UINT32* p) { (void)HXAtomicDecRetUINT32(p); } +static inline void HXAtomicAddUINT32(UINT32* p, UINT32 n) { (void)HXAtomicAddRetUINT32(p, n); } +static inline void HXAtomicSubUINT32(UINT32* p, UINT32 n) { (void)HXAtomicSubRetUINT32(p, n); } /*********************************************************************** - * MAC - PowerPC (PB or XCode) / Linux - PowerPC + * Linux - PowerPC * * Implementation Notes: * * Use PowerPC load exclusive and store exclusive instructions * */ -#elif (defined(_MAC_UNIX) && defined(__ppc__)) || (defined(_LINUX) && defined(__powerpc__)) - -// could also probably be defined(__GNUC__) && defined(__powerpc) +#elif defined(_LINUX) && defined(__powerpc__) static inline UINT32 HXAtomicIncRetUINT32(UINT32* pNum) @@ -1195,94 +1196,6 @@ static inline void HXAtomicSubUINT32(UINT32* p, UINT32 n) { (void)HXAtomicSubRetUINT32(p, n); } -/*********************************************************************** - * Macintosh OS X -- Intel - * - * Uses OStomic APIs, available on OS X 10.4 Tiger and later - * - */ -#elif defined(_MAC_UNIX) && defined(__i386__) - -#include "libkern/OSAtomic.h" - -static inline UINT32 -HXAtomicIncRetUINT32(UINT32* pNum) -{ - return (UINT32)(OSAtomicIncrement32((int32_t*)pNum)); -} - -static inline UINT32 -HXAtomicDecRetUINT32(UINT32* pNum) -{ - return (UINT32)(OSAtomicDecrement32((int32_t*)pNum)); -} - -static inline UINT32 -HXAtomicAddRetUINT32(UINT32* pNum, UINT32 ulNum) -{ - return (UINT32)(OSAtomicAdd32((int32_t)ulNum, (int32_t*)pNum)); -} - -static inline UINT32 -HXAtomicSubRetUINT32(UINT32* pNum, UINT32 ulNum) -{ - return (UINT32)(OSAtomicAdd32(-(int32_t)ulNum, (int32_t*)pNum)); -} - -// the rest of these atomic operations can be implemented in terms of the four above. - -static inline void HXAtomicIncINT32(INT32* p) { (void)HXAtomicIncRetUINT32((UINT32*)p); } -static inline void HXAtomicDecINT32(INT32* p) { (void)HXAtomicDecRetUINT32((UINT32*)p); } -static inline void HXAtomicAddINT32(INT32* p, INT32 n) { (void)HXAtomicAddRetUINT32((UINT32*)p, (UINT32)n); } -static inline void HXAtomicSubINT32(INT32* p, INT32 n) { (void)HXAtomicSubRetUINT32((UINT32*)p, (UINT32)n); } -static inline INT32 HXAtomicIncRetINT32(INT32* p) { return (INT32)HXAtomicIncRetUINT32((UINT32*)p); } -static inline INT32 HXAtomicDecRetINT32(INT32* p) { return (INT32)HXAtomicDecRetUINT32((UINT32*)p); } -static inline INT32 HXAtomicAddRetINT32(INT32* p, INT32 n) { return (INT32)HXAtomicAddRetUINT32((UINT32*)p, (UINT32)n); } -static inline INT32 HXAtomicSubRetINT32(INT32* p, INT32 n) { return (INT32)HXAtomicSubRetUINT32((UINT32*)p, (UINT32)n); } -static inline void HXAtomicIncUINT32(UINT32* p) { (void)HXAtomicIncRetUINT32(p); } -static inline void HXAtomicDecUINT32(UINT32* p) { (void)HXAtomicDecRetUINT32(p); } -static inline void HXAtomicAddUINT32(UINT32* p, UINT32 n) { (void)HXAtomicAddRetUINT32(p, n); } -static inline void HXAtomicSubUINT32(UINT32* p, UINT32 n) { (void)HXAtomicSubRetUINT32(p, n); } - -/*********************************************************************** - * Generic - * - * Implementation Notes: - * - * This should work on any platform with a HXMutex-style mutex. - * It allocates a pool of mutexes and hashes the int pointers - * to one of the mutexes. Since the mutexes are held for - * such a short time, only long enough to increment an int, - * collisions should be extremely rare and this should work fine, - * although it is probably less fast than the extra-high-performance - * atomic operators provided above. You need to link in atomic.cpp - * to get HXAtomic::m_pLocks defined. - * - * Basic design of the mutex-based lock-pool implementation: - * At startup, allocate an array of N mutexes (where N is a power of 2). - * When a method is called, hash the int pointer to one of the locks. - * Lock this mutex. - * Modify the value. - * Unlock this mutex. - * - * - * Platform-specific notes: - * Any platforms that use this should be documented here! - * Why are you using the generic operators for this platform? - * - * HP-UX / HP-PA: - * This is used on the HP-PA processor since it doesn't provide the - * necessary assembler operators to implement proper atomic updates - * of ints. HP's mutex primitive seems pretty fast however, resulting - * in a workable solution. - * - * OpenBSD: - * The standard assembler on x86 can't handle the gcc/asm operators - * defined above, so we're using the lock-pool approach for now. - * This approach also makes it possible to support non-x86 OpenBSD - * builds more easily (someday). - * - */ #elif defined(_HPUX) || defined(_OPENBSD) #if defined(__cplusplus) Index: include/chxxtype.h =================================================================== RCS file: /cvsroot/common/include/chxxtype.h,v retrieving revision 1.6 diff -u -w -r1.6 chxxtype.h --- include/chxxtype.h 2 Nov 2004 22:56:04 -0000 1.6 +++ include/chxxtype.h 16 Dec 2008 04:09:13 -0000 @@ -255,10 +255,7 @@ CHXxRect operator+(const CHXxPoint& point) const; CHXxRect operator-(const CHXxPoint& point) const; -#ifdef _MACINTOSH - operator Rect* (void) const; - CHXxRect(const Rect& rect); -#elif defined _WINDOWS +#if defined _WINDOWS operator RECT (void); operator RECT (void) const; #endif @@ -443,17 +440,7 @@ inline CHXxRect CHXxRect::operator-(const CHXxPoint& pt) const { CHXxRect rect(*this); rect.Offset(-pt.x, -pt.y); return rect; } -#ifdef _MACINTOSH -inline CHXxRect::operator Rect* (void) const - { Rect rect; ::SetRect(&rect, left, top, right, bottom); return (Rect*)▭ } // (?) Dangerous. Passing pointer to a local variable. -inline CHXxRect::CHXxRect(const Rect& rect) - { - left = rect.left; - top = rect.top; - right = rect.right; - bottom = rect.bottom; - } -#elif defined _WINDOWS +#if defined _WINDOWS inline CHXxRect::operator RECT () {RECT xxrc; xxrc.left=(int)left, xxrc.top=(int)top, xxrc.right=(int)right, xxrc.bottom=(int)bottom; return xxrc;} inline CHXxRect::operator RECT () const Index: include/hxauth.h =================================================================== RCS file: /cvsroot/common/include/hxauth.h,v retrieving revision 1.3 diff -u -w -r1.3 hxauth.h --- include/hxauth.h 9 Jul 2004 18:20:48 -0000 1.3 +++ include/hxauth.h 16 Dec 2008 04:09:13 -0000 @@ -408,14 +408,6 @@ const char* pPassword) PURE; }; -#ifdef _MACINTOSH -#pragma export on -#endif - STDAPI CreatePassword(IUnknown** /* OUT */ ppIUnknown); -#ifdef _MACINTOSH -#pragma export off -#endif - #endif /* _HXAUTH_H_ */ Index: include/hxcore.h =================================================================== RCS file: /cvsroot/common/include/hxcore.h,v retrieving revision 1.8.6.3 diff -u -w -r1.8.6.3 hxcore.h --- include/hxcore.h 17 Apr 2007 21:00:50 -0000 1.8.6.3 +++ include/hxcore.h 16 Dec 2008 04:09:13 -0000 @@ -85,10 +85,6 @@ typedef struct _HXxEvent HXxEvent; -#ifdef _MAC_CFM -#pragma export on -#endif - #if defined _UNIX && !(defined _VXWORKS) /* Includes needed for select() stuff */ #include <sys/time.h> @@ -140,10 +136,6 @@ */ STDAPI CloseEngine( IHXClientEngine* /*IN*/ pEngine ); -#ifdef _MAC_CFM -#pragma export off -#endif - /* * Definitions of Function Pointers to CreateEngine() and Close Engine(). * These types are provided as a convenince to authors of top level clients. Index: include/hxencod.h =================================================================== RCS file: /cvsroot/common/include/hxencod.h,v retrieving revision 1.3 diff -u -w -r1.3 hxencod.h --- include/hxencod.h 9 Jul 2004 18:20:48 -0000 1.3 +++ include/hxencod.h 16 Dec 2008 04:09:13 -0000 @@ -61,14 +61,7 @@ typedef _INTERFACE IHXConnectionlessControl IHXConnectionlessControl; typedef _INTERFACE IHXTransportControl IHXTransportControl; -#ifndef _MACINTOSH STDAPI_(IUnknown*) CreateContext(); -#else -#pragma export on -STDAPI_(IUnknown*) CreateContext(); -#pragma export off -#endif - DEFINE_GUID(IID_IHXEncoderResponse, 0x00001600, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59); Index: include/hxhpbase.h =================================================================== RCS file: /cvsroot/common/include/hxhpbase.h,v retrieving revision 1.8 diff -u -w -r1.8 hxhpbase.h --- include/hxhpbase.h 9 Jul 2004 18:20:48 -0000 1.8 +++ include/hxhpbase.h 16 Dec 2008 04:09:13 -0000 @@ -223,13 +223,6 @@ /* ------------------------ _WIN32 ------------------------- */ # endif - /* ---------------------- MACINTOSH ---------------------- */ -# ifdef _MACINTOSH - -# define HX_DEBUG_NEW new - - /* ---------------------- MACINTOSH ---------------------- */ -# endif # else /* end debug section */ Index: include/hxplugn.h =================================================================== RCS file: /cvsroot/common/include/hxplugn.h,v retrieving revision 1.6.4.1 diff -u -w -r1.6.4.1 hxplugn.h --- include/hxplugn.h 15 Aug 2006 18:22:04 -0000 1.6.4.1 +++ include/hxplugn.h 16 Dec 2008 04:09:13 -0000 @@ -141,19 +141,12 @@ * situation. * */ -#ifdef _MAC_CFM -#pragma export on -#endif STDAPI HXCreateInstance ( IUnknown** /*OUT*/ ppIUnknown ); -#ifdef _MAC_CFM -#pragma export off -#endif - /**************************************************************************** * @@ -167,16 +160,9 @@ * resources. This method is called just before the DLL is unloaded. * */ -#ifdef _MAC_CFM -#pragma export on -#endif STDAPI HXShutdown(void); -#ifdef _MAC_CFM -#pragma export off -#endif - /**************************************************************************** * Index: include/hxtypes.h =================================================================== RCS file: /cvsroot/common/include/hxtypes.h,v retrieving revision 1.24.4.6 diff -u -w -r1.24.4.6 hxtypes.h --- include/hxtypes.h 31 Dec 2006 17:48:22 -0000 1.24.4.6 +++ include/hxtypes.h 16 Dec 2008 04:09:13 -0000 @@ -66,10 +66,6 @@ # endif /* Free */ #endif -#ifdef _MACINTOSH -#pragma once -#endif - #ifndef _HXTYPES_H_ #define _HXTYPES_H_ @@ -136,7 +132,11 @@ typedef unsigned char UINT8; /* unsigned 8 bit value */ typedef short int INT16; /* signed 16 bit value */ typedef unsigned short int UINT16; /* unsigned 16 bit value */ -# if (defined _UNIX && defined _LONG_IS_64) +# if defined(_MAC_UNIX) + typedef UInt32 UINT32; + typedef SInt32 INT32; + typedef UInt32 UINT; +# elif (defined _UNIX && defined _LONG_IS_64) typedef int INT32; /* signed 32 bit value */ typedef unsigned int UINT32; /* unsigned 32 bit value */ typedef unsigned int UINT; @@ -225,14 +225,6 @@ #endif -#ifdef _MACINTOSH - #ifdef powerc - #define _MACPPC - #else - #define _MAC68K - #endif -#endif - #if defined(_SYMBIAN) #define PATH_MAX KMaxPath #endif @@ -268,9 +260,6 @@ #define MAX_UINT64 0xffffffffffffffffULL #endif /* MAX_UINT64 */ -#if defined(_MACINTOSH) -#define kLetInterruptsFinishBeforeQuittingGestalt 'RN$~' -#endif // $EndPrivate. #define MAX_DISPLAY_NAME 256 @@ -306,9 +295,7 @@ typedef INT32 long32; typedef UINT32 u_long32; -#ifndef _MACINTOSH typedef INT8 Int8; -#endif typedef UINT8 u_Int8; typedef INT16 Int16; typedef UINT16 u_Int16; @@ -456,7 +443,7 @@ #define HXEXPORT_PTR * #endif -#if defined(_WIN32) || defined(_WINDOWS) || defined (_MACINTOSH)|| defined (_UNIX) +#if defined(_WIN32) || defined(_WINDOWS) || defined (_UNIX) typedef void (*RANOTIFYPROC)( void* ); #endif @@ -738,18 +725,10 @@ #endif -#ifdef _MACINTOSH -// xxxbobclark with CWPro 7, there is a code generation bug in the long long -// casting code. It can be avoided by first casting to an unsigned long long. -// This is supposedly fixed in the upcoming (as of this writing) CWPro 8, but -// for now we're setting up the casting using a macro to change it easily. -#define CAST_TO_INT64 (INT64)(UINT64) -#else #define CAST_TO_INT64 (INT64) -#endif -#if defined _LONG_IS_64 && (defined _OSF1 || defined _SOLARIS || defined _HPUX || defined __amd64__) +#if (defined _LONG_IS_64 && (defined _OSF1 || defined _SOLARIS || defined _HPUX || defined __amd64__ || defined _MAC_UNIX)) typedef unsigned long PTR_INT; #else typedef unsigned int PTR_INT; Index: include/hxver.h =================================================================== RCS file: /cvsroot/common/include/hxver.h,v retrieving revision 1.17.6.3 diff -u -w -r1.17.6.3 hxver.h --- include/hxver.h 10 Sep 2007 15:19:25 -0000 1.17.6.3 +++ include/hxver.h 16 Dec 2008 04:09:13 -0000 @@ -136,8 +136,6 @@ #define STRPLATFORM " (32-bit) " #elif defined(_WIN16) #define STRPLATFORM " (16-bit) " -#elif defined(_MACINTOSH) -#define STRPLATFORM " MacPPC " #endif #define HXVER_SDK_PRODUCT "HelixSDK" Index: include/platform.h =================================================================== RCS file: /cvsroot/common/include/platform.h,v retrieving revision 1.32.2.3 diff -u -w -r1.32.2.3 platform.h --- include/platform.h 30 Aug 2006 17:30:52 -0000 1.32.2.3 +++ include/platform.h 16 Dec 2008 04:09:13 -0000 @@ -49,6 +49,6 @@ #ifndef _PLATFORM_H_ #define _PLATFORM_H_ -#define TARVER_STR_PLATFORM "linux-2.2-libc6-gcc32-i586" -#define TARVER_STR_BUILD_BRANCH "hxclient_1_5_0_cayenne_restricted" +#define TARVER_STR_PLATFORM "macos-gcc4-xcode3" +#define TARVER_STR_BUILD_BRANCH "voldemort_mac" #endif Index: include/rmfftype.h =================================================================== RCS file: /cvsroot/common/include/rmfftype.h,v retrieving revision 1.8.6.4 diff -u -w -r1.8.6.4 rmfftype.h --- include/rmfftype.h 16 Jun 2006 09:37:21 -0000 1.8.6.4 +++ include/rmfftype.h 16 Dec 2008 04:09:13 -0000 @@ -124,13 +124,6 @@ #pragma warning( disable : 4200 ) #endif -#ifdef _MACINTOSH -// modify packing of VideoTypeSpecificData to match -// hxcodec.h's packing of HX_FORMAT_VIDEO -// cr grobbinsky cf rlovejoy -#pragma options align=mac68k -#endif - #include "hxinline.h" class RMGenericHeader @@ -1894,9 +1887,6 @@ // Restore warnings #pragma warning( default : 4200 ) #endif -#ifdef _MACINTOSH -#pragma options align=reset -#endif #endif Index: include/rnver.h =================================================================== RCS file: /cvsroot/common/include/rnver.h,v retrieving revision 1.10.6.2 diff -u -w -r1.10.6.2 rnver.h --- include/rnver.h 18 Oct 2006 15:19:07 -0000 1.10.6.2 +++ include/rnver.h 16 Dec 2008 04:09:13 -0000 @@ -130,8 +130,6 @@ #define STRPLATFORM " (32-bit) " #elif defined(_WIN16) #define STRPLATFORM " (16-bit) " -#elif defined(_MACINTOSH) -#define STRPLATFORM " MacPPC " #endif #ifndef HXVER_SDK_PRODUCT Index: lang/xml/xmlconfig.cpp =================================================================== RCS file: /cvsroot/common/lang/xml/xmlconfig.cpp,v retrieving revision 1.10 diff -u -w -r1.10 xmlconfig.cpp --- lang/xml/xmlconfig.cpp 19 Jul 2004 21:13:16 -0000 1.10 +++ lang/xml/xmlconfig.cpp 16 Dec 2008 04:09:13 -0000 @@ -110,14 +110,6 @@ #elif defined (_UNIX) #define OS_SEPARATOR_CHAR '/' #define OS_SEPARATOR_STRING "/" -#elif defined (_MACINTOSH) -#ifdef _MAC_MACHO -#define OS_SEPARATOR_CHAR '/' -#define OS_SEPARATOR_STRING "/" -#else -#define OS_SEPARATOR_CHAR ':' -#define OS_SEPARATOR_STRING ":" -#endif #endif // defined (_WINDOWS ) || defined (_WIN32) XMLConfig::XMLConfigListNode::~XMLConfigListNode() Index: lang/xml/xmlwrite.cpp =================================================================== RCS file: /cvsroot/common/lang/xml/xmlwrite.cpp,v retrieving revision 1.6 diff -u -w -r1.6 xmlwrite.cpp --- lang/xml/xmlwrite.cpp 19 Jul 2004 21:13:16 -0000 1.6 +++ lang/xml/xmlwrite.cpp 16 Dec 2008 04:09:13 -0000 @@ -87,8 +87,6 @@ #if defined _WINDOWS #define WRITER_EOL "\n" -#elif defined _MACINTOSH -#define WRITER_EOL "\r" #else #define WRITER_EOL "\n" #endif Index: log/logsystem/hxtdeliverymanager.cpp =================================================================== RCS file: /cvsroot/common/log/logsystem/hxtdeliverymanager.cpp,v retrieving revision 1.2.6.3 diff -u -w -r1.2.6.3 hxtdeliverymanager.cpp --- log/logsystem/hxtdeliverymanager.cpp 26 Apr 2005 23:06:28 -0000 1.2.6.3 +++ log/logsystem/hxtdeliverymanager.cpp 16 Dec 2008 04:09:13 -0000 @@ -81,7 +81,7 @@ , m_pIContextObserver(NULL) , m_pMessageFilter(NULL) { - m_nId = reinterpret_cast<UINT32>(pIUnknown); + m_nId = (UINT32)(PTR_INT)(pIUnknown); pIUnknown->QueryInterface(IID_IHXTLogObserver, (void**)&m_pIObserver); pIUnknown->QueryInterface(IID_IHXTLogObserver2, (void**)&m_pIObserver2); @@ -331,7 +331,7 @@ { pMsg->MessageType(CLogMsg::FILTER_MESSAGE); CLogMsgFilter* pMsgFilter = static_cast<CLogMsgFilter*>(pMsg->Message()); - pMsgFilter->ObserverId(reinterpret_cast<UINT32>(pObserver)); + pMsgFilter->ObserverId((UINT32)(PTR_INT)pObserver); pMsgFilter->MessageFilter(szFilterStr); } @@ -368,7 +368,7 @@ //Find the Observer asking to unsubscribe HXScopeLock lock(m_pObserverMutex); - UINT32 nObserverId = reinterpret_cast<UINT32>(pObserver); + UINT32 nObserverId = (UINT32)(PTR_INT)pObserver; CHXSimpleList::Iterator iter = m_observers.Begin(); for( ; iter != m_observers.End(); ++iter) { @@ -394,7 +394,7 @@ // Find the record for the observer that sent the locale HXScopeLock lock(m_pObserverMutex); - UINT32 nObserverId = reinterpret_cast<UINT32>(pObserver); + UINT32 nObserverId = (UINT32)(PTR_INT)(pObserver); CHXSimpleList::Iterator iter = m_observers.Begin(); for( /**/;iter != m_observers.End(); ++iter) { Index: log/logsystem/hxtlogfilter.cpp =================================================================== RCS file: /cvsroot/common/log/logsystem/hxtlogfilter.cpp,v retrieving revision 1.1.1.1.8.2 diff -u -w -r1.1.1.1.8.2 hxtlogfilter.cpp --- log/logsystem/hxtlogfilter.cpp 26 Apr 2005 23:06:28 -0000 1.1.1.1.8.2 +++ log/logsystem/hxtlogfilter.cpp 16 Dec 2008 04:09:13 -0000 @@ -347,7 +347,7 @@ CHXPtrArray::Iterator iter = m_vMsgNum.Begin(); while(iter != m_vMsgNum.End()) { - if(UINT32(*iter) == pMsg->MessageNumber()) + if((UINT32)(PTR_INT)(*iter) == pMsg->MessageNumber()) { bPassedOne = TRUE; break; Index: log/logsystem/hxtthreadtracker.cpp =================================================================== RCS file: /cvsroot/common/log/logsystem/hxtthreadtracker.cpp,v retrieving revision 1.1.1.1.8.3 diff -u -w -r1.1.1.1.8.3 hxtthreadtracker.cpp --- log/logsystem/hxtthreadtracker.cpp 5 Sep 2005 12:52:31 -0000 1.1.1.1.8.3 +++ log/logsystem/hxtthreadtracker.cpp 16 Dec 2008 04:09:13 -0000 @@ -188,7 +188,7 @@ int count = pThreadData->m_vChildThreads.GetSize(); for (int idx = 0; idx < count; ++idx) { - SetThreadJobName(szJobName, (UINT32)pThreadData->m_vChildThreads.GetAt(idx)); + SetThreadJobName(szJobName, (UINT32)(PTR_INT)pThreadData->m_vChildThreads.GetAt(idx)); } } } Index: log/logutil/pub/hxtlogutil.h =================================================================== RCS file: /cvsroot/common/log/logutil/pub/hxtlogutil.h,v retrieving revision 1.3.6.9 diff -u -w -r1.3.6.9 hxtlogutil.h --- log/logutil/pub/hxtlogutil.h 30 Oct 2007 20:25:14 -0000 1.3.6.9 +++ log/logutil/pub/hxtlogutil.h 16 Dec 2008 04:09:13 -0000 @@ -212,16 +212,6 @@ #define HXLOG_DLLSUFFIX ".dll" #elif defined(_MAC_UNIX) #define HXLOG_DLLSUFFIX ".bundle" -#elif _MACINTOSH -#if defined(_CARBON) -#ifdef _MAC_MACHO -#define HXLOG_DLLSUFFIX ".bundle" -#else -#define HXLOG_DLLSUFFIX ".shlb" -#endif -#else // _CARBON -#define HXLOG_DLLSUFFIX ".DLL" -#endif // _CARBON #elif defined (_UNIX) #define HXLOG_DLLSUFFIX ".so" #else Index: netio/conn.cpp =================================================================== RCS file: /cvsroot/common/netio/conn.cpp,v retrieving revision 1.11 diff -u -w -r1.11 conn.cpp --- netio/conn.cpp 9 Jul 2004 18:22:39 -0000 1.11 +++ netio/conn.cpp 16 Dec 2008 04:09:13 -0000 @@ -480,13 +480,7 @@ char pHostname[ulHostNameLen]; /* Flawfinder: ignore */ -#ifndef _MACINTOSH char **pptr; -#endif - -#ifdef _MACINTOSH - return HXR_UNEXPECTED; -#endif theErr = init_drivers(NULL); if (FAILED(theErr)) @@ -511,7 +505,6 @@ HX_ASSERT(hptr); -#ifndef _MACINTOSH if (hptr->h_addrtype == AF_INET) { // get # of interfaces @@ -542,7 +535,6 @@ { theErr = HXR_UNEXPECTED; } -#endif bail: return theErr; @@ -552,22 +544,6 @@ #if defined(HELIX_FEATURE_SECURECONN) CHXMapPtrToPtr secureconnhelper::zm_ConnMap; -// xxxbobclark yeesh, why this is required I'm still working on. -// Yuck nonetheless. - -void WasteTime() -{ -#ifdef _MACINTOSH - ULONG32 startTix = HX_GET_TICKCOUNT(); - - while (CALCULATE_ELAPSED_TICKS(startTix, HX_GET_TICKCOUNT()) < 200) - { -// EventRecord er; -// ::EventAvail(everyEvent, &er); - } -#endif -} - conn* secureconnhelper::GetConn(LONG32 fakeFD) { @@ -597,8 +573,6 @@ UINT16 bytes = (UINT16) len; result = pConn->read(buff, &bytes); - WasteTime(); - if (result == HXR_OK) { return bytes; @@ -619,8 +593,6 @@ UINT16 bytes = (UINT16) len; result = pConn->write(buff, &bytes); - WasteTime(); - if (result == HXR_OK) { return bytes; @@ -702,8 +674,6 @@ HX_RESULT result = m_pActualConn->connect(host, port, blocking, ulPlatform); - WasteTime(); - if (result == HXR_OK) { result = m_pHXSSL->PostConnect(m_FakeFD); @@ -883,24 +853,6 @@ return m_pActualConn->last_error(); } -#ifdef _MACINTOSH -HX_RESULT -secureconn::GetEndpoint(REF(void*) pRef) -{ - HX_ASSERT(m_pActualConn != NULL); - - return m_pActualConn->GetEndpoint(pRef); -} - -HX_RESULT -secureconn::SetupEndpoint(BOOL bWait) -{ - HX_ASSERT(m_pActualConn != NULL); - - return m_pActualConn->SetupEndpoint(bWait); -} -#endif - void secureconn::set_callback(HXAsyncNetCallback* pCallback) { Index: netio/thrdconn.cpp =================================================================== RCS file: /cvsroot/common/netio/thrdconn.cpp,v retrieving revision 1.14 diff -u -w -r1.14 thrdconn.cpp --- netio/thrdconn.cpp 9 Jul 2004 18:22:39 -0000 1.14 +++ netio/thrdconn.cpp 16 Dec 2008 04:09:14 -0000 @@ -62,11 +62,6 @@ #include "platform/unix/UnixThreads.h" #endif /* _UNIX_THREADED_NETWORK_IO */ -#ifdef _CARBON -#include "carbthrd.h" -#endif - - #include "hxslist.h" #include "growingq.h" @@ -260,15 +255,6 @@ } } m_pMainAppThread=NULL; -#elif defined(_CARBON) && defined(THREADS_SUPPORTED) - // remove any messages from the main app thread for us. - HX_ASSERT(m_pMainAppThread); - HXThreadMessage msgBack; - HXThreadMessage msgMatch(0, (void*)this, NULL, NULL); - while (((HXCarbonThread*)m_pMainAppThread)->PeekMessageMatching(&msgBack, &msgMatch, TRUE) == HXR_OK) - { - } - m_pMainAppThread = NULL; #endif } @@ -1421,9 +1407,6 @@ HX_RESULT ThreadedConn::DoRead(BOOL bFromReadNotification) { -#ifdef _CARBON - AddRef(); // ensure that this object doesn't encounter its dtor before routine completes -#endif HX_RESULT theErr = HXR_OK; m_pMutex->Lock(); @@ -1582,9 +1565,6 @@ exit: m_pMutex->Unlock(); -#ifdef _CARBON - Release(); -#endif return theErr; } @@ -1598,9 +1578,6 @@ { return; } -#ifdef _CARBON - AddRef(); -#endif HX_RESULT theErr = HXR_OK; m_pMutex->Lock(); if (m_uSocketType == HX_TCP_SOCKET) @@ -1700,9 +1677,6 @@ m_bConnected = FALSE; PostDoneAndDetach(); } -#ifdef _CARBON - Release(); -#endif } //-------------------------------------------------- Index: netio/threngin.cpp =================================================================== RCS file: /cvsroot/common/netio/threngin.cpp,v retrieving revision 1.6 diff -u -w -r1.6 threngin.cpp --- netio/threngin.cpp 9 Jul 2004 18:22:39 -0000 1.6 +++ netio/threngin.cpp 16 Dec 2008 04:09:14 -0000 @@ -64,10 +64,6 @@ #include "platform/unix/unix_net.h" #endif -#if defined(_MACINTOSH) && defined(_CARBON) && defined(THREADS_SUPPORTED) -#include "carbthrd.h" -#endif - #include "hxheap.h" #ifdef _DEBUG #undef HX_THIS_FILE @@ -106,10 +102,6 @@ , m_pSockMap(0) , m_pQuitEvent(NULL) , m_bInDestructor(FALSE) -#if defined(_MACINTOSH) && defined(_CARBON) && defined(THREADS_SUPPORTED) - , m_ThreadedNetworkingCarbonTimerUPP(NULL) - , m_ThreadedNetworkingCarbonTimerRef(NULL) -#endif #if defined(HELIX_FEATURE_NETWORK_USE_SELECT) , m_pLocalListener(NULL) , m_pLocalReader(NULL) @@ -138,17 +130,6 @@ HXThread::MakeStubThread(m_pMainAppThread); #endif m_pMainAppThread->YieldTimeSlice(); - -#if defined(_MACINTOSH) && defined(_CARBON) && defined(THREADS_SUPPORTED) - HX_ASSERT(!m_ThreadedNetworkingCarbonTimerUPP); - HX_ASSERT(!m_ThreadedNetworkingCarbonTimerRef); - - m_ThreadedNetworkingCarbonTimerUPP = ::NewEventLoopTimerUPP( - (EventLoopTimerProcPtr)FauxMainAppCarbonTimer); - InstallEventLoopTimer(GetCurrentEventLoop(), 0, 50 * kEventDurationMillisecond, - m_ThreadedNetworkingCarbonTimerUPP, this, &m_ThreadedNetworkingCarbonTimerRef); - -#endif } ThreadEngine::~ThreadEngine() @@ -209,14 +190,6 @@ m_pLocalListener->Release(); #endif // HELIX_FEATURE_NETWORK_USE_SELECT -#if defined(_MACINTOSH) && defined(_CARBON) && defined(THREADS_SUPPORTED) - ::RemoveEventLoopTimer(m_ThreadedNetworkingCarbonTimerRef); - m_ThreadedNetworkingCarbonTimerRef; - - ::DisposeEventLoopTimerUPP(m_ThreadedNetworkingCarbonTimerUPP); - m_ThreadedNetworkingCarbonTimerUPP; -#endif - if (m_pMainAppThread) { delete m_pMainAppThread; @@ -644,62 +617,3 @@ } -#if defined(_MACINTOSH) && defined(_CARBON) && defined(THREADS_SUPPORTED) - -void ThreadEngine::FauxMainAppCarbonTimer(EventLoopTimerRef, void* /* unused */) -{ - // xxxbobclark this is essentially just ripped off from Greg Wright's - // similar message handling loop for Unix. - // - // It's been moved to pnio because more places than just rmacore - // (i.e. rmacleng) use the threaded implementation of networking, - // viz. rnqueue for Auto-Update. Using a Carbon Timer to get time - // periodically can luckily be implemented in pnio; it's sure to - // get actual System Time. - - ThreadEngine* pEngine = ThreadEngine::GetThreadEngine(); - HX_ASSERT(pEngine); - HXCarbonThread* pMainAppThread = (HXCarbonThread*)pEngine->GetMainAppThread(); - HX_ASSERT(pMainAppThread); - HXThreadMessage msg; - - while (pMainAppThread->PeekMessage(&msg, 0, 0, TRUE) == HXR_OK) - { - if (msg.m_ulMessage != 0) - { - ThreadedConn* pThreadedConn = (ThreadedConn*)msg.m_pParam1; - if (pThreadedConn) - { - switch (msg.m_ulMessage) - { - case HXMSG_ASYNC_DNS: - pThreadedConn->OnAsyncDNS((BOOL)msg.m_pParam2); - break; - - case HXMSG_ASYNC_CONNECT: - pThreadedConn->OnConnect((BOOL)msg.m_pParam2); - break; - - case HXMSG_ASYNC_READ: - pThreadedConn->OnReadNotification(); - break; - - case HXMSG_ASYNC_WRITE: - pThreadedConn->OnWriteNotification(); - break; - - case HXMSG_ASYNC_ACCEPT: - pThreadedConn->OnAcceptNotification(); - break; - - default: - HX_ASSERT(!"Unknown message in threaded networking Carbon Timer"); - break; - - } - } - } - } -} - -#endif Index: netio/platform/posix/hxsocketselector.cpp =================================================================== RCS file: /cvsroot/common/netio/platform/posix/hxsocketselector.cpp,v retrieving revision 1.2 diff -u -w -r1.2 hxsocketselector.cpp --- netio/platform/posix/hxsocketselector.cpp 5 Jan 2005 02:49:40 -0000 1.2 +++ netio/platform/posix/hxsocketselector.cpp 16 Dec 2008 04:09:14 -0000 @@ -150,7 +150,7 @@ CHXMapPtrToPtr::Iterator end = m_pool.End(); for(CHXMapPtrToPtr::Iterator begin = m_pool.Begin(); begin != end; ++begin) { - sockobj_t fd = reinterpret_cast<sockobj_t>(begin.get_key()); + sockobj_t fd = (sockobj_t)((PTR_INT)(begin.get_key())); RemoveSocket(fd); } @@ -175,7 +175,7 @@ CHXSet::Iterator end = removeSet_.End(); for(CHXSet::Iterator begin = removeSet_.Begin(); begin != end; ++begin) { - sockobj_t fd = reinterpret_cast<sockobj_t>(*begin); + sockobj_t fd = (sockobj_t)(PTR_INT)(*begin); RemoveSocket(fd); } } Index: netio/pub/conn.h =================================================================== RCS file: /cvsroot/common/netio/pub/conn.h,v retrieving revision 1.11 diff -u -w -r1.11 conn.h --- netio/pub/conn.h 9 Jul 2004 18:22:36 -0000 1.11 +++ netio/pub/conn.h 16 Dec 2008 04:09:14 -0000 @@ -47,10 +47,6 @@ * * ***** END LICENSE BLOCK ***** */ -#ifdef _MACINTOSH -#pragma once -#endif - #ifndef _conn #define _conn @@ -214,13 +210,6 @@ // we need it for dns_find_ip_addr since async stuff needs a window handle... virtual HX_RESULT SetWindowHandle(ULONG32 handle) {return HXR_OK;}; -#elif defined (_MACINTOSH) - /* - * these are mac only - required for setting up - * a socket to accept a new incomming connection - */ - virtual HX_RESULT GetEndpoint(REF(void*) pRef) {return HXR_NOTIMPL;} - virtual HX_RESULT SetupEndpoint(BOOL bWait) {return HXR_NOTIMPL;} #endif virtual ULONG32 AddRef (void) = 0; @@ -462,12 +451,6 @@ // call through to the final implemenations' code. virtual HX_RESULT last_error (void); -#if defined (_WINDOWS) || defined (_WIN32) -// virtual HX_RESULT SetWindowHandle(ULONG32 handle) {return HXR_OK;}; -#elif defined (_MACINTOSH) - virtual HX_RESULT GetEndpoint(REF(void*) pRef); - virtual HX_RESULT SetupEndpoint(BOOL bWait); -#endif virtual void set_callback (HXAsyncNetCallback* pCallback); virtual UINT16 connection_open (void); virtual int get_sock (void); Index: netio/pub/sockio.h =================================================================== RCS file: /cvsroot/common/netio/pub/sockio.h,v retrieving revision 1.6 diff -u -w -r1.6 sockio.h --- netio/pub/sockio.h 14 Oct 2004 17:59:32 -0000 1.6 +++ netio/pub/sockio.h 16 Dec 2008 04:09:14 -0000 @@ -54,8 +54,6 @@ #include "platform/unix/sockio.h" #elif defined(_WINDOWS) #include "platform/win/sockio.h" -#elif defined(_MACINTOSH) -#include "platform/mac/sockio.h" #elif defined(_SYMBIAN) #include "platform/symbian/sockio.h" #elif defined(_OPENWAVE) @@ -64,6 +62,6 @@ #include "hlxclib/errno.h" #else #error "Platform not supported!" -#endif /* defined(_MACINTOSH) */ +#endif #endif /* SOCIO_H */ Index: netio/pub/threngin.h =================================================================== RCS file: /cvsroot/common/netio/pub/threngin.h,v retrieving revision 1.4 diff -u -w -r1.4 threngin.h --- netio/pub/threngin.h 9 Jul 2004 18:22:36 -0000 1.4 +++ netio/pub/threngin.h 16 Dec 2008 04:09:14 -0000 @@ -96,13 +96,6 @@ HXEvent* m_pQuitEvent; BOOL m_bInDestructor; static ThreadEngine* m_pzThreadEngine; - -#if defined(_MACINTOSH) && defined(_CARBON) && defined(THREADS_SUPPORTED) - EventLoopTimerUPP m_ThreadedNetworkingCarbonTimerUPP; - EventLoopTimerRef m_ThreadedNetworkingCarbonTimerRef; - static void FauxMainAppCarbonTimer(EventLoopTimerRef, void*); -#endif - }; class DestructEngine Index: netio/pub/platform/mac/socketerrors.h =================================================================== RCS file: /cvsroot/common/netio/pub/platform/mac/socketerrors.h,v retrieving revision 1.3 diff -u -w -r1.3 socketerrors.h --- netio/pub/platform/mac/socketerrors.h 9 Jul 2004 18:22:23 -0000 1.3 +++ netio/pub/platform/mac/socketerrors.h 16 Dec 2008 04:09:14 -0000 @@ -137,19 +137,13 @@ #define EMLINK 31 /* Too many links */ #define EPIPE 32 /* Broken pipe */ -#ifndef _MACINTOSH /* math software */ #define EDOM 33 /* Numerical argument out of domain */ #define ERANGE 34 /* Result too large */ -#endif /* non-blocking and interrupt i/o */ -#if !defined(macintosh) && !defined(_MACINTOSH) #define EAGAIN 35 /* Resource temporarily unavailable */ #define EWOULDBLOCK EAGAIN /* Operation would block */ -#else -#define EWOULDBLOCK 11 /* Operation would block */ -#endif #ifndef _POSIX_SOURCE #define EINPROGRESS 36 /* Operation now in progress */ #define EALREADY 37 /* Operation already in progress */ Index: netio/pub/platform/mac/sockio.h =================================================================== RCS file: /cvsroot/common/netio/pub/platform/mac/sockio.h,v retrieving revision 1.6.6.1 diff -u -w -r1.6.6.1 sockio.h --- netio/pub/platform/mac/sockio.h 8 Mar 2005 00:05:01 -0000 1.6.6.1 +++ netio/pub/platform/mac/sockio.h 16 Dec 2008 04:09:14 -0000 @@ -136,11 +136,6 @@ off_t seek(off_t off, INT32 whence); INT16 status(struct stat *st); off_t file_size(); - -#ifdef _MACINTOSH -private: - void *mFile; // pointer to the actual Mac file object -#endif }; struct SocketIO: public IO,mIO { @@ -184,14 +179,6 @@ INT16 sock; INT32 do_write; SockFd* sock_fd; - -#ifdef _MACINTOSH -protected: - - void *mSocket; // ptr to the actual Mac network socket - INT16 mBackLog; // accepting socket backlog -#endif - }; // XXX does not belong in the SocketIO class Index: runtime/hlxosstr.cpp =================================================================== RCS file: /cvsroot/common/runtime/hlxosstr.cpp,v retrieving revision 1.18.2.6 diff -u -w -r1.18.2.6 hlxosstr.cpp --- runtime/hlxosstr.cpp 15 Dec 2007 07:17:20 -0000 1.18.2.6 +++ runtime/hlxosstr.cpp 16 Dec 2008 04:09:14 -0000 @@ -68,7 +68,7 @@ #define CP_UTF8 65001 #if defined(_FREEBSD) || defined(_OPENBSD) || defined(_NETBSD) || \ - (defined(_MACINTOSH) && defined(_MAC_MACHO)) || defined(_MAC_UNIX) || \ + defined(_MAC_UNIX) || \ defined(_OPENWAVE_ARMULATOR) int wcslen(const wchar_t* pStr) { Index: runtime/platform/mac/hxcrt.cpp =================================================================== RCS file: /cvsroot/common/runtime/platform/mac/hxcrt.cpp,v retrieving revision 1.8 diff -u -w -r1.8 hxcrt.cpp --- runtime/platform/mac/hxcrt.cpp 9 Jul 2004 18:20:54 -0000 1.8 +++ runtime/platform/mac/hxcrt.cpp 16 Dec 2008 04:09:14 -0000 @@ -52,19 +52,6 @@ #include "hxtypes.h" -#ifndef _MAC_MACHO - -void* __nwa(size_t size, char* file, int line); -//void* __nw(size_t size, char* file, int line); - -extern "C" void* __nwa__FUlPcl(size_t size, char*, int); -//extern "C" void* __nw__FUlPcl(size_t size, char* file, int line); - -//extern "C" void* operator new(unsigned long, char*, long); - -#endif - - extern "C" short HXCRT_ASSERT(char* message); extern "C" { @@ -77,18 +64,6 @@ BOOL HXMM_ATINTERRUPT(void); void HXMM_COMPACT(void); -#ifndef _MAC_MACHO - -void* malloc(size_t size); -void* calloc(size_t nmemb, size_t size); -void* realloc(void* ptr, size_t size); -void free(void* ptr); - - -char *__ttyname(long); - -#endif - } extern "C" short InstallConsole(short); @@ -96,60 +71,6 @@ extern "C" long WriteCharsToConsole(char*, long); extern "C" long ReadCharsFromConsole(char*, long); -#ifndef _MAC_MACHO - -void* operator new(unsigned long size, char*, long); -void* operator new(unsigned long size, char*, long) -{ -return operator new(size); -} - -//void* operator new[](size_t size, char* file, int line) -void* __nwa(size_t size, char* file, int line) -{ - void* retval = HXMM_NEWDEBUG(size, file, line); - return retval; -} - -void* __nw(size_t size, char* file, int line); -void* __nw(size_t size, char* file, int line) -{ - void* retval = HXMM_NEWDEBUG(size, file, line); - return retval; -} - -void* __nwa(size_t size) -{ - void* retval = HXMM_NEW(size); - return retval; -} - -void* __nw(size_t size) -{ - void* retval = HXMM_NEW(size); - return retval; -} - -void __dl(void* ptr) -{ - HXMM_DELETE(ptr); -} - - -void __dla(void* ptr) -{ - HXMM_DELETE(ptr); -} - - -void* __nwa__FUlPcl(size_t size, char*, int) -{ - void* retval = HXMM_NEW(size); - return retval; -} - -#endif - #pragma mark - CFBundleRef systemBundle = NULL; @@ -181,52 +102,6 @@ #define USE_NEW_POINTER_FOR_MALLOC 1 -#ifndef _MAC_MACHO - -void* malloc(size_t size) -{ - LoadBundleIfNecessary(); - if (fpMalloc) - { - return fpMalloc(size); - } - HXCRT_ASSERT("malloc function pointer not found"); - return NULL; -} - -void* calloc(size_t nmemb, size_t size) -{ - if (fpCalloc) - { - return fpCalloc(nmemb, size); - } - HXCRT_ASSERT("calloc function pointer not found"); - return NULL; -} - -void* realloc(void* ptr, size_t size) -{ - if (fpRealloc) - { - return fpRealloc(ptr, size); - } - HXCRT_ASSERT("realloc function pointer not found"); - return NULL; -} - -void free(void* ptr) -{ - if (fpFree) - { - fpFree(ptr); - return; - } - HXCRT_ASSERT("free function pointer not found"); - return; -} - -#endif - #pragma mark - @@ -240,107 +115,6 @@ // Console stubs so stio.h stuff works -#ifndef _MAC_MACHO - -short InstallConsole(short fd) -{ -#pragma unused (fd) - - return 0; -} - -/* - * extern void RemoveConsole(void); - * - * Removes the console package. It is called after all other streams - * are closed and exit functions (installed by either atexit or _atexit) - * have been called. Since there is no way to recover from an error, - * this function doesn't need to return any. - */ - -void RemoveConsole(void) -{ -} - -/* - * extern long WriteCharsToConsole(char *buffer, long n); - * - * Writes a stream of output to the Console window. This function is - * called by write. - * - * char *buffer: Pointer to the buffer to be written. - * long n: The length of the buffer to be written. - * returns short: Actual number of characters written to the stream, - * -1 if an error occurred. - */ - -long WriteCharsToConsole(char *buffer, long n) -{ - while (n > 0) - { - - // try to break the string on carriage returns - // (some consoles honor the \r causing lines overwriting themselves) - int lineLen = n; - bool skipReturn = false; - for(int i=0;i<n;i++) - { - if (buffer[i] == '\r') - { - // found a CR -- print up to this point only - lineLen = i; - skipReturn = true; // otherwise some consoles will print two CR's for a line - break; - } - } - - // and for sure break the line into blocks <= 200 bytes. - Str255 a; - long len = lineLen; - if (len > 200) len = 200; - - a[0] = len; - BlockMoveData(buffer, &a[1], len); - - DebugStr(a); - - if (skipReturn) - len++; - - n -= len; - buffer += len; - } - - return 0; -} - -/* - * extern long ReadCharsFromConsole(char *buffer, long n); - * - * Reads from the Console into a buffer. This function is called by - * read. - * - * char *buffer: Pointer to the buffer which will recieve the input. - * long n: The maximum amount of characters to be read (size of - * buffer). - * returns short: Actual number of characters read from the stream, - * -1 if an error occurred. - */ - -long ReadCharsFromConsole(char *buffer, long n) -{ -#pragma unused (buffer, n) - - return 0; -} - -char *__ttyname(long) -{ - return (NULL); -} - -#endif - void* HXMM_NEW(unsigned long size) { LoadBundleIfNecessary(); Index: runtime/pub/hlxclib/fcntl.h =================================================================== RCS file: /cvsroot/common/runtime/pub/hlxclib/fcntl.h,v retrieving revision 1.9 diff -u -w -r1.9 fcntl.h --- runtime/pub/hlxclib/fcntl.h 9 Jul 2004 18:21:09 -0000 1.9 +++ runtime/pub/hlxclib/fcntl.h 16 Dec 2008 04:09:14 -0000 @@ -120,17 +120,14 @@ #endif /* defined(WIN32_PLATFORM_PSPC) */ -#if defined(_UNIX) || (defined(_MACINTOSH) && defined(_MAC_MACHO)) +#if defined(_UNIX) #if !defined(O_BINARY) #define O_BINARY 0 #endif // O_BINARY #endif // _UNIX -// XXX HP O_ACCMODE has been defined(0x0003) in macfd.h on MacOSX -#if !defined(_MACINTOSH) #ifndef O_ACCMODE #define O_ACCMODE (_O_RDONLY | _O_WRONLY | _O_RDWR | _O_BINARY) #endif /* O_ACCMODE */ -#endif /* _MACINTOSH */ #endif /* HLXSYS_FCNTL_H */ Index: runtime/pub/hlxclib/io.h =================================================================== RCS file: /cvsroot/common/runtime/pub/hlxclib/io.h,v retrieving revision 1.6 diff -u -w -r1.6 io.h --- runtime/pub/hlxclib/io.h 9 Jul 2004 18:21:09 -0000 1.6 +++ runtime/pub/hlxclib/io.h 16 Dec 2008 04:09:14 -0000 @@ -50,7 +50,7 @@ #ifndef HLXSYS_IO_H #define HLXSYS_IO_H -#if !defined(WIN32_PLATFORM_PSPC) && !defined(_UNIX) && !defined(_MACINTOSH) && !defined(_SYMBIAN) && !defined(_OPENWAVE) +#if !defined(WIN32_PLATFORM_PSPC) && !defined(_UNIX) && !defined(_SYMBIAN) && !defined(_OPENWAVE) #include <io.h> #endif /* !defined(WIN32_PLATFORM_PSPC) */ @@ -61,7 +61,7 @@ int __helix_unlink(const char *filename); -#if defined(WIN32_PLATFORM_PSPC) || (defined(_MACINTOSH) && defined(_MAC_MACHO)) +#if defined(WIN32_PLATFORM_PSPC) inline int _unlink(const char* filename ) Index: runtime/pub/hlxclib/malloc.h =================================================================== RCS file: /cvsroot/common/runtime/pub/hlxclib/malloc.h,v retrieving revision 1.6.6.2 diff -u -w -r1.6.6.2 malloc.h --- runtime/pub/hlxclib/malloc.h 31 Dec 2006 17:48:22 -0000 1.6.6.2 +++ runtime/pub/hlxclib/malloc.h 16 Dec 2008 04:09:14 -0000 @@ -50,7 +50,7 @@ #ifndef HLXSYS_MALLOC_H #define HLXSYS_MALLOC_H -#if !defined(_SYMBIAN) && !defined(_MACINTOSH) && !defined(_VXWORKS) \ +#if !defined(_SYMBIAN) && !defined(_VXWORKS) \ && !defined(_OPENWAVE) && !defined(_MAC_UNIX) && !defined(_FREEBSD5) \ && !defined(_FREEBSD6) && !defined(_FREEBSD7) #include <malloc.h> Index: runtime/pub/hlxclib/memory.h =================================================================== RCS file: /cvsroot/common/runtime/pub/hlxclib/memory.h,v retrieving revision 1.7 diff -u -w -r1.7 memory.h --- runtime/pub/hlxclib/memory.h 9 Jul 2004 18:21:09 -0000 1.7 +++ runtime/pub/hlxclib/memory.h 16 Dec 2008 04:09:14 -0000 @@ -58,7 +58,7 @@ #include <memory.h> #endif -#if defined(_SOLARIS) || defined(_MAC_CFM) +#if defined(_SOLARIS) #include <string.h> #endif Index: runtime/pub/hlxclib/stdlib.h =================================================================== RCS file: /cvsroot/common/runtime/pub/hlxclib/stdlib.h,v retrieving revision 1.10 diff -u -w -r1.10 stdlib.h --- runtime/pub/hlxclib/stdlib.h 9 Jul 2004 18:21:09 -0000 1.10 +++ runtime/pub/hlxclib/stdlib.h 16 Dec 2008 04:09:14 -0000 @@ -128,14 +128,6 @@ } #endif /* _WINDOWS */ -#if defined (_MACINTOSH) - -#define itoa __helix_itoa -#define i64toa __helix_i64toa -#define atoi64 __helix_atoi64 - -#endif /* _MACINTOSH */ - #if defined (_UNIX) && !defined (__QNXNTO__) // Convert integer to string Index: runtime/pub/hlxclib/string.h =================================================================== RCS file: /cvsroot/common/runtime/pub/hlxclib/string.h,v retrieving revision 1.22 diff -u -w -r1.22 string.h --- runtime/pub/hlxclib/string.h 9 Jul 2004 18:21:09 -0000 1.22 +++ runtime/pub/hlxclib/string.h 16 Dec 2008 04:09:14 -0000 @@ -145,38 +145,6 @@ #define strnicmp strncasecmp #endif /* _OPENWAVE_ARMULATOR */ -#if defined (_MACINTOSH) - -#ifdef _MAC_MACHO - -#define strlwr __helix_strlwr -#define stricmp strcasecmp -#define strnicmp strncasecmp -#define strrev __helix_strrev - -#else - -int strnicmp(const char *first, const char *last, size_t count); -int stricmp(const char *first, const char *last); -char * strrev(char * str); - -#endif - -#define strcmpi stricmp - -#ifndef _MAC_MACHO - -HLX_INLINE int -strcasecmp(const char* str1, const char* str2) -{ - return stricmp(str1, str2); -} - -#endif - - -#endif /* _MACINTOSH */ - #if defined (_UNIX) && !defined (__QNXNTO__) /* strcasecmp, strncasecmp are defined in strings.h */ @@ -195,7 +163,7 @@ #endif /* _UNIX */ -#if defined (_MACINTOSH) || defined (_UNIX) +#if defined (_UNIX) #define _tcsspn strspn #define _tcscspn strcspn #define _tcsrchr strchr Index: runtime/pub/hlxclib/sys/socket.h =================================================================== RCS file: /cvsroot/common/runtime/pub/hlxclib/sys/socket.h,v retrieving revision 1.10 diff -u -w -r1.10 socket.h --- runtime/pub/hlxclib/sys/socket.h 28 Sep 2004 01:57:31 -0000 1.10 +++ runtime/pub/hlxclib/sys/socket.h 16 Dec 2008 04:09:14 -0000 @@ -61,8 +61,6 @@ #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> -#elif defined(_MACINTOSH) -#include "platform/mac/macsockets.h" //for sockaddr_in #elif defined(_OPENWAVE) #include "platform/openwave/socketdefs.h" Index: runtime/pub/hlxclib/sys/stat.h =================================================================== RCS file: /cvsroot/common/runtime/pub/hlxclib/sys/stat.h,v retrieving revision 1.6.6.1 diff -u -w -r1.6.6.1 stat.h --- runtime/pub/hlxclib/sys/stat.h 6 Jun 2006 07:23:21 -0000 1.6.6.1 +++ runtime/pub/hlxclib/sys/stat.h 16 Dec 2008 04:09:14 -0000 @@ -51,11 +51,7 @@ #define HLXSYS_SYS_STAT_H #if !defined(WIN32_PLATFORM_PSPC) && !defined(_OPENWAVE) && !defined(_WINCE) -#if defined(_MACINTOSH) && !defined(_MAC_MACHO) -#include <stat.h> -#else #include <sys/stat.h> -#endif #endif /* !defined(WIN32_PLATFORM_PSPC) */ #include "hlxclib/sys/types.h" Index: runtime/pub/hlxclib/sys/types.h =================================================================== RCS file: /cvsroot/common/runtime/pub/hlxclib/sys/types.h,v retrieving revision 1.7 diff -u -w -r1.7 types.h --- runtime/pub/hlxclib/sys/types.h 9 Jul 2004 18:21:06 -0000 1.7 +++ runtime/pub/hlxclib/sys/types.h 16 Dec 2008 04:09:14 -0000 @@ -50,13 +50,13 @@ #ifndef HLXSYS_SYS_TYPES_H #define HLXSYS_SYS_TYPES_H -#if !defined(WIN32_PLATFORM_PSPC) && !defined(_MACINTOSH) && !defined(_OPENWAVE) +#if !defined(WIN32_PLATFORM_PSPC) && !defined(_OPENWAVE) #include <sys/types.h> #endif /* !defined(WIN32_PLATFORM_PSPC) */ -#if defined (_WINDOWS) || (defined (_MACINTOSH) && !defined(_MAC_MACHO)) +#if defined (_WINDOWS) typedef long off_t; -#endif /* defined (_WINDOWS) || defined (_MACINTOSH) */ +#endif /* defined (_WINDOWS) */ #if defined(_OPENWAVE) #include "hlxclib/time.h" Index: runtime/pub/platform/mac/hxmm.h =================================================================== RCS file: /cvsroot/common/runtime/pub/platform/mac/hxmm.h,v retrieving revision 1.5 diff -u -w -r1.5 hxmm.h --- runtime/pub/platform/mac/hxmm.h 9 Jul 2004 18:21:12 -0000 1.5 +++ runtime/pub/platform/mac/hxmm.h 16 Dec 2008 04:09:14 -0000 @@ -57,18 +57,9 @@ //#include "pn_macmemory.h" //#include "pnmm_c.h" -#ifdef _CARBON -#ifdef BUILDING_PNCRT -#include <Carbon.h> -#endif -#ifndef _MAC_MACHO -#include <size_t.h> -#endif -#else #ifndef size_t typedef unsigned long size_t; #endif -#endif #include "hxtypes.h" Index: system/dllpath.cpp =================================================================== RCS file: /cvsroot/common/system/dllpath.cpp,v retrieving revision 1.9.6.2 diff -u -w -r1.9.6.2 dllpath.cpp --- system/dllpath.cpp 5 May 2005 18:22:21 -0000 1.9.6.2 +++ system/dllpath.cpp 16 Dec 2008 04:09:14 -0000 @@ -52,9 +52,6 @@ #include "dllpath.h" #include "hxdir.h" -#ifdef _MACINTOSH -#include "maclibrary.h" -#endif #include "hxheap.h" #ifdef _DEBUG @@ -156,9 +153,6 @@ CHXString strPath = szPath; if(!strPath.IsEmpty()) { -#ifdef _MACINTOSH - ResolveIndependentPath(strPath); -#endif if(strPath.GetAt(strPath.GetLength() - 1) != OS_SEPARATOR_CHAR) strPath += OS_SEPARATOR_STRING; @@ -237,7 +231,7 @@ { HX_RESULT theError = HXR_OK; -#if !defined(_MACINTOSH) && !defined(WIN32_PLATFORM_PSPC) +#if !defined(WIN32_PLATFORM_PSPC) if(szPath) { char* pPathEnvVar = getenv("PATH"); @@ -281,7 +275,7 @@ { HX_RESULT theError = HXR_OK; -#if !defined(_MACINTOSH) && !defined(WIN32_PLATFORM_PSPC) +#if !defined(WIN32_PLATFORM_PSPC) if(!m_strPathEnvVar.IsEmpty()) { #if defined(_AIX) || defined(_LINUX) || defined(_FREEBSD) Index: system/genthrd.cpp =================================================================== RCS file: /cvsroot/common/system/genthrd.cpp,v retrieving revision 1.5 diff -u -w -r1.5 genthrd.cpp --- system/genthrd.cpp 9 Jul 2004 18:19:44 -0000 1.5 +++ system/genthrd.cpp 16 Dec 2008 04:09:14 -0000 @@ -177,45 +177,6 @@ return HXR_NOTIMPL; } -//=========================================================================== - -#ifdef _MACINTOSH -#ifdef _CARBON - -HXGenMacMutex::HXGenMacMutex (void) -{ - MPCreateCriticalRegion(&mCriticalRegion); -} - -HXGenMacMutex::~HXGenMacMutex (void) -{ - MPDeleteCriticalRegion(mCriticalRegion); -} - - -HX_RESULT -HXGenMacMutex::Lock (void) -{ - MPEnterCriticalRegion(mCriticalRegion, kDurationForever); - return HXR_OK; -} - -HX_RESULT -HXGenMacMutex::Unlock (void) -{ - MPExitCriticalRegion(mCriticalRegion); - return HXR_OK; -} - -HX_RESULT -HXGenMacMutex::Trylock (void) -{ - return HXR_NOTIMPL; -} - -#endif -#endif - HXGenEvent::HXGenEvent(const char* pEventName, BOOL bManualReset) { } Index: system/hxdate.cpp =================================================================== RCS file: /cvsroot/common/system/hxdate.cpp,v retrieving revision 1.11 diff -u -w -r1.11 hxdate.cpp --- system/hxdate.cpp 9 Jul 2004 18:19:44 -0000 1.11 +++ system/hxdate.cpp 16 Dec 2008 04:09:14 -0000 @@ -51,21 +51,8 @@ #include "hlxclib/string.h" #include "hlxclib/stdio.h" -#ifdef _MACINTOSH -#ifndef _MAC_MACHO -#include <OSUtils.h> -#endif -#ifdef _CARBON -#ifndef _MAC_MACHO -#include <stat.h> -#endif -#else -#include <stat.mac.h> -#endif -#else #include "hlxclib/sys/types.h" #include "hlxclib/sys/stat.h" -#endif #if defined(_AIX) #include <ctype.h> #endif @@ -143,51 +130,6 @@ return datetime; } -#elif _MACINTOSH -#ifndef _MAC_MACHO -#include <datetimeutils.h> -#endif -HX_DATETIME HX_GET_DATETIME(void) -{ - HX_DATETIME datetime; - - ULONG32 secs; - LongDateRec ldate; - - ::GetDateTime(&secs); - - LongDateTime time = secs; - - ::LongSecondsToDate(&time, &ldate); - - datetime.second = ldate.ld.second; - datetime.minute = ldate.ld.minute; - datetime.hour = ldate.ld.hour; - datetime.dayofweek = ldate.ld.dayOfWeek - 1; - datetime.dayofmonth = ldate.ld.day; - datetime.dayofyear = ldate.ld.dayOfYear; - datetime.month = ldate.ld.month; - datetime.year = ldate.ld.year - HX_YEAR_OFFSET; - - // get time zone in seconds - MachineLocation loc; - ::ReadLocation(&loc); - - // we need to extend the sign since the gmtDelta is a 3 byte value - long gmtDelta = loc.u.gmtDelta; - long internalGmtDelta = gmtDelta & 0x00FFFFFF; - - if(internalGmtDelta & 0x00800000) - { - internalGmtDelta = internalGmtDelta | 0xFF000000; - } - - // convert to hours - datetime.gmtDelta = (short)internalGmtDelta/3600; - - return datetime; -} - #elif defined(_UNIX) || defined(_SYMBIAN) HX_DATETIME Index: system/hxthread.cpp =================================================================== RCS file: /cvsroot/common/system/hxthread.cpp,v retrieving revision 1.10 diff -u -w -r1.10 hxthread.cpp --- system/hxthread.cpp 27 Oct 2004 18:45:36 -0000 1.10 +++ system/hxthread.cpp 16 Dec 2008 04:09:14 -0000 @@ -72,14 +72,6 @@ # include "symbianthreads.h" #endif -#if defined (_MACINTOSH) -#ifdef THREADS_SUPPORTED -#include "platform/mac/carbthrd.h" -#else -#include "macthrd.h" -#endif -#endif - #include "hxheap.h" #ifdef _DEBUG #undef HX_THIS_FILE @@ -98,12 +90,6 @@ pThread = 0; #ifdef _WIN32 pThread = new HXWinThread; -#elif defined (_MACINTOSH) -# ifdef THREADS_SUPPORTED - pThread = new HXCarbonThread; -# else - pThread = new HXMacThread; -# endif #elif defined( _UNIX_THREADS_SUPPORTED ) HXUnixThread::MakeThread(pThread); #elif defined _SYMBIAN @@ -124,12 +110,6 @@ { #ifdef _WIN32 return HXWinThread::GetCurrentThreadID(); -#elif defined (_MACINTOSH) -# ifdef THREADS_SUPPORTED - return HXCarbonThread::GetCurrentThreadID(); -# else - return HXMacThread::GetCurrentThreadID(); -# endif #elif defined( _UNIX_THREADS_SUPPORTED ) return HXUnixThread::GetCurrentThreadID(); #elif defined _SYMBIAN @@ -183,13 +163,6 @@ pMutex = new HXWinMutex; #elif defined( _UNIX_THREADS_SUPPORTED ) HXUnixMutex::MakeMutex(pMutex); -#elif defined _MACINTOSH - -#ifdef THREADS_SUPPORTED - pMutex = new HXCarbonMutex; -#else - pMutex = new HXMacMutex; -#endif #elif defined _SYMBIAN pMutex = new HXSymbianMutex; #else @@ -207,11 +180,7 @@ HXMutex::MakeStubMutex(HXMutex*& pMutex) { pMutex = 0; -#if defined(_CARBON) && !defined(THREADS_SUPPORTED) - pMutex = new HXGenMacMutex; -#else pMutex = new HXGenMutex; -#endif if (!pMutex) { return HXR_OUTOFMEMORY; @@ -233,20 +202,6 @@ pEvent = new HXWinEvent(pEventName, bManualReset); #elif defined( _UNIX_THREADS_SUPPORTED ) pEvent = new HXUnixEvent(pEventName, bManualReset ); -#elif defined _MACINTOSH - -#ifdef THREADS_SUPPORTED - if (bManualReset) - { - pEvent = new HXCarbonManualEvent(pEventName); - } - else - { - pEvent = new HXCarbonEvent(pEventName, bManualReset); - } -#else - pEvent = new HXMacEvent(pEventName, bManualReset); -#endif #elif defined _SYMBIAN pEvent = new HXSymbianEvent(pEventName, bManualReset); #else Index: system/stataccs.cpp =================================================================== RCS file: /cvsroot/common/system/stataccs.cpp,v retrieving revision 1.14 diff -u -w -r1.14 stataccs.cpp --- system/stataccs.cpp 9 Jul 2004 18:19:44 -0000 1.14 +++ system/stataccs.cpp 16 Dec 2008 04:09:14 -0000 @@ -71,17 +71,7 @@ #if defined(_WINDOWS) || defined(_SYMBIAN) #define DLL_SUFFIX ".dll" -#elif defined(_MACINTOSH) -#if defined(_CARBON) -#ifdef _MAC_MACHO -#define DLL_SUFFIX ".bundle" -#else -#define DLL_SUFFIX ".shlb" #endif -#else // #if defined(_CARBON) -#define DLL_SUFFIX ".dll" -#endif // #if defined(_CARBON) #else -#endif // #elif defined(_MACINTOSH) class StaticDLLAccess : public DLLAccessImp { @@ -165,7 +155,7 @@ found = TRUE; ret = DLLAccess::DLL_OK; -#if !defined (_MACINTOSH) && !defined(_WIN16) &&!defined(HELIX_CONFIG_NOSTATICS) +#if !defined(_WIN16) &&!defined(HELIX_CONFIG_NOSTATICS) if(g_bReportHXCreateInstancePointer) { printf (" Entry Point %s %p\n", mapentry->dllName, mapentry->funcptr); Index: system/platform/mac/carbthrd.cpp =================================================================== RCS file: /cvsroot/common/system/platform/mac/carbthrd.cpp,v retrieving revision 1.6 diff -u -w -r1.6 carbthrd.cpp --- system/platform/mac/carbthrd.cpp 9 Jul 2004 18:19:02 -0000 1.6 +++ system/platform/mac/carbthrd.cpp 16 Dec 2008 04:09:14 -0000 @@ -47,8 +47,6 @@ * * ***** END LICENSE BLOCK ***** */ -#if defined(_CARBON) || defined(_MAC_UNIX) - #include "platform/mac/carbthrd.h" #include "hxmsgs.h" //for HXMSG_ASYNC_TIMER message. @@ -690,56 +688,3 @@ return retval; } -#if 0 - -// HXCarbonAsyncTimer - -HXCarbonAsyncTimer::HXCarbonAsyncTimer(ULONG32 ulTimeOut, HXThread* pReceivingThread) - : m_ulTimeout(ulTimeOut) - , m_pReceivingThread(pReceivingThread) - , m_CarbonTimerUPP(NULL) - , m_CarbonTimerRef(NULL) - , m_msg(NULL) -{ - m_msg = new HXThreadMessage(HXMSG_ASYNC_TIMER, (void*)m_ulTimeout, NULL, NULL); - m_CarbonTimerUPP = ::NewEventLoopTimerUPP((EventLoopTimerProcPtr)MyCarbonTimer); - ::InstallEventLoopTimer(GetCurrentEventLoop(), 0, kEventDurationMillisecond * - m_ulTimeout, m_CarbonTimerUPP, this, &m_CarbonTimerRef); -} - -HXCarbonAsyncTimer::~HXCarbonAsyncTimer() -{ - if (m_CarbonTimerRef) - { - ::RemoveEventLoopTimer(m_CarbonTimerRef); - m_CarbonTimerRef = NULL; - } - if (m_CarbonTimerUPP) - { - ::DisposeEventLoopTimerUPP(m_CarbonTimerUPP); - m_CarbonTimerUPP = NULL; - } - delete m_msg; -} - -/* static */ -UINT32 -HXCarbonAsyncTimer::SetTimer(ULONG32 ulTimeOut, HXThread* pReceivingThread) -{ - volatile HXCarbonAsyncTimer* pAsyncTimer = new HXCarbonAsyncTimer(ulTimeOut, pReceivingThread); - return (UINT32) pAsyncTimer; -} - -/* static */ -void -HXCarbonAsyncTimer::MyCarbonTimer(EventLoopTimerRef, HXCarbonAsyncTimer* pAsyncTimer) -{ - HX_ASSERT(pAsyncTimer); - HX_ASSERT(pAsyncTimer->m_pReceivingThread); - HXThreadMessage theMsg(HXMSG_ASYNC_TIMER, (void*)pAsyncTimer->m_ulTimeout, NULL, NULL); - pAsyncTimer->m_pReceivingThread->PostMessage(&theMsg); -} - -#endif - -#endif Index: system/platform/mac/mac_dll.cpp =================================================================== RCS file: /cvsroot/common/system/platform/mac/mac_dll.cpp,v retrieving revision 1.9 diff -u -w -r1.9 mac_dll.cpp --- system/platform/mac/mac_dll.cpp 9 Jul 2004 18:19:02 -0000 1.9 +++ system/platform/mac/mac_dll.cpp 16 Dec 2008 04:09:14 -0000 @@ -166,15 +166,7 @@ return; } -#if defined(_CARBON) || defined(_MAC_UNIX) -#ifdef _MAC_MACHO out_buf_len = sprintf(out_buf, "%s.bundle", long_name); /* Flawfinder: ignore */ -#else - out_buf_len = sprintf(out_buf, "%s.shlb", long_name); /* Flawfinder: ignore */ -#endif -#else - out_buf_len = sprintf(out_buf, "%s.dll", long_name); /* Flawfinder: ignore */ -#endif } DLLAccessImp* DLLAccess::CreatePlatformDLLImp() Index: system/platform/unix/pthreadthreads.cpp =================================================================== RCS file: /cvsroot/common/system/platform/unix/pthreadthreads.cpp,v retrieving revision 1.10.6.2 diff -u -w -r1.10.6.2 pthreadthreads.cpp --- system/platform/unix/pthreadthreads.cpp 14 Nov 2008 02:00:11 -0000 1.10.6.2 +++ system/platform/unix/pthreadthreads.cpp 16 Dec 2008 04:09:14 -0000 @@ -62,7 +62,7 @@ ULONG32 HXUnixThread::GetCurrentThreadID() { - return (ULONG32) pthread_self(); + return (ULONG32) (PTR_INT)pthread_self(); } //======================================================================= @@ -84,7 +84,7 @@ HX_RESULT retVal = HXR_OK; pthread_t threadID=0; int nCode = pthread_create( &threadID, NULL, pfExecFunc, pArg ); - ulThreadID = (ULONG32) threadID; + ulThreadID = (ULONG32) (PTR_INT)threadID; if(nCode!=0) { ulThreadID = 0; Index: system/pub/dllacces.h =================================================================== RCS file: /cvsroot/common/system/pub/dllacces.h,v retrieving revision 1.14 diff -u -w -r1.14 dllacces.h --- system/pub/dllacces.h 9 Jul 2004 18:19:32 -0000 1.14 +++ system/pub/dllacces.h 16 Dec 2008 04:09:14 -0000 @@ -56,16 +56,6 @@ #define OS_DLL_PATTERN_STRING "*.bundle" #elif _UNIX #define OS_DLL_PATTERN_STRING "*.so*" -#elif _MACINTOSH -#ifdef _CARBON -#ifdef _MAC_MACHO - #define OS_DLL_PATTERN_STRING "*.bundle" -#else - #define OS_DLL_PATTERN_STRING "*.shlb" -#endif -#else - #define OS_DLL_PATTERN_STRING "*.dll" -#endif #else // undefined platform #error dll extension undefined on platform #endif Index: system/pub/dllpath.h =================================================================== RCS file: /cvsroot/common/system/pub/dllpath.h,v retrieving revision 1.7 diff -u -w -r1.7 dllpath.h --- system/pub/dllpath.h 9 Jul 2004 18:19:32 -0000 1.7 +++ system/pub/dllpath.h 16 Dec 2008 04:09:14 -0000 @@ -54,12 +54,6 @@ #include "hxmap.h" #include "hxstring.h" -#ifdef _MACINTOSH -#pragma export on -STDAPI SetDLLAccessPath(const char* pPathDescriptor); -#pragma export off -#endif - #if defined(HELIX_CONFIG_NOSTATICS) #include "globals/hxglobals.h" #endif Index: system/pub/genthrd.h =================================================================== RCS file: /cvsroot/common/system/pub/genthrd.h,v retrieving revision 1.4 diff -u -w -r1.4 genthrd.h --- system/pub/genthrd.h 27 Oct 2004 18:45:36 -0000 1.4 +++ system/pub/genthrd.h 16 Dec 2008 04:09:14 -0000 @@ -116,26 +116,4 @@ }; -#ifdef _MACINTOSH -#ifdef _CARBON - -class HXGenMacMutex : public HXMutex -{ -public: - HXGenMacMutex (void); - virtual ~HXGenMacMutex (void); - - virtual HX_RESULT Lock (void); - - virtual HX_RESULT Unlock (void); - - virtual HX_RESULT Trylock (void); - -private: - MPCriticalRegionID mCriticalRegion; -}; - -#endif -#endif - #endif /*_HX_GEN_THREAD*/ Index: system/pub/hxtick.h =================================================================== RCS file: /cvsroot/common/system/pub/hxtick.h,v retrieving revision 1.9 diff -u -w -r1.9 hxtick.h --- system/pub/hxtick.h 15 Jul 2004 23:21:34 -0000 1.9 +++ system/pub/hxtick.h 16 Dec 2008 04:09:14 -0000 @@ -65,7 +65,7 @@ * should be the same - HX_GET_BETTERTICKCOUNT should always be more ACCURATE. */ -#if defined(_MACINTOSH) || defined(_UNIX) +#if defined(_UNIX) #ifdef __cplusplus extern "C" { Index: system/pub/hxtime.h =================================================================== RCS file: /cvsroot/common/system/pub/hxtime.h,v retrieving revision 1.8 diff -u -w -r1.8 hxtime.h --- system/pub/hxtime.h 9 Jul 2004 18:19:32 -0000 1.8 +++ system/pub/hxtime.h 16 Dec 2008 04:09:14 -0000 @@ -57,7 +57,7 @@ * This really should be replaced with some platform indpendent function */ -#if (defined _UNIX && !defined _VXWORKS) || (defined(_MACINTOSH) && defined(_MAC_MACHO)) +#if (defined _UNIX && !defined _VXWORKS) # if defined _LINUX && !defined _RED_HAT_5_X_ # define int long # include <linux/time.h> @@ -79,30 +79,6 @@ LONG32 tv_usec; /* and microseconds */ }; -#elif (defined _MACINTOSH) -# include "hxtypes.h" -# include <time.h> -# include <utime.h> - -class HXTime : public timeval -{ -public: - HXTime() - { - tv_sec=NULL; - tv_usec=NULL; - }; -}; - - typedef long tv_sec_t; - typedef long tv_usec_t; -/* - struct timeval - { - tv_sec_t tv_sec; - tv_usec_t tv_usec; - }; -*/ #elif defined(_SYMBIAN) # include <sys/time.h> class HXTime : public timeval {}; @@ -110,14 +86,8 @@ # error need to include time functions (and timeval). #endif /* _UNIX */ -#if defined (_WINDOWS) || defined (_WIN32) || defined (_MACINTOSH) || defined(_VXWORKS) || defined(_OPENWAVE) +#if defined (_WINDOWS) || defined (_WIN32) || defined(_VXWORKS) || defined(_OPENWAVE) int gettimeofday(HXTime* time, void* unused); #endif /* WINDOWS OR MAC*/ -#if (defined _MACINTOSH) -/* Mac time is secs since 1904 */ -time_t WinToMacTime(time_t timeT); -time_t MacToWinTime(time_t timeT); -#endif - #endif /* _HXTIME_H_ */ Index: system/pub/microsleep.h =================================================================== RCS file: /cvsroot/common/system/pub/microsleep.h,v retrieving revision 1.8 diff -u -w -r1.8 microsleep.h --- system/pub/microsleep.h 22 Dec 2004 18:29:45 -0000 1.8 +++ system/pub/microsleep.h 16 Dec 2008 04:09:14 -0000 @@ -98,9 +98,6 @@ Sleep(uSecs / 1000); #elif defined _OSF1 || defined _HPUX usleep((useconds_t)uSecs); -#elif defined _MACINTOSH - AbsoluteTime timeToWakeUp = AddDurationToAbsolute( uSecs * kDurationMicrosecond, UpTime() ); - MPDelayUntil(&timeToWakeUp); #elif defined _BEOS snooze(uSecs); #elif defined _SYMBIAN Index: system/pub/staticff.h =================================================================== RCS file: /cvsroot/common/system/pub/staticff.h,v retrieving revision 1.7 diff -u -w -r1.7 staticff.h --- system/pub/staticff.h 9 Jul 2004 18:19:32 -0000 1.7 +++ system/pub/staticff.h 16 Dec 2008 04:09:14 -0000 @@ -57,9 +57,7 @@ // forward declares for classes and structs // include for regular expression compiler -#ifndef _MACINTOSH #include "hlxclib/sys/types.h" -#endif #define OS_PATH_DELIMITER "/" Index: system/pub/platform/mac/carbthrd.h =================================================================== RCS file: /cvsroot/common/system/pub/platform/mac/carbthrd.h,v retrieving revision 1.7 diff -u -w -r1.7 carbthrd.h --- system/pub/platform/mac/carbthrd.h 27 Oct 2004 18:45:37 -0000 1.7 +++ system/pub/platform/mac/carbthrd.h 16 Dec 2008 04:09:14 -0000 @@ -174,32 +174,4 @@ MPSemaphoreID m_mpSemaphoreID; }; -#if 0 - -class HXCarbonAsyncTimer -{ -public: - - // SetTimer and KillTimer emulate Windows' ::SetTimer and ::KillTimer - // functions. - - static UINT32 SetTimer(ULONG32 ulTimeOut, HXThread* pReceivingThread); - static BOOL KillTimer(UINT32 ulTimerID); - -protected: - - HXCarbonAsyncTimer(ULONG32 ulTimeOut, HXThread* pReceivingThread); - ~HXCarbonAsyncTimer(); - - static void MyCarbonTimer(EventLoopTimerRef, HXCarbonAsyncTimer* pAsyncTimer); - - HXThread* m_pReceivingThread; - ULONG32 m_ulTimeout; - EventLoopTimerUPP m_CarbonTimerUPP; - EventLoopTimerRef m_CarbonTimerRef; - HXThreadMessage* m_msg; -}; - -#endif - #endif /*_HX_CARBON_THREAD*/ Index: util/cookies.cpp =================================================================== RCS file: /cvsroot/common/util/cookies.cpp,v retrieving revision 1.25.6.12 diff -u -w -r1.25.6.12 cookies.cpp --- util/cookies.cpp 9 Jan 2007 10:35:29 -0000 1.25.6.12 +++ util/cookies.cpp 16 Dec 2008 04:09:14 -0000 @@ -54,20 +54,8 @@ // #include "hlxclib/stdio.h" #include "safestring.h" -#ifdef _MACINTOSH -#ifdef _CARBON -#ifdef _MAC_MACHO -#include <sys/stat.h> -#else -#include <stat.h> -#endif -#else /* _CARBON */ -#include <stat.mac.h> -#endif /* _CARBON */ -#else /* _MACINTOSH */ #include "hlxclib/sys/types.h" #include "hlxclib/sys/stat.h" -#endif /* _MACINTOSH */ #include "hlxclib/time.h" @@ -83,14 +71,10 @@ typedef BOOL (HXEXPORT_PTR FPSHGetSpecialFolderPath) (HWND hwndOwner, LPTSTR lpszPath, int nFolder, BOOL fCreate); #endif /* _WINDOWS */ -#if defined(_CARBON) || defined(_MAC_MACHO) +#if defined(_MAC_UNIX) #include "hxver.h" // for HXVER_SDK_PRODUCT #endif -#if defined(_CARBON) -#include "cfwrappers.h" -#endif - #include "hxresult.h" #include "hxslist.h" #include "chxpckts.h" @@ -131,9 +115,6 @@ #elif defined (_UNIX) || defined (_OPENWAVE) #define OS_SEPARATOR_CHAR '/' #define OS_SEPARATOR_STRING "/" -#elif defined (_MACINTOSH) -#define OS_SEPARATOR_CHAR ':' -#define OS_SEPARATOR_STRING ":" #endif /* defined (_WINDOWS ) || defined (WIN32) */ HXCookies::HXCookies(IUnknown* pContext, BOOL bMemoryOnly) @@ -557,7 +538,7 @@ } -#if defined(_CARBON) || defined(_MAC_MACHO) +#if defined(_MAC_UNIX) #define REPORT_COOKIES 1 #endif @@ -903,7 +884,7 @@ str.Format("Cookies requested, getting host: %s path: %s cookies: %s", pHost, pPath, strCookieReport.IsEmpty() ? "<no cookies>" : (const char *) strCookieReport); -#if defined(_CARBON) || defined(_MAC_MACHO) +#if defined(_MAC_UNIX) CFStringRef stringRef = ::CFStringCreateWithCString( kCFAllocatorDefault, (const char*) str, kCFStringEncodingUTF8 ); ::CFShow(stringRef); ::CFRelease(stringRef); @@ -937,7 +918,7 @@ const char* pRMCookiesPath = NULL; IHXBuffer* pBuffer = NULL; -#if !defined(_CARBON) && !defined(_MAC_MACHO) /* figured out every time at runtime on the Mac since paths are not stable between runs */ +#if !defined(_MAC_UNIX) /* figured out every time at runtime on the Mac since paths are not stable between runs */ if (m_pPreferences && (m_pPreferences->ReadPref("CookiesPath", pBuffer) == HXR_OK)) { m_pRMCookiesPath = new char[pBuffer->GetSize() + 1]; @@ -954,7 +935,7 @@ } else { -#if defined(_CARBON) || defined(_MAC_MACHO) +#if defined(_MAC_UNIX) CHXString strSDKPath = CHXFileSpecUtils::GetAppDataDir(HXVER_SDK_PRODUCT).GetPathName(); #elif defined(_UNIX) pRMCookiesPath = getenv("HOME"); @@ -1292,11 +1273,7 @@ { while (i < ulBytesRead) { -#ifdef _MACINTOSH - if (pTmpBuf[i] == 10 || pTmpBuf[i] == 13) -#else if (pTmpBuf[i] == 10) -#endif { // LF if (pTmpBuf[i+1]) { @@ -1533,11 +1510,7 @@ pNewCookie->pPath = new CHXString(pPath); pNewCookie->pHost = new CHXString(pHost); -#ifdef _MACINTOSH - pNewCookie->expires = (time_t)atoi64(pExpires); -#else pNewCookie->expires = atol(pExpires); -#endif if(!strcasecmp(pIsDomain, "TRUE")) { Index: util/dbcs.cpp =================================================================== RCS file: /cvsroot/common/util/dbcs.cpp,v retrieving revision 1.15.6.1 diff -u -w -r1.15.6.1 dbcs.cpp --- util/dbcs.cpp 2 Mar 2005 18:45:22 -0000 1.15.6.1 +++ util/dbcs.cpp 16 Dec 2008 04:09:14 -0000 @@ -55,24 +55,6 @@ #include <ctype.h> // for isleadbyte() #endif -#ifdef _MACINTOSH -#ifndef _MAC_MACHO -#include <script.h> // for CharByte() -#endif - -// These aren't defined by the OS headers, so I define them here. -#define MBCS_LEADBYTE -1 -#define MBCS_SINGLEBYTE 0 -#define MBCS_LASTBYTE 1 -#define MBCS_MIDDLEBYTE 2 - -// Functions used to simplify the logic of moving to either end of a character. -char* MoveToLeadByte(char *pChar); -char* MoveToLastByte(char *pChar); - -#endif - - #include "dbcs.h" #include "hxassert.h" #include "hxheap.h" @@ -90,8 +72,6 @@ static int DBCSEnabled = -1; if(DBCSEnabled < 0) DBCSEnabled = GetSystemMetrics(SM_DBCSENABLED); -#elif defined(_MACINTOSH) - int DBCSEnabled = 1; #else int DBCSEnabled = 0; #endif @@ -112,19 +92,6 @@ #if (defined( _WIN32 ) || defined( _WINDOWS )) && !defined(WIN32_PLATFORM_PSPC) pNext = AnsiNext(pChar); -#elif defined (_MACINTOSH) - - pNext=(char*)pChar; - - // If this is a multi-byte character then return the last byte of the character. - // If it is a singbyte character then do nothing. - pNext=MoveToLastByte(pNext); - - // If this is a single byte character then move to the next byte. - // If this is a multi-byte character then we know we are at the end of the character, - // so moving + 1 would correct. - pNext=pNext+1; - #else //unix pNext = (char*)pChar + 1; #endif @@ -148,22 +115,6 @@ char * pPrev = NULL; #if (defined( _WIN32 ) || defined( _WINDOWS )) && !defined(WIN32_PLATFORM_PSPC) pPrev = AnsiPrev(pStart, pChar); -#elif defined(_MACINTOSH) - // Since there is no AnsiPrev equivalent on the Macintosh. - - pPrev=(char*)pChar; - - //Move to LeadByte of current character. - // If single byte do nothing. - pPrev=MoveToLeadByte(pPrev); - - //Move back one byte. - pPrev=pPrev-1; - - //Move to leadbyte of this character. - //If single byte do nothing. - pPrev=MoveToLeadByte(pPrev); - #else // unix pPrev = (char*)pChar - 1; #endif @@ -337,13 +288,9 @@ #if (defined( _WIN32 ) || defined( _WINDOWS )) && !defined(WIN32_PLATFORM_PSPC) return _ismbblead((unsigned int)Byte); -#elif defined(_MACINTOSH) || defined(_MAC_UNIX) -#if defined(_CARBON) || defined(_MAC_UNIX) +#elif defined(_MAC_UNIX) return (CharacterType((Ptr)&Byte,0, smRoman) == MBCS_LEADBYTE); #else - return (CharType((Ptr)&Byte,0) == MBCS_LEADBYTE); -#endif -#else return FALSE; #endif } @@ -385,44 +332,6 @@ #endif } -////////////////////////////// -// MACINTOSH ONLY FUNCTIONS -// - -#ifdef _MACINTOSH - -//* Move to the first byte of the current character. -//* Does nothing if the current character is a single byte. -char* MoveToLeadByte(char* pChar) { - char *pPrev=pChar; -#if 0 /* CharByte can't be executed at interrupt time */ - if (CharByte((Ptr)pPrev,0) != MBCS_SINGLEBYTE) { - while (CharByte((Ptr)pPrev,0) != MBCS_LEADBYTE) - pPrev=pPrev-1; - }//*if -#endif - return(pPrev); -} - -//* Move to the last byte of the current character. -//* Okay this is strange logic, CharByte searches upto the offset that is specified. -//* It never looks back, so it must always be at the beginning of a character in order to -//* ever return a correct value, with the exception of the MBCS_LEADBYTE which could be specified -//* as 1 byte. -//* Does nothing if the current character is a single byte. -char* MoveToLastByte(char *pChar) { - char *pNext=pChar; -#if 0 /* CharByte can't be executed at interrupt time */ - if (CharByte((Ptr)pNext,1) != MBCS_SINGLEBYTE) { - if (CharByte((Ptr)pNext,1) == MBCS_LASTBYTE) - pNext=pNext+1; - }//*if -#endif - return(pNext); -} - -#endif - #endif // !defined(_UNIX) Index: util/hxstrutl.cpp =================================================================== RCS file: /cvsroot/common/util/hxstrutl.cpp,v retrieving revision 1.13 diff -u -w -r1.13 hxstrutl.cpp --- util/hxstrutl.cpp 2 Nov 2004 22:56:04 -0000 1.13 +++ util/hxstrutl.cpp 16 Dec 2008 04:09:14 -0000 @@ -56,162 +56,6 @@ #include "hlxclib/stdio.h" //for vsnprintf -#ifdef _MACINTOSH - -int CopyP2CString(ConstStr255Param inSource, char* outDest, int inDestLength) -{ - int outLength = 0; - HX_ASSERT( inDestLength > 0 ); - if ( inSource ) - { - outLength = *inSource++; - outLength = HX_MIN( outLength, ( inDestLength - 1 ) ); - int copiedLength = outLength; - while ( copiedLength-- ) - { - *outDest++ = *( char* ) inSource++; - } - } - *outDest = '\0'; - return( outLength ); -} - -// -// CopyC2PString converts the source C string to a destination -// pascal string as it copies. The dest string will -// be truncated to fit into an Str255 if necessary. -// If the C String pointer is NULL, the pascal string's length is set to zero -// -void CopyC2PString(const char* inSource, Str255 outDest) -{ -#ifdef _CARBON - if (inSource == NULL) outDest[0] = 0; - else CopyCStringToPascal(inSource, outDest); // Carbon TextUtils.h call -#else - short length = 0; - - // handle case of overlapping strings - if ( (void*)inSource == (void*)outDest ) - { - unsigned char* curdst = &outDest[1]; - unsigned char thisChar; - - thisChar = *(const unsigned char*)inSource++; - while ( thisChar != '\0' ) - { - unsigned char nextChar; - - // use nextChar so we don't overwrite what we are about to read - nextChar = *(const unsigned char*)inSource++; - *curdst++ = thisChar; - thisChar = nextChar; - - if ( ++length >= 255 ) - break; - } - } - else if ( inSource != NULL ) - { - unsigned char* curdst = &outDest[1]; - short overflow = 255; // count down so test it loop is faster - register char temp; - - // Can't do the K&R C thing of ?while (*s++ = *t++)? because it will copy trailing zero - // which might overrun pascal buffer. Instead we use a temp variable. - while ( (temp = *inSource++) != 0 ) - { - *(char*)curdst++ = temp; - - if ( --overflow <= 0 ) - break; - } - length = 255 - overflow; - } - outDest[0] = length; -#endif // !defined _CARBON -} - -char -WINToMacCharacter( char inWINChar ) -{ - static const unsigned char kXX = 240; - static const unsigned char kWINToMacHiBitCharConverter[ 128 ] = /* Flawfinder: ignore */ - { - // Conversion made between Windows MS Sans Serif and Macintosh Geneva. - kXX, kXX, kXX, kXX, kXX, kXX, kXX, kXX, kXX, kXX, kXX, kXX, kXX, kXX, kXX, kXX, - kXX, 212, 213, kXX, kXX, kXX, kXX, kXX, kXX, kXX, kXX, kXX, kXX, kXX, kXX, kXX, - 202, 193, 162, 163, 188, 180, kXX, 164, 172, 169, 187, 199, 194, 208, 168, 248, - 251, 177, kXX, kXX, 171, 181, 166, 225, 252, kXX, kXX, 200, kXX, kXX, kXX, 192, - 203, 231, 229, 204, 128, 129, 174, 130, 233, 131, 230, 232, 237, 234, 235, 236, - kXX, 132, 241, 238, 239, 205, 133, 120, 175, 244, 242, 243, 134, kXX, kXX, 167, - 136, 135, 137, 139, 138, 140, 190, 141, 143, 142, 144, 145, 147, 146, 148, 149, - 182, 150, 152, 151, 153, 155, 154, 214, 191, 157, 156, 158, 159, kXX, kXX, 216 - }; - char outMacChar = ( ( unsigned char ) inWINChar & 0x80 ) ? - ( char ) kWINToMacHiBitCharConverter[ ( unsigned char ) inWINChar & ~0x80 ] : inWINChar; /* Flawfinder: ignore */ - return ( outMacChar ); -} - -static char -MacToWinCharacter( char inMacChar ) -{ - static const unsigned char kXX = 240; - static const unsigned char kMacToWinHiBitCharConverter[ 128 ] = /* Flawfinder: ignore */ - { - // Conversion made between Macintosh Geneva and Windows MS Sans Serif - 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0xE1, 0xE0, 0xE2, 0xE4, 0xE3, 0xE5, 0xE7, 0xE9, 0xE8, - 0xEA, 0xEB, 0xED, 0xEC, 0xEE, 0xEF, 0xF1, 0xF3, 0xF2, 0xF4, 0xF6, 0xF5, 0xFA, 0xF9, 0xFB, 0x9F, - 0xA0, 0xA1, 0xA2, 0xA3, 0xA7, 0xA5, 0xB6, 0xDF, 0xAE, 0xA9, 0xAA, 0xB4, 0xA8, 0xAD, 0xC6, 0xD8, - 0xB0, 0xB1, 0xB2, 0xB3, 0xA5, 0xB5, 0xF0, 0xB7, 0xB8, 0xB9, 0xBA, 0xAA, 0xA4, 0xBD, 0xE6, 0xF8, - 0xBF, 0xA1, 0xAC, 0xC3, 0xC4, 0xC5, 0xC6, 0xAB, 0xBB, 0xC6, 0xA0, 0xC0, 0xC3, 0xD5, 0xCE, 0xCF, - 0xAD, 0xD1, 0xD2, 0xD3, 0x91, 0x92, 0xF7, 0xD7, 0xFF, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF, - 0xE0, 0xB7, 0xE2, 0xE3, 0xE4, 0xC2, 0xCA, 0xC1, 0xCB, 0xC8, 0xCD, 0xCE, 0xCF, 0xCC, 0xD3, 0xD4, - 0xF0, 0xD2, 0xDA, 0xDB, 0xD9, 0xF5, 0xF6, 0xF7, 0xAF, 0xF9, 0xFA, 0xB0, 0xB8, 0xFF, 0xFF, 0xFF - }; - char outWinChar = ( ( unsigned char ) inMacChar & 0x80 ) ? - ( char ) kMacToWinHiBitCharConverter[ ( unsigned char ) inMacChar & ~0x80 ] : inMacChar; /* Flawfinder: ignore */ - return ( outWinChar ); -} - -// these functions are used to convert Windows extended chars (used in non-English Roman languages) -// to Mac extended chars & vice-versa -void -StripMacChars( char* pChars) -{ - // don't bother if double-byte language -#ifdef _CARBON - if (CharacterByteType(pChars,0, smRoman) == smSingleByte) /* CharByte can't be executed at interrupt time! */ -#else - if (CharByte(pChars,0) == smSingleByte) /* CharByte can't be executed at interrupt time! */ -#endif - { - int theStringLength = strlen(pChars); - for ( int index = 0; index < theStringLength; ++index ) - { - pChars[index] = MacToWinCharacter( pChars[ index ] ) ; - } - } -} - -void -StripWinChars( char* pChars) -{ - // don't bother if double-byte language -#ifdef _CARBON - if (CharacterByteType(pChars,0, smRoman) == smSingleByte) /* CharByte can't be executed at interrupt time! */ -#else - if (CharByte(pChars,0) == smSingleByte) /* CharByte can't be executed at interrupt time! */ -#endif - { - int theStringLength = strlen(pChars); - for ( int index = 0; index < theStringLength; ++index ) - { - pChars[index] = WINToMacCharacter( pChars[ index ] ) ; - } - } -} -#endif - char * StripLine (char *string) { Index: util/hxwinver.cpp =================================================================== RCS file: /cvsroot/common/util/hxwinver.cpp,v retrieving revision 1.15.6.1 diff -u -w -r1.15.6.1 hxwinver.cpp --- util/hxwinver.cpp 1 May 2006 14:39:21 -0000 1.15.6.1 +++ util/hxwinver.cpp 16 Dec 2008 04:09:14 -0000 @@ -55,16 +55,6 @@ #include <string.h> // needed for strXXX() functions #endif -#ifdef _MACINTOSH -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#ifndef _MAC_MACHO -#include "OpenTransport.h" -#endif -//#include "productversion.r" -#endif - #if defined(HELIX_CONFIG_NOSTATICS) # include "globals/hxglobals.h" #endif @@ -104,14 +94,8 @@ #endif //_WINDOWS // Helper functions for macintosh -#if defined(_MACINTOSH) || defined(_MAC_UNIX) +#if defined(_MAC_UNIX) void GetMacSystemVersion(UINT16 *major, UINT16 *minor, UINT16 *release); - -#if !defined(_CARBON) && !defined(_MAC_UNIX) -BOOL IsPPC(void); -BOOL HasFPU(void); -BOOL HasOpenTransport (void); -#endif #endif /* @@ -366,10 +350,9 @@ ////////// END WINDOWS SPECIFIC ////////// ////////// START MACINTOSH SPECIFIC CODE////////// -#elif defined(_MACINTOSH) || defined(_MAC_UNIX) +#elif defined(_MAC_UNIX) -#if defined(_CARBON) || defined(_MAC_UNIX) rVersionInfo.dwPlatformId = HX_PLATFORM_MACOSX; #if defined(__i386__) rVersionInfo.dwMachineType = HX_MACHINE_686; @@ -377,18 +360,6 @@ rVersionInfo.dwMachineType = HX_MACHINE_PPC; #endif rVersionInfo.bFPUAvailable = FALSE; -#else - if (HasOpenTransport()) - rVersionInfo.dwPlatformId = HX_PLATFORM_MACOT; - else - rVersionInfo.dwPlatformId = HX_PLATFORM_MACTCP; - - if (IsPPC()) - rVersionInfo.dwMachineType = HX_MACHINE_PPC; - else - rVersionInfo.dwMachineType = HX_MACHINE_68K; - rVersionInfo.bFPUAvailable = HasFPU(); -#endif GetMacSystemVersion(&rVersionInfo.wMajorVersion, &rVersionInfo.wMinorVersion, &rVersionInfo.wReleaseVersion); @@ -718,21 +689,6 @@ // CPU/Process/machine. same thing... pProcName = HXGetMachName(pVersionInfo->dwMachineType); -#ifdef _MACINTOSH - // Macintosh OS version currently includes a wReleaseVersion number. - SafeSprintf(szEncodedName,MAX_ENCODED_NAME,"%s_%d.%d.%d_%s_%s_%s_%s_%s%s", - pOSName, - pVersionInfo->wMajorVersion, - pVersionInfo->wMinorVersion, - pVersionInfo->wReleaseVersion, - pProductVer, - pProductName, - pDistCode, - pLanguage, - pProcName, - (pVersionInfo->bFPUAvailable ? "" : "_No-FPU") - ); -#else // WINDOWS and UNIX SafeSprintf(szEncodedName,MAX_ENCODED_NAME, "%s_%d.%d_%s_%s_%s_%s_%s%s", pOSName, @@ -746,8 +702,6 @@ (pVersionInfo->bFPUAvailable ? "" : "_No-FPU") ); -#endif - return szEncodedName; }; @@ -908,25 +862,6 @@ HXFreeLibrary("version.dll"); -#elif defined (_MACINTOSH) - // dist code stored in STR 1000 resource of application - INT16 strResId = 1000; - StringHandle hStr = ::GetString(strResId); - if (hStr) - { - if ((*hStr)[0] < ulDistBufferLen) - { - strncpy(pDistBuffer,(char*)*hStr+1,(*hStr)[0]); /* Flawfinder: ignore */ - pDistBuffer[(*hStr)[0]] = 0; - } - ::ReleaseResource((Handle)hStr); - bOk = TRUE; - } - else - { - SafeStrCpy(pDistBuffer,"UNK", ulDistBufferLen); - } - #endif // defined(_WIN32) || defined(_WINDOWS) return bOk; @@ -934,49 +869,7 @@ -#if defined(_MACINTOSH) || defined(_MAC_UNIX) - -// Support functions for HXGetWinVer for Macintosh - -#if !defined(_CARBON) && !defined(_MAC_UNIX) // Carbon code runs only on PPC processors with OT so runtime checks are pointless -BOOL -HasOpenTransport (void) -{ - OSErr theErr = noErr; - LONG32 result; - Boolean hasOT = FALSE; - - theErr = Gestalt(gestaltOpenTpt, &result); - hasOT = theErr == noErr && - (result & gestaltOpenTptPresentMask) != 0 && - (result & gestaltOpenTptTCPPresentMask) != 0; - - return hasOT; -} - -BOOL -HasFPU(void) -{ - long theFPU; - - /* Determine the coprocessor type */ - Gestalt(gestaltFPUType, &theFPU); - - if(theFPU == gestaltNoFPU) - return FALSE; - - return TRUE; - -} - -BOOL -IsPPC(void) { - long theCPU; - Gestalt(gestaltNativeCPUtype, &theCPU); - if (theCPU >= gestaltCPU601) return(TRUE); - return(FALSE); -} -#endif // !_CARBON +#if defined(_MAC_UNIX) static UINT16 BCDtoDecimal(UINT16 bcd) @@ -992,7 +885,7 @@ void GetMacSystemVersion(UINT16 *major, UINT16 *minor, UINT16 *release) { - long gestVer; + SInt32 gestVer; UINT16 ver, bigRev, littleRev; OSErr err = Gestalt(gestaltSystemVersion, &gestVer); // returns a BCD number, like 0x00001015 for 10.1.5 @@ -1017,5 +910,5 @@ } -#endif // _MACINTOSH +#endif // _MAC_UNIX Index: util/localrep.c =================================================================== RCS file: /cvsroot/common/util/localrep.c,v retrieving revision 1.11.6.3 diff -u -w -r1.11.6.3 localrep.c --- util/localrep.c 17 Mar 2005 04:37:27 -0000 1.11.6.3 +++ util/localrep.c 16 Dec 2008 04:09:14 -0000 @@ -58,12 +58,6 @@ #include <windowsx.h> #endif -#if defined(_MACINTOSH) -#include <stdio.h> -#include <string.h> -#endif - - // For debugging... //#include "hxassert.h" #include "hxheap.h" @@ -120,36 +114,6 @@ OS_STRING2(buffer, sizeOfBuffer), sizeOfBuffer); #endif -#ifdef _MACINTOSH - if (time > 0) - { - struct tm *tmtime = localtime(&time); - char format[32]; /* Flawfinder: ignore */ - switch (flags) - { - case HXLOCALTIMESTRING_24HOURFORMAT: - { - strcpy(format, "%H:%M"); /* Flawfinder: ignore */ - } - break; - case HXLOCALTIMESTRING_NOMINUTESORSECONDS: - { - sprintf(format, "%d", (((tmtime->tm_hour == 0) || (tmtime->tm_hour - 12 == 0))? 12 : ((tmtime->tm_hour > 12)? tmtime->tm_hour - 12 : tmtime->tm_hour))); /* Flawfinder: ignore */ - strcat(format, " %p"); /* Flawfinder: ignore */ - } - break; - case HXLOCALTIMESTRING_NOSECONDS: - default: - { - sprintf(format, "%d", (((tmtime->tm_hour == 0) || (tmtime->tm_hour - 12 == 0))? 12 : ((tmtime->tm_hour > 12)? tmtime->tm_hour - 12 : tmtime->tm_hour))); /* Flawfinder: ignore */ - strcat(format, ":%M %p"); /* Flawfinder: ignore */ - } - break; - } - strftime(buffer, sizeOfBuffer, format, tmtime); - } -#endif - return result; } @@ -286,28 +250,6 @@ buffer, sizeOfBuffer); #endif -#ifdef _MACINTOSH - if (time > 0) - { - struct tm *tmtime = localtime(&time); - char format[32];/* Flawfinder: ignore */ - switch (flags) - { - case HXLOCALDATESTRING_SHORTDATE: - strcpy(format, "%x"); /* Flawfinder: ignore */ // 10 Aug, 1999 - break; - case HXLOCALDATESTRING_LONGDATE: - strcpy(format, "%B %d, %Y"); /* Flawfinder: ignore */ // August 10, 1999 - break; - case HXLOCALDATESTRING_DEFAULT: - default: - strcpy(format, "%m/%d"); /* Flawfinder: ignore */ // 10/8 - break; - } - strftime(buffer, sizeOfBuffer, format, tmtime); - } -#endif - return result; } @@ -433,19 +375,6 @@ char buffer[3]; /* Flawfinder: ignore */ if(GetLocaleInfo(locale ? locale : LOCALE_SYSTEM_DEFAULT, LOCALE_SDECIMAL, buffer, 2) > 1) result = buffer[0]; -#elif defined(_MACINTOSH) - { - Intl0Hndl intlHandle; - - check(locale == 0); - - intlHandle = (Intl0Hndl) GetIntlResource(0); - if (intlHandle) - { - result = (**intlHandle).decimalPt; - } - } - #endif return result; } @@ -467,22 +396,6 @@ { char result = ':'; -#if defined(_MACINTOSH) - - { - Intl0Hndl intlHandle; - - check(locale == 0); - - intlHandle = (Intl0Hndl) GetIntlResource(0); - if (intlHandle) - { - result = (**intlHandle).timeSep; - } - } - -#endif - #ifdef WIN32 char buffer[3]; /* Flawfinder: ignore */ if(GetLocaleInfo(locale ? locale : LOCALE_SYSTEM_DEFAULT, LOCALE_SDECIMAL, buffer, 2) > 1) Index: util/netbyte.cpp =================================================================== RCS file: /cvsroot/common/util/netbyte.cpp,v retrieving revision 1.14.6.4 diff -u -w -r1.14.6.4 netbyte.cpp --- util/netbyte.cpp 5 Sep 2005 12:35:16 -0000 1.14.6.4 +++ util/netbyte.cpp 16 Dec 2008 04:09:14 -0000 @@ -56,10 +56,6 @@ #include "ihxpckts.h" #include "hxbuffer.h" -#ifdef _MACINTOSH -#include "hxstrutl.h" // for isascii definition -#endif - #include "hxheap.h" #ifdef _DEBUG #undef HX_THIS_FILE Index: util/pref.cpp =================================================================== RCS file: /cvsroot/common/util/pref.cpp,v retrieving revision 1.11.6.1 diff -u -w -r1.11.6.1 pref.cpp --- util/pref.cpp 28 Mar 2005 18:36:09 -0000 1.11.6.1 +++ util/pref.cpp 16 Dec 2008 04:09:14 -0000 @@ -60,12 +60,8 @@ //#include "hlxclib/stdio.h" #include "hlxclib/stdlib.h" -#if defined(_MACINTOSH) || defined(_MAC_UNIX) -#if defined(_CARBON) || defined(_MAC_UNIX) +#if defined(_MAC_UNIX) #include "platform/mac/mac_pref_cf.h" -#else -#include "mac_pref.h" -#endif #elif defined(_UNIX) && !defined(_MAC_UNIX) #include "unix_pref.h" @@ -96,12 +92,9 @@ { CPref * pPref = NULL; -#if defined (_CARBON) || defined(_MAC_UNIX) +#if defined(_MAC_UNIX) pPref = CMacPref::open_pref(pCompanyName, pProductName, nProdMajorVer, nProdMinorVer, bCommon); -#elif defined (_MACINTOSH) - pPref = CMacPref::open_pref(pCompanyName, pProductName, nProdMajorVer, nProdMinorVer); - #elif defined( _UNIX) pPref = ( CPref *) CUnixPref::open_pref(pCompanyName, pProductName, nProdMajorVer, nProdMinorVer); Index: util/platform/mac/MoreFilesX.c =================================================================== RCS file: /cvsroot/common/util/platform/mac/MoreFilesX.c,v retrieving revision 1.7.6.2 diff -u -w -r1.7.6.2 MoreFilesX.c --- util/platform/mac/MoreFilesX.c 14 Nov 2008 02:02:03 -0000 1.7.6.2 +++ util/platform/mac/MoreFilesX.c 16 Dec 2008 04:09:14 -0000 @@ -251,38 +251,6 @@ /*****************************************************************************/ OSErr -FSGetVolParms( - FSVolumeRefNum volRefNum, - UInt32 bufferSize, - GetVolParmsInfoBuffer *volParmsInfo, - UInt32 *actualInfoSize) -{ - OSErr result; - HParamBlockRec pb; - - /* check parameters */ - require_action((NULL != volParmsInfo) && (NULL != actualInfoSize), - BadParameter, result = paramErr); - - pb.ioParam.ioNamePtr = NULL; - pb.ioParam.ioVRefNum = volRefNum; - pb.ioParam.ioBuffer = (Ptr)volParmsInfo; - pb.ioParam.ioReqCount = (SInt32)bufferSize; - result = PBHGetVolParmsSync(&pb); - require_noerr(result, PBHGetVolParmsSync); - - /* return number of bytes the file system returned in volParmsInfo buffer */ - *actualInfoSize = (UInt32)pb.ioParam.ioActCount; - -PBHGetVolParmsSync: -BadParameter: - - return ( result ); -} - -/*****************************************************************************/ - -OSErr FSGetVRefNum( const FSRef *ref, FSVolumeRefNum *vRefNum) @@ -1359,41 +1327,6 @@ /*****************************************************************************/ OSErr -FSCopyFileMgrAttributes( - const FSRef *sourceRef, - const FSRef *destinationRef, - Boolean copyLockBit) -{ - OSErr result; - FSCatalogInfo catalogInfo; - - /* get the source information */ - result = FSGetCatalogInfo(sourceRef, kFSCatInfoSettableInfo, &catalogInfo, NULL, NULL, NULL); - require_noerr(result, FSGetCatalogInfo); - - /* don't copy the hasBeenInited bit; clear it */ - ((FileInfo *)&catalogInfo.finderInfo)->finderFlags &= ~kHasBeenInited; - - /* should the locked bit be copied? */ - if ( !copyLockBit ) - { - /* no, make sure the locked bit is clear */ - catalogInfo.nodeFlags &= ~kFSNodeLockedMask; - } - - /* set the destination information */ - result = FSSetCatalogInfo(destinationRef, kFSCatInfoSettableInfo, &catalogInfo); - require_noerr(result, FSSetCatalogInfo); - -FSSetCatalogInfo: -FSGetCatalogInfo: - - return ( result ); -} - -/*****************************************************************************/ - -OSErr FSMoveRenameObjectUnicode( const FSRef *ref, const FSRef *destDirectory, @@ -1971,682 +1904,6 @@ /*****************************************************************************/ -OSErr -FSExchangeObjectsCompat( - const FSRef *sourceRef, - const FSRef *destRef, - FSRef *newSourceRef, - FSRef *newDestRef) -{ - enum - { - /* get all settable info except for mod dates, plus the volume refNum and parent directory ID */ - kGetCatInformationMask = (kFSCatInfoSettableInfo | - kFSCatInfoVolume | - kFSCatInfoParentDirID) & - ~(kFSCatInfoContentMod | kFSCatInfoAttrMod), - /* set everything possible except for mod dates */ - kSetCatinformationMask = kFSCatInfoSettableInfo & - ~(kFSCatInfoContentMod | kFSCatInfoAttrMod) - }; - - OSErr result; - GetVolParmsInfoBuffer volParmsInfo; - UInt32 infoSize; - FSCatalogInfo sourceCatalogInfo; /* source file's catalog information */ - FSCatalogInfo destCatalogInfo; /* destination file's catalog information */ - HFSUniStr255 sourceName; /* source file's Unicode name */ - HFSUniStr255 destName; /* destination file's Unicode name */ - FSRef sourceCurrentRef; /* FSRef to current location of source file throughout this function */ - FSRef destCurrentRef; /* FSRef to current location of destination file throughout this function */ - FSRef sourceParentRef; /* FSRef to parent directory of source file */ - FSRef destParentRef; /* FSRef to parent directory of destination file */ - HFSUniStr255 sourceUniqueName; /* unique name given to source file while exchanging it with destination */ - HFSUniStr255 destUniqueName; /* unique name given to destination file while exchanging it with source */ - long theSeed; /* the seed for generating unique names */ - Boolean sameParentDirs; /* true if source and destinatin parent directory is the same */ - - /* check parameters */ - require_action((NULL != newSourceRef) && (NULL != newDestRef), BadParameter, result = paramErr); - - /* output refs and current refs = input refs to start with */ - BlockMoveData(sourceRef, newSourceRef, sizeof(FSRef)); - BlockMoveData(sourceRef, &sourceCurrentRef, sizeof(FSRef)); - - BlockMoveData(destRef, newDestRef, sizeof(FSRef)); - BlockMoveData(destRef, &destCurrentRef, sizeof(FSRef)); - - /* get source volume's vRefNum */ - result = FSGetCatalogInfo(&sourceCurrentRef, kFSCatInfoVolume, &sourceCatalogInfo, NULL, NULL, NULL); - require_noerr(result, DetermineSourceVRefNumFailed); - - /* see if that volume supports FSExchangeObjects */ - result = FSGetVolParms(sourceCatalogInfo.volume, sizeof(GetVolParmsInfoBuffer), - &volParmsInfo, &infoSize); - if ( (noErr == result) && VolSupportsFSExchangeObjects(&volParmsInfo) ) - { - /* yes - use FSExchangeObjects */ - result = FSExchangeObjects(sourceRef, destRef); - } - else - { - /* no - emulate FSExchangeObjects */ - - /* Note: The compatibility case won't work for files with *Btree control blocks. */ - /* Right now the only *Btree files are created by the system. */ - - /* get all catalog information and Unicode names for each file */ - result = FSGetCatalogInfo(&sourceCurrentRef, kGetCatInformationMask, &sourceCatalogInfo, &sourceName, NULL, &sourceParentRef); - require_noerr(result, SourceFSGetCatalogInfoFailed); - - result = FSGetCatalogInfo(&destCurrentRef, kGetCatInformationMask, &destCatalogInfo, &destName, NULL, &destParentRef); - require_noerr(result, DestFSGetCatalogInfoFailed); - - /* make sure source and destination are on same volume */ - require_action(sourceCatalogInfo.volume == destCatalogInfo.volume, NotSameVolume, result = diffVolErr); - - /* make sure both files are *really* files */ - require_action((0 == (sourceCatalogInfo.nodeFlags & kFSNodeIsDirectoryMask)) && - (0 == (destCatalogInfo.nodeFlags & kFSNodeIsDirectoryMask)), NotAFile, result = notAFileErr); - - /* generate 2 names that are unique in both directories */ - theSeed = 0x4a696d4c; /* a fine unlikely filename */ - - result = GenerateUniqueHFSUniStr(&theSeed, &sourceParentRef, &destParentRef, &sourceUniqueName); - require_noerr(result, GenerateUniqueHFSUniStr1Failed); - - result = GenerateUniqueHFSUniStr(&theSeed, &sourceParentRef, &destParentRef, &destUniqueName); - require_noerr(result, GenerateUniqueHFSUniStr2Failed); - - /* rename sourceCurrentRef to sourceUniqueName */ - result = FSRenameUnicode(&sourceCurrentRef, sourceUniqueName.length, sourceUniqueName.unicode, kTextEncodingUnknown, newSourceRef); - require_noerr(result, FSRenameUnicode1Failed); - BlockMoveData(newSourceRef, &sourceCurrentRef, sizeof(FSRef)); - - /* rename destCurrentRef to destUniqueName */ - result = FSRenameUnicode(&destCurrentRef, destUniqueName.length, destUniqueName.unicode, kTextEncodingUnknown, newDestRef); - require_noerr(result, FSRenameUnicode2Failed); - BlockMoveData(newDestRef, &destCurrentRef, sizeof(FSRef)); - - /* are the source and destination parent directories the same? */ - sameParentDirs = ( sourceCatalogInfo.parentDirID == destCatalogInfo.parentDirID ); - if ( !sameParentDirs ) - { - /* move source file to dest parent directory */ - result = FSMoveObject(&sourceCurrentRef, &destParentRef, newSourceRef); - require_noerr(result, FSMoveObject1Failed); - BlockMoveData(newSourceRef, &sourceCurrentRef, sizeof(FSRef)); - - /* move dest file to source parent directory */ - result = FSMoveObject(&destCurrentRef, &sourceParentRef, newDestRef); - require_noerr(result, FSMoveObject2Failed); - BlockMoveData(newDestRef, &destCurrentRef, sizeof(FSRef)); - } - - /* At this point, the files are in their new locations (if they were moved). */ - /* The source file is named sourceUniqueName and is in the directory referred to */ - /* by destParentRef. The destination file is named destUniqueName and is in the */ - /* directory referred to by sourceParentRef. */ - - /* give source file the dest file's catalog information except for mod dates */ - result = FSSetCatalogInfo(&sourceCurrentRef, kSetCatinformationMask, &destCatalogInfo); - require_noerr(result, FSSetCatalogInfo1Failed); - - /* give dest file the source file's catalog information except for mod dates */ - result = FSSetCatalogInfo(&destCurrentRef, kSetCatinformationMask, &sourceCatalogInfo); - require_noerr(result, FSSetCatalogInfo2Failed); - - /* rename source file with dest file's name */ - result = FSRenameUnicode(&sourceCurrentRef, destName.length, destName.unicode, destCatalogInfo.textEncodingHint, newSourceRef); - require_noerr(result, FSRenameUnicode3Failed); - BlockMoveData(newSourceRef, &sourceCurrentRef, sizeof(FSRef)); - - /* rename dest file with source file's name */ - result = FSRenameUnicode(&destCurrentRef, sourceName.length, sourceName.unicode, sourceCatalogInfo.textEncodingHint, newDestRef); - require_noerr(result, FSRenameUnicode4Failed); - - /* we're done with no errors, so swap newSourceRef and newDestRef */ - BlockMoveData(newDestRef, newSourceRef, sizeof(FSRef)); - BlockMoveData(&sourceCurrentRef, newDestRef, sizeof(FSRef)); - } - - return ( result ); - - /**********************/ - -/* If there are any failures while emulating FSExchangeObjects, attempt to reverse any steps */ -/* already taken. In any case, newSourceRef and newDestRef will refer to the files in whatever */ -/* state and location they ended up in so that both files can be found by the calling code. */ - -FSRenameUnicode4Failed: - - /* attempt to rename source file to sourceUniqueName */ - if ( noErr == FSRenameUnicode(&sourceCurrentRef, sourceUniqueName.length, sourceUniqueName.unicode, kTextEncodingUnknown, newSourceRef) ) - { - BlockMoveData(newSourceRef, &sourceCurrentRef, sizeof(FSRef)); - } - -FSRenameUnicode3Failed: - - /* attempt to restore dest file's catalog information */ - verify_noerr(FSSetCatalogInfo(&destCurrentRef, kFSCatInfoSettableInfo, &destCatalogInfo)); - -FSSetCatalogInfo2Failed: - - /* attempt to restore source file's catalog information */ - verify_noerr(FSSetCatalogInfo(&sourceCurrentRef, kFSCatInfoSettableInfo, &sourceCatalogInfo)); - -FSSetCatalogInfo1Failed: - - if ( !sameParentDirs ) - { - /* attempt to move dest file back to dest directory */ - if ( noErr == FSMoveObject(&destCurrentRef, &destParentRef, newDestRef) ) - { - BlockMoveData(newDestRef, &destCurrentRef, sizeof(FSRef)); - } - } - -FSMoveObject2Failed: - - if ( !sameParentDirs ) - { - /* attempt to move source file back to source directory */ - if ( noErr == FSMoveObject(&sourceCurrentRef, &sourceParentRef, newSourceRef) ) - { - BlockMoveData(newSourceRef, &sourceCurrentRef, sizeof(FSRef)); - } - } - -FSMoveObject1Failed: - - /* attempt to rename dest file to original name */ - verify_noerr(FSRenameUnicode(&destCurrentRef, destName.length, destName.unicode, destCatalogInfo.textEncodingHint, newDestRef)); - -FSRenameUnicode2Failed: - - /* attempt to rename source file to original name */ - verify_noerr(FSRenameUnicode(&sourceCurrentRef, sourceName.length, sourceName.unicode, sourceCatalogInfo.textEncodingHint, newSourceRef)); - -FSRenameUnicode1Failed: -GenerateUniqueHFSUniStr2Failed: -GenerateUniqueHFSUniStr1Failed: -NotAFile: -NotSameVolume: -DestFSGetCatalogInfoFailed: -SourceFSGetCatalogInfoFailed: -FSGetVolParmsFailed: -DetermineSourceVRefNumFailed: -BadParameter: - - return ( result ); -} - -/*****************************************************************************/ - -#pragma mark ----- Shared Environment Routines ----- - -/*****************************************************************************/ - -OSErr -FSLockRangeMoreFiles( - SInt16 refNum, - SInt32 rangeLength, - SInt32 rangeStart) -{ - OSErr result; - ParamBlockRec pb; - - pb.ioParam.ioRefNum = refNum; - pb.ioParam.ioReqCount = rangeLength; - pb.ioParam.ioPosMode = fsFromStart; - pb.ioParam.ioPosOffset = rangeStart; - result = PBLockRangeSync(&pb); - require_noerr(result, PBLockRangeSync); - -PBLockRangeSync: - - return ( result ); -} - -/*****************************************************************************/ - -OSErr -FSUnlockRangeMoreFiles( - SInt16 refNum, - SInt32 rangeLength, - SInt32 rangeStart) -{ - OSErr result; - ParamBlockRec pb; - - pb.ioParam.ioRefNum = refNum; - pb.ioParam.ioReqCount = rangeLength; - pb.ioParam.ioPosMode = fsFromStart; - pb.ioParam.ioPosOffset = rangeStart; - result = PBUnlockRangeSync(&pb); - require_noerr(result, PBUnlockRangeSync); - -PBUnlockRangeSync: - - return ( result ); -} - -/*****************************************************************************/ - -OSErr -FSGetDirAccess( - const FSRef *ref, - SInt32 *ownerID, /* can be NULL */ - SInt32 *groupID, /* can be NULL */ - SInt32 *accessRights) /* can be NULL */ -{ - OSErr result; - FSSpec spec; - HParamBlockRec pb; - - /* get FSSpec from FSRef */ - result = FSGetCatalogInfo(ref, kFSCatInfoNone, NULL, NULL, &spec, NULL); - require_noerr(result, FSGetCatalogInfo); - - /* get directory access info for FSSpec */ - pb.accessParam.ioNamePtr = (StringPtr)spec.name; - pb.accessParam.ioVRefNum = spec.vRefNum; - pb.fileParam.ioDirID = spec.parID; - result = PBHGetDirAccessSync(&pb); - require_noerr(result, PBHGetDirAccessSync); - - /* return the IDs and access rights */ - if ( NULL != ownerID ) - { - *ownerID = pb.accessParam.ioACOwnerID; - } - if ( NULL != groupID ) - { - *groupID = pb.accessParam.ioACGroupID; - } - if ( NULL != accessRights ) - { - *accessRights = pb.accessParam.ioACAccess; - } - -PBHGetDirAccessSync: -FSGetCatalogInfo: - - return ( result ); -} - -/*****************************************************************************/ - -OSErr -FSSetDirAccess( - const FSRef *ref, - SInt32 ownerID, - SInt32 groupID, - SInt32 accessRights) -{ - OSErr result; - FSSpec spec; - HParamBlockRec pb; - - enum - { - /* Just the bits that can be set */ - kSetDirAccessSettableMask = (kioACAccessBlankAccessMask + - kioACAccessEveryoneWriteMask + kioACAccessEveryoneReadMask + kioACAccessEveryoneSearchMask + - kioACAccessGroupWriteMask + kioACAccessGroupReadMask + kioACAccessGroupSearchMask + - kioACAccessOwnerWriteMask + kioACAccessOwnerReadMask + kioACAccessOwnerSearchMask) - }; - - /* get FSSpec from FSRef */ - result = FSGetCatalogInfo(ref, kFSCatInfoNone, NULL, NULL, &spec, NULL); - require_noerr(result, FSGetCatalogInfo); - - /* set directory access info for FSSpec */ - pb.accessParam.ioNamePtr = (StringPtr)spec.name; - pb.accessParam.ioVRefNum = spec.vRefNum; - pb.fileParam.ioDirID = spec.parID; - pb.accessParam.ioACOwnerID = ownerID; - pb.accessParam.ioACGroupID = groupID; - pb.accessParam.ioACAccess = accessRights & kSetDirAccessSettableMask; - result = PBHSetDirAccessSync(&pb); - require_noerr(result, PBHSetDirAccessSync); - -PBHSetDirAccessSync: -FSGetCatalogInfo: - - return ( result ); -} - -/*****************************************************************************/ - -OSErr -FSGetVolMountInfoSize( - FSVolumeRefNum volRefNum, - SInt16 *size) -{ - OSErr result; - ParamBlockRec pb; - - /* check parameters */ - require_action(NULL != size, BadParameter, result = paramErr); - - pb.ioParam.ioNamePtr = NULL; - pb.ioParam.ioVRefNum = volRefNum; - pb.ioParam.ioBuffer = (Ptr)size; - result = PBGetVolMountInfoSize(&pb); - require_noerr(result, PBGetVolMountInfoSize); - -PBGetVolMountInfoSize: -BadParameter: - - return ( result ); -} - -/*****************************************************************************/ - -OSErr -FSGetVolMountInfo( - FSVolumeRefNum volRefNum, - void *volMountInfo) -{ - OSErr result; - ParamBlockRec pb; - - /* check parameters */ - require_action(NULL != volMountInfo, BadParameter, result = paramErr); - - pb.ioParam.ioNamePtr = NULL; - pb.ioParam.ioVRefNum = volRefNum; - pb.ioParam.ioBuffer = (Ptr)volMountInfo; - result = PBGetVolMountInfo(&pb); - require_noerr(result, PBGetVolMountInfo); - -PBGetVolMountInfo: -BadParameter: - - return ( result ); -} - -/*****************************************************************************/ - -OSErr -FSMapID( - FSVolumeRefNum volRefNum, - SInt32 ugID, - SInt16 objType, - Str31 name) -{ - OSErr result; - HParamBlockRec pb; - - /* check parameters */ - require_action(NULL != name, BadParameter, result = paramErr); - - pb.objParam.ioNamePtr = NULL; - pb.objParam.ioVRefNum = volRefNum; - pb.objParam.ioObjType = objType; - pb.objParam.ioObjNamePtr = name; - pb.objParam.ioObjID = ugID; - result = PBHMapIDSync(&pb); - require_noerr(result, PBHMapIDSync); - -PBHMapIDSync: -BadParameter: - - return ( result ); -} - -/*****************************************************************************/ - -OSErr -FSMapName( - FSVolumeRefNum volRefNum, - ConstStr255Param name, - SInt16 objType, - SInt32 *ugID) -{ - OSErr result; - HParamBlockRec pb; - - /* check parameters */ - require_action(NULL != ugID, BadParameter, result = paramErr); - - pb.objParam.ioNamePtr = NULL; - pb.objParam.ioVRefNum = volRefNum; - pb.objParam.ioObjType = objType; - pb.objParam.ioObjNamePtr = (StringPtr)name; - result = PBHMapNameSync(&pb); - require_noerr(result, PBHMapNameSync); - - /* return the user or group ID */ - *ugID = pb.objParam.ioObjID; - -PBHMapNameSync: -BadParameter: - - return ( result ); -} - -/*****************************************************************************/ - -OSErr -FSCopyFile( - const FSRef *srcFileRef, - const FSRef *dstDirectoryRef, - UniCharCount nameLength, - const UniChar *copyName, /* can be NULL (no rename during copy) */ - TextEncoding textEncodingHint, - FSRef *newRef) /* can be NULL */ -{ - OSErr result; - FSSpec srcFileSpec; - FSCatalogInfo catalogInfo; - HParamBlockRec pb; - Str31 hfsName; - GetVolParmsInfoBuffer volParmsInfo; - UInt32 infoSize; - - /* get source FSSpec from source FSRef */ - result = FSGetCatalogInfo(srcFileRef, kFSCatInfoNone, NULL, NULL, &srcFileSpec, NULL); - require_noerr(result, FSGetCatalogInfo_srcFileRef); - - /* Make sure the volume supports CopyFile */ - result = FSGetVolParms(srcFileSpec.vRefNum, sizeof(GetVolParmsInfoBuffer), - &volParmsInfo, &infoSize); - require_action((noErr == result) && VolHasCopyFile(&volParmsInfo), - NoCopyFileSupport, result = paramErr); - - /* get destination volume reference number and destination directory ID from destination FSRef */ - result = FSGetCatalogInfo(dstDirectoryRef, kFSCatInfoVolume + kFSCatInfoNodeID, - &catalogInfo, NULL, NULL, NULL); - require_noerr(result, FSGetCatalogInfo_dstDirectoryRef); - - /* tell the server to copy the object */ - pb.copyParam.ioVRefNum = srcFileSpec.vRefNum; - pb.copyParam.ioDirID = srcFileSpec.parID; - pb.copyParam.ioNamePtr = (StringPtr)srcFileSpec.name; - pb.copyParam.ioDstVRefNum = catalogInfo.volume; - pb.copyParam.ioNewDirID = (long)catalogInfo.nodeID; - pb.copyParam.ioNewName = NULL; - if ( NULL != copyName ) - { - result = UnicodeNameGetHFSName(nameLength, copyName, textEncodingHint, false, hfsName); - require_noerr(result, UnicodeNameGetHFSName); - - pb.copyParam.ioCopyName = hfsName; - } - else - { - pb.copyParam.ioCopyName = NULL; - } - result = PBHCopyFileSync(&pb); - require_noerr(result, PBHCopyFileSync); - - if ( NULL != newRef ) - { - verify_noerr(FSMakeFSRef(pb.copyParam.ioDstVRefNum, pb.copyParam.ioNewDirID, - pb.copyParam.ioCopyName, newRef)); - } - -PBHCopyFileSync: -UnicodeNameGetHFSName: -FSGetCatalogInfo_dstDirectoryRef: -NoCopyFileSupport: -FSGetCatalogInfo_srcFileRef: - - return ( result ); -} - -/*****************************************************************************/ - -OSErr -FSMoveRename( - const FSRef *srcFileRef, - const FSRef *dstDirectoryRef, - UniCharCount nameLength, - const UniChar *moveName, /* can be NULL (no rename during move) */ - TextEncoding textEncodingHint, - FSRef *newRef) /* can be NULL */ -{ - OSErr result; - FSSpec srcFileSpec; - FSCatalogInfo catalogInfo; - HParamBlockRec pb; - Str31 hfsName; - GetVolParmsInfoBuffer volParmsInfo; - UInt32 infoSize; - - /* get source FSSpec from source FSRef */ - result = FSGetCatalogInfo(srcFileRef, kFSCatInfoNone, NULL, NULL, &srcFileSpec, NULL); - require_noerr(result, FSGetCatalogInfo_srcFileRef); - - /* Make sure the volume supports MoveRename */ - result = FSGetVolParms(srcFileSpec.vRefNum, sizeof(GetVolParmsInfoBuffer), - &volParmsInfo, &infoSize); - require_action((noErr == result) && VolHasMoveRename(&volParmsInfo), - NoMoveRenameSupport, result = paramErr); - - /* get destination volume reference number and destination directory ID from destination FSRef */ - result = FSGetCatalogInfo(dstDirectoryRef, kFSCatInfoVolume + kFSCatInfoNodeID, - &catalogInfo, NULL, NULL, NULL); - require_noerr(result, FSGetCatalogInfo_dstDirectoryRef); - - /* make sure the source and destination are on the same volume */ - require_action(srcFileSpec.vRefNum == catalogInfo.volume, NotSameVolume, result = diffVolErr); - - /* tell the server to move and rename the object */ - pb.copyParam.ioVRefNum = srcFileSpec.vRefNum; - pb.copyParam.ioDirID = srcFileSpec.parID; - pb.copyParam.ioNamePtr = (StringPtr)srcFileSpec.name; - pb.copyParam.ioNewDirID = (long)catalogInfo.nodeID; - pb.copyParam.ioNewName = NULL; - if ( NULL != moveName ) - { - result = UnicodeNameGetHFSName(nameLength, moveName, textEncodingHint, false, hfsName); - require_noerr(result, UnicodeNameGetHFSName); - - pb.copyParam.ioCopyName = hfsName; - } - else - { - pb.copyParam.ioCopyName = NULL; - } - result = PBHMoveRenameSync(&pb); - require_noerr(result, PBHMoveRenameSync); - - if ( NULL != newRef ) - { - verify_noerr(FSMakeFSRef(pb.copyParam.ioVRefNum, pb.copyParam.ioNewDirID, - pb.copyParam.ioCopyName, newRef)); - } - -PBHMoveRenameSync: -UnicodeNameGetHFSName: -NotSameVolume: -FSGetCatalogInfo_dstDirectoryRef: -NoMoveRenameSupport: -FSGetCatalogInfo_srcFileRef: - - return ( result ); -} - -/*****************************************************************************/ - -#pragma mark ----- File ID Routines ----- - -/*****************************************************************************/ - -OSErr -FSResolveFileIDRef( - FSVolumeRefNum volRefNum, - SInt32 fileID, - FSRef *ref) -{ - OSErr result; - FIDParam pb; - Str255 tempStr; - - /* check parameters */ - require_action(NULL != ref, BadParameter, result = paramErr); - - /* resolve the file ID reference */ - tempStr[0] = 0; - pb.ioNamePtr = tempStr; - pb.ioVRefNum = volRefNum; - pb.ioFileID = fileID; - result = PBResolveFileIDRefSync((HParmBlkPtr)&pb); - require_noerr(result, PBResolveFileIDRefSync); - - /* and then make an FSRef to the file */ - result = FSMakeFSRef(volRefNum, pb.ioSrcDirID, tempStr, ref); - require_noerr(result, FSMakeFSRef); - -FSMakeFSRef: -PBResolveFileIDRefSync: -BadParameter: - - return ( result ); -} - -/*****************************************************************************/ - -OSErr -FSCreateFileIDRef( - const FSRef *ref, - SInt32 *fileID) -{ - OSErr result; - FSSpec spec; - FIDParam pb; - - /* check parameters */ - require_action(NULL != fileID, BadParameter, result = paramErr); - - /* Get an FSSpec from the FSRef */ - result = FSGetCatalogInfo(ref, kFSCatInfoNone, NULL, NULL, &spec, NULL); - require_noerr(result, FSGetCatalogInfo); - - /* Create (or get) the file ID reference using the FSSpec */ - pb.ioNamePtr = (StringPtr)spec.name; - pb.ioVRefNum = spec.vRefNum; - pb.ioSrcDirID = spec.parID; - result = PBCreateFileIDRefSync((HParmBlkPtr)&pb); - require((noErr == result) || (fidExists == result) || (afpIDExists == result), - PBCreateFileIDRefSync); - - /* return the file ID reference */ - *fileID = pb.ioFileID; - -PBCreateFileIDRefSync: -FSGetCatalogInfo: -BadParameter: - - return ( result ); -} - -/*****************************************************************************/ - #pragma mark ----- Utility Routines ----- /*****************************************************************************/ @@ -2809,3 +2066,4 @@ } /*****************************************************************************/ + Index: util/platform/mac/cfwrappers.cpp =================================================================== RCS file: /cvsroot/common/util/platform/mac/cfwrappers.cpp,v retrieving revision 1.6 diff -u -w -r1.6 cfwrappers.cpp --- util/platform/mac/cfwrappers.cpp 13 Sep 2004 19:29:44 -0000 1.6 +++ util/platform/mac/cfwrappers.cpp 16 Dec 2008 04:09:14 -0000 @@ -49,8 +49,6 @@ #pragma once -#if defined(_CARBON) || defined(_MAC_UNIX) - #include "platform/mac/cfwrappers.h" #include "hxassert.h" @@ -475,5 +473,3 @@ pStrDebugOnlyPeek = (const char *) mStrDebugOnly; } #endif // _DEBUG - -#endif // _CARBON Index: util/platform/mac/cresload.cpp =================================================================== RCS file: /cvsroot/common/util/platform/mac/cresload.cpp,v retrieving revision 1.6 diff -u -w -r1.6 cresload.cpp --- util/platform/mac/cresload.cpp 9 Jul 2004 18:23:03 -0000 1.6 +++ util/platform/mac/cresload.cpp 16 Dec 2008 04:09:14 -0000 @@ -149,7 +149,7 @@ // FSOpenResourceFile (by default) opens the DATA FORK // as a resource file. Allows us to use data-fork-based // resource files. - short theRefNum = 0; + ResFileRefNum theRefNum = 0; OSErr err = FSOpenResourceFile(&resourceFSRef, 0, NULL, fsRdPerm, &theRefNum); if (err == noErr) { Index: util/platform/mac/fullpathname.cp =================================================================== RCS file: /cvsroot/common/util/platform/mac/fullpathname.cp,v retrieving revision 1.8 diff -u -w -r1.8 fullpathname.cp --- util/platform/mac/fullpathname.cp 13 Sep 2004 19:29:44 -0000 1.8 +++ util/platform/mac/fullpathname.cp 16 Dec 2008 04:09:14 -0000 @@ -49,10 +49,8 @@ #include "platform/mac/FullPathName.h" -#if defined(_MAC_UNIX) || defined(_CARBON) #include "platform/mac/MoreFilesX.h" #include "platform/mac/cfwrappers.h" -#endif /* * Pascal string utilities @@ -62,19 +60,16 @@ extern "C" { #endif -#if defined(_MAC_UNIX) || defined(_CARBON) - // prototypes for internal routines -static OSErr PathFromFSRefInternal(CFURLPathStyle pathStyle, const FSRef *ref, CHXString& fullPathName); -static OSErr FSRefFromPathInternal(CFURLPathStyle pathStyle, const char *path, FSRef *outRef); -static OSErr AlternateFSRefFromHFSPathInternal(const char* hfspath, FSRef* outRef); +static OSErr PathFromFSRefInternal(const FSRef *ref, CHXString& fullPathName); +static OSErr FSRefFromPathInternal(const char *path, FSRef *outRef); // must use posix path -static OSStatus URLFromPathInternal(CFURLPathStyle pathStyle, const char *pszPath, CHXString& strURL); -static OSStatus PathFromURLInternal(CFURLPathStyle pathStyle, const char *pszURL, CHXString& fullPathName); +static OSStatus URLFromPathInternal(const char *pszPath, CHXString& strURL); +static OSStatus PathFromURLInternal(const char *pszURL, CHXString& fullPathName); -OSStatus PathFromCFURLInternal(CFURLPathStyle pathStyle, CFURLRef urlRef, CHXString& fullPathName); +OSStatus PathFromCFURLInternal(CFURLRef urlRef, CHXString& fullPathName); -OSErr PathFromFSRefInternal(CFURLPathStyle pathStyle, const FSRef *ref, CHXString& fullPathName) +OSErr PathFromFSRefInternal(const FSRef *ref, CHXString& fullPathName) { CHXCFString cfs; CHXCFURL cfurl; @@ -85,31 +80,29 @@ cfurl = ref; require(cfurl.IsSet(), CantSetURLToRef); - return PathFromCFURLInternal(pathStyle, cfurl, fullPathName); + return PathFromCFURLInternal(cfurl, fullPathName); CantSetURLToRef: BadParam: return errFSBadFSRef; } -OSErr FSRefFromPathInternal(CFURLPathStyle pathStyle, const char *path, FSRef *outRef) +OSErr FSRefFromPathInternal(const char *path, FSRef *outRef) { CHXCFURL cfurl; CHXCFString cfstr; Boolean bSuccess; - CFStringEncoding encoding; const Boolean kDirectoryDoesntMatter = false; // we could look at the last char of the string if it mattered require_nonnull(outRef, BadOutputParam); // copy the path to a CFString - encoding = (pathStyle == kCFURLHFSPathStyle ? CFStringGetSystemEncoding() : (CFStringEncoding) kCFStringEncodingUTF8); - cfstr = CHXCFString(path, encoding); - if (!cfstr.IsSet() && (kCFStringEncodingUTF8 == encoding)) + cfstr = CHXCFString(path, kCFStringEncodingUTF8); + if (!cfstr.IsSet()) { // it's not a proper path; it might be something from inside a text file, probably created on Windows - encoding = CFStringGetSystemEncoding(); + CFStringEncoding encoding = CFStringGetSystemEncoding(); if (encoding == kCFStringEncodingMacRoman) { encoding = kCFStringEncodingWindowsLatin1; @@ -119,18 +112,13 @@ require(cfstr.IsSet(), CantMakeCFString); // make a CFURL from the CFString - cfurl = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, cfstr, pathStyle, kDirectoryDoesntMatter); + cfurl = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, cfstr, kCFURLPOSIXPathStyle, kDirectoryDoesntMatter); require(cfurl.IsSet(), CantSetURL); // get an FSRef from the URL; this will fail if the item doesn't really exist bSuccess = CFURLGetFSRef(cfurl, outRef); //if (!bSuccess) CFShow(cfurl); - if ((!bSuccess) && (pathStyle == kCFURLHFSPathStyle)) - { - OSErr err = AlternateFSRefFromHFSPathInternal(path, outRef); - bSuccess = (err == noErr); - } require_quiet(bSuccess, CantGetRefFromURL); // now make an FSRef @@ -143,65 +131,19 @@ return paramErr; } - -// GR 7/23/02 blech... -// AlternateFSRefFromHFSPathInternal exists only because Mac OS X 10.1.5 and maybe later -// can't make CFURLs and then FSRefs from HFS paths that have volume names with high-8 bit -// characters in them. - -OSErr AlternateFSRefFromHFSPathInternal(const char* hfspath, FSRef* outRef) -{ - require_nonnull_return(outRef, paramErr); - require_nonnull_return(hfspath, paramErr); - - OSErr err = -1; - - // use FSMakeFSSpec for short paths, NewAliasMinimalFromFullPath for long paths - - if (strlen(hfspath) < 256) - { - Str255 pascPath; - FSSpec spec; - - c2pstrcpy(pascPath, hfspath); - err = FSMakeFSSpec(0, 0, pascPath, &spec); - if (err == noErr || err == fnfErr) - { - err = FSpMakeFSRef(&spec, outRef); - } - } - else - { - AliasHandle aliasH; - Boolean wasChanged; - - err = NewAliasMinimalFromFullPath(strlen(hfspath), hfspath, "\p", "\p", &aliasH); - if (err == noErr) - { - err = FSResolveAliasWithMountFlags(nil, aliasH, outRef, &wasChanged, kResolveAliasFileNoUI); - - DisposeHandle((Handle) aliasH); - } - } - return err; -} - - -OSStatus URLFromPathInternal(CFURLPathStyle pathStyle, const char *pszPath, CHXString& strURL) +OSStatus URLFromPathInternal(const char *pszPath, CHXString& strURL) { CHXCFURL cfurl; CHXCFString cfstr; CFStringRef cfsNoRelease; - CFStringEncoding encoding; const Boolean kDirectoryDoesntMatter = false; // we could look at the last char of the string if it mattered // copy the path into a CFString - encoding = (pathStyle == kCFURLHFSPathStyle ? CFStringGetSystemEncoding() : (CFStringEncoding) kCFStringEncodingUTF8); - cfstr = CHXCFString(pszPath, encoding); + cfstr = CHXCFString(pszPath, kCFStringEncodingUTF8); // make a CFURL from the CFString of the path - cfurl = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, cfstr, pathStyle, kDirectoryDoesntMatter); + cfurl = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, cfstr, kCFURLPOSIXPathStyle, kDirectoryDoesntMatter); require(cfurl.IsSet(), CantSetURL); // get the URL as a CFString @@ -218,7 +160,7 @@ return paramErr; } -OSStatus PathFromURLInternal(CFURLPathStyle pathStyle, const char *pszURL, CHXString& fullPathName) +OSStatus PathFromURLInternal(const char *pszURL, CHXString& fullPathName) { CHXCFURL cfurl; CHXCFString cfs; @@ -227,29 +169,14 @@ cfurl = pszURL; require(cfurl.IsSet(), CantMakeURL); - return PathFromCFURLInternal(pathStyle, cfurl, fullPathName); + return PathFromCFURLInternal(cfurl, fullPathName); CantMakeURL: return kNSLBadURLSyntax; } -OSStatus PathFromCFURLInternal(CFURLPathStyle pathStyle, CFURLRef urlRef, CHXString& fullPathName) -{ - if (pathStyle == kCFURLHFSPathStyle) +OSStatus PathFromCFURLInternal(CFURLRef urlRef, CHXString& fullPathName) { - CHXCFString cfs; - - // get the HFS path as a CFString from the CFURL - cfs = CFURLCopyFileSystemPath (urlRef, pathStyle); - require(cfs.IsSet(), CantSetStringToURL); - - // copy the path to the CHXString - fullPathName.SetFromCFString(cfs, CFStringGetSystemEncoding()); - } - else - { -#if defined(_MAC_MACHO) - // POSIX paths are canonical UTF-8, as returned by CFURLGetFileSystemRepresentation const Boolean kAbsolutePath = true; @@ -261,11 +188,6 @@ fullPathName.ReleaseBuffer(); require(succeeded, CantSetStringToURL); -#else - HX_ASSERT(!"CFM builds shouldn't be getting posix paths!"); -#endif - } - require_quiet(!fullPathName.IsEmpty(), URLCreationFailed); return noErr; @@ -282,87 +204,27 @@ OSErr PathFromFSRef(const FSRef *ref, CHXString& fullPathName) { -#ifdef _MAC_CFM - return HFSPathFromFSRef(ref, fullPathName); -#else return POSIXPathFromFSRef(ref, fullPathName); -#endif } OSErr FSRefFromPath(const char *path, FSRef *outRef) { -#ifdef _MAC_CFM - return FSRefFromHFSPath(path, outRef); -#else return FSRefFromPosixPath(path, outRef); -#endif } OSErr PathFromURL(const char *pszURL, CHXString& fullPathName) { -#ifdef _MAC_CFM - return HFSPathFromURL(pszURL, fullPathName); -#else return POSIXPathFromURL(pszURL, fullPathName); -#endif } OSErr URLFromPath(const char *pszPath, CHXString& strURL) { -#ifdef _MAC_CFM - return URLFromHFSPath(pszPath, strURL); -#else return URLFromPOSIXPath(pszPath, strURL); -#endif -} - -OSErr HFSPathFromFSRef(const FSRef *pRef, CHXString& fullPathName) -{ - OSErr err; - - err = PathFromFSRefInternal(kCFURLHFSPathStyle, pRef, fullPathName); - - if (err == noErr) - { - // be sure that directory path names end with ':' - OSErr err2; - Boolean isDir; - long *kDontWantNodeID = NULL; - - err2 = FSGetNodeID(pRef, kDontWantNodeID, &isDir); - if ((err2 == noErr) && isDir) - { - if (fullPathName.Right(1) != ":") - { - fullPathName += ':'; - } - } - } - - return err; -} - -OSErr FSRefFromHFSPath(const char *path, FSRef *outRef) -{ - CHXString strPath; - OSErr err; - - err = FullFromPartialHFSPath(path, strPath); - - // now we have a full path name to convert - - // GR 3/26/02 - // ick, this fails for paths on mounted volumes due to CFURL bugs, and none - // of the alternatives I can find seem to work, either - - err = FSRefFromPathInternal(kCFURLHFSPathStyle, (const char *) strPath, outRef); - return err; } - OSStatus POSIXPathFromFSRef (const FSRef *pRef, CHXString& fullPathName) { - return PathFromFSRefInternal(kCFURLPOSIXPathStyle, pRef, fullPathName); + return PathFromFSRefInternal(pRef, fullPathName); } OSStatus FSRefFromPosixPath (const char *path, FSRef *pRef) @@ -372,7 +234,7 @@ err = FullFromPartialPOSIXPath(path, strPath); - return FSRefFromPathInternal(kCFURLPOSIXPathStyle, path, pRef); + return FSRefFromPathInternal(path, pRef); } // url <--> path routines @@ -384,74 +246,12 @@ err = FullFromPartialPOSIXPath(pszPath, strPath); - return URLFromPathInternal(kCFURLPOSIXPathStyle, pszPath, strURL); + return URLFromPathInternal(pszPath, strURL); } OSStatus POSIXPathFromURL(const char *pszURL, CHXString& fullPathName) { - return PathFromURLInternal(kCFURLPOSIXPathStyle, pszURL, fullPathName); -} - -OSStatus URLFromHFSPath(const char *pszPath, CHXString& strURL) -{ - OSStatus err; - CHXString strPath; - - err = FullFromPartialHFSPath(pszPath, strPath); - - return URLFromPathInternal(kCFURLHFSPathStyle, pszPath, strURL); -} - -OSStatus HFSPathFromURL(const char *pszURL, CHXString& fullPathName) -{ - return PathFromURLInternal(kCFURLHFSPathStyle, pszURL, fullPathName); -} - -OSErr FullFromPartialHFSPath(const char *pszPartialOrFullPath, CHXString& fullPathName) -{ - // icky; hopefully no one will ever pass in a file name or partial path - // - // If there's no colon in the HFS path, or it begins with a colon, - // we assume it's a local file name or partial path and use the - // current directory to make a full path - - CHXString strTemp; - OSErr err; - - err = noErr; - strTemp = pszPartialOrFullPath; - - INT32 colonOffset = strTemp.Find(':'); - - if (colonOffset == -1 || colonOffset == 0) - { - FSVolumeRefNum vRefNum; - long dirID; - - err = HGetVol(nil, &vRefNum, &dirID); - if (err == noErr) - { - err = PathNameFromDirID(dirID, vRefNum, strTemp); - if (err == noErr) - { - if (colonOffset == 0) - { - // concatenate a partial path starting with : - // (skip the initial colon, though) - strTemp += &pszPartialOrFullPath[1]; - } - else - { - // concatenate just a file name - strTemp += pszPartialOrFullPath; - } - } - } - } - - fullPathName = strTemp; - - return err; + return PathFromURLInternal(pszURL, fullPathName); } OSErr FullFromPartialPOSIXPath(const char *pszPartialOrFullPath, CHXString& fullPathName) @@ -467,7 +267,6 @@ err = noErr; -#if defined(_MAC_MACHO) if (pszPartialOrFullPath[0] != '/') { char buff[MAXPATHLEN]; @@ -481,223 +280,12 @@ { strTemp = pszPartialOrFullPath; } -#else - strTemp = pszPartialOrFullPath; -#endif fullPathName = strTemp; return err; } -#endif // defined _CARBON - - -#pragma mark - -#pragma mark [Pre-Carbon routines] -#pragma mark - - -OSErr PathNameFromDirID(long dirID, short vRefNum, CHXString &fullPathName) -{ -#if defined(_MAC_UNIX) || defined(_CARBON) - FSRef fsref; - OSErr err; - - // get the FSRef for this directory - - err = FSMakeFSRef(vRefNum, dirID, NULL, &fsref); // MoreFilesX passes null for the name, so we can, too - if (err == noErr) - { - // get the path name from the FSRef - err = HFSPathFromFSRef(&fsref, fullPathName); - } - - return err; - -#else // !defined _CARBON - - DirInfo block; - Str63 directoryName; - OSErr err = noErr; - - fullPathName.Empty(); - - block.ioDrParID = dirID; - block.ioNamePtr = directoryName; - do { - block.ioVRefNum = vRefNum; - block.ioFDirIndex = -1; - block.ioDrDirID = block.ioDrParID; - - err = PBGetCatInfoSync ((CInfoPBPtr) &block); - if (noErr != err) return (err); - - directoryName[++directoryName[0]] = ':'; // append a colon - - if (noErr != err) return (err); - - fullPathName.InsertFromStr255(directoryName); - - } while (block.ioDrDirID != fsRtDirID); - - return (err); - -#endif // !defined _CARBON -} - -/* -PathNameFromWD - -*/ -OSErr PathNameFromWD(long vRefNum, CHXString &pathName) -{ - // Working Directories are obsolete under System 7 and later - // - // We shouldn't be calling this routine - - HX_ASSERT(FALSE); - return paramErr; -} - -/* -PathNameFromFSSpec -*/ -OSErr PathNameFromFSSpec (const FSSpec* fsSpec, CHXString &fullPathName) - -{ - OSErr err; - short leafNameLength; - - if (fsSpec->parID == fsRtParID) - { - // parID of 1 means the name is a volume name - // - // just add a colon to the end to make the path (like "Hard Disk:") - - fullPathName.SetFromStr255(fsSpec->name); - if (fullPathName.GetAt(fullPathName.GetLength() - 1) != ':') - { - fullPathName += ":"; - } - return noErr; - } - - // generate the path up to the parent directory - err = PathNameFromDirID (fsSpec->parID, fsSpec->vRefNum, fullPathName); - if (err) return err; - - // add the leaf item's name - leafNameLength = fsSpec->name[0]; - if (leafNameLength) - { - fullPathName.AppendFromStr255(fsSpec->name); - - // if the leaf item doesn't end in a colon, it might - // or might not be a directory. Let's check, and add a colon if - // necessary - - if (fsSpec->name[leafNameLength] != ':') - { - CInfoPBRec catInfo; - Str63 name; - - // copy the name to avoid changing the input parameters - BlockMoveData(fsSpec->name, name, 1 + leafNameLength); - - catInfo.hFileInfo.ioVRefNum = fsSpec->vRefNum; - catInfo.hFileInfo.ioDirID = fsSpec->parID; - catInfo.hFileInfo.ioNamePtr = name; - catInfo.hFileInfo.ioFDirIndex = 0; // use name and parID - - // we might get an error from PBGetCatInfo if the - // leaf item doesn't actually exist - err = PBGetCatInfoSync(&catInfo); - if (err == noErr - && (catInfo.hFileInfo.ioFlAttrib & ioDirMask) != 0) - { - // the leaf item is a directory - fullPathName += ":"; - } - } - } - - return noErr; -} - -// FSSpecFromPathName converts a full pathname (in a null-terminated -// string) to a Mac file spec. -// -// The fields of spec are set to zero if the conversion fails. -// This routine returns fnfErr if the conversion succeeded but -// the file doesn't (yet) exist. - -OSErr FSSpecFromPathName(const char *path, FSSpecPtr spec) -{ - // revised to remove 255 character limit length path names - - UInt32 len; - - OSErr err; - FSSpec fileSpec; - - fileSpec.vRefNum = 0; - fileSpec.parID = 0; - fileSpec.name[0] = 0; - - len = strlen(path); - - if (len == 0) - { - // empty path... leave the fileSpec invalid - err = nsvErr; - } - else if (len <= 255) - { - // path is under 256 characters, so let FSMakeFSSpec make the path for us - // - // Warning: passing zeros as vRefNum and dirID and a *partial* pathname - // is interpreted as being relative to the poorly-defined "current" directory. - // This conversion should really only be used for full paths, starting - // from the drive name. - - Str255 name; - - name[0] = len; - BlockMoveData(path, &name[1], len); - err = FSMakeFSSpec(0, 0, name, &fileSpec); - } - else { - - Boolean wasChanged; - Str32 nullString; - AliasHandle alias; - - // longer paths, let the alias manager make the file spec for us - // - // The alias manager expects a full pathname, so this won't - // work on partial paths longer than 255 characters. - - HX_ASSERT(path[0] != ':'); // be sure it's not a partial path - - nullString[0] = 0; // null string to indicate no zone or server name - err = NewAliasMinimalFromFullPath(len, path, nullString, nullString, &alias); - if (err == noErr) - { - // Let the Alias Manager resolve the alias. - err = ResolveAlias(NULL, alias, &fileSpec, &wasChanged); - - // ResolveAlias returns fnfErr if the target doesn't exist but - // the fileSpec is valid, just like FSMakeFSSpec does - - DisposeHandle((Handle) alias); // we don't really need the alias - } - } - - *spec = fileSpec; - - return err; -} - #ifdef __cplusplus } #endif Index: util/platform/mac/hurl.cpp =================================================================== RCS file: /cvsroot/common/util/platform/mac/hurl.cpp,v retrieving revision 1.7 diff -u -w -r1.7 hurl.cpp --- util/platform/mac/hurl.cpp 9 Jul 2004 18:23:03 -0000 1.7 +++ util/platform/mac/hurl.cpp 16 Dec 2008 04:09:14 -0000 @@ -59,20 +59,12 @@ #include "platform/mac/hurl.h" #include "hxwintyp.h" -#if defined(_CARBON) || defined(_MAC_UNIX) #include "platform/mac/mac_pref_cf.h" -#ifndef _MAC_UNIX - #include "filespecutils.h" - #include "MoreFilesX.h" -#endif static BOOL LaunchMacBrowserCarbon(const char* pURL, IHXPreferences* pPrefs, BOOL bBringToFront, BOOL bNewWindow); static BOOL GetPreferredBrowser(IHXPreferences* pPrefs, FSRef *outBrowserFSRef, OSType *outBrowserSignature); static void MakeHurlJavascriptURL(const char * pszURL, const char * pszWindowName, BOOL bSetPosition, const HXxPoint& ptWindowPos, const HXxSize& sizeWindow, CHXString& outStrURL, BOOL bUseNewJavascriptWindow); -#else - #include "mac_pref.h" -#endif // _CARBON // Stuff for using ODOCs instead of OpenURL for Unicode UTF-8 URLs because IE 5.2 and Netscape can't // deal with UTF8 in URLs; we'll send ODOCs instead of OpenURL events in those cases @@ -162,156 +154,7 @@ BOOL LaunchMacBrowserWithURLWindowParam(const char* pURL, IHXPreferences* pPrefs, BOOL bBringToFront, BOOL bNewWindow) { -#if defined(_CARBON) || defined(_MAC_UNIX) return LaunchMacBrowserCarbon(pURL, pPrefs, bBringToFront, bNewWindow); -#else - - OSErr theErr = noErr; - CPBusyCursor busyCursor; - - Size urlLen = ::strlen(pURL); - Boolean launched = FALSE; - - // Check to see if the default browser is running, otherwise launch it. - // Then send it an openURL event. - - OSType defaultBrowser = 'PNst'; - IHXBuffer* pBuffer = NULL; - - Boolean bICStarted = HXInternetConfigMac::StartUsingIC(); - - if (pPrefs) - { - if (HXR_OK == pPrefs->ReadPref("PreferredBrowser", pBuffer)) - { - const char* theBrowserFilePath = (const char*) pBuffer->GetBuffer(); - if (theBrowserFilePath) - { - FInfo applFinderInfo; - FSSpec spec; - if (noErr == FSSpecFromPathName(theBrowserFilePath, &spec)) - { - if (noErr == FSpGetFInfo(&spec, &applFinderInfo)) - { - defaultBrowser = applFinderInfo.fdCreator; - } - } - } - pBuffer->Release(); - } - } - /* get Preferred Browser from InternetConfig unless either - InternetConfig isn't linked in, System 8.1, OR - Preferences dictate a specific browser. */ - if (defaultBrowser == 'PNst') - { - if (ICStart) // not linked with IC for some reason - pre Sys 8.1? - { - unsigned char *kDontCareBrowserName = NULL; - - OSStatus err = HXInternetConfigMac::GetHTTPHelper(&defaultBrowser, kDontCareBrowserName); - } - else - { - defaultBrowser = NETSCAPE_CREATOR; - } - } - - OSType openBrowser = 0; - FSSpec cachedDefaultBrowserSpec; - { - - // check if any browser is already running - if (CheckForApplicationRunning(NETSCAPE_CREATOR)) - openBrowser = NETSCAPE_CREATOR; - else if (CheckForApplicationRunning(MSIE_CREATOR)) - openBrowser = MSIE_CREATOR; - else if (CheckForApplicationRunning(AOL_CREATOR)) - openBrowser = AOL_CREATOR; - - if (!openBrowser) - { - short volindex=1; - short vRefNum=0; - - // Look through all volumes for the default browser application. - while (GetVRefnumFromIndex(volindex,&vRefNum)) - { - short fileindex=0; - while (noErr==HX_FSpGetAppSpecFromDesktop(defaultBrowser,fileindex, - vRefNum,&cachedDefaultBrowserSpec)) - { - FInfo finfo; - FSpGetFInfo(&cachedDefaultBrowserSpec,&finfo); - if (finfo.fdType=='APPL') - { - AppleEvent theEvent; - - //do this at idle time! don't want to launch app at interrupt time - if (MakeOpenURLEvent(defaultBrowser, pURL, &theEvent, bNewWindow)) - { - ProcessSerialNumber* kDontCareAboutPSN = NULL; - short launchFlags; - - if (bBringToFront) - { - launchFlags = (launchContinue | launchNoFileFlags); - } - else - { - launchFlags = (launchContinue | launchNoFileFlags | launchDontSwitch); - } - theErr = FSpLaunchApplicationWithParamsAndFlags(&cachedDefaultBrowserSpec, &theEvent, - kDontCareAboutPSN, launchFlags); - if (theErr == noErr) - { - launched = TRUE; - } - - (void) AEDisposeDesc(&theEvent); - } - - }//if - else - { - fileindex++; - continue; - }//else - break; - }//while - - if (launched) break; - volindex++; - }//while - }//if - - if( !launched && openBrowser) - { - const BOOL bAsync = TRUE; - launched = SendOpenURLOrdered(openBrowser,pURL, bAsync, bBringToFront, bNewWindow); - } - - - if ( bICStarted && !launched ) - { - theErr = HXInternetConfigMac::LaunchURL(pURL); - - launched = (theErr == noErr); - - } - goto CleanUp; - }//if - -CleanUp: - if (bICStarted) - { - HXInternetConfigMac::StopUsingIC(); - } - - return (launched); - -#endif // !defined _CARBON - } BOOL SendOpenURL(OSType appSignature, const char* pURL, BOOL async) @@ -420,7 +263,7 @@ long window = bNewWindow ? kNewWindow : kSameWindow; - err = AEPutParamPtr(theAppleEventPtr, kOpenUrlWindowID, typeLongInteger, &window, sizeof(window)); + err = AEPutParamPtr(theAppleEventPtr, kOpenUrlWindowID, typeSInt32, &window, sizeof(window)); require_noerr(err, CouldntPutWindow); (void) AEDisposeDesc(&target); @@ -491,314 +334,20 @@ #endif } -#if defined(_CARBON) || defined(_MAC_UNIX) BOOL GetPreferredOrSystemBrowser(IHXPreferences* pPrefs, FSRef *outBrowserFSRef, OSType *outBrowserSignature) { -#ifdef _MAC_UNIX HX_ASSERT("GetPreferredOrSystemBrowser unimplemented" == NULL); -#else - FSRef browserFSRef; - OSType defaultBrowserSignature; - BOOL bSuccess; - - ZeroInit(&browserFSRef); - - bSuccess = GetPreferredBrowser(pPrefs, &browserFSRef, &defaultBrowserSignature); - if (!bSuccess) - { - // there isn't a preferred browser in prefs; get one from InternetConfig, or else look - // for any of our known browsers - - unsigned char *kDontCareBrowserName = NULL; - OSErr err; - - err = HXInternetConfigMac::GetHTTPHelper(&defaultBrowserSignature, kDontCareBrowserName); - if (err == noErr) - { - err = GetApplicationFSRefFromSignature(defaultBrowserSignature, &browserFSRef); - } - - if (err != noErr) - { - defaultBrowserSignature = NETSCAPE_CREATOR; - - for (int idx = 0; BrowserCreators[idx] != 0; idx++) - { - if (noErr == GetApplicationFSRefFromSignature(BrowserCreators[idx], &browserFSRef)) - { - defaultBrowserSignature = BrowserCreators[idx]; - break; - } - } - } - if (err == noErr) - { - bSuccess = TRUE; - } - } - - if (outBrowserSignature) *outBrowserSignature = defaultBrowserSignature; - if (outBrowserFSRef) *outBrowserFSRef = browserFSRef; - - return bSuccess; -#endif } BOOL GetPreferredBrowser(IHXPreferences* pPrefs, FSRef *outBrowserFSRef, OSType *outBrowserSignature) { -#ifdef _MAC_UNIX HX_ASSERT("GetPreferredBrowser unimplemented" == NULL); -#else - HX_RESULT res; - OSStatus err; - const char* theBrowserPref; - FinderInfo fileInfo; - IHXBuffer* pBuffer = NULL; - - check(outBrowserFSRef != NULL && outBrowserSignature != NULL); - - require_nonnull_quiet(pPrefs, NoPrefsAvailable); - - res = pPrefs->ReadPref("PreferredBrowser", pBuffer); - require_quiet(SUCCEEDED(res), CantGetPreferredBrowser); - - theBrowserPref = (const char*) pBuffer->GetBuffer(); - require_nonnull(theBrowserPref, CantGetPrefFromBuffer); - - require_quiet(strlen(theBrowserPref) > 1, NoBrowserSet); - - if (strlen(theBrowserPref) == 4) - { - // the pref is an OSType - *outBrowserSignature = *(OSType *) theBrowserPref; - - err = GetApplicationFSRefFromSignature(*outBrowserSignature, outBrowserFSRef); - require_noerr_quiet(err, CantGetBrowserFSRef); - } - else - { - // the pref is a persistent file spec or a path - CHXFileSpecifier browserSpec; - - (void) browserSpec.SetFromPersistentString(theBrowserPref); - require(browserSpec.IsSet(), CantMakeBrowserSpec); - - *outBrowserFSRef = (FSRef) browserSpec; - - err = FSGetFinderInfo(outBrowserFSRef, &fileInfo, NULL, NULL); - require_noerr_quiet(err, CantGetBrowserType); - - *outBrowserSignature = fileInfo.file.fileCreator; - } - - HX_RELEASE(pBuffer); - return TRUE; - -CantGetBrowserType: -CantGetAppRef: -CantMakeBrowserSpec: -CantGetBrowserFSRef: -NoBrowserSet: -CantGetPrefFromBuffer: - HX_RELEASE(pBuffer); -CantGetPreferredBrowser: -NoPrefsAvailable: - return FALSE; -#endif } static BOOL LaunchMacBrowserCarbon(const char* pURL, IHXPreferences* pPrefs, BOOL bBringToFront, BOOL bNewWindow) { -#ifdef _MAC_UNIX HX_ASSERT("LaunchMacBrowserCarbon unimplemented" == NULL); -#else - FSRef browserFSRef; - //BOOL bSuccess; - OSType defaultBrowserSignature; - OSType openBrowserSignature; - OSStatus err; - BOOL bLaunched; - int idx; - - bLaunched = FALSE; - - // get the preferred browser from prefs, if it's available; otherwise, find some other browser - // to default to - - defaultBrowserSignature = 0; - ZeroInit(&browserFSRef); - - GetPreferredOrSystemBrowser(pPrefs, &browserFSRef, &defaultBrowserSignature); - - // see if the preferred browser, or any other, is running - openBrowserSignature = 0; - if (CheckForApplicationRunning(defaultBrowserSignature)) - { - openBrowserSignature = defaultBrowserSignature; - } - else - { - for (idx = 0; BrowserCreators[idx] != 0; idx++) - { - if (CheckForApplicationRunning(BrowserCreators[idx])) - { - openBrowserSignature = BrowserCreators[idx]; - break; - } - } - } - - // CZ 10/29/02 - if a browser is running and the current app is that browser - // then we must be running the embedded player - // in this case don't force the browser to come to the front - // ie. a hurl from the embedded player shouldn't bring the browser to the front - - if (GetCurrentAppSignature() == openBrowserSignature) - { - bBringToFront = FALSE; - } - - - // GR 10/1/02 Nasty hack: Netscape 6 and 7 can't deal with URLs in standard OS X format, so - // for that browser and for local URLs only, we'll make a bogus old-style file:/// URL - // by taking a full path and replacing colons with slashes - - CHXString strNetscapeLocalURL; - if (openBrowserSignature == 'MOSS' || (openBrowserSignature == 0 && defaultBrowserSignature == 'MOSS')) - { - CHXFileSpecifier fileSpec; - - fileSpec.SetFromURL(pURL); - if (fileSpec.IsSet()) - { - CHXString strPathMunge = fileSpec.GetPathName(); - for (int idx = 0; idx < strPathMunge.GetLength(); idx++) - { - if (strPathMunge[idx] == ':') strPathMunge.SetAt(idx, '/'); - else if (strPathMunge[idx] == '/') strPathMunge.SetAt(idx, ':'); - } - strPathMunge.FindAndReplace(" ", "%20", TRUE); - - strNetscapeLocalURL = "file:///"; - strNetscapeLocalURL += strPathMunge; - pURL = (const char *) strNetscapeLocalURL; - } - } - - // try to send the URL via an Apple event to an open browser - if (openBrowserSignature) - { - const BOOL bAsync = TRUE; - - bLaunched = SendOpenURLOrdered(openBrowserSignature, pURL, bAsync, bBringToFront, bNewWindow); - } - - // if necessary, launch a browser - if (!bLaunched) - { - if (IsRunningNativeOnMacOSX()) - { - CHXFileSpecifier tempSpec; - - if (IsLocalFileURLAPotentialProblemBecauseOfPercentEncodedUTF8Chars(pURL)) - { - // we handle the UTF8 problem only with local files; avoid the problem - // by opening file document directly instead of using a temp file - tempSpec.SetFromURL(pURL); - } - else - { - // Is OS X we can't pass an Apple event with the launch (can we?), so we'll make a document to - // open which redirects to the real page - - // make a temp file with the redirect to the real URL; we do this for network URLs - // or for local URLs that don't have UTF-8 - - CHXDirSpecifier tempDirSpec; - CHXString strRedirect; - const BOOL kReplaceExistingTempFile = TRUE; - - strRedirect = "<HEAD>\n<META HTTP-EQUIV=\"refresh\" CONTENT=\"0;URL="; - strRedirect += pURL; - strRedirect += "\">\n</HEAD>\n"; - - // make a file spec for a temp file, create the file and open it, - // and write the redirect into the file - - tempDirSpec = CHXFileSpecUtils::MacFindFolder(kOnAppropriateDisk, kChewableItemsFolderType); - tempSpec = CHXFileSpecUtils::GetUniqueTempFileSpec(tempDirSpec, "HX_hurl_%.html", "%"); - check(tempSpec.IsSet()); - - err = CHXFileSpecUtils::WriteTextFile(tempSpec, strRedirect, kReplaceExistingTempFile); - check_noerr(err); - } - - // launch the browser with that temp file - - if (err == noErr) - { - LSLaunchFSRefSpec launchSpec; - - ZeroInit(&launchSpec); - launchSpec.appRef = &browserFSRef; - launchSpec.numDocs = 1; - launchSpec.itemRefs = (FSRef *) tempSpec; - launchSpec.launchFlags = kLSLaunchDefaults | (bBringToFront ? 0 : kLSLaunchDontSwitch); - - err = LSOpenFromRefSpec(&launchSpec, NULL); // NULL -> don't care about FSRef of launched app - } - if (err == noErr) - { - bLaunched = TRUE; - } - - } - else - { - // OS 9 launch - AppleEvent theEvent; - if (MakeOpenURLEvent(defaultBrowserSignature, pURL, &theEvent, bNewWindow)) - { - ProcessSerialNumber* kDontCareAboutPSN = NULL; - short launchFlags; - FSSpec appSpec; - - launchFlags = (launchContinue | launchNoFileFlags); - if (!bBringToFront) - { - launchFlags |= launchDontSwitch; - } - - err = FindApplicationBySignature(defaultBrowserSignature, &appSpec); - - if (err == noErr) - { - err = FSpLaunchApplicationWithParamsAndFlags(&appSpec, &theEvent, - kDontCareAboutPSN, launchFlags); - } - if (err == noErr) - { - bLaunched = TRUE; - } - - (void) AEDisposeDesc(&theEvent); - } - } - } - - // last ditch effort is to rely on InternetConfig - if (!bLaunched) - { - err = HXInternetConfigMac::LaunchURL(pURL); - if (err == noErr) - { - bLaunched = TRUE; - } - } - - return bLaunched; -#endif } Boolean IsLocalFileURLAPotentialProblemBecauseOfPercentEncodedUTF8Chars(const char *pURL) @@ -924,6 +473,3 @@ outStrURL = strScript; } - -#endif // _CARBON - Index: util/platform/mac/hx_moreprocesses.c =================================================================== RCS file: /cvsroot/common/util/platform/mac/hx_moreprocesses.c,v retrieving revision 1.6 diff -u -w -r1.6 hx_moreprocesses.c --- util/platform/mac/hx_moreprocesses.c 9 Jul 2004 18:23:03 -0000 1.6 +++ util/platform/mac/hx_moreprocesses.c 16 Dec 2008 04:09:14 -0000 @@ -49,48 +49,8 @@ #include "platform/mac/HX_MoreProcesses.h" -#if defined(_CARBON) || defined(_MAC_UNIX) -#include "platform/mac/MoreFilesX.h" -#endif - -#ifndef _MAC_UNIX -#include "hxmm.h" -#endif - -#ifndef _MAC_UNIX /* this is defined always true for _MAC_UNIX builds */ -Boolean IsRunningNativeOnMacOSX() -{ -#ifdef _CARBON - - long sysVersion; - OSErr err; - - static int zIsNative = 0; - - if (zIsNative == 1) return true; - if (zIsNative == -1) return false; - - - err = Gestalt(gestaltSystemVersion, &sysVersion); - check_noerr(err); - - if (err == noErr && sysVersion >= 0x1000) - { - zIsNative = 1; - return true; - } - else - { - zIsNative = -1; - return false; - } - -#else - return false; -#endif -} -#endif +#include "platform/mac/MoreFilesX.h" Boolean IsMacInCooperativeThread() { @@ -130,7 +90,12 @@ Boolean SameFSSpec(FSSpecPtr sa, FSSpecPtr sb) { - + if (noErr == FSCompareFSRefs(sa, sb)) + { + return true; + } + return false; + /* if (sa->vRefNum==sb->vRefNum) { if (sa->parID==sb->parID) @@ -142,6 +107,7 @@ } } return false; + */ } @@ -208,93 +174,6 @@ } -Boolean CheckForApplicationRunningFSSpec(OSType AppSignature,FSSpec *spec) { - - return GetApplicationSpec(AppSignature, spec); - -} - -// -// GetPSNSpec -// -// Returns the FSSpec for the related PSN. -// -Boolean GetPSNSpec(ProcessSerialNumber* psn,FSSpec* theSpec) -{ - Boolean theResult= false; - ProcessInfoRec info; - OSErr e=noErr; - - - info.processInfoLength = sizeof (info); - info.processName = nil; - info.processAppSpec = theSpec; - - e=GetProcessInformation (psn, &info); - - theResult = e ? false : true; - - return theResult; -} - - -// -// GetApplicationSpec -// -// Looks through all the processes for one matching the signature passed in the "AppSignature" -// Then returns the Application's FSSpec. -// -Boolean GetApplicationSpec(OSType AppSignature, FSSpec *theSpec) -{ - - OSErr e = noErr; - ProcessSerialNumber psn = {kNoProcess, kNoProcess}; - Boolean theResult=false; - - while (noErr == (e = GetNextProcess (&psn))) { - ProcessInfoRec info; - - info.processInfoLength = sizeof (info); - info.processName = nil; - info.processAppSpec = theSpec; - if (noErr != (e = GetProcessInformation (&psn, &info))) break; - - if (AppSignature != info.processSignature) continue; - theResult=true; - break; - } /* while */ - - return (theResult); -} - - -// -// GetCurrentAppSpec -// -// Returns the FSSpec for the currently running application. -// - -Boolean GetCurrentAppSpec(FSSpec *theSpec) -{ - - OSErr err; - ProcessSerialNumber psn; - ProcessInfoRec pir; - - if (theSpec == NULL) return false; - - psn.highLongOfPSN = 0; - psn.lowLongOfPSN = kCurrentProcess; - - pir.processInfoLength = sizeof(ProcessInfoRec); - pir.processName = nil; - pir.processAppSpec = theSpec; - err = GetProcessInformation (&psn, &pir); - - return (err == noErr); -} - - // // GetCurrentAppSignature // @@ -303,7 +182,6 @@ OSType GetCurrentAppSignature(void) { - OSErr err; ProcessSerialNumber psn; ProcessInfoRec pir; @@ -311,9 +189,8 @@ psn.highLongOfPSN = 0; psn.lowLongOfPSN = kCurrentProcess; + bzero(&pir, sizeof(pir)); pir.processInfoLength = sizeof(ProcessInfoRec); - pir.processName = nil; - pir.processAppSpec = nil; err = GetProcessInformation (&psn, &pir); if (err == noErr) return pir.processSignature; @@ -338,17 +215,20 @@ currPSN.lowLongOfPSN = kNoProcess; currPSN.highLongOfPSN = 0; - do { + do + { err = GetNextProcess(&currPSN); if (err == noErr) { - currPIR.processName = NULL; - currPIR.processAppSpec = NULL; + bzero(&currPIR, sizeof(currPIR)); currPIR.processInfoLength = sizeof(ProcessInfoRec); err = GetProcessInformation(&currPSN, &currPIR); if (err == noErr && currPIR.processSignature == signature) { - if (psn) *psn = currPSN; + if (psn) + { + *psn = currPSN; + } break; } } @@ -375,15 +255,15 @@ currPSN.lowLongOfPSN = kNoProcess; currPSN.highLongOfPSN = 0; - do { + do + { err = GetNextProcess(&currPSN); if (err == noErr) { if (SameProcess(&currPSN, psn, &bSamePSN) == noErr && bSamePSN) { - currPIR.processName = NULL; - currPIR.processAppSpec = NULL; + bzero(&currPIR, sizeof(currPIR)); currPIR.processInfoLength = sizeof(ProcessInfoRec); err = GetProcessInformation(&currPSN, &currPIR); if (err == noErr) @@ -395,8 +275,6 @@ } break; } - - } } while (err == noErr); @@ -410,43 +288,47 @@ // // Looks through all the processes and returns a count of the processes with AppSignature. // -short CountAppSignatures(OSType AppSignature) { - +short CountAppSignatures(OSType AppSignature) +{ OSErr e = noErr; ProcessSerialNumber psn = {kNoProcess, kNoProcess}; short theResult=0; - while (noErr == (e = GetNextProcess (&psn))) { + while (noErr == (e = GetNextProcess (&psn))) + { ProcessInfoRec info; + bzero(&info, sizeof(info)); info.processInfoLength = sizeof (info); - info.processName = nil; - info.processAppSpec = nil; - if (noErr != (e = GetProcessInformation (&psn, &info))) break; + if (noErr != (e = GetProcessInformation (&psn, &info))) + { + break; + } - if (AppSignature != info.processSignature) continue; + if (AppSignature != info.processSignature) + { + continue; + } theResult++; - - } /* while */ + } return (theResult); - } // // ActivateApplication // -void ActivateApplication(OSType AppSignature) { - +void ActivateApplication(OSType AppSignature) +{ OSErr e = noErr; ProcessSerialNumber psn = {kNoProcess, kNoProcess}; - while (noErr == (e = GetNextProcess (&psn))) { + while (noErr == (e = GetNextProcess (&psn))) + { ProcessInfoRec info; + bzero(&info, sizeof(info)); info.processInfoLength = sizeof (info); - info.processName = nil; - info.processAppSpec = nil; if (noErr != (e = GetProcessInformation (&psn, &info))) break; if (AppSignature != info.processSignature) continue; @@ -454,199 +336,19 @@ ActivateApplicationPSN(&psn); break; - } /* while */ + } } // // ActivateApplicationPSN // -void ActivateApplicationPSN(ProcessSerialNumber *psn) { - +void ActivateApplicationPSN(ProcessSerialNumber* psn) +{ if (psn == 0L) return; SetFrontProcess(psn); - -} - - -// -// FSpLaunchApplication launches a Mac application given a file spec -// - -OSErr FSpLaunchApplication (FSSpec *appSpec) { - - return FSpLaunchApplicationWithParams(appSpec, NULL, NULL); -} - -// -// FSpLaunchApplication launches a Mac application given a file spec -// and an option Apple Event to include as a launch parameter -// -// If psn is non-nil, the launched processes' PSN is returned -// - -OSErr FSpLaunchApplicationWithParams(FSSpec *appSpec, const AppleEvent *theEvent, ProcessSerialNumber *psn) -{ - return FSpLaunchApplicationWithParamsAndFlags(appSpec, theEvent, psn, (launchContinue | launchNoFileFlags)); -} - -OSErr FSpLaunchApplicationWithParamsAndFlags(FSSpec *appSpec, const AppleEvent *theEvent, ProcessSerialNumber *psn, short launchFlags) -{ - OSErr err = noErr; - LaunchParamBlockRec launchPB; - AEDesc paramsDesc; - - paramsDesc.dataHandle = NULL; - - launchPB.launchBlockID = extendedBlock; - launchPB.launchEPBLength = extendedBlockLen; - launchPB.launchFileFlags = 0; - launchPB.launchControlFlags = launchFlags; - launchPB.launchAppSpec = appSpec; - launchPB.launchAppParameters = NULL; - - // if we were passed an event, convert and attach that to the launch param block - if (theEvent) - { - err = AECoerceDesc(theEvent, typeAppParameters, ¶msDesc); - if (err == noErr) - { -#if !defined(_CARBON) && !defined(_MAC_UNIX) - HLock(paramsDesc.dataHandle); -#endif - launchPB.launchAppParameters = (AppParametersPtr) *paramsDesc.dataHandle; - } - } - - // do the launch - if (err == noErr) - { - err = LaunchApplication(&launchPB); - if (err == noErr && psn != NULL) - { - *psn = launchPB.launchProcessSN; - } } - // if we had an event to convert and attach, dispose our converted version - if (paramsDesc.dataHandle) (void) AEDisposeDesc(¶msDesc); - - return err; -} - - -OSErr FSpLaunchApplicationPSN (FSSpec *appSpec,ProcessSerialNumber* psn) { - - return FSpLaunchApplicationWithParams(appSpec, NULL, psn); - -} - - - -// -// OpenDocumentWithApplication sends an event to the target application -// to open the document, launching the application if necessary. -// -// Unlike sending an Apple event to the finder, this gives us an -// error if the open doesn't happen -// - -OSErr OpenDocumentWithApplication(OSType signature, FSSpec *file) -{ - OSErr err; - ProcessSerialNumber appPSN; - FSSpec appSpec; - AEDesc targetAddrDesc; - AppleEvent theAppleEvent, theReplyEvent; - AliasHandle fileAlias; - - theAppleEvent.dataHandle = NULL; // to facilitate cleanup - targetAddrDesc.dataHandle = NULL; - appPSN.lowLongOfPSN = 0; - fileAlias = NULL; - - err = GetPSNFromSignature(signature, &appPSN); - if (err != noErr) - { - - // app isn't running, we'll try to launch it - // - // address the event target by the process's signature - - err = AECreateDesc(typeApplSignature, &signature, sizeof(DescType), &targetAddrDesc); - } - else - { - // address target by PSN - err = AECreateDesc(typeProcessSerialNumber, &appPSN, sizeof(ProcessSerialNumber), &targetAddrDesc); - } - - if (err == noErr) - { - // make the Apple event, stuff in an alias to the file as the direct object - err = AECreateAppleEvent(kCoreEventClass, kAEOpenDocuments, &targetAddrDesc, - kAutoGenerateReturnID, kAnyTransactionID, &theAppleEvent); - if (err == noErr) - { - err = NewAliasMinimal(file, &fileAlias); - if (err == noErr) - { - HLock((Handle) fileAlias); - err = AEPutParamPtr(&theAppleEvent, keyDirectObject, typeAlias, - *fileAlias, GetHandleSize((Handle) fileAlias)); - } - } - } - - if (err == noErr) - { - if (appPSN.lowLongOfPSN) - { - // app is running and we know its PSN, so - // send the event directly to it - err = AESend(&theAppleEvent, &theReplyEvent, kAENoReply, - kAENormalPriority, kAEDefaultTimeout, NULL, NULL); - - (void) SetFrontProcess(&appPSN); - } - else - { - // the app isn't running, so launch it with the - // event attached - err = FindApplicationBySignature(signature, &appSpec); - if (err == noErr) - { - err = FSpLaunchApplicationWithParams(&appSpec, &theAppleEvent, NULL); - } - } - } - - if (fileAlias) DisposeHandle((Handle) fileAlias); - if (theAppleEvent.dataHandle) (void) AEDisposeDesc(&theAppleEvent); - if (targetAddrDesc.dataHandle) (void) AEDisposeDesc(&targetAddrDesc); - - return err; -} - -// -// LaunchApplicationBySignature finds an application on a local -// volume and launches it. theEvent can be null if no Apple -// event should be attached. -// - -OSErr LaunchApplicationBySignature(OSType signature, AppleEvent *theEvent) -{ - OSErr err; - FSSpec appSpec; - - err = FindApplicationBySignature(signature, &appSpec); - if (err == noErr) - { - err = FSpLaunchApplicationWithParams(&appSpec, theEvent, NULL); - } - - return err; -} // // FindApplicationBySignature finds an application on a local (not server) @@ -658,21 +360,8 @@ OSErr FindApplicationBySignature(OSType signature, FSSpec *appSpec) { -#ifndef _MAC_UNIX - Str63 name; - short volIndex; - short vRefNum; - HParamBlockRec hpb; - DTPBRec dtpb; - GetVolParmsInfoBuffer gvpb; - Boolean foundAppFlag; - Boolean giveUpFlag; -#endif OSErr err; -#if defined(_CARBON) || defined(_MAC_UNIX) - if (IsRunningNativeOnMacOSX()) - { // Mac OS X; we can't rely on the desktop database, so use launch services FSRef appRef; @@ -683,94 +372,6 @@ } return err; } -#endif - -#if defined(_MAC_UNIX) - return -1; // should never get here -#else - foundAppFlag = false; - giveUpFlag = false; - - - // step through each volume available - volIndex = 1; - - do { - name[0] = 0; - hpb.volumeParam.ioNamePtr = name; - hpb.volumeParam.ioVolIndex = volIndex; - hpb.volumeParam.ioVRefNum = 0; - hpb.volumeParam.ioCompletion = NULL; // shouldn't matter since we're calling sync - - err = PBHGetVInfoSync(&hpb); - if (err == noErr) - { - - vRefNum = hpb.volumeParam.ioVRefNum; - - // check only local volumes for the application - // - // PBHGetVolParms returns vMServerAdr of zero for local volumes - // - // name and vRefNum are already set in param block hpb from the PBHGetVInfo call - - hpb.ioParam.ioBuffer = (char *) &gvpb; - hpb.ioParam.ioReqCount = sizeof(GetVolParmsInfoBuffer); - - err = PBHGetVolParmsSync(&hpb); - if (err == noErr && gvpb.vMServerAdr == 0) - { - // now we know this is a valid, local volume; - // see if it has a desktop database - dtpb.ioNamePtr = NULL; - dtpb.ioVRefNum = vRefNum; - - err = PBDTGetPath(&dtpb); - if (err == noErr) - { - // this volume has a desktop database; search it - name[0] = 0; - dtpb.ioNamePtr = name; - dtpb.ioIndex = 0; // get newest application - dtpb.ioFileCreator = signature; - dtpb.ioCompletion = NULL; // shouldn't matter since we're calling sync - // dtpb.ioDTRefNum set by GetPath call - - err = PBDTGetAPPLSync(&dtpb); - if (err == noErr) - { - FSSpec foundSpec; - - err = FSMakeFSSpec(vRefNum, dtpb.ioAPPLParID, name, &foundSpec); - - if (err == noErr) - { - if (appSpec) *appSpec = foundSpec; - - // we got the app; bail - foundAppFlag = true; - } - } - } - } - - - } - else - { - // PBHGetVInfoSync returned an error - giveUpFlag = true; - } - volIndex++; - - } while (!giveUpFlag &&!foundAppFlag); - - // at this point, we should have noErr indicating that we found - // an app and the FSSpec is valid - - return err; -#endif // !defined _MAC_UNIX -} OSErr SendQuitEventToApplication(ProcessSerialNumber *psn) @@ -801,7 +402,6 @@ return err; } -#if defined(_CARBON) || defined(_MAC_UNIX) OSStatus GetApplicationFSRefFromSignature(OSType signature, FSRef *outAppFSRef) { OSStatus err; @@ -810,21 +410,8 @@ const CFStringRef kAnyExtension = NULL; CFURLRef* kDontWantURL = NULL; - if (IsRunningNativeOnMacOSX()) - { err = LSGetApplicationForInfo(kAnyFileType, signature, kAnyExtension, kLSRolesAll, outAppFSRef, kDontWantURL); - } - else - { - FSSpec appSpec; - err = FindApplicationBySignature(signature, &appSpec); - if (err == noErr) - { - err = FSpMakeFSRef(&appSpec, outAppFSRef); - } - } - return err; } -#endif + Index: util/platform/mac/hxinternetconfigutils.cpp =================================================================== RCS file: /cvsroot/common/util/platform/mac/hxinternetconfigutils.cpp,v retrieving revision 1.5 diff -u -w -r1.5 hxinternetconfigutils.cpp --- util/platform/mac/hxinternetconfigutils.cpp 9 Jul 2004 18:23:03 -0000 1.5 +++ util/platform/mac/hxinternetconfigutils.cpp 16 Dec 2008 04:09:14 -0000 @@ -56,18 +56,12 @@ #endif #include "hxstrutl.h" -#ifndef _CARBON #define ICAttr long -#endif ICInstance HXInternetConfigMac::m_icInstance = NULL; UInt32 HXInternetConfigMac::m_refcount = 0; -#ifdef _CARBON - const ICAttr kNoAttrChange = kICAttrNoChange; -#else const ICAttr kNoAttrChange = ICattr_no_change; -#endif static void ConcatPString(StringPtr mainStr, ConstStr255Param suffix) { @@ -129,9 +123,7 @@ status = ICStart(&m_icInstance, GetCurrentAppSignature()); if (status == noErr) { -#ifndef _CARBON status = ICFindConfigFile(m_icInstance, 0, NULL); -#endif } else { @@ -246,11 +238,7 @@ status = ICMapFilename(m_icInstance, fileName, &mapEntry); if (status == noErr) { -#ifdef _CARBON - result = mapEntry.fileType; -#else result = mapEntry.file_type; -#endif } StopUsingIC(); @@ -273,11 +261,7 @@ status = ICMapFilename(m_icInstance, fileName, &mapEntry); if (status == noErr) { -#ifdef _CARBON - result = mapEntry.fileCreator; -#else result = mapEntry.file_creator; -#endif } StopUsingIC(); @@ -647,193 +631,13 @@ OSErr HXInternetConfigMac::GetICMapEntryMatchingTemplate(UInt32 searchFromIndex, const ICMapEntry& templateICMapEntry, ICMapEntry& outICMapEntry, UInt32& outICMapEntryIndex, SInt32& outEntryPos) { -#ifndef _CARBON - HX_ASSERT(!"HXInternetConfigMac::GetIndexedICMapMatchingTemplate not implemented pre-Carbon"); - return 0; -#else - OSStatus status = icInternalErr; - ICAttr mapAttr; - Handle mapHandle = NULL; - long numEntries; - UInt32 idx; - long entryPos; - ICMapEntry currEntry; - OSErr returnResult = -1; - - check(templateICMapEntry.fileType || templateICMapEntry.fileCreator || templateICMapEntry.postCreator - || templateICMapEntry.MIMEType[0] || templateICMapEntry.extension[0]); - - if (!StartUsingIC()) goto Bail; - - mapHandle = ::NewHandle(0); - if (mapHandle == NULL) goto Bail; - - status = ICFindPrefHandle(m_icInstance, kICMapping, &mapAttr, mapHandle); - if (status != noErr) goto Bail; - - numEntries = 0; - status = ICCountMapEntries(m_icInstance, mapHandle, &numEntries); - - // check(searchFromIndex < numEntries); this commonly happens when searching for all matching entries - - // retrieve each entry, see if the file_creator or post_creator field points to out app, and if so - // be sure the bit is set to open the app after downloading - - if (status == noErr) - { - status = icPrefNotFoundErr; - for (idx = 1 + searchFromIndex; idx <= numEntries; ++idx) - { - status = ICGetIndMapEntry(m_icInstance, mapHandle, idx, &entryPos, &currEntry); - - if (status == noErr) - { - const Boolean kCaseSensitive = true; - const Boolean kDiacriticSensitive = true; - - Boolean bMatches = true; - - // check if it matches the template entry in any non-empty, important fields - if ((templateICMapEntry.fileType != 0 && templateICMapEntry.fileType != currEntry.fileType) - || (templateICMapEntry.fileCreator != 0 && templateICMapEntry.fileCreator != currEntry.fileCreator) - || (templateICMapEntry.postCreator != 0 && templateICMapEntry.postCreator != currEntry.postCreator) - || (templateICMapEntry.MIMEType[0] != 0 - && !EqualString(templateICMapEntry.MIMEType, currEntry.MIMEType, kCaseSensitive, kDiacriticSensitive)) - || (templateICMapEntry.extension[0] != 0 - && !PStringInString(templateICMapEntry.extension, currEntry.extension))) - { - bMatches = false; - } - - if (bMatches) - { - outICMapEntry = currEntry; - outICMapEntryIndex = idx; - outEntryPos = entryPos; - returnResult = noErr; - break; - } - } - } - } - - -Bail: - if (mapHandle) DisposeHandle(mapHandle); - - StopUsingIC(); - - return returnResult; -#endif + HX_ASSERT(!"HXInternetConfigMac::GetIndexedICMapMatchingTemplate not implemented"); } OSErr HXInternetConfigMac::SetICMapEntry(const ICMapEntry * theICMapEntry, SInt32 entryPos, const void* pAppData, Size appDataSize) { -#ifndef _CARBON - HX_ASSERT(!"HXInternetConfigMac::SetExistingICMap for Mac OS X only"); + HX_ASSERT(!"HXInternetConfigMac::SetExistingICMap not implemented"); return 0; -#else - // entryPos of -1 means add new entry rather than replace one at a given position - // ICMapEntry of NULL means just delete the old entry - - OSStatus status = icInternalErr; - ICAttr mapAttr; - Handle mapHandle = NULL; - Boolean icStarted = FALSE; - - if (theICMapEntry) - { - check(theICMapEntry->fixedLength != 0); - check(theICMapEntry->fixedLength <= theICMapEntry->totalLength); - check(theICMapEntry->totalLength == sizeof(ICMapEntry)); - } - - icStarted = StartUsingIC(); - require(icStarted, Bail); - - mapHandle = ::NewHandle(0); - require_nonnull(mapHandle, Bail); - - status = ICFindPrefHandle(m_icInstance, kICMapping, &mapAttr, mapHandle); - require_noerr(status, Bail); - - if (pAppData && entryPos != -1) - { - // since we want to replace old app data as well as the entry, we need - // to completely delete the old entry (which also deletes the data), - // add the new one, find the position of the new one, and add the user data to that - - status = ICDeleteMapEntry(m_icInstance, mapHandle, entryPos); - require_noerr(status, Bail); - - entryPos = -1; - } - - // if entryPos is -1, add a new entry; if theICMapEntry is NULL, delete - // the entry at entryPos; otherwise, replace the entry at entryPos - - - if (entryPos != -1 && theICMapEntry != NULL) - { - status = ICSetMapEntry(m_icInstance, mapHandle, entryPos, theICMapEntry); - require_noerr(status, Bail); - } - else if (theICMapEntry != NULL) - { - status = ICAddMapEntry(m_icInstance, mapHandle, theICMapEntry); - require_noerr(status, Bail); - } - else - { - status = ICDeleteMapEntry(m_icInstance, mapHandle, entryPos); - require_noerr(status, Bail); - } - - if (pAppData) - { - check_nonnull(theICMapEntry); - - // add is documented to put the new ICMapEntry at the end of the handle - // - // first, find the entryPos of the last entry in the handle - - long numEntries; - ICMapEntry tempEntry; - SInt32 mungeRes; - - status = ICCountMapEntries(m_icInstance, mapHandle, &numEntries); - require_noerr(status, Bail); - - status = ICGetIndMapEntry(m_icInstance, mapHandle, numEntries, &entryPos, &tempEntry); - check_noerr(status); - check(EqualString(tempEntry.MIMEType, theICMapEntry->MIMEType, true, true)); // be sure it's what we inserted - - if (status == noErr) - { - // insert the app data after the new ICMapEntry and increase the entry's total length - - mungeRes = ::Munger(mapHandle, entryPos + tempEntry.totalLength, NULL, 0, pAppData, appDataSize); - check(mungeRes >= 0); - - if (mungeRes >= 0) - { - ICMapEntry* pEntry = (ICMapEntry *) (entryPos + *mapHandle); - pEntry->totalLength += appDataSize; - } - } - } - - status = ICSetPrefHandle(m_icInstance, kICMapping, mapAttr, mapHandle); - - -Bail: - if (mapHandle) DisposeHandle(mapHandle); - - if (icStarted) StopUsingIC(); - - return (OSErr) status; -#endif - } // SetMappingsToLaunchDownloadedFiles runs through the file helper mappings looking for @@ -842,78 +646,7 @@ // to appName) OSErr HXInternetConfigMac::SetMappingsToOpenDownloadedFiles(OSType appSignature, ConstStr255Param appName) { -#ifndef _CARBON - HX_ASSERT(!"HXInternetConfigMac::SetMappingsToOpenDownloadedFiles for Mac OS X only"); + HX_ASSERT(!"HXInternetConfigMac::SetMappingsToOpenDownloadedFiles unimplemented"); return 0; -#else - OSStatus status = icInternalErr; - ICAttr mapAttr; - Handle mapHandle = NULL; - long numEntries; - long idx, entryPos; - ICMapEntry currEntry; - Boolean bChangedMap; - - if (!StartUsingIC()) goto Bail; - - mapHandle = ::NewHandle(0); - if (mapHandle == NULL) goto Bail; - - status = ICFindPrefHandle(m_icInstance, kICMapping, &mapAttr, mapHandle); - if (status != noErr) goto Bail; - - numEntries = 0; - status = ICCountMapEntries(m_icInstance, mapHandle, &numEntries); - - bChangedMap = false; - - // retrieve each entry, see if the file_creator or post_creator field points to out app, and if so - // be sure the bit is set to open the app after downloading - - if (status == noErr) - { - for (idx = 1; idx <= numEntries; ++idx) - { - status = ICGetIndMapEntry(m_icInstance, mapHandle, idx, &entryPos, &currEntry); - - if (status == noErr) - { - if (currEntry.fileCreator == appSignature || currEntry.postCreator == appSignature) - { - if ((currEntry.flags & kICMapPostMask) != 0 - && currEntry.postCreator == appSignature) - { - // it launches the player, it's good - } - else - { - currEntry.flags |= kICMapPostMask; - currEntry.postCreator = appSignature; - - CopyPString(appName, currEntry.postAppName); - - status = ICSetMapEntry(m_icInstance, mapHandle, entryPos, &currEntry); - - bChangedMap = true; - } - } - } - } - } - - - if (bChangedMap) - { - status = ICSetPrefHandle(m_icInstance, kICMapping, mapAttr, mapHandle); - } - - -Bail: - if (mapHandle) DisposeHandle(mapHandle); - - StopUsingIC(); - - return (OSErr) status; -#endif } Index: util/platform/mac/maclibrary.cp =================================================================== RCS file: /cvsroot/common/util/platform/mac/maclibrary.cp,v retrieving revision 1.10.6.1 diff -u -w -r1.10.6.1 maclibrary.cp --- util/platform/mac/maclibrary.cp 1 May 2006 14:39:22 -0000 1.10.6.1 +++ util/platform/mac/maclibrary.cp 16 Dec 2008 04:09:14 -0000 @@ -227,7 +227,6 @@ // HX_RESULT // Error code indicating the success or failure of the function. // -#if defined(_CARBON) || defined(_MAC_UNIX) HX_RESULT FindLibrary(ULONG32 moftCodecTag, OSType codecCreator, char* pLibName, FSSpec &fsLibSpec) { // FindLibrary searches messily through files in the Extensions folder; this is obviously @@ -244,102 +243,6 @@ return 0; } -#else // !defined _CARBON - -HX_RESULT FindLibrary(HX_MOFTAG moftCodecTag, OSType codecCreator, char* pLibName, FSSpec &fsLibSpec) -{ - HX_RESULT err = HXR_DEC_NOT_FOUND; - //find the Sys ?/Extensions/RealAudio folder - FSSpec raSpec; - if (noErr == ::FindFolder (-1, kExtensionFolderType, kDontCreateFolder, &raSpec.vRefNum, &raSpec.parID)) - { - ::FSMakeFSSpec (raSpec.vRefNum, raSpec.parID, "\pReal", &raSpec); //get str fm resource? - - //FSSpec libSpec; - int i=1; - short rfRefNum; - Str255 strID; - short currRes = ::CurResFile(); - Handle hRsrc; - short iCnt; - - //iterate through all files in RealAudio directory - while ( FSpIterateDirectory(&raSpec, i, &fsLibSpec)) - { - Boolean tempbool=false; - - ResolveAliasFile(&fsLibSpec,true,&tempbool,&tempbool); - - rfRefNum = OpenLibraryRes(&fsLibSpec, codecCreator); - if (rfRefNum) - { - - strID[0] = 0; - // check if file has expected STR# resources defining codec ID - iCnt = ::Count1Resources('STR#'); - if (iCnt) - { - hRsrc = ::Get1Resource('STR#',kCodecIDStrResID); - if (hRsrc) - ::GetIndString(strID,kCodecIDStrResID,kCodecIDStrItem); - if (strID[0]) - { - long lValue = 0; - memcpy(&lValue, &strID[1], sizeof(long)); - if (lValue == moftCodecTag) - { - strncpy(pLibName, (char*)&fsLibSpec.name[1], fsLibSpec.name[0]); - pLibName[fsLibSpec.name[0]] = 0; - err = HXR_OK; - break; - } - - } //if (strID[0]) - } // if iCnt - ::CloseResFile(rfRefNum); - ::UseResFile(currRes); - - } //if rfRefNum - i++; - } //while - } //if FindFolder - - if (err == HXR_DEC_INIT_FAILED) - { - // look elsewhere? - } - - return err; -} //end FindLibrary - -short OpenLibraryRes(FSSpec *libSpec, OSType codecCreator) -{ - FInfo fndrInfo; - short rfRefNum = 0; - AliasHandle alias = NULL; - - OSErr err = ::FSpGetFInfo(libSpec,&fndrInfo); - - if (err == noErr && fndrInfo.fdCreator == codecCreator) - { - const Boolean kResolveAliasChains = true; - Boolean isFolder, wasAliased; - - err = ResolveAliasFile(libSpec, kResolveAliasChains, &isFolder, &wasAliased); - check_noerr(err); - - rfRefNum = ::FSpOpenResFile(libSpec, fsRdPerm); - if (rfRefNum == -1) - { - rfRefNum = 0; - } - } - return rfRefNum; -} -#endif // !defined _CARBON - - - ///////////////////////////////////////////////////////////////////////////// // @@ -362,44 +265,12 @@ // Returns the ConnectionID // -#if defined(_CARBON) || defined(_MAC_UNIX) - #include "filespecutils.h" -#if defined(_DEBUG) && !defined(_MAC_UNIX) -static void DebugReportAnyLoadFailure(OSErr err, StringPtr errMsgPascStr, - const char *pLoadCallName, ConstStr255Param libNameStr, FSSpec* fileFSSpec) -{ -// if (err != cfragUnresolvedErr && err != cfragNoLibraryErr) return; naw, we'll report any errors now - - if (err == noErr) return; - - CHXString strErrMsg, strLibName, strPath, msg; - Str255 pascMsg; - - strErrMsg.SetFromStr255(errMsgPascStr); - strLibName.SetFromStr255(libNameStr); - - if (fileFSSpec) - { - strPath = *fileFSSpec; - } - - msg.Format("%s failed, err=%d lib: %s path: %s errMsg: %s", - pLoadCallName, err, - (const char *) strLibName, (const char *) strPath, - (const char *) strErrMsg); - msg.MakeStr255(pascMsg); - DebugStr(pascMsg); -} -#else static inline void DebugReportAnyLoadFailure(OSErr, StringPtr , const char *, ConstStr255Param, FSSpec* ) { } -#endif - -#ifdef _MAC_MACHO HINSTANCE LoadLibrary(const char* dllname) { @@ -454,130 +325,6 @@ return (HINSTANCE)myBundle; } -#else - -HINSTANCE LoadLibrary(const char* dllname) // Carbon (CFM) version -{ - CFragConnectionID connID = 0; // reference ID to shared lib - Ptr mainAddr = nil; - Str255 errMsg; - OSErr err = noErr; - CHXString strFullName; - - check(dllname != NULL && dllname[0] != 0); - - strFullName = dllname; - - // if there's a colon, it's a full path; if there's no colon, - // it's a file name to be loaded using the implicitly search path - - if (strFullName.Find(':') == -1) - { - // we were given a simple library name; load it with the implicit system search path - - Str255 pascFullName; - - c2pstrcpy(pascFullName, (const char *) strFullName); - - err = ::GetSharedLibrary(pascFullName, kPowerPCCFragArch, kLoadCFrag, &connID, &mainAddr, errMsg); - - // xxxbobclark GetSharedLibrary is case-sensitive! so we may have just asked for - // i.e. "RV30.shlb" and failed, while "rv30.shlb" exists. - // Since we tend to use lower-case we'll force it to lower-case and see whether - // we can find it this time. - if (err == -2804) - { - strFullName.MakeLower(); - c2pstrcpy(pascFullName, (const char *) strFullName); - err = ::GetSharedLibrary(pascFullName, kPowerPCCFragArch, kLoadCFrag, &connID, &mainAddr, errMsg); - } - - DebugReportAnyLoadFailure(err, errMsg, "GetDiskFragment()", pascFullName, nil); - } - else - { - // we were given a path to a file - - // change shortcut prefix like ?ASUP? and ?APPL? into the full correct paths - ResolveIndependentPath(strFullName); - - // make a file spec from the path, resolve if it if it points to an alias file, - // and load the library from disk - CHXFileSpecifier dllFileSpec = strFullName; - - if (SUCCEEDED(CHXFileSpecUtils::ResolveFileSpecifierAlias(dllFileSpec))) - { - FSSpec dllFSSpec = (FSSpec) dllFileSpec; - err = ::GetDiskFragment (&dllFSSpec, 0, kCFragGoesToEOF, dllFSSpec.name, - kLoadCFrag, &connID, &mainAddr, errMsg); - - DebugReportAnyLoadFailure(err, errMsg, "GetDiskFragment()", dllFSSpec.name, &dllFSSpec); - } - } - - return (HINSTANCE) connID; -} - -#endif // else block from _MAC_MACHO - -#else // !defined _CARBON -HINSTANCE LoadLibrary(const char* dllname) // pre-Carbon version -{ - CFragConnectionID connID = 0; //reference ID to shared lib - Ptr mainAddr = nil; - Str255 errMsg; - OSErr err=noErr; - CHXString fullpath; - FSSpec spec; - Boolean tempbool=false; - - HX_ASSERT(dllname); - - fullpath = dllname; - // replace special prefixes (APPL, ASUP,..) with actual path - ResolveIndependentPath(fullpath); - spec = fullpath; - - err = ResolveAliasFileWithMountFlags(&spec,true,&tempbool,&tempbool,kResolveAliasFileNoUI); - - - err = GetDiskFragment (&spec, 0, kCFragGoesToEOF, spec.name, kLoadCFrag, &connID, &mainAddr, errMsg); - - if (err) - { - if (0 == spec.vRefNum) - { - // if spec is not valid (ie. spec.name is empty) use file name - // so that it tries to load lib from System folder or app folder - // this code - char fileName[256]; - int copyLen = strlen(dllname); - char* pFileStart = strrchr(dllname, ':'); - if (pFileStart) - { - pFileStart++; // skip over ':' - copyLen -= (pFileStart - dllname); - } - else - { - pFileStart = (char*)dllname; - } - - strncpy(&fileName[1], pFileStart, copyLen); - fileName[0] = copyLen; - err = ::GetSharedLibrary((ConstStr63Param)fileName, kPowerPCCFragArch, kLoadCFrag, &connID, &mainAddr, errMsg); - } - else - { - err = ::GetSharedLibrary(spec.name, kPowerPCCFragArch, kLoadCFrag, &connID, &mainAddr, errMsg); - } - } - - - return (HINSTANCE)connID; -} -#endif - ///////////////////////////////////////////////////////////////////////////// // // Function: @@ -599,19 +346,10 @@ // none // -#ifdef _MAC_MACHO void FreeLibrary(HINSTANCE lib) { ::CFRelease((HINSTANCE)lib); } -#else -void FreeLibrary(HINSTANCE lib) -{ - CFragConnectionID connID = (CFragConnectionID)lib; - - ::CloseConnection(&connID); -} -#endif ///////////////////////////////////////////////////////////////////////////// // @@ -636,7 +374,6 @@ // void* // The address of the function. // -#ifdef _MAC_MACHO void* GetProcAddress(HMODULE lib, char* function) { void* theAddr = NULL; @@ -655,113 +392,4 @@ } return theAddr; } -#else -void* GetProcAddress(HMODULE lib, char* function) -{ - Ptr symAddr = nil; - CFragSymbolClass symClass; - CFragConnectionID connID = (CFragConnectionID)lib; - - Str255 strFuncName; - strcpy((char *)&strFuncName[1], function); - strFuncName[0] = strlen(function); - - -// FindSymbol doesn't actually return the address of the function; -// it returns a pointer to a TOC entry in the code fragment - OSErr err = ::FindSymbol(connID, (ConstStr63Param)((Str255*)strFuncName), &symAddr, &symClass); - - return symAddr; -} -#endif - -#if !defined(_MAC_UNIX) - -// -// ResolveIndependentPath checks the supplied full path to see -// if it's prefixed by a location indicator (like '?APPL?:' -// or '?asup?:'. If so, it changes the prefix to the appropriate -// path beginning. -// -// If the supplied path does not contain a prefix, or the folder type -// isn't recognized by FindFolder, the string is not changed. -// -// Returns TRUE if the path string was changed, FALSE otherwise. -// - -BOOL ResolveIndependentPath(CHXString& strPath) -{ - BOOL result; - CHXString startpath; - - const short kPrefixLength = 6; // ?code? - - // assume we aren't altering the string - result = FALSE; - - // look for proper characters preceding the first colon; - // folder should be bracketed by ? ? - - startpath = strPath.NthField(':', 1); - if (startpath.GetLength() == kPrefixLength - && startpath[0] == '?' - && startpath[5] == '?') - { - FSSpec folderSpec; - short foundVRefNum; - long foundDirID; - OSType foldType; - OSErr err; - - // extract the folder type - BlockMoveData(1 + (const char *) startpath, &foldType, sizeof(OSType)); - - // handle APPL as a the path to the current application, - // otherwise use FindFolder - - if (foldType == 'APPL') - { - // our desired dirID and vRefNum are those of the app's directory - (void) GetCurrentAppSpec(&folderSpec); - foundVRefNum = folderSpec.vRefNum; - foundDirID = folderSpec.parID; - err = noErr; - } - else - { - // use FindFolder to locate the desired directory - err = FindFolder(kOnSystemDisk, foldType, kCreateFolder, - &foundVRefNum, &foundDirID); - HX_ASSERT(err == noErr); - } - - if (err == noErr) - { - CHXString restpath; - - // no problem finding the desired folder - // - // make a path up to the desired folder, ending in a colon - - err = FSMakeFSSpec(foundVRefNum, foundDirID, "\p", &folderSpec); - HX_ASSERT(err == noErr); - - startpath = folderSpec; // coerce the file spec to a path - - if (startpath[startpath.GetLength() - 1] != ':') - { - startpath += ':'; - } - - // make a full path from the new startpath plus the rest of the original - restpath = strPath.Mid(kPrefixLength + 1); - - strPath = startpath + restpath; - - result = TRUE; // indicate that the string's been changed - } - } - return result; -} -#endif Index: util/pub/cookies.h =================================================================== RCS file: /cvsroot/common/util/pub/cookies.h,v retrieving revision 1.3.6.2 diff -u -w -r1.3.6.2 cookies.h --- util/pub/cookies.h 19 Sep 2005 17:59:02 -0000 1.3.6.2 +++ util/pub/cookies.h 16 Dec 2008 04:09:14 -0000 @@ -55,10 +55,6 @@ typedef BOOL (PASCAL FAR *INTERNETSETCOOKIE)(LPCSTR, LPCSTR, LPCSTR); #endif /* _WINDOWS */ -#ifdef _MACINTOSH -#include <time.h> -#endif - #include "ihxcookies2.h" struct CookieStruct Index: util/pub/hxstrutl.h =================================================================== RCS file: /cvsroot/common/util/pub/hxstrutl.h,v retrieving revision 1.10 diff -u -w -r1.10 hxstrutl.h --- util/pub/hxstrutl.h 9 Sep 2004 22:48:26 -0000 1.10 +++ util/pub/hxstrutl.h 16 Dec 2008 04:09:14 -0000 @@ -61,37 +61,9 @@ #include <ctype.h> #endif #endif -#ifdef _MACINTOSH -#include <ctype.h> -#endif #include "hxresult.h" -#if defined (_MACINTOSH) - -#define isascii isprint - -inline const char *AnsiNext(const char* pcPtr) { return( pcPtr + 1 ); } -inline const char *AnsiPrev(const char * /* pcStart */, const char* pcPtr) { return (pcPtr - 1 ); } - -int CopyP2CString(ConstStr255Param inSource, char* outDest, int inDestLength); -void CopyC2PString(const char* inSource, Str255 outDest); -char WINToMacCharacter( char inWINChar ); -// these functions are used to convert Windows extended chars (used in non-English Roman languages) -// to Mac extended chars & vice-versa -void StripWinChars( char* pChars); -void StripMacChars( char* pChars); - -inline void pstrcpy(Str255 dst, ConstStr255Param src) { BlockMoveData(src, dst, 1+src[0]); } - -#ifndef _CARBON -inline void PStrCopy(StringPtr dest, ConstStr255Param src) { BlockMoveData(src, dest, 1+src[0]); } -inline void p2cstrcpy(char *dst, ConstStr255Param src) { CopyP2CString(src, dst, 255); } -inline void c2pstrcpy(Str255 dst, const char * src) { CopyC2PString(src, dst); } -#endif - -#endif /* _MACINTOSH */ - #define CR (CHAR) '\r' #define LF (CHAR) '\n' #define CRLF "\r\n" Index: util/pub/platform.h =================================================================== RCS file: /cvsroot/common/util/pub/platform.h,v retrieving revision 1.5 diff -u -w -r1.5 platform.h --- util/pub/platform.h 9 Jul 2004 18:23:37 -0000 1.5 +++ util/pub/platform.h 16 Dec 2008 04:09:14 -0000 @@ -87,9 +87,6 @@ #elif (defined _WIN32 && defined _WINDOWS) #define PLATFORM "NT 3.5.x" #define LIC_PLATFORM 'J' -#elif (defined _MACINTOSH) -#define PLATFORM "Macintosh" -#define LIC_PLATFORM 'M' #elif defined __QNXNTO__ #define PLATFORM "QNX Neutrino 2.x" #define LIC_PLATFORM 'N' Index: util/pub/pref.h =================================================================== RCS file: /cvsroot/common/util/pub/pref.h,v retrieving revision 1.5 diff -u -w -r1.5 pref.h --- util/pub/pref.h 9 Jul 2004 18:23:37 -0000 1.5 +++ util/pub/pref.h 16 Dec 2008 04:09:15 -0000 @@ -47,10 +47,6 @@ * * ***** END LICENSE BLOCK ***** */ -#ifdef _MACINTOSH -#pragma once -#endif - #ifndef _PREF #define _PREF @@ -239,7 +235,7 @@ /* call open_pref() to automatically create the correct platform specific preference object. If open_pref() returns NULL, an error occurred and the CPref object was not created. Call last_error to get the error */ -#if defined(_CARBON) || defined(_MAC_UNIX) +#if defined(_MAC_UNIX) // for the Mac, we default to bCommon=FALSE since we want non-admin users to be able to run a new install, so by default // prefs get written per-user static CPref* open_pref(const char* pCompanyName, const char* pProductName, int nProdMajorVer, int nProdMinorVer, BOOL bCommon = FALSE); Index: util/pub/timeval.h =================================================================== RCS file: /cvsroot/common/util/pub/timeval.h,v retrieving revision 1.9.6.1 diff -u -w -r1.9.6.1 timeval.h --- util/pub/timeval.h 12 Nov 2007 18:15:53 -0000 1.9.6.1 +++ util/pub/timeval.h 16 Dec 2008 04:09:15 -0000 @@ -71,10 +71,6 @@ Timeval(int usec); Timeval(long sec, long usec); Timeval(long usec); -#if defined(_MACINTOSH) && defined(__MWERKS__) && !defined(_CARBON) -// I added this to make Timeval t = sendperiod compile - Timeval(time_t sec); -#endif Timeval(float t); Timeval(double t); @@ -85,14 +81,6 @@ }; -#if defined(_MACINTOSH) && defined(__MWERKS__) && !defined(_CARBON) -// I added this to make Timeval t = sendperiod compile -inline Timeval::Timeval(time_t t) { - tv_sec = (tv_sec_t)t; - tv_usec = (tv_usec_t)0; -} -#endif - inline Timeval::Timeval(float t) { tv_sec = (tv_sec_t)t; tv_usec = (tv_usec_t)((t-tv_sec)*SECOND); Index: util/pub/platform/mac/MoreFilesX.h =================================================================== RCS file: /cvsroot/common/util/pub/platform/mac/MoreFilesX.h,v retrieving revision 1.3.6.2 diff -u -w -r1.3.6.2 MoreFilesX.h --- util/pub/platform/mac/MoreFilesX.h 14 Nov 2008 02:02:10 -0000 1.3.6.2 +++ util/pub/platform/mac/MoreFilesX.h 16 Dec 2008 04:09:15 -0000 @@ -366,36 +366,6 @@ /*****************************************************************************/ -#pragma mark FSGetVolParms - -OSErr -FSGetVolParms( - FSVolumeRefNum volRefNum, - UInt32 bufferSize, - GetVolParmsInfoBuffer *volParmsInfo, - UInt32 *actualInfoSize); - -/* - The FSGetVolParms function returns information about the characteristics - of a volume. A result of paramErr usually just means the volume doesn't - support GetVolParms and the feature you were going to check - for isn't available. - - volRefNum --> Volume specification. - bufferSize --> Size of buffer pointed to by volParmsInfo. - volParmsInfo <-- A GetVolParmsInfoBuffer record where the volume - attributes information is returned. - actualInfoSize <-- The number of bytes actually returned - in volParmsInfo. - - __________ - - Also see: The GetVolParmsInfoBuffer Macros for checking attribute bits - in this file -*/ - -/*****************************************************************************/ - #pragma mark FSGetVRefNum OSErr @@ -1098,28 +1068,6 @@ /*****************************************************************************/ -#pragma mark FSCopyFileMgrAttributes - -OSErr -FSCopyFileMgrAttributes( - const FSRef *sourceRef, - const FSRef *destinationRef, - Boolean copyLockBit); - -/* - The CopyFileMgrAttributes function copies all File Manager attributes - from the source file or directory to the destination file or directory. - If copyLockBit is true, then set the locked state of the destination - to match the source. - - sourceRef --> FSRef to a file or directory. - destinationRef --> FSRef to a file or directory. - copyLockBit --> If true, set the locked state of the destination - to match the source. -*/ - -/*****************************************************************************/ - #pragma mark FSMoveRenameObjectUnicode OSErr @@ -1325,389 +1273,6 @@ /*****************************************************************************/ -#pragma mark FSExchangeObjectsCompat - -OSErr -FSExchangeObjectsCompat( - const FSRef *sourceRef, - const FSRef *destRef, - FSRef *newSourceRef, - FSRef *newDestRef); - -/* - The FSExchangeObjectsCompat function exchanges the data between two files. - - The FSExchangeObjectsCompat function is an enhanced version of - FSExchangeObjects function. The two enhancements FSExchangeObjectsCompat - provides are: - - 1, FSExchangeObjectsCompat will work on volumes which do not support - FSExchangeObjects. FSExchangeObjectsCompat does this by emulating - FSExchangeObjects through a series of File Manager operations. If - there is a failure at any step along the way, FSExchangeObjectsCompat - attempts to undo any steps already taken to leave the files in their - original state in their original locations. - - 2. FSExchangeObjectsCompat returns new FSRefs to the source and - destination files. Note that if this function fails at any step along - the way, newSourceRef and newDestRef still give you access to the final - locations of the files being exchanged -- even if they are renamed or - not in their original locations. - - sourceRef --> FSRef to the source file. - destRef --> FSRef to the destination file. - newSourceRef <-- The new FSRef to the source file. - newDestRef <-- The new FSRef to the destination file. -*/ - -/*****************************************************************************/ - -#pragma mark ----- Shared Environment Routines ----- - -/*****************************************************************************/ - -#pragma mark FSLockRange - -OSErr -FSLockRangeMoreFiles( - SInt16 refNum, - SInt32 rangeLength, - SInt32 rangeStart); - -/* - The LockRange function locks (denies access to) a portion of a file - that was opened with shared read/write permission. - - refNum --> The file reference number of an open file. - rangeLength --> The number of bytes in the range. - rangeStart --> The starting byte in the range to lock. - - __________ - - Also see: UnlockRange -*/ - -/*****************************************************************************/ - -#pragma mark FSUnlockRange - -OSErr -FSUnlockRangeMoreFiles( - SInt16 refNum, - SInt32 rangeLength, - SInt32 rangeStart); - -/* - The UnlockRange function unlocks (allows access to) a previously locked - portion of a file that was opened with shared read/write permission. - - refNum --> The file reference number of an open file. - rangeLength --> The number of bytes in the range. - rangeStart --> The starting byte in the range to unlock. - - __________ - - Also see: LockRange -*/ - -/*****************************************************************************/ - -#pragma mark FSGetDirAccess - -OSErr -FSGetDirAccess( - const FSRef *ref, - SInt32 *ownerID, /* can be NULL */ - SInt32 *groupID, /* can be NULL */ - SInt32 *accessRights); /* can be NULL */ - -/* - The FSGetDirAccess function retrieves the directory access control - information for a directory on a shared volume. - - ref --> An FSRef specifying the directory. - ownerID <** An optional pointer to a SInt32. - If not NULL, the directory's owner ID - will be returned in the SInt32. - groupID <** An optional pointer to a SInt32. - If not NULL, the directory's group ID, or 0 - if no group affiliation, will be returned in - the SInt32. - accessRights <** An optional pointer to a SInt32. - If not NULL, the directory's access rights - will be returned in the SInt32. - - __________ - - Also see: FSSetDirAccess, FSMapID, FSMapName -*/ - -/*****************************************************************************/ - -#pragma mark FSSetDirAccess - -OSErr -FSSetDirAccess( - const FSRef *ref, - SInt32 ownerID, - SInt32 groupID, - SInt32 accessRights); - -/* - The FSpSetDirAccess function changes the directory access control - information for a directory on a shared volume. You must be the owner of - a directory to change its access control information. - - ref --> An FSRef specifying the directory. - ownerID --> The directory's owner ID. - groupID --> The directory's group ID or 0 if no group affiliation. - accessRights --> The directory's access rights. - - __________ - - Also see: FSGetDirAccess, FSMapID, FSMapName -*/ - -/*****************************************************************************/ - -#pragma mark FSGetVolMountInfoSize - -OSErr -FSGetVolMountInfoSize( - FSVolumeRefNum volRefNum, - SInt16 *size); - -/* - The FSGetVolMountInfoSize function determines the how much space the - program needs to allocate for a volume mounting information record. - - volRefNum --> Volume specification. - size <-- The space needed (in bytes) of the volume - mounting information record. - - __________ - - Also see: FSGetVolMountInfo, VolumeMount -*/ - -/*****************************************************************************/ - -#pragma mark FSGetVolMountInfo - -OSErr -FSGetVolMountInfo( - FSVolumeRefNum volRefNum, - void *volMountInfo); - -/* - The FSGetVolMountInfo function retrieves a volume mounting information - record containing all the information needed to mount the volume, - except for passwords. - - volRefNum --> Volume specification. - volMountInfo <-- The volume mounting information. - - __________ - - Also see: FSGetVolMountInfoSize, VolumeMount -*/ - -/*****************************************************************************/ - -#pragma mark FSMapID - -OSErr -FSMapID( - FSVolumeRefNum volRefNum, - SInt32 ugID, - SInt16 objType, - Str31 name); - -/* - The FSMapID function determines the name of a user or group if you know - the user or group ID. - - volRefNum --> Volume specification. - objType --> The mapping function code: - kOwnerID2Name to map a user ID to a user name - kGroupID2Name to map a group ID to a group name - name <** An optional pointer to a buffer (minimum Str31). - If not NULL, the user or group name - will be returned in the buffer. - - __________ - - Also see: FSGetDirAccess, FSSetDirAccess, FSMapName -*/ - -/*****************************************************************************/ - -#pragma mark FSMapName - -OSErr -FSMapName( - FSVolumeRefNum volRefNum, - ConstStr255Param name, - SInt16 objType, - SInt32 *ugID); - -/* - The FSMapName function determines the user or group ID if you know the - user or group name. - - volRefNum --> Volume specification. - name --> The user or group name. - objType --> The mapping function code: - kOwnerName2ID to map a user name to a user ID - kGroupName2ID to map a user name to a group ID - ugID <-- The user or group ID. - - __________ - - Also see: FSGetDirAccess, FSSetDirAccess, FSMapID -*/ - -/*****************************************************************************/ - -#pragma mark FSCopyFile - -OSErr -FSCopyFile( - const FSRef *srcFileRef, - const FSRef *dstDirectoryRef, - UniCharCount nameLength, - const UniChar *copyName, /* can be NULL (no rename during copy) */ - TextEncoding textEncodingHint, - FSRef *newRef); /* can be NULL */ - -/* - The FSCopyFile function duplicates a file and optionally renames it. - The source and destination volumes must be on the same file server. - This function instructs the server to copy the file. - - srcFileRef --> An FSRef specifying the source file. - dstDirectoryRef --> An FSRef specifying the destination directory. - nameLength --> Number of UniChar in copyName parameter (ignored - if copyName is NULL). - copyName --> Points to the new file name if the file is to be - renamed, or NULL if the file isn't to be renamed. - textEncodingHint --> The text encoding hint used for the rename. - You can pass kTextEncodingUnknown to use the - "default" textEncodingHint. - newRef <** An optional pointer to a FSRef. - If not NULL, the FSRef of the duplicated file - will be returned in the FSRef. -*/ - -/*****************************************************************************/ - -#pragma mark FSMoveRename - -OSErr -FSMoveRename( - const FSRef *srcFileRef, - const FSRef *dstDirectoryRef, - UniCharCount nameLength, - const UniChar *moveName, /* can be NULL (no rename during move) */ - TextEncoding textEncodingHint, - FSRef *newRef); /* can be NULL */ - -/* - The FSMoveRename function moves a file or directory (object), and - optionally renames it. The source and destination locations must be on - the same shared volume. - - srcFileRef --> An FSRef specifying the source file. - dstDirectoryRef --> An FSRef specifying the destination directory. - nameLength --> Number of UniChar in moveName parameter (ignored - if copyName is NULL) - moveName --> Points to the new object name if the object is to be - renamed, or NULL if the object isn't to be renamed. - textEncodingHint --> The text encoding hint used for the rename. - You can pass kTextEncodingUnknown to use the - "default" textEncodingHint. - newRef <** An optional pointer to a FSRef. - If not NULL, the FSRef of the moved object - will be returned in the FSRef. -*/ - -/*****************************************************************************/ - -#pragma mark ----- File ID Routines ----- - -/*****************************************************************************/ - -#pragma mark FSResolveFileIDRef - -OSErr -FSResolveFileIDRef( - FSVolumeRefNum volRefNum, - SInt32 fileID, - FSRef *ref); - -/* - The FSResolveFileIDRef function returns an FSRef for the file with the - specified file ID reference. - - volRefNum --> Volume specification. - fileID --> The file ID reference. - ref <-- The FSRef for the file ID reference. - - __________ - - Also see: FSCreateFileIDRef, FSDeleteFileIDRef -*/ - -/*****************************************************************************/ - -#pragma mark FSCreateFileIDRef - -OSErr -FSCreateFileIDRef( - const FSRef *ref, - SInt32 *fileID); - -/* - The FSCreateFileIDRef function creates a file ID reference for the - specified file, or if a file ID reference already exists, supplies - the file ID reference and returns the result code fidExists or afpIDExists. - - ref --> The FSRef for the file. - fileID <-- The file ID reference (if result is noErr, - fidExists, or afpIDExists). - - __________ - - Also see: GetFSRefFromFileIDRef, FSDeleteFileIDRef -*/ - -/*****************************************************************************/ - -#pragma mark FSDeleteFileIDRef - -/* - Why is there no FSDeleteFileIDRef routine? There are two reasons: - - 1. Since Mac OS 8.1, PBDeleteFileIDRef hasn't deleted file ID references. - On HFS volumes, deleting a file ID reference breaks aliases (which - use file ID references to track files as they are moved around on a - volume) and file ID references are automatically deleted when the file - they refer to is deleted. On HFS Plus volumes, file ID references are - always created when a file is created, deleted when the file is deleted, - and cannot be deleted at any other time. - - 2. PBDeleteFileIDRef causes a memory access fault under Mac OS X 10.0 - through 10.1.x. While this will be fixed in a future release, the - implementation, like the Mac OS 8/9 implementation, does not delete - file ID references. - - __________ - - Also see: GetFSRefFromFileIDRef, FSCreateFileIDRef -*/ - -/*****************************************************************************/ - #pragma mark ----- Utility Routines ----- /*****************************************************************************/ Index: util/pub/platform/mac/cfwrappers.h =================================================================== RCS file: /cvsroot/common/util/pub/platform/mac/cfwrappers.h,v retrieving revision 1.5 diff -u -w -r1.5 cfwrappers.h --- util/pub/platform/mac/cfwrappers.h 9 Jul 2004 18:23:21 -0000 1.5 +++ util/pub/platform/mac/cfwrappers.h 16 Dec 2008 04:09:15 -0000 @@ -71,16 +71,6 @@ #pragma once -#ifndef _CARBON -#ifndef _MAC_UNIX -#error Carbon-only header -#endif -#endif - -#ifndef _MAC_MACHO -#include <CFString.h> -#endif - #include "hxstring.h" #include "hxtypes.h" Index: util/pub/platform/mac/fullpathname.h =================================================================== RCS file: /cvsroot/common/util/pub/platform/mac/fullpathname.h,v retrieving revision 1.5 diff -u -w -r1.5 fullpathname.h --- util/pub/platform/mac/fullpathname.h 9 Jul 2004 18:23:21 -0000 1.5 +++ util/pub/platform/mac/fullpathname.h 16 Dec 2008 04:09:15 -0000 @@ -55,21 +55,6 @@ extern "C" { #endif -#if defined(_MAC_UNIX) || defined(_CARBON) - -// 8-bit encodings: -// HFS path is in system encoding (required by Metrowerks libraries) -// POSIX path is in UTF8 encoding (prefs assumes system encoding so this can't be saved) -// URLs are percent-escaped - -// HFS path <--> FSRef -OSErr HFSPathFromFSRef(const FSRef *ref, CHXString& fullPathName); -OSErr FSRefFromHFSPath(const char *path, FSRef *outRef); - -// HFS path <--> URL -OSStatus URLFromHFSPath(const char *pszPath, CHXString& strURL); -OSStatus HFSPathFromURL(const char *pszURL, CHXString& fullPathName); - // "Current" path type (HFS on CFM builds, POSIX on Mach-O builds) OSErr PathFromFSRef(const FSRef *ref, CHXString& fullPathName); OSErr FSRefFromPath(const char *path, FSRef *outRef); @@ -85,24 +70,8 @@ // POSIX path <--> URL OSStatus URLFromPOSIXPath(const char *pszPath, CHXString& strURL); OSStatus POSIXPathFromURL(const char *pszURL, CHXString& fullPathName); - -// HFS partial <--> full path name (hopefully never needed) -OSErr FullFromPartialHFSPath(const char *pszPartialOrFullPath, CHXString& fullPathName); OSErr FullFromPartialPOSIXPath(const char *pszPartialOrFullPath, CHXString& fullPathName); -#endif // _CARBON - -// Deprecated routines -// -// These are old HFS path routines; these should not be used under Carbon since they -// will fail on long filenames - -OSErr PathNameFromDirID(long dirID, short vRefNum, CHXString &fullPathName); -OSErr PathNameFromWD(long vRefNum, CHXString &pathName); -OSErr PathNameFromFSSpec(const FSSpec* fsSpec, CHXString &fullPathName); -OSErr FSSpecFromPathName(const char *path, FSSpecPtr spec); - - #ifdef __cplusplus } #endif Index: util/pub/platform/mac/hurl.h =================================================================== RCS file: /cvsroot/common/util/pub/platform/mac/hurl.h,v retrieving revision 1.4 diff -u -w -r1.4 hurl.h --- util/pub/platform/mac/hurl.h 9 Jul 2004 18:23:21 -0000 1.4 +++ util/pub/platform/mac/hurl.h 16 Dec 2008 04:09:15 -0000 @@ -72,10 +72,6 @@ BOOL MakeOpenURLEvent(OSType appSignature, const char* pURL, AEDesc *theAppleEventPtr, Boolean bNewWindow = false); -#ifdef _CARBON -BOOL GetPreferredOrSystemBrowser(IHXPreferences* pPrefs, FSRef *outBrowserFSRef, OSType *outBrowserSignature); -#endif - #ifdef __cplusplus } #endif Index: util/pub/platform/mac/hx_moreprocesses.h =================================================================== RCS file: /cvsroot/common/util/pub/platform/mac/hx_moreprocesses.h,v retrieving revision 1.5 diff -u -w -r1.5 hx_moreprocesses.h --- util/pub/platform/mac/hx_moreprocesses.h 9 Jul 2004 18:23:21 -0000 1.5 +++ util/pub/platform/mac/hx_moreprocesses.h 16 Dec 2008 04:09:15 -0000 @@ -57,11 +57,7 @@ // OS X-savvy calls //////////////////////////////////////////////////////////////////////////////////// -#ifdef _MAC_UNIX #define IsRunningNativeOnMacOSX() (1) -#else -Boolean IsRunningNativeOnMacOSX(void); // returns false for non-Carbon code and Carbon on OS 9 -#endif Boolean IsMacInCooperativeThread(void); // use on OS X instead of HXMM_ATINTERRUPT @@ -76,30 +72,13 @@ void ActivateApplicationPSN(ProcessSerialNumber *psn); // Calls for launching processes -#if defined(_CARBON) || defined(_MAC_UNIX) OSStatus GetApplicationFSRefFromSignature(OSType signature, FSRef *outAppFSRef); -#endif -OSErr LaunchApplicationBySignature(OSType signature, AppleEvent *theEvent); OSErr SendQuitEventToApplication(ProcessSerialNumber *psn); - - -// pre-OS X calls... -Boolean CheckForApplicationRunningFSSpec(OSType AppSignature, FSSpec *spec); - -Boolean GetApplicationSpec(OSType AppSignature, FSSpec *theSpec); -Boolean GetPSNSpec(ProcessSerialNumber* psn,FSSpec* theSpec); -Boolean GetCurrentAppSpec(FSSpec *theSpec); Boolean SameFSSpec(FSSpecPtr sa, FSSpecPtr sb); -OSErr FSpLaunchApplication (FSSpec *appSpec); -OSErr FSpLaunchApplicationPSN (FSSpec *appSpec,ProcessSerialNumber* psn); // Returns a ProcessSerialNumber -OSErr FSpLaunchApplicationWithParams(FSSpec *appSpec, const AppleEvent *theEvent, ProcessSerialNumber *psn); -OSErr FSpLaunchApplicationWithParamsAndFlags(FSSpec *appSpec, const AppleEvent *theEvent, ProcessSerialNumber *psn, short launchFlags); - OSErr FindApplicationBySignature(OSType signature, FSSpec *appSpec); // searches Desktop Databases, use GetApplicationFSRefFromSignature instead -OSErr OpenDocumentWithApplication(OSType signature, FSSpec *file); // either launch or send event directly, as appropriate #ifdef __cplusplus } Index: util/pub/platform/mac/mac_pref_cf.h =================================================================== RCS file: /cvsroot/common/util/pub/platform/mac/mac_pref_cf.h,v retrieving revision 1.6 diff -u -w -r1.6 mac_pref_cf.h --- util/pub/platform/mac/mac_pref_cf.h 9 Jul 2004 18:23:21 -0000 1.6 +++ util/pub/platform/mac/mac_pref_cf.h 16 Dec 2008 04:09:15 -0000 @@ -49,12 +49,6 @@ #pragma once -#ifndef _CARBON -#ifndef _MAC_UNIX -#error use mac_pref.h instead for non-carbon builds -#endif -#endif - #include "pref.h" #include "cfwrappers.h" #include "hxstring.h" -------------- next part --------------