Refactoring

This commit is contained in:
elasota
2020-06-01 00:38:24 -04:00
parent 6fe0f2d964
commit eac923c475
9 changed files with 171 additions and 173 deletions

View File

@@ -52,7 +52,7 @@ PLError_t DoOpenDocAE (const AppleEvent *theAE, AppleEvent *reply, UInt32 ref)
VFileInfo finderInfo; VFileInfo finderInfo;
AEDescList docList; AEDescList docList;
long itemsInList; long itemsInList;
Size actualSize; size_t actualSize;
AEKeyword keywd; AEKeyword keywd;
DescType returnedType; DescType returnedType;
PLError_t theErr, whoCares; PLError_t theErr, whoCares;
@@ -162,7 +162,7 @@ PLError_t DoQuitAE (const AppleEvent *theAE, AppleEvent *reply, UInt32 ref)
PLError_t MyGotRequiredParams (const AppleEvent *theAE) PLError_t MyGotRequiredParams (const AppleEvent *theAE)
{ {
DescType returnedType; DescType returnedType;
Size actualSize; size_t actualSize;
return (AEGetAttributePtr(theAE, keyMissedKeywordAttr, typeWildCard, return (AEGetAttributePtr(theAE, keyMissedKeywordAttr, typeWildCard,
&returnedType, 0L, 0, &actualSize) == errAEDescNotFound) ? PLErrors::kNone : &returnedType, 0L, 0, &actualSize) == errAEDescNotFound) ? PLErrors::kNone :

View File

@@ -58,7 +58,7 @@ Boolean CreateNewHouse (void)
{ {
AEKeyword theKeyword; AEKeyword theKeyword;
DescType actualType; DescType actualType;
Size actualSize; size_t actualSize;
VFileSpec tempSpec; VFileSpec tempSpec;
VFileSpec theSpec; VFileSpec theSpec;
PLError_t theErr; PLError_t theErr;

View File

@@ -42,7 +42,7 @@ void SaveGame2 (void)
PortabilityLayer::InputManager::GetInstance()->ClearState(); PortabilityLayer::InputManager::GetInstance()->ClearState();
Str255 gameNameStr; Str255 gameNameStr;
Size byteCount; size_t byteCount;
houseType *thisHousePtr; houseType *thisHousePtr;
roomType *srcRoom; roomType *srcRoom;
savedRoom *destRoom; savedRoom *destRoom;

View File

@@ -19,13 +19,13 @@ PLError_t AECountItems(AEDescList *descList, long *count)
return PLErrors::kNone; return PLErrors::kNone;
} }
PLError_t AEGetNthPtr(AEDescList *descList, long index, DescType desiredType, AEKeyword *keyword, DescType *type, void *data, Size maxSize, Size *actualSize) PLError_t AEGetNthPtr(AEDescList *descList, long index, DescType desiredType, AEKeyword *keyword, DescType *type, void *data, size_t maxSize, size_t *actualSize)
{ {
PL_NotYetImplemented(); PL_NotYetImplemented();
return PLErrors::kNone; return PLErrors::kNone;
} }
PLError_t AEGetAttributePtr(const AppleEvent *evt, AEKeyword keyword, DescType desiredType, DescType *type, void *data, Size maxSize, Size *actualSize) PLError_t AEGetAttributePtr(const AppleEvent *evt, AEKeyword keyword, DescType desiredType, DescType *type, void *data, size_t maxSize, size_t *actualSize)
{ {
PL_NotYetImplemented(); PL_NotYetImplemented();
return PLErrors::kNone; return PLErrors::kNone;

View File

@@ -22,8 +22,8 @@ typedef AEEventHandler AEEventHandlerUPP;
PLError_t AEGetParamDesc(const AppleEvent *evt, AEKeyword keyword, DescType desiredType, AEDescList *descList); PLError_t AEGetParamDesc(const AppleEvent *evt, AEKeyword keyword, DescType desiredType, AEDescList *descList);
PLError_t AEDisposeDesc(AEDescList *descList); PLError_t AEDisposeDesc(AEDescList *descList);
PLError_t AECountItems(AEDescList *descList, long *count); PLError_t AECountItems(AEDescList *descList, long *count);
PLError_t AEGetNthPtr(AEDescList *descList, long index, DescType desiredType, AEKeyword *keyword, DescType *type, void *data, Size maxSize, Size *actualSize); PLError_t AEGetNthPtr(AEDescList *descList, long index, DescType desiredType, AEKeyword *keyword, DescType *type, void *data, size_t maxSize, size_t *actualSize);
PLError_t AEGetAttributePtr(const AppleEvent *evt, AEKeyword keyword, DescType desiredType, DescType *type, void *data, Size maxSize, Size *actualSize); PLError_t AEGetAttributePtr(const AppleEvent *evt, AEKeyword keyword, DescType desiredType, DescType *type, void *data, size_t maxSize, size_t *actualSize);
PLError_t AEInstallEventHandler(AEEventClass eventClass, AEEventID eventID, AEEventHandlerUPP handler, UInt32 ref, bool isSysHandler); PLError_t AEInstallEventHandler(AEEventClass eventClass, AEEventID eventID, AEEventHandlerUPP handler, UInt32 ref, bool isSysHandler);
PLError_t AESetInteractionAllowed(AEInteractAllowed level); PLError_t AESetInteractionAllowed(AEInteractAllowed level);

View File

@@ -561,7 +561,7 @@ void ExitToShell()
PL_NotYetImplemented(); PL_NotYetImplemented();
} }
Handle NewHandle(Size size) Handle NewHandle(size_t size)
{ {
PortabilityLayer::MMHandleBlock *hBlock = PortabilityLayer::MemoryManager::GetInstance()->AllocHandle(size); PortabilityLayer::MMHandleBlock *hBlock = PortabilityLayer::MemoryManager::GetInstance()->AllocHandle(size);
if (!hBlock) if (!hBlock)
@@ -578,7 +578,7 @@ long GetHandleSize(Handle handle)
return handle.MMBlock()->m_size; return handle.MMBlock()->m_size;
} }
PLError_t SetHandleSize(Handle hdl, Size newSize) PLError_t SetHandleSize(Handle hdl, size_t newSize)
{ {
PortabilityLayer::MemoryManager *mm = PortabilityLayer::MemoryManager::GetInstance(); PortabilityLayer::MemoryManager *mm = PortabilityLayer::MemoryManager::GetInstance();
if (!mm->ResizeHandle(hdl.MMBlock(), newSize)) if (!mm->ResizeHandle(hdl.MMBlock(), newSize))
@@ -587,12 +587,12 @@ PLError_t SetHandleSize(Handle hdl, Size newSize)
return PLErrors::kNone; return PLErrors::kNone;
} }
void *NewPtr(Size size) void *NewPtr(size_t size)
{ {
return PortabilityLayer::MemoryManager::GetInstance()->Alloc(size); return PortabilityLayer::MemoryManager::GetInstance()->Alloc(size);
} }
void *NewPtrClear(Size size) void *NewPtrClear(size_t size)
{ {
void *data = NewPtr(size); void *data = NewPtr(size);
if (data != nullptr && size != 0) if (data != nullptr && size != 0)

View File

@@ -36,8 +36,6 @@ typedef int16_t SInt16;
typedef int32_t Int32; typedef int32_t Int32;
typedef uint32_t UInt32; typedef uint32_t UInt32;
typedef size_t Size;
typedef unsigned char Str15[16]; typedef unsigned char Str15[16];
typedef unsigned char Str31[32]; typedef unsigned char Str31[32];
typedef unsigned char Str63[64]; typedef unsigned char Str63[64];
@@ -256,13 +254,13 @@ void GetTime(DateTimeRec *dateTime);
void FlushEvents(); void FlushEvents();
Handle NewHandle(Size size); Handle NewHandle(size_t size);
long GetHandleSize(Handle handle); long GetHandleSize(Handle handle);
PLError_t SetHandleSize(Handle hdl, Size newSize); PLError_t SetHandleSize(Handle hdl, size_t newSize);
void *NewPtr(Size size); void *NewPtr(size_t size);
void *NewPtrClear(Size size); void *NewPtrClear(size_t size);
void DisposePtr(void *ptr); void DisposePtr(void *ptr);