From: Adam Dickmeiss Date: Mon, 15 May 2000 15:32:50 +0000 (+0000) Subject: Added support for 64 bit input file support. X-Git-Tag: ZEBRA.1.1~69 X-Git-Url: http://sru.miketaylor.org.uk/cgi-bin?a=commitdiff_plain;h=a0da17360613c183107d78449bda31fcb97911fa;p=idzebra-moved-to-github.git Added support for 64 bit input file support. --- diff --git a/configure b/configure index 4bbbfb7..31815c9 100755 --- a/configure +++ b/configure @@ -1681,13 +1681,60 @@ fi done fi +echo $ac_n "checking for large files""... $ac_c" 1>&6 +echo "configure:1686: checking for large files" >&5 +if test "$cross_compiling" = yes; then + bits=32 +else + cat > conftest.$ac_ext < +#include +#include +int main(int argc, char **argv) +{ + off_t o; + char tmp_str[32]; + if (sizeof(off_t) == 8) { + o = 2000000000; + sprintf (tmp_str, "%Ld", o+o+o); + if (!strcmp (tmp_str, "6000000000")) + exit (0); + } + exit (1); +} + +EOF +if { (eval echo configure:1711: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + bits=64 +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + bits=32 +fi +rm -fr conftest* +fi + +if test "$bits" = "64"; then + cat >> confdefs.h <<\EOF +#define _FILE_OFFSET_BITS 64 +EOF + + echo "$ac_t""yes" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:1686: checking for ANSI C header files" >&5 +echo "configure:1733: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1695,7 +1742,7 @@ else #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1699: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1746: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1712,7 +1759,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -1730,7 +1777,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -1751,7 +1798,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -1762,7 +1809,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:1766: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1813: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else diff --git a/configure.in b/configure.in index 8405b9e..62cd8ec 100644 --- a/configure.in +++ b/configure.in @@ -1,5 +1,5 @@ dnl Zebra, Index Data Aps, 1994-2000 -dnl $Id: configure.in,v 1.20 2000-05-02 11:26:13 adam Exp $ +dnl $Id: configure.in,v 1.21 2000-05-15 15:32:50 adam Exp $ dnl AC_INIT(include/zebraver.h) AC_MSG_CHECKING(for package) @@ -143,6 +143,31 @@ AC_CHECK_LIB(bz2,bzCompressInit) if test "$ac_cv_lib_bz2_bzCompressInit" = "yes"; then AC_CHECK_HEADERS(bzlib.h) fi +dnl ------- 64 bit files +AC_MSG_CHECKING(for large files) +AC_TRY_RUN([#define _FILE_OFFSET_BITS 64 +#include +#include +#include +int main(int argc, char **argv) +{ + off_t o; + char tmp_str[32]; + if (sizeof(off_t) == 8) { + o = 2000000000; + sprintf (tmp_str, "%Ld", o+o+o); + if (!strcmp (tmp_str, "6000000000")) + exit (0); + } + exit (1); +} +],bits=64,bits=32,bits=32) +if test "$bits" = "64"; then + AC_DEFINE(_FILE_OFFSET_BITS,64) + AC_MSG_RESULT(yes) +else + AC_MSG_RESULT(no) +fi dnl dnl ------ ANSI C Header files AC_STDC_HEADERS diff --git a/recctrl/marcread.c b/recctrl/marcread.c index c76e22d..a6924a8 100644 --- a/recctrl/marcread.c +++ b/recctrl/marcread.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: marcread.c,v $ - * Revision 1.10 1999-11-30 13:48:04 adam + * Revision 1.11 2000-05-15 15:32:51 adam + * Added support for 64 bit input file support. + * + * Revision 1.10 1999/11/30 13:48:04 adam * Improved installation. Updated for inclusion of YAZ header files. * * Revision 1.9 1999/06/25 13:47:25 adam @@ -166,7 +169,8 @@ data1_node *grs_read_marc (struct grs_read_info *p) if (read_bytes == record_length - 4) { off_t cur_offset = (*p->tellf)(p->fh); - assert (cur_offset > 26); + if (cur_offset <= 27) + return NULL; if (p->endf) (*p->endf)(p->fh, cur_offset - 1); }