commit
476a0cef4a
|
|
@ -23,7 +23,11 @@ CC=$(CROSS_COMPILE)gcc # gcc or g++
|
||||||
CFLAGS+=-ggdb3 -Os
|
CFLAGS+=-ggdb3 -Os
|
||||||
LDFLAGS+=-Wl,--gc-sections
|
LDFLAGS+=-Wl,--gc-sections
|
||||||
CFLAGS+=-ggdb3 -Wall -DNORMALUNIX -DLINUX -DSNDSERV # -DUSEASM
|
CFLAGS+=-ggdb3 -Wall -DNORMALUNIX -DLINUX -DSNDSERV # -DUSEASM
|
||||||
LIBS+=-lm -lc -lSDL
|
LIBS+=-lm -lc
|
||||||
|
|
||||||
|
ifneq ($(NOSDL),1)
|
||||||
|
LIBS+= -lSDL
|
||||||
|
endif
|
||||||
|
|
||||||
# subdirectory for objects
|
# subdirectory for objects
|
||||||
OBJDIR=build
|
OBJDIR=build
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <errno.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
|
@ -92,7 +93,8 @@ size_t W_StdC_Read(wad_file_t *wad, unsigned int offset,
|
||||||
void *buffer, size_t buffer_len)
|
void *buffer, size_t buffer_len)
|
||||||
{
|
{
|
||||||
stdc_wad_file_t *stdc_wad;
|
stdc_wad_file_t *stdc_wad;
|
||||||
size_t result;
|
size_t result = 0;
|
||||||
|
int rc;
|
||||||
|
|
||||||
stdc_wad = (stdc_wad_file_t *) wad;
|
stdc_wad = (stdc_wad_file_t *) wad;
|
||||||
|
|
||||||
|
|
@ -102,7 +104,21 @@ size_t W_StdC_Read(wad_file_t *wad, unsigned int offset,
|
||||||
|
|
||||||
// Read into the buffer.
|
// Read into the buffer.
|
||||||
|
|
||||||
result = read(stdc_wad->fd, buffer, buffer_len);
|
do {
|
||||||
|
|
||||||
|
rc = read(stdc_wad->fd, (char *)buffer + result, buffer_len - result);
|
||||||
|
|
||||||
|
if (rc <= 0) {
|
||||||
|
|
||||||
|
if (rc < 0 && errno == EINTR)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
result += rc;
|
||||||
|
|
||||||
|
} while (result < buffer_len);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue