Use size_t for lengths in stream objects
Provides safety against them accidentally becoming negative because of bugs in the calculations. Also does the same to CharArray and friends as they were strongly connection to the stream objects.
This commit is contained in:
committed by
Lauri Kasanen
parent
346fccb96c
commit
259f1055cb
@@ -146,7 +146,7 @@ void RegKey::setString(const TCHAR* valname, const TCHAR* value) const {
|
||||
if (result != ERROR_SUCCESS) throw rdr::SystemException("setString", result);
|
||||
}
|
||||
|
||||
void RegKey::setBinary(const TCHAR* valname, const void* value, int length) const {
|
||||
void RegKey::setBinary(const TCHAR* valname, const void* value, size_t length) const {
|
||||
LONG result = RegSetValueEx(key, valname, 0, REG_BINARY, (const BYTE*)value, length);
|
||||
if (result != ERROR_SUCCESS) throw rdr::SystemException("setBinary", result);
|
||||
}
|
||||
@@ -169,12 +169,12 @@ TCHAR* RegKey::getString(const TCHAR* valname, const TCHAR* def) const {
|
||||
}
|
||||
}
|
||||
|
||||
void RegKey::getBinary(const TCHAR* valname, void** data, int* length) const {
|
||||
void RegKey::getBinary(const TCHAR* valname, void** data, size_t* length) const {
|
||||
TCharArray hex(getRepresentation(valname));
|
||||
if (!rdr::HexInStream::hexStrToBin(CStr(hex.buf), (char**)data, length))
|
||||
throw rdr::Exception("getBinary failed");
|
||||
}
|
||||
void RegKey::getBinary(const TCHAR* valname, void** data, int* length, void* def, int deflen) const {
|
||||
void RegKey::getBinary(const TCHAR* valname, void** data, size_t* length, void* def, size_t deflen) const {
|
||||
try {
|
||||
getBinary(valname, data, length);
|
||||
} catch(rdr::Exception&) {
|
||||
|
||||
Reference in New Issue
Block a user