protect debug statements

This commit is contained in:
David Rose 2006-03-21 01:42:53 +00:00
parent 59eaa16056
commit e79df2bfcc
4 changed files with 100 additions and 52 deletions

View File

@ -832,21 +832,23 @@ load_client_certificate() {
sev = NS_info; sev = NS_info;
source = _client_certificate_filename; source = _client_certificate_filename;
} }
if (_client_certificate_priv != (EVP_PKEY *)NULL && if (downloader_cat.is_on(sev)) {
_client_certificate_pub != (X509 *)NULL) { if (_client_certificate_priv != (EVP_PKEY *)NULL &&
downloader_cat.out(sev) _client_certificate_pub != (X509 *)NULL) {
<< "Read client certificate from " << source << "\n"; downloader_cat.out(sev)
<< "Read client certificate from " << source << "\n";
} else {
if (_client_certificate_priv == (EVP_PKEY *)NULL) { } else {
downloader_cat.out(sev) if (_client_certificate_priv == (EVP_PKEY *)NULL) {
<< "Could not read private key from " << source << "\n"; downloader_cat.out(sev)
} << "Could not read private key from " << source << "\n";
}
if (_client_certificate_pub == (X509 *)NULL) {
downloader_cat.out(sev) if (_client_certificate_pub == (X509 *)NULL) {
<< "Could not read public key from " << source << "\n"; downloader_cat.out(sev)
<< "Could not read public key from " << source << "\n";
}
} }
} }
} }

View File

