]> xenbits.xensource.com Git - libvirt.git/commitdiff
Cast pointer to int using intptr_t
authorMarc-André Lureau <marcandre.lureau@gmail.com>
Wed, 25 Jan 2012 20:13:25 +0000 (21:13 +0100)
committerEric Blake <eblake@redhat.com>
Thu, 26 Jan 2012 01:00:47 +0000 (18:00 -0700)
Fix a few warnings with mingw64 x86_64.

src/util/logging.c
src/util/threads-win32.c

index 8d60280775c4975a651c1364b5ce2dfd55dc46b9..48a056d4b25ec89e2cf8a931a39f211c3673bd0c 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * logging.c: internal logging and debugging
  *
- * Copyright (C) 2008, 2010-2011 Red Hat, Inc.
+ * Copyright (C) 2008, 2010-2012 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
@@ -329,7 +329,7 @@ static void virLogDumpAllFD(const char *msg, int len) {
 
     for (i = 0; i < virLogNbOutputs;i++) {
         if (virLogOutputs[i].f == virLogOutputToFd) {
-            int fd = (long) virLogOutputs[i].data;
+            int fd = (intptr_t) virLogOutputs[i].data;
 
             if (fd >= 0) {
                 ignore_value (safewrite(fd, msg, len));
@@ -791,7 +791,7 @@ static int virLogOutputToFd(const char *category ATTRIBUTE_UNUSED,
                             const char *str,
                             void *data)
 {
-    int fd = (long) data;
+    int fd = (intptr_t) data;
     int ret;
     char *msg;
 
@@ -808,7 +808,7 @@ static int virLogOutputToFd(const char *category ATTRIBUTE_UNUSED,
 }
 
 static void virLogCloseFd(void *data) {
-    int fd = (long) data;
+    int fd = (intptr_t) data;
 
     VIR_FORCE_CLOSE(fd);
 }
@@ -826,7 +826,8 @@ static int virLogAddOutputToFile(int priority, const char *file) {
     fd = open(file, O_CREAT | O_APPEND | O_WRONLY, S_IRUSR | S_IWUSR);
     if (fd < 0)
         return -1;
-    if (virLogDefineOutput(virLogOutputToFd, virLogCloseFd, (void *)(long)fd,
+    if (virLogDefineOutput(virLogOutputToFd, virLogCloseFd,
+                           (void *)(intptr_t)fd,
                            priority, VIR_LOG_TO_FILE, file, 0) < 0) {
         VIR_FORCE_CLOSE(fd);
         return -1;
index 1c3382662b435e1f8cee2ff9a0c1326532fa3b44..157439ceae98912f2da9c7b51848cd139e9c27e4 100644 (file)
@@ -336,7 +336,7 @@ int virThreadSelfID(void)
 /* For debugging use only; see comments in threads-pthread.c.  */
 int virThreadID(virThreadPtr thread)
 {
-    return (int)thread->thread;
+    return (intptr_t)thread->thread;
 }