Mail Archives: djgpp-workers/2016/04/25/12:48:22
This is a multi-part message in MIME format.
--------------050408070503050905030607
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
On 04/25/2016 07:05 PM, Andris Pavenis (andris DOT pavenis AT iki DOT fi) [via djgpp-workers AT delorie DOT com] wrote:
>
> Sent to me privately. I suggested author to send it to list. I have not seen however any activity
> since that.
> So I'm forwarding message to list.
>
> I'm also committing the proposed patch for ttyscrn.c.
>
Problem with fseeko64() confirmed. Test example in attachment.
fseek() works OK in this example, fseeko64() do not
Andris
--------------050408070503050905030607
Content-Type: text/x-c++src;
name="fseeko64_test.cpp"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="fseeko64_test.cpp"
#include <cstdio>
#include <cstring>
#include <iostream>
int test1(bool useFseeko64)
{
int numErr = 0;
char b1[8192], b2[4096];
FILE* input = std::fopen("/dev/env/DJDIR/bin/gcc.exe", "rb");
//FILE* input = std::fopen("d:/djgpp/bin/gcc.exe", "rb");
std::fread(b1, 8192, 1, input);
for (int off = 0; off < 4095; off += 17) {
if (useFseeko64) {
fseeko64(input, off, SEEK_SET);
} else {
fseek(input, off, SEEK_SET);
}
std::fread(b2, 4096, 1, input);
if (std::memcmp(b1 + off, b2, 4096) != 0) {
numErr++;
}
}
return numErr;
}
int main(void)
{
std::cout << "fseek: " << test1(false) << " errors found" << std::endl;
std::cout << "fseeko64: " << test1(true) << " errors found" << std::endl;
return 0;
}
--------------050408070503050905030607--
- Raw text -