mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-01 17:35:34 -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,8 +304,9 @@ do_get(const string &key, const string &name, int &data_type, string &data,
|
||||
if (data_type == REG_SZ ||
|
||||
data_type == REG_MULTI_SZ ||
|
||||
data_type == REG_EXPAND_SZ) {
|
||||
// Eliminate the trailing null character.
|
||||
buffer_size--;
|
||||
// Eliminate the trailing null character for non-zero lengths.
|
||||
if (buffer_size > 0) // if zero, leave it
|
||||
buffer_size--;
|
||||
}
|
||||
data = string(init_buffer, buffer_size);
|
||||
|
||||
@ -325,8 +326,9 @@ do_get(const string &key, const string &name, int &data_type, string &data,
|
||||
if (data_type == REG_SZ ||
|
||||
data_type == REG_MULTI_SZ ||
|
||||
data_type == REG_EXPAND_SZ) {
|
||||
// Eliminate the trailing null character.
|
||||
buffer_size--;
|
||||
// Eliminate the trailing null character for non-zero lengths.
|
||||
if (buffer_size > 0) // if zero, leave it
|
||||
buffer_size--;
|
||||
}
|
||||
data = string(new_buffer, buffer_size);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user