Explorar el Código

fix some bugs that cppcheck found

master
Felix von Leitner hace 6 años
padre
commit
9ed80b2d0e
Se han modificado 3 ficheros con 7 adiciones y 7 borrados
  1. +1
    -1
      cdb/cdb.c
  2. +2
    -2
      test/range.c
  3. +4
    -4
      windoze.h

+ 1
- 1
cdb/cdb.c Ver fichero

@@ -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;
}


+ 2
- 2
test/range.c Ver fichero

@@ -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);


+ 4
- 4
windoze.h Ver fichero

@@ -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

Cargando…
Cancelar
Guardar