Skip to content
Snippets Groups Projects
Commit c2c3a756 authored by Fredrik Noring's avatar Fredrik Noring
Browse files

Fixed seek.

Rev: lib/modules/Yabu.pmod/module.pmod:1.18
parent 7250920b
No related branches found
No related tags found
No related merge requests found
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* associated with a unique key. * associated with a unique key.
*/ */
constant cvs_id = "$Id: module.pmod,v 1.17 1999/10/19 22:45:33 noring Exp $"; constant cvs_id = "$Id: module.pmod,v 1.18 2000/01/29 12:37:31 noring Exp $";
#define ERR(msg) throw(({ "(Yabu) "+msg+"\n", backtrace() })) #define ERR(msg) throw(({ "(Yabu) "+msg+"\n", backtrace() }))
#define IO_ERR(msg) throw(({ sprintf("(Yabu) %s, %s (%d)\n",msg,strerror(errno()),errno()),backtrace() })) #define IO_ERR(msg) throw(({ sprintf("(Yabu) %s, %s (%d)\n",msg,strerror(errno()),errno()),backtrace() }))
...@@ -131,32 +131,9 @@ static private class FileIO { ...@@ -131,32 +131,9 @@ static private class FileIO {
static private int mask = 0; static private int mask = 0;
static private array(int) fractionalise(int i)
{
if(!mask)
{
int size = 0;
for(mask = 1; mask; size++)
mask <<= 1;
mask = ~(0xff << (size-8));
}
return ({ (i>>8) & mask, i & 0xff });
}
static private void seek(int offset) static private void seek(int offset)
{ {
if(offset < 0) if(offset < 0 || file::seek(offset) == -1)
{
int fraction;
[offset, fraction] = fractionalise(offset);
if(file::seek(offset, 0x100) == -1 ||
(fraction && sizeof(file::read(fraction)) != fraction))
ERR("seek failed");
}
else
if(file::seek(offset) == -1)
ERR("seek failed"); ERR("seek failed");
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment