From 1ca3263b1febbef86071eaaa4e8eda0bbac578fa Mon Sep 17 00:00:00 2001 From: Christian Wieninger Date: Wed, 20 Feb 2008 17:47:50 +0100 Subject: replaced asprintf with cString::sprintf and a wrapper function --- svdrpclient.h | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'svdrpclient.h') diff --git a/svdrpclient.h b/svdrpclient.h index 10bdbae..177ce1f 100644 --- a/svdrpclient.h +++ b/svdrpclient.h @@ -91,21 +91,18 @@ public: } } - bool SendCmd(char* cmd) + bool SendCmd(const char* cmd) { if (!bConnected) return false; - char* szCmd = NULL; - - asprintf(&szCmd, "%s\r\n", cmd); - Send(szCmd); - free(szCmd); + cString szCmd = cString::sprintf("%s\r\n", cmd); + Send(*szCmd); bool cmdret = (Receive() == CMDSUCCESS); - asprintf(&szCmd, "QUIT\r\n"); + szCmd = cString::sprintf("QUIT\r\n"); Send(szCmd); - free(szCmd); + long rc = 0; if ((rc = Receive()) != SVDRPDISCONNECT) LogFile.eSysLog("could not disconnect (%ld)!", rc); @@ -113,7 +110,7 @@ public: close(sock); return cmdret; } - bool Send(char* szSend) + bool Send(const char* szSend) { int length = strlen(szSend); int sent = 0; @@ -147,7 +144,7 @@ public: return -1; } char* Temp = NULL; - asprintf(&Temp, "%s%c", csResp, ch); + msprintf(&Temp, "%s%c", csResp, ch); free(csResp); csResp = Temp; } -- cgit v1.2.3