Another attempt to suppress MSVC C4245
https://github.com/upx/upx/issues/435 modified: pefile.cpp
This commit is contained in:
committed by
Markus F.X.J. Oberhumer
parent
052392d97b
commit
6cad27896f
+20
-6
@@ -2247,10 +2247,26 @@ void PeFile::pack0(OutputFile *fo, ht &ih, ht &oh,
|
||||
|
||||
if (ih.dllflags & IMAGE_DLL_CHARACTERISTICS_FORCE_INTEGRITY)
|
||||
{
|
||||
if (opt->force)
|
||||
ih.dllflags &= ~IMAGE_DLL_CHARACTERISTICS_FORCE_INTEGRITY;
|
||||
else
|
||||
if (opt->force) {
|
||||
#if defined(_MSVC_LANG) //{
|
||||
#pragma warning( push )
|
||||
#pragma warning( suppress: 4245 )
|
||||
// MSVC bug
|
||||
// pefile.cpp(3114): note: see reference to function template instantiation 'void PeFile::pack0<LE32,PeFile32::pe_header_t>(OutputFile *,ht &,ht &,unsigned int,upx_uint64_t,bool)' being compiled
|
||||
// with
|
||||
// [
|
||||
// ht=PeFile32::pe_header_t
|
||||
// ]
|
||||
// pefile.cpp(2251): warning C4245: 'argument': conversion from 'int' to 'unsigned int', signed/unsigned mismatch
|
||||
#endif //}
|
||||
ih.dllflags &= ~IMAGE_DLL_CHARACTERISTICS_FORCE_INTEGRITY;
|
||||
#if defined(_MSVC_LANG) //{
|
||||
#pragma warning( pop )
|
||||
#endif //}
|
||||
}
|
||||
else {
|
||||
throwCantPack("image forces integrity check (use --force to remove)");
|
||||
}
|
||||
}
|
||||
checkHeaderValues(ih.subsystem, subsystem_mask, ih.entry, ih.filealign);
|
||||
|
||||
@@ -3110,9 +3126,7 @@ void PeFile32::pack0(OutputFile *fo, unsigned subsystem_mask,
|
||||
upx_uint64_t default_imagebase,
|
||||
bool last_section_rsrc_only)
|
||||
{
|
||||
// Redundant cast of subsystem_mask tries to workaround
|
||||
// MSVC complaint C4245 signed/unsigned mismatch
|
||||
super::pack0<LE32>(fo, ih, oh, (unsigned)subsystem_mask,
|
||||
super::pack0<LE32>(fo, ih, oh, subsystem_mask,
|
||||
default_imagebase, last_section_rsrc_only);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user