Skip to content

Commit

Permalink
Cleanup parse errors which appear in the latest Xcode.
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremysrand committed Jun 8, 2023
1 parent 0ae5fa1 commit 1be8d21
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 20 deletions.
24 changes: 13 additions & 11 deletions BuGS/globalScores.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@
* Copyright © 2021 Jeremy Rand. All rights reserved.
*/

#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>

#include <Hash.h>
#include <locator.h>
#include <misctool.h>
#include <stdint.h>
#include <orca.h>
#include <tcpip.h>
#include <types.h>

#include <stdio.h>
#include <stdlib.h>

#include "globalScores.h"

Expand Down Expand Up @@ -181,6 +182,10 @@ static void handleClosingTcp(void);

// Globals

#if __ORCAC__
segment "highscores";
#endif

static tGameNetworkStateHandler handlers[NUM_GAME_NETWORK_STATES] = {
handleConnectFailed,
handleUnconnected,
Expand Down Expand Up @@ -222,9 +227,6 @@ tSetHighScoreRequestWithHash setHighScoreRequest;

// Implementation


segment "highscores";

void initNetwork(tHighScoreInitParams * params)
{
networkGlobals = NULL;
Expand Down Expand Up @@ -411,7 +413,7 @@ static void handleUnconnected(void)

static void handleConnected(void)
{
TCPIPDNRNameToIP(networkGlobals->initParams.scoreServer, &(networkGlobals->domainNameResolution));
TCPIPDNRNameToIP((char *)networkGlobals->initParams.scoreServer, &(networkGlobals->domainNameResolution));
if (toolerror()) {
networkGlobals->gameNetworkState = GAME_NETWORK_LOOKUP_FAILED;
networkGlobals->errorCode = toolerror();
Expand Down Expand Up @@ -572,7 +574,7 @@ static void handleRequestScores(void)
md5Init(&(networkGlobals->hashWorkBlock));
md5Append(&(networkGlobals->hashWorkBlock), (Pointer)&(networkGlobals->secrets), sizeof(networkGlobals->secrets));
md5Append(&(networkGlobals->hashWorkBlock), (Pointer)&(networkGlobals->highScoreRequest.highScoreRequest), sizeof(networkGlobals->highScoreRequest.highScoreRequest));
md5Finish(&(networkGlobals->hashWorkBlock), &(networkGlobals->highScoreRequest.md5Digest[0]));
md5Finish(&(networkGlobals->hashWorkBlock), (Pointer)&(networkGlobals->highScoreRequest.md5Digest[0]));

networkGlobals->errorCode = TCPIPWriteTCP(networkGlobals->ipid, (Pointer)&(networkGlobals->highScoreRequest), sizeof(networkGlobals->highScoreRequest), FALSE, FALSE);
if (networkGlobals->errorCode != tcperrOK) {
Expand Down Expand Up @@ -637,7 +639,7 @@ static void handleSetHighScore(void)
md5Init(&(networkGlobals->hashWorkBlock));
md5Append(&(networkGlobals->hashWorkBlock), (Pointer)&(networkGlobals->secrets), sizeof(networkGlobals->secrets));
md5Append(&(networkGlobals->hashWorkBlock), (Pointer)&(setHighScoreRequest.setHighScoreRequest), sizeof(setHighScoreRequest.setHighScoreRequest));
md5Finish(&(networkGlobals->hashWorkBlock), &(setHighScoreRequest.md5Digest[0]));
md5Finish(&(networkGlobals->hashWorkBlock), (Pointer)&(setHighScoreRequest.md5Digest[0]));

networkGlobals->errorCode = TCPIPWriteTCP(networkGlobals->ipid, (Pointer)&setHighScoreRequest, sizeof(setHighScoreRequest), FALSE, FALSE);
if (networkGlobals->errorCode != tcperrOK) {
Expand Down
2 changes: 1 addition & 1 deletion BuGS/globalScores.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#define _GUARD_PROJECTBuGS_FILEglobalScores_


#include <types.h>
#include <TYPES.h>


typedef struct tHighScore
Expand Down
5 changes: 4 additions & 1 deletion BuGS/loadSounds.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,16 @@
#include "main.h"



#if __ORCAC__
segment "loadSounds";
#endif

static void loadSound(Word addr, Word soundNum)
{
Handle handle = LoadResource(rRawSound, soundNum);
HLock(handle);
WriteRamBlock(*handle, addr, GetHandleSize(handle));
WriteRamBlock(*handle, addr, (Word)GetHandleSize(handle));
HUnlock(handle);
}

Expand Down
2 changes: 1 addition & 1 deletion BuGS/loadSounds.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#define _GUARD_PROJECTBuGS_FILEloadSounds_


#include <types.h>
#include <TYPES.h>


extern void loadSpiderSound(Word addr);
Expand Down
12 changes: 8 additions & 4 deletions BuGS/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,27 @@
*
*/


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

#include <orca.h>
#include <Memory.h>
#include <Locator.h>
#include <MiscTool.h>

#include "main.h"
#include "game.h"
#include "globalScores.h"
#include "settings.h"
#include "tileData.h"


/* Defines and macros */

#define TOOLFAIL(string) \
if (toolerror()) SysFailMgr(toolerror(), "\p" string "\n\r Error Code -> $");
if (toolerror()) SysFailMgr(toolerror(), (Pointer)"\p" string "\n\r Error Code -> $");


/* Globals */
Expand Down Expand Up @@ -74,7 +78,7 @@ void scorePosition(unsigned int position, unsigned int numberOfScores)
int i;

sprintf(globalScoreInfo, " %u OF %u SCORES", position, numberOfScores);
for (i = strlen(globalScoreInfo); i < sizeof(globalScoreInfo); i++) {
for (i = (int)strlen(globalScoreInfo); i < sizeof(globalScoreInfo); i++) {
globalScoreInfo[i] = ' ';
}
globalScoreInfo[GAME_NUM_TILES_WIDE] = '\0';
Expand Down Expand Up @@ -124,7 +128,7 @@ int main(void)
SetMouse(transparent);

highScoreInitParams.userId = myUserId;
highScoreInitParams.scoreServer = "\p" NETWORK_SERVER;
highScoreInitParams.scoreServer = (const char *)"\p" NETWORK_SERVER;
highScoreInitParams.scorePort = NETWORK_SERVERPORT;
highScoreInitParams.secret1 = NETWORK_SERVERSECRET1;
highScoreInitParams.secret2 = NETWORK_SERVERSECRET2;
Expand Down
6 changes: 5 additions & 1 deletion BuGS/settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@
* Copyright © 2021 Jeremy Rand. All rights reserved.
*/

#include <string.h>

#include <gsos.h>
#include <orca.h>
#include <Memory.h>

#include "game.h"
#include "globalScores.h"
#include "settings.h"
#include "tileData.h"
Expand Down Expand Up @@ -62,8 +65,9 @@ static Handle filenameHandle = NULL;

// Implementation

#if __ORCAC__
segment "settings";

#endif

static void allocateFilenameHandle(void)
{
Expand Down
2 changes: 1 addition & 1 deletion BuGS/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#ifndef _GUARD_PROJECTBuGS_FILEsettings_
#define _GUARD_PROJECTBuGS_FILEsettings_

#include <types.h>
#include <TYPES.h>


extern unsigned int myUserId;
Expand Down

0 comments on commit 1be8d21

Please sign in to comment.