[sane-devel] canon-sane.c:2113: error: `SSIZE_MAX' undeclared

Gerhard Jaeger gerhard@gjaeger.de
Thu, 30 Jun 2005 09:36:49 +0200


Hi Franz

On Thursday 30 June 2005 00:02, Franz Bakan wrote:
> Hi,
> 
> When compiling SANE with gcc 3.3.5 on OS/2 I get this error.
> 
>  canon-sane.c:2113: error: `SSIZE_MAX' undeclared
> 
> I want to know if this is a problem in canon-sane.c or a problem with
> the include files coming with gcc3.3.5
> 
> From the OS/2 gcc3.3.5 guy I got this hint:
> 
> SSIZE_MAX is defined by sys/limits.h which is included by limits.h.
>    It's visiblitiy definitly depends on _ANSI_SOURCE and _C99_SOURCE
>    not being defined anywhere, and it may also be invisible with some
>    other _*_SOURCE macros and perhaps -ansi....
> 
> But I don't know if ANSI_SOURCE or C99_SOURCE should be defined or not.
> 
> Does someone know what's going on?

I got the same problem here, when cross-compiling with a gcc-3.4.3 for PPC.
The definiton could be found in
bits/posix1_lim.h, which is included from limits.h, when __USE_POSIX is set.

As this SSIZE_MAX only occurs in canon-sane.c, I suggest to use the following
patch to fix that:

--- sane-backends-1.0.15/backend/canon-sane.c.orig      2005-02-17 12:23:49.000000000 +0100
+++ sane-backends-1.0.15/backend/canon-sane.c   2005-02-17 12:23:55.000000000 +0100
@@ -1,3 +1,7 @@
+#ifndef SSIZE_MAX
+# define SSIZE_MAX      LONG_MAX
+#endif
+
 SANE_Status
 sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize)
 {


If there are no objections, I'd like to add the patch to CVS.

Ciao,
Gerhard