From: Eduardo Ramos Testillano Date: Mon, 20 Jun 2016 01:33:43 +0000 (+0200) Subject: fix, to avoid continuing working over object X-Git-Tag: REFACTORING_TESTING_LIBRARY~6 X-Git-Url: https://git.teslayout.com/public/public/public/?a=commitdiff_plain;h=280ea9dc419bc28bce42a0e4799ad8ab27530ea4;p=anna.git fix, to avoid continuing working over object --- diff --git a/example/diameter/batchConverter/main.cpp b/example/diameter/batchConverter/main.cpp index 85f7948..ae2ffdc 100644 --- a/example/diameter/batchConverter/main.cpp +++ b/example/diameter/batchConverter/main.cpp @@ -68,14 +68,17 @@ void _exit(const std::string &message, int resultCode = 1) { } // Decodes a diameter message coming from a datablock -void decodeDataBlock(const anna::DataBlock &db/*, unsigned int & detectedApplicationId*/) throw() { +bool decodeDataBlock(const anna::DataBlock &db/*, unsigned int & detectedApplicationId*/) throw() { try { G_codecMsg.clear(); G_codecMsg.decode(db); } catch(RuntimeException &ex) { std::cerr << ex.asString() << std::endl << std::endl; //_exit(ex.asString()); + return false; } + + return true; } //------------------------------------------------------------------- @@ -203,15 +206,16 @@ int main(int argc, char **argv) { _exit("Error reading hex file provided"); // Decode datablock: - decodeDataBlock(db_aux); + if (decodeDataBlock(db_aux)) { - // Write conversion: - std::string outputFile = entry + ".as.xml"; - std::ofstream out(outputFile.c_str(), std::ifstream::out); - out << G_codecMsg.asXMLString(); - out.close(); + // Write conversion: + std::string outputFile = entry + ".as.xml"; + std::ofstream out(outputFile.c_str(), std::ifstream::out); + out << G_codecMsg.asXMLString(); + out.close(); - anyHexConverted = true; + anyHexConverted = true; + } } }