Ticket #413 (closed defect: fixed)

Opened 4 months ago

Last modified 2 months ago

off_t not always in stdio.h

Reported by: dryeo Assigned to: conrad
Priority: normal Milestone:
Component: liboggz Version:
Severity: normal Keywords:
Cc:

Description

Compiling liboggz 0.9.8 on OS/2 gives this error,

f gcc.exe -DHAVE_CONFIG_H -I. -I. -I../../.. -I../../.. -I../../../include -I../../../include -I../../../src/tools -I../../../src/tests -I/usr/local/include      -g -O2 -g -std=gnu99 -Wno-unused -MT header.o -MD -MP -MF ".deps/header.Tpo" -c -o header.o header.c; \
then mv -f ".deps/header.Tpo" ".deps/header.Po"; else rm -f ".deps/header.Tpo"; exit 1; fi
header.c:34: error: parse error before "len"
header.c: In function `header_content_length':
header.c:36: error: `len' undeclared (first use in this function)
header.c:36: error: (Each undeclared identifier is reported only once
header.c:36: error: for each function it appears in.)
make[4]: *** [header.o] Error 1

Fix is to include sys/types.h for off_t, this fix is also needed on some versions of OS X.

Simplest fix is this

--- configure.ac.org    Tue Aug  5 20:10:18 2008
+++ configure.ac        Tue Aug  5 20:11:30 2008
@@ -28,7 +28,7 @@

 # Checks for header files.
 AC_HEADER_STDC
-AC_CHECK_HEADERS([fcntl.h inttypes.h stdlib.h string.h unistd.h])
+AC_CHECK_HEADERS([fcntl.h inttypes.h stdlib.h string.h sys/types.h unistd.h])

 # Checks for typedefs, structures, and compiler characteristics.
 AC_TYPE_OFF_T

--- header.c.bak        Tue Aug  5 20:00:06 2008
+++ header.c    Tue Aug  5 20:21:46 2008
@@ -1,5 +1,8 @@
 #include "config.h"

+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h> /* For off_t not found in stdio.h */
+#endif
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>

Change History

2008-09-16 02:57:00 changed by conrad

  • status changed from new to closed.
  • resolution set to fixed.

Applied in changeset:3719