bug #42100, Carbon compatibility. r=gordon, saari, pinkerton, sfraser

This commit is contained in:
beard%netscape.com 2000-06-20 23:10:06 +00:00
Родитель 27e254fee3
Коммит 1c926d81a2
86 изменённых файлов: 675 добавлений и 753 удалений

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

@ -1641,7 +1641,16 @@ sub BuildRuntimeProjects()
BuildOneProject(":mozilla:lib:mac:NSStdLib:NSStdLib.mcp", "NSStdLib$D.shlb", 1, $main::ALIAS_SYM_FILES, 0);
BuildOneProject(":mozilla:nsprpub:macbuild:NSPR20PPC.mcp", "NSPR20$D.shlb", 1, $main::ALIAS_SYM_FILES, 0);
#// for NSPR under Carbon, have to link against some additional static libraries when NOT building with TARGET_CARBON.
if ( $main::CARBON ) {
BuildOneProject(":mozilla:nsprpub:macbuild:NSPR20PPC.mcp", "NSPR20$D.shlb (Carbon)", 0, 0, 0);
_MakeAlias(":mozilla:nsprpub:macbuild:NSPR20$D.shlb", ":mozilla:dist:viewer_debug:Essential Files:");
if ($main::ALIAS_SYM_FILES) {
_MakeAlias(":mozilla:nsprpub:macbuild:NSPR20$D.shlb.xSYM", ":mozilla:dist:viewer_debug:Essential Files:");
}
} else {
BuildOneProject(":mozilla:nsprpub:macbuild:NSPR20PPC.mcp", "NSPR20$D.shlb", 1, $main::ALIAS_SYM_FILES, 0);
}
print("--- Runtime projects complete ----\n");
}
@ -1761,7 +1770,16 @@ sub BuildNeckoProjects()
print("--- Starting Necko projects ----\n");
if ( $main::CARBON ) {
BuildOneProject(":mozilla:netwerk:macbuild:netwerk.mcp", "Necko$D.shlb (Carbon)", 0, 0, 0);
_MakeAlias(":mozilla:netwerk:macbuild:Necko$D.shlb", ":mozilla:dist:viewer_debug:Components:");
if ($main::ALIAS_SYM_FILES) {
_MakeAlias(":mozilla:netwerk:macbuild:Necko$D.shlb.xSYM", ":mozilla:dist:viewer_debug:Components:");
}
} else {
BuildOneProject(":mozilla:netwerk:macbuild:netwerk.mcp", "Necko$D.shlb", 1, $main::ALIAS_SYM_FILES, 1);
}
BuildOneProject(":mozilla:netwerk:macbuild:netwerk2.mcp", "Necko2$D.shlb", 1, $main::ALIAS_SYM_FILES, 1);
BuildOneProject(":mozilla:dom:src:jsurl:macbuild:JSUrl.mcp", "JSUrl$D.shlb", 1, $main::ALIAS_SYM_FILES, 1);

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

@ -32,6 +32,7 @@
#define TARGET_CARBON 0
#if TARGET_CARBON
#define PP_Target_Carbon 1
#define OLDP2C 1
#endif
/* Some build-wide Mac-related defines */

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

@ -156,6 +156,11 @@ inline GrafPtr GetQDGlobalsThePort ( )
return qd.thePort;
}
inline const BitMap * GetPortBitMapForCopyBits(CGrafPtr port)
{
return &((GrafPtr)port)->portBits;
}
#endif /* !TARGET_CARBON */
#endif /* CarbonHelpers_h__ */

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

@ -476,7 +476,7 @@ nsDeviceContextMac :: FindScreenForSurface ( nsIScreen** outScreen )
NS_IF_ADDREF(*outScreen = sPrimaryScreen.get());
}
else {
::SetPort ( window );
::SetPortWindowPort( window );
// convert window bounds to global coordinates
Point topLeft = { bounds.top, bounds.left };
@ -487,7 +487,9 @@ nsDeviceContextMac :: FindScreenForSurface ( nsIScreen** outScreen )
// subtract out the height of title bar from the size
StRegionFromPool structRgn;
::GetWindowStructureRgn(window, structRgn);
// GetWindowRegion is available in 8.0 and beyond. Use it.
// ::GetWindowStructureRgn(window, structRgn);
::GetWindowRegion(window, kWindowStructureRgn, structRgn);
Rect structBox;
::GetRegionBounds ( structRgn, &structBox );
PRInt32 wTitleHeight = topLeft.v - 1 - structBox.top;
@ -773,12 +775,53 @@ void nsDeviceContextMac :: InitFontInfoList()
if (!gFontInfoList)
return;
short numFONDs = ::CountResources('FOND');
#if !TARGET_CARBON
#if TARGET_CARBON
// use the new Font Manager enumeration API.
FMFontFamilyIterator iter;
err = FMCreateFontFamilyIterator(NULL, NULL, kFMDefaultOptions, &iter);
if (err != noErr)
return;
TextEncoding unicodeEncoding = ::CreateTextEncoding(kTextEncodingUnicodeDefault,
kTextEncodingDefaultVariant,
kTextEncodingDefaultFormat);
// enumerate all fonts.
TECObjectRef converter = 0;
TextEncoding oldFontEncoding = 0;
FMFontFamily fontFamily;
while (FMGetNextFontFamily(&iter, &fontFamily) == noErr) {
Str255 fontName;
err = ::FMGetFontFamilyName(fontFamily, fontName);
if (err != noErr || fontName[0] == 0 || fontName[1] == '.' || fontName[1] == '%')
continue;
TextEncoding fontEncoding;
err = ::FMGetFontFamilyTextEncoding(fontFamily, &fontEncoding);
if (oldFontEncoding != fontEncoding) {
oldFontEncoding = fontEncoding;
if (converter)
err = ::TECDisposeConverter(converter);
err = ::TECCreateConverter(&converter, fontEncoding, unicodeEncoding);
if (err != noErr)
continue;
}
// convert font name to UNICODE.
PRUnichar unicodeFontName[sizeof(fontName)];
ByteCount actualInputLength, actualOutputLength;
err = ::TECConvertText(converter, &fontName[1], fontName[0], &actualInputLength,
(TextPtr)unicodeFontName , sizeof(unicodeFontName), &actualOutputLength);
unicodeFontName[actualOutputLength / sizeof(PRUnichar)] = '\0';
FontNameKey key(unicodeFontName);
gFontInfoList->Put(&key, (void*)fontFamily);
}
if (converter)
err = ::TECDisposeConverter(converter);
err = FMDisposeFontFamilyIterator(&iter);
#else
short numFONDs = ::CountResources('FOND');
TextEncoding unicodeEncoding = ::CreateTextEncoding(kTextEncodingUnicodeDefault,
kTextEncodingDefaultVariant,
kTextEncodingDefaultFormat);
#endif
TECObjectRef converter = nil;
ScriptCode lastscript = smUninterp;
for (short i = 1; i <= numFONDs ; i++)
@ -792,7 +835,6 @@ void nsDeviceContextMac :: InitFontInfoList()
::GetResInfo(fond, &fondID, &resType, fontName);
if( (0 != fontName[0]) && ('.' != fontName[1]) && ('%' != fontName[1]))
{
#if !TARGET_CARBON
ScriptCode script = ::FontToScript(fondID);
if (script != lastscript)
{
@ -821,21 +863,13 @@ void nsDeviceContextMac :: InitFontInfoList()
FontNameKey key(unicodeFontName);
gFontInfoList->Put(&key, (void*)fondID);
}
#else
// pinkerton - CreateTextEncoding() makes a carbon app exit. this is a smarmy hack
char buffer[500];
::BlockMoveData ( &fontName[1], buffer, *fontName );
buffer[*fontName] = NULL;
printf("font buffer is %s\n", buffer);
FontNameKey key(buffer);
gFontInfoList->Put(&key, (void*)fondID);
#endif
::ReleaseResource(fond);
}
}
}
if (converter)
err = ::TECDisposeConverter(converter);
#endif /* !TARGET_CARBON */
}
}
@ -850,17 +884,8 @@ bool nsDeviceContextMac :: GetMacFontNumber(const nsString& aFontName, short &aF
//¥TODO?: Maybe we shouldn't call that function so often. If nsFont could store the
// fontNum, nsFontMetricsMac::SetFont() wouldn't need to call this at all.
InitFontInfoList();
#if TARGET_CARBON
char* fontNameC = aFontName.ToNewCString();
Str255 fontNamePascal;
fontNamePascal[0] = strlen(fontNameC);
::BlockMoveData ( fontNameC, &fontNamePascal[1], fontNamePascal[0] );
::GetFNum ( fontNamePascal, &aFontNum );
delete[] fontNameC;
#else
FontNameKey key(aFontName);
aFontNum = (short)gFontInfoList->Get(&key);
#endif
return (aFontNum != 0) && (kFontIDSymbol != aFontNum);
}

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

