[Lldb-commits] [lldb] r234562 - Remove 'z' modifier from printf/sscanf operations in AdbClient - the modifier isn't supported by MS C++ compiler.

Oleksiy Vyalov ovyalov at google.com
Thu Apr 9 20:59:53 PDT 2015


Author: ovyalov
Date: Thu Apr  9 22:59:52 2015
New Revision: 234562

URL: http://llvm.org/viewvc/llvm-project?rev=234562&view=rev
Log:
Remove 'z' modifier from printf/sscanf operations in AdbClient  - the modifier isn't supported by MS C++ compiler.

Modified:
    lldb/trunk/source/Plugins/Platform/Android/AdbClient.cpp

Modified: lldb/trunk/source/Plugins/Platform/Android/AdbClient.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/Android/AdbClient.cpp?rev=234562&r1=234561&r2=234562&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/Android/AdbClient.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/Android/AdbClient.cpp Thu Apr  9 22:59:52 2015
@@ -49,7 +49,7 @@ AdbClient::CreateByDeviceID (const char*
     else
     {
         if (connect_devices.size () != 1)
-            return Error ("Expected a single connected device, got instead %zu", connect_devices.size ());
+            return Error ("Expected a single connected device, got instead %" PRIu64, static_cast<uint64_t>(connect_devices.size ()));
 
         adb.SetDeviceID (connect_devices.front ());
     }
@@ -142,7 +142,7 @@ AdbClient::SendMessage (const std::strin
         return error;
 
     char length_buffer[5];
-    snprintf (length_buffer, sizeof (length_buffer), "%04zx", packet.size ());
+    snprintf (length_buffer, sizeof (length_buffer), "%04x", static_cast<int>(packet.size ()));
 
     ConnectionStatus status;
 
@@ -177,8 +177,8 @@ AdbClient::ReadMessage (std::string &mes
     if (error.Fail ())
         return error;
 
-    size_t packet_len = 0;
-    sscanf (buffer, "%zx", &packet_len);
+    int packet_len = 0;
+    sscanf (buffer, "%x", &packet_len);
     std::string result (packet_len, 0);
     m_conn.Read (&result[0], packet_len, kConnTimeout, status, &error);
     if (error.Success ())
@@ -200,7 +200,7 @@ AdbClient::ReadResponseStatus()
 
     m_conn.Read (buffer, packet_len, kConnTimeout, status, &error);
     if (error.Fail ())
-      return error;
+        return error;
 
     if (strncmp (buffer, kOKAY, packet_len) != 0)
     {





More information about the lldb-commits mailing list