Fix potential sign issue.
Signed-off-by: Andrea Odetti <mariofutire@gmail.com>
This commit is contained in:
parent
e8bcb72771
commit
6e872d4bf1
2 changed files with 6 additions and 3 deletions
|
@ -145,7 +145,10 @@ namespace common2
|
|||
DWORD value;
|
||||
if (RegLoadValue(path.c_str(), name, TRUE, &value))
|
||||
{
|
||||
dest = value;
|
||||
// DWORD and int have the same size
|
||||
// but if they did not, this would be necessary
|
||||
typedef std::make_signed<DWORD>::type signed_t;
|
||||
dest = static_cast<signed_t>(value);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -161,9 +164,9 @@ namespace common2
|
|||
const std::string path = section + "\\geometry";
|
||||
const auto saveValue = [&path](const char * name, const int source)
|
||||
{
|
||||
// this seems to already do the right thing for negative numbers
|
||||
RegSaveValue(path.c_str(), name, TRUE, source);
|
||||
};
|
||||
|
||||
saveValue("width", geometry.width);
|
||||
saveValue("height", geometry.height);
|
||||
saveValue("x", geometry.x);
|
||||
|
|
|
@ -79,4 +79,4 @@ RegistryContext::RegistryContext(const std::shared_ptr<Registry> & registry)
|
|||
RegistryContext::~RegistryContext()
|
||||
{
|
||||
Registry::instance.reset();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue