Remote{Message|DrawingEngine}: Add some more debug output.
This commit is contained in:
@@ -1011,19 +1011,40 @@ RemoteDrawingEngine::_DrawingEngineResult(void* cookie, RemoteMessage& message)
|
|||||||
|
|
||||||
switch (message.Code()) {
|
switch (message.Code()) {
|
||||||
case RP_DRAW_STRING_RESULT:
|
case RP_DRAW_STRING_RESULT:
|
||||||
if (message.Read(engine->fDrawStringResult) != B_OK)
|
{
|
||||||
|
status_t result = message.Read(engine->fDrawStringResult);
|
||||||
|
if (result != B_OK) {
|
||||||
|
TRACE_ERROR("failed to read draw string result: %s\n",
|
||||||
|
strerror(result));
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case RP_STRING_WIDTH_RESULT:
|
case RP_STRING_WIDTH_RESULT:
|
||||||
if (message.Read(engine->fStringWidthResult) != B_OK)
|
{
|
||||||
|
status_t result = message.Read(engine->fStringWidthResult);
|
||||||
|
if (result != B_OK) {
|
||||||
|
TRACE_ERROR("failed to read string width result: %s\n",
|
||||||
|
strerror(result));
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case RP_READ_BITMAP_RESULT:
|
case RP_READ_BITMAP_RESULT:
|
||||||
if (message.ReadBitmap(&engine->fReadBitmapResult) != B_OK)
|
{
|
||||||
|
status_t result = message.ReadBitmap(&engine->fReadBitmapResult);
|
||||||
|
if (result != B_OK) {
|
||||||
|
TRACE_ERROR("failed to read bitmap of read bitmap result: %s\n",
|
||||||
|
strerror(result));
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -28,27 +28,49 @@
|
|||||||
#include <new>
|
#include <new>
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef CLIENT_COMPILE
|
||||||
|
#define TRACE_ALWAYS(x...) printf("RemoteMessage: " x)
|
||||||
|
#else
|
||||||
|
#define TRACE_ALWAYS(x...) debug_printf("RemoteMessage: " x)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define TRACE(x...) /*TRACE_ALWAYS(x)*/
|
||||||
|
#define TRACE_ERROR(x...) TRACE_ALWAYS(x)
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
RemoteMessage::NextMessage(uint16& code)
|
RemoteMessage::NextMessage(uint16& code)
|
||||||
{
|
{
|
||||||
if (fDataLeft > 0) {
|
if (fDataLeft > 0) {
|
||||||
// discard remainder of message
|
// discard remainder of message
|
||||||
int32 readSize = fSource->Read(NULL, fDataLeft);
|
int32 readSize = fSource->Read(NULL, fDataLeft);
|
||||||
if (readSize < 0)
|
if (readSize < 0) {
|
||||||
|
TRACE_ERROR("failed to read from source: %s\n", strerror(readSize));
|
||||||
return readSize;
|
return readSize;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static const uint32 kHeaderSize = sizeof(uint16) + sizeof(uint32);
|
static const uint32 kHeaderSize = sizeof(uint16) + sizeof(uint32);
|
||||||
|
|
||||||
fDataLeft = kHeaderSize;
|
fDataLeft = kHeaderSize;
|
||||||
Read(code);
|
status_t result = Read(code);
|
||||||
uint32 dataLeft;
|
if (result != B_OK) {
|
||||||
status_t result = Read(dataLeft);
|
TRACE_ERROR("failed to read message code: %s\n", strerror(result));
|
||||||
if (result != B_OK)
|
|
||||||
return result;
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
if (dataLeft < kHeaderSize)
|
uint32 dataLeft;
|
||||||
|
result = Read(dataLeft);
|
||||||
|
if (result != B_OK) {
|
||||||
|
TRACE_ERROR("failed to read message length: %s\n", strerror(result));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dataLeft < kHeaderSize) {
|
||||||
|
TRACE_ERROR("message claims %" B_PRIu32 " bytes, needed at least %"
|
||||||
|
B_PRIu32 " for the header\n", dataLeft, kHeaderSize);
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
fDataLeft = dataLeft - kHeaderSize;
|
fDataLeft = dataLeft - kHeaderSize;
|
||||||
fCode = code;
|
fCode = code;
|
||||||
|
|||||||
Reference in New Issue
Block a user