From bd212d4ace55deec338cb8590697b7f2846967f0 Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Sun, 14 Aug 2005 16:00:12 +0000 Subject: [PATCH] Fix for getStringReply to return a difference between an empty string and an error / no string --- vdr.cc | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/vdr.cc b/vdr.cc index a8bb171..e1c6989 100644 --- a/vdr.cc +++ b/vdr.cc @@ -155,17 +155,21 @@ char* VDR::getStringReply() int dataLength = tcp->getDataLength(); - Log::getInstance()->log("VDR", Log::DEBUG, "Data length %u", dataLength); +// Log::getInstance()->log("VDR", Log::DEBUG, "GSR Data length %u", dataLength); - int count = 0; + if ((dataLength == 4) && (p[0] == '\0')) + { + Log::getInstance()->log("VDR", Log::DEBUG, "GSR returning null no string returned"); + free(p); + return NULL; // no string returned + } char* returnText; int tLength; - tLength = strlen((char*)&p[count]); + tLength = strlen((char*)p); returnText = new char[tLength + 1]; - strcpy(returnText, (char*)&p[count]); - count += tLength + 1; + strcpy(returnText, (char*)p); free(p); -- 2.39.5