mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-23 07:30:40 +00:00
Address some const-disregarding casts missed in r5540 due to conditional compilation settings and platforms.
git-svn-id: https://svn.eduke32.com/eduke32@5551 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
da1081112c
commit
98ebda94ec
21 changed files with 67 additions and 60 deletions
|
@ -80,11 +80,11 @@ void clearbufbyte(void *D, int32_t c, int32_t a);
|
|||
void copybufbyte(const void *S, void *D, int32_t c);
|
||||
void copybufreverse(const void *S, void *D, int32_t c);
|
||||
|
||||
static inline int32_t krecipasm(int32_t const i)
|
||||
static inline int32_t krecipasm(int32_t i)
|
||||
{
|
||||
// Ken did this
|
||||
float f = (float const)i;
|
||||
i = *(int32_t *)&f;
|
||||
float const f = (float const)i;
|
||||
i = *(int32_t const *)&f;
|
||||
return ((reciptable[(i >> 12) & 2047] >> (((i - 0x3f800000) >> 23) & 31)) ^ (i >> 31));
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -245,7 +245,8 @@ static inline void swap64bit(void *a, void *b)
|
|||
static inline int32_t krecipasm(int32_t i)
|
||||
{
|
||||
// Ken did this
|
||||
float f = (float) i; i = *(int32_t *) &f;
|
||||
float const f = (float const)i;
|
||||
i = *(int32_t const *)&f;
|
||||
return((reciptable[(i>>12)&2047]>>(((i-0x3f800000)>>23)&31))^(i>>31));
|
||||
}
|
||||
|
||||
|
|
|
@ -10915,7 +10915,6 @@ void test_map(int32_t mode)
|
|||
if ((!mode && cursectnum >= 0) || (mode && startsectnum >= 0))
|
||||
{
|
||||
char const *param = " -map " PLAYTEST_MAPNAME " -noinstancechecking";
|
||||
char *fullparam;
|
||||
char current_cwd[BMAX_PATH];
|
||||
int32_t slen = 0;
|
||||
BFILE *fp;
|
||||
|
@ -10930,14 +10929,14 @@ void test_map(int32_t mode)
|
|||
fclose(fp);
|
||||
else
|
||||
{
|
||||
char const * lastslash = (char const *)Bstrrchr(mapster32_fullpath, '/');
|
||||
#ifdef _WIN32
|
||||
fullparam = (char *)Bstrrchr(mapster32_fullpath, '\\');
|
||||
#else
|
||||
fullparam = (char *)Bstrrchr(mapster32_fullpath, '/');
|
||||
char const * lastbackslash = (char const *)Bstrrchr(mapster32_fullpath, '\\');
|
||||
lastslash = max(lastslash, lastbackslash);
|
||||
#endif
|
||||
if (fullparam)
|
||||
if (lastslash)
|
||||
{
|
||||
slen = fullparam-mapster32_fullpath+1;
|
||||
slen = lastslash-mapster32_fullpath+1;
|
||||
Bstrncpy(game_executable, mapster32_fullpath, slen);
|
||||
Bstrncpy(game_executable+slen, DefaultGameExec, sizeof(game_executable)-slen);
|
||||
}
|
||||
|
@ -10955,7 +10954,7 @@ void test_map(int32_t mode)
|
|||
// and a possible extra space not in testplay_addparam,
|
||||
// the length should be Bstrlen(game_executable)+Bstrlen(param)+(slen+1)+2+1.
|
||||
|
||||
fullparam = (char *)Xmalloc(Bstrlen(game_executable)+Bstrlen(param)+slen+4);
|
||||
char *fullparam = (char *)Xmalloc(Bstrlen(game_executable)+Bstrlen(param)+slen+4);
|
||||
Bsprintf(fullparam,"\"%s\"",game_executable);
|
||||
|
||||
if (testplay_addparam)
|
||||
|
|
|
@ -2955,7 +2955,7 @@ jwzgles_glTexImage2D (GLenum target,
|
|||
GLenum type,
|
||||
const GLvoid *data)
|
||||
{
|
||||
GLvoid *d2 = (GLvoid *) data;
|
||||
GLvoid *d2 = NULL;
|
||||
Assert (!state->compiling_verts, "glTexImage2D not allowed inside glBegin");
|
||||
Assert (!state->compiling_list, /* technically legal, but stupid! */
|
||||
"glTexImage2D not allowed inside glNewList");
|
||||
|
@ -2974,7 +2974,7 @@ jwzgles_glTexImage2D (GLenum target,
|
|||
/* GLES does not let us omit the data pointer to create a blank texture. */
|
||||
if (! data)
|
||||
{
|
||||
d2 = (GLvoid *) calloc (1, width * height * sizeof(GLfloat) * 4);
|
||||
data = d2 = (GLvoid *) calloc (1, width * height * sizeof(GLfloat) * 4);
|
||||
Assert (d2, "out of memory");
|
||||
}
|
||||
|
||||
|
@ -2987,12 +2987,12 @@ jwzgles_glTexImage2D (GLenum target,
|
|||
LOG10 ("direct %-12s %s %d %s %d %d %d %s %s 0x%lX", "glTexImage2D",
|
||||
mode_desc(target), level, mode_desc(internalFormat),
|
||||
width, height, border, mode_desc(format), mode_desc(type),
|
||||
(unsigned long) d2);
|
||||
(unsigned long) data);
|
||||
glTexImage2D (target, level, internalFormat, width, height, border,
|
||||
format, type, d2); /* the real one */
|
||||
format, type, data); /* the real one */
|
||||
CHECK("glTexImage2D");
|
||||
|
||||
if (d2 != data) free (d2);
|
||||
free (d2);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -3258,7 +3258,7 @@ jwzgles_gluBuild2DMipmaps (GLenum target,
|
|||
int w2 = to_pow2(width);
|
||||
int h2 = to_pow2(height);
|
||||
|
||||
void *d2 = (void *) data;
|
||||
void *d2 = NULL;
|
||||
|
||||
/* OpenGLES no longer supports "4" as a synonym for "RGBA". */
|
||||
switch (internalFormat) {
|
||||
|
@ -3283,10 +3283,10 @@ jwzgles_gluBuild2DMipmaps (GLenum target,
|
|||
int ibpl = istride * width;
|
||||
int obpl = ostride * w2;
|
||||
int oy;
|
||||
const unsigned char *in = (unsigned char *) data;
|
||||
const unsigned char *in = (const unsigned char *) data;
|
||||
unsigned char *out = (unsigned char *) malloc (h2 * obpl);
|
||||
Assert (out, "out of memory");
|
||||
d2 = out;
|
||||
data = d2 = out;
|
||||
|
||||
for (oy = 0; oy < h2; oy++)
|
||||
{
|
||||
|
@ -3312,8 +3312,8 @@ jwzgles_gluBuild2DMipmaps (GLenum target,
|
|||
}
|
||||
|
||||
jwzgles_glTexImage2D (target, 0, internalFormat, w2, h2, 0,
|
||||
format, type, d2);
|
||||
if (d2 != data) free (d2);
|
||||
format, type, data);
|
||||
free (d2);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -2745,7 +2745,7 @@ int32_t kzfindfile(char *filnam)
|
|||
#else
|
||||
if (!hfind)
|
||||
{
|
||||
char *s = ".";
|
||||
char const *s = ".";
|
||||
if (wildstpathleng > 0)
|
||||
{
|
||||
filnam[wildstpathleng] = 0;
|
||||
|
|
|
@ -714,9 +714,10 @@ int32_t initinput(void)
|
|||
#endif
|
||||
|
||||
#if defined EDUKE32_OSX
|
||||
static char sdl_has3buttonmouse[] = "SDL_HAS3BUTTONMOUSE=1";
|
||||
// force OS X to operate in >1 button mouse mode so that LMB isn't adulterated
|
||||
if (!getenv("SDL_HAS3BUTTONMOUSE"))
|
||||
putenv("SDL_HAS3BUTTONMOUSE=1");
|
||||
putenv(sdl_has3buttonmouse);
|
||||
#endif
|
||||
|
||||
if (!keyremapinit)
|
||||
|
|
|
@ -136,7 +136,7 @@ static gboolean on_startwin_delete_event(GtkWidget *widget, GdkEvent *event, gpo
|
|||
|
||||
static GdkPixbuf *load_banner(void)
|
||||
{
|
||||
return gdk_pixbuf_from_pixdata((GdkPixdata*)&startbanner_pixdata, FALSE, NULL);
|
||||
return gdk_pixbuf_from_pixdata((GdkPixdata const *)&startbanner_pixdata, FALSE, NULL);
|
||||
}
|
||||
|
||||
static void SetPage(int32_t n)
|
||||
|
|
|
@ -234,13 +234,13 @@ static INT_PTR CALLBACK startup_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam,
|
|||
|
||||
ZeroMemory(&tab, sizeof(tab));
|
||||
tab.mask = TCIF_TEXT;
|
||||
tab.pszText = Bstrdup(TEXT("Setup"));
|
||||
static char textSetup[] = TEXT("Setup");
|
||||
tab.pszText = textSetup;
|
||||
SendMessage(hwnd, TCM_INSERTITEM, (WPARAM)0, (LPARAM)&tab);
|
||||
Bfree(tab.pszText);
|
||||
tab.mask = TCIF_TEXT;
|
||||
tab.pszText = Bstrdup(TEXT("Message Log"));
|
||||
static char textMessageLog[] = TEXT("Message Log");
|
||||
tab.pszText = textMessageLog;
|
||||
SendMessage(hwnd, TCM_INSERTITEM, (WPARAM)1, (LPARAM)&tab);
|
||||
Bfree(tab.pszText);
|
||||
// Work out the position and size of the area inside the tab control for the pages
|
||||
ZeroMemory(&r, sizeof(r));
|
||||
GetClientRect(hwnd, &r);
|
||||
|
|
|
@ -185,7 +185,7 @@ static int32_t joyblast=0;
|
|||
|
||||
static struct
|
||||
{
|
||||
char *name;
|
||||
char const *name;
|
||||
LPDIRECTINPUTDEVICE7A *did;
|
||||
LPCDIDATAFORMAT df;
|
||||
} devicedef = { "joystick", &lpDID, &c_dfDIJoystick };
|
||||
|
@ -731,7 +731,7 @@ int32_t handleevents(void)
|
|||
}
|
||||
|
||||
|
||||
void switchlayout(char * layout)
|
||||
void switchlayout(char const * layout)
|
||||
{
|
||||
char layoutname[KL_NAMELENGTH];
|
||||
|
||||
|
@ -2802,10 +2802,10 @@ static int32_t SetupOpenGL(int32_t width, int32_t height, int32_t bitspp)
|
|||
GLubyte *p,*p2,*p3;
|
||||
int32_t err = 0;
|
||||
|
||||
glinfo.vendor = (char *)bglGetString(GL_VENDOR);
|
||||
glinfo.renderer = (char *)bglGetString(GL_RENDERER);
|
||||
glinfo.version = (char *)bglGetString(GL_VERSION);
|
||||
glinfo.extensions = (char *)bglGetString(GL_EXTENSIONS);
|
||||
glinfo.vendor = (char const *)bglGetString(GL_VENDOR);
|
||||
glinfo.renderer = (char const *)bglGetString(GL_RENDERER);
|
||||
glinfo.version = (char const *)bglGetString(GL_VERSION);
|
||||
glinfo.extensions = (char const *)bglGetString(GL_EXTENSIONS);
|
||||
|
||||
// GL driver blacklist
|
||||
|
||||
|
|
|
@ -139,7 +139,7 @@ enet_address_get_host_ip (const ENetAddress * address, char * name, size_t nameL
|
|||
#ifdef HAS_INET_NTOP
|
||||
if (inet_ntop (AF_INET, & address -> host, name, nameLength) == NULL)
|
||||
#else
|
||||
char * addr = inet_ntoa (* (struct in_addr *) & address -> host);
|
||||
char * addr = inet_ntoa (* (struct in_addr const *) & address -> host);
|
||||
if (addr != NULL)
|
||||
{
|
||||
size_t addrLen = strlen(addr);
|
||||
|
|
|
@ -9889,10 +9889,11 @@ const char **g_elModules;
|
|||
|
||||
static void G_AddDemo(const char* param)
|
||||
{
|
||||
char * colon = (char *)Bstrchr(param, ':');
|
||||
Bstrncpy(tempbuf, param, sizeof(tempbuf));
|
||||
char * colon = (char *)Bstrchr(tempbuf, ':');
|
||||
int32_t framespertic=-1, numrepeats=1;
|
||||
|
||||
if (colon && colon != param)
|
||||
if (colon && colon != tempbuf)
|
||||
{
|
||||
// -d<filename>:<num>[,<num>]
|
||||
// profiling options
|
||||
|
@ -9900,7 +9901,7 @@ static void G_AddDemo(const char* param)
|
|||
Bsscanf(colon, "%u,%u", &framespertic, &numrepeats);
|
||||
}
|
||||
|
||||
Demo_SetFirst(param);
|
||||
Demo_SetFirst(tempbuf);
|
||||
|
||||
if (framespertic < 0)
|
||||
{
|
||||
|
|
|
@ -318,7 +318,7 @@ static playbackstatus MV_GetNextVorbisBlock(VoiceNode *voice)
|
|||
#ifdef GEKKO
|
||||
// If libtremor had the three additional ov_read() parameters that libvorbis has,
|
||||
// this would be better handled using the endianness parameter.
|
||||
int16_t *data = (int16_t *)(voice->sound); // assumes signed 16-bit
|
||||
int16_t *data = (int16_t *)(vd->block); // assumes signed 16-bit
|
||||
for (bytesread = 0; bytesread < BLOCKSIZE / 2; ++bytesread)
|
||||
data[bytesread] = (data[bytesread] & 0xff) << 8 | ((data[bytesread] & 0xff00) >> 8);
|
||||
#endif
|
||||
|
|
|
@ -55,9 +55,9 @@ static int8_t external_midi_restart=0;
|
|||
#endif
|
||||
|
||||
#ifdef __ANDROID__ //TODO fix
|
||||
static char *external_midi_tempfn = "eduke32-music.mid";
|
||||
static char const *external_midi_tempfn = "eduke32-music.mid";
|
||||
#else
|
||||
static char *external_midi_tempfn = "/tmp/eduke32-music.mid";
|
||||
static char const *external_midi_tempfn = "/tmp/eduke32-music.mid";
|
||||
#endif
|
||||
|
||||
static int32_t external_midi = 0;
|
||||
|
|
|
@ -258,7 +258,7 @@ static gboolean on_startwin_delete_event(GtkWidget *widget, GdkEvent *event, gpo
|
|||
|
||||
static GdkPixbuf *load_banner(void)
|
||||
{
|
||||
return gdk_pixbuf_from_pixdata((GdkPixdata*)&startbanner_pixdata, FALSE, NULL);
|
||||
return gdk_pixbuf_from_pixdata((GdkPixdata const *)&startbanner_pixdata, FALSE, NULL);
|
||||
}
|
||||
|
||||
static void SetPage(int32_t n)
|
||||
|
@ -444,7 +444,7 @@ static void PopulateForm(unsigned char pgs)
|
|||
for (grpfile_t const * fg = foundgrps; fg; fg=fg->next)
|
||||
{
|
||||
gtk_list_store_append(list, &iter);
|
||||
gtk_list_store_set(list, &iter, 0, fg->type->name, 1, fg->filename, 2, (gpointer)fg, -1);
|
||||
gtk_list_store_set(list, &iter, 0, fg->type->name, 1, fg->filename, 2, (void const *)fg, -1);
|
||||
if (settings.grp == fg)
|
||||
{
|
||||
GtkTreeSelection *sel = gtk_tree_view_get_selection(gamelist);
|
||||
|
|
|
@ -499,13 +499,13 @@ static INT_PTR CALLBACK startup_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam,
|
|||
|
||||
ZeroMemory(&tab, sizeof(tab));
|
||||
tab.mask = TCIF_TEXT;
|
||||
tab.pszText = Bstrdup(TEXT("Setup"));
|
||||
static char textSetup[] = TEXT("Setup");
|
||||
tab.pszText = textSetup;
|
||||
SendMessage(hwnd, TCM_INSERTITEM, (WPARAM)TAB_CONFIG, (LPARAM)&tab);
|
||||
Bfree(tab.pszText);
|
||||
tab.mask = TCIF_TEXT;
|
||||
tab.pszText = Bstrdup(TEXT("Message Log"));
|
||||
static char textMessageLog[] = TEXT("Message Log");
|
||||
tab.pszText = textMessageLog;
|
||||
SendMessage(hwnd, TCM_INSERTITEM, (WPARAM)TAB_MESSAGES, (LPARAM)&tab);
|
||||
Bfree(tab.pszText);
|
||||
|
||||
// Work out the position and size of the area inside the tab control for the pages
|
||||
ZeroMemory(&r, sizeof(r));
|
||||
|
|
|
@ -61,7 +61,7 @@ static int retval = -1, mode = TAB_MESSAGES;
|
|||
static GdkPixbuf *load_banner(void)
|
||||
{
|
||||
extern const GdkPixdata startbanner_pixdata;
|
||||
return gdk_pixbuf_from_pixdata(&startbanner_pixdata, FALSE, NULL);
|
||||
return gdk_pixbuf_from_pixdata((GdkPixdata const *)&startbanner_pixdata, FALSE, NULL);
|
||||
}
|
||||
|
||||
static void SetPage(int n)
|
||||
|
|
|
@ -353,13 +353,16 @@ static INT_PTR CALLBACK startup_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam,
|
|||
|
||||
ZeroMemory(&tab, sizeof(tab));
|
||||
tab.mask = TCIF_TEXT;
|
||||
tab.pszText = TEXT("Configuration");
|
||||
static char textConfiguration[] = TEXT("Configuration")
|
||||
tab.pszText = textConfiguration;
|
||||
SendMessage(hwnd, TCM_INSERTITEM, (WPARAM)TAB_CONFIG, (LPARAM)&tab);
|
||||
tab.mask = TCIF_TEXT;
|
||||
tab.pszText = TEXT("Game");
|
||||
static char textGame[] = TEXT("Game")
|
||||
tab.pszText = textGame;
|
||||
SendMessage(hwnd, TCM_INSERTITEM, (WPARAM)TAB_GAME, (LPARAM)&tab);
|
||||
tab.mask = TCIF_TEXT;
|
||||
tab.pszText = TEXT("Messages");
|
||||
static char textMessages[] = TEXT("Messages");
|
||||
tab.pszText = textMessages;
|
||||
SendMessage(hwnd, TCM_INSERTITEM, (WPARAM)TAB_MESSAGES, (LPARAM)&tab);
|
||||
|
||||
// Work out the position and size of the area inside the tab control for the pages
|
||||
|
|
|
@ -46,10 +46,10 @@ static int32_t setsprite_eyeheight(int16_t spritenum, const vec3_t *pos)
|
|||
void initsb(char,char,int,char,char,char,char);
|
||||
void uninitsb(void);
|
||||
void setears(int,int,int,int);
|
||||
void wsayfollow(char *,int,int,int *,int *,char);
|
||||
void wsay(char *,int,int,int);
|
||||
void wsayfollow(char const *,int,int,int *,int *,char);
|
||||
void wsay(char const *,int,int,int);
|
||||
void loadwaves(void);
|
||||
void loadsong(char *);
|
||||
void loadsong(char const *);
|
||||
void musicon(void);
|
||||
void musicoff(void);
|
||||
void refreshaudio(void);
|
||||
|
|
|
@ -24,7 +24,7 @@ void setears(int daposx, int daposy, int daxvect, int dayvect)
|
|||
UNREFERENCED_PARAMETER(dayvect);
|
||||
}
|
||||
|
||||
void wsayfollow(char *dafilename, int dafreq, int davol, int *daxplc, int *dayplc, char followstat)
|
||||
void wsayfollow(char const *dafilename, int dafreq, int davol, int *daxplc, int *dayplc, char followstat)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(dafilename);
|
||||
UNREFERENCED_PARAMETER(dafreq);
|
||||
|
@ -34,7 +34,7 @@ void wsayfollow(char *dafilename, int dafreq, int davol, int *daxplc, int *daypl
|
|||
UNREFERENCED_PARAMETER(followstat);
|
||||
}
|
||||
|
||||
void wsay(char *dafilename, int dafreq, int volume1, int volume2)
|
||||
void wsay(char const *dafilename, int dafreq, int volume1, int volume2)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(dafilename);
|
||||
UNREFERENCED_PARAMETER(dafreq);
|
||||
|
@ -46,7 +46,7 @@ void loadwaves(void)
|
|||
{
|
||||
}
|
||||
|
||||
void loadsong(char *filename)
|
||||
void loadsong(char const *filename)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(filename);
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ static int retval = -1, mode = TAB_MESSAGES;
|
|||
|
||||
static GdkPixbuf *load_banner(void)
|
||||
{
|
||||
return gdk_pixbuf_from_pixdata((GdkPixdata *)&startbanner_pixdata, FALSE, NULL);
|
||||
return gdk_pixbuf_from_pixdata((GdkPixdata const *)&startbanner_pixdata, FALSE, NULL);
|
||||
}
|
||||
|
||||
static void SetPage(int n)
|
||||
|
|
|
@ -203,10 +203,12 @@ static INT_PTR CALLBACK startup_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam,
|
|||
|
||||
ZeroMemory(&tab, sizeof(tab));
|
||||
tab.mask = TCIF_TEXT;
|
||||
tab.pszText = TEXT("Configuration");
|
||||
static char textConfiguration[] = TEXT("Configuration");
|
||||
tab.pszText = textConfiguration;
|
||||
SendMessage(hwnd, TCM_INSERTITEM, (WPARAM)0, (LPARAM)&tab);
|
||||
tab.mask = TCIF_TEXT;
|
||||
tab.pszText = TEXT("Messages");
|
||||
static char textMessages[] = TEXT("Messages");
|
||||
tab.pszText = textMessages;
|
||||
SendMessage(hwnd, TCM_INSERTITEM, (WPARAM)1, (LPARAM)&tab);
|
||||
|
||||
// Work out the position and size of the area inside the tab control for the pages
|
||||
|
|
Loading…
Reference in a new issue