[Lldb-commits] [PATCH] D109779: [LLDB] [Minidump] Fix format string warnings on Windows

Martin Storsjö via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Sep 14 12:18:35 PDT 2021


mstorsjo created this revision.
mstorsjo added a reviewer: labath.
mstorsjo requested review of this revision.
Herald added a project: LLDB.

These variables are 'size_t' and thus should use %zu. On Windows,
'long' is always 32 bit.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D109779

Files:
  lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp


Index: lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp
===================================================================
--- lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp
+++ lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp
@@ -729,7 +729,7 @@
   if (error.Fail() || bytes_written != header_size) {
     if (bytes_written != header_size)
       error.SetErrorStringWithFormat(
-          "Unable to write the header. (written %ld/%ld).", bytes_written,
+          "Unable to write the header. (written %zd/%zd).", bytes_written,
           header_size);
     return error;
   }
@@ -740,7 +740,7 @@
   if (error.Fail() || bytes_written != m_data.GetByteSize()) {
     if (bytes_written != m_data.GetByteSize())
       error.SetErrorStringWithFormat(
-          "Unable to write the data. (written %ld/%ld).", bytes_written,
+          "Unable to write the data. (written %zd/%zd).", bytes_written,
           m_data.GetByteSize());
     return error;
   }
@@ -752,7 +752,7 @@
     if (error.Fail() || bytes_written != directory_size) {
       if (bytes_written != directory_size)
         error.SetErrorStringWithFormat(
-            "Unable to write the directory. (written %ld/%ld).", bytes_written,
+            "Unable to write the directory. (written %zd/%zd).", bytes_written,
             directory_size);
       return error;
     }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D109779.372534.patch
Type: text/x-patch
Size: 1391 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20210914/b7b38185/attachment-0001.bin>


More information about the lldb-commits mailing list