mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 02:15:43 -04:00
don't decrement zero-length REG_*SZ strings passed back from the registry
This commit is contained in:
parent
c4b12b18cb
commit
543a6a3a7e
@ -304,7 +304,8 @@ do_get(const string &key, const string &name, int &data_type, string &data,
|
|||||||
if (data_type == REG_SZ ||
|
if (data_type == REG_SZ ||
|
||||||
data_type == REG_MULTI_SZ ||
|
data_type == REG_MULTI_SZ ||
|
||||||
data_type == REG_EXPAND_SZ) {
|
data_type == REG_EXPAND_SZ) {
|
||||||
// Eliminate the trailing null character.
|
// Eliminate the trailing null character for non-zero lengths.
|
||||||
|
if (buffer_size > 0) // if zero, leave it
|
||||||
buffer_size--;
|
buffer_size--;
|
||||||
}
|
}
|
||||||
data = string(init_buffer, buffer_size);
|
data = string(init_buffer, buffer_size);
|
||||||
@ -325,7 +326,8 @@ do_get(const string &key, const string &name, int &data_type, string &data,
|
|||||||
if (data_type == REG_SZ ||
|
if (data_type == REG_SZ ||
|
||||||
data_type == REG_MULTI_SZ ||
|
data_type == REG_MULTI_SZ ||
|
||||||
data_type == REG_EXPAND_SZ) {
|
data_type == REG_EXPAND_SZ) {
|
||||||
// Eliminate the trailing null character.
|
// Eliminate the trailing null character for non-zero lengths.
|
||||||
|
if (buffer_size > 0) // if zero, leave it
|
||||||
buffer_size--;
|
buffer_size--;
|
||||||
}
|
}
|
||||||
data = string(new_buffer, buffer_size);
|
data = string(new_buffer, buffer_size);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user