Clean up headers and make things static where appropriate.

Also include a few missing prototypes, which could possibly fix bugs.
This commit is contained in:
Stephen Heumann 2016-05-13 19:35:41 -05:00
parent b8bdc81eda
commit 141739c985
15 changed files with 79 additions and 56 deletions

View File

@ -1,4 +1,7 @@
#if __ORCAC__
#pragma lint -1
#pragma noroot #pragma noroot
#endif
#include <window.h> #include <window.h>
#include <quickdraw.h> #include <quickdraw.h>
@ -15,6 +18,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <event.h> #include <event.h>
#include <limits.h> #include <limits.h>
#include <orca.h>
#include "vncsession.h" #include "vncsession.h"
#include "vncview.h" #include "vncview.h"

View File

@ -1,4 +1,7 @@
#if __ORCAC__
#pragma lint -1
#pragma noroot #pragma noroot
#endif
#include <types.h> #include <types.h>
#include <stdlib.h> #include <stdlib.h>

View File

@ -1,4 +1,7 @@
#if __ORCAC__
#pragma lint -1
#pragma noroot #pragma noroot
#endif
#include <window.h> #include <window.h>
#include <quickdraw.h> #include <quickdraw.h>

View File

@ -1,4 +1,7 @@
#if __ORCAC__
#pragma lint -1
#pragma noroot #pragma noroot
#endif
#include <window.h> #include <window.h>
#include <quickdraw.h> #include <quickdraw.h>

View File

