fixed compile errors and warnings using Dev-C++ in "Compile as C++" mode
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 15 Sep 2009 10:08:02 +0000 (10:08 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 15 Sep 2009 10:08:02 +0000 (10:08 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@9198 d7cf8633-e32d-0410-b094-e92efae38249

cap_ogg.c
cl_main.c
cl_particles.c
image_png.c
lhnet.c
menu.c
model_shared.c
sys_sdl.c

index 9382bb5..626efe4 100644 (file)
--- a/cap_ogg.c
+++ b/cap_ogg.c
@@ -1009,13 +1009,13 @@ void SCR_CaptureVideo_Ogg_BeginVideo(void)
                        if(ti.quality < 0)
                        {
                                ti.target_bitrate = -1;
-                               ti.keyframe_data_target_bitrate = -1;
+                               ti.keyframe_data_target_bitrate = (unsigned int)-1;
                                ti.quality = 63;
                        }
                        else
                        {
                                ti.target_bitrate = -1;
-                               ti.keyframe_data_target_bitrate = -1;
+                               ti.keyframe_data_target_bitrate = (unsigned int)-1;
                                ti.quality = bound(0, ti.quality, 63);
                        }
                }
index 108701a..799010d 100644 (file)
--- a/cl_main.c
+++ b/cl_main.c
@@ -1231,7 +1231,7 @@ void CL_UpdateViewModel(void)
        ent->state_previous = ent->state_current;
        ent->state_current = defaultstate;
        ent->state_current.time = cl.time;
-       ent->state_current.number = -1;
+       ent->state_current.number = (unsigned int)-1;
        ent->state_current.active = true;
        ent->state_current.modelindex = cl.stats[STAT_WEAPON];
        ent->state_current.frame = cl.stats[STAT_WEAPONFRAME];
index 47020d7..ac186bb 100644 (file)
@@ -301,8 +301,8 @@ void CL_Particles_ParseEffectInfo(const char *textstart, const char *textend)
                        info->lightshadow = true;
                        info->lighttime = 9999;
                        info->stretchfactor = 1;
-                       info->staincolor[0] = -1;
-                       info->staincolor[1] = -1;
+                       info->staincolor[0] = (unsigned int)-1;
+                       info->staincolor[1] = (unsigned int)-1;
                        info->staintex[0] = -1;
                        info->staintex[1] = -1;
                }
@@ -376,7 +376,7 @@ void CL_Particles_ParseEffectInfo(const char *textstart, const char *textend)
                else if (!strcmp(argv[0], "stretchfactor")) {readfloat(info->stretchfactor);}
                else if (!strcmp(argv[0], "staincolor")) {readints(info->staincolor, 2);}
                else if (!strcmp(argv[0], "staintex")) {readints(info->staintex, 2);}
-               else if (!strcmp(argv[0], "stainless")) {info->staintex[0] = -2; info->staincolor[0] = -1; info->staincolor[1] = -1;}
+               else if (!strcmp(argv[0], "stainless")) {info->staintex[0] = -2; info->staincolor[0] = (unsigned int)-1; info->staincolor[1] = (unsigned int)-1;}
                else
                        Con_Printf("effectinfo.txt:%i: skipping unknown command %s\n", linenumber, argv[0]);
 #undef checkparms
index c7acf47..ca090b2 100644 (file)
@@ -249,7 +249,7 @@ unsigned char *PNG_LoadImage_BGRA (const unsigned char *raw, int filesize)
        // NOTE: this relies on jmp_buf being the first thing in the png structure
        // created by libpng! (this is correct for libpng 1.2.x)
 #ifdef __cplusplus
-#ifdef MACOSX
+#if defined(MACOSX) || defined(WIN32)
        if (setjmp((int *)png))
 #else
        if (setjmp((__jmp_buf_tag *)png))
diff --git a/lhnet.c b/lhnet.c
index 1e90318..492074b 100644 (file)
--- a/lhnet.c
+++ b/lhnet.c
@@ -6,7 +6,7 @@
 #define _WIN32_WINNT 0x0501
 #include <winsock2.h>
 #include <ws2tcpip.h>
-#include <wspiapi.h>
+//#include <wspiapi.h>
 #endif
 
 #ifndef STANDALONETEST
