warning cleanup patch from raorn

This commit is contained in:
Bill Currie 2007-01-06 21:31:03 +00:00 committed by Jeff Teunissen
parent 24ab92e68d
commit 99e05d2188
8 changed files with 30 additions and 18 deletions

View file

@ -368,13 +368,17 @@ SNDDMA_Submit (void)
samples = *plugin_info_snd_output_data.paintedtime
- *plugin_info_snd_output_data.soundtime;
if (sn.samplepos + BYTES <= sn.samples)
write (audio_fd, sn.buffer + BYTES, samples);
else {
write (audio_fd, sn.buffer + BYTES, sn.samples -
sn.samplepos);
write (audio_fd, sn.buffer, BYTES - (sn.samples -
sn.samplepos));
if (sn.samplepos + BYTES <= sn.samples) {
if (write (audio_fd, sn.buffer + BYTES, samples) != samples)
Sys_Printf ("SNDDMA_Submit(): %s\n", strerror (errno));
} else {
if (write (audio_fd, sn.buffer + BYTES, sn.samples -
sn.samplepos) != sn.samples - sn.samplepos)
Sys_Printf ("SNDDMA_Submit(): %s\n", strerror (errno));
if (write (audio_fd, sn.buffer, BYTES - (sn.samples -
sn.samplepos)) !=
BYTES - (sn.samples - sn.samplepos))
Sys_Printf ("SNDDMA_Submit(): %s\n", strerror (errno));
}
*plugin_info_snd_output_data.soundtime += samples;
}

View file

@ -117,9 +117,9 @@ check_file (int fd, int offs, int len, int *zip)
lseek (fd, offs, SEEK_SET);
r = read (fd, id, 2);
if (r == 2 && id[0] == 0x1f && id[1] == 0x8b && len >= 6) {
lseek (fd, offs + len - 4, SEEK_SET);
read (fd, len_bytes, 4);
if (r == 2 && id[0] == 0x1f && id[1] == 0x8b && len >= 6 &&
lseek (fd, offs + len - 4, SEEK_SET) >= 0 &&
read (fd, len_bytes, 4) == 4) {
len = ((len_bytes[3] << 24)
| (len_bytes[2] << 16)
| (len_bytes[1] << 8)

View file

@ -502,9 +502,11 @@ Sys_DebugLog (const char *file, const char *fmt, ...)
va_start (args, fmt);
dvsprintf (data, fmt, args);
va_end (args);
fd = open (file, O_WRONLY | O_CREAT | O_APPEND, 0644);
write (fd, data->str, data->size - 1);
close (fd);
if ((fd = open (file, O_WRONLY | O_CREAT | O_APPEND, 0644)) >= 0) {
if (write (fd, data->str, data->size - 1) != (ssize_t) (data->size - 1))
Sys_Printf ("Error writing %s: %s\n", file, strerror(errno));
close (fd);
}
}
int

View file

@ -203,6 +203,8 @@ static int FillScanRates(struct VideoMode *vmode);
static void Usage(void);
#undef puts
#undef printf
#define Die Sys_Printf
#define puts(s) Sys_Printf("%s\n",(s))
#define printf Sys_Printf

View file

@ -226,7 +226,8 @@ VID_Shutdown (void)
close(fb_fd);
ioctl(tty_fd, KDSETMODE, KD_TEXT);
write(tty_fd, "\033]R", 3); /* reset palette */
if (write(tty_fd, "\033]R", 3) != 3) /* reset palette */
Sys_Printf("could not reset palette: %s\n", strerror(errno));
fbdev_inited = 0;
}

View file

@ -492,7 +492,7 @@ CheckForFlood (flood_enum_t cmdtype)
oldest = 0;
if (firsttime) {
memset (floodstatus, sizeof (flood_t) * DOSFLOODCMDS * DOSFLOODIP, 0);
memset (floodstatus, 0, sizeof (flood_t) * DOSFLOODCMDS * DOSFLOODIP);
firsttime = false;
}

View file

@ -634,12 +634,14 @@ ReadClipHull (int hullnum)
bsp->nummodels);
for (i = 0; i < n; i++) {
fscanf (f, "%d\n", &j);
if (fscanf (f, "%d\n", &j) != 1)
Sys_Error ("Error parsing %s", options.hullfile);
bsp->models[i].headnode[hullnum] = bsp->numclipnodes + j;
}
fscanf (f, "\n%d\n", &n);
if (fscanf (f, "\n%d\n", &n) != 1)
Sys_Error ("Error parsing %s", options.hullfile);
firstclipnode = bsp->numclipnodes;
for (i = 0; i < n; i++) {

View file

@ -145,7 +145,8 @@ SetQdirFromPath (char *path)
if (!(path[0] == '/' || path[0] == '\\' || path[1] == ':'))
{ // path is partial
getcwd (temp, sizeof (temp));
if (getcwd (temp, sizeof (temp)) == NULL)
Sys_Error ("Can't get CWD");
strcat (temp, path);
path = temp;
}