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:
anders_k 2014-03-09 23:04:51 +00:00
parent 41f1f8b504
commit dce2f551ac
2 changed files with 12 additions and 2 deletions

View file

@ -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;
}