Replace DEBUG_PRINTF with NS_WARNING/NS_ASSERTION. Bug 117440, patch by

Morten Nilsen <Morten@Nilsen.com>, r=timeless, sr=brendan
This commit is contained in:
bzbarsky%mit.edu 2002-01-09 18:49:43 +00:00
parent 9a039b7c3a
commit 614dc253ca
5 changed files with 29 additions and 68 deletions

View File

@ -23,6 +23,7 @@
* Pierre Phaneuf <pp@ludusdesign.com>
* Roland Mainz <roland.mainz@informatik.med.uni-giessen.de>
* Brian Stell <bstell@ix.netcom.com>
* Morten Nilsen <morten@nilsen.com>
*
*
* Alternatively, the contents of this file may be used under the terms of
@ -52,6 +53,7 @@
#include "nsISaveAsCharset.h"
#include "nsIPref.h"
#include "nsCOMPtr.h"
#include "nsPrintfCString.h"
#include "nspr.h"
#include "nsHashtable.h"
#include "nsReadableUtils.h"
@ -1879,7 +1881,7 @@ SetUpFontCharSetInfo(nsFontCharSetInfo* aSelf)
if (mapper) {
aSelf->mCCMap = MapperToCCMap(mapper);
if (aSelf->mCCMap) {
DEBUG_PRINTF(("\n\ncharset = %s", atomToName(charset)));
NS_WARNING(nsPrintfCString("\n\ncharset = %s", atomToName(charset)).get());
/*
* We used to disable special characters like smart quotes

View File

@ -20,6 +20,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Morten Nilsen <morten@nilsen.com>
*
*
* Alternatively, the contents of this file may be used under the terms of
@ -71,11 +72,8 @@
#define REGSELF_PRINTF(x,y) \
printf("RegSelf %s to %s converter complete\n", \
x, y)
#define UCONV_DEBUG_PRINTF(x) \
printf(x)
#else
#define REGSELF_PRINTF(x,y)
#define UCONV_DEBUG_PRINTF(x)
#endif
#define NS_IMPL_NSUCONVERTERREGSELF \
@ -136,8 +134,8 @@ _InstanceClass##UnRegSelf (nsIComponentManager *aCompMgr, \
const char* registryLocation, \
const nsModuleComponentInfo *info) \
{ \
UCONV_DEBUG_PRINTF("UnRegSelf " _From " to " _To "converter not implement\n"); \
return NS_OK; \
NS_WARNING("UnRegSelf " _From " to " _To "converter not implemented\n"); \
return NS_ERROR_NOT_IMPLEMENTED; \
}
/**

View File

@ -32,6 +32,7 @@
#include "nsKeyboardUtils.h"
#include "nspr.h"
#include "nsWindow.h"
#include "nsPrintfCString.h"
//
// xkbms: X KeyBoard Mode Switch
@ -58,20 +59,6 @@
// application to filter events with a non-null window
//
#undef DEBUG_X_KEYBOARD_MODE_SWITCH
#ifdef DEBUG_X_KEYBOARD_MODE_SWITCH
#define DEBUG_PRINTF(x) \
PR_BEGIN_MACRO \
printf x ; \
printf(", %s %d\n", __FILE__, __LINE__); \
PR_END_MACRO
#else
#define DEBUG_PRINTF(x) \
PR_BEGIN_MACRO \
PR_END_MACRO
#endif
// Xlib should define this!
#define MODIFIERMAP_ROW_SIZE 8
@ -88,11 +75,9 @@ void
nsXKBModeSwitch::ControlWorkaround(gboolean grab_during_popup,
gboolean ungrab_during_mode_switch)
{
DEBUG_PRINTF(("nsXKBModeSwitch::ControlWorkaround:"));
DEBUG_PRINTF((" grab_during_popup = %d",
grab_during_popup));
DEBUG_PRINTF((" ungrab_during_mode_switch = %d",
ungrab_during_mode_switch));
NS_WARNING("nsXKBModeSwitch::ControlWorkaround:");
NS_WARNING(nsPrintfCString(" grab_during_popup = %d", grab_during_popup).get());
NS_WARNING(nsPrintfCString(" ungrab_during_mode_switch = %d", ungrab_during_mode_switch).get());
gGrabDuringPopup = grab_during_popup;
gUnGrabDuringModeSwitch = ungrab_during_mode_switch;
@ -164,11 +149,11 @@ nsXKBModeSwitch::HandleMappingNotify()
XFreeModifiermap(xmodmap);
if (!gModeSwitchKeycode1) {
DEBUG_PRINTF(("\n\nnsXKBModeSwitch::HandleMappingNotify: no Mode_switch\n\n"));
NS_WARNING("\n\nnsXKBModeSwitch::HandleMappingNotify: no Mode_switch\n\n");
}
DEBUG_PRINTF(("\n\nnsXKBModeSwitch::HandleMappingNotify:"));
DEBUG_PRINTF((" gModeSwitchKeycode1 = %d", gModeSwitchKeycode1));
DEBUG_PRINTF((" gModeSwitchKeycode2 = %d", gModeSwitchKeycode2));
NS_WARNING("\n\nnsXKBModeSwitch::HandleMappingNotify:");
NS_WARNING(nsPrintfCString(" gModeSwitchKeycode1 = %d", gModeSwitchKeycode1).get());
NS_WARNING(nsPrintfCString(" gModeSwitchKeycode2 = %d", gModeSwitchKeycode2).get());
#if defined(HAVE_X11_XKBLIB_H) && \
defined(XkbMajorVersion) && defined(XbMinorVersion)
@ -207,14 +192,14 @@ nsXKBModeSwitch::HandleKeyPress(XKeyEvent *xke)
if ((xke->keycode == gModeSwitchKeycode1)
|| (xke->keycode == gModeSwitchKeycode2)) {
gModeSwitchDown = TRUE;
DEBUG_PRINTF(("nsXKBModeSwitch::HandleKeyPress: Mode_switch is down"));
NS_WARNING("nsXKBModeSwitch::HandleKeyPress: Mode_switch is down");
nsWindow *win = nsWindow::GetGrabWindow();
if (!win)
return;
if (win->GrabInProgress()) {
if (gUnGrabDuringModeSwitch) {
gdk_keyboard_ungrab(GDK_CURRENT_TIME);
DEBUG_PRINTF(("\n\n*** ungrab keyboard ***\n\n"));
NS_WARNING("\n\n*** ungrab keyboard ***\n\n");
}
}
}
@ -232,7 +217,7 @@ nsXKBModeSwitch::HandleKeyRelease(XKeyEvent *xke)
if ((xke->keycode == gModeSwitchKeycode1)
|| (xke->keycode == gModeSwitchKeycode2)) {
gModeSwitchDown = FALSE;
DEBUG_PRINTF(("nsXKBModeSwitch::HandleKeyPress: Mode_switch is up"));
NS_WARNING("nsXKBModeSwitch::HandleKeyPress: Mode_switch is up");
nsWindow *win = nsWindow::GetGrabWindow();
if (!win)
return;
@ -241,7 +226,7 @@ nsXKBModeSwitch::HandleKeyRelease(XKeyEvent *xke)
if (!win->GetGdkGrabWindow())
return;
gdk_keyboard_grab(win->GetGdkGrabWindow(), gOwnerEvents, gGrabTime);
DEBUG_PRINTF(("\n\n*** re-grab keyboard ***\n\n"));
NS_WARNING("\n\n*** re-grab keyboard ***\n\n");
}
}
}

View File

@ -21,6 +21,7 @@
*
* Contributor(s):
* Pierre Phaneuf <pp@ludusdesign.com>
* Morten Nilsen <morten@nilsen.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
@ -71,9 +72,6 @@
#ifdef DEBUG
#define DEBUG_FIND
#define DEBUG_PRINTF PR_fprintf
#else
#define DEBUG_PRINTF (void)
#endif
@ -557,11 +555,9 @@ nsFindComponent::Find(nsISupports *aContext, PRBool *aDidFind)
}
}
// Test for error (GetFindDialog succeeds if there's no dialog).
if ( NS_FAILED( rv ) ) {
DEBUG_PRINTF( PR_STDOUT, "%s %d: Error getting find dialog, rv=0x%08X\n",
__FILE__, (int)__LINE__, (int)rv );
NS_ASSERTION(NS_SUCCEEDED(rv), "Error getting find dialog");
if ( NS_FAILED( rv ) )
return rv;
}
}
if (aContext)
@ -645,11 +641,9 @@ nsFindComponent::Replace( nsISupports *aContext )
}
}
// Test for error (GetReplaceDialog succeeds if there's no dialog).
if ( NS_FAILED( rv ) ) {
DEBUG_PRINTF( PR_STDOUT, "%s %d: Error getting replace dialog, rv=0x%08X\n",
__FILE__, (int)__LINE__, (int)rv );
NS_ASSERTION(NS_SUCCEEDED(rv), "Error getting replace dialog");
if ( NS_FAILED( rv ) )
return rv;
}
}
if (aContext)

View File

@ -21,6 +21,7 @@
*
* Contributor(s):
* Pierre Phaneuf <pp@ludusdesign.com>
* Morten Nilsen <morten@nilsen.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
@ -63,12 +64,6 @@
#include "nsIStringBundle.h"
static NS_DEFINE_CID(kStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID);
#ifdef NS_DEBUG
#define DEBUG_PRINTF PR_fprintf
#else
#define DEBUG_PRINTF (void)
#endif
#ifdef USE_ASYNC_READ
NS_IMPL_ISUPPORTS5(nsStreamXferOp, nsIStreamListener, nsIRequestObserver, nsIStreamTransferOperation, nsIProgressEventSink, nsIInterfaceRequestor);
#else
@ -145,10 +140,7 @@ nsStreamXferOp::OnError( int operation, nsresult errorCode ) {
rv = mObserver->Observe( (nsIStreamTransferOperation*)this,
NS_ISTREAMTRANSFER_CONTRACTID ";onError",
NS_ConvertASCIItoUCS2( buf ).get() );
if ( NS_FAILED( rv ) ) {
DEBUG_PRINTF( PR_STDOUT, "%s %d: Observe failed, rv=0x%08X\n",
(char*)__FILE__, (int)__LINE__, (int)rv );
}
NS_ASSERTION(NS_SUCCEEDED(rv), "Observe failed");
}
return rv;
@ -277,8 +269,7 @@ nsStreamXferOp::OnStartRequest(nsIRequest *request, nsISupports* aContext) {
nsresult rv = NS_OK;
#ifdef DEBUG_law
DEBUG_PRINTF( PR_STDOUT, "nsStreamXferOp::OnStartRequest; request=0x%08X, context=0x%08X\n",
(int)(void*)request, (int)(void*)aContext );
NS_WARNING(nsPrintfCString("nsStreamXferOp::OnStartRequest; request=0x%08X, context=0x%08X\n",(int)(void*)request, (int)(void*)aContext).get());
#endif
#ifdef USE_ASYNC_READ
@ -407,10 +398,7 @@ nsStreamXferOp::OnProgress(nsIRequest *request, nsISupports* aContext,
rv = mObserver->Observe( (nsIStreamTransferOperation*)this,
NS_ISTREAMTRANSFER_CONTRACTID ";onProgress",
NS_ConvertASCIItoUCS2( buf ).get() );
if ( NS_FAILED( rv ) ) {
DEBUG_PRINTF( PR_STDOUT, "%s %d: Observe failed, rv=0x%08X\n",
(char*)__FILE__, (int)__LINE__, (int)rv );
}
NS_ASSERTION(NS_SUCCEEDED(rv), "Observe failed");
}
return rv;
@ -436,10 +424,7 @@ nsStreamXferOp::OnStatus( nsIRequest *request,
rv = mObserver->Observe( (nsIStreamTransferOperation*)this,
NS_ISTREAMTRANSFER_CONTRACTID ";onStatus",
msg.get() );
if ( NS_FAILED( rv ) ) {
DEBUG_PRINTF( PR_STDOUT, "%s %d: Observe failed, rv=0x%08X\n",
(char*)__FILE__, (int)__LINE__, (int)rv );
}
NS_ASSERTION(NS_SUCCEEDED(rv), "Observe failed");
}
return rv;
@ -546,10 +531,7 @@ nsStreamXferOp::OnStopRequest( nsIRequest *request,
rv = kungFuDeathGrip->Observe( (nsIStreamTransferOperation*)this,
NS_ISTREAMTRANSFER_CONTRACTID ";onCompletion",
nsnull );
if ( NS_FAILED( rv ) ) {
DEBUG_PRINTF( PR_STDOUT, "%s %d: Observe failed, rv=0x%08X\n",
(char*)__FILE__, (int)__LINE__, (int)rv );
}
NS_ASSERTION(NS_SUCCEEDED(rv), "Observe failed");
}
return rv;