change the value type for MSG_Write(Byte|Short|Long) from unsigned int to

int to avoid float -> unsigned int conversion problems
This commit is contained in:
Bill Currie 2002-08-19 01:58:01 +00:00
parent 3431b7ce82
commit 451eaba2e1
2 changed files with 12 additions and 12 deletions

View file

@ -30,9 +30,9 @@
#include "QF/sizebuf.h"
void MSG_WriteByte (sizebuf_t *sb, unsigned int c);
void MSG_WriteShort (sizebuf_t *sb, unsigned int c);
void MSG_WriteLong (sizebuf_t *sb, unsigned int c);
void MSG_WriteByte (sizebuf_t *sb, int c);
void MSG_WriteShort (sizebuf_t *sb, int c);
void MSG_WriteLong (sizebuf_t *sb, int c);
void MSG_WriteFloat (sizebuf_t *sb, float f);
void MSG_WriteString (sizebuf_t *sb, const char *s);
void MSG_WriteCoord (sizebuf_t *sb, float coord);

View file

@ -52,7 +52,7 @@ static const char rcsid[] =
// writing functions ==========================================================
void
MSG_WriteByte (sizebuf_t *sb, unsigned int c)
MSG_WriteByte (sizebuf_t *sb, int c)
{
byte *buf;
@ -61,25 +61,25 @@ MSG_WriteByte (sizebuf_t *sb, unsigned int c)
}
void
MSG_WriteShort (sizebuf_t *sb, unsigned int c)
MSG_WriteShort (sizebuf_t *sb, int c)
{
byte *buf;
buf = SZ_GetSpace (sb, 2);
*buf++ = c & 0xff;
*buf = c >> 8;
*buf++ = ((unsigned int) c) & 0xff;
*buf = ((unsigned int) c) >> 8;
}
void
MSG_WriteLong (sizebuf_t *sb, unsigned int c)
MSG_WriteLong (sizebuf_t *sb, int c)
{
byte *buf;
buf = SZ_GetSpace (sb, 4);
*buf++ = c & 0xff;
*buf++ = (c >> 8) & 0xff;
*buf++ = (c >> 16) & 0xff;
*buf = c >> 24;
*buf++ = ((unsigned int) c) & 0xff;
*buf++ = (((unsigned int) c) >> 8) & 0xff;
*buf++ = (((unsigned int) c) >> 16) & 0xff;
*buf = ((unsigned int) c) >> 24;
}
void