Skip to content

Commit

Permalink
build: resolve 101 instances of -Wunused-variable
Browse files Browse the repository at this point in the history
  • Loading branch information
jengelh committed Nov 4, 2024
1 parent 85f0f2d commit 9ba0037
Show file tree
Hide file tree
Showing 33 changed files with 31 additions and 114 deletions.
2 changes: 0 additions & 2 deletions 2dlib/memsurf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,6 @@ bool grMemorySurface::init(int w, int h, int bpp, char *data, int rowsize, unsig
// internal functions
// ---------------------------------------------------------------------------

static mem_bitmap grMemSurf_object;

bool gr_bm_mem_Blt16(ddgr_surface *dsf, int dx, int dy, ddgr_surface *ssf, int sx, int sy, int sw, int sh);
bool gr_bm_mem_Blt16ck(ddgr_surface *dsf, int dx, int dy, ddgr_surface *ssf, int sx, int sy, int sw, int sh);

Expand Down
1 change: 0 additions & 1 deletion 2dlib/pentext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@

#define STR_BUF_SIZE 512
static char Str_buf[STR_BUF_SIZE]; // String buffer for variable arguments
static char Draw_str_buf[STR_BUF_SIZE]; // used to buffer words in a string

// ---------------------------------------------------------------------------
// Viewport font and text funcitons
Expand Down
5 changes: 0 additions & 5 deletions bitmap/bitmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -575,8 +575,6 @@ int bm_AllocNoMemBitmap(int w, int h) {
// Searches thru all bitmaps for a specific name, returns -1 if not found
// or index of bitmap with name
int bm_FindBitmapName(const char *name) {
int num_counted = 0;

bms_bitmap fbmp;
strcpy(fbmp.name, name);
bm_Node *fnode = bm_findNode(&fbmp);
Expand Down Expand Up @@ -641,8 +639,6 @@ int bm_TestName(const char *src) {
strncpy(namedest, filename, limit);
namedest[limit] = 0;

int cur_len = strlen(namedest);

// Now, make sure there are no other bitmaps with this name
strcat(namedest, ".ogf");
if ((i = bm_FindBitmapName(namedest)) == -1)
Expand All @@ -652,7 +648,6 @@ int bm_TestName(const char *src) {
// gets the filename from a path, plus appends our .ogf extension
void bm_ChangeEndName(const char *src, char *dest) {
uint32_t i, limit;
int last = -1;
int curnum = -1;
char namedest[256 + 16];
char path[256], ext[256], filename[256];
Expand Down
2 changes: 1 addition & 1 deletion bitmap/iff.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ int bm_iff_parse_file(CFILE *ifile, iff_bitmap_header *bmheader, iff_bitmap_head

switch (sig) {
case IFF_SIG_FORM: {
int newsig = bm_iff_get_sig(ifile);
bm_iff_get_sig(ifile);
bmheader->type = TYPE_PBM;
break;
}
Expand Down
1 change: 0 additions & 1 deletion grtext/grtext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,6 @@ int grtext_GetTextLineWidth(const char *str) {
int line_width = 0, max_width = 0;
int rgb_define_mode = 0;
int strsize = strlen(str);
int line_idx = 0;

for (int i = 0; i < strsize; i++) {
int width;
Expand Down
14 changes: 7 additions & 7 deletions libmve/mveplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ static int create_audiobuf_handler(unsigned char major, unsigned char minor, uns

int flags = get_ushort(data + 2);
int sample_rate = get_ushort(data + 4);
int desired_buffer = get_int(data + 6);
// int desired_buffer = get_int(data + 6);

int channels = (flags & MVE_AUDIO_FLAGS_STEREO) ? 2 : 1;
int sample_size = (flags & MVE_AUDIO_FLAGS_16BIT) ? 2 : 1;
Expand Down Expand Up @@ -338,12 +338,12 @@ static int video_codemap_handler(unsigned char major, unsigned char minor, unsig
static int video_data_handler(unsigned char major, unsigned char minor, unsigned char *data, int len, void *context) {
unsigned char *temp;

short nFrameHot = get_short(data);
short nFrameCold = get_short(data + 2);
short nXoffset = get_short(data + 4);
short nYoffset = get_short(data + 6);
short nXsize = get_short(data + 8);
short nYsize = get_short(data + 10);
// short nFrameHot = get_short(data);
// short nFrameCold = get_short(data + 2);
// short nXoffset = get_short(data + 4);
// short nYoffset = get_short(data + 6);
// short nXsize = get_short(data + 8);
// short nYsize = get_short(data + 10);
unsigned short nFlags = get_ushort(data + 12);

if (nFlags & 1) {
Expand Down
2 changes: 1 addition & 1 deletion manage/gamefilepage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ int mng_ReadNewGamefilePage(CFILE *infile, mngs_gamefile_page *gamefilepage) {
ASSERT(infile != NULL);
memset(gamefilepage, 0, sizeof(mngs_gamefile_page));

int version = cf_ReadShort(infile);
/* int version = */ cf_ReadShort(infile);

cf_ReadString(gamefilepage->gamefile_struct.name, PAGENAME_LEN, infile);
cf_ReadString(gamefilepage->gamefile_struct.dir_name, PAGENAME_LEN, infile);
Expand Down
4 changes: 2 additions & 2 deletions manage/manage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1480,7 +1480,7 @@ void mng_TransferPages() {
continue;
}
pagetype = cf_ReadByte(infile);
int len = cf_ReadInt(infile);
/* int len = */ cf_ReadInt(infile);
switch (pagetype) {
case PAGETYPE_TEXTURE:
mng_ReadNewTexturePage(infile, &texpage);
Expand Down Expand Up @@ -2208,7 +2208,7 @@ int mng_ReplacePage(char *srcname, char *destname, int handle, int dest_pagetype
// If local is 1, deletes from the local table file
int mng_DeletePage(char *name, int dest_pagetype, int local) {
CFILE *infile, *outfile;
uint8_t pagetype, replaced = 0;
uint8_t pagetype;
int done = 0;
int deleted = 0;

Expand Down
2 changes: 1 addition & 1 deletion manage/megapage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ int mng_ReadNewMegacellPage(CFILE *infile, mngs_megacell_page *megacellpage) {
int i;
ASSERT(infile != NULL);
memset(megacellpage, 0, sizeof(mngs_megacell_page));
int version = cf_ReadShort(infile);
/* int version = */ cf_ReadShort(infile);

cf_ReadString(megacellpage->megacell_struct.name, PAGENAME_LEN, infile);

Expand Down
8 changes: 3 additions & 5 deletions manage/pagelock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,6 @@ void mng_InitPagelocks() {
// Returns pointer to locker's name, or NULL if the file is unlocked
char *mng_CheckIfLockerPresent() {
CFILE *infile;
int i = 0;
static char lockname[200];

ASSERT(Network_up);
Expand Down Expand Up @@ -380,7 +379,6 @@ int mng_CheckIfPageLocked(mngs_Pagelock *pl) {
r = 2;
} else {
if (!stricmp(pl->name, testlock.name)) {
int test = 0;
if (pl->pagetype == testlock.pagetype) {
if (!stricmp(testlock.holder, "UNLOCKED"))
r = 0;
Expand Down Expand Up @@ -602,7 +600,7 @@ int mng_DeletePagelock(char *name, int pagetype) {
// Given a list of names and a pagetype, deletes the ones already inside the lock file
int mng_DeletePagelockSeries(char *names[], int num, int pagetype) {
CFILE *infile, *outfile;
int done = 0, deleted = 0;
int done = 0;
mngs_Pagelock temp_pl;

infile = (CFILE *)cfopen(TableLockFilename, "rb");
Expand Down Expand Up @@ -656,7 +654,7 @@ int mng_DeletePagelockSeries(char *names[], int num, int pagetype) {
// Goes through the pagelock table and deletes all duplicate entries
int mng_DeleteDuplicatePagelocks() {
CFILE *infile; //,*outfile;
int done = 0, deleted = 0;
int done = 0;
mngs_Pagelock temp_pl;
mngs_Pagelock *already_read;
int num = 0, duplicates = 0, i;
Expand Down Expand Up @@ -727,7 +725,7 @@ int mng_UnlockPagelockSeries(const char *names[], int *pagetypes, int num) {
memset(already_done, 0, 500);

CFILE *infile, *outfile;
int done = 0, deleted = 0;
int done = 0;
mngs_Pagelock temp_pl;
int total = 0;

Expand Down
2 changes: 1 addition & 1 deletion manage/soundpage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ void mng_WriteNewSoundPage(CFILE *outfile, mngs_sound_page *soundpage) {
// Reads a sound page from an open file. Returns 0 on error.
int mng_ReadNewSoundPage(CFILE *infile, mngs_sound_page *soundpage) {
ASSERT(infile != NULL);
int version = cf_ReadShort(infile);
/* int version = */ cf_ReadShort(infile);
// read in name,rawfile name
cf_ReadString(soundpage->sound_struct.name, PAGENAME_LEN, infile);
cf_ReadString(soundpage->raw_name, PAGENAME_LEN, infile);
Expand Down
5 changes: 2 additions & 3 deletions manage/texpage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -762,9 +762,8 @@ int mng_ReadNewTexturePage(CFILE *infile, mngs_texture_page *texpage) {
// If local is 1, deletes from the local table file
int mng_DeleteTexPageSeries(char *names[], int num_textures, int local) {
CFILE *infile, *outfile;
uint8_t pagetype, replaced = 0;
uint8_t pagetype;
int done = 0;
int deleted = 0;
memset(&texpage1, 0, sizeof(mngs_texture_page));

if (local)
Expand Down Expand Up @@ -796,7 +795,7 @@ int mng_DeleteTexPageSeries(char *names[], int num_textures, int local) {
continue;
}
pagetype = cf_ReadByte(infile);
int len = cf_ReadInt(infile);
/* int len = */ cf_ReadInt(infile);

// If not a texture page, just read it in and write it right back out
if (pagetype != PAGETYPE_TEXTURE) {
Expand Down
4 changes: 0 additions & 4 deletions model/newstyle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,6 @@ inline void RenderSubmodelLightmapFace(poly_model *pm, bsp_info *sm, int facenum
inline void RenderSubmodelFaceFogged(poly_model *pm, bsp_info *sm, int facenum) {
g3Point *pointlist[100];
polyface *fp = &sm->faces[facenum];
int modelnum = sm - pm->submodel;
int t;

for (t = 0; t < fp->nverts; t++) {
Expand Down Expand Up @@ -561,7 +560,6 @@ inline void RenderSubmodelFaceFogged(poly_model *pm, bsp_info *sm, int facenum)
inline void RenderSubmodelFaceSpecular(poly_model *pm, bsp_info *sm, int facenum) {
g3Point *pointlist[100];
polyface *fp = &sm->faces[facenum];
int modelnum = sm - pm->submodel;
int t;
bool smooth = 0;

Expand Down Expand Up @@ -623,7 +621,6 @@ inline void RenderSubmodelFaceSpecular(poly_model *pm, bsp_info *sm, int facenum
// Draws a glowing cone of light that represents thrusters
void DrawThrusterEffect(vector *pos, float r, float g, float b, vector *norm, float size, float length) {
vector cur_pos = *pos;
float cur_length = 0;
vector glow_pos[MAX_PARTS];
float glow_size[MAX_PARTS];
int total_parts = 0;
Expand Down Expand Up @@ -702,7 +699,6 @@ void RenderSubmodelFacesSorted(poly_model *pm, bsp_info *sm) {

int rcount;
int model_render_order[MAX_POLYGON_VECS];
int modelnum = sm - pm->submodel;

ASSERT(sm->nverts < MAX_POLYGON_VECS);

Expand Down
6 changes: 0 additions & 6 deletions model/polymodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2441,8 +2441,6 @@ void SetModelAngles(poly_model *po, const float *normalized_angles) {

// Now do a parametric adjustment on the angles

int cur_angle = 0;

// If we're already at the high point of the interpolation then just
// stuff some values
if (cur_state == po->num_key_angles - 1) {
Expand Down Expand Up @@ -2555,7 +2553,6 @@ void SetModelInterpPos(poly_model *po, const float *normalized_pos) {

// Now do a parametric adjustment on the positions

vector total_delta_pos = {0, 0, 0};
vector subpos;
vector final_pos;

Expand Down Expand Up @@ -3122,7 +3119,6 @@ int CountFacesInPolymodel(poly_model *pm) {
// of that point
void GetPolyModelPointInWorld(vector *dest, poly_model *pm, vector *wpos, matrix *orient, int subnum, vector *pos,
vector *norm) {
bsp_info *sm = &pm->submodel[subnum];
float normalized_time[MAX_SUBOBJECTS];
int i;

Expand Down Expand Up @@ -3174,8 +3170,6 @@ void GetPolyModelPointInWorld(vector *dest, poly_model *pm, vector *wpos, matrix

void GetPolyModelPointInWorld(vector *dest, poly_model *pm, vector *wpos, matrix *orient, int subnum,
float *normalized_time, vector *pos, vector *norm) {
bsp_info *sm = &pm->submodel[subnum];

ASSERT(!(pm->flags & PMF_NOT_RESIDENT));

if (!pm->new_style)
Expand Down
2 changes: 1 addition & 1 deletion module/module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,6 @@ bool mod_FreeModule(module *handle) {
// mod_GetLastError to see if there was an error symstr is the name of the function you want to get the symbol for (Do
// NOT give any pre/suffix to this name) parmbytes is the size (in bytes) of the parameter list the function should have
MODPROCADDRESS mod_GetSymbol(module *handle, const char *symstr, uint8_t parmbytes) {
char buffer[256];
MODPROCADDRESS sym;
if (!handle) {
ModLastError = MODERR_INVALIDHANDLE;
Expand All @@ -248,6 +247,7 @@ MODPROCADDRESS mod_GetSymbol(module *handle, const char *symstr, uint8_t parmbyt
return nullptr;
}
#if defined(WIN32)
char buffer[256];
// We need to first form the correct symbol name (for Windows)
if (parmbytes == 255)
sprintf(buffer, "%s", symstr);
Expand Down
4 changes: 2 additions & 2 deletions netcon/descent3onlineclient/odtclient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ int MainMultiplayerMenu() {

// void HotSpotCreate(int item,int parentitem, int id, int key, int txtitemoff, int txtitemon, int x, int y, int w,
// int h, int flags,int winnum)
void *exit_hs = DLLHotSpotCreate(main_wnd, 5, KEY_ESC, exit_off_text, exit_on_text, 33, 427, 70, 15, 0);
/* void *exit_hs = */ DLLHotSpotCreate(main_wnd, 5, KEY_ESC, exit_off_text, exit_on_text, 33, 427, 70, 15, 0);

void *priv_hs = DLLHotSpotCreate(main_wnd, 6, 0, priv_msg_off_text, priv_msg_on_text, 328, 403, 170, 15, 0);

Expand Down Expand Up @@ -1188,7 +1188,7 @@ int SearchMasterTrackerGameMenu() {
// Menu loop
while (!exit_menu) {
if (ChatStarted)
const char *p = GetChatText();
GetChatText();

DLLDescentDefer();

Expand Down
10 changes: 0 additions & 10 deletions netcon/inetfile/CFtp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ CFtpGet::CFtpGet(char *URL, char *localfile, char *Username, char *Password) {
}
m_ListenSock = socket(AF_INET, SOCK_STREAM, 0);
if (INVALID_SOCKET == m_ListenSock) {
int iWinsockErr = WSAGetLastError();
m_State = FTP_STATE_SOCKET_ERROR;
return;
} else {
Expand All @@ -145,15 +144,13 @@ CFtpGet::CFtpGet(char *URL, char *localfile, char *Username, char *Password) {
// Bind the listen socket
if (bind(m_ListenSock, (SOCKADDR *)&listensockaddr, sizeof(SOCKADDR))) {
// Couldn't bind the socket
int iWinsockErr = WSAGetLastError();
m_State = FTP_STATE_SOCKET_ERROR;
return;
}

// Listen for the server connection
if (listen(m_ListenSock, 1)) {
// Couldn't listen on the socket
int iWinsockErr = WSAGetLastError();
m_State = FTP_STATE_SOCKET_ERROR;
return;
}
Expand Down Expand Up @@ -339,7 +336,6 @@ uint32_t CFtpGet::GetFile() {
close(m_ListenSock);
#endif
if (m_DataSock == INVALID_SOCKET) {
int iWinsockErr = WSAGetLastError();
m_State = FTP_STATE_SOCKET_ERROR;
return 0;
}
Expand All @@ -363,7 +359,6 @@ uint32_t CFtpGet::IssuePort() {
// Get the address for the hListenSocket
iLength = sizeof(listenaddr);
if (getsockname(m_ListenSock, (SOCKADDR *)&listenaddr, &iLength) == SOCKET_ERROR) {
int iWinsockErr = WSAGetLastError();
m_State = FTP_STATE_SOCKET_ERROR;
return 0;
}
Expand All @@ -374,7 +369,6 @@ uint32_t CFtpGet::IssuePort() {
// Now, reuse the socket address structure to
// get the IP address from the control socket.
if (getsockname(m_ControlSock, (SOCKADDR *)&listenaddr, &iLength) == SOCKET_ERROR) {
int iWinsockErr = WSAGetLastError();
m_State = FTP_STATE_SOCKET_ERROR;
return 0;
}
Expand Down Expand Up @@ -411,7 +405,6 @@ uint32_t CFtpGet::IssuePort() {
if (nReplyCode != 250 || (ReadFTPServerReply() != 200)) // ummmmmmmm
#endif
{
int iWinsockErr = WSAGetLastError();
m_State = FTP_STATE_SOCKET_ERROR;
return 0;
}
Expand Down Expand Up @@ -445,7 +438,6 @@ int CFtpGet::ConnectControlSocket() {
return 0;
// Now we will connect to the host
if (connect(m_ControlSock, (SOCKADDR *)&hostaddr, sizeof(SOCKADDR))) {
int iWinsockErr = WSAGetLastError();
m_State = FTP_STATE_CANT_CONNECT;
return 0;
}
Expand Down Expand Up @@ -479,7 +471,6 @@ uint32_t CFtpGet::SendFTPCommand(char *command) {
FlushControlChannel();
// Send the FTP command
if (SOCKET_ERROR == (send(m_ControlSock, command, strlen(command), 0))) {
int iWinsockErr = WSAGetLastError();
// Return 999 to indicate an error has occurred
return (999);
}
Expand Down Expand Up @@ -579,7 +570,6 @@ uint32_t CFtpGet::ReadDataChannel() {
void CFtpGet::FlushControlChannel() {
fd_set read_fds;
TIMEVAL timeout;
int bytesin = 0;
char flushbuff[3];

timeout.tv_sec = 0;
Expand Down
1 change: 0 additions & 1 deletion netcon/mtclient/mt_net.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,6 @@ void InitMTSockets() {
}

{
static HOSTENT lhe;
memset(&sockaddr, 0, sizeof(SOCKADDR_IN));
gtrackaddr.sin_family = AF_INET;
gtrackaddr.sin_addr.s_addr = INADDR_ANY;
Expand Down
Loading

0 comments on commit 9ba0037

Please sign in to comment.