From cf734be3099118aef43d45ae51f53875d77d91c3 Mon Sep 17 00:00:00 2001
From: "Mirar (Pontus Hagland)" <pike@sort.mirar.org>
Date: Mon, 27 Jan 2003 12:59:14 +0100
Subject: [PATCH] (large INT_TYPE saga) struct image->xsize,ysize changed to
 INT_TYPE, a bunch of sprintf formats fixed

Rev: src/modules/Image/encodings/pnm.c:1.30
Rev: src/modules/Image/image.c:1.201
Rev: src/modules/Image/image.h:1.51
Rev: src/modules/Image/layers.c:1.84
---
 src/modules/Image/encodings/pnm.c | 16 ++++++++--------
 src/modules/Image/image.c         |  7 ++++---
 src/modules/Image/image.h         |  4 ++--
 src/modules/Image/layers.c        | 14 ++++++++------
 4 files changed, 22 insertions(+), 19 deletions(-)

diff --git a/src/modules/Image/encodings/pnm.c b/src/modules/Image/encodings/pnm.c
index fcdeb2fc74..9cbdebf3c4 100644
--- a/src/modules/Image/encodings/pnm.c
+++ b/src/modules/Image/encodings/pnm.c
@@ -2,7 +2,7 @@
 || This file is part of Pike. For copyright information see COPYRIGHT.
 || Pike is distributed under GPL, LGPL and MPL. See the file COPYING
 || for more information.
-|| $Id: pnm.c,v 1.29 2002/10/21 17:06:15 marcus Exp $
+|| $Id: pnm.c,v 1.30 2003/01/27 11:59:14 mirar Exp $
 */
 
 /*
@@ -52,7 +52,7 @@
 #include <ctype.h>
 
 #include "stralloc.h"
-RCSID("$Id: pnm.c,v 1.29 2002/10/21 17:06:15 marcus Exp $");
+RCSID("$Id: pnm.c,v 1.30 2003/01/27 11:59:14 mirar Exp $");
 #include "pike_macros.h"
 #include "object.h"
 #include "constants.h"
@@ -292,7 +292,7 @@ void img_pnm_encode_P1(INT32 args) /* ascii PBM */
    if (!img->img)
       Pike_error("Image.PNM.encode_P1(): Given image is empty\n");
 
-   sprintf(buf,"P1\n%d %d\n",img->xsize,img->ysize);
+   sprintf(buf,"P1\n%"PRINTPIKEINT"d %"PRINTPIKEINT"d\n",img->xsize,img->ysize);
    a=make_shared_string(buf);
 
    y=img->ysize;
@@ -338,7 +338,7 @@ void img_pnm_encode_P2(INT32 args) /* ascii PGM */
    add_ref(o);
    pop_n_elems(args);
 
-   sprintf(buf,"P2\n%d %d\n255\n",img->xsize,img->ysize);
+   sprintf(buf,"P2\n%"PRINTPIKEINT"d %"PRINTPIKEINT"d\n255\n",img->xsize,img->ysize);
    push_string(make_shared_string(buf));
    n=1;
 
@@ -379,7 +379,7 @@ void img_pnm_encode_P3(INT32 args) /* ascii PPM */
    add_ref(o);
    pop_n_elems(args);
 
-   sprintf(buf,"P3\n%d %d\n255\n",img->xsize,img->ysize);
+   sprintf(buf,"P3\n%"PRINTPIKEINT"d %"PRINTPIKEINT"d\n255\n",img->xsize,img->ysize);
    push_string(make_shared_string(buf));
    n=1;
 
@@ -417,7 +417,7 @@ void img_pnm_encode_P4(INT32 args) /* binary PBM */
    if (!img->img)
       Pike_error("Image.PNM.encode_P4(): Given image is empty\n");
 
-   sprintf(buf,"P4\n%d %d\n",img->xsize,img->ysize);
+   sprintf(buf,"P4\n%"PRINTPIKEINT"d %"PRINTPIKEINT"d\n",img->xsize,img->ysize);
    a=make_shared_string(buf);
 
    y=img->ysize;
@@ -463,7 +463,7 @@ void img_pnm_encode_P5(INT32 args) /* binary PGM */
    if (!img->img)
       Pike_error("Image.PNM.encode_P5(): Given image is empty\n");
 
-   sprintf(buf,"P5\n%d %d\n255\n",img->xsize,img->ysize);
+   sprintf(buf,"P5\n%"PRINTPIKEINT"d %"PRINTPIKEINT"d\n255\n",img->xsize,img->ysize);
    a=make_shared_string(buf);
 
    n=img->xsize*img->ysize;
@@ -495,7 +495,7 @@ void img_pnm_encode_P6(INT32 args)
    if (!img->img)
       Pike_error("Image.PNM.encode_P6(): Given image is empty\n");
 
