From df048cb381b930ffd5360079efd5091513a734fd Mon Sep 17 00:00:00 2001 From: Andrea Zoli <zoli@iasfbo.inaf.it> Date: Thu, 28 Apr 2016 13:18:45 +0200 Subject: [PATCH] Fix the Tail section parsing while using .stream configuration files. --- src/ConfigurationFile.cpp | 2 +- src/Packet.cpp | 2 +- src/PartOfPacket.cpp | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ConfigurationFile.cpp b/src/ConfigurationFile.cpp index dd51659..9e9cd23 100644 --- a/src/ConfigurationFile.cpp +++ b/src/ConfigurationFile.cpp @@ -73,7 +73,7 @@ char* ConfigurationFile::getLine() throw(PacketExceptionIO*) try { temp = InputTextFile::getLine(); - if(temp[0] == 0) + if(temp == 0 || temp[0] == 0) return temp; while(strstr(temp, "--") != NULL) { diff --git a/src/Packet.cpp b/src/Packet.cpp index 139d510..ec05ee7 100644 --- a/src/Packet.cpp +++ b/src/Packet.cpp @@ -254,7 +254,7 @@ bool Packet::createPacketType(char* fileName, bool isprefix, word dimprefix) thr { dimPacketTail = dataField->getPacketTail()->size(); line = file.getLastLineRead(); - if(strcmp(line, "[Compression]") == 0) { + if(line && strcmp(line, "[Compression]") == 0) { compressible = true; compressionAlgorithmsIndex = atoi(file.getLine()); compressionAlgorithmsSection = atoi(file.getLine()); diff --git a/src/PartOfPacket.cpp b/src/PartOfPacket.cpp index ef09237..5888518 100644 --- a/src/PartOfPacket.cpp +++ b/src/PartOfPacket.cpp @@ -247,7 +247,7 @@ bool PartOfPacket::loadFields(InputText& fp) throw(PacketException*) do { name = fp.getLine(); count++; - if(name[0] == '[') + if(fp.isEOF() || name[0] == '[') { count--; break; @@ -273,7 +273,7 @@ bool PartOfPacket::loadFields(InputText& fp) throw(PacketException*) numberOfFields++; name = fp.getLine(); /// It reads until the buffer ends - if(name[0] == '[') + if(fp.isEOF() || name[0] == '[') { break; } -- GitLab