Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:68955 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 56253 invoked from network); 7 Sep 2013 18:20:01 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Sep 2013 18:20:01 -0000 Authentication-Results: pb1.pair.com header.from=jakub.php@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=jakub.php@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.128.172 as permitted sender) X-PHP-List-Original-Sender: jakub.php@gmail.com X-Host-Fingerprint: 209.85.128.172 mail-ve0-f172.google.com Received: from [209.85.128.172] ([209.85.128.172:60637] helo=mail-ve0-f172.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 09/7F-00660-05E6B225 for ; Sat, 07 Sep 2013 14:20:01 -0400 Received: by mail-ve0-f172.google.com with SMTP id oz11so2508853veb.31 for ; Sat, 07 Sep 2013 11:19:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=BC880wtrf6h27+RAYvRUrMryqrEj0VmIkQAgmDCnNo4=; b=eXRgJSZv5NH6sEku90jU4v+pwjjJAzE5F9BS+MuDlQW6eMNcW0COYKibyzSoKCAozm 81mnUKSnZOILOaQukTTJqAE4OxPR/9NC8y1tFpmPY2jdxrqtBW87LrRUqb2twVOOJ5vF uAIvzbZVf/hYD5uvA4xHVskFiiJ9UTZi99oYWv16hhl1FT4uSVK6E8fGg1y6izIFaAaW 3Ae6W2d+TuRIVjAsS9s1SLxvmHdC8WRzX5+dLJL4fAJA+djfhlpZsZZAYe7JGcbH2gD/ Mc8jPIJNGYFdOJjcvKeHLYyRaBuQYMoWQ6vDmkcrczrxnxh4WV1Y+ctM3WaetpsDp0Ni JLFw== MIME-Version: 1.0 X-Received: by 10.220.140.69 with SMTP id h5mr8685974vcu.0.1378577997653; Sat, 07 Sep 2013 11:19:57 -0700 (PDT) Sender: jakub.php@gmail.com Received: by 10.52.76.68 with HTTP; Sat, 7 Sep 2013 11:19:57 -0700 (PDT) In-Reply-To: References: <52244384.7030407@sugarcrm.com> <5224F352.30408@sugarcrm.com> Date: Sat, 7 Sep 2013 19:19:57 +0100 X-Google-Sender-Auth: rVOfSo1-tmGWLDgO7TXmJxGq6_s Message-ID: To: Marco Schuster Cc: Rasmus Schultz , Stas Malyshev , Matthew Leverton , PHP internals Content-Type: multipart/alternative; boundary=047d7b343244d8743504e5cf33c5 Subject: Re: [PHP-DEV] Re: crc32() and ip2long() return values From: bukka@php.net (Jakub Zelenka) --047d7b343244d8743504e5cf33c5 Content-Type: text/plain; charset=ISO-8859-1 Hi, On Sat, Sep 7, 2013 at 6:44 PM, Marco Schuster wrote: > > I ran into 32-bit problems, too, when working with >2GB files (in this > case, raw DVD ISO images) on a 32-bit system (I couldn't find a > reliable(!!) way to read a 4-byte absolute offset and seek to it). > Of course, this warning is mentioned in the manpage, but really, not > having at least a class for unsigned 32-bit ints (e.g. a Uint32 or a > Uint64 for 64-bit platforms) which native functions like seek and > friends coerce into a 32/64-bit uint makes PHP useless for anything > that involves access to files or memory offsets (a problem from > another project) > 2GB. > > The seek offset is always signed. In C you have either int fseek (FILE *stream, long int offset, int whence) which is signed. Or you can use int fseeko (FILE *stream, off_t offset, int whence) or off_t lseek(int fd, off_t offset, int whence) for descriptors. When you look to glibc, you will find these definitions #define __OFF_T_TYPE __SYSCALL_SLONG_TYPE __STD_TYPE __OFF_T_TYPE __off_t; typedef __off_t off_t; __SYSCALL_SLONG_TYPE is signed type as well (S Long :)). If you need to seek over 31bit size on 32bit system, then you can seek twice. Just need to set the whence to SEEK_CUR for the second seek... Jakub --047d7b343244d8743504e5cf33c5--