[core,orders] fix undefined variable, unify log strings

This commit is contained in:
akallabeth
2023-08-03 12:02:11 +02:00
committed by akallabeth
parent 2496037f03
commit e51a5b33fb

View File

@@ -41,6 +41,10 @@
#define TAG FREERDP_TAG("core.orders")
static const char primary_order_str[] = "Primary Drawing Order";
static const char secondary_order_str[] = "Secondary Drawing Order";
static const char alt_sec_order_str[] = "Alternate Secondary Drawing Order";
BYTE get_primary_drawing_order_field_bytes(UINT32 orderType, BOOL* pValid)
{
if (pValid)
@@ -252,7 +256,7 @@ static BOOL check_alt_order_supported(wLog* log, rdpSettings* settings, BYTE ord
break;
default:
WLog_Print(log, WLOG_WARN, "%s - Alternate Secondary Drawing Order UNKNOWN", orderName);
WLog_Print(log, WLOG_WARN, "%s - %s UNKNOWN", orderName, alt_sec_order_str);
condition = FALSE;
break;
}
@@ -417,7 +421,7 @@ static BOOL check_primary_order_supported(wLog* log, rdpSettings* settings, UINT
break;
default:
WLog_Print(log, WLOG_ERROR, "%s Primary Drawing Order not supported", orderName);
WLog_Print(log, WLOG_ERROR, "%s %s not supported", orderName, primary_order_str);
break;
}
@@ -3479,7 +3483,7 @@ static BOOL read_primary_order(wLog* log, const char* orderName, wStream* s,
break;
default:
WLog_Print(log, WLOG_WARN, "Primary Drawing Order %s not supported, ignoring",
WLog_Print(log, WLOG_WARN, "%s %s not supported, ignoring", primary_order_str,
orderName);
rc = TRUE;
break;
@@ -3487,7 +3491,7 @@ static BOOL read_primary_order(wLog* log, const char* orderName, wStream* s,
if (!rc)
{
WLog_Print(log, WLOG_ERROR, "Read Primary Drawing Order %s failed", orderName);
WLog_Print(log, WLOG_ERROR, "%s %s failed", primary_order_str, orderName);
return FALSE;
}
@@ -3526,7 +3530,7 @@ static BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
}
orderName = primary_order_string(orderInfo->orderType);
WLog_Print(up->log, WLOG_DEBUG, "Primary Drawing Order %s", orderName);
WLog_Print(up->log, WLOG_DEBUG, "%s %s", primary_order_str, orderName);
if (!check_primary_order_supported(up->log, settings, orderInfo->orderType, orderName))
return FALSE;
@@ -3571,7 +3575,7 @@ static BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
{
case ORDER_TYPE_DSTBLT:
{
WLog_Print(up->log, WLOG_DEBUG, "Primary Drawing Order %s rop=%s [0x%08" PRIx32 "]",
WLog_Print(up->log, WLOG_DEBUG, "%s %s rop=%s [0x%08" PRIx32 "]", primary_order_str,
orderName, gdi_rop3_code_string(primary->dstblt.bRop),
gdi_rop3_code(primary->dstblt.bRop));
rc = IFCALLRESULT(defaultReturn, primary->common.DstBlt, context, &primary->dstblt);
@@ -3580,7 +3584,7 @@ static BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
case ORDER_TYPE_PATBLT:
{
WLog_Print(up->log, WLOG_DEBUG, "Primary Drawing Order %s rop=%s [0x%08" PRIx32 "]",
WLog_Print(up->log, WLOG_DEBUG, "%s %s rop=%s [0x%08" PRIx32 "]", primary_order_str,
orderName, gdi_rop3_code_string(primary->patblt.bRop),
gdi_rop3_code(primary->patblt.bRop));
rc = IFCALLRESULT(defaultReturn, primary->common.PatBlt, context, &primary->patblt);
@@ -3589,7 +3593,7 @@ static BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
case ORDER_TYPE_SCRBLT:
{
WLog_Print(up->log, WLOG_DEBUG, "Primary Drawing Order %s rop=%s [0x%08" PRIx32 "]",
WLog_Print(up->log, WLOG_DEBUG, "%s %s rop=%s [0x%08" PRIx32 "]", primary_order_str,
orderName, gdi_rop3_code_string(primary->scrblt.bRop),
gdi_rop3_code(primary->scrblt.bRop));
rc = IFCALLRESULT(defaultReturn, primary->common.ScrBlt, context, &primary->scrblt);
@@ -3598,7 +3602,7 @@ static BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
case ORDER_TYPE_OPAQUE_RECT:
{
WLog_Print(up->log, WLOG_DEBUG, "Primary Drawing Order %s", orderName);
WLog_Print(up->log, WLOG_DEBUG, "%s %s", primary_order_str, orderName);
rc = IFCALLRESULT(defaultReturn, primary->common.OpaqueRect, context,
&primary->opaque_rect);
}
@@ -3606,7 +3610,7 @@ static BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
case ORDER_TYPE_DRAW_NINE_GRID:
{
WLog_Print(up->log, WLOG_DEBUG, "Primary Drawing Order %s", orderName);
WLog_Print(up->log, WLOG_DEBUG, "%s %s", primary_order_str, orderName);
rc = IFCALLRESULT(defaultReturn, primary->common.DrawNineGrid, context,
&primary->draw_nine_grid);
}
@@ -3614,7 +3618,7 @@ static BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
case ORDER_TYPE_MULTI_DSTBLT:
{
WLog_Print(up->log, WLOG_DEBUG, "Primary Drawing Order %s rop=%s [0x%08" PRIx32 "]",
WLog_Print(up->log, WLOG_DEBUG, "%s %s rop=%s [0x%08" PRIx32 "]", primary_order_str,
orderName, gdi_rop3_code_string(primary->multi_dstblt.bRop),
gdi_rop3_code(primary->multi_dstblt.bRop));
rc = IFCALLRESULT(defaultReturn, primary->common.MultiDstBlt, context,
@@ -3624,7 +3628,7 @@ static BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
case ORDER_TYPE_MULTI_PATBLT:
{
WLog_Print(up->log, WLOG_DEBUG, "Primary Drawing Order %s rop=%s [0x%08" PRIx32 "]",
WLog_Print(up->log, WLOG_DEBUG, "%s %s rop=%s [0x%08" PRIx32 "]", primary_order_str,
orderName, gdi_rop3_code_string(primary->multi_patblt.bRop),
gdi_rop3_code(primary->multi_patblt.bRop));
rc = IFCALLRESULT(defaultReturn, primary->common.MultiPatBlt, context,
@@ -3634,7 +3638,7 @@ static BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
case ORDER_TYPE_MULTI_SCRBLT:
{
WLog_Print(up->log, WLOG_DEBUG, "Primary Drawing Order %s rop=%s [0x%08" PRIx32 "]",
WLog_Print(up->log, WLOG_DEBUG, "%s %s rop=%s [0x%08" PRIx32 "]", primary_order_str,
orderName, gdi_rop3_code_string(primary->multi_scrblt.bRop),
gdi_rop3_code(primary->multi_scrblt.bRop));
rc = IFCALLRESULT(defaultReturn, primary->common.MultiScrBlt, context,
@@ -3644,7 +3648,7 @@ static BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
case ORDER_TYPE_MULTI_OPAQUE_RECT:
{
WLog_Print(up->log, WLOG_DEBUG, "Primary Drawing Order %s", orderName);
WLog_Print(up->log, WLOG_DEBUG, "%s %s", primary_order_str, orderName);
rc = IFCALLRESULT(defaultReturn, primary->common.MultiOpaqueRect, context,
&primary->multi_opaque_rect);
}
@@ -3652,7 +3656,7 @@ static BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
case ORDER_TYPE_MULTI_DRAW_NINE_GRID:
{
WLog_Print(up->log, WLOG_DEBUG, "Primary Drawing Order %s", orderName);
WLog_Print(up->log, WLOG_DEBUG, "%s %s", primary_order_str, orderName);
rc = IFCALLRESULT(defaultReturn, primary->common.MultiDrawNineGrid, context,
&primary->multi_draw_nine_grid);
}
@@ -3660,21 +3664,21 @@ static BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
case ORDER_TYPE_LINE_TO:
{
WLog_Print(up->log, WLOG_DEBUG, "Primary Drawing Order %s", orderName);
WLog_Print(up->log, WLOG_DEBUG, "%s %s", primary_order_str, orderName);
rc = IFCALLRESULT(defaultReturn, primary->common.LineTo, context, &primary->line_to);
}
break;
case ORDER_TYPE_POLYLINE:
{
WLog_Print(up->log, WLOG_DEBUG, "Primary Drawing Order %s", orderName);
WLog_Print(up->log, WLOG_DEBUG, "%s %s", primary_order_str, orderName);
rc = IFCALLRESULT(defaultReturn, primary->common.Polyline, context, &primary->polyline);
}
break;
case ORDER_TYPE_MEMBLT:
{
WLog_Print(up->log, WLOG_DEBUG, "Primary Drawing Order %s rop=%s [0x%08" PRIx32 "]",
WLog_Print(up->log, WLOG_DEBUG, "%s %s rop=%s [0x%08" PRIx32 "]", primary_order_str,
orderName, gdi_rop3_code_string(primary->memblt.bRop),
gdi_rop3_code(primary->memblt.bRop));
rc = IFCALLRESULT(defaultReturn, primary->common.MemBlt, context, &primary->memblt);
@@ -3683,7 +3687,7 @@ static BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
case ORDER_TYPE_MEM3BLT:
{
WLog_Print(up->log, WLOG_DEBUG, "Primary Drawing Order %s rop=%s [0x%08" PRIx32 "]",
WLog_Print(up->log, WLOG_DEBUG, "%s %s rop=%s [0x%08" PRIx32 "]", primary_order_str,
orderName, gdi_rop3_code_string(primary->mem3blt.bRop),
gdi_rop3_code(primary->mem3blt.bRop));
rc = IFCALLRESULT(defaultReturn, primary->common.Mem3Blt, context, &primary->mem3blt);
@@ -3692,7 +3696,7 @@ static BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
case ORDER_TYPE_SAVE_BITMAP:
{
WLog_Print(up->log, WLOG_DEBUG, "Primary Drawing Order %s", orderName);
WLog_Print(up->log, WLOG_DEBUG, "%s %s", primary_order_str, orderName);
rc = IFCALLRESULT(defaultReturn, primary->common.SaveBitmap, context,
&primary->save_bitmap);
}
@@ -3700,7 +3704,7 @@ static BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
case ORDER_TYPE_GLYPH_INDEX:
{
WLog_Print(up->log, WLOG_DEBUG, "Primary Drawing Order %s", orderName);
WLog_Print(up->log, WLOG_DEBUG, "%s %s", primary_order_str, orderName);
rc = IFCALLRESULT(defaultReturn, primary->common.GlyphIndex, context,
&primary->glyph_index);
}
@@ -3708,7 +3712,7 @@ static BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
case ORDER_TYPE_FAST_INDEX:
{
WLog_Print(up->log, WLOG_DEBUG, "Primary Drawing Order %s", orderName);
WLog_Print(up->log, WLOG_DEBUG, "%s %s", primary_order_str, orderName);
rc = IFCALLRESULT(defaultReturn, primary->common.FastIndex, context,
&primary->fast_index);
}
@@ -3716,7 +3720,7 @@ static BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
case ORDER_TYPE_FAST_GLYPH:
{
WLog_Print(up->log, WLOG_DEBUG, "Primary Drawing Order %s", orderName);
WLog_Print(up->log, WLOG_DEBUG, "%s %s", primary_order_str, orderName);
rc = IFCALLRESULT(defaultReturn, primary->common.FastGlyph, context,
&primary->fast_glyph);
}
@@ -3724,7 +3728,7 @@ static BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
case ORDER_TYPE_POLYGON_SC:
{
WLog_Print(up->log, WLOG_DEBUG, "Primary Drawing Order %s", orderName);
WLog_Print(up->log, WLOG_DEBUG, "%s %s", primary_order_str, orderName);
rc = IFCALLRESULT(defaultReturn, primary->common.PolygonSC, context,
&primary->polygon_sc);
}
@@ -3732,7 +3736,7 @@ static BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
case ORDER_TYPE_POLYGON_CB:
{
WLog_Print(up->log, WLOG_DEBUG, "Primary Drawing Order %s", orderName);
WLog_Print(up->log, WLOG_DEBUG, "%s %s", primary_order_str, orderName);
rc = IFCALLRESULT(defaultReturn, primary->common.PolygonCB, context,
&primary->polygon_cb);
}
@@ -3740,7 +3744,7 @@ static BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
case ORDER_TYPE_ELLIPSE_SC:
{
WLog_Print(up->log, WLOG_DEBUG, "Primary Drawing Order %s", orderName);
WLog_Print(up->log, WLOG_DEBUG, "%s %s", primary_order_str, orderName);
rc = IFCALLRESULT(defaultReturn, primary->common.EllipseSC, context,
&primary->ellipse_sc);
}
@@ -3748,20 +3752,20 @@ static BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
case ORDER_TYPE_ELLIPSE_CB:
{
WLog_Print(up->log, WLOG_DEBUG, "Primary Drawing Order %s", orderName);
WLog_Print(up->log, WLOG_DEBUG, "%s %s", primary_order_str, orderName);
rc = IFCALLRESULT(defaultReturn, primary->common.EllipseCB, context,
&primary->ellipse_cb);
}
break;
default:
WLog_Print(up->log, WLOG_WARN, "Primary Drawing Order %s not supported", orderName);
WLog_Print(up->log, WLOG_WARN, "%s %s not supported", primary_order_str, orderName);
break;
}
if (!rc)
{
WLog_Print(up->log, WLOG_ERROR, "Primary Drawing Order %s failed", orderName);
WLog_Print(up->log, WLOG_ERROR, "%s %s failed", primary_order_str, orderName);
return FALSE;
}
@@ -3799,7 +3803,7 @@ static BOOL update_recv_secondary_order(rdpUpdate* update, wStream* s, BYTE flag
start = Stream_GetPosition(s);
name = secondary_order_string(orderType);
WLog_Print(up->log, WLOG_DEBUG, "Secondary Drawing Order %s", name);
WLog_Print(up->log, WLOG_DEBUG, "%s %s", secondary_order_str, name);
rc = IFCALLRESULT(TRUE, secondary->CacheOrderInfo, context, orderLength, extraFlags, orderType,
name);
if (!rc)
@@ -3934,35 +3938,35 @@ static BOOL update_recv_secondary_order(rdpUpdate* update, wStream* s, BYTE flag
break;
default:
WLog_Print(up->log, WLOG_WARN, "Secondary Drawing Order %s not supported", name);
WLog_Print(up->log, WLOG_WARN, "%s %s not supported", secondary_order_str, name);
break;
}
if (!rc)
{
WLog_Print(up->log, WLOG_ERROR, "Secondary Drawing Order %s failed", name);
WLog_Print(up->log, WLOG_ERROR, "%s %s failed", secondary_order_str, name);
}
end = start + orderLengthFull;
pos = Stream_GetPosition(s);
if (pos > end)
{
WLog_Print(up->log, WLOG_WARN, "Secondary Drawing Order %s: read %" PRIuz "bytes too much",
WLog_Print(up->log, WLOG_WARN, "%s %s: read %" PRIuz "bytes too much", secondary_order_str,
name, pos - end);
return FALSE;
}
diff = end - pos;
if (diff > 0)
{
WLog_Print(up->log, WLOG_DEBUG,
"Secondary Drawing Order %s: read %" PRIuz "bytes short, skipping", name, diff);
WLog_Print(up->log, WLOG_DEBUG, "%s %s: read %" PRIuz "bytes short, skipping",
secondary_order_str, name, diff);
if (!Stream_SafeSeek(s, diff))
return FALSE;
}
return rc;
}
static BOOL read_altsec_order(wStream* s, BYTE orderType, rdpAltSecUpdate* altsec_pub)
static BOOL read_altsec_order(wLog* log, wStream* s, BYTE orderType, rdpAltSecUpdate* altsec_pub)
{
BOOL rc = FALSE;
rdp_altsec_update_internal* altsec = altsec_update_cast(altsec_pub);
@@ -4034,7 +4038,7 @@ static BOOL read_altsec_order(wStream* s, BYTE orderType, rdpAltSecUpdate* altse
if (!rc)
{
WLog_Print(up->log, WLOG_ERROR, "Read Alternate Secondary Drawing Order %s failed",
WLog_Print(log, WLOG_ERROR, "Read %s %s failed", alt_sec_order_str,
altsec_order_string(orderType));
}
@@ -4055,7 +4059,7 @@ static BOOL update_recv_altsec_order(rdpUpdate* update, wStream* s, BYTE flags)
WINPR_ASSERT(context);
WINPR_ASSERT(settings);
WLog_Print(up->log, WLOG_DEBUG, "Alternate Secondary Drawing Order %s", orderName);
WLog_Print(up->log, WLOG_DEBUG, "%s %s", alt_sec_order_str, orderName);
rc = IFCALLRESULT(TRUE, altsec->common.DrawOrderInfo, context, orderType, orderName);
if (!rc)
@@ -4064,7 +4068,7 @@ static BOOL update_recv_altsec_order(rdpUpdate* update, wStream* s, BYTE flags)
if (!check_alt_order_supported(up->log, settings, orderType, orderName))
return FALSE;
if (!read_altsec_order(s, orderType, &altsec->common))
if (!read_altsec_order(up->log, s, orderType, &altsec->common))
return FALSE;
switch (orderType)
@@ -4137,7 +4141,7 @@ static BOOL update_recv_altsec_order(rdpUpdate* update, wStream* s, BYTE flags)
if (!rc)
{
WLog_Print(up->log, WLOG_ERROR, "Alternate Secondary Drawing Order %s failed", orderName);
WLog_Print(up->log, WLOG_ERROR, "%s %s failed", alt_sec_order_str, orderName);
}
return rc;
@@ -4164,4 +4168,4 @@ BOOL update_recv_order(rdpUpdate* update, wStream* s)
WLog_Print(up->log, WLOG_ERROR, "order flags %02" PRIx8 " failed", controlFlags);
return rc;
}
}