Commit 285607d1 authored by Purves, Murray's avatar Purves, Murray
Browse files

Fixing bit offset in PCF write

parent c39a1b74
Pipeline #16173 passed with stages
in 9 minutes and 5 seconds
......@@ -413,11 +413,14 @@ bool SpectrumPCFStream<data_type>::write_to(const std::string &file) const
radix_line("|");
}
// Skip to 256*83 bytes (start of spectral data)
stream.write(make_length(" ", (256 * 83) - stream.bytesWritten()).c_str(),
(256 * 83) - stream.bytesWritten());
// Skip to 256*82 bytes (start of spectral data)
radix_line("Skipping " << (256 * 82) - stream.bytesWritten()
<< " bytes to start of spectra data (256*83 = "
<< 256 * 82 << " bytes)");
stream.write(make_length(" ", (256 * 82) - stream.bytesWritten()).c_str(),
(256 * 82) - stream.bytesWritten());
// Add bytes written directly to eafstream count
stream.setBytesWritten(256 * 83);
stream.setBytesWritten(256 * 82);
}
else if (mData->deviationPairPresence().compare(
"DeviationPairsInFileCompressed") == 0)
......@@ -459,11 +462,14 @@ bool SpectrumPCFStream<data_type>::write_to(const std::string &file) const
radix_line("|");
}
// Skip to 256*83 bytes (start of spectral data)
stream.write(make_length(" ", (256 * 83) - stream.bytesWritten()).c_str(),
(256 * 83) - stream.bytesWritten());
// Skip to 256*82 bytes (start of spectral data)
radix_line("Skipping " << (256 * 82) - stream.bytesWritten()
<< " bytes to start of spectra data (256*83 = "
<< 256 * 82 << " bytes)");
stream.write(make_length(" ", (256 * 82) - stream.bytesWritten()).c_str(),
(256 * 82) - stream.bytesWritten());
// Add bytes written directly to eafstream count
stream.setBytesWritten(256 * 83);
stream.setBytesWritten(256 * 82);
}
else
{
......
......@@ -39,7 +39,7 @@ TEST(RadixIO, SpectrumToPCF)
ASSERT_TRUE(testStream2.read_from(testWritePCFFile));
// Test the contents of the two spectra
EXPECT_EQ(30, testSpectrum2->spectrumDataCount());
EXPECT_EQ(1, testSpectrum2->spectrumDataCount());
EXPECT_EQ(testSpectrum1->spectrumDataCount(),
testSpectrum2->spectrumDataCount());
}
......
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