Print error when ExeHeadStringList::find is unable to convert to narrow string
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6449 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
41f1f8b504
commit
dce2f551ac
2 changed files with 12 additions and 2 deletions
|
@ -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 @@ unsigned int ExeHeadStringList::find(const void *ptr, unsigned int cchF, WORD co
|
|||
{
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -143,13 +143,13 @@ public:
|
|||
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
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue