better handling of dconfig/new interface interactions

This commit is contained in:
David Rose 2004-12-29 15:11:17 +00:00
parent 8c5f9f0219
commit 638fad7bf6

View File

@ -118,15 +118,26 @@ set_value_type(ConfigVariableCore::ValueType value_type) {
// Description: Specifies the trust level of this variable. See // Description: Specifies the trust level of this variable. See
// get_flags(). It is not an error to call this // get_flags(). It is not an error to call this
// multiple times, but if the value changes once // multiple times, but if the value changes once
// get_declaration() has been called, a warning is printed. // get_declaration() has been called, a warning is
// printed.
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
void ConfigVariableCore:: void ConfigVariableCore::
set_flags(int flags) { set_flags(int flags) {
if (_value_queried && _flags != flags) { if (_value_queried) {
prc_cat->warning() int bits_changed = (_flags ^ flags);
<< "changing trust level for ConfigVariable " if ((bits_changed & F_trust_level_mask) != 0) {
<< get_name() << " from " << _flags << " to " prc_cat->warning()
<< flags << ".\n"; << "changing trust level for ConfigVariable "
<< get_name() << " from " << (_flags & F_trust_level_mask) << " to "
<< (flags & F_trust_level_mask) << ".\n";
}
if ((bits_changed & ~(F_trust_level_mask | F_dconfig)) != 0) {
prc_cat->warning()
<< "changing flags for ConfigVariable "
<< get_name() << " from " << hex
<< (_flags & ~F_trust_level_mask) << " to "
<< (flags & ~F_trust_level_mask) << dec << ".\n";
}
} }
_flags = flags; _flags = flags;
@ -153,6 +164,15 @@ set_description(const string &description) {
// older DConfig interface. // older DConfig interface.
return; return;
} }
if (description == "DConfig") {
// As a similar exception, we don't replace an existing
// description with one that reads simply "DConfig", unless it
// was empty previously.
if (_description.empty()) {
_description = description;
}
return;
}
prc_cat->warning() prc_cat->warning()
<< "changing description for ConfigVariable " << "changing description for ConfigVariable "