@@ -878,7 +878,7 @@ int LHNET_Read(lhnetsocket_t *lhnetsocket, void *content, int maxcontentlength,
                SOCKLEN_T inetaddresslength;
                address->addresstype = LHNETADDRESSTYPE_NONE;
                inetaddresslength = sizeof(address->addr.in);
-               value = recvfrom(lhnetsocket->inetsocket, content, maxcontentlength, 0, &address->addr.sock, &inetaddresslength);
+               value = recvfrom(lhnetsocket->inetsocket, (char *)content, maxcontentlength, 0, &address->addr.sock, &inetaddresslength);
                if (value > 0)
                {
                        address->addresstype = LHNETADDRESSTYPE_INET4;
@@ -904,7 +904,7 @@ int LHNET_Read(lhnetsocket_t *lhnetsocket, void *content, int maxcontentlength,
                SOCKLEN_T inetaddresslength;
                address->addresstype = LHNETADDRESSTYPE_NONE;
                inetaddresslength = sizeof(address->addr.in6);
-               value = recvfrom(lhnetsocket->inetsocket, content, maxcontentlength, 0, &address->addr.sock, &inetaddresslength);
+               value = recvfrom(lhnetsocket->inetsocket, (char *)content, maxcontentlength, 0, &address->addr.sock, &inetaddresslength);
                if (value > 0)
                {
                        address->addresstype = LHNETADDRESSTYPE_INET6;
@@ -957,7 +957,7 @@ int LHNET_Write(lhnetsocket_t *lhnetsocket, const void *content, int contentleng
        }
        else if (lhnetsocket->address.addresstype == LHNETADDRESSTYPE_INET4)
        {
-               value = sendto(lhnetsocket->inetsocket, content, contentlength, 0, (struct sockaddr *)&address->addr.in, sizeof(struct sockaddr_in));
+               value = sendto(lhnetsocket->inetsocket, (char *)content, contentlength, 0, (struct sockaddr *)&address->addr.in, sizeof(struct sockaddr_in));
                if (value == -1)
                {
                        if (SOCKETERRNO == EWOULDBLOCK)
@@ -967,7 +967,7 @@ int LHNET_Write(lhnetsocket_t *lhnetsocket, const void *content, int contentleng
        }
        else if (lhnetsocket->address.addresstype == LHNETADDRESSTYPE_INET6)
        {
-               value = sendto(lhnetsocket->inetsocket, content, contentlength, 0, (struct sockaddr *)&address->addr.in6, sizeof(struct sockaddr_in6));
+               value = sendto(lhnetsocket->inetsocket, (char *)content, contentlength, 0, (struct sockaddr *)&address->addr.in6, sizeof(struct sockaddr_in6));
                if (value == -1)
                {
                        if (SOCKETERRNO == EWOULDBLOCK)
diff --git a/menu.c b/menu.c
index d74c17d..96fc75e 100644 (file)
--- a/menu.c
+++ b/menu.c
@@ -5377,7 +5377,7 @@ void MR_Init(void)
                        }
                        if(video_resolutions[i].conwidth > video_resolutions[i].width || video_resolutions[i].conheight > video_resolutions[i].height)
                        {
-                               double f1, f2;
+                               int f1, f2;
                                f1 = video_resolutions[i].conwidth > video_resolutions[i].width;
                                f2 = video_resolutions[i].conheight > video_resolutions[i].height;
                                if(f1 > f2)
index b65104b..3705359 100644 (file)
@@ -318,7 +318,7 @@ dp_model_t *Mod_LoadModel(dp_model_t *mod, qboolean crash, qboolean checkdisk)
                        Con_Printf("loading model %s\n", mod->name);
 
                mod->used = true;
-               mod->crc = -1;
+               mod->crc = (unsigned int)-1;
                mod->loaded = false;
 
                VectorClear(mod->normalmins);
index 6ca7812..4a90853 100644 (file)
--- a/sys_sdl.c
+++ b/sys_sdl.c
@@ -177,11 +177,11 @@ char *Sys_GetClipboardData (void)
 
                if ((hClipboardData = GetClipboardData (CF_TEXT)) != 0)
                {
-                       if ((cliptext = GlobalLock (hClipboardData)) != 0)
+                       if ((cliptext = (char *)GlobalLock (hClipboardData)) != 0)
                        {
                                size_t allocsize;
                                allocsize = GlobalSize (hClipboardData) + 1;
-                               data = Z_Malloc (allocsize);
+                               data = (char *)Z_Malloc (allocsize);
                                strlcpy (data, cliptext, allocsize);
                                GlobalUnlock (hClipboardData);
                        }