Skip to content

Require C++11 Minimum #35

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions cplusplus/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,6 @@ target_link_libraries(zdw ${ZLIB_LIBRARIES})
target_link_libraries(unconvertDWfile zdw)
target_link_libraries(convertDWfile zdw)

set_property(TARGET zdw PROPERTY CXX_STANDARD 11)
set_property(TARGET unconvertDWfile PROPERTY CXX_STANDARD 11)
set_property(TARGET convertDWfile PROPERTY CXX_STANDARD 11)
4 changes: 4 additions & 0 deletions cplusplus/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# ZDW Compression Library

Build Requirements:
* C++11 compatible compiler.
11 changes: 7 additions & 4 deletions cplusplus/UnconvertFromZDW.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <math.h>
#include <ostream>
#include <set>
#include <cassert>
#include <sstream>
#include <stdint.h>
#include <string.h>
Expand Down Expand Up @@ -635,9 +636,10 @@ string UnconvertFromZDW_Base::getColumnDesc(const string& name, UCHAR type, size
case VIRTUAL_EXPORT_FILE_BASENAME:
case VARCHAR:
{
char temp[32];
const size_t TEMP_BUFFER_SIZE=32;
char temp[TEMP_BUFFER_SIZE];
const int char_size = (this->columnCharSize && this->columnCharSize[index]) ? this->columnCharSize[index] : 255; //before version 7, we don't have a size value
sprintf(temp, "varchar(%d)", char_size);
snprintf(temp, TEMP_BUFFER_SIZE, "varchar(%d)", char_size);
text += temp;
}
break;
Expand Down Expand Up @@ -1269,12 +1271,13 @@ void UnconvertFromZDW<T>::outputDefault(T& buffer, const UCHAR type)
template <typename T>
ERR_CODE UnconvertFromZDW<T>::readNextRow(T& buffer)
{
const size_t TEMP_BUFFER_SIZE=64;
long u = 0;
char *pos;
ULONG index;
ULONGLONG visid_low = 0;
int tempLength;
char temp[64];
char temp[TEMP_BUFFER_SIZE];
bool bColumnWritten = false;

IncrementCurrentRowNumber();
Expand Down Expand Up @@ -1443,7 +1446,7 @@ ERR_CODE UnconvertFromZDW<T>::readNextRow(T& buffer)
pos = GetWord(index, row);
buffer.write(pos, strlen(pos));
} else { //version 1-3
tempLength = sprintf(temp, "%0.12lf", (val.n + this->columnBase[c]) / this->decimalFactor);
tempLength = snprintf(temp, TEMP_BUFFER_SIZE, "%0.12lf", (val.n + this->columnBase[c]) / this->decimalFactor);
buffer.write(temp, tempLength);
}
} else {
Expand Down
1 change: 1 addition & 0 deletions cplusplus/unconvertDWfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "zdw/UnconvertFromZDW.h"

#include <algorithm>
#include <cassert>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
Expand Down
5 changes: 2 additions & 3 deletions cplusplus/zdw/UnconvertFromZDW.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@
#include <stdexcept>
#include <string>
#include <vector>

#include <boost/scoped_ptr.hpp>
#include <memory>


namespace adobe {
Expand Down Expand Up @@ -348,7 +347,7 @@ class UnconvertFromZDWToMemory : public UnconvertFromZDW<BufferedOutputInMem>
ERR_CODE handleZDWParseBlockHeader();

private:
boost::scoped_ptr<BufferedOutputInMem> pBufferedOutput;
std::unique_ptr<BufferedOutputInMem> pBufferedOutput;
size_t num_output_columns;
bool bUseInternalBuffer;
};
Expand Down