mirror of
https://github.com/jeremysrand/Listener.git
synced 2024-06-01 16:41:31 +00:00
Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
e65f577659 | ||
|
4de42bf26e |
|
@ -7,17 +7,17 @@
|
|||
<key>Archive.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>3</integer>
|
||||
<integer>2</integer>
|
||||
</dict>
|
||||
<key>Binary.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>4</integer>
|
||||
<integer>3</integer>
|
||||
</dict>
|
||||
<key>DiskImage.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>2</integer>
|
||||
<integer>1</integer>
|
||||
</dict>
|
||||
<key>Listener.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
|
@ -27,7 +27,7 @@
|
|||
<key>doNotBuild.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>1</integer>
|
||||
<integer>4</integer>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include <locator.h>
|
||||
#include <tcpip.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -143,7 +144,7 @@ static char * stateMessages[NUM_LISTEN_STATES] = {
|
|||
|
||||
// Implementation
|
||||
|
||||
void delayToNextTick()
|
||||
void delayToNextTick(void)
|
||||
{
|
||||
LongWord oldTickCounter = GetTick();
|
||||
while (oldTickCounter == GetTick())
|
||||
|
@ -195,7 +196,7 @@ void teardownNetwork(void)
|
|||
}
|
||||
|
||||
|
||||
void freeText(void)
|
||||
void freeMemory(void)
|
||||
{
|
||||
tTextList * textList = globals->textListHead;
|
||||
|
||||
|
@ -207,30 +208,25 @@ void freeText(void)
|
|||
textList = textList->header.next;
|
||||
free(prev);
|
||||
}
|
||||
|
||||
free(globals);
|
||||
globals = NULL;
|
||||
}
|
||||
|
||||
void NDAClose(void)
|
||||
{
|
||||
if ((globals != NULL) &&
|
||||
(globals->ndaActive)) {
|
||||
if (globals == NULL)
|
||||
return;
|
||||
|
||||
if (globals->ndaActive) {
|
||||
CloseWindow(globals->winPtr);
|
||||
globals->winPtr = NULL;
|
||||
globals->ndaActive = FALSE;
|
||||
ResourceShutDown();
|
||||
}
|
||||
|
||||
teardownNetwork();
|
||||
ResourceShutDown();
|
||||
freeText();
|
||||
memset(globals, 0, sizeof(*globals));
|
||||
}
|
||||
|
||||
|
||||
void freeGlobals(void)
|
||||
{
|
||||
freeText();
|
||||
|
||||
free(globals);
|
||||
globals = NULL;
|
||||
freeMemory();
|
||||
}
|
||||
|
||||
|
||||
|
@ -241,15 +237,6 @@ void NDAInit(int code)
|
|||
*/
|
||||
if (code) {
|
||||
userId = MMStartUp();
|
||||
globals = malloc(sizeof(*globals));
|
||||
memset(globals, 0, sizeof(*globals));
|
||||
} else {
|
||||
if ((globals != NULL) &&
|
||||
(globals->ndaActive)) {
|
||||
NDAClose();
|
||||
teardownNetwork();
|
||||
freeGlobals();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -297,6 +284,11 @@ GrafPortPtr NDAOpen(void)
|
|||
SysPrefsRecGS prefsDCB;
|
||||
unsigned int oldPrefs;
|
||||
|
||||
if (globals == NULL) {
|
||||
globals = malloc(sizeof(*globals));
|
||||
memset(globals, 0, sizeof(*globals));
|
||||
}
|
||||
|
||||
if (globals->ndaActive)
|
||||
return NULL;
|
||||
|
||||
|
@ -314,7 +306,7 @@ GrafPortPtr NDAOpen(void)
|
|||
|
||||
oldResourceApp = OpenResourceFileByID(readEnable, userId);
|
||||
|
||||
globals->winPtr = NewWindow2("\p Listener ", 0, DrawContents, NULL, 0x02, windowRes, rWindParam1);
|
||||
globals->winPtr = NewWindow2((Pointer)"\p Listener ", 0, DrawContents, NULL, 0x02, windowRes, rWindParam1);
|
||||
|
||||
SetSysWindow(globals->winPtr);
|
||||
ShowWindow(globals->winPtr);
|
||||
|
@ -670,6 +662,9 @@ BOOLEAN NDAAction(EventRecord *sysEvent, int code)
|
|||
unsigned int eventCode;
|
||||
BOOLEAN result = FALSE;
|
||||
|
||||
if (globals == NULL)
|
||||
return result;
|
||||
|
||||
switch (code) {
|
||||
case runAction:
|
||||
HandleRun();
|
||||
|
|
|
@ -16,7 +16,7 @@ resource rVersion (1) {
|
|||
{
|
||||
1, /* Major version number in BCD */
|
||||
0, /* Minor version number in BCD */
|
||||
0, /* Bug version number in BCD */
|
||||
1, /* Bug version number in BCD */
|
||||
release, /* Development phase */
|
||||
0 /* Release number */
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue
Block a user