Skip to content

Commit

Permalink
Fixed some type mismatches and removed unused vars.
Browse files Browse the repository at this point in the history
All handles now use Uint32_t in all function in glbapi.cpp
  • Loading branch information
wel97459 committed Dec 20, 2024
1 parent b8eefff commit ade1742
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 23 deletions.
4 changes: 1 addition & 3 deletions src/demo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,7 @@ DEMO_LoadFile(
void
)
{
int filesize;

filesize = GLB_ReadFile(demo_name, 0);
GLB_ReadFile(demo_name, 0);
GLB_ReadFile(demo_name, (char*)playback);

cur_play = 1;
Expand Down
2 changes: 1 addition & 1 deletion src/gfxapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1522,7 +1522,7 @@ GFX_StrPixelLen(

for (loop = 0; loop < maxloop; loop++)
{
outlen += infont->width[instr[loop]] + fontspacing;
outlen += infont->width[(int)instr[loop]] + fontspacing;
}

return outlen;
Expand Down
19 changes: 9 additions & 10 deletions src/glbapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,6 @@ GLB_FindFile(
* create a file name and attempt to open it local first, then if it
* fails use the exe path and try again.
*/
int lookat = 0;
char *name = (char*)malloc((strlen(prefix)+9) * sizeof(char));
sprintf(name, "%s%04u.GLB", prefix, filenum);
filename = GLB_FindFilePath(name);
Expand Down Expand Up @@ -555,7 +554,7 @@ GLB_FetchItem(
***************************************************************************/
char*
GLB_CacheItem(
int handle
uint32_t handle
)
{
return GLB_FetchItem(handle, FI_CACHE);
Expand All @@ -566,7 +565,7 @@ GLB_CacheItem(
***************************************************************************/
char*
GLB_GetItem(
int handle // INPUT : handle of item
uint32_t handle // INPUT : handle of item
)
{
return GLB_FetchItem(handle, FI_DISCARD);
Expand All @@ -577,7 +576,7 @@ GLB_GetItem(
***************************************************************************/
char*
GLB_LockItem(
int handle
uint32_t handle
)
{
return GLB_FetchItem(handle, FI_LOCK);
Expand All @@ -588,7 +587,7 @@ GLB_LockItem(
***************************************************************************/
void
GLB_UnlockItem(
int handle
uint32_t handle
)
{
ITEM_H itm;
Expand Down Expand Up @@ -628,7 +627,7 @@ GLB_UnlockItem(
***************************************************************************/
int // RETURN: TRUE = Label
GLB_IsLabel(
int handle // INPUT : handle of item
uint32_t handle // INPUT : handle of item
)
{
ITEM_H itm;
Expand All @@ -653,7 +652,7 @@ GLB_IsLabel(
***************************************************************************/
void
GLB_ReadItem(
int handle, // INPUT : handle of item
uint32_t handle, // INPUT : handle of item
char* mem // INPUT : pointer to memory
)
{
Expand Down Expand Up @@ -725,7 +724,7 @@ GLB_GetItemID(
***************************************************************************/
char* // RETURN: pointer to item
GLB_GetPtr(
int handle // INPUT : handle of item
uint32_t handle // INPUT : handle of item
)
{
ITEM_H itm;
Expand All @@ -751,7 +750,7 @@ GLB_GetPtr(
***************************************************************************/
void
GLB_FreeItem(
int handle // INPUT : handle of item
uint32_t handle // INPUT : handle of item
)
{
ITEM_H itm;
Expand Down Expand Up @@ -824,7 +823,7 @@ GLB_FreeAll(
***************************************************************************/
int // RETURN: sizeof ITEM
GLB_ItemSize(
int handle // INPUT : handle of item
uint32_t handle // INPUT : handle of item
)
{
ITEM_H itm;
Expand Down
18 changes: 9 additions & 9 deletions src/glbapi.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,22 @@ typedef struct

void GLB_UseVM(void);
int GLB_InitSystem(const char *exepath, int innum, const char *iprefix);
char *GLB_LockItem(int handle);
void GLB_UnlockItem(int handle);
char *GLB_GetItem(int handle);
char *GLB_CacheItem(int handle);
void GLB_FreeItem(int handle);
char *GLB_LockItem(uint32_t handle);
void GLB_UnlockItem(uint32_t handle);
char *GLB_GetItem(uint32_t handle);
char *GLB_CacheItem(uint32_t handle);
void GLB_FreeItem(uint32_t handle);
void GLB_FreeAll(void);
int GLB_GetItemID(const char *in_name);
int GLB_ItemSize(int handle);
int GLB_ItemSize(uint32_t handle);
void GLB_EnCrypt(const char *key, void *buf, int length);
void GLB_DeCrypt(const char *key, void *buf, int length);
int GLB_ReadFile(const char *name, char *buffer);
void GLB_SaveFile(char *name, char *buffer, int length);
int GLB_Load(char *inmem, int filenum, int itemnum);
int GLB_IsLabel(int handle);
void GLB_ReadItem(int handle, char *mem);
int GLB_IsLabel(uint32_t handle);
void GLB_ReadItem(uint32_t handle, char *mem);
char * GLB_FindFilePath(char *file);
//char *GLB_GetPtr(int handle);
//char *GLB_GetPtr(uint32_t handle);
//void GLB_SetItemPointer(int a1, char* a2);
//void GLB_SetItemSize(int a1, int a2);

0 comments on commit ade1742

Please sign in to comment.