Subject: | patch for compiler warning on 64 bit platforms |
fix for compiler warning about cast from pointer to integer of different
size
Subject: | 0001-Print-pointers-with-p-instead-of-d.patch |
From 64f1ab88a3beb3f47d7b776d04aef918b0066e04 Mon Sep 17 00:00:00 2001
From: willi <willi@amdlinux>
Date: Sat, 25 Feb 2012 15:34:58 +0100
Subject: [PATCH] Print pointers with %p instead of %d
Fixes compiler warning on 64-bit platforms.
---
Sane.xs | 20 ++++++++++----------
1 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/Sane.xs b/Sane.xs
index 2dfcbdf..c23ae2c 100644
--- a/Sane.xs
+++ b/Sane.xs
@@ -13,7 +13,7 @@ sane_DESTROY (handle)
SANE_Handle handle
CODE:
SV* sv = get_sv("Sane::DEBUG", FALSE);
- if (SvTRUE(sv)) printf("Closing SANE_Handle %d\n", (int) handle);
+ if (SvTRUE(sv)) printf("Closing SANE_Handle %p\n", (void *) handle);
sane_close(handle);
void
@@ -28,7 +28,7 @@ sane_get_option_descriptor (h, n)
int i;
PPCODE:
SV* sv = get_sv("Sane::DEBUG", FALSE);
- if (SvTRUE(sv)) printf("Getting option description %d from SANE_Handle %d\n", n, (int) h);
+ if (SvTRUE(sv)) printf("Getting option description %d from SANE_Handle %p\n", n, (void *) h);
opt = sane_get_option_descriptor (h, n);
if (!opt) croak("Error getting sane_get_option_descriptor");
if (opt->name != NULL) {
@@ -93,7 +93,7 @@ sane_get_option (h, n)
const SANE_Option_Descriptor * opt;
PPCODE:
SV* sv = get_sv("Sane::DEBUG", FALSE);
- if (SvTRUE(sv)) printf("Getting option %d from SANE_Handle %d\n", n, (int) h);
+ if (SvTRUE(sv)) printf("Getting option %d from SANE_Handle %p\n", n, (void *) h);
opt = sane_get_option_descriptor (h, n);
if (!opt) croak("Error getting sane_get_option_descriptor");
if ( opt->size == 0 ) {
@@ -147,7 +147,7 @@ sane_set_auto (h, n)
SANE_Int info;
PPCODE:
SV* sv = get_sv("Sane::DEBUG", FALSE);
- if (SvTRUE(sv)) printf("Setting option %d to automatic on SANE_Handle %d\n", n, (int) h);
+ if (SvTRUE(sv)) printf("Setting option %d to automatic on SANE_Handle %p\n", n, (void *) h);
status = sane_control_option (h, n, SANE_ACTION_SET_AUTO, 0, &info);
sv = get_sv("Sane::_status", FALSE);
sv_setiv(sv, status);
@@ -171,7 +171,7 @@ sane_set_option (h, n, value)
char * string;
PPCODE:
SV* sv = get_sv("Sane::DEBUG", FALSE);
- if (SvTRUE(sv)) printf("Setting option %d on SANE_Handle %d\n", n, (int) h);
+ if (SvTRUE(sv)) printf("Setting option %d on SANE_Handle %p\n", n, (void *) h);
opt = sane_get_option_descriptor (h, n);
if (!opt) croak("Error getting sane_get_option_descriptor");
switch (opt->type) {
@@ -236,7 +236,7 @@ sane_start (handle)
SANE_Status status;
CODE:
SV* sv = get_sv("Sane::DEBUG", FALSE);
- if (SvTRUE(sv)) printf("Running sane_start for SANE_Handle %d\n", (int) handle);
+ if (SvTRUE(sv)) printf("Running sane_start for SANE_Handle %p\n", (void *) handle);
status = sane_start(handle);
sv = get_sv("Sane::_status", FALSE);
sv_setiv(sv, status);
@@ -250,7 +250,7 @@ sane_get_parameters (handle)
HV* hv = (HV*) sv_2mortal((SV*) newHV());
PPCODE:
SV* sv = get_sv("Sane::DEBUG", FALSE);
- if (SvTRUE(sv)) printf("Getting parameters for SANE_Handle %d\n", (int) handle);
+ if (SvTRUE(sv)) printf("Getting parameters for SANE_Handle %p\n", (void *) handle);
status = sane_get_parameters (handle, ¶ms);
sv = get_sv("Sane::_status", FALSE);
sv_setiv(sv, status);
@@ -302,7 +302,7 @@ sane_set_io_mode (handle, non_blocking)
SANE_Status status;
CODE:
SV* sv = get_sv("Sane::DEBUG", FALSE);
- if (SvTRUE(sv)) printf("Setting IO mode to %d on SANE_Handle %d\n", non_blocking, (int) handle);
+ if (SvTRUE(sv)) printf("Setting IO mode to %d on SANE_Handle %p\n", non_blocking, (void *) handle);
status = sane_set_io_mode (handle, non_blocking);
sv = get_sv("Sane::_status", FALSE);
sv_setiv(sv, status);
@@ -315,7 +315,7 @@ sane_get_select_fd (handle)
SANE_Int fd;
PPCODE:
SV* sv = get_sv("Sane::DEBUG", FALSE);
- if (SvTRUE(sv)) printf("Getting file handle of SANE_Handle %d\n", (int) handle);
+ if (SvTRUE(sv)) printf("Getting file handle of SANE_Handle %p\n", (void *) handle);
status = sane_get_select_fd (handle, &fd);
sv = get_sv("Sane::_status", FALSE);
sv_setiv(sv, status);
@@ -556,7 +556,7 @@ sane__open(class, name)
PPCODE:
status = sane_open(name, &h);
SV* sv = get_sv("Sane::DEBUG", FALSE);
- if (SvTRUE(sv)) printf("sane_open returned SANE_Handle %d\n", (int) h);
+ if (SvTRUE(sv)) printf("sane_open returned SANE_Handle %p\n", (void *) h);
sv = get_sv("Sane::_status", FALSE);
sv_setiv(sv, status);
if (status) {
--
1.7.9