OSDN Git Service

Cppcheck: %d in format string (no. x) requires 'int' but the argument type is 'UINT...
authorTakashi Sawanaka <sdottaka@users.sourceforge.net>
Mon, 15 Aug 2016 03:25:02 +0000 (12:25 +0900)
committerTakashi Sawanaka <sdottaka@users.sourceforge.net>
Mon, 15 Aug 2016 03:25:02 +0000 (12:25 +0900)
Src/Common/MessageBoxDialog.cpp
Src/DirCmpReport.cpp
Src/Exceptions.h
Src/MergeEditView.cpp
Src/diffutils/src/CMP.C

index 7bf2c16..9d7774b 100644 (file)
@@ -804,7 +804,7 @@ void CMessageBoxDialog::OnTimer ( UINT_PTR nIDEvent )
                                {
                                        // Add the remaining seconds to the text of the button.
                                        TCHAR szTimeoutSeconds[40];
-                                       wsprintf(szTimeoutSeconds, _T(" = %d"), m_nTimeoutSeconds);
+                                       wsprintf(szTimeoutSeconds, _T(" = %u"), m_nTimeoutSeconds);
                                        strButtonText += szTimeoutSeconds;
                                }
                                // Set the text of the button.
index 5be4434..1751078 100644 (file)
@@ -165,8 +165,10 @@ bool DirCmpReport::GenerateReport(String &errStr)
                                DWORD size = GetLength32(file);
                                // Rewrite CF_HTML header with valid offsets
                                file.SeekToBegin();
-                               wsprintfA(buffer, header, cbHeader, size - 1,
-                                       cbHeader + sizeof start - 1, size - sizeof end + 1);
+                               wsprintfA(buffer, header, cbHeader, 
+                                       static_cast<int>(size - 1),
+                                       static_cast<int>(cbHeader + sizeof start - 1),
+                                       static_cast<int>(size - sizeof end + 1));
                                file.Write(buffer, cbHeader);
                                SetClipboardData(CF_HTML, GlobalReAlloc(file.Detach(), size, 0));
                        }
index d14ed89..9ae5e9f 100644 (file)
@@ -93,7 +93,7 @@ public:
        virtual bool GetErrorMessage( TCHAR *lpszError, unsigned nMaxError, unsigned *pnHelpContext = NULL )
        {
                static TCHAR message[512];
-               _sntprintf(message, sizeof(message)/sizeof(message[0]), _T("Exception %s (0x%.8x)"), getSeMessage(), getSeNumber());
+               _sntprintf(message, sizeof(message)/sizeof(message[0]), _T("Exception %s (0x%.8x)"), getSeMessage(), static_cast<unsigned>(getSeNumber()));
                StringCchCopy(lpszError, nMaxError, message);
                return true;
        }
index c9d8903..117c070 100644 (file)
@@ -3245,7 +3245,7 @@ void CMergeEditView::OnEditCopyLineNumbers()
        GetSelection(ptStart, ptEnd);
 
        // Get last selected line (having widest linenumber)
-       UINT line = pDoc->m_ptBuf[m_nThisPane]->ComputeRealLine(ptEnd.y);
+       int line = pDoc->m_ptBuf[m_nThisPane]->ComputeRealLine(ptEnd.y);
        size_t nNumWidth = string_to_str(line + 1).length();
        
        for (int i = ptStart.y; i <= ptEnd.y; i++)
index 7aae42d..5046058 100644 (file)
@@ -336,7 +336,7 @@ cmp ()
                    {
                      if (opt_print_chars)
                        {
-                         printf ("%6lu %3o ", char_number, c0);
+                         printf ("%6lu %3o ", (unsigned long)char_number, c0);
                          printc (4, c0);
                          printf (" %3o ", c1);
                          printc (0, c1);