Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix few -Wformat warnings #582

Merged
merged 11 commits into from
Apr 3, 2017
4 changes: 2 additions & 2 deletions src/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -1753,7 +1753,7 @@ int stlink_write_flash(stlink_t *sl, stm32_addr_t addr, uint8_t* base, uint32_t
return -1;
}
fprintf(stdout,"\rFlash page at addr: 0x%08lx erased",
(unsigned long)addr + off);
(unsigned long)(addr + off));
fflush(stdout);
page_count++;
}
Expand Down Expand Up @@ -1934,7 +1934,7 @@ int stlink_write_flash(stlink_t *sl, stm32_addr_t addr, uint8_t* base, uint32_t
if (sl->verbose >= 1) {
/* show progress. writing procedure is slow
and previous errors are misleading */
fprintf(stdout, "\r%3u/%lu pages written", write_block_count++, (unsigned long)len/sl->flash_pgsz);
fprintf(stdout, "\r%3u/%lu pages written", write_block_count++, (unsigned long)(len/sl->flash_pgsz));
fflush(stdout);
}
}
Expand Down
12 changes: 12 additions & 0 deletions src/mingw/mingw.c
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,18 @@ char *win32_strsep (char **stringp, const char *delim)
/* NOTREACHED */
}

void usleep(DWORD waitTime)
{
LARGE_INTEGER perf_cnt, start, now;

QueryPerformanceFrequency(&perf_cnt);
QueryPerformanceCounter(&start);

do {
QueryPerformanceCounter((LARGE_INTEGER*) &now);
} while ((now.QuadPart - start.QuadPart) / (float)perf_cnt.QuadPart * 1000 * 1000 < waitTime);
}

#endif


1 change: 1 addition & 0 deletions src/mingw/mingw.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,6 @@ ssize_t win32_read_socket(SOCKET fd, void *buf, int n);
ssize_t win32_write_socket(SOCKET fd, void *buf, int n);

static inline void sleep(unsigned ms) { Sleep(ms); }
void usleep(DWORD waitTime);

#endif
2 changes: 1 addition & 1 deletion src/tools/flash.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ int main(int ac, char** av)

if ( o.flash_size != 0u && o.flash_size != sl->flash_size ) {
sl->flash_size = o.flash_size;
printf("Forcing flash size: --flash=0x%08zX\n",sl->flash_size);
printf("Forcing flash size: --flash=0x%08X\n",(unsigned int)sl->flash_size);
}

sl->verbose = o.log_level;
Expand Down