@ -1,4 +1,7 @@
#if __ORCAC__
#pragma lint -1
#pragma noroot #pragma noroot
#endif
#include <window.h> #include <window.h>
#include <quickdraw.h> #include <quickdraw.h>
@ -29,10 +32,10 @@
#include "raw.h" #include "raw.h"
#include "hextile.h" #include "hextile.h"
unsigned int hexXTiles, hexYTiles; /* For in-process hextile processing */ static unsigned int hexXTiles, hexYTiles; /* For in-process hextile processing */
unsigned int hexXTileNum, hexYTileNum; static unsigned int hexXTileNum, hexYTileNum;
unsigned int hexTileWidth, hexTileHeight; static unsigned int hexTileWidth, hexTileHeight;
unsigned char hexBackground, hexForeground; static unsigned char hexBackground, hexForeground;
static BOOLEAN extraByteAdvance; static BOOLEAN extraByteAdvance;
@ -48,7 +51,7 @@ static BOOLEAN extraByteAdvance;
#define hexWaitingForSubrect 4 #define hexWaitingForSubrect 4
#define hexWaitingForRawData 8 #define hexWaitingForRawData 8
void HexNextTile (void) { static void HexNextTile (void) {
hexXTileNum++; hexXTileNum++;
if (hexXTileNum == hexXTiles) { if (hexXTileNum == hexXTiles) {
hexYTileNum++; hexYTileNum++;
@ -67,7 +70,7 @@ void HexNextTile (void) {
} }
void HexRawDraw (Point *contentOriginPtr, int rectWidth, int rectHeight) { static void HexRawDraw (Point *contentOriginPtr, int rectWidth, int rectHeight) {
unsigned int i, j; /* Loop indices */ unsigned int i, j; /* Loop indices */
unsigned int n = 0; unsigned int n = 0;
unsigned char *dataPtr; unsigned char *dataPtr;

View File

@ -1,4 +1,7 @@
#if __ORCAC__
#pragma lint -1
#pragma noroot #pragma noroot
#endif
#include <window.h> #include <window.h>
#include <quickdraw.h> #include <quickdraw.h>

View File

@ -1,2 +1,3 @@
void SendKeyEvent (BOOLEAN keyDownFlag, unsigned long key);
extern void ProcessKeyEvent (void); extern void ProcessKeyEvent (void);
extern void SendModifiers (void); extern void SendModifiers (void);

View File

@ -1,4 +1,7 @@
#if __ORCAC__
#pragma lint -1
#pragma noroot #pragma noroot
#endif
#include <window.h> #include <window.h>
#include <quickdraw.h> #include <quickdraw.h>

15
raw.cc
View File

@ -1,4 +1,7 @@
#if __ORCAC__
#pragma lint -1
#pragma noroot #pragma noroot
#endif
#include <window.h> #include <window.h>
#include <quickdraw.h> #include <quickdraw.h>
@ -30,18 +33,18 @@
#include "hextile.h" #include "hextile.h"
/* Data on state of raw rectangle drawing routines */ /* Data on state of raw rectangle drawing routines */
unsigned int lineBytes; /* Number of bytes in a line of GS pixels */ static unsigned int lineBytes; /* Number of bytes in a line of GS pixels */
unsigned long pixels; static unsigned long pixels;
unsigned int drawingLine; /* Line to be drawn while displaying */ static unsigned int drawingLine; /* Line to be drawn while displaying */
static BOOLEAN extraByteAdvance; static BOOLEAN extraByteAdvance;
unsigned char *destPtr; static unsigned char *destPtr;
/* Ends drawing of a raw rectangle when it is complete or aborted /* Ends drawing of a raw rectangle when it is complete or aborted
* because the rectangle is not visible. * because the rectangle is not visible.
*/ */
void StopRawDrawing (void) { static void StopRawDrawing (void) {
HUnlock(readBufferHndl); HUnlock(readBufferHndl);
free(srcLocInfo.ptrToPixImage); /* Allocated as destPtr */ free(srcLocInfo.ptrToPixImage); /* Allocated as destPtr */
@ -252,7 +255,7 @@ void RawDraw (void) {
#pragma optimize -1 #pragma optimize -1
/* Draw one line of Raw data - used if the complete rect isn't yet available */ /* Draw one line of Raw data - used if the complete rect isn't yet available */
void RawDrawLine (void) { static void RawDrawLine (void) {
unsigned int i; unsigned int i;
unsigned char *dataPtr; unsigned char *dataPtr;
unsigned long contentOrigin; unsigned long contentOrigin;

View File

@ -1,4 +1,7 @@
#if __ORCAC__
#pragma lint -1
#pragma noroot #pragma noroot
#endif
#include <window.h> #include <window.h>
#include <quickdraw.h> #include <quickdraw.h>
@ -15,6 +18,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <event.h> #include <event.h>
#include <limits.h> #include <limits.h>
#include <orca.h>
#include "vncsession.h" #include "vncsession.h"
#include "vncview.h" #include "vncview.h"
@ -34,12 +38,12 @@ unsigned int fbWidth;
BOOLEAN displayInProgress; BOOLEAN displayInProgress;
unsigned int numRects; static unsigned int numRects;
unsigned int rectX; unsigned int rectX;
unsigned int rectY; unsigned int rectY;
unsigned int rectWidth; unsigned int rectWidth;
unsigned int rectHeight; unsigned int rectHeight;
unsigned long rectEncoding; static unsigned long rectEncoding;
GrafPortPtr vncWindow; GrafPortPtr vncWindow;
@ -67,7 +71,7 @@ BOOLEAN checkBounds = FALSE; /* Adjust drawing to stay in bounds */
* is an unavoidable penalty of opening other windows over the main VNC window. * is an unavoidable penalty of opening other windows over the main VNC window.
*/ */
#pragma databank 1 #pragma databank 1
void VNCRedraw (void) { static void VNCRedraw (void) {
RegionHndl updateRgnHndl; RegionHndl updateRgnHndl;
updateRgnHndl = vncWindow->visRgn; updateRgnHndl = vncWindow->visRgn;
@ -85,7 +89,7 @@ void VNCRedraw (void) {
/* Change Super Hi-Res display to the specified resolution (640 or 320). /* Change Super Hi-Res display to the specified resolution (640 or 320).
* Uses the procedure described in IIgs Tech Note #4. * Uses the procedure described in IIgs Tech Note #4.
*/ */
void ChangeResolution(int rez) { static void ChangeResolution(int rez) {
static Handle dpSpace; static Handle dpSpace;
unsigned int masterSCB; unsigned int masterSCB;
@ -213,7 +217,7 @@ void SendFBUpdateRequest (BOOLEAN incremental, unsigned int x, unsigned int y,
/* Start responding to a FramebufferUpdate from the server /* Start responding to a FramebufferUpdate from the server
*/ */
void DoFBUpdate (void) { static void DoFBUpdate (void) {
unsigned int *dataPtr; /* Pointer to header data */ unsigned int *dataPtr; /* Pointer to header data */
if (!DoWaitingReadTCP(15)) { if (!DoWaitingReadTCP(15)) {
@ -239,7 +243,7 @@ void DoFBUpdate (void) {
* would be bad but for the fact that it will never be called if the server * would be bad but for the fact that it will never be called if the server
* is actually working correctly. * is actually working correctly.
*/ */
void DoSetColourMapEntries (void) { static void DoSetColourMapEntries (void) {
unsigned int numColors; unsigned int numColors;
DoWaitingReadTCP(3); DoWaitingReadTCP(3);

View File

@ -3,12 +3,10 @@ extern unsigned int fbWidth;
extern BOOLEAN displayInProgress; extern BOOLEAN displayInProgress;
extern unsigned int numRects;
extern unsigned int rectX; extern unsigned int rectX;
extern unsigned int rectY; extern unsigned int rectY;
extern unsigned int rectWidth; extern unsigned int rectWidth;
extern unsigned int rectHeight; extern unsigned int rectHeight;
extern unsigned long rectEncoding;
#define encodingRaw 0 #define encodingRaw 0
#define encodingCopyRect 1 #define encodingCopyRect 1
@ -43,3 +41,4 @@ void SendFBUpdateRequest (BOOLEAN /*incremental*/, unsigned int /*x*/,
void ConnectedEventLoop (void); void ConnectedEventLoop (void);
void NextRect (void);

View File

@ -57,8 +57,14 @@ void ** readBufferHndl; /* Handle to the data read by the last
* DoReadTCP call. Copy this elsewhere if more * DoReadTCP call. Copy this elsewhere if more
* data may be read while it is still in use. * data may be read while it is still in use.
*/ */
BOOLEAN readError; static BOOLEAN alerted = FALSE;
BOOLEAN alerted = FALSE;
static void CloseConnectStatusWindow (void);
static BOOLEAN ConnectTCPIP (void);
static BOOLEAN GetIpid (void);
static BOOLEAN DoVNCHandshaking (void);
static BOOLEAN DoDES (void);
static BOOLEAN FinishVNCHandshaking (void);
#define buffTypePointer 0x0000 /* For TCPIPReadTCP() */ #define buffTypePointer 0x0000 /* For TCPIPReadTCP() */
#define buffTypeHandle 0x0001 #define buffTypeHandle 0x0001
@ -178,7 +184,7 @@ void DisplayConnectStatus(char *statusString, BOOLEAN cancelMessage) {
***********************************************************************/ ***********************************************************************/
#pragma databank 1 /* Set data bank register to access globals. */ #pragma databank 1 /* Set data bank register to access globals. */
#pragma toolparms 1 /* Use tool-style stack model */ #pragma toolparms 1 /* Use tool-style stack model */
void DisplayConnectStatusFromTool (char *statusString) { static void DisplayConnectStatusFromTool (char *statusString) {
DisplayConnectStatus(statusString, TRUE); DisplayConnectStatus(statusString, TRUE);
} }
#pragma toolparms 0 /* Use ORCA stack model */ #pragma toolparms 0 /* Use ORCA stack model */
@ -187,7 +193,7 @@ void DisplayConnectStatusFromTool (char *statusString) {
/*********************************************************************** /***********************************************************************
* CloseConnectStatusWindow - Close connect status window (if open) * CloseConnectStatusWindow - Close connect status window (if open)
***********************************************************************/ ***********************************************************************/
void CloseConnectStatusWindow (void) { static void CloseConnectStatusWindow (void) {
if (connectStatusWindowPtr != NULL) { if (connectStatusWindowPtr != NULL) {
CloseWindow(connectStatusWindowPtr); CloseWindow(connectStatusWindowPtr);
connectStatusWindowPtr = NULL; connectStatusWindowPtr = NULL;
@ -197,7 +203,7 @@ void CloseConnectStatusWindow (void) {
/*********************************************************************** /***********************************************************************
* ConnectTCPIP - Try to establish a TCP/IP connection through Marinetti * ConnectTCPIP - Try to establish a TCP/IP connection through Marinetti
***********************************************************************/ ***********************************************************************/
BOOLEAN ConnectTCPIP (void) static BOOLEAN ConnectTCPIP (void)
{ {
BOOLEAN connected = FALSE; /* Are we connected to the network now? */ BOOLEAN connected = FALSE; /* Are we connected to the network now? */
@ -220,7 +226,7 @@ BOOLEAN ConnectTCPIP (void)
/*********************************************************************** /***********************************************************************
* GetIpid() - parse the server name and attempt to get an ipid for it * GetIpid() - parse the server name and attempt to get an ipid for it
***********************************************************************/ ***********************************************************************/
BOOLEAN GetIpid (void) static BOOLEAN GetIpid (void)
{ {
#define baseDisplayNum 5900 #define baseDisplayNum 5900
@ -283,7 +289,7 @@ BOOLEAN GetIpid (void)
#undef baseDisplayNum #undef baseDisplayNum
} }
unsigned int tcperr; static unsigned int tcperr;
/* Read data, waiting for up to 15 seconds for the data to be ready */ /* Read data, waiting for up to 15 seconds for the data to be ready */
BOOLEAN DoWaitingReadTCP(unsigned long dataLength) { BOOLEAN DoWaitingReadTCP(unsigned long dataLength) {
@ -300,7 +306,7 @@ BOOLEAN DoWaitingReadTCP(unsigned long dataLength) {
/* Fix things when TCPIPReadTCP returns less data than it's supposed to */ /* Fix things when TCPIPReadTCP returns less data than it's supposed to */
BOOLEAN ReadFixup (unsigned long requested, unsigned long returned) { static BOOLEAN ReadFixup (unsigned long requested, unsigned long returned) {
static rrBuff theRRBuff; static rrBuff theRRBuff;
static void **fixupBufferHndl = NULL; static void **fixupBufferHndl = NULL;
@ -369,7 +375,7 @@ BOOLEAN DoReadTCP (unsigned long dataLength) {
/********************************************************************** /**********************************************************************
* DoVNCHandshaking() - Establish connection to VNC server * DoVNCHandshaking() - Establish connection to VNC server
**********************************************************************/ **********************************************************************/
BOOLEAN DoVNCHandshaking (void) { static BOOLEAN DoVNCHandshaking (void) {
#define connectionFailedAlert 2004 #define connectionFailedAlert 2004
#define badRFBVersionAlert 2008 #define badRFBVersionAlert 2008
#define badAuthTypeAlert 2009 #define badAuthTypeAlert 2009
@ -459,7 +465,7 @@ BOOLEAN DoVNCHandshaking (void) {
/********************************************************************** /**********************************************************************
* DoDES() - Try to do DES (aka VNC) authentication * DoDES() - Try to do DES (aka VNC) authentication
**********************************************************************/ **********************************************************************/
BOOLEAN DoDES (void) { static BOOLEAN DoDES (void) {
/* This reverses the order of the low 7 bits of a byte. */ /* This reverses the order of the low 7 bits of a byte. */
/* Uses the high bit (7) as scratch space. */ /* Uses the high bit (7) as scratch space. */
#define SwitchBits(x) do { x &= 0x7f; /* Clear 7 */ \ #define SwitchBits(x) do { x &= 0x7f; /* Clear 7 */ \
@ -599,7 +605,7 @@ BOOLEAN DoDES (void) {
/********************************************************************** /**********************************************************************
* FinishVNCHandshaking() - Complete VNC protocol initialization * FinishVNCHandshaking() - Complete VNC protocol initialization
**********************************************************************/ **********************************************************************/
BOOLEAN FinishVNCHandshaking (void) { static BOOLEAN FinishVNCHandshaking (void) {
#define screenTooBigError 2010 #define screenTooBigError 2010
unsigned char sharedFlag; unsigned char sharedFlag;
unsigned long serverNameLen; unsigned long serverNameLen;

View File

@ -14,8 +14,6 @@
(((unsigned long)x & 0x0000FF00) << 8) | \ (((unsigned long)x & 0x0000FF00) << 8) | \
(((unsigned long)x & 0x00FF0000) >> 8)) (((unsigned long)x & 0x00FF0000) >> 8))
extern BOOLEAN readError;
extern GrafPortPtr connectStatusWindowPtr; extern GrafPortPtr connectStatusWindowPtr;
extern void ** readBufferHndl; extern void ** readBufferHndl;
@ -25,12 +23,6 @@ extern unsigned int hostIpid;
extern void DisplayConnectStatus(char *, BOOLEAN); extern void DisplayConnectStatus(char *, BOOLEAN);
extern void DoConnect (void); extern void DoConnect (void);
extern BOOLEAN GetIpid (void);
extern BOOLEAN ConnectTCPIP (void);
extern BOOLEAN DoReadTCP (unsigned long); extern BOOLEAN DoReadTCP (unsigned long);
extern BOOLEAN DoWaitingReadTCP(unsigned long); extern BOOLEAN DoWaitingReadTCP(unsigned long);
extern void CloseTCPConnection (void); extern void CloseTCPConnection (void);
extern BOOLEAN DoDES (void);
extern BOOLEAN DoVNCHandshaking(void);
extern BOOLEAN FinishVNCHandshaking(void);
extern void CloseConnectStatusWindow (void);

View File

@ -68,12 +68,12 @@
#define radHextile 26 #define radHextile 26
BOOLEAN done = FALSE; /* are we done, yet? */ static BOOLEAN done = FALSE; /* are we done, yet? */
EventRecord myEvent; /* event record for menu mode */ EventRecord myEvent; /* event record for menu mode */
GrafPortPtr newConnWindow; /* pointer to new connection window */ GrafPortPtr newConnWindow; /* pointer to new connection window */
BOOLEAN vncConnected = FALSE; /* are we connected to a VNC host */ BOOLEAN vncConnected = FALSE; /* are we connected to a VNC host */
int menuOffset; /* Indicates which menu bar is active */ int menuOffset; /* Indicates which menu bar is active */
Ref startStopParm; /* tool start/shutdown parameter */ static Ref startStopParm; /* tool start/shutdown parameter */
BOOLEAN colorTablesComplete = FALSE; /* Are the big color tables complete */ BOOLEAN colorTablesComplete = FALSE; /* Are the big color tables complete */
@ -87,6 +87,8 @@ BOOLEAN useHextile = FALSE;
char vncServer[257]; char vncServer[257];
char vncPassword[10]; char vncPassword[10];
static void Quit (void);
/*************************************************************** /***************************************************************
* DrawContents - Draw the contents of the active port * DrawContents - Draw the contents of the active port
@ -94,7 +96,7 @@ char vncPassword[10];
#pragma databank 1 #pragma databank 1
void DrawContents (void) { static void DrawContents (void) {
PenNormal(); /* use a "normal" pen */ PenNormal(); /* use a "normal" pen */
DrawControls(GetPort()); /* draw controls in window */ DrawControls(GetPort()); /* draw controls in window */
} }
@ -105,7 +107,7 @@ void DrawContents (void) {
* DoAbout - Draw our about box * DoAbout - Draw our about box
***************************************************************/ ***************************************************************/
void DoAbout (void) { static void DoAbout (void) {
#define alertID 1 /* alert string resource ID */ #define alertID 1 /* alert string resource ID */
AlertWindow(awCString+awResource, NULL, alertID); AlertWindow(awCString+awResource, NULL, alertID);
@ -117,7 +119,7 @@ void DoAbout (void) {
* DoNewConnection - Show the New Connection window * DoNewConnection - Show the New Connection window
***************************************************************/ ***************************************************************/
void DoNewConnection (void) { static void DoNewConnection (void) {
unsigned int masterSCB; unsigned int masterSCB;
masterSCB = GetMasterSCB(); masterSCB = GetMasterSCB();
@ -157,7 +159,7 @@ void DoClose (GrafPortPtr wPtr) {
* editAction: Action selected from edit menu * editAction: Action selected from edit menu
***************************************************************/ ***************************************************************/
void DoLEEdit (int editAction) { static void DoLEEdit (int editAction) {
CtlRecHndl ctl; /* target control handle */ CtlRecHndl ctl; /* target control handle */
unsigned long id; /* control ID */ unsigned long id; /* control ID */
GrafPortPtr port; /* caller's GrafPort */ GrafPortPtr port; /* caller's GrafPort */
@ -192,7 +194,7 @@ void DoLEEdit (int editAction) {
* HandleMenu - Initialize the menu bar. * HandleMenu - Initialize the menu bar.
***************************************************************/ ***************************************************************/
void HandleMenu (void) { static void HandleMenu (void) {
int menuNum, menuItemNum; /* menu number & menu item number */ int menuNum, menuItemNum; /* menu number & menu item number */
menuNum = myEvent.wmTaskData >> 16; menuNum = myEvent.wmTaskData >> 16;
@ -218,7 +220,7 @@ void HandleMenu (void) {
* HandleControl - Handle a control press in the New Conn. window * HandleControl - Handle a control press in the New Conn. window
***************************************************************/ ***************************************************************/
void HandleControl (void) { static void HandleControl (void) {
switch (myEvent.wmTaskData4) { switch (myEvent.wmTaskData4) {
case btnConnect: DoConnect(); break; case btnConnect: DoConnect(); break;
case btnCancel: DoClose(newConnWindow); break; case btnCancel: DoClose(newConnWindow); break;
@ -274,7 +276,7 @@ void InitMenus (int offset) {
* CheckMenus - Check the menus to see if they should be dimmed * CheckMenus - Check the menus to see if they should be dimmed
***************************************************************/ ***************************************************************/
void CheckMenus (void) { static void CheckMenus (void) {
GrafPortPtr activeWindow; /* Front visible window */ GrafPortPtr activeWindow; /* Front visible window */
static GrafPortPtr lastActiveWindow; static GrafPortPtr lastActiveWindow;
@ -335,7 +337,7 @@ void CheckMenus (void) {
/* InitScreen - Set up color tables and SCBs to appropriate values /* InitScreen - Set up color tables and SCBs to appropriate values
*/ */
void InitScreen (void) { static void InitScreen (void) {
static ColorTable gray640Colors = { static ColorTable gray640Colors = {
0x0000, 0x0555, 0x0AAA, 0x0FFF, 0x0000, 0x0555, 0x0AAA, 0x0FFF, 0x0000, 0x0555, 0x0AAA, 0x0FFF, 0x0000, 0x0555, 0x0AAA, 0x0FFF,
0x0000, 0x0555, 0x0AAA, 0x0FFF, 0x0000, 0x0555, 0x0AAA, 0x0FFF 0x0000, 0x0555, 0x0AAA, 0x0FFF, 0x0000, 0x0555, 0x0AAA, 0x0FFF
@ -347,7 +349,7 @@ void InitScreen (void) {
InitPalette(); /* Restore Apple Menu colors */ InitPalette(); /* Restore Apple Menu colors */
} }
void Quit (void) { static void Quit (void) {
/* Done with event loop - now quitting */ /* Done with event loop - now quitting */
if (vncConnected) /* Disconnect if still connected */ if (vncConnected) /* Disconnect if still connected */
CloseTCPConnection(); CloseTCPConnection();

View File

@ -9,16 +9,12 @@ extern GrafPortPtr newConnWindow;
extern int menuOffset; extern int menuOffset;
/* Connection options */ /* Connection options */
extern BOOLEAN color;
extern int hRez; extern int hRez;
extern int vRez;
extern BOOLEAN requestSharedSession; extern BOOLEAN requestSharedSession;
extern BOOLEAN allowClipboardTransfers; extern BOOLEAN allowClipboardTransfers;
extern BOOLEAN emulate3ButtonMouse; extern BOOLEAN emulate3ButtonMouse;
extern BOOLEAN viewOnlyMode; extern BOOLEAN viewOnlyMode;
extern BOOLEAN useHextile; extern BOOLEAN useHextile;
extern BOOLEAN localPointer;
extern unsigned long deleteKeysym;
extern char vncServer[257]; extern char vncServer[257];
extern char vncPassword[10]; extern char vncPassword[10];
@ -27,6 +23,4 @@ extern BOOLEAN vncConnected; /* Is the GS desktop active */
extern BOOLEAN colorTablesComplete; /* Are the color tables complete */ extern BOOLEAN colorTablesComplete; /* Are the color tables complete */
extern void DoClose (GrafPortPtr wPtr); extern void DoClose (GrafPortPtr wPtr);
extern void DrawContents (void);
extern void InitMenus (int); extern void InitMenus (int);
extern void Quit (void);