From a00639be2436ebec732fd4cb9b135278a9c6ebe2 Mon Sep 17 00:00:00 2001 From: GravisZro Date: Thu, 23 May 2024 22:59:50 -0400 Subject: [PATCH] Replace "signed char" with "int8_t" --- Descent3/hudmessage.cpp | 4 ++-- legacy/powerball/powerball.cpp | 4 ++-- lib/Adecode.h | 2 +- lib/linux/dyna_glide.h | 2 +- lib/pstypes.h | 2 +- libacm/aencode.cpp | 2 +- libmve/mveasm.cpp | 10 +++++----- lnxmvelib/mveasm.cpp | 14 +++++++------- netgames/dmfc/dmfcbase.cpp | 2 +- netgames/dmfc/dmfcinterface.cpp | 2 +- netgames/dmfc/dmfcinternal.h | 2 +- netgames/includes/idmfc.h | 4 ++-- scripts/lnx/osiris_common.h | 2 +- scripts/osiris_common.h | 2 +- third_party/stb/stb_image_write.h | 10 +++++----- 15 files changed, 32 insertions(+), 32 deletions(-) diff --git a/Descent3/hudmessage.cpp b/Descent3/hudmessage.cpp index 459fc0c1..c1fc38ec 100644 --- a/Descent3/hudmessage.cpp +++ b/Descent3/hudmessage.cpp @@ -539,7 +539,7 @@ bool AddColoredHUDMessage(ddgr_color color, const char *format, ...) { // Adds a HUD message (similar to AddColoredHUDMessage), however can be filtered out by // a "-playermessages" command line. bool AddFilteredColoredHUDMessage(ddgr_color color, const char *format, ...) { - static signed char checked_command_line = -1; + static int8_t checked_command_line = -1; if (checked_command_line == -1) { if (FindArg("-playermessages") != 0) { @@ -575,7 +575,7 @@ bool AddFilteredColoredHUDMessage(ddgr_color color, const char *format, ...) { // Adds a HUD message (similar to AddHUDMessage), however can be filtered out by // a "-playermessages" command line. bool AddFilteredHUDMessage(const char *format, ...) { - static signed char checked_command_line = -1; + static int8_t checked_command_line = -1; if (checked_command_line == -1) { if (FindArg("-playermessages") != 0) { diff --git a/legacy/powerball/powerball.cpp b/legacy/powerball/powerball.cpp index f0050a85..dab77dbd 100644 --- a/legacy/powerball/powerball.cpp +++ b/legacy/powerball/powerball.cpp @@ -954,7 +954,7 @@ void GetGameStartPacket(ubyte *data) memcpy(TeamScores,&data[size],sizeof(int)*DLLMAX_TEAMS); size+= (sizeof(int)*DLLMAX_TEAMS); //who has the powerball - signed char temp; + int8_t temp; memcpy(&temp,&data[size],sizeof(char)); size+=sizeof(char); WhoHasPowerBall = temp; @@ -993,7 +993,7 @@ void SendGameStartPacket(int pnum) //add the team scores memcpy(&data[size],TeamScores,sizeof(int)*DLLMAX_TEAMS); size += (sizeof(int)*DLLMAX_TEAMS); - signed char temp; + int8_t temp; //who has the powerball if anyone temp = WhoHasPowerBall; memcpy(&data[size],&temp,sizeof(char)); size+= sizeof(char); diff --git a/lib/Adecode.h b/lib/Adecode.h index 363fa07b..cbb02eae 100644 --- a/lib/Adecode.h +++ b/lib/Adecode.h @@ -25,7 +25,7 @@ typedef int32_t sint32; typedef unsigned short uint16; typedef signed short sint16; typedef uint8_t uint8; -typedef signed char sint8; +typedef int8_t sint8; class IAudioDecoder { public: diff --git a/lib/linux/dyna_glide.h b/lib/linux/dyna_glide.h index 996919af..24097fdf 100644 --- a/lib/linux/dyna_glide.h +++ b/lib/linux/dyna_glide.h @@ -167,7 +167,7 @@ typedef uint8_t FxU8; -typedef signed char FxI8; +typedef int8_t FxI8; typedef unsigned short FxU16; diff --git a/lib/pstypes.h b/lib/pstypes.h index e986b805..af2ee7f0 100644 --- a/lib/pstypes.h +++ b/lib/pstypes.h @@ -23,7 +23,7 @@ // define unsigned types; typedef uint8_t ubyte; -typedef signed char sbyte; +typedef int8_t sbyte; typedef unsigned short ushort; typedef uint32_t uint32_t; typedef unsigned long ulong; diff --git a/libacm/aencode.cpp b/libacm/aencode.cpp index 6d063a7d..ac010939 100644 --- a/libacm/aencode.cpp +++ b/libacm/aencode.cpp @@ -28,7 +28,7 @@ typedef int32_t sint32; typedef unsigned short uint16; typedef signed short sint16; typedef uint8_t uint8; -typedef signed char sint8; +typedef int8_t sint8; struct BitsEncoder { FILE *m_outFile; // var50 | offset 0x10 diff --git a/libmve/mveasm.cpp b/libmve/mveasm.cpp index cc6662d4..73aa8eed 100644 --- a/libmve/mveasm.cpp +++ b/libmve/mveasm.cpp @@ -201,7 +201,7 @@ public: initme() { int x, y; int m4, m3, m2, m1; - signed char *ptr; + int8_t *ptr; uint8_t *uptr; // Do nfhpk_mov4l @@ -277,7 +277,7 @@ public: } // do nfpk_ShiftP1 - ptr = (signed char *)nfpk_ShiftP1; + ptr = (int8_t *)nfpk_ShiftP1; for (y = -8; y != 8; y++) { for (x = -8; x != 8; x++) { #ifdef OUTRAGE_BIG_ENDIAN @@ -292,7 +292,7 @@ public: } // do nfpk_ShiftP2[] - ptr = (signed char *)nfpk_ShiftP2; + ptr = (int8_t *)nfpk_ShiftP2; for (y = 0; y != 8; y++) { for (x = 8; x != 15; x++) { #ifdef OUTRAGE_BIG_ENDIAN @@ -534,14 +534,14 @@ void PkDecompWorker(const bool hiColor, const uint8_t *ops, const uint8_t *comp, unsigned short hax, ax; } reg_word; typedef struct { - signed char hah, hal, ah, al; + int8_t hah, hal, ah, al; } reg_byte; #else typedef struct { unsigned short ax, hax; } reg_word; typedef struct { - signed char al, ah, hal, hah; + int8_t al, ah, hal, hah; } reg_byte; #endif diff --git a/lnxmvelib/mveasm.cpp b/lnxmvelib/mveasm.cpp index e0c59c47..4bc62efc 100644 --- a/lnxmvelib/mveasm.cpp +++ b/lnxmvelib/mveasm.cpp @@ -180,7 +180,7 @@ public: initme() { int x, y; int m4, m3, m2, m1; - signed char *ptr; + int8_t *ptr; uint8_t *uptr; // Do nfhpk_mov4l @@ -231,7 +231,7 @@ public: uptr++; } // do nfpk_ShiftP1 - ptr = (signed char *)nfpk_ShiftP1; + ptr = (int8_t *)nfpk_ShiftP1; for (y = -8; y != 8; y++) { for (x = -8; x != 8; x++) { @@ -247,7 +247,7 @@ public: } // do nfpk_ShiftP2[] - ptr = (signed char *)nfpk_ShiftP2; + ptr = (int8_t *)nfpk_ShiftP2; for (y = 0; y != 8; y++) { for (x = 8; x != 15; x++) { @@ -390,14 +390,14 @@ void nfHPkDecomp(uint8_t *ops, uint8_t *comp, unsigned x, unsigned y, unsigned w unsigned short hax, ax; } reg_word; typedef struct { - signed char hah, hal, ah, al; + int8_t hah, hal, ah, al; } reg_byte; #else typedef struct { unsigned short ax, hax; } reg_word; typedef struct { - signed char al, ah, hal, hah; + int8_t al, ah, hal, hah; } reg_byte; #endif union { @@ -423,14 +423,14 @@ void nfHPkDecomp(uint8_t *ops, uint8_t *comp, unsigned x, unsigned y, unsigned w unsigned short hax, ax; } reg_word; typedef struct { - signed char hah, hal, ah, al; + int8_t hah, hal, ah, al; } reg_byte; #else typedef struct { unsigned short ax, hax; } reg_word; typedef struct { - signed char al, ah, hal, hah; + int8_t al, ah, hal, hah; } reg_byte; #endif union { diff --git a/netgames/dmfc/dmfcbase.cpp b/netgames/dmfc/dmfcbase.cpp index 751d7a8d..4d2b0f5c 100644 --- a/netgames/dmfc/dmfcbase.cpp +++ b/netgames/dmfc/dmfcbase.cpp @@ -3305,7 +3305,7 @@ void strlowcpy(char *dest, const char *src) { // command string to the given function handler. Returns 1 on success, -1 if out of memory, 0 if it already // exists. These commands are not case sensitive. // Ex. AddInputCommand("team"); //this handles all the '$team' passed in -signed char DMFCBase::AddInputCommand(const char *command, const char *description, void (*handler)(const char *), bool allow_remotely) { +int8_t DMFCBase::AddInputCommand(const char *command, const char *description, void (*handler)(const char *), bool allow_remotely) { ASSERT(command != NULL); ASSERT(handler != NULL); diff --git a/netgames/dmfc/dmfcinterface.cpp b/netgames/dmfc/dmfcinterface.cpp index 1a7b0b04..6596495c 100644 --- a/netgames/dmfc/dmfcinterface.cpp +++ b/netgames/dmfc/dmfcinterface.cpp @@ -896,7 +896,7 @@ void DLLFUNCCALL IDMFC_DisconnectMe(IDMFC *instance) { instance->DisconnectMe(); } -signed char DLLFUNCCALL IDMFC_AddInputCommand(IDMFC *instance, const char *command, const char *description, +int8_t DLLFUNCCALL IDMFC_AddInputCommand(IDMFC *instance, const char *command, const char *description, void (*handler)(const char *)) { assert(instance != NULL); return instance->AddInputCommand(command, description, handler); diff --git a/netgames/dmfc/dmfcinternal.h b/netgames/dmfc/dmfcinternal.h index 2f1f2f4d..d6a97293 100644 --- a/netgames/dmfc/dmfcinternal.h +++ b/netgames/dmfc/dmfcinternal.h @@ -1597,7 +1597,7 @@ public: // exists. These commands are not case sensitive. // Ex. AddInputCommand("team"); //this handles all the '$team' passed in // allow_remotely : if set true, this input command can be called remotely via remote administration - signed char AddInputCommand(const char *command, const char *description, void (*handler)(const char *), bool allow_remotely = false); + int8_t AddInputCommand(const char *command, const char *description, void (*handler)(const char *), bool allow_remotely = false); // DMFCBase::CanInputCommandBeUsedRemotely // diff --git a/netgames/includes/idmfc.h b/netgames/includes/idmfc.h index 17e64cb7..5d32af4a 100644 --- a/netgames/includes/idmfc.h +++ b/netgames/includes/idmfc.h @@ -1163,7 +1163,7 @@ public: // exists. These commands are not case sensitive. // Ex. AddInputCommand("team"); //this handles all the '$team' passed in // allow_remotely : if set true, this input command can be called remotely via remote administration - virtual signed char AddInputCommand(const char *command, const char *description, void (*handler)(const char *), + virtual int8_t AddInputCommand(const char *command, const char *description, void (*handler)(const char *), bool allow_remotely = false) = 0; // Does a check on on the pinfo info making sure it is valid @@ -1915,7 +1915,7 @@ DLLEXPORT void DLLFUNCCALL IDMFC_DoDamageToPlayer(IDMFC *instance, int pnum, int bool playsound = true); DLLEXPORT void DLLFUNCCALL IDMFC_StartUIWindow(IDMFC *instance, int id, void *user_data); DLLEXPORT void DLLFUNCCALL IDMFC_DisconnectMe(IDMFC *instance); -DLLEXPORT signed char DLLFUNCCALL IDMFC_AddInputCommand(IDMFC *instance, const char *command, const char *description, +DLLEXPORT int8_t DLLFUNCCALL IDMFC_AddInputCommand(IDMFC *instance, const char *command, const char *description, void (*handler)(const char *)); DLLEXPORT void DLLFUNCCALL IDMFC_CheckPInfo(IDMFC *instance); DLLEXPORT void DLLFUNCCALL IDMFC_EnableStatisticalMessages(IDMFC *instance, bool on); diff --git a/scripts/lnx/osiris_common.h b/scripts/lnx/osiris_common.h index 8b2777fa..f12408c6 100644 --- a/scripts/lnx/osiris_common.h +++ b/scripts/lnx/osiris_common.h @@ -928,7 +928,7 @@ typedef int OMMSHANDLE; // define unsigned types; typedef uint8_t ubyte; -typedef signed char sbyte; +typedef int8_t sbyte; typedef unsigned short ushort; typedef uint32_t uint32_t; typedef uint32_t ddgr_color; diff --git a/scripts/osiris_common.h b/scripts/osiris_common.h index d6dd4474..3c0b24e8 100644 --- a/scripts/osiris_common.h +++ b/scripts/osiris_common.h @@ -929,7 +929,7 @@ typedef int OMMSHANDLE; // define unsigned types; typedef uint8_t ubyte; -typedef signed char sbyte; +typedef int8_t sbyte; typedef unsigned short ushort; typedef uint32_t uint32_t; typedef uint32_t ddgr_color; diff --git a/third_party/stb/stb_image_write.h b/third_party/stb/stb_image_write.h index 55eb6a04..2ce08974 100644 --- a/third_party/stb/stb_image_write.h +++ b/third_party/stb/stb_image_write.h @@ -1089,7 +1089,7 @@ static uint8_t stbiw__paeth(int a, int b, int c) } // @OPTIMIZE: provide an option that always forces left-predict or paeth predict -static void stbiw__encode_png_line(uint8_t *pixels, int stride_bytes, int width, int height, int y, int n, int filter_type, signed char *line_buffer) +static void stbiw__encode_png_line(uint8_t *pixels, int stride_bytes, int width, int height, int y, int n, int filter_type, int8_t *line_buffer) { static int mapping[] = { 0,1,2,3,4 }; static int firstmap[] = { 0,1,0,5,6 }; @@ -1110,7 +1110,7 @@ static void stbiw__encode_png_line(uint8_t *pixels, int stride_bytes, int width, case 1: line_buffer[i] = z[i]; break; case 2: line_buffer[i] = z[i] - z[i-signed_stride]; break; case 3: line_buffer[i] = z[i] - (z[i-signed_stride]>>1); break; - case 4: line_buffer[i] = (signed char) (z[i] - stbiw__paeth(0,z[i-signed_stride],0)); break; + case 4: line_buffer[i] = (int8_t) (z[i] - stbiw__paeth(0,z[i-signed_stride],0)); break; case 5: line_buffer[i] = z[i]; break; case 6: line_buffer[i] = z[i]; break; } @@ -1131,7 +1131,7 @@ STBIWDEF uint8_t *stbi_write_png_to_mem(const uint8_t *pixels, int stride_bytes, int ctype[5] = { -1, 0, 4, 2, 6 }; uint8_t sig[8] = { 137,80,78,71,13,10,26,10 }; uint8_t *out,*o, *filt, *zlib; - signed char *line_buffer; + int8_t *line_buffer; int j,zlen; if (stride_bytes == 0) @@ -1142,7 +1142,7 @@ STBIWDEF uint8_t *stbi_write_png_to_mem(const uint8_t *pixels, int stride_bytes, } filt = (uint8_t *) STBIW_MALLOC((x*n+1) * y); if (!filt) return 0; - line_buffer = (signed char *) STBIW_MALLOC(x * n); if (!line_buffer) { STBIW_FREE(filt); return 0; } + line_buffer = (int8_t *) STBIW_MALLOC(x * n); if (!line_buffer) { STBIW_FREE(filt); return 0; } for (j=0; j < y; ++j) { int filter_type; if (force_filter > -1) { @@ -1156,7 +1156,7 @@ STBIWDEF uint8_t *stbi_write_png_to_mem(const uint8_t *pixels, int stride_bytes, // Estimate the entropy of the line using this filter; the less, the better. est = 0; for (i = 0; i < x*n; ++i) { - est += abs((signed char) line_buffer[i]); + est += abs((int8_t) line_buffer[i]); } if (est < best_filter_val) { best_filter_val = est;