From f248d1746eefcb9f6990b1f4a48c07a951b8d357 Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Sat, 14 Nov 2015 13:39:18 -1000 Subject: [PATCH] proper string-size computation for binarySize --- atdna/main.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/atdna/main.cpp b/atdna/main.cpp index 114f07c..1073022 100644 --- a/atdna/main.cpp +++ b/atdna/main.cpp @@ -841,7 +841,7 @@ class ATDNAEmitVisitor : public clang::RecursiveASTVisitor } } - if (sizeExprStr.size()) + if (sizeExprStr.size() && sizeExprStr.compare("-1")) fileOut << " __isz += (" << sizeExprStr << ");\n"; else fileOut << " __isz += " << fieldName << ".size() + 1;\n"; @@ -879,7 +879,7 @@ class ATDNAEmitVisitor : public clang::RecursiveASTVisitor ++idx; } - if (sizeExprStr.size()) + if (sizeExprStr.size() && sizeExprStr.compare("-1")) fileOut << " __isz += (" << sizeExprStr << ") * 2;\n"; else fileOut << " __isz += (" << fieldName << ".size() + 1) * 2;\n"; @@ -913,7 +913,7 @@ class ATDNAEmitVisitor : public clang::RecursiveASTVisitor } - if (sizeExprStr.size()) + if (sizeExprStr.size() && sizeExprStr.compare("-1")) fileOut << " __isz += (" << sizeExprStr << ") * 2;\n"; else fileOut << " __isz += (" << fieldName << ".size() + 1) * 2;\n";