From: havoc Date: Sun, 27 Dec 2009 13:12:57 +0000 (+0000) Subject: fix a bunch of type-punned pointer warnings X-Git-Tag: xonotic-v0.1.0preview~938 X-Git-Url: https://git.xonotic.org/?a=commitdiff_plain;h=a51184c097151de400f20677daa901c0388f6b1e;p=xonotic%2Fdarkplaces.git fix a bunch of type-punned pointer warnings git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@9710 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/console.c b/console.c index 36fe15ce..560f770e 100644 --- a/console.c +++ b/console.c @@ -1899,7 +1899,7 @@ qboolean GetMapList (const char *s, char *completedname, int completednamebuffer lumplen = LittleLong(header->lumps[Q2LUMP_ENTITIES].filelen); } } - else if((p = LittleLong(((int *)buf)[0])) == BSPVERSION || p == 30) + else if((p = BuffLittleLong(buf)) == BSPVERSION || p == 30) { dheader_t *header = (dheader_t *)buf; lumpofs = LittleLong(header->lumps[LUMP_ENTITIES].fileofs); diff --git a/ft2.c b/ft2.c index 0e99c1e4..dbbf056a 100644 --- a/ft2.c +++ b/ft2.c @@ -503,7 +503,7 @@ static qboolean Font_LoadSize(ft2_font_t *font, float size, qboolean no_texture, int map_index; ft2_font_map_t *fmap, temp; - if (IS_NAN(size)) + if (!(size > 0.001f && size < 1000.0f)) size = 0; if (!size) diff --git a/gl_draw.c b/gl_draw.c index 67e17f63..1c5b4ad2 100644 --- a/gl_draw.c +++ b/gl_draw.c @@ -775,9 +775,8 @@ static void LoadFont_f(void) for(i = 0; i < Cmd_Argc()-3; ++i) { sz = atof(Cmd_Argv(i+3)); - if (IS_NAN(sz)) // do not use crap sizes - continue; - f->req_sizes[i] = sz; + if (sz > 0.001f && sz < 1000.0f) // do not use crap sizes + f->req_sizes[i] = sz; } } LoadFont(true, mainfont, f); diff --git a/model_alias.c b/model_alias.c index ef4b9e28..5591775a 100644 --- a/model_alias.c +++ b/model_alias.c @@ -531,6 +531,7 @@ int Mod_Alias_GetExtendedTagInfoForIndex(const dp_model_t *model, unsigned int s return 1; *parentindex = model->data_bones[tagindex].parent; *tagname = model->data_bones[tagindex].name; + memset(blendmatrix, 0, sizeof(blendmatrix)); for (blendindex = 0;blendindex < MAX_FRAMEBLENDS && frameblend[blendindex].lerp > 0;blendindex++) { lerp = frameblend[blendindex].lerp; @@ -548,6 +549,7 @@ int Mod_Alias_GetExtendedTagInfoForIndex(const dp_model_t *model, unsigned int s return 1; *parentindex = -1; *tagname = model->data_tags[tagindex].name; + memset(blendmatrix, 0, sizeof(blendmatrix)); for (blendindex = 0;blendindex < MAX_FRAMEBLENDS && frameblend[blendindex].lerp > 0;blendindex++) { lerp = frameblend[blendindex].lerp; diff --git a/netconn.c b/netconn.c index 595a6714..657c5120 100755 --- a/netconn.c +++ b/netconn.c @@ -624,7 +624,6 @@ qboolean NetConn_CanSend(netconn_t *conn) int NetConn_SendUnreliableMessage(netconn_t *conn, sizebuf_t *data, protocolversion_t protocol, int rate, qboolean quakesignon_suppressreliables) { int totallen = 0; - int temp; // if this packet was supposedly choked, but we find ourselves sending one // anyway, make sure the size counting starts at zero @@ -654,11 +653,9 @@ int NetConn_SendUnreliableMessage(netconn_t *conn, sizebuf_t *data, protocolvers sendreliable = true; } // outgoing unreliable packet number, and outgoing reliable packet number (0 or 1) - temp = (unsigned int)conn->outgoing_unreliable_sequence | ((unsigned int)sendreliable<<31); - *((int *)(sendbuffer + 0)) = LittleLong(temp); + StoreLittleLong(sendbuffer, (unsigned int)conn->outgoing_unreliable_sequence | ((unsigned int)sendreliable<<31)); // last received unreliable packet number, and last received reliable packet number (0 or 1) - temp = (unsigned int)conn->qw.incoming_sequence | ((unsigned int)conn->qw.incoming_reliable_sequence<<31); - *((int *)(sendbuffer + 4)) = LittleLong(temp); + StoreLittleLong(sendbuffer + 4, (unsigned int)conn->qw.incoming_sequence | ((unsigned int)conn->qw.incoming_reliable_sequence<<31)); packetLen = 8; conn->outgoing_unreliable_sequence++; // client sends qport in every packet