Skip to contentSkip to conversation

block/raw-win32: Fix compiler warnings (wrong format specifiers)

PATCH Applied Stefan Weil 4 participants 4 messages Dec 17, 2012 – Dec 18, 2012 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 block/raw-win32: Fix compiler warnings (wrong format specifiers)

Commit fbcad04d6bfdff937536eb23088a01a280a1a3af added fprintf statements with wrong format specifiers.

GetLastError() returns a DWORD which is unsigned long, so %lu must be used.

---

Do we want those fprintf statements here at all?

- Stefan

 block/raw-win32.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
block/raw-win32.c +2 -2
index ce207a3..a2e155e 100644
@@ -314,11 +314,11 @@ static int raw_truncate(BlockDriverState *bs, int64_t offset)
      */
     dwPtrLow = SetFilePointer(s->hfile, low, &high, FILE_BEGIN);
     if (dwPtrLow == INVALID_SET_FILE_POINTER && GetLastError() != NO_ERROR) {
-        fprintf(stderr, "SetFilePointer error: %d\n", GetLastError());
+        fprintf(stderr, "SetFilePointer error: %lu\n", GetLastError());
         return -EIO;
     }
     if (SetEndOfFile(s->hfile) == 0) {
-        fprintf(stderr, "SetEndOfFile error: %d\n", GetLastError());
+        fprintf(stderr, "SetEndOfFile error: %lu\n", GetLastError());
         return -EIO;
     }
     return 0;
Signature · 1 line
1.7.10.4
#1 lore raw

Am 17.12.2012 20:40, schrieb Stefan Weil:

Quoted 9 lines

Commit fbcad04d6bfdff937536eb23088a01a280a1a3af added fprintf statements with wrong format specifiers.

GetLastError() returns a DWORD which is unsigned long, so %lu must be used.

---

Do we want those fprintf statements here at all?

I believe it was argued that otherwise you cannot distinguish where the EIO came from.

Andreas

Quoted 22 lines
 block/raw-win32.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
block/raw-win32.c +2 -2
index ce207a3..a2e155e 100644
@@ -314,11 +314,11 @@ static int raw_truncate(BlockDriverState *bs, int64_t offset)
      */
     dwPtrLow = SetFilePointer(s->hfile, low, &high, FILE_BEGIN);
     if (dwPtrLow == INVALID_SET_FILE_POINTER && GetLastError() != NO_ERROR) {
-        fprintf(stderr, "SetFilePointer error: %d\n", GetLastError());
+        fprintf(stderr, "SetFilePointer error: %lu\n", GetLastError());
         return -EIO;
     }
     if (SetEndOfFile(s->hfile) == 0) {
-        fprintf(stderr, "SetEndOfFile error: %d\n", GetLastError());
+        fprintf(stderr, "SetEndOfFile error: %lu\n", GetLastError());
         return -EIO;
     }
     return 0;
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#2 lore raw
In reply to Stefan Weil
Quoted 5 lines · Stefan Weil

Commit fbcad04d6bfdff937536eb23088a01a280a1a3af added fprintf statements with wrong format specifiers.

GetLastError() returns a DWORD which is unsigned long, so %lu must be used.

That's right, I didn't see that.

Thanks Stefan,

Signature · 1 line
Fabien Chouteau
#3 lore raw
In reply to Stefan Weil
Quoted 6 lines · Stefan Weil

Commit fbcad04d6bfdff937536eb23088a01a280a1a3af added fprintf statements with wrong format specifiers.

GetLastError() returns a DWORD which is unsigned long, so %lu must be used.

Quoted 8 lines

---

Do we want those fprintf statements here at all?

- Stefan

 block/raw-win32.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Thanks, applied to the block patches tree:
https://github.com/stefanha/qemu/commits/block

Stefan