Skip to content

Commit

Permalink
Put macros into ASDF namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
eschnett committed May 30, 2018
1 parent 92793d1 commit b79a5e8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Expand Up @@ -6,7 +6,7 @@ cmake_policy(SET CMP0048 NEW)
set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)
set(CMAKE_DISABLE_SOURCE_CHANGES ON)

project(asdf-cxx VERSION 2.0.1 LANGUAGES CXX)
project(asdf-cxx VERSION 2.0.2 LANGUAGES CXX)
set(PROJECT_DESCRIPTION
"asdf-cxx (Advanced Scientific Data Format), C++ implementation")
set(PROJECT_URL "https://github.com/eschnett/asdf-cxx")
Expand Down
12 changes: 6 additions & 6 deletions asdf_config.hpp.in
Expand Up @@ -27,25 +27,25 @@ void checkVersion(const char *header_version);
// bzip2 support

#if @HAVE_BZIP2@
#define HAVE_BZIP2 1
#define ASDF_HAVE_BZIP2 1
#else
#undef HAVE_BZIP2
#undef ASDF_HAVE_BZIP2
#endif

// OpenSSL support

#if @HAVE_OPENSSL@
#define HAVE_OPENSSL 1
#define ASDF_HAVE_OPENSSL 1
#else
#undef HAVE_OPENSSL
#undef ASDF_HAVE_OPENSSL
#endif

// zlib support

#if @HAVE_ZLIB@
#define HAVE_ZLIB 1
#define ASDF_HAVE_ZLIB 1
#else
#undef HAVE_ZLIB
#undef ASDF_HAVE_ZLIB
#endif

} // namespace ASDF
Expand Down
16 changes: 8 additions & 8 deletions ndarray.cpp
Expand Up @@ -3,15 +3,15 @@
#include "asdf_config.hpp"
#include "asdf_stl.hpp"

#ifdef HAVE_BZIP2
#ifdef ASDF_HAVE_BZIP2
#include <bzlib.h>
#endif

#ifdef HAVE_OPENSSL
#ifdef ASDF_HAVE_OPENSSL
#include <openssl/md5.h>
#endif

#ifdef HAVE_ZLIB
#ifdef ASDF_HAVE_ZLIB
#include <zlib.h>
#endif

Expand Down Expand Up @@ -211,7 +211,7 @@ shared_ptr<generic_blob_t> read_block(istream &is) {
assert(data_space == allocated_space);
data = move(indata);
break;
#ifdef HAVE_BZIP2
#ifdef ASDF_HAVE_BZIP2
case compression_t::bzip2: {
data.resize(data_space);
bz_stream strm;
Expand Down Expand Up @@ -244,7 +244,7 @@ shared_ptr<generic_blob_t> read_block(istream &is) {
break;
}
#endif
#ifdef HAVE_ZLIB
#ifdef ASDF_HAVE_ZLIB
case compression_t::zlib: {
data.resize(data_space);
z_stream strm;
Expand Down Expand Up @@ -317,7 +317,7 @@ void ndarray::write_block(ostream &os) const {
outdata = data;
break;
case compression_t::bzip2: {
#ifdef HAVE_BZIP2
#ifdef ASDF_HAVE_BZIP2
comp = {'b', 'z', 'p', '2'};
// Allocate 600 bytes plus 1% more
outdata = make_shared<blob_t<unsigned char>>(vector<unsigned char>(
Expand Down Expand Up @@ -362,7 +362,7 @@ void ndarray::write_block(ostream &os) const {
break;
}
case compression_t::zlib: {
#ifdef HAVE_ZLIB
#ifdef ASDF_HAVE_ZLIB
comp = {'z', 'l', 'i', 'b'};
// Allocate 6 bytes plus 5 bytes per 16 kByte more
outdata = make_shared<blob_t<unsigned char>>(vector<unsigned char>(
Expand Down Expand Up @@ -424,7 +424,7 @@ void ndarray::write_block(ostream &os) const {
output(header, data_space);
// checksum
array<unsigned char, 16> checksum;
#ifdef HAVE_OPENSSL
#ifdef ASDF_HAVE_OPENSSL
MD5_CTX ctx;
MD5_Init(&ctx);
MD5_Update(&ctx, outdata->ptr(), outdata->nbytes());
Expand Down

0 comments on commit b79a5e8

Please sign in to comment.