From c6ed114410ecb9943feb226960c4c60fca780680 Mon Sep 17 00:00:00 2001 From: crs Date: Sun, 14 Oct 2001 14:56:06 +0000 Subject: [PATCH] stupid bug fixes. writef() used the wrong variable as the number of bytes to write. readf() forgot to prepare the va_list. --- synergy/CProtocolUtil.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/synergy/CProtocolUtil.cpp b/synergy/CProtocolUtil.cpp index 7ebed7b2..d35b2867 100644 --- a/synergy/CProtocolUtil.cpp +++ b/synergy/CProtocolUtil.cpp @@ -1,6 +1,7 @@ #include "CProtocolUtil.h" #include "IInputStream.h" #include "IOutputStream.h" +#include "CLog.h" #include #include #include @@ -14,6 +15,7 @@ void CProtocolUtil::writef(IOutputStream* stream, { assert(stream != NULL); assert(fmt != NULL); + log((CLOG_DEBUG "writef(%s)", fmt)); va_list args; @@ -36,7 +38,8 @@ void CProtocolUtil::writef(IOutputStream* stream, // write buffer UInt8* scan = buffer; while (count > 0) { - const UInt32 n = stream->write(scan, n); + const UInt32 n = stream->write(scan, count); + log((CLOG_DEBUG "wrote %d of %d bytes", n, count)); count -= n; scan += n; } @@ -51,6 +54,7 @@ void CProtocolUtil::readf(IInputStream* stream, assert(fmt != NULL); va_list args; + va_start(args, fmt); // begin scanning while (*fmt) { @@ -162,6 +166,8 @@ void CProtocolUtil::readf(IInputStream* stream, ++fmt; } } + + va_end(args); } UInt32 CProtocolUtil::getLength(