message: add buffer version specific function for bzip2
diff: @@ -114,24 +114,8 @@ size_t CompressBZIP2::DecompressV1(const char *bufferIn, const size_t sizeIn,
  // If a newer buffer format is implemented, create another function, e.g.
  // DecompressV2 and keep this function for decompressing lagacy data.
  - return 0;
  -}
  -size_t CompressBZIP2::Decompress(const char *bufferIn, const size_t sizeIn,
  - char *dataOut, const DataType /*type*/,
  - const Dims & /*blockStart*/,
  - const Dims & /*blockCount*/,
  - const Params & /*parameters*/,
  - Params & /*info*/)
  -{
  - size_t bufferInOffset = 1; // skip operator type
  - const uint8_t bufferVersion =
  - GetParameter<uint8_t>(bufferIn, bufferInOffset);
  - bufferInOffset += 2; // skip two reserved bytes
  -
  - size_t ret;
  + size_t bufferInOffset = 4; // skip the first four bytes
  - if (bufferVersion == 1)
  - {
  size_t sizeOut = GetParameter<size_t>(bufferIn, bufferInOffset);
  size_t batches = GetParameter<size_t>(bufferIn, bufferInOffset);
  @@ -163,8 +147,8 @@ size_t CompressBZIP2::Decompress(const char *bufferIn, const size_t sizeIn,
  unsigned int sourceLen =
  GetParameter<unsigned int>(bufferIn, bufferInOffset);
  - int status = BZ2_bzBuffToBuffDecompress(
  - dest, &destLen, source, sourceLen, small, verbosity);
  + int status = BZ2_bzBuffToBuffDecompress(dest, &destLen, source,
  + sourceLen, small, verbosity);
  CheckStatus(status, "in call to ADIOS2 BZIP2 Decompress batch " +
  std::to_string(b) + "\n");
  @@ -176,7 +160,33 @@ size_t CompressBZIP2::Decompress(const char *bufferIn, const size_t sizeIn,
  {
  throw("corrupted bzip2 buffer");
  }
  - ret = sizeOut;
  +
  + return sizeOut;
  +}
  +size_t CompressBZIP2::Decompress(const char *bufferIn, const size_t sizeIn,
  + char *dataOut, const DataType /*type*/,
  + const Dims & /*blockStart*/,
  + const Dims & /*blockCount*/,
  + const Params & /*parameters*/,
  + Params & /*info*/)
  +{
  + size_t bufferInOffset = 1; // skip operator type
  + const uint8_t bufferVersion =
  + GetParameter<uint8_t>(bufferIn, bufferInOffset);
  + bufferInOffset += 2; // skip two reserved bytes
  +
  + size_t ret;
  +
  + if (bufferVersion == 1)
  + {
  + // pass in the whole buffer as there is absolute positions saved in the
  + // buffer to determine the offsets and lengths for batches
  + DecompressV1(bufferIn, sizeIn, dataOut);
  + }
  + else if (bufferVersion == 2)
  + {
  + // TODO: if a Version 2 blosc buffer is being implemented, put it here
  + // and keep the DecompressV1 routine for backward compatibility
  }
  else
  {
  