Module: tools Branch: master Commit: 18afecb4b786e7069e989d1400ee86ccbc818141 URL: https://source.winehq.org/git/tools.git/?a=commit;h=18afecb4b786e7069e989d14...
Author: Francois Gouget fgouget@codeweavers.com Date: Thu Dec 6 01:39:20 2018 +0100
testbot/TestAgent: Don't append a '\0' when sending data.
_SendString() is used to both send data, typically the content of files, and perl strings. In the first case $Type is 'd', and in the latter 's' and a trailing '\0' is added to match the C convention.
Signed-off-by: Francois Gouget fgouget@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
testbot/lib/WineTestBot/TestAgent.pm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/testbot/lib/WineTestBot/TestAgent.pm b/testbot/lib/WineTestBot/TestAgent.pm index 8957b9f..a128e34 100644 --- a/testbot/lib/WineTestBot/TestAgent.pm +++ b/testbot/lib/WineTestBot/TestAgent.pm @@ -791,10 +791,12 @@ sub _SendUInt64($$$) sub _SendString($$$;$) { my ($self, $Name, $Str, $Type) = @_; + $Type ||= 's'; + debug(" SendString('$Name', '$Str', '$Type')\n");
- debug(" SendString('$Name', '$Str')\n"); - $Str .= "\0"; - return $self->_SendEntryHeader($Name, $Type || 's', length($Str)) && + # Add a trailing '\0' to strings to match the C convention. + $Str .= "\0" if ($Type eq 's'); + return $self->_SendEntryHeader($Name, $Type, length($Str)) && $self->_SendRawData($Name, $Str); }