fix all compilation warnings in an attempt to fix last address error problems, cut new release

This commit is contained in:
camh 2022-02-07 12:12:50 -08:00
parent f48280b866
commit 4a457f94fb
6 changed files with 36 additions and 24 deletions

View File

@ -22,14 +22,14 @@ OSErr writeSerialPortDebug(short refNum, const char* str)
// OSErr err; // OSErr err;
// return err; // return err;
const char* nameStr = ""; const unsigned char* nameStr = "\p";
switch (refNum) switch (refNum)
{ {
case aoutRefNum: case aoutRefNum:
nameStr = MODEM_PORT_OUT; nameStr = (const unsigned char*)MODEM_PORT_OUT;
break; break;
case boutRefNum: case boutRefNum:
nameStr = PRINTER_PORT_OUT; nameStr = (const unsigned char*)PRINTER_PORT_OUT;
break; break;
default: default:

View File

@ -98,17 +98,17 @@ void setupSerialPort(const char *name) {
#define PRINTER_PORT_OUT "\p.BOut" #define PRINTER_PORT_OUT "\p.BOut"
#define PRINTER_PORT_IN "\p.BIn" #define PRINTER_PORT_IN "\p.BIn"
const char* serialPortOutputName = ""; const unsigned char* serialPortOutputName = "\p";
const char* serialPortInputName = ""; const unsigned char* serialPortInputName = "\p";
if (strcmp (name, "modem") == 0) { if (strcmp (name, "modem") == 0) {
serialPortOutputName = MODEM_PORT_OUT; serialPortOutputName = (const unsigned char *)MODEM_PORT_OUT;
serialPortInputName = MODEM_PORT_IN; serialPortInputName = (const unsigned char *)MODEM_PORT_IN;
} else if (strcmp (name, "printer") == 0) { } else if (strcmp (name, "printer") == 0) {
serialPortOutputName = PRINTER_PORT_OUT; serialPortOutputName = (const unsigned char *)PRINTER_PORT_OUT;
serialPortInputName = MODEM_PORT_IN; serialPortInputName = (const unsigned char *)MODEM_PORT_IN;
} else { } else {
return; return;
@ -220,7 +220,7 @@ void readSerialPort(char* output) {
char *errorMessage = "TIMEOUT_ERROR"; char *errorMessage = "TIMEOUT_ERROR";
strncat(output, errorMessage, strlen(errorMessage)); strncat(output, errorMessage, strlen(output) - 1);
// once we are done reading the buffer entirely, we need to clear it. i'm not sure if this is the best way or not but seems to work // once we are done reading the buffer entirely, we need to clear it. i'm not sure if this is the best way or not but seems to work
memset(&GlobalSerialInputBuffer[0], 0, MAX_RECEIVE_SIZE); memset(&GlobalSerialInputBuffer[0], 0, MAX_RECEIVE_SIZE);
@ -241,7 +241,7 @@ void readSerialPort(char* output) {
if (DEBUGGING) { if (DEBUGGING) {
char debugMessage[100]; char debugMessage[100];
sprintf(debugMessage, "receive loop: byteCount: %d, lastByteCount: %d\n", byteCount, lastByteCount); sprintf(debugMessage, "receive loop: byteCount: %ld, lastByteCount: %ld\n", byteCount, lastByteCount);
printf(debugMessage); printf(debugMessage);
} }
@ -264,7 +264,7 @@ void readSerialPort(char* output) {
if (DEBUGGING) { if (DEBUGGING) {
char debugMessage[100]; char debugMessage[100];
sprintf(debugMessage, "receive loop setting last doByteCountsMatch to true: byteCount: %d, lastByteCount: %d\n", byteCount, lastByteCount); sprintf(debugMessage, "receive loop setting last doByteCountsMatch to true: byteCount: %ld, lastByteCount: %ld\n", byteCount, lastByteCount);
printf(debugMessage); printf(debugMessage);
} }
@ -275,7 +275,7 @@ void readSerialPort(char* output) {
if (DEBUGGING) { if (DEBUGGING) {
char debugMessage[100]; char debugMessage[100];
sprintf(debugMessage, "receive loop complete: byteCount: %d, lastByteCount: %d\n", byteCount, lastByteCount); sprintf(debugMessage, "receive loop complete: byteCount: %ld, lastByteCount: %ld\n", byteCount, lastByteCount);
printf(debugMessage); printf(debugMessage);
} }
@ -304,7 +304,7 @@ void readSerialPort(char* output) {
char *debugOutput; char *debugOutput;
char tempString[MAX_RECEIVE_SIZE]; char tempString[MAX_RECEIVE_SIZE];
strncat(tempString, tempOutput, totalByteCount); strncat(tempString, tempOutput, totalByteCount);
sprintf(debugOutput, "\n'%d'\n", strlen(tempString)); sprintf(debugOutput, "\n'%ld'\n", strlen(tempString));
printf(debugOutput); printf(debugOutput);
printf("\ndone with output\n"); printf("\ndone with output\n");
printf("\n"); printf("\n");
@ -453,12 +453,19 @@ char* _getReturnValueFromResponse(char* response, char* application_id, char* ca
printf("setting output to token:\n"); printf("setting output to token:\n");
printf(token); printf(token);
char *debugOutput; char *debugOutput;
sprintf(debugOutput, "\n'%d'\n", strlen(token)); sprintf(debugOutput, "\n'%ld'\n", strlen(token));
printf(debugOutput); printf(debugOutput);
printf("\ndone with output\n"); printf("\ndone with output\n");
} }
strncat(output, token, strlen(token) - 6); // the -6 here is to drop the ;;@@&& off the end of the response int lengthWithoutControlChars = strlen(token) - 6;
if (strlen(output) - 1 < lengthWithoutControlChars) {
lengthWithoutControlChars = strlen(output) - 1;
}
strncat(output, token, lengthWithoutControlChars); // drop the ;;@@&& off the end of the response
return NULL; return NULL;
@ -508,7 +515,7 @@ void writeToCoprocessor(char* operation, char* operand) {
// must be called after writeToCoprocessor and before other writeToCoprocessor // must be called after writeToCoprocessor and before other writeToCoprocessor
// operations because we depend on the location of call_counter // operations because we depend on the location of call_counter
char* getReturnValueFromResponse(char *response, char *operation, char *output) { void getReturnValueFromResponse(char *response, char *operation, char *output) {
if (DEBUGGING) { if (DEBUGGING) {

Binary file not shown.

Binary file not shown.

View File

@ -181,6 +181,7 @@ void EventLoop(struct nk_context *ctx)
int lastMouseVPos = 0; int lastMouseVPos = 0;
int lastUpdatedTickCountMessagesInChat = 0; int lastUpdatedTickCountMessagesInChat = 0;
int lastUpdatedTickCountChatCounts = 0; int lastUpdatedTickCountChatCounts = 0;
Boolean gotNewMessages = false;
do { do {
@ -196,11 +197,15 @@ void EventLoop(struct nk_context *ctx)
ShowCursor(); ShowCursor();
} }
gotNewMessages = false;
// check for new stuff every 10 sec? // check for new stuff every 10 sec?
// note! this is used by some of the functionality in our nuklear_app to trigger // note! this is used by some of the functionality in our nuklear_app to trigger
// new chat lookups // new chat lookups
if (TickCount() - lastUpdatedTickCountMessagesInChat > 600) { if (TickCount() - lastUpdatedTickCountMessagesInChat > 600) {
gotNewMessages = true;
// writeSerialPortDebug(boutRefNum, "update by tick count"); // writeSerialPortDebug(boutRefNum, "update by tick count");
lastUpdatedTickCountMessagesInChat = TickCount(); lastUpdatedTickCountMessagesInChat = TickCount();
@ -213,7 +218,7 @@ void EventLoop(struct nk_context *ctx)
// this should be out of sync with the counter above it so that we dont end up making // this should be out of sync with the counter above it so that we dont end up making
// two coprocessor calls on one event loop iteration // two coprocessor calls on one event loop iteration
if (TickCount() - lastUpdatedTickCountChatCounts > 300) { if (!gotNewMessages && TickCount() - lastUpdatedTickCountChatCounts > 300) {
// writeSerialPortDebug(boutRefNum, "update by tick count"); // writeSerialPortDebug(boutRefNum, "update by tick count");
lastUpdatedTickCountChatCounts = TickCount(); lastUpdatedTickCountChatCounts = TickCount();
@ -632,7 +637,7 @@ void DoMenuCommand(menuResult)
{ {
short menuID; /* the resource ID of the selected menu */ short menuID; /* the resource ID of the selected menu */
short menuItem; /* the item number of the selected menu */ short menuItem; /* the item number of the selected menu */
short itemHit; // short itemHit;
// Str255 daName; // Str255 daName;
// short daRefNum; // short daRefNum;
// Boolean handledByDA; // Boolean handledByDA;
@ -644,7 +649,7 @@ void DoMenuCommand(menuResult)
switch ( menuItem ) { switch ( menuItem ) {
// case iAbout: /* bring up alert for About */ // case iAbout: /* bring up alert for About */
default: default:
itemHit = Alert(rAboutAlert, nil); // itemHit = Alert(rAboutAlert, nil);
break; break;
/* /*
@ -689,7 +694,7 @@ void DoMenuCommand(menuResult)
case mHelp: case mHelp:
switch ( menuItem ) { switch ( menuItem ) {
case iQuickHelp: case iQuickHelp:
itemHit = Alert(rAboutAlert, nil); // itemHit = Alert(rAboutAlert, nil);
break; break;
case iUserGuide: case iUserGuide:
{ {
@ -875,9 +880,9 @@ Boolean TrapAvailable(tNumber,tType)
} /*TrapAvailable*/ } /*TrapAvailable*/
void AlertUser() { void AlertUser() {
short itemHit; // short itemHit;
SetCursor(&qd.arrow); SetCursor(&qd.arrow);
itemHit = Alert(rUserAlert, nil); // itemHit = Alert(rUserAlert, nil);
ExitToShell(); ExitToShell();
} /* AlertUser */ } /* AlertUser */

View File

@ -402,7 +402,7 @@ static short nk_quickdraw_font_get_text_width(nk_handle handle, short height, co
for (short i = 0; i < len; i++) { for (short i = 0; i < len; i++) {
width += widthFor12ptFont[text[i]]; width += widthFor12ptFont[(int)text[i]];
} }
return width; return width;