@ -35,10 +35,14 @@
*/
inline PRBool CurrentPortIsWMPort()
{
#if TARGET_CARBON
return PR_FALSE;
#else
GrafPtr curPort;
::GetPort(&curPort);
return (curPort == ::LMGetWMgrPort());
#endif
}
@ -55,6 +59,15 @@ public:
if (mOldPort != newPort)
::SetPort(newPort);
}
#if TARGET_CARBON
StPortSetter(WindowPtr newWindow)
: mNewPort(GetWindowPort(newWindow)), mOldPort(::GetQDGlobalsThePort())
{
if (mOldPort != mNewPort)
::SetPort(mNewPort);
}
#endif
~StPortSetter()
{

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

@ -456,8 +456,8 @@ NS_IMETHODIMP nsRenderingContextMac::CopyOffScreenBits(nsDrawingSurface aSrcSurf
// copy the bits now
::CopyBits(
#if TARGET_CARBON
reinterpret_cast<BitMap*>(*::GetPortPixMap(srcPort)),
reinterpret_cast<BitMap*>(*::GetPortPixMap(destPort)),
::GetPortBitMapForCopyBits(srcPort),
::GetPortBitMapForCopyBits(destPort),
#else
&srcPort->portBits,
&destPort->portBits,

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

@ -22,7 +22,7 @@
/*
* npupp.h $Revision: 3.2 $
* npupp.h $Revision: 3.3 $
* function call mecahnics needed by platform specific glue code.
*/
@ -56,7 +56,7 @@
/* NPP_Initialize */
#if GENERATINGCFM
#if TARGET_RT_MAC_CFM
typedef UniversalProcPtr NPP_InitializeUPP;
enum {
@ -83,7 +83,7 @@ typedef void (* NP_LOADDS NPP_InitializeUPP)(void);
/* NPP_Shutdown */
#if GENERATINGCFM
#if TARGET_RT_MAC_CFM
typedef UniversalProcPtr NPP_ShutdownUPP;
enum {
@ -110,7 +110,7 @@ typedef void (* NP_LOADDS NPP_ShutdownUPP)(void);
/* NPP_New */
#if GENERATINGCFM
#if TARGET_RT_MAC_CFM
typedef UniversalProcPtr NPP_NewUPP;
enum {
@ -143,7 +143,7 @@ typedef NPError (* NP_LOADDS NPP_NewUPP)(NPMIMEType pluginType, NPP instance, ui
/* NPP_Destroy */
#if GENERATINGCFM
#if TARGET_RT_MAC_CFM
typedef UniversalProcPtr NPP_DestroyUPP;
enum {
@ -169,7 +169,7 @@ typedef NPError (* NP_LOADDS NPP_DestroyUPP)(NPP instance, NPSavedData** save);
/* NPP_SetWindow */
#if GENERATINGCFM
#if TARGET_RT_MAC_CFM
typedef UniversalProcPtr NPP_SetWindowUPP;
enum {
@ -196,7 +196,7 @@ typedef NPError (* NP_LOADDS NPP_SetWindowUPP)(NPP instance, NPWindow* window);
/* NPP_NewStream */
#if GENERATINGCFM
#if TARGET_RT_MAC_CFM
typedef UniversalProcPtr NPP_NewStreamUPP;
enum {
@ -224,7 +224,7 @@ typedef NPError (* NP_LOADDS NPP_NewStreamUPP)(NPP instance, NPMIMEType type, NP
/* NPP_DestroyStream */
#if GENERATINGCFM
#if TARGET_RT_MAC_CFM
typedef UniversalProcPtr NPP_DestroyStreamUPP;
enum {
@ -252,7 +252,7 @@ typedef NPError (* NP_LOADDS NPP_DestroyStreamUPP)(NPP instance, NPStream* strea
/* NPP_WriteReady */
#if GENERATINGCFM
#if TARGET_RT_MAC_CFM
typedef UniversalProcPtr NPP_WriteReadyUPP;
enum {
@ -279,7 +279,7 @@ typedef int32 (* NP_LOADDS NPP_WriteReadyUPP)(NPP instance, NPStream* stream);
/* NPP_Write */
#if GENERATINGCFM
#if TARGET_RT_MAC_CFM
typedef UniversalProcPtr NPP_WriteUPP;
enum {
@ -309,7 +309,7 @@ typedef int32 (* NP_LOADDS NPP_WriteUPP)(NPP instance, NPStream* stream, int32 o
/* NPP_StreamAsFile */
#if GENERATINGCFM
#if TARGET_RT_MAC_CFM
typedef UniversalProcPtr NPP_StreamAsFileUPP;
enum {
@ -336,7 +336,7 @@ typedef void (* NP_LOADDS NPP_StreamAsFileUPP)(NPP instance, NPStream* stream, c
/* NPP_Print */
#if GENERATINGCFM
#if TARGET_RT_MAC_CFM
typedef UniversalProcPtr NPP_PrintUPP;
enum {
@ -363,7 +363,7 @@ typedef void (* NP_LOADDS NPP_PrintUPP)(NPP instance, NPPrint* platformPrint);
/* NPP_HandleEvent */
#if GENERATINGCFM
#if TARGET_RT_MAC_CFM
typedef UniversalProcPtr NPP_HandleEventUPP;
enum {
@ -390,7 +390,7 @@ typedef int16 (* NP_LOADDS NPP_HandleEventUPP)(NPP instance, void* event);
/* NPP_URLNotify */
#if GENERATINGCFM
#if TARGET_RT_MAC_CFM
typedef UniversalProcPtr NPP_URLNotifyUPP;
enum {
@ -419,7 +419,7 @@ typedef void (* NP_LOADDS NPP_URLNotifyUPP)(NPP instance, const char* url, NPRea
/* NPP_GetValue */
#if GENERATINGCFM
#if TARGET_RT_MAC_CFM
typedef UniversalProcPtr NPP_GetValueUPP;
enum {
@ -445,7 +445,7 @@ typedef NPError (* NP_LOADDS NPP_GetValueUPP)(NPP instance, NPPVariable variable
/* NPP_SetValue */
#if GENERATINGCFM
#if TARGET_RT_MAC_CFM
typedef UniversalProcPtr NPP_SetValueUPP;
enum {
@ -478,7 +478,7 @@ typedef NPError (* NP_LOADDS NPP_SetValueUPP)(NPP instance, NPNVariable variable
/* NPN_GetValue */
#if GENERATINGCFM
#if TARGET_RT_MAC_CFM
typedef UniversalProcPtr NPN_GetValueUPP;
enum {
@ -504,7 +504,7 @@ typedef NPError (* NP_LOADDS NPN_GetValueUPP)(NPP instance, NPNVariable variable
/* NPN_SetValue */
#if GENERATINGCFM
#if TARGET_RT_MAC_CFM
typedef UniversalProcPtr NPN_SetValueUPP;
enum {
@ -530,7 +530,7 @@ typedef NPError (* NP_LOADDS NPN_SetValueUPP)(NPP instance, NPPVariable variable
/* NPN_GetUrlNotify */
#if GENERATINGCFM
#if TARGET_RT_MAC_CFM
typedef UniversalProcPtr NPN_GetURLNotifyUPP;
enum {
@ -557,7 +557,7 @@ typedef NPError (* NP_LOADDS NPN_GetURLNotifyUPP)(NPP instance, const char* url,
/* NPN_PostUrlNotify */
#if GENERATINGCFM
#if TARGET_RT_MAC_CFM
typedef UniversalProcPtr NPN_PostURLNotifyUPP;
enum {
@ -587,7 +587,7 @@ typedef NPError (* NP_LOADDS NPN_PostURLNotifyUPP)(NPP instance, const char* url
/* NPN_GetUrl */
#if GENERATINGCFM
#if TARGET_RT_MAC_CFM
typedef UniversalProcPtr NPN_GetURLUPP;
enum {
@ -613,7 +613,7 @@ typedef NPError (* NP_LOADDS NPN_GetURLUPP)(NPP instance, const char* url, const
/* NPN_PostUrl */
#if GENERATINGCFM
#if TARGET_RT_MAC_CFM
typedef UniversalProcPtr NPN_PostURLUPP;
enum {
@ -642,7 +642,7 @@ typedef NPError (* NP_LOADDS NPN_PostURLUPP)(NPP instance, const char* url, cons
/* NPN_RequestRead */
#if GENERATINGCFM
#if TARGET_RT_MAC_CFM
typedef UniversalProcPtr NPN_RequestReadUPP;
enum {
@ -669,7 +669,7 @@ typedef NPError (* NP_LOADDS NPN_RequestReadUPP)(NPStream* stream, NPByteRange*
/* NPN_NewStream */
#if GENERATINGCFM
#if TARGET_RT_MAC_CFM
typedef UniversalProcPtr NPN_NewStreamUPP;
enum {
@ -698,7 +698,7 @@ typedef NPError (* NP_LOADDS NPN_NewStreamUPP)(NPP instance, NPMIMEType type, co
/* NPN_Write */
#if GENERATINGCFM
#if TARGET_RT_MAC_CFM
typedef UniversalProcPtr NPN_WriteUPP;
enum {
@ -727,7 +727,7 @@ typedef int32 (* NP_LOADDS NPN_WriteUPP)(NPP instance, NPStream* stream, int32 l
/* NPN_DestroyStream */
#if GENERATINGCFM
#if TARGET_RT_MAC_CFM
typedef UniversalProcPtr NPN_DestroyStreamUPP;
enum {
@ -755,7 +755,7 @@ typedef NPError (* NP_LOADDS NPN_DestroyStreamUPP)(NPP instance, NPStream* strea
/* NPN_Status */
#if GENERATINGCFM
#if TARGET_RT_MAC_CFM
typedef UniversalProcPtr NPN_StatusUPP;
enum {
@ -781,7 +781,7 @@ typedef void (* NP_LOADDS NPN_StatusUPP)(NPP instance, const char* message);
/* NPN_UserAgent */
#if GENERATINGCFM
#if TARGET_RT_MAC_CFM
typedef UniversalProcPtr NPN_UserAgentUPP;
enum {
@ -807,7 +807,7 @@ typedef const char* (* NP_LOADDS NPN_UserAgentUPP)(NPP instance);
/* NPN_MemAlloc */
#if GENERATINGCFM
#if TARGET_RT_MAC_CFM
typedef UniversalProcPtr NPN_MemAllocUPP;
enum {
@ -834,7 +834,7 @@ typedef void* (* NP_LOADDS NPN_MemAllocUPP)(uint32 size);
/* NPN__MemFree */
#if GENERATINGCFM
#if TARGET_RT_MAC_CFM
typedef UniversalProcPtr NPN_MemFreeUPP;
enum {
@ -860,7 +860,7 @@ typedef void (* NP_LOADDS NPN_MemFreeUPP)(void* ptr);
/* NPN_MemFlush */
#if GENERATINGCFM
#if TARGET_RT_MAC_CFM
typedef UniversalProcPtr NPN_MemFlushUPP;
enum {
@ -888,7 +888,7 @@ typedef uint32 (* NP_LOADDS NPN_MemFlushUPP)(uint32 size);
/* NPN_ReloadPlugins */
#if GENERATINGCFM
#if TARGET_RT_MAC_CFM
typedef UniversalProcPtr NPN_ReloadPluginsUPP;
enum {
@ -915,7 +915,7 @@ typedef void (* NP_LOADDS NPN_ReloadPluginsUPP)(NPBool reloadPages);
/* NPN_GetJavaEnv */
#if GENERATINGCFM
#if TARGET_RT_MAC_CFM
typedef UniversalProcPtr NPN_GetJavaEnvUPP;
enum {
@ -940,7 +940,7 @@ typedef JRIEnv* (* NP_LOADDS NPN_GetJavaEnvUPP)(void);
/* NPN_GetJavaPeer */
#if GENERATINGCFM
#if TARGET_RT_MAC_CFM
typedef UniversalProcPtr NPN_GetJavaPeerUPP;
enum {
@ -967,7 +967,7 @@ typedef jref (* NP_LOADDS NPN_GetJavaPeerUPP)(NPP instance);
/* NPN_InvalidateRect */
#if GENERATINGCFM
#if TARGET_RT_MAC_CFM
typedef UniversalProcPtr NPN_InvalidateRectUPP;
enum {
@ -995,7 +995,7 @@ typedef void (* NP_LOADDS NPN_InvalidateRectUPP)(NPP instance, NPRect *rect);
/* NPN_InvalidateRegion */
#if GENERATINGCFM
#if TARGET_RT_MAC_CFM
typedef UniversalProcPtr NPN_InvalidateRegionUPP;
enum {
@ -1022,7 +1022,7 @@ typedef void (* NP_LOADDS NPN_InvalidateRegionUPP)(NPP instance, NPRegion region
/* NPN_ForceRedraw */
#if GENERATINGCFM
#if TARGET_RT_MAC_CFM
typedef UniversalProcPtr NPN_ForceRedrawUPP;
enum {
@ -1052,7 +1052,7 @@ typedef void (* NP_LOADDS NPN_ForceRedrawUPP)(NPP instance);
*******************************************************************************************/
#ifdef XP_MAC
#if PRAGMA_ALIGN_SUPPORTED
#if PRAGMA_STRUCT_ALIGN
#pragma options align=mac68k
#endif
#endif
@ -1103,7 +1103,7 @@ typedef struct _NPNetscapeFuncs {
} NPNetscapeFuncs;
#ifdef XP_MAC
#if PRAGMA_ALIGN_SUPPORTED
#if PRAGMA_STRUCT_ALIGN
#pragma options align=reset
#endif
#endif
@ -1121,7 +1121,7 @@ typedef struct _NPNetscapeFuncs {
* and NPPShutdownUPP for Netscape's use.
*/
#if GENERATINGCFM
#if TARGET_RT_MAC_CFM
typedef UniversalProcPtr NPP_MainEntryUPP;
enum {

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

@ -5616,7 +5616,7 @@ nsCSSFrameConstructor::ConstructXULFrame(nsIPresShell* aPresShell,
rv = NS_NewMenuFrame(aPresShell, &newFrame, (aTag != nsXULAtoms::menuitem));
}
else if (aTag == nsXULAtoms::menubar) {
#if defined(XP_MAC) || defined(RHAPSODY) // The Mac uses its native menu bar.
#if (defined(XP_MAC) && !TARGET_CARBON) || defined(RHAPSODY) // The Mac uses its native menu bar.
aHaltProcessing = PR_TRUE;
return NS_OK;
#else

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

@ -2202,6 +2202,11 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetMayScript(PRBool *result)
// Here's where we forward events to plugins.
#ifdef XP_MAC
#if TARGET_CARBON
inline Boolean OSEventAvail(EventMask mask, EventRecord* event) { return EventAvail(mask, event); }
#endif
static void GUItoMacEvent(const nsGUIEvent& anEvent, EventRecord& aMacEvent)
{
::OSEventAvail(0, &aMacEvent);

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

@ -2202,6 +2202,11 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetMayScript(PRBool *result)
// Here's where we forward events to plugins.
#ifdef XP_MAC
#if TARGET_CARBON
inline Boolean OSEventAvail(EventMask mask, EventRecord* event) { return EventAvail(mask, event); }
#endif
static void GUItoMacEvent(const nsGUIEvent& anEvent, EventRecord& aMacEvent)
{
::OSEventAvail(0, &aMacEvent);

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

@ -5616,7 +5616,7 @@ nsCSSFrameConstructor::ConstructXULFrame(nsIPresShell* aPresShell,
rv = NS_NewMenuFrame(aPresShell, &newFrame, (aTag != nsXULAtoms::menuitem));
}
else if (aTag == nsXULAtoms::menubar) {
#if defined(XP_MAC) || defined(RHAPSODY) // The Mac uses its native menu bar.
#if (defined(XP_MAC) && !TARGET_CARBON) || defined(RHAPSODY) // The Mac uses its native menu bar.
aHaltProcessing = PR_TRUE;
return NS_OK;
#else

Двоичные данные
lib/mac/InterfaceLib/Interface.mcp

Двоичный файл не отображается.

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

@ -32,7 +32,7 @@
//##############################################################################
// needed because we are not compiling the relevant parts of New.cp
nothrow_t nothrow;
std::nothrow_t nothrow;
void* operator new (size_t size, const std::nothrow_t& ) throw()
{

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

@ -115,13 +115,17 @@ void nsHeapZoneHeader::SetupHeapZone(Ptr zonePtr, Size ptrSize)
{
Ptr zoneStart = zonePtr + sizeof(nsHeapZoneHeader);
Ptr endZone = zonePtr + ptrSize;
#if !TARGET_CARBON
::InitZone(nil, kHeapZoneMasterPointers, endZone, zoneStart);
#endif
mHeapZone = (THz)zoneStart;
#if !TARGET_CARBON
// set the current zone back to the application zone, because InitZone changes it
::SetZone(::ApplicationZone());
#endif
}
@ -129,10 +133,13 @@ void nsHeapZoneHeader::SetupHeapZone(Ptr zonePtr, Size ptrSize)
Ptr nsHeapZoneHeader::AllocateZonePtr(Size ptrSize)
//--------------------------------------------------------------------
{
#if !TARGET_CARBON
::SetZone(mHeapZone);
#endif
Ptr thePtr = ::NewPtr(ptrSize);
#if !TARGET_CARBON
::SetZone(::ApplicationZone());
#endif
mChunkCount += (thePtr != nil);
return thePtr;
@ -143,7 +150,9 @@ Ptr nsHeapZoneHeader::AllocateZonePtr(Size ptrSize)
void nsHeapZoneHeader::DisposeZonePtr(Ptr thePtr, Boolean &outWasLastChunk)
//--------------------------------------------------------------------
{
#if !TARGET_CARBON
MEM_ASSERT(::PtrZone(thePtr) == mHeapZone, "Ptr disposed from wrong zone!");
#endif
::DisposePtr(thePtr);
mChunkCount --;
outWasLastChunk = (mChunkCount == 0);
@ -154,10 +163,14 @@ void nsHeapZoneHeader::DisposeZonePtr(Ptr thePtr, Boolean &outWasLastChunk)
/* static */ nsHeapZoneHeader* nsHeapZoneHeader::GetZoneFromPtr(Ptr subheapPtr)
//--------------------------------------------------------------------
{
#if !TARGET_CARBON
THz ptrZone = ::PtrZone(subheapPtr);
MEM_ASSERT(ptrZone && (::MemError() == noErr), "Problem getting zone from ptr");
return (nsHeapZoneHeader *)((char *)ptrZone - sizeof(nsHeapZoneHeader));
#else
return NULL;
#endif
}
@ -411,9 +424,9 @@ void nsAllocatorManager::FreeSubheap(Ptr subheapPtr)
// increase the stack size by 32k. Someone is bound to have fun with
// recursion
#if !TARGET_CARBON
SetApplLimit(GetApplLimit() - inAppStackSizeInc);
#if !TARGET_CARBON
MaxApplZone();
#endif

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

@ -52,7 +52,7 @@ enum
** stack space used when recursively calling CopyLevel and to hold
** global information that might be needed at any time. */
#if PRAGMA_ALIGN_SUPPORTED
#if PRAGMA_STRUCT_ALIGN
#pragma options align=mac68k
#endif
struct EnumerateGlobals
@ -67,7 +67,7 @@ struct EnumerateGlobals
Str63 itemName; /* the name of the current item */
CInfoPBRec myCPB; /* the parameter block used for PBGetCatInfo calls */
};
#if PRAGMA_ALIGN_SUPPORTED
#if PRAGMA_STRUCT_ALIGN
#pragma options align=reset
#endif
@ -79,7 +79,7 @@ typedef EnumerateGlobals *EnumerateGlobalsPtr;
** stack space used when recursively calling GetLevelSize and to hold
** global information that might be needed at any time. */
#if PRAGMA_ALIGN_SUPPORTED
#if PRAGMA_STRUCT_ALIGN
#pragma options align=mac68k
#endif
struct PreflightGlobals
@ -95,7 +95,7 @@ struct PreflightGlobals
unsigned long tempBlocks; /* temporary storage for calculations (save some stack space) */
CopyFilterProcPtr copyFilterProc; /* pointer to filter function */
};
#if PRAGMA_ALIGN_SUPPORTED
#if PRAGMA_STRUCT_ALIGN
#pragma options align=reset
#endif

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

@ -180,7 +180,7 @@ pascal OSErr FSpGetFullPath(const FSSpec *spec,
if ( result == noErr )
{
/* Return the length */
*fullPathLength = InlineGetHandleSize(*fullPath);
*fullPathLength = GetHandleSize(*fullPath);
result = realResult; // return realResult in case it was fnfErr
}
else

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

@ -33,7 +33,7 @@
** stack space used when recursively calling IterateDirectoryLevel
** and to hold global information that might be needed at any time.
*/
#if PRAGMA_ALIGN_SUPPORTED
#if PRAGMA_STRUCT_ALIGN
#pragma options align=mac68k
#endif
struct IterateGlobals
@ -47,7 +47,7 @@ struct IterateGlobals
unsigned short currentLevel; /* The current level IterateLevel is on */
void *yourDataPtr; /* A pointer to caller data the filter may need to access */
};
#if PRAGMA_ALIGN_SUPPORTED
#if PRAGMA_STRUCT_ALIGN
#pragma options align=reset
#endif

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

@ -85,7 +85,7 @@ enum
/* local data structures */
#if PRAGMA_ALIGN_SUPPORTED
#if PRAGMA_STRUCT_ALIGN
#pragma options align=mac68k
#endif
@ -134,7 +134,7 @@ struct APPLRec
typedef struct APPLRec APPLRec;
typedef APPLRec *APPLRecPtr;
#if PRAGMA_ALIGN_SUPPORTED
#if PRAGMA_STRUCT_ALIGN
#pragma options align=reset
#endif
@ -314,7 +314,7 @@ static OSErr GetAPPLFromDesktopFile(ConstStr255Param volName,
applResHandle = Get1Resource(kAPPLResType, 0);
if ( applResHandle != NULL )
{
applSize = InlineGetHandleSize((Handle)applResHandle);
applSize = GetHandleSize((Handle)applResHandle);
if ( applSize != 0 ) /* make sure the APPL resource isn't empty */
{
foundCreator = false;
@ -1110,7 +1110,7 @@ static OSErr GetCommentFromDesktopFile(short vRefNum,
commentHandle = (StringHandle)Get1Resource(kFCMTResType,commentID);
if ( commentHandle != NULL )
{
if ( InlineGetHandleSize((Handle)commentHandle) > 0 )
if ( GetHandleSize((Handle)commentHandle) > 0 )
{
BlockMoveData(*commentHandle, comment, *commentHandle[0] + 1);
}

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

@ -55,7 +55,7 @@
** stack space used when recursively calling DeleteLevel and to hold
** global information that might be needed at any time. */
#if PRAGMA_ALIGN_SUPPORTED
#if PRAGMA_STRUCT_ALIGN
#pragma options align=mac68k
#endif
struct DeleteEnumGlobals
@ -64,7 +64,7 @@ struct DeleteEnumGlobals
Str63 itemName; /* the name of the current item */
UniversalFMPB myPB; /* the parameter block used for PBGetCatInfo calls */
};
#if PRAGMA_ALIGN_SUPPORTED
#if PRAGMA_STRUCT_ALIGN
#pragma options align=reset
#endif
@ -87,7 +87,7 @@ pascal void TruncPString(StringPtr destination,
/* a multi-byte character. */
while (maxLength != 0)
{
charType = CharByte((Ptr)&source[1], maxLength);
charType = CharacterByteType((Ptr)&source[1], maxLength, 0);
if ( (charType == smSingleByte) || (charType == smLastByte) )
break; /* source[maxLength] is now a valid last character */
--maxLength;
@ -438,7 +438,7 @@ pascal OSErr HGetVInfo(short volReference,
#undef pascal
#endif
#if GENERATINGCFM && !TARGET_CARBON
#if TARGET_RT_MAC_CFM && !TARGET_CARBON
pascal OSErr PBXGetVolInfoSync(XVolumeParamPtr paramBlock)
{
enum
@ -547,6 +547,8 @@ pascal OSErr CheckVolLock(ConstStr255Param pathname,
/*****************************************************************************/
#if CALL_NOT_IN_CARBON
pascal OSErr GetDriverName(short driverRefNum,
Str255 driverName)
{
@ -645,6 +647,8 @@ pascal OSErr FindDrive(ConstStr255Param pathname,
return ( result );
}
#endif /* CALL_NOT_IN_CARBON */
/*****************************************************************************/
pascal OSErr GetDiskBlocks(ConstStr255Param pathname,
@ -803,6 +807,8 @@ pascal OSErr GetVolFileSystemID(ConstStr255Param pathname,
/*****************************************************************************/
#if CALL_NOT_IN_CARBON
pascal OSErr GetVolState(ConstStr255Param pathname,
short vRefNum,
Boolean *volumeOnline,
@ -978,6 +984,8 @@ pascal OSErr UnmountAndEject(ConstStr255Param pathname,
return ( error );
}
#endif /* CALL_NOT_IN_CARBON */
/*****************************************************************************/
pascal OSErr OnLine(FSSpecPtr volumes,

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

@ -210,7 +210,7 @@ enum
/*****************************************************************************/
#if PRAGMA_ALIGN_SUPPORTED
#if PRAGMA_STRUCT_ALIGN
#pragma options align=mac68k
#endif
@ -317,7 +317,7 @@ struct MyAFPXVolMountInfo
typedef struct MyAFPXVolMountInfo MyAFPXVolMountInfo;
typedef MyAFPXVolMountInfo *MyAFPXVolMountInfoPtr, **MyAFPXVolMountInfoHandle;
#if PRAGMA_ALIGN_SUPPORTED
#if PRAGMA_STRUCT_ALIGN
#pragma options align=reset
#endif

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

@ -75,7 +75,7 @@ typedef LevelRec *LevelRecPtr, **LevelRecHandle;
** SearchPositionRec is my version of a CatPositionRec. It holds the
** information I need to resuming searching.
*/
#if PRAGMA_ALIGN_SUPPORTED
#if PRAGMA_STRUCT_ALIGN
#pragma options align=mac68k
#endif
struct SearchPositionRec
@ -85,7 +85,7 @@ struct SearchPositionRec
unsigned short stackDepth; /* Current depth on searchStack. */
short priv[11]; /* For future use... */
};
#if PRAGMA_ALIGN_SUPPORTED
#if PRAGMA_STRUCT_ALIGN
#pragma options align=reset
#endif
typedef struct SearchPositionRec SearchPositionRec;
@ -95,7 +95,7 @@ typedef SearchPositionRec *SearchPositionRecPtr;
/*
** ExtendedTMTask is a TMTask record extended to hold the timer flag.
*/
#if PRAGMA_ALIGN_SUPPORTED
#if PRAGMA_STRUCT_ALIGN
#pragma options align=mac68k
#endif
struct ExtendedTMTask
@ -104,7 +104,7 @@ struct ExtendedTMTask
Boolean stopSearch; /* the Time Mgr task will set stopSearch to */
/* true when the timer expires */
};
#if PRAGMA_ALIGN_SUPPORTED
#if PRAGMA_STRUCT_ALIGN
#pragma options align=reset
#endif
typedef struct ExtendedTMTask ExtendedTMTask;
@ -144,7 +144,7 @@ static void CheckForMatches(CInfoPBPtr cPB,
#undef pascal
#endif
#if GENERATINGCFM
#if TARGET_RT_MAC_CFM
static pascal void TimeOutTask(TMTaskPtr tmTaskPtr);
@ -214,7 +214,7 @@ static OSErr CheckStack(unsigned short stackDepth,
/* Time to grow stack */
SetHandleSize((Handle)searchStack, *searchStackSize + (kAdditionalLevelRecs * sizeof(LevelRec)));
result = MemError(); /* should be noErr */
*searchStackSize = InlineGetHandleSize((Handle)searchStack);
*searchStackSize = GetHandleSize((Handle)searchStack);
}
else
{
@ -687,7 +687,7 @@ Failed:
#undef pascal
#endif
#if GENERATINGCFM
#if TARGET_RT_MAC_CFM
static pascal void TimeOutTask(TMTaskPtr tmTaskPtr)
{
@ -813,7 +813,7 @@ pascal OSErr IndexedSearch(CSParamPtr pb,
/* Make sure searchStack really exists */
if ( searchStack != NULL )
{
searchStackSize = InlineGetHandleSize((Handle)searchStack);
searchStackSize = GetHandleSize((Handle)searchStack);
/* See if the search is a new search or a resumed search. */
if ( catPosition->initialize == 0 )

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

@ -74,7 +74,7 @@
#endif
#ifndef __MACOSSEVENORLATER
#if GENERATINGCFM
#if TARGET_RT_MAC_CFM
#define __MACOSSEVENORLATER 1
#else
#define __MACOSSEVENORLATER __MACOSSEVENFIVEORLATER

Двоичные данные
lib/mac/NSRuntime/NSRuntime.mcp

Двоичный файл не отображается.

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

@ -343,6 +343,7 @@ static void swap (
#endif /* XP_MAC */
#ifdef XP_MAC
#include <OSUtils.h>
#include <time.h>
static void MyReadLocation(MachineLocation * loc)
{

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

@ -836,7 +836,7 @@ il_size(il_container *ic)
#define IL_SIZE_CHUNK 128
#endif
#ifdef XP_MAC
# if GENERATINGPOWERPC
# if TARGET_CPU_PPC
# define IL_PREFERRED_CHUNK 8192
# define IL_OFFSCREEN_CHUNK 128
# else /* normal mac */

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

@ -22,7 +22,7 @@
/*
* npupp.h $Revision: 3.2 $
* npupp.h $Revision: 3.3 $
* function call mecahnics needed by platform specific glue code.
*/
@ -56,7 +56,7 @@
/* NPP_Initialize */
#if GENERATINGCFM
#if TARGET_RT_MAC_CFM
typedef UniversalProcPtr NPP_InitializeUPP;
enum {
@ -83,7 +83,7 @@ typedef void (* NP_LOADDS NPP_InitializeUPP)(void);
/* NPP_Shutdown */
#if GENERATINGCFM
#if TARGET_RT_MAC_CFM
typedef UniversalProcPtr NPP_ShutdownUPP;
enum {
@ -110,7 +110,7 @@ typedef void (* NP_LOADDS NPP_ShutdownUPP)(void);
/* NPP_New */
#if GENERATINGCFM
#if TARGET_RT_MAC_CFM
typedef UniversalProcPtr NPP_NewUPP;
enum {
@ -143,7 +143,7 @@ typedef NPError (* NP_LOADDS NPP_NewUPP)(NPMIMEType pluginType, NPP instance, ui
/* NPP_Destroy */
#if GENERATINGCFM
#if TARGET_RT_MAC_CFM
typedef UniversalProcPtr NPP_DestroyUPP;
enum {
@ -169,7 +169,7 @@ typedef NPError (* NP_LOADDS NPP_DestroyUPP)(NPP instance, NPSavedData** save);
/* NPP_SetWindow */
#if GENERATINGCFM
#if TARGET_RT_MAC_CFM
typedef UniversalProcPtr NPP_SetWindowUPP;
enum {
@ -196,7 +196,7 @@ typedef NPError (* NP_LOADDS NPP_SetWindowUPP)(NPP instance, NPWindow* window);
/* NPP_NewStream */
#if GENERATINGCFM
#if TARGET_RT_MAC_CFM
typedef UniversalProcPtr NPP_NewStreamUPP;
enum {
@ -224,7 +224,7 @@ typedef NPError (* NP_LOADDS NPP_NewStreamUPP)(NPP instance, NPMIMEType type, NP
/* NPP_DestroyStream */
#if GENERATINGCFM
#if TARGET_RT_MAC_CFM
typedef UniversalProcPtr NPP_DestroyStreamUPP;
enum {
@ -252,7 +252,7 @@ typedef NPError (* NP_LOADDS NPP_DestroyStreamUPP)(NPP instance, NPStream* strea
/* NPP_WriteReady */
#if GENERATINGCFM
#if TARGET_RT_MAC_CFM
typedef UniversalProcPtr NPP_WriteReadyUPP;
enum {
@ -279,7 +279,7 @@ typedef int32 (* NP_LOADDS NPP_WriteReadyUPP)(NPP instance, NPStream* stream);
/* NPP_Write */
#if GENERATINGCFM
#if TARGET_RT_MAC_CFM
typedef UniversalProcPtr NPP_WriteUPP;
enum {
@ -309,7 +309,7 @@ typedef int32 (* NP_LOADDS NPP_WriteUPP)(NPP instance, NPStream* stream, int32 o
/* NPP_StreamAsFile */
#if GENERATINGCFM
#if TARGET_RT_MAC_CFM
typedef UniversalProcPtr NPP_StreamAsFileUPP;
enum {
@ -336,7 +336,7 @@ typedef void (* NP_LOADDS NPP_StreamAsFileUPP)(NPP instance, NPStream* stream, c
/* NPP_Print */
#if GENERATINGCFM
#if TARGET_RT_MAC_CFM
typedef UniversalProcPtr NPP_PrintUPP;
enum {
@ -363,7 +363,7 @@ typedef void (* NP_LOADDS NPP_PrintUPP)(NPP instance, NPPrint* platformPrint);
/* NPP_HandleEvent */
#if GENERATINGCFM
#if TARGET_RT_MAC_CFM
typedef UniversalProcPtr NPP_HandleEventUPP;
enum {
@ -390,7 +390,7 @@ typedef int16 (* NP_LOADDS NPP_HandleEventUPP)(NPP instance, void* event);
/* NPP_URLNotify */
#if GENERATINGCFM
#if TARGET_RT_MAC_CFM
typedef UniversalProcPtr NPP_URLNotifyUPP;
enum {
@ -419,7 +419,7 @@ typedef void (* NP_LOADDS NPP_URLNotifyUPP)(NPP instance, const char* url, NPRea
/* NPP_GetValue */
#if GENERATINGCFM
#if TARGET_RT_MAC_CFM
typedef UniversalProcPtr NPP_GetValueUPP;
enum {
@ -445,7 +445,7 @@ typedef NPError (* NP_LOADDS NPP_GetValueUPP)(NPP instance, NPPVariable variable
/* NPP_SetValue */
#if GENERATINGCFM
#if TARGET_RT_MAC_CFM
typedef UniversalProcPtr NPP_SetValueUPP;
enum {
@ -478,7 +478,7 @@ typedef NPError (* NP_LOADDS NPP_SetValueUPP)(NPP instance, NPNVariable variable
/* NPN_GetValue */
#if GENERATINGCFM
#if TARGET_RT_MAC_CFM
typedef UniversalProcPtr NPN_GetValueUPP;
enum {
@ -504,7 +504,7 @@ typedef NPError (* NP_LOADDS NPN_GetValueUPP)(NPP instance, NPNVariable variable
/* NPN_SetValue */
#if GENERATINGCFM
#if TARGET_RT_MAC_CFM
typedef UniversalProcPtr NPN_SetValueUPP;
enum {
@ -530,7 +530,7 @@ typedef NPError (* NP_LOADDS NPN_SetValueUPP)(NPP instance, NPPVariable variable
/* NPN_GetUrlNotify */
#if GENERATINGCFM
#if TARGET_RT_MAC_CFM
typedef UniversalProcPtr NPN_GetURLNotifyUPP;
enum {
@ -557,7 +557,7 @@ typedef NPError (* NP_LOADDS NPN_GetURLNotifyUPP)(NPP instance, const char* url,
/* NPN_PostUrlNotify */
#if GENERATINGCFM
#if TARGET_RT_MAC_CFM
typedef UniversalProcPtr NPN_PostURLNotifyUPP;
enum {
@ -587,7 +587,7 @@ typedef NPError (* NP_LOADDS NPN_PostURLNotifyUPP)(NPP instance, const char* url
/* NPN_GetUrl */
#if GENERATINGCFM
#if TARGET_RT_MAC_CFM
typedef UniversalProcPtr NPN_GetURLUPP;
enum {
@ -613,7 +613,7 @@ typedef NPError (* NP_LOADDS NPN_GetURLUPP)(NPP instance, const char* url, const
/* NPN_PostUrl */
#if GENERATINGCFM
#if TARGET_RT_MAC_CFM
typedef UniversalProcPtr NPN_PostURLUPP;
enum {
@ -642,7 +642,7 @@ typedef NPError (* NP_LOADDS NPN_PostURLUPP)(NPP instance, const char* url, cons
/* NPN_RequestRead */
#if GENERATINGCFM
#if TARGET_RT_MAC_CFM
typedef UniversalProcPtr NPN_RequestReadUPP;
enum {
@ -669,7 +669,7 @@ typedef NPError (* NP_LOADDS NPN_RequestReadUPP)(NPStream* stream, NPByteRange*
/* NPN_NewStream */
#if GENERATINGCFM
#if TARGET_RT_MAC_CFM
typedef UniversalProcPtr NPN_NewStreamUPP;
enum {
@ -698,7 +698,7 @@ typedef NPError (* NP_LOADDS NPN_NewStreamUPP)(NPP instance, NPMIMEType type, co
/* NPN_Write */
#if GENERATINGCFM
#if TARGET_RT_MAC_CFM
typedef UniversalProcPtr NPN_WriteUPP;
enum {
@ -727,7 +727,7 @@ typedef int32 (* NP_LOADDS NPN_WriteUPP)(NPP instance, NPStream* stream, int32 l
/* NPN_DestroyStream */
#if GENERATINGCFM
#if TARGET_RT_MAC_CFM
typedef UniversalProcPtr NPN_DestroyStreamUPP;
enum {
@ -755,7 +755,7 @@ typedef NPError (* NP_LOADDS NPN_DestroyStreamUPP)(NPP instance, NPStream* strea
/* NPN_Status */
#if GENERATINGCFM
#if TARGET_RT_MAC_CFM
typedef UniversalProcPtr NPN_StatusUPP;
enum {
@ -781,7 +781,7 @@ typedef void (* NP_LOADDS NPN_StatusUPP)(NPP instance, const char* message);
/* NPN_UserAgent */
#if GENERATINGCFM
#if TARGET_RT_MAC_CFM
typedef UniversalProcPtr NPN_UserAgentUPP;
enum {
@ -807,7 +807,7 @@ typedef const char* (* NP_LOADDS NPN_UserAgentUPP)(NPP instance);
/* NPN_MemAlloc */
#if GENERATINGCFM
#if TARGET_RT_MAC_CFM
typedef UniversalProcPtr NPN_MemAllocUPP;
enum {
@ -834,7 +834,7 @@ typedef void* (* NP_LOADDS NPN_MemAllocUPP)(uint32 size);
/* NPN__MemFree */
#if GENERATINGCFM
#if TARGET_RT_MAC_CFM
typedef UniversalProcPtr NPN_MemFreeUPP;
enum {
@ -860,7 +860,7 @@ typedef void (* NP_LOADDS NPN_MemFreeUPP)(void* ptr);
/* NPN_MemFlush */
#if GENERATINGCFM
#if TARGET_RT_MAC_CFM
typedef UniversalProcPtr NPN_MemFlushUPP;
enum {
@ -888,7 +888,7 @@ typedef uint32 (* NP_LOADDS NPN_MemFlushUPP)(uint32 size);
/* NPN_ReloadPlugins */
#if GENERATINGCFM
#if TARGET_RT_MAC_CFM
typedef UniversalProcPtr NPN_ReloadPluginsUPP;
enum {
@ -915,7 +915,7 @@ typedef void (* NP_LOADDS NPN_ReloadPluginsUPP)(NPBool reloadPages);
/* NPN_GetJavaEnv */
#if GENERATINGCFM
#if TARGET_RT_MAC_CFM
typedef UniversalProcPtr NPN_GetJavaEnvUPP;
enum {
@ -940,7 +940,7 @@ typedef JRIEnv* (* NP_LOADDS NPN_GetJavaEnvUPP)(void);
/* NPN_GetJavaPeer */
#if GENERATINGCFM
#if TARGET_RT_MAC_CFM
typedef UniversalProcPtr NPN_GetJavaPeerUPP;
enum {
@ -967,7 +967,7 @@ typedef jref (* NP_LOADDS NPN_GetJavaPeerUPP)(NPP instance);
/* NPN_InvalidateRect */
#if GENERATINGCFM
#if TARGET_RT_MAC_CFM
typedef UniversalProcPtr NPN_InvalidateRectUPP;
enum {
@ -995,7 +995,7 @@ typedef void (* NP_LOADDS NPN_InvalidateRectUPP)(NPP instance, NPRect *rect);
/* NPN_InvalidateRegion */
#if GENERATINGCFM
#if TARGET_RT_MAC_CFM
typedef UniversalProcPtr NPN_InvalidateRegionUPP;
enum {
@ -1022,7 +1022,7 @@ typedef void (* NP_LOADDS NPN_InvalidateRegionUPP)(NPP instance, NPRegion region
/* NPN_ForceRedraw */
#if GENERATINGCFM
#if TARGET_RT_MAC_CFM
typedef UniversalProcPtr NPN_ForceRedrawUPP;
enum {
@ -1052,7 +1052,7 @@ typedef void (* NP_LOADDS NPN_ForceRedrawUPP)(NPP instance);
*******************************************************************************************/
#ifdef XP_MAC
#if PRAGMA_ALIGN_SUPPORTED
#if PRAGMA_STRUCT_ALIGN
#pragma options align=mac68k
#endif
#endif
@ -1103,7 +1103,7 @@ typedef struct _NPNetscapeFuncs {
} NPNetscapeFuncs;
#ifdef XP_MAC
#if PRAGMA_ALIGN_SUPPORTED
#if PRAGMA_STRUCT_ALIGN
#pragma options align=reset
#endif
#endif
@ -1121,7 +1121,7 @@ typedef struct _NPNetscapeFuncs {
* and NPPShutdownUPP for Netscape's use.
*/
#if GENERATINGCFM
#if TARGET_RT_MAC_CFM
typedef UniversalProcPtr NPP_MainEntryUPP;
enum {

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

@ -304,7 +304,7 @@ ns4xPlugin::CreatePlugin(nsPluginTag* pluginTag, nsIServiceManager* serviceMgr)
return NS_ERROR_UNEXPECTED;
#endif
#ifdef XP_MAC
#if defined(XP_MAC) && !TARGET_CARBON
// get the mainRD entry point
NP_MAIN pfnMain = (NP_MAIN) PR_FindSymbol(pluginTag->mLibrary, "mainRD");
if(pfnMain == NULL)
@ -426,8 +426,10 @@ ns4xPlugin::Shutdown(void)
printf("shutting down plugin %08x\n",(int)this);
#endif
#ifdef XP_MAC
#if !TARGET_CARBON
CallNPP_ShutdownProc(fShutdownEntry);
::CloseResFile(fPluginRefNum);
#endif
#else
fShutdownEntry();
#endif

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

@ -304,7 +304,7 @@ ns4xPlugin::CreatePlugin(nsPluginTag* pluginTag, nsIServiceManager* serviceMgr)
return NS_ERROR_UNEXPECTED;
#endif
#ifdef XP_MAC
#if defined(XP_MAC) && !TARGET_CARBON
// get the mainRD entry point
NP_MAIN pfnMain = (NP_MAIN) PR_FindSymbol(pluginTag->mLibrary, "mainRD");
if(pfnMain == NULL)
@ -426,8 +426,10 @@ ns4xPlugin::Shutdown(void)
printf("shutting down plugin %08x\n",(int)this);
#endif
#ifdef XP_MAC
#if !TARGET_CARBON
CallNPP_ShutdownProc(fShutdownEntry);
::CloseResFile(fPluginRefNum);
#endif
#else
fShutdownEntry();
#endif

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

@ -54,18 +54,15 @@ static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
#include "pprthred.h"
#if TARGET_CARBON
#define nsDNS_NOTIFIER_ROUTINE nsDnsServiceNotifierRoutineUPP
#define INIT_OPEN_TRANSPORT() InitOpenTransport(mClientContext, kInitOTForExtensionMask)
#define OT_OPEN_INTERNET_SERVICES(config, flags, err) OTOpenInternetServices(config, flags, err, mClientContext)
#define OT_OPEN_ENDPOINT(config, flags, info, err) OTOpenEndpoint(config, flags, info, err, mClientContext)
#define INIT_OPEN_TRANSPORT() InitOpenTransportInContext(kInitOTForExtensionMask, &mClientContext)
#define OT_OPEN_INTERNET_SERVICES(config, flags, err) OTOpenInternetServicesInContext(config, flags, err, mClientContext)
#define OT_OPEN_ENDPOINT(config, flags, info, err) OTOpenEndpointInContext(config, flags, info, err, mClientContext)
#define CLOSE_OPEN_TRANSPORT() do { if (mClientContext) CloseOpenTransportInContext(mClientContext); } while (0)
#else
#define nsDNS_NOTIFIER_ROUTINE nsDnsServiceNotifierRoutine
#define INIT_OPEN_TRANSPORT() InitOpenTransport()
#define OT_OPEN_INTERNET_SERVICES(config, flags, err) OTOpenInternetServices(config, flags, err)
#define OT_OPEN_ENDPOINT(config, flags, info, err) OTOpenEndpoint(config, flags, info, err)
#define CLOSE_OPEN_TRANSPORT() CloseOpenTransport()
#endif /* TARGET_CARBON */
typedef struct nsInetHostInfo {
@ -907,13 +904,8 @@ nsDNSService::LateInit()
// create Open Transport Service Provider for DNS Lookups
OSStatus errOT;
#if TARGET_CARBON
nsDnsServiceNotifierRoutineUPP = NewOTNotifyUPP(nsDnsServiceNotifierRoutine);
errOT = OTAllocClientContext((UInt32)0, &clientContext);
NS_ASSERTION(err == kOTNoError, "error allocating OTClientContext.");
#endif /* TARGET_CARBON */
errOT = INIT_OPEN_TRANSPORT();
NS_ASSERTION(errOT == kOTNoError, "InitOpenTransport failed.");
@ -922,7 +914,7 @@ nsDNSService::LateInit()
NS_ASSERTION((mServiceRef != NULL) && (errOT == kOTNoError), "error opening OT service.");
/* Install notify function for DNR Address To String completion */
errOT = OTInstallNotifier(mServiceRef, nsDNS_NOTIFIER_ROUTINE, this);
errOT = OTInstallNotifier(mServiceRef, nsDnsServiceNotifierRoutineUPP, this);
NS_ASSERTION(errOT == kOTNoError, "error installing dns notification routine.");
/* Put us into async mode */
@ -1218,7 +1210,7 @@ nsDNSService::Shutdown()
// let's shutdown Open Transport so outstanding lookups won't complete while we're cleaning them up
(void) OTCloseProvider((ProviderRef)mServiceRef);
CloseOpenTransport(); // terminate routine should check flag and do this if Shutdown() is bypassed somehow
CLOSE_OPEN_TRANSPORT(); // terminate routine should check flag and do this if Shutdown() is bypassed somehow
PRThread* dnsServiceThread;
rv = mThread->GetPRThread(&dnsServiceThread);

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

@ -84,8 +84,8 @@ protected:
QHdr mCompletionQueue;
#if TARGET_CARBON
OTClientContextPtr mClientContext;
OTNotifyUPP nsDnsServiceNotifierRoutineUPP;
#endif /* TARGET_CARBON */
OTNotifyUPP nsDnsServiceNotifierRoutineUPP;
#endif /* XP_MAC */
#if defined(XP_PC) && !defined(XP_OS2)

Двоичные данные
netwerk/macbuild/netwerk.mcp

Двоичный файл не отображается.

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

@ -141,7 +141,7 @@
# if !__option(enumsalwaysint)
# error You need to define 'Enums Always Int' for your project.
# endif
# if defined(GENERATING68K) && !GENERATINGCFM
# if defined(TARGET_CPU_68K) && !TARGET_RT_MAC_CFM
# if !__option(fourbyteints)
# error You need to define 'Struct Alignment: 68k' for your project.
# endif

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

@ -119,7 +119,7 @@ extern "C" {
# if !__option(enumsalwaysint)
# error You need to define 'Enums Always Int' for your project.
# endif
# if defined(GENERATING68K) && !GENERATINGCFM
# if defined(TARGET_CPU_68K) && !TARGET_RT_MAC_CFM
# if !__option(fourbyteints)
# error You need to define 'Struct Alignment: 68k' for your project.
# endif

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

@ -50,7 +50,7 @@ ICInstance nsInternetConfig::GetInstance()
{
if ( !sInstance )
{
ICError err;
OSStatus err;
if ((long)ICStart == kUnresolvedCFragSymbolAddress )
return sInstance;
@ -63,7 +63,9 @@ ICInstance nsInternetConfig::GetInstance()
}
else
{
#if !TARGET_CARBON
::ICFindConfigFile( sInstance, 0 , nil );
#endif
::ICGetSeed( sInstance, &sSeed );
}
}
@ -108,7 +110,7 @@ nsresult nsInternetConfig::GetString( unsigned char* inKey, char** outString )
ICInstance instance = nsInternetConfig::GetInstance();
if ( instance )
{
ICError err;
OSStatus err;
char buffer[256];
ICAttr junk;
long size = 256;

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

@ -60,7 +60,9 @@ nsresult nsExternalProtocol::DefaultLaunch( nsIURI *pUri)
err = ICStart(&inst, 'MOSS');
if (err == noErr) {
#if !TARGET_CARBON
err = ICFindConfigFile( inst, 0, nil);
#endif
if (err == noErr) {
startSel = 0;
err = ICLaunchURL(inst, "\p", (char *)((const char *) uriStr), endSel, &startSel, &endSel);

Двоичные данные
webshell/tests/viewer/mac/viewer.rsrc

Двоичный файл не отображается.

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

@ -37,10 +37,8 @@
#include <Dialogs.h>
#include "nsMacMessagePump.h" // for the windowless menu event handler
#if !TARGET_CARBON
#include "nsILeakDetector.h"
#include "macstdlibextras.h"
#endif
typedef SInt32 MessageT;
typedef PRUint32 Uint32;
@ -356,11 +354,9 @@ nsNativeBrowserWindow::DispatchMenuItem(PRInt32 aID)
case cmd_DumpLeaks:
{
nsresult rv;
#if !TARGET_CARBON
NS_WITH_SERVICE(nsILeakDetector, leakDetector, "component://netscape/xpcom/leakdetector", &rv)
if (NS_SUCCEEDED(rv))
leakDetector->DumpLeaks();
#endif
}
break;
case cmd_GFXScrollBars: xpID =VIEWER_GFX_SCROLLBARS_ON; break;
@ -431,9 +427,7 @@ static pascal OSErr handleQuitApplication(const AppleEvent*, AppleEvent*, UInt32
int main(int argc, char **argv)
{
// Set up the toolbox and (if DEBUG) the console
#if !TARGET_CARBON
InitializeMacToolbox();
#endif
// Install an a Quit AppleEvent handler.
OSErr err = AEInstallEventHandler(kCoreEventClass, kAEQuitApplication,

Двоичные данные
widget/macbuild/widget.mcp

Двоичный файл не отображается.

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

@ -37,6 +37,8 @@
#include <memory>
using std::auto_ptr;
class nsMacMessagePump;
class nsMacMessageSink;
class nsIToolkit;

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

@ -43,6 +43,7 @@
#include "nsISupportsPrimitives.h"
#include "nsXPIDLString.h"
#include "nsPrimitiveHelpers.h"
#include "nsMemory.h"
#include <Scrap.h>
@ -213,9 +214,10 @@ nsClipboard :: GetNativeClipboardData ( nsITransferable * aTransferable, PRInt32
// create a mime mapper. It's ok for this to fail because the data may come from
// another app which obviously wouldn't put our mime mapping data on the clipboard.
char* mimeMapperData = nsnull;
GetDataOffClipboard ( nsMimeMapperMac::MappingFlavor(), (void**)&mimeMapperData, 0 );
errCode = GetDataOffClipboard ( nsMimeMapperMac::MappingFlavor(), (void**)&mimeMapperData, 0 );
nsMimeMapperMac theMapper ( mimeMapperData );
nsCRT::free ( mimeMapperData );
if (mimeMapperData)
nsCRT::free ( mimeMapperData );
// Now walk down the list of flavors. When we find one that is actually on the
// clipboard, copy out the data into the transferable in that format. SetTransferData()
@ -295,6 +297,11 @@ nsClipboard :: GetDataOffClipboard ( ResType inMacFlavor, void** outData, PRInt3
if ( !outData || !inMacFlavor )
return NS_ERROR_FAILURE;
// set up default results.
*outData = nsnull;
if ( outDataSize )
*outDataSize = 0;
// check if it is on the clipboard
long offsetUnused = 0;
@ -306,9 +313,10 @@ nsClipboard :: GetDataOffClipboard ( ResType inMacFlavor, void** outData, PRInt3
err = ::GetCurrentScrap(&scrap);
if (err != noErr) return NS_ERROR_FAILURE;
err = ::GetScrapFlavorSize(scrap, inMacFlavor, &dataSize);
if (err != noErr) return NS_ERROR_FAILURE;
// check err??
if (dataSize > 0) {
char* dataBuff = new char[dataSize];
char* dataBuff = (char*) nsMemory::Alloc(dataSize);
if ( !dataBuff )
return NS_ERROR_OUT_OF_MEMORY;
err = ::GetScrapFlavorData(scrap, inMacFlavor, &dataSize, dataBuff);
@ -370,6 +378,7 @@ nsClipboard :: GetDataOffClipboard ( ResType inMacFlavor, void** outData, PRInt3
NS_IMETHODIMP
nsClipboard :: HasDataMatchingFlavors ( nsISupportsArray* aFlavorList, PRInt32 aWhichClipboard, PRBool * outResult )
{
nsresult rv = NS_OK;
*outResult = PR_FALSE; // assume there is nothing there we want.
if ( aWhichClipboard != kGlobalClipboard )
return NS_OK;
@ -377,7 +386,7 @@ nsClipboard :: HasDataMatchingFlavors ( nsISupportsArray* aFlavorList, PRInt32 a
// create a mime mapper. It's ok for this to fail because the data may come from
// another app which obviously wouldn't put our mime mapping data on the clipboard.
char* mimeMapperData = nsnull;
GetDataOffClipboard ( nsMimeMapperMac::MappingFlavor(), (void**)&mimeMapperData, 0 );
rv = GetDataOffClipboard ( nsMimeMapperMac::MappingFlavor(), (void**)&mimeMapperData, 0 );
nsMimeMapperMac theMapper ( mimeMapperData );
nsMemory::Free ( mimeMapperData );

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

@ -257,11 +257,13 @@ pascal void nsDynamicMDEFMain(
// Force a size message next time we draw this menu
if(message == kMenuDrawMsg) {
#if !TARGET_CARBON
SInt8 state = ::HGetState((Handle)theMenu);
HLock((Handle)theMenu);
(**theMenu).menuWidth = -1;
(**theMenu).menuHeight = -1;
HSetState((Handle)theMenu, state);
#endif
}
}
@ -461,6 +463,7 @@ void nsCallSystemMDEF(
Point hitPt,
short * whichItem)
{
#if !TARGET_CARBON
SInt8 state = ::HGetState(gSystemMDEFHandle);
::HLock(gSystemMDEFHandle);
@ -476,7 +479,7 @@ void nsCallSystemMDEF(
::DisposeRoutineDescriptor(gmdefUPP);
::HSetState(gSystemMDEFHandle, state);
#endif
return;
}

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

@ -166,16 +166,18 @@ NS_IMETHODIMP nsFilePicker::Show(PRInt16 *retval)
//-------------------------------------------------------------------------
static pascal void FileDialogEventHandlerProc( NavEventCallbackMessage msg, NavCBRecPtr cbRec, NavCallBackUserData data )
{
WindowPtr window = reinterpret_cast<WindowPtr>(cbRec->eventData.eventDataParms.event->message);
switch ( msg ) {
case kNavCBEvent:
switch ( cbRec->eventData.eventDataParms.event->what ) {
case updateEvt:
::BeginUpdate(window);
::EndUpdate(window);
break;
}
case kNavCBEvent:
switch ( cbRec->eventData.eventDataParms.event->what ) {
case updateEvt:
WindowPtr window = reinterpret_cast<WindowPtr>(cbRec->eventData.eventDataParms.event->message);
if (window) {
::BeginUpdate(window);
::EndUpdate(window);
}
break;
}
break;
}
}

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

@ -203,19 +203,20 @@ PRBool nsFileWidget::Show()
// this doesn't seem to work as of yet...I'll play around with it some more.
//
//-------------------------------------------------------------------------
pascal void myProc ( NavEventCallbackMessage msg, NavCBRecPtr cbRec, NavCallBackUserData data ) ;
pascal void myProc ( NavEventCallbackMessage msg, NavCBRecPtr cbRec, NavCallBackUserData data )
static pascal void myProc ( NavEventCallbackMessage msg, NavCBRecPtr cbRec, NavCallBackUserData data )
{
WindowPtr window = reinterpret_cast<WindowPtr>(cbRec->eventData.eventDataParms.event->message);
switch ( msg ) {
case kNavCBEvent:
switch ( cbRec->eventData.eventDataParms.event->what ) {
case updateEvt:
::BeginUpdate(window);
::EndUpdate(window);
break;
case kNavCBEvent:
switch ( cbRec->eventData.eventDataParms.event->what ) {
case updateEvt:
WindowPtr window = reinterpret_cast<WindowPtr>(cbRec->eventData.eventDataParms.event->message);
if (window) {
::BeginUpdate(window);
::EndUpdate(window);
}
break;
}
break;
}
}

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

@ -1363,7 +1363,7 @@ void nsMacEventHandler::ConvertOSEventToMouseEvent(
// now look to see if we want to convert this to a double- or triple-click
const short kDoubleClickMoveThreshold = 5;
if (((aOSEvent.when - sLastMouseUp) < ::LMGetDoubleTime()) &&
if (((aOSEvent.when - sLastMouseUp) < ::GetDblTime()) &&
(((abs(aOSEvent.where.h - sLastWhere.h) < kDoubleClickMoveThreshold) &&
(abs(aOSEvent.where.v - sLastWhere.v) < kDoubleClickMoveThreshold))))
{

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

@ -73,11 +73,9 @@
#endif
#if DEBUG
#if !TARGET_CARBON
#include <SIOUX.h>
#include "macstdlibextras.h"
#endif
#endif
#define DRAW_ON_RESIZE 0 // if 1, enable live-resize except when the command key is down
@ -319,7 +317,7 @@ PRBool nsMacMessagePump::GetEvent(EventRecord &theEvent)
SInt32 sleepTime = (havePendingEvent || BrowserIsBusy()) ? 0 : 2;
::LMSetSysEvtMask(everyEvent); // we need keyUp events
::SetEventMask(everyEvent); // we need keyUp events
PRBool haveEvent = ::WaitNextEvent(everyEvent, &theEvent, sleepTime, mMouseRgn);
sNextWNECall = ::TickCount() + kWNECallIntervalTicks;
@ -343,10 +341,8 @@ void nsMacMessagePump::DispatchEvent(PRBool aRealEvent, EventRecord *anEvent)
{
#if DEBUG
#if !TARGET_CARBON
if ((anEvent->what != kHighLevelEvent) && SIOUXHandleOneEvent(anEvent))
return;
#endif
#endif
switch(anEvent->what)
@ -556,8 +552,9 @@ void nsMacMessagePump::DoMouseDown(EventRecord &anEvent)
::SizeWindow(whichWindow, width, height, true);
::DrawGrowIcon(whichWindow);
anEvent.where.h = width; // simulate a click in the grow icon
anEvent.where.v = height;
// simulate a click in the grow icon
anEvent.where.h = width - 8; // on Aqua, clicking at (width, height) misses the grow icon. inset a bit.
anEvent.where.v = height - 8;
::LocalToGlobal(&anEvent.where);
DispatchOSEventToRaptor(anEvent, whichWindow);
@ -589,6 +586,7 @@ void nsMacMessagePump::DoMouseDown(EventRecord &anEvent)
Rect portRect;
Point newPt = botRight(*::GetWindowPortBounds(whichWindow, &portRect));
::LocalToGlobal(&newPt);
newPt.h -= 8, newPt.v -= 8;
anEvent.where = newPt; // important!
DispatchOSEventToRaptor(anEvent, whichWindow);
}
@ -766,6 +764,7 @@ void nsMacMessagePump::DoKey(EventRecord &anEvent)
//-------------------------------------------------------------------------
void nsMacMessagePump::DoDisk(const EventRecord& anEvent)
{
#if !TARGET_CARBON
if (HiWord(anEvent.message) != noErr)
{
// Error mounting disk. Ask if user wishes to format it.
@ -774,6 +773,7 @@ void nsMacMessagePump::DoDisk(const EventRecord& anEvent)
::DIBadMount(pt, (SInt32) anEvent.message);
::DIUnload();
}
#endif
}

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

@ -27,6 +27,8 @@
#include <map>
using std::map;
#include <Events.h>
#include <Windows.h>

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

@ -27,7 +27,6 @@
short nsMacResources::mRefNum = kResFileNotOpened;
short nsMacResources::mSaveResFile = 0;
#if !TARGET_CARBON
pascal OSErr __NSInitialize(const CFragInitBlock *theInitBlock);
pascal OSErr __initializeResources(const CFragInitBlock *theInitBlock);
@ -63,8 +62,6 @@ pascal void __terminateResources(void)
__NSTerminate();
}
#endif
//----------------------------------------------------------------------------------------
//
//----------------------------------------------------------------------------------------

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

@ -357,6 +357,7 @@ nsresult nsMacWindow::StandardCreate(nsIWidget *aParent,
break;
case eWindowType_dialog:
#if !TARGET_CARBON
if (aInitData &&
aInitData->mBorderStyle != eBorderStyle_all &&
aInitData->mBorderStyle != eBorderStyle_default &&
@ -372,6 +373,7 @@ nsresult nsMacWindow::StandardCreate(nsIWidget *aParent,
hOffset = kDialogMarginWidth;
vOffset = kDialogTitleBarHeight;
break;
#endif
case eWindowType_toplevel:
if (aInitData &&
@ -408,6 +410,12 @@ nsresult nsMacWindow::StandardCreate(nsIWidget *aParent,
Rect wRect;
nsRectToMacRect(aRect, wRect);
#if TARGET_CARBON
// enforce some minimums on carbon. otherwise the system hangs.
if (aRect.width < 100) wRect.right = wRect.left + 100;
if (aRect.height < 100) wRect.bottom = wRect.top + 100;
#endif
#ifdef WINDOW_SIZE_TWEAKING
// see also the Resize method
@ -510,8 +518,9 @@ NS_IMETHODIMP nsMacWindow::Show(PRBool bState)
if ( mAcceptsActivation )
::ShowWindow(mWindowPtr);
else {
::BringToFront(mWindowPtr); // competes with ComeToFront, but makes popups work
::ShowHide(mWindowPtr, true);
::BringToFront(mWindowPtr); // competes with ComeToFront, but makes popups work
//::SendBehind(::FrontWindow(), mWindowPtr);
}
ComeToFront();
}
@ -679,8 +688,7 @@ void nsMacWindow::MoveToGlobalPoint(PRInt32 aX, PRInt32 aY)
//-------------------------------------------------------------------------
NS_IMETHODIMP nsMacWindow::Resize(PRInt32 aWidth, PRInt32 aHeight, PRBool aRepaint)
{
if (mWindowMadeHere)
{
if (mWindowMadeHere) {
// Sanity check against screen size
Rect screenRect;
::GetRegionBounds(::GetGrayRgn(), &screenRect);

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

@ -24,6 +24,8 @@
#include <memory> // for auto_ptr
using std::auto_ptr;
#include "nsWindow.h"
#include "nsMacEventHandler.h"

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

@ -387,7 +387,7 @@ nsMenuBar::MenuConstruct( const nsMenuEvent & aMenuEvent, nsIWidget* aParentWind
if(menuIDstring.EqualsWithConversion("menu_Help")) {
nsMenuEvent event;
MenuHandle handle;
#ifndef RHAPSODY
#if !(defined(RHAPSODY) || defined(TARGET_CARBON))
::HMGetHelpMenuHandle(&handle);
#endif
event.mCommand = (unsigned int) handle;

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

@ -32,17 +32,11 @@
#include "nsString.h"
nsMimeMapperMac :: nsMimeMapperMac ( )
: mCounter(0)
{
}
nsMimeMapperMac :: nsMimeMapperMac ( const char* inMappings )
: mCounter(0)
{
if ( strlen(inMappings) )
if (inMappings && strlen(inMappings) )
ParseMappings ( inMappings );
}

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

@ -50,18 +50,19 @@
#ifndef nsMimeMapper_h__
#define nsMimeMapper_h__
#include <utility>
#include <vector>
#include <Types.h>
#include "nsString.h"
using std::pair;
class nsMimeMapperMac
{
public:
enum { kMappingFlavor = 'MOZm' } ;
nsMimeMapperMac ( ) ;
nsMimeMapperMac ( const char* inMappings ) ;
nsMimeMapperMac ( const char* inMappings = nsnull ) ;
~nsMimeMapperMac ( ) ;
// Converts from mime type (eg: text/plain) to MacOS type (eg: 'TEXT'). If

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

@ -25,6 +25,8 @@
#include <Appearance.h>
#include <memory>
using std::auto_ptr;
#if TARGET_CARBON || (UNIVERSAL_INTERFACES_VERSION >= 0x0330)
#include <ControlDefinitions.h>
#endif

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

@ -1101,13 +1101,9 @@ NS_IMETHODIMP nsWindow::Update()
static Boolean control_key_down()
{
#if TARGET_CARBON
return PR_FALSE;
#else
EventRecord event;
::OSEventAvail(0, &event);
::EventAvail(0, &event);
return (event.modifiers & controlKey) != 0;
#endif
}
static long long microseconds()
@ -1164,11 +1160,11 @@ OSStatus
nsWindow :: CountUpdateRectProc (UInt16 message, RgnHandle rgn, const Rect *inDirtyRect, void *refCon)
{
NS_ASSERTION ( refCon, "You better pass a counter!" );
(*NS_REINTERPRET_CAST(long*, refCon))++; // increment
return noErr;
}
#else
#endif
//
// UpdateRect
@ -1216,10 +1212,6 @@ nsWindow :: CountUpdateRect (Rect *inDirtyRect, void* inData)
} // CountUpdateRects
#endif
//-------------------------------------------------------------------------
// HandleUpdateEvent
//
@ -1277,17 +1269,17 @@ nsresult nsWindow::HandleUpdateEvent()
// Iterate over each rect in the region, sending a paint event for each. Carbon
// has a routine for this, pre-carbon doesn't so we roll our own. If the region
// is very complicated (more than 10 pieces), just use a bounding box.
#if TARGET_CARBON
long count = 0;
QDRegionToRects ( updateRgn, kQDParseRegionFromTop, sCountRectProc, this );
if ( count < 10 )
QDRegionToRects ( updateRgn, kQDParseRegionFromTop, sUpdateRectProc, this );
else {
Rect boundingBox;
::GetRegionBounds(updateRgn, &boundingBox);
PaintUpdateRegionRects ( &boundingBox, this );
}
#else
#if TARGET_CARBON
long count = 0;
QDRegionToRects ( updateRgn, kQDParseRegionFromTop, sCountRectProc, &count );
if ( count > 0 && count < 10 )
QDRegionToRects ( updateRgn, kQDParseRegionFromTop, sUpdateRectProc, this );
else {
Rect boundingBox;
::GetRegionBounds(updateRgn, &boundingBox);
PaintUpdateRect ( &boundingBox, this );
}
#else
long count = 0;
EachRegionRect ( updateRgn, CountUpdateRect, &count );
if ( count < 10 )

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

@ -219,10 +219,10 @@ protected:
#if TARGET_CARBON
static OSStatus PaintUpdateRectProc (UInt16 message, RgnHandle rgn, const Rect *rect, void *refCon);
static OSStatus CountUpdateRectProc (UInt16 message, RgnHandle rgn, const Rect *rect, void *refCon);
#else
#endif
static void PaintUpdateRect (Rect * r, void* data) ;
static void CountUpdateRect (Rect * r, void* data) ;
#endif
};

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

@ -104,7 +104,7 @@
Str255 buffer;
va_start(ap, format);
buffer[0] = vsnprintf((char *)buffer + 1, sizeof(buffer) - 1, format, ap);
buffer[0] = std::vsnprintf((char *)buffer + 1, sizeof(buffer) - 1, format, ap);
va_end(ap);
if (PL_strcasestr((char *)&buffer[1], "warning"))
printf("¥¥¥%s\n", (char*)buffer + 1);

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

@ -104,7 +104,7 @@
Str255 buffer;
va_start(ap, format);
buffer[0] = vsnprintf((char *)buffer + 1, sizeof(buffer) - 1, format, ap);
buffer[0] = std::vsnprintf((char *)buffer + 1, sizeof(buffer) - 1, format, ap);
va_end(ap);
if (PL_strcasestr((char *)&buffer[1], "warning"))
printf("¥¥¥%s\n", (char*)buffer + 1);

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

@ -95,7 +95,7 @@ enum
** stack space used when recursively calling CopyLevel and to hold
** global information that might be needed at any time. */
#if PRAGMA_ALIGN_SUPPORTED
#if PRAGMA_STRUCT_ALIGN
#pragma options align=mac68k
#endif
struct EnumerateGlobals
@ -110,7 +110,7 @@ struct EnumerateGlobals
Str63 itemName; /* the name of the current item */
CInfoPBRec myCPB; /* the parameter block used for PBGetCatInfo calls */
};
#if PRAGMA_ALIGN_SUPPORTED
#if PRAGMA_STRUCT_ALIGN
#pragma options align=reset
#endif
@ -122,7 +122,7 @@ typedef EnumerateGlobals *EnumerateGlobalsPtr;
** stack space used when recursively calling GetLevelSize and to hold
** global information that might be needed at any time. */
#if PRAGMA_ALIGN_SUPPORTED
#if PRAGMA_STRUCT_ALIGN
#pragma options align=mac68k
#endif
struct PreflightGlobals
@ -138,7 +138,7 @@ struct PreflightGlobals
unsigned long tempBlocks; /* temporary storage for calculations (save some stack space) */
CopyFilterProcPtr copyFilterProc; /* pointer to filter function */
};
#if PRAGMA_ALIGN_SUPPORTED
#if PRAGMA_STRUCT_ALIGN
#pragma options align=reset
#endif

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

@ -364,7 +364,7 @@ NS_IMETHODIMP FileImpl::Write(const char* aBuf, PRUint32 aCount, PRUint32 *aWrit
// Calling PR_Write on stdout is sure suicide.
if (mFileDesc == PR_STDOUT || mFileDesc == PR_STDERR)
{
cout.write(aBuf, aCount);
std::cout.write(aBuf, aCount);
*aWriteCount = aCount;
return NS_OK;
}
@ -452,7 +452,7 @@ NS_IMETHODIMP FileImpl::Flush()
#ifdef XP_MAC
if (mFileDesc == PR_STDOUT || mFileDesc == PR_STDERR)
{
cout.flush();
std::cout.flush();
return NS_OK;
}
#endif

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

@ -53,6 +53,8 @@
#include <Folders.h>
#include "macDirectoryCopy.h"
#include <limits.h>
// Stupid @#$% header looks like its got extern mojo but it doesn't really
extern "C"
{
@ -301,14 +303,15 @@ static OSErr FindAppOnVolume (OSType sig, short vRefNum, FSSpec *file)
static OSErr GetIndVolume(short index, short *vRefNum)
{
ParamBlockRec pb;
HParamBlockRec pb;
Str63 volumeName;
OSErr err = noErr;
pb.volumeParam.ioCompletion = nil;
pb.volumeParam.ioNamePtr = nil;
pb.volumeParam.ioNamePtr = volumeName;
pb.volumeParam.ioVolIndex = index;
err = PBGetVInfoSync(&pb);
err = PBHGetVInfoSync(&pb);
*vRefNum = pb.volumeParam.ioVRefNum;
return err;
@ -2297,10 +2300,14 @@ nsresult nsLocalFile::MyLaunchAppWithDoc(const FSSpec& appSpec, const FSSpec* aD
err = AECoerceDesc(&theEvent, typeAppParameters, &launchDesc);
if (err != noErr) return NS_ERROR_FAILURE;
::HLock(theEvent.dataHandle);
launchThis.launchAppSpec = (FSSpecPtr)&appSpec;
launchThis.launchAppParameters = (AppParametersPtr)*launchDesc.dataHandle;
#if TARGET_CARBON && ACCESSOR_CALLS_ARE_FUNCTIONS
::AEGetDescData(&launchDesc, &launchThis.launchAppParameters, sizeof(launchThis.launchAppParameters));
#else
// no need to lock this handle.
AppParameters appParameters = *(AppParametersPtr)*launchDesc.dataHandle;
launchThis.launchAppParameters = &appParameters;
#endif
launchThis.launchBlockID = extendedBlock;
launchThis.launchEPBLength = extendedBlockLen;
launchThis.launchFileFlags = 0;

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

@ -50,7 +50,7 @@ ICInstance nsInternetConfig::GetInstance()
{
if ( !sInstance )
{
ICError err;
OSStatus err;
if ((long)ICStart == kUnresolvedCFragSymbolAddress )
return sInstance;
@ -63,7 +63,9 @@ ICInstance nsInternetConfig::GetInstance()
}
else
{
#if !TARGET_CARBON
::ICFindConfigFile( sInstance, 0 , nil );
#endif
::ICGetSeed( sInstance, &sSeed );
}
}
@ -108,7 +110,7 @@ nsresult nsInternetConfig::GetString( unsigned char* inKey, char** outString )
ICInstance instance = nsInternetConfig::GetInstance();
if ( instance )
{
ICError err;
OSStatus err;
char buffer[256];
ICAttr junk;
long size = 256;

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

@ -115,7 +115,7 @@ static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
#include "nsIDOMXULDocument.h"
// End hack
#if defined(XP_MAC) || defined(RHAPSODY)
#if (defined(XP_MAC) && !TARGET_CARBON) || defined(RHAPSODY)
#define USE_NATIVE_MENUS
#endif

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

@ -576,6 +576,7 @@ void AEApplicationClass::GetDataFromObject(const AEDesc *token, AEDesc *desiredT
break;
case pClipboard:
#if !TARGET_CARBON
{
// Return all of the items currently on the clipboard.
// The returned information is an AEList, and each data type
@ -627,7 +628,8 @@ void AEApplicationClass::GetDataFromObject(const AEDesc *token, AEDesc *desiredT
scrapPtr += itemLength;
}
HUnlock (scrapInfo->scrapHandle);
}
}
#endif
break;
default:
@ -667,7 +669,7 @@ void AEApplicationClass::SetDataForObject(const AEDesc *token, AEDesc *data)
case pClipboard:
// The data should be an AE list containing a series of things to be placed on the
// clipboard. The data type of each item is also the clipboard type for that data
#if !TARGET_CARBON
err = ZeroScrap();
ThrowIfOSErr(err);
@ -687,6 +689,7 @@ void AEApplicationClass::SetDataForObject(const AEDesc *token, AEDesc *data)
*currentItemDesc.dataHandle);
ThrowIfOSErr(err);
}
#endif
break;
default:

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

@ -213,7 +213,7 @@ AEDispatchHandler* AEDispatchTree::FindHandler(DescType handlerClass)
*(DescType *)key = handlerClass;
(void)PatriciaSearch(mTree, key, &foundClass);
(void)PatriciaSearch(mTree, key, (void**)&foundClass);
return foundClass;
}

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

@ -43,11 +43,12 @@ AECoercionHandlers::AECoercionHandlers()
{
OSErr err;
// XXX: Note inconsistent type between NewAECoerceDescProc and AEInstallCoercionHandler. Buggy headers when using Carbon?
mTextDescToPascalString = NewAECoerceDescProc(TextToPascalStringCoercion);
ThrowIfNil(mTextDescToPascalString);
err = ::AEInstallCoercionHandler(typeChar, typePascalString,
mTextDescToPascalString,
(AECoercionHandlerUPP) mTextDescToPascalString,
(long)this,
true, /* Pass a pointer not a descriptor */
false ); /* Application table, not System */
@ -57,7 +58,7 @@ AECoercionHandlers::AECoercionHandlers()
ThrowIfNil(mPascalStringDescToText);
err = ::AEInstallCoercionHandler(typePascalString, typeChar,
mPascalStringDescToText,
(AECoercionHandlerUPP) mPascalStringDescToText,
(long)this,
true, /* Pass a pointer not a descriptor */
false ); /* Application table, not System */
@ -75,14 +76,14 @@ AECoercionHandlers::~AECoercionHandlers()
{
if (mTextDescToPascalString)
{
AERemoveCoercionHandler(typeChar, typePascalString, mTextDescToPascalString, false);
DisposeRoutineDescriptor(mTextDescToPascalString);
AERemoveCoercionHandler(typeChar, typePascalString, (AECoercionHandlerUPP) mTextDescToPascalString, false);
DisposeAECoerceDescUPP(mTextDescToPascalString);
}
if (mPascalStringDescToText)
{
AERemoveCoercionHandler(typePascalString, typeChar, mPascalStringDescToText, false);
DisposeRoutineDescriptor(mPascalStringDescToText);
AERemoveCoercionHandler(typePascalString, typeChar, (AECoercionHandlerUPP) mPascalStringDescToText, false);
DisposeAECoerceDescUPP(mPascalStringDescToText);
}
}
@ -93,7 +94,7 @@ AECoercionHandlers::~AECoercionHandlers()
TextToPascalStringCoercion
----------------------------------------------------------------------------*/
OSErr AECoercionHandlers::TextToPascalStringCoercion(const AEDesc *fromDesc, DescType toType, long handlerRefcon, AEDesc *toDesc)
pascal OSErr AECoercionHandlers::TextToPascalStringCoercion(const AEDesc *fromDesc, DescType toType, long handlerRefcon, AEDesc *toDesc)
{
OSErr err = noErr;
@ -121,7 +122,7 @@ OSErr AECoercionHandlers::TextToPascalStringCoercion(const AEDesc *fromDesc, Des
----------------------------------------------------------------------------*/
OSErr AECoercionHandlers::PascalStringToTextCoercion(const AEDesc *fromDesc, DescType toType, long handlerRefcon, AEDesc *toDesc)
pascal OSErr AECoercionHandlers::PascalStringToTextCoercion(const AEDesc *fromDesc, DescType toType, long handlerRefcon, AEDesc *toDesc)
{
OSErr err = noErr;
@ -132,16 +133,15 @@ OSErr AECoercionHandlers::PascalStringToTextCoercion(const AEDesc *fromDesc, Des
{
case typePascalString:
{
Handle dataHandle = fromDesc->dataHandle;
long stringLen = *(unsigned char *)(*dataHandle);
long stringLen = AEGetDescDataSize(fromDesc);
if (stringLen > 255)
{
err = errAECoercionFail;
break;
}
StHandleLocker locker(dataHandle);
err = AECreateDesc(typeChar, *dataHandle + 1, stringLen, toDesc);
Str255 str;
AEGetDescData(fromDesc, str, sizeof(str) - 1);
err = AECreateDesc(typeChar, str + 1, str[0], toDesc);
}
break;

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

@ -41,8 +41,8 @@ public:
protected:
static OSErr TextToPascalStringCoercion(const AEDesc *fromDesc, DescType toType, long handlerRefcon, AEDesc *toDesc);
static OSErr PascalStringToTextCoercion(const AEDesc *fromDesc, DescType toType, long handlerRefcon, AEDesc *toDesc);
static pascal OSErr TextToPascalStringCoercion(const AEDesc *fromDesc, DescType toType, long handlerRefcon, AEDesc *toDesc);
static pascal OSErr PascalStringToTextCoercion(const AEDesc *fromDesc, DescType toType, long handlerRefcon, AEDesc *toDesc);
protected:

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

@ -35,21 +35,23 @@ Boolean AEComparisons::CompareTexts(DescType oper, const AEDesc *desc1, const AE
Boolean result = false;
short compareResult;
Handle lhsHandle = 0, rhsHandle = 0;
char *lhs;
char *rhs;
long lhsSize;
long rhsSize;
char h1State, h2State;
lhsSize = GetHandleSize(desc1->dataHandle);
h1State = HGetState(desc1->dataHandle);
HLock(desc1->dataHandle);
lhs = *(desc1->dataHandle);
// FIXME: this can leak lhsHandle if second conversion fails.
if (DescToTextHandle(desc1, &lhsHandle) != noErr || DescToTextHandle(desc2, &rhsHandle) != noErr)
goto fail;
rhsSize = GetHandleSize(desc2->dataHandle);
h2State = HGetState(desc2->dataHandle);
HLock(desc2->dataHandle);
rhs = *(desc2->dataHandle);
lhsSize = GetHandleSize(lhsHandle);
HLock(lhsHandle);
lhs = *(lhsHandle);
rhsSize = GetHandleSize(rhsHandle);
HLock(rhsHandle);
rhs = *(rhsHandle);
compareResult = ::CompareText(lhs, rhs, lhsSize, rhsSize, nil);
@ -129,8 +131,9 @@ Boolean AEComparisons::CompareTexts(DescType oper, const AEDesc *desc1, const AE
ThrowOSErr(errAEBadTestKey);
}
HSetState(desc1->dataHandle, h1State);
HSetState(desc2->dataHandle, h2State);
fail:
if (lhsHandle) DisposeHandle(lhsHandle);
if (rhsHandle) DisposeHandle(rhsHandle);
return result;
}

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

@ -172,37 +172,37 @@ AECoreClass::AECoreClass(Boolean suspendEvents)
AECoreClass::~AECoreClass()
{
if (mSuspendEventHandlerUPP)
DisposeRoutineDescriptor(mSuspendEventHandlerUPP);
DisposeAEEventHandlerUPP(mSuspendEventHandlerUPP);
if (mStandardSuiteHandlerUPP)
DisposeRoutineDescriptor(mStandardSuiteHandlerUPP);
DisposeAEEventHandlerUPP(mStandardSuiteHandlerUPP);
if (mRequiredSuiteHandlerUPP)
DisposeRoutineDescriptor(mRequiredSuiteHandlerUPP);
DisposeAEEventHandlerUPP(mRequiredSuiteHandlerUPP);
if (mMozillaSuiteHandlerUPP)
DisposeRoutineDescriptor(mMozillaSuiteHandlerUPP);
DisposeAEEventHandlerUPP(mMozillaSuiteHandlerUPP);
if (mGetURLSuiteHandlerUPP)
DisposeRoutineDescriptor(mGetURLSuiteHandlerUPP);
DisposeAEEventHandlerUPP(mGetURLSuiteHandlerUPP);
if (mSpyGlassSuiteHandlerUPP)
DisposeRoutineDescriptor(mSpyGlassSuiteHandlerUPP);
DisposeAEEventHandlerUPP(mSpyGlassSuiteHandlerUPP);
if (mCreateElementHandlerUPP)
DisposeRoutineDescriptor(mCreateElementHandlerUPP);
DisposeAEEventHandlerUPP(mCreateElementHandlerUPP);
if (mPropertyFromListAccessor)
DisposeRoutineDescriptor(mPropertyFromListAccessor);
DisposeOSLAccessorUPP(mPropertyFromListAccessor);
if (mAnythingFromAppAccessor)
DisposeRoutineDescriptor(mAnythingFromAppAccessor);
DisposeOSLAccessorUPP(mAnythingFromAppAccessor);
if (mCountItemsCallback)
DisposeRoutineDescriptor(mCountItemsCallback);
DisposeOSLCountUPP(mCountItemsCallback);
if (mCompareItemsCallback)
DisposeRoutineDescriptor(mCompareItemsCallback);
DisposeOSLCompareUPP(mCompareItemsCallback);
}
#pragma mark -
@ -212,7 +212,7 @@ AECoreClass::~AECoreClass()
HandleCoreSuiteEvent
----------------------------------------------------------------------------*/
void AECoreClass::HandleCoreSuiteEvent(AppleEvent *appleEvent, AppleEvent *reply)
void AECoreClass::HandleCoreSuiteEvent(const AppleEvent *appleEvent, AppleEvent *reply)
{
StAEDesc directParameter;
StAEDesc token;
@ -357,7 +357,7 @@ void AECoreClass::HandleCoreSuiteEvent(AppleEvent *appleEvent, AppleEvent *reply
HandleRequiredSuiteEvent
----------------------------------------------------------------------------*/
void AECoreClass::HandleRequiredSuiteEvent(AppleEvent *appleEvent, AppleEvent *reply)
void AECoreClass::HandleRequiredSuiteEvent(const AppleEvent *appleEvent, AppleEvent *reply)
{
StAEDesc token;
@ -376,7 +376,7 @@ void AECoreClass::HandleRequiredSuiteEvent(AppleEvent *appleEvent, AppleEvent *r
HandleCreateElementEvent
----------------------------------------------------------------------------*/
void AECoreClass::HandleCreateElementEvent(AppleEvent *appleEvent, AppleEvent *reply)
void AECoreClass::HandleCreateElementEvent(const AppleEvent *appleEvent, AppleEvent *reply)
{
StAEDesc token;
OSErr err = noErr;
@ -400,7 +400,7 @@ void AECoreClass::HandleCreateElementEvent(AppleEvent *appleEvent, AppleEvent *r
HandleEventSuspend
----------------------------------------------------------------------------*/
void AECoreClass::HandleEventSuspend(AppleEvent *appleEvent, AppleEvent *reply)
void AECoreClass::HandleEventSuspend(const AppleEvent *appleEvent, AppleEvent *reply)
{
mSuspendedEvent = *appleEvent;
mReplyToSuspendedEvent = *reply;
@ -484,7 +484,7 @@ void AECoreClass::GetAnythingFromApp( DescType desiredClass,
----------------------------------------------------------------------------*/
pascal OSErr AECoreClass::SuspendEventHandler(AppleEvent *appleEvent, AppleEvent *reply, long refCon)
pascal OSErr AECoreClass::SuspendEventHandler(const AppleEvent *appleEvent, AppleEvent *reply, UInt32 refCon)
{
AECoreClass* coreClass = reinterpret_cast<AECoreClass *>(refCon);
OSErr err = noErr;
@ -519,7 +519,7 @@ pascal OSErr AECoreClass::SuspendEventHandler(AppleEvent *appleEvent, AppleEvent
----------------------------------------------------------------------------*/
pascal OSErr AECoreClass::RequiredSuiteHandler(AppleEvent *appleEvent, AppleEvent *reply, long refCon)
pascal OSErr AECoreClass::RequiredSuiteHandler(const AppleEvent *appleEvent, AppleEvent *reply, UInt32 refCon)
{
AECoreClass* coreClass = reinterpret_cast<AECoreClass *>(refCon);
OSErr err = noErr;
@ -554,7 +554,7 @@ pascal OSErr AECoreClass::RequiredSuiteHandler(AppleEvent *appleEvent, AppleEven
----------------------------------------------------------------------------*/
pascal OSErr AECoreClass::CoreSuiteHandler(AppleEvent *appleEvent, AppleEvent *reply, long refCon)
pascal OSErr AECoreClass::CoreSuiteHandler(const AppleEvent *appleEvent, AppleEvent *reply, UInt32 refCon)
{
AECoreClass* coreClass = reinterpret_cast<AECoreClass *>(refCon);
OSErr err = noErr;
@ -583,7 +583,7 @@ pascal OSErr AECoreClass::CoreSuiteHandler(AppleEvent *appleEvent, AppleEvent *r
----------------------------------------------------------------------------*/
pascal OSErr AECoreClass::CreateElementHandler(AppleEvent *appleEvent, AppleEvent *reply, long refCon)
pascal OSErr AECoreClass::CreateElementHandler(const AppleEvent *appleEvent, AppleEvent *reply, UInt32 refCon)
{
AECoreClass* coreClass = reinterpret_cast<AECoreClass *>(refCon);
OSErr err = noErr;
@ -613,7 +613,7 @@ pascal OSErr AECoreClass::CreateElementHandler(AppleEvent *appleEvent, AppleEven
MozillaSuiteHandler
----------------------------------------------------------------------------*/
pascal OSErr AECoreClass::MozillaSuiteHandler(AppleEvent *appleEvent, AppleEvent *reply, long refCon)
pascal OSErr AECoreClass::MozillaSuiteHandler(const AppleEvent *appleEvent, AppleEvent *reply, UInt32 refCon)
{
AECoreClass* coreClass = reinterpret_cast<AECoreClass *>(refCon);
OSErr err = noErr;
@ -643,7 +643,7 @@ pascal OSErr AECoreClass::MozillaSuiteHandler(AppleEvent *appleEvent, AppleEvent
----------------------------------------------------------------------------*/
pascal OSErr AECoreClass::GetURLSuiteHandler(AppleEvent *appleEvent, AppleEvent *reply, long refCon)
pascal OSErr AECoreClass::GetURLSuiteHandler(const AppleEvent *appleEvent, AppleEvent *reply, UInt32 refCon)
{
AECoreClass* coreClass = reinterpret_cast<AECoreClass *>(refCon);
OSErr err = noErr;
@ -673,7 +673,7 @@ pascal OSErr AECoreClass::GetURLSuiteHandler(AppleEvent *appleEvent, AppleEvent
----------------------------------------------------------------------------*/
pascal OSErr AECoreClass::SpyglassSuiteHandler(AppleEvent *appleEvent, AppleEvent *reply, long refCon)
pascal OSErr AECoreClass::SpyglassSuiteHandler(const AppleEvent *appleEvent, AppleEvent *reply, UInt32 refCon)
{
AECoreClass* coreClass = reinterpret_cast<AECoreClass *>(refCon);
OSErr err = noErr;
@ -705,7 +705,7 @@ pascal OSErr AECoreClass::SpyglassSuiteHandler(AppleEvent *appleEvent, AppleEven
We probably want to handle events for this suite off to another class.
----------------------------------------------------------------------------*/
void AECoreClass::HandleMozillaSuiteEvent(AppleEvent *appleEvent, AppleEvent *reply)
void AECoreClass::HandleMozillaSuiteEvent(const AppleEvent *appleEvent, AppleEvent *reply)
{
mMozillaSuiteHandler.HandleMozillaSuiteEvent(appleEvent, reply);
}
@ -716,7 +716,7 @@ void AECoreClass::HandleMozillaSuiteEvent(AppleEvent *appleEvent, AppleEvent *re
We probably want to handle events for this suite off to another class.
----------------------------------------------------------------------------*/
void AECoreClass::HandleGetURLSuiteEvent(AppleEvent *appleEvent, AppleEvent *reply)
void AECoreClass::HandleGetURLSuiteEvent(const AppleEvent *appleEvent, AppleEvent *reply)
{
mGetURLSuiteHandler.HandleGetURLSuiteEvent(appleEvent, reply);
}
@ -727,7 +727,7 @@ void AECoreClass::HandleGetURLSuiteEvent(AppleEvent *appleEvent, AppleEvent *rep
We probably want to handle events for this suite off to another class.
----------------------------------------------------------------------------*/
void AECoreClass::HandleSpyglassSuiteEvent(AppleEvent *appleEvent, AppleEvent *reply)
void AECoreClass::HandleSpyglassSuiteEvent(const AppleEvent *appleEvent, AppleEvent *reply)
{
mSpyglassSuiteHandler.HandleSpyglassSuiteEvent(appleEvent, reply);
}
@ -1073,7 +1073,7 @@ void AECoreClass::InstallSuiteHandlers(Boolean suspendEvents)
HandleCoreSuiteEvent
----------------------------------------------------------------------------*/
void AECoreClass::ResumeEventHandling(AppleEvent *appleEvent, AppleEvent *reply, Boolean dispatchEvent)
void AECoreClass::ResumeEventHandling(const AppleEvent *appleEvent, AppleEvent *reply, Boolean dispatchEvent)
{
InstallSuiteHandlers(false);
@ -1083,8 +1083,3 @@ void AECoreClass::ResumeEventHandling(AppleEvent *appleEvent, AppleEvent *reply,
err = ::AEResumeTheCurrentEvent(appleEvent, reply, (AEEventHandlerUPP)(dispatchEvent ? kAEUseStandardDispatch : kAENoDispatch), (long)this);
ThrowIfOSErr(err);
}

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

@ -50,32 +50,32 @@ public:
AECoreClass(Boolean suspendEvents = false); // throws OSErrs
~AECoreClass();
void HandleCoreSuiteEvent(AppleEvent *appleEvent, AppleEvent *reply); // throws OSErrs
void HandleRequiredSuiteEvent(AppleEvent *appleEvent, AppleEvent *reply); // throws OSErrs
void HandleCoreSuiteEvent(const AppleEvent *appleEvent, AppleEvent *reply); // throws OSErrs
void HandleRequiredSuiteEvent(const AppleEvent *appleEvent, AppleEvent *reply); // throws OSErrs
void HandleMozillaSuiteEvent(AppleEvent *appleEvent, AppleEvent *reply); // throws OSErrs
void HandleGetURLSuiteEvent(AppleEvent *appleEvent, AppleEvent *reply); // throws OSErrs
void HandleSpyglassSuiteEvent(AppleEvent *appleEvent, AppleEvent *reply); // throws OSErrs
void HandleMozillaSuiteEvent(const AppleEvent *appleEvent, AppleEvent *reply); // throws OSErrs
void HandleGetURLSuiteEvent(const AppleEvent *appleEvent, AppleEvent *reply); // throws OSErrs
void HandleSpyglassSuiteEvent(const AppleEvent *appleEvent, AppleEvent *reply); // throws OSErrs
void HandleCreateElementEvent(AppleEvent *appleEvent, AppleEvent *reply); // throws OSErrs
void HandleCreateElementEvent(const AppleEvent *appleEvent, AppleEvent *reply); // throws OSErrs
void HandleEventSuspend(AppleEvent *appleEvent, AppleEvent *reply);
void ResumeEventHandling(AppleEvent *appleEvent, AppleEvent *reply, Boolean dispatchEvent);
void HandleEventSuspend(const AppleEvent *appleEvent, AppleEvent *reply);
void ResumeEventHandling(const AppleEvent *appleEvent, AppleEvent *reply, Boolean dispatchEvent);
// AE Handlers
static pascal OSErr SuspendEventHandler(AppleEvent *appleEvent, AppleEvent *reply, long refCon);
static pascal OSErr RequiredSuiteHandler(AppleEvent *appleEvent, AppleEvent *reply, long refCon);
static pascal OSErr CoreSuiteHandler(AppleEvent *appleEvent, AppleEvent *reply, long refCon);
static pascal OSErr CreateElementHandler(AppleEvent *appleEvent, AppleEvent *reply, long refCon);
static pascal OSErr SuspendEventHandler(const AppleEvent *appleEvent, AppleEvent *reply, UInt32 refCon);
static pascal OSErr RequiredSuiteHandler(const AppleEvent *appleEvent, AppleEvent *reply, UInt32 refCon);
static pascal OSErr CoreSuiteHandler(const AppleEvent *appleEvent, AppleEvent *reply, UInt32 refCon);
static pascal OSErr CreateElementHandler(const AppleEvent *appleEvent, AppleEvent *reply, UInt32 refCon);
// Handler for Mozilla Suite events
static pascal OSErr MozillaSuiteHandler(AppleEvent *appleEvent, AppleEvent *reply, long refCon);
static pascal OSErr MozillaSuiteHandler(const AppleEvent *appleEvent, AppleEvent *reply, UInt32 refCon);
// Handler for GetURL events
static pascal OSErr GetURLSuiteHandler(AppleEvent *appleEvent, AppleEvent *reply, long refCon);
static pascal OSErr GetURLSuiteHandler(const AppleEvent *appleEvent, AppleEvent *reply, UInt32 refCon);
// Handler for GetURL events
static pascal OSErr SpyglassSuiteHandler(AppleEvent *appleEvent, AppleEvent *reply, long refCon);
static pascal OSErr SpyglassSuiteHandler(const AppleEvent *appleEvent, AppleEvent *reply, UInt32 refCon);
AEDispatchHandler* GetDispatchHandler(DescType dispatchClass);

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

@ -68,7 +68,7 @@ AEGenericClass::AEGenericClass(DescType classType, DescType containerClass)
AEGenericClass::~AEGenericClass()
{
if (mItemFromContainerAccessor)
DisposeRoutineDescriptor(mItemFromContainerAccessor);
DisposeOSLAccessorUPP(mItemFromContainerAccessor);
}
#pragma mark -

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

@ -49,7 +49,7 @@ AEGetURLSuiteHandler::~AEGetURLSuiteHandler()
HandleGetURLSuiteEvent
----------------------------------------------------------------------------*/
void AEGetURLSuiteHandler::HandleGetURLSuiteEvent(AppleEvent *appleEvent, AppleEvent *reply)
void AEGetURLSuiteHandler::HandleGetURLSuiteEvent(const AppleEvent *appleEvent, AppleEvent *reply)
{
OSErr err = noErr;
@ -96,7 +96,7 @@ void AEGetURLSuiteHandler::HandleGetURLSuiteEvent(AppleEvent *appleEvent, AppleE
HandleGetURLEvent
----------------------------------------------------------------------------*/
void AEGetURLSuiteHandler::HandleGetURLEvent(AppleEvent *appleEvent, AppleEvent *reply)
void AEGetURLSuiteHandler::HandleGetURLEvent(const AppleEvent *appleEvent, AppleEvent *reply)
{
StAEDesc directParameter;
OSErr err;

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

@ -40,11 +40,11 @@ public:
AEGetURLSuiteHandler();
~AEGetURLSuiteHandler();
void HandleGetURLSuiteEvent(AppleEvent *appleEvent, AppleEvent *reply); // throws OSErrs
void HandleGetURLSuiteEvent(const AppleEvent *appleEvent, AppleEvent *reply); // throws OSErrs
protected:
void HandleGetURLEvent(AppleEvent *appleEvent, AppleEvent *reply);
void HandleGetURLEvent(const AppleEvent *appleEvent, AppleEvent *reply);
};

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

@ -47,7 +47,7 @@ AEMozillaSuiteHandler::~AEMozillaSuiteHandler()
HandleMozillaSuiteEvent
----------------------------------------------------------------------------*/
void AEMozillaSuiteHandler::HandleMozillaSuiteEvent(AppleEvent *appleEvent, AppleEvent *reply)
void AEMozillaSuiteHandler::HandleMozillaSuiteEvent(const AppleEvent *appleEvent, AppleEvent *reply)
{
OSErr err = noErr;

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

@ -40,7 +40,7 @@ public:
AEMozillaSuiteHandler();
~AEMozillaSuiteHandler();
void HandleMozillaSuiteEvent(AppleEvent *appleEvent, AppleEvent *reply); // throws OSErrs
void HandleMozillaSuiteEvent(const AppleEvent *appleEvent, AppleEvent *reply); // throws OSErrs
protected:

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

@ -50,7 +50,7 @@ AESpyglassSuiteHandler::~AESpyglassSuiteHandler()
HandleSpyglassSuiteEvent
----------------------------------------------------------------------------*/
void AESpyglassSuiteHandler::HandleSpyglassSuiteEvent(AppleEvent *appleEvent, AppleEvent *reply)
void AESpyglassSuiteHandler::HandleSpyglassSuiteEvent(const AppleEvent *appleEvent, AppleEvent *reply)
{
OSErr err = noErr;
@ -105,7 +105,7 @@ void AESpyglassSuiteHandler::HandleSpyglassSuiteEvent(AppleEvent *appleEvent, Ap
HandleOpenURLEvent
----------------------------------------------------------------------------*/
void AESpyglassSuiteHandler::HandleOpenURLEvent(AppleEvent *appleEvent, AppleEvent *reply)
void AESpyglassSuiteHandler::HandleOpenURLEvent(const AppleEvent *appleEvent, AppleEvent *reply)
{
StAEDesc directParameter;
FSSpec saveToFile;
@ -161,7 +161,7 @@ void AESpyglassSuiteHandler::HandleOpenURLEvent(AppleEvent *appleEvent, AppleEve
HandleRegisterURLEchoEvent
----------------------------------------------------------------------------*/
void AESpyglassSuiteHandler::HandleRegisterURLEchoEvent(AppleEvent *appleEvent, AppleEvent *reply)
void AESpyglassSuiteHandler::HandleRegisterURLEchoEvent(const AppleEvent *appleEvent, AppleEvent *reply)
{
// extract the direct parameter (the requester's signature)
StAEDesc directParameter;
@ -170,10 +170,14 @@ void AESpyglassSuiteHandler::HandleRegisterURLEchoEvent(AppleEvent *appleEvent,
if (typeType == directParameter.descriptorType)
{
mDocObserver = new nsDocLoadObserver;
ThrowIfNil(mDocObserver);
NS_ADDREF(mDocObserver); // our owning ref
mDocObserver->AddEchoRequester(**(OSType**)directParameter.dataHandle);
if (mDocObserver == nsnull) {
mDocObserver = new nsDocLoadObserver;
ThrowIfNil(mDocObserver);
NS_ADDREF(mDocObserver); // our owning ref
}
OSType requester;
if (AEGetDescData(&directParameter, &requester, sizeof(requester)) == noErr)
mDocObserver->AddEchoRequester(requester);
}
}
@ -181,7 +185,7 @@ void AESpyglassSuiteHandler::HandleRegisterURLEchoEvent(AppleEvent *appleEvent,
HandleUnregisterURLEchoEvent
----------------------------------------------------------------------------*/
void AESpyglassSuiteHandler::HandleUnregisterURLEchoEvent(AppleEvent *appleEvent, AppleEvent *reply)
void AESpyglassSuiteHandler::HandleUnregisterURLEchoEvent(const AppleEvent *appleEvent, AppleEvent *reply)
{
// extract the direct parameter (the requester's signature)
StAEDesc directParameter;

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

@ -74,14 +74,14 @@ public:
AESpyglassSuiteHandler();
~AESpyglassSuiteHandler();
void HandleSpyglassSuiteEvent(AppleEvent *appleEvent, AppleEvent *reply); // throws OSErrs
void HandleSpyglassSuiteEvent(const AppleEvent *appleEvent, AppleEvent *reply); // throws OSErrs
protected:
void HandleOpenURLEvent(AppleEvent *appleEvent, AppleEvent *reply);
void HandleOpenURLEvent(const AppleEvent *appleEvent, AppleEvent *reply);
void HandleRegisterURLEchoEvent(AppleEvent *appleEvent, AppleEvent *reply);
void HandleUnregisterURLEchoEvent(AppleEvent *appleEvent, AppleEvent *reply);
void HandleRegisterURLEchoEvent(const AppleEvent *appleEvent, AppleEvent *reply);
void HandleUnregisterURLEchoEvent(const AppleEvent *appleEvent, AppleEvent *reply);
protected:

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

@ -25,20 +25,28 @@
#include "nsAETokens.h"
AETokenDesc::AETokenDesc(const AEDesc* token)
: mTokenValid(false)
{
mTokenValid = (AEGetDescDataSize(token) == sizeof(CoreTokenRecord));
if (mTokenValid)
AEGetDescData(token, &mTokenData, sizeof(CoreTokenRecord));
}
AETokenDesc::~AETokenDesc() {}
// ---------------------------------------------------------------------------
DescType AETokenDesc::GetDispatchClass() const
{
CoreTokenHandle tokenData = GetTokenHandle();
return (tokenData) ? (**tokenData).dispatchClass : typeNull;
return (mTokenValid ? mTokenData.dispatchClass : typeNull);
}
// ---------------------------------------------------------------------------
DescType AETokenDesc::GetObjectClass() const
{
CoreTokenHandle tokenData = GetTokenHandle();
return (tokenData) ? (**tokenData).objectClass : typeNull;
return (mTokenValid ? mTokenData.objectClass : typeNull);
}
// ---------------------------------------------------------------------------
@ -48,32 +56,28 @@ DescType AETokenDesc::GetObjectClass() const
Boolean AETokenDesc::UsePropertyCode() const
{
CoreTokenHandle tokenData = GetTokenHandle();
return (tokenData) ? ((**tokenData).propertyCode != typeNull) : false;
return (mTokenValid ? mTokenData.propertyCode != typeNull : false);
}
// ---------------------------------------------------------------------------
DescType AETokenDesc::GetPropertyCode() const
{
CoreTokenHandle tokenData = GetTokenHandle();
return (tokenData) ? (**tokenData).propertyCode : typeNull;
return (mTokenValid ? mTokenData.propertyCode : typeNull);
}
// ---------------------------------------------------------------------------
long AETokenDesc::GetDocumentID() const
{
CoreTokenHandle tokenData = GetTokenHandle();
return (tokenData) ? (**tokenData).documentID : 0;
return (mTokenValid ? mTokenData.documentID : typeNull);
}
// ---------------------------------------------------------------------------
WindowPtr AETokenDesc::GetWindowPtr() const
{
CoreTokenHandle tokenData = GetTokenHandle();
return (tokenData) ? (**tokenData).window : nil;
return (mTokenValid ? mTokenData.window : nil);
}
@ -81,8 +85,7 @@ WindowPtr AETokenDesc::GetWindowPtr() const
TAEListIndex AETokenDesc::GetElementNumber() const
{
CoreTokenHandle tokenData = GetTokenHandle();
return (tokenData) ? (**tokenData).elementNumber : 0;
return (mTokenValid ? mTokenData.elementNumber : 0);
}
@ -93,42 +96,30 @@ TAEListIndex AETokenDesc::GetElementNumber() const
void AETokenDesc::SetPropertyCode(DescType propertyCode)
{
CoreTokenHandle tokenData = GetTokenHandle();
ThrowIfNil(tokenData);
(**tokenData).propertyCode = propertyCode;
mTokenData.propertyCode = propertyCode;
}
// ---------------------------------------------------------------------------
void AETokenDesc::SetDispatchClass(DescType dispatchClass)
{
CoreTokenHandle tokenData = GetTokenHandle();
ThrowIfNil(tokenData);
(**tokenData).dispatchClass = dispatchClass;
mTokenData.dispatchClass = dispatchClass;
}
// ---------------------------------------------------------------------------
void AETokenDesc::SetObjectClass(DescType objectClass)
{
CoreTokenHandle tokenData = GetTokenHandle();
ThrowIfNil(tokenData);
(**tokenData).objectClass = objectClass;
mTokenData.objectClass = objectClass;
}
// ---------------------------------------------------------------------------
void AETokenDesc::SetElementNumber(TAEListIndex number)
{
CoreTokenHandle tokenData = GetTokenHandle();
ThrowIfNil(tokenData);
(**tokenData).elementNumber = number;
mTokenData.elementNumber = number;
}
// ---------------------------------------------------------------------------
void AETokenDesc::SetWindow(WindowPtr wind)
{
CoreTokenHandle tokenData = GetTokenHandle();
ThrowIfNil(tokenData);
(**tokenData).window = wind;
mTokenData.window = wind;
}

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

@ -63,37 +63,27 @@ typedef struct CoreTokenRecord CoreTokenRecord, *CoreTokenPtr, **CoreTokenHandle
class AETokenDesc
{
public:
AETokenDesc(const AEDesc* token) { mToken = token; }
~AETokenDesc() {}
AETokenDesc(const AEDesc* token);
~AETokenDesc();
DescType GetDispatchClass() const;
DescType GetObjectClass() const;
DescType GetDispatchClass() const;
DescType GetObjectClass() const;
Boolean UsePropertyCode() const;
DescType GetPropertyCode() const;
DescType GetPropertyCode() const;
long GetDocumentID() const;
long GetDocumentID() const;
WindowPtr GetWindowPtr() const;
TAEListIndex GetElementNumber() const;
TAEListIndex GetElementNumber() const;
void SetDispatchClass(DescType dispatchClass);
void SetObjectClass(DescType objectClass);
void SetPropertyCode(DescType propertyCode);
void SetElementNumber(TAEListIndex number);
void SetWindow(WindowPtr wind);
void SetDispatchClass(DescType dispatchClass);
void SetObjectClass(DescType objectClass);
void SetPropertyCode(DescType propertyCode);
void SetElementNumber(TAEListIndex number);
void SetWindow(WindowPtr wind);
protected:
CoreTokenHandle GetTokenHandle() const
{
if (mToken->dataHandle && GetHandleSize(mToken->dataHandle) == sizeof(CoreTokenRecord))
return (CoreTokenHandle)mToken->dataHandle;
else
return nil;
}
const AEDesc* mToken;
CoreTokenRecord mTokenData;
Boolean mTokenValid;
};
#endif /* __AETOKENS__ */

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

@ -28,8 +28,7 @@
#include "nsAETokens.h"
#include "nsAEUtils.h"
static OSErr AECoerceDescData(const AEDesc *theAEDesc, DescType typeCode, void *dataPtr, Size maximumSize);
/*----------------------------------------------------------------------------
CreateAliasAEDesc
@ -66,7 +65,7 @@ OSErr GetTextFromAEDesc(const AEDesc *inDesc, Handle *outTextHandle)
if (err != noErr) return err;
MyHLock(textHandle);
err = AEGetDescData(inDesc, typeChar, *textHandle, textLength);
err = AECoerceDescData(inDesc, typeChar, *textHandle, textLength);
MyHUnlock(textHandle);
if (err != noErr)
@ -89,38 +88,18 @@ exit:
Get a copy of the data from the AE desc. The will attempt to coerce to the
requested type, returning an error on failure.
----------------------------------------------------------------------------*/
OSErr AEGetDescData(const AEDesc *theAEDesc, DescType typeCode, void *dataPtr, Size maximumSize)
OSErr AEGetDescData(const AEDesc *theAEDesc, void *dataPtr, Size maximumSize)
{
Size dataLength;
OSErr err;
if (theAEDesc->descriptorType != typeCode)
if (theAEDesc->dataHandle)
{
AEDesc coercedDesc = { typeNull, nil };
err = AECoerceDesc(theAEDesc, typeCode, &coercedDesc);
if (err != noErr) return err;
dataLength = GetHandleSize(coercedDesc.dataHandle);
BlockMoveData(*coercedDesc.dataHandle, dataPtr, Min(dataLength, maximumSize));
AEDisposeDesc(&coercedDesc);
Size dataLength = GetHandleSize(theAEDesc->dataHandle);
BlockMoveData(*theAEDesc->dataHandle, dataPtr, Min(dataLength, maximumSize));
}
else
{
if (theAEDesc->dataHandle)
{
dataLength = GetHandleSize(theAEDesc->dataHandle);
BlockMoveData(*theAEDesc->dataHandle, dataPtr, Min(dataLength, maximumSize));
}
else
return paramErr;
}
return noErr;
return paramErr;
}
/*----------------------------------------------------------------------------
AEGetDescDataSize
@ -139,6 +118,25 @@ Size AEGetDescDataSize(const AEDesc *theAEDesc)
#endif //TARGET_CARBON
static OSErr AECoerceDescData(const AEDesc *theAEDesc, DescType typeCode, void *dataPtr, Size maximumSize)
{
OSErr err;
if (theAEDesc->descriptorType != typeCode)
{
AEDesc coercedDesc = { typeNull, nil };
err = AECoerceDesc(theAEDesc, typeCode, &coercedDesc);
if (err != noErr) return err;
err = AEGetDescData(&coercedDesc, dataPtr, maximumSize);
AEDisposeDesc(&coercedDesc);
return err;
}
else
{
return AEGetDescData(theAEDesc, dataPtr, maximumSize);
}
}
#pragma mark -
@ -153,7 +151,7 @@ OSErr CreateThreadAEInfo(const AppleEvent *event, AppleEvent *reply, TThreadAEIn
TThreadAEInfo *threadAEInfo = nil;
OSErr err;
err = MyNewBlockClear(sizeof(TThreadAEInfo), &threadAEInfo);
err = MyNewBlockClear(sizeof(TThreadAEInfo), (void**)&threadAEInfo);
if (err != noErr) return err;
threadAEInfo->mAppleEvent = *event;
@ -276,137 +274,87 @@ StAEDesc& StAEDesc::operator= (const StAEDesc& rhs)
Boolean StAEDesc::GetBoolean()
{
if (descriptorType == typeBoolean)
return **(Boolean **)dataHandle;
else
{
StAEDesc tempDesc;
if (::AECoerceDesc(this, typeBoolean, &tempDesc) == noErr)
return **(Boolean **)tempDesc.dataHandle;
else
ThrowOSErr(errAECoercionFail);
}
return false;
Boolean result = false;
OSErr err = ::AECoerceDescData(this, typeBoolean, &result, sizeof(result));
if (err != noErr)
ThrowOSErr(errAECoercionFail);
return result;
}
SInt16 StAEDesc::GetShort()
{
if (descriptorType == typeShortInteger)
return **(SInt16 **)dataHandle;
else
{
StAEDesc tempDesc;
if (::AECoerceDesc(this, typeShortInteger, &tempDesc) == noErr)
return **(SInt16 **)tempDesc.dataHandle;
else
ThrowOSErr(errAECoercionFail);
}
return 0;
SInt16 result = 0;
OSErr err = ::AECoerceDescData(this, typeShortInteger, &result, sizeof(result));
if (err != noErr)
ThrowOSErr(errAECoercionFail);
return result;
}
SInt32 StAEDesc::GetLong()
{
if (descriptorType == typeLongInteger)
return **(SInt32 **)dataHandle;
else
{
StAEDesc tempDesc;
if (::AECoerceDesc(this, typeLongInteger, &tempDesc) == noErr)
return **(SInt32 **)tempDesc.dataHandle;
else
ThrowOSErr(errAECoercionFail);
}
return 0;
SInt32 result = 0;
OSErr err = ::AECoerceDescData(this, typeLongInteger, &result, sizeof(result));
if (err != noErr)
ThrowOSErr(errAECoercionFail);
return result;
}
DescType StAEDesc::GetEnumType()
{
if (descriptorType == typeEnumeration)
return **(DescType **)dataHandle;
else
{
StAEDesc tempDesc;
if (::AECoerceDesc(this, typeEnumeration, &tempDesc) == noErr)
return **(DescType **)tempDesc.dataHandle;
else
ThrowOSErr(errAECoercionFail);
}
return 0;
DescType result = typeNull;
OSErr err = ::AECoerceDescData(this, typeEnumeration, &result, sizeof(result));
if (err != noErr)
ThrowOSErr(errAECoercionFail);
return result;
}
void StAEDesc::GetRect(Rect& outData)
{
if (descriptorType == typeQDRectangle)
outData = **(Rect **)dataHandle;
else
{
StAEDesc tempDesc;
if (::AECoerceDesc(this, typeQDRectangle, &tempDesc) == noErr)
outData = **(Rect **)tempDesc.dataHandle;
else
ThrowOSErr(errAECoercionFail);
}
OSErr err = ::AECoerceDescData(this, typeQDRectangle, &outData, sizeof(Rect));
if (err != noErr)
ThrowOSErr(errAECoercionFail);
}
void StAEDesc::GetRGBColor(RGBColor& outData)
{
if (descriptorType == typeRGBColor)
outData = **(RGBColor **)dataHandle;
else
{
StAEDesc tempDesc;
if (::AECoerceDesc(this, typeRGBColor, &tempDesc) == noErr)
outData = **(RGBColor **)tempDesc.dataHandle;
else
ThrowOSErr(errAECoercionFail);
}
OSErr err = ::AECoerceDescData(this, typeRGBColor, &outData, sizeof(RGBColor));
if (err != noErr)
ThrowOSErr(errAECoercionFail);
}
void StAEDesc::GetLongDateTime(LongDateTime& outDateTime)
{
if (descriptorType == typeLongDateTime)
outDateTime = **(LongDateTime **)dataHandle;
else
{
StAEDesc tempDesc;
if (::AECoerceDesc(this, typeLongDateTime, &tempDesc) == noErr)
outDateTime = **(LongDateTime **)tempDesc.dataHandle;
else
ThrowOSErr(errAECoercionFail);
}
OSErr err = ::AECoerceDescData(this, typeLongDateTime, &outDateTime, sizeof(LongDateTime));
if (err != noErr)
ThrowOSErr(errAECoercionFail);
}
void StAEDesc::GetFileSpec(FSSpec &outFileSpec)
{
if (descriptorType == typeFSS)
outFileSpec = **(FSSpec **)dataHandle;
else
{
StAEDesc tempDesc;
if (::AECoerceDesc(this, typeFSS, &tempDesc) == noErr)
outFileSpec = **(FSSpec **)tempDesc.dataHandle;
else
ThrowOSErr(errAECoercionFail);
}
OSErr err = ::AECoerceDescData(this, typeFSS, &outFileSpec, sizeof(FSSpec));
if (err != noErr)
ThrowOSErr(errAECoercionFail);
}
void StAEDesc::GetCString(char *outString, short maxLen)
{
if (descriptorType == typeChar)
{
long dataSize = GetDataSize();
StrCopySafe(outString, *dataHandle, Min(dataSize, maxLen));
long dataSize = GetDataSize();
dataSize = Min(dataSize, maxLen-1);
if (AEGetDescData(this, outString, dataSize) == noErr)
outString[dataSize] = '\0';
}
else
{
StAEDesc tempDesc;
StAEDesc tempDesc;
if (::AECoerceDesc(this, typeChar, &tempDesc) == noErr)
{
long dataSize = tempDesc.GetDataSize();
StrCopySafe(outString, *tempDesc.dataHandle, Min(dataSize, maxLen));
long dataSize = tempDesc.GetDataSize();
dataSize = Min(dataSize, maxLen-1);
if (AEGetDescData(&tempDesc, outString, dataSize) == noErr)
outString[dataSize] = '\0';
}
else
ThrowOSErr(errAECoercionFail);
@ -417,10 +365,10 @@ void StAEDesc::GetPString(Str255 outString)
{
if (descriptorType == typeChar)
{
long stringLen = GetDataSize();
long stringLen = GetDataSize();
if (stringLen > 255)
stringLen = 255;
BlockMoveData(*dataHandle, &outString[1], stringLen);
AEGetDescData(this, outString+1, stringLen);
outString[0] = stringLen;
}
else
@ -428,10 +376,10 @@ void StAEDesc::GetPString(Str255 outString)
StAEDesc tempDesc;
if (::AECoerceDesc(this, typeChar, &tempDesc) == noErr)
{
long stringLen = tempDesc.GetDataSize();
long stringLen = tempDesc.GetDataSize();
if (stringLen > 255)
stringLen = 255;
BlockMoveData(*tempDesc.dataHandle, &outString[1], stringLen);
AEGetDescData(&tempDesc, outString+1, stringLen);
outString[0] = stringLen;
}
else
@ -441,29 +389,28 @@ void StAEDesc::GetPString(Str255 outString)
Handle StAEDesc::GetTextHandle()
{
StAEDesc tempDesc;
Handle data = nil;
Handle data = nil;
if (descriptorType == typeChar)
{
data = dataHandle;
Size dataSize = GetDataSize();
data = ::NewHandle(dataSize);
if (data == NULL)
ThrowOSErr(memFullErr);
::HLock(data);
::AEGetDescData(this, *data, dataSize);
::HUnlock(data);
}
else
{
StAEDesc tempDesc;
if (::AECoerceDesc(this, typeChar, &tempDesc) == noErr)
data = tempDesc.dataHandle;
data = tempDesc.GetTextHandle();
else
ThrowOSErr(errAECoercionFail);
ThrowOSErr(errAECoercionFail);
}
if (data)
{
OSErr err = ::HandToHand(&data);
ThrowIfOSErr(err);
return data;
}
return nil;
return data;
}
@ -843,36 +790,30 @@ OSErr GetObjectClassFromAppleEvent(const AppleEvent *appleEvent, DescType *objec
---------------------------------------------------------------------------*/
OSErr DescToPString(const AEDesc* desc, Str255 aPString, short maxLength)
{
StAEDesc tempDesc;
Handle dataHandle = nil;
long charCount;
if (desc->descriptorType == typeChar)
{
dataHandle = desc->dataHandle;
long stringLen = AEGetDescDataSize(desc);
if (stringLen > maxLength)
stringLen = maxLength;
AEGetDescData(desc, aPString+1, stringLen);
aPString[0] = stringLen;
}
else
{
if (AECoerceDesc(desc, typeChar, &tempDesc) == noErr)
dataHandle = tempDesc.dataHandle;
else
StAEDesc tempDesc;
if (AECoerceDesc(desc, typeChar, &tempDesc) == noErr) {
long stringLen = tempDesc.GetDataSize();
if (stringLen > maxLength)
stringLen = maxLength;
AEGetDescData(&tempDesc, aPString+1, stringLen);
aPString[0] = stringLen;
} else
return errAECoercionFail;
}
charCount = GetHandleSize(dataHandle);
if (charCount > maxLength)
{
return errAECoercionFail;
}
BlockMoveData(*dataHandle, &aPString[1], charCount);
aPString[0] = charCount;
return noErr;
}
/*----------------------------------------------------------------------------
DescToCString
@ -881,31 +822,30 @@ OSErr DescToPString(const AEDesc* desc, Str255 aPString, short maxLength)
--------------------------------------------------------------------------- */
OSErr DescToCString(const AEDesc* desc, CStr255 aCString, short maxLength)
{
StAEDesc tempDesc;
Handle dataHandle = nil;
long charCount;
if (desc->descriptorType == typeChar)
{
dataHandle = desc->dataHandle;
long stringLen = AEGetDescDataSize(desc);
if (stringLen >= maxLength)
stringLen = maxLength - 1;
if (AEGetDescData(desc, aCString, stringLen) == noErr)
aCString[stringLen] = '\0';
else
return errAECoercionFail;
}
else
{
if (AECoerceDesc(desc, typeChar, &tempDesc) == noErr)
dataHandle = tempDesc.dataHandle;
else
StAEDesc tempDesc;
if (AECoerceDesc(desc, typeChar, &tempDesc) == noErr) {
long stringLen = AEGetDescDataSize(&tempDesc);
if (stringLen >= maxLength)
stringLen = maxLength - 1;
if (AEGetDescData(&tempDesc, aCString, stringLen) == noErr)
aCString[stringLen] = '\0';
else
return errAECoercionFail;
} else
return errAECoercionFail;
}
charCount = GetHandleSize(dataHandle);
if (charCount > maxLength)
{
return errAECoercionFail;
}
BlockMoveData(*dataHandle, aCString, charCount);
aCString[charCount] = '\0';
return noErr;
}
@ -915,14 +855,10 @@ OSErr DescToCString(const AEDesc* desc, CStr255 aCString, short maxLength)
OSErr DescToDescType(const AEDesc *desc, DescType *descType)
{
OSErr err = noErr;
if (GetHandleSize(desc->dataHandle) == 4)
*descType = *(DescType*)*(desc->dataHandle);
if (AEGetDescDataSize(desc) == sizeof(DescType))
return AEGetDescData(desc, descType, sizeof(DescType));
else
err = errAECoercionFail;
return err;
return errAECoercionFail;
}
//----------------------------------------------------------------------------------
@ -931,23 +867,7 @@ OSErr DescToDescType(const AEDesc *desc, DescType *descType)
OSErr DescToBoolean(const AEDesc* desc, Boolean* aBoolean)
{
StAEDesc tempDesc;
Handle dataHandle = nil;
if (desc->descriptorType == typeBoolean)
{
dataHandle = desc->dataHandle;
}
else
{
if (AECoerceDesc(desc, typeBoolean, &tempDesc) == noErr)
dataHandle = tempDesc.dataHandle;
else
return errAECoercionFail;
}
*aBoolean = **dataHandle;
return noErr;
return AECoerceDescData(desc, typeBoolean, aBoolean, sizeof(Boolean));
}
//----------------------------------------------------------------------------------
@ -956,23 +876,7 @@ OSErr DescToBoolean(const AEDesc* desc, Boolean* aBoolean)
OSErr DescToFixed(const AEDesc* desc, Fixed* aFixed)
{
StAEDesc tempDesc;
Handle dataHandle = nil;
if (desc->descriptorType == typeFixed)
{
dataHandle = desc->dataHandle;
}
else
{
if (AECoerceDesc(desc, typeFixed, &tempDesc) == noErr)
dataHandle = tempDesc.dataHandle;
else
return errAECoercionFail;
}
*aFixed = *(Fixed *)*dataHandle;
return noErr;
return AECoerceDescData(desc, typeFixed, aFixed, sizeof(Fixed));
}
//----------------------------------------------------------------------------------
@ -981,48 +885,16 @@ OSErr DescToFixed(const AEDesc* desc, Fixed* aFixed)
OSErr DescToFloat(const AEDesc* desc, float* aFloat)
{
StAEDesc tempDesc;
Handle dataHandle = nil;
if (desc->descriptorType == typeFloat)
{
dataHandle = desc->dataHandle;
}
else
{
if (AECoerceDesc(desc, typeFloat, &tempDesc) == noErr)
dataHandle = tempDesc.dataHandle;
else
return errAECoercionFail;
}
*aFloat = **(float**)dataHandle;
return noErr;
return AECoerceDescData(desc, typeFloat, aFloat, sizeof(float));
}
//----------------------------------------------------------------------------------
// Converts descriptor dataHandle to a long
//----------------------------------------------------------------------------------
OSErr DescToLong(const AEDesc* desc, long* aLong)
OSErr DescToLong(const AEDesc* desc, long* aLong)
{
StAEDesc tempDesc;
Handle dataHandle = nil;
if (desc->descriptorType == typeLongInteger)
{
dataHandle = desc->dataHandle;
}
else
{
if (AECoerceDesc(desc, typeLongInteger, &tempDesc) == noErr)
dataHandle = tempDesc.dataHandle;
else
return errAECoercionFail;
}
*aLong = *(long *)*dataHandle;
return noErr;
return AECoerceDescData(desc, typeLongInteger, aLong, sizeof(long));
}
//----------------------------------------------------------------------------------
@ -1031,22 +903,7 @@ OSErr DescToLong(const AEDesc* desc, long* aLong)
OSErr DescToRGBColor(const AEDesc* desc, RGBColor* aRGBColor)
{
StAEDesc tempDesc;
Handle dataHandle = nil;
if (desc->descriptorType == typeRGBColor) // a color value
{
dataHandle = desc->dataHandle;
}
else {
if (AECoerceDesc(desc, typeRGBColor, &tempDesc) == noErr)
dataHandle = tempDesc.dataHandle;
else
return errAECoercionFail;
}
*aRGBColor = *(RGBColor *)*dataHandle;
return noErr;
return AECoerceDescData(desc, typeRGBColor, aRGBColor, sizeof(RGBColor));
}
//----------------------------------------------------------------------------------
@ -1055,23 +912,7 @@ OSErr DescToRGBColor(const AEDesc* desc, RGBColor* aRGBColor)
OSErr DescToShort(const AEDesc* desc, short* aShort)
{
StAEDesc tempDesc;
Handle dataHandle = nil;
if (desc->descriptorType == typeShortInteger)
{
dataHandle = desc->dataHandle;
}
else
{
if (AECoerceDesc(desc, typeShortInteger, &tempDesc) == noErr)
dataHandle = tempDesc.dataHandle;
else
return errAECoercionFail;
}
*aShort = *(short *)*dataHandle;
return noErr;
return AECoerceDescData(desc, typeShortInteger, aShort, sizeof(short));
}
//----------------------------------------------------------------------------------
@ -1080,26 +921,27 @@ OSErr DescToShort(const AEDesc* desc, short* aShort)
OSErr DescToTextHandle(const AEDesc* desc, Handle *text)
{
StAEDesc tempDesc;
Handle dataHandle = nil;
OSErr err;
Handle data = nil;
if (desc->descriptorType == typeChar)
{
dataHandle = desc->dataHandle;
Size dataSize = ::AEGetDescDataSize(desc);
data = ::NewHandle(dataSize);
if (data == NULL)
return memFullErr;
::HLock(data);
::AEGetDescData(desc, *data, dataSize);
::HUnlock(data);
}
else
{
if (AECoerceDesc(desc, typeChar, &tempDesc) == noErr)
dataHandle = tempDesc.dataHandle;
StAEDesc tempDesc;
if (::AECoerceDesc(desc, typeChar, &tempDesc) == noErr)
data = tempDesc.GetTextHandle();
else
return errAECoercionFail;
return errAECoercionFail;
}
err = HandToHand(&dataHandle);
if (err != noErr) return err;
*text = dataHandle;
*text = data;
return noErr;
}
@ -1109,23 +951,7 @@ OSErr DescToTextHandle(const AEDesc* desc, Handle *text)
OSErr DescToRect(const AEDesc* desc, Rect* aRect)
{
StAEDesc tempDesc;
Handle dataHandle = nil;
if (desc->descriptorType == typeRectangle)
{
dataHandle = desc->dataHandle;
}
else
{
if (AECoerceDesc(desc, typeQDRectangle, &tempDesc) == noErr)
dataHandle = tempDesc.dataHandle;
else
return errAECoercionFail;
}
*aRect = *(Rect *)*dataHandle;
return(noErr);
return AECoerceDescData(desc, typeRectangle, aRect, sizeof(Rect));
}
//----------------------------------------------------------------------------------
@ -1134,23 +960,7 @@ OSErr DescToRect(const AEDesc* desc, Rect* aRect)
OSErr DescToPoint(const AEDesc* desc, Point* aPoint)
{
StAEDesc tempDesc;
Handle dataHandle = nil;
if (desc->descriptorType == typeQDPoint)
{
dataHandle = desc->dataHandle;
}
else
{
if (AECoerceDesc(desc, typeQDPoint, &tempDesc) == noErr)
dataHandle = tempDesc.dataHandle;
else
return errAECoercionFail;
}
*aPoint = *(Point *)*dataHandle;
return(noErr);
return AECoerceDescData(desc, typeQDPoint, aPoint, sizeof(Point));
}
#pragma mark -

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

@ -36,7 +36,7 @@
#include <Files.h>
#include <Errors.h>
#include <Aliases.h>
#include <MacWindows.h>
#include "nsAEDefs.h"
#include "nsMacUtils.h"
@ -95,7 +95,7 @@ OSErr ResumeThreadAE(TThreadAEInfo *threadAEInfo, OSErr threadError);
#if !TARGET_CARBON
OSErr AEGetDescData(const AEDesc *theAEDesc, DescType typeCode, void * dataPtr, Size maximumSize);
OSErr AEGetDescData(const AEDesc *theAEDesc, void * dataPtr, Size maximumSize);
Size AEGetDescDataSize(const AEDesc *theAEDesc);
#endif /* TARGET_CARBON */
@ -163,19 +163,22 @@ public:
StAEDesc& operator= (const StAEDesc&rhs); // throws OSErrs
Size GetDataSize() { return (dataHandle) ? GetHandleSize(dataHandle) : 0; }
Size GetDataSize()
{
return AEGetDescDataSize(this);
}
Boolean GetBoolean();
SInt16 GetShort();
SInt32 GetLong();
DescType GetEnumType();
DescType GetEnumType();
void GetRect(Rect& outRect);
void GetRGBColor(RGBColor& outColor);
void GetLongDateTime(LongDateTime& outDateTime);
void GetFileSpec(FSSpec &outFileSpec);
void GetCString(char *outString, short maxLen);
void GetPString(Str255 outString);
void GetRect(Rect& outRect);
void GetRGBColor(RGBColor& outColor);
void GetLongDateTime(LongDateTime& outDateTime);
void GetFileSpec(FSSpec &outFileSpec);
void GetCString(char *outString, short maxLen);
void GetPString(Str255 outString);
Handle GetTextHandle();

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

@ -164,7 +164,7 @@ AEWindowClass::AEWindowClass(DescType classType, TWindowKind windowKind)
AEWindowClass::~AEWindowClass()
{
if (mDocumentAccessor)
DisposeRoutineDescriptor(mDocumentAccessor);
DisposeOSLAccessorUPP(mDocumentAccessor);
}
#pragma mark -

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

@ -64,7 +64,11 @@ void GetCleanedWindowName(WindowPtr wind, char* outName, long maxLen)
//---------------------------------------------------------
inline void GetWindowPortRect(WindowPtr wind, Rect *outRect)
{
#if OPAQUE_TOOLBOX_STRUCTS
::GetPortBounds(GetWindowPort(wind), outRect);
#else
*outRect = wind->portRect;
#endif
}
/*----------------------------------------------------------------------------
@ -86,7 +90,7 @@ void GetWindowGlobalBounds(WindowPtr wind, Rect* outBounds)
GrafPtr curPort;
GetWindowPortRect(wind, outBounds);
GetPort(&curPort);
SetPort(wind);
SetPortWindowPort(wind);
LocalToGlobalRect(outBounds);
SetPort(curPort);
}

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

@ -131,7 +131,9 @@ public:
~stTSMCloser()
{
#if !TARGET_CARBON
(void)CloseTSMAwareApplication();
#endif
}
};
#endif // XP_MAC

Двоичные данные
xpfe/bootstrap/nsMacBundle.rsrc

Двоичный файл не отображается.

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

@ -78,10 +78,15 @@ nsSplashScreenMac::Show()
{
mDialog = ::GetNewDialog(rSplashDialog, nil, (WindowPtr)-1L);
if (!mDialog) return NS_ERROR_FAILURE;
#if TARGET_CARBON
::ShowWindow(GetDialogWindow(mDialog));
::SetPortDialogPort(mDialog);
#else
::ShowWindow(mDialog);
::SetPort(mDialog);
#endif
::DrawDialog(mDialog); // we don't handle events for this dialog, so we
// need to draw explicitly. Yuck.
return NS_OK;

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

@ -81,7 +81,7 @@ typedef struct PASResource
#if PRAGMA_ALIGN_SUPPORTED
#if PRAGMA_STRUCT_ALIGN
#pragma options align=reset
#endif