[libvirt] [PATCH] storage_encryption: silence clang warning

Eric Blake eblake at redhat.com
Fri May 7 23:10:12 UTC 2010


For printf("%*s",foo,bar), clang complains if foo is not int:

warning: field width should have type 'int', but argument has
type 'unsigned int' [-Wformat]

* src/conf/storage_encryption_conf.c
(virStorageEncryptionSecretFormat, virStorageEncryptionFormat):
Use correct type.
---
 src/conf/storage_encryption_conf.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/conf/storage_encryption_conf.c b/src/conf/storage_encryption_conf.c
index 7a64050..8f29492 100644
--- a/src/conf/storage_encryption_conf.c
+++ b/src/conf/storage_encryption_conf.c
@@ -1,7 +1,7 @@
 /*
  * storage_encryption_conf.c: volume encryption information
  *
- * Copyright (C) 2009 Red Hat, Inc.
+ * Copyright (C) 2009-2010 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -216,7 +216,7 @@ virStorageEncryptionParseNode(xmlDocPtr xml, xmlNodePtr root)
 static int
 virStorageEncryptionSecretFormat(virBufferPtr buf,
                                  virStorageEncryptionSecretPtr secret,
-                                 unsigned int indent)
+                                 int indent)
 {
     const char *type;
     char uuidstr[VIR_UUID_STRING_BUFLEN];
@@ -249,14 +249,15 @@ virStorageEncryptionFormat(virBufferPtr buf,
         return -1;
     }
     virBufferVSprintf(buf, "%*s<encryption format='%s'>\n",
-                      indent, "", format);
+                      (int) indent, "", format);

     for (i = 0; i < enc->nsecrets; i++) {
-        if (virStorageEncryptionSecretFormat(buf, enc->secrets[i], indent + 2) < 0)
+        if (virStorageEncryptionSecretFormat(buf, enc->secrets[i],
+                                             indent + 2) < 0)
             return -1;
     }

-    virBufferVSprintf(buf, "%*s</encryption>\n", indent, "");
+    virBufferVSprintf(buf, "%*s</encryption>\n", (int) indent, "");

     return 0;
 }
-- 
1.6.6.1




More information about the libvir-list mailing list