Skip to content
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

HDT format identifier uses only HDT version. #43

Merged
merged 1 commit into from
Dec 9, 2016
Merged
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: 1 addition & 2 deletions hdt-lib/include/HDTVocabulary.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ namespace hdt {
namespace HDTVocabulary {
// Base
const std::string HDT_BASE = "<http://purl.org/HDT/hdt#";
const std::string HDT_CONTAINER = HDT_BASE+"HDT" + HDTVersion::get_version_string("-") + ">";
const std::string HDT_CONTAINER_BASE = HDT_BASE+"HDTv" + HDT_VERSION;
const std::string HDT_CONTAINER = HDT_BASE+"HDTv" + HDT_VERSION + ">";
const std::string HDT_HEADER = HDT_BASE+"header";
const std::string HDT_DICTIONARY_BASE = HDT_BASE+"dictionary";
const std::string HDT_DICTIONARY = HDT_DICTIONARY_BASE+">";
Expand Down
8 changes: 3 additions & 5 deletions hdt-lib/src/hdt/BasicHDT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ void BasicHDT::loadHeader(const char *fileName, ProgressListener *listener)
controlInformation.load(*input);
std::string hdtFormat = controlInformation.getFormat();
if(hdtFormat!=HDTVocabulary::HDT_CONTAINER) {
throw std::runtime_error("This software cannot open this version of HDT File.");
throw std::runtime_error("This software (v" + std::string(HDT_VERSION) + ".x.x) cannot open this version of HDT File (" + hdtFormat + ")");
}

// Load header
Expand All @@ -692,8 +692,7 @@ void BasicHDT::loadFromHDT(std::istream & input, ProgressListener *listener)
// Load Global ControlInformation.
controlInformation.load(input);
std::string hdtFormat = controlInformation.getFormat();
//if(hdtFormat!=HDTVocabulary::HDT_CONTAINER) {
if (hdtFormat.find(HDTVocabulary::HDT_CONTAINER_BASE) == std::string::npos) {
if(hdtFormat!=HDTVocabulary::HDT_CONTAINER) {
throw std::runtime_error("This software (v" + std::string(HDT_VERSION) + ".x.x) cannot open this version of HDT File (" + hdtFormat + ")");
}

Expand Down Expand Up @@ -779,8 +778,7 @@ size_t BasicHDT::loadMMap(unsigned char *ptr, unsigned char *ptrMax, ProgressLis
// Load Global ControlInformation
count+=controlInformation.load(&ptr[count], ptrMax);
std::string hdtFormat = controlInformation.getFormat();
//if(hdtFormat!=HDTVocabulary::HDT_CONTAINER) {
if (hdtFormat.find(HDTVocabulary::HDT_CONTAINER_BASE) == std::string::npos) {
if(hdtFormat!=HDTVocabulary::HDT_CONTAINER) {
throw std::runtime_error("This software (v" + std::string(HDT_VERSION) + ".x.x) cannot open this version of HDT File (" + hdtFormat + ")");
}

Expand Down