diff --git a/Descent3/Game2DLL.cpp b/Descent3/Game2DLL.cpp index aaaca14c..bb334f82 100644 --- a/Descent3/Game2DLL.cpp +++ b/Descent3/Game2DLL.cpp @@ -578,7 +578,7 @@ bool InitGameModule(char *name, module *mod) { if (!cf_OpenLibrary(lib_name)) { ddio_MakePath(tmp_dll_name, Base_directory, "netgames", name, NULL); strcat(tmp_dll_name, ".d3m"); - Multi_game_dll_name[0] = NULL; + Multi_game_dll_name[0] = '\0'; goto loaddll; } // get a temp file name diff --git a/Descent3/TelComEffects.cpp b/Descent3/TelComEffects.cpp index af693ae2..323e9647 100644 --- a/Descent3/TelComEffects.cpp +++ b/Descent3/TelComEffects.cpp @@ -124,10 +124,6 @@ #include "hlsoundlib.h" #include "soundload.h" -#ifndef MACINTOSH -#define IGNORE_TABLE(x) x -#endif - tceffect TCEffects[MAX_TCEFFECTS]; int Screen_roots[MAX_TELCOM_SCREENS]; bool Screen_has_effect_with_focus[MAX_TELCOM_SCREENS]; diff --git a/Descent3/dedicated_server.cpp b/Descent3/dedicated_server.cpp index 44f91913..30751332 100644 --- a/Descent3/dedicated_server.cpp +++ b/Descent3/dedicated_server.cpp @@ -780,7 +780,9 @@ void PrintDedicatedMessage(const char *fmt, ...) { #include "linux/linux_fix.h" #include "errno.h" #define BOOL bool -#define SOCKET unsigned int +#ifndef SOCKET +#define SOCKET int +#endif #define SOCKADDR_IN sockaddr_in #define SOCKADDR sockaddr #define INVALID_SOCKET -1 @@ -886,7 +888,7 @@ void ListenDedicatedSocket(void) { new_socket->prev = NULL; Head_sock = new_socket; memcpy(&new_socket->addr, &conn_addr, sizeof(new_socket->addr)); - new_socket->input[0] = NULL; + new_socket->input[0] = '\0'; new_socket->sock = incoming_socket; new_socket->validated = false; // Give the new connection the login prompt @@ -905,7 +907,7 @@ void DedicatedSocketputs(char *str) { strcat(newstr, "\r\n"); } else { buf[0] = str[i]; - buf[1] = NULL; + buf[1] = '\0'; strcat(newstr, buf); } } @@ -963,7 +965,7 @@ void DedicatedReadTelnet(void) { conn = DedicatedLogoutTelnet(conn); break; } else if (bytesread > 0) { - buf[1] = NULL; + buf[1] = '\0'; // When we see a CR, process the line if ((buf[0] == 0x0a) || (buf[0] == 0x0d)) { if (conn->input[0] == 0) { @@ -983,12 +985,12 @@ void DedicatedReadTelnet(void) { if (conn->input[0] == '$') { DLLInfo.input_string = conn->input; CallGameDLL(EVT_CLIENT_INPUT_STRING, &DLLInfo); - conn->input[0] = NULL; + conn->input[0] = '\0'; return; } ParseLine(conn->input, command, operand, 255, 255); - conn->input[0] = NULL; + conn->input[0] = '\0'; if (!command[0]) return; @@ -1011,7 +1013,7 @@ void DedicatedReadTelnet(void) { send(conn->sock, "\r\n", strlen("\r\n") + 1, 0); PrintDedicatedMessage(TXT_DS_REMOTELOGGEDIN, inet_ntoa(conn->addr.sin_addr)); PrintDedicatedMessage("\n"); - conn->input[0] = NULL; + conn->input[0] = '\0'; } else { PrintDedicatedMessage(TXT_DS_BADPASS, inet_ntoa(conn->addr.sin_addr)); PrintDedicatedMessage("\n"); @@ -1030,9 +1032,9 @@ void DedicatedReadTelnet(void) { delstr[0] = 8; delstr[1] = ' '; delstr[2] = 8; - delstr[3] = NULL; - conn->input[strlen(conn->input) - 1] = NULL; - buf[1] = NULL; + delstr[3] = '\0'; + conn->input[strlen(conn->input) - 1] = '\0'; + buf[1] = '\0'; send(conn->sock, delstr, strlen(delstr), 0); } else { if (strlen(conn->input) + bytesread >= sizeof(conn->input)) { diff --git a/Descent3/demofile.cpp b/Descent3/demofile.cpp index ee33b83d..1cb2e2b7 100644 --- a/Descent3/demofile.cpp +++ b/Descent3/demofile.cpp @@ -322,14 +322,14 @@ void PageInAllData(void); // Prompts user for filename and starts recording if successfull void DemoToggleRecording() { char szfile[_MAX_PATH * 2]; - szfile[0] = NULL; + szfile[0] = '\0'; if (Demo_flags == DF_RECORDING) { // Stop recording and close the file cfclose(Demo_cfp); Demo_flags = DF_NONE; AddBlinkingHUDMessage(TXT_DEMOSAVED); - Demo_fname[0] = NULL; + Demo_fname[0] = '\0'; return; } else if (Demo_flags == DF_PLAYBACK) { // We can't record a demo while we are playing back a demo @@ -360,7 +360,7 @@ void DemoToggleRecording() { } else { // cfopen failed AddBlinkingHUDMessage(TXT_DEMOCANTCREATE); - Demo_fname[0] = NULL; + Demo_fname[0] = '\0'; return; } } @@ -1429,7 +1429,7 @@ void DemoAbort(bool deletefile) { Demo_flags = DF_NONE; if (deletefile) ddio_DeleteFile(Demo_fname); - Demo_fname[0] = NULL; + Demo_fname[0] = '\0'; return; } } diff --git a/Descent3/descent.cpp b/Descent3/descent.cpp index 37075d7a..67d1bc77 100644 --- a/Descent3/descent.cpp +++ b/Descent3/descent.cpp @@ -898,7 +898,7 @@ char *GetMultiCDPath(char *file) { // Clear out any old path // memset(filepath,0,_MAX_PATH*2); - filepath[0] = NULL; + filepath[0] = '\0'; for (i = 0; i < num_cd_files; i++) { char *vol_filename; diff --git a/Descent3/hudmessage.cpp b/Descent3/hudmessage.cpp index e1a98aad..678db3b0 100644 --- a/Descent3/hudmessage.cpp +++ b/Descent3/hudmessage.cpp @@ -453,7 +453,7 @@ bool AddMultipleLinesToHUDMessages(char *temp_message, ddgr_color color) { // char word[HUD_MESSAGE_LENGTH*2]; char nextword[HUD_MESSAGE_LENGTH * 2]; static char thisline[HUD_MESSAGE_LENGTH * 2] = ""; - thisline[0] = NULL; + thisline[0] = '\0'; strcpy(ourstr, temp_message); p = strtok(ourstr, " "); bool added = 0; @@ -467,7 +467,7 @@ bool AddMultipleLinesToHUDMessages(char *temp_message, ddgr_color color) { strcpy(nextword, p); if ((grtext_GetTextLineWidth(thisline) + grtext_GetTextLineWidth(nextword)) > (Game_window_w * .7)) { if (thisline[strlen(thisline) - 1] == ' ') - thisline[strlen(thisline) - 1] = NULL; + thisline[strlen(thisline) - 1] = '\0'; added |= AddLineToHUDMessages(thisline, color); // Scan for color information in the string we just added @@ -482,13 +482,13 @@ bool AddMultipleLinesToHUDMessages(char *temp_message, ddgr_color color) { thisline[i] = c[i]; thisline[4] = 0; } else - thisline[0] = NULL; + thisline[0] = '\0'; } p = nextword; } } if (thisline[strlen(thisline) - 1] == ' ') - thisline[strlen(thisline) - 1] = NULL; + thisline[strlen(thisline) - 1] = '\0'; if (thisline[0]) added |= AddLineToHUDMessages(thisline, color); diff --git a/Descent3/init.cpp b/Descent3/init.cpp index e8d2da1b..727c0e6c 100644 --- a/Descent3/init.cpp +++ b/Descent3/init.cpp @@ -1641,7 +1641,7 @@ void InitIOSystems(bool editor) { int len = strlen(Base_directory); for (int i = (len - 1); i >= 0; i--) { if (i == '\\') { - Base_directory[i] = NULL; + Base_directory[i] = '\0'; } } mprintf((0, "Using working directory of %s\n", Base_directory)); @@ -2210,7 +2210,7 @@ void InitD3Systems1(bool editor) { strcpy(ipparse, GameArgs[tcplogarg + 1]); pport = strchr(ipparse, ':'); if (pport) { - *pport = NULL; + *pport = '\0'; pport++; port = atoi(pport); } diff --git a/Descent3/menu.cpp b/Descent3/menu.cpp index f0dc97e9..05fc330d 100644 --- a/Descent3/menu.cpp +++ b/Descent3/menu.cpp @@ -924,13 +924,13 @@ bool ProcessCommandLine() { char *tokp; strcpy(szurl, GameArgs[urlarg]); #ifdef DEMO - szurl[strlen("d3demo2://") - 1] = NULL; // Should make the string "d3demo:/" + szurl[strlen("d3demo2://") - 1] = '\0'; // Should make the string "d3demo:/" p = szurl + strlen("d3demo2://"); // pointer to the first character of the url after the // if (strcmpi(szurl, "d3demo2:/") == 0) { mprintf((0, "Got a url passed: %s\n", p)); } #else - szurl[strlen("descent3://") - 1] = NULL; // Should make the string "descent3:/" + szurl[strlen("descent3://") - 1] = '\0'; // Should make the string "descent3:/" p = szurl + strlen("descent3://"); // pointer to the first character of the url after the // if (strcmpi(szurl, "descent3:/") == 0) { mprintf((0, "Got a url passed: %s\n", p)); @@ -939,7 +939,7 @@ bool ProcessCommandLine() { tokp = strtok(p, "/"); if (strcmpi(tokp, "ip") == 0) { tokp = strtok(NULL, "/"); - Auto_login_port[0] = NULL; + Auto_login_port[0] = '\0'; strcpy(Auto_login_addr, tokp); // char seldll[_MAX_PATH*2]; // ddio_MakePath(seldll,Base_directory,"online","Direct TCP~IP Game.d3c",NULL); @@ -956,7 +956,7 @@ bool ProcessCommandLine() { } } else if (strcmpi(tokp, "pxo") == 0) { tokp = strtok(NULL, "/"); - Auto_login_port[0] = NULL; + Auto_login_port[0] = '\0'; strcpy(Auto_login_addr, tokp); // char seldll[_MAX_PATH*2]; // ddio_MakePath(seldll,Base_directory,"online","parallax online.d3c",NULL); @@ -997,7 +997,7 @@ bool ProcessCommandLine() { char *port = strchr(connhost, ':'); if (port) { // terminate the hostname - *port = NULL; + *port = '\0'; // Increment to the first character of the port name port++; // get the port number diff --git a/Descent3/mission_download.cpp b/Descent3/mission_download.cpp index cc0796af..199b7c1a 100644 --- a/Descent3/mission_download.cpp +++ b/Descent3/mission_download.cpp @@ -628,7 +628,7 @@ void msn_ClipURLToWidth(int width, char *string) { int size = 0; char save = string[0]; - string[0] = NULL; + string[0] = '\0'; while (size < string_length) { if ((grtext_GetTextLineWidth(string)) >= width) { return; @@ -637,7 +637,7 @@ void msn_ClipURLToWidth(int width, char *string) { string[size] = save; size++; save = string[size]; - string[size] = NULL; + string[size] = '\0'; } } @@ -648,7 +648,7 @@ char *msn_SecondsToString(int time_sec) { int minutes; int seconds; int i; - fmttime[0] = NULL; + fmttime[0] = '\0'; hours = time_sec / 3600; i = time_sec % 3600; minutes = i / 60; diff --git a/Descent3/multi.cpp b/Descent3/multi.cpp index 8dc2834e..32b93216 100644 --- a/Descent3/multi.cpp +++ b/Descent3/multi.cpp @@ -7950,7 +7950,7 @@ void MultiSendClientCustomData(int slot, int whoto) { MultiAddShort(slot, data, &count); // Send custom logo filename (all 0's if none) - csum_filename[0] = NULL; + csum_filename[0] = '\0'; if (NetPlayers[slot].ship_logo[0]) { if (slot == Player_num) { char szcrc[_MAX_PATH]; @@ -8070,7 +8070,7 @@ void MultiDoCustomPlayerData(ubyte *data) { char *GetFileNameFromPlayerAndID(short playernum, short id) { static char rval[_MAX_PATH * 2]; - rval[0] = NULL; + rval[0] = '\0'; if (playernum >= MAX_NET_PLAYERS) { mprintf((0, "Invalid playernum (%d) passed to GetFileNameFromPlayerAndID()\n", playernum)); @@ -8114,10 +8114,10 @@ char *GetFileNameFromPlayerAndID(short playernum, short id) { cfp = cfopen(rval, "rb"); if (!cfp) { mprintf((0, "Multiplayer file xfer File does not exist, not using file %d for player %d!\n", id, playernum)); - // rval[0] = NULL; + // rval[0] = '\0'; } else if (32768 < cfilelength(cfp)) { mprintf((0, "Multiplayer file xfer File to long, not using file %d for player %d!\n", id, playernum)); - rval[0] = NULL; + rval[0] = '\0'; } if (cfp) cfclose(cfp); diff --git a/Descent3/multi_save_setting.cpp b/Descent3/multi_save_setting.cpp index 4053a5a0..bb4e9ab1 100644 --- a/Descent3/multi_save_setting.cpp +++ b/Descent3/multi_save_setting.cpp @@ -62,7 +62,7 @@ int MultiSaveSettings(char *filename) { int i; cf = cfopen(filename, "wt"); if (!cf) - return NULL; + return 0; sprintf(szoutput, "NAME\t%s", Netgame.name); cf_WriteString(cf, szoutput); sprintf(szoutput, "MISSION\t%s", Netgame.mission); @@ -126,7 +126,7 @@ int MultiLoadSettings(char *filename) { int objid; cf = cfopen(filename, "rt"); if (!cf) - return NULL; + return 0; while (cf_ReadString(szinput, MAX_MPS_LINE_LEN - 1, cf)) { diff --git a/Descent3/multi_ui.cpp b/Descent3/multi_ui.cpp index f3f3b6ff..5998433e 100644 --- a/Descent3/multi_ui.cpp +++ b/Descent3/multi_ui.cpp @@ -672,7 +672,7 @@ int AutoConnectPXO() { char *port = strchr(Auto_login_addr, ':'); if (port) { // terminate the hostname - *port = NULL; + *port = '\0'; // Increment to the first character of the port name port++; // get the port number @@ -682,7 +682,7 @@ int AutoConnectPXO() { if (portarg) { strcpy(Auto_login_port, GameArgs[portarg + 1]); } else { - Auto_login_port[0] = NULL; + Auto_login_port[0] = '\0'; } } @@ -708,7 +708,7 @@ int AutoConnectLANIP() { char *port = strchr(Auto_login_addr, ':'); if (port) { // terminate the hostname - *port = NULL; + *port = '\0'; // Increment to the first character of the port name port++; // get the port number @@ -721,7 +721,7 @@ int AutoConnectLANIP() { if (portarg) { strcpy(Auto_login_port, GameArgs[portarg + 1]); } else { - Auto_login_port[0] = NULL; + Auto_login_port[0] = '\0'; } } // ddio_MakePath(seldll,Base_directory,"online","Direct TCP~IP Game.d3c",NULL); @@ -746,7 +746,7 @@ int AutoConnectHeat() { char *port = strchr(Auto_login_addr, ':'); if (port) { // terminate the hostname - *port = NULL; + *port = '\0'; // Increment to the first character of the port name port++; // get the port number @@ -759,7 +759,7 @@ int AutoConnectHeat() { if (portarg) { strcpy(Auto_login_port, GameArgs[portarg + 1]); } else { - Auto_login_port[0] = NULL; + Auto_login_port[0] = '\0'; } } if (LoadMultiDLL("HEAT.NET")) { @@ -1883,4 +1883,4 @@ no_players: mem_free(Multi_recieved_player_list); Multi_recieved_player_list = NULL; } -} \ No newline at end of file +} diff --git a/Descent3/screens.cpp b/Descent3/screens.cpp index ad61e797..b16d4325 100644 --- a/Descent3/screens.cpp +++ b/Descent3/screens.cpp @@ -577,7 +577,7 @@ void PaintPLRSinglePlayerText() { if (tlen > curpos) { line_progress[i] = curpos; line_replace[i] = PLRText[i][curpos]; - PLRText[i][curpos] = NULL; + PLRText[i][curpos] = '\0'; all_done_painting = false; } } @@ -666,4 +666,4 @@ const char *GetNormalizedRating(float mag) return TXT(Stat_ratings[rating]); } -*/ \ No newline at end of file +*/ diff --git a/bitmap/bitmain.cpp b/bitmap/bitmain.cpp index 3eb98ae6..db83c4bf 100644 --- a/bitmap/bitmain.cpp +++ b/bitmap/bitmain.cpp @@ -1207,7 +1207,7 @@ int bm_w(int handle, int miplevel) { } if (GameBitmaps[handle].flags & BF_NOT_RESIDENT) if (!bm_MakeBitmapResident(handle)) - return NULL; + return 0; if (!(GameBitmaps[handle].flags & BF_MIPMAPPED)) miplevel = 0; w = GameBitmaps[handle].width; @@ -1224,7 +1224,7 @@ int bm_h(int handle, int miplevel) { // If this bitmap is not page in, do so! if (GameBitmaps[handle].flags & BF_NOT_RESIDENT) if (!bm_MakeBitmapResident(handle)) - return NULL; + return 0; if (!(GameBitmaps[handle].flags & BF_MIPMAPPED)) miplevel = 0; h = GameBitmaps[handle].height; @@ -1245,7 +1245,7 @@ int bm_miplevels(int handle) { // If this bitmap is not page in, do so! if (GameBitmaps[handle].flags & BF_NOT_RESIDENT) if (!bm_MakeBitmapResident(handle)) - return NULL; + return 0; if (GameBitmaps[handle].flags & BF_MIPMAPPED) { for (int tmp = GameBitmaps[handle].width; tmp > 0; tmp = tmp >> 1) { levels++; @@ -1264,7 +1264,7 @@ int bm_mipped(int handle) { // If this bitmap is not page in, do so! if (GameBitmaps[handle].flags & BF_NOT_RESIDENT) if (!bm_MakeBitmapResident(handle)) - return NULL; + return 0; if (GameBitmaps[handle].flags & BF_MIPMAPPED) return 1; return 0; @@ -1752,6 +1752,6 @@ int bm_format(int handle) { } if (GameBitmaps[handle].flags & BF_NOT_RESIDENT) if (!bm_MakeBitmapResident(handle)) - return NULL; + return 0; return (GameBitmaps[handle].format); } diff --git a/czip/CZip.cpp b/czip/CZip.cpp index bb5d679b..b363c54b 100644 --- a/czip/CZip.cpp +++ b/czip/CZip.cpp @@ -402,7 +402,7 @@ bool CZip::AddFileToArchive(char *filename, int compression_type) { // Add to the end of the file, so we need to move to the end, back up sizeof(int) to remove // header - VFseek(bfile->file, 0 - sizeof(int), SEEK_END); + VFseek(bfile->file, int(0 - sizeof(int)), SEEK_END); int compressed_size = -1; int header_start = VFtell(bfile->file); diff --git a/grtext/grtext.cpp b/grtext/grtext.cpp index 5c11ced0..e54c2434 100644 --- a/grtext/grtext.cpp +++ b/grtext/grtext.cpp @@ -458,7 +458,7 @@ void grtext_Puts(int x, int y, const char *str) { for (int a = 0; a < slen; a++) lowerstr[a] = tolower(str[a]); - lowerstr[slen] = NULL; + lowerstr[slen] = '\0'; for (int i = 0; i < NUM_BAD_WORDS; i++) { char *p = strstr(lowerstr, (char *)bad_words[i]); diff --git a/lib/networking.h b/lib/networking.h index 00f548e5..7cc71b4b 100644 --- a/lib/networking.h +++ b/lib/networking.h @@ -202,10 +202,7 @@ inline void INADDR_GET_SUN_SUNB(struct in_addr *st, unsigned char *s_b1, unsigne #include "linux/linux_fix.h" -#ifndef SOCKET #define SOCKET int -#endif - #define BOOL bool #define SOCKADDR_IN sockaddr_in #define SOCKADDR_IPX sockaddr_ipx @@ -311,8 +308,8 @@ inline void INADDR_GET_SUN_SUNB(struct in_addr *st, unsigned char *s_b1, unsigne #include "macsock.h" +#define SOCKET int #define BOOL bool -#define SOCKET unsigned int #define SOCKADDR_IN sockaddr_in // #define SOCKADDR_IPX sockaddr_ipx #define SOCKADDR sockaddr diff --git a/netcon/includes/inetgetfile.h b/netcon/includes/inetgetfile.h index 7de0e97c..81934d9f 100644 --- a/netcon/includes/inetgetfile.h +++ b/netcon/includes/inetgetfile.h @@ -91,7 +91,7 @@ #define BOOL bool #ifndef SOCKET -#define SOCKET unsigned int +#define SOCKET int #endif #define SOCKADDR_IN sockaddr_in diff --git a/netcon/inetfile/Chttpget.cpp b/netcon/inetfile/Chttpget.cpp index ad28ff6a..1688ba25 100644 --- a/netcon/inetfile/Chttpget.cpp +++ b/netcon/inetfile/Chttpget.cpp @@ -751,7 +751,7 @@ int http_gethostbynameworker(void *parm) if (he == NULL) { lookup->error = true; #ifdef __LINUX__ - return NULL; + return 0; #else return; #endif @@ -763,6 +763,6 @@ int http_gethostbynameworker(void *parm) mem_free(lookup); #ifdef __LINUX__ - return NULL; + return 0; #endif } diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index 3603c384..3ed4bacf 100644 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -110,4 +110,4 @@ IF(UNIX AND NOT APPLE) DEPENDS ${SCRIPTS} COMMENT "Building platform specific hog." ) -ENDIF() \ No newline at end of file +ENDIF() diff --git a/ui/UIEdit.cpp b/ui/UIEdit.cpp index 30b9a43d..4ac8b170 100644 --- a/ui/UIEdit.cpp +++ b/ui/UIEdit.cpp @@ -199,7 +199,7 @@ void UIEdit::SetText(char *text) { void UIEdit::GetText(char *buffer, int len) { // ASSERT(strlen(m_TextBuf) < (unsigned)len); if (!m_TextBuf) { - buffer[0] = 0; + buffer[0] = '\0'; return; } strncpy(buffer, m_TextBuf, len - 1);