Commit 3560cc65 authored by Jérémie Dudouet's avatar Jérémie Dudouet
Browse files

correct an error in reading the file in baniry mode

parent 449ff090
...@@ -68,7 +68,7 @@ bool TstampFilter::Initialize(std::string tstampFile, int tolerance, int id) ...@@ -68,7 +68,7 @@ bool TstampFilter::Initialize(std::string tstampFile, int tolerance, int id)
fMyId = id; fMyId = id;
if(fMyId < 0) { // only tstamp present in file if(fMyId < 0) { // only tstamp present in file
int nn; int nn;
if(fBinaryFormat) nn = fread (&fTimestamp,1,sizeof (fTimestamp),fTstampFILE); if(fBinaryFormat) nn = fread (&fTimestamp,1,sizeof (fTimestamp),fTstampFILE)/sizeof(fTimestamp);
else nn = fscanf(fTstampFILE, "%lld", &fTimestamp); else nn = fscanf(fTstampFILE, "%lld", &fTimestamp);
if(nn != 1) { if(nn != 1) {
cout << "Error reading " << fTstampFile << endl; cout << "Error reading " << fTstampFile << endl;
...@@ -84,8 +84,8 @@ bool TstampFilter::Initialize(std::string tstampFile, int tolerance, int id) ...@@ -84,8 +84,8 @@ bool TstampFilter::Initialize(std::string tstampFile, int tolerance, int id)
while(true) { while(true) {
int nn; int nn;
if(fBinaryFormat) { if(fBinaryFormat) {
nn = fread (&fTimestamp,1,sizeof (fTimestamp),fTstampFILE); nn = fread (&fTimestamp,1,sizeof (fTimestamp),fTstampFILE)/sizeof(fTimestamp);
nn += fread (&id,1,sizeof (id),fTstampFILE); nn += fread (&id,1,sizeof (id),fTstampFILE)/sizeof(id);
} }
else nn = fscanf(fTstampFILE, "%d %lld", & id, &fTimestamp); else nn = fscanf(fTstampFILE, "%d %lld", & id, &fTimestamp);
if(nn != 2) { if(nn != 2) {
...@@ -114,7 +114,7 @@ void TstampFilter::NextTstamp() ...@@ -114,7 +114,7 @@ void TstampFilter::NextTstamp()
// timestamp only // timestamp only
while(true) { while(true) {
int nn; int nn;
if(fBinaryFormat) nn = fread (&fTimestamp,1,sizeof (fTimestamp),fTstampFILE); if(fBinaryFormat) nn = fread (&fTimestamp,1,sizeof (fTimestamp),fTstampFILE)/sizeof(fTimestamp);
else nn = fscanf(fTstampFILE, "%lld", &fTimestamp); else nn = fscanf(fTstampFILE, "%lld", &fTimestamp);
if(nn != 1) { if(nn != 1) {
cout << "Error reading " << fTstampFile << endl; cout << "Error reading " << fTstampFile << endl;
...@@ -134,8 +134,8 @@ void TstampFilter::NextTstamp() ...@@ -134,8 +134,8 @@ void TstampFilter::NextTstamp()
while(true) { while(true) {
int nn; int nn;
if(fBinaryFormat) { if(fBinaryFormat) {
nn = fread (&fTimestamp,1,sizeof (fTimestamp),fTstampFILE); nn = fread (&fTimestamp,1,sizeof (fTimestamp),fTstampFILE)/sizeof(fTimestamp);
nn += fread (&id,1,sizeof (id),fTstampFILE); nn += fread (&id,1,sizeof (id),fTstampFILE)/sizeof(id);
} }
else nn = fscanf(fTstampFILE, "%d %lld", & id, &fTimestamp); else nn = fscanf(fTstampFILE, "%d %lld", & id, &fTimestamp);
if(nn != 2) { if(nn != 2) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment