[babl] Use pointer integer types for comparisons
- From: Martin Nordholts <martinn src gnome org>
- To: svn-commits-list gnome org
- Subject: [babl] Use pointer integer types for comparisons
- Date: Sun, 19 Jul 2009 11:26:07 +0000 (UTC)
commit 5bca0ac9fec91233f15298cf2bfa9eebb5502f7b
Author: Danny Robson <danny blubinc net>
Date: Sun Jul 19 19:24:54 2009 +1000
Use pointer integer types for comparisons
Convert all occurences of pointer arithmetic using integral types to use
the standard ptrdiff_t and intptr_t types. Fixes some build warnings.
babl/babl-fish.c | 3 ++-
babl/babl-memory.c | 3 ++-
extensions/sse-fixups.c | 5 +++--
3 files changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/babl/babl-fish.c b/babl/babl-fish.c
index 0ab048c..622ca25 100644
--- a/babl/babl-fish.c
+++ b/babl/babl-fish.c
@@ -18,6 +18,7 @@
#include "config.h"
#include "babl-internal.h"
+#include <stddef.h>
#include <string.h>
#include <stdarg.h>
@@ -137,7 +138,7 @@ babl_fish_get_id (const Babl *source,
/* value of 'id' will be used as argument for hash function,
* substraction serves as simple combination of
* source/destination values. */
- int id = (int) source - (int) destination;
+ ptrdiff_t id = source - destination;
/* instances with id 0 won't be inserted into database */
if (id == 0)
id = 1;
diff --git a/babl/babl-memory.c b/babl/babl-memory.c
index ea6e65d..3a8f34f 100644
--- a/babl/babl-memory.c
+++ b/babl/babl-memory.c
@@ -17,6 +17,7 @@
*/
#include "config.h"
+#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@@ -106,7 +107,7 @@ babl_malloc (size_t size)
if (!ret)
babl_fatal ("args=(%i): failed", size);
- offset = BABL_ALIGN - ((unsigned int) ret + BABL_ALLOC) % BABL_ALIGN;
+ offset = BABL_ALIGN - ((uintptr_t) ret + BABL_ALLOC) % BABL_ALIGN;
ret = ret + BABL_ALLOC + offset;
*((void **) ret - 1) = ret - BABL_ALLOC - offset;
diff --git a/extensions/sse-fixups.c b/extensions/sse-fixups.c
index 1866556..96c2585 100644
--- a/extensions/sse-fixups.c
+++ b/extensions/sse-fixups.c
@@ -23,6 +23,7 @@
#if defined(__GNUC__) && (__GNUC__ >= 4) && defined(USE_SSE) && defined(USE_MMX)
+#include <stdint.h>
#include <stdlib.h>
#include "babl.h"
@@ -53,7 +54,7 @@ conv_rgbaF_linear_rgb8_linear (unsigned char *src,
{
long n = samples;
- if ((int) src & 0xF)
+ if ((intptr_t) src & 0xF)
{
// nonaligned buffers, we have to use fallback x87 code
float *fsrc = (float *) src;
@@ -110,7 +111,7 @@ conv_rgbaF_linear_rgba8_linear (unsigned char *src,
long samples)
{
long n = samples;
- if ((int) src & 0xF)
+ if ((intptr_t) src & 0xF)
{
// nonaligned buffers, we have to use fallback x87 code
float *fsrc = (float *) src;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]