mirror of
https://github.com/debauchee/barrier.git
synced 2026-05-10 00:11:43 +08:00
Changed log() and logc() macros to LOG() and LOGC(), respectively.
This avoids a conflict with the standard math library log() function.
This commit is contained in:
@@ -28,7 +28,7 @@ CProtocolUtil::writef(IOutputStream* stream, const char* fmt, ...)
|
||||
{
|
||||
assert(stream != NULL);
|
||||
assert(fmt != NULL);
|
||||
log((CLOG_DEBUG2 "writef(%s)", fmt));
|
||||
LOG((CLOG_DEBUG2 "writef(%s)", fmt));
|
||||
|
||||
va_list args;
|
||||
|
||||
@@ -52,7 +52,7 @@ CProtocolUtil::writef(IOutputStream* stream, const char* fmt, ...)
|
||||
UInt8* scan = buffer;
|
||||
while (count > 0) {
|
||||
const UInt32 n = stream->write(scan, count);
|
||||
log((CLOG_DEBUG2 "wrote %d of %d bytes", n, count));
|
||||
LOG((CLOG_DEBUG2 "wrote %d of %d bytes", n, count));
|
||||
count -= n;
|
||||
scan += n;
|
||||
}
|
||||
@@ -65,7 +65,7 @@ CProtocolUtil::readf(IInputStream* stream, const char* fmt, ...)
|
||||
{
|
||||
assert(stream != NULL);
|
||||
assert(fmt != NULL);
|
||||
log((CLOG_DEBUG2 "readf(%s)", fmt));
|
||||
LOG((CLOG_DEBUG2 "readf(%s)", fmt));
|
||||
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
@@ -91,7 +91,7 @@ CProtocolUtil::readf(IInputStream* stream, const char* fmt, ...)
|
||||
case 1:
|
||||
// 1 byte integer
|
||||
*reinterpret_cast<UInt8*>(v) = buffer[0];
|
||||
log((CLOG_DEBUG2 "readf: read %d byte integer: %d (0x%x)", len, *reinterpret_cast<UInt8*>(v), *reinterpret_cast<UInt8*>(v)));
|
||||
LOG((CLOG_DEBUG2 "readf: read %d byte integer: %d (0x%x)", len, *reinterpret_cast<UInt8*>(v), *reinterpret_cast<UInt8*>(v)));
|
||||
break;
|
||||
|
||||
case 2:
|
||||
@@ -100,7 +100,7 @@ CProtocolUtil::readf(IInputStream* stream, const char* fmt, ...)
|
||||
static_cast<UInt16>(
|
||||
(static_cast<UInt16>(buffer[0]) << 8) |
|
||||
static_cast<UInt16>(buffer[1]));
|
||||
log((CLOG_DEBUG2 "readf: read %d byte integer: %d (0x%x)", len, *reinterpret_cast<UInt16*>(v), *reinterpret_cast<UInt16*>(v)));
|
||||
LOG((CLOG_DEBUG2 "readf: read %d byte integer: %d (0x%x)", len, *reinterpret_cast<UInt16*>(v), *reinterpret_cast<UInt16*>(v)));
|
||||
break;
|
||||
|
||||
case 4:
|
||||
@@ -110,7 +110,7 @@ CProtocolUtil::readf(IInputStream* stream, const char* fmt, ...)
|
||||
(static_cast<UInt32>(buffer[1]) << 16) |
|
||||
(static_cast<UInt32>(buffer[2]) << 8) |
|
||||
static_cast<UInt32>(buffer[3]);
|
||||
log((CLOG_DEBUG2 "readf: read %d byte integer: %d (0x%x)", len, *reinterpret_cast<UInt32*>(v), *reinterpret_cast<UInt32*>(v)));
|
||||
LOG((CLOG_DEBUG2 "readf: read %d byte integer: %d (0x%x)", len, *reinterpret_cast<UInt32*>(v), *reinterpret_cast<UInt32*>(v)));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@@ -149,7 +149,7 @@ CProtocolUtil::readf(IInputStream* stream, const char* fmt, ...)
|
||||
}
|
||||
throw;
|
||||
}
|
||||
log((CLOG_DEBUG2 "readf: read %d byte string: %.*s", len, len, sBuffer));
|
||||
LOG((CLOG_DEBUG2 "readf: read %d byte string: %.*s", len, len, sBuffer));
|
||||
|
||||
// save the data
|
||||
CString* dst = va_arg(args, CString*);
|
||||
@@ -180,7 +180,7 @@ CProtocolUtil::readf(IInputStream* stream, const char* fmt, ...)
|
||||
|
||||
// verify match
|
||||
if (buffer[0] != *fmt) {
|
||||
log((CLOG_DEBUG2 "readf: format mismatch: %c vs %c", *fmt, buffer[0]));
|
||||
LOG((CLOG_DEBUG2 "readf: format mismatch: %c vs %c", *fmt, buffer[0]));
|
||||
throw XIOReadMismatch();
|
||||
}
|
||||
|
||||
@@ -366,7 +366,7 @@ CProtocolUtil::read(IInputStream* stream, void* vbuffer, UInt32 count)
|
||||
|
||||
// bail if stream has hungup
|
||||
if (n == 0) {
|
||||
log((CLOG_DEBUG2 "unexpected disconnect in readf(), %d bytes left", count));
|
||||
LOG((CLOG_DEBUG2 "unexpected disconnect in readf(), %d bytes left", count));
|
||||
throw XIOEndOfStream();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user