Skip to content

Commit

Permalink
Fixing shadowing of global index function.
Browse files Browse the repository at this point in the history
Fixes the following warnings;
```
cc -Wall -O2  -fPIC -Wall -Wshadow -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -I/usr/include/iverilog -c  -o ipc.o ipc.c
ipc.c: In function ‘ipc_receive’:
ipc.c:98:17: warning: declaration of ‘index’ shadows a global declaration [-Wshadow]
ipc.c:113:17: warning: declaration of ‘index’ shadows a global declaration [-Wshadow]
```

Fixes #14
mithro authored and sbourdeauducq committed Apr 20, 2015
1 parent f57ee29 commit b8bbaae
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions vpi/ipc.c
Original file line number Diff line number Diff line change
@@ -95,29 +95,29 @@ int ipc_receive(struct ipc_softc *sc)
char *name;
int nchunks;
unsigned char *chunks;
unsigned int index;
unsigned int chunk_index;

name = (char *)&buffer[i];
i += strlen(name) + 1;
assert((i+4) < l);
index = buffer[i] | buffer[i+1] << 8 | buffer[i+2] << 16 | buffer[i+3] << 24;
chunk_index = buffer[i] | buffer[i+1] << 8 | buffer[i+2] << 16 | buffer[i+3] << 24;
i += 4;
nchunks = buffer[i++];
assert(i + nchunks == l);
chunks = (unsigned char *)&buffer[i];

return sc->h_write(name, index, nchunks, chunks, sc->user);
return sc->h_write(name, chunk_index, nchunks, chunks, sc->user);
}
case MESSAGE_READ: {
char *name;
unsigned int index;
unsigned int name_index;

name = (char *)&buffer[i];
i += strlen(name) + 1;
assert((i+4) == l);
index = buffer[i] | buffer[i+1] << 8 | buffer[i+2] << 16 | buffer[i+3] << 24;
name_index = buffer[i] | buffer[i+1] << 8 | buffer[i+2] << 16 | buffer[i+3] << 24;

return sc->h_read(name, index, sc->user);
return sc->h_read(name, name_index, sc->user);
}
default:
return 0;

0 comments on commit b8bbaae

Please sign in to comment.