VC6 cannot handle template class typedef of a template class with the same name (in a different namespace)

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@7047 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
anders_k 2018-11-07 16:58:43 +00:00
parent 3c6821f214
commit 5b09b32668
9 changed files with 10 additions and 22 deletions

View file

@ -1334,4 +1334,3 @@ void SetCompressor(NCOMPRESSOR compressor)
ResetObjects(); ResetObjects();
} }
} }

View file

@ -35,13 +35,7 @@ struct group
TCHAR *name; TCHAR *name;
}; };
// Jim Park: Moved this array from inside the func to the outside. While it static const struct group groups[] =
// was probably "safe" for this array to be inside because the strings are in
// the .data section and so the pointer to the string returned is probably
// safe, this is a bad practice to have as that's making an assumption on what
// the compiler will do. Besides which, other types of data returned would
// actually fail as the local vars would be popped off the stack.
struct group groups[] =
{ {
{DOMAIN_ALIAS_RID_USERS, _T("User")}, {DOMAIN_ALIAS_RID_USERS, _T("User")},
// every user belongs to the users group, hence users come before guests // every user belongs to the users group, hence users come before guests

View file

@ -1097,9 +1097,9 @@ FORCEINLINE BOOL NoDepr_GetVersionExW(OSVERSIONINFOW*p) { __pragma(warning(push)
#ifdef __cplusplus #ifdef __cplusplus
namespace STLHelpers namespace STL
{ {
template<class M> struct mapped_type_helper { typedef typename M::value_type::second_type type; }; // VC6 uses referent_type and not mapped_type template<class M> struct mapped_type { typedef typename M::value_type::second_type type; }; // VC6 uses referent_type and not mapped_type
} }
#endif //~ __cplusplus #endif //~ __cplusplus

View file

@ -266,7 +266,7 @@ bool Plugins::IsPluginCallSyntax(const tstring& token)
struct PrintPluginDirsHelper { struct PrintPluginDirsHelper {
template<class C> static void print(const C&c, const char*indent = "") template<class C> static void print(const C&c, const char*indent = "")
{ {
std::/*unordered_*/set<typename STLHelpers::mapped_type_helper<C>::type std::/*unordered_*/set<NSIS_CXX_TYPENAME STL::mapped_type<C>::type
#ifdef _WIN32 #ifdef _WIN32
, Plugins::strnocasecmp , Plugins::strnocasecmp
#endif #endif

View file

@ -22,7 +22,7 @@
#include <set> #include <set>
#include "tstring.h" #include "tstring.h"
namespace STLHelpers namespace STL
{ {
template<class S, class C> template<class S, class C>
struct string_nocasecmpless : std::binary_function<S, S, bool> struct string_nocasecmpless : std::binary_function<S, S, bool>
@ -44,7 +44,7 @@ namespace STLHelpers
class Plugins class Plugins
{ {
public: public:
typedef STLHelpers::string_nocasecmpless<tstring, tstring::value_type> strnocasecmp; typedef STL::string_nocasecmpless<tstring, tstring::value_type> strnocasecmp;
Plugins() : m_initialized(false) {} Plugins() : m_initialized(false) {}

View file

@ -170,14 +170,13 @@ namespace MakensisAPI {
#define FLAG_OFFSET(flag) (FIELD_OFFSET(exec_flags_t, flag)/sizeof(int)) #define FLAG_OFFSET(flag) (FIELD_OFFSET(exec_flags_t, flag)/sizeof(int))
class DiagState { class DiagState {
template<class M> struct mapped_type_helper { typedef typename STLHelpers::mapped_type_helper<M>::type type; };
template<class C, class K, class V> void insert_or_assign(C&c, const K&k, V val) template<class C, class K, class V> void insert_or_assign(C&c, const K&k, V val)
{ {
typename C::value_type item(k, val); typename C::value_type item(k, val);
std::pair<NSIS_CXX_TYPENAME C::iterator, bool> ret = c.insert(item); std::pair<NSIS_CXX_TYPENAME C::iterator, bool> ret = c.insert(item);
if (!ret.second) ret.first->second = val; if (!ret.second) ret.first->second = val;
} }
template<class C, class K> typename mapped_type_helper<C>::type get_paired_value(const C&c, const K&k, typename mapped_type_helper<C>::type defval) const template<class C, class K> typename STL::mapped_type<C>::type get_paired_value(const C&c, const K&k, typename STL::mapped_type<C>::type defval) const
{ {
typename C::const_iterator it = c.find(k); typename C::const_iterator it = c.find(k);
return c.end() == it ? defval : it->second; return c.end() == it ? defval : it->second;

View file

@ -2291,19 +2291,15 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
{ {
manifest_sosl.deleteall(); manifest_sosl.deleteall();
if (2 == line.getnumtokens()) if (2 == line.getnumtokens())
{
switch(line.gettoken_enum(1,_T("none\0all\0"))) switch(line.gettoken_enum(1,_T("none\0all\0")))
{ {
case 0: return PS_OK; case 0: return PS_OK;
case 1: return manifest_sosl.addall() ? PS_OK : PS_ERROR; case 1: return manifest_sosl.addall() ? PS_OK : PS_ERROR;
} }
}
for(int argi = 1; argi < line.getnumtokens(); ++argi) for(int argi = 1; argi < line.getnumtokens(); ++argi)
{
if (!manifest_sosl.append(line.gettoken_str(argi))) if (!manifest_sosl.append(line.gettoken_str(argi)))
PRINTHELP(); PRINTHELP();
} }
}
return PS_OK; return PS_OK;
case TOK_MANIFEST_DISABLEWINDOWFILTERING: case TOK_MANIFEST_DISABLEWINDOWFILTERING:
switch(line.gettoken_enum(1,_T("notset\0false\0true"))) switch(line.gettoken_enum(1,_T("notset\0false\0true")))

View file

@ -1010,8 +1010,8 @@ int CEXEBuild::pp_define(LineParser&line)
int CEXEBuild::pp_undef(LineParser&line) int CEXEBuild::pp_undef(LineParser&line)
{ {
UINT noerr = false, stopswitch = false, ti = 1, handled = 0; UINT noerr = false, stopswitch = false, handled = 0;
for (; ti < line.getnumtokens(); ++ti) for (int ti = 1; ti < line.getnumtokens(); ++ti)
{ {
const TCHAR *name = line.gettoken_str(ti); const TCHAR *name = line.gettoken_str(ti);
if (!stopswitch && !_tcsicmp(name, _T("/noerrors"))) if (!stopswitch && !_tcsicmp(name, _T("/noerrors")))