|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH] FIX: Cast the time_t values to avoid warnings
I added 4 casts from time_t to unsigned long int
in the libxl_sprintf functions, so there is no
warning at compilation time (and no failing with
-Werror).
The casting format has been discuted, and since
there is no system having a 8 byte time_t format
yet; unsigned long int should be sufficient.
Also, it matches the libxl_sprintf syntax (%lu).
Signed-off-by: 7heo <7heo@xxxxxxx>
---
tools/libxl/libxl_create.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
index cb9c822..48a60ae 100644
--- a/tools/libxl/libxl_create.c
+++ b/tools/libxl/libxl_create.c
@@ -350,7 +350,7 @@ int libxl__domain_build(libxl__gc *gc,
vments[2] = "image/ostype";
vments[3] = "hvm";
vments[4] = "start_time";
- vments[5] = libxl__sprintf(gc, "%lu.%02d",
start_time.tv_sec,(int)start_time.tv_usec/10000);
+ vments[5] = libxl__sprintf(gc, "%lu.%02d", (unsigned long
int)(start_time.tv_sec),(int)start_time.tv_usec/10000);
localents = libxl__calloc(gc, 7, sizeof(char *));
localents[0] = "platform/acpi";
@@ -373,7 +373,7 @@ int libxl__domain_build(libxl__gc *gc,
vments[i++] = "image/kernel";
vments[i++] = (char *) state->pv_kernel.path;
vments[i++] = "start_time";
- vments[i++] = libxl__sprintf(gc, "%lu.%02d",
start_time.tv_sec,(int)start_time.tv_usec/10000);
+ vments[i++] = libxl__sprintf(gc, "%lu.%02d", (unsigned long
int)(start_time.tv_sec),(int)start_time.tv_usec/10000);
if (state->pv_ramdisk.path) {
vments[i++] = "image/ramdisk";
vments[i++] = (char *) state->pv_ramdisk.path;
@@ -846,7 +846,7 @@ void libxl__xc_domain_restore_done(libxl__egc *egc, void
*dcs_void,
vments[2] = "image/ostype";
vments[3] = "hvm";
vments[4] = "start_time";
- vments[5] = libxl__sprintf(gc, "%lu.%02d",
start_time.tv_sec,(int)start_time.tv_usec/10000);
+ vments[5] = libxl__sprintf(gc, "%lu.%02d", (unsigned long
int)(start_time.tv_sec),(int)start_time.tv_usec/10000);
break;
case LIBXL_DOMAIN_TYPE_PV:
vments = libxl__calloc(gc, 11, sizeof(char *));
@@ -856,7 +856,7 @@ void libxl__xc_domain_restore_done(libxl__egc *egc, void
*dcs_void,
vments[i++] = "image/kernel";
vments[i++] = (char *) state->pv_kernel.path;
vments[i++] = "start_time";
- vments[i++] = libxl__sprintf(gc, "%lu.%02d",
start_time.tv_sec,(int)start_time.tv_usec/10000);
+ vments[i++] = libxl__sprintf(gc, "%lu.%02d", (unsigned long
int)(start_time.tv_sec),(int)start_time.tv_usec/10000);
if (state->pv_ramdisk.path) {
vments[i++] = "image/ramdisk";
vments[i++] = (char *) state->pv_ramdisk.path;
--
1.7.10.4
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |