1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

pidl: Make sure to cast whole expressions

$cvar could be an expression such as ‘1 << 10’. In such cases this cast
presumably was intended to apply to the entire expression, not just to
the ‘1’.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Joseph Sutton 2023-11-27 12:58:05 +13:00 committed by Andrew Bartlett
parent 59b9432524
commit e3f81fa71e

View File

@ -2082,11 +2082,11 @@ sub ConvertScalarToPython($$$$)
# possibly 64 bit unsigned long. (enums are signed in C,
# unsigned in NDR)
if ($ctypename =~ /^(uint32|uint3264)$/) {
return "PyLong_FromUnsignedLongLong((uint32_t)$cvar)";
return "PyLong_FromUnsignedLongLong((uint32_t)($cvar))";
}
if ($ctypename =~ /^(uint|uint8|uint16|uint1632)$/) {
return "PyLong_FromLong((uint16_t)$cvar)";
return "PyLong_FromLong((uint16_t)($cvar))";
}
if ($ctypename eq "DATA_BLOB") {