Fix some 64-bit mingw compile issues.

Just one more issue to fix (alloca), but with a hack, QF compiles (no clue
yet if it works: wine doesn't seem to be an option at this stage)
This commit is contained in:
Bill Currie 2013-01-22 13:27:39 +09:00
parent cb45d248c4
commit f1aefc969d
11 changed files with 43 additions and 24 deletions

View file

@ -75,7 +75,7 @@ dnl ==================================================================
dnl Checks for which system driver to use
AC_MSG_CHECKING(for system driver)
case "${host}" in
i?86-*-mingw32*)
i?86-*-mingw32*|x86_64-w64-mingw32)
SYSTYPE=WIN32
AC_MSG_RESULT([Win32 driver])
WIN32_LIBS=' $(NET_LIBS)'

View file

@ -34,7 +34,7 @@
#ifdef HAVE_STRINGS_H
# include <strings.h>
#endif
#include <inttypes.h>
#include <stdlib.h>
#include "winquake.h"
@ -262,7 +262,7 @@ s_soundinfo_f (void)
Sys_Printf ("%5d samplebits\n", snd_shm->samplebits);
Sys_Printf ("%5d submission_chunk\n", snd_shm->submission_chunk);
Sys_Printf ("%5d speed\n", snd_shm->speed);
Sys_Printf ("0x%lx dma buffer\n", (long) snd_shm->buffer);
Sys_Printf ("0x%"PRIxPTR" dma buffer\n", (intptr_t) snd_shm->buffer);
Sys_Printf ("%5d total_channels\n", snd_total_channels);
}

View file

@ -496,8 +496,8 @@ GIB_Slice_Find_f (void)
dsprintf (GIB_Return (0), "%lu",
(unsigned long int) (res - GIB_Argv (1)));
dsprintf (GIB_Return (0), "%lu",
(unsigned long int) (res - GIB_Argv (1)) +
strlen (GIB_Argv (2)));
(unsigned long int) (res - GIB_Argv (1) +
strlen (GIB_Argv (2))));
}
}

View file

