Commit d51b8bf8 authored by Sid Stenersen's avatar Sid Stenersen
Browse files

fix: serializing

parent 94c74c7f
Pipeline #80175 passed with stages
in 15 minutes and 16 seconds
...@@ -151,7 +151,7 @@ namespace seismicdrive ...@@ -151,7 +151,7 @@ namespace seismicdrive
void deserialize(const std::string &sdms) void deserialize(const std::string &sdms)
{ {
auto tokens = sdutils::split(sdms, ';'); auto tokens = sdutils::split(sdms, ';', true);
if (tokens[0] != sdconfig::SDMANAGER_SERIALV) if (tokens[0] != sdconfig::SDMANAGER_SERIALV)
{ {
throw error::manager::context::UnknownFormat(1); throw error::manager::context::UnknownFormat(1);
......
...@@ -37,7 +37,7 @@ namespace seismicdrive ...@@ -37,7 +37,7 @@ namespace seismicdrive
explicit Impl(const std::string &sdms, SDManager *sdManager = nullptr) explicit Impl(const std::string &sdms, SDManager *sdManager = nullptr)
: _sdmanager(sdManager) : _sdmanager(sdManager)
{ {
std::vector<std::string> tokens = sdutils::split(sdms, ';', 5); std::vector<std::string> tokens = sdutils::split(sdms, ';', true, 5);
if (tokens[0] != sdconfig::SDROGDATASET_SERIALV) if (tokens[0] != sdconfig::SDROGDATASET_SERIALV)
{ {
throw error::dataset::Error({sdmex::dsgenericreadonly::WrongSerializationVersion(), ""}); throw error::dataset::Error({sdmex::dsgenericreadonly::WrongSerializationVersion(), ""});
......
...@@ -208,13 +208,13 @@ namespace seismicdrive ...@@ -208,13 +208,13 @@ namespace seismicdrive
} }
} }
std::vector<std::string> split(const std::string &s, char delimiter, size_t maxTokens) std::vector<std::string> split(const std::string &s, char delimiter, bool keepEmpty, size_t maxTokens)
{ {
std::vector<std::string> v; std::vector<std::string> v;
for (size_t a = 0;;) for (size_t a = 0;;)
{ {
auto b = s.find(delimiter, a); auto b = s.find(delimiter, a);
if (b != a) if (keepEmpty || b != a)
{ {
if (v.size() == maxTokens - 1) if (v.size() == maxTokens - 1)
{ {
......
...@@ -74,7 +74,7 @@ namespace seismicdrive ...@@ -74,7 +74,7 @@ namespace seismicdrive
void stringsFromArchive(std::istringstream &archive, std::vector<std::string> &ss); void stringsFromArchive(std::istringstream &archive, std::vector<std::string> &ss);
std::vector<std::string> split(const std::string &s, char delimiter, size_t maxTokens = std::string::npos); std::vector<std::string> split(const std::string &s, char delimiter, bool keepEmpty, size_t maxTokens = std::string::npos);
uint64_t getAuthTokenExpiration(const std::string &authToken, const std::string &tag = ""); uint64_t getAuthTokenExpiration(const std::string &authToken, const std::string &tag = "");
......
...@@ -36,7 +36,7 @@ namespace seismicdrive ...@@ -36,7 +36,7 @@ namespace seismicdrive
uint64_t getAuthTokenExpiration(const std::string &authToken, const std::string &tag) uint64_t getAuthTokenExpiration(const std::string &authToken, const std::string &tag)
{ {
std::string payload; std::string payload;
auto s = sdutils::split(authToken, '.'); auto s = sdutils::split(authToken, '.', false);
if (s.size() > 1) if (s.size() > 1)
{ {
payload = s[1]; payload = s[1];
......
...@@ -160,7 +160,7 @@ TestRunner *TestRunner::Create(int argc, char *argv[]) ...@@ -160,7 +160,7 @@ TestRunner *TestRunner::Create(int argc, char *argv[])
if (maxth.size()) if (maxth.size())
{ {
params.maxThreads.clear(); params.maxThreads.clear();
for (auto s : sdutils::split(maxth, ',')) for (auto s : sdutils::split(maxth, ',', false))
{ {
params.maxThreads.push_back(std::stoi(s)); params.maxThreads.push_back(std::stoi(s));
} }
......
Supports Markdown
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