[prev in list] [next in list] [prev in thread] [next in thread] 

List:       nsis-commits
Subject:    [NSIS-commits] SF.net SVN: nsis:[6449] NSIS/trunk/Source
From:       anders_k () users ! sourceforge ! net
Date:       2014-03-09 23:04:52
Message-ID: E1WMmm7-0008Rw-JE () sfs-ml-2 ! v29 ! ch3 ! sourceforge ! com
[Download RAW message or body]

Revision: 6449
          http://sourceforge.net/p/nsis/code/6449
Author:   anders_k
Date:     2014-03-09 23:04:51 +0000 (Sun, 09 Mar 2014)
Log Message:
-----------
Print error when ExeHeadStringList::find is unable to convert to narrow string

Modified Paths:
--------------
    NSIS/trunk/Source/strlist.cpp
    NSIS/trunk/Source/strlist.h

Modified: NSIS/trunk/Source/strlist.cpp
===================================================================
--- NSIS/trunk/Source/strlist.cpp	2014-03-06 17:26:49 UTC (rev 6448)
+++ NSIS/trunk/Source/strlist.cpp	2014-03-09 23:04:51 UTC (rev 6449)
@@ -18,6 +18,9 @@
 
 #include "strlist.h"
 #include "utf.h"
+#ifndef NDEBUG
+#include "util.h" // For PrintColorFmtMsg_ERR
+#endif
 
 #ifdef _UNICODE
 char* convert_processed_string_to_ansi(char *out, const TCHAR *in, WORD codepage); \
// defined in build.cpp @@ -120,6 +123,13 @@
     {
       cbMB = WideCharToMultiByte(codepage,0,find,cchF,bufMB,cbF,0,0);
     }
+#ifndef NDEBUG
+    if (!cbMB)
+    {
+      const TCHAR *fmt = _T("Unable to convert%")NPRINs _T(" string \"%")NPRIs \
_T("\" to codepage %u\n"); +      PrintColorFmtMsg_ERR(fmt,(processed ? " processed" \
: ""),find,codepage); +    }
+#endif
     assert(cbMB);
     cbF = cbMB, find = (const wchar_t*) bufMB;
   }

Modified: NSIS/trunk/Source/strlist.h
===================================================================
--- NSIS/trunk/Source/strlist.h	2014-03-06 17:26:49 UTC (rev 6448)
+++ NSIS/trunk/Source/strlist.h	2014-03-09 23:04:51 UTC (rev 6449)
@@ -143,13 +143,13 @@
   bool get(unsigned int offset, tstring&str) const;
   unsigned int getnum() const;
   unsigned int gettotalsize() const { return m_gr.get() ? m_gr.getlen() : (m_wide ? \
                2 : 1); }
-  void* getstorageptr() const { return m_gr.get() ? m_gr.get() : (void*)L""; }
+  const void* getstorageptr() const { return m_gr.get() ? m_gr.get() : (void*)L""; }
 
 protected:
   unsigned int find(const void *str, unsigned int cchF, WORD codepage, bool \
processed, char**ppBufMB) const;  
   GrowBuf m_gr;
-  bool m_wide;
+  bool m_wide; // Are we storing wide or narrow strings
   enum {WIDEDIV=2}; // ExeHead expects us to provide offsets this way, also helps \
UTF16 offsets for shell constants to fit in < 0xFF  };
 

This was sent by the SourceForge.net collaborative development platform, the world's \
largest Open Source development site.


------------------------------------------------------------------------------
Subversion Kills Productivity. Get off Subversion & Make the Move to Perforce.
With Perforce, you get hassle-free workflows. Merge that actually works. 
Faster operations. Version large binaries.  Built-in WAN optimization and the
freedom to use Git, Perforce or both. Make the move to Perforce.
http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk
_______________________________________________
NSIS-commits mailing list
NSIS-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nsis-commits


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic