note 100129 deleted from function.fseek by googleguy
| From: | googleguy@php.net | Date: | Tue, 22 Oct 2013 12:15:59 +0000 |
| Subject: | note 100129 deleted from function.fseek by googleguy | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-197116@lists.php.net to get a copy of this message | ||
Note Submitter: sylvain at abstraction dot fr
----
seeking past PHP_INT_MAX.
<?php
function fseek64(&$fh, $offset)
{
fseek($fh, 0, SEEK_SET);
if ($offset <= PHP_INT_MAX)
{
return fseek($fh, $offset, SEEK_SET);
}
$t_offset = PHP_INT_MAX;
$offset = $offset - $t_offset;
while (fseek($fh, $t_offset, SEEK_CUR) === 0)
{
if ($offset > PHP_INT_MAX)
{
$t_offset = PHP_INT_MAX;
$offset = $offset - $t_offset;
}
else if ($offset > 0)
{
$t_offset = $offset;
$offset = 0;
}
else
{
return 0;
}
}
return -1;
}
?>