Ejemplo n.º 1
0
void PosOverrunTest()
{
    String tmpfile = GetTempFileName("pos");
    FileOut fo;
    if(!fo.Open(tmpfile)) {
        Cout() << "PosOverrunTest: error creating file "  << tmpfile << "\n";
        return;
    }
    for(int i = 0; i < 0x10000; i++)
        fo.PutIW(i);
    int64 size = fo.GetSize();
    fo.Close();
    if(fo.IsError() || size != 0x20000) {
        Cout() << "PosOverrunTest generator error, file " << tmpfile << "\n";
        return;
    }
    FileIn fi;
    fi.SetBufferSize(4096);
    if(!fi.Open(tmpfile)) {
        Cout() << "PosOverrunTest: error reopening temporary file " << tmpfile << "\n";
        return;
    }
    for(int i = 0; i < 4096; i++)
        fi.Get();
    char buffer[32];
    fi.GetAll(buffer, 32);
    bool ok = true;
    for(int i = 0; i < 16; i++) {
        int strmval = PeekIW(buffer + 2 * i);
        int expect = 2048 + i;
        if(strmval != expect) {
            Cout() << "PosOverrunTest: " << FormatIntHex(expect, 4) << " expected, " << FormatIntHex(strmval, 4) << " found\n";
            ok = false;
        }
    }
    if(ok)
        Cout() << "PosOverrunTest: finished without errors\n";
}
Ejemplo n.º 2
0
static String sZet(FileIn& in, int offset, int len)
{
	in.Seek(offset);
	return ZDecompress(in.Get(len));	
}