-   sprintf(buf,"P6\n%d %d\n255\n",img->xsize,img->ysize);
+   sprintf(buf,"P6\n%"PRINTPIKEINT"d %"PRINTPIKEINT"d\n255\n",img->xsize,img->ysize);
    a=make_shared_string(buf);
    if (sizeof(rgb_group)==3)
       b=make_shared_binary_string((char*)img->img,
diff --git a/src/modules/Image/image.c b/src/modules/Image/image.c
index bd0aa67303..4bec316b96 100644
--- a/src/modules/Image/image.c
+++ b/src/modules/Image/image.c
@@ -2,7 +2,7 @@
 || This file is part of Pike. For copyright information see COPYRIGHT.
 || Pike is distributed under GPL, LGPL and MPL. See the file COPYING
 || for more information.
-|| $Id: image.c,v 1.200 2002/10/21 17:06:14 marcus Exp $
+|| $Id: image.c,v 1.201 2003/01/27 11:59:14 mirar Exp $
 */
 
 /*
@@ -101,7 +101,7 @@
 
 #include "stralloc.h"
 #include "global.h"
-RCSID("$Id: image.c,v 1.200 2002/10/21 17:06:14 marcus Exp $");
+RCSID("$Id: image.c,v 1.201 2003/01/27 11:59:14 mirar Exp $");
 #include "pike_macros.h"
 #include "object.h"
 #include "constants.h"
@@ -608,7 +608,8 @@ void img_read_get_channel(int arg,char *name,INT32 args,
 		  "uninitialized image object\n",arg+1,name);
 	 if (img->xsize!=THIS->xsize || img->ysize!=THIS->ysize) 
 	    Pike_error("create_method: argument %d (%s channel): "
-		  "size is wrong, %dx%d; expected %dx%d\n",
+		  "size is wrong, %"PRINTPIKEINT"dx%"PRINTPIKEINT"d;"
+		       " expected %"PRINTPIKEINT"dx%"PRINTPIKEINT"d\n",
 		  arg+1,name,img->xsize,img->ysize,
 		  THIS->xsize,THIS->ysize);
 	 *s=(COLORTYPE*)img->img;
diff --git a/src/modules/Image/image.h b/src/modules/Image/image.h
index 12bc307eb8..09b09f81a0 100644
--- a/src/modules/Image/image.h
+++ b/src/modules/Image/image.h
@@ -2,7 +2,7 @@
 || This file is part of Pike. For copyright information see COPYRIGHT.
 || Pike is distributed under GPL, LGPL and MPL. See the file COPYING
 || for more information.
-|| $Id: image.h,v 1.50 2002/10/11 01:39:42 nilsson Exp $
+|| $Id: image.h,v 1.51 2003/01/27 11:59:14 mirar Exp $
 */
 
 #ifdef PIKE_IMAGE_IMAGE_H
@@ -103,7 +103,7 @@ typedef struct
 struct image
 {
    rgb_group *img;
-   INT32 xsize,ysize;
+   INT_TYPE xsize,ysize;
    rgb_group rgb;
    unsigned char alpha;
 };
diff --git a/src/modules/Image/layers.c b/src/modules/Image/layers.c
index ac56862db4..e99e135c24 100644
--- a/src/modules/Image/layers.c
+++ b/src/modules/Image/layers.c
@@ -2,7 +2,7 @@
 || This file is part of Pike. For copyright information see COPYRIGHT.
 || Pike is distributed under GPL, LGPL and MPL. See the file COPYING
 || for more information.
-|| $Id: layers.c,v 1.83 2002/12/09 22:43:27 mirar Exp $
+|| $Id: layers.c,v 1.84 2003/01/27 11:59:14 mirar Exp $
 */
 
 /*
@@ -201,7 +201,7 @@
 
 #include <math.h> /* floor */
 
-RCSID("$Id: layers.c,v 1.83 2002/12/09 22:43:27 mirar Exp $");
+RCSID("$Id: layers.c,v 1.84 2003/01/27 11:59:14 mirar Exp $");
 
 #include "image_machine.h"
 
@@ -3113,8 +3113,9 @@ static void image_layer_crop(INT32 args)
 	 Pike_error("No image returned from image->copy\n");
       if (img->xsize!=xz || img->ysize!=yz)
 	 Pike_error("Image returned from image->copy had "
-	       "unexpected size (%d,%d, expected %d,%d)\n",
-		img->xsize,img->ysize,(INT32)xz,(INT32)yz);
+	       "unexpected size (%"PRINTPIKEINT"d,%"PRINTPIKEINT"d,"
+		    " expected %"PRINTPIKEINT"d,%"PRINTPIKEINT"d)\n",
+		img->xsize,img->ysize,xz,yz);
 
       free_object(l->image);
       l->image=Pike_sp[-1].u.object;
@@ -3141,8 +3142,9 @@ static void image_layer_crop(INT32 args)
 	 Pike_error("No image returned from alpha->copy\n");
       if (img->xsize!=xz || img->ysize!=yz)
 	 Pike_error("Image returned from alpha->copy had "
-	       "unexpected size (%d,%d, expected %d,%d)\n",
-	       img->xsize,img->ysize,(INT32)xz,(INT32)yz);
+	       "unexpected size (%"PRINTPIKEINT"d,%"PRINTPIKEINT"d, "
+		    "expected %"PRINTPIKEINT"d,%"PRINTPIKEINT"d)\n",
+	       img->xsize,img->ysize,xz,yz);
       free_object(l->alpha);
       l->alpha=Pike_sp[-1].u.object;
       Pike_sp--;
-- 
GitLab