Skip to content

Commit

Permalink
Fix for json
Browse files Browse the repository at this point in the history
  • Loading branch information
dsalantic committed Feb 12, 2021
1 parent 4bb0923 commit ff719c4
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 19 deletions.
3 changes: 2 additions & 1 deletion HISTORY
Original file line number Diff line number Diff line change
Expand Up @@ -243,4 +243,5 @@ Not versioned yet
Issue #175 Cat021 Ed2.4 SelH is not reasonable
Issue #174 Warning: ‘char* strncpy(char*, const char*, size_t)’ output may be truncated
Issue #122 glibc version 2.1 behaves diffrently than glibc 2.0.6
Added CAT004 v1.12
Added CAT004 v1.12
Issue #178 Explicit items with more elements then in definition should be put to list
42 changes: 24 additions & 18 deletions src/asterix/DataItemFormatExplicit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,13 @@ bool DataItemFormatExplicit::getText(std::string &strResult, std::string &strHea

std::string tmpStr = "";

switch (formatType) {
case CAsterixFormat::EJSON:
case CAsterixFormat::EJSONH:
case CAsterixFormat::EJSONE: {
tmpStr += format("[");
if (nFullLength != bodyLength) {
switch (formatType) {
case CAsterixFormat::EJSON:
case CAsterixFormat::EJSONH:
case CAsterixFormat::EJSONE: {
tmpStr += format("[");
}
}
}

Expand All @@ -86,24 +88,28 @@ bool DataItemFormatExplicit::getText(std::string &strResult, std::string &strHea
ret |= di->getText(tmpStr, strHeader, formatType, pData, bodyLength);
pData += bodyLength;

switch (formatType) {
case CAsterixFormat::EJSON:
case CAsterixFormat::EJSONH:
case CAsterixFormat::EJSONE: {
tmpStr += format(",");
if (nFullLength != bodyLength) {
switch (formatType) {
case CAsterixFormat::EJSON:
case CAsterixFormat::EJSONH:
case CAsterixFormat::EJSONE: {
tmpStr += format(",");
}
}
}
}
}

switch (formatType) {
case CAsterixFormat::EJSON:
case CAsterixFormat::EJSONH:
case CAsterixFormat::EJSONE: {
if (tmpStr[tmpStr.length() - 1] == ',') {
tmpStr[tmpStr.length() - 1] = ']';
} else {
tmpStr += ']';
if (nFullLength != bodyLength) {
switch (formatType) {
case CAsterixFormat::EJSON:
case CAsterixFormat::EJSONH:
case CAsterixFormat::EJSONE: {
if (tmpStr[tmpStr.length() - 1] == ',') {
tmpStr[tmpStr.length() - 1] = ']';
} else {
tmpStr += ']';
}
}
}
}
Expand Down

0 comments on commit ff719c4

Please sign in to comment.