Browse Source

fix warning

master
Alex 'AdUser' Z 10 years ago
parent
commit
c4df78cbc4
  1. 8
      src/imdb_1to2.c

8
src/imdb_1to2.c

@ -66,20 +66,20 @@ int main(int argc, char **argv) {
lseek(in, rec_first * IMDB_REC_LEN, SEEK_SET); lseek(in, rec_first * IMDB_REC_LEN, SEEK_SET);
lseek(out, rec_first * IMDB_REC_LEN, SEEK_SET); lseek(out, rec_first * IMDB_REC_LEN, SEEK_SET);
bytes = read(in, in_buf, IMDB_REC_LEN * records); bytes = read(in, in_buf, IMDB_REC_LEN * records);
if (bytes != IMDB_REC_LEN * records) { if (bytes != (ssize_t) records * IMDB_REC_LEN) {
printf("Read size mismatch, expected %lu, got: %i\n", printf("Read size mismatch, expected %lu, got: %i\n",
IMDB_REC_LEN * records, bytes); IMDB_REC_LEN * records, bytes);
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
memset(out_buf, 0x0, IMDB_REC_LEN * records); memset(out_buf, 0x0, records * IMDB_REC_LEN);
for (int i = 0; i < records; i++) { for (unsigned int i = 0; i < records; i++) {
src = &in_buf[i * IMDB_REC_LEN]; src = &in_buf[i * IMDB_REC_LEN];
dst = &out_buf[i * IMDB_REC_LEN]; dst = &out_buf[i * IMDB_REC_LEN];
memcpy(dst + 0, src + 0, sizeof(char) * 1); // usage flag memcpy(dst + 0, src + 0, sizeof(char) * 1); // usage flag
memcpy(dst + 16, src + 2, sizeof(char) * 32); // image bitmap memcpy(dst + 16, src + 2, sizeof(char) * 32); // image bitmap
} }
bytes = write(out, out_buf, IMDB_REC_LEN * records); bytes = write(out, out_buf, IMDB_REC_LEN * records);
if (bytes != IMDB_REC_LEN * records) { if (bytes != (ssize_t) records * IMDB_REC_LEN) {
printf("Write size mismatch, expected %lu, got: %i\n", printf("Write size mismatch, expected %lu, got: %i\n",
IMDB_REC_LEN * records, bytes); IMDB_REC_LEN * records, bytes);
exit(EXIT_FAILURE); exit(EXIT_FAILURE);

Loading…
Cancel
Save