fix some bugs that cppcheck found

master
leitner 11 years ago
parent 6d18d4ecc3
commit 0f6e586fc9

@ -49,7 +49,7 @@ void cdb_init(struct cdb *c,int64 fd) {
if (fstat(fd,&st) == 0)
if (st.st_size <= 0xffffffff) {
x = mmap(0,st.st_size,PROT_READ,MAP_SHARED,fd,0);
if (x + 1) {
if (x != MAP_FAILED) {
c->size = st.st_size;
c->map = x;
}

@ -108,7 +108,7 @@ void check_rangeptrbuf() {
{
uint16_t y[6];
int i;
for (i=0; i<7; ++i) y[i]="fnord"[i];
for (i=0; i<6; ++i) y[i]="fnord"[i];
assert(range_str2inbuf(y,5*2,y)==0);
assert(range_str2inbuf(y,5*2+1,y)==0);
assert(range_str2inbuf(y,sizeof(y),y)==1);
@ -122,7 +122,7 @@ void check_rangeptrbuf() {
{
uint32_t y[6];
int i;
for (i=0; i<7; ++i) y[i]="fnord"[i];
for (i=0; i<6; ++i) y[i]="fnord"[i];
assert(range_str4inbuf(y,5*4,y)==0);
assert(range_str4inbuf(y,5*4+3,y)==0);
assert(range_str4inbuf(y,sizeof(y),y)==1);

@ -8,13 +8,13 @@ extern "C" {
int winsock2errno(long l);
void __winsock_init(void);
#ifdef __cplusplus
}
#endif
#else
#define winsock2errno(fnord) (fnord)
#define __winsock_init()
#ifdef __cplusplus
}
#endif
#endif

Loading…
Cancel
Save