From: Marc-André Lureau Date: Wed, 25 Jan 2012 20:13:25 +0000 (+0100) Subject: Cast pointer to int using intptr_t X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=d553554b75c9ab835e53e9ce836b8cca94c713ee;p=libvirt.git Cast pointer to int using intptr_t Fix a few warnings with mingw64 x86_64. --- diff --git a/src/util/logging.c b/src/util/logging.c index 8d60280775..48a056d4b2 100644 --- a/src/util/logging.c +++ b/src/util/logging.c @@ -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; diff --git a/src/util/threads-win32.c b/src/util/threads-win32.c index 1c3382662b..157439ceae 100644 --- a/src/util/threads-win32.c +++ b/src/util/threads-win32.c @@ -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; }