@ -533,8 +533,10 @@ try_for_fbconfig(int framebuffer_mode,
int attrib_list[max_attrib_list]; int attrib_list[max_attrib_list];
int n=0; int n=0;
glxdisplay_cat.debug() if (glxdisplay_cat.is_debug()) {
<< "Trying for fbconfig with: RGB(" << want_color_bits << ")"; glxdisplay_cat.debug()
<< "Trying for fbconfig with: RGB(" << want_color_bits << ")";
}
int want_color_component_bits = max(want_color_bits / 3, 1); int want_color_component_bits = max(want_color_bits / 3, 1);
@ -546,28 +548,36 @@ try_for_fbconfig(int framebuffer_mode,
attrib_list[n++] = want_color_component_bits; attrib_list[n++] = want_color_component_bits;
if (framebuffer_mode & FrameBufferProperties::FM_alpha) { if (framebuffer_mode & FrameBufferProperties::FM_alpha) {
glxdisplay_cat.debug(false) << " ALPHA(" << want_alpha_bits << ")"; if (glxdisplay_cat.is_debug()) {
glxdisplay_cat.debug(false) << " ALPHA(" << want_alpha_bits << ")";
}
attrib_list[n++] = GLX_ALPHA_SIZE; attrib_list[n++] = GLX_ALPHA_SIZE;
attrib_list[n++] = want_alpha_bits; attrib_list[n++] = want_alpha_bits;
} }
switch (framebuffer_mode & FrameBufferProperties::FM_buffer) { switch (framebuffer_mode & FrameBufferProperties::FM_buffer) {
case FrameBufferProperties::FM_single_buffer: case FrameBufferProperties::FM_single_buffer:
glxdisplay_cat.debug(false) << " SINGLEBUFFER"; if (glxdisplay_cat.is_debug()) {
glxdisplay_cat.debug(false) << " SINGLEBUFFER";
}
attrib_list[n++] = GLX_DOUBLEBUFFER; attrib_list[n++] = GLX_DOUBLEBUFFER;
attrib_list[n++] = false; attrib_list[n++] = false;
break; break;
case FrameBufferProperties::FM_double_buffer: case FrameBufferProperties::FM_double_buffer:
case FrameBufferProperties::FM_triple_buffer: case FrameBufferProperties::FM_triple_buffer:
glxdisplay_cat.debug(false) << " DOUBLEBUFFER"; if (glxdisplay_cat.is_debug()) {
glxdisplay_cat.debug(false) << " DOUBLEBUFFER";
}
attrib_list[n++] = GLX_DOUBLEBUFFER; attrib_list[n++] = GLX_DOUBLEBUFFER;
attrib_list[n++] = true; attrib_list[n++] = true;
break; break;
} }
if (framebuffer_mode & FrameBufferProperties::FM_stereo) { if (framebuffer_mode & FrameBufferProperties::FM_stereo) {
glxdisplay_cat.debug(false) << " STEREO"; if (glxdisplay_cat.is_debug()) {
glxdisplay_cat.debug(false) << " STEREO";
}
attrib_list[n++] = GLX_STEREO; attrib_list[n++] = GLX_STEREO;
attrib_list[n++] = true; attrib_list[n++] = true;
} else { } else {
@ -576,19 +586,25 @@ try_for_fbconfig(int framebuffer_mode,
} }
if (framebuffer_mode & FrameBufferProperties::FM_depth) { if (framebuffer_mode & FrameBufferProperties::FM_depth) {
glxdisplay_cat.debug(false) << " DEPTH(" << want_depth_bits << ")"; if (glxdisplay_cat.is_debug()) {
glxdisplay_cat.debug(false) << " DEPTH(" << want_depth_bits << ")";
}
attrib_list[n++] = GLX_DEPTH_SIZE; attrib_list[n++] = GLX_DEPTH_SIZE;
attrib_list[n++] = want_depth_bits; attrib_list[n++] = want_depth_bits;
} }
if (framebuffer_mode & FrameBufferProperties::FM_stencil) { if (framebuffer_mode & FrameBufferProperties::FM_stencil) {
glxdisplay_cat.debug(false) << " STENCIL(" << want_stencil_bits << ")"; if (glxdisplay_cat.is_debug()) {
glxdisplay_cat.debug(false) << " STENCIL(" << want_stencil_bits << ")";
}
attrib_list[n++] = GLX_STENCIL_SIZE; attrib_list[n++] = GLX_STENCIL_SIZE;
attrib_list[n++] = want_stencil_bits; attrib_list[n++] = want_stencil_bits;
} }
if (framebuffer_mode & FrameBufferProperties::FM_accum) { if (framebuffer_mode & FrameBufferProperties::FM_accum) {
glxdisplay_cat.debug(false) << " ACCUM"; if (glxdisplay_cat.is_debug()) {
glxdisplay_cat.debug(false) << " ACCUM";
}
attrib_list[n++] = GLX_ACCUM_RED_SIZE; attrib_list[n++] = GLX_ACCUM_RED_SIZE;
attrib_list[n++] = want_color_component_bits; attrib_list[n++] = want_color_component_bits;
attrib_list[n++] = GLX_ACCUM_GREEN_SIZE; attrib_list[n++] = GLX_ACCUM_GREEN_SIZE;
@ -602,7 +618,9 @@ try_for_fbconfig(int framebuffer_mode,
} }
if (framebuffer_mode & FrameBufferProperties::FM_multisample) { if (framebuffer_mode & FrameBufferProperties::FM_multisample) {
glxdisplay_cat.debug(false) << " MULTISAMPLE(" << want_multisamples << ")"; if (glxdisplay_cat.is_debug()) {
glxdisplay_cat.debug(false) << " MULTISAMPLE(" << want_multisamples << ")";
}
attrib_list[n++] = GLX_SAMPLE_BUFFERS; attrib_list[n++] = GLX_SAMPLE_BUFFERS;
attrib_list[n++] = 1; attrib_list[n++] = 1;
attrib_list[n++] = GLX_SAMPLES; attrib_list[n++] = GLX_SAMPLES;
@ -838,8 +856,10 @@ try_for_visual(int framebuffer_mode,
int attrib_list[max_attrib_list]; int attrib_list[max_attrib_list];
int n=0; int n=0;
glxdisplay_cat.debug() if (glxdisplay_cat.is_debug()) {
<< "Trying for visual with: RGB(" << want_color_bits << ")"; glxdisplay_cat.debug()
<< "Trying for visual with: RGB(" << want_color_bits << ")";
}
int want_color_component_bits = max(want_color_bits / 3, 1); int want_color_component_bits = max(want_color_bits / 3, 1);
@ -852,30 +872,42 @@ try_for_visual(int framebuffer_mode,
attrib_list[n++] = want_color_component_bits; attrib_list[n++] = want_color_component_bits;
if (framebuffer_mode & FrameBufferProperties::FM_alpha) { if (framebuffer_mode & FrameBufferProperties::FM_alpha) {
glxdisplay_cat.debug(false) << " ALPHA(" << want_alpha_bits << ")"; if (glxdisplay_cat.is_debug()) {
glxdisplay_cat.debug(false) << " ALPHA(" << want_alpha_bits << ")";
}
attrib_list[n++] = GLX_ALPHA_SIZE; attrib_list[n++] = GLX_ALPHA_SIZE;
attrib_list[n++] = want_alpha_bits; attrib_list[n++] = want_alpha_bits;
} }
if (framebuffer_mode & FrameBufferProperties::FM_double_buffer) { if (framebuffer_mode & FrameBufferProperties::FM_double_buffer) {
glxdisplay_cat.debug(false) << " DOUBLEBUFFER"; if (glxdisplay_cat.is_debug()) {
glxdisplay_cat.debug(false) << " DOUBLEBUFFER";
}
attrib_list[n++] = GLX_DOUBLEBUFFER; attrib_list[n++] = GLX_DOUBLEBUFFER;
} }
if (framebuffer_mode & FrameBufferProperties::FM_stereo) { if (framebuffer_mode & FrameBufferProperties::FM_stereo) {
glxdisplay_cat.debug(false) << " STEREO"; if (glxdisplay_cat.is_debug()) {
glxdisplay_cat.debug(false) << " STEREO";
}
attrib_list[n++] = GLX_STEREO; attrib_list[n++] = GLX_STEREO;
} }
if (framebuffer_mode & FrameBufferProperties::FM_depth) { if (framebuffer_mode & FrameBufferProperties::FM_depth) {
glxdisplay_cat.debug(false) << " DEPTH(" << want_depth_bits << ")"; if (glxdisplay_cat.is_debug()) {
glxdisplay_cat.debug(false) << " DEPTH(" << want_depth_bits << ")";
}
attrib_list[n++] = GLX_DEPTH_SIZE; attrib_list[n++] = GLX_DEPTH_SIZE;
attrib_list[n++] = want_depth_bits; attrib_list[n++] = want_depth_bits;
} }
if (framebuffer_mode & FrameBufferProperties::FM_stencil) { if (framebuffer_mode & FrameBufferProperties::FM_stencil) {
glxdisplay_cat.debug(false) << " STENCIL(" << want_stencil_bits << ")"; if (glxdisplay_cat.is_debug()) {
glxdisplay_cat.debug(false) << " STENCIL(" << want_stencil_bits << ")";
}
attrib_list[n++] = GLX_STENCIL_SIZE; attrib_list[n++] = GLX_STENCIL_SIZE;
attrib_list[n++] = want_stencil_bits; attrib_list[n++] = want_stencil_bits;
} }
if (framebuffer_mode & FrameBufferProperties::FM_accum) { if (framebuffer_mode & FrameBufferProperties::FM_accum) {
glxdisplay_cat.debug(false) << " ACCUM"; if (glxdisplay_cat.is_debug()) {
glxdisplay_cat.debug(false) << " ACCUM";
}
attrib_list[n++] = GLX_ACCUM_RED_SIZE; attrib_list[n++] = GLX_ACCUM_RED_SIZE;
attrib_list[n++] = want_color_component_bits; attrib_list[n++] = want_color_component_bits;
attrib_list[n++] = GLX_ACCUM_GREEN_SIZE; attrib_list[n++] = GLX_ACCUM_GREEN_SIZE;
@ -888,7 +920,9 @@ try_for_visual(int framebuffer_mode,
} }
} }
if (framebuffer_mode & FrameBufferProperties::FM_multisample) { if (framebuffer_mode & FrameBufferProperties::FM_multisample) {
glxdisplay_cat.debug(false) << " MULTISAMPLE(" << want_multisamples << ")"; if (glxdisplay_cat.is_debug()) {
glxdisplay_cat.debug(false) << " MULTISAMPLE(" << want_multisamples << ")";
}
attrib_list[n++] = GLX_SAMPLES; attrib_list[n++] = GLX_SAMPLES;
attrib_list[n++] = want_multisamples; attrib_list[n++] = want_multisamples;
} }

View File

@ -192,9 +192,11 @@ query_gl_version() {
// We output to glgsg_cat instead of glxdisplay_cat, since this is // We output to glgsg_cat instead of glxdisplay_cat, since this is
// where the GL version has been output, and it's nice to see the // where the GL version has been output, and it's nice to see the
// two of these together. // two of these together.
glgsg_cat.debug() if (glgsg_cat.is_debug()) {
<< "GLX_VERSION = " << _glx_version_major << "." << _glx_version_minor glgsg_cat.debug()
<< "\n"; << "GLX_VERSION = " << _glx_version_major << "." << _glx_version_minor
<< "\n";
}
} }
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////

View File

@ -55,9 +55,11 @@ void LoaderFileTypeRegistry::
register_type(LoaderFileType *type) { register_type(LoaderFileType *type) {
// Make sure we haven't already registered this type. // Make sure we haven't already registered this type.
if (find(_types.begin(), _types.end(), type) != _types.end()) { if (find(_types.begin(), _types.end(), type) != _types.end()) {
loader_cat->debug() if (loader_cat->is_debug()) {
<< "Attempt to register LoaderFileType " << type->get_name() loader_cat->debug()
<< " (" << type->get_type() << ") more than once.\n"; << "Attempt to register LoaderFileType " << type->get_name()
<< " (" << type->get_type() << ") more than once.\n";
}
return; return;
} }
@ -92,9 +94,11 @@ register_deferred_type(const string &extension, const string &library) {
if (ei != _extensions.end()) { if (ei != _extensions.end()) {
// We already have a loader for this type; no need to register // We already have a loader for this type; no need to register
// another one. // another one.
loader_cat->debug() if (loader_cat->is_debug()) {
<< "Attempt to register loader library " << library loader_cat->debug()
<< " (" << dcextension << ") when extension is already known.\n"; << "Attempt to register loader library " << library
<< " (" << dcextension << ") when extension is already known.\n";
}
return; return;
} }
@ -102,14 +106,18 @@ register_deferred_type(const string &extension, const string &library) {
di = _deferred_types.find(dcextension); di = _deferred_types.find(dcextension);
if (di != _deferred_types.end()) { if (di != _deferred_types.end()) {
if ((*di).second == library) { if ((*di).second == library) {
loader_cat->debug() if (loader_cat->is_debug()) {
<< "Attempt to register loader library " << library loader_cat->debug()
<< " (" << dcextension << ") more than once.\n"; << "Attempt to register loader library " << library
<< " (" << dcextension << ") more than once.\n";
}
return; return;
} else { } else {
loader_cat->debug() if (loader_cat->is_debug()) {
<< "Multiple libraries registered that use the extension " loader_cat->debug()
<< dcextension << "\n"; << "Multiple libraries registered that use the extension "
<< dcextension << "\n";
}
} }
} }
@ -246,9 +254,11 @@ record_extension(const string &extension, LoaderFileType *type) {
Extensions::const_iterator ei; Extensions::const_iterator ei;
ei = _extensions.find(dcextension); ei = _extensions.find(dcextension);
if (ei != _extensions.end()) { if (ei != _extensions.end()) {
loader_cat->debug() if (loader_cat->is_debug()) {
<< "Multiple LoaderFileTypes registered that use the extension " loader_cat->debug()
<< dcextension << "\n"; << "Multiple LoaderFileTypes registered that use the extension "
<< dcextension << "\n";
}
} else { } else {
_extensions.insert(Extensions::value_type(dcextension, type)); _extensions.insert(Extensions::value_type(dcextension, type));
} }