[PATCH] testbot/TestAgent: Don't append a '\0' when sending data.

Francois Gouget fgouget at codeweavers.com
Wed Dec 5 18:39:20 CST 2018


_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 at codeweavers.com>
---
 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 8957b9f829..a128e347e4 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);
 }
 
-- 
2.19.2



More information about the wine-devel mailing list