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

Max size increased from 2 to 4 gibibyte.

Rev: lib/modules/Yabu.pmod/module.pmod:1.16
parent 39ac736b
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.15 1999/08/30 10:01:28 noring Exp $"; constant cvs_id = "$Id: module.pmod,v 1.16 1999/10/19 22:43:15 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() }))
...@@ -129,8 +129,33 @@ static private class FileIO { ...@@ -129,8 +129,33 @@ static private class FileIO {
static private inherit Stdio.File:file; static private inherit Stdio.File:file;
static private string filename, filemode; static private string filename, filemode;
static private int mask = 0;
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)
{
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) if(file::seek(offset) == -1)
ERR("seek failed"); ERR("seek failed");
} }
...@@ -353,6 +378,8 @@ class Chunk { ...@@ -353,6 +378,8 @@ class Chunk {
return f[0]; return f[0];
} }
int x = eof; int x = eof;
if(eof < 0 && 0 <= eof+type)
ERR("Database too large!");
eof += type; eof += type;
return x; return x;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment