Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 46404 - typedef long streamoff; //long???? 32 bits? Handle files >=2GB? Impossible!
Summary: typedef long streamoff; //long???? 32 bits? Handle files >=2GB? Impossible!
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] GCC Porting (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: Please assign to toolchain
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-03-31 14:29 UTC by Halassy Zoltán
Modified: 2005-07-15 07:51 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Halassy Zoltán 2004-03-31 14:29:30 UTC
I'm using g++ 3.3.2-r5.

There is a file:
/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.2/include/g++-v3/i686-pc-linux-gnu/bits/c++io.h

Line 42:
  typedef long          streamoff;

Many C++ classes using the "streamoff" type (like fstream). With "long", a developer cannot handle files >=2GB (long is a signed 32 bit integer on all platforms) using eg. ifstream.

Please correct me, when i was wrong, or please correct that (g++-2.95 uses __off64_t).


Reproducible: Always
Steps to Reproduce:
Demonstrate:
1. Try to open a >=2GB file. (with ifstream)
2. seek to the end. (seekg member)
3. the seek function produces errno 75 (EOVERFLOW)

replacing "long" -> "__off64_t" solves the problem (for me).


Expected Results:  
The fstream class definietly must handle hudge files.


Portage 2.0.50-r1 (default-x86-1.4, gcc-3.3.2, glibc-2.3.2-r9, 2.4.23-win4lin)
=================================================================
System uname: 2.4.23-win4lin i686 AMD Duron(TM)Processor
Gentoo Base System version 1.4.3.13
Autoconf: sys-devel/autoconf-2.58-r1
Automake: sys-devel/automake-1.7.7
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CFLAGS="-O3 -march=athlon -funroll-loops -pipe"
CHOST="i686-pc-linux-gnu"
COMPILER="gcc3"
CONFIG_PROTECT="/etc /opt/glftpd/etc /usr/X11R6/lib/X11/xkb
/usr/kde/2/share/config /usr/kde/3.1/share/config /usr/kde/3.2/share/config
/usr/kde/3/share/config /usr/lib/mozilla/defaults/pref /usr/share/config
/usr/share/texmf/tex/generic/config/ /usr/share/texmf/tex/platex/config/
/var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-O3 -march=athlon -funroll-loops -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs ccache sandbox"
GENTOO_MIRRORS="http://gentoo.oregonstate.edu
http://distro.ibiblio.org/pub/Linux/distributions/gentoo"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY=""
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="3dfx 3dnow X Xaw3d aalib acpi alsa apache2 apm arts avi berkdb bidi cdr
crypt cscope cups dga directfb doc dvb dvd encode esd ethereal fam fbcon flac
flash foomaticdb gd gdbm ggi gif gnome gphoto2 gpm gstreamer gtk gtk2 gtkhtml
imagemagick imap imlib jack java jikes jpeg kde ladcca lcms libg++ libwww mad
mcal mikmod mmx motif mozilla mpeg mpi mysql nas ncurses nls nocardbus nocd
oggvorbis opengl oss pam pdflib perl plotutils png python qt quicktime readline
samba sasl sdl slang speex spell ssl svga tcltk tcpd tetex tiff truetype unicode
usb video_cards_rage128 videos wmf x86 xml xml2 xmms xosd xv zlib"
Comment 1 Caleb Tennis (RETIRED) gentoo-dev 2005-07-15 07:51:52 UTC
Assuming fixed in latest versions, please reopen if not.