@ -2509,10 +2509,10 @@ typedef struct
DEBUG_PRINT_COMPILED_PATTERN (bufp, pat, pend); \
\
/* Restore register info. */ \
high_reg = (unsigned long) POP_FAILURE_ITEM (); \
high_reg = (uintptr_t) POP_FAILURE_ITEM (); \
DEBUG_PRINT2 (" Popping high active reg: %d\n", high_reg); \
\
low_reg = (unsigned long) POP_FAILURE_ITEM (); \
low_reg = (uintptr_t) POP_FAILURE_ITEM (); \
DEBUG_PRINT2 (" Popping low active reg: %d\n", low_reg); \
\
for (this_reg = high_reg; (unsigned) this_reg >= low_reg; this_reg--) \
@ -3225,8 +3225,8 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop)
unsigned num_regs = bufp->re_nsub + 1;
/* The currently active registers. */
unsigned long lowest_active_reg = NO_LOWEST_ACTIVE_REG;
unsigned long highest_active_reg = NO_HIGHEST_ACTIVE_REG;
uintptr_t lowest_active_reg = NO_LOWEST_ACTIVE_REG;
uintptr_t highest_active_reg = NO_HIGHEST_ACTIVE_REG;
/* Information on the contents of registers. These are pointers into
the input strings; they record just what was matched (on this

View file

@ -109,10 +109,14 @@
#endif
#ifndef HAVE_SOCKLEN_T
# ifdef HAVE_SIZE
typedef size_t socklen_t;
# ifdef _WIN64
typedef int socklen_t;
# else
# ifdef HAVE_SIZE
typedef size_t socklen_t;
# else
typedef unsigned int socklen_t;
# endif
# endif
#endif
@ -433,7 +437,11 @@ int
UDP_CheckNewConnections (void)
{
#if defined (HAVE_IOCTL) || defined (_WIN32)
# ifdef _WIN64
u_long available;
# else
int available;
# endif
AF_address_t from;
socklen_t fromlen = sizeof (from);
char buff[1];
@ -505,7 +513,8 @@ UDP_Read (int socket, byte *buf, int len, netadr_t *from)
socklen_t addrlen = sizeof (AF_address_t);
memset (&addr, 0, sizeof (addr));
ret = recvfrom (socket, buf, len, 0, (struct sockaddr *) &addr, &addrlen);
ret = recvfrom (socket, (void *) buf, len, 0, (struct sockaddr *) &addr,
&addrlen);
if (ret == -1 && (errno == EWOULDBLOCK || errno == ECONNREFUSED))
return 0;
SockadrToNetadr (&addr, from);
@ -555,7 +564,8 @@ UDP_Write (int socket, byte *buf, int len, netadr_t *to)
AF_address_t addr;
NetadrToSockadr (to, &addr);
ret = sendto (socket, buf, len, 0, &addr.sa, SA_LEN (&addr.sa));
ret = sendto (socket, (const void *) buf, len, 0, &addr.sa,
SA_LEN (&addr.sa));
if (ret == -1 && errno == EWOULDBLOCK)
return 0;
Sys_MaskPrintf (SYS_NET, "sent %d bytes to %s\n", ret,

View file

@ -29,6 +29,7 @@
# include "config.h"
#endif
#include <winsock2.h>
#include "winquake.h"
#include "QF/cvar.h"
@ -127,7 +128,11 @@ SockadrToNetadr (AF_address_t *s, netadr_t *a)
static double blocktime;
#ifdef _WIN64
static INT_PTR PASCAL FAR
#else
static BOOL PASCAL FAR
#endif
BlockingHook (void)
{
MSG msg;

View file

@ -176,7 +176,7 @@ set_arrays (const shaderparam_t *vert, const shaderparam_t *norm,
GLint size;
qfeglGetBufferParameteriv (GL_ARRAY_BUFFER, GL_BUFFER_SIZE, &size);
if (size <= (long)pose_offs) {
if (size <= (intptr_t)pose_offs) {
Sys_Printf ("Invalid pose");
pose = 0;
}

View file

@ -582,20 +582,20 @@ glsl_R_BuildDisplayLists (model_t **models, int num_models)
if (!tex->elechain) {
ec = add_elechain (tex, surf->ec_index);
el = ec->elements;
el->base = (byte *) vertices->size;
el->base = (byte *) (intptr_t) vertices->size;
vertex_index_base = 0;
}
if (surf->ec_index != ec->index) { // next sub-model
ec = add_elechain (tex, surf->ec_index);
el = ec->elements;
el->base = (byte *) vertices->size;
el->base = (byte *) (intptr_t) vertices->size;
vertex_index_base = 0;
}
if (vertex_index_base + surf->numedges > 65535) {
// elements index overflow
el->next = get_elements ();
el = el->next;
el->base = (byte *) vertices->size;
el->base = (byte *) (intptr_t) vertices->size;
vertex_index_base = 0;
}
// we don't use it now, but pre-initializing the list won't hurt
@ -610,7 +610,7 @@ glsl_R_BuildDisplayLists (model_t **models, int num_models)
}
clear_texture_chains ();
Sys_MaskPrintf (SYS_GLSL, "R_BuildDisplayLists: %ld verts total\n",
vertices->size / sizeof (bspvert_t));
(long) (vertices->size / sizeof (bspvert_t)));
if (!bsp_vbo)
qfeglGenBuffers (1, &bsp_vbo);
qfeglBindBuffer (GL_ARRAY_BUFFER, bsp_vbo);

View file

@ -230,7 +230,11 @@ preprocess_file (const char *filename, const char *ext)
puts("");
}
#ifdef _WIN64
status = spawnvp (_P_WAIT, cpp_argv[0], (char **) cpp_argv);
#else
status = spawnvp (_P_WAIT, cpp_argv[0], cpp_argv);
#endif
if (status) {
fprintf (stderr, "%s: cpp returned error code %d\n",

View file

@ -52,7 +52,7 @@ static hashtab_t *saved_strings;
static const char *
strpool_get_key (const void *_str, void *_strpool)
{
long str = (long) _str;
long str = (intptr_t) _str;
strpool_t *strpool = (strpool_t *) _strpool;
return strpool->strings + str;
@ -74,7 +74,7 @@ strpool_new (void)
strpool_t *
strpool_build (const char *strings, int size)
{
long s;
intptr_t s;
strpool_t *strpool = malloc (sizeof (strpool_t));
strpool->str_tab = Hash_NewTable (16381, strpool_get_key, 0, strpool);
@ -100,12 +100,12 @@ strpool_delete (strpool_t *strpool)
int
strpool_addstr (strpool_t *strpool, const char *str)
{
long s;
intptr_t s;
int len;
if (!str || !*str)
return 0;
s = (long) Hash_Find (strpool->str_tab, str);
s = (intptr_t) Hash_Find (strpool->str_tab, str);
if (s)
return s;
len = strlen (str) + 1;

View file

@ -468,11 +468,11 @@ CalcPortalVis (void)
Sys_Error ("pthread_attr_setstacksize failed");
for (i = 0; i < options.threads; i++) {
if (pthread_create (&work_threads[i], &attrib, LeafThread,
(void *) i) == -1)
(void *) (intptr_t) i) == -1)
Sys_Error ("pthread_create failed");
}
if (pthread_create (&work_threads[i], &attrib, WatchThread,
(void *) i) == -1)
(void *) (intptr_t) i) == -1)
Sys_Error ("pthread_create failed");
for (i = 0; i < options.threads; i++) {