Browse Source

fixed format warning for printf()

cast size_t to unsigned to avoid issues caused by
64 bit systems mixed with 32 bit once.
cast pointer to unsigned long to ensure 64bit will
be printed on linux x64
pull/27/head
Vitus Birkmeir 3 years ago
parent
commit
260d8354d5
  1. 4
      ftpd.c
  2. 8
      test-in-docker/src/main.c

4
ftpd.c

@ -1392,10 +1392,10 @@ void ftpd_init(void)
vfs_load_plugin(vfs_default_fs);
pcb = tcp_new();
LWIP_DEBUGF(FTPD_DEBUG, ("ftpd_init: pcb: %x\n", pcb));
LWIP_DEBUGF(FTPD_DEBUG, ("ftpd_init: pcb: %lx\n", (unsigned long) pcb));
int r = tcp_bind(pcb, IP_ADDR_ANY, 21);
LWIP_DEBUGF(FTPD_DEBUG, ("ftpd_init: tcp_bind: %d\n", r));
pcb = tcp_listen(pcb);
LWIP_DEBUGF(FTPD_DEBUG, ("ftpd_init: listen-pcb: %x\n", pcb));
LWIP_DEBUGF(FTPD_DEBUG, ("ftpd_init: listen-pcb: %lx\n", (unsigned long) pcb));
tcp_accept(pcb, ftpd_msgaccept);
}

8
test-in-docker/src/main.c

@ -64,10 +64,10 @@ DRESULT disk_write(BYTE pdrv, const BYTE* buff, LBA_t sector, UINT count) {
if (pdrv != 0) return RES_NOTRDY;
size_t r = lseek(data, 512*sector, SEEK_SET);
printf("disk_write: lseek returns %d\n", r);
printf("disk_write: lseek returns %u\n", (unsigned) r);
r = write(data, buff, 512 * count);
printf("disk_write(%d): write returns %d\n", count, r);
printf("disk_write(%u): write returns %u\n", count, (unsigned) r);
return RES_OK;
}
@ -76,10 +76,10 @@ DRESULT disk_read(BYTE pdrv, BYTE* buff, LBA_t sector, UINT count) {
if (pdrv != 0) return RES_NOTRDY;
size_t r = lseek(data, 512*sector, SEEK_SET);
printf("disk_read: lseek returns %d\n", r);
printf("disk_read: lseek returns %u\n", (unsigned) r);
r = read(data, buff, 512 * count);
printf("disk_read(%d): read returns %d\n", count, r);
printf("disk_read(%u): read returns %u\n", count, (unsigned) r);
return RES_OK;
}

Loading…
Cancel
Save