From c6b67eceebb3291277c5da193761ba42600e2194 Mon Sep 17 00:00:00 2001 From: "warren%netscape.com" Date: Fri, 27 Oct 2000 22:43:51 +0000 Subject: [PATCH] Bug 47207. Changing printf to PRINTF to use new logging facility. r=valeski,sr=waterson git-svn-id: svn://10.0.0.236/trunk@81885 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/caps/src/nsScriptSecurityManager.cpp | 27 +- .../chrome/src/nsChromeProtocolHandler.cpp | 24 +- mozilla/chrome/src/nsChromeRegistry.cpp | 17 +- mozilla/chrome/tools/chromereg/regchrome.cpp | 2 +- mozilla/content/base/src/nsContentPolicy.cpp | 13 +- mozilla/content/base/src/nsDocumentViewer.cpp | 52 ++- .../content/base/src/nsNodeInfoManager.cpp | 17 +- .../base/src/nsPlainTextSerializer.cpp | 21 +- mozilla/content/base/src/nsRange.cpp | 11 +- mozilla/content/base/src/nsSelection.cpp | 59 +-- mozilla/content/base/src/nsStyleContext.cpp | 60 +-- mozilla/content/base/src/nsStyleSet.cpp | 69 ++- mozilla/content/events/src/nsDOMEvent.cpp | 9 +- .../events/src/nsEventListenerManager.cpp | 13 +- .../events/src/nsEventStateManager.cpp | 17 +- .../html/content/src/nsGenericHTMLElement.cpp | 7 + .../html/document/src/nsHTMLContentSink.cpp | 9 +- .../html/document/src/nsHTMLDocument.cpp | 21 +- .../html/style/src/nsCSSDeclaration.cpp | 11 +- .../content/html/style/src/nsCSSLayout.cpp | 9 +- .../content/html/style/src/nsCSSLoader.cpp | 24 +- .../content/html/style/src/nsCSSScanner.cpp | 11 +- .../content/html/style/src/nsCSSStruct.cpp | 11 +- .../content/html/style/src/nsCSSStyleRule.cpp | 27 +- .../html/style/src/nsCSSStyleSheet.cpp | 9 +- .../content/html/style/src/nsStyleUtil.cpp | 119 ++--- mozilla/content/shared/src/nsStyleUtil.cpp | 119 ++--- mozilla/content/xbl/src/nsXBLBinding.cpp | 9 +- .../content/xbl/src/nsXBLPrototypeBinding.cpp | 7 +- mozilla/content/xbl/src/nsXBLService.cpp | 4 +- .../content/xbl/src/nsXBLWindowKeyHandler.cpp | 9 +- .../xml/content/src/nsXMLCDATASection.cpp | 6 + .../content/xml/content/src/nsXMLEntity.cpp | 6 + .../content/xml/content/src/nsXMLNotation.cpp | 6 + .../src/nsXMLProcessingInstruction.cpp | 6 + .../xml/document/src/nsXMLContentSink.cpp | 14 +- .../xml/document/src/nsXMLDocument.cpp | 11 +- .../xul/content/src/nsRDFDOMNodeList.cpp | 7 +- .../xul/content/src/nsXULPopupListener.cpp | 7 +- .../xul/content/src/nsXULTreeElement.cpp | 9 +- .../document/src/nsXULCommandDispatcher.cpp | 38 +- .../xul/document/src/nsXULDocument.cpp | 12 +- .../content/xul/document/src/nsXULDocument.h | 10 +- .../xul/templates/src/nsXULContentUtils.cpp | 7 +- .../xul/templates/src/nsXULSortService.cpp | 7 +- mozilla/docshell/base/nsDocShell.cpp | 2 +- mozilla/docshell/base/nsWebShell.cpp | 47 +- mozilla/dom/src/base/nsGlobalWindow.cpp | 19 +- mozilla/dom/src/base/nsJSEnvironment.cpp | 37 +- mozilla/dom/src/build/nsDOMFactory.cpp | 9 +- mozilla/editor/base/CreateElementTxn.cpp | 31 +- mozilla/editor/base/DeleteElementTxn.cpp | 21 +- mozilla/editor/base/DeleteRangeTxn.cpp | 23 +- mozilla/editor/base/DeleteTextTxn.cpp | 14 +- mozilla/editor/base/IMECommitTxn.cpp | 24 +- mozilla/editor/base/IMETextTxn.cpp | 44 +- mozilla/editor/base/InsertElementTxn.cpp | 18 +- mozilla/editor/base/InsertTextTxn.cpp | 29 +- mozilla/editor/base/JoinElementTxn.cpp | 15 +- mozilla/editor/base/PlaceholderTxn.cpp | 14 +- mozilla/editor/base/SplitElementTxn.cpp | 53 +-- mozilla/editor/base/nsEditor.cpp | 49 +- .../editor/base/nsEditorEventListeners.cpp | 37 +- mozilla/editor/base/nsEditorShell.cpp | 20 +- mozilla/editor/base/nsEditorTxnLog.cpp | 9 +- mozilla/editor/base/nsHTMLEditRules.cpp | 13 +- mozilla/editor/base/nsHTMLEditor.cpp | 100 ++-- mozilla/editor/base/nsInternetCiter.cpp | 25 +- mozilla/editor/base/nsTableEditor.cpp | 19 +- mozilla/editor/base/nsTextEditRules.cpp | 11 +- mozilla/editor/base/nsWrapUtils.cpp | 7 +- mozilla/editor/composer/src/nsEditorShell.cpp | 20 +- .../libeditor/base/CreateElementTxn.cpp | 31 +- .../libeditor/base/DeleteElementTxn.cpp | 21 +- .../editor/libeditor/base/DeleteRangeTxn.cpp | 23 +- .../editor/libeditor/base/DeleteTextTxn.cpp | 14 +- mozilla/editor/libeditor/base/IMETextTxn.cpp | 44 +- .../libeditor/base/InsertElementTxn.cpp | 18 +- .../editor/libeditor/base/InsertTextTxn.cpp | 29 +- .../editor/libeditor/base/JoinElementTxn.cpp | 15 +- .../editor/libeditor/base/PlaceholderTxn.cpp | 14 +- .../editor/libeditor/base/SplitElementTxn.cpp | 53 +-- mozilla/editor/libeditor/base/nsEditor.cpp | 49 +- .../editor/libeditor/html/nsEditorTxnLog.cpp | 9 +- .../editor/libeditor/html/nsHTMLEditRules.cpp | 13 +- .../editor/libeditor/html/nsHTMLEditor.cpp | 100 ++-- .../editor/libeditor/html/nsTableEditor.cpp | 19 +- .../libeditor/text/nsEditorEventListeners.cpp | 37 +- .../editor/libeditor/text/nsInternetCiter.cpp | 25 +- .../editor/libeditor/text/nsTextEditRules.cpp | 11 +- mozilla/editor/libeditor/text/nsWrapUtils.cpp | 7 +- .../txtsvc/nsTextServicesDocument.cpp | 59 +-- .../txtsvc/src/nsTextServicesDocument.cpp | 59 +-- .../browser/activex/src/xml/ParseExpat.cpp | 3 +- .../embedding/browser/gtk/src/gtkmozembed.cpp | 7 +- .../browser/gtk/tests/TestGtkEmbed.cpp | 7 +- .../browser/photon/src/PtMozilla.cpp | 16 +- mozilla/extensions/cookie/nsCookie.cpp | 19 +- .../extensions/cookie/nsCookieHTTPNotify.cpp | 9 +- .../extensions/cookie/tests/TestCookie.cpp | 20 +- mozilla/extensions/finger/nsFingerChannel.cpp | 25 +- mozilla/extensions/pics/src/nsPICS.cpp | 13 +- .../pics/src/nsPICSElementObserver.cpp | 7 +- mozilla/extensions/psm-glue/src/nsFSDR.cpp | 19 +- .../psm-glue/src/nsKeygenHandler.cpp | 7 +- .../psm-glue/src/nsPSMComponent.cpp | 9 +- .../psm-glue/src/nsSecureBrowserUIImpl.cpp | 18 +- .../extensions/wallet/src/nsWalletService.cpp | 9 +- mozilla/extensions/wallet/src/wallet.cpp | 61 ++- mozilla/gfx/src/beos/nsDeviceContextBeOS.cpp | 9 +- mozilla/gfx/src/beos/nsDrawingSurfaceBeOS.cpp | 9 +- mozilla/gfx/src/beos/nsFontMetricsBeOS.cpp | 9 +- mozilla/gfx/src/beos/nsImageBeOS.cpp | 15 +- mozilla/gfx/src/beos/nsRegionBeOS.cpp | 7 +- .../gfx/src/beos/nsRenderingContextBeOS.cpp | 9 +- mozilla/gfx/src/gtk/nsDeviceContextGTK.cpp | 7 +- mozilla/gfx/src/gtk/nsDrawingSurfaceGTK.cpp | 9 +- mozilla/gfx/src/gtk/nsFontMetricsGTK.cpp | 77 ++- mozilla/gfx/src/gtk/nsGCCache.cpp | 34 +- mozilla/gfx/src/gtk/nsImageGTK.cpp | 47 +- mozilla/gfx/src/gtk/nsRegionGTK.cpp | 9 +- mozilla/gfx/src/gtk/nsRenderingContextGTK.cpp | 29 +- mozilla/gfx/src/mac/nsUnicodeMappingUtil.cpp | 10 +- mozilla/gfx/src/motif/nsFontMetricsMotif.cpp | 17 +- mozilla/gfx/src/motif/nsImageMotif.cpp | 9 +- mozilla/gfx/src/nsRenderingContextImpl.cpp | 28 +- mozilla/gfx/src/os2/nsDeviceContextOS2.cpp | 15 +- mozilla/gfx/src/os2/nsDrawingSurfaceOS2.cpp | 15 +- mozilla/gfx/src/os2/nsFontMetricsOS2.cpp | 7 +- mozilla/gfx/src/os2/nsGfxFactoryOS2.cpp | 11 +- mozilla/gfx/src/os2/nsImageOS2.cpp | 7 +- mozilla/gfx/src/os2/nsRegionOS2.cpp | 13 +- mozilla/gfx/src/os2/nsRenderingContextOS2.cpp | 23 +- mozilla/gfx/src/photon/nsDeviceContextPh.cpp | 39 +- .../photon/nsDeviceContextSpecFactoryP.cpp | 7 +- mozilla/gfx/src/photon/nsDrawingSurfacePh.cpp | 15 +- mozilla/gfx/src/photon/nsFontMetricsPh.cpp | 9 +- mozilla/gfx/src/photon/nsImagePh.cpp | 7 +- mozilla/gfx/src/photon/nsRegionPh.cpp | 13 +- .../gfx/src/photon/nsRenderingContextPh.cpp | 31 +- mozilla/gfx/src/photon/nsScreenPh.cpp | 7 +- mozilla/gfx/src/ps/nsAFMObject.cpp | 6 +- mozilla/gfx/src/ps/nsPostScriptObj.cpp | 15 +- .../gfx/src/shared/nsRenderingContextImpl.cpp | 28 +- .../windows/nsDeviceContextSpecFactoryW.cpp | 9 +- .../gfx/src/windows/nsDeviceContextWin.cpp | 6 +- .../gfx/src/windows/nsDrawingSurfaceWin.cpp | 13 +- mozilla/gfx/src/windows/nsFontMetricsWin.cpp | 56 +-- .../gfx/src/windows/nsRenderingContextWin.cpp | 19 +- mozilla/gfx/src/windows/nsScreenWin.cpp | 6 +- mozilla/gfx/src/xlib/nsDeviceContextXlib.cpp | 7 +- mozilla/gfx/src/xlib/nsFontMetricsXlib.cpp | 23 +- mozilla/gfx/src/xlib/nsImageXlib.cpp | 9 +- .../gfx/src/xlib/nsRenderingContextXlib.cpp | 7 +- mozilla/gfx/src/xlibrgb/xlibrgb.c | 84 ++-- mozilla/gfx/src/xprint/nsFontMetricsXP.cpp | 85 ++-- mozilla/gfx/src/xprint/nsXPrintContext.cpp | 9 +- mozilla/gfx/tests/btest/BitTest.cpp | 15 +- mozilla/gfx/tests/coverage/nsCoverage.cpp | 9 +- mozilla/htmlparser/robot/nsDebugRobot.cpp | 13 +- mozilla/htmlparser/src/CNavDTD.cpp | 14 +- mozilla/htmlparser/src/COtherDTD.cpp | 3 +- mozilla/htmlparser/src/COtherElements.h | 95 ++-- mozilla/htmlparser/src/CRtfDTD.cpp | 9 +- mozilla/htmlparser/src/nsDTDUtils.cpp | 7 +- .../src/nsHTMLContentSinkStream.cpp | 9 +- .../htmlparser/src/nsHTMLToTXTSinkStream.cpp | 23 +- mozilla/htmlparser/src/nsParser.cpp | 18 +- mozilla/htmlparser/src/nsParserModule.cpp | 13 +- mozilla/htmlparser/src/nsViewSourceHTML.cpp | 8 +- mozilla/intl/chardet/src/nsCharDetModule.cpp | 23 +- .../intl/chardet/src/nsCyrillicDetector.cpp | 8 +- mozilla/intl/chardet/src/nsPSMDetectors.cpp | 60 +-- mozilla/intl/chardet/tests/DetectCharset.cpp | 54 ++- mozilla/intl/locale/src/mac/nsLocaleSHLIB.cpp | 7 +- .../intl/locale/src/os2/nsLocaleModule.cpp | 21 +- .../intl/locale/src/unix/nsCollationUnix.cpp | 10 +- .../intl/locale/src/unix/nsLocaleModule.cpp | 21 +- .../locale/src/windows/nsIWin32LocaleImpl.cpp | 11 +- mozilla/intl/strres/src/nsAcceptLang.cpp | 9 +- mozilla/intl/strres/src/nsStringBundle.cpp | 25 +- .../uconv/public/nsICharsetConverterManager.h | 17 +- mozilla/intl/uconv/src/nsUConvModule.cpp | 22 +- mozilla/intl/uconv/tests/TestUConv.cpp | 2 + mozilla/intl/uconv/tests/convperf.cpp | 3 + mozilla/intl/uconv/tests/nsTestUConv.cpp | 2 + mozilla/intl/uconv/tests/nsconv.cpp | 3 + .../intl/uconv/ucvcn/nsUnicodeToGB2312GL.cpp | 1 - mozilla/intl/uconv/ucvja/nsUCvJaModule.cpp | 1 + mozilla/layout/base/nsAutoCopy.cpp | 9 +- mozilla/layout/base/nsCSSFrameConstructor.cpp | 63 +-- mozilla/layout/base/nsCSSRendering.cpp | 19 +- mozilla/layout/base/nsCaret.cpp | 7 +- mozilla/layout/base/nsDocumentViewer.cpp | 52 ++- mozilla/layout/base/nsFrameManager.cpp | 27 +- mozilla/layout/base/nsLayoutHistoryState.cpp | 17 +- mozilla/layout/base/nsPresShell.cpp | 201 ++++---- mozilla/layout/base/public/nsIFrame.h | 3 + mozilla/layout/base/public/nsIFrameDebug.h | 2 + mozilla/layout/base/src/nsAutoCopy.cpp | 9 +- mozilla/layout/base/src/nsCaret.cpp | 7 +- mozilla/layout/base/src/nsContentPolicy.cpp | 13 +- mozilla/layout/base/src/nsDocumentViewer.cpp | 52 ++- .../layout/base/src/nsFrameImageLoader.cpp | 30 +- mozilla/layout/base/src/nsFrameUtil.cpp | 38 +- .../layout/base/src/nsLayoutHistoryState.cpp | 17 +- mozilla/layout/base/src/nsNodeInfoManager.cpp | 17 +- .../layout/base/src/nsPlainTextSerializer.cpp | 21 +- .../layout/base/src/nsPrintPreviewContext.cpp | 2 + mozilla/layout/base/src/nsRange.cpp | 11 +- mozilla/layout/base/src/nsSelection.cpp | 59 +-- mozilla/layout/base/src/nsSpaceManager.cpp | 10 +- mozilla/layout/base/src/nsStyleContext.cpp | 60 +-- mozilla/layout/base/src/nsStyleSet.cpp | 69 ++- mozilla/layout/build/nsLayoutDLF.cpp | 13 +- mozilla/layout/build/nsLayoutFactory.cpp | 11 +- mozilla/layout/build/nsLayoutModule.cpp | 22 +- mozilla/layout/events/src/nsDOMEvent.cpp | 9 +- .../events/src/nsEventListenerManager.cpp | 13 +- .../layout/events/src/nsEventStateManager.cpp | 17 +- .../layout/forms/nsButtonFrameRenderer.cpp | 7 +- .../layout/forms/nsComboboxControlFrame.cpp | 62 +-- mozilla/layout/forms/nsFieldSetFrame.cpp | 31 +- mozilla/layout/forms/nsFormControlFrame.cpp | 34 +- mozilla/layout/forms/nsFormControlFrame.h | 7 +- mozilla/layout/forms/nsFormControlHelper.cpp | 9 +- .../layout/forms/nsHTMLButtonControlFrame.cpp | 14 +- mozilla/layout/forms/nsListControlFrame.cpp | 80 ++-- mozilla/layout/generic/nsBlockBandData.cpp | 25 +- mozilla/layout/generic/nsBlockFrame.cpp | 310 +++++++------ .../layout/generic/nsBlockReflowContext.cpp | 39 +- mozilla/layout/generic/nsBlockReflowState.cpp | 310 +++++++------ mozilla/layout/generic/nsBlockReflowState.h | 310 +++++++------ mozilla/layout/generic/nsContainerFrame.cpp | 14 +- mozilla/layout/generic/nsFrame.cpp | 42 +- mozilla/layout/generic/nsFrame.h | 4 +- mozilla/layout/generic/nsFrameFrame.cpp | 17 +- mozilla/layout/generic/nsFrameSetFrame.cpp | 17 +- mozilla/layout/generic/nsFrameUtil.cpp | 38 +- mozilla/layout/generic/nsGfxScrollFrame.cpp | 9 +- mozilla/layout/generic/nsHTMLReflowState.cpp | 9 +- mozilla/layout/generic/nsIFrame.h | 3 + mozilla/layout/generic/nsIFrameDebug.h | 2 + mozilla/layout/generic/nsImageFrame.cpp | 13 +- mozilla/layout/generic/nsInlineFrame.cpp | 17 +- mozilla/layout/generic/nsLineBox.cpp | 20 +- mozilla/layout/generic/nsLineLayout.cpp | 157 ++++--- mozilla/layout/generic/nsObjectFrame.cpp | 15 +- mozilla/layout/generic/nsPlaceholderFrame.cpp | 6 + mozilla/layout/generic/nsSelection.cpp | 59 +-- mozilla/layout/generic/nsSpaceManager.cpp | 10 +- mozilla/layout/generic/nsSplittableFrame.cpp | 6 + mozilla/layout/generic/nsTextFrame.cpp | 54 +-- mozilla/layout/generic/nsTextTransformer.cpp | 31 +- .../layout/html/base/src/nsBlockBandData.cpp | 25 +- mozilla/layout/html/base/src/nsBlockFrame.cpp | 310 +++++++------ .../html/base/src/nsBlockReflowContext.cpp | 39 +- .../html/base/src/nsBlockReflowState.cpp | 310 +++++++------ .../layout/html/base/src/nsBlockReflowState.h | 310 +++++++------ .../layout/html/base/src/nsContainerFrame.cpp | 14 +- mozilla/layout/html/base/src/nsDST.cpp | 2 +- mozilla/layout/html/base/src/nsFrame.cpp | 42 +- mozilla/layout/html/base/src/nsFrame.h | 4 +- .../layout/html/base/src/nsFrameManager.cpp | 27 +- .../layout/html/base/src/nsGfxScrollFrame.cpp | 9 +- .../html/base/src/nsHTMLImageLoader.cpp | 27 +- .../html/base/src/nsHTMLReflowState.cpp | 9 +- mozilla/layout/html/base/src/nsImageFrame.cpp | 13 +- .../layout/html/base/src/nsInlineFrame.cpp | 17 +- mozilla/layout/html/base/src/nsLineBox.cpp | 20 +- mozilla/layout/html/base/src/nsLineLayout.cpp | 157 ++++--- .../layout/html/base/src/nsObjectFrame.cpp | 15 +- .../html/base/src/nsPlaceholderFrame.cpp | 6 + mozilla/layout/html/base/src/nsPresShell.cpp | 201 ++++---- .../layout/html/base/src/nsScrollFrame.cpp | 11 +- .../html/base/src/nsSplittableFrame.cpp | 6 + mozilla/layout/html/base/src/nsTextFrame.cpp | 54 +-- .../html/base/src/nsTextTransformer.cpp | 31 +- .../html/content/src/nsGenericHTMLElement.cpp | 7 + .../layout/html/document/src/nsFrameFrame.cpp | 17 +- .../html/document/src/nsFrameSetFrame.cpp | 17 +- .../html/document/src/nsHTMLContentSink.cpp | 9 +- .../html/document/src/nsHTMLDocument.cpp | 21 +- .../html/forms/src/nsButtonFrameRenderer.cpp | 7 +- .../html/forms/src/nsComboboxControlFrame.cpp | 62 +-- .../layout/html/forms/src/nsFieldSetFrame.cpp | 31 +- .../html/forms/src/nsFormControlFrame.cpp | 34 +- .../html/forms/src/nsFormControlFrame.h | 7 +- .../html/forms/src/nsFormControlHelper.cpp | 9 +- mozilla/layout/html/forms/src/nsFormFrame.cpp | 8 +- .../html/forms/src/nsGfxListControlFrame.cpp | 105 ++--- .../html/forms/src/nsGfxTextControlFrame.cpp | 59 +-- .../html/forms/src/nsGfxTextControlFrame2.cpp | 7 +- .../forms/src/nsHTMLButtonControlFrame.cpp | 14 +- .../layout/html/forms/src/nsLabelFrame.cpp | 4 +- .../html/forms/src/nsListControlFrame.cpp | 80 ++-- .../forms/src/nsNativeFormControlFrame.cpp | 10 +- .../html/style/src/nsCSSDeclaration.cpp | 11 +- .../html/style/src/nsCSSFrameConstructor.cpp | 63 +-- mozilla/layout/html/style/src/nsCSSLayout.cpp | 9 +- mozilla/layout/html/style/src/nsCSSLoader.cpp | 24 +- .../layout/html/style/src/nsCSSRendering.cpp | 19 +- .../layout/html/style/src/nsCSSScanner.cpp | 11 +- .../layout/html/style/src/nsCSSStyleRule.cpp | 27 +- .../layout/html/style/src/nsCSSStyleSheet.cpp | 9 +- mozilla/layout/html/style/src/nsStyleUtil.cpp | 119 ++--- .../table/src/BasicTableLayoutStrategy.cpp | 21 +- mozilla/layout/html/table/src/nsCellMap.cpp | 43 +- .../html/table/src/nsTableCellFrame.cpp | 21 +- .../layout/html/table/src/nsTableColFrame.cpp | 17 +- .../layout/html/table/src/nsTableFrame.cpp | 58 +-- .../layout/html/table/src/nsTableRowFrame.cpp | 19 +- .../layout/mathml/base/src/nsMathMLChar.cpp | 45 +- .../base/src/nsMathMLContainerFrame.cpp | 53 ++- .../mathml/base/src/nsMathMLmactionFrame.cpp | 9 +- .../mathml/base/src/nsMathMLmactionFrame.h | 7 +- .../mathml/base/src/nsMathMLmfracFrame.cpp | 9 +- .../mathml/base/src/nsMathMLmoFrame.cpp | 7 +- .../mathml/base/src/nsMathMLmoverFrame.cpp | 7 +- .../mathml/base/src/nsMathMLmpaddedFrame.cpp | 11 +- .../mathml/base/src/nsMathMLmrootFrame.cpp | 7 +- .../mathml/base/src/nsMathMLmsubFrame.cpp | 7 +- .../mathml/base/src/nsMathMLmsubsupFrame.cpp | 7 +- .../mathml/base/src/nsMathMLmsupFrame.cpp | 7 +- .../mathml/base/src/nsMathMLmunderFrame.cpp | 7 +- .../base/src/nsMathMLmunderoverFrame.cpp | 7 +- .../mathml/content/src/nsMathMLOperators.cpp | 25 +- mozilla/layout/style/nsCSSDeclaration.cpp | 11 +- mozilla/layout/style/nsCSSLoader.cpp | 24 +- mozilla/layout/style/nsCSSScanner.cpp | 11 +- mozilla/layout/style/nsCSSStruct.cpp | 11 +- mozilla/layout/style/nsCSSStyleRule.cpp | 27 +- mozilla/layout/style/nsCSSStyleSheet.cpp | 9 +- mozilla/layout/style/nsStyleContext.cpp | 60 +-- mozilla/layout/style/nsStyleSet.cpp | 69 ++- mozilla/layout/style/nsStyleUtil.cpp | 119 ++--- .../layout/svg/base/src/nsPolygonFrame.cpp | 10 +- .../svg/base/src/nsSVGContainerFrame.cpp | 8 +- .../tables/BasicTableLayoutStrategy.cpp | 21 +- mozilla/layout/tables/nsCellMap.cpp | 43 +- mozilla/layout/tables/nsTableCellFrame.cpp | 21 +- mozilla/layout/tables/nsTableColFrame.cpp | 17 +- mozilla/layout/tables/nsTableFrame.cpp | 58 +-- mozilla/layout/tables/nsTableRowFrame.cpp | 19 +- mozilla/layout/xbl/src/nsXBLBinding.cpp | 9 +- .../layout/xbl/src/nsXBLPrototypeBinding.cpp | 7 +- mozilla/layout/xbl/src/nsXBLService.cpp | 4 +- .../layout/xbl/src/nsXBLWindowKeyHandler.cpp | 9 +- .../xml/content/src/nsXMLCDATASection.cpp | 6 + .../xml/content/src/nsXMLDocumentType.cpp | 6 + .../layout/xml/content/src/nsXMLEntity.cpp | 6 + .../layout/xml/content/src/nsXMLNotation.cpp | 6 + .../src/nsXMLProcessingInstruction.cpp | 6 + .../xml/document/src/nsXMLContentSink.cpp | 14 +- .../layout/xml/document/src/nsXMLDocument.cpp | 11 +- mozilla/layout/xul/base/src/nsBox.cpp | 16 +- mozilla/layout/xul/base/src/nsBoxFrame.cpp | 63 +-- .../layout/xul/base/src/nsBoxLayoutState.cpp | 7 +- .../xul/base/src/nsBoxToBlockAdaptor.cpp | 39 +- mozilla/layout/xul/base/src/nsMenuFrame.cpp | 7 +- .../layout/xul/base/src/nsMenuPopupFrame.cpp | 7 +- .../layout/xul/base/src/nsMonumentLayout.cpp | 13 +- .../layout/xul/base/src/nsPopupSetFrame.cpp | 11 +- .../layout/xul/base/src/nsRepeatService.cpp | 7 +- .../layout/xul/base/src/nsRootBoxFrame.cpp | 7 +- .../layout/xul/base/src/nsScrollbarFrame.cpp | 7 +- mozilla/layout/xul/base/src/nsSliderFrame.cpp | 19 +- .../layout/xul/base/src/nsSplitterFrame.cpp | 33 +- .../layout/xul/base/src/nsSprocketLayout.cpp | 13 +- mozilla/layout/xul/base/src/nsStackFrame.cpp | 9 +- mozilla/layout/xul/base/src/nsStackLayout.cpp | 7 +- .../layout/xul/base/src/nsTextBoxFrame.cpp | 7 +- .../xul/base/src/nsTitledButtonFrame.cpp | 13 +- .../xul/base/src/nsToolbarItemFrame.cpp | 7 +- .../xul/base/src/nsXULTreeOuterGroupFrame.cpp | 23 +- mozilla/mailnews/absync/src/nsAbSync.cpp | 33 +- .../absync/src/nsAbSyncPostEngine.cpp | 9 +- .../mailnews/addrbook/src/nsAddressBook.cpp | 19 +- mozilla/mailnews/addrbook/src/nsDirPrefs.cpp | 11 +- .../mailnews/base/search/src/nsMsgFilter.cpp | 7 +- .../base/search/src/nsMsgFilterDataSource.cpp | 6 +- .../base/search/src/nsMsgFilterList.cpp | 7 +- .../base/search/src/nsMsgSearchDataSource.cpp | 8 +- mozilla/mailnews/base/src/nsMessenger.cpp | 24 +- .../mailnews/base/src/nsMessengerMigrator.cpp | 61 +-- mozilla/mailnews/base/src/nsMsgAccount.cpp | 15 +- .../mailnews/base/src/nsMsgAccountManager.cpp | 19 +- .../base/src/nsMsgAccountManagerDS.cpp | 17 +- .../base/src/nsMsgFolderDataSource.cpp | 11 +- .../base/src/nsMsgServiceProvider.cpp | 9 +- .../base/src/nsSubscribableServer.cpp | 11 +- mozilla/mailnews/base/util/nsMsgDBFolder.cpp | 11 +- mozilla/mailnews/base/util/nsMsgFolder.cpp | 7 +- .../base/util/nsMsgIncomingServer.cpp | 13 +- mozilla/mailnews/base/util/nsMsgKeySet.cpp | 33 +- .../mailnews/base/util/nsMsgLineBuffer.cpp | 9 +- .../mailnews/base/util/nsMsgMailNewsUrl.cpp | 7 +- mozilla/mailnews/base/util/nsMsgUtils.cpp | 9 +- .../compose/src/nsMsgAttachmentHandler.cpp | 7 +- .../mailnews/compose/src/nsMsgCompUtils.cpp | 7 +- mozilla/mailnews/compose/src/nsMsgCompose.cpp | 45 +- mozilla/mailnews/compose/src/nsMsgCopy.cpp | 13 +- mozilla/mailnews/compose/src/nsMsgCreate.cpp | 11 +- .../compose/src/nsMsgDeliveryListener.cpp | 9 +- mozilla/mailnews/compose/src/nsMsgQuote.cpp | 7 +- mozilla/mailnews/compose/src/nsMsgSend.cpp | 29 +- .../mailnews/compose/src/nsMsgSendLater.cpp | 19 +- .../mailnews/compose/src/nsSmtpDataSource.cpp | 13 +- mozilla/mailnews/compose/src/nsURLFetcher.cpp | 7 +- .../mailnews/compose/tests/compose/test.cpp | 27 +- .../mailnews/compose/tests/compose2/test2.cpp | 41 +- .../mailnews/compose/tests/geturl/geturl.cpp | 14 +- .../mailnews/compose/tests/sendlater/test.cpp | 20 +- .../mailnews/compose/tests/sendpage/Test.cpp | 49 +- .../mailnews/compose/tests/smtp/smtpTest.cpp | 38 +- .../db/msgdb/src/nsImapMailDatabase.cpp | 7 +- .../mailnews/db/msgdb/src/nsMailDatabase.cpp | 17 +- .../mailnews/db/msgdb/src/nsMsgDatabase.cpp | 16 +- mozilla/mailnews/db/msgdb/src/nsMsgThread.cpp | 15 +- .../mailnews/db/msgdb/src/nsNewsDatabase.cpp | 19 +- .../imap/src/nsImapIncomingServer.cpp | 13 +- .../mailnews/imap/src/nsImapMailFolder.cpp | 16 +- mozilla/mailnews/imap/src/nsImapProtocol.cpp | 42 +- .../imap/src/nsImapServerResponseParser.cpp | 10 +- mozilla/mailnews/imap/src/nsImapService.cpp | 7 +- .../import/eudora/src/EudoraDebugLog.h | 14 +- .../import/eudora/src/nsEudoraFactory.cpp | 3 +- mozilla/mailnews/import/oexpress/OEDebugLog.h | 14 +- .../mailnews/import/oexpress/nsOEFactory.cpp | 2 + .../mailnews/import/outlook/src/MapiDbgLog.h | 18 +- .../import/outlook/src/OutlookDebugLog.h | 14 +- .../import/outlook/src/nsOutlookFactory.cpp | 3 + mozilla/mailnews/import/src/ImportDebug.h | 14 +- .../mailnews/import/src/nsImportFactory.cpp | 1 + .../mailnews/import/src/nsImportService.cpp | 1 - .../mailnews/import/text/src/TextDebugLog.h | 14 +- .../import/text/src/nsTextFactory.cpp | 2 + .../mailnews/local/src/nsNoIncomingServer.cpp | 9 +- mozilla/mailnews/local/src/nsParseMailbox.cpp | 11 +- mozilla/mailnews/local/src/nsPop3Protocol.cpp | 16 +- mozilla/mailnews/local/src/nsPop3Sink.cpp | 37 +- .../mime/cthandlers/vcard/nsVCard.cpp | 35 +- mozilla/mailnews/mime/src/comi18n.cpp | 9 +- mozilla/mailnews/mime/src/mimecont.cpp | 9 +- mozilla/mailnews/mime/src/mimedrft.cpp | 31 +- mozilla/mailnews/mime/src/mimeebod.cpp | 7 +- mozilla/mailnews/mime/src/mimefilt.cpp | 31 +- mozilla/mailnews/mime/src/mimemoz2.cpp | 22 +- mozilla/mailnews/mime/src/mimemsg.cpp | 7 +- mozilla/mailnews/mime/src/mimemult.cpp | 11 +- mozilla/mailnews/mime/src/mimeobj.cpp | 7 +- .../mailnews/mime/src/nsStreamConverter.cpp | 13 +- .../mailnews/news/src/nsNNTPArticleList.cpp | 7 +- .../news/src/nsNNTPCategoryContainer.cpp | 9 +- mozilla/mailnews/news/src/nsNNTPHost.cpp | 17 +- mozilla/mailnews/news/src/nsNNTPNewsgroup.cpp | 25 +- .../mailnews/news/src/nsNNTPNewsgroupList.cpp | 41 +- .../mailnews/news/src/nsNNTPNewsgroupPost.cpp | 9 +- mozilla/mailnews/news/src/nsNNTPProtocol.cpp | 69 ++- mozilla/mailnews/news/src/nsNewsFolder.cpp | 39 +- mozilla/mailnews/news/src/nsNewsUtils.cpp | 13 +- .../news/src/nsNntpIncomingServer.cpp | 43 +- mozilla/mailnews/news/src/nsNntpService.cpp | 73 +-- .../src/nsAppFileLocationProvider.cpp | 7 +- mozilla/modules/libimg/gifcom/gif.cpp | 6 +- mozilla/modules/libimg/jpgcom/jpeg.cpp | 8 +- mozilla/modules/libimg/pngcom/ipng.cpp | 16 +- mozilla/modules/libimg/public_com/if_struct.h | 10 +- mozilla/modules/libimg/src/if.cpp | 19 +- mozilla/modules/libimg/src/if.h | 13 +- mozilla/modules/libimg/src/ilclient.cpp | 16 +- mozilla/modules/libjar/nsJAR.cpp | 19 +- mozilla/modules/libjar/nsJARInputStream.cpp | 7 +- mozilla/modules/libpref/src/nsPref.cpp | 56 +-- mozilla/modules/libreg/xpcom/nsRegistry.cpp | 36 +- mozilla/modules/libutil/src/stopwatch.cpp | 9 +- mozilla/modules/plugin/bad/badapter.cpp | 25 +- .../modules/plugin/base/src/ns4xPlugin.cpp | 19 +- .../plugin/base/src/ns4xPluginInstance.cpp | 27 +- .../plugin/base/src/nsPluginHostImpl.cpp | 35 +- .../plugin/base/src/nsPluginInstancePeer.cpp | 12 +- .../plugin/base/src/nsPluginViewer.cpp | 11 +- .../plugin/base/src/nsPluginsDirBeOS.cpp | 25 +- .../plugin/base/src/nsPluginsDirWin.cpp | 7 +- mozilla/modules/plugin/default/unix/npshell.c | 13 +- mozilla/modules/plugin/default/unix/npunix.c | 7 +- mozilla/modules/plugin/nglsrc/ns4xPlugin.cpp | 19 +- .../plugin/nglsrc/ns4xPluginInstance.cpp | 27 +- .../plugin/nglsrc/nsPluginHostImpl.cpp | 35 +- .../plugin/nglsrc/nsPluginInstancePeer.cpp | 12 +- .../modules/plugin/nglsrc/nsPluginViewer.cpp | 11 +- .../plugin/nglsrc/nsPluginsDirBeOS.cpp | 25 +- .../modules/plugin/nglsrc/nsPluginsDirWin.cpp | 7 +- .../plugin/samples/backward/badapter.cpp | 25 +- .../plugin/samples/default/unix/npshell.c | 13 +- .../plugin/samples/default/unix/npunix.c | 7 +- mozilla/netwerk/base/src/nsIOService.cpp | 9 +- .../netwerk/base/src/nsSocketTransport.cpp | 138 +++--- .../netwerk/cache/filecache/nsDBAccessor.cpp | 10 +- .../cache/filecache/nsDiskCacheRecord.cpp | 13 +- .../cache/filecache/nsNetDiskCache.cpp | 27 +- .../netwerk/dns/daemon/nsDnsAsyncLookup.cpp | 24 +- mozilla/netwerk/dns/src/nsDnsService.cpp | 20 +- .../protocol/finger/src/nsFingerChannel.cpp | 25 +- .../protocol/http/src/nsHTTPChannel.cpp | 58 ++- .../protocol/http/src/nsHTTPHandler.cpp | 44 +- .../protocol/http/src/nsHTTPRequest.cpp | 35 +- .../protocol/http/src/nsHTTPResponse.cpp | 17 +- .../http/src/nsHTTPResponseListener.cpp | 57 ++- .../converters/mozTXTToHTMLConv.cpp | 7 +- .../converters/nsFTPDirListingConv.cpp | 66 +-- .../parser/htmlparser/robot/nsDebugRobot.cpp | 13 +- mozilla/parser/htmlparser/src/CNavDTD.cpp | 14 +- mozilla/parser/htmlparser/src/COtherDTD.cpp | 3 +- .../parser/htmlparser/src/COtherElements.h | 95 ++-- mozilla/parser/htmlparser/src/CRtfDTD.cpp | 9 +- mozilla/parser/htmlparser/src/nsDTDUtils.cpp | 7 +- .../src/nsHTMLContentSinkStream.cpp | 9 +- .../htmlparser/src/nsHTMLToTXTSinkStream.cpp | 23 +- mozilla/parser/htmlparser/src/nsParser.cpp | 18 +- .../parser/htmlparser/src/nsParserModule.cpp | 13 +- .../htmlparser/src/nsViewSourceHTML.cpp | 8 +- .../pref-migrator/src/nsPrefMigration.cpp | 32 +- mozilla/profile/src/nsProfile.cpp | 61 +-- mozilla/profile/src/nsProfileAccess.cpp | 13 +- .../rdf/base/src/nsContainerEnumerator.cpp | 7 +- mozilla/rdf/base/src/nsInMemoryDataSource.cpp | 22 +- mozilla/rdf/base/src/nsRDFContainer.cpp | 7 +- mozilla/rdf/base/src/nsRDFContainerUtils.cpp | 7 +- mozilla/rdf/base/src/nsRDFContentSink.cpp | 16 +- mozilla/rdf/base/src/nsRDFService.cpp | 22 +- .../brprof/server/nsBrowsingProfileReader.cpp | 7 +- .../chrome/src/nsChromeProtocolHandler.cpp | 24 +- mozilla/rdf/chrome/src/nsChromeRegistry.cpp | 17 +- .../rdf/chrome/tools/chromereg/regchrome.cpp | 2 +- mozilla/rdf/content/src/nsDlgDefaultKeys.cpp | 9 +- mozilla/rdf/content/src/nsRDFDOMNodeList.cpp | 7 +- .../content/src/nsXULCommandDispatcher.cpp | 38 +- mozilla/rdf/content/src/nsXULContentUtils.cpp | 7 +- mozilla/rdf/content/src/nsXULDocument.cpp | 12 +- mozilla/rdf/content/src/nsXULDocument.h | 10 +- .../rdf/content/src/nsXULPopupListener.cpp | 7 +- mozilla/rdf/content/src/nsXULSortService.cpp | 7 +- mozilla/rdf/content/src/nsXULTreeElement.cpp | 9 +- .../datasource/src/nsFileSystemDataSource.cpp | 8 +- mozilla/rdf/datasource/src/nsLocalStore.cpp | 9 +- .../rdf/tests/domds/nsRDFDOMDataSource.cpp | 29 +- mozilla/string/obsolete/nsString.cpp | 7 +- mozilla/string/obsolete/nsString2.cpp | 6 +- mozilla/uriloader/base/nsDocLoader.cpp | 24 +- .../exthandler/nsExternalHelperAppService.cpp | 7 +- .../extprotocol/base/nsExternalProtocol.cpp | 11 - .../extprotocol/mac/nsExternalProtocolMac.cpp | 10 - .../unix/nsExternalProtocolUnix.cpp | 9 - .../extprotocol/win/nsExternalProtocolWin.cpp | 14 +- mozilla/view/src/nsScrollingView.cpp | 7 +- mozilla/view/src/nsView.cpp | 17 +- mozilla/view/src/nsViewFactory.cpp | 13 +- mozilla/view/src/nsViewManager.cpp | 59 +-- mozilla/view/src/nsViewManager2.cpp | 57 +-- .../embed/xlib/gtk/nsEmbedXlibIntoGtk.cpp | 19 +- .../webshell/embed/xlib/motif/EmbedMozilla.c | 11 +- .../embed/xlib/motif/nsEmbedXlibIntoMotif.cpp | 19 +- mozilla/webshell/embed/xlib/qt/MainWidget.cpp | 19 +- .../embed/xlib/qt/QMozillaContainer.cpp | 37 +- .../embed/xlib/qt/nsEmbedXlibIntoQt.cpp | 11 +- .../embed/xlib/qt/nsQtEventProcessor.cpp | 11 +- mozilla/webshell/embed/xlib/xt/EmbedMozilla.c | 11 +- .../embed/xlib/xt/nsEmbedXlibIntoXt.cpp | 31 +- .../webshell/tests/viewer/nsWebCrawler.cpp | 1 + mozilla/widget/src/beos/nsAppShell.cpp | 11 +- mozilla/widget/src/beos/nsButton.cpp | 7 +- mozilla/widget/src/beos/nsClipboard.cpp | 52 +-- mozilla/widget/src/beos/nsComboBox.cpp | 9 +- mozilla/widget/src/beos/nsDialog.cpp | 9 +- mozilla/widget/src/beos/nsDragService.cpp | 7 +- mozilla/widget/src/beos/nsDropTarget.cpp | 42 +- mozilla/widget/src/beos/nsFileWidget.cpp | 7 +- .../src/beos/nsFontRetrieverService.cpp | 15 +- mozilla/widget/src/beos/nsLabel.cpp | 7 +- mozilla/widget/src/beos/nsListBox.cpp | 9 +- mozilla/widget/src/beos/nsMenu.cpp | 13 +- mozilla/widget/src/beos/nsMenuBar.cpp | 7 +- mozilla/widget/src/beos/nsPopUpMenu.cpp | 9 +- mozilla/widget/src/beos/nsTextAreaWidget.cpp | 7 +- mozilla/widget/src/beos/nsTextHelper.cpp | 7 +- mozilla/widget/src/beos/nsTextWidget.cpp | 7 +- mozilla/widget/src/beos/nsToolkit.cpp | 7 +- mozilla/widget/src/beos/nsWidgetFactory.cpp | 7 +- mozilla/widget/src/beos/nsWindow.cpp | 47 +- mozilla/widget/src/gtk/nsAppShell.cpp | 21 +- mozilla/widget/src/gtk/nsClipboard.cpp | 35 +- mozilla/widget/src/gtk/nsContextMenu.cpp | 9 +- mozilla/widget/src/gtk/nsFilePicker.cpp | 7 +- mozilla/widget/src/gtk/nsFileWidget.cpp | 11 +- .../widget/src/gtk/nsFontRetrieverService.cpp | 15 +- mozilla/widget/src/gtk/nsGtkEventHandler.cpp | 27 +- mozilla/widget/src/gtk/nsGtkIMEHelper.cpp | 13 +- mozilla/widget/src/gtk/nsLookAndFeel.cpp | 7 +- mozilla/widget/src/gtk/nsMenu.cpp | 9 +- mozilla/widget/src/gtk/nsSound.cpp | 12 +- mozilla/widget/src/gtk/nsTextHelper.cpp | 7 +- mozilla/widget/src/gtk/nsWidget.cpp | 39 +- mozilla/widget/src/gtk/nsWindow.cpp | 61 +-- mozilla/widget/src/gtkxtbin/gtkxtbin.c | 18 +- mozilla/widget/src/mac/nsClipboard.cpp | 13 +- mozilla/widget/src/mac/nsContextMenu.cpp | 7 +- mozilla/widget/src/mac/nsDragService.cpp | 17 +- mozilla/widget/src/mac/nsDynamicMDEF.cpp | 73 +-- mozilla/widget/src/mac/nsDynamicMDEF.h | 9 +- mozilla/widget/src/mac/nsMacEventHandler.cpp | 85 ++-- mozilla/widget/src/mac/nsMacMessagePump.cpp | 9 +- mozilla/widget/src/mac/nsMenu.cpp | 45 +- mozilla/widget/src/mac/nsMenuBar.cpp | 11 +- mozilla/widget/src/mac/nsTextHelper.cpp | 17 +- mozilla/widget/src/mac/nsWindow.cpp | 11 +- .../nsMotifAppContextServiceFactory.cpp | 7 +- mozilla/widget/src/motif/nsAppShell.cpp | 17 +- mozilla/widget/src/motif/nsLabel.cpp | 7 +- mozilla/widget/src/motif/nsMenu.cpp | 20 +- mozilla/widget/src/motif/nsMenuItem.cpp | 15 +- mozilla/widget/src/motif/nsTextAreaWidget.cpp | 9 +- mozilla/widget/src/motif/nsTextHelper.cpp | 7 +- mozilla/widget/src/motif/nsTextWidget.cpp | 9 +- mozilla/widget/src/motif/nsToolkit.cpp | 11 +- mozilla/widget/src/motif/nsWidgetFactory.cpp | 7 +- mozilla/widget/src/motif/nsWindow.cpp | 29 +- mozilla/widget/src/motif/nsXtEventHandler.cpp | 13 +- mozilla/widget/src/os2/nsAppShell.cpp | 9 +- mozilla/widget/src/os2/nsCanvas.cpp | 15 +- mozilla/widget/src/os2/nsClipboard.cpp | 13 +- mozilla/widget/src/os2/nsDragService.cpp | 43 +- mozilla/widget/src/os2/nsFSTree.cpp | 21 +- mozilla/widget/src/os2/nsFileDialog.cpp | 9 +- .../widget/src/os2/nsFontRetrieverService.cpp | 7 +- mozilla/widget/src/os2/nsFrameWindow.cpp | 13 +- mozilla/widget/src/os2/nsModule.cpp | 17 +- mozilla/widget/src/os2/nsSound.cpp | 9 +- mozilla/widget/src/os2/nsWindow.cpp | 43 +- .../widget/src/photon/PtRawDrawContainer.cpp | 29 +- mozilla/widget/src/photon/nsAppShell.cpp | 21 +- mozilla/widget/src/photon/nsClipboard.cpp | 55 ++- mozilla/widget/src/photon/nsDragService.cpp | 59 +-- .../src/photon/nsFontRetrieverService.cpp | 15 +- mozilla/widget/src/photon/nsLabel.cpp | 7 +- mozilla/widget/src/photon/nsWidget.cpp | 375 +++++++-------- mozilla/widget/src/photon/nsWindow.cpp | 439 +++++++++--------- mozilla/widget/src/qt/nsAppShell.cpp | 8 +- mozilla/widget/src/qt/nsDragService.cpp | 7 +- mozilla/widget/src/qt/nsWidget.cpp | 9 +- mozilla/widget/src/qt/nsWidgetFactory.cpp | 5 + mozilla/widget/src/qt/nsWindow.cpp | 7 +- mozilla/widget/src/windows/nsAppShell.cpp | 7 +- mozilla/widget/src/windows/nsButton.cpp | 7 +- mozilla/widget/src/windows/nsClipboard.cpp | 33 +- mozilla/widget/src/windows/nsContextMenu.cpp | 19 +- mozilla/widget/src/windows/nsDataObj.cpp | 61 +-- .../src/windows/nsDataObjCollection.cpp | 17 +- mozilla/widget/src/windows/nsFileWidget.cpp | 9 +- .../src/windows/nsFontRetrieverService.cpp | 37 +- mozilla/widget/src/windows/nsLabel.cpp | 7 +- mozilla/widget/src/windows/nsMenu.cpp | 21 +- mozilla/widget/src/windows/nsMenuBar.cpp | 7 +- .../widget/src/windows/nsNativeDragSource.cpp | 15 +- .../widget/src/windows/nsNativeDragTarget.cpp | 13 +- mozilla/widget/src/windows/nsSound.cpp | 9 +- mozilla/widget/src/windows/nsWindow.cpp | 121 ++--- mozilla/widget/src/xlib/nsAppShell.cpp | 27 +- mozilla/widget/src/xlib/nsClipboard.cpp | 15 +- mozilla/widget/src/xlib/nsDragService.cpp | 11 +- mozilla/widget/src/xlib/nsSound.cpp | 13 +- mozilla/widget/src/xlib/nsToolkit.cpp | 9 +- mozilla/widget/src/xlib/nsWidget.cpp | 35 +- .../nsXlibWindowServiceFactory.cpp | 7 +- mozilla/widget/src/xpwidgets/nsBaseWidget.cpp | 11 +- .../widget/src/xpwidgets/nsTransferable.cpp | 15 +- .../widget/src/xpwidgets/nsXPLookAndFeel.cpp | 11 +- mozilla/widget/timer/src/rhapsody/nsTimer.cpp | 11 +- .../widget/timer/src/unix/gtk/nsTimerGtk.cpp | 13 +- .../timer/src/unix/motif/nsTimerMotif.cpp | 9 +- .../src/unix/motif/nsTimerMotifFactory.cpp | 7 +- .../widget/timer/src/unix/qt/nsTimerQt.cpp | 5 + .../timer/src/unix/qt/nsTimerQtFactory.cpp | 1 - .../timer/src/unix/xlib/nsTimerXlib.cpp | 31 +- mozilla/xpcom/base/nsConsoleService.cpp | 12 +- mozilla/xpcom/base/nsDebug.cpp | 155 +++---- mozilla/xpcom/base/nsTraceRefcnt.cpp | 49 +- mozilla/xpcom/base/nsTraceRefcntImpl.cpp | 49 +- .../xpcom/components/nsComponentManager.cpp | 26 +- mozilla/xpcom/components/nsGenericFactory.cpp | 30 +- .../components/nsNativeComponentLoader.cpp | 31 +- mozilla/xpcom/components/nsRegistry.cpp | 36 +- mozilla/xpcom/components/xcDll.cpp | 7 +- mozilla/xpcom/ds/bufferRoutines.h | 4 +- mozilla/xpcom/ds/nsBufferManager.h | 25 +- mozilla/xpcom/ds/nsDeque.cpp | 7 +- mozilla/xpcom/ds/nsPersistentProperties.cpp | 13 +- mozilla/xpcom/ds/nsStatistics.cpp | 6 + mozilla/xpcom/ds/nsString.cpp | 7 +- mozilla/xpcom/ds/nsString2.cpp | 6 +- mozilla/xpcom/ds/nsVoidBTree.cpp | 11 +- mozilla/xpcom/glue/nsDebug.cpp | 155 +++---- mozilla/xpcom/glue/nsGenericFactory.cpp | 30 +- mozilla/xpcom/io/MANIFEST_IDL | 2 - .../xpcom/io/nsAppFileLocationProvider.cpp | 7 +- mozilla/xpcom/io/nsDirectoryService.cpp | 7 +- mozilla/xpcom/io/nsFileSpecBeOS.cpp | 7 +- mozilla/xpcom/io/nsFileSpecUnix.cpp | 9 +- mozilla/xpcom/io/nsIFileStream.cpp | 8 +- mozilla/xpcom/io/nsLocalFileOS2.h | 7 +- mozilla/xpcom/io/nsLocalFileUnix.cpp | 26 +- mozilla/xpcom/io/nsLocalFileUnix.h | 8 + mozilla/xpcom/io/nsSpecialSystemDirectory.cpp | 27 +- mozilla/xpcom/proxy/src/nsProxyEventClass.cpp | 13 +- .../xpcom/proxy/src/nsProxyEventObject.cpp | 27 +- .../xptinfo/src/xptiInterfaceInfoManager.cpp | 21 +- .../reflect/xptinfo/src/xptiManifest.cpp | 7 +- .../xpcom/reflect/xptinfo/src/xptiMisc.cpp | 9 +- mozilla/xpcom/string/obsolete/nsString.cpp | 7 +- mozilla/xpcom/string/obsolete/nsString2.cpp | 6 +- .../src/nsAppFileLocationProvider.cpp | 2 +- .../xpfe/appshell/src/nsAppShellService.cpp | 19 +- .../appshell/src/nsCommandLineService.cpp | 11 +- mozilla/xpfe/appshell/src/nsCommonDialogs.cpp | 10 +- mozilla/xpfe/appshell/src/nsFileLocations.cpp | 9 +- mozilla/xpfe/appshell/src/nsUserInfoUnix.cpp | 9 +- .../xpfe/appshell/src/nsWebShellWindow.cpp | 27 +- mozilla/xpfe/bootstrap/appleevents/patricia.c | 18 +- mozilla/xpfe/bootstrap/nsAppRunner.cpp | 58 +-- .../xpfe/bootstrap/nsNativeAppSupportOS2.cpp | 64 +-- .../xpfe/bootstrap/nsNativeAppSupportWin.cpp | 70 +-- mozilla/xpfe/bootstrap/nsSigHandlers.cpp | 32 +- .../xpfe/browser/src/nsBrowserInstance.cpp | 146 +++--- .../bookmarks/src/nsBookmarksService.cpp | 37 +- mozilla/xpfe/components/build/nsModule.cpp | 3 + .../components/find/src/nsFindComponent.cpp | 35 +- .../history/src/nsGlobalHistory.cpp | 21 +- .../public/nsIAppShellComponentImpl.h | 32 +- .../related/src/nsRelatedLinksHandler.cpp | 17 +- .../sample/src/nsSampleAppShellComponent.cpp | 10 +- .../search/src/nsInternetSearchService.cpp | 74 +-- .../search/src/nsLocalSearchService.cpp | 9 +- .../components/shistory/src/nsSHistory.cpp | 13 +- .../startup/src/nsCommandLineService.cpp | 11 +- .../components/startup/src/nsUserInfoUnix.cpp | 9 +- .../xpfe/components/timebomb/nsTimeBomb.cpp | 13 +- .../ucth/src/nsUnknownContentTypeHandler.cpp | 47 +- .../urlbarhistory/src/nsUrlbarHistory.cpp | 23 +- .../xpfe/components/urlwidget/nsUrlWidget.cpp | 11 +- .../winhooks/nsWindowsHooksUtil.cpp | 8 +- .../components/xfer/src/nsStreamTransfer.cpp | 25 +- .../components/xfer/src/nsStreamXferOp.cpp | 57 ++- mozilla/xpinstall/src/nsInstall.cpp | 7 +- mozilla/xpinstall/src/nsInstallPatch.cpp | 7 +- .../xpinstall/src/nsInstallProgressDialog.cpp | 23 +- mozilla/xpinstall/src/nsJSInstall.cpp | 8 +- mozilla/xpinstall/src/nsXPInstallManager.cpp | 7 +- 757 files changed, 10724 insertions(+), 8223 deletions(-) diff --git a/mozilla/caps/src/nsScriptSecurityManager.cpp b/mozilla/caps/src/nsScriptSecurityManager.cpp index c380b68d2e5..361c9517caa 100644 --- a/mozilla/caps/src/nsScriptSecurityManager.cpp +++ b/mozilla/caps/src/nsScriptSecurityManager.cpp @@ -60,6 +60,15 @@ #include "nsIXPConnect.h" #include "nsIScriptGlobalObject.h" #include "nsIDOMWindowInternal.h" +#include "nslog.h" + +#ifdef DEBUG_jband +NS_IMPL_LOG_ENABLED(nsScriptSecurityManagerLog) +#else +NS_IMPL_LOG(nsScriptSecurityManagerLog) +#endif +#define PRINTF NS_LOG_PRINTF(nsScriptSecurityManagerLog) +#define FLUSH NS_LOG_FLUSH(nsScriptSecurityManagerLog) static NS_DEFINE_CID(kNetSupportDialogCID, NS_NETSUPPORTDIALOG_CID); static NS_DEFINE_IID(kIIOServiceIID, NS_IIOSERVICE_IID); @@ -922,13 +931,13 @@ Localize(char *genericString, nsString &result) ret = nsServiceManager::GetService(kIOServiceCID, kIIOServiceIID, (nsISupports**) &pNetService); if (NS_FAILED(ret)) { - NS_WARNING("cannot get net service\n"); + NS_WARNING("cannot get net service"); return ret; } nsIURI *uri = nsnull; ret = pNetService->NewURI(PROPERTIES_URL, nsnull, &uri); if (NS_FAILED(ret)) { - NS_WARNING("cannot create URI\n"); + NS_WARNING("cannot create URI"); nsServiceManager::ReleaseService(kIOServiceCID, pNetService); return ret; } @@ -938,7 +947,7 @@ Localize(char *genericString, nsString &result) nsServiceManager::ReleaseService(kIOServiceCID, pNetService); if (NS_FAILED(ret)) { - NS_WARNING("cannot create URL\n"); + NS_WARNING("cannot create URL"); return ret; } @@ -947,13 +956,13 @@ Localize(char *genericString, nsString &result) ret = nsServiceManager::GetService(kStringBundleServiceCID, kIStringBundleServiceIID, (nsISupports**) &pStringService); if (NS_FAILED(ret)) { - NS_WARNING("cannot get string service\n"); + NS_WARNING("cannot get string service"); return ret; } char *spec = nsnull; ret = url->GetSpec(&spec); if (NS_FAILED(ret)) { - NS_WARNING("cannot get url spec\n"); + NS_WARNING("cannot get url spec"); nsServiceManager::ReleaseService(kStringBundleServiceCID, pStringService); nsCRT::free(spec); return ret; @@ -964,7 +973,7 @@ Localize(char *genericString, nsString &result) nsCRT::free(spec); nsServiceManager::ReleaseService(kStringBundleServiceCID, pStringService); if (NS_FAILED(ret)) { - NS_WARNING("cannot create instance\n"); + NS_WARNING("cannot create instance"); return ret; } @@ -976,7 +985,7 @@ Localize(char *genericString, nsString &result) ret = bundle->GetStringFromName(strtmp.GetUnicode(), &ptrv); NS_RELEASE(bundle); if (NS_FAILED(ret)) { - NS_WARNING("cannot get string from name\n"); + NS_WARNING("cannot get string from name"); } result = ptrv; nsCRT::free(ptrv); @@ -1480,11 +1489,9 @@ nsScriptSecurityManager::GetScriptSecurityManager() if (NS_FAILED(rv)) { NS_WARNING("failed to install xpconnect security manager!"); } -#ifdef DEBUG_jband else { - printf("!!!!! xpc security manager registered\n"); + PRINTF("!!!!! xpc security manager registered"); } -#endif } else { NS_WARNING("can't get xpconnect to install security manager!"); diff --git a/mozilla/chrome/src/nsChromeProtocolHandler.cpp b/mozilla/chrome/src/nsChromeProtocolHandler.cpp index 4d8b47de1dd..d41863b4bcc 100644 --- a/mozilla/chrome/src/nsChromeProtocolHandler.cpp +++ b/mozilla/chrome/src/nsChromeProtocolHandler.cpp @@ -47,6 +47,13 @@ #include "nsRDFCID.h" #include "nsXPIDLString.h" #include "prlog.h" +#include "nslog.h" + +NS_IMPL_LOG(nsChromeProtocolHandlerLog) +#define PRINTF NS_LOG_PRINTF(nsChromeProtocolHandlerLog) +#define FLUSH NS_LOG_FLUSH(nsChromeProtocolHandlerLog) + +#define gLog nsChromeProtocolHandlerLog //---------------------------------------------------------------------- @@ -105,10 +112,6 @@ protected: static void* PR_CALLBACK HandleStopLoadEvent(PLEvent* aEvent); static void PR_CALLBACK DestroyLoadEvent(PLEvent* aEvent); -#ifdef PR_LOGGING - static PRLogModuleInfo* gLog; -#endif - public: static nsresult Create(nsIURI* aURI, nsIChannel** aResult); @@ -130,10 +133,6 @@ public: NS_DECL_NSICHANNEL }; -#ifdef PR_LOGGING -PRLogModuleInfo* nsCachedChromeChannel::gLog; -#endif - NS_IMPL_ADDREF(nsCachedChromeChannel); NS_IMPL_RELEASE(nsCachedChromeChannel); NS_IMPL_QUERY_INTERFACE2(nsCachedChromeChannel, nsIRequest, nsIChannel); @@ -160,11 +159,6 @@ nsCachedChromeChannel::nsCachedChromeChannel(nsIURI* aURI) { NS_INIT_REFCNT(); -#ifdef PR_LOGGING - if (! gLog) - gLog = PR_NewLogModule("nsCachedChromeChannel"); -#endif - PR_LOG(gLog, PR_LOG_DEBUG, ("nsCachedChromeChannel[%p]: created", this)); } @@ -683,7 +677,7 @@ nsChromeProtocolHandler::NewChannel(nsIURI* aURI, //nsXPIDLCString oldSpec; //aURI->GetSpec(getter_Copies(oldSpec)); - //printf("*************************** %s\n", (const char*)oldSpec); + //PRINTF("*************************** %s", (const char*)oldSpec); nsXPIDLCString spec; rv = reg->ConvertChromeURL(chromeURI, getter_Copies(spec)); @@ -709,7 +703,7 @@ nsChromeProtocolHandler::NewChannel(nsIURI* aURI, jar = do_QueryInterface(result); } if (!res && !file && !jar) { - NS_WARNING("Remote chrome not allowed! Only file:, resource:, and jar: are valid.\n"); + NS_WARNING("Remote chrome not allowed! Only file:, resource:, and jar: are valid."); result = nsnull; return NS_ERROR_FAILURE; } diff --git a/mozilla/chrome/src/nsChromeRegistry.cpp b/mozilla/chrome/src/nsChromeRegistry.cpp index 697dc849cc6..2798b3eea6c 100644 --- a/mozilla/chrome/src/nsChromeRegistry.cpp +++ b/mozilla/chrome/src/nsChromeRegistry.cpp @@ -77,6 +77,11 @@ #include "nsInt64.h" #include "nsIDirectoryService.h" #include "nsAppDirectoryServiceDefs.h" +#include "nslog.h" + +NS_IMPL_LOG(nsChromeRegistryLog) +#define PRINTF NS_LOG_PRINTF(nsChromeRegistryLog) +#define FLUSH NS_LOG_FLUSH(nsChromeRegistryLog) static char kChromePrefix[] = "chrome://"; static char kAllPackagesName[] = "all-packages.rdf"; @@ -1718,9 +1723,7 @@ NS_IMETHODIMP nsChromeRegistry::InstallProvider(const nsCString& aProviderType, PRBool aRemove) { // XXX don't allow local chrome overrides of install chrome! -#ifdef DEBUG - printf("*** Chrome Registration of %s: Checking for contents.rdf at %s\n", (const char*)aProviderType, (const char*)aBaseURL); -#endif + PRINTF("*** Chrome Registration of %s: Checking for contents.rdf at %s\n", (const char*)aProviderType, (const char*)aBaseURL); // Load the data source found at the base URL. nsCOMPtr dataSource; @@ -2634,9 +2637,7 @@ nsChromeRegistry::ProcessNewChromeBuffer(char *aBuffer, PRInt32 aLength) if (isSelection) { nsAutoString name; name.AssignWithConversion(chromeLocation); rv = SelectSkin(name.GetUnicode(), isProfile); -#ifdef DEBUG - printf("***** Chrome Registration: Selecting skin %s as default\n", (const char*)chromeLocation); -#endif + PRINTF("***** Chrome Registration: Selecting skin %s as default\n", (const char*)chromeLocation); } else rv = InstallSkin(chromeURL, isProfile, PR_FALSE); @@ -2647,9 +2648,7 @@ nsChromeRegistry::ProcessNewChromeBuffer(char *aBuffer, PRInt32 aLength) if (isSelection) { nsAutoString name; name.AssignWithConversion(chromeLocation); rv = SelectLocale(name.GetUnicode(), isProfile); -#ifdef DEBUG - printf("***** Chrome Registration: Selecting locale %s as default\n", (const char*)chromeLocation); -#endif + PRINTF("***** Chrome Registration: Selecting locale %s as default\n", (const char*)chromeLocation); } else rv = InstallLocale(chromeURL, isProfile); diff --git a/mozilla/chrome/tools/chromereg/regchrome.cpp b/mozilla/chrome/tools/chromereg/regchrome.cpp index 8439c81fd8c..6bae9521d18 100644 --- a/mozilla/chrome/tools/chromereg/regchrome.cpp +++ b/mozilla/chrome/tools/chromereg/regchrome.cpp @@ -39,7 +39,7 @@ int main(int argc, char **argv) nsIDirectoryServiceProvider *appFileLocProvider; appFileLocProvider = new nsAppFileLocationProvider; if (!appFileLocProvider) { - NS_WARNING("failed to create directory service provider\n"); + NS_WARNING("failed to create directory service provider"); return NS_ERROR_FAILURE; } // add a reference diff --git a/mozilla/content/base/src/nsContentPolicy.cpp b/mozilla/content/base/src/nsContentPolicy.cpp index 0e129563294..487492e5ab5 100644 --- a/mozilla/content/base/src/nsContentPolicy.cpp +++ b/mozilla/content/base/src/nsContentPolicy.cpp @@ -25,6 +25,15 @@ #include "nsContentPolicyUtils.h" #include "nsContentPolicy.h" #include "nsICategoryManager.h" +#include "nslog.h" + +#ifdef DEBUG_shaver +NS_IMPL_LOG_ENABLED(nsContentPolicyLog) +#else +NS_IMPL_LOG(nsContentPolicyLog) +#endif +#define PRINTF NS_LOG_PRINTF(nsContentPolicyLog) +#define FLUSH NS_LOG_FLUSH(nsContentPolicyLog) NS_IMPL_ISUPPORTS1(nsContentPolicy, nsIContentPolicy) @@ -85,9 +94,7 @@ nsContentPolicy::nsContentPolicy() if (NS_FAILED(string->GetData(getter_Copies(contractid)))) continue; -#ifdef DEBUG_shaver - fprintf(stderr, "POLICY: loading %s\n", (const char *)contractid); -#endif + PRINTF("POLICY: loading %s\n", (const char *)contractid); /* * Create this policy service and add to mPolicies. * diff --git a/mozilla/content/base/src/nsDocumentViewer.cpp b/mozilla/content/base/src/nsDocumentViewer.cpp index 59a576257a6..aa5642734f7 100644 --- a/mozilla/content/base/src/nsDocumentViewer.cpp +++ b/mozilla/content/base/src/nsDocumentViewer.cpp @@ -80,7 +80,6 @@ #include "nsIDOMHTMLFrameSetElement.h" #include "nsIFrameManager.h" - #include "nsIChromeRegistry.h" #include "nsIServiceManager.h" @@ -93,6 +92,11 @@ #include "nsISelectionController.h" #include "nsITransformMediator.h" +#include "nslog.h" + +NS_IMPL_LOG(nsDocumentViewerLog) +#define PRINTF NS_LOG_PRINTF(nsDocumentViewerLog) +#define FLUSH NS_LOG_FLUSH(nsDocumentViewerLog) static NS_DEFINE_CID(kEventQueueService, NS_EVENTQUEUESERVICE_CID); @@ -459,7 +463,7 @@ DocumentViewerImpl::BindToDocument(nsISupports *aDoc, const char *aCommand) NS_PRECONDITION(!mDocument, "Viewer is already bound to a document!"); #ifdef NOISY_VIEWER - printf("DocumentViewerImpl::BindToDocument\n"); + PRINTF("DocumentViewerImpl::BindToDocument\n"); #endif nsresult rv; @@ -1550,7 +1554,7 @@ PRInt32 width,height; if (factory) { #ifdef DEBUG_dcone - printf("PRINT JOB STARTING\n"); + PRINTF("PRINT JOB STARTING\n"); #endif nsIDeviceContextSpec *devspec = nsnull; @@ -1622,48 +1626,48 @@ PRInt32 width,height; float a1,a2; PRInt32 i1,i2; - printf("CRITICAL PRINTING INFORMATION\n"); - printf("PRESSHELL(%x) PRESCONTEXT(%x)\nVIEWMANAGER(%x) VIEW(%x)\n", - mPrintPS, mPrintPC,mPrintDC,mPrintVM,mPrintView); + PRINTF("CRITICAL PRINTING INFORMATION\n"); + PRINTF("PRESSHELL(%x) PRESCONTEXT(%x)\nVIEWMANAGER(%x) VIEW(%x)\n", + mPrintPS, mPrintPC,mPrintDC,mPrintVM,mPrintView); // DEVICE CONTEXT INFORMATION from PresContext - printf("DeviceContext of Presentation Context(%x)\n",dx); + PRINTF("DeviceContext of Presentation Context(%x)\n",dx); dx->GetDevUnitsToTwips(a1); dx->GetTwipsToDevUnits(a2); - printf(" DevToTwips = %f TwipToDev = %f\n",a1,a2); + PRINTF(" DevToTwips = %f TwipToDev = %f\n",a1,a2); dx->GetAppUnitsToDevUnits(a1); dx->GetDevUnitsToAppUnits(a2); - printf(" AppUnitsToDev = %f DevUnitsToApp = %f\n",a1,a2); + PRINTF(" AppUnitsToDev = %f DevUnitsToApp = %f\n",a1,a2); dx->GetCanonicalPixelScale(a1); - printf(" GetCanonicalPixelScale = %f\n",a1); + PRINTF(" GetCanonicalPixelScale = %f\n",a1); dx->GetScrollBarDimensions(a1, a2); - printf(" ScrollBar x = %f y = %f\n",a1,a2); + PRINTF(" ScrollBar x = %f y = %f\n",a1,a2); dx->GetZoom(a1); - printf(" Zoom = %f\n",a1); + PRINTF(" Zoom = %f\n",a1); dx->GetDepth((PRUint32&)i1); - printf(" Depth = %d\n",i1); + PRINTF(" Depth = %d\n",i1); dx->GetDeviceSurfaceDimensions(i1,i2); - printf(" DeviceDimension w = %d h = %d\n",i1,i2); + PRINTF(" DeviceDimension w = %d h = %d\n",i1,i2); // DEVICE CONTEXT INFORMATION - printf("DeviceContext created for print(%x)\n",mPrintDC); + PRINTF("DeviceContext created for print(%x)\n",mPrintDC); mPrintDC->GetDevUnitsToTwips(a1); mPrintDC->GetTwipsToDevUnits(a2); - printf(" DevToTwips = %f TwipToDev = %f\n",a1,a2); + PRINTF(" DevToTwips = %f TwipToDev = %f\n",a1,a2); mPrintDC->GetAppUnitsToDevUnits(a1); mPrintDC->GetDevUnitsToAppUnits(a2); - printf(" AppUnitsToDev = %f DevUnitsToApp = %f\n",a1,a2); + PRINTF(" AppUnitsToDev = %f DevUnitsToApp = %f\n",a1,a2); mPrintDC->GetCanonicalPixelScale(a1); - printf(" GetCanonicalPixelScale = %f\n",a1); + PRINTF(" GetCanonicalPixelScale = %f\n",a1); mPrintDC->GetScrollBarDimensions(a1, a2); - printf(" ScrollBar x = %f y = %f\n",a1,a2); + PRINTF(" ScrollBar x = %f y = %f\n",a1,a2); mPrintDC->GetZoom(a1); - printf(" Zoom = %f\n",a1); + PRINTF(" Zoom = %f\n",a1); mPrintDC->GetDepth((PRUint32&)i1); - printf(" Depth = %d\n",i1); + PRINTF(" Depth = %d\n",i1); mPrintDC->GetDeviceSurfaceDimensions(i1,i2); - printf(" DeviceDimension w = %d h = %d\n",i1,i2); + PRINTF(" DeviceDimension w = %d h = %d\n",i1,i2); #endif // Print listener setup... @@ -1682,12 +1686,12 @@ PRInt32 width,height; if(!mIsPrinting){ DocumentReadyForPrinting(); #ifdef DEBUG_dcone - printf("PRINT JOB ENDING, OBSERVER WAS NOT CALLED\n"); + PRINTF("PRINT JOB ENDING, OBSERVER WAS NOT CALLED\n"); #endif } else { // use the observer mechanism to finish the printing #ifdef DEBUG_dcone - printf("PRINTING OBSERVER STARTED\n"); + PRINTF("PRINTING OBSERVER STARTED\n"); #endif } } diff --git a/mozilla/content/base/src/nsNodeInfoManager.cpp b/mozilla/content/base/src/nsNodeInfoManager.cpp index 392dc58ebdc..451228da375 100644 --- a/mozilla/content/base/src/nsNodeInfoManager.cpp +++ b/mozilla/content/base/src/nsNodeInfoManager.cpp @@ -25,6 +25,15 @@ #include "nsCOMPtr.h" #include "nsString.h" #include "nsIAtom.h" +#include "nslog.h" + +#ifdef DEBUG_jst +NS_IMPL_LOG_ENABLED(nsNodeInfoManagerLog) +#else +NS_IMPL_LOG(nsNodeInfoManagerLog) +#endif +#define PRINTF NS_LOG_PRINTF(nsNodeInfoManagerLog) +#define FLUSH NS_LOG_FLUSH(nsNodeInfoManagerLog) nsNodeInfoManager* nsNodeInfoManager::gAnonymousNodeInfoManager = nsnull; PRUint32 nsNodeInfoManager::gNodeManagerCount = 0; @@ -65,9 +74,7 @@ nsNodeInfoManager::nsNodeInfoManager() nsNodeInfoInner::KeyCompare, PL_CompareValues, nsnull, nsnull); -#ifdef DEBUG_jst - printf ("Creating NodeInfoManager, gcount = %d\n", gNodeManagerCount); -#endif + PRINTF("Creating NodeInfoManager, gcount = %d\n", gNodeManagerCount); } @@ -88,9 +95,7 @@ nsNodeInfoManager::~nsNodeInfoManager() if (mNodeInfoHash) PL_HashTableDestroy(mNodeInfoHash); -#ifdef DEBUG_jst - printf ("Removing NodeInfoManager, gcount = %d\n", gNodeManagerCount); -#endif + PRINTF("Removing NodeInfoManager, gcount = %d\n", gNodeManagerCount); } diff --git a/mozilla/content/base/src/nsPlainTextSerializer.cpp b/mozilla/content/base/src/nsPlainTextSerializer.cpp index 1923f185431..5e9ddcf2b51 100644 --- a/mozilla/content/base/src/nsPlainTextSerializer.cpp +++ b/mozilla/content/base/src/nsPlainTextSerializer.cpp @@ -36,6 +36,11 @@ #include "nsITextContent.h" #include "nsTextFragment.h" #include "nsParserCIID.h" +#include "nslog.h" + +NS_IMPL_LOG(nsPlainTextSerializerLog) +#define PRINTF NS_LOG_PRINTF(nsPlainTextSerializerLog) +#define FLUSH NS_LOG_FLUSH(nsPlainTextSerializerLog) static NS_DEFINE_CID(kLWBrkCID, NS_LWBRK_CID); static NS_DEFINE_CID(kPrefServiceCID, NS_PREF_CID); @@ -482,7 +487,7 @@ nsPlainTextSerializer::DoOpenContainer(PRInt32 aTag) if (-1 != style.Find("-moz-pre-wrap", PR_TRUE, whitespace)) { #ifdef DEBUG_preformatted - printf("Set mPreFormatted based on style moz-pre-wrap\n"); + PRINTF("Set mPreFormatted based on style moz-pre-wrap\n"); #endif mPreFormatted = PR_TRUE; mCacheLine = PR_TRUE; @@ -504,14 +509,14 @@ nsPlainTextSerializer::DoOpenContainer(PRInt32 aTag) if (NS_SUCCEEDED(err)) { mWrapColumn = (PRUint32)col; #ifdef DEBUG_preformatted - printf("Set wrap column to %d based on style\n", mWrapColumn); + PRINTF("Set wrap column to %d based on style\n", mWrapColumn); #endif } } } else if (-1 != style.Find("pre", PR_TRUE, whitespace)) { #ifdef DEBUG_preformatted - printf("Set mPreFormatted based on style pre\n"); + PRINTF("Set mPreFormatted based on style pre\n"); #endif mPreFormatted = PR_TRUE; mCacheLine = PR_TRUE; @@ -1262,7 +1267,7 @@ nsPlainTextSerializer::Write(const nsString& aString) { #ifdef DEBUG_wrapping char* foo = aString.ToNewCString(); - printf("Write(%s): wrap col = %d, mColPos = %d\n", foo, mWrapColumn, mColPos); + PRINTF("Write(%s): wrap col = %d, mColPos = %d\n", foo, mWrapColumn, mColPos); nsMemory::Free(foo); #endif @@ -1328,7 +1333,7 @@ nsPlainTextSerializer::Write(const nsString& aString) } #ifdef DEBUG_wrapping - printf("No wrapping: newline is %d, totLen is %d; leaving mColPos = %d\n", + PRINTF("No wrapping: newline is %d, totLen is %d; leaving mColPos = %d\n", newline, totLen, mColPos); #endif return; @@ -1348,8 +1353,8 @@ nsPlainTextSerializer::Write(const nsString& aString) nsString remaining; aString.Right(remaining, totLen - bol); foo = remaining.ToNewCString(); - // printf("Next line: bol = %d, newlinepos = %d, totLen = %d, string = '%s'\n", - // bol, nextpos, totLen, foo); + // PRINTF("Next line: bol = %d, newlinepos = %d, totLen = %d, string = '%s'\n", + // bol, nextpos, totLen, foo))x; nsMemory::Free(foo); #endif @@ -1425,7 +1430,7 @@ nsPlainTextSerializer::Write(const nsString& aString) } } } - } // Continue looping over the string + }// Continue looping over the string } PRBool diff --git a/mozilla/content/base/src/nsRange.cpp b/mozilla/content/base/src/nsRange.cpp index ac6b041930b..66383c942ea 100644 --- a/mozilla/content/base/src/nsRange.cpp +++ b/mozilla/content/base/src/nsRange.cpp @@ -45,6 +45,11 @@ #include "nsIHTMLFragmentContentSink.h" // XXX Temporary inclusion to deal with fragment parsing #include "nsHTMLParts.h" +#include "nslog.h" + +NS_IMPL_LOG(nsRangeLog) +#define PRINTF NS_LOG_PRINTF(nsRangeLog) +#define FLUSH NS_LOG_FLUSH(nsRangeLog) static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); static NS_DEFINE_IID(kIScriptObjectOwnerIID, NS_ISCRIPTOBJECTOWNER_IID); @@ -1571,7 +1576,7 @@ nsresult nsRange::ToString(nsAWritableString& aReturn) } #ifdef DEBUG_range - printf("Range dump: -----------------------\n"); + PRINTF("Range dump: -----------------------\n"); #endif /* DEBUG */ // effeciency hack for simple case @@ -1585,7 +1590,7 @@ nsresult nsRange::ToString(nsAWritableString& aReturn) // If debug, dump it: nsCOMPtr cN (do_QueryInterface(mStartParent)); if (cN) cN->List(stdout); - printf("End Range dump: -----------------------\n"); + PRINTF("End Range dump: -----------------------\n"); #endif /* DEBUG */ // grab the text @@ -1646,7 +1651,7 @@ nsresult nsRange::ToString(nsAWritableString& aReturn) } #ifdef DEBUG_range - printf("End Range dump: -----------------------\n"); + PRINTF("End Range dump: -----------------------\n"); #endif /* DEBUG */ return NS_OK; } diff --git a/mozilla/content/base/src/nsSelection.cpp b/mozilla/content/base/src/nsSelection.cpp index 0f7d2fcdae7..a3f66a40f30 100644 --- a/mozilla/content/base/src/nsSelection.cpp +++ b/mozilla/content/base/src/nsSelection.cpp @@ -74,6 +74,11 @@ #include "nsIDocument.h" #include "nsISelectionController.h"//for the enums +#include "nslog.h" + +NS_IMPL_LOG(nsSelectionLog) +#define PRINTF NS_LOG_PRINTF(nsSelectionLog) +#define FLUSH NS_LOG_FLUSH(nsSelectionLog) #define STATUS_CHECK_RETURN_MACRO() {if (!mTracker) return NS_ERROR_FAILURE;} //#define DEBUG_TABLE 1 @@ -1243,7 +1248,7 @@ void printRange(nsIDOMRange *aDomRange) { if (!aDomRange) { - printf("NULL nsIDOMRange\n"); + PRINTF("NULL nsIDOMRange\n"); } nsCOMPtr startNode; nsCOMPtr endNode; @@ -1254,7 +1259,7 @@ void printRange(nsIDOMRange *aDomRange) aDomRange->GetEndParent(getter_AddRefs(endNode)); aDomRange->GetEndOffset(&endOffset); - printf("range: 0x%lx\t start: 0x%lx %ld, \t end: 0x%lx,%ld\n", + PRINTF("range: 0x%lx\t start: 0x%lx %ld, \t end: 0x%lx,%ld\n", (unsigned long)aDomRange, (unsigned long)(nsIDOMNode*)startNode, (long)startOffset, (unsigned long)(nsIDOMNode*)endNode, (long)endOffset); @@ -1341,7 +1346,7 @@ nsSelection::HandleTextEvent(nsGUIEvent *aGUIEvent) return NS_ERROR_NULL_POINTER; #ifdef DEBUG_TAGUE - printf("nsSelection: HandleTextEvent\n"); + PRINTF("nsSelection: HandleTextEvent\n"); #endif nsresult result(NS_OK); if (NS_TEXT_EVENT == aGUIEvent->message) { @@ -1838,7 +1843,7 @@ nsSelection::SetMouseDownState(PRBool aState) { // Mouse up kills dragging-table cell selection #ifdef DEBUG_TABLE_SELECTION -printf("SetMouseDownState to FALSE - stopping cell selection\n"); + PRINTF("SetMouseDownState to FALSE - stopping cell selection\n"); #endif mSelectingTableCells = PR_FALSE; mStartSelectedCell = nsnull; @@ -2277,7 +2282,7 @@ nsSelection::HandleTableSelection(nsIContent *aParentContent, PRInt32 aContentOf return NS_OK; } #ifdef DEBUG_TABLE_SELECTION -printf("HandleTableSelection: Dragged into a new column or row\n"); + PRINTF("HandleTableSelection: Dragged into a new column or row\n"); #endif // Continue dragging row or column selection return SelectRowOrColumn(childContent, mSelectingTableCellMode); @@ -2285,7 +2290,7 @@ printf("HandleTableSelection: Dragged into a new column or row\n"); else if (mSelectingTableCellMode == TABLESELECTION_CELL) { #ifdef DEBUG_TABLE_SELECTION -printf("HandleTableSelection: Dragged into a new cell\n"); + PRINTF("HandleTableSelection: Dragged into a new cell\n"); #endif // Clear this to be sure SelectBlockOfCells works correctly mAppendStartSelectedCell = nsnull; @@ -2329,7 +2334,7 @@ printf("HandleTableSelection: Dragged into a new cell\n"); if (mMouseDownState) { #ifdef DEBUG_TABLE_SELECTION -printf("HandleTableSelection: Mouse down event\n"); + PRINTF("HandleTableSelection: Mouse down event\n"); #endif // Clear cell we stored in mouse-down mUnselectCellOnMouseUp = nsnull; @@ -2370,7 +2375,7 @@ printf("HandleTableSelection: Mouse down event\n"); // Remember this cell to (possibly) unselect it on mouseup mUnselectCellOnMouseUp = childContent; #ifdef DEBUG_TABLE_SELECTION -printf("HandleTableSelection: Saving mUnselectCellOnMouseUp\n"); + PRINTF("HandleTableSelection: Saving mUnselectCellOnMouseUp\n"); #endif } else @@ -2422,7 +2427,7 @@ printf("HandleTableSelection: Saving mUnselectCellOnMouseUp\n"); else { #ifdef DEBUG_TABLE_SELECTION -printf("HandleTableSelection: Mouse UP event\n"); + PRINTF("HandleTableSelection: Mouse UP event\n"); #endif // First check if we are extending a block selection PRInt32 rangeCount; @@ -2445,7 +2450,7 @@ printf("HandleTableSelection: Mouse UP event\n"); nsCOMPtr range; PRInt32 offset; #ifdef DEBUG_TABLE_SELECTION -printf("HandleTableSelection: Unselecting mUnselectCellOnMouseUp; rangeCount=%d\n", rangeCount); + PRINTF("HandleTableSelection: Unselecting mUnselectCellOnMouseUp; rangeCount=%d\n", rangeCount); #endif for( PRInt32 i = 0; i < rangeCount; i++) { @@ -2476,7 +2481,7 @@ printf("HandleTableSelection: Unselecting mUnselectCellOnMouseUp; rangeCount=%d\ if (rangeCount == 1) { #ifdef DEBUG_TABLE_SELECTION -printf("HandleTableSelection: Unselecting single selected cell\n"); + PRINTF("HandleTableSelection: Unselecting single selected cell\n"); #endif // This was the only cell selected. // Collapse to "normal" selection inside the cell @@ -2490,7 +2495,7 @@ printf("HandleTableSelection: Unselecting single selected cell\n"); return mDomSelections[index]->Collapse(childNode, 0); } #ifdef DEBUG_TABLE_SELECTION -printf("HandleTableSelection: Removing cell from multi-cell selection\n"); + PRINTF("HandleTableSelection: Removing cell from multi-cell selection\n"); #endif //TODO: Should we try to reassign to a different existing cell? //mStartSelectedCell = nsnull; @@ -2510,7 +2515,7 @@ printf("HandleTableSelection: Removing cell from multi-cell selection\n"); // we may append by using Shift+click in another cell mAppendStartSelectedCell = childContent; #ifdef DEBUG_TABLE_SELECTION -printf("HandleTableSelection: Setting mAppendStartSelectedCell for append block\n"); + PRINTF("HandleTableSelection: Setting mAppendStartSelectedCell for append block\n"); #endif } } @@ -2530,7 +2535,7 @@ nsSelection::SelectBlockOfCells(nsIContent *aEndCell) { // We are appending a new block #ifdef DEBUG_TABLE_SELECTION -printf("SelectBlockOfCells -- using mAppendStartSelectedCell\n"); + PRINTF("SelectBlockOfCells -- using mAppendStartSelectedCell\n"); #endif startCell = mAppendStartSelectedCell; } @@ -2538,14 +2543,14 @@ printf("SelectBlockOfCells -- using mAppendStartSelectedCell\n"); { startCell = mStartSelectedCell; #ifdef DEBUG_TABLE_SELECTION -printf("SelectBlockOfCells -- using mStartSelectedCell\n"); + PRINTF("SelectBlockOfCells -- using mStartSelectedCell\n"); #endif } if (!startCell) { #ifdef DEBUG_TABLE_SELECTION -printf("SelectBlockOfCells -- NO START CELL!\n"); + PRINTF("SelectBlockOfCells -- NO START CELL!\n"); #endif return NS_OK; } @@ -2591,8 +2596,8 @@ printf("SelectBlockOfCells -- NO START CELL!\n"); if (NS_FAILED(result)) return result; #ifdef DEBUG_TABLE_SELECTION -if (!range) -printf("SelectBlockOfCells -- range is null\n"); + if (!range) + PRINTF("SelectBlockOfCells -- range is null\n"); #endif if (range && (curRowIndex < minRowIndex || curRowIndex > maxRowIndex || @@ -3094,7 +3099,7 @@ nsSelection::DeleteFromDocument() else { // Otherwise it's harder, have to find the previous node - printf("Sorry, don't know how to delete across frame boundaries yet\n"); + PRINTF("Sorry, don't know how to delete across frame boundaries yet\n"); return NS_ERROR_NOT_IMPLEMENTED; } } @@ -3126,7 +3131,7 @@ nsSelection::DeleteFromDocument() mDomSelections[index]->Collapse(mDomSelections[index]->FetchAnchorNode(), mDomSelections[index]->FetchAnchorOffset()); #ifdef DEBUG else - printf("Don't know how to set selection back past frame boundary\n"); + PRINTF("Don't know how to set selection back past frame boundary\n"); #endif return NS_OK; @@ -4720,12 +4725,12 @@ nsDOMSelection::Collapse(nsIDOMNode* aParentNode, PRInt32 aOffset) nsAutoString tagString; tag->ToString(tagString); char * tagCString = tagString.ToNewCString(); - printf ("Sel. Collapse to %p %s %d\n", content, tagCString, aOffset); + PRINTF ("Sel. Collapse to %p %s %d\n", content, tagCString, aOffset); delete [] tagCString; } } else { - printf ("Sel. Collapse set to null parent.\n"); + PRINTF ("Sel. Collapse set to null parent.\n"); } #endif @@ -5519,9 +5524,9 @@ nsDOMSelection::Extend(nsIDOMNode* aParentNode, PRInt32 aOffset) DEBUG_OUT_RANGE(range); #if 0 if (eDirNext == mDirection) - printf(" direction = 1 LEFT TO RIGHT\n"); + PRINTF(" direction = 1 LEFT TO RIGHT\n"); else - printf(" direction = 0 RIGHT TO LEFT\n"); + PRINTF(" direction = 0 RIGHT TO LEFT\n"); #endif SetDirection(dir); #ifdef DEBUG_SELECTION @@ -5536,12 +5541,12 @@ nsDOMSelection::Extend(nsIDOMNode* aParentNode, PRInt32 aOffset) nsAutoString tagString; tag->ToString(tagString); char * tagCString = tagString.ToNewCString(); - printf ("Sel. Extend to %p %s %d\n", content, tagCString, aOffset); + PRINTF ("Sel. Extend to %p %s %d\n", content, tagCString, aOffset); delete [] tagCString; } } else { - printf ("Sel. Extend set to null parent.\n"); + PRINTF ("Sel. Extend set to null parent.\n"); } #endif if (!mFrameSelection) @@ -5633,7 +5638,7 @@ nsDOMSelection::ContainsNode(nsIDOMNode* aNode, PRBool aRecursive, PRBool* aYes) nsAutoString name, value; aNode->GetNodeName(name); aNode->GetNodeValue(value); - printf("%s [%s]: %d, %d\n", name.ToNewCString(), value.ToNewCString(), + PRINTF("%s [%s]: %d, %d\n", name.ToNewCString(), value.ToNewCString(), nodeStartsBeforeRange, nodeEndsAfterRange); #endif PRUint16 nodeType; diff --git a/mozilla/content/base/src/nsStyleContext.cpp b/mozilla/content/base/src/nsStyleContext.cpp index 978f19add2c..43c6dfd18fe 100644 --- a/mozilla/content/base/src/nsStyleContext.cpp +++ b/mozilla/content/base/src/nsStyleContext.cpp @@ -49,6 +49,16 @@ #include "nsIStyleSet.h" #include "nsISizeOfHandler.h" #include "nsIPresShell.h" +#include "nslog.h" +#undef fprintf + +#ifdef NOISY_DEBUG +NS_IMPL_LOG_ENABLED(nsStyleContextLog) +#else +NS_IMPL_LOG(nsStyleContextLog) +#endif +#define PRINTF NS_LOG_PRINTF(nsStyleContextLog) +#define FLUSH NS_LOG_FLUSH(nsStyleContextLog) static NS_DEFINE_IID(kIStyleContextIID, NS_ISTYLECONTEXT_IID); @@ -2021,9 +2031,7 @@ PRUint32 nsStyleContextData::Release(void) --mRefCnt; NS_LOG_RELEASE(this,mRefCnt,"nsStyleContextData"); if (0 == mRefCnt) { -#ifdef NOISY_DEBUG - printf("deleting nsStyleContextData instance: (%ld)\n", (long)(--gInstanceCount)); -#endif + PRINTF("deleting nsStyleContextData instance: (%ld)\n", (long)(--gInstanceCount)); delete this; return 0; } @@ -2042,10 +2050,8 @@ nsStyleContextData *nsStyleContextData::Create(nsIPresContext *aPresContext) pData = new nsStyleContextData(aPresContext); if (pData) { NS_ADDREF(pData); -#ifdef NOISY_DEBUG - printf("new nsStyleContextData instance: (%ld) CRC=%lu\n", + PRINTF("new nsStyleContextData instance: (%ld) CRC=%lu\n", (long)(++gInstanceCount), (unsigned long)pData->ComputeCRC32(0)); -#endif // NOISY_DEBUG } } return pData; @@ -2907,14 +2913,10 @@ StyleContextImpl::RemapStyle(nsIPresContext* aPresContext, PRBool aRecurse) if ((NS_SUCCEEDED(mStyleSet->FindMatchingContext(this, &matchingSC))) && (nsnull != matchingSC)) { ShareStyleDataFrom(matchingSC); -#ifdef NOISY_DEBUG - printf("SC Data Shared :)\n"); -#endif + PRINTF("SC Data Shared :)\n"); NS_IF_RELEASE(matchingSC); } else { -#ifdef NOISY_DEBUG - printf("Unique SC Data - Not Shared :(\n"); -#endif + PRINTF("Unique SC Data - Not Shared :(\n"); } } // if(bDisableSharing==false) @@ -3130,7 +3132,7 @@ StyleContextImpl::StyleDataMatches(nsIStyleContext* aStyleContextToMatch, #ifdef DEBUG if (hint > 0) { gFalsePos++; - // printf("CRC match but CalcStyleDifference shows differences: crc is not sufficient?"); + // PRINTF("CRC match but CalcStyleDifference shows differences: crc is not sufficient?"); } #endif *aMatches = (0 == hint) ? PR_TRUE : PR_FALSE; @@ -3148,7 +3150,7 @@ StyleContextImpl::StyleDataMatches(nsIStyleContext* aStyleContextToMatch, NS_ASSERTION(hint>0,"!!!FALSE-NEGATIVE in StyleMatchesData!!!"); */ } - // printf("False-Pos: %ld - Screened: %ld\n", gFalsePos, gScreenedByCRC); + // PRINTF("False-Pos: %ld - Screened: %ld\n", gFalsePos, gScreenedByCRC); #endif } return rv; @@ -3249,32 +3251,32 @@ void StyleContextImpl::SizeOf(nsISizeOfHandler *aSizeOfHandler, PRUint32 &aSize) bDetailDumpDone = PR_TRUE; PRUint32 totalSize=0; - printf( "Detailed StyleContextImpl dump: basic class sizes of members\n" ); - printf( "*************************************\n"); - printf( " - StyleFontImpl: %ld\n", (long)sizeof(GETSCDATA(Font)) ); + PRINTF( "Detailed StyleContextImpl dump: basic class sizes of members\n" ); + PRINTF( "*************************************\n"); + PRINTF( " - StyleFontImpl: %ld\n", (long)sizeof(GETSCDATA(Font)) ); totalSize += (long)sizeof(GETSCDATA(Font)); - printf( " - StyleColorImpl: %ld\n", (long)sizeof(GETSCDATA(Color)) ); + PRINTF( " - StyleColorImpl: %ld\n", (long)sizeof(GETSCDATA(Color)) ); totalSize += (long)sizeof(GETSCDATA(Color)); - printf( " - StyleSpacingImpl: %ld\n", (long)sizeof(GETSCDATA(Spacing)) ); + PRINTF( " - StyleSpacingImpl: %ld\n", (long)sizeof(GETSCDATA(Spacing)) ); totalSize += (long)sizeof(GETSCDATA(Spacing)); - printf( " - StyleListImpl: %ld\n", (long)sizeof(GETSCDATA(List)) ); + PRINTF( " - StyleListImpl: %ld\n", (long)sizeof(GETSCDATA(List)) ); totalSize += (long)sizeof(GETSCDATA(List)); - printf( " - StylePositionImpl: %ld\n", (long)sizeof(GETSCDATA(Position)) ); + PRINTF( " - StylePositionImpl: %ld\n", (long)sizeof(GETSCDATA(Position)) ); totalSize += (long)sizeof(GETSCDATA(Position)); - printf( " - StyleTextImpl: %ld\n", (long)sizeof(GETSCDATA(Text)) ); + PRINTF( " - StyleTextImpl: %ld\n", (long)sizeof(GETSCDATA(Text)) ); totalSize += (long)sizeof(GETSCDATA(Text)); - printf( " - StyleDisplayImpl: %ld\n", (long)sizeof(GETSCDATA(Display)) ); + PRINTF( " - StyleDisplayImpl: %ld\n", (long)sizeof(GETSCDATA(Display)) ); totalSize += (long)sizeof(GETSCDATA(Display)); - printf( " - StyleTableImpl: %ld\n", (long)sizeof(GETSCDATA(Table)) ); + PRINTF( " - StyleTableImpl: %ld\n", (long)sizeof(GETSCDATA(Table)) ); totalSize += (long)sizeof(GETSCDATA(Table)); - printf( " - StyleContentImpl: %ld\n", (long)sizeof(GETSCDATA(Content)) ); + PRINTF( " - StyleContentImpl: %ld\n", (long)sizeof(GETSCDATA(Content)) ); totalSize += (long)sizeof(GETSCDATA(Content)); - printf( " - StyleUserInterfaceImpl: %ld\n", (long)sizeof(GETSCDATA(UserInterface)) ); + PRINTF( " - StyleUserInterfaceImpl: %ld\n", (long)sizeof(GETSCDATA(UserInterface)) ); totalSize += (long)sizeof(GETSCDATA(UserInterface)); - printf( " - StylePrintImpl: %ld\n", (long)sizeof(GETSCDATA(Print))); + PRINTF( " - StylePrintImpl: %ld\n", (long)sizeof(GETSCDATA(Print))); totalSize += (long)sizeof(GETSCDATA(Print)); - printf( " - Total: %ld\n", (long)totalSize); - printf( "*************************************\n"); + PRINTF( " - Total: %ld\n", (long)totalSize); + PRINTF( "*************************************\n"); } // first get the unique items collection diff --git a/mozilla/content/base/src/nsStyleSet.cpp b/mozilla/content/base/src/nsStyleSet.cpp index fd1cee1e16d..f1bfeff23ff 100644 --- a/mozilla/content/base/src/nsStyleSet.cpp +++ b/mozilla/content/base/src/nsStyleSet.cpp @@ -37,6 +37,11 @@ #include "nsICSSStyleSheet.h" #include "nsNetUtil.h" #include "nsIStyleRuleSupplier.h" +#include "nslog.h" + +NS_IMPL_LOG(nsStyleSetLog) +#define PRINTF NS_LOG_PRINTF(nsStyleSetLog) +#define FLUSH NS_LOG_FLUSH(nsStyleSetLog) #ifdef MOZ_PERF_METRICS #include "nsITimeRecorder.h" @@ -316,7 +321,7 @@ StyleSetImpl::~StyleSetImpl() #ifdef DEBUG NS_ASSERTION( mStyleContextCache.Count() == 0, "StyleContextCache is not empty in StyleSet destructor: style contexts are being leaked"); if (mStyleContextCache.Count() > 0) { - printf("*** Leaking %d style context instances (reported by the StyleContextCache) ***\n", mStyleContextCache.Count()); + PRINTF("*** Leaking %d style context instances (reported by the StyleContextCache) ***\n", mStyleContextCache.Count()); } #endif #endif @@ -677,9 +682,7 @@ NS_IMETHODIMP StyleSetImpl::EnableQuirkStyleSheet(PRBool aEnable) } } if (mQuirkStyleSheet) { -#ifdef DEBUG - printf( "%s Quirk StyleSheet\n", aEnable ? "Enabling" : "Disabling" ); -#endif + PRINTF( "%s Quirk StyleSheet\n", aEnable ? "Enabling" : "Disabling" ); mQuirkStyleSheet->SetEnabled(aEnable); } return rv; @@ -769,12 +772,12 @@ nsIStyleContext* StyleSetImpl::GetContext(nsIPresContext* aPresContext, aUsedRules = PRBool(nsnull != aRules); } #ifdef NOISY_DEBUG - fprintf(stdout, "+++ NewSC %d +++\n", ++gNewCount); + PRINTF("+++ NewSC %d +++\n", ++gNewCount); #endif } #ifdef NOISY_DEBUG else { - fprintf(stdout, "--- SharedSC %d ---\n", ++gSharedCount); + PRINTF("--- SharedSC %d ---\n", ++gSharedCount); } #endif @@ -1392,9 +1395,7 @@ StyleSetImpl::StartTimer(PRUint32 aTimerID) if (mTimerEnabled) { MOZ_TIMER_START(mStyleResolutionWatch); } else { -#ifdef NOISY_DEBUG - printf( "Attempt to start timer while disabled - ignoring\n" ); -#endif + PRINTF( "Attempt to start timer while disabled - ignoring\n" ); } } else @@ -1413,9 +1414,7 @@ StyleSetImpl::StopTimer(PRUint32 aTimerID) if (mTimerEnabled) { MOZ_TIMER_STOP(mStyleResolutionWatch); } else { -#ifdef NOISY_DEBUG - printf( "Attempt to stop timer while disabled - ignoring\n" ); -#endif + PRINTF( "Attempt to stop timer while disabled - ignoring\n" ); } } else @@ -1477,9 +1476,7 @@ PRUint32 StyleContextCache::Count(void) Tickle("From Count()"); #endif -#ifdef NOISY_DEBUG - printf("StyleContextCache count: %ld\n", (long)mCount); -#endif + PRINTF("StyleContextCache count: %ld\n", (long)mCount); return mCount; } @@ -1500,9 +1497,7 @@ nsresult StyleContextCache::AddContext(scKey aKey, nsIStyleContext *aContext) } DumpStats(); } else { -#ifdef DEBUG - printf( "Context already in list in StyleContextCache::AddContext\n"); -#endif + PRINTF( "Context already in list in StyleContextCache::AddContext\n"); rv = NS_ERROR_FAILURE; } } @@ -1528,11 +1523,9 @@ nsresult StyleContextCache::RemoveContext(scKey aKey, nsIStyleContext *aContext) if (NS_SUCCEEDED(rv)) { NS_ASSERTION(GetList(aKey) == nsnull, "Failed to delete list in StyleContextCache::RemoveContext"); } -#ifdef DEBUG else { - printf( "Error removing all contexts in StyleContextCache::RemoveContext\n"); + PRINTF( "Error removing all contexts in StyleContextCache::RemoveContext\n"); } -#endif } } return rv; @@ -1591,10 +1584,10 @@ PRBool HashTableEnumDump(nsHashKey *aKey, void *aData, void* closure) } if (nsnull == aKey && nsnull == aData && closure != nsnull) { // dump the cumulatives - printf("----------------------------------------------------------------------------------\n"); - printf("(%d lists, %ld contexts) List Lengths: Min=%ld Max=%ld Average=%ld Unary=%ld\n", + PRINTF("----------------------------------------------------------------------------------\n"); + PRINTF("(%d lists, %ld contexts) List Lengths: Min=%ld Max=%ld Average=%ld Unary=%ld\n", (int)nCount, (long)nTotal, (long)nMin, (long)nMax, (long)(nCount>0 ? nTotal/nCount : 0), (long)nUnary); - printf("----------------------------------------------------------------------------------\n"); + PRINTF("----------------------------------------------------------------------------------\n"); return PR_TRUE; } @@ -1602,7 +1595,7 @@ PRBool HashTableEnumDump(nsHashKey *aKey, void *aData, void* closure) nsVoidArray *pList = (nsVoidArray *)aData; if (pList) { PRUint32 count = pList->Count(); - printf("List Length at key %lu:\t%ld\n", + PRINTF("List Length at key %lu:\t%ld\n", (unsigned long)aKey->HashValue(), (long)count ); nCount++; @@ -1630,7 +1623,7 @@ PRBool HashTableEnumTickle(nsHashKey *aKey, void *aData, void* closure) if (pContext) { scKey key; pContext->GetStyleContextKey(key); - printf( "%p tickled\n"); + PRINTF( "%p tickled\n"); } } } @@ -1640,20 +1633,20 @@ PRBool HashTableEnumTickle(nsHashKey *aKey, void *aData, void* closure) void StyleContextCache::DumpStats(void) { #ifdef DUMP_CACHE_STATS - printf("StyleContextCache DumpStats BEGIN\n"); + PRINTF("StyleContextCache DumpStats BEGIN\n"); HashTableEnumDump(nsnull, nsnull, nsnull); mHashTable.Enumerate(HashTableEnumDump); HashTableEnumDump(nsnull, nsnull, "HACK!"); - printf("StyleContextCache DumpStats END\n"); + PRINTF("StyleContextCache DumpStats END\n"); #endif } void StyleContextCache::Tickle(const char *msg) { #ifdef DEBUG - printf("Tickling: %s\n", msg ? msg : ""); + PRINTF("Tickling: %s\n", msg ? msg : ""); mHashTable.Enumerate(HashTableEnumTickle); - printf("Tickle done.\n"); + PRINTF("Tickle done.\n"); #endif } @@ -1673,9 +1666,7 @@ StyleSetImpl::AddStyleContext(nsIStyleContext *aNewStyleContext) scKey key; aNewStyleContext->GetStyleContextKey(key); rv = mStyleContextCache.AddContext(key,aNewStyleContext); -#ifdef NOISY_DEBUG - printf( "StyleContextCount: %ld\n", (long)mStyleContextCache.Count()); -#endif + PRINTF( "StyleContextCount: %ld\n", (long)mStyleContextCache.Count()); } #else // DONT USE_FAST_CACHE @@ -1684,9 +1675,7 @@ StyleSetImpl::AddStyleContext(nsIStyleContext *aNewStyleContext) NS_ASSERTION((mStyleContextCache.IndexOf(aNewStyleContext) == -1), "StyleContext added in AddStyleContext is already in cache"); if (aNewStyleContext) { rv = mStyleContextCache.AppendElement(aNewStyleContext); -#ifdef NOISY_DEBUG - printf( "StyleContextCount: %ld\n", (long)mStyleContextCache.Count()); -#endif + PRINTF( "StyleContextCount: %ld\n", (long)mStyleContextCache.Count()); } #endif // USE_FAST_CACHE @@ -1708,9 +1697,7 @@ StyleSetImpl::RemoveStyleContext(nsIStyleContext *aNewStyleContext) scKey key; aNewStyleContext->GetStyleContextKey(key); rv = mStyleContextCache.RemoveContext(key,aNewStyleContext); -#ifdef NOISY_DEBUG - printf( "StyleContextCount: %ld\n", (long)mStyleContextCache.Count()); -#endif + PRINTF( "StyleContextCount: %ld\n", (long)mStyleContextCache.Count()); } #else //DONT USE_FAST_CACHE @@ -1719,9 +1706,7 @@ StyleSetImpl::RemoveStyleContext(nsIStyleContext *aNewStyleContext) NS_ASSERTION((mStyleContextCache.IndexOf(aNewStyleContext) != -1), "StyleContext removed in AddStyleContext is not in cache"); if (aNewStyleContext) { rv = mStyleContextCache.RemoveElement(aNewStyleContext); -#ifdef NOISY_DEBUG - printf( "StyleContextCount: %ld\n", (long)mStyleContextCache.Count()); -#endif + PRINTF( "StyleContextCount: %ld\n", (long)mStyleContextCache.Count()); } #endif //#ifdef USE_FAST_CACHE diff --git a/mozilla/content/events/src/nsDOMEvent.cpp b/mozilla/content/events/src/nsDOMEvent.cpp index bc7a4175f36..1422175ac70 100644 --- a/mozilla/content/events/src/nsDOMEvent.cpp +++ b/mozilla/content/events/src/nsDOMEvent.cpp @@ -40,6 +40,11 @@ #include "nsIDOMAbstractView.h" #include "prmem.h" #include "nsLayoutAtoms.h" +#include "nslog.h" + +NS_IMPL_LOG(nsDOMEventLog) +#define PRINTF NS_LOG_PRINTF(nsDOMEventLog) +#define FLUSH NS_LOG_FLUSH(nsDOMEventLog) static NS_DEFINE_IID(kIFrameIID, NS_IFRAME_IID); @@ -581,7 +586,7 @@ NS_METHOD nsDOMEvent::GetCharCode(PRUint32* aCharCode) case NS_KEY_UP: case NS_KEY_DOWN: #if defined(NS_DEBUG) && defined(DEBUG_brade) - printf("GetCharCode used for wrong key event; should use onkeypress.\n"); + PRINTF("GetCharCode used for wrong key event; should use onkeypress.\n"); #endif *aCharCode = 0; break; @@ -589,7 +594,7 @@ NS_METHOD nsDOMEvent::GetCharCode(PRUint32* aCharCode) *aCharCode = ((nsKeyEvent*)mEvent)->charCode; #if defined(NS_DEBUG) && defined(DEBUG_buster) if (0==*aCharCode) - printf("GetCharCode used correctly but no valid key!\n"); + PRINTF("GetCharCode used correctly but no valid key!\n"); #endif break; default: diff --git a/mozilla/content/events/src/nsEventListenerManager.cpp b/mozilla/content/events/src/nsEventListenerManager.cpp index 4c981f4b261..f708a3bd783 100644 --- a/mozilla/content/events/src/nsEventListenerManager.cpp +++ b/mozilla/content/events/src/nsEventListenerManager.cpp @@ -56,6 +56,11 @@ #include "nsIJSContextStack.h" #include "nsIDocument.h" #include "nsIPresShell.h" +#include "nslog.h" + +NS_IMPL_LOG(nsEventListenerManagerLog) +#define PRINTF NS_LOG_PRINTF(nsEventListenerManagerLog) +#define FLUSH NS_LOG_FLUSH(nsEventListenerManagerLog) static NS_DEFINE_IID(kIEventListenerManagerIID, NS_IEVENTLISTENERMANAGER_IID); static NS_DEFINE_IID(kIDOMEventListenerIID, NS_IDOMEVENTLISTENER_IID); @@ -991,9 +996,7 @@ nsresult nsEventListenerManager::HandleEvent(nsIPresContext* aPresContext, case NS_COMPOSITION_END: case NS_COMPOSITION_QUERY: case NS_RECONVERSION_QUERY: -#if DEBUG_TAGUE - printf("DOM: got composition event\n"); -#endif + PRINTF("DOM: got composition event\n"); if (nsnull != mCompositionListeners) { if (nsnull == *aDOMEvent) { ret = NS_NewDOMUIEvent(aDOMEvent,aPresContext,empty,aEvent); @@ -1056,9 +1059,7 @@ nsresult nsEventListenerManager::HandleEvent(nsIPresContext* aPresContext, break; case NS_TEXT_EVENT: -#if DEBUG_TAGUE - printf("DOM: got text event\n"); -#endif + PRINTF("DOM: got text event\n"); if (nsnull != mTextListeners) { if (nsnull == *aDOMEvent) { ret = NS_NewDOMUIEvent(aDOMEvent,aPresContext,empty,aEvent); diff --git a/mozilla/content/events/src/nsEventStateManager.cpp b/mozilla/content/events/src/nsEventStateManager.cpp index 39ac748d710..f49658de2e5 100644 --- a/mozilla/content/events/src/nsEventStateManager.cpp +++ b/mozilla/content/events/src/nsEventStateManager.cpp @@ -71,6 +71,15 @@ #include "nsIDocShell.h" #include "nsIMarkupDocumentViewer.h" #include "nsITreeFrame.h" +#include "nslog.h" + +#ifdef DEBUG_hyatt +NS_IMPL_LOG_ENABLED(nsEventStateManagerLog) +#else +NS_IMPL_LOG(nsEventStateManagerLog) +#endif +#define PRINTF NS_LOG_PRINTF(nsEventStateManagerLog) +#define FLUSH NS_LOG_FLUSH(nsEventStateManagerLog) //we will use key binding by default now. this wil lbreak viewer for now #define NON_KEYBINDING 0 @@ -81,8 +90,6 @@ nsIContent * gLastFocusedContent = 0; // Strong reference nsIDocument * gLastFocusedDocument = 0; // Strong reference nsIPresContext* gLastFocusedPresContext = 0; // Weak reference -PRLogModuleInfo *MOUSEWHEEL; - PRUint32 nsEventStateManager::mInstanceCount = 0; enum { @@ -130,8 +137,6 @@ nsEventStateManager::nsEventStateManager() NS_INIT_REFCNT(); ++mInstanceCount; - if (!MOUSEWHEEL) - MOUSEWHEEL = PR_NewLogModule("MOUSEWHEEL"); } NS_IMETHODIMP @@ -314,9 +319,7 @@ nsEventStateManager::PreHandleEvent(nsIPresContext* aPresContext, break; case NS_GOTFOCUS: { -#ifdef DEBUG_hyatt - printf("Got focus.\n"); -#endif + PRINTF("Got focus.\n"); EnsureDocument(aPresContext); diff --git a/mozilla/content/html/content/src/nsGenericHTMLElement.cpp b/mozilla/content/html/content/src/nsGenericHTMLElement.cpp index 10249427b59..d60ad988cbd 100644 --- a/mozilla/content/html/content/src/nsGenericHTMLElement.cpp +++ b/mozilla/content/html/content/src/nsGenericHTMLElement.cpp @@ -91,6 +91,13 @@ #include "nsIHTMLContentSink.h" #include "nsHTMLContentSinkStream.h" #include "nsLayoutCID.h" +#include "nslog.h" +#undef fprintf + +NS_IMPL_LOG(nsGenericHTMLElementLog) +#define PRINTF NS_LOG_PRINTF(nsGenericHTMLElementLog) +#define FLUSH NS_LOG_FLUSH(nsGenericHTMLElementLog) + // XXX todo: add in missing out-of-memory checks #include "nsIPref.h" // Used by the temp pref, should be removed! diff --git a/mozilla/content/html/document/src/nsHTMLContentSink.cpp b/mozilla/content/html/document/src/nsHTMLContentSink.cpp index bb71c69854a..4d3a03c1499 100644 --- a/mozilla/content/html/document/src/nsHTMLContentSink.cpp +++ b/mozilla/content/html/document/src/nsHTMLContentSink.cpp @@ -110,6 +110,13 @@ #include "nsContentPolicyUtils.h" #include "nsWeakReference.h"//nshtmlelementfactory supports weak references +#include "nslog.h" +#undef PRLogModuleInfo +#undef PR_NewLogModule + +NS_IMPL_LOG(nsHTMLContentSinkLog) +#define PRINTF NS_LOG_PRINTF(nsHTMLContentSinkLog) +#define FLUSH NS_LOG_FLUSH(nsHTMLContentSinkLog) #ifdef ALLOW_ASYNCH_STYLE_SHEETS const PRBool kBlockByDefault=PR_FALSE; @@ -1011,7 +1018,7 @@ GetOptionText(const nsIParserNode& aNode, nsString& aText) } nsAutoString x; char* y = aText.ToNewCString(); - printf("foo"); + PRINTF("foo"); } #endif diff --git a/mozilla/content/html/document/src/nsHTMLDocument.cpp b/mozilla/content/html/document/src/nsHTMLDocument.cpp index 54ecc620d18..003c61c4bf8 100644 --- a/mozilla/content/html/document/src/nsHTMLDocument.cpp +++ b/mozilla/content/html/document/src/nsHTMLDocument.cpp @@ -108,6 +108,11 @@ #include "nsICachedNetData.h" #include "nsIXMLContent.h" //for createelementNS #include "nsHTMLParts.h" //for createelementNS +#include "nslog.h" + +NS_IMPL_LOG(nsHTMLDocumentLog) +#define PRINTF NS_LOG_PRINTF(nsHTMLDocumentLog) +#define FLUSH NS_LOG_FLUSH(nsHTMLDocumentLog) #define DETECTOR_CONTRACTID_MAX 127 @@ -566,7 +571,7 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand, { #ifdef DEBUG_charset char* cCharset = charset.ToNewCString(); - printf("From HTTP Header, charset = %s\n", cCharset); + PRINTF("From HTTP Header, charset = %s\n", cCharset); Recycle(cCharset); #endif charset = preferred; @@ -710,7 +715,7 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand, #ifdef DEBUG_charset nsAutoString d(defaultCharsetFromWebShell); char* cCharset = d.ToNewCString(); - printf("From default charset, charset = %s\n", cCharset); + PRINTF("From default charset, charset = %s\n", cCharset); Recycle(cCharset); #endif charset = defaultCharsetFromWebShell; @@ -735,7 +740,7 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand, #ifdef DEBUG_charset nsAutoString d(requestCharset); char* cCharset = d.ToNewCString(); - printf("From request charset, charset = %s req=%d->%d\n", + PRINTF("From request charset, charset = %s req=%d->%d\n", cCharset, charsetSource, requestCharsetSource); Recycle(cCharset); #endif @@ -755,7 +760,7 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand, #ifdef DEBUG_charset nsAutoString d(forceCharsetFromWebShell); char* cCharset = d.ToNewCString(); - printf("From force, charset = %s \n", cCharset); + PRINTF("From force, charset = %s \n", cCharset); Recycle(cCharset); #endif charset = forceCharsetFromWebShell; @@ -860,7 +865,7 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand, csAtom->ToString(charset); charsetSource = kCharsetFromParentFrame; - // printf("### 0 >>> Having parent CS = %s\n", charset.ToNewCString()); + // PRINTF("### 0 >>> Having parent CS = %s\n", charset.ToNewCString()); } } } @@ -934,7 +939,7 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand, #ifdef DEBUG_charset char* cCharset = charset.ToNewCString(); - printf("set to parser charset = %s source %d\n", + PRINTF("set to parser charset = %s source %d\n", cCharset, charsetSource); Recycle(cCharset); #endif @@ -3719,7 +3724,7 @@ void printDOMRefs(nsIDOMNode * aNode, PRInt32 aLevel) PRInt32 i; for (i=0;i"), aNode); + PRINTF("[%s] (0x%x)\n", (cStr?cStr:""), aNode); delete[] cStr; PRBool hasChildren; diff --git a/mozilla/content/html/style/src/nsCSSDeclaration.cpp b/mozilla/content/html/style/src/nsCSSDeclaration.cpp index 395e9339987..cbef66fd3d4 100644 --- a/mozilla/content/html/style/src/nsCSSDeclaration.cpp +++ b/mozilla/content/html/style/src/nsCSSDeclaration.cpp @@ -31,6 +31,11 @@ #include "nsCOMPtr.h" #include "nsIStyleSet.h" #include "nsISizeOfHandler.h" +#include "nslog.h" + +NS_IMPL_LOG(nsCSSDeclarationLog) +#define PRINTF NS_LOG_PRINTF(nsCSSDeclarationLog) +#define FLUSH NS_LOG_FLUSH(nsCSSDeclarationLog) // #define DEBUG_REFS @@ -1062,7 +1067,7 @@ CSSDeclarationImpl::CSSDeclarationImpl(void) NS_INIT_REFCNT(); #ifdef DEBUG_REFS ++gInstanceCount; - fprintf(stdout, "CSSDeclaration Instances (ctor): %ld\n", (long)gInstanceCount); + FPRINTF(stdout, "CSSDeclaration Instances (ctor): %ld\n", (long)gInstanceCount); #endif } @@ -1088,7 +1093,7 @@ CSSDeclarationImpl::CSSDeclarationImpl(const CSSDeclarationImpl& aCopy) #ifdef DEBUG_REFS ++gInstanceCount; - fprintf(stdout, "CSSDeclaration Instances (cp-ctor): %ld\n", (long)gInstanceCount); + FPRINTF(stdout, "CSSDeclaration Instances (cp-ctor): %ld\n", (long)gInstanceCount); #endif if (aCopy.mImportant) { @@ -1134,7 +1139,7 @@ CSSDeclarationImpl::~CSSDeclarationImpl(void) #ifdef DEBUG_REFS --gInstanceCount; - fprintf(stdout, "CSSDeclaration Instances (dtor): %ld\n", (long)gInstanceCount); + FPRINTF(stdout, "CSSDeclaration Instances (dtor): %ld\n", (long)gInstanceCount); #endif } diff --git a/mozilla/content/html/style/src/nsCSSLayout.cpp b/mozilla/content/html/style/src/nsCSSLayout.cpp index dbb288b89be..d4df8a36286 100644 --- a/mozilla/content/html/style/src/nsCSSLayout.cpp +++ b/mozilla/content/html/style/src/nsCSSLayout.cpp @@ -31,6 +31,11 @@ #include "nsRect.h" #include "nsIPtr.h" #include "nsHTMLIIDs.h" +#include "nslog.h" + +NS_IMPL_LOG(nsCSSLayoutLog) +#define PRINTF NS_LOG_PRINTF(nsCSSLayoutLog) +#define FLUSH NS_LOG_FLUSH(nsCSSLayoutLog) NS_DEF_PTR(nsIStyleContext); NS_DEF_PTR(nsIContent); @@ -104,7 +109,7 @@ nsCSSLayout::RelativePositionChildren(nsIPresContext* aCX, nscoord dx = 0; switch (kidPosition->mOffset.GetLeftUnit()) { case eStyleUnit_Percent: - printf("XXX: not yet implemented: % relative position\n"); + PRINTF("XXX: not yet implemented: % relative position\n"); case eStyleUnit_Auto: break; case eStyleUnit_Coord: @@ -114,7 +119,7 @@ nsCSSLayout::RelativePositionChildren(nsIPresContext* aCX, nscoord dy = 0; switch (kidPosition->mOffset.GetTopUnit()) { case eStyleUnit_Percent: - printf("XXX: not yet implemented: % relative position\n"); + PRINTF("XXX: not yet implemented: % relative position\n"); case eStyleUnit_Auto: break; case eStyleUnit_Coord: diff --git a/mozilla/content/html/style/src/nsCSSLoader.cpp b/mozilla/content/html/style/src/nsCSSLoader.cpp index 4d7ca1cf4e9..077fb2b995d 100644 --- a/mozilla/content/html/style/src/nsCSSLoader.cpp +++ b/mozilla/content/html/style/src/nsCSSLoader.cpp @@ -59,6 +59,12 @@ #include +#include "nslog.h" + +NS_IMPL_LOG(nsCSSLoaderLog) +#define PRINTF NS_LOG_PRINTF(nsCSSLoaderLog) +#define FLUSH NS_LOG_FLUSH(nsCSSLoaderLog) + static NS_DEFINE_IID(kICSSLoaderIID, NS_ICSS_LOADER_IID); //static NS_DEFINE_IID(kICSSParserIID, NS_ICSS_PARSER_IID); //static NS_DEFINE_IID(kICSSStyleSheetIID, NS_ICSS_STYLE_SHEET_IID); @@ -922,10 +928,8 @@ CSSLoaderImpl::DidLoadStyle(nsIStreamLoader* aLoader, // Dump error message to console. char *url; aLoadData->mURL->GetSpec(&url); -#ifdef DEBUG - cerr << "CSSLoaderImpl::DidLoadStyle: Load of URL '" << url - << "' failed. Error code: " << NS_ERROR_GET_CODE(aStatus) << "\n"; -#endif + PRINTF("CSSLoaderImpl::DidLoadStyle: Load of URL '%s' failed. Error code: %x\n", + url, aStatus); nsCRT::free(url); } @@ -1198,10 +1202,8 @@ CSSLoaderImpl::LoadSheet(URLKey& aKey, SheetLoadData* aData) // Dump an error message to the console char *url; aKey.mURL->GetSpec(&url); -#ifdef DEBUG - cerr << "CSSLoaderImpl::LoadSheet: Load of URL '" << url - << "' failed. Error code: " << NS_ERROR_GET_CODE(result) << "\n"; -#endif + PRINTF("CSSLoaderImpl::LoadSheet: Load of URL '%s' failed. Error code: %x\n", + url, result); nsCRT::free(url); } } @@ -1531,10 +1533,8 @@ CSSLoaderImpl::LoadAgentSheet(nsIURI* aURL, // Dump an error message to the console char *url; aURL->GetSpec(&url); -#ifdef DEBUG - cerr << "CSSLoaderImpl::LoadAgentSheet: Load of URL '" << url - << "' failed. Error code: " << NS_ERROR_GET_CODE(result) << "\n"; -#endif + PRINTF("CSSLoaderImpl::LoadAgentSheet: Load of URL '%s' failed. Error code: %x\n", + url, result); nsCRT::free(url); } } diff --git a/mozilla/content/html/style/src/nsCSSScanner.cpp b/mozilla/content/html/style/src/nsCSSScanner.cpp index 0c1e5a9171b..76b39ec58ad 100644 --- a/mozilla/content/html/style/src/nsCSSScanner.cpp +++ b/mozilla/content/html/style/src/nsCSSScanner.cpp @@ -24,6 +24,11 @@ #include "nsIUnicharInputStream.h" #include "nsString.h" #include "nsCRT.h" +#include "nslog.h" + +NS_IMPL_LOG(nsCSSScannerLog) +#define PRINTF NS_LOG_PRINTF(nsCSSScannerLog) +#define FLUSH NS_LOG_FLUSH(nsCSSScannerLog) #ifdef NS_DEBUG static char* kNullPointer = "null pointer"; @@ -215,7 +220,7 @@ void nsCSSScanner::InitErrorReporting(nsIURI* aURI) void nsCSSScanner::ReportError(const nsAReadableString& aError) { - printf("CSS Error (%s :%u.%u): %s.\n", + PRINTF("CSS Error (%s :%u.%u): %s.\n", mFileName.get(), mLineNumber, mColNumber, @@ -287,7 +292,7 @@ PRInt32 nsCSSScanner::Read(PRInt32& aErrorCode) #endif } mLastRead = rv; -//printf("Read => %x\n", rv); +//PRINTF("Read => %x\n", rv); return rv; } @@ -301,7 +306,7 @@ PRInt32 nsCSSScanner::Peek(PRInt32& aErrorCode) mPushback[0] = PRUnichar(ch); mPushbackCount++; } -//printf("Peek => %x\n", mLookAhead); +//PRINTF("Peek => %x\n", mLookAhead); return PRInt32(mPushback[mPushbackCount - 1]); } diff --git a/mozilla/content/html/style/src/nsCSSStruct.cpp b/mozilla/content/html/style/src/nsCSSStruct.cpp index 395e9339987..cbef66fd3d4 100644 --- a/mozilla/content/html/style/src/nsCSSStruct.cpp +++ b/mozilla/content/html/style/src/nsCSSStruct.cpp @@ -31,6 +31,11 @@ #include "nsCOMPtr.h" #include "nsIStyleSet.h" #include "nsISizeOfHandler.h" +#include "nslog.h" + +NS_IMPL_LOG(nsCSSDeclarationLog) +#define PRINTF NS_LOG_PRINTF(nsCSSDeclarationLog) +#define FLUSH NS_LOG_FLUSH(nsCSSDeclarationLog) // #define DEBUG_REFS @@ -1062,7 +1067,7 @@ CSSDeclarationImpl::CSSDeclarationImpl(void) NS_INIT_REFCNT(); #ifdef DEBUG_REFS ++gInstanceCount; - fprintf(stdout, "CSSDeclaration Instances (ctor): %ld\n", (long)gInstanceCount); + FPRINTF(stdout, "CSSDeclaration Instances (ctor): %ld\n", (long)gInstanceCount); #endif } @@ -1088,7 +1093,7 @@ CSSDeclarationImpl::CSSDeclarationImpl(const CSSDeclarationImpl& aCopy) #ifdef DEBUG_REFS ++gInstanceCount; - fprintf(stdout, "CSSDeclaration Instances (cp-ctor): %ld\n", (long)gInstanceCount); + FPRINTF(stdout, "CSSDeclaration Instances (cp-ctor): %ld\n", (long)gInstanceCount); #endif if (aCopy.mImportant) { @@ -1134,7 +1139,7 @@ CSSDeclarationImpl::~CSSDeclarationImpl(void) #ifdef DEBUG_REFS --gInstanceCount; - fprintf(stdout, "CSSDeclaration Instances (dtor): %ld\n", (long)gInstanceCount); + FPRINTF(stdout, "CSSDeclaration Instances (dtor): %ld\n", (long)gInstanceCount); #endif } diff --git a/mozilla/content/html/style/src/nsCSSStyleRule.cpp b/mozilla/content/html/style/src/nsCSSStyleRule.cpp index 0fd73f6c51e..92e56e9a7a5 100644 --- a/mozilla/content/html/style/src/nsCSSStyleRule.cpp +++ b/mozilla/content/html/style/src/nsCSSStyleRule.cpp @@ -54,12 +54,17 @@ #include "nsIStyleSet.h" #include "nsISizeOfHandler.h" - // MJA: bug 31816 #include "nsIPresShell.h" #include "nsIDocShellTreeItem.h" // - END MJA +#include "nslog.h" + +NS_IMPL_LOG(nsCSSStyleRuleLog) +#define PRINTF NS_LOG_PRINTF(nsCSSStyleRuleLog) +#define FLUSH NS_LOG_FLUSH(nsCSSStyleRuleLog) + // #define DEBUG_REFS static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); @@ -164,7 +169,7 @@ nsAttrSelector::nsAttrSelector(PRInt32 aNameSpace, const nsString& aAttr) #ifdef DEBUG_REFS gAttrSelectorCount++; - printf( "nsAttrSelector Instances (ctor): %ld\n", (long)gAttrSelectorCount); + PRINTF( "nsAttrSelector Instances (ctor): %ld\n", (long)gAttrSelectorCount); #endif mAttr = NS_NewAtom(aAttr); @@ -183,7 +188,7 @@ nsAttrSelector::nsAttrSelector(PRInt32 aNameSpace, const nsString& aAttr, PRUint #ifdef DEBUG_REFS gAttrSelectorCount++; - printf( "nsAttrSelector Instances (ctor): %ld\n", (long)gAttrSelectorCount); + PRINTF( "nsAttrSelector Instances (ctor): %ld\n", (long)gAttrSelectorCount); #endif mAttr = NS_NewAtom(aAttr); @@ -201,7 +206,7 @@ nsAttrSelector::nsAttrSelector(const nsAttrSelector& aCopy) #ifdef DEBUG_REFS gAttrSelectorCount++; - printf( "nsAttrSelector Instances (cp-ctor): %ld\n", (long)gAttrSelectorCount); + PRINTF( "nsAttrSelector Instances (cp-ctor): %ld\n", (long)gAttrSelectorCount); #endif NS_IF_ADDREF(mAttr); @@ -214,7 +219,7 @@ nsAttrSelector::~nsAttrSelector(void) #ifdef DEBUG_REFS gAttrSelectorCount--; - printf( "nsAttrSelector Instances (dtor): %ld\n", (long)gAttrSelectorCount); + PRINTF( "nsAttrSelector Instances (dtor): %ld\n", (long)gAttrSelectorCount); #endif NS_IF_RELEASE(mAttr); @@ -304,7 +309,7 @@ nsCSSSelector::nsCSSSelector(void) #ifdef DEBUG_REFS gSelectorCount++; - printf( "nsCSSSelector Instances (ctor): %ld\n", (long)gSelectorCount); + PRINTF( "nsCSSSelector Instances (ctor): %ld\n", (long)gSelectorCount); #endif } @@ -326,7 +331,7 @@ nsCSSSelector::nsCSSSelector(const nsCSSSelector& aCopy) #ifdef DEBUG_REFS gSelectorCount++; - printf( "nsCSSSelector Instances (cp-ctor): %ld\n", (long)gSelectorCount); + PRINTF( "nsCSSSelector Instances (cp-ctor): %ld\n", (long)gSelectorCount); #endif } @@ -337,7 +342,7 @@ nsCSSSelector::~nsCSSSelector(void) #ifdef DEBUG_REFS gSelectorCount--; - printf( "nsCSSSelector Instances (dtor): %ld\n", (long)gSelectorCount); + PRINTF( "nsCSSSelector Instances (dtor): %ld\n", (long)gSelectorCount); #endif } @@ -1080,7 +1085,7 @@ CSSStyleRuleImpl::CSSStyleRuleImpl(const nsCSSSelector& aSelector) { #ifdef DEBUG_REFS gStyleRuleCount++; - printf( "CSSStyleRuleImpl Instances (ctor): %ld\n", (long)gStyleRuleCount); + PRINTF( "CSSStyleRuleImpl Instances (ctor): %ld\n", (long)gStyleRuleCount); #endif } @@ -1095,7 +1100,7 @@ CSSStyleRuleImpl::CSSStyleRuleImpl(const CSSStyleRuleImpl& aCopy) { #ifdef DEBUG_REFS gStyleRuleCount++; - printf( "CSSStyleRuleImpl Instances (cp-ctor): %ld\n", (long)gStyleRuleCount); + PRINTF( "CSSStyleRuleImpl Instances (cp-ctor): %ld\n", (long)gStyleRuleCount); #endif nsCSSSelector* copySel = aCopy.mSelector.mNext; @@ -1118,7 +1123,7 @@ CSSStyleRuleImpl::~CSSStyleRuleImpl(void) { #ifdef DEBUG_REFS gStyleRuleCount--; - printf( "CSSStyleRuleImpl Instances (dtor): %ld\n", (long)gStyleRuleCount); + PRINTF( "CSSStyleRuleImpl Instances (dtor): %ld\n", (long)gStyleRuleCount); #endif nsCSSSelector* next = mSelector.mNext; diff --git a/mozilla/content/html/style/src/nsCSSStyleSheet.cpp b/mozilla/content/html/style/src/nsCSSStyleSheet.cpp index 2f0d70b0b1c..0e8f57c2bc8 100644 --- a/mozilla/content/html/style/src/nsCSSStyleSheet.cpp +++ b/mozilla/content/html/style/src/nsCSSStyleSheet.cpp @@ -66,6 +66,11 @@ #include "nsIStyleSet.h" #include "nsISizeOfHandler.h" #include "nsStyleUtil.h" +#include "nslog.h" + +NS_IMPL_LOG(nsCSSStyleSheetLog) +#define PRINTF NS_LOG_PRINTF(nsCSSStyleSheetLog) +#define FLUSH NS_LOG_FLUSH(nsCSSStyleSheetLog) //#define DEBUG_RULES //#define EVENT_DEBUG @@ -1975,7 +1980,7 @@ CSSStyleSheetImpl::CheckRuleForAttributes(nsICSSRule *aRule) nsAutoString str; sel->mAttr->ToString(str); char * chars = str.ToNewCString(); - fprintf(stderr, "[%s@%p]", chars, this); + FPRINTF(stderr, "[%s@%p]", chars, this); nsMemory::Free(chars); #endif AtomKey key(sel->mAttr); @@ -3008,7 +3013,7 @@ static PRBool SelectorMatches(nsIPresContext* aPresContext, if (contentTag) { contentTag->ToString(strTag); } - printf("Tag: %s PseudoClass: %s EventState: %d\n", + PRINTF("Tag: %s PseudoClass: %s EventState: %d\n", strTag.ToNewCString(), strPseudo.ToNewCString(), (int)eventState); #endif } diff --git a/mozilla/content/html/style/src/nsStyleUtil.cpp b/mozilla/content/html/style/src/nsStyleUtil.cpp index 66fdb313db8..153b325f502 100644 --- a/mozilla/content/html/style/src/nsStyleUtil.cpp +++ b/mozilla/content/html/style/src/nsStyleUtil.cpp @@ -40,6 +40,11 @@ #include "nsIServiceManager.h" #include "nsIPref.h" +#include "nslog.h" + +NS_IMPL_LOG(nsStyleUtilLog) +#define PRINTF NS_LOG_PRINTF(nsStyleUtilLog) +#define FLUSH NS_LOG_FLUSH(nsStyleUtilLog) static NS_DEFINE_CID(kPrefCID, NS_PREF_CID); @@ -676,106 +681,106 @@ void DumpFontSizes(nsIPresContext* aPresContext) for (short i=0; i<2; i ++) { doWinRounding ^= true; - printf("\n\n\n"); - printf("---------------------------------------------------------------\n"); - printf(" CSS \n"); - printf(" Rounding %s\n", (doWinRounding ? "ON" : "OFF")); - printf("---------------------------------------------------------------\n"); - printf("\n"); - printf("NEW SIZES:\n"); - printf("----------\n"); - printf(" xx-small x-small small medium large x-large xx-large\n"); + PRINTF("\n\n\n"); + PRINTF("---------------------------------------------------------------\n"); + PRINTF(" CSS \n"); + PRINTF(" Rounding %s\n", (doWinRounding ? "ON" : "OFF")); + PRINTF("---------------------------------------------------------------\n"); + PRINTF("\n"); + PRINTF("NEW SIZES:\n"); + PRINTF("----------\n"); + PRINTF(" xx-small x-small small medium large x-large xx-large\n"); for (baseSize = 9; baseSize <= 20; baseSize++) { - printf("%2d: ", baseSize); + PRINTF("%2d: ", baseSize); for (cssSize = 0; cssSize <= 6; cssSize++) { val = NewCalcFontPointSize(cssSize, baseSize*dev2app, 1.0f, aPresContext, eFontSize_CSS); - printf("%2d ", RoundSize(val, aPresContext, false)); + PRINTF("%2d ", RoundSize(val, aPresContext, false)); } - printf("\n"); + PRINTF("\n"); } - printf("\n"); - printf("OLD SIZES:\n"); - printf("----------\n"); - printf(" xx-small x-small small medium large x-large xx-large\n"); + PRINTF("\n"); + PRINTF("OLD SIZES:\n"); + PRINTF("----------\n"); + PRINTF(" xx-small x-small small medium large x-large xx-large\n"); for (baseSize = 9; baseSize <= 20; baseSize++) { - printf("%2d: ", baseSize); + PRINTF("%2d: ", baseSize); for (cssSize = 0; cssSize <= 6; cssSize++) { val = OldCalcFontPointSize(cssSize, baseSize*dev2app, 1.0f); - printf("%2d ", RoundSize(val, aPresContext, doWinRounding)); + PRINTF("%2d ", RoundSize(val, aPresContext, doWinRounding)); } - printf("\n"); + PRINTF("\n"); } - printf("\n"); - printf("DIFFS:\n"); - printf("------\n"); - printf(" xx-small x-small small medium large x-large xx-large\n"); + PRINTF("\n"); + PRINTF("DIFFS:\n"); + PRINTF("------\n"); + PRINTF(" xx-small x-small small medium large x-large xx-large\n"); for (baseSize = 9; baseSize <= 20; baseSize++) { - printf("%2d: ", baseSize); + PRINTF("%2d: ", baseSize); for (cssSize = 0; cssSize <= 6; cssSize++) { oldVal = OldCalcFontPointSize(cssSize, baseSize*dev2app, 1.0f); val = NewCalcFontPointSize(cssSize, baseSize*dev2app, 1.0f, aPresContext, eFontSize_CSS); if (RoundSize(oldVal, aPresContext, doWinRounding) <= 8) - printf(" ."); + PRINTF(" ."); else - printf("%2d", (RoundSize(val, aPresContext, false)-RoundSize(oldVal, aPresContext, doWinRounding))); - printf(" "); + PRINTF("%2d", (RoundSize(val, aPresContext, false)-RoundSize(oldVal, aPresContext, doWinRounding))); + PRINTF(" "); } - printf("\n"); + PRINTF("\n"); } - printf("\n\n\n"); - printf("---------------------------------------------------------------\n"); - printf(" HTML \n"); - printf(" Rounding %s\n", (doWinRounding ? "ON" : "OFF")); - printf("---------------------------------------------------------------\n"); - printf("\n"); - printf("NEW SIZES:\n"); - printf("----------\n"); - printf(" #1 #2 #3 #4 #5 #6 #7\n"); + PRINTF("\n\n\n"); + PRINTF("---------------------------------------------------------------\n"); + PRINTF(" HTML \n"); + PRINTF(" Rounding %s\n", (doWinRounding ? "ON" : "OFF")); + PRINTF("---------------------------------------------------------------\n"); + PRINTF("\n"); + PRINTF("NEW SIZES:\n"); + PRINTF("----------\n"); + PRINTF(" #1 #2 #3 #4 #5 #6 #7\n"); for (baseSize = 9; baseSize <= 20; baseSize++) { - printf("%2d: ", baseSize); + PRINTF("%2d: ", baseSize); for (htmlSize = 1; htmlSize <= 7; htmlSize++) { val = NewCalcFontPointSize(htmlSize, baseSize*dev2app, 1.0f, aPresContext, eFontSize_HTML); - printf("%2d ", RoundSize(val, aPresContext, false)); + PRINTF("%2d ", RoundSize(val, aPresContext, false)); } - printf("\n"); + PRINTF("\n"); } - printf("\n"); - printf("OLD SIZES:\n"); - printf("----------\n"); - printf(" #1 #2 #3 #4 #5 #6 #7\n"); + PRINTF("\n"); + PRINTF("OLD SIZES:\n"); + PRINTF("----------\n"); + PRINTF(" #1 #2 #3 #4 #5 #6 #7\n"); for (baseSize = 9; baseSize <= 20; baseSize++) { - printf("%2d: ", baseSize); + PRINTF("%2d: ", baseSize); for (htmlSize = 1; htmlSize <= 7; htmlSize++) { val = OldCalcFontPointSize(htmlSize, baseSize*dev2app, 1.0f); - printf("%2d ", RoundSize(val, aPresContext, doWinRounding)); + PRINTF("%2d ", RoundSize(val, aPresContext, doWinRounding)); } - printf("\n"); + PRINTF("\n"); } - printf("\n"); - printf("DIFFS:\n"); - printf("------\n"); - printf(" #1 #2 #3 #4 #5 #6 #7\n"); + PRINTF("\n"); + PRINTF("DIFFS:\n"); + PRINTF("------\n"); + PRINTF(" #1 #2 #3 #4 #5 #6 #7\n"); for (baseSize = 9; baseSize <= 20; baseSize++) { - printf("%2d: ", baseSize); + PRINTF("%2d: ", baseSize); for (htmlSize = 1; htmlSize <= 7; htmlSize++) { oldVal = OldCalcFontPointSize(htmlSize, baseSize*dev2app, 1.0f); val = NewCalcFontPointSize(htmlSize, baseSize*dev2app, 1.0f, aPresContext, eFontSize_HTML); if (RoundSize(oldVal, aPresContext, doWinRounding) <= 8) - printf(" ."); + PRINTF(" ."); else - printf("%2d", (RoundSize(val, aPresContext, false)-RoundSize(oldVal, aPresContext, doWinRounding))); - printf(" "); + PRINTF("%2d", (RoundSize(val, aPresContext, false)-RoundSize(oldVal, aPresContext, doWinRounding))); + PRINTF(" "); } - printf("\n"); + PRINTF("\n"); } - printf("\n\n\n"); + PRINTF("\n\n\n"); } } } diff --git a/mozilla/content/shared/src/nsStyleUtil.cpp b/mozilla/content/shared/src/nsStyleUtil.cpp index 66fdb313db8..153b325f502 100644 --- a/mozilla/content/shared/src/nsStyleUtil.cpp +++ b/mozilla/content/shared/src/nsStyleUtil.cpp @@ -40,6 +40,11 @@ #include "nsIServiceManager.h" #include "nsIPref.h" +#include "nslog.h" + +NS_IMPL_LOG(nsStyleUtilLog) +#define PRINTF NS_LOG_PRINTF(nsStyleUtilLog) +#define FLUSH NS_LOG_FLUSH(nsStyleUtilLog) static NS_DEFINE_CID(kPrefCID, NS_PREF_CID); @@ -676,106 +681,106 @@ void DumpFontSizes(nsIPresContext* aPresContext) for (short i=0; i<2; i ++) { doWinRounding ^= true; - printf("\n\n\n"); - printf("---------------------------------------------------------------\n"); - printf(" CSS \n"); - printf(" Rounding %s\n", (doWinRounding ? "ON" : "OFF")); - printf("---------------------------------------------------------------\n"); - printf("\n"); - printf("NEW SIZES:\n"); - printf("----------\n"); - printf(" xx-small x-small small medium large x-large xx-large\n"); + PRINTF("\n\n\n"); + PRINTF("---------------------------------------------------------------\n"); + PRINTF(" CSS \n"); + PRINTF(" Rounding %s\n", (doWinRounding ? "ON" : "OFF")); + PRINTF("---------------------------------------------------------------\n"); + PRINTF("\n"); + PRINTF("NEW SIZES:\n"); + PRINTF("----------\n"); + PRINTF(" xx-small x-small small medium large x-large xx-large\n"); for (baseSize = 9; baseSize <= 20; baseSize++) { - printf("%2d: ", baseSize); + PRINTF("%2d: ", baseSize); for (cssSize = 0; cssSize <= 6; cssSize++) { val = NewCalcFontPointSize(cssSize, baseSize*dev2app, 1.0f, aPresContext, eFontSize_CSS); - printf("%2d ", RoundSize(val, aPresContext, false)); + PRINTF("%2d ", RoundSize(val, aPresContext, false)); } - printf("\n"); + PRINTF("\n"); } - printf("\n"); - printf("OLD SIZES:\n"); - printf("----------\n"); - printf(" xx-small x-small small medium large x-large xx-large\n"); + PRINTF("\n"); + PRINTF("OLD SIZES:\n"); + PRINTF("----------\n"); + PRINTF(" xx-small x-small small medium large x-large xx-large\n"); for (baseSize = 9; baseSize <= 20; baseSize++) { - printf("%2d: ", baseSize); + PRINTF("%2d: ", baseSize); for (cssSize = 0; cssSize <= 6; cssSize++) { val = OldCalcFontPointSize(cssSize, baseSize*dev2app, 1.0f); - printf("%2d ", RoundSize(val, aPresContext, doWinRounding)); + PRINTF("%2d ", RoundSize(val, aPresContext, doWinRounding)); } - printf("\n"); + PRINTF("\n"); } - printf("\n"); - printf("DIFFS:\n"); - printf("------\n"); - printf(" xx-small x-small small medium large x-large xx-large\n"); + PRINTF("\n"); + PRINTF("DIFFS:\n"); + PRINTF("------\n"); + PRINTF(" xx-small x-small small medium large x-large xx-large\n"); for (baseSize = 9; baseSize <= 20; baseSize++) { - printf("%2d: ", baseSize); + PRINTF("%2d: ", baseSize); for (cssSize = 0; cssSize <= 6; cssSize++) { oldVal = OldCalcFontPointSize(cssSize, baseSize*dev2app, 1.0f); val = NewCalcFontPointSize(cssSize, baseSize*dev2app, 1.0f, aPresContext, eFontSize_CSS); if (RoundSize(oldVal, aPresContext, doWinRounding) <= 8) - printf(" ."); + PRINTF(" ."); else - printf("%2d", (RoundSize(val, aPresContext, false)-RoundSize(oldVal, aPresContext, doWinRounding))); - printf(" "); + PRINTF("%2d", (RoundSize(val, aPresContext, false)-RoundSize(oldVal, aPresContext, doWinRounding))); + PRINTF(" "); } - printf("\n"); + PRINTF("\n"); } - printf("\n\n\n"); - printf("---------------------------------------------------------------\n"); - printf(" HTML \n"); - printf(" Rounding %s\n", (doWinRounding ? "ON" : "OFF")); - printf("---------------------------------------------------------------\n"); - printf("\n"); - printf("NEW SIZES:\n"); - printf("----------\n"); - printf(" #1 #2 #3 #4 #5 #6 #7\n"); + PRINTF("\n\n\n"); + PRINTF("---------------------------------------------------------------\n"); + PRINTF(" HTML \n"); + PRINTF(" Rounding %s\n", (doWinRounding ? "ON" : "OFF")); + PRINTF("---------------------------------------------------------------\n"); + PRINTF("\n"); + PRINTF("NEW SIZES:\n"); + PRINTF("----------\n"); + PRINTF(" #1 #2 #3 #4 #5 #6 #7\n"); for (baseSize = 9; baseSize <= 20; baseSize++) { - printf("%2d: ", baseSize); + PRINTF("%2d: ", baseSize); for (htmlSize = 1; htmlSize <= 7; htmlSize++) { val = NewCalcFontPointSize(htmlSize, baseSize*dev2app, 1.0f, aPresContext, eFontSize_HTML); - printf("%2d ", RoundSize(val, aPresContext, false)); + PRINTF("%2d ", RoundSize(val, aPresContext, false)); } - printf("\n"); + PRINTF("\n"); } - printf("\n"); - printf("OLD SIZES:\n"); - printf("----------\n"); - printf(" #1 #2 #3 #4 #5 #6 #7\n"); + PRINTF("\n"); + PRINTF("OLD SIZES:\n"); + PRINTF("----------\n"); + PRINTF(" #1 #2 #3 #4 #5 #6 #7\n"); for (baseSize = 9; baseSize <= 20; baseSize++) { - printf("%2d: ", baseSize); + PRINTF("%2d: ", baseSize); for (htmlSize = 1; htmlSize <= 7; htmlSize++) { val = OldCalcFontPointSize(htmlSize, baseSize*dev2app, 1.0f); - printf("%2d ", RoundSize(val, aPresContext, doWinRounding)); + PRINTF("%2d ", RoundSize(val, aPresContext, doWinRounding)); } - printf("\n"); + PRINTF("\n"); } - printf("\n"); - printf("DIFFS:\n"); - printf("------\n"); - printf(" #1 #2 #3 #4 #5 #6 #7\n"); + PRINTF("\n"); + PRINTF("DIFFS:\n"); + PRINTF("------\n"); + PRINTF(" #1 #2 #3 #4 #5 #6 #7\n"); for (baseSize = 9; baseSize <= 20; baseSize++) { - printf("%2d: ", baseSize); + PRINTF("%2d: ", baseSize); for (htmlSize = 1; htmlSize <= 7; htmlSize++) { oldVal = OldCalcFontPointSize(htmlSize, baseSize*dev2app, 1.0f); val = NewCalcFontPointSize(htmlSize, baseSize*dev2app, 1.0f, aPresContext, eFontSize_HTML); if (RoundSize(oldVal, aPresContext, doWinRounding) <= 8) - printf(" ."); + PRINTF(" ."); else - printf("%2d", (RoundSize(val, aPresContext, false)-RoundSize(oldVal, aPresContext, doWinRounding))); - printf(" "); + PRINTF("%2d", (RoundSize(val, aPresContext, false)-RoundSize(oldVal, aPresContext, doWinRounding))); + PRINTF(" "); } - printf("\n"); + PRINTF("\n"); } - printf("\n\n\n"); + PRINTF("\n\n\n"); } } } diff --git a/mozilla/content/xbl/src/nsXBLBinding.cpp b/mozilla/content/xbl/src/nsXBLBinding.cpp index 0a7b5045a40..574366b552b 100644 --- a/mozilla/content/xbl/src/nsXBLBinding.cpp +++ b/mozilla/content/xbl/src/nsXBLBinding.cpp @@ -80,6 +80,11 @@ #include "nsXBLLoadHandler.h" #include "nsXBLBinding.h" +#include "nslog.h" + +NS_IMPL_LOG(nsXBLBindingLog) +#define PRINTF NS_LOG_PRINTF(nsXBLBindingLog) +#define FLUSH NS_LOG_FLUSH(nsXBLBindingLog) // Static IIDs/CIDs. Try to minimize these. static char kNameSpaceSeparator = ':'; @@ -228,7 +233,7 @@ nsXBLBinding::nsXBLBinding(nsIXBLPrototypeBinding* aBinding) NS_INIT_REFCNT(); mPrototypeBinding = aBinding; gRefCnt++; - // printf("REF COUNT UP: %d %s\n", gRefCnt, (const char*)mID); + // PRINTF("REF COUNT UP: %d %s\n", gRefCnt, (const char*)mID); if (gRefCnt == 1) { kXULTemplateAtom = NS_NewAtom("template"); @@ -268,7 +273,7 @@ nsXBLBinding::nsXBLBinding(nsIXBLPrototypeBinding* aBinding) nsXBLBinding::~nsXBLBinding(void) { gRefCnt--; - // printf("REF COUNT DOWN: %d %s\n", gRefCnt, (const char*)mID); + // PRINTF("REF COUNT DOWN: %d %s\n", gRefCnt, (const char*)mID); if (gRefCnt == 0) { NS_RELEASE(kXULTemplateAtom); diff --git a/mozilla/content/xbl/src/nsXBLPrototypeBinding.cpp b/mozilla/content/xbl/src/nsXBLPrototypeBinding.cpp index 6b9c772958a..27df22d5a43 100644 --- a/mozilla/content/xbl/src/nsXBLPrototypeBinding.cpp +++ b/mozilla/content/xbl/src/nsXBLPrototypeBinding.cpp @@ -49,6 +49,11 @@ #include "nsXBLService.h" #include "nsXBLPrototypeBinding.h" #include "nsFixedSizeAllocator.h" +#include "nslog.h" + +NS_IMPL_LOG(nsXBLPrototypeBindingLog) +#define PRINTF NS_LOG_PRINTF(nsXBLPrototypeBindingLog) +#define FLUSH NS_LOG_FLUSH(nsXBLPrototypeBindingLog) // Helper Classes ===================================================================== @@ -147,7 +152,7 @@ nsXBLPrototypeBinding::nsXBLPrototypeBinding(const nsCString& aID, nsIContent* a mXBLDocInfoWeak = getter_AddRefs(NS_GetWeakReference(aInfo)); gRefCnt++; - // printf("REF COUNT UP: %d %s\n", gRefCnt, (const char*)mID); + // PRINTF("REF COUNT UP: %d %s\n", gRefCnt, (const char*)mID); if (gRefCnt == 1) { kPool.Init("XBL Attribute Entries", kBucketSizes, kNumBuckets, kInitialSize); diff --git a/mozilla/content/xbl/src/nsXBLService.cpp b/mozilla/content/xbl/src/nsXBLService.cpp index dba82016e00..d55e18f2924 100644 --- a/mozilla/content/xbl/src/nsXBLService.cpp +++ b/mozilla/content/xbl/src/nsXBLService.cpp @@ -282,7 +282,7 @@ nsXBLStreamListener::OnStopRequest(nsIChannel* aChannel, nsISupports* aCtxt, nsr } if (NS_FAILED(rv) || NS_FAILED(aStatus)) { - NS_WARNING("Failed to load XBL document!!!!!!!!!!!!!\n"); + NS_WARNING("Failed to load XBL document!!!!!!!!!!!!!"); PRUint32 count = mBindingRequests.Count(); for (PRUint32 i = 0; i < count; i++) { @@ -321,7 +321,7 @@ nsXBLStreamListener::Load(nsIDOMEvent* aEvent) // See if we're still alive. nsCOMPtr doc(do_QueryReferent(mDocument)); if (!doc) { - NS_WARNING("XBL load did not complete until after document went away! Modal dialog bug?\n"); + NS_WARNING("XBL load did not complete until after document went away! Modal dialog bug?"); } else { // Remove ourselves from the set of pending docs. diff --git a/mozilla/content/xbl/src/nsXBLWindowKeyHandler.cpp b/mozilla/content/xbl/src/nsXBLWindowKeyHandler.cpp index ede299c0f22..53392e8444f 100644 --- a/mozilla/content/xbl/src/nsXBLWindowKeyHandler.cpp +++ b/mozilla/content/xbl/src/nsXBLWindowKeyHandler.cpp @@ -45,6 +45,11 @@ #include "nsIDOMDocument.h" #include "nsIDocument.h" #include "nsIDOMElement.h" +#include "nslog.h" + +NS_IMPL_LOG(nsXBLWindowKeyHandlerLog) +#define PRINTF NS_LOG_PRINTF(nsXBLWindowKeyHandlerLog) +#define FLUSH NS_LOG_FLUSH(nsXBLWindowKeyHandlerLog) PRUint32 nsXBLWindowKeyHandler::gRefCnt = 0; nsIAtom* nsXBLWindowKeyHandler::kKeyDownAtom = nsnull; @@ -94,7 +99,7 @@ nsXBLWindowKeyHandler::IsEditor() nsCOMPtr commandDispatcher; privateWindow->GetRootCommandDispatcher(getter_AddRefs(commandDispatcher)); if (!commandDispatcher) { - NS_WARNING("********* Problem for embedding. They have no command dispatcher!!!\n"); + NS_WARNING("********* Problem for embedding. They have no command dispatcher!!!"); return PR_FALSE; } @@ -244,7 +249,7 @@ nsXBLWindowKeyHandler::WalkHandlersInternal(nsIDOMKeyEvent* aKeyEvent, nsIAtom* nsCAutoString idc; idc.AssignWithConversion(id); if (!idc.IsEmpty()) - printf("Key matched with id of: %s\n", (const char*)idc); + PRINTF("Key matched with id of: %s", (const char*)idc); */ elt->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::disabled, disabled); diff --git a/mozilla/content/xml/content/src/nsXMLCDATASection.cpp b/mozilla/content/xml/content/src/nsXMLCDATASection.cpp index 4ac16673bcf..2a0c727a693 100644 --- a/mozilla/content/xml/content/src/nsXMLCDATASection.cpp +++ b/mozilla/content/xml/content/src/nsXMLCDATASection.cpp @@ -31,6 +31,12 @@ #include "nsCRT.h" #include "nsLayoutAtoms.h" #include "nsIXMLContent.h" +#include "nslog.h" +#undef fprintf + +NS_IMPL_LOG(nsXMLCDATASectionLog) +#define PRINTF NS_LOG_PRINTF(nsXMLCDATASectionLog) +#define FLUSH NS_LOG_FLUSH(nsXMLCDATASectionLog) class nsXMLCDATASection : public nsIDOMCDATASection, diff --git a/mozilla/content/xml/content/src/nsXMLEntity.cpp b/mozilla/content/xml/content/src/nsXMLEntity.cpp index 0dce994ece4..d2cf63910e4 100644 --- a/mozilla/content/xml/content/src/nsXMLEntity.cpp +++ b/mozilla/content/xml/content/src/nsXMLEntity.cpp @@ -31,6 +31,12 @@ #include "nsLayoutAtoms.h" #include "nsString.h" #include "nsIXMLContent.h" +#include "nslog.h" +#undef fprintf + +NS_IMPL_LOG(nsXMLEntityLog) +#define PRINTF NS_LOG_PRINTF(nsXMLEntityLog) +#define FLUSH NS_LOG_FLUSH(nsXMLEntityLog) class nsXMLEntity : public nsIDOMEntity, diff --git a/mozilla/content/xml/content/src/nsXMLNotation.cpp b/mozilla/content/xml/content/src/nsXMLNotation.cpp index 44ab03f3a79..5b52676a205 100644 --- a/mozilla/content/xml/content/src/nsXMLNotation.cpp +++ b/mozilla/content/xml/content/src/nsXMLNotation.cpp @@ -31,6 +31,12 @@ #include "nsLayoutAtoms.h" #include "nsString.h" #include "nsIXMLContent.h" +#include "nslog.h" +#undef fprintf + +NS_IMPL_LOG(nsXMLNotationLog) +#define PRINTF NS_LOG_PRINTF(nsXMLNotationLog) +#define FLUSH NS_LOG_FLUSH(nsXMLNotationLog) class nsXMLNotation : public nsIDOMNotation, diff --git a/mozilla/content/xml/content/src/nsXMLProcessingInstruction.cpp b/mozilla/content/xml/content/src/nsXMLProcessingInstruction.cpp index b782501fcb6..414b3f68d80 100644 --- a/mozilla/content/xml/content/src/nsXMLProcessingInstruction.cpp +++ b/mozilla/content/xml/content/src/nsXMLProcessingInstruction.cpp @@ -39,6 +39,12 @@ #include "nsIXMLContent.h" #include "nsNetUtil.h" +#include "nslog.h" +#undef fprintf + +NS_IMPL_LOG(nsXMLProcessingInstructionLog) +#define PRINTF NS_LOG_PRINTF(nsXMLProcessingInstructionLog) +#define FLUSH NS_LOG_FLUSH(nsXMLProcessingInstructionLog) class nsXMLProcessingInstruction : public nsIDOMProcessingInstruction, diff --git a/mozilla/content/xml/document/src/nsXMLContentSink.cpp b/mozilla/content/xml/document/src/nsXMLContentSink.cpp index f342509d898..7deb7dd8415 100644 --- a/mozilla/content/xml/document/src/nsXMLContentSink.cpp +++ b/mozilla/content/xml/document/src/nsXMLContentSink.cpp @@ -75,6 +75,12 @@ // XXX misnamed header file, but oh well #include "nsHTMLTokens.h" +#include "nslog.h" + +NS_IMPL_LOG(nsXMLContentSinkLog) +#define PRINTF NS_LOG_PRINTF(nsXMLContentSinkLog) +#define FLUSH NS_LOG_FLUSH(nsXMLContentSinkLog) + static char kNameSpaceSeparator = ':'; static char kNameSpaceDef[] = "xmlns"; static char kStyleSheetPI[] = "xml-stylesheet"; @@ -768,7 +774,7 @@ NS_IMETHODIMP nsXMLContentSink::AddXMLDecl(const nsIParserNode& aNode) { // XXX We'll ignore it for now - printf("nsXMLContentSink::AddXMLDecl\n"); + PRINTF("nsXMLContentSink::AddXMLDecl\n"); return NS_OK; } @@ -1369,21 +1375,21 @@ nsXMLContentSink::AddText(const nsString& aString) NS_IMETHODIMP nsXMLContentSink::AddUnparsedEntity(const nsIParserNode& aNode) { - printf("nsXMLContentSink::AddUnparsedEntity\n"); + PRINTF("nsXMLContentSink::AddUnparsedEntity\n"); return NS_OK; } NS_IMETHODIMP nsXMLContentSink::AddNotation(const nsIParserNode& aNode) { - printf("nsXMLContentSink::AddNotation\n"); + PRINTF("nsXMLContentSink::AddNotation\n"); return NS_OK; } NS_IMETHODIMP nsXMLContentSink::AddEntityReference(const nsIParserNode& aNode) { - printf("nsXMLContentSink::AddEntityReference\n"); + PRINTF("nsXMLContentSink::AddEntityReference\n"); return NS_OK; } diff --git a/mozilla/content/xml/document/src/nsXMLDocument.cpp b/mozilla/content/xml/document/src/nsXMLDocument.cpp index fddb9ec912e..c5b04c4df0e 100644 --- a/mozilla/content/xml/document/src/nsXMLDocument.cpp +++ b/mozilla/content/xml/document/src/nsXMLDocument.cpp @@ -72,6 +72,11 @@ #include "nsDOMError.h" #include "nsScriptSecurityManager.h" #include "nsIPrincipal.h" +#include "nslog.h" + +NS_IMPL_LOG(nsXMLDocumentLog) +#define PRINTF NS_LOG_PRINTF(nsXMLDocumentLog) +#define FLUSH NS_LOG_FLUSH(nsXMLDocumentLog) // XXX The XML world depends on the html atoms @@ -453,7 +458,7 @@ nsXMLDocument::StartDocumentLoad(const char* aCommand, #ifdef DEBUG_charset nsAutoString d(defaultCharsetFromDocShell); char* cCharset = d.ToNewCString(); - printf("From default charset, charset = %s\n", cCharset); + PRINTF("From default charset, charset = %s\n", cCharset); Recycle(cCharset); #endif charset = defaultCharsetFromDocShell; @@ -470,7 +475,7 @@ nsXMLDocument::StartDocumentLoad(const char* aCommand, #ifdef DEBUG_charset nsAutoString d(requestCharset); char* cCharset = d.ToNewCString(); - printf("From request charset, charset = %s req=%d->%d\n", + PRINTF("From request charset, charset = %s req=%d->%d\n", cCharset, charsetSource, requestCharsetSource); Recycle(cCharset); #endif @@ -492,7 +497,7 @@ nsXMLDocument::StartDocumentLoad(const char* aCommand, #ifdef DEBUG_charset nsAutoString d(forceCharsetFromDocShell); char* cCharset = d.ToNewCString(); - printf("From force, charset = %s \n", cCharset); + PRINTF("From force, charset = %s \n", cCharset); Recycle(cCharset); #endif charset = forceCharsetFromDocShell; diff --git a/mozilla/content/xul/content/src/nsRDFDOMNodeList.cpp b/mozilla/content/xul/content/src/nsRDFDOMNodeList.cpp index 92be6decb0b..5a088eb402e 100644 --- a/mozilla/content/xul/content/src/nsRDFDOMNodeList.cpp +++ b/mozilla/content/xul/content/src/nsRDFDOMNodeList.cpp @@ -39,6 +39,11 @@ #include "nsIServiceManager.h" #include "nsISupportsArray.h" #include "nsRDFDOMNodeList.h" +#include "nslog.h" + +NS_IMPL_LOG(nsRDFDOMNodeListLog) +#define PRINTF NS_LOG_PRINTF(nsRDFDOMNodeListLog) +#define FLUSH NS_LOG_FLUSH(nsRDFDOMNodeListLog) //////////////////////////////////////////////////////////////////////// // GUID definitions @@ -65,7 +70,7 @@ nsRDFDOMNodeList::~nsRDFDOMNodeList(void) { #ifdef DEBUG_REFS --gInstanceCount; - fprintf(stdout, "%d - RDF: nsRDFDOMNodeList\n", gInstanceCount); + PRINTF("%d - RDF: nsRDFDOMNodeList\n", gInstanceCount); #endif NS_IF_RELEASE(mElements); diff --git a/mozilla/content/xul/content/src/nsXULPopupListener.cpp b/mozilla/content/xul/content/src/nsXULPopupListener.cpp index 37c3366b4e2..8306fd92183 100644 --- a/mozilla/content/xul/content/src/nsXULPopupListener.cpp +++ b/mozilla/content/xul/content/src/nsXULPopupListener.cpp @@ -62,6 +62,11 @@ #include "nsIFrame.h" #include "nsIStyleContext.h" +#include "nslog.h" + +NS_IMPL_LOG(nsXULPopupListenerLog) +#define PRINTF NS_LOG_PRINTF(nsXULPopupListenerLog) +#define FLUSH NS_LOG_FLUSH(nsXULPopupListenerLog) //////////////////////////////////////////////////////////////////////// @@ -160,7 +165,7 @@ XULPopupListenerImpl::~XULPopupListenerImpl(void) #ifdef DEBUG_REFS --gInstanceCount; - fprintf(stdout, "%d - RDF: XULPopupListenerImpl\n", gInstanceCount); + PRINTF("%d - RDF: XULPopupListenerImpl\n", gInstanceCount); #endif } diff --git a/mozilla/content/xul/content/src/nsXULTreeElement.cpp b/mozilla/content/xul/content/src/nsXULTreeElement.cpp index db302a46d87..de89357c34c 100644 --- a/mozilla/content/xul/content/src/nsXULTreeElement.cpp +++ b/mozilla/content/xul/content/src/nsXULTreeElement.cpp @@ -46,6 +46,11 @@ #include "nsLayoutCID.h" #include "nsString.h" #include "nsITreeBoxObject.h" +#include "nslog.h" + +NS_IMPL_LOG(nsXULTreeElementLog) +#define PRINTF NS_LOG_PRINTF(nsXULTreeElementLog) +#define FLUSH NS_LOG_FLUSH(nsXULTreeElementLog) static NS_DEFINE_CID(kCRangeCID, NS_RANGE_CID); static NS_DEFINE_IID(kCContentIteratorCID, NS_CONTENTITERATOR_CID); @@ -113,7 +118,7 @@ nsXULTreeElement::~nsXULTreeElement() { #ifdef DEBUG_REFS --gInstanceCount; - fprintf(stdout, "%d - RDF: nsXULTreeElement\n", gInstanceCount); + PRINTF("%d - RDF: nsXULTreeElement\n", gInstanceCount); #endif NS_IF_RELEASE(mSelectedItems); @@ -415,7 +420,7 @@ nsresult nsXULTreeElement::FireOnSelectHandler() { #ifdef DEBUG_bryner - printf("FireOnSelectHandler\n"); + PRINTF("FireOnSelectHandler\n"); #endif nsCOMPtr content = do_QueryInterface(mOuter); nsCOMPtr document; diff --git a/mozilla/content/xul/document/src/nsXULCommandDispatcher.cpp b/mozilla/content/xul/document/src/nsXULCommandDispatcher.cpp index 9bc1d1ade42..7d78b162fb8 100644 --- a/mozilla/content/xul/document/src/nsXULCommandDispatcher.cpp +++ b/mozilla/content/xul/document/src/nsXULCommandDispatcher.cpp @@ -48,10 +48,13 @@ #include "nsXULCommandDispatcher.h" #include "prlog.h" #include "nsIDOMEventTarget.h" +#include "nslog.h" -#ifdef PR_LOGGING -static PRLogModuleInfo* gLog; -#endif +NS_IMPL_LOG(nsXULCommandDispatcherLog) +#define PRINTF NS_LOG_PRINTF(nsXULCommandDispatcherLog) +#define FLUSH NS_LOG_FLUSH(nsXULCommandDispatcherLog) + +#define gLog nsXULCommandDispatcherLog //////////////////////////////////////////////////////////////////////// @@ -60,11 +63,6 @@ nsXULCommandDispatcher::nsXULCommandDispatcher(void) mActive(PR_FALSE), mFocusInitialized(PR_FALSE), mUpdaters(nsnull) { NS_INIT_REFCNT(); - -#ifdef PR_LOGGING - if (! gLog) - gLog = PR_NewLogModule("nsXULCommandDispatcher"); -#endif } nsXULCommandDispatcher::~nsXULCommandDispatcher(void) @@ -272,7 +270,7 @@ nsXULCommandDispatcher::UpdateCommands(const nsAReadableString& aEventName) #if 0 { char* actionString = aEventName.ToNewCString(); - printf("Doing UpdateCommands(\"%s\")\n", actionString); + PRINTF("Doing UpdateCommands(\"%s\")\n", actionString); free(actionString); } #endif @@ -373,20 +371,20 @@ nsXULCommandDispatcher::Focus(nsIDOMEvent* aEvent) aEvent->GetOriginalTarget(getter_AddRefs(t)); #if 0 - printf("%d : Focus occurred on: ", this); + PRINTF("%d : Focus occurred on: ", this); nsCOMPtr domDebugElement = do_QueryInterface(t); if (domDebugElement) { - printf("A Focusable DOM Element"); + PRINTF("A Focusable DOM Element"); } nsCOMPtr domDebugDocument = do_QueryInterface(t); if (domDebugDocument) { nsCOMPtr htmlDoc = do_QueryInterface(t); if (htmlDoc) { - printf("Window with an HTML doc (happens twice)"); + PRINTF("Window with an HTML doc (happens twice)"); } - else printf("Window with a XUL doc (happens twice)"); + else PRINTF("Window with a XUL doc (happens twice)"); } - printf("\n"); + PRINTF("\n"); #endif /* DEBUG_hyatt */ nsCOMPtr domElement = do_QueryInterface(t); @@ -442,20 +440,20 @@ nsXULCommandDispatcher::Blur(nsIDOMEvent* aEvent) aEvent->GetOriginalTarget(getter_AddRefs(t)); #if 0 - printf("%d : Blur occurred on: ", this); + PRINTF("%d : Blur occurred on: ", this); nsCOMPtr domDebugElement = do_QueryInterface(t); if (domDebugElement) { - printf("A Focusable DOM Element"); + PRINTF("A Focusable DOM Element"); } nsCOMPtr domDebugDocument = do_QueryInterface(t); if (domDebugDocument) { nsCOMPtr htmlDoc = do_QueryInterface(t); if (htmlDoc) { - printf("Window with an HTML doc (happens twice)"); + PRINTF("Window with an HTML doc (happens twice)"); } - else printf("Window with a XUL doc (happens twice)"); + else PRINTF("Window with a XUL doc (happens twice)"); } - printf("\n"); + PRINTF("\n"); #endif /* DEBUG_hyatt */ nsCOMPtr domElement = do_QueryInterface(t); @@ -633,7 +631,7 @@ nsXULCommandDispatcher::SetSuppressFocus(PRBool aSuppressFocus) else if(mSuppressFocus > 0) --mSuppressFocus; - //printf("mSuppressFocus == %d\n", mSuppressFocus); + //PRINTF("mSuppressFocus == %d\n", mSuppressFocus); // we are unsuppressing after activating, so update focus-related commands // we need this to update commands in the case where an element is focussed. diff --git a/mozilla/content/xul/document/src/nsXULDocument.cpp b/mozilla/content/xul/document/src/nsXULDocument.cpp index af8a20678de..47b27011ef5 100644 --- a/mozilla/content/xul/document/src/nsXULDocument.cpp +++ b/mozilla/content/xul/document/src/nsXULDocument.cpp @@ -128,6 +128,7 @@ #include "nsIXBLService.h" #include "nsReadableUtils.h" +NS_IMPL_LOG(nsXULDocumentLog) //---------------------------------------------------------------------- // @@ -225,8 +226,6 @@ nsIXULPrototypeCache* nsXULDocument::gXULCache; nsIScriptSecurityManager* nsXULDocument::gScriptSecurityManager; nsIPrincipal* nsXULDocument::gSystemPrincipal; -PRLogModuleInfo* nsXULDocument::gXULLog; - class nsProxyLoadStream : public nsIInputStream { private: @@ -3961,11 +3960,6 @@ static const char kXULNameSpaceURI[] = XUL_NAMESPACE_URI; if (NS_FAILED(rv)) return rv; } -#ifdef PR_LOGGING - if (! gXULLog) - gXULLog = PR_NewLogModule("nsXULDocument"); -#endif - return NS_OK; } @@ -5398,7 +5392,7 @@ nsXULDocument::OnStreamComplete(nsIStreamLoader* aLoader, { char* uriSpec; uri->GetSpec(&uriSpec); - printf("Failed to load %s\n", uriSpec ? uriSpec : ""); + PRINTF("Failed to load %s\n", uriSpec ? uriSpec : ""); nsCRT::free(uriSpec); } } @@ -6467,7 +6461,7 @@ nsXULDocument::ParserObserver::OnStopRequest(nsIChannel* aChannel, nsXPIDLCString spec; uri->GetSpec(getter_Copies(spec)); - printf("*** Failed to load overlay %s\n", (const char*) spec); + PRINTF("*** Failed to load overlay %s\n", (const char*) spec); #endif rv = mDocument->ResumeWalk(); diff --git a/mozilla/content/xul/document/src/nsXULDocument.h b/mozilla/content/xul/document/src/nsXULDocument.h index 7486326cf5f..08f287a2c48 100644 --- a/mozilla/content/xul/document/src/nsXULDocument.h +++ b/mozilla/content/xul/document/src/nsXULDocument.h @@ -69,6 +69,13 @@ #include "nsIBindingManager.h" #include "nsINodeInfo.h" #include "nsIDOMDocumentEvent.h" +#include "nslog.h" + +NS_DECL_LOG(nsXULDocumentLog) +#define PRINTF NS_LOG_PRINTF(nsXULDocumentLog) +#define FLUSH NS_LOG_FLUSH(nsXULDocumentLog) + +#define gXULLog nsXULDocumentLog class nsIAtom; class nsIElementFactory; @@ -86,7 +93,6 @@ class nsIXULPrototypeScript; #endif struct JSObject; -struct PRLogModuleInfo; /** * The XUL document class @@ -485,8 +491,6 @@ protected: static nsIScriptSecurityManager* gScriptSecurityManager; static nsIPrincipal* gSystemPrincipal; - static PRLogModuleInfo* gXULLog; - static void GetElementFactory(PRInt32 aNameSpaceID, nsIElementFactory** aResult); nsIContent* diff --git a/mozilla/content/xul/templates/src/nsXULContentUtils.cpp b/mozilla/content/xul/templates/src/nsXULContentUtils.cpp index dd475025806..418e05ca499 100644 --- a/mozilla/content/xul/templates/src/nsXULContentUtils.cpp +++ b/mozilla/content/xul/templates/src/nsXULContentUtils.cpp @@ -82,6 +82,11 @@ #include "nsIDateTimeFormat.h" #include "nsDateTimeFormatCID.h" #include "nsIScriptableDateFormat.h" +#include "nslog.h" + +NS_IMPL_LOG(nsXULContentUtilsLog) +#define PRINTF NS_LOG_PRINTF(nsXULContentUtilsLog) +#define FLUSH NS_LOG_FLUSH(nsXULContentUtilsLog) static NS_DEFINE_CID(kDateTimeFormatCID, NS_DATETIMEFORMAT_CID); @@ -301,7 +306,7 @@ nsXULContentUtils::~nsXULContentUtils() { #ifdef DEBUG_REFS --gInstanceCount; - fprintf(stdout, "%d - RDF: nsXULContentUtils\n", gInstanceCount); + PRINTF("%d - RDF: nsXULContentUtils\n", gInstanceCount); #endif if (--gRefCnt == 0) { diff --git a/mozilla/content/xul/templates/src/nsXULSortService.cpp b/mozilla/content/xul/templates/src/nsXULSortService.cpp index c09355367f6..05a045093f1 100644 --- a/mozilla/content/xul/templates/src/nsXULSortService.cpp +++ b/mozilla/content/xul/templates/src/nsXULSortService.cpp @@ -107,6 +107,11 @@ #include "nsILocale.h" #include "nsLocaleCID.h" #include "nsILocaleService.h" +#include "nslog.h" + +NS_IMPL_LOG(nsXULSortServiceLog) +#define PRINTF NS_LOG_PRINTF(nsXULSortServiceLog) +#define FLUSH NS_LOG_FLUSH(nsXULSortServiceLog) @@ -436,7 +441,7 @@ XULSortServiceImpl::~XULSortServiceImpl(void) { #ifdef DEBUG_REFS --gInstanceCount; - fprintf(stdout, "%d - RDF: XULSortServiceImpl\n", gInstanceCount); + PRINTF("%d - RDF: XULSortServiceImpl\n", gInstanceCount); #endif --gRefCnt; diff --git a/mozilla/docshell/base/nsDocShell.cpp b/mozilla/docshell/base/nsDocShell.cpp index e90b8a72711..661a7f082d2 100644 --- a/mozilla/docshell/base/nsDocShell.cpp +++ b/mozilla/docshell/base/nsDocShell.cpp @@ -1120,7 +1120,7 @@ NS_IMETHODIMP nsDocShell::AddChild(nsIDocShellTreeItem *aChild) res = dcInfo->SetParentCharset(&parentCS); if (NS_FAILED(res)) return NS_OK; - // printf("### 1 >>> Adding child. Parent CS = %s. ItemType = %d.\n", parentCS.ToNewCString(), mItemType); + // PRINTF("### 1 >>> Adding child. Parent CS = %s. ItemType = %d.\n", parentCS.ToNewCString(), mItemType); return NS_OK; } diff --git a/mozilla/docshell/base/nsWebShell.cpp b/mozilla/docshell/base/nsWebShell.cpp index 97598c4bb0a..c9414a8068e 100644 --- a/mozilla/docshell/base/nsWebShell.cpp +++ b/mozilla/docshell/base/nsWebShell.cpp @@ -115,29 +115,23 @@ typedef unsigned long HMTX; #define SH_IN_FRAMES 1 -#ifdef NS_DEBUG -/** - * Note: the log module is created during initialization which - * means that you cannot perform logging before then. - */ -static PRLogModuleInfo* gLogModule = PR_NewLogModule("webshell"); -#endif +#include "nslog.h" +#undef PRINTF +#undef FLUSH -#define WEB_TRACE_CALLS 0x1 -#define WEB_TRACE_HISTORY 0x2 +NS_IMPL_LOG(nsWebShellLog) +#define PRINTF NS_LOG_PRINTF(nsWebShellLog) +#define FLUSH NS_LOG_FLUSH(nsWebShellLog) -#define WEB_LOG_TEST(_lm,_bit) (PRIntn((_lm)->level) & (_bit)) +#define gLogModule nsWebShellLog -#ifdef NS_DEBUG -#define WEB_TRACE(_bit,_args) \ - PR_BEGIN_MACRO \ - if (WEB_LOG_TEST(gLogModule,_bit)) { \ - PR_LogPrint _args; \ - } \ - PR_END_MACRO -#else -#define WEB_TRACE(_bit,_args) -#endif +NS_IMPL_LOG(nsWebShellCallsLog) +#define CALLS_PRINTF NS_LOG_PRINTF(nsWebShellCallsLog) +#define CALLS_FLUSH NS_LOG_FLUSH(nsWebShellCallsLog) + +//NS_IMPL_LOG(nsWebShellHistoryLog) +//#define HISTORY_PRINTF NS_LOG_PRINTF(nsWebShellHistoryLog) +//#define HISTORY_FLUSH NS_LOG_FLUSH(nsWebShellHistoryLog) //static NS_DEFINE_CID(kGlobalHistoryCID, NS_GLOBALHISTORY_CID); //static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID); @@ -160,9 +154,7 @@ nsWebShell::nsWebShell() : nsDocShell() // We're counting the number of |nsWebShells| to help find leaks ++gNumberOfWebShells; #endif -#ifdef DEBUG - printf("WEBSHELL+ = %ld\n", gNumberOfWebShells); -#endif + PRINTF("WEBSHELL+ = %ld\n", gNumberOfWebShells); NS_INIT_REFCNT(); mThreadEventQueue = nsnull; @@ -212,9 +204,7 @@ nsWebShell::~nsWebShell() // We're counting the number of |nsWebShells| to help find leaks --gNumberOfWebShells; #endif -#ifdef DEBUG - printf("WEBSHELL- = %ld\n", gNumberOfWebShells); -#endif + PRINTF("WEBSHELL- = %ld\n", gNumberOfWebShells); } void nsWebShell::InitFrameData() @@ -1201,7 +1191,7 @@ nsWebShell::OnEndURLLoad(nsIDocumentLoader* loader, #if 0 const char* spec; aURL->GetSpec(&spec); - printf("nsWebShell::OnEndURLLoad:%p: loader=%p url=%s status=%d\n", this, loader, spec, aStatus); + PRINTF("nsWebShell::OnEndURLLoad:%p: loader=%p url=%s status=%d\n", this, loader, spec, aStatus); #endif /* *Fire the OnEndDocumentLoad of the webshell observer @@ -1367,8 +1357,7 @@ NS_IMETHODIMP nsWebShell::Create() NS_ENSURE_SUCCESS(eventService->GetThreadEventQueue(NS_CURRENT_THREAD, &mThreadEventQueue), NS_ERROR_FAILURE); - WEB_TRACE(WEB_TRACE_CALLS, - ("nsWebShell::Init: this=%p", this)); + CALLS_PRINTF("nsWebShell::Init: this=%p", this); // HACK....force the uri loader to give us a load cookie for this webshell...then get it's // doc loader and store it...as more of the docshell lands, we'll be able to get rid diff --git a/mozilla/dom/src/base/nsGlobalWindow.cpp b/mozilla/dom/src/base/nsGlobalWindow.cpp index c291ea1e356..69dd01510db 100644 --- a/mozilla/dom/src/base/nsGlobalWindow.cpp +++ b/mozilla/dom/src/base/nsGlobalWindow.cpp @@ -107,7 +107,20 @@ #include "nsIBindingManager.h" #include "nsIXBLService.h" +#include "nslog.h" +#ifdef DEBUG_seth +NS_IMPL_LOG_ENABLED(nsGlobalWindowLog) +#else +NS_IMPL_LOG(nsGlobalWindowLog) +#endif +#define PRINTF NS_LOG_PRINTF(nsGlobalWindowLog) +#define FLUSH NS_LOG_FLUSH(nsGlobalWindowLog) + +// log for js dump commands: +NS_IMPL_LOG_ENABLED(DUMP) +#define DUMP_PRINTF NS_LOG_PRINTF(DUMP) +#define DUMP_FLUSH NS_LOG_FLUSH(DUMP) // CIDs static NS_DEFINE_IID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID); @@ -1470,7 +1483,7 @@ NS_IMETHODIMP GlobalWindowImpl::Dump(const nsAReadableString& aStr) #endif if (cstr) { - printf("%s", cstr); + DUMP_PRINTF("%s", cstr); nsCRT::free(cstr); } @@ -1641,9 +1654,7 @@ NS_IMETHODIMP GlobalWindowImpl::Home() nsString homeURL; if (!url) { // if all else fails, use this -#ifdef DEBUG_seth - printf("all else failed. using %s as the home page\n", DEFAULT_HOME_PAGE); -#endif + PRINTF("all else failed. using %s as the home page\n", DEFAULT_HOME_PAGE); homeURL.AssignWithConversion(DEFAULT_HOME_PAGE); } else diff --git a/mozilla/dom/src/base/nsJSEnvironment.cpp b/mozilla/dom/src/base/nsJSEnvironment.cpp index 60ff9dd2b66..dc9a7e0cdf7 100644 --- a/mozilla/dom/src/base/nsJSEnvironment.cpp +++ b/mozilla/dom/src/base/nsJSEnvironment.cpp @@ -61,15 +61,17 @@ #include "nsIJVMManager.h" #include "nsILiveConnectManager.h" +#include "nslog.h" + +NS_IMPL_LOG(nsJSEnvironmentLog) +#define PRINTF NS_LOG_PRINTF(nsJSEnvironmentLog) +#define FLUSH NS_LOG_FLUSH(nsJSEnvironmentLog) + const size_t gStackSize = 8192; static NS_DEFINE_IID(kCScriptNameSetRegistryCID, NS_SCRIPT_NAMESET_REGISTRY_CID); static NS_DEFINE_IID(kPrefServiceCID, NS_PREF_CID); -#ifdef PR_LOGGING -static PRLogModuleInfo* gJSDiagnostics = nsnull; -#endif - #include "nsIScriptError.h" void PR_CALLBACK @@ -171,28 +173,25 @@ NS_ScriptErrorReporter(JSContext *cx, if (status != nsEventStatus_eIgnore) error.AppendWithConversion("Error was suppressed by event handler\n"); +#ifdef NS_ENABLE_LOGGING char *errorStr = error.ToNewCString(); if (errorStr) { - fprintf(stderr, "%s\n", errorStr); + PRINTF("%s\n", errorStr); nsMemory::Free(errorStr); } +#endif #ifdef PR_LOGGING if (report) { - if (!gJSDiagnostics) - gJSDiagnostics = PR_NewLogModule("JSDiagnostics"); - - if (gJSDiagnostics) { - PR_LOG(gJSDiagnostics, - JSREPORT_IS_WARNING(report->flags) ? PR_LOG_WARNING : PR_LOG_ERROR, - ("file %s, line %u: %s\n%s%s", - report->filename, report->lineno, message, - report->linebuf ? report->linebuf : "", - (report->linebuf && - report->linebuf[strlen(report->linebuf)-1] != '\n') - ? "\n" - : "")); - } + PR_LOG(nsJSEnvironmentLog, + JSREPORT_IS_WARNING(report->flags) ? PR_LOG_WARNING : PR_LOG_ERROR, + ("file %s, line %u: %s\n%s%s", + report->filename, report->lineno, message, + report->linebuf ? report->linebuf : "", + (report->linebuf && + report->linebuf[strlen(report->linebuf)-1] != '\n') + ? "\n" + : "")); } #endif diff --git a/mozilla/dom/src/build/nsDOMFactory.cpp b/mozilla/dom/src/build/nsDOMFactory.cpp index 0055b24a539..3c74ef092f9 100644 --- a/mozilla/dom/src/build/nsDOMFactory.cpp +++ b/mozilla/dom/src/build/nsDOMFactory.cpp @@ -138,6 +138,11 @@ #include "nsIDOMPkcs11.h" #include "nsIDOMCSSPrimitiveValue.h" #include "plhash.h" +#include "nslog.h" + +NS_IMPL_LOG(nsDOMFactoryLog) +#define PRINTF NS_LOG_PRINTF(nsDOMFactoryLog) +#define FLUSH NS_LOG_FLUSH(nsDOMFactoryLog) static NS_DEFINE_IID(kIDOMNativeObjectRegistry, NS_IDOM_NATIVE_OBJECT_REGISTRY_IID); @@ -791,7 +796,7 @@ void DumpJSStack() if(NS_SUCCEEDED(rv)) xpc->DebugDumpJSStack(PR_TRUE, PR_TRUE, PR_FALSE); else - printf("failed to get XPConnect service!\n"); + PRINTF("failed to get XPConnect service!\n"); } void DumpJSEval(PRUint32 frame, const char* text) @@ -801,7 +806,7 @@ void DumpJSEval(PRUint32 frame, const char* text) if(NS_SUCCEEDED(rv)) xpc->DebugDumpEvalInJSStackFrame(frame, text); else - printf("failed to get XPConnect service!\n"); + PRINTF("failed to get XPConnect service!\n"); } JS_END_EXTERN_C #endif diff --git a/mozilla/editor/base/CreateElementTxn.cpp b/mozilla/editor/base/CreateElementTxn.cpp index e7080bd959c..f9abd730aeb 100644 --- a/mozilla/editor/base/CreateElementTxn.cpp +++ b/mozilla/editor/base/CreateElementTxn.cpp @@ -31,11 +31,11 @@ //included for new nsEditor::CreateContent() #include "nsIContent.h" -#ifdef NS_DEBUG -static PRBool gNoisy = PR_FALSE; -#else -static const PRBool gNoisy = PR_FALSE; -#endif +#include "nslog.h" + +NS_IMPL_LOG(CreateElementTxnLog) +#define PRINTF NS_LOG_PRINTF(CreateElementTxnLog) +#define FLUSH NS_LOG_FLUSH(CreateElementTxnLog) CreateElementTxn::CreateElementTxn() : EditTxn() @@ -74,13 +74,12 @@ CreateElementTxn::~CreateElementTxn() NS_IMETHODIMP CreateElementTxn::Do(void) { - if (gNoisy) - { - char* nodename = mTag.ToNewCString(); - printf("Do Create Element parent = %p <%s>, offset = %d\n", - mParent.get(), nodename, mOffsetInParent); - nsMemory::Free(nodename); - } +#ifdef NS_LOGGING + char* nodename = mTag.ToNewCString(); + PRINTF("Do Create Element parent = %p <%s>, offset = %d\n", + mParent.get(), nodename, mOffsetInParent); + nsMemory::Free(nodename); +#endif NS_ASSERTION(mEditor && mParent, "bad state"); if (!mEditor || !mParent) return NS_ERROR_NOT_INITIALIZED; @@ -121,7 +120,7 @@ NS_IMETHODIMP CreateElementTxn::Do(void) NS_ASSERTION(((NS_SUCCEEDED(result)) && (mNewNode)), "could not create element."); if (!mNewNode) return NS_ERROR_NULL_POINTER; - if (gNoisy) { printf(" newNode = %p\n", mNewNode.get()); } + PRINTF(" newNode = %p\n", mNewNode.get()); // insert the new node nsCOMPtr resultNode; if (CreateElementTxn::eAppend==(PRInt32)mOffsetInParent) @@ -172,8 +171,8 @@ NS_IMETHODIMP CreateElementTxn::Do(void) NS_IMETHODIMP CreateElementTxn::Undo(void) { - if (gNoisy) { printf("Undo Create Element, mParent = %p, node = %p\n", - mParent.get(), mNewNode.get()); } + PRINTF("Undo Create Element, mParent = %p, node = %p\n", + mParent.get(), mNewNode.get()); NS_ASSERTION(mEditor && mParent, "bad state"); if (!mEditor || !mParent) return NS_ERROR_NOT_INITIALIZED; @@ -184,7 +183,7 @@ NS_IMETHODIMP CreateElementTxn::Undo(void) NS_IMETHODIMP CreateElementTxn::Redo(void) { - if (gNoisy) { printf("Redo Create Element\n"); } + PRINTF("Redo Create Element\n"); NS_ASSERTION(mEditor && mParent, "bad state"); if (!mEditor || !mParent) return NS_ERROR_NOT_INITIALIZED; diff --git a/mozilla/editor/base/DeleteElementTxn.cpp b/mozilla/editor/base/DeleteElementTxn.cpp index 928e3a6f6ce..2c23b569dde 100644 --- a/mozilla/editor/base/DeleteElementTxn.cpp +++ b/mozilla/editor/base/DeleteElementTxn.cpp @@ -25,12 +25,11 @@ #include "nsIDOMElement.h" #endif -#ifdef NS_DEBUG -static PRBool gNoisy = PR_FALSE; -#else -static const PRBool gNoisy = PR_FALSE; -#endif +#include "nslog.h" +NS_IMPL_LOG(DeleteElementTxnLog) +#define PRINTF NS_LOG_PRINTF(DeleteElementTxnLog) +#define FLUSH NS_LOG_FLUSH(DeleteElementTxnLog) DeleteElementTxn::DeleteElementTxn() : EditTxn() @@ -56,7 +55,7 @@ DeleteElementTxn::~DeleteElementTxn() NS_IMETHODIMP DeleteElementTxn::Do(void) { - if (gNoisy) { printf("%p Do Delete Element element = %p\n", this, mElement.get()); } + PRINTF("%p Do Delete Element element = %p\n", this, mElement.get()); if (!mElement) return NS_ERROR_NOT_INITIALIZED; nsresult result = mElement->GetParentNode(getter_AddRefs(mParent)); @@ -80,8 +79,7 @@ NS_IMETHODIMP DeleteElementTxn::Do(void) p = parentElementTag.ToNewCString(); if (c&&p) { - if (gNoisy) - printf(" DeleteElementTxn: deleting child %s from parent %s\n", c, p); + PRINTF(" DeleteElementTxn: deleting child %s from parent %s\n", c, p); nsCRT::free(c); nsCRT::free(p); } @@ -98,7 +96,7 @@ NS_IMETHODIMP DeleteElementTxn::Do(void) NS_IMETHODIMP DeleteElementTxn::Undo(void) { - if (gNoisy) { printf("%p Undo Delete Element element = %p, parent = %p\n", this, mElement.get(), mParent.get()); } + PRINTF("%p Undo Delete Element element = %p, parent = %p\n", this, mElement.get(), mParent.get()); if (!mParent) { return NS_OK; } // this is a legal state, the txn is a no-op if (!mElement) { return NS_ERROR_NULL_POINTER; } @@ -119,8 +117,7 @@ NS_IMETHODIMP DeleteElementTxn::Undo(void) p = parentElementTag.ToNewCString(); if (c&&p) { - if (gNoisy) - printf(" DeleteElementTxn: inserting child %s back into parent %s\n", c, p); + PRINTF(" DeleteElementTxn: inserting child %s back into parent %s\n", c, p); nsCRT::free(c); nsCRT::free(p); } @@ -134,7 +131,7 @@ NS_IMETHODIMP DeleteElementTxn::Undo(void) NS_IMETHODIMP DeleteElementTxn::Redo(void) { - if (gNoisy) { printf("%p Redo Delete Element element = %p, parent = %p\n", this, mElement.get(), mParent.get()); } + PRINTF("%p Redo Delete Element element = %p, parent = %p\n", this, mElement.get(), mParent.get()); if (!mParent) { return NS_OK; } // this is a legal state, the txn is a no-op if (!mElement) { return NS_ERROR_NULL_POINTER; } diff --git a/mozilla/editor/base/DeleteRangeTxn.cpp b/mozilla/editor/base/DeleteRangeTxn.cpp index 1e3299d1b69..05a7144f975 100644 --- a/mozilla/editor/base/DeleteRangeTxn.cpp +++ b/mozilla/editor/base/DeleteRangeTxn.cpp @@ -37,11 +37,11 @@ #include "nsIDOMElement.h" #endif -#ifdef NS_DEBUG -static PRBool gNoisy = PR_FALSE; -#else -static const PRBool gNoisy = PR_FALSE; -#endif +#include "nslog.h" + +NS_IMPL_LOG(DeleteRangeTxnLog) +#define PRINTF NS_LOG_PRINTF(DeleteRangeTxnLog) +#define FLUSH NS_LOG_FLUSH(DeleteRangeTxnLog) // note that aEditor is not refcounted DeleteRangeTxn::DeleteRangeTxn() @@ -97,11 +97,8 @@ NS_IMETHODIMP DeleteRangeTxn::Init(nsIEditor *aEditor, nsIDOMRange *aRange) children->GetLength(&count); } NS_ASSERTION(mEndOffset<=(PRInt32)count, "bad end offset"); - if (gNoisy) - { - printf ("DeleteRange: %d of %p to %d of %p\n", - mStartOffset, (void *)mStartParent, mEndOffset, (void *)mEndParent); - } + PRINTF("DeleteRange: %d of %p to %d of %p\n", + mStartOffset, (void *)mStartParent, mEndOffset, (void *)mEndParent); } #endif return result; @@ -114,7 +111,7 @@ DeleteRangeTxn::~DeleteRangeTxn() NS_IMETHODIMP DeleteRangeTxn::Do(void) { - if (gNoisy) { printf("Do Delete Range\n"); } + PRINTF("Do Delete Range\n"); if (!mStartParent || !mEndParent || !mCommonParent || !mEditor) return NS_ERROR_NOT_INITIALIZED; @@ -169,7 +166,7 @@ NS_IMETHODIMP DeleteRangeTxn::Do(void) NS_IMETHODIMP DeleteRangeTxn::Undo(void) { - if (gNoisy) { printf("Undo Delete Range\n"); } + PRINTF("Undo Delete Range\n"); if (!mStartParent || !mEndParent || !mCommonParent || !mEditor) return NS_ERROR_NOT_INITIALIZED; @@ -179,7 +176,7 @@ NS_IMETHODIMP DeleteRangeTxn::Undo(void) NS_IMETHODIMP DeleteRangeTxn::Redo(void) { - if (gNoisy) { printf("Redo Delete Range\n"); } + PRINTF("Redo Delete Range\n"); if (!mStartParent || !mEndParent || !mCommonParent || !mEditor) return NS_ERROR_NOT_INITIALIZED; diff --git a/mozilla/editor/base/DeleteTextTxn.cpp b/mozilla/editor/base/DeleteTextTxn.cpp index 88db0665f0f..31be507c7c0 100644 --- a/mozilla/editor/base/DeleteTextTxn.cpp +++ b/mozilla/editor/base/DeleteTextTxn.cpp @@ -24,11 +24,11 @@ #include "nsIDOMCharacterData.h" #include "nsISelection.h" -#ifdef NS_DEBUG -static PRBool gNoisy = PR_FALSE; -#else -static const PRBool gNoisy = PR_FALSE; -#endif +#include "nslog.h" + +NS_IMPL_LOG(DeleteTextTxnLog) +#define PRINTF NS_LOG_PRINTF(DeleteTextTxnLog) +#define FLUSH NS_LOG_FLUSH(DeleteTextTxnLog) DeleteTextTxn::DeleteTextTxn() : EditTxn() @@ -64,7 +64,7 @@ NS_IMETHODIMP DeleteTextTxn::Init(nsIEditor *aEditor, NS_IMETHODIMP DeleteTextTxn::Do(void) { - if (gNoisy) { printf("Do Delete Text\n"); } + PRINTF("Do Delete Text\n"); NS_ASSERTION(mEditor && mElement, "bad state"); if (!mEditor || !mElement) { return NS_ERROR_NOT_INITIALIZED; } // get the text that we're about to delete @@ -96,7 +96,7 @@ NS_IMETHODIMP DeleteTextTxn::Do(void) // was it an insertion point or an extended selection? NS_IMETHODIMP DeleteTextTxn::Undo(void) { - if (gNoisy) { printf("Undo Delete Text\n"); } + PRINTF("Undo Delete Text\n"); NS_ASSERTION(mEditor && mElement, "bad state"); if (!mEditor || !mElement) { return NS_ERROR_NOT_INITIALIZED; } diff --git a/mozilla/editor/base/IMECommitTxn.cpp b/mozilla/editor/base/IMECommitTxn.cpp index 215c8fb89d0..b40b866432d 100644 --- a/mozilla/editor/base/IMECommitTxn.cpp +++ b/mozilla/editor/base/IMECommitTxn.cpp @@ -22,6 +22,15 @@ #include "IMECommitTxn.h" #include "nsEditor.h" +#include "nslog.h" + +#ifdef DEBUG_IME +NS_IMPL_LOG_ENABLED(IMECommitTxnLog) +#else +NS_IMPL_LOG(IMECommitTxnLog) +#endif +#define PRINTF NS_LOG_PRINTF(IMECommitTxnLog) +#define FLUSH NS_LOG_FLUSH(IMECommitTxnLog) // #define DEBUG_IME nsIAtom *IMECommitTxn::gIMECommitTxnName = nsnull; @@ -57,28 +66,19 @@ NS_IMETHODIMP IMECommitTxn::Init(void) NS_IMETHODIMP IMECommitTxn::Do(void) { -#ifdef DEBUG_IME - printf("Do IME Commit"); -#endif - + PRINTF("Do IME Commit"); return NS_OK; } NS_IMETHODIMP IMECommitTxn::Undo(void) { -#ifdef DEBUG_IME - printf("Undo IME Commit"); -#endif - + PRINTF("Undo IME Commit"); return NS_OK; } NS_IMETHODIMP IMECommitTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransaction) { -#ifdef DEBUG_IME - printf("Merge IME Commit"); -#endif - + PRINTF("Merge IME Commit"); NS_ASSERTION(aDidMerge, "null ptr- aDidMerge"); NS_ASSERTION(aTransaction, "null ptr- aTransaction"); if((nsnull == aDidMerge) || (nsnull == aTransaction)) diff --git a/mozilla/editor/base/IMETextTxn.cpp b/mozilla/editor/base/IMETextTxn.cpp index 95aa41bd6f5..85eee494bfc 100644 --- a/mozilla/editor/base/IMETextTxn.cpp +++ b/mozilla/editor/base/IMETextTxn.cpp @@ -30,6 +30,15 @@ #include "nsIPresShell.h" #include "EditAggregateTxn.h" #include "nsLayoutCID.h" +#include "nslog.h" + +#ifdef DEBUG_IMETXN +NS_IMPL_LOG_ENABLED(IMETextTxnLog) +#else +NS_IMPL_LOG(IMETextTxnLog) +#endif +#define PRINTF NS_LOG_PRINTF(IMETextTxnLog) +#define FLUSH NS_LOG_FLUSH(IMETextTxnLog) // #define DEBUG_IMETXN static NS_DEFINE_IID(kRangeCID, NS_RANGE_CID); @@ -86,11 +95,7 @@ NS_IMETHODIMP IMETextTxn::Init(nsIDOMCharacterData *aElement, NS_IMETHODIMP IMETextTxn::Do(void) { - -#ifdef DEBUG_IMETXN - printf("Do IME Text element = %p replace = %d len = %d\n", mElement.get(), mReplaceLength, mStringToInsert.Length()); -#endif - + PRINTF("Do IME Text element = %p replace = %d len = %d\n", mElement.get(), mReplaceLength, mStringToInsert.Length()); nsCOMPtr selCon = do_QueryReferent(mSelConWeak); if (!selCon) return NS_ERROR_NOT_INITIALIZED; @@ -110,10 +115,7 @@ NS_IMETHODIMP IMETextTxn::Do(void) NS_IMETHODIMP IMETextTxn::Undo(void) { -#ifdef DEBUG_IMETXN - printf("Undo IME Text element = %p\n", mElement.get()); -#endif - + PRINTF("Undo IME Text element = %p\n", mElement.get()); nsCOMPtr selCon = do_QueryReferent(mSelConWeak); if (!selCon) return NS_ERROR_NOT_INITIALIZED; @@ -140,9 +142,7 @@ NS_IMETHODIMP IMETextTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransaction) return NS_ERROR_NULL_POINTER; nsresult result; -#ifdef DEBUG_IMETXN - printf("Merge IME Text element = %p\n", mElement.get()); -#endif + PRINTF("Merge IME Text element = %p\n", mElement.get()); // // check to make sure we have valid return pointers @@ -174,9 +174,7 @@ NS_IMETHODIMP IMETextTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransaction) otherTxn->GetData(mStringToInsert,&newTextRangeList); mRangeList = do_QueryInterface(newTextRangeList); *aDidMerge = PR_TRUE; -#ifdef DEBUG_IMETXN - printf("IMETextTxn assimilated IMETextTxn:%p\n", aTransaction); -#endif + PRINTF("IMETextTxn assimilated IMETextTxn:%p\n", aTransaction); NS_RELEASE(otherTxn); return NS_OK; } @@ -292,24 +290,24 @@ NS_IMETHODIMP IMETextTxn::CollapseTextSelection(void) PRUint16 listlen,start,stop,type; nsIPrivateTextRange* rangePtr; result = mRangeList->GetLength(&listlen); - printf("nsIPrivateTextRangeList[%p]\n",mRangeList); + PRINTF("nsIPrivateTextRangeList[%p]\n",mRangeList); for (i=0;iItem(i,&rangePtr); rangePtr->GetRangeStart(&start); rangePtr->GetRangeEnd(&stop); rangePtr->GetRangeType(&type); - printf("range[%d] start=%d end=%d type=",i,start,stop,type); + PRINTF("range[%d] start=%d end=%d type=",i,start,stop,type); if (type==nsIPrivateTextRange::TEXTRANGE_RAWINPUT) - printf("TEXTRANGE_RAWINPUT\n"); + PRINTF("TEXTRANGE_RAWINPUT\n"); else if (type==nsIPrivateTextRange::TEXTRANGE_SELECTEDRAWTEXT) - printf("TEXTRANGE_SELECTEDRAWTEXT\n"); + PRINTF("TEXTRANGE_SELECTEDRAWTEXT\n"); else if (type==nsIPrivateTextRange::TEXTRANGE_CONVERTEDTEXT) - printf("TEXTRANGE_CONVERTEDTEXT\n"); + PRINTF("TEXTRANGE_CONVERTEDTEXT\n"); else if (type==nsIPrivateTextRange::TEXTRANGE_SELECTEDCONVERTEDTEXT) - printf("TEXTRANGE_SELECTEDCONVERTEDTEXT\n"); + PRINTF("TEXTRANGE_SELECTEDCONVERTEDTEXT\n"); else if (type==nsIPrivateTextRange::TEXTRANGE_CARETPOSITION) - printf("TEXTRANGE_CARETPOSITION\n"); - else printf("unknown constant\n"); + PRINTF("TEXTRANGE_CARETPOSITION\n"); + else PRINTF("unknown constant\n"); } #endif diff --git a/mozilla/editor/base/InsertElementTxn.cpp b/mozilla/editor/base/InsertElementTxn.cpp index fb6797fbac6..3cca82dcd06 100644 --- a/mozilla/editor/base/InsertElementTxn.cpp +++ b/mozilla/editor/base/InsertElementTxn.cpp @@ -24,13 +24,11 @@ #include "nsISelection.h" #include "nsIContent.h" #include "nsIDOMNodeList.h" +#include "nslog.h" -#ifdef NS_DEBUG -static PRBool gNoisy = PR_FALSE; -#else -static const PRBool gNoisy = PR_FALSE; -#endif - +NS_IMPL_LOG(InsertElementTxnLog) +#define PRINTF NS_LOG_PRINTF(InsertElementTxnLog) +#define FLUSH NS_LOG_FLUSH(InsertElementTxnLog) InsertElementTxn::InsertElementTxn() : EditTxn() @@ -64,14 +62,14 @@ InsertElementTxn::~InsertElementTxn() NS_IMETHODIMP InsertElementTxn::Do(void) { - if (gNoisy) + if (NS_LOG_ENABLED(InsertElementTxnLog)) { nsCOMPtrnodeAsContent = do_QueryInterface(mNode); nsCOMPtrparentAsContent = do_QueryInterface(mParent); nsString namestr; mNode->GetNodeName(namestr); char* nodename = namestr.ToNewCString(); - printf("%p Do Insert Element of %p <%s> into parent %p at offset %d\n", + PRINTF("%p Do Insert Element of %p <%s> into parent %p at offset %d\n", this, nodeAsContent.get(), nodename, parentAsContent.get(), mOffset); nsMemory::Free(nodename); @@ -121,8 +119,8 @@ NS_IMETHODIMP InsertElementTxn::Do(void) NS_IMETHODIMP InsertElementTxn::Undo(void) { - if (gNoisy) { printf("%p Undo Insert Element of %p into parent %p at offset %d\n", - this, mNode.get(), mParent.get(), mOffset); } + PRINTF("%p Undo Insert Element of %p into parent %p at offset %d\n", + this, mNode.get(), mParent.get(), mOffset); if (!mNode || !mParent) return NS_ERROR_NOT_INITIALIZED; nsCOMPtr resultNode; diff --git a/mozilla/editor/base/InsertTextTxn.cpp b/mozilla/editor/base/InsertTextTxn.cpp index 921bfe3dec7..620057c4cf1 100644 --- a/mozilla/editor/base/InsertTextTxn.cpp +++ b/mozilla/editor/base/InsertTextTxn.cpp @@ -25,15 +25,14 @@ #include "nsIDOMCharacterData.h" #include "nsISelection.h" #include "EditAggregateTxn.h" +#include "nslog.h" + +NS_IMPL_LOG(InsertTextTxnLog) +#define PRINTF NS_LOG_PRINTF(InsertTextTxnLog) +#define FLUSH NS_LOG_FLUSH(InsertTextTxnLog) static NS_DEFINE_IID(kIDOMSelectionIID, NS_ISELECTION_IID); -#ifdef NS_DEBUG -static PRBool gNoisy = PR_FALSE; -#else -static const PRBool gNoisy = PR_FALSE; -#endif - nsIAtom *InsertTextTxn::gInsertTextTxnName; nsresult InsertTextTxn::ClassInit() @@ -66,11 +65,11 @@ NS_IMETHODIMP InsertTextTxn::Init(nsIDOMCharacterData *aElement, nsIEditor *aEditor) { #if 0 //def DEBUG_cmanske - nsAutoString text; - aElement->GetData(text); - printf("InsertTextTxn: Offset to insert at = %d. Text of the node to insert into:\n", aOffset); - wprintf(text.GetUnicode()); - printf("\n"); + nsAutoString text; + aElement->GetData(text); + PRINTF("InsertTextTxn: Offset to insert at = %d. Text of the node to insert into:\n", aOffset); + WPRINTF(text.GetUnicode()); + PRINTF("\n"); #endif NS_ASSERTION(aElement && aEditor, "bad args"); @@ -85,7 +84,7 @@ NS_IMETHODIMP InsertTextTxn::Init(nsIDOMCharacterData *aElement, NS_IMETHODIMP InsertTextTxn::Do(void) { - if (gNoisy) { printf("Do Insert Text element = %p\n", mElement.get()); } + PRINTF("Do Insert Text element = %p\n", mElement.get()); NS_ASSERTION(mElement && mEditor, "bad state"); if (!mElement || !mEditor) { return NS_ERROR_NOT_INITIALIZED; } @@ -114,7 +113,7 @@ NS_IMETHODIMP InsertTextTxn::Do(void) NS_IMETHODIMP InsertTextTxn::Undo(void) { - if (gNoisy) { printf("Undo Insert Text element = %p\n", mElement.get()); } + PRINTF("Undo Insert Text element = %p\n", mElement.get()); NS_ASSERTION(mElement && mEditor, "bad state"); if (!mElement || !mEditor) { return NS_ERROR_NOT_INITIALIZED; } @@ -144,7 +143,7 @@ NS_IMETHODIMP InsertTextTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransacti otherInsTxn->GetData(otherData); mStringToInsert += otherData; *aDidMerge = PR_TRUE; - if (gNoisy) { printf("InsertTextTxn assimilated %p\n", aTransaction); } + PRINTF("InsertTextTxn assimilated %p\n", aTransaction); } NS_RELEASE(otherInsTxn); } @@ -176,7 +175,7 @@ NS_IMETHODIMP InsertTextTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransacti otherInsertTxn->GetData(otherData); mStringToInsert += otherData; *aDidMerge = PR_TRUE; - if (gNoisy) { printf("InsertTextTxn assimilated %p\n", aTransaction); } + PRINTF("InsertTextTxn assimilated %p\n", aTransaction); } NS_RELEASE(otherInsertTxn); } diff --git a/mozilla/editor/base/JoinElementTxn.cpp b/mozilla/editor/base/JoinElementTxn.cpp index 21cb2675bed..8eb97f754f8 100644 --- a/mozilla/editor/base/JoinElementTxn.cpp +++ b/mozilla/editor/base/JoinElementTxn.cpp @@ -24,12 +24,11 @@ #include "nsEditor.h" #include "nsIDOMNodeList.h" #include "nsIDOMCharacterData.h" +#include "nslog.h" -#ifdef NS_DEBUG -static PRBool gNoisy = PR_FALSE; -#else -static const PRBool gNoisy = PR_FALSE; -#endif +NS_IMPL_LOG(JoinElementTxnLog) +#define PRINTF NS_LOG_PRINTF(JoinElementTxnLog) +#define FLUSH NS_LOG_FLUSH(JoinElementTxnLog) JoinElementTxn::JoinElementTxn() : EditTxn() @@ -58,7 +57,7 @@ JoinElementTxn::~JoinElementTxn() // After Do() and Redo(), the left node is removed from the content tree and right node remains. NS_IMETHODIMP JoinElementTxn::Do(void) { - if (gNoisy) { printf("%p Do Join of %p and %p\n", this, mLeftNode.get(), mRightNode.get()); } + PRINTF("%p Do Join of %p and %p\n", this, mLeftNode.get(), mRightNode.get()); NS_PRECONDITION((mEditor && mLeftNode && mRightNode), "null arg"); if (!mEditor || !mLeftNode || !mRightNode) { return NS_ERROR_NOT_INITIALIZED; } @@ -97,7 +96,7 @@ NS_IMETHODIMP JoinElementTxn::Do(void) result = mEditor->JoinNodesImpl(mRightNode, mLeftNode, mParent, PR_FALSE); if (NS_SUCCEEDED(result)) { - if (gNoisy) { printf(" left node = %p removed\n", mLeftNode.get()); } + PRINTF(" left node = %p removed\n", mLeftNode.get()); } } else @@ -112,7 +111,7 @@ NS_IMETHODIMP JoinElementTxn::Do(void) // and re-inserted mLeft? NS_IMETHODIMP JoinElementTxn::Undo(void) { - if (gNoisy) { printf("%p Undo Join, right node = %p\n", this, mRightNode.get()); } + PRINTF("%p Undo Join, right node = %p\n", this, mRightNode.get()); NS_ASSERTION(mRightNode && mLeftNode && mParent, "bad state"); if (!mRightNode || !mLeftNode || !mParent) { return NS_ERROR_NOT_INITIALIZED; } nsresult result; diff --git a/mozilla/editor/base/PlaceholderTxn.cpp b/mozilla/editor/base/PlaceholderTxn.cpp index 5a1df3492b3..c2b698346fe 100644 --- a/mozilla/editor/base/PlaceholderTxn.cpp +++ b/mozilla/editor/base/PlaceholderTxn.cpp @@ -26,13 +26,11 @@ #include "nsHTMLEditor.h" #include "nsIPresShell.h" #include "IMETextTxn.h" +#include "nslog.h" -#if defined(NS_DEBUG) && defined(DEBUG_buster) -static PRBool gNoisy = PR_TRUE; -#else -static const PRBool gNoisy = PR_FALSE; -#endif - +NS_IMPL_LOG(PlaceholderTxnLog) +#define PRINTF NS_LOG_PRINTF(PlaceholderTxnLog) +#define FLUSH NS_LOG_FLUSH(PlaceholderTxnLog) PlaceholderTxn::PlaceholderTxn() : EditAggregateTxn(), mAbsorb(PR_TRUE), @@ -86,7 +84,7 @@ NS_IMETHODIMP PlaceholderTxn::Init(nsIAtom *aName, nsSelectionState *aSelState, NS_IMETHODIMP PlaceholderTxn::Do(void) { - if (gNoisy) { printf("PlaceholderTxn Do\n"); } + PRINTF("PlaceholderTxn Do\n"); return NS_OK; } @@ -176,7 +174,7 @@ NS_IMETHODIMP PlaceholderTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransact // efficiency hack: no need to remember selection here, as we haven't yet // finished the inital batch and we know we will be told when the batch ends. // we can remeber the selection then. - if (gNoisy) { printf("Placeholder txn assimilated %p\n", aTransaction); } + PRINTF("Placeholder txn assimilated %p\n", aTransaction); } else { // merge typing or IME or deletion transactions if the selection matches diff --git a/mozilla/editor/base/SplitElementTxn.cpp b/mozilla/editor/base/SplitElementTxn.cpp index e742f526ec6..0a122a628bd 100644 --- a/mozilla/editor/base/SplitElementTxn.cpp +++ b/mozilla/editor/base/SplitElementTxn.cpp @@ -25,6 +25,11 @@ #include "nsIDOMNode.h" #include "nsISelection.h" #include "nsIDOMCharacterData.h" +#include "nslog.h" + +NS_IMPL_LOG(SplitElementTxnLog) +#define PRINTF NS_LOG_PRINTF(SplitElementTxnLog) +#define FLUSH NS_LOG_FLUSH(SplitElementTxnLog) #ifdef NS_DEBUG static PRBool gNoisy = PR_FALSE; @@ -60,7 +65,7 @@ SplitElementTxn::~SplitElementTxn() NS_IMETHODIMP SplitElementTxn::Do(void) { - if (gNoisy) { printf("%p Do Split of node %p offset %d\n", this, mExistingRightNode.get(), mOffset); } + PRINTF("%p Do Split of node %p offset %d\n", this, mExistingRightNode.get(), mOffset); NS_ASSERTION(mExistingRightNode && mEditor, "bad state"); if (!mExistingRightNode || !mEditor) { return NS_ERROR_NOT_INITIALIZED; } @@ -72,7 +77,7 @@ NS_IMETHODIMP SplitElementTxn::Do(void) mEditor->MarkNodeDirty(mExistingRightNode); - if (gNoisy) { printf(" created left node = %p\n", mNewLeftNode.get()); } + PRINTF(" created left node = %p\n", mNewLeftNode.get()); // get the parent node result = mExistingRightNode->GetParentNode(getter_AddRefs(mParent)); if (NS_FAILED(result)) return result; @@ -96,10 +101,8 @@ NS_IMETHODIMP SplitElementTxn::Do(void) NS_IMETHODIMP SplitElementTxn::Undo(void) { - if (gNoisy) { - printf("%p Undo Split of existing node %p and new node %p offset %d\n", - this, mExistingRightNode.get(), mNewLeftNode.get(), mOffset); - } + PRINTF("%p Undo Split of existing node %p and new node %p offset %d\n", + this, mExistingRightNode.get(), mNewLeftNode.get(), mOffset); NS_ASSERTION(mEditor && mExistingRightNode && mNewLeftNode && mParent, "bad state"); if (!mEditor || !mExistingRightNode || !mNewLeftNode || !mParent) { return NS_ERROR_NOT_INITIALIZED; @@ -107,14 +110,11 @@ NS_IMETHODIMP SplitElementTxn::Undo(void) // this assumes Do inserted the new node in front of the prior existing node nsresult result = mEditor->JoinNodesImpl(mExistingRightNode, mNewLeftNode, mParent, PR_FALSE); - if (gNoisy) - { - printf("** after join left child node %p into right node %p\n", mNewLeftNode.get(), mExistingRightNode.get()); - if (gNoisy) {mEditor->DebugDumpContent(); } // DEBUG - } + PRINTF("** after join left child node %p into right node %p\n", mNewLeftNode.get(), mExistingRightNode.get()); + if (NS_LOG_ENABLED(SplitElementTxnLog)) { mEditor->DebugDumpContent(); } // DEBUG if (NS_SUCCEEDED(result)) { - if (gNoisy) { printf(" left node = %p removed\n", mNewLeftNode.get()); } + PRINTF(" left node = %p removed\n", mNewLeftNode.get()); } return result; } @@ -128,11 +128,9 @@ NS_IMETHODIMP SplitElementTxn::Redo(void) if (!mEditor || !mExistingRightNode || !mNewLeftNode || !mParent) { return NS_ERROR_NOT_INITIALIZED; } - if (gNoisy) { - printf("%p Redo Split of existing node %p and new node %p offset %d\n", - this, mExistingRightNode.get(), mNewLeftNode.get(), mOffset); - if (gNoisy) {mEditor->DebugDumpContent(); } // DEBUG - } + PRINTF("%p Redo Split of existing node %p and new node %p offset %d\n", + this, mExistingRightNode.get(), mNewLeftNode.get(), mOffset); + if (NS_LOG_ENABLED(SplitElementTxnLog)) { mEditor->DebugDumpContent(); } // DEBUG nsresult result; nsCOMPtrresultNode; // first, massage the existing node so it is in its post-split state @@ -141,11 +139,8 @@ NS_IMETHODIMP SplitElementTxn::Redo(void) if (rightNodeAsText) { result = rightNodeAsText->DeleteData(0, mOffset); - if (gNoisy) - { - printf("** after delete of text in right text node %p offset %d\n", rightNodeAsText.get(), mOffset); - mEditor->DebugDumpContent(); // DEBUG - } + PRINTF("** after delete of text in right text node %p offset %d\n", rightNodeAsText.get(), mOffset); + if (NS_LOG_ENABLED(SplitElementTxnLog)) { mEditor->DebugDumpContent(); } // DEBUG } else { @@ -162,22 +157,16 @@ NS_IMETHODIMP SplitElementTxn::Redo(void) if (NS_SUCCEEDED(result)) { result = mNewLeftNode->AppendChild(child, getter_AddRefs(resultNode)); - if (gNoisy) - { - printf("** move child node %p from right node %p to left node %p\n", child.get(), mExistingRightNode.get(), mNewLeftNode.get()); - if (gNoisy) {mEditor->DebugDumpContent(); } // DEBUG - } + PRINTF("** move child node %p from right node %p to left node %p\n", child.get(), mExistingRightNode.get(), mNewLeftNode.get()); + if (NS_LOG_ENABLED(SplitElementTxnLog)) { mEditor->DebugDumpContent(); } // DEBUG } child = do_QueryInterface(nextSibling); } } // second, re-insert the left node into the tree result = mParent->InsertBefore(mNewLeftNode, mExistingRightNode, getter_AddRefs(resultNode)); - if (gNoisy) - { - printf("** reinsert left child node %p before right node %p\n", mNewLeftNode.get(), mExistingRightNode.get()); - if (gNoisy) {mEditor->DebugDumpContent(); } // DEBUG - } + PRINTF("** reinsert left child node %p before right node %p\n", mNewLeftNode.get(), mExistingRightNode.get()); + if (NS_LOG_ENABLED(SplitElementTxnLog)) {mEditor->DebugDumpContent(); } // DEBUG return result; } diff --git a/mozilla/editor/base/nsEditor.cpp b/mozilla/editor/base/nsEditor.cpp index 8d8aacdfe8b..0868a2aa8d8 100644 --- a/mozilla/editor/base/nsEditor.cpp +++ b/mozilla/editor/base/nsEditor.cpp @@ -137,12 +137,11 @@ static NS_DEFINE_CID(kCTransactionManagerCID, NS_TRANSACTIONMANAGER_CID); const char* nsEditor::kMOZEditorBogusNodeAttr="_moz_editor_bogus_node"; const char* nsEditor::kMOZEditorBogusNodeValue="TRUE"; -#ifdef NS_DEBUG_EDITOR -static PRBool gNoisy = PR_FALSE; -#else -static const PRBool gNoisy = PR_FALSE; -#endif +#include "nslog.h" +NS_IMPL_LOG(nsEditorLog) +#define PRINTF NS_LOG_PRINTF(nsEditorLog) +#define FLUSH NS_LOG_FLUSH(nsEditorLog) const PRUnichar nbsp = 160; PRInt32 nsEditor::gInstanceCount = 0; @@ -724,11 +723,11 @@ nsRangeUpdater::DidMoveNode(nsIDOMNode *aOldParent, PRInt32 aOldOffset, nsIDOMNo nsRangeStore::nsRangeStore() { - // DEBUG: n++; printf("range store alloc count=%d\n", n); + // DEBUG: n++; PRINTF("range store alloc count=%d\n", n); } nsRangeStore::~nsRangeStore() { - // DEBUG: n--; printf("range store alloc count=%d\n", n); + // DEBUG: n--; PRINTF("range store alloc count=%d\n", n); } nsresult nsRangeStore::StoreRange(nsIDOMRange *aRange) @@ -1108,7 +1107,7 @@ nsEditor::GetSelection(nsISelection **aSelection) NS_IMETHODIMP nsEditor::Do(nsITransaction *aTxn) { - if (gNoisy) { printf("Editor::Do ----------\n"); } + PRINTF("Editor::Do ----------\n"); nsresult result = NS_OK; @@ -1185,7 +1184,7 @@ nsEditor::EnableUndo(PRBool aEnable) nsnull, NS_GET_IID(nsITransactionManager), getter_AddRefs(mTxnMgr)); if (NS_FAILED(result) || !mTxnMgr) { - printf("ERROR: Failed to get TransactionManager instance.\n"); + PRINTF("ERROR: Failed to get TransactionManager instance.\n"); return NS_ERROR_NOT_AVAILABLE; } } @@ -1221,7 +1220,7 @@ nsEditor::GetTransactionManager(nsITransactionManager* *aTxnManager) NS_IMETHODIMP nsEditor::Undo(PRUint32 aCount) { - if (gNoisy) { printf("Editor::Undo ----------\n"); } + PRINTF("Editor::Undo ----------\n"); nsresult result = NS_OK; ForceCompositionEnd(); @@ -1266,7 +1265,7 @@ NS_IMETHODIMP nsEditor::CanUndo(PRBool &aIsEnabled, PRBool &aCanUndo) NS_IMETHODIMP nsEditor::Redo(PRUint32 aCount) { - if (gNoisy) { printf("Editor::Redo ----------\n"); } + PRINTF("Editor::Redo ----------\n"); nsresult result = NS_OK; nsAutoRules beginRulesSniffing(this, kOpRedo, nsIEditor::eNone); @@ -2455,7 +2454,7 @@ NS_IMETHODIMP nsEditor::BeginComposition(nsTextEventReply* aReply) { #ifdef DEBUG_tague - printf("nsEditor::StartComposition\n"); + PRINTF("nsEditor::StartComposition\n"); #endif nsresult ret = QueryComposition(aReply); mInIMEMode = PR_TRUE; @@ -2814,7 +2813,7 @@ nsEditor::CloneAttributes(nsIDOMNode *aDestNode, nsIDOMNode *aSourceNode) } else { // Do we ever get here? #if DEBUG_cmanske - printf("Attribute in sourceAttribute has empty value in nsEditor::CloneAttributes()\n"); + PRINTF("Attribute in sourceAttribute has empty value in nsEditor::CloneAttributes()\n"); #endif } } @@ -3255,7 +3254,7 @@ nsEditor::SplitNodeImpl(nsIDOMNode * aExistingRightNode, nsIDOMNode* aParent) { - if (gNoisy) { printf("SplitNodeImpl: left=%p, right=%p, offset=%d\n", aNewLeftNode, aExistingRightNode, aOffset); } + PRINTF("SplitNodeImpl: left=%p, right=%p, offset=%d\n", aNewLeftNode, aExistingRightNode, aOffset); nsresult result; NS_ASSERTION(((nsnull!=aExistingRightNode) && @@ -3282,7 +3281,7 @@ nsEditor::SplitNodeImpl(nsIDOMNode * aExistingRightNode, nsCOMPtr resultNode; result = aParent->InsertBefore(aNewLeftNode, aExistingRightNode, getter_AddRefs(resultNode)); - //printf(" after insert\n"); content->List(); // DEBUG + //PRINTF(" after insert\n"); content->List(); // DEBUG if (NS_SUCCEEDED(result)) { // split the children between the 2 nodes @@ -3318,13 +3317,13 @@ nsEditor::SplitNodeImpl(nsIDOMNode * aExistingRightNode, if ((NS_SUCCEEDED(result)) && (childNode)) { result = aExistingRightNode->RemoveChild(childNode, getter_AddRefs(resultNode)); - //printf(" after remove\n"); content->List(); // DEBUG + //PRINTF(" after remove\n"); content->List(); // DEBUG if (NS_SUCCEEDED(result)) { nsCOMPtr firstChild; aNewLeftNode->GetFirstChild(getter_AddRefs(firstChild)); result = aNewLeftNode->InsertBefore(childNode, firstChild, getter_AddRefs(resultNode)); - //printf(" after append\n"); content->List(); // DEBUG + //PRINTF(" after append\n"); content->List(); // DEBUG } } } @@ -4617,8 +4616,8 @@ nsEditor::GetBlockSection(nsIDOMNode *aChild, result = (*aRightNode)->GetNextSibling(getter_AddRefs(sibling)); } NS_ADDREF((*aRightNode)); - if (gNoisy) { printf("GetBlockSection returning %p %p\n", - (*aLeftNode), (*aRightNode)); } + PRINTF("GetBlockSection returning %p %p\n", + (*aLeftNode), (*aRightNode)); return result; } @@ -4673,7 +4672,7 @@ nsEditor::GetBlockSectionsForRange(nsIDOMRange *aRange, nsISupportsArray *aSecti result = GetBlockSection(currentNode, getter_AddRefs(leftNode), getter_AddRefs(rightNode)); - if (gNoisy) {printf("currentNode %p has block content (%p,%p)\n", currentNode.get(), leftNode.get(), rightNode.get());} + PRINTF("currentNode %p has block content (%p,%p)\n", currentNode.get(), leftNode.get(), rightNode.get()); if ((NS_SUCCEEDED(result)) && leftNode && rightNode) { // add range to the list if it doesn't overlap with the previous range @@ -4686,12 +4685,12 @@ nsEditor::GetBlockSectionsForRange(nsIDOMRange *aRange, nsISupportsArray *aSecti blockParentOfLastStartNode = do_QueryInterface(GetBlockNodeParent(lastStartNode)); if (blockParentOfLastStartNode) { - if (gNoisy) {printf("lastStartNode %p has block parent %p\n", lastStartNode.get(), blockParentOfLastStartNode.get());} + PRINTF("lastStartNode %p has block parent %p\n", lastStartNode.get(), blockParentOfLastStartNode.get()); nsCOMPtr blockParentOfLeftNode; blockParentOfLeftNode = do_QueryInterface(GetBlockNodeParent(leftNode)); if (blockParentOfLeftNode) { - if (gNoisy) {printf("leftNode %p has block parent %p\n", leftNode.get(), blockParentOfLeftNode.get());} + PRINTF("leftNode %p has block parent %p\n", leftNode.get(), blockParentOfLeftNode.get()); if (blockParentOfLastStartNode==blockParentOfLeftNode) { addRange = PR_FALSE; } @@ -4700,7 +4699,7 @@ nsEditor::GetBlockSectionsForRange(nsIDOMRange *aRange, nsISupportsArray *aSecti } if (PR_TRUE==addRange) { - if (gNoisy) {printf("adding range, setting lastRange with start node %p\n", leftNode.get());} + PRINTF("adding range, setting lastRange with start node %p\n", leftNode.get()); nsCOMPtr range; result = nsComponentManager::CreateInstance(kCRangeCID, nsnull, NS_GET_IID(nsIDOMRange), getter_AddRefs(range)); @@ -5842,7 +5841,7 @@ nsEditor::CreateTxnForDeleteInsertionPoint(nsIDOMRange *aRange, } else { // XXX: can you have an empty text node? If so, what do you do? - printf("ERROR: found a text node with 0 characters\n"); + PRINTF("ERROR: found a text node with 0 characters\n"); result = NS_ERROR_UNEXPECTED; } } @@ -5881,7 +5880,7 @@ nsEditor::CreateTxnForDeleteInsertionPoint(nsIDOMRange *aRange, } else { // XXX: can you have an empty text node? If so, what do you do? - printf("ERROR: found a text node with 0 characters\n"); + PRINTF("ERROR: found a text node with 0 characters\n"); result = NS_ERROR_UNEXPECTED; } } diff --git a/mozilla/editor/base/nsEditorEventListeners.cpp b/mozilla/editor/base/nsEditorEventListeners.cpp index 6f11a9a11bc..03c9098a8c6 100644 --- a/mozilla/editor/base/nsEditorEventListeners.cpp +++ b/mozilla/editor/base/nsEditorEventListeners.cpp @@ -64,6 +64,15 @@ #include "nsISupportsPrimitives.h" #include "nsLayoutCID.h" #include "nsIDOMNSRange.h" +#include "nslog.h" + +#ifdef DEBUG_IME +NS_IMPL_LOG_ENABLED(nsEditorEventListenersLog) +#else +NS_IMPL_LOG(nsEditorEventListenersLog) +#endif +#define PRINTF NS_LOG_PRINTF(nsEditorEventListenersLog) +#define FLUSH NS_LOG_FLUSH(nsEditorEventListenersLog) // Drag & Drop, Clipboard Support static NS_DEFINE_CID(kCDataFlavorCID, NS_DATAFLAVOR_CID); @@ -510,9 +519,7 @@ nsTextEditorTextListener::QueryInterface(REFNSIID aIID, void** aInstancePtr) nsresult nsTextEditorTextListener::HandleEvent(nsIDOMEvent* aEvent) { -#ifdef DEBUG_IME - printf("nsTextEditorTextListener::HandleEvent\n"); -#endif + PRINTF("nsTextEditorTextListener::HandleEvent\n"); return NS_OK; } @@ -521,9 +528,7 @@ nsTextEditorTextListener::HandleEvent(nsIDOMEvent* aEvent) nsresult nsTextEditorTextListener::HandleText(nsIDOMEvent* aTextEvent) { -#ifdef DEBUG_IME - printf("nsTextEditorTextListener::HandleText\n"); -#endif + PRINTF("nsTextEditorTextListener::HandleText\n"); nsAutoString composedText; nsresult result = NS_OK; nsCOMPtr textEvent; @@ -806,9 +811,7 @@ NS_IMPL_RELEASE(nsTextEditorCompositionListener) nsresult nsTextEditorCompositionListener::HandleEvent(nsIDOMEvent* aEvent) { -#ifdef DEBUG_IME - printf("nsTextEditorCompositionListener::HandleEvent\n"); -#endif + PRINTF("nsTextEditorCompositionListener::HandleEvent\n"); return NS_OK; } @@ -824,9 +827,7 @@ void nsTextEditorCompositionListener::SetEditor(nsIEditor *aEditor) nsresult nsTextEditorCompositionListener::HandleStartComposition(nsIDOMEvent* aCompositionEvent) { -#ifdef DEBUG_IME - printf("nsTextEditorCompositionListener::HandleStartComposition\n"); -#endif + PRINTF("nsTextEditorCompositionListener::HandleStartComposition\n"); nsCOMPtr pCompositionEvent = do_QueryInterface(aCompositionEvent); nsTextEventReply* eventReply; @@ -840,9 +841,7 @@ nsTextEditorCompositionListener::HandleStartComposition(nsIDOMEvent* aCompositio nsresult nsTextEditorCompositionListener::HandleQueryComposition(nsIDOMEvent* aCompositionEvent) { -#ifdef DEBUG_IME - printf("nsTextEditorCompositionListener::HandleQueryComposition\n"); -#endif + PRINTF("nsTextEditorCompositionListener::HandleQueryComposition\n"); nsCOMPtr pCompositionEvent = do_QueryInterface(aCompositionEvent); nsTextEventReply* eventReply; @@ -857,9 +856,7 @@ nsTextEditorCompositionListener::HandleQueryComposition(nsIDOMEvent* aCompositio nsresult nsTextEditorCompositionListener::HandleEndComposition(nsIDOMEvent* aCompositionEvent) { -#ifdef DEBUG_IME - printf("nsTextEditorCompositionListener::HandleEndComposition\n"); -#endif + PRINTF("nsTextEditorCompositionListener::HandleEndComposition\n"); return mEditor->EndComposition(); } @@ -867,9 +864,7 @@ nsTextEditorCompositionListener::HandleEndComposition(nsIDOMEvent* aCompositionE nsresult nsTextEditorCompositionListener::HandleQueryReconversion(nsIDOMEvent* aReconversionEvent) { -#ifdef DEBUG_IME - printf("nsTextEditorCompositionListener::HandleQueryReconversion\n"); -#endif + PRINTF("nsTextEditorCompositionListener::HandleQueryReconversion\n"); nsCOMPtr pCompositionEvent = do_QueryInterface(aReconversionEvent); nsReconversionEventReply* eventReply; diff --git a/mozilla/editor/base/nsEditorShell.cpp b/mozilla/editor/base/nsEditorShell.cpp index 795ed91175d..0140cd34dcc 100644 --- a/mozilla/editor/base/nsEditorShell.cpp +++ b/mozilla/editor/base/nsEditorShell.cpp @@ -126,6 +126,12 @@ #include "nsInternetCiter.h" #include "nsEditorShellMouseListener.h" +#include "nslog.h" + +NS_IMPL_LOG(nsEditorShellLog) +#define PRINTF NS_LOG_PRINTF(nsEditorShellLog) +#define FLUSH NS_LOG_FLUSH(nsEditorShellLog) + /////////////////////////////////////// // Drag & Drop, Clipboard @@ -558,9 +564,7 @@ nsEditorShell::PrepareDocumentForEditing(nsIDocumentLoader* aLoader, nsIURI *aUr temp++; } -#if DEBUG - printf("PrepareDocumentForEditing: Editor is editing %s\n", pageURLString ? pageURLString : ""); -#endif + PRINTF("PrepareDocumentForEditing: Editor is editing %s\n", pageURLString ? pageURLString : ""); // only save the file spec if this is a local file, and is not // about:blank @@ -817,7 +821,7 @@ nsEditorShell::SetWebShellWindow(nsIDOMWindowInternal* aWin) nsAutoString str(name); char* cstr = str.ToNewCString(); - printf("Attaching to WebShellWindow[%s]\n", cstr); + PRINTF("Attaching to WebShellWindow[%s]\n", cstr); nsCRT::free(cstr); #endif */ @@ -2614,7 +2618,7 @@ nsEditorShell::Rewrap(PRBool aRespectNewlines) if (NS_FAILED(rv)) return NS_OK; #ifdef DEBUG_akkana - printf("nsEditorShell::Rewrap to %ld columns\n", (long)wrapCol); + PRINTF("nsEditorShell::Rewrap to %ld columns\n", (long)wrapCol); #endif nsCOMPtr selection; @@ -2678,7 +2682,7 @@ NS_IMETHODIMP nsEditorShell::StripCites() { #ifdef DEBUG_akkana - printf("nsEditorShell::StripCites()\n"); + PRINTF("nsEditorShell::StripCites()\n"); #endif nsCOMPtr selection; @@ -5033,7 +5037,7 @@ nsEditorShell::RunUnitTests() err = editor->DebugUnitTests(&numTests, &numTestsFailed); #ifdef APP_DEBUG - printf("\nRan %ld tests, of which %ld failed\n", (long)numTests, (long)numTestsFailed); + PRINTF("\nRan %ld tests, of which %ld failed\n", (long)numTests, (long)numTestsFailed); #endif return NS_OK; @@ -5384,7 +5388,7 @@ nsEditorShell::HandleMouseClickOnElement(nsIDOMElement *aElement, PRInt32 aClick TagName.ToLowerCase(); char szTagName[64]; TagName.ToCString(szTagName, 64); - printf("***** Element clicked on: %s, x=%d, y=%d\n", szTagName, x, y); + PRINTF("***** Element clicked on: %s, x=%d, y=%d\n", szTagName, x, y); #endif */ if (mDisplayMode == eDisplayModeAllTags) diff --git a/mozilla/editor/base/nsEditorTxnLog.cpp b/mozilla/editor/base/nsEditorTxnLog.cpp index 2638a6ae177..f386a452759 100644 --- a/mozilla/editor/base/nsEditorTxnLog.cpp +++ b/mozilla/editor/base/nsEditorTxnLog.cpp @@ -24,6 +24,11 @@ #include #include "nsHTMLEditorLog.h" #include "nsEditorTxnLog.h" +#include "nslog.h" + +NS_IMPL_LOG(nsEditorTxnLogLog) +#define PRINTF NS_LOG_PRINTF(nsEditorTxnLogLog) +#define FLUSH NS_LOG_FLUSH(nsEditorTxnLogLog) #define LOCK_LOG(doc) #define UNLOCK_LOG(doc) @@ -394,7 +399,7 @@ nsEditorTxnLog::Write(const char *aBuffer) if (mEditorLog) mEditorLog->Write(aBuffer); else - printf(aBuffer); + PRINTF(aBuffer); return NS_OK; } @@ -408,7 +413,7 @@ nsEditorTxnLog::WriteInt(const char *aFormat, PRInt32 aInt) if (mEditorLog) mEditorLog->WriteInt(aFormat, aInt); else - printf(aFormat, aInt); + PRINTF(aFormat, aInt); return NS_OK; } diff --git a/mozilla/editor/base/nsHTMLEditRules.cpp b/mozilla/editor/base/nsHTMLEditRules.cpp index 35fd0e8f04f..866b05627ad 100644 --- a/mozilla/editor/base/nsHTMLEditRules.cpp +++ b/mozilla/editor/base/nsHTMLEditRules.cpp @@ -47,6 +47,15 @@ #include "InsertTextTxn.h" #include "DeleteTextTxn.h" +#include "nslog.h" + +#if defined(DEBUG_ftang) +NS_IMPL_LOG_ENABLED(nsHTMLEditRulesLog) +#else +NS_IMPL_LOG(nsHTMLEditRulesLog) +#endif +#define PRINTF NS_LOG_PRINTF(nsHTMLEditRulesLog) +#define FLUSH NS_LOG_FLUSH(nsHTMLEditRulesLog) //const static char* kMOZEditorBogusNodeAttr="MOZ_EDITOR_BOGUS_NODE"; //const static char* kMOZEditorBogusNodeValue="TRUE"; @@ -384,9 +393,7 @@ nsHTMLEditRules::WillDoAction(nsISelection *aSelection, { if (!aInfo || !aCancel || !aHandled) return NS_ERROR_NULL_POINTER; -#if defined(DEBUG_ftang) - printf("nsHTMLEditRules::WillDoAction action = %d\n", aInfo->action); -#endif + PRINTF("nsHTMLEditRules::WillDoAction action = %d\n", aInfo->action); *aCancel = PR_FALSE; *aHandled = PR_FALSE; diff --git a/mozilla/editor/base/nsHTMLEditor.cpp b/mozilla/editor/base/nsHTMLEditor.cpp index bad61d29a14..f41b0a53c9b 100644 --- a/mozilla/editor/base/nsHTMLEditor.cpp +++ b/mozilla/editor/base/nsHTMLEditor.cpp @@ -105,6 +105,12 @@ #include "nsEditorUtils.h" #include "nsIPref.h" +#include "nslog.h" + +NS_IMPL_LOG(nsHTMLEditorLog) +#define PRINTF NS_LOG_PRINTF(nsHTMLEditorLog) +#define FLUSH NS_LOG_FLUSH(nsHTMLEditorLog) + const PRUnichar nbsp = 160; // HACK - CID for NS_CTRANSITIONAL_DTD_CID so that we can get at transitional dtd @@ -132,13 +138,6 @@ static NS_DEFINE_CID(kCHTMLFormatConverterCID, NS_HTMLFORMATCONVERTER_CID); #define kHTMLContext "text/_moz_htmlcontext" #define kHTMLInfo "text/_moz_htmlinfo" - -#if defined(NS_DEBUG) && defined(DEBUG_buster) -static PRBool gNoisy = PR_FALSE; -#else -static const PRBool gNoisy = PR_FALSE; -#endif - // Some utilities to handle annoying overloading of "A" tag for link and named anchor static char hrefText[] = "href"; static char anchorTxt[] = "anchor"; @@ -576,7 +575,7 @@ nsHTMLEditor::InstallEventListeners() result = NS_NewEditorTextListener(getter_AddRefs(mTextListenerP),this); if (NS_FAILED(result)) { #ifdef DEBUG_TAGUE -printf("nsTextEditor.cpp: failed to get TextEvent Listener\n"); + PRINTF("nsTextEditor.cpp: failed to get TextEvent Listener\n"); #endif HandleEventListenerError(); return result; @@ -586,7 +585,7 @@ printf("nsTextEditor.cpp: failed to get TextEvent Listener\n"); result = NS_NewEditorCompositionListener(getter_AddRefs(mCompositionListenerP),this); if (NS_FAILED(result)) { #ifdef DEBUG_TAGUE -printf("nsTextEditor.cpp: failed to get TextEvent Listener\n"); + PRINTF("nsTextEditor.cpp: failed to get TextEvent Listener\n"); #endif HandleEventListenerError(); return result; @@ -1729,14 +1728,13 @@ NS_IMETHODIMP nsHTMLEditor::GetInlinePropertyWithAttrValue(nsIAtom *aProperty, if (!aProperty) return NS_ERROR_NULL_POINTER; /* - if (gNoisy) - { +#ifdef NS_ENABLE_LOGGING nsAutoString propString; aProperty->ToString(propString); char *propCString = propString.ToNewCString(); - if (gNoisy) { printf("nsTextEditor::GetTextProperty %s\n", propCString); } + PRINTF("nsTextEditor::GetTextProperty %s\n", propCString); nsCRT::free(propCString); - } +#endif */ nsresult result; aAny=PR_FALSE; @@ -1843,7 +1841,7 @@ NS_IMETHODIMP nsHTMLEditor::GetInlinePropertyWithAttrValue(nsIAtom *aProperty, iter->CurrentNode(getter_AddRefs(content)); while (NS_ENUMERATOR_FALSE == iter->IsDone()) { - //if (gNoisy) { printf(" checking node %p\n", content.get()); } + //PRINTF(" checking node %p\n", content.get()); nsCOMPtrtext; text = do_QueryInterface(content); PRBool skipNode = PR_FALSE; @@ -1858,7 +1856,7 @@ NS_IMETHODIMP nsHTMLEditor::GetInlinePropertyWithAttrValue(nsIAtom *aProperty, text->GetLength(&count); if (startOffset==(PRInt32)count) { - //if (gNoisy) { printf(" skipping node %p\n", content.get()); } + //PRINTF(" skipping node %p\n", content.get()); skipNode = PR_TRUE; } } @@ -1869,11 +1867,11 @@ NS_IMETHODIMP nsHTMLEditor::GetInlinePropertyWithAttrValue(nsIAtom *aProperty, content->CanContainChildren(canContainChildren); if (canContainChildren) { - //if (gNoisy) { printf(" skipping non-leaf node %p\n", content.get()); } + //PRINTF(" skipping non-leaf node %p\n", content.get()); skipNode = PR_TRUE; } else { - //if (gNoisy) { printf(" testing non-text leaf node %p\n", content.get()); } + //PRINTF(" testing non-text leaf node %p\n", content.get()); } } if (!skipNode) @@ -1916,7 +1914,7 @@ NS_IMETHODIMP nsHTMLEditor::GetInlinePropertyWithAttrValue(nsIAtom *aProperty, { // make sure that if none of the selection is set, we don't report all is set aAll = PR_FALSE; } - //if (gNoisy) { printf(" returning first=%d any=%d all=%d\n", aFirst, aAny, aAll); } + //PRINTF(" returning first=%d any=%d all=%d\n", aFirst, aAny, aAll); return result; } @@ -2352,9 +2350,7 @@ NS_IMETHODIMP nsHTMLEditor::DeleteSelection(nsIEditor::EDirection aAction) } if (NS_FAILED(result)) { -#ifdef DEBUG - printf("Selection controller interface didn't work!\n"); -#endif + PRINTF("Selection controller interface didn't work!\n"); return result; } } @@ -3023,9 +3019,7 @@ nsHTMLEditor::ReplaceHeadContentsWithHTML(const nsString &aSourceToInsert) if (NS_FAILED(res)) { -#ifdef DEBUG - printf("Couldn't create contextual fragment: error was %d\n", res); -#endif + PRINTF("Couldn't create contextual fragment: error was %d\n", res); return res; } if (!docfrag) return NS_ERROR_NULL_POINTER; @@ -3292,9 +3286,9 @@ nsHTMLEditor::InsertElementAtSelection(nsIDOMElement* aElement, PRBool aDeleteSe { nsAutoString name; parentSelectedNode->GetNodeName(name); - printf("InsertElement: Anchor node of selection: "); - wprintf(name.GetUnicode()); - printf(" Offset: %d\n", offsetForInsert); + PRINTF("InsertElement: Anchor node of selection: "); + WPRINTF(name.GetUnicode()); + PRINTF(" Offset: %d\n", offsetForInsert); } #endif @@ -3442,13 +3436,13 @@ nsHTMLEditor::SetCaretAfterElement(nsIDOMElement* aElement) { nsAutoString name; parent->GetNodeName(name); - printf("SetCaretAfterElement: Parent node: "); - wprintf(name.GetUnicode()); - printf(" Offset: %d\n\nHTML:\n", offsetInParent+1); + PRINTF("SetCaretAfterElement: Parent node: "); + WPRINTF(name.GetUnicode()); + PRINTF(" Offset: %d\n\nHTML:\n", offsetInParent+1); nsAutoString Format("text/html"); nsAutoString ContentsAs; OutputToString(ContentsAs, Format, 2); - wprintf(ContentsAs.GetUnicode()); + WPRINTF(ContentsAs.GetUnicode()); } #endif } @@ -4287,13 +4281,13 @@ nsHTMLEditor::GetSelectedElement(const nsString& aTagName, nsIDOMElement** aRetu { nsAutoString name; anchorNode->GetNodeName(name); - printf("GetSelectedElement: Anchor node of selection: "); - wprintf(name.GetUnicode()); - printf(" Offset: %d\n", anchorOffset); + PRINTF("GetSelectedElement: Anchor node of selection: "); + WPRINTF(name.GetUnicode()); + PRINTF(" Offset: %d\n", anchorOffset); focusNode->GetNodeName(name); - printf("Focus node of selection: "); - wprintf(name.GetUnicode()); - printf(" Offset: %d\n", focusOffset); + PRINTF("Focus node of selection: "); + WPRINTF(name.GetUnicode()); + PRINTF(" Offset: %d\n", focusOffset); } #endif nsCOMPtr parentLinkOfAnchor; @@ -4414,10 +4408,10 @@ nsHTMLEditor::GetSelectedElement(const nsString& aTagName, nsIDOMElement** aRetu } else { // Should never get here? isCollapsed = PR_TRUE; - printf("isCollapsed was FALSE, but no elements found in selection\n"); + PRINTF("isCollapsed was FALSE, but no elements found in selection\n"); } } else { - printf("Could not create enumerator for GetSelectionProperties\n"); + PRINTF("Could not create enumerator for GetSelectionProperties\n"); } } } @@ -4529,7 +4523,7 @@ nsHTMLEditor::InsertLinkAroundSelection(nsIDOMElement* aAnchorElement) if (isCollapsed) { - printf("InsertLinkAroundSelection called but there is no selection!!!\n"); + PRINTF("InsertLinkAroundSelection called but there is no selection!!!\n"); res = NS_OK; } else { // Be sure we were given an anchor element @@ -4974,8 +4968,8 @@ NS_IMETHODIMP nsHTMLEditor::GetBodyWrapWidth(PRInt32 *aWrapColumn) *aWrapColumn = stylePosition->mWidth.GetIntValue(); else { #ifdef DEBUG_akkana - printf("Can't get wrap column: style unit is %d\n", - stylePosition->mWidth.GetUnit()); + PRINTF("Can't get wrap column: style unit is %d\n", + stylePosition->mWidth.GetUnit()); #endif *aWrapColumn = -1; return NS_ERROR_UNEXPECTED; @@ -5064,11 +5058,11 @@ NS_IMETHODIMP nsHTMLEditor::SetBodyWrapWidth(PRInt32 aWrapColumn) #ifdef DEBUG_wrapstyle char* curstyle = styleValue.ToNewCString(); - printf("Setting style: [%s]\nNow body looks like:\n", curstyle); + PRINTF("Setting style: [%s]\nNow body looks like:\n", curstyle); Recycle(curstyle); //nsCOMPtr nodec (do_QueryInterface(bodyElement)); //if (nodec) nodec->List(stdout); - //printf("-----\n"); + //PRINTF("-----\n"); #endif /* DEBUG_akkana */ return res; @@ -5297,7 +5291,7 @@ NS_IMETHODIMP nsHTMLEditor::InsertFromTransferable(nsITransferable *transferable nsAutoString flavor, stuffToPaste; flavor.AssignWithConversion( bestFlavor ); // just so we can use flavor.Equals() #ifdef DEBUG_akkana - printf("Got flavor [%s]\n", bestFlavor); + PRINTF("Got flavor [%s]\n", bestFlavor); #endif if (flavor.EqualsWithConversion(kHTMLMime)) { @@ -5391,7 +5385,7 @@ NS_IMETHODIMP nsHTMLEditor::InsertFromTransferable(nsITransferable *transferable else if (flavor.EqualsWithConversion(kJPEGImageMime)) { // Insert Image code here - printf("Don't know how to insert an image yet!\n"); + PRINTF("Don't know how to insert an image yet!\n"); //nsIImage* image = (nsIImage *)data; //NS_RELEASE(image); rv = NS_ERROR_NOT_IMPLEMENTED; // for now give error code @@ -5599,7 +5593,7 @@ NS_IMETHODIMP nsHTMLEditor::CanDrag(nsIDOMEvent *aDragEvent, PRBool &aCanDrag) if (mIgnoreSpuriousDragEvent) { #ifdef DEBUG_cmanske - printf(" *** IGNORING SPURIOUS DRAG EVENT!\n"); + PRINTF(" *** IGNORING SPURIOUS DRAG EVENT!\n"); #endif mIgnoreSpuriousDragEvent = PR_FALSE; return NS_OK; @@ -5913,7 +5907,7 @@ NS_IMETHODIMP nsHTMLEditor::PasteAsCitedQuotation(const nsString& aCitation, if (NS_FAILED(res)) { #ifdef DEBUG_akkana - printf("Couldn't collapse"); + PRINTF("Couldn't collapse"); #endif // XXX: error result: should res be returned here? } @@ -5957,12 +5951,12 @@ NS_IMETHODIMP nsHTMLEditor::PasteAsPlaintextQuotation(PRInt32 aSelectionType) if (NS_FAILED(rv)) { #ifdef DEBUG_akkana - printf("PasteAsPlaintextQuotation: GetAnyTransferData failed, %d\n", rv); + PRINTF("PasteAsPlaintextQuotation: GetAnyTransferData failed, %d\n", rv); #endif return rv; } #ifdef DEBUG_akkana - printf("Got flavor [%s]\n", flav); + PRINTF("Got flavor [%s]\n", flav); #endif nsAutoString flavor; flavor.AssignWithConversion(flav); nsAutoString stuffToPaste; @@ -6437,7 +6431,7 @@ NS_IMETHODIMP nsHTMLEditor::OutputToStream(nsIOutputStream* aOutputStream, nsCRT::free(contractid); if (NS_FAILED(rv)) { - printf("Couldn't get contractid %s\n", contractid); + PRINTF("Couldn't get contractid %s\n", contractid); return rv; } @@ -7165,7 +7159,7 @@ nsHTMLEditor::DeleteSelectionAndPrepareToCreateNode(nsCOMPtr &parent // Here's where the new node was inserted } else { - printf("InsertBreak into an empty document is not yet supported\n"); + PRINTF("InsertBreak into an empty document is not yet supported\n"); } return result; } @@ -7223,7 +7217,7 @@ nsCOMPtr nsHTMLEditor::FindPreElement() void nsHTMLEditor::HandleEventListenerError() { - if (gNoisy) { printf("failed to add event listener\n"); } + PRINTF("failed to add event listener\n"); // null out the nsCOMPtrs mKeyListenerP = nsnull; mMouseListenerP = nsnull; diff --git a/mozilla/editor/base/nsInternetCiter.cpp b/mozilla/editor/base/nsInternetCiter.cpp index bd7ea957cbf..72f1bd87efc 100644 --- a/mozilla/editor/base/nsInternetCiter.cpp +++ b/mozilla/editor/base/nsInternetCiter.cpp @@ -26,6 +26,11 @@ #include "nsString.h" #include "nsCOMPtr.h" +#include "nslog.h" + +NS_IMPL_LOG(nsInternetCiterLog) +#define PRINTF NS_LOG_PRINTF(nsInternetCiterLog) +#define FLUSH NS_LOG_FLUSH(nsInternetCiterLog) // Line breaker stuff #include "nsIServiceManager.h" @@ -210,7 +215,7 @@ nsInternetCiter::Rewrap(const nsString& aInString, { #ifdef DEBUG_wrapping nsAutoString debug (nsPromiseSubstring(aInString, posInString, length-posInString)); - printf("Outer loop: '%s'\n", debug.ToNewCString()); + PRINTF("Outer loop: '%s'\n", debug.ToNewCString()); #endif // Get the new cite level here since we're at the beginning of a line @@ -264,8 +269,8 @@ nsInternetCiter::Rewrap(const nsString& aInString, else if (outStringCol > 0) { #ifdef DEBUG_wrapping - printf("Appending space; citeLevel=%d, outStringCol=%d\n", citeLevel, - outStringCol); + PRINTF("Appending space; citeLevel=%d, outStringCol=%d\n", citeLevel, + outStringCol); #endif aOutString.Append(space); ++outStringCol; @@ -287,7 +292,7 @@ nsInternetCiter::Rewrap(const nsString& aInString, #ifdef DEBUG_wrapping nsAutoString debug (nsPromiseSubstring(aInString, posInString, nextNewline-posInString)); - printf("Unquoted: appending '%s'\n", debug.ToNewCString()); + PRINTF("Unquoted: appending '%s'\n", debug.ToNewCString()); #endif aOutString.Append(nsPromiseSubstring(aInString, posInString, nextNewline-posInString)); @@ -295,7 +300,7 @@ nsInternetCiter::Rewrap(const nsString& aInString, if (nextNewline != length) { #ifdef DEBUG_wrapping - printf("unquoted: appending a newline\n"); + PRINTF("unquoted: appending a newline\n"); #endif aOutString.Append(nl); outStringCol = 0; @@ -310,7 +315,7 @@ nsInternetCiter::Rewrap(const nsString& aInString, { #ifdef DEBUG_wrapping nsAutoString debug (nsPromiseSubstring(aInString, posInString, nextNewline-posInString)); - printf("Inner loop: '%s'\n", debug.ToNewCString()); + PRINTF("Inner loop: '%s'\n", debug.ToNewCString()); #endif // If this is a short line, just append it and continue: @@ -322,7 +327,7 @@ nsInternetCiter::Rewrap(const nsString& aInString, ++nextNewline; #ifdef DEBUG_wrapping nsAutoString debug (nsPromiseSubstring(aInString, posInString, nextNewline - posInString)); - printf("Short line: '%s'\n", debug.ToNewCString()); + PRINTF("Short line: '%s'\n", debug.ToNewCString()); #endif aOutString += nsPromiseSubstring(aInString, posInString, nextNewline - posInString); @@ -357,12 +362,12 @@ nsInternetCiter::Rewrap(const nsString& aInString, if (NS_FAILED(rv)) { #ifdef DEBUG_akkana - printf("nsInternetCiter: LineBreaker not working -- breaking hard\n"); + PRINTF("nsInternetCiter: LineBreaker not working -- breaking hard\n"); #endif breakPt = eol; } #ifdef DEBUG_wrapping - printf("breakPt = %d\n", breakPt); + PRINTF("breakPt = %d\n", breakPt); #endif aOutString += nsPromiseSubstring(aInString, posInString, breakPt); @@ -378,7 +383,7 @@ nsInternetCiter::Rewrap(const nsString& aInString, } } // end inner loop within one line of aInString #ifdef DEBUG_wrapping - printf("---------\nEnd inner loop: out string is now '%s'\n-----------\n", + PRINTF("---------\nEnd inner loop: out string is now '%s'\n-----------\n", aOutString.ToNewCString()); #endif } // end outer loop over lines of aInString diff --git a/mozilla/editor/base/nsTableEditor.cpp b/mozilla/editor/base/nsTableEditor.cpp index e09373fe6fd..2c02df8f4e2 100644 --- a/mozilla/editor/base/nsTableEditor.cpp +++ b/mozilla/editor/base/nsTableEditor.cpp @@ -46,6 +46,11 @@ #include "nsEditorUtils.h" #include "nsHTMLEditUtils.h" +#include "nslog.h" + +NS_IMPL_LOG(nsTableEditorLog) +#define PRINTF NS_LOG_PRINTF(nsTableEditorLog) +#define FLUSH NS_LOG_FLUSH(nsTableEditorLog) //#define DEBUG_TABLE 1 @@ -357,7 +362,7 @@ nsHTMLEditor::GetNextRow(nsIDOMElement* aTableElement, nsIDOMElement* &aRow) return NS_OK; } #ifdef DEBUG_cmanske - printf("GetNextRow: firstChild of row's parent's sibling is not a TR!\n"); + PRINTF("GetNextRow: firstChild of row's parent's sibling is not a TR!\n"); #endif // We arrive here only if a table section has no children // or first child of section is not a row (bad HTML!) @@ -2500,9 +2505,7 @@ nsHTMLEditor::NormalizeTable(nsIDOMElement *aTable) if (!cell) { //We are missing a cell at a cellmap location -#ifdef DEBUG - printf("NormalizeTable found missing cell at row=%d, col=%d\n", rowIndex, colIndex); -#endif + PRINTF("NormalizeTable found missing cell at row=%d, col=%d\n", rowIndex, colIndex); // Add a cell after the previous Cell in the current row if(previousCellInRow) { @@ -2515,9 +2518,7 @@ nsHTMLEditor::NormalizeTable(nsIDOMElement *aTable) startRowIndex = rowIndex; } else { // We don't have any cells in this row -- We are really messed up! -#ifdef DEBUG - printf("NormalizeTable found no cells in row=%d, col=%d\n", rowIndex, colIndex); -#endif + PRINTF("NormalizeTable found no cells in row=%d, col=%d\n", rowIndex, colIndex); return NS_ERROR_FAILURE; } } @@ -2934,7 +2935,7 @@ nsHTMLEditor::GetNextSelectedCell(nsIDOMElement **aCell, nsIDOMRange **aRange) if (*aCell) break; #ifdef DEBUG_cmanske else - printf("GetNextSelectedCell: Collapsed range found\n"); + PRINTF("GetNextSelectedCell: Collapsed range found\n"); #endif // If we didn't find a cell, continue to next range in selection @@ -3027,7 +3028,7 @@ nsHTMLEditor::SetSelectionAfterTableEdit(nsIDOMElement* aTable, PRInt32 aRow, PR if (!selection) { #ifdef DEBUG_cmanske - printf("Selection not found after table manipulation!\n"); + PRINTF("Selection not found after table manipulation!\n"); #endif return NS_ERROR_FAILURE; } diff --git a/mozilla/editor/base/nsTextEditRules.cpp b/mozilla/editor/base/nsTextEditRules.cpp index 9d022ff37a1..ad5dcd6ef33 100644 --- a/mozilla/editor/base/nsTextEditRules.cpp +++ b/mozilla/editor/base/nsTextEditRules.cpp @@ -42,6 +42,11 @@ #include "EditTxn.h" #include "TypeInState.h" #include "nsIPref.h" +#include "nslog.h" + +NS_IMPL_LOG(nsTextEditRulesLog) +#define PRINTF NS_LOG_PRINTF(nsTextEditRulesLog) +#define FLUSH NS_LOG_FLUSH(nsTextEditRulesLog) static NS_DEFINE_CID(kContentIteratorCID, NS_CONTENTITERATOR_CID); static NS_DEFINE_IID(kRangeCID, NS_RANGE_CID); @@ -230,7 +235,7 @@ nsTextEditRules::WillDoAction(nsISelection *aSelection, // null selection is legal if (!aInfo || !aCancel || !aHandled) { return NS_ERROR_NULL_POINTER; } #if defined(DEBUG_ftang) - printf("nsTextEditRules::WillDoAction action= %d", aInfo->action); + PRINTF("nsTextEditRules::WillDoAction action= %d", aInfo->action); #endif *aCancel = PR_FALSE; @@ -478,7 +483,7 @@ nsTextEditRules::WillInsertBreak(nsISelection *aSelection, PRBool *aCancel, PRBo mozQuoteVal, isMozQuote)) && isMozQuote) { - printf("It's a moz quote -- splitting\n"); + PRINTF("It's a moz quote -- splitting\n"); nsCOMPtr outLeftNode; nsCOMPtr outRightNode; res = mEditor->SplitNodeDeep(preNode, selNode, selOffset, &newOffset, PR_TRUE, &outLeftNode, &outRightNode); @@ -892,7 +897,7 @@ nsTextEditRules::WillDeleteSelection(nsISelection *aSelection, #ifdef DEBUG_buster char *password = mPasswordText.ToNewCString(); - printf("mPasswordText is %s\n", password); + PRINTF("mPasswordText is %s\n", password); nsCRT::free(password); #endif } diff --git a/mozilla/editor/base/nsWrapUtils.cpp b/mozilla/editor/base/nsWrapUtils.cpp index 59a74b964dc..51dda959826 100644 --- a/mozilla/editor/base/nsWrapUtils.cpp +++ b/mozilla/editor/base/nsWrapUtils.cpp @@ -23,6 +23,11 @@ #include "nsWrapUtils.h" #include "nsCOMPtr.h" +#include "nslog.h" + +NS_IMPL_LOG(nsWrapUtilsLog) +#define PRINTF NS_LOG_PRINTF(nsWrapUtilsLog) +#define FLUSH NS_LOG_FLUSH(nsWrapUtilsLog) // Line breaker stuff #include "nsIServiceManager.h" @@ -101,7 +106,7 @@ nsWrapUtils::Rewrap(const nsString& aInString, if (NS_FAILED(rv)) { #ifdef DEBUG_akkana - printf("nsILineBreaker not working -- breaking hard\n"); + PRINTF("nsILineBreaker not working -- breaking hard\n"); #endif breakPt = eol+1; } diff --git a/mozilla/editor/composer/src/nsEditorShell.cpp b/mozilla/editor/composer/src/nsEditorShell.cpp index 795ed91175d..0140cd34dcc 100644 --- a/mozilla/editor/composer/src/nsEditorShell.cpp +++ b/mozilla/editor/composer/src/nsEditorShell.cpp @@ -126,6 +126,12 @@ #include "nsInternetCiter.h" #include "nsEditorShellMouseListener.h" +#include "nslog.h" + +NS_IMPL_LOG(nsEditorShellLog) +#define PRINTF NS_LOG_PRINTF(nsEditorShellLog) +#define FLUSH NS_LOG_FLUSH(nsEditorShellLog) + /////////////////////////////////////// // Drag & Drop, Clipboard @@ -558,9 +564,7 @@ nsEditorShell::PrepareDocumentForEditing(nsIDocumentLoader* aLoader, nsIURI *aUr temp++; } -#if DEBUG - printf("PrepareDocumentForEditing: Editor is editing %s\n", pageURLString ? pageURLString : ""); -#endif + PRINTF("PrepareDocumentForEditing: Editor is editing %s\n", pageURLString ? pageURLString : ""); // only save the file spec if this is a local file, and is not // about:blank @@ -817,7 +821,7 @@ nsEditorShell::SetWebShellWindow(nsIDOMWindowInternal* aWin) nsAutoString str(name); char* cstr = str.ToNewCString(); - printf("Attaching to WebShellWindow[%s]\n", cstr); + PRINTF("Attaching to WebShellWindow[%s]\n", cstr); nsCRT::free(cstr); #endif */ @@ -2614,7 +2618,7 @@ nsEditorShell::Rewrap(PRBool aRespectNewlines) if (NS_FAILED(rv)) return NS_OK; #ifdef DEBUG_akkana - printf("nsEditorShell::Rewrap to %ld columns\n", (long)wrapCol); + PRINTF("nsEditorShell::Rewrap to %ld columns\n", (long)wrapCol); #endif nsCOMPtr selection; @@ -2678,7 +2682,7 @@ NS_IMETHODIMP nsEditorShell::StripCites() { #ifdef DEBUG_akkana - printf("nsEditorShell::StripCites()\n"); + PRINTF("nsEditorShell::StripCites()\n"); #endif nsCOMPtr selection; @@ -5033,7 +5037,7 @@ nsEditorShell::RunUnitTests() err = editor->DebugUnitTests(&numTests, &numTestsFailed); #ifdef APP_DEBUG - printf("\nRan %ld tests, of which %ld failed\n", (long)numTests, (long)numTestsFailed); + PRINTF("\nRan %ld tests, of which %ld failed\n", (long)numTests, (long)numTestsFailed); #endif return NS_OK; @@ -5384,7 +5388,7 @@ nsEditorShell::HandleMouseClickOnElement(nsIDOMElement *aElement, PRInt32 aClick TagName.ToLowerCase(); char szTagName[64]; TagName.ToCString(szTagName, 64); - printf("***** Element clicked on: %s, x=%d, y=%d\n", szTagName, x, y); + PRINTF("***** Element clicked on: %s, x=%d, y=%d\n", szTagName, x, y); #endif */ if (mDisplayMode == eDisplayModeAllTags) diff --git a/mozilla/editor/libeditor/base/CreateElementTxn.cpp b/mozilla/editor/libeditor/base/CreateElementTxn.cpp index e7080bd959c..f9abd730aeb 100644 --- a/mozilla/editor/libeditor/base/CreateElementTxn.cpp +++ b/mozilla/editor/libeditor/base/CreateElementTxn.cpp @@ -31,11 +31,11 @@ //included for new nsEditor::CreateContent() #include "nsIContent.h" -#ifdef NS_DEBUG -static PRBool gNoisy = PR_FALSE; -#else -static const PRBool gNoisy = PR_FALSE; -#endif +#include "nslog.h" + +NS_IMPL_LOG(CreateElementTxnLog) +#define PRINTF NS_LOG_PRINTF(CreateElementTxnLog) +#define FLUSH NS_LOG_FLUSH(CreateElementTxnLog) CreateElementTxn::CreateElementTxn() : EditTxn() @@ -74,13 +74,12 @@ CreateElementTxn::~CreateElementTxn() NS_IMETHODIMP CreateElementTxn::Do(void) { - if (gNoisy) - { - char* nodename = mTag.ToNewCString(); - printf("Do Create Element parent = %p <%s>, offset = %d\n", - mParent.get(), nodename, mOffsetInParent); - nsMemory::Free(nodename); - } +#ifdef NS_LOGGING + char* nodename = mTag.ToNewCString(); + PRINTF("Do Create Element parent = %p <%s>, offset = %d\n", + mParent.get(), nodename, mOffsetInParent); + nsMemory::Free(nodename); +#endif NS_ASSERTION(mEditor && mParent, "bad state"); if (!mEditor || !mParent) return NS_ERROR_NOT_INITIALIZED; @@ -121,7 +120,7 @@ NS_IMETHODIMP CreateElementTxn::Do(void) NS_ASSERTION(((NS_SUCCEEDED(result)) && (mNewNode)), "could not create element."); if (!mNewNode) return NS_ERROR_NULL_POINTER; - if (gNoisy) { printf(" newNode = %p\n", mNewNode.get()); } + PRINTF(" newNode = %p\n", mNewNode.get()); // insert the new node nsCOMPtr resultNode; if (CreateElementTxn::eAppend==(PRInt32)mOffsetInParent) @@ -172,8 +171,8 @@ NS_IMETHODIMP CreateElementTxn::Do(void) NS_IMETHODIMP CreateElementTxn::Undo(void) { - if (gNoisy) { printf("Undo Create Element, mParent = %p, node = %p\n", - mParent.get(), mNewNode.get()); } + PRINTF("Undo Create Element, mParent = %p, node = %p\n", + mParent.get(), mNewNode.get()); NS_ASSERTION(mEditor && mParent, "bad state"); if (!mEditor || !mParent) return NS_ERROR_NOT_INITIALIZED; @@ -184,7 +183,7 @@ NS_IMETHODIMP CreateElementTxn::Undo(void) NS_IMETHODIMP CreateElementTxn::Redo(void) { - if (gNoisy) { printf("Redo Create Element\n"); } + PRINTF("Redo Create Element\n"); NS_ASSERTION(mEditor && mParent, "bad state"); if (!mEditor || !mParent) return NS_ERROR_NOT_INITIALIZED; diff --git a/mozilla/editor/libeditor/base/DeleteElementTxn.cpp b/mozilla/editor/libeditor/base/DeleteElementTxn.cpp index 928e3a6f6ce..2c23b569dde 100644 --- a/mozilla/editor/libeditor/base/DeleteElementTxn.cpp +++ b/mozilla/editor/libeditor/base/DeleteElementTxn.cpp @@ -25,12 +25,11 @@ #include "nsIDOMElement.h" #endif -#ifdef NS_DEBUG -static PRBool gNoisy = PR_FALSE; -#else -static const PRBool gNoisy = PR_FALSE; -#endif +#include "nslog.h" +NS_IMPL_LOG(DeleteElementTxnLog) +#define PRINTF NS_LOG_PRINTF(DeleteElementTxnLog) +#define FLUSH NS_LOG_FLUSH(DeleteElementTxnLog) DeleteElementTxn::DeleteElementTxn() : EditTxn() @@ -56,7 +55,7 @@ DeleteElementTxn::~DeleteElementTxn() NS_IMETHODIMP DeleteElementTxn::Do(void) { - if (gNoisy) { printf("%p Do Delete Element element = %p\n", this, mElement.get()); } + PRINTF("%p Do Delete Element element = %p\n", this, mElement.get()); if (!mElement) return NS_ERROR_NOT_INITIALIZED; nsresult result = mElement->GetParentNode(getter_AddRefs(mParent)); @@ -80,8 +79,7 @@ NS_IMETHODIMP DeleteElementTxn::Do(void) p = parentElementTag.ToNewCString(); if (c&&p) { - if (gNoisy) - printf(" DeleteElementTxn: deleting child %s from parent %s\n", c, p); + PRINTF(" DeleteElementTxn: deleting child %s from parent %s\n", c, p); nsCRT::free(c); nsCRT::free(p); } @@ -98,7 +96,7 @@ NS_IMETHODIMP DeleteElementTxn::Do(void) NS_IMETHODIMP DeleteElementTxn::Undo(void) { - if (gNoisy) { printf("%p Undo Delete Element element = %p, parent = %p\n", this, mElement.get(), mParent.get()); } + PRINTF("%p Undo Delete Element element = %p, parent = %p\n", this, mElement.get(), mParent.get()); if (!mParent) { return NS_OK; } // this is a legal state, the txn is a no-op if (!mElement) { return NS_ERROR_NULL_POINTER; } @@ -119,8 +117,7 @@ NS_IMETHODIMP DeleteElementTxn::Undo(void) p = parentElementTag.ToNewCString(); if (c&&p) { - if (gNoisy) - printf(" DeleteElementTxn: inserting child %s back into parent %s\n", c, p); + PRINTF(" DeleteElementTxn: inserting child %s back into parent %s\n", c, p); nsCRT::free(c); nsCRT::free(p); } @@ -134,7 +131,7 @@ NS_IMETHODIMP DeleteElementTxn::Undo(void) NS_IMETHODIMP DeleteElementTxn::Redo(void) { - if (gNoisy) { printf("%p Redo Delete Element element = %p, parent = %p\n", this, mElement.get(), mParent.get()); } + PRINTF("%p Redo Delete Element element = %p, parent = %p\n", this, mElement.get(), mParent.get()); if (!mParent) { return NS_OK; } // this is a legal state, the txn is a no-op if (!mElement) { return NS_ERROR_NULL_POINTER; } diff --git a/mozilla/editor/libeditor/base/DeleteRangeTxn.cpp b/mozilla/editor/libeditor/base/DeleteRangeTxn.cpp index 1e3299d1b69..05a7144f975 100644 --- a/mozilla/editor/libeditor/base/DeleteRangeTxn.cpp +++ b/mozilla/editor/libeditor/base/DeleteRangeTxn.cpp @@ -37,11 +37,11 @@ #include "nsIDOMElement.h" #endif -#ifdef NS_DEBUG -static PRBool gNoisy = PR_FALSE; -#else -static const PRBool gNoisy = PR_FALSE; -#endif +#include "nslog.h" + +NS_IMPL_LOG(DeleteRangeTxnLog) +#define PRINTF NS_LOG_PRINTF(DeleteRangeTxnLog) +#define FLUSH NS_LOG_FLUSH(DeleteRangeTxnLog) // note that aEditor is not refcounted DeleteRangeTxn::DeleteRangeTxn() @@ -97,11 +97,8 @@ NS_IMETHODIMP DeleteRangeTxn::Init(nsIEditor *aEditor, nsIDOMRange *aRange) children->GetLength(&count); } NS_ASSERTION(mEndOffset<=(PRInt32)count, "bad end offset"); - if (gNoisy) - { - printf ("DeleteRange: %d of %p to %d of %p\n", - mStartOffset, (void *)mStartParent, mEndOffset, (void *)mEndParent); - } + PRINTF("DeleteRange: %d of %p to %d of %p\n", + mStartOffset, (void *)mStartParent, mEndOffset, (void *)mEndParent); } #endif return result; @@ -114,7 +111,7 @@ DeleteRangeTxn::~DeleteRangeTxn() NS_IMETHODIMP DeleteRangeTxn::Do(void) { - if (gNoisy) { printf("Do Delete Range\n"); } + PRINTF("Do Delete Range\n"); if (!mStartParent || !mEndParent || !mCommonParent || !mEditor) return NS_ERROR_NOT_INITIALIZED; @@ -169,7 +166,7 @@ NS_IMETHODIMP DeleteRangeTxn::Do(void) NS_IMETHODIMP DeleteRangeTxn::Undo(void) { - if (gNoisy) { printf("Undo Delete Range\n"); } + PRINTF("Undo Delete Range\n"); if (!mStartParent || !mEndParent || !mCommonParent || !mEditor) return NS_ERROR_NOT_INITIALIZED; @@ -179,7 +176,7 @@ NS_IMETHODIMP DeleteRangeTxn::Undo(void) NS_IMETHODIMP DeleteRangeTxn::Redo(void) { - if (gNoisy) { printf("Redo Delete Range\n"); } + PRINTF("Redo Delete Range\n"); if (!mStartParent || !mEndParent || !mCommonParent || !mEditor) return NS_ERROR_NOT_INITIALIZED; diff --git a/mozilla/editor/libeditor/base/DeleteTextTxn.cpp b/mozilla/editor/libeditor/base/DeleteTextTxn.cpp index 88db0665f0f..31be507c7c0 100644 --- a/mozilla/editor/libeditor/base/DeleteTextTxn.cpp +++ b/mozilla/editor/libeditor/base/DeleteTextTxn.cpp @@ -24,11 +24,11 @@ #include "nsIDOMCharacterData.h" #include "nsISelection.h" -#ifdef NS_DEBUG -static PRBool gNoisy = PR_FALSE; -#else -static const PRBool gNoisy = PR_FALSE; -#endif +#include "nslog.h" + +NS_IMPL_LOG(DeleteTextTxnLog) +#define PRINTF NS_LOG_PRINTF(DeleteTextTxnLog) +#define FLUSH NS_LOG_FLUSH(DeleteTextTxnLog) DeleteTextTxn::DeleteTextTxn() : EditTxn() @@ -64,7 +64,7 @@ NS_IMETHODIMP DeleteTextTxn::Init(nsIEditor *aEditor, NS_IMETHODIMP DeleteTextTxn::Do(void) { - if (gNoisy) { printf("Do Delete Text\n"); } + PRINTF("Do Delete Text\n"); NS_ASSERTION(mEditor && mElement, "bad state"); if (!mEditor || !mElement) { return NS_ERROR_NOT_INITIALIZED; } // get the text that we're about to delete @@ -96,7 +96,7 @@ NS_IMETHODIMP DeleteTextTxn::Do(void) // was it an insertion point or an extended selection? NS_IMETHODIMP DeleteTextTxn::Undo(void) { - if (gNoisy) { printf("Undo Delete Text\n"); } + PRINTF("Undo Delete Text\n"); NS_ASSERTION(mEditor && mElement, "bad state"); if (!mEditor || !mElement) { return NS_ERROR_NOT_INITIALIZED; } diff --git a/mozilla/editor/libeditor/base/IMETextTxn.cpp b/mozilla/editor/libeditor/base/IMETextTxn.cpp index 95aa41bd6f5..85eee494bfc 100644 --- a/mozilla/editor/libeditor/base/IMETextTxn.cpp +++ b/mozilla/editor/libeditor/base/IMETextTxn.cpp @@ -30,6 +30,15 @@ #include "nsIPresShell.h" #include "EditAggregateTxn.h" #include "nsLayoutCID.h" +#include "nslog.h" + +#ifdef DEBUG_IMETXN +NS_IMPL_LOG_ENABLED(IMETextTxnLog) +#else +NS_IMPL_LOG(IMETextTxnLog) +#endif +#define PRINTF NS_LOG_PRINTF(IMETextTxnLog) +#define FLUSH NS_LOG_FLUSH(IMETextTxnLog) // #define DEBUG_IMETXN static NS_DEFINE_IID(kRangeCID, NS_RANGE_CID); @@ -86,11 +95,7 @@ NS_IMETHODIMP IMETextTxn::Init(nsIDOMCharacterData *aElement, NS_IMETHODIMP IMETextTxn::Do(void) { - -#ifdef DEBUG_IMETXN - printf("Do IME Text element = %p replace = %d len = %d\n", mElement.get(), mReplaceLength, mStringToInsert.Length()); -#endif - + PRINTF("Do IME Text element = %p replace = %d len = %d\n", mElement.get(), mReplaceLength, mStringToInsert.Length()); nsCOMPtr selCon = do_QueryReferent(mSelConWeak); if (!selCon) return NS_ERROR_NOT_INITIALIZED; @@ -110,10 +115,7 @@ NS_IMETHODIMP IMETextTxn::Do(void) NS_IMETHODIMP IMETextTxn::Undo(void) { -#ifdef DEBUG_IMETXN - printf("Undo IME Text element = %p\n", mElement.get()); -#endif - + PRINTF("Undo IME Text element = %p\n", mElement.get()); nsCOMPtr selCon = do_QueryReferent(mSelConWeak); if (!selCon) return NS_ERROR_NOT_INITIALIZED; @@ -140,9 +142,7 @@ NS_IMETHODIMP IMETextTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransaction) return NS_ERROR_NULL_POINTER; nsresult result; -#ifdef DEBUG_IMETXN - printf("Merge IME Text element = %p\n", mElement.get()); -#endif + PRINTF("Merge IME Text element = %p\n", mElement.get()); // // check to make sure we have valid return pointers @@ -174,9 +174,7 @@ NS_IMETHODIMP IMETextTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransaction) otherTxn->GetData(mStringToInsert,&newTextRangeList); mRangeList = do_QueryInterface(newTextRangeList); *aDidMerge = PR_TRUE; -#ifdef DEBUG_IMETXN - printf("IMETextTxn assimilated IMETextTxn:%p\n", aTransaction); -#endif + PRINTF("IMETextTxn assimilated IMETextTxn:%p\n", aTransaction); NS_RELEASE(otherTxn); return NS_OK; } @@ -292,24 +290,24 @@ NS_IMETHODIMP IMETextTxn::CollapseTextSelection(void) PRUint16 listlen,start,stop,type; nsIPrivateTextRange* rangePtr; result = mRangeList->GetLength(&listlen); - printf("nsIPrivateTextRangeList[%p]\n",mRangeList); + PRINTF("nsIPrivateTextRangeList[%p]\n",mRangeList); for (i=0;iItem(i,&rangePtr); rangePtr->GetRangeStart(&start); rangePtr->GetRangeEnd(&stop); rangePtr->GetRangeType(&type); - printf("range[%d] start=%d end=%d type=",i,start,stop,type); + PRINTF("range[%d] start=%d end=%d type=",i,start,stop,type); if (type==nsIPrivateTextRange::TEXTRANGE_RAWINPUT) - printf("TEXTRANGE_RAWINPUT\n"); + PRINTF("TEXTRANGE_RAWINPUT\n"); else if (type==nsIPrivateTextRange::TEXTRANGE_SELECTEDRAWTEXT) - printf("TEXTRANGE_SELECTEDRAWTEXT\n"); + PRINTF("TEXTRANGE_SELECTEDRAWTEXT\n"); else if (type==nsIPrivateTextRange::TEXTRANGE_CONVERTEDTEXT) - printf("TEXTRANGE_CONVERTEDTEXT\n"); + PRINTF("TEXTRANGE_CONVERTEDTEXT\n"); else if (type==nsIPrivateTextRange::TEXTRANGE_SELECTEDCONVERTEDTEXT) - printf("TEXTRANGE_SELECTEDCONVERTEDTEXT\n"); + PRINTF("TEXTRANGE_SELECTEDCONVERTEDTEXT\n"); else if (type==nsIPrivateTextRange::TEXTRANGE_CARETPOSITION) - printf("TEXTRANGE_CARETPOSITION\n"); - else printf("unknown constant\n"); + PRINTF("TEXTRANGE_CARETPOSITION\n"); + else PRINTF("unknown constant\n"); } #endif diff --git a/mozilla/editor/libeditor/base/InsertElementTxn.cpp b/mozilla/editor/libeditor/base/InsertElementTxn.cpp index fb6797fbac6..3cca82dcd06 100644 --- a/mozilla/editor/libeditor/base/InsertElementTxn.cpp +++ b/mozilla/editor/libeditor/base/InsertElementTxn.cpp @@ -24,13 +24,11 @@ #include "nsISelection.h" #include "nsIContent.h" #include "nsIDOMNodeList.h" +#include "nslog.h" -#ifdef NS_DEBUG -static PRBool gNoisy = PR_FALSE; -#else -static const PRBool gNoisy = PR_FALSE; -#endif - +NS_IMPL_LOG(InsertElementTxnLog) +#define PRINTF NS_LOG_PRINTF(InsertElementTxnLog) +#define FLUSH NS_LOG_FLUSH(InsertElementTxnLog) InsertElementTxn::InsertElementTxn() : EditTxn() @@ -64,14 +62,14 @@ InsertElementTxn::~InsertElementTxn() NS_IMETHODIMP InsertElementTxn::Do(void) { - if (gNoisy) + if (NS_LOG_ENABLED(InsertElementTxnLog)) { nsCOMPtrnodeAsContent = do_QueryInterface(mNode); nsCOMPtrparentAsContent = do_QueryInterface(mParent); nsString namestr; mNode->GetNodeName(namestr); char* nodename = namestr.ToNewCString(); - printf("%p Do Insert Element of %p <%s> into parent %p at offset %d\n", + PRINTF("%p Do Insert Element of %p <%s> into parent %p at offset %d\n", this, nodeAsContent.get(), nodename, parentAsContent.get(), mOffset); nsMemory::Free(nodename); @@ -121,8 +119,8 @@ NS_IMETHODIMP InsertElementTxn::Do(void) NS_IMETHODIMP InsertElementTxn::Undo(void) { - if (gNoisy) { printf("%p Undo Insert Element of %p into parent %p at offset %d\n", - this, mNode.get(), mParent.get(), mOffset); } + PRINTF("%p Undo Insert Element of %p into parent %p at offset %d\n", + this, mNode.get(), mParent.get(), mOffset); if (!mNode || !mParent) return NS_ERROR_NOT_INITIALIZED; nsCOMPtr resultNode; diff --git a/mozilla/editor/libeditor/base/InsertTextTxn.cpp b/mozilla/editor/libeditor/base/InsertTextTxn.cpp index 921bfe3dec7..620057c4cf1 100644 --- a/mozilla/editor/libeditor/base/InsertTextTxn.cpp +++ b/mozilla/editor/libeditor/base/InsertTextTxn.cpp @@ -25,15 +25,14 @@ #include "nsIDOMCharacterData.h" #include "nsISelection.h" #include "EditAggregateTxn.h" +#include "nslog.h" + +NS_IMPL_LOG(InsertTextTxnLog) +#define PRINTF NS_LOG_PRINTF(InsertTextTxnLog) +#define FLUSH NS_LOG_FLUSH(InsertTextTxnLog) static NS_DEFINE_IID(kIDOMSelectionIID, NS_ISELECTION_IID); -#ifdef NS_DEBUG -static PRBool gNoisy = PR_FALSE; -#else -static const PRBool gNoisy = PR_FALSE; -#endif - nsIAtom *InsertTextTxn::gInsertTextTxnName; nsresult InsertTextTxn::ClassInit() @@ -66,11 +65,11 @@ NS_IMETHODIMP InsertTextTxn::Init(nsIDOMCharacterData *aElement, nsIEditor *aEditor) { #if 0 //def DEBUG_cmanske - nsAutoString text; - aElement->GetData(text); - printf("InsertTextTxn: Offset to insert at = %d. Text of the node to insert into:\n", aOffset); - wprintf(text.GetUnicode()); - printf("\n"); + nsAutoString text; + aElement->GetData(text); + PRINTF("InsertTextTxn: Offset to insert at = %d. Text of the node to insert into:\n", aOffset); + WPRINTF(text.GetUnicode()); + PRINTF("\n"); #endif NS_ASSERTION(aElement && aEditor, "bad args"); @@ -85,7 +84,7 @@ NS_IMETHODIMP InsertTextTxn::Init(nsIDOMCharacterData *aElement, NS_IMETHODIMP InsertTextTxn::Do(void) { - if (gNoisy) { printf("Do Insert Text element = %p\n", mElement.get()); } + PRINTF("Do Insert Text element = %p\n", mElement.get()); NS_ASSERTION(mElement && mEditor, "bad state"); if (!mElement || !mEditor) { return NS_ERROR_NOT_INITIALIZED; } @@ -114,7 +113,7 @@ NS_IMETHODIMP InsertTextTxn::Do(void) NS_IMETHODIMP InsertTextTxn::Undo(void) { - if (gNoisy) { printf("Undo Insert Text element = %p\n", mElement.get()); } + PRINTF("Undo Insert Text element = %p\n", mElement.get()); NS_ASSERTION(mElement && mEditor, "bad state"); if (!mElement || !mEditor) { return NS_ERROR_NOT_INITIALIZED; } @@ -144,7 +143,7 @@ NS_IMETHODIMP InsertTextTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransacti otherInsTxn->GetData(otherData); mStringToInsert += otherData; *aDidMerge = PR_TRUE; - if (gNoisy) { printf("InsertTextTxn assimilated %p\n", aTransaction); } + PRINTF("InsertTextTxn assimilated %p\n", aTransaction); } NS_RELEASE(otherInsTxn); } @@ -176,7 +175,7 @@ NS_IMETHODIMP InsertTextTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransacti otherInsertTxn->GetData(otherData); mStringToInsert += otherData; *aDidMerge = PR_TRUE; - if (gNoisy) { printf("InsertTextTxn assimilated %p\n", aTransaction); } + PRINTF("InsertTextTxn assimilated %p\n", aTransaction); } NS_RELEASE(otherInsertTxn); } diff --git a/mozilla/editor/libeditor/base/JoinElementTxn.cpp b/mozilla/editor/libeditor/base/JoinElementTxn.cpp index 21cb2675bed..8eb97f754f8 100644 --- a/mozilla/editor/libeditor/base/JoinElementTxn.cpp +++ b/mozilla/editor/libeditor/base/JoinElementTxn.cpp @@ -24,12 +24,11 @@ #include "nsEditor.h" #include "nsIDOMNodeList.h" #include "nsIDOMCharacterData.h" +#include "nslog.h" -#ifdef NS_DEBUG -static PRBool gNoisy = PR_FALSE; -#else -static const PRBool gNoisy = PR_FALSE; -#endif +NS_IMPL_LOG(JoinElementTxnLog) +#define PRINTF NS_LOG_PRINTF(JoinElementTxnLog) +#define FLUSH NS_LOG_FLUSH(JoinElementTxnLog) JoinElementTxn::JoinElementTxn() : EditTxn() @@ -58,7 +57,7 @@ JoinElementTxn::~JoinElementTxn() // After Do() and Redo(), the left node is removed from the content tree and right node remains. NS_IMETHODIMP JoinElementTxn::Do(void) { - if (gNoisy) { printf("%p Do Join of %p and %p\n", this, mLeftNode.get(), mRightNode.get()); } + PRINTF("%p Do Join of %p and %p\n", this, mLeftNode.get(), mRightNode.get()); NS_PRECONDITION((mEditor && mLeftNode && mRightNode), "null arg"); if (!mEditor || !mLeftNode || !mRightNode) { return NS_ERROR_NOT_INITIALIZED; } @@ -97,7 +96,7 @@ NS_IMETHODIMP JoinElementTxn::Do(void) result = mEditor->JoinNodesImpl(mRightNode, mLeftNode, mParent, PR_FALSE); if (NS_SUCCEEDED(result)) { - if (gNoisy) { printf(" left node = %p removed\n", mLeftNode.get()); } + PRINTF(" left node = %p removed\n", mLeftNode.get()); } } else @@ -112,7 +111,7 @@ NS_IMETHODIMP JoinElementTxn::Do(void) // and re-inserted mLeft? NS_IMETHODIMP JoinElementTxn::Undo(void) { - if (gNoisy) { printf("%p Undo Join, right node = %p\n", this, mRightNode.get()); } + PRINTF("%p Undo Join, right node = %p\n", this, mRightNode.get()); NS_ASSERTION(mRightNode && mLeftNode && mParent, "bad state"); if (!mRightNode || !mLeftNode || !mParent) { return NS_ERROR_NOT_INITIALIZED; } nsresult result; diff --git a/mozilla/editor/libeditor/base/PlaceholderTxn.cpp b/mozilla/editor/libeditor/base/PlaceholderTxn.cpp index 5a1df3492b3..c2b698346fe 100644 --- a/mozilla/editor/libeditor/base/PlaceholderTxn.cpp +++ b/mozilla/editor/libeditor/base/PlaceholderTxn.cpp @@ -26,13 +26,11 @@ #include "nsHTMLEditor.h" #include "nsIPresShell.h" #include "IMETextTxn.h" +#include "nslog.h" -#if defined(NS_DEBUG) && defined(DEBUG_buster) -static PRBool gNoisy = PR_TRUE; -#else -static const PRBool gNoisy = PR_FALSE; -#endif - +NS_IMPL_LOG(PlaceholderTxnLog) +#define PRINTF NS_LOG_PRINTF(PlaceholderTxnLog) +#define FLUSH NS_LOG_FLUSH(PlaceholderTxnLog) PlaceholderTxn::PlaceholderTxn() : EditAggregateTxn(), mAbsorb(PR_TRUE), @@ -86,7 +84,7 @@ NS_IMETHODIMP PlaceholderTxn::Init(nsIAtom *aName, nsSelectionState *aSelState, NS_IMETHODIMP PlaceholderTxn::Do(void) { - if (gNoisy) { printf("PlaceholderTxn Do\n"); } + PRINTF("PlaceholderTxn Do\n"); return NS_OK; } @@ -176,7 +174,7 @@ NS_IMETHODIMP PlaceholderTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransact // efficiency hack: no need to remember selection here, as we haven't yet // finished the inital batch and we know we will be told when the batch ends. // we can remeber the selection then. - if (gNoisy) { printf("Placeholder txn assimilated %p\n", aTransaction); } + PRINTF("Placeholder txn assimilated %p\n", aTransaction); } else { // merge typing or IME or deletion transactions if the selection matches diff --git a/mozilla/editor/libeditor/base/SplitElementTxn.cpp b/mozilla/editor/libeditor/base/SplitElementTxn.cpp index e742f526ec6..0a122a628bd 100644 --- a/mozilla/editor/libeditor/base/SplitElementTxn.cpp +++ b/mozilla/editor/libeditor/base/SplitElementTxn.cpp @@ -25,6 +25,11 @@ #include "nsIDOMNode.h" #include "nsISelection.h" #include "nsIDOMCharacterData.h" +#include "nslog.h" + +NS_IMPL_LOG(SplitElementTxnLog) +#define PRINTF NS_LOG_PRINTF(SplitElementTxnLog) +#define FLUSH NS_LOG_FLUSH(SplitElementTxnLog) #ifdef NS_DEBUG static PRBool gNoisy = PR_FALSE; @@ -60,7 +65,7 @@ SplitElementTxn::~SplitElementTxn() NS_IMETHODIMP SplitElementTxn::Do(void) { - if (gNoisy) { printf("%p Do Split of node %p offset %d\n", this, mExistingRightNode.get(), mOffset); } + PRINTF("%p Do Split of node %p offset %d\n", this, mExistingRightNode.get(), mOffset); NS_ASSERTION(mExistingRightNode && mEditor, "bad state"); if (!mExistingRightNode || !mEditor) { return NS_ERROR_NOT_INITIALIZED; } @@ -72,7 +77,7 @@ NS_IMETHODIMP SplitElementTxn::Do(void) mEditor->MarkNodeDirty(mExistingRightNode); - if (gNoisy) { printf(" created left node = %p\n", mNewLeftNode.get()); } + PRINTF(" created left node = %p\n", mNewLeftNode.get()); // get the parent node result = mExistingRightNode->GetParentNode(getter_AddRefs(mParent)); if (NS_FAILED(result)) return result; @@ -96,10 +101,8 @@ NS_IMETHODIMP SplitElementTxn::Do(void) NS_IMETHODIMP SplitElementTxn::Undo(void) { - if (gNoisy) { - printf("%p Undo Split of existing node %p and new node %p offset %d\n", - this, mExistingRightNode.get(), mNewLeftNode.get(), mOffset); - } + PRINTF("%p Undo Split of existing node %p and new node %p offset %d\n", + this, mExistingRightNode.get(), mNewLeftNode.get(), mOffset); NS_ASSERTION(mEditor && mExistingRightNode && mNewLeftNode && mParent, "bad state"); if (!mEditor || !mExistingRightNode || !mNewLeftNode || !mParent) { return NS_ERROR_NOT_INITIALIZED; @@ -107,14 +110,11 @@ NS_IMETHODIMP SplitElementTxn::Undo(void) // this assumes Do inserted the new node in front of the prior existing node nsresult result = mEditor->JoinNodesImpl(mExistingRightNode, mNewLeftNode, mParent, PR_FALSE); - if (gNoisy) - { - printf("** after join left child node %p into right node %p\n", mNewLeftNode.get(), mExistingRightNode.get()); - if (gNoisy) {mEditor->DebugDumpContent(); } // DEBUG - } + PRINTF("** after join left child node %p into right node %p\n", mNewLeftNode.get(), mExistingRightNode.get()); + if (NS_LOG_ENABLED(SplitElementTxnLog)) { mEditor->DebugDumpContent(); } // DEBUG if (NS_SUCCEEDED(result)) { - if (gNoisy) { printf(" left node = %p removed\n", mNewLeftNode.get()); } + PRINTF(" left node = %p removed\n", mNewLeftNode.get()); } return result; } @@ -128,11 +128,9 @@ NS_IMETHODIMP SplitElementTxn::Redo(void) if (!mEditor || !mExistingRightNode || !mNewLeftNode || !mParent) { return NS_ERROR_NOT_INITIALIZED; } - if (gNoisy) { - printf("%p Redo Split of existing node %p and new node %p offset %d\n", - this, mExistingRightNode.get(), mNewLeftNode.get(), mOffset); - if (gNoisy) {mEditor->DebugDumpContent(); } // DEBUG - } + PRINTF("%p Redo Split of existing node %p and new node %p offset %d\n", + this, mExistingRightNode.get(), mNewLeftNode.get(), mOffset); + if (NS_LOG_ENABLED(SplitElementTxnLog)) { mEditor->DebugDumpContent(); } // DEBUG nsresult result; nsCOMPtrresultNode; // first, massage the existing node so it is in its post-split state @@ -141,11 +139,8 @@ NS_IMETHODIMP SplitElementTxn::Redo(void) if (rightNodeAsText) { result = rightNodeAsText->DeleteData(0, mOffset); - if (gNoisy) - { - printf("** after delete of text in right text node %p offset %d\n", rightNodeAsText.get(), mOffset); - mEditor->DebugDumpContent(); // DEBUG - } + PRINTF("** after delete of text in right text node %p offset %d\n", rightNodeAsText.get(), mOffset); + if (NS_LOG_ENABLED(SplitElementTxnLog)) { mEditor->DebugDumpContent(); } // DEBUG } else { @@ -162,22 +157,16 @@ NS_IMETHODIMP SplitElementTxn::Redo(void) if (NS_SUCCEEDED(result)) { result = mNewLeftNode->AppendChild(child, getter_AddRefs(resultNode)); - if (gNoisy) - { - printf("** move child node %p from right node %p to left node %p\n", child.get(), mExistingRightNode.get(), mNewLeftNode.get()); - if (gNoisy) {mEditor->DebugDumpContent(); } // DEBUG - } + PRINTF("** move child node %p from right node %p to left node %p\n", child.get(), mExistingRightNode.get(), mNewLeftNode.get()); + if (NS_LOG_ENABLED(SplitElementTxnLog)) { mEditor->DebugDumpContent(); } // DEBUG } child = do_QueryInterface(nextSibling); } } // second, re-insert the left node into the tree result = mParent->InsertBefore(mNewLeftNode, mExistingRightNode, getter_AddRefs(resultNode)); - if (gNoisy) - { - printf("** reinsert left child node %p before right node %p\n", mNewLeftNode.get(), mExistingRightNode.get()); - if (gNoisy) {mEditor->DebugDumpContent(); } // DEBUG - } + PRINTF("** reinsert left child node %p before right node %p\n", mNewLeftNode.get(), mExistingRightNode.get()); + if (NS_LOG_ENABLED(SplitElementTxnLog)) {mEditor->DebugDumpContent(); } // DEBUG return result; } diff --git a/mozilla/editor/libeditor/base/nsEditor.cpp b/mozilla/editor/libeditor/base/nsEditor.cpp index 8d8aacdfe8b..0868a2aa8d8 100644 --- a/mozilla/editor/libeditor/base/nsEditor.cpp +++ b/mozilla/editor/libeditor/base/nsEditor.cpp @@ -137,12 +137,11 @@ static NS_DEFINE_CID(kCTransactionManagerCID, NS_TRANSACTIONMANAGER_CID); const char* nsEditor::kMOZEditorBogusNodeAttr="_moz_editor_bogus_node"; const char* nsEditor::kMOZEditorBogusNodeValue="TRUE"; -#ifdef NS_DEBUG_EDITOR -static PRBool gNoisy = PR_FALSE; -#else -static const PRBool gNoisy = PR_FALSE; -#endif +#include "nslog.h" +NS_IMPL_LOG(nsEditorLog) +#define PRINTF NS_LOG_PRINTF(nsEditorLog) +#define FLUSH NS_LOG_FLUSH(nsEditorLog) const PRUnichar nbsp = 160; PRInt32 nsEditor::gInstanceCount = 0; @@ -724,11 +723,11 @@ nsRangeUpdater::DidMoveNode(nsIDOMNode *aOldParent, PRInt32 aOldOffset, nsIDOMNo nsRangeStore::nsRangeStore() { - // DEBUG: n++; printf("range store alloc count=%d\n", n); + // DEBUG: n++; PRINTF("range store alloc count=%d\n", n); } nsRangeStore::~nsRangeStore() { - // DEBUG: n--; printf("range store alloc count=%d\n", n); + // DEBUG: n--; PRINTF("range store alloc count=%d\n", n); } nsresult nsRangeStore::StoreRange(nsIDOMRange *aRange) @@ -1108,7 +1107,7 @@ nsEditor::GetSelection(nsISelection **aSelection) NS_IMETHODIMP nsEditor::Do(nsITransaction *aTxn) { - if (gNoisy) { printf("Editor::Do ----------\n"); } + PRINTF("Editor::Do ----------\n"); nsresult result = NS_OK; @@ -1185,7 +1184,7 @@ nsEditor::EnableUndo(PRBool aEnable) nsnull, NS_GET_IID(nsITransactionManager), getter_AddRefs(mTxnMgr)); if (NS_FAILED(result) || !mTxnMgr) { - printf("ERROR: Failed to get TransactionManager instance.\n"); + PRINTF("ERROR: Failed to get TransactionManager instance.\n"); return NS_ERROR_NOT_AVAILABLE; } } @@ -1221,7 +1220,7 @@ nsEditor::GetTransactionManager(nsITransactionManager* *aTxnManager) NS_IMETHODIMP nsEditor::Undo(PRUint32 aCount) { - if (gNoisy) { printf("Editor::Undo ----------\n"); } + PRINTF("Editor::Undo ----------\n"); nsresult result = NS_OK; ForceCompositionEnd(); @@ -1266,7 +1265,7 @@ NS_IMETHODIMP nsEditor::CanUndo(PRBool &aIsEnabled, PRBool &aCanUndo) NS_IMETHODIMP nsEditor::Redo(PRUint32 aCount) { - if (gNoisy) { printf("Editor::Redo ----------\n"); } + PRINTF("Editor::Redo ----------\n"); nsresult result = NS_OK; nsAutoRules beginRulesSniffing(this, kOpRedo, nsIEditor::eNone); @@ -2455,7 +2454,7 @@ NS_IMETHODIMP nsEditor::BeginComposition(nsTextEventReply* aReply) { #ifdef DEBUG_tague - printf("nsEditor::StartComposition\n"); + PRINTF("nsEditor::StartComposition\n"); #endif nsresult ret = QueryComposition(aReply); mInIMEMode = PR_TRUE; @@ -2814,7 +2813,7 @@ nsEditor::CloneAttributes(nsIDOMNode *aDestNode, nsIDOMNode *aSourceNode) } else { // Do we ever get here? #if DEBUG_cmanske - printf("Attribute in sourceAttribute has empty value in nsEditor::CloneAttributes()\n"); + PRINTF("Attribute in sourceAttribute has empty value in nsEditor::CloneAttributes()\n"); #endif } } @@ -3255,7 +3254,7 @@ nsEditor::SplitNodeImpl(nsIDOMNode * aExistingRightNode, nsIDOMNode* aParent) { - if (gNoisy) { printf("SplitNodeImpl: left=%p, right=%p, offset=%d\n", aNewLeftNode, aExistingRightNode, aOffset); } + PRINTF("SplitNodeImpl: left=%p, right=%p, offset=%d\n", aNewLeftNode, aExistingRightNode, aOffset); nsresult result; NS_ASSERTION(((nsnull!=aExistingRightNode) && @@ -3282,7 +3281,7 @@ nsEditor::SplitNodeImpl(nsIDOMNode * aExistingRightNode, nsCOMPtr resultNode; result = aParent->InsertBefore(aNewLeftNode, aExistingRightNode, getter_AddRefs(resultNode)); - //printf(" after insert\n"); content->List(); // DEBUG + //PRINTF(" after insert\n"); content->List(); // DEBUG if (NS_SUCCEEDED(result)) { // split the children between the 2 nodes @@ -3318,13 +3317,13 @@ nsEditor::SplitNodeImpl(nsIDOMNode * aExistingRightNode, if ((NS_SUCCEEDED(result)) && (childNode)) { result = aExistingRightNode->RemoveChild(childNode, getter_AddRefs(resultNode)); - //printf(" after remove\n"); content->List(); // DEBUG + //PRINTF(" after remove\n"); content->List(); // DEBUG if (NS_SUCCEEDED(result)) { nsCOMPtr firstChild; aNewLeftNode->GetFirstChild(getter_AddRefs(firstChild)); result = aNewLeftNode->InsertBefore(childNode, firstChild, getter_AddRefs(resultNode)); - //printf(" after append\n"); content->List(); // DEBUG + //PRINTF(" after append\n"); content->List(); // DEBUG } } } @@ -4617,8 +4616,8 @@ nsEditor::GetBlockSection(nsIDOMNode *aChild, result = (*aRightNode)->GetNextSibling(getter_AddRefs(sibling)); } NS_ADDREF((*aRightNode)); - if (gNoisy) { printf("GetBlockSection returning %p %p\n", - (*aLeftNode), (*aRightNode)); } + PRINTF("GetBlockSection returning %p %p\n", + (*aLeftNode), (*aRightNode)); return result; } @@ -4673,7 +4672,7 @@ nsEditor::GetBlockSectionsForRange(nsIDOMRange *aRange, nsISupportsArray *aSecti result = GetBlockSection(currentNode, getter_AddRefs(leftNode), getter_AddRefs(rightNode)); - if (gNoisy) {printf("currentNode %p has block content (%p,%p)\n", currentNode.get(), leftNode.get(), rightNode.get());} + PRINTF("currentNode %p has block content (%p,%p)\n", currentNode.get(), leftNode.get(), rightNode.get()); if ((NS_SUCCEEDED(result)) && leftNode && rightNode) { // add range to the list if it doesn't overlap with the previous range @@ -4686,12 +4685,12 @@ nsEditor::GetBlockSectionsForRange(nsIDOMRange *aRange, nsISupportsArray *aSecti blockParentOfLastStartNode = do_QueryInterface(GetBlockNodeParent(lastStartNode)); if (blockParentOfLastStartNode) { - if (gNoisy) {printf("lastStartNode %p has block parent %p\n", lastStartNode.get(), blockParentOfLastStartNode.get());} + PRINTF("lastStartNode %p has block parent %p\n", lastStartNode.get(), blockParentOfLastStartNode.get()); nsCOMPtr blockParentOfLeftNode; blockParentOfLeftNode = do_QueryInterface(GetBlockNodeParent(leftNode)); if (blockParentOfLeftNode) { - if (gNoisy) {printf("leftNode %p has block parent %p\n", leftNode.get(), blockParentOfLeftNode.get());} + PRINTF("leftNode %p has block parent %p\n", leftNode.get(), blockParentOfLeftNode.get()); if (blockParentOfLastStartNode==blockParentOfLeftNode) { addRange = PR_FALSE; } @@ -4700,7 +4699,7 @@ nsEditor::GetBlockSectionsForRange(nsIDOMRange *aRange, nsISupportsArray *aSecti } if (PR_TRUE==addRange) { - if (gNoisy) {printf("adding range, setting lastRange with start node %p\n", leftNode.get());} + PRINTF("adding range, setting lastRange with start node %p\n", leftNode.get()); nsCOMPtr range; result = nsComponentManager::CreateInstance(kCRangeCID, nsnull, NS_GET_IID(nsIDOMRange), getter_AddRefs(range)); @@ -5842,7 +5841,7 @@ nsEditor::CreateTxnForDeleteInsertionPoint(nsIDOMRange *aRange, } else { // XXX: can you have an empty text node? If so, what do you do? - printf("ERROR: found a text node with 0 characters\n"); + PRINTF("ERROR: found a text node with 0 characters\n"); result = NS_ERROR_UNEXPECTED; } } @@ -5881,7 +5880,7 @@ nsEditor::CreateTxnForDeleteInsertionPoint(nsIDOMRange *aRange, } else { // XXX: can you have an empty text node? If so, what do you do? - printf("ERROR: found a text node with 0 characters\n"); + PRINTF("ERROR: found a text node with 0 characters\n"); result = NS_ERROR_UNEXPECTED; } } diff --git a/mozilla/editor/libeditor/html/nsEditorTxnLog.cpp b/mozilla/editor/libeditor/html/nsEditorTxnLog.cpp index 2638a6ae177..f386a452759 100644 --- a/mozilla/editor/libeditor/html/nsEditorTxnLog.cpp +++ b/mozilla/editor/libeditor/html/nsEditorTxnLog.cpp @@ -24,6 +24,11 @@ #include #include "nsHTMLEditorLog.h" #include "nsEditorTxnLog.h" +#include "nslog.h" + +NS_IMPL_LOG(nsEditorTxnLogLog) +#define PRINTF NS_LOG_PRINTF(nsEditorTxnLogLog) +#define FLUSH NS_LOG_FLUSH(nsEditorTxnLogLog) #define LOCK_LOG(doc) #define UNLOCK_LOG(doc) @@ -394,7 +399,7 @@ nsEditorTxnLog::Write(const char *aBuffer) if (mEditorLog) mEditorLog->Write(aBuffer); else - printf(aBuffer); + PRINTF(aBuffer); return NS_OK; } @@ -408,7 +413,7 @@ nsEditorTxnLog::WriteInt(const char *aFormat, PRInt32 aInt) if (mEditorLog) mEditorLog->WriteInt(aFormat, aInt); else - printf(aFormat, aInt); + PRINTF(aFormat, aInt); return NS_OK; } diff --git a/mozilla/editor/libeditor/html/nsHTMLEditRules.cpp b/mozilla/editor/libeditor/html/nsHTMLEditRules.cpp index 35fd0e8f04f..866b05627ad 100644 --- a/mozilla/editor/libeditor/html/nsHTMLEditRules.cpp +++ b/mozilla/editor/libeditor/html/nsHTMLEditRules.cpp @@ -47,6 +47,15 @@ #include "InsertTextTxn.h" #include "DeleteTextTxn.h" +#include "nslog.h" + +#if defined(DEBUG_ftang) +NS_IMPL_LOG_ENABLED(nsHTMLEditRulesLog) +#else +NS_IMPL_LOG(nsHTMLEditRulesLog) +#endif +#define PRINTF NS_LOG_PRINTF(nsHTMLEditRulesLog) +#define FLUSH NS_LOG_FLUSH(nsHTMLEditRulesLog) //const static char* kMOZEditorBogusNodeAttr="MOZ_EDITOR_BOGUS_NODE"; //const static char* kMOZEditorBogusNodeValue="TRUE"; @@ -384,9 +393,7 @@ nsHTMLEditRules::WillDoAction(nsISelection *aSelection, { if (!aInfo || !aCancel || !aHandled) return NS_ERROR_NULL_POINTER; -#if defined(DEBUG_ftang) - printf("nsHTMLEditRules::WillDoAction action = %d\n", aInfo->action); -#endif + PRINTF("nsHTMLEditRules::WillDoAction action = %d\n", aInfo->action); *aCancel = PR_FALSE; *aHandled = PR_FALSE; diff --git a/mozilla/editor/libeditor/html/nsHTMLEditor.cpp b/mozilla/editor/libeditor/html/nsHTMLEditor.cpp index bad61d29a14..f41b0a53c9b 100644 --- a/mozilla/editor/libeditor/html/nsHTMLEditor.cpp +++ b/mozilla/editor/libeditor/html/nsHTMLEditor.cpp @@ -105,6 +105,12 @@ #include "nsEditorUtils.h" #include "nsIPref.h" +#include "nslog.h" + +NS_IMPL_LOG(nsHTMLEditorLog) +#define PRINTF NS_LOG_PRINTF(nsHTMLEditorLog) +#define FLUSH NS_LOG_FLUSH(nsHTMLEditorLog) + const PRUnichar nbsp = 160; // HACK - CID for NS_CTRANSITIONAL_DTD_CID so that we can get at transitional dtd @@ -132,13 +138,6 @@ static NS_DEFINE_CID(kCHTMLFormatConverterCID, NS_HTMLFORMATCONVERTER_CID); #define kHTMLContext "text/_moz_htmlcontext" #define kHTMLInfo "text/_moz_htmlinfo" - -#if defined(NS_DEBUG) && defined(DEBUG_buster) -static PRBool gNoisy = PR_FALSE; -#else -static const PRBool gNoisy = PR_FALSE; -#endif - // Some utilities to handle annoying overloading of "A" tag for link and named anchor static char hrefText[] = "href"; static char anchorTxt[] = "anchor"; @@ -576,7 +575,7 @@ nsHTMLEditor::InstallEventListeners() result = NS_NewEditorTextListener(getter_AddRefs(mTextListenerP),this); if (NS_FAILED(result)) { #ifdef DEBUG_TAGUE -printf("nsTextEditor.cpp: failed to get TextEvent Listener\n"); + PRINTF("nsTextEditor.cpp: failed to get TextEvent Listener\n"); #endif HandleEventListenerError(); return result; @@ -586,7 +585,7 @@ printf("nsTextEditor.cpp: failed to get TextEvent Listener\n"); result = NS_NewEditorCompositionListener(getter_AddRefs(mCompositionListenerP),this); if (NS_FAILED(result)) { #ifdef DEBUG_TAGUE -printf("nsTextEditor.cpp: failed to get TextEvent Listener\n"); + PRINTF("nsTextEditor.cpp: failed to get TextEvent Listener\n"); #endif HandleEventListenerError(); return result; @@ -1729,14 +1728,13 @@ NS_IMETHODIMP nsHTMLEditor::GetInlinePropertyWithAttrValue(nsIAtom *aProperty, if (!aProperty) return NS_ERROR_NULL_POINTER; /* - if (gNoisy) - { +#ifdef NS_ENABLE_LOGGING nsAutoString propString; aProperty->ToString(propString); char *propCString = propString.ToNewCString(); - if (gNoisy) { printf("nsTextEditor::GetTextProperty %s\n", propCString); } + PRINTF("nsTextEditor::GetTextProperty %s\n", propCString); nsCRT::free(propCString); - } +#endif */ nsresult result; aAny=PR_FALSE; @@ -1843,7 +1841,7 @@ NS_IMETHODIMP nsHTMLEditor::GetInlinePropertyWithAttrValue(nsIAtom *aProperty, iter->CurrentNode(getter_AddRefs(content)); while (NS_ENUMERATOR_FALSE == iter->IsDone()) { - //if (gNoisy) { printf(" checking node %p\n", content.get()); } + //PRINTF(" checking node %p\n", content.get()); nsCOMPtrtext; text = do_QueryInterface(content); PRBool skipNode = PR_FALSE; @@ -1858,7 +1856,7 @@ NS_IMETHODIMP nsHTMLEditor::GetInlinePropertyWithAttrValue(nsIAtom *aProperty, text->GetLength(&count); if (startOffset==(PRInt32)count) { - //if (gNoisy) { printf(" skipping node %p\n", content.get()); } + //PRINTF(" skipping node %p\n", content.get()); skipNode = PR_TRUE; } } @@ -1869,11 +1867,11 @@ NS_IMETHODIMP nsHTMLEditor::GetInlinePropertyWithAttrValue(nsIAtom *aProperty, content->CanContainChildren(canContainChildren); if (canContainChildren) { - //if (gNoisy) { printf(" skipping non-leaf node %p\n", content.get()); } + //PRINTF(" skipping non-leaf node %p\n", content.get()); skipNode = PR_TRUE; } else { - //if (gNoisy) { printf(" testing non-text leaf node %p\n", content.get()); } + //PRINTF(" testing non-text leaf node %p\n", content.get()); } } if (!skipNode) @@ -1916,7 +1914,7 @@ NS_IMETHODIMP nsHTMLEditor::GetInlinePropertyWithAttrValue(nsIAtom *aProperty, { // make sure that if none of the selection is set, we don't report all is set aAll = PR_FALSE; } - //if (gNoisy) { printf(" returning first=%d any=%d all=%d\n", aFirst, aAny, aAll); } + //PRINTF(" returning first=%d any=%d all=%d\n", aFirst, aAny, aAll); return result; } @@ -2352,9 +2350,7 @@ NS_IMETHODIMP nsHTMLEditor::DeleteSelection(nsIEditor::EDirection aAction) } if (NS_FAILED(result)) { -#ifdef DEBUG - printf("Selection controller interface didn't work!\n"); -#endif + PRINTF("Selection controller interface didn't work!\n"); return result; } } @@ -3023,9 +3019,7 @@ nsHTMLEditor::ReplaceHeadContentsWithHTML(const nsString &aSourceToInsert) if (NS_FAILED(res)) { -#ifdef DEBUG - printf("Couldn't create contextual fragment: error was %d\n", res); -#endif + PRINTF("Couldn't create contextual fragment: error was %d\n", res); return res; } if (!docfrag) return NS_ERROR_NULL_POINTER; @@ -3292,9 +3286,9 @@ nsHTMLEditor::InsertElementAtSelection(nsIDOMElement* aElement, PRBool aDeleteSe { nsAutoString name; parentSelectedNode->GetNodeName(name); - printf("InsertElement: Anchor node of selection: "); - wprintf(name.GetUnicode()); - printf(" Offset: %d\n", offsetForInsert); + PRINTF("InsertElement: Anchor node of selection: "); + WPRINTF(name.GetUnicode()); + PRINTF(" Offset: %d\n", offsetForInsert); } #endif @@ -3442,13 +3436,13 @@ nsHTMLEditor::SetCaretAfterElement(nsIDOMElement* aElement) { nsAutoString name; parent->GetNodeName(name); - printf("SetCaretAfterElement: Parent node: "); - wprintf(name.GetUnicode()); - printf(" Offset: %d\n\nHTML:\n", offsetInParent+1); + PRINTF("SetCaretAfterElement: Parent node: "); + WPRINTF(name.GetUnicode()); + PRINTF(" Offset: %d\n\nHTML:\n", offsetInParent+1); nsAutoString Format("text/html"); nsAutoString ContentsAs; OutputToString(ContentsAs, Format, 2); - wprintf(ContentsAs.GetUnicode()); + WPRINTF(ContentsAs.GetUnicode()); } #endif } @@ -4287,13 +4281,13 @@ nsHTMLEditor::GetSelectedElement(const nsString& aTagName, nsIDOMElement** aRetu { nsAutoString name; anchorNode->GetNodeName(name); - printf("GetSelectedElement: Anchor node of selection: "); - wprintf(name.GetUnicode()); - printf(" Offset: %d\n", anchorOffset); + PRINTF("GetSelectedElement: Anchor node of selection: "); + WPRINTF(name.GetUnicode()); + PRINTF(" Offset: %d\n", anchorOffset); focusNode->GetNodeName(name); - printf("Focus node of selection: "); - wprintf(name.GetUnicode()); - printf(" Offset: %d\n", focusOffset); + PRINTF("Focus node of selection: "); + WPRINTF(name.GetUnicode()); + PRINTF(" Offset: %d\n", focusOffset); } #endif nsCOMPtr parentLinkOfAnchor; @@ -4414,10 +4408,10 @@ nsHTMLEditor::GetSelectedElement(const nsString& aTagName, nsIDOMElement** aRetu } else { // Should never get here? isCollapsed = PR_TRUE; - printf("isCollapsed was FALSE, but no elements found in selection\n"); + PRINTF("isCollapsed was FALSE, but no elements found in selection\n"); } } else { - printf("Could not create enumerator for GetSelectionProperties\n"); + PRINTF("Could not create enumerator for GetSelectionProperties\n"); } } } @@ -4529,7 +4523,7 @@ nsHTMLEditor::InsertLinkAroundSelection(nsIDOMElement* aAnchorElement) if (isCollapsed) { - printf("InsertLinkAroundSelection called but there is no selection!!!\n"); + PRINTF("InsertLinkAroundSelection called but there is no selection!!!\n"); res = NS_OK; } else { // Be sure we were given an anchor element @@ -4974,8 +4968,8 @@ NS_IMETHODIMP nsHTMLEditor::GetBodyWrapWidth(PRInt32 *aWrapColumn) *aWrapColumn = stylePosition->mWidth.GetIntValue(); else { #ifdef DEBUG_akkana - printf("Can't get wrap column: style unit is %d\n", - stylePosition->mWidth.GetUnit()); + PRINTF("Can't get wrap column: style unit is %d\n", + stylePosition->mWidth.GetUnit()); #endif *aWrapColumn = -1; return NS_ERROR_UNEXPECTED; @@ -5064,11 +5058,11 @@ NS_IMETHODIMP nsHTMLEditor::SetBodyWrapWidth(PRInt32 aWrapColumn) #ifdef DEBUG_wrapstyle char* curstyle = styleValue.ToNewCString(); - printf("Setting style: [%s]\nNow body looks like:\n", curstyle); + PRINTF("Setting style: [%s]\nNow body looks like:\n", curstyle); Recycle(curstyle); //nsCOMPtr nodec (do_QueryInterface(bodyElement)); //if (nodec) nodec->List(stdout); - //printf("-----\n"); + //PRINTF("-----\n"); #endif /* DEBUG_akkana */ return res; @@ -5297,7 +5291,7 @@ NS_IMETHODIMP nsHTMLEditor::InsertFromTransferable(nsITransferable *transferable nsAutoString flavor, stuffToPaste; flavor.AssignWithConversion( bestFlavor ); // just so we can use flavor.Equals() #ifdef DEBUG_akkana - printf("Got flavor [%s]\n", bestFlavor); + PRINTF("Got flavor [%s]\n", bestFlavor); #endif if (flavor.EqualsWithConversion(kHTMLMime)) { @@ -5391,7 +5385,7 @@ NS_IMETHODIMP nsHTMLEditor::InsertFromTransferable(nsITransferable *transferable else if (flavor.EqualsWithConversion(kJPEGImageMime)) { // Insert Image code here - printf("Don't know how to insert an image yet!\n"); + PRINTF("Don't know how to insert an image yet!\n"); //nsIImage* image = (nsIImage *)data; //NS_RELEASE(image); rv = NS_ERROR_NOT_IMPLEMENTED; // for now give error code @@ -5599,7 +5593,7 @@ NS_IMETHODIMP nsHTMLEditor::CanDrag(nsIDOMEvent *aDragEvent, PRBool &aCanDrag) if (mIgnoreSpuriousDragEvent) { #ifdef DEBUG_cmanske - printf(" *** IGNORING SPURIOUS DRAG EVENT!\n"); + PRINTF(" *** IGNORING SPURIOUS DRAG EVENT!\n"); #endif mIgnoreSpuriousDragEvent = PR_FALSE; return NS_OK; @@ -5913,7 +5907,7 @@ NS_IMETHODIMP nsHTMLEditor::PasteAsCitedQuotation(const nsString& aCitation, if (NS_FAILED(res)) { #ifdef DEBUG_akkana - printf("Couldn't collapse"); + PRINTF("Couldn't collapse"); #endif // XXX: error result: should res be returned here? } @@ -5957,12 +5951,12 @@ NS_IMETHODIMP nsHTMLEditor::PasteAsPlaintextQuotation(PRInt32 aSelectionType) if (NS_FAILED(rv)) { #ifdef DEBUG_akkana - printf("PasteAsPlaintextQuotation: GetAnyTransferData failed, %d\n", rv); + PRINTF("PasteAsPlaintextQuotation: GetAnyTransferData failed, %d\n", rv); #endif return rv; } #ifdef DEBUG_akkana - printf("Got flavor [%s]\n", flav); + PRINTF("Got flavor [%s]\n", flav); #endif nsAutoString flavor; flavor.AssignWithConversion(flav); nsAutoString stuffToPaste; @@ -6437,7 +6431,7 @@ NS_IMETHODIMP nsHTMLEditor::OutputToStream(nsIOutputStream* aOutputStream, nsCRT::free(contractid); if (NS_FAILED(rv)) { - printf("Couldn't get contractid %s\n", contractid); + PRINTF("Couldn't get contractid %s\n", contractid); return rv; } @@ -7165,7 +7159,7 @@ nsHTMLEditor::DeleteSelectionAndPrepareToCreateNode(nsCOMPtr &parent // Here's where the new node was inserted } else { - printf("InsertBreak into an empty document is not yet supported\n"); + PRINTF("InsertBreak into an empty document is not yet supported\n"); } return result; } @@ -7223,7 +7217,7 @@ nsCOMPtr nsHTMLEditor::FindPreElement() void nsHTMLEditor::HandleEventListenerError() { - if (gNoisy) { printf("failed to add event listener\n"); } + PRINTF("failed to add event listener\n"); // null out the nsCOMPtrs mKeyListenerP = nsnull; mMouseListenerP = nsnull; diff --git a/mozilla/editor/libeditor/html/nsTableEditor.cpp b/mozilla/editor/libeditor/html/nsTableEditor.cpp index e09373fe6fd..2c02df8f4e2 100644 --- a/mozilla/editor/libeditor/html/nsTableEditor.cpp +++ b/mozilla/editor/libeditor/html/nsTableEditor.cpp @@ -46,6 +46,11 @@ #include "nsEditorUtils.h" #include "nsHTMLEditUtils.h" +#include "nslog.h" + +NS_IMPL_LOG(nsTableEditorLog) +#define PRINTF NS_LOG_PRINTF(nsTableEditorLog) +#define FLUSH NS_LOG_FLUSH(nsTableEditorLog) //#define DEBUG_TABLE 1 @@ -357,7 +362,7 @@ nsHTMLEditor::GetNextRow(nsIDOMElement* aTableElement, nsIDOMElement* &aRow) return NS_OK; } #ifdef DEBUG_cmanske - printf("GetNextRow: firstChild of row's parent's sibling is not a TR!\n"); + PRINTF("GetNextRow: firstChild of row's parent's sibling is not a TR!\n"); #endif // We arrive here only if a table section has no children // or first child of section is not a row (bad HTML!) @@ -2500,9 +2505,7 @@ nsHTMLEditor::NormalizeTable(nsIDOMElement *aTable) if (!cell) { //We are missing a cell at a cellmap location -#ifdef DEBUG - printf("NormalizeTable found missing cell at row=%d, col=%d\n", rowIndex, colIndex); -#endif + PRINTF("NormalizeTable found missing cell at row=%d, col=%d\n", rowIndex, colIndex); // Add a cell after the previous Cell in the current row if(previousCellInRow) { @@ -2515,9 +2518,7 @@ nsHTMLEditor::NormalizeTable(nsIDOMElement *aTable) startRowIndex = rowIndex; } else { // We don't have any cells in this row -- We are really messed up! -#ifdef DEBUG - printf("NormalizeTable found no cells in row=%d, col=%d\n", rowIndex, colIndex); -#endif + PRINTF("NormalizeTable found no cells in row=%d, col=%d\n", rowIndex, colIndex); return NS_ERROR_FAILURE; } } @@ -2934,7 +2935,7 @@ nsHTMLEditor::GetNextSelectedCell(nsIDOMElement **aCell, nsIDOMRange **aRange) if (*aCell) break; #ifdef DEBUG_cmanske else - printf("GetNextSelectedCell: Collapsed range found\n"); + PRINTF("GetNextSelectedCell: Collapsed range found\n"); #endif // If we didn't find a cell, continue to next range in selection @@ -3027,7 +3028,7 @@ nsHTMLEditor::SetSelectionAfterTableEdit(nsIDOMElement* aTable, PRInt32 aRow, PR if (!selection) { #ifdef DEBUG_cmanske - printf("Selection not found after table manipulation!\n"); + PRINTF("Selection not found after table manipulation!\n"); #endif return NS_ERROR_FAILURE; } diff --git a/mozilla/editor/libeditor/text/nsEditorEventListeners.cpp b/mozilla/editor/libeditor/text/nsEditorEventListeners.cpp index 6f11a9a11bc..03c9098a8c6 100644 --- a/mozilla/editor/libeditor/text/nsEditorEventListeners.cpp +++ b/mozilla/editor/libeditor/text/nsEditorEventListeners.cpp @@ -64,6 +64,15 @@ #include "nsISupportsPrimitives.h" #include "nsLayoutCID.h" #include "nsIDOMNSRange.h" +#include "nslog.h" + +#ifdef DEBUG_IME +NS_IMPL_LOG_ENABLED(nsEditorEventListenersLog) +#else +NS_IMPL_LOG(nsEditorEventListenersLog) +#endif +#define PRINTF NS_LOG_PRINTF(nsEditorEventListenersLog) +#define FLUSH NS_LOG_FLUSH(nsEditorEventListenersLog) // Drag & Drop, Clipboard Support static NS_DEFINE_CID(kCDataFlavorCID, NS_DATAFLAVOR_CID); @@ -510,9 +519,7 @@ nsTextEditorTextListener::QueryInterface(REFNSIID aIID, void** aInstancePtr) nsresult nsTextEditorTextListener::HandleEvent(nsIDOMEvent* aEvent) { -#ifdef DEBUG_IME - printf("nsTextEditorTextListener::HandleEvent\n"); -#endif + PRINTF("nsTextEditorTextListener::HandleEvent\n"); return NS_OK; } @@ -521,9 +528,7 @@ nsTextEditorTextListener::HandleEvent(nsIDOMEvent* aEvent) nsresult nsTextEditorTextListener::HandleText(nsIDOMEvent* aTextEvent) { -#ifdef DEBUG_IME - printf("nsTextEditorTextListener::HandleText\n"); -#endif + PRINTF("nsTextEditorTextListener::HandleText\n"); nsAutoString composedText; nsresult result = NS_OK; nsCOMPtr textEvent; @@ -806,9 +811,7 @@ NS_IMPL_RELEASE(nsTextEditorCompositionListener) nsresult nsTextEditorCompositionListener::HandleEvent(nsIDOMEvent* aEvent) { -#ifdef DEBUG_IME - printf("nsTextEditorCompositionListener::HandleEvent\n"); -#endif + PRINTF("nsTextEditorCompositionListener::HandleEvent\n"); return NS_OK; } @@ -824,9 +827,7 @@ void nsTextEditorCompositionListener::SetEditor(nsIEditor *aEditor) nsresult nsTextEditorCompositionListener::HandleStartComposition(nsIDOMEvent* aCompositionEvent) { -#ifdef DEBUG_IME - printf("nsTextEditorCompositionListener::HandleStartComposition\n"); -#endif + PRINTF("nsTextEditorCompositionListener::HandleStartComposition\n"); nsCOMPtr pCompositionEvent = do_QueryInterface(aCompositionEvent); nsTextEventReply* eventReply; @@ -840,9 +841,7 @@ nsTextEditorCompositionListener::HandleStartComposition(nsIDOMEvent* aCompositio nsresult nsTextEditorCompositionListener::HandleQueryComposition(nsIDOMEvent* aCompositionEvent) { -#ifdef DEBUG_IME - printf("nsTextEditorCompositionListener::HandleQueryComposition\n"); -#endif + PRINTF("nsTextEditorCompositionListener::HandleQueryComposition\n"); nsCOMPtr pCompositionEvent = do_QueryInterface(aCompositionEvent); nsTextEventReply* eventReply; @@ -857,9 +856,7 @@ nsTextEditorCompositionListener::HandleQueryComposition(nsIDOMEvent* aCompositio nsresult nsTextEditorCompositionListener::HandleEndComposition(nsIDOMEvent* aCompositionEvent) { -#ifdef DEBUG_IME - printf("nsTextEditorCompositionListener::HandleEndComposition\n"); -#endif + PRINTF("nsTextEditorCompositionListener::HandleEndComposition\n"); return mEditor->EndComposition(); } @@ -867,9 +864,7 @@ nsTextEditorCompositionListener::HandleEndComposition(nsIDOMEvent* aCompositionE nsresult nsTextEditorCompositionListener::HandleQueryReconversion(nsIDOMEvent* aReconversionEvent) { -#ifdef DEBUG_IME - printf("nsTextEditorCompositionListener::HandleQueryReconversion\n"); -#endif + PRINTF("nsTextEditorCompositionListener::HandleQueryReconversion\n"); nsCOMPtr pCompositionEvent = do_QueryInterface(aReconversionEvent); nsReconversionEventReply* eventReply; diff --git a/mozilla/editor/libeditor/text/nsInternetCiter.cpp b/mozilla/editor/libeditor/text/nsInternetCiter.cpp index bd7ea957cbf..72f1bd87efc 100644 --- a/mozilla/editor/libeditor/text/nsInternetCiter.cpp +++ b/mozilla/editor/libeditor/text/nsInternetCiter.cpp @@ -26,6 +26,11 @@ #include "nsString.h" #include "nsCOMPtr.h" +#include "nslog.h" + +NS_IMPL_LOG(nsInternetCiterLog) +#define PRINTF NS_LOG_PRINTF(nsInternetCiterLog) +#define FLUSH NS_LOG_FLUSH(nsInternetCiterLog) // Line breaker stuff #include "nsIServiceManager.h" @@ -210,7 +215,7 @@ nsInternetCiter::Rewrap(const nsString& aInString, { #ifdef DEBUG_wrapping nsAutoString debug (nsPromiseSubstring(aInString, posInString, length-posInString)); - printf("Outer loop: '%s'\n", debug.ToNewCString()); + PRINTF("Outer loop: '%s'\n", debug.ToNewCString()); #endif // Get the new cite level here since we're at the beginning of a line @@ -264,8 +269,8 @@ nsInternetCiter::Rewrap(const nsString& aInString, else if (outStringCol > 0) { #ifdef DEBUG_wrapping - printf("Appending space; citeLevel=%d, outStringCol=%d\n", citeLevel, - outStringCol); + PRINTF("Appending space; citeLevel=%d, outStringCol=%d\n", citeLevel, + outStringCol); #endif aOutString.Append(space); ++outStringCol; @@ -287,7 +292,7 @@ nsInternetCiter::Rewrap(const nsString& aInString, #ifdef DEBUG_wrapping nsAutoString debug (nsPromiseSubstring(aInString, posInString, nextNewline-posInString)); - printf("Unquoted: appending '%s'\n", debug.ToNewCString()); + PRINTF("Unquoted: appending '%s'\n", debug.ToNewCString()); #endif aOutString.Append(nsPromiseSubstring(aInString, posInString, nextNewline-posInString)); @@ -295,7 +300,7 @@ nsInternetCiter::Rewrap(const nsString& aInString, if (nextNewline != length) { #ifdef DEBUG_wrapping - printf("unquoted: appending a newline\n"); + PRINTF("unquoted: appending a newline\n"); #endif aOutString.Append(nl); outStringCol = 0; @@ -310,7 +315,7 @@ nsInternetCiter::Rewrap(const nsString& aInString, { #ifdef DEBUG_wrapping nsAutoString debug (nsPromiseSubstring(aInString, posInString, nextNewline-posInString)); - printf("Inner loop: '%s'\n", debug.ToNewCString()); + PRINTF("Inner loop: '%s'\n", debug.ToNewCString()); #endif // If this is a short line, just append it and continue: @@ -322,7 +327,7 @@ nsInternetCiter::Rewrap(const nsString& aInString, ++nextNewline; #ifdef DEBUG_wrapping nsAutoString debug (nsPromiseSubstring(aInString, posInString, nextNewline - posInString)); - printf("Short line: '%s'\n", debug.ToNewCString()); + PRINTF("Short line: '%s'\n", debug.ToNewCString()); #endif aOutString += nsPromiseSubstring(aInString, posInString, nextNewline - posInString); @@ -357,12 +362,12 @@ nsInternetCiter::Rewrap(const nsString& aInString, if (NS_FAILED(rv)) { #ifdef DEBUG_akkana - printf("nsInternetCiter: LineBreaker not working -- breaking hard\n"); + PRINTF("nsInternetCiter: LineBreaker not working -- breaking hard\n"); #endif breakPt = eol; } #ifdef DEBUG_wrapping - printf("breakPt = %d\n", breakPt); + PRINTF("breakPt = %d\n", breakPt); #endif aOutString += nsPromiseSubstring(aInString, posInString, breakPt); @@ -378,7 +383,7 @@ nsInternetCiter::Rewrap(const nsString& aInString, } } // end inner loop within one line of aInString #ifdef DEBUG_wrapping - printf("---------\nEnd inner loop: out string is now '%s'\n-----------\n", + PRINTF("---------\nEnd inner loop: out string is now '%s'\n-----------\n", aOutString.ToNewCString()); #endif } // end outer loop over lines of aInString diff --git a/mozilla/editor/libeditor/text/nsTextEditRules.cpp b/mozilla/editor/libeditor/text/nsTextEditRules.cpp index 9d022ff37a1..ad5dcd6ef33 100644 --- a/mozilla/editor/libeditor/text/nsTextEditRules.cpp +++ b/mozilla/editor/libeditor/text/nsTextEditRules.cpp @@ -42,6 +42,11 @@ #include "EditTxn.h" #include "TypeInState.h" #include "nsIPref.h" +#include "nslog.h" + +NS_IMPL_LOG(nsTextEditRulesLog) +#define PRINTF NS_LOG_PRINTF(nsTextEditRulesLog) +#define FLUSH NS_LOG_FLUSH(nsTextEditRulesLog) static NS_DEFINE_CID(kContentIteratorCID, NS_CONTENTITERATOR_CID); static NS_DEFINE_IID(kRangeCID, NS_RANGE_CID); @@ -230,7 +235,7 @@ nsTextEditRules::WillDoAction(nsISelection *aSelection, // null selection is legal if (!aInfo || !aCancel || !aHandled) { return NS_ERROR_NULL_POINTER; } #if defined(DEBUG_ftang) - printf("nsTextEditRules::WillDoAction action= %d", aInfo->action); + PRINTF("nsTextEditRules::WillDoAction action= %d", aInfo->action); #endif *aCancel = PR_FALSE; @@ -478,7 +483,7 @@ nsTextEditRules::WillInsertBreak(nsISelection *aSelection, PRBool *aCancel, PRBo mozQuoteVal, isMozQuote)) && isMozQuote) { - printf("It's a moz quote -- splitting\n"); + PRINTF("It's a moz quote -- splitting\n"); nsCOMPtr outLeftNode; nsCOMPtr outRightNode; res = mEditor->SplitNodeDeep(preNode, selNode, selOffset, &newOffset, PR_TRUE, &outLeftNode, &outRightNode); @@ -892,7 +897,7 @@ nsTextEditRules::WillDeleteSelection(nsISelection *aSelection, #ifdef DEBUG_buster char *password = mPasswordText.ToNewCString(); - printf("mPasswordText is %s\n", password); + PRINTF("mPasswordText is %s\n", password); nsCRT::free(password); #endif } diff --git a/mozilla/editor/libeditor/text/nsWrapUtils.cpp b/mozilla/editor/libeditor/text/nsWrapUtils.cpp index 59a74b964dc..51dda959826 100644 --- a/mozilla/editor/libeditor/text/nsWrapUtils.cpp +++ b/mozilla/editor/libeditor/text/nsWrapUtils.cpp @@ -23,6 +23,11 @@ #include "nsWrapUtils.h" #include "nsCOMPtr.h" +#include "nslog.h" + +NS_IMPL_LOG(nsWrapUtilsLog) +#define PRINTF NS_LOG_PRINTF(nsWrapUtilsLog) +#define FLUSH NS_LOG_FLUSH(nsWrapUtilsLog) // Line breaker stuff #include "nsIServiceManager.h" @@ -101,7 +106,7 @@ nsWrapUtils::Rewrap(const nsString& aInString, if (NS_FAILED(rv)) { #ifdef DEBUG_akkana - printf("nsILineBreaker not working -- breaking hard\n"); + PRINTF("nsILineBreaker not working -- breaking hard\n"); #endif breakPt = eol+1; } diff --git a/mozilla/editor/libeditor/txtsvc/nsTextServicesDocument.cpp b/mozilla/editor/libeditor/txtsvc/nsTextServicesDocument.cpp index 44a8574000c..0f987a9af3a 100644 --- a/mozilla/editor/libeditor/txtsvc/nsTextServicesDocument.cpp +++ b/mozilla/editor/libeditor/txtsvc/nsTextServicesDocument.cpp @@ -34,6 +34,11 @@ #include "nsIDOMElement.h" #include "nsIDOMHTMLElement.h" #include "nsIDOMHTMLDocument.h" +#include "nslog.h" + +NS_IMPL_LOG(nsTextServicesDocumentLog) +#define PRINTF NS_LOG_PRINTF(nsTextServicesDocumentLog) +#define FLUSH NS_LOG_FLUSH(nsTextServicesDocumentLog) #define LOCK_DOC(doc) #define UNLOCK_DOC(doc) @@ -1792,7 +1797,7 @@ nsTextServicesDocument::SetSelection(PRInt32 aOffset, PRInt32 aLength) UNLOCK_DOC(this); //**** KDEBUG **** - // printf("\n * Sel: (%2d, %4d) (%2d, %4d)\n", mSelStartIndex, mSelStartOffset, mSelEndIndex, mSelEndOffset); + // PRINTF("\n * Sel: (%2d, %4d) (%2d, %4d)\n", mSelStartIndex, mSelStartOffset, mSelEndIndex, mSelEndOffset); //**** KDEBUG **** return result; @@ -1834,8 +1839,8 @@ nsTextServicesDocument::DeleteSelection() LOCK_DOC(this); //**** KDEBUG **** - // printf("\n---- Before Delete\n"); - // printf("Sel: (%2d, %4d) (%2d, %4d)\n", mSelStartIndex, mSelStartOffset, mSelEndIndex, mSelEndOffset); + // PRINTF("\n---- Before Delete\n"); + // PRINTF("Sel: (%2d, %4d) (%2d, %4d)\n", mSelStartIndex, mSelStartOffset, mSelEndIndex, mSelEndOffset); // PrintOffsetTable(); //**** KDEBUG **** @@ -1899,8 +1904,8 @@ nsTextServicesDocument::DeleteSelection() } //**** KDEBUG **** - // printf("\n---- Middle Delete\n"); - // printf("Sel: (%2d, %4d) (%2d, %4d)\n", mSelStartIndex, mSelStartOffset, mSelEndIndex, mSelEndOffset); + // PRINTF("\n---- Middle Delete\n"); + // PRINTF("Sel: (%2d, %4d) (%2d, %4d)\n", mSelStartIndex, mSelStartOffset, mSelEndIndex, mSelEndOffset); // PrintOffsetTable(); //**** KDEBUG **** @@ -2026,8 +2031,8 @@ nsTextServicesDocument::DeleteSelection() result = RemoveInvalidOffsetEntries(); //**** KDEBUG **** - // printf("\n---- After Delete\n"); - // printf("Sel: (%2d, %4d) (%2d, %4d)\n", mSelStartIndex, mSelStartOffset, mSelEndIndex, mSelEndOffset); + // PRINTF("\n---- After Delete\n"); + // PRINTF("Sel: (%2d, %4d) (%2d, %4d)\n", mSelStartIndex, mSelStartOffset, mSelEndIndex, mSelEndOffset); // PrintOffsetTable(); //**** KDEBUG **** @@ -2086,8 +2091,8 @@ nsTextServicesDocument::InsertText(const nsString *aText) if (SelectionIsValid()) { //**** KDEBUG **** - // printf("\n---- Before Insert\n"); - // printf("Sel: (%2d, %4d) (%2d, %4d)\n", mSelStartIndex, mSelStartOffset, mSelEndIndex, mSelEndOffset); + // PRINTF("\n---- Before Insert\n"); + // PRINTF("Sel: (%2d, %4d) (%2d, %4d)\n", mSelStartIndex, mSelStartOffset, mSelEndIndex, mSelEndOffset); // PrintOffsetTable(); //**** KDEBUG **** @@ -2268,8 +2273,8 @@ nsTextServicesDocument::InsertText(const nsString *aText) } //**** KDEBUG **** - // printf("\n---- After Insert\n"); - // printf("Sel: (%2d, %4d) (%2d, %4d)\n", mSelStartIndex, mSelStartOffset, mSelEndIndex, mSelEndOffset); + // PRINTF("\n---- After Insert\n"); + // PRINTF("Sel: (%2d, %4d) (%2d, %4d)\n", mSelStartIndex, mSelStartOffset, mSelEndIndex, mSelEndOffset); // PrintOffsetTable(); //**** KDEBUG **** } @@ -2299,8 +2304,8 @@ nsTextServicesDocument::InsertNode(nsIDOMNode *aNode, PRInt32 aPosition) { //**** KDEBUG **** - // printf("** InsertNode: 0x%.8x 0x%.8x %d\n", aNode, aParent, aPosition); - // fflush(stdout); + // PRINTF("** InsertNode: 0x%.8x 0x%.8x %d\n", aNode, aParent, aPosition); + // FLUSH(); //**** KDEBUG **** NS_ASSERTION(0, "InsertNode called, offset tables might be out of sync."); @@ -2312,8 +2317,8 @@ nsresult nsTextServicesDocument::DeleteNode(nsIDOMNode *aChild) { //**** KDEBUG **** - // printf("** DeleteNode: 0x%.8x\n", aChild); - // fflush(stdout); + // PRINTF("** DeleteNode: 0x%.8x\n", aChild); + // FLUSH(); //**** KDEBUG **** LOCK_DOC(this); @@ -2392,8 +2397,8 @@ nsTextServicesDocument::SplitNode(nsIDOMNode *aExistingRightNode, nsIDOMNode *aNewLeftNode) { //**** KDEBUG **** - // printf("** SplitNode: 0x%.8x %d 0x%.8x\n", aExistingRightNode, aOffset, aNewLeftNode); - // fflush(stdout); + // PRINTF("** SplitNode: 0x%.8x %d 0x%.8x\n", aExistingRightNode, aOffset, aNewLeftNode); + // FLUSH(); //**** KDEBUG **** NS_ASSERTION(0, "SplitNode called, offset tables might be out of sync."); @@ -2411,8 +2416,8 @@ nsTextServicesDocument::JoinNodes(nsIDOMNode *aLeftNode, nsresult result; //**** KDEBUG **** - // printf("** JoinNodes: 0x%.8x 0x%.8x 0x%.8x\n", aLeftNode, aRightNode, aParent); - // fflush(stdout); + // PRINTF("** JoinNodes: 0x%.8x 0x%.8x 0x%.8x\n", aLeftNode, aRightNode, aParent); + // FLUSH(); //**** KDEBUG **** // Make sure that both nodes are text nodes! @@ -3100,7 +3105,7 @@ nsTextServicesDocument::SetSelectionInternal(PRInt32 aOffset, PRInt32 aLength, P mSelEndOffset = mSelStartOffset; //**** KDEBUG **** - // printf("\n* Sel: (%2d, %4d) (%2d, %4d)\n", mSelStartIndex, mSelStartOffset, mSelEndIndex, mSelEndOffset); + // PRINTF("\n* Sel: (%2d, %4d) (%2d, %4d)\n", mSelStartIndex, mSelStartOffset, mSelEndIndex, mSelEndOffset); //**** KDEBUG **** return NS_OK; @@ -3150,7 +3155,7 @@ nsTextServicesDocument::SetSelectionInternal(PRInt32 aOffset, PRInt32 aLength, P } //**** KDEBUG **** - // printf("\n * Sel: (%2d, %4d) (%2d, %4d)\n", mSelStartIndex, mSelStartOffset, mSelEndIndex, mSelEndOffset); + // PRINTF("\n * Sel: (%2d, %4d) (%2d, %4d)\n", mSelStartIndex, mSelStartOffset, mSelEndIndex, mSelEndOffset); //**** KDEBUG **** return result; @@ -4445,13 +4450,13 @@ nsTextServicesDocument::PrintOffsetTable() for (i = 0; i < mOffsetTable.Count(); i++) { entry = (OffsetEntry *)mOffsetTable[i]; - printf("ENTRY %4d: 0x%.8x %c %c %4d %4d %4d\n", + PRINTF("ENTRY %4d: 0x%.8x %c %c %4d %4d %4d\n", i, (PRInt32)entry->mNode, entry->mIsValid ? 'V' : 'N', entry->mIsInsertedText ? 'I' : 'B', entry->mNodeOffset, entry->mStrOffset, entry->mLength); } - fflush(stdout); + FLUSH(); } void @@ -4466,7 +4471,7 @@ nsTextServicesDocument::PrintContentNode(nsIContent *aContent) atom->ToString(tmpStr); tmpStr.ToCString(tmpBuf, 256); - printf("%s", tmpBuf); + PRINTF("%s", tmpBuf); nsCOMPtr node = do_QueryInterface(aContent); @@ -4487,10 +4492,10 @@ nsTextServicesDocument::PrintContentNode(nsIContent *aContent) return; str.ToCString(tmpBuf, 256); - printf(": \"%s\"", tmpBuf); + PRINTF(": \"%s\"", tmpBuf); } } - printf("\n"); - fflush(stdout); + PRINTF("\n"); + FLUSH(); } diff --git a/mozilla/editor/txtsvc/src/nsTextServicesDocument.cpp b/mozilla/editor/txtsvc/src/nsTextServicesDocument.cpp index 44a8574000c..0f987a9af3a 100644 --- a/mozilla/editor/txtsvc/src/nsTextServicesDocument.cpp +++ b/mozilla/editor/txtsvc/src/nsTextServicesDocument.cpp @@ -34,6 +34,11 @@ #include "nsIDOMElement.h" #include "nsIDOMHTMLElement.h" #include "nsIDOMHTMLDocument.h" +#include "nslog.h" + +NS_IMPL_LOG(nsTextServicesDocumentLog) +#define PRINTF NS_LOG_PRINTF(nsTextServicesDocumentLog) +#define FLUSH NS_LOG_FLUSH(nsTextServicesDocumentLog) #define LOCK_DOC(doc) #define UNLOCK_DOC(doc) @@ -1792,7 +1797,7 @@ nsTextServicesDocument::SetSelection(PRInt32 aOffset, PRInt32 aLength) UNLOCK_DOC(this); //**** KDEBUG **** - // printf("\n * Sel: (%2d, %4d) (%2d, %4d)\n", mSelStartIndex, mSelStartOffset, mSelEndIndex, mSelEndOffset); + // PRINTF("\n * Sel: (%2d, %4d) (%2d, %4d)\n", mSelStartIndex, mSelStartOffset, mSelEndIndex, mSelEndOffset); //**** KDEBUG **** return result; @@ -1834,8 +1839,8 @@ nsTextServicesDocument::DeleteSelection() LOCK_DOC(this); //**** KDEBUG **** - // printf("\n---- Before Delete\n"); - // printf("Sel: (%2d, %4d) (%2d, %4d)\n", mSelStartIndex, mSelStartOffset, mSelEndIndex, mSelEndOffset); + // PRINTF("\n---- Before Delete\n"); + // PRINTF("Sel: (%2d, %4d) (%2d, %4d)\n", mSelStartIndex, mSelStartOffset, mSelEndIndex, mSelEndOffset); // PrintOffsetTable(); //**** KDEBUG **** @@ -1899,8 +1904,8 @@ nsTextServicesDocument::DeleteSelection() } //**** KDEBUG **** - // printf("\n---- Middle Delete\n"); - // printf("Sel: (%2d, %4d) (%2d, %4d)\n", mSelStartIndex, mSelStartOffset, mSelEndIndex, mSelEndOffset); + // PRINTF("\n---- Middle Delete\n"); + // PRINTF("Sel: (%2d, %4d) (%2d, %4d)\n", mSelStartIndex, mSelStartOffset, mSelEndIndex, mSelEndOffset); // PrintOffsetTable(); //**** KDEBUG **** @@ -2026,8 +2031,8 @@ nsTextServicesDocument::DeleteSelection() result = RemoveInvalidOffsetEntries(); //**** KDEBUG **** - // printf("\n---- After Delete\n"); - // printf("Sel: (%2d, %4d) (%2d, %4d)\n", mSelStartIndex, mSelStartOffset, mSelEndIndex, mSelEndOffset); + // PRINTF("\n---- After Delete\n"); + // PRINTF("Sel: (%2d, %4d) (%2d, %4d)\n", mSelStartIndex, mSelStartOffset, mSelEndIndex, mSelEndOffset); // PrintOffsetTable(); //**** KDEBUG **** @@ -2086,8 +2091,8 @@ nsTextServicesDocument::InsertText(const nsString *aText) if (SelectionIsValid()) { //**** KDEBUG **** - // printf("\n---- Before Insert\n"); - // printf("Sel: (%2d, %4d) (%2d, %4d)\n", mSelStartIndex, mSelStartOffset, mSelEndIndex, mSelEndOffset); + // PRINTF("\n---- Before Insert\n"); + // PRINTF("Sel: (%2d, %4d) (%2d, %4d)\n", mSelStartIndex, mSelStartOffset, mSelEndIndex, mSelEndOffset); // PrintOffsetTable(); //**** KDEBUG **** @@ -2268,8 +2273,8 @@ nsTextServicesDocument::InsertText(const nsString *aText) } //**** KDEBUG **** - // printf("\n---- After Insert\n"); - // printf("Sel: (%2d, %4d) (%2d, %4d)\n", mSelStartIndex, mSelStartOffset, mSelEndIndex, mSelEndOffset); + // PRINTF("\n---- After Insert\n"); + // PRINTF("Sel: (%2d, %4d) (%2d, %4d)\n", mSelStartIndex, mSelStartOffset, mSelEndIndex, mSelEndOffset); // PrintOffsetTable(); //**** KDEBUG **** } @@ -2299,8 +2304,8 @@ nsTextServicesDocument::InsertNode(nsIDOMNode *aNode, PRInt32 aPosition) { //**** KDEBUG **** - // printf("** InsertNode: 0x%.8x 0x%.8x %d\n", aNode, aParent, aPosition); - // fflush(stdout); + // PRINTF("** InsertNode: 0x%.8x 0x%.8x %d\n", aNode, aParent, aPosition); + // FLUSH(); //**** KDEBUG **** NS_ASSERTION(0, "InsertNode called, offset tables might be out of sync."); @@ -2312,8 +2317,8 @@ nsresult nsTextServicesDocument::DeleteNode(nsIDOMNode *aChild) { //**** KDEBUG **** - // printf("** DeleteNode: 0x%.8x\n", aChild); - // fflush(stdout); + // PRINTF("** DeleteNode: 0x%.8x\n", aChild); + // FLUSH(); //**** KDEBUG **** LOCK_DOC(this); @@ -2392,8 +2397,8 @@ nsTextServicesDocument::SplitNode(nsIDOMNode *aExistingRightNode, nsIDOMNode *aNewLeftNode) { //**** KDEBUG **** - // printf("** SplitNode: 0x%.8x %d 0x%.8x\n", aExistingRightNode, aOffset, aNewLeftNode); - // fflush(stdout); + // PRINTF("** SplitNode: 0x%.8x %d 0x%.8x\n", aExistingRightNode, aOffset, aNewLeftNode); + // FLUSH(); //**** KDEBUG **** NS_ASSERTION(0, "SplitNode called, offset tables might be out of sync."); @@ -2411,8 +2416,8 @@ nsTextServicesDocument::JoinNodes(nsIDOMNode *aLeftNode, nsresult result; //**** KDEBUG **** - // printf("** JoinNodes: 0x%.8x 0x%.8x 0x%.8x\n", aLeftNode, aRightNode, aParent); - // fflush(stdout); + // PRINTF("** JoinNodes: 0x%.8x 0x%.8x 0x%.8x\n", aLeftNode, aRightNode, aParent); + // FLUSH(); //**** KDEBUG **** // Make sure that both nodes are text nodes! @@ -3100,7 +3105,7 @@ nsTextServicesDocument::SetSelectionInternal(PRInt32 aOffset, PRInt32 aLength, P mSelEndOffset = mSelStartOffset; //**** KDEBUG **** - // printf("\n* Sel: (%2d, %4d) (%2d, %4d)\n", mSelStartIndex, mSelStartOffset, mSelEndIndex, mSelEndOffset); + // PRINTF("\n* Sel: (%2d, %4d) (%2d, %4d)\n", mSelStartIndex, mSelStartOffset, mSelEndIndex, mSelEndOffset); //**** KDEBUG **** return NS_OK; @@ -3150,7 +3155,7 @@ nsTextServicesDocument::SetSelectionInternal(PRInt32 aOffset, PRInt32 aLength, P } //**** KDEBUG **** - // printf("\n * Sel: (%2d, %4d) (%2d, %4d)\n", mSelStartIndex, mSelStartOffset, mSelEndIndex, mSelEndOffset); + // PRINTF("\n * Sel: (%2d, %4d) (%2d, %4d)\n", mSelStartIndex, mSelStartOffset, mSelEndIndex, mSelEndOffset); //**** KDEBUG **** return result; @@ -4445,13 +4450,13 @@ nsTextServicesDocument::PrintOffsetTable() for (i = 0; i < mOffsetTable.Count(); i++) { entry = (OffsetEntry *)mOffsetTable[i]; - printf("ENTRY %4d: 0x%.8x %c %c %4d %4d %4d\n", + PRINTF("ENTRY %4d: 0x%.8x %c %c %4d %4d %4d\n", i, (PRInt32)entry->mNode, entry->mIsValid ? 'V' : 'N', entry->mIsInsertedText ? 'I' : 'B', entry->mNodeOffset, entry->mStrOffset, entry->mLength); } - fflush(stdout); + FLUSH(); } void @@ -4466,7 +4471,7 @@ nsTextServicesDocument::PrintContentNode(nsIContent *aContent) atom->ToString(tmpStr); tmpStr.ToCString(tmpBuf, 256); - printf("%s", tmpBuf); + PRINTF("%s", tmpBuf); nsCOMPtr node = do_QueryInterface(aContent); @@ -4487,10 +4492,10 @@ nsTextServicesDocument::PrintContentNode(nsIContent *aContent) return; str.ToCString(tmpBuf, 256); - printf(": \"%s\"", tmpBuf); + PRINTF(": \"%s\"", tmpBuf); } } - printf("\n"); - fflush(stdout); + PRINTF("\n"); + FLUSH(); } diff --git a/mozilla/embedding/browser/activex/src/xml/ParseExpat.cpp b/mozilla/embedding/browser/activex/src/xml/ParseExpat.cpp index 6cefa2a11b6..e540ab83e73 100644 --- a/mozilla/embedding/browser/activex/src/xml/ParseExpat.cpp +++ b/mozilla/embedding/browser/activex/src/xml/ParseExpat.cpp @@ -60,8 +60,7 @@ HRESULT ParseExpat(const char *pBuffer, unsigned long cbBufSize, IXMLDocument *p if (!XML_Parse(parser, pBuffer, cbBufSize, 1)) { /* TODO Create error code - fprintf(stderr, - "%s at line %d\n", + PRINTF("%s at line %d\n", XML_ErrorString(XML_GetErrorCode(parser)), XML_GetCurrentLineNumber(parser)); */ diff --git a/mozilla/embedding/browser/gtk/src/gtkmozembed.cpp b/mozilla/embedding/browser/gtk/src/gtkmozembed.cpp index 29ed85b007c..ecc147d7e27 100644 --- a/mozilla/embedding/browser/gtk/src/gtkmozembed.cpp +++ b/mozilla/embedding/browser/gtk/src/gtkmozembed.cpp @@ -47,6 +47,11 @@ #include "nsWidgetsCID.h" #include "nsIAppShell.h" #include "nsIDOMDocument.h" +#include "nslog.h" + +NS_IMPL_LOG(gtkmozembedLog) +#define PRINTF NS_LOG_PRINTF(gtkmozembedLog) +#define FLUSH NS_LOG_FLUSH(gtkmozembedLog) // freakin X headers #ifdef Success @@ -489,7 +494,7 @@ GtkMozEmbedPrivate::OnChromeStateChange(nsIWebProgress *aWebProgress, { // apparently our primary content area hasn't been loaded. // tis ok - printf("Warning: Failed to find primary content shell! I will try again later.\n"); + PRINTF("Warning: Failed to find primary content shell! I will try again later.\n"); return NS_OK; } // if we made it this far, our primary content shell has been diff --git a/mozilla/embedding/browser/gtk/tests/TestGtkEmbed.cpp b/mozilla/embedding/browser/gtk/tests/TestGtkEmbed.cpp index 5d9bb170819..92c3e6e405f 100644 --- a/mozilla/embedding/browser/gtk/tests/TestGtkEmbed.cpp +++ b/mozilla/embedding/browser/gtk/tests/TestGtkEmbed.cpp @@ -22,6 +22,11 @@ #include "gtkmozembed.h" #include #include +#include "nslog.h" + +NS_IMPL_LOG(TestGtkEmbedLog) +#define PRINTF NS_LOG_PRINTF(TestGtkEmbedLog) +#define FLUSH NS_LOG_FLUSH(TestGtkEmbedLog) // mozilla specific headers #include "nsIDOMKeyEvent.h" @@ -866,7 +871,7 @@ gint dom_mouse_click_cb (GtkMozEmbed *embed, nsIDOMMouseEvent *event, // g_print("dom_mouse_click_cb\n"); PRUint16 button; event->GetButton(&button); - printf("button was %d\n", button); + PRINTF("button was %d\n", button); return NS_OK; } diff --git a/mozilla/embedding/browser/photon/src/PtMozilla.cpp b/mozilla/embedding/browser/photon/src/PtMozilla.cpp index abab968b6bb..847ac1f0c97 100644 --- a/mozilla/embedding/browser/photon/src/PtMozilla.cpp +++ b/mozilla/embedding/browser/photon/src/PtMozilla.cpp @@ -63,6 +63,12 @@ #include "nsIDOMMouseListener.h" #include "nsIDOMMouseEvent.h" +#include "nslog.h" + +NS_IMPL_LOG(PtMozillaLog) +#define PRINTF NS_LOG_PRINTF(PtMozillaLog) +#define FLUSH NS_LOG_FLUSH(PtMozillaLog) + static NS_DEFINE_CID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID); static NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID); static NS_DEFINE_CID(kAppShellServiceCID, NS_APPSHELL_SERVICE_CID); @@ -495,7 +501,7 @@ PhMozEmbedPrivate::OnChromeStateChange(nsIWebProgress *aWebProgress, { // apparently our primary content area hasn't been loaded. // tis ok - printf("Warning: Failed to find primary content shell! I will try again later.\n"); + PRINTF("Warning: Failed to find primary content shell! I will try again later.\n"); return NS_OK; } // if we made it this far, our primary content shell has been @@ -1388,7 +1394,7 @@ static void mozilla_defaults( PtWidget_t *widget ) int retval; retval = _mozilla_embed_startup_xpcom(); if (retval != TRUE) - printf("moz_embed_startup_xpcom(): FAILED\n"); + PRINTF("moz_embed_startup_xpcom(): FAILED\n"); } // increment the number of widgets num_widgets++; @@ -1401,7 +1407,7 @@ static void mozilla_defaults( PtWidget_t *widget ) nsresult rv; rv = moz->embed_private->Init((PtWidget_t *)moz); if (!NS_SUCCEEDED(rv)) - printf("moz->embed_private->Init(moz): FAILED\n"); + PRINTF("moz->embed_private->Init(moz): FAILED\n"); // widget related basic->flags = Pt_ALL_OUTLINES | Pt_ALL_BEVELS | Pt_FLAT_FILL; @@ -1448,13 +1454,13 @@ static void mozilla_realized( PtWidget_t *widget ) nsresult rv; rv = embed_private->Realize(widget); if (!NS_SUCCEEDED(rv)) - printf("embed_private->Realize(widget): FAILED\n"); + PRINTF("embed_private->Realize(widget): FAILED\n"); // get our hands on the base window nsCOMPtr webBrowserBaseWindow = do_QueryInterface(embed_private->mWebBrowser); if (!webBrowserBaseWindow) - printf("webBrowserBaseWindow: FAILED\n"); + PRINTF("webBrowserBaseWindow: FAILED\n"); // show it webBrowserBaseWindow->SetVisibility(PR_TRUE); diff --git a/mozilla/extensions/cookie/nsCookie.cpp b/mozilla/extensions/cookie/nsCookie.cpp index 8e60583536a..e1c0b0d161a 100644 --- a/mozilla/extensions/cookie/nsCookie.cpp +++ b/mozilla/extensions/cookie/nsCookie.cpp @@ -43,6 +43,11 @@ #include "nsIPref.h" #include "nsTextFormatter.h" +#include "nslog.h" + +NS_IMPL_LOG(nsCookieLog) +#define PRINTF NS_LOG_PRINTF(nsCookieLog) +#define FLUSH NS_LOG_FLUSH(nsCookieLog) static NS_DEFINE_CID(kNetSupportDialogCID, NS_NETSUPPORTDIALOG_CID); static NS_DEFINE_IID(kStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID); @@ -195,18 +200,14 @@ cookie_Localize(char* genericString) { /* create a bundle for the localization */ NS_WITH_SERVICE(nsIStringBundleService, pStringService, kStringBundleServiceCID, &ret); if (NS_FAILED(ret)) { -#ifdef DEBUG - printf("cannot get string service\n"); -#endif + PRINTF("cannot get string service\n"); return v.ToNewUnicode(); } nsCOMPtr locale; nsCOMPtr bundle; ret = pStringService->CreateBundle(cookie_localization, locale, getter_AddRefs(bundle)); if (NS_FAILED(ret)) { -#ifdef DEBUG - printf("cannot create instance\n"); -#endif + PRINTF("cannot create instance\n"); return v.ToNewUnicode(); } @@ -217,9 +218,7 @@ cookie_Localize(char* genericString) { ret = bundle->GetStringFromName(ptrtmp, getter_Copies(ptrv)); v = ptrv; if (NS_FAILED(ret)) { -#ifdef DEBUG - printf("cannot get string from name\n"); -#endif + PRINTF("cannot get string from name\n"); return v.ToNewUnicode(); } return v.ToNewUnicode(); @@ -1403,7 +1402,7 @@ cookie_SetCookieString(char * curURL, nsIPrompt *aPrompter, char * setCookieHead return; } -//printf("\nSetCookieString(URL '%s', header '%s') time %d == %s\n",curURL,setCookieHeader,timeToExpire,asctime(gmtime(&timeToExpire))); +//PRINTF("\nSetCookieString(URL '%s', header '%s') time %d == %s\n",curURL,setCookieHeader,timeToExpire,asctime(gmtime(&timeToExpire))); if(cookie_GetLifetimePref() == COOKIE_Discard) { if(cookie_GetLifetimeTime() < timeToExpire) { PR_Free(cur_path); diff --git a/mozilla/extensions/cookie/nsCookieHTTPNotify.cpp b/mozilla/extensions/cookie/nsCookieHTTPNotify.cpp index 64ca57e3a06..58e044b1bcb 100644 --- a/mozilla/extensions/cookie/nsCookieHTTPNotify.cpp +++ b/mozilla/extensions/cookie/nsCookieHTTPNotify.cpp @@ -38,6 +38,11 @@ #include "nsIHTTPProtocolHandler.h" // for NS_HTTP_STARTUP_CATEGORY #include "nsIInterfaceRequestor.h" #include "nsIPrompt.h" +#include "nslog.h" + +NS_IMPL_LOG(nsCookieHTTPNotifyLog) +#define PRINTF NS_LOG_PRINTF(nsCookieHTTPNotifyLog) +#define FLUSH NS_LOG_FLUSH(nsCookieHTTPNotifyLog) static NS_DEFINE_CID(kINetModuleMgrCID, NS_NETMODULEMGR_CID); @@ -117,9 +122,7 @@ nsCookieHTTPNotify::nsCookieHTTPNotify() { NS_INIT_REFCNT(); mCookieService = nsnull; -#ifdef DEBUG_dp - printf("CookieHTTPNotify Created.\n"); -#endif /* DEBUG_dp */ + PRINTF("CookieHTTPNotify Created.\n"); } nsCookieHTTPNotify::~nsCookieHTTPNotify() diff --git a/mozilla/extensions/cookie/tests/TestCookie.cpp b/mozilla/extensions/cookie/tests/TestCookie.cpp index c53f6c4e9e9..237fbb71470 100644 --- a/mozilla/extensions/cookie/tests/TestCookie.cpp +++ b/mozilla/extensions/cookie/tests/TestCookie.cpp @@ -27,7 +27,11 @@ #include "nsXPIDLString.h" #include "nsIEventQueueService.h" #include "nsIStringBundle.h" +#include "nslog.h" +NS_IMPL_LOG(TestCookieLog) +#define PRINTF NS_LOG_PRINTF(TestCookieLog) +#define FLUSH NS_LOG_FLUSH(TestCookieLog) static nsIEventQueue* gEventQ = nsnull; @@ -42,12 +46,12 @@ void SetACookie(nsICookieService *cookieService, const char* aSpec, const char* nsString cookie; cookie.AssignWithConversion(aCookieString); - printf("setting cookie for \"%s\" : ", aSpec); + PRINTF("setting cookie for \"%s\" : ", aSpec); nsresult rv = cookieService->SetCookieString(uri, nsnull, cookie); if (NS_FAILED(rv)) { - printf("NOT-SET\n"); + PRINTF("NOT-SET\n"); } else { - printf("\"%s\" was set.\n", aCookieString); + PRINTF("\"%s\" was set.\n", aCookieString); } return; } @@ -58,16 +62,16 @@ void GetACookie(nsICookieService *cookieService, const char* aSpec, char* *aCook NS_ASSERTION(uri, "malformed uri"); nsString cookie; - printf("retrieving cookie(s) for \"%s\" : ", aSpec); + PRINTF("retrieving cookie(s) for \"%s\" : ", aSpec); nsresult rv = cookieService->GetCookieString(uri, cookie); - if (NS_FAILED(rv)) printf("XXX GetCookieString() failed!\n"); + if (NS_FAILED(rv)) PRINTF("XXX GetCookieString() failed!\n"); if (cookie.IsEmpty()) { - printf("NOT-FOUND\n"); + PRINTF("NOT-FOUND\n"); } else { - printf("FOUND: "); + PRINTF("FOUND: "); char *cookieString = cookie.ToNewCString(); - printf("%s\n", cookieString); + PRINTF("%s\n", cookieString); nsCRT::free(cookieString); } return; diff --git a/mozilla/extensions/finger/nsFingerChannel.cpp b/mozilla/extensions/finger/nsFingerChannel.cpp index 8c99900fdb1..a4d98e4c1bb 100644 --- a/mozilla/extensions/finger/nsFingerChannel.cpp +++ b/mozilla/extensions/finger/nsFingerChannel.cpp @@ -32,6 +32,15 @@ #include "nsMimeTypes.h" #include "nsIStreamConverterService.h" #include "nsITXTToHTMLConv.h" +#include "nslog.h" + +#ifdef DEBUG_bryner +NS_IMPL_LOG_ENABLED(nsFingerChannelLog) +#else +NS_IMPL_LOG(nsFingerChannelLog) +#endif +#define PRINTF NS_LOG_PRINTF(nsFingerChannelLog) +#define FLUSH NS_LOG_FLUSH(nsFingerChannelLog) static NS_DEFINE_CID(kSocketTransportServiceCID, NS_SOCKETTRANSPORTSERVICE_CID); static NS_DEFINE_CID(kStreamConverterServiceCID, NS_STREAMCONVERTERSERVICE_CID); @@ -95,10 +104,8 @@ nsFingerChannel::Init(nsIURI* uri) mHost = cString; } -#ifdef DEBUG_bryner - printf("Status:mUser = %s, mHost = %s\n", (const char*)mUser, + PRINTF("Status:mUser = %s, mHost = %s\n", (const char*)mUser, (const char*)mHost); -#endif if (!*(const char *)mHost) return NS_ERROR_NOT_INITIALIZED; return NS_OK; @@ -452,11 +459,9 @@ NS_IMETHODIMP nsFingerChannel::OnStopRequest(nsIChannel* aChannel, nsISupports* aContext, nsresult aStatus, const PRUnichar* aStatusArg) { -#ifdef DEBUG_bryner - printf("nsFingerChannel::OnStopRequest, mActAsObserver=%d\n", - mActAsObserver); - printf(" aChannel = %p\n", aChannel); -#endif + PRINTF("nsFingerChannel::OnStopRequest, mActAsObserver=%d\n", + mActAsObserver); + PRINTF(" aChannel = %p\n", aChannel); nsresult rv = NS_OK; if (NS_FAILED(aStatus) || !mActAsObserver) { @@ -534,9 +539,7 @@ nsFingerChannel::SendRequest(nsIChannel* aChannel) { charstream = do_QueryInterface(result, &rv); if (NS_FAILED(rv)) return rv; -#ifdef DEBUG_bryner - printf("Sending: %s\n", requestBuffer.GetBuffer()); -#endif + PRINTF("Sending: %s\n", requestBuffer.GetBuffer()); rv = aChannel->SetTransferCount(requestBuffer.Length()); if (NS_FAILED(rv)) return rv; diff --git a/mozilla/extensions/pics/src/nsPICS.cpp b/mozilla/extensions/pics/src/nsPICS.cpp index 0534ca77871..6eb15e9bdd9 100644 --- a/mozilla/extensions/pics/src/nsPICS.cpp +++ b/mozilla/extensions/pics/src/nsPICS.cpp @@ -60,6 +60,11 @@ #include "net.h" #include "nsString.h" #include +#include "nslog.h" + +NS_IMPL_LOG(nsPICSLog) +#define PRINTF NS_LOG_PRINTF(nsPICSLog) +#define FLUSH NS_LOG_FLUSH(nsPICSLog) static NS_DEFINE_CID(kPrefCID, NS_PREF_CID); @@ -399,14 +404,14 @@ nsPICS::ProcessPICSLabel(char *label) rs = ParsePICSLabel(label); status = CompareToUserSettings(rs, "http://www.w3.org/"); if(status == PICS_NO_RATINGS) { - printf("PICS_PassFailReturnVal %d", status); + PRINTF("PICS_PassFailReturnVal %d", status); if(mPICSPagesMustBeRatedPref) status = PICS_RATINGS_FAILED; else status = PICS_RATINGS_PASSED; } } - printf("\nPICS_PassFailReturnVal %d\n", status); + PRINTF("\nPICS_PassFailReturnVal %d\n", status); FreeRatingsStruct(rs); return status; } @@ -666,8 +671,8 @@ nsPICS::ParsePICSLabel(char * label) while((rating_value = (PICS_RatingValue *)HTList_nextObject(list_ptr)) != NULL) { if (rating_value->name) - printf(" rating_value->name: %s\n", rating_value->name); - printf(" rating_value->value: %f\n\n", rating_value->value); + PRINTF(" rating_value->name: %s\n", rating_value->name); + PRINTF(" rating_value->value: %f\n\n", rating_value->value); } diff --git a/mozilla/extensions/pics/src/nsPICSElementObserver.cpp b/mozilla/extensions/pics/src/nsPICSElementObserver.cpp index ef2f4cbb508..c26ed7c63c7 100644 --- a/mozilla/extensions/pics/src/nsPICSElementObserver.cpp +++ b/mozilla/extensions/pics/src/nsPICSElementObserver.cpp @@ -39,6 +39,11 @@ static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID); #include "nsIWebShellServices.h" #include "plstr.h" #include "prenv.h" +#include "nslog.h" + +NS_IMPL_LOG(nsPICSElementObserverLog) +#define PRINTF NS_LOG_PRINTF(nsPICSElementObserverLog) +#define FLUSH NS_LOG_FLUSH(nsPICSElementObserverLog) //static NS_DEFINE_IID(kIObserverIID, NS_IOBSERVER_IID); //static NS_DEFINE_IID(kObserverCID, NS_OBSERVER_CID); @@ -146,7 +151,7 @@ NS_IMETHODIMP nsPICSElementObserver::Notify(PRUint32 aDocumentID, const nsString& theValue1=valueArray[0]; char *val1 = theValue1.ToNewCString(); if(theValue1.EqualsIgnoreCase("\"PICS-LABEL\"")) { - printf("\nReceived notification for a PICS-LABEl\n"); + PRINTF("\nReceived notification for a PICS-LABEL\n"); const nsString& theValue2=valueArray[1]; char *label = theValue2.ToNewCString(); if (valueArray[numOfAttributes]) { diff --git a/mozilla/extensions/psm-glue/src/nsFSDR.cpp b/mozilla/extensions/psm-glue/src/nsFSDR.cpp index 578ba31cc24..06fc5179c77 100644 --- a/mozilla/extensions/psm-glue/src/nsFSDR.cpp +++ b/mozilla/extensions/psm-glue/src/nsFSDR.cpp @@ -32,6 +32,11 @@ #include "nsIPSMComponent.h" #include "nsFSDR.h" +#include "nslog.h" + +NS_IMPL_LOG(nsFSDRLog) +#define PRINTF NS_LOG_PRINTF(nsFSDRLog) +#define FLUSH NS_LOG_FLUSH(nsFSDRLog) /********************************************************************************* **************************** MASTER PASSWORD FUNCTIONS *************************** @@ -73,7 +78,7 @@ Wallet_Localize(char* genericString) { (nsISupports**) &pNetService); if (NS_FAILED(ret)) { - printf("cannot get net service\n"); + PRINTF("cannot get net service\n"); return v.ToNewUnicode(); } nsIURI *url = nsnull; @@ -81,7 +86,7 @@ Wallet_Localize(char* genericString) { nsIURI *uri = nsnull; ret = pNetService->NewURI(PROPERTIES_URL, nsnull, &uri); if (NS_FAILED(ret)) { - printf("cannot create URI\n"); + PRINTF("cannot create URI\n"); nsServiceManager::ReleaseService(kIOServiceCID, pNetService); return v.ToNewUnicode(); } @@ -91,7 +96,7 @@ Wallet_Localize(char* genericString) { nsServiceManager::ReleaseService(kIOServiceCID, pNetService); if (NS_FAILED(ret)) { - printf("cannot create URL\n"); + PRINTF("cannot create URL\n"); return v.ToNewUnicode(); } @@ -100,7 +105,7 @@ Wallet_Localize(char* genericString) { ret = nsServiceManager::GetService(kStringBundleServiceCID, kIStringBundleServiceIID, (nsISupports**) &pStringService); if (NS_FAILED(ret)) { - printf("cannot get string service\n"); + PRINTF("cannot get string service\n"); NS_RELEASE(url); return v.ToNewUnicode(); } @@ -110,7 +115,7 @@ Wallet_Localize(char* genericString) { ret = url->GetSpec(&spec); NS_RELEASE(url); if (NS_FAILED(ret)) { - printf("cannot get url spec\n"); + PRINTF("cannot get url spec\n"); nsServiceManager::ReleaseService(kStringBundleServiceCID, pStringService); nsCRT::free(spec); return v.ToNewUnicode(); @@ -118,7 +123,7 @@ Wallet_Localize(char* genericString) { ret = pStringService->CreateBundle(spec, locale, &bundle); nsCRT::free(spec); if (NS_FAILED(ret)) { - printf("cannot create instance\n"); + PRINTF("cannot create instance\n"); nsServiceManager::ReleaseService(kStringBundleServiceCID, pStringService); return v.ToNewUnicode(); } @@ -131,7 +136,7 @@ Wallet_Localize(char* genericString) { ret = bundle->GetStringFromName(ptrtmp, &ptrv); NS_RELEASE(bundle); if (NS_FAILED(ret)) { - printf("cannot get string from name\n"); + PRINTF("cannot get string from name\n"); return v.ToNewUnicode(); } v = ptrv; diff --git a/mozilla/extensions/psm-glue/src/nsKeygenHandler.cpp b/mozilla/extensions/psm-glue/src/nsKeygenHandler.cpp index 5f1a5509b80..11572fb8430 100644 --- a/mozilla/extensions/psm-glue/src/nsKeygenHandler.cpp +++ b/mozilla/extensions/psm-glue/src/nsKeygenHandler.cpp @@ -35,6 +35,11 @@ #include "nsCrypto.h" #include "cmtcmn.h" #include "cmtjs.h" +#include "nslog.h" + +NS_IMPL_LOG(nsKeygenHandlerLog) +#define PRINTF NS_LOG_PRINTF(nsKeygenHandlerLog) +#define FLUSH NS_LOG_FLUSH(nsKeygenHandlerLog) //These defines are taken from the PKCS#11 spec #define CKM_RSA_PKCS_KEY_PAIR_GEN 0x00000000 @@ -228,7 +233,7 @@ nsKeygenFormProcessor::ProcessValue(nsIDOMHTMLElement *aElement, #ifdef DEBUG_javi char *name = aName.ToNewCString(); char *value = aValue.ToNewCString(); - printf("ProcessValue: name %s value %s\n", name, value); + PRINTF("ProcessValue: name %s value %s\n", name, value); delete [] name; delete [] value; #endif diff --git a/mozilla/extensions/psm-glue/src/nsPSMComponent.cpp b/mozilla/extensions/psm-glue/src/nsPSMComponent.cpp index 289c9014a44..8f8c7461601 100644 --- a/mozilla/extensions/psm-glue/src/nsPSMComponent.cpp +++ b/mozilla/extensions/psm-glue/src/nsPSMComponent.cpp @@ -74,6 +74,11 @@ #define PSM_FILE_NAME "psm" #endif +#include "nslog.h" + +NS_IMPL_LOG(nsPSMComponentLog) +#define PRINTF NS_LOG_PRINTF(nsPSMComponentLog) +#define FLUSH NS_LOG_FLUSH(nsPSMComponentLog) static NS_DEFINE_CID(kCStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID); static NS_DEFINE_CID(kProfileCID, NS_PROFILE_CID); @@ -627,9 +632,7 @@ nsPSMComponent::GetControlConnection( CMT_CONTROL * *_retval ) } failure: -#ifdef DEBUG - printf("*** Failure setting up Cartman! \n"); -#endif + PRINTF("*** Failure setting up Cartman! \n"); if (mControl) { diff --git a/mozilla/extensions/psm-glue/src/nsSecureBrowserUIImpl.cpp b/mozilla/extensions/psm-glue/src/nsSecureBrowserUIImpl.cpp index f17ef1cb21e..39d85e5696f 100644 --- a/mozilla/extensions/psm-glue/src/nsSecureBrowserUIImpl.cpp +++ b/mozilla/extensions/psm-glue/src/nsSecureBrowserUIImpl.cpp @@ -67,6 +67,11 @@ #include "cmtcmn.h" #include "rsrcids.h" #include "nsSSLIOLayer.h" +#include "nslog.h" + +NS_IMPL_LOG(nsSecureBrowserUIImplLog) +#define PRINTF NS_LOG_PRINTF(nsSecureBrowserUIImplLog) +#define FLUSH NS_LOG_FLUSH(nsSecureBrowserUIImplLog) static NS_DEFINE_CID(kCStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID); static NS_DEFINE_CID(kCommonDialogsCID, NS_CommonDialog_CID ); @@ -86,13 +91,13 @@ static NS_DEFINE_CID(kPrefCID, NS_PREF_CID); // // To enable logging (see prlog.h for full details): // -// set NSPR_LOG_MODULES=nsSecureBroswerUI:5 +// set NSPR_LOG_MODULES=gSecureDocLog:5 // set NSPR_LOG_FILE=nspr.log // // this enables PR_LOG_DEBUG level information and places all output in // the file nspr.log // -PRLogModuleInfo* gSecureDocLog = nsnull; +NS_IMPL_LOG(gSecureDocLog); #endif /* PR_LOGGING */ @@ -129,13 +134,6 @@ nsSecureBrowserUIImpl::nsSecureBrowserUIImpl() { NS_INIT_REFCNT(); -#if defined(PR_LOGGING) - if (nsnull == gSecureDocLog) { - gSecureDocLog = PR_NewLogModule("nsSecureBroswerUI"); - } -#endif /* PR_LOGGING */ - - mIsSecureDocument = mMixContentAlertShown = mIsDocumentBroken = PR_FALSE; mLastPSMStatus = nsnull; mCurrentURI = nsnull; @@ -516,7 +514,7 @@ nsSecureBrowserUIImpl::OnSecurityChange(nsIWebProgress *aWebProgress, nsXPIDLCString temp; aURI->GetSpec(getter_Copies(temp)); - printf("OnSecurityChange: (%x) %s\n", state, (const char*)temp); + PRINTF("OnSecurityChange: (%x) %s\n", state, (const char*)temp); #endif diff --git a/mozilla/extensions/wallet/src/nsWalletService.cpp b/mozilla/extensions/wallet/src/nsWalletService.cpp index 207b0969b40..165fd0fa9e5 100644 --- a/mozilla/extensions/wallet/src/nsWalletService.cpp +++ b/mozilla/extensions/wallet/src/nsWalletService.cpp @@ -43,6 +43,11 @@ #include "nsINetSupportDialogService.h" #include "nsIInterfaceRequestor.h" #include "nsIPrompt.h" +#include "nslog.h" + +NS_IMPL_LOG(nsWalletServiceLog) +#define PRINTF NS_LOG_PRINTF(nsWalletServiceLog) +#define FLUSH NS_LOG_FLUSH(nsWalletServiceLog) static NS_DEFINE_IID(kDocLoaderServiceCID, NS_DOCUMENTLOADER_SERVICE_CID); static NS_DEFINE_CID(kNetSupportDialogCID, NS_NETSUPPORTDIALOG_CID); @@ -57,9 +62,7 @@ nsWalletlibService::nsWalletlibService() nsWalletlibService::~nsWalletlibService() { -#ifdef DEBUG_dp - printf("Wallet Service destroyed successfully.\n"); -#endif /* DEBUG_dp */ + PRINTF("Wallet Service destroyed successfully.\n"); } NS_IMPL_THREADSAFE_ISUPPORTS5(nsWalletlibService, diff --git a/mozilla/extensions/wallet/src/wallet.cpp b/mozilla/extensions/wallet/src/wallet.cpp index b09e2183938..c0b77842fbd 100644 --- a/mozilla/extensions/wallet/src/wallet.cpp +++ b/mozilla/extensions/wallet/src/wallet.cpp @@ -55,6 +55,11 @@ #include "nsISecurityManagerComponent.h" #include "nsIWalletService.h" +#include "nslog.h" + +NS_IMPL_LOG(walletLog) +#define PRINTF NS_LOG_PRINTF(walletLog) +#define FLUSH NS_LOG_FLUSH(walletLog) #ifdef DEBUG_morse #define morseAssert NS_ASSERTION @@ -80,14 +85,14 @@ static NS_DEFINE_IID(kStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID); #include "prlong.h" #include "prinrval.h" -#include "prlog.h" +#include "nslog.h" // // To enable logging (see prlog.h for full details): // -// set NSPR_LOG_MODULES=nsWallet:5 +// set NSPR_LOG_MODULES=gWalletLog:5 // set NSPR_LOG_FILE=nspr.log // -PRLogModuleInfo* gWalletLog = nsnull; +NS_IMPL_LOG(gWalletLog); /********************************************************/ @@ -369,8 +374,6 @@ nsresult NS_NewURItoFile(const char *in, nsFileSpec dirSpec, const char *out) { nsresult rv; - if (gWalletLog == nsnull) - gWalletLog = PR_NewLogModule ("nsWallet"); nsCOMPtr serv = do_GetService(kIOServiceCID, &rv); if (NS_FAILED(rv)) return rv; @@ -384,9 +387,7 @@ NS_NewURItoFile(const char *in, nsFileSpec dirSpec, const char *out) // Async reading thru the calls of the event sink interface rv = NS_OpenURI(getter_AddRefs(pChannel), pURL, serv); if (NS_FAILED(rv)) { -#ifdef DEBUG - printf("ERROR: NewChannelFromURI failed for %s\n", in); -#endif + PRINTF("ERROR: NewChannelFromURI failed for %s\n", in); return rv; } @@ -502,12 +503,12 @@ nsIURI * wallet_lastUrl = NULL; static void wallet_Pause(){ - fprintf(stdout,"%cpress y to continue\n", '\007'); + PRINTF("%cpress y to continue\n", '\007'); char c; for (;;) { c = getchar(); if (tolower(c) == 'y') { - fprintf(stdout,"OK\n"); + PRINTF("OK\n"); break; } } @@ -520,7 +521,7 @@ static void wallet_DumpAutoString(const nsString& as){ char s[100]; as.ToCString(s, sizeof(s)); - fprintf(stdout, "%s\n", s); + PRINTF("%s\n", s); } static void @@ -534,13 +535,13 @@ wallet_Dump(nsVoidArray * list) { ptr = NS_STATIC_CAST(wallet_MapElement*, list->ElementAt(i)); ptr->item1.ToCString(item1, sizeof(item1)); ptr->item2.ToCString(item2, sizeof(item2)); - fprintf(stdout, "%s %s \n", item1, item2); + PRINTF("%s %s \n", item1, item2); wallet_Sublist * ptr1; PRInt32 count2 = LIST_COUNT(ptr->itemList); for (PRInt32 i2=0; i2itemList->ElementAt(i2)); ptr1->item.ToCString(item, sizeof(item)); - fprintf(stdout, " %s \n", item); + PRINTF(" %s \n", item); } } wallet_Pause(); @@ -574,7 +575,7 @@ wallet_DumpTiming() { LL_I2L(r2, 100); LL_DIV(r3, r1, r2); LL_L2I(r4, r3); - fprintf(stdout, "time %c = %ld\n", timingID[i], (long)r4); + PRINTF("time %c = %ld\n", timingID[i], (long)r4); if (i%20 == 0) { wallet_Pause(); } @@ -632,7 +633,7 @@ wallet_DumpStopwatch() { LL_I2L(r1, 100); LL_DIV(r2, stopwatch, r1); LL_L2I(r3, r2); - fprintf(stdout, "stopwatch = %ld\n", (long)r3); + PRINTF("stopwatch = %ld\n", (long)r3); } #endif /* DEBUG */ @@ -651,18 +652,14 @@ Wallet_Localize(char* genericString) { /* create a bundle for the localization */ nsCOMPtr pStringService = do_GetService(kStringBundleServiceCID, &ret); if (NS_FAILED(ret)) { -#ifdef DEBUG - printf("cannot get string service\n"); -#endif + PRINTF("cannot get string service\n"); return v.ToNewUnicode(); } nsCOMPtr locale; nsCOMPtr bundle; ret = pStringService->CreateBundle(PROPERTIES_URL, locale, getter_AddRefs(bundle)); if (NS_FAILED(ret)) { -#ifdef DEBUG - printf("cannot create instance\n"); -#endif + PRINTF("cannot create instance\n"); return v.ToNewUnicode(); } @@ -672,9 +669,7 @@ Wallet_Localize(char* genericString) { PRUnichar *ptrv = nsnull; ret = bundle->GetStringFromName(ptrtmp, &ptrv); if (NS_FAILED(ret)) { -#ifdef DEBUG - printf("cannot get string from name\n"); -#endif + PRINTF("cannot get string from name\n"); return v.ToNewUnicode(); } v = ptrv; @@ -2414,7 +2409,7 @@ wallet_Initialize(PRBool fetchTables, PRBool unlockDatabase=PR_TRUE) { //wallet_PauseStopwatch(); //wallet_DumpStopwatch(); #endif -// printf("******** start profile\n"); +// PRINTF("******** start profile\n"); // ProfileStart(); wallet_Clear(&wallet_FieldToSchema_list); /* otherwise we will duplicate the list */ @@ -2429,7 +2424,7 @@ wallet_Initialize(PRBool fetchTables, PRBool unlockDatabase=PR_TRUE) { wallet_ReadFromFile(schemaConcatFileName, wallet_SchemaConcat_list, PR_FALSE); // ProfileStop(); -// printf("****** end profile\n"); +// PRINTF("****** end profile\n"); wallet_tablesInitialized = PR_TRUE; } @@ -2454,24 +2449,24 @@ wallet_Initialize(PRBool fetchTables, PRBool unlockDatabase=PR_TRUE) { } #if DEBUG -// fprintf(stdout,"Field to Schema table \n"); +// PRINTF("Field to Schema table \n"); // wallet_Dump(wallet_FieldToSchema_list); -// fprintf(stdout,"SchemaConcat table \n"); +// PRINTF("SchemaConcat table \n"); // wallet_Dump(wallet_SchemaConcat_list); -// fprintf(stdout,"URL Field to Schema table \n"); +// PRINTF("URL Field to Schema table \n"); // char item1[100]; // wallet_MapElement * ptr; // PRInt32 count = LIST_COUNT(wallet_URLFieldToSchema_list); // for (PRInt32 i=0; iElementAt(i)); // ptr->item1.ToCString(item1, 100); -// fprintf(stdout, item1); -// fprintf(stdout,"\n"); +// PRINTF(item1); +// PRINTF("\n"); // wallet_Dump(ptr->itemList); // } -// fprintf(stdout,"Schema to Value table \n"); +// PRINTF("Schema to Value table \n"); // wallet_Dump(wallet_SchemaToValue_list); #endif @@ -2524,7 +2519,7 @@ wallet_InitializeCurrentURL(nsIDocument * doc) { } } #ifdef DEBUG -// fprintf(stdout,"specific URL Field to Schema table \n"); +// PRINTF("specific URL Field to Schema table \n"); // wallet_Dump(wallet_specificURLFieldToSchema_list); #endif } diff --git a/mozilla/gfx/src/beos/nsDeviceContextBeOS.cpp b/mozilla/gfx/src/beos/nsDeviceContextBeOS.cpp index 6961cc5b55e..07e65d83e76 100644 --- a/mozilla/gfx/src/beos/nsDeviceContextBeOS.cpp +++ b/mozilla/gfx/src/beos/nsDeviceContextBeOS.cpp @@ -34,6 +34,11 @@ #include #include +#include "nslog.h" + +NS_IMPL_LOG(nsDeviceContextBeOSLog) +#define PRINTF NS_LOG_PRINTF(nsDeviceContextBeOSLog) +#define FLUSH NS_LOG_FLUSH(nsDeviceContextBeOSLog) static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); static NS_DEFINE_IID(kDeviceContextIID, NS_IDEVICE_CONTEXT_IID); @@ -80,7 +85,7 @@ NS_IMETHODIMP nsDeviceContextBeOS::Init(nsNativeWidget aNativeWidget) NS_IMETHODIMP nsDeviceContextBeOS::CreateRenderingContext(nsIRenderingContext *&aContext) { -printf("nsDeviceContextBeOS::CreateRenderingContext - FIXME: not implemented\n"); + PRINTF("nsDeviceContextBeOS::CreateRenderingContext - FIXME: not implemented\n"); return NS_ERROR_FAILURE; } @@ -220,7 +225,7 @@ NS_IMETHODIMP nsDeviceContextBeOS::CheckFontExistence(const nsString& aFontName) } } - //printf("%s there? %s\n", cStr, isthere?"Yes":"No" ); + //PRINTF("%s there? %s\n", cStr, isthere?"Yes":"No" ); delete[] cStr; diff --git a/mozilla/gfx/src/beos/nsDrawingSurfaceBeOS.cpp b/mozilla/gfx/src/beos/nsDrawingSurfaceBeOS.cpp index 68705324fb5..45498b95ae2 100644 --- a/mozilla/gfx/src/beos/nsDrawingSurfaceBeOS.cpp +++ b/mozilla/gfx/src/beos/nsDrawingSurfaceBeOS.cpp @@ -22,6 +22,11 @@ #include "nsDrawingSurfaceBeOS.h" #include "prmem.h" +#include "nslog.h" + +NS_IMPL_LOG(nsDrawingSurfaceBeOSLog) +#define PRINTF NS_LOG_PRINTF(nsDrawingSurfaceBeOSLog) +#define FLUSH NS_LOG_FLUSH(nsDrawingSurfaceBeOSLog) static NS_DEFINE_IID(kIDrawingSurfaceIID, NS_IDRAWING_SURFACE_IID); @@ -148,7 +153,7 @@ NS_IMETHODIMP nsDrawingSurfaceBeOS :: Lock(PRInt32 aX, PRInt32 aY, mLockFlags = aFlags; #endif mView->LockLooper(); -printf("nsDrawingSurfaceBeOS :: Lock not implemented\n"); + PRINTF("nsDrawingSurfaceBeOS :: Lock not implemented\n"); return NS_OK; } @@ -156,7 +161,7 @@ printf("nsDrawingSurfaceBeOS :: Lock not implemented\n"); NS_IMETHODIMP nsDrawingSurfaceBeOS :: Unlock(void) { mView->UnlockLooper(); -printf("nsDrawingSurfaceBeOS :: Unlock not implemented\n"); + PRINTF("nsDrawingSurfaceBeOS :: Unlock not implemented\n"); return NS_OK; #if 0 diff --git a/mozilla/gfx/src/beos/nsFontMetricsBeOS.cpp b/mozilla/gfx/src/beos/nsFontMetricsBeOS.cpp index 981469c7b35..21d324df8a1 100644 --- a/mozilla/gfx/src/beos/nsFontMetricsBeOS.cpp +++ b/mozilla/gfx/src/beos/nsFontMetricsBeOS.cpp @@ -23,6 +23,11 @@ #include "xp_core.h" #include "nsFontMetricsBeOS.h" #include "nspr.h" +#include "nslog.h" + +NS_IMPL_LOG(nsFontMetricsBeOSLog) +#define PRINTF NS_LOG_PRINTF(nsFontMetricsBeOSLog) +#define FLUSH NS_LOG_FLUSH(nsFontMetricsBeOSLog) #undef NOISY_FONTS #undef REALLY_NOISY_FONTS @@ -129,9 +134,7 @@ NS_IMETHODIMP nsFontMetricsBeOS::Init(const nsFont& aFont, nsIAtom* aLangGroup, mFontHandle.SetSize( rounded * app2dev ); #ifdef NOISY_FONTS -#ifdef DEBUG - fprintf(stderr, "looking for font %s (%d)", wildstring, aFont.size / 20); -#endif + PRINTF("looking for font %s (%d)", wildstring, aFont.size / 20); #endif RealizeFont(aContext); diff --git a/mozilla/gfx/src/beos/nsImageBeOS.cpp b/mozilla/gfx/src/beos/nsImageBeOS.cpp index 284a084a57b..f3331bf6b6a 100644 --- a/mozilla/gfx/src/beos/nsImageBeOS.cpp +++ b/mozilla/gfx/src/beos/nsImageBeOS.cpp @@ -24,6 +24,11 @@ #include "nsRenderingContextBeOS.h" #include "nspr.h" #include +#include "nslog.h" + +NS_IMPL_LOG(nsImageBeOSLog) +#define PRINTF NS_LOG_PRINTF(nsImageBeOSLog) +#define FLUSH NS_LOG_FLUSH(nsImageBeOSLog) #define IsFlagSet(a,b) (a & b) @@ -133,7 +138,7 @@ nsresult mAlphaBits = nsnull; mAlphaWidth = 0; mAlphaHeight = 0; -printf("nsImageBeOS::Init: 8 bit image mask unimplemented\n"); + PRINTF("nsImageBeOS::Init: 8 bit image mask unimplemented\n"); break; } @@ -224,27 +229,27 @@ nsImageBeOS::GetAlphaLineStride() nsIImage* nsImageBeOS::DuplicateImage() { - printf("nsImageBeOS::DuplicateImage - FIXME: not implamented\n"); + PRINTF("nsImageBeOS::DuplicateImage - FIXME: not implamented\n"); return nsnull; } void nsImageBeOS::SetAlphaLevel(PRInt32 aAlphaLevel) { - printf("nsImageBeOS::SetAlphaLevel - FIXME: not implamented\n"); + PRINTF("nsImageBeOS::SetAlphaLevel - FIXME: not implamented\n"); } PRInt32 nsImageBeOS::GetAlphaLevel() { - printf("nsImageBeOS::GetAlphaLevel - FIXME: not implamented\n"); + PRINTF("nsImageBeOS::GetAlphaLevel - FIXME: not implamented\n"); return 0; } void nsImageBeOS::MoveAlphaMask(PRInt32 aX, PRInt32 aY) { - printf("nsImageBeOS::MoveAlphaMask - FIXME: not implamented\n"); + PRINTF("nsImageBeOS::MoveAlphaMask - FIXME: not implamented\n"); } //------------------------------------------------------------ diff --git a/mozilla/gfx/src/beos/nsRegionBeOS.cpp b/mozilla/gfx/src/beos/nsRegionBeOS.cpp index cc9f7339009..1517ac60d8c 100644 --- a/mozilla/gfx/src/beos/nsRegionBeOS.cpp +++ b/mozilla/gfx/src/beos/nsRegionBeOS.cpp @@ -24,6 +24,11 @@ #include "nsRegionBeOS.h" #include "prmem.h" +#include "nslog.h" + +NS_IMPL_LOG(nsRegionBeOSLog) +#define PRINTF NS_LOG_PRINTF(nsRegionBeOSLog) +#define FLUSH NS_LOG_FLUSH(nsRegionBeOSLog) static NS_DEFINE_IID(kRegionIID, NS_IREGION_IID); @@ -118,7 +123,7 @@ PRBool nsRegionBeOS :: IsEmpty(void) PRBool nsRegionBeOS :: IsEqual(const nsIRegion &aRegion) { - printf(" - nsRegionBeOS :: IsEqual not implemented!\n"); + PRINTF(" - nsRegionBeOS :: IsEqual not implemented!\n"); return PR_FALSE; } diff --git a/mozilla/gfx/src/beos/nsRenderingContextBeOS.cpp b/mozilla/gfx/src/beos/nsRenderingContextBeOS.cpp index 8df1d921138..451389e9434 100644 --- a/mozilla/gfx/src/beos/nsRenderingContextBeOS.cpp +++ b/mozilla/gfx/src/beos/nsRenderingContextBeOS.cpp @@ -24,6 +24,11 @@ #include "nsRegionBeOS.h" #include "nsGfxCIID.h" #include +#include "nslog.h" + +NS_IMPL_LOG(nsRenderingContextBeOSLog) +#define PRINTF NS_LOG_PRINTF(nsRenderingContextBeOSLog) +#define FLUSH NS_LOG_FLUSH(nsRenderingContextBeOSLog) #define NS_TO_GDK_RGB(ns) (ns & 0xff) << 16 | (ns & 0xff00) | ((ns >> 16) & 0xff) @@ -602,7 +607,7 @@ NS_IMETHODIMP nsRenderingContextBeOS::SetLineStyle(nsLineStyle aLineStyle) { if (aLineStyle != mCurrentLineStyle) { -printf("nsRenderingContextBeOS::SetLineStyle not implemented!\n"); + PRINTF("nsRenderingContextBeOS::SetLineStyle not implemented!\n"); #if 0 switch(aLineStyle) { @@ -1312,7 +1317,7 @@ nsRenderingContextBeOS::CopyOffScreenBits(nsDrawingSurface aSrcSurf, } } else - printf("nsRenderingContextBeOS::CopyOffScreenBits - FIXME: should render from surface without bitmap!?!?!\n"); + PRINTF("nsRenderingContextBeOS::CopyOffScreenBits - FIXME: should render from surface without bitmap!?!?!\n"); // NS_ASSERTION(0, "attempt to blit with bad BViews"); srcview->UnlockLooper(); diff --git a/mozilla/gfx/src/gtk/nsDeviceContextGTK.cpp b/mozilla/gfx/src/gtk/nsDeviceContextGTK.cpp index 5d45b401c52..553896fd57f 100644 --- a/mozilla/gfx/src/gtk/nsDeviceContextGTK.cpp +++ b/mozilla/gfx/src/gtk/nsDeviceContextGTK.cpp @@ -34,6 +34,11 @@ #include "nsGfxPSCID.h" #include "nsIDeviceContextPS.h" +#include "nslog.h" + +NS_IMPL_LOG(nsDeviceContextGTKLog) +#define PRINTF NS_LOG_PRINTF(nsDeviceContextGTKLog) +#define FLUSH NS_LOG_FLUSH(nsDeviceContextGTKLog) #ifdef USE_XPRINT #include "nsGfxXPrintCID.h" @@ -180,7 +185,7 @@ NS_IMETHODIMP nsDeviceContextGTK::Init(nsNativeWidget aNativeWidget) #ifdef DEBUG static PRBool once = PR_TRUE; if (once) { - printf("GFX: dpi=%d t2p=%g p2t=%g depth=%d\n", mDpi, mTwipsToPixels, mPixelsToTwips,mDepth); + PRINTF("GFX: dpi=%d t2p=%g p2t=%g depth=%d\n", mDpi, mTwipsToPixels, mPixelsToTwips,mDepth); once = PR_FALSE; } #endif diff --git a/mozilla/gfx/src/gtk/nsDrawingSurfaceGTK.cpp b/mozilla/gfx/src/gtk/nsDrawingSurfaceGTK.cpp index e08835cc975..8b886259e88 100644 --- a/mozilla/gfx/src/gtk/nsDrawingSurfaceGTK.cpp +++ b/mozilla/gfx/src/gtk/nsDrawingSurfaceGTK.cpp @@ -24,6 +24,11 @@ #include #include #include "nsDrawingSurfaceGTK.h" +#include "nslog.h" + +NS_IMPL_LOG(nsDrawingSurfaceGTKLog) +#define PRINTF NS_LOG_PRINTF(nsDrawingSurfaceGTKLog) +#define FLUSH NS_LOG_FLUSH(nsDrawingSurfaceGTKLog) NS_IMPL_ISUPPORTS2(nsDrawingSurfaceGTK, nsIDrawingSurface, nsIDrawingSurfaceGTK) @@ -148,7 +153,7 @@ NS_IMETHODIMP nsDrawingSurfaceGTK :: Lock(PRInt32 aX, PRInt32 aY, // MOZ_TIMER_STOP(mLockTime); // MOZ_TIMER_LOG(("Time taken to lock: ")); // MOZ_TIMER_PRINT(mLockTime); - printf("Time taken to lock: %d\n", PR_Now() - mLockTime); + PRINTF("Time taken to lock: %d\n", PR_Now() - mLockTime); #endif return NS_OK; @@ -195,7 +200,7 @@ NS_IMETHODIMP nsDrawingSurfaceGTK :: Unlock(void) #ifdef CHEAP_PERFORMANCE_MEASUREMENT - printf("Time taken to unlock: %d\n", PR_Now() - mUnlockTime); + PRINTF("Time taken to unlock: %d\n", PR_Now() - mUnlockTime); #endif return NS_OK; diff --git a/mozilla/gfx/src/gtk/nsFontMetricsGTK.cpp b/mozilla/gfx/src/gtk/nsFontMetricsGTK.cpp index 27a306b57f1..467e233acd8 100644 --- a/mozilla/gfx/src/gtk/nsFontMetricsGTK.cpp +++ b/mozilla/gfx/src/gtk/nsFontMetricsGTK.cpp @@ -32,6 +32,11 @@ #include "nsCOMPtr.h" #include "nspr.h" #include "nsHashtable.h" +#include "nslog.h" + +NS_IMPL_LOG(nsFontMetricsGTKLog) +#define PRINTF NS_LOG_PRINTF(nsFontMetricsGTKLog) +#define FLUSH NS_LOG_FLUSH(nsFontMetricsGTKLog) #include #include @@ -757,11 +762,7 @@ static PRBool FontEnumCallback(const nsString& aFamily, PRBool aGeneric, void *aData) { #ifdef REALLY_NOISY_FONTS -#ifdef DEBUG - printf("font = '"); - fputs(aFamily, stdout); - printf("'\n"); -#endif + PRINTF("font = '%s'\n", aFamily); #endif if (!IsASCIIFontName(aFamily)) { @@ -945,9 +946,7 @@ void nsFontMetricsGTK::RealizeFont() { mXHeight = nscoord(pr * f); #ifdef REALLY_NOISY_FONTS -#ifdef DEBUG - printf("xHeight=%d\n", mXHeight); -#endif + PRINTF("xHeight=%d\n", mXHeight); #endif } } @@ -958,9 +957,7 @@ void nsFontMetricsGTK::RealizeFont() * fonts served by xfsft (not xfstt!) */ mUnderlineOffset = -NSToIntRound(pr * f); #ifdef REALLY_NOISY_FONTS -#ifdef DEBUG - printf("underlineOffset=%d\n", mUnderlineOffset); -#endif + PRINTF("underlineOffset=%d\n", mUnderlineOffset); #endif } else @@ -976,9 +973,7 @@ void nsFontMetricsGTK::RealizeFont() /* this will only be provided from adobe .afm fonts */ mUnderlineSize = nscoord(MAX(f, NSToIntRound(pr * f))); #ifdef REALLY_NOISY_FONTS -#ifdef DEBUG - printf("underlineSize=%d\n", mUnderlineSize); -#endif + PRINTF("underlineSize=%d\n", mUnderlineSize); #endif } else @@ -992,9 +987,7 @@ void nsFontMetricsGTK::RealizeFont() { mSuperscriptOffset = nscoord(MAX(f, NSToIntRound(pr * f))); #ifdef REALLY_NOISY_FONTS -#ifdef DEBUG - printf("superscriptOffset=%d\n", mSuperscriptOffset); -#endif + PRINTF("superscriptOffset=%d\n", mSuperscriptOffset); #endif } else @@ -1006,9 +999,7 @@ void nsFontMetricsGTK::RealizeFont() { mSubscriptOffset = nscoord(MAX(f, NSToIntRound(pr * f))); #ifdef REALLY_NOISY_FONTS -#ifdef DEBUG - printf("subscriptOffset=%d\n", mSubscriptOffset); -#endif + PRINTF("subscriptOffset=%d\n", mSubscriptOffset); #endif } else @@ -1397,7 +1388,7 @@ CheckMap(nsFontCharSetMap* aEntry) res = gCharSetManager->GetUnicodeEncoder(charset, getter_AddRefs(converter)); if (NS_FAILED(res)) { - printf("=== %s failed (%s)\n", aEntry->mInfo->mCharSet, __FILE__); + PRINTF("=== %s failed (%s)\n", aEntry->mInfo->mCharSet, __FILE__); } } } @@ -1502,11 +1493,11 @@ static char* gDumpStyles[3] = { "normal", "italic", "oblique" }; static PRIntn DumpCharSet(PLHashEntry* he, PRIntn i, void* arg) { - printf(" %s\n", (char*) he->key); + PRINTF(" %s\n", (char*) he->key); nsFontCharSet* charSet = (nsFontCharSet*) he->value; for (int sizeIndex = 0; sizeIndex < charSet->mSizesCount; sizeIndex++) { nsFontGTK* size = &charSet->mSizes[sizeIndex]; - printf(" %d %s\n", size->mSize, size->mName); + PRINTF(" %d %s\n", size->mSize, size->mName); } return HT_ENUMERATE_NEXT; } @@ -1517,15 +1508,15 @@ DumpFamily(nsFontFamily* aFamily) for (int styleIndex = 0; styleIndex < 3; styleIndex++) { nsFontStyle* style = aFamily->mStyles[styleIndex]; if (style) { - printf(" style: %s\n", gDumpStyles[styleIndex]); + PRINTF(" style: %s\n", gDumpStyles[styleIndex]); for (int weightIndex = 0; weightIndex < 8; weightIndex++) { nsFontWeight* weight = style->mWeights[weightIndex]; if (weight) { - printf(" weight: %d\n", (weightIndex + 1) * 100); + PRINTF(" weight: %d\n", (weightIndex + 1) * 100); for (int stretchIndex = 0; stretchIndex < 9; stretchIndex++) { nsFontStretch* stretch = weight->mStretches[stretchIndex]; if (stretch) { - printf(" stretch: %d\n", stretchIndex + 1); + PRINTF(" stretch: %d\n", stretchIndex + 1); PL_HashTableEnumerateEntries(stretch->mCharSets, DumpCharSet, nsnull); } @@ -1541,7 +1532,7 @@ DumpFamilyEnum(PLHashEntry* he, PRIntn i, void* arg) { char buf[256]; ((nsString*) he->key)->ToCString(buf, sizeof(buf)); - printf("family: %s\n", buf); + PRINTF("family: %s\n", buf); nsFontFamily* family = (nsFontFamily*) he->value; DumpFamily(family); @@ -1656,7 +1647,7 @@ nsFontGTK::LoadFont(void) #ifdef NS_FONT_DEBUG_LOAD_FONT if (gDebug & NS_FONT_DEBUG_LOAD_FONT) { - printf("loaded %s\n", mName); + PRINTF("loaded %s\n", mName); } #endif @@ -1664,7 +1655,7 @@ nsFontGTK::LoadFont(void) #ifdef NS_FONT_DEBUG_LOAD_FONT else if (gDebug & NS_FONT_DEBUG_LOAD_FONT) { - printf("cannot load %s\n", mName); + PRINTF("cannot load %s\n", mName); } #endif @@ -2502,7 +2493,7 @@ GetFontNames(char* aPattern, nsFontNodeArray* aNodes) { #ifdef NS_FONT_DEBUG_CALL_TRACE if (gDebug & NS_FONT_DEBUG_CALL_TRACE) { - printf("GetFontNames %s\n", aPattern); + PRINTF("GetFontNames %s\n", aPattern); } #endif @@ -2600,9 +2591,7 @@ GetFontNames(char* aPattern, nsFontNodeArray* aNodes) } if (!charSetInfo) { #ifdef NOISY_FONTS -#ifdef DEBUG - printf("cannot find charset %s\n", charSetName); -#endif + PRINTF("cannot find charset %s\n", charSetName); #endif charSetInfo = &Unknown; } @@ -2615,9 +2604,7 @@ GetFontNames(char* aPattern, nsFontNodeArray* aNodes) &charSetInfo->mLangGroup); if (NS_FAILED(res)) { #ifdef NOISY_FONTS -#ifdef DEBUG - printf("=== cannot get lang group for %s\n", charSetInfo->mCharSet); -#endif + PRINTF("=== cannot get lang group for %s\n", charSetInfo->mCharSet); #endif } } @@ -2683,9 +2670,7 @@ GetFontNames(char* aPattern, nsFontNodeArray* aNodes) int weightNumber = (int) gWeights->Get(&weightKey); if (!weightNumber) { #ifdef NOISY_FONTS -#ifdef DEBUG - printf("cannot find weight %s\n", weightName); -#endif + PRINTF("cannot find weight %s\n", weightName); #endif weightNumber = NS_FONT_WEIGHT_NORMAL; } @@ -2703,9 +2688,7 @@ GetFontNames(char* aPattern, nsFontNodeArray* aNodes) int stretchIndex = (int) gStretches->Get(&setWidthKey); if (!stretchIndex) { #ifdef NOISY_FONTS -#ifdef DEBUG - printf("cannot find stretch %s\n", setWidth); -#endif + PRINTF("cannot find stretch %s\n", setWidth); #endif stretchIndex = 5; } @@ -3129,16 +3112,16 @@ nsFontMetricsGTK::FindFont(PRUnichar aChar) #ifdef NS_FONT_DEBUG_CALL_TRACE if (gDebug & NS_FONT_DEBUG_CALL_TRACE) { - printf("FindFont(%04X)[", aChar); + PRINTF("FindFont(%04X)[", aChar); for (PRInt32 i = 0; i < mFonts.Count(); i++) { - printf("%s, ", mFonts.CStringAt(i)->GetBuffer()); + PRINTF("%s, ", mFonts.CStringAt(i)->GetBuffer()); } - printf("]\nreturns "); + PRINTF("]\nreturns "); if (font) { - printf("%s\n", font->mName ? font->mName : "(substitute)"); + PRINTF("%s\n", font->mName ? font->mName : "(substitute)"); } else { - printf("NULL\n"); + PRINTF("NULL\n"); } } #endif diff --git a/mozilla/gfx/src/gtk/nsGCCache.cpp b/mozilla/gfx/src/gtk/nsGCCache.cpp index 8b1475296f1..83432cdc082 100644 --- a/mozilla/gfx/src/gtk/nsGCCache.cpp +++ b/mozilla/gfx/src/gtk/nsGCCache.cpp @@ -28,6 +28,12 @@ #include #include #include +#include "nslog.h" + +NS_IMPL_LOG(nsGCCacheLog) +#define PRINTF NS_LOG_PRINTF(nsGCCacheLog) +#define FLUSH NS_LOG_FLUSH(nsGCCacheLog) + /* The GC cache is shared among all windows, since it doesn't hog any scarce resources (like colormap entries.) */ @@ -92,18 +98,18 @@ nsGCCache::~nsGCCache() void nsGCCache::ReportStats() { DEBUG_METER( - fprintf(stderr, "GC Cache:\n\thits:"); - int hits = 0; - for (int i = 0; i < GC_CACHE_SIZE; i++) { - fprintf(stderr, " %4d", GCCacheStats.hits[i]); - hits+=GCCacheStats.hits[i]; - } - int total = hits + GCCacheStats.misses; - float percent = float(float(hits) / float(total)); - percent *= 100; - fprintf(stderr, "\n\thits: %d, misses: %d, hit percent: %f%%\n", - hits, GCCacheStats.misses, percent); - ); + PRINTF("GC Cache:\n\thits:"); + int hits = 0; + for (int i = 0; i < GC_CACHE_SIZE; i++) { + PRINTF(" %4d", GCCacheStats.hits[i]); + hits+=GCCacheStats.hits[i]; + } + int total = hits + GCCacheStats.misses; + float percent = float(float(hits) / float(total)); + percent *= 100; + PRINTF("\n\thits: %d, misses: %d, hit percent: %f%%\n", + hits, GCCacheStats.misses, percent); + ); } GdkRegion * @@ -178,7 +184,7 @@ GdkGC *nsGCCache::GetGC(GdkWindow *window, GdkGCValues *gcv, GdkGCValuesMask fla entry->flags = flags; entry->gcv = *gcv; entry->clipRegion = NULL; - //printf("creating new gc=%X\n",entry->gc); + //PRINTF("creating new gc=%X\n",entry->gc); } else if ( ((GdkGCPrivate*)entry->gc)->ref_count > 1 ) { // Old GC still in use, create new @@ -187,7 +193,7 @@ GdkGC *nsGCCache::GetGC(GdkWindow *window, GdkGCValues *gcv, GdkGCValuesMask fla entry->flags = flags; entry->gcv = *gcv; entry->clipRegion = NULL; - //printf("creating new (use)gc=%X\n",entry->gc); + //PRINTF("creating new (use)gc=%X\n",entry->gc); } else { ReuseGC(entry, gcv, flags); diff --git a/mozilla/gfx/src/gtk/nsImageGTK.cpp b/mozilla/gfx/src/gtk/nsImageGTK.cpp index c46a473a5d7..a0a079e4efe 100644 --- a/mozilla/gfx/src/gtk/nsImageGTK.cpp +++ b/mozilla/gfx/src/gtk/nsImageGTK.cpp @@ -28,6 +28,11 @@ #include "nsRenderingContextGTK.h" #include "nspr.h" +#include "nslog.h" + +NS_IMPL_LOG(nsImageGTKLog) +#define PRINTF NS_LOG_PRINTF(nsImageGTKLog) +#define FLUSH NS_LOG_FLUSH(nsImageGTKLog) #define IsFlagSet(a,b) ((a) & (b)) @@ -73,7 +78,7 @@ nsImageGTK::nsImageGTK() mNaturalHeight = 0; #ifdef TRACE_IMAGE_ALLOCATION - printf("nsImageGTK::nsImageGTK(this=%p)\n", + PRINTF("nsImageGTK::nsImageGTK(this=%p)\n", this); #endif } @@ -105,7 +110,7 @@ nsImageGTK::~nsImageGTK() } #ifdef TRACE_IMAGE_ALLOCATION - printf("nsImageGTK::~nsImageGTK(this=%p)\n", + PRINTF("nsImageGTK::~nsImageGTK(this=%p)\n", this); #endif } @@ -157,7 +162,7 @@ nsresult nsImageGTK::Init(PRInt32 aWidth, PRInt32 aHeight, mIsTopToBottom = PR_TRUE; #ifdef TRACE_IMAGE_ALLOCATION - printf("nsImageGTK::Init(this=%p,%d,%d,%d,%d)\n", + PRINTF("nsImageGTK::Init(this=%p,%d,%d,%d,%d)\n", this, aWidth, aHeight, @@ -289,7 +294,7 @@ void nsImageGTK::ImageUpdated(nsIDeviceContext *aContext, nsRect *aUpdateRect) { #ifdef TRACE_IMAGE_ALLOCATION - printf("nsImageGTK::ImageUpdated(this=%p,%d)\n", + PRINTF("nsImageGTK::ImageUpdated(this=%p,%d)\n", this, aFlags); #endif @@ -312,7 +317,7 @@ nsImageGTK::Draw(nsIRenderingContext &aContext, nsDrawingSurface aSurface, #ifdef TRACE_IMAGE_ALLOCATION - printf("nsImageGTK::Draw(this=%p) (%d, %d, %d, %d), (%d, %d, %d, %d)\n", + PRINTF("nsImageGTK::Draw(this=%p) (%d, %d, %d, %d), (%d, %d, %d, %d)\n", this, aSX, aSY, aSWidth, aSHeight, aDX, aDY, aDWidth, aDHeight); @@ -397,7 +402,7 @@ nsImageGTK::DrawComposited32(PRBool isLSB, PRBool flipBytes, blueIndex = 3-blueIndex; } -// fprintf(stderr, "startX=%u startY=%u activeX=%u activeY=%u\n", +// PRINTF("startX=%u startY=%u activeX=%u activeY=%u\n", // startX, startY, activeX, activeY); // fprintf(stderr, "width=%u height=%u\n", ximage->width, ximage->height); @@ -711,9 +716,9 @@ nsImageGTK::DrawComposited(nsIRenderingContext &aContext, readHeight = surfaceHeight-readY; -// fprintf(stderr, "aX=%d aY=%d, aWidth=%u aHeight=%u\n", aX, aY, aWidth, aHeight); -// fprintf(stderr, "surfaceWidth=%u surfaceHeight=%u\n", surfaceWidth, surfaceHeight); -// fprintf(stderr, "readX=%u readY=%u readWidth=%u readHeight=%u destX=%u destY=%u\n\n", +// PRINTF("aX=%d aY=%d, aWidth=%u aHeight=%u\n", aX, aY, aWidth, aHeight); +// PRINTF("surfaceWidth=%u surfaceHeight=%u\n", surfaceWidth, surfaceHeight); +// PRINTF("readX=%u readY=%u readWidth=%u readHeight=%u destX=%u destY=%u\n\n", // readX, readY, readWidth, readHeight, destX, destY); XImage *ximage = XGetImage(dpy, drawable, @@ -848,7 +853,7 @@ void nsImageGTK::CreateOffscreenPixmap(PRInt32 aWidth, PRInt32 aHeight) // example: animated GIFs. if (!mImagePixmap) { #ifdef TRACE_IMAGE_ALLOCATION - printf("nsImageGTK::Draw(this=%p) gdk_pixmap_new(nsnull,width=%d,height=%d,depth=%d)\n", + PRINTF("nsImageGTK::Draw(this=%p) gdk_pixmap_new(nsnull,width=%d,height=%d,depth=%d)\n", this, aWidth, aHeight, mDepth); @@ -922,7 +927,7 @@ nsImageGTK::Draw(nsIRenderingContext &aContext, #ifdef TRACE_IMAGE_ALLOCATION - printf("nsImageGTK::Draw(this=%p,x=%d,y=%d,width=%d,height=%d)\n", + PRINTF("nsImageGTK::Draw(this=%p,x=%d,y=%d,width=%d,height=%d)\n", this, aX, aY, aWidth, aHeight); @@ -991,7 +996,7 @@ nsImageGTK::Draw(nsIRenderingContext &aContext, copyGC = ((nsRenderingContextGTK&)aContext).GetGC(); } #ifdef TRACE_IMAGE_ALLOCATION - printf("nsImageGTK::Draw(this=%p) gdk_draw_pixmap(x=%d,y=%d,width=%d,height=%d)\n", + PRINTF("nsImageGTK::Draw(this=%p) gdk_draw_pixmap(x=%d,y=%d,width=%d,height=%d)\n", this, validX+aX, validY+aY, @@ -1021,7 +1026,7 @@ nsImageGTK::Draw(nsIRenderingContext &aContext, #ifdef CHEAP_PERFORMANCE_MEASURMENT gEndTime = PR_Now(); - printf("nsImageGTK::Draw(this=%p,w=%d,h=%d) total=%lld pixmap=%lld, alpha=%lld, copy=%lld\n", + PRINTF("nsImageGTK::Draw(this=%p,w=%d,h=%d) total=%lld pixmap=%lld, alpha=%lld, copy=%lld\n", this, aWidth, aHeight, gEndTime - gStartTime, @@ -1059,7 +1064,7 @@ void nsImageGTK::TilePixmap(GdkPixmap *src, GdkPixmap *dest, // draw to destination window #ifdef DEBUG_TILING - printf("nsImageGTK::TilePixmap(..., %d, %d, %d, %d)\n", + PRINTF("nsImageGTK::TilePixmap(..., %d, %d, %d, %d)\n", destRect.x, destRect.y, destRect.width, destRect.height); #endif @@ -1088,11 +1093,11 @@ NS_IMETHODIMP nsImageGTK::DrawTile(nsIRenderingContext &aContext, nsRect &aTileRect) { #ifdef DEBUG_TILING - printf("nsImageGTK::DrawTile: mWidth=%d, mHeight=%d\n", mWidth, mHeight); - printf(" aSrcRect.width=%d, aSrcRect.height=%d\n", + PRINTF("nsImageGTK::DrawTile: mWidth=%d, mHeight=%d\n", mWidth, mHeight); + PRINTF(" aSrcRect.width=%d, aSrcRect.height=%d\n", aSrcRect.width, aSrcRect.height); - printf("nsImageGTK::DrawTile((src: %d, %d), (tile: %d,%d, %d, %d) %p\n", mWidth, mHeight, + PRINTF("nsImageGTK::DrawTile((src: %d, %d), (tile: %d,%d, %d, %d) %p\n", mWidth, mHeight, aTileRect.x, aTileRect.y, aTileRect.width, aTileRect.height, this); #endif @@ -1129,7 +1134,7 @@ NS_IMETHODIMP nsImageGTK::DrawTile(nsIRenderingContext &aContext, if ((partial) || (drawing->GetDepth() == 8) || (mAlphaDepth == 8)) { #ifdef DEBUG_TILING - printf("Warning: using slow tiling\n"); + PRINTF("Warning: using slow tiling\n"); #endif PRInt32 aY0 = aTileRect.y, aX0 = aTileRect.x, @@ -1201,8 +1206,8 @@ NS_IMETHODIMP nsImageGTK::DrawTile(nsIRenderingContext &aContext, const nsRect &aTileRect) { #ifdef DEBUG_TILING - printf("nsImageGTK::DrawTile: mWidth=%d, mHeight=%d\n", mWidth, mHeight); - printf("nsImageGTK::DrawTile((src: %d, %d), (tile: %d,%d, %d, %d) %p\n", aSXOffset, aSYOffset, + PRINTF("nsImageGTK::DrawTile: mWidth=%d, mHeight=%d\n", mWidth, mHeight); + PRINTF("nsImageGTK::DrawTile((src: %d, %d), (tile: %d,%d, %d, %d) %p\n", aSXOffset, aSYOffset, aTileRect.x, aTileRect.y, aTileRect.width, aTileRect.height, this); #endif @@ -1239,7 +1244,7 @@ NS_IMETHODIMP nsImageGTK::DrawTile(nsIRenderingContext &aContext, if ((partial) || (mAlphaDepth == 8)) { #ifdef DEBUG_TILING - printf("Warning: using slow tiling\n"); + PRINTF("Warning: using slow tiling\n"); #endif PRInt32 aY0 = aTileRect.y - aSYOffset, aX0 = aTileRect.x - aSXOffset, diff --git a/mozilla/gfx/src/gtk/nsRegionGTK.cpp b/mozilla/gfx/src/gtk/nsRegionGTK.cpp index 748e443f21b..659b9360e1b 100644 --- a/mozilla/gfx/src/gtk/nsRegionGTK.cpp +++ b/mozilla/gfx/src/gtk/nsRegionGTK.cpp @@ -25,6 +25,11 @@ #include "nsRegionGTK.h" #include "xregion.h" #include "prmem.h" +#include "nslog.h" + +NS_IMPL_LOG(nsRegionGTKLog) +#define PRINTF NS_LOG_PRINTF(nsRegionGTKLog) +#define FLUSH NS_LOG_FLUSH(nsRegionGTKLog) #ifdef DEBUG_REGIONS static int nRegions; @@ -39,7 +44,7 @@ nsRegionGTK::nsRegionGTK() #ifdef DEBUG_REGIONS ++nRegions; - printf("REGIONS+ = %i\n", nRegions); + PRINTF("REGIONS+ = %i\n", nRegions); #endif mRegion = nsnull; @@ -49,7 +54,7 @@ nsRegionGTK::~nsRegionGTK() { #ifdef DEBUG_REGIONS --nRegions; - printf("REGIONS- = %i\n", nRegions); + PRINTF("REGIONS- = %i\n", nRegions); #endif if (mRegion) diff --git a/mozilla/gfx/src/gtk/nsRenderingContextGTK.cpp b/mozilla/gfx/src/gtk/nsRenderingContextGTK.cpp index ca97cb1b9d0..dc7fd25f4db 100644 --- a/mozilla/gfx/src/gtk/nsRenderingContextGTK.cpp +++ b/mozilla/gfx/src/gtk/nsRenderingContextGTK.cpp @@ -30,6 +30,11 @@ #include "nsGCCache.h" #include #include "prmem.h" +#include "nslog.h" + +NS_IMPL_LOG(nsRenderingContextGTKLog) +#define PRINTF NS_LOG_PRINTF(nsRenderingContextGTKLog) +#define FLUSH NS_LOG_FLUSH(nsRenderingContextGTKLog) #define NS_TO_GDK_RGB(ns) (ns & 0xff) << 16 | (ns & 0xff00) | ((ns >> 16) & 0xff) @@ -397,7 +402,7 @@ static char * nsClipCombine_to_string(nsClipCombine aCombine) { #ifdef TRACE_SET_CLIP - printf("nsRenderingContextGTK::SetClipRect(x=%d,y=%d,w=%d,h=%d,%s)\n", + PRINTF("nsRenderingContextGTK::SetClipRect(x=%d,y=%d,w=%d,h=%d,%s)\n", trect.x, trect.y, trect.width, @@ -457,7 +462,7 @@ NS_IMETHODIMP nsRenderingContextGTK::SetClipRect(const nsRect& aRect, nsRect trect = aRect; #ifdef TRACE_SET_CLIP - printf("nsRenderingContextGTK::SetClipRect(%s)\n", + PRINTF("nsRenderingContextGTK::SetClipRect(%s)\n", nsClipCombine_to_string(aCombine)); #endif // TRACE_SET_CLIP @@ -602,7 +607,7 @@ NS_IMETHODIMP nsRenderingContextGTK::GetClipRegion(nsIRegion **aRegion) } } } else { - printf("null clip region, can't make a valid copy\n"); + PRINTF("null clip region, can't make a valid copy\n"); rv = NS_ERROR_FAILURE; } @@ -845,7 +850,7 @@ NS_IMETHODIMP nsRenderingContextGTK::DrawPolyline(const nsPoint aPoints[], PRInt mTranMatrix->TransformCoord(&p.x,&p.y); pts[i].x = p.x; pts[i].y = p.y; - printf("(%i,%i)\n", p.x, p.y); + PRINTF("(%i,%i)\n", p.x, p.y); } UpdateGC(); @@ -1578,7 +1583,7 @@ NS_IMETHODIMP nsRenderingContextGTK::DrawImage(nsIImage *aImage, // gdk_window_clear_area(mSurface->GetDrawable(), x, y, w, h); PRInt32 xx, yy, ww, hh; mClipRegion->GetBoundingBox(&xx,&yy,&ww,&hh); - printf("clip bounds: x = %i, y = %i, w = %i, h = %i\n", xx, yy, ww, hh); + PRINTF("clip bounds: x = %i, y = %i, w = %i, h = %i\n", xx, yy, ww, hh); nscolor color = mCurrentColor; SetColor(NS_RGB(255, 0, 0)); @@ -1609,7 +1614,7 @@ NS_IMETHODIMP nsRenderingContextGTK::DrawImage(nsIImage *aImage, #if 0 PRInt32 x, y, w, h; mClipRegion->GetBoundingBox(&x,&y,&w,&h); - printf("clip bounds: x = %i, y = %i, w = %i, h = %i\n", x, y, w, h); + PRINTF("clip bounds: x = %i, y = %i, w = %i, h = %i\n", x, y, w, h); // gdk_window_clear_area(mSurface->GetDrawable(), sr.x, sr.y, sr.width, sr.height); @@ -1693,21 +1698,21 @@ nsRenderingContextGTK::CopyOffScreenBits(nsDrawingSurface aSrcSurf, g_return_val_if_fail(mSurface != NULL, NS_ERROR_FAILURE); #if 0 - printf("nsRenderingContextGTK::CopyOffScreenBits()\nflags=\n"); + PRINTF("nsRenderingContextGTK::CopyOffScreenBits()\nflags=\n"); if (aCopyFlags & NS_COPYBITS_USE_SOURCE_CLIP_REGION) - printf("NS_COPYBITS_USE_SOURCE_CLIP_REGION\n"); + PRINTF("NS_COPYBITS_USE_SOURCE_CLIP_REGION\n"); if (aCopyFlags & NS_COPYBITS_XFORM_SOURCE_VALUES) - printf("NS_COPYBITS_XFORM_SOURCE_VALUES\n"); + PRINTF("NS_COPYBITS_XFORM_SOURCE_VALUES\n"); if (aCopyFlags & NS_COPYBITS_XFORM_DEST_VALUES) - printf("NS_COPYBITS_XFORM_DEST_VALUES\n"); + PRINTF("NS_COPYBITS_XFORM_DEST_VALUES\n"); if (aCopyFlags & NS_COPYBITS_TO_BACK_BUFFER) - printf("NS_COPYBITS_TO_BACK_BUFFER\n"); + PRINTF("NS_COPYBITS_TO_BACK_BUFFER\n"); - printf("\n"); + PRINTF("\n"); #endif if (aCopyFlags & NS_COPYBITS_TO_BACK_BUFFER) diff --git a/mozilla/gfx/src/mac/nsUnicodeMappingUtil.cpp b/mozilla/gfx/src/mac/nsUnicodeMappingUtil.cpp index 5df2d330ba7..3672ccdc10e 100644 --- a/mozilla/gfx/src/mac/nsUnicodeMappingUtil.cpp +++ b/mozilla/gfx/src/mac/nsUnicodeMappingUtil.cpp @@ -26,6 +26,12 @@ #include "nsUnicodeMappingUtil.h" #include "nsUnicodeFontMappingCache.h" #include "nsDeviceContextMac.h" +#include "nslog.h" + +NS_IMPL_LOG(nsUnicodeMappingUtilLog) +#define PRINTF NS_LOG_PRINTF(nsUnicodeMappingUtilLog) +#define FLUSH NS_LOG_FLUSH(nsUnicodeMappingUtilLog) + static NS_DEFINE_CID(kPrefCID, NS_PREF_CID); #define BAD_FONT_NUM -1 @@ -39,7 +45,7 @@ static int gUnicodeMappingUtilCount = 0; int PrefChangedCallback( const char* aPrefName, void* instance_data) { - //printf("PrefChangeCallback \n"); + //PRINTF("PrefChangeCallback \n"); nsUnicodeMappingUtil::GetSingleton()->Reset(); return 0; } @@ -334,7 +340,7 @@ PrefEnumCallback(const char* aName, void* aClosure) Self->mGenericFontMapping[script][type] = fontname; #ifdef DEBUG_ftang_font char* utf8 = fontname->ToNewUTF8String(); - printf("font %d %d %s= %s\n",script , type, aName,utf8); + PRINTF("font %d %d %s= %s\n",script , type, aName,utf8); Recycle(utf8); #endif } diff --git a/mozilla/gfx/src/motif/nsFontMetricsMotif.cpp b/mozilla/gfx/src/motif/nsFontMetricsMotif.cpp index 105d1cb510e..4a1c535d773 100644 --- a/mozilla/gfx/src/motif/nsFontMetricsMotif.cpp +++ b/mozilla/gfx/src/motif/nsFontMetricsMotif.cpp @@ -26,6 +26,11 @@ #include "nspr.h" #include "nsCRT.h" +#include "nslog.h" + +NS_IMPL_LOG(nsFontMetricsMotifLog) +#define PRINTF NS_LOG_PRINTF(nsFontMetricsMotifLog) +#define FLUSH NS_LOG_FLUSH(nsFontMetricsMotifLog) static NS_DEFINE_IID(kIFontMetricsIID, NS_IFONT_METRICS_IID); @@ -90,9 +95,7 @@ NS_IMETHODIMP nsFontMetricsMotif :: Init(const nsFont& aFont, nsIAtom* aLangGrou dpi = 100; #ifdef NOISY_FONTS -#ifdef DEBUG - fprintf(stderr, "looking for font %s (%d)", wildstring, aFont.size / 20); -#endif + PRINTF("looking for font %s (%d)", wildstring, aFont.size / 20); #endif //font properties we care about: @@ -163,9 +166,7 @@ NS_IMETHODIMP nsFontMetricsMotif :: Init(const nsFont& aFont, nsIAtom* aLangGrou mFontHandle = ::XLoadFont(dpy, nametouse); #ifdef NOISY_FONTS -#ifdef DEBUG - fprintf(stderr, " is: %s\n", nametouse); -#endif + PRINTF(" is: %s\n", nametouse); #endif ::XFreeFontInfo(fnames, fonts, numnames); @@ -175,9 +176,7 @@ NS_IMETHODIMP nsFontMetricsMotif :: Init(const nsFont& aFont, nsIAtom* aLangGrou //ack. we're in real trouble, go for fixed... #ifdef NOISY_FONTS -#ifdef DEBUG - fprintf(stderr, " is: %s\n", "fixed (final fallback)"); -#endif + PRINTF(" is: %s\n", "fixed (final fallback)"); #endif mFontHandle = ::XLoadFont(dpy, "fixed"); diff --git a/mozilla/gfx/src/motif/nsImageMotif.cpp b/mozilla/gfx/src/motif/nsImageMotif.cpp index e67bdb9c4c3..b4e5ab188b0 100644 --- a/mozilla/gfx/src/motif/nsImageMotif.cpp +++ b/mozilla/gfx/src/motif/nsImageMotif.cpp @@ -26,6 +26,11 @@ #include "nsDeviceContextMotif.h" #include "nspr.h" +#include "nslog.h" + +NS_IMPL_LOG(nsImageMotifLog) +#define PRINTF NS_LOG_PRINTF(nsImageMotifLog) +#define FLUSH NS_LOG_FLUSH(nsImageMotifLog) #define IsFlagSet(a,b) (a & b) @@ -384,12 +389,12 @@ void nsImageMotif::CreateImage(nsDrawingSurface aSurface) format = ZPixmap; } else { -printf("Format XYPixmap\n"); + PRINTF("Format XYPixmap\n"); format = XYPixmap; } #endif -/* printf("Width %d Height %d Visual Depth %d Image Depth %d\n", +/* PRINTF("Width %d Height %d Visual Depth %d Image Depth %d\n", mWidth, mHeight, motifdrawing->depth, mDepth); */ diff --git a/mozilla/gfx/src/nsRenderingContextImpl.cpp b/mozilla/gfx/src/nsRenderingContextImpl.cpp index 65e3f7c4a45..a422b3f30d0 100644 --- a/mozilla/gfx/src/nsRenderingContextImpl.cpp +++ b/mozilla/gfx/src/nsRenderingContextImpl.cpp @@ -26,7 +26,11 @@ #include "nsTransform2D.h" #include #include "il_util.h" +#include "nslog.h" +NS_IMPL_LOG(nsRenderingContextImplLog) +#define PRINTF NS_LOG_PRINTF(nsRenderingContextImplLog) +#define FLUSH NS_LOG_FLUSH(nsRenderingContextImplLog) const nsPoint *gPts; @@ -454,10 +458,10 @@ float fx,fy,smag; }else{ // draw the curve #ifdef DEBUGCURVE - printf("LINE 1- %d,%d %d,%d\n",NSToCoordRound(curve1.mAnc1.x),NSToCoordRound(curve1.mAnc1.y), - NSToCoordRound(curve1.mAnc1.x),NSToCoordRound(curve1.mAnc1.y)); - printf("LINE 2- %d,%d %d,%d\n",NSToCoordRound(curve1.mAnc2.x),NSToCoordRound(curve1.mAnc2.y), - NSToCoordRound(curve2.mAnc2.x),NSToCoordRound(curve2.mAnc2.y)); + PRINTF("LINE 1- %d,%d %d,%d\n",NSToCoordRound(curve1.mAnc1.x),NSToCoordRound(curve1.mAnc1.y), + NSToCoordRound(curve1.mAnc1.x),NSToCoordRound(curve1.mAnc1.y)); + PRINTF("LINE 2- %d,%d %d,%d\n",NSToCoordRound(curve1.mAnc2.x),NSToCoordRound(curve1.mAnc2.y), + NSToCoordRound(curve2.mAnc2.x),NSToCoordRound(curve2.mAnc2.y)); #endif aRenderingContext->DrawStdLine(NSToCoordRound(curve1.mAnc1.x),NSToCoordRound(curve1.mAnc1.y),NSToCoordRound(curve1.mAnc2.x),NSToCoordRound(curve1.mAnc2.y)); aRenderingContext->DrawStdLine(NSToCoordRound(curve1.mAnc2.x),NSToCoordRound(curve1.mAnc2.y),NSToCoordRound(curve2.mAnc2.x),NSToCoordRound(curve2.mAnc2.y)); @@ -472,10 +476,10 @@ float fx,fy,smag; void QBezierCurve::DebugPrint() { - printf("CURVE COORDINATES\n"); - printf("Anchor 1 %f %f\n",mAnc1.x,mAnc1.y); - printf("Control %f %f\n",mCon.x,mCon.y); - printf("Anchor %f %f\n",mAnc2.x,mAnc2.y); + PRINTF("CURVE COORDINATES\n"); + PRINTF("Anchor 1 %f %f\n",mAnc1.x,mAnc1.y); + PRINTF("Control %f %f\n",mCon.x,mCon.y); + PRINTF("Anchor %f %f\n",mAnc2.x,mAnc2.y); } @@ -510,10 +514,10 @@ float fx,fy,smag; aThePoints[(*aNumPts)++].MoveTo(NSToCoordRound(curve2.mAnc2.x),NSToCoordRound(curve2.mAnc2.y)); #ifdef DEBUGCURVE - printf("LINE 1- %d,%d %d,%d\n",NSToCoordRound(curve1.mAnc1.x),NSToCoordRound(curve1.mAnc1.y), - NSToCoordRound(curve1.mAnc1.x),NSToCoordRound(curve1.mAnc1.y)); - printf("LINE 2- %d,%d %d,%d\n",NSToCoordRound(curve1.mAnc2.x),NSToCoordRound(curve1.mAnc2.y), - NSToCoordRound(curve2.mAnc2.x),NSToCoordRound(curve2.mAnc2.y)); + PRINTF("LINE 1- %d,%d %d,%d\n",NSToCoordRound(curve1.mAnc1.x),NSToCoordRound(curve1.mAnc1.y), + NSToCoordRound(curve1.mAnc1.x),NSToCoordRound(curve1.mAnc1.y)); + PRINTF("LINE 2- %d,%d %d,%d\n",NSToCoordRound(curve1.mAnc2.x),NSToCoordRound(curve1.mAnc2.y), + NSToCoordRound(curve2.mAnc2.x),NSToCoordRound(curve2.mAnc2.y)); #endif } diff --git a/mozilla/gfx/src/os2/nsDeviceContextOS2.cpp b/mozilla/gfx/src/os2/nsDeviceContextOS2.cpp index 6c615d3089c..a126e4401d9 100644 --- a/mozilla/gfx/src/os2/nsDeviceContextOS2.cpp +++ b/mozilla/gfx/src/os2/nsDeviceContextOS2.cpp @@ -34,6 +34,11 @@ #include "nsHashTable.h" // For CreateFontAliasTable() #include "nsGfxDefs.h" +#include "nslog.h" + +NS_IMPL_LOG(nsDeviceContextOS2Log) +#define PRINTF NS_LOG_PRINTF(nsDeviceContextOS2Log) +#define FLUSH NS_LOG_FLUSH(nsDeviceContextOS2Log) // Size of the color cube #define COLOR_CUBE_SIZE 216 @@ -166,8 +171,8 @@ nsresult nsDeviceContextOS2::Init( nsNativeDeviceContext aContext, mWidth = hcinfo.xPels; mHeight = hcinfo.yPels; // XXX hsb says there are margin problems, must be from here... - printf( "Got surface of size %d x %d pixels\n", mWidth, mHeight); - printf( "mPixelScale = %f\n", mPixelScale); + PRINTF("Got surface of size %d x %d pixels\n", mWidth, mHeight); + PRINTF("mPixelScale = %f\n", mPixelScale); // We need to begin a document now, because the client is entitled at // this point to do stuff like create fonts, which required the PS to @@ -860,7 +865,7 @@ nsresult nsDeviceContextOS2::BeginDocument() if( mPrintState == nsPrintState_ePreBeginDoc) { PrnStartJob( mDC, "Warpzilla NGLayout job"); - printf( "BeginDoc\n"); + PRINTF("BeginDoc\n"); mPrintState = nsPrintState_eBegunDoc; } return NS_OK; @@ -870,7 +875,7 @@ nsresult nsDeviceContextOS2::EndDocument() { PrnEndJob( mDC); mPrintState = nsPrintState_ePreBeginDoc; - printf("EndDoc\n"); + PRINTF("EndDoc\n"); return NS_OK; } @@ -881,7 +886,7 @@ nsresult nsDeviceContextOS2::BeginPage() else { PrnNewPage( mDC); - printf("NewPage"); + PRINTF("NewPage"); } return NS_OK; } diff --git a/mozilla/gfx/src/os2/nsDrawingSurfaceOS2.cpp b/mozilla/gfx/src/os2/nsDrawingSurfaceOS2.cpp index 66940d50620..b8fce37e50d 100644 --- a/mozilla/gfx/src/os2/nsDrawingSurfaceOS2.cpp +++ b/mozilla/gfx/src/os2/nsDrawingSurfaceOS2.cpp @@ -25,6 +25,11 @@ #include "nsIWidget.h" #include "nsDrawingSurfaceOS2.h" #include "nsFontMetricsOS2.h" +#include "nslog.h" + +NS_IMPL_LOG(nsDrawingSurfaceOS2Log) +#define PRINTF NS_LOG_PRINTF(nsDrawingSurfaceOS2Log) +#define FLUSH NS_LOG_FLUSH(nsDrawingSurfaceOS2Log) // Base class -- fonts, palette and xpcom ----------------------------------- @@ -275,10 +280,8 @@ nsresult nsOffscreenSurface::Lock( PRInt32 aX, PRInt32 aY, (PBITMAPINFO2) mInfoHeader); if( rc != mInfoHeader->cy) PMERROR( "GpiQueryBitmapBits"); -#ifdef DEBUG - printf( "Lock, requested %d x %d and got %d x %d\n", - aWidth, aHeight, (int) mInfoHeader->cx, aHeight); -#endif + PRINTF("Lock, requested %d x %d and got %d x %d\n", + aWidth, aHeight, (int) mInfoHeader->cx, aHeight); // Okay. Now have current state of bitmap in mBits. *aStride = lStride; @@ -368,7 +371,7 @@ nsresult nsOffscreenSurface::GetPixelFormat( nsPixelFormat *aFormat) break; default: - printf( "Bad bit-depth for GetPixelFormat (%d)\n", bih.cBitCount); + PRINTF( "Bad bit-depth for GetPixelFormat (%d)\n", bih.cBitCount); break; } @@ -413,7 +416,7 @@ nsresult nsOnscreenSurface::Lock( PRInt32 aX, PRInt32 aY, { EnsureProxy(); - printf( "Locking through a proxy\n"); + PRINTF( "Locking through a proxy\n"); // blit our 'real' bitmap to the proxy surface PRUint32 width, height; diff --git a/mozilla/gfx/src/os2/nsFontMetricsOS2.cpp b/mozilla/gfx/src/os2/nsFontMetricsOS2.cpp index 11a5fac8169..5b033e7ed17 100644 --- a/mozilla/gfx/src/os2/nsFontMetricsOS2.cpp +++ b/mozilla/gfx/src/os2/nsFontMetricsOS2.cpp @@ -34,6 +34,11 @@ #include "prmem.h" #include "plhash.h" #include "prprf.h" +#include "nslog.h" + +NS_IMPL_LOG(nsFontMetricsOS2Log) +#define PRINTF NS_LOG_PRINTF(nsFontMetricsOS2Log) +#define FLUSH NS_LOG_FLUSH(nsFontMetricsOS2Log) #undef USER_DEFINED #define USER_DEFINED "x-user-def" @@ -985,7 +990,7 @@ nsFontMetricsOS2::InitializeGlobalFonts(HPS aPS) #ifdef MOZ_MATHML // XXX need a better way to deal with non-TrueType fonts? if (!(fontType & TRUETYPE_FONTTYPE)) { - //printf("rejecting %s\n", logFont->lfFaceName); + //PRINTF("rejecting %s\n", logFont->lfFaceName); return 1; } #endif diff --git a/mozilla/gfx/src/os2/nsGfxFactoryOS2.cpp b/mozilla/gfx/src/os2/nsGfxFactoryOS2.cpp index 98fe95a988c..bc82c2b75cc 100644 --- a/mozilla/gfx/src/os2/nsGfxFactoryOS2.cpp +++ b/mozilla/gfx/src/os2/nsGfxFactoryOS2.cpp @@ -49,6 +49,11 @@ #include "nsIImageManager.h" #include "nsScreenManagerOS2.h" #include "nsString.h" +#include "nslog.h" + +NS_IMPL_LOG(nsGfxFactoryOS2Log) +#define PRINTF NS_LOG_PRINTF(nsGfxFactoryOS2Log) +#define FLUSH NS_LOG_FLUSH(nsGfxFactoryOS2Log) static NS_DEFINE_IID(kCFontMetrics, NS_FONT_METRICS_CID); static NS_DEFINE_IID(kCFontEnumerator, NS_FONT_ENUMERATOR_CID); @@ -304,7 +309,7 @@ void PMERROR( const char *api) { ERRORID eid = WinGetLastError(0); USHORT usError = ERRORIDERROR(eid); - printf( "%s failed, error = 0x%X\n", api, usError); + PRINTF("%s failed, error = 0x%X\n", api, usError); } nsGfxModuleData::nsGfxModuleData() : hModResources(0), hpsScreen(0), @@ -320,7 +325,7 @@ void nsGfxModuleData::Init() if( rc) { - printf( "Gfx failed to load self. rc = %d, cause = %s\n", (int)rc, buffer); + PRINTF("Gfx failed to load self. rc = %d, cause = %s\n", (int)rc, buffer); // rats. Can't load ourselves. Oh well. Try to be harmless... hModResources = 0; } @@ -388,7 +393,7 @@ int WideCharToMultiByte( int CodePage, const PRUnichar *pText, ULONG ulLength, c } else if( unirc != ULS_SUCCESS) { - printf("very bad"); + PRINTF("very bad"); } return ulSize - cplen; } diff --git a/mozilla/gfx/src/os2/nsImageOS2.cpp b/mozilla/gfx/src/os2/nsImageOS2.cpp index b932720fd73..ce5c2e41877 100644 --- a/mozilla/gfx/src/os2/nsImageOS2.cpp +++ b/mozilla/gfx/src/os2/nsImageOS2.cpp @@ -32,6 +32,11 @@ #include "nsImageOS2.h" #include "nsIDeviceContext.h" #include "nsRenderingContextOS2.h" +#include "nslog.h" + +NS_IMPL_LOG(nsImageOS2Log) +#define PRINTF NS_LOG_PRINTF(nsImageOS2Log) +#define FLUSH NS_LOG_FLUSH(nsImageOS2Log) #define ROP_NOTSRCAND 0x22 // NOT(SRC) AND DST @@ -336,7 +341,7 @@ void nsImageOS2::CreateBitmaps( nsDrawingSurfaceOS2 *surf) PMERROR( "GpiCreateBitmap (mask)"); } else - printf( "8 bit alpha mask, no chance...\n"); + PRINTF("8 bit alpha mask, no chance...\n"); } } diff --git a/mozilla/gfx/src/os2/nsRegionOS2.cpp b/mozilla/gfx/src/os2/nsRegionOS2.cpp index aa0e07c1c51..c0cce9e2469 100644 --- a/mozilla/gfx/src/os2/nsRegionOS2.cpp +++ b/mozilla/gfx/src/os2/nsRegionOS2.cpp @@ -25,6 +25,11 @@ #include #include "nsRegionOS2.h" +#include "nslog.h" + +NS_IMPL_LOG(nsRegionOS2Log) +#define PRINTF NS_LOG_PRINTF(nsRegionOS2Log) +#define FLUSH NS_LOG_FLUSH(nsRegionOS2Log) // Crazy Region Space // @@ -103,7 +108,7 @@ void nsRegionOS2::combine( long lOp, PRInt32 aX, PRInt32 aY, PRInt32 aW, PRInt32 if( rgn == RGN_ERROR) { PMERROR( "GpiCreateRegion #2 "); - printf( "X Y W H is %d %d %d %d\n", aX, aY, aW, aH); + PRINTF("X Y W H is %d %d %d %d\n", aX, aY, aW, aH); } mRegionType = GpiCombineRegion( nsRgnPS, mRegion, mRegion, rgn, lOp); if( mRegionType == RGN_ERROR) @@ -272,10 +277,8 @@ static void RealQueryRects( HRGN hrgn, realloc( *aRects, sizeof( nsRegionRectSet) + ((*aRects)->mNumRects + 9) * sizeof(nsRegionRect)); (*aRects)->mRectsLen += 10; -#ifdef DEBUG -// !! If this happens lots, bump up initial allocation - printf( "Allocating more regionrect space...\n"); -#endif + // !! If this happens lots, bump up initial allocation + PRINTF("Allocating more regionrect space...\n"); } nsRegionRect *theRect = (*aRects)->mRects + (*aRects)->mNumRects; diff --git a/mozilla/gfx/src/os2/nsRenderingContextOS2.cpp b/mozilla/gfx/src/os2/nsRenderingContextOS2.cpp index 0b6fe05a0e3..88318e97d3b 100644 --- a/mozilla/gfx/src/os2/nsRenderingContextOS2.cpp +++ b/mozilla/gfx/src/os2/nsRenderingContextOS2.cpp @@ -52,6 +52,11 @@ #include "nsFont.h" #include "libimg.h" #include "prprf.h" +#include "nslog.h" + +NS_IMPL_LOG(nsRenderingContextOS2Log) +#define PRINTF NS_LOG_PRINTF(nsRenderingContextOS2Log) +#define FLUSH NS_LOG_FLUSH(nsRenderingContextOS2Log) // helper clip region functions - defined at the bottom of this file. LONG GpiCombineClipRegion( HPS hps, HRGN hrgnCombine, LONG lOp); @@ -92,7 +97,7 @@ void GraphicsState::Destruct() { if( mClipRegion) { - printf( "oops, leaked a region from rc-gs\n"); + PRINTF( "oops, leaked a region from rc-gs\n"); mClipRegion = 0; } NS_IF_RELEASE( mFontMetrics); @@ -118,16 +123,16 @@ class GraphicsStateCache ~GraphicsStateCache() { #ifdef PROFILE_GSTATE - printf( "---- Graphics-State Stats -----\n"); - printf( " GStates requested: %d\n", mCount); - printf( " Actual GStates created: %d\n", mPeak); + PRINTF( "---- Graphics-State Stats -----\n"); + PRINTF( " GStates requested: %d\n", mCount); + PRINTF( " Actual GStates created: %d\n", mPeak); double d = mCount ? (double)(mCount - mPeak) / (double)mCount : 0; - printf( " Gstates recycled: %d (%d%%)\n", mCount - mPeak, (int)(d*100.0)); + PRINTF( " Gstates recycled: %d (%d%%)\n", mCount - mPeak, (int)(d*100.0)); UINT i = mSize+mDeleted; - printf( " Cached+Deleted: %d\n", i); + PRINTF( " Cached+Deleted: %d\n", i); if( i != mPeak) - printf( " WARNING: GStates leaked: %d\n", mPeak - i); - printf( "------------------------------\n\n"); + PRINTF( " WARNING: GStates leaked: %d\n", mPeak - i); + PRINTF( "------------------------------\n\n"); #endif // Clear up the cache @@ -558,7 +563,7 @@ nsresult nsRenderingContextOS2::PopState( PRBool &aClipEmpty) nsresult nsRenderingContextOS2::Reset() { // okay, what's this supposed to do? Empty the state stack? - printf( "nsRenderingContext::Reset() -- hmm\n"); + PRINTF( "nsRenderingContext::Reset() -- hmm\n"); return NS_OK; } diff --git a/mozilla/gfx/src/photon/nsDeviceContextPh.cpp b/mozilla/gfx/src/photon/nsDeviceContextPh.cpp index d1f9afd8e60..37ab995b6cd 100644 --- a/mozilla/gfx/src/photon/nsDeviceContextPh.cpp +++ b/mozilla/gfx/src/photon/nsDeviceContextPh.cpp @@ -34,6 +34,11 @@ #include "nsHashtable.h" #include "nsPhGfxLog.h" +#include "nslog.h" + +NS_IMPL_LOG(nsDeviceContextPhLog) +#define PRINTF NS_LOG_PRINTF(nsDeviceContextPhLog) +#define FLUSH NS_LOG_FLUSH(nsDeviceContextPhLog) static NS_DEFINE_IID(kIDeviceContextSpecIID, NS_IDEVICE_CONTEXT_SPEC_IID); static NS_DEFINE_CID(kPrefCID, NS_PREF_CID); @@ -151,12 +156,12 @@ nsresult nsDeviceContextPh :: Init(nsNativeDeviceContext aContext, nsIDeviceCont PpPrintContext_t *pc = ((nsDeviceContextSpecPh *)mSpec)->GetPrintContext(); PpPrintGetPC(pc, Pp_PC_PAPER_SIZE, (const void **)&psize ); - mWidthFloat = (float)(psize->w / 10); - mHeightFloat = (float)(psize->h / 10); - dim.w = psize->w / 10; - dim.h = psize->h / 10; - printf("PRINT: %d, %d\n", (int)mWidthFloat, (int)mHeightFloat); - PpPrintSetPC(pc, INITIAL_PC, 0 , Pp_PC_SOURCE_SIZE, &dim ); + mWidthFloat = (float)(psize->w / 10); + mHeightFloat = (float)(psize->h / 10); + dim.w = psize->w / 10; + dim.h = psize->h / 10; + PRINTF("PRINT: %d, %d\n", (int)mWidthFloat, (int)mHeightFloat); + PpPrintSetPC(pc, INITIAL_PC, 0 , Pp_PC_SOURCE_SIZE, &dim ); return NS_OK; } @@ -175,10 +180,10 @@ void nsDeviceContextPh :: GetPrinterRect(int *width, int *height) memset( &rect, 0, sizeof(rect)); memset( &margins, 0, sizeof(margins)); - printf("PC: %X\n", pc); + PRINTF("PC: %X\n", pc); PpPrintGetPC(pc, Pp_PC_PAPER_SIZE, (const void **)&psize ); PpPrintGetPC(pc, Pp_PC_NONPRINT_MARGINS, (const void **)&non_print ); - printf("SIZE: %d, %d\n", psize->w, psize->h); + PRINTF("SIZE: %d, %d\n", psize->w, psize->h); dim.w = (psize->w - ( non_print->ul.x + non_print->lr.x )) * 100 / 1000; dim.h = (psize->h - ( non_print->ul.x + non_print->lr.x )) * 100 / 1000; @@ -329,7 +334,7 @@ NS_IMETHODIMP nsDeviceContextPh :: CreateRenderingContext(nsIRenderingContext *& PR_LOG(PhGfxLog, PR_LOG_DEBUG,("nsDeviceContextPh::CreateRenderingContext - mDC=<%p>\n", mDC)); PhGC_t * aGC = (PhGC_t *) mDC; - printf("CreateRenderingContext\n"); + PRINTF("CreateRenderingContext\n"); rv = surf->Init(aGC); if (NS_OK == rv) @@ -480,7 +485,7 @@ NS_IMETHODIMP nsDeviceContextPh :: GetClientRect(nsRect &aRect) aRect.y = 0; aRect.width = NSToIntRound(mWidth * mDevUnitsToAppUnits); aRect.height = NSToIntRound(mHeight * mDevUnitsToAppUnits); - printf("GetClientRect: printer: %d, %d - %d, %d\n", mWidth, mHeight, aRect.width, aRect.height); + PRINTF("GetClientRect: printer: %d, %d - %d, %d\n", mWidth, mHeight, aRect.width, aRect.height); } else rv = GetRect ( aRect ); @@ -545,7 +550,7 @@ NS_IMETHODIMP nsDeviceContextPh :: GetDeviceSurfaceDimensions(PRInt32 &aWidth, P { if (mSpec) { - printf("PRINT: GetDeviceSurfaceDimensions\n"); + PRINTF("PRINT: GetDeviceSurfaceDimensions\n"); aWidth = NSToIntRound(mWidthFloat * mDevUnitsToAppUnits); aHeight = NSToIntRound(mHeightFloat * mDevUnitsToAppUnits); return (NS_OK); @@ -645,14 +650,14 @@ NS_IMETHODIMP nsDeviceContextPh :: BeginDocument(void) PpPrintContext_t *pc = ((nsDeviceContextSpecPh *)mSpec)->GetPrintContext(); PhDrawContext_t *dc = PhDCSetCurrent(NULL); - printf("Begin: %X, ", dc); + PRINTF("Begin: %X, ", dc); PhDCSetCurrent(dc); PpStartJob(pc); PpContinueJob(pc); dc = PhDCSetCurrent(NULL); - printf("%X\n", dc); + PRINTF("%X\n", dc); PhDCSetCurrent(dc); return NS_OK; @@ -660,7 +665,7 @@ NS_IMETHODIMP nsDeviceContextPh :: BeginDocument(void) NS_IMETHODIMP nsDeviceContextPh :: EndDocument(void) { - printf("EndDocument\n"); + PRINTF("EndDocument\n"); PpPrintContext_t *pc = ((nsDeviceContextSpecPh *)mSpec)->GetPrintContext(); PpSuspendJob(pc); PpEndJob(pc); @@ -703,13 +708,13 @@ NS_IMETHODIMP nsDeviceContextPh :: EndDocument(void) NS_IMETHODIMP nsDeviceContextPh :: BeginPage(void) { - printf("BeginPage\n"); + PRINTF("BeginPage\n"); return NS_OK; } NS_IMETHODIMP nsDeviceContextPh :: EndPage(void) { - printf("EndPage\n"); + PRINTF("EndPage\n"); PpPrintNewPage(((nsDeviceContextSpecPh *)mSpec)->GetPrintContext()); return NS_OK; #if 0 @@ -805,7 +810,7 @@ nsresult nsDeviceContextPh :: GetDisplayInfo(PRInt32 &aWidth, PRInt32 &aHeight, } else { - printf("The PHIG environment variable must be set, try setting it to 1\n"); + PRINTF("The PHIG environment variable must be set, try setting it to 1\n"); } PR_LOG(PhGfxLog, PR_LOG_DEBUG,("nsDeviceContextPh::GetDisplayInfo aWidth=<%d> aHeight=<%d> aDepth=<%d>\n", aWidth, aHeight, aDepth)); diff --git a/mozilla/gfx/src/photon/nsDeviceContextSpecFactoryP.cpp b/mozilla/gfx/src/photon/nsDeviceContextSpecFactoryP.cpp index d159abf0443..7202b9a3637 100644 --- a/mozilla/gfx/src/photon/nsDeviceContextSpecFactoryP.cpp +++ b/mozilla/gfx/src/photon/nsDeviceContextSpecFactoryP.cpp @@ -24,6 +24,11 @@ #include "nsDeviceContextSpecPh.h" #include "nsGfxCIID.h" #include "plstr.h" +#include "nslog.h" + +NS_IMPL_LOG(nsDeviceContextSpecFactoryPLog) +#define PRINTF NS_LOG_PRINTF(nsDeviceContextSpecFactoryPLog) +#define FLUSH NS_LOG_FLUSH(nsDeviceContextSpecFactoryPLog) #include #include "nsPhGfxLog.h" @@ -72,7 +77,7 @@ NS_IMETHODIMP nsDeviceContextSpecFactoryPh :: CreateDeviceContextSpec(nsIDeviceC { #else PpLoadPrinter(pc, NULL); - printf("LoadPrinter: %X\n", pc); + PRINTF("LoadPrinter: %X\n", pc); #endif nsIDeviceContextSpec *devSpec = nsnull; diff --git a/mozilla/gfx/src/photon/nsDrawingSurfacePh.cpp b/mozilla/gfx/src/photon/nsDrawingSurfacePh.cpp index a6141cf2137..612d1c62bd7 100644 --- a/mozilla/gfx/src/photon/nsDrawingSurfacePh.cpp +++ b/mozilla/gfx/src/photon/nsDrawingSurfacePh.cpp @@ -27,6 +27,11 @@ #include #include #include +#include "nslog.h" + +NS_IMPL_LOG(nsDrawingSurfacePhLog) +#define PRINTF NS_LOG_PRINTF(nsDrawingSurfacePhLog) +#define FLUSH NS_LOG_FLUSH(nsDrawingSurfacePhLog) NS_IMPL_ISUPPORTS2(nsDrawingSurfacePh, nsIDrawingSurface, nsIDrawingSurfacePh) @@ -102,7 +107,7 @@ NS_IMETHODIMP nsDrawingSurfacePh :: Lock(PRInt32 aX, PRInt32 aY, void **aBits, PRInt32 *aStride, PRInt32 *aWidthBytes, PRUint32 aFlags) { - printf("Lock()\n"); + PRINTF("Lock()\n"); PhArea_t dst_area, src_area; int format = 0, bpl; @@ -160,13 +165,13 @@ NS_IMETHODIMP nsDrawingSurfacePh :: Lock(PRInt32 aX, PRInt32 aY, } *aStride = *aWidthBytes = bpl * dst_area.size.w; - printf("end Lock()\n"); + PRINTF("end Lock()\n"); return NS_OK; } NS_IMETHODIMP nsDrawingSurfacePh :: Unlock(void) { - printf("UnLock\n"); + PRINTF("UnLock\n"); PdOffscreenContext_t *off_dc = (PdOffscreenContext_t *) mDrawContext; PhArea_t dst_area, src_area; @@ -194,8 +199,8 @@ NS_IMETHODIMP nsDrawingSurfacePh :: Unlock(void) mLocked = PR_FALSE; - printf("end UnLock\n"); - return NS_OK; + PRINTF("end UnLock\n"); + return NS_OK; } NS_IMETHODIMP nsDrawingSurfacePh :: GetDimensions(PRUint32 *aWidth, PRUint32 *aHeight) diff --git a/mozilla/gfx/src/photon/nsFontMetricsPh.cpp b/mozilla/gfx/src/photon/nsFontMetricsPh.cpp index f451149b1e0..abd3bfb66e9 100644 --- a/mozilla/gfx/src/photon/nsFontMetricsPh.cpp +++ b/mozilla/gfx/src/photon/nsFontMetricsPh.cpp @@ -25,6 +25,11 @@ #include "nsFontMetricsPh.h" #include "nsPhGfxLog.h" #include "nsHashtable.h" +#include "nslog.h" + +NS_IMPL_LOG(nsFontMetricsPhLog) +#define PRINTF NS_LOG_PRINTF(nsFontMetricsPhLog) +#define FLUSH NS_LOG_FLUSH(nsFontMetricsPhLog) #include @@ -163,7 +168,7 @@ nsFontMetricsPh :: Init ( const nsFont& aFont, nsIAtom* aLangGroup, app2twip *= (app2dev * textZoom); PRInt32 sizePoints = NSTwipsToFloorIntPoints(nscoord(mFont->size * app2twip * 0.90)); - //printf("FONTSIZE: %f, %f, %f, %f, %d, %d (%d)\n", app2dev, app2twip, scale, textZoom, \ + //PRINTF("FONTSIZE: %f, %f, %f, %f, %d, %d (%d)\n", app2dev, app2twip, scale, textZoom, \ // mFont->size, sizePoints, sizePoints2); char NSFontName[64]; /* Local buffer to keep the fontname in */ @@ -189,7 +194,7 @@ nsFontMetricsPh :: Init ( const nsFont& aFont, nsIAtom* aLangGroup, if (PfGenerateFontName((const uchar_t *)"Courier 10 Pitch BT", uiFlags, sizePoints, (uchar_t *)NSFullFontName) == NULL) { NS_ASSERTION(0,"nsFontMetricsPh::Init Name generate failed for default font\n"); - printf(" nsFontMetricsPh::Init Name generate failed for default font: %s, %d, %d\n", str, uiFlags, sizePoints); + PRINTF((" nsFontMetricsPh::Init Name generate failed for default font: %s, %d, %d\n", str, uiFlags, sizePoints)); } } diff --git a/mozilla/gfx/src/photon/nsImagePh.cpp b/mozilla/gfx/src/photon/nsImagePh.cpp index 6f916e23207..eda27398211 100644 --- a/mozilla/gfx/src/photon/nsImagePh.cpp +++ b/mozilla/gfx/src/photon/nsImagePh.cpp @@ -23,6 +23,11 @@ #include "nsImagePh.h" #include "nsRenderingContextPh.h" #include "nsPhGfxLog.h" +#include "nslog.h" + +NS_IMPL_LOG(nsImagePhLog) +#define PRINTF NS_LOG_PRINTF(nsImagePhLog) +#define FLUSH NS_LOG_FLUSH(nsImagePhLog) #include "nspr.h" @@ -316,7 +321,7 @@ NS_IMETHODIMP nsImagePh :: Draw(nsIRenderingContext &aContext, nsDrawingSurface // mPhImage.alpha = &pg_alpha; // PgDrawPhImagemx(&pos, &mPhImage, 0); // mPhImage.alpha = nsnull; - printf("DRAW IMAGE: with 8 bit alpha!!\n"); + PRINTF("DRAW IMAGE: with 8 bit alpha!!\n"); } return NS_OK; diff --git a/mozilla/gfx/src/photon/nsRegionPh.cpp b/mozilla/gfx/src/photon/nsRegionPh.cpp index 563f72a0ddd..fc91abcd052 100644 --- a/mozilla/gfx/src/photon/nsRegionPh.cpp +++ b/mozilla/gfx/src/photon/nsRegionPh.cpp @@ -22,6 +22,11 @@ #include "nsRegionPh.h" #include "prmem.h" +#include "nslog.h" + +NS_IMPL_LOG(nsRegionPhLog) +#define PRINTF NS_LOG_PRINTF(nsRegionPhLog) +#define FLUSH NS_LOG_FLUSH(nsRegionPhLog) /* Turn debug off to limit all the output to PhGfxLog */ #undef DEBUG @@ -51,7 +56,7 @@ static void DumpTiles(PhTile_t *t) while(t) { - printf("Tile %d is t=<%p> t->next=<%p> (%d, %d) - (%d,%d)\n", count, t, t->next, tulx, tuly, tlrx, tlry); + PRINTF("Tile %d is t=<%p> t->next=<%p> (%d, %d) - (%d,%d)\n", count, t, t->next, tulx, tuly, tlrx, tlry); PR_LOG(PhGfxLog, PR_LOG_DEBUG, ("Tile %d is t=<%p> t->next=<%p> (%d, %d) - (%d,%d)\n", count, t, t->next, tulx, tuly, tlrx, tlry)); t = t->next; count++; @@ -233,7 +238,7 @@ void nsRegionPh :: Subtract(PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHei tile->rect.lr.y = (aY+aHeight-1); tile->next = NULL; - //printf ("subtract: %d %d %d %d\n", tile->rect.ul.x, tile->rect.ul.y, tile->rect.lr.x, tile->rect.lr.y); + //PRINTF ("subtract: %d %d %d %d\n", tile->rect.ul.x, tile->rect.ul.y, tile->rect.lr.x, tile->rect.lr.y); mRegion = PhClipTilings(mRegion, tile, NULL); } @@ -430,12 +435,12 @@ NS_IMETHODIMP nsRegionPh :: GetRects(nsRegionRectSet **aRects) rect->y = tuly; rect->height = (tlry - tuly+1); rects->mArea += rect->width * rect->height; - //printf ("getrect: %d %d %d %d\n",rect->x,rect->y,rect->width,rect->height); + //PRINTF ("getrect: %d %d %d %d\n",rect->x,rect->y,rect->width,rect->height); rect++; t = t->next; } - //printf ("num rects %d %d\n",rects->mNumRects,rects->mRectsLen); fflush(stdout); + //PRINTF ("num rects %d %d\n",rects->mNumRects,rects->mRectsLen); fflush(stdout); *aRects = rects; return NS_OK; } diff --git a/mozilla/gfx/src/photon/nsRenderingContextPh.cpp b/mozilla/gfx/src/photon/nsRenderingContextPh.cpp index 821c4fb4f18..ac8f9c7f52c 100644 --- a/mozilla/gfx/src/photon/nsRenderingContextPh.cpp +++ b/mozilla/gfx/src/photon/nsRenderingContextPh.cpp @@ -39,6 +39,11 @@ extern "C" int verbose=4; // kedl, need this while using Bobby's test render lib #include "nsDrawingSurfacePh.h" #include #include +#include "nslog.h" + +NS_IMPL_LOG(nsRenderingContextPhLog) +#define PRINTF NS_LOG_PRINTF(nsRenderingContextPhLog) +#define FLUSH NS_LOG_FLUSH(nsRenderingContextPhLog) static NS_DEFINE_IID(kIRenderingContextIID, NS_IRENDERING_CONTEXT_IID); static NS_DEFINE_IID(kIDrawingSurfaceIID, NS_IDRAWING_SURFACE_IID); @@ -178,7 +183,7 @@ nsRenderingContextPh :: ~nsRenderingContextPh() if (mSurface && (dc == mSurface->GetDC())) { PhDCSetCurrent(NULL); - //printf("PhDCSetCurrent (~nsRenderingContextPh): NULL\n"); + //PRINTF("PhDCSetCurrent (~nsRenderingContextPh): NULL\n"); } #else PhDCSetCurrent(NULL); @@ -585,11 +590,11 @@ NS_IMETHODIMP nsRenderingContextPh :: SetClipRect(const nsRect& aRect, nsClipCom } else { - printf ("no region....\n"); - NS_ASSERTION(mTMatrix, "nsRenderingContextPh::SetClipRect mTMatrix is NULL"); - NS_ASSERTION(mClipRegion, "nsRenderingContextPh::SetClipRect mClipRegionis NULL"); - PR_LOG(PhGfxLog, PR_LOG_ERROR, ("nsRenderingContextPh::SetClipRect Invalid pointers!\n")); - abort(); + PRINTF ("no region....\n"); + NS_ASSERTION(mTMatrix, "nsRenderingContextPh::SetClipRect mTMatrix is NULL"); + NS_ASSERTION(mClipRegion, "nsRenderingContextPh::SetClipRect mClipRegionis NULL"); + PR_LOG(PhGfxLog, PR_LOG_ERROR, ("nsRenderingContextPh::SetClipRect Invalid pointers!\n")); + abort(); } return res; @@ -672,7 +677,7 @@ NS_IMETHODIMP nsRenderingContextPh :: GetClipRegion(nsIRegion **aRegion) if (*aRegion) // copy it, they should be using CopyClipRegion { - // printf("you should be calling CopyClipRegion()\n"); + // PRINTF("you should be calling CopyClipRegion()\n"); (*aRegion)->SetTo(*mClipRegion); rv = NS_OK; } @@ -690,7 +695,7 @@ NS_IMETHODIMP nsRenderingContextPh :: GetClipRegion(nsIRegion **aRegion) } else { - printf("null clip region, can't make a valid copy\n"); + PRINTF("null clip region, can't make a valid copy\n"); NS_RELEASE(*aRegion); rv = NS_ERROR_FAILURE; } @@ -1390,8 +1395,8 @@ NS_IMETHODIMP nsRenderingContextPh::DrawImage(nsIImage *aImage, if (mClipRegion->IsEmpty()) { // this is bad! - // printf("drawing image with empty clip region\n"); - //printf("nsRenderingContextPh::DrawImage2 drawing image with empty clip region\n"); + // PRINTF("drawing image with empty clip region\n"); + //PRINTF("nsRenderingContextPh::DrawImage2 drawing image with empty clip region\n"); return NS_ERROR_FAILURE; } #endif @@ -1433,7 +1438,7 @@ NS_IMETHODIMP nsRenderingContextPh::DrawImage(nsIImage *aImage, if (mClipRegion->IsEmpty()) { // this is bad! - // printf("drawing image with empty clip region\n"); + // PRINTF("drawing image with empty clip region\n"); return NS_ERROR_FAILURE; } @@ -1585,7 +1590,7 @@ int rid; if (err == -1) { - printf ("nsRenderingContextPh::CopyOffScreenBits Error calling PgDrawImage\n"); + PRINTF ("nsRenderingContextPh::CopyOffScreenBits Error calling PgDrawImage\n"); abort(); } @@ -1651,7 +1656,7 @@ void nsRenderingContextPh::ApplyClipping( PhGC_t *gc ) } } else - printf("nsRenderingContextPh::ApplyClipping mClipRegion is NULL"); + PRINTF("nsRenderingContextPh::ApplyClipping mClipRegion is NULL"); } diff --git a/mozilla/gfx/src/photon/nsScreenPh.cpp b/mozilla/gfx/src/photon/nsScreenPh.cpp index 7247fce9160..7a0fcb2214c 100644 --- a/mozilla/gfx/src/photon/nsScreenPh.cpp +++ b/mozilla/gfx/src/photon/nsScreenPh.cpp @@ -24,6 +24,11 @@ #include #include "nsPhGfxLog.h" +#include "nslog.h" + +NS_IMPL_LOG(nsScreenPhLog) +#define PRINTF NS_LOG_PRINTF(nsScreenPhLog) +#define FLUSH NS_LOG_FLUSH(nsScreenPhLog) nsScreenPh :: nsScreenPh ( ) { @@ -74,7 +79,7 @@ nsScreenPh :: nsScreenPh ( ) } else { - printf("nsScreenPh::nsScreenPh The PHIG environment variable must be set, try setting it to 1\n"); + PRINTF("nsScreenPh::nsScreenPh The PHIG environment variable must be set, try setting it to 1\n"); } } diff --git a/mozilla/gfx/src/ps/nsAFMObject.cpp b/mozilla/gfx/src/ps/nsAFMObject.cpp index ab559c2f30b..977493050d4 100644 --- a/mozilla/gfx/src/ps/nsAFMObject.cpp +++ b/mozilla/gfx/src/ps/nsAFMObject.cpp @@ -35,7 +35,11 @@ #include "Courier-BoldOblique.h" #include "Courier-Oblique.h" #include "Symbol.h" +#include "nslog.h" +NS_IMPL_LOG(nsAFMObjectLog) +#define PRINTF NS_LOG_PRINTF(nsAFMObjectLog) +#define FLUSH NS_LOG_FLUSH(nsAFMObjectLog) // this is the basic font set supported currently @@ -775,7 +779,7 @@ float totallen=0.0f; idx = asciichar-32; fwidth = (PRInt32)(mPSFontInfo->mAFMCharMetrics[idx].mW0x); // if ( (*cptr == 0x0020) || (*cptr == 0x002c) ) - // printf("fwidth = %d\n", fwidth); + // PRINTF("fwidth = %d\n", fwidth); if (*cptr & 0xff00) fwidth = 1056; if ( (*cptr == 0x0020) || (*cptr == 0x002c) ) diff --git a/mozilla/gfx/src/ps/nsPostScriptObj.cpp b/mozilla/gfx/src/ps/nsPostScriptObj.cpp index 899e4fd87f8..36e997ad9ad 100644 --- a/mozilla/gfx/src/ps/nsPostScriptObj.cpp +++ b/mozilla/gfx/src/ps/nsPostScriptObj.cpp @@ -41,6 +41,11 @@ #include "nsIUnicodeDecoder.h" #include "nsICharsetAlias.h" +#include "nslog.h" + +NS_IMPL_LOG(nsPostScriptObjLog) +#define PRINTF NS_LOG_PRINTF(nsPostScriptObjLog) +#define FLUSH NS_LOG_FLUSH(nsPostScriptObjLog) #ifdef VMS #include @@ -211,8 +216,8 @@ nsPostScriptObj::Init( nsIDeviceContextSpecPS *aSpec ) aSpec->GetLeftMargin( left ); aSpec->GetRightMargin( right ); -printf("\nPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP\n"); -printf( "top %f bottom %f left %f right %f\n", top, bottom, left, right ); + PRINTF("\nPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP\n"); + PRINTF("top %f bottom %f left %f right %f\n", top, bottom, left, right ); aSpec->GetFirstPageFirst( isFirstPageFirst ); if ( isFirstPageFirst == PR_FALSE ) mPrintSetup->reverse = 1; @@ -255,8 +260,8 @@ printf( "top %f bottom %f left %f right %f\n", top, bottom, left, right ); aSpec->GetPageDimensions( fwidth, fheight ); mPrintSetup->width = (int)(fwidth * mPrintSetup->dpi); mPrintSetup->height = (int)(fheight * mPrintSetup->dpi); - printf("\nPreWidth = %f PreHeight = %f\n",fwidth,fheight); - printf("\nWidth = %d Height = %d\n",mPrintSetup->width,mPrintSetup->height); + PRINTF("\nPreWidth = %f PreHeight = %f\n",fwidth,fheight); + PRINTF("\nWidth = %d Height = %d\n",mPrintSetup->width,mPrintSetup->height); mPrintSetup->header = "header"; mPrintSetup->footer = "footer"; mPrintSetup->sizes = NULL; @@ -270,7 +275,7 @@ printf( "top %f bottom %f left %f right %f\n", top, bottom, left, right ); mPrintSetup->bottom = (int) (bottom * mPrintSetup->dpi); mPrintSetup->left = (int) (left * mPrintSetup->dpi); mPrintSetup->right = (int) (right * mPrintSetup->dpi); -printf( "dpi %f top %d bottom %d left %d right %d\n", mPrintSetup->dpi, mPrintSetup->top, mPrintSetup->bottom, mPrintSetup->left, mPrintSetup->right ); + PRINTF( "dpi %f top %d bottom %d left %d right %d\n", mPrintSetup->dpi, mPrintSetup->top, mPrintSetup->bottom, mPrintSetup->left, mPrintSetup->right ); mPrintSetup->rules = 1.0f; // Scale factor for rulers mPrintSetup->n_up = 0; // cool page combining mPrintSetup->bigger = 1; // Used to init sizes if sizesin NULL diff --git a/mozilla/gfx/src/shared/nsRenderingContextImpl.cpp b/mozilla/gfx/src/shared/nsRenderingContextImpl.cpp index 65e3f7c4a45..a422b3f30d0 100644 --- a/mozilla/gfx/src/shared/nsRenderingContextImpl.cpp +++ b/mozilla/gfx/src/shared/nsRenderingContextImpl.cpp @@ -26,7 +26,11 @@ #include "nsTransform2D.h" #include #include "il_util.h" +#include "nslog.h" +NS_IMPL_LOG(nsRenderingContextImplLog) +#define PRINTF NS_LOG_PRINTF(nsRenderingContextImplLog) +#define FLUSH NS_LOG_FLUSH(nsRenderingContextImplLog) const nsPoint *gPts; @@ -454,10 +458,10 @@ float fx,fy,smag; }else{ // draw the curve #ifdef DEBUGCURVE - printf("LINE 1- %d,%d %d,%d\n",NSToCoordRound(curve1.mAnc1.x),NSToCoordRound(curve1.mAnc1.y), - NSToCoordRound(curve1.mAnc1.x),NSToCoordRound(curve1.mAnc1.y)); - printf("LINE 2- %d,%d %d,%d\n",NSToCoordRound(curve1.mAnc2.x),NSToCoordRound(curve1.mAnc2.y), - NSToCoordRound(curve2.mAnc2.x),NSToCoordRound(curve2.mAnc2.y)); + PRINTF("LINE 1- %d,%d %d,%d\n",NSToCoordRound(curve1.mAnc1.x),NSToCoordRound(curve1.mAnc1.y), + NSToCoordRound(curve1.mAnc1.x),NSToCoordRound(curve1.mAnc1.y)); + PRINTF("LINE 2- %d,%d %d,%d\n",NSToCoordRound(curve1.mAnc2.x),NSToCoordRound(curve1.mAnc2.y), + NSToCoordRound(curve2.mAnc2.x),NSToCoordRound(curve2.mAnc2.y)); #endif aRenderingContext->DrawStdLine(NSToCoordRound(curve1.mAnc1.x),NSToCoordRound(curve1.mAnc1.y),NSToCoordRound(curve1.mAnc2.x),NSToCoordRound(curve1.mAnc2.y)); aRenderingContext->DrawStdLine(NSToCoordRound(curve1.mAnc2.x),NSToCoordRound(curve1.mAnc2.y),NSToCoordRound(curve2.mAnc2.x),NSToCoordRound(curve2.mAnc2.y)); @@ -472,10 +476,10 @@ float fx,fy,smag; void QBezierCurve::DebugPrint() { - printf("CURVE COORDINATES\n"); - printf("Anchor 1 %f %f\n",mAnc1.x,mAnc1.y); - printf("Control %f %f\n",mCon.x,mCon.y); - printf("Anchor %f %f\n",mAnc2.x,mAnc2.y); + PRINTF("CURVE COORDINATES\n"); + PRINTF("Anchor 1 %f %f\n",mAnc1.x,mAnc1.y); + PRINTF("Control %f %f\n",mCon.x,mCon.y); + PRINTF("Anchor %f %f\n",mAnc2.x,mAnc2.y); } @@ -510,10 +514,10 @@ float fx,fy,smag; aThePoints[(*aNumPts)++].MoveTo(NSToCoordRound(curve2.mAnc2.x),NSToCoordRound(curve2.mAnc2.y)); #ifdef DEBUGCURVE - printf("LINE 1- %d,%d %d,%d\n",NSToCoordRound(curve1.mAnc1.x),NSToCoordRound(curve1.mAnc1.y), - NSToCoordRound(curve1.mAnc1.x),NSToCoordRound(curve1.mAnc1.y)); - printf("LINE 2- %d,%d %d,%d\n",NSToCoordRound(curve1.mAnc2.x),NSToCoordRound(curve1.mAnc2.y), - NSToCoordRound(curve2.mAnc2.x),NSToCoordRound(curve2.mAnc2.y)); + PRINTF("LINE 1- %d,%d %d,%d\n",NSToCoordRound(curve1.mAnc1.x),NSToCoordRound(curve1.mAnc1.y), + NSToCoordRound(curve1.mAnc1.x),NSToCoordRound(curve1.mAnc1.y)); + PRINTF("LINE 2- %d,%d %d,%d\n",NSToCoordRound(curve1.mAnc2.x),NSToCoordRound(curve1.mAnc2.y), + NSToCoordRound(curve2.mAnc2.x),NSToCoordRound(curve2.mAnc2.y)); #endif } diff --git a/mozilla/gfx/src/windows/nsDeviceContextSpecFactoryW.cpp b/mozilla/gfx/src/windows/nsDeviceContextSpecFactoryW.cpp index c6313a94c71..120d473407e 100644 --- a/mozilla/gfx/src/windows/nsDeviceContextSpecFactoryW.cpp +++ b/mozilla/gfx/src/windows/nsDeviceContextSpecFactoryW.cpp @@ -26,6 +26,11 @@ #include #include "nsGfxCIID.h" #include "plstr.h" +#include "nslog.h" + +NS_IMPL_LOG(nsDeviceContextSpecFactoryWLog) +#define PRINTF NS_LOG_PRINTF(nsDeviceContextSpecFactoryWLog) +#define FLUSH NS_LOG_FLUSH(nsDeviceContextSpecFactoryWLog) nsDeviceContextSpecFactoryWin :: nsDeviceContextSpecFactoryWin() { @@ -98,9 +103,7 @@ NS_IMETHODIMP nsDeviceContextSpecFactoryWin :: CreateDeviceContextSpec(nsIDevice PL_strcpy(device, &(((char *)devnames)[devnames->wDeviceOffset])); PL_strcpy(driver, &(((char *)devnames)[devnames->wDriverOffset])); -#ifdef NS_DEBUG -printf("printer: driver %s, device %s\n", driver, device); -#endif + PRINTF("printer: driver %s, device %s\n", driver, device); nsIDeviceContextSpec *devspec = nsnull; diff --git a/mozilla/gfx/src/windows/nsDeviceContextWin.cpp b/mozilla/gfx/src/windows/nsDeviceContextWin.cpp index a369b02b6c3..49370406de4 100644 --- a/mozilla/gfx/src/windows/nsDeviceContextWin.cpp +++ b/mozilla/gfx/src/windows/nsDeviceContextWin.cpp @@ -30,7 +30,11 @@ #include "nsIScreenManager.h" #include "nsIScreen.h" #include "nsGfxCIID.h" +#include "nslog.h" +NS_IMPL_LOG(nsDeviceContextWinLog) +#define PRINTF NS_LOG_PRINTF(nsDeviceContextWinLog) +#define FLUSH NS_LOG_FLUSH(nsDeviceContextWinLog) // Size of the color cube #define COLOR_CUBE_SIZE 216 @@ -447,7 +451,7 @@ nsresult nsDeviceContextWin :: GetSysFontInfo(HDC aHDC, nsSystemAttrID anID, nsF LONG logHeight = LONG((float(ptrLogFont->lfHeight) * mPixelScale)+0.5); // round up int pointSize = -MulDiv(logHeight, 72, ::GetDeviceCaps(aHDC, LOGPIXELSY)); - //printf("\n\n Default Font size: %dpt\n", pointSize); + //PRINTF("\n\n Default Font size: %dpt\n", pointSize); // As far as I can tell the Default size 8pt // increase it by 2 points to match Windows GUI if (anID == eSystemAttr_Font_Button || diff --git a/mozilla/gfx/src/windows/nsDrawingSurfaceWin.cpp b/mozilla/gfx/src/windows/nsDrawingSurfaceWin.cpp index b6bd0cc014f..8ce950bf044 100644 --- a/mozilla/gfx/src/windows/nsDrawingSurfaceWin.cpp +++ b/mozilla/gfx/src/windows/nsDrawingSurfaceWin.cpp @@ -27,6 +27,11 @@ #include "nsDrawingSurfaceWin.h" #include "prmem.h" #include "nscrt.h" +#include "nslog.h" + +NS_IMPL_LOG(nsDrawingSurfaceWinLog) +#define PRINTF NS_LOG_PRINTF(nsDrawingSurfaceWinLog) +#define FLUSH NS_LOG_FLUSH(nsDrawingSurfaceWinLog) //#define GFX_DEBUG @@ -850,7 +855,7 @@ nsresult nsDrawingSurfaceWin :: CreateDDraw() mDDraw2->SetCooperativeLevel(NULL, DDSCL_NORMAL); #ifdef NS_DEBUG - printf("using DirectDraw (%08X)\n", mDDraw2); + PRINTF("using DirectDraw (%08X)\n", mDDraw2); DDSCAPS ddscaps; DWORD totalmem, freemem; @@ -860,12 +865,12 @@ nsresult nsDrawingSurfaceWin :: CreateDDraw() if (NS_SUCCEEDED(res)) { - printf("total video memory: %d\n", totalmem); - printf("free video memory: %d\n", freemem); + PRINTF("total video memory: %d\n", totalmem); + PRINTF("free video memory: %d\n", freemem); } else { - printf("GetAvailableVidMem() returned %08x: %s\n", res, + PRINTF("GetAvailableVidMem() returned %08x: %s\n", res, (res == DDERR_NODIRECTDRAWHW) ? "no hardware ddraw driver available" : "unknown error code"); } diff --git a/mozilla/gfx/src/windows/nsFontMetricsWin.cpp b/mozilla/gfx/src/windows/nsFontMetricsWin.cpp index b9de392fa82..99d084b59e3 100644 --- a/mozilla/gfx/src/windows/nsFontMetricsWin.cpp +++ b/mozilla/gfx/src/windows/nsFontMetricsWin.cpp @@ -32,6 +32,11 @@ #include "prmem.h" #include "plhash.h" #include "prprf.h" +#include "nslog.h" + +NS_IMPL_LOG(nsFontMetricsWinLog) +#define PRINTF NS_LOG_PRINTF(nsFontMetricsWinLog) +#define FLUSH NS_LOG_FLUSH(nsFontMetricsWinLog) #define NS_FONT_TYPE_UNKNOWN -1 #define NS_FONT_TYPE_UNICODE 0 @@ -1282,7 +1287,7 @@ nsFontMetricsWin::GetCMAP(HDC aDC, const char* aShortName, int* aFontType, PRUin // XXX should we trust this font at all if it does this? } } - //printf("0x%04X-0x%04X ", startC, endC); + //PRINTF("0x%04X-0x%04X ", startC, endC); } else { PRUint16 endC = endCode[i]; @@ -1299,10 +1304,10 @@ nsFontMetricsWin::GetCMAP(HDC aDC, const char* aShortName, int* aFontType, PRUin } } } - //printf("0x%04X-0x%04X ", startCode[i], endC); + //PRINTF("0x%04X-0x%04X ", startCode[i], endC); } } - //printf("\n"); + //PRINTF("\n"); PR_Free(buf); PR_Free(isSpace); @@ -1386,9 +1391,7 @@ GetGlyphIndices(HDC aDC, break; } if (i == n) { -#ifdef NS_DEBUG - printf("nsFontMetricsWin::GetGlyphIndices() called for a non-unicode font!"); -#endif + PRINTF("nsFontMetricsWin::GetGlyphIndices() called for a non-unicode font!"); PR_Free(buf); return nsnull; } @@ -1776,7 +1779,7 @@ static int CALLBACK enumProc(const LOGFONT* logFont, const TEXTMETRIC* metrics, #ifdef MOZ_MATHML // XXX need a better way to deal with non-TrueType fonts? if (!(fontType & TRUETYPE_FONTTYPE)) { - //printf("rejecting %s\n", logFont->lfFaceName); + //PRINTF("rejecting %s\n", logFont->lfFaceName); return 1; } #endif @@ -2164,7 +2167,7 @@ typedef struct { static int CALLBACK nsFontWeightCallback(const LOGFONT* logFont, const TEXTMETRIC * metrics, DWORD fontType, LPARAM closure) { - // printf("Name %s Log font sizes %d\n",logFont->lfFaceName,logFont->lfWeight); + // PRINTF("Name %s Log font sizes %d\n",logFont->lfFaceName,logFont->lfWeight); nsFontWeightInfo* weightInfo = (nsFontWeightInfo*)closure; if (NULL != metrics) { @@ -2215,12 +2218,11 @@ static void SearchSimulatedFontWeight(HDC aDC, nsFontWeightInfo* aWeightInfo) TEXTMETRIC metrics; GetTextMetrics(aDC, &metrics); if (metrics.tmWeight == weight) { -// printf("font weight for %s found: %d%s\n", logFont.lfFaceName, weight, +// PRINTF("font weight for %s found: %d%s\n", logFont.lfFaceName, weight, // nsFontMetricsWin::IsFontWeightAvailable(weight, aWeightInfo->mWeights) ? -// "" : " (simulated)"); +// "" : " (simulated)")); nsFontMetricsWin::SetFontWeight(weight / 100, &aWeightInfo->mWeights); } - ::SelectObject(aDC, (HGDIOBJ)oldfont); ::DeleteObject((HGDIOBJ)hfont); } @@ -2244,7 +2246,7 @@ nsFontMetricsWin::GetFontWeightTable(HDC aDC, nsString* aFontName) { weightInfo.mFontCount = 0; ::EnumFontFamiliesEx(aDC, &logFont, nsFontWeightCallback, (LPARAM)&weightInfo, 0); SearchSimulatedFontWeight(aDC, &weightInfo); - // printf("font weights for %s dec %d hex %x \n", logFont.lfFaceName, weightInfo.mWeights, weightInfo.mWeights); +// PRINTF("font weights for %s dec %d hex %x \n", logFont.lfFaceName, weightInfo.mWeights, weightInfo.mWeights); return weightInfo.mWeights; } @@ -2409,7 +2411,7 @@ nsFontMetricsWin::GetFontWeight(PRInt32 aWeight, PRUint16 aWeightTable) { } } -// printf("XXX Input weight %d output weight %d weight table hex %x\n", aWeight, selectedWeight, aWeightTable); +// PRINTF("XXX Input weight %d output weight %d weight table hex %x\n", aWeight, selectedWeight, aWeightTable); return selectedWeight; } @@ -2442,13 +2444,13 @@ nsFontMetricsWin::LookForFontWeightTable(HDC aDC, nsString* aName) nsFontWeightEntry* weightEntry = (nsFontWeightEntry*)PL_HashTableLookup(gFontWeights, &searchEntry); if (nsnull != weightEntry) { - // printf("Re-use weight entry\n"); + // PRINTF("Re-use weight entry\n"); return weightEntry->mWeightTable; } // Hasn't been computed, so need to compute and store it. PRUint16 weightTable = GetFontWeightTable(aDC, aName); -// printf("Compute font weight %d\n", weightTable); +// PRINTF("Compute font weight %d\n", weightTable); // Store it in font weight HashTable. nsFontWeightEntry* fontWeightEntry = new nsFontWeightEntry; @@ -3212,8 +3214,8 @@ nsFontWinUnicode::GetBoundingMetrics(HDC aDC, void nsFontWinUnicode::DumpFontInfo() { - printf("FontName: %s @%p\n", mName, this); - printf("FontType: nsFontWinUnicode\n"); + PRINTF("FontName: %s @%p\n", mName, this); + PRINTF("FontType: nsFontWinUnicode\n"); } #endif // NS_DEBUG #endif @@ -3361,8 +3363,8 @@ nsFontWinNonUnicode::GetBoundingMetrics(HDC aDC, void nsFontWinNonUnicode::DumpFontInfo() { - printf("FontName: %s @%p\n", mName, this); - printf("FontType: nsFontWinNonUnicode\n"); + PRINTF("FontName: %s @%p\n", mName, this); + PRINTF("FontType: nsFontWinNonUnicode\n"); } #endif // NS_DEBUG #endif @@ -3553,8 +3555,8 @@ nsFontWinSubstitute::GetBoundingMetrics(HDC aDC, void nsFontWinSubstitute::DumpFontInfo() { - printf("FontName: %s @%p\n", mName, this); - printf("FontType: nsFontWinSubstitute\n"); + PRINTF("FontName: %s @%p\n", mName, this); + PRINTF("FontType: nsFontWinSubstitute\n"); } #endif // NS_DEBUG #endif @@ -3562,7 +3564,7 @@ nsFontWinSubstitute::DumpFontInfo() static void GenerateDefault(nsCharSetInfo* aSelf) { -printf("%s defaulted\n", aSelf->mName); + PRINTF("%s defaulted\n", aSelf->mName); PRUint32* map = aSelf->mMap; for (int i = 0; i < 2048; i++) { map[i] = 0xFFFFFFFF; @@ -3580,7 +3582,7 @@ GenerateSingleByte(nsCharSetInfo* aSelf) } int len = MultiByteToWideChar(aSelf->mCodePage, 0, (char*) mb, 256, wc, 256); if (len != 256) { - printf("%s: MultiByteToWideChar returned %d\n", aSelf->mName, len); + PRINTF("%s: MultiByteToWideChar returned %d\n", aSelf->mName, len); } PRUint32* map = aSelf->mMap; for (i = 0; i < 256; i++) { @@ -3639,7 +3641,7 @@ nsFontWinA::GetSubsets(HDC aDC) if ((array[dword] >> bit) & 1) { PRUint8 charSet = bitToCharSet[i]; #ifdef DEBUG_FONT_SIGNATURE - printf(" %02d %s\n", i, gCharSetInfo[gCharSetToIndex[charSet]].mName); + PRINTF(" %02d %s\n", i, gCharSetInfo[gCharSetToIndex[charSet]].mName); #endif if (charSet != DEFAULT_CHARSET) { if (HaveConverterFor(charSet)) { @@ -3832,8 +3834,8 @@ nsFontSubset::GetBoundingMetrics(HDC aDC, void nsFontSubset::DumpFontInfo() { - printf("FontName: %s @%p\n", mName, this); - printf("FontType: nsFontSubset\n"); + PRINTF("FontName: %s @%p\n", mName, this); + PRINTF("FontType: nsFontSubset\n"); } #endif // NS_DEBUG #endif @@ -3955,7 +3957,7 @@ nsFontMetricsWinA::LoadFont(HDC aDC, nsString* aName) return nsnull; } #ifdef DEBUG_FONT_SIGNATURE - printf("%s\n", logFont.lfFaceName); + PRINTF("%s\n", logFont.lfFaceName); #endif if (!font->GetSubsets(aDC)) { delete font; diff --git a/mozilla/gfx/src/windows/nsRenderingContextWin.cpp b/mozilla/gfx/src/windows/nsRenderingContextWin.cpp index 4c62c71c738..7883847a772 100644 --- a/mozilla/gfx/src/windows/nsRenderingContextWin.cpp +++ b/mozilla/gfx/src/windows/nsRenderingContextWin.cpp @@ -30,6 +30,11 @@ #include "prprf.h" #include "nsDrawingSurfaceWin.h" #include "nsGfxCIID.h" +#include "nslog.h" + +NS_IMPL_LOG(nsRenderingContextWinLog) +#define PRINTF NS_LOG_PRINTF(nsRenderingContextWinLog) +#define FLUSH NS_LOG_FLUSH(nsRenderingContextWinLog) //#define GFX_DEBUG @@ -1564,7 +1569,7 @@ static void ArabicShaping(const PRUnichar* aString, PRUint32 aLen, *dest++ = formB; else *dest++ = PresentationFormB(*src, eIsolated); -//printf("%x %d %d %d %x\n" ,*src,leftJ, thisJ, rightJ, +//PRINTF("%x %d %d %d %x\n" ,*src,leftJ, thisJ, rightJ, //PresentationFormB(*src, DecideForm(leftJ, thisJ, rightJ))); src--; } @@ -1575,7 +1580,7 @@ static void ArabicShaping(const PRUnichar* aString, PRUint32 aLen, *dest++ = formB; else *dest++ = PresentationFormB(*src, eIsolated); -//printf("%x %d %d %d %x\n" ,*src, thisJ, rightJ, eNJ, +//PRINTF("%x %d %d %d %x\n" ,*src, thisJ, rightJ, eNJ, //PresentationFormB(*src, DecideForm( thisJ, rightJ, eNJ))); src--; PRUnichar *lSrc = aBuf; @@ -1609,10 +1614,10 @@ static void ArabicShaping(const PRUnichar* aString, PRUint32 aLen, *lDest++ = *lSrc++; aBufLen = lDest - aBuf; #if 0 -printf("["); +PRINTF(("[")); for(PRUint32 k=0;kGetBoundingMetrics(mDC, italicSlope, &pstr[start], i - start, rawbm); if (NS_FAILED(rv)) { #ifdef NS_DEBUG - printf("GetBoundingMetrics() failed for: 0x%04X...\n", pstr[start]); + PRINTF("GetBoundingMetrics() failed for: 0x%04X...\n", pstr[start]); prevFont->DumpFontInfo(); #endif if (selectedFont != mCurrFont) { @@ -2744,7 +2749,7 @@ FoundFont: rv = prevFont->GetBoundingMetrics(mDC, italicSlope, &pstr[start], i - start, rawbm); if (NS_FAILED(rv)) { #ifdef NS_DEBUG - printf("GetBoundingMetrics() failed for: 0x%04X...\n", pstr[start]); + PRINTF("GetBoundingMetrics() failed for: 0x%04X...\n", pstr[start]); prevFont->DumpFontInfo(); #endif if (selectedFont != mCurrFont) { diff --git a/mozilla/gfx/src/windows/nsScreenWin.cpp b/mozilla/gfx/src/windows/nsScreenWin.cpp index 2a9e41756e6..cc274cae7c3 100644 --- a/mozilla/gfx/src/windows/nsScreenWin.cpp +++ b/mozilla/gfx/src/windows/nsScreenWin.cpp @@ -29,7 +29,11 @@ #define WINVER 0x0500 #include "nsScreenWin.h" +#include "nslog.h" +NS_IMPL_LOG(nsScreenWinLog) +#define PRINTF NS_LOG_PRINTF(nsScreenWinLog) +#define FLUSH NS_LOG_FLUSH(nsScreenWinLog) // needed because there are unicode/ansi versions of this routine // and we need to make sure we get the correct one. @@ -67,7 +71,7 @@ nsScreenWin :: nsScreenWin ( void* inScreen ) if ( mGetMonitorInfoProc ) mHasMultiMonitorAPIs = PR_TRUE; } - printf("has multiple monitor apis is %ld\n", mHasMultiMonitorAPIs); + PRINTF("has multiple monitor apis is %ld\n", mHasMultiMonitorAPIs); #endif // nothing else to do. I guess we could cache a bunch of information diff --git a/mozilla/gfx/src/xlib/nsDeviceContextXlib.cpp b/mozilla/gfx/src/xlib/nsDeviceContextXlib.cpp index 4a675c593fd..5688d0a7f6d 100644 --- a/mozilla/gfx/src/xlib/nsDeviceContextXlib.cpp +++ b/mozilla/gfx/src/xlib/nsDeviceContextXlib.cpp @@ -38,6 +38,11 @@ #include "nsGfxPSCID.h" #include "nsIDeviceContextPS.h" +#include "nslog.h" + +NS_IMPL_LOG(nsDeviceContextXlibLog) +#define PRINTF NS_LOG_PRINTF(nsDeviceContextXlibLog) +#define FLUSH NS_LOG_FLUSH(nsDeviceContextXlibLog) static NS_DEFINE_CID(kPrefCID, NS_PREF_CID); static NS_DEFINE_IID(kDeviceContextIID, NS_IDEVICE_CONTEXT_IID); @@ -94,7 +99,7 @@ NS_IMETHODIMP nsDeviceContextXlib::Init(nsNativeWidget aNativeWidget) { once = PR_FALSE; - printf("nsDeviceContextXlib::Init(dpy=%p screen=%p visual=%p depth=%d)\n", + PRINTF("nsDeviceContextXlib::Init(dpy=%p screen=%p visual=%p depth=%d)\n", mDisplay, mScreen, mVisual, diff --git a/mozilla/gfx/src/xlib/nsFontMetricsXlib.cpp b/mozilla/gfx/src/xlib/nsFontMetricsXlib.cpp index 41656f642db..04caeda1c6f 100644 --- a/mozilla/gfx/src/xlib/nsFontMetricsXlib.cpp +++ b/mozilla/gfx/src/xlib/nsFontMetricsXlib.cpp @@ -45,6 +45,11 @@ #include #include #include "xlibrgb.h" +#include "nslog.h" + +NS_IMPL_LOG(nsFontMetricsXlibLog) +#define PRINTF NS_LOG_PRINTF(nsFontMetricsXlibLog) +#define FLUSH NS_LOG_FLUSH(nsFontMetricsXlibLog) #undef USER_DEFINED #define USER_DEFINED "x-user-def" @@ -1467,13 +1472,13 @@ SetUpFontCharSetInfo(nsFontCharSetInfo* aSelf) } } else - fprintf(stderr, "=== nsICharRepresentable %s failed\n", aSelf->mCharSet); + PRINTF("=== nsICharRepresentable %s failed\n", aSelf->mCharSet); } else - fprintf(stderr, "=== GetUnicodeEncoder %s failed\n", aSelf->mCharSet); + PRINTF("=== GetUnicodeEncoder %s failed\n", aSelf->mCharSet); } else - fprintf(stderr, "=== GetCharsetAtom2 %s failed\n", aSelf->mCharSet); + PRINTF("=== GetCharsetAtom2 %s failed\n", aSelf->mCharSet); } #undef DEBUG_DUMP_TREE @@ -2621,7 +2626,7 @@ GetFontNames(char* aPattern, nsFontNodeArray* aNodes) if (NS_FAILED(res)) { #ifdef NOISY_FONTS - fprintf(stderr, "=== cannot get lang group for %s\n", charSetInfo->mCharSet); + PRINTF("=== cannot get lang group for %s\n", charSetInfo->mCharSet); #endif } } @@ -3173,16 +3178,16 @@ nsFontMetricsXlib::FindFont(PRUnichar aChar) #ifdef NS_FONT_DEBUG_CALL_TRACE if (gDebug & NS_FONT_DEBUG_CALL_TRACE) { - printf("FindFont(%04X)[", aChar); + PRINTF("FindFont(%04X)[", aChar); for (PRInt32 i = 0; i < mFonts.Count(); i++) { - printf("%s, ", mFonts.CStringAt(i)->GetBuffer()); + PRINTF("%s, ", mFonts.CStringAt(i)->GetBuffer()); } - printf("]\nreturns "); + PRINTF("]\nreturns "); if (font) { - printf("%s\n", font->mName ? font->mName : "(substitute)"); + PRINTF("%s\n", font->mName ? font->mName : "(substitute)"); } else { - printf("NULL\n"); + PRINTF("NULL\n"); } } #endif diff --git a/mozilla/gfx/src/xlib/nsImageXlib.cpp b/mozilla/gfx/src/xlib/nsImageXlib.cpp index 83c051ea54c..e19d72849a9 100644 --- a/mozilla/gfx/src/xlib/nsImageXlib.cpp +++ b/mozilla/gfx/src/xlib/nsImageXlib.cpp @@ -25,6 +25,11 @@ #include "nsDrawingSurfaceXlib.h" #include "xlibrgb.h" #include "prlog.h" +#include "nslog.h" + +NS_IMPL_LOG(nsImageXlibLog) +#define PRINTF NS_LOG_PRINTF(nsImageXlibLog) +#define FLUSH NS_LOG_FLUSH(nsImageXlibLog) #define IsFlagSet(a,b) ((a) & (b)) @@ -78,7 +83,7 @@ nsImageXlib::~nsImageXlib() NS_ASSERTION(nsnull != mDisplay,"display is null."); #ifdef XLIB_PIXMAP_DEBUG - printf("XFreePixmap(display = %p)\n",mDisplay); + PRINTF("XFreePixmap(display = %p)\n",mDisplay); #endif XFreePixmap(mDisplay, mAlphaPixmap); @@ -91,7 +96,7 @@ nsImageXlib::~nsImageXlib() NS_ASSERTION(nsnull != mDisplay,"display is null."); #ifdef XLIB_PIXMAP_DEBUG - printf("XFreePixmap(display = %p)\n",mDisplay); + PRINTF("XFreePixmap(display = %p)\n",mDisplay); #endif XFreePixmap(mDisplay, mImagePixmap); diff --git a/mozilla/gfx/src/xlib/nsRenderingContextXlib.cpp b/mozilla/gfx/src/xlib/nsRenderingContextXlib.cpp index 90bb14088e4..667b571830c 100644 --- a/mozilla/gfx/src/xlib/nsRenderingContextXlib.cpp +++ b/mozilla/gfx/src/xlib/nsRenderingContextXlib.cpp @@ -29,6 +29,11 @@ #include "xlibrgb.h" #include "prprf.h" #include "prmem.h" +#include "nslog.h" + +NS_IMPL_LOG(nsRenderingContextXlibLog) +#define PRINTF NS_LOG_PRINTF(nsRenderingContextXlibLog) +#define FLUSH NS_LOG_FLUSH(nsRenderingContextXlibLog) static NS_DEFINE_IID(kIRenderingContextIID, NS_IRENDERING_CONTEXT_IID); @@ -208,7 +213,7 @@ nsresult nsRenderingContextXlib::CommonInit(void) Drawable drawable = mRenderingSurface->GetDrawable(); #ifdef XLIB_GFX_NOISY - printf("XGetGeometry(display=%p,drawable=%p)\n", + PRINTF("XGetGeometry(display=%p,drawable=%p)\n", (void *) mDisplay, (void *) drawable); #endif diff --git a/mozilla/gfx/src/xlibrgb/xlibrgb.c b/mozilla/gfx/src/xlibrgb/xlibrgb.c index 56fe0876875..ab845d937ca 100644 --- a/mozilla/gfx/src/xlibrgb/xlibrgb.c +++ b/mozilla/gfx/src/xlibrgb/xlibrgb.c @@ -61,6 +61,12 @@ # include #endif +#include "nslog.h" + +NS_IMPL_LOG(xlibrgbLog) +#define PRINTF NS_LOG_PRINTF(xlibrgbLog) +#define FLUSH NS_LOG_FLUSH(xlibrgbLog) + #define ENABLE_GRAYSCALE #define G_LITTLE_ENDIAN 1 @@ -234,9 +240,7 @@ xlib_rgb_cmap_fail (const char *msg, Colormap cmap, unsigned long *pixels) int n_free; int i; -#ifdef VERBOSE - printf ("%s", msg); -#endif + PRINTF ("%s", msg); n_free = 0; for (i = 0; i < 256; i++) if (pixels[i] < 256) @@ -269,9 +273,7 @@ xlib_rgb_make_colorcube (unsigned long *pixels, int nr, int ng, int nb) for (i = 0; i < 4096; i++) { colorcube[i] = pixels[rt[i >> 8] + gt[(i >> 4) & 0x0f] + bt[i & 0x0f]]; -#ifdef VERBOSE - printf ("%03x %02x %x %x %x\n", i, colorcube[i], rt[i >> 8], gt[(i >> 4) & 0x0f], bt[i & 0x0f]); -#endif + PRINTF ("%03x %02x %x %x %x\n", i, colorcube[i], rt[i >> 8], gt[(i >> 4) & 0x0f], bt[i & 0x0f]); } } @@ -421,9 +423,7 @@ xlib_rgb_try_colormap (int nr, int ng, int nb) } pixels[i] = color.pixel; } -#ifdef VERBOSE - printf ("%d: %lx\n", i, pixels[i]); -#endif + PRINTF ("%d: %lx\n", i, pixels[i]); } image_info->nred_shades = nr; @@ -585,7 +585,7 @@ xlib_rgb_score_visual (XVisualInfo *visual) pseudo = (visual->class == PseudoColor || visual->class == TrueColor); if (xlib_rgb_verbose) - printf ("Visual 0x%x, type = %s, depth = %d, %ld:%ld:%ld%s; score=%x\n", + PRINTF ("Visual 0x%x, type = %s, depth = %d, %ld:%ld:%ld%s; score=%x\n", (int)visual->visualid, visual_names[visual->class], visual->depth, @@ -593,7 +593,7 @@ xlib_rgb_score_visual (XVisualInfo *visual) visual->green_mask, visual->blue_mask, sys ? " (system)" : "", - (quality << 12) | (speed << 8) | (sys << 4) | pseudo); + (quality << 12) | (speed << 8) | (sys << 4) | pseudo); return (quality << 12) | (speed << 8) | (sys << 4) | pseudo; } @@ -720,10 +720,8 @@ xlib_rgb_set_gray_cmap (Colormap cmap) color.blue = i * 257; status = XAllocColor(image_info->display, cmap, &color); pixels[i] = color.pixel; -#ifdef VERBOSE - printf ("allocating pixel %d, %x %x %x, result %d\n", - color.pixel, color.red, color.green, color.blue, status); -#endif + PRINTF ("allocating pixel %d, %x %x %x, result %d\n", + color.pixel, color.red, color.green, color.blue, status); } /* Now, we make fake colorcubes - we ultimately just use the pseudocolor @@ -769,12 +767,12 @@ xlib_rgb_init_with_depth (Display *display, Screen *screen, int prefDepth) /* check endian sanity */ #if G_BYTE_ORDER == G_BIG_ENDIAN if (((char *)byte_order)[0] == 1) { - printf ("xlib_rgb_init: compiled for big endian, but this is a little endian machine.\n\n"); + PRINTF ("xlib_rgb_init: compiled for big endian, but this is a little endian machine.\n\n"); exit(1); } #else if (((char *)byte_order)[0] != 1) { - printf ("xlib_rgb_init: compiled for little endian, but this is a big endian machine.\n\n"); + PRINTF ("xlib_rgb_init: compiled for little endian, but this is a big endian machine.\n\n"); exit(1); } #endif @@ -851,10 +849,10 @@ xlib_rgb_init_with_depth (Display *display, Screen *screen, int prefDepth) xlib_rgb_do_colormaps (); } if (xlib_rgb_verbose) - printf ("color cube: %d x %d x %d\n", + PRINTF ("color cube: %d x %d x %d\n", image_info->nred_shades, image_info->ngreen_shades, - image_info->nblue_shades); + image_info->nblue_shades); if (!image_info->cmap_alloced) image_info->cmap = image_info->default_colormap; @@ -964,15 +962,13 @@ xlib_rgb_xpixel_from_rgb (uint32 rgb) else if (image_info->x_visual_info->class == TrueColor || image_info->x_visual_info->class == DirectColor) { -#ifdef VERBOSE - printf ("shift, prec: r %d %d g %d %d b %d %d\n", - image_info->red_shift, - image_info->red_prec, - image_info->green_shift, - image_info->green_prec, - image_info->blue_shift, - image_info->blue_prec); -#endif + PRINTF ("shift, prec: r %d %d g %d %d b %d %d\n", + image_info->red_shift, + image_info->red_prec, + image_info->green_shift, + image_info->green_prec, + image_info->blue_shift, + image_info->blue_prec); pixel = (((((rgb & 0xff0000) >> 16) >> (8 - image_info->red_prec)) << @@ -1303,9 +1299,7 @@ xlib_rgb_preprocess_dm_565 (void) { dith = DM[0][i] >> 3; DM_565[i] = (dith << 20) | dith | (((7 - dith) >> 1) << 10); -#ifdef VERBOSE - printf ("%i %x %x\n", i, dith, DM_565[i]); -#endif + PRINTF ("%i %x %x\n", i, dith, DM_565[i]); } } } @@ -2955,9 +2949,9 @@ xlib_rgb_select_conv (XImage *image, ByteOrder byte_order) depth = image_info->x_visual_info->depth; bpp = image->bits_per_pixel; if (xlib_rgb_verbose) - printf ("Chose visual 0x%x, image bpp=%d, %s first\n", - (int)image_info->x_visual_info->visual->visualid, - bpp, byte_order == LSB_FIRST ? "lsb" : "msb"); + PRINTF ("Chose visual 0x%x, image bpp=%d, %s first\n", + (int)image_info->x_visual_info->visual->visualid, + bpp, byte_order == LSB_FIRST ? "lsb" : "msb"); #if G_BYTE_ORDER == G_BIG_ENDIAN byterev = (byte_order == LSB_FIRST); @@ -3147,7 +3141,7 @@ xlib_rgb_alloc_scratch_image (void) XFlush(image_info->display); #endif #ifdef VERBOSE - printf ("flush, %d puts since last flush\n", sincelast); + PRINTF ("flush, %d puts since last flush\n", sincelast); sincelast = 0; #endif static_image_idx = 0; @@ -3226,7 +3220,7 @@ xlib_rgb_alloc_scratch (int width, int height, int *ax, int *ay) } image = static_image[idx]; #ifdef VERBOSE - printf ("index %d, x %d, y %d (%d x %d)\n", idx, *ax, *ay, width, height); + PRINTF ("index %d, x %d, y %d (%d x %d)\n", idx, *ax, *ay, width, height); sincelast++; #endif return image; @@ -3417,16 +3411,14 @@ xlib_rgb_cmap_new (uint32 *colors, int n_colors) (image_info->x_visual_info->class == PseudoColor || image_info->x_visual_info->class == GrayScale)) for (i = 0; i < n_colors; i++) - { - rgb = colors[i]; - j = ((rgb & 0xf00000) >> 12) | - ((rgb & 0xf000) >> 8) | - ((rgb & 0xf0) >> 4); -#ifdef VERBOSE - printf ("%d %x %x %d\n", i, j, colorcube[j]); -#endif - cmap->lut[i] = colorcube[j]; - } + { + rgb = colors[i]; + j = ((rgb & 0xf00000) >> 12) | + ((rgb & 0xf000) >> 8) | + ((rgb & 0xf0) >> 4); + PRINTF ("%d %x %x %d\n", i, j, colorcube[j]); + cmap->lut[i] = colorcube[j]; + } return cmap; } diff --git a/mozilla/gfx/src/xprint/nsFontMetricsXP.cpp b/mozilla/gfx/src/xprint/nsFontMetricsXP.cpp index e58262f993c..c67ccc4db4c 100644 --- a/mozilla/gfx/src/xprint/nsFontMetricsXP.cpp +++ b/mozilla/gfx/src/xprint/nsFontMetricsXP.cpp @@ -35,6 +35,11 @@ #include "nsCOMPtr.h" #include "nspr.h" #include "plhash.h" +#include "nslog.h" + +NS_IMPL_LOG(nsFontMetricsXPLog) +#define PRINTF NS_LOG_PRINTF(nsFontMetricsXPLog) +#define FLUSH NS_LOG_FLUSH(nsFontMetricsXPLog) #include #include @@ -123,11 +128,7 @@ static PRBool FontEnumCallback(const nsString& aFamily, PRBool aGeneric, void *aData) { #ifdef REALLY_NOISY_FONTS -#ifdef DEBUG - printf("font = '"); - fputs(aFamily, stdout); - printf("'\n"); -#endif + PRINTF("font = '%s'\n") aFamily); #endif nsFontMetricsXP* metrics = (nsFontMetricsXP*) aData; if (metrics->mFontsCount == metrics->mFontsAlloc) { @@ -283,10 +284,8 @@ nsFontMetricsXP::PickAppropriateSize(char **names, XFontStruct *fonts, // If the closest smaller font is closer than the closest larger // font, use it. #ifdef NOISY_FONTS -#ifdef DEBUG - printf(" *** desiredPix=%d(%d) min=%d max=%d *** ", + PRINTF(" *** desiredPix=%d(%d) min=%d max=%d *** ", desiredPix, desired, closestMin, closestMax); -#endif #endif if (desiredPix - closestMin <= closestMax - desiredPix) { return names[minIndex]; @@ -341,9 +340,7 @@ void nsFontMetricsXP::RealizeFont() { mXHeight = nscoord(pr * f); #ifdef REALLY_NOISY_FONTS -#ifdef DEBUG - printf("xHeight=%d\n", mXHeight); -#endif + PRINTF("xHeight=%d\n", mXHeight); #endif } } @@ -354,9 +351,7 @@ void nsFontMetricsXP::RealizeFont() * fonts served by xfsft (not xfstt!) */ mUnderlineOffset = -NSToIntRound(pr * f); #ifdef REALLY_NOISY_FONTS -#ifdef DEBUG - printf("underlineOffset=%d\n", mUnderlineOffset); -#endif + PRINTF("underlineOffset=%d\n", mUnderlineOffset); #endif } else @@ -373,9 +368,7 @@ void nsFontMetricsXP::RealizeFont() /* this will only be provided from adobe .afm fonts */ mUnderlineSize = nscoord(PR_MAX(f, NSToIntRound(pr * f))); #ifdef REALLY_NOISY_FONTS -#ifdef DEBUG - printf("underlineSize=%d\n", mUnderlineSize); -#endif + PRINTF("underlineSize=%d\n", mUnderlineSize); #endif } else @@ -390,9 +383,7 @@ void nsFontMetricsXP::RealizeFont() { mSuperscriptOffset = nscoord(PR_MAX(f, NSToIntRound(pr * f))); #ifdef REALLY_NOISY_FONTS -#ifdef DEBUG - printf("superscriptOffset=%d\n", mSuperscriptOffset); -#endif + PRINTF("superscriptOffset=%d\n", mSuperscriptOffset); #endif } else @@ -404,9 +395,7 @@ void nsFontMetricsXP::RealizeFont() { mSubscriptOffset = nscoord(PR_MAX(f, NSToIntRound(pr * f))); #ifdef REALLY_NOISY_FONTS -#ifdef DEBUG - printf("subscriptOffset=%d\n", mSubscriptOffset); -#endif + PRINTF("subscriptOffset=%d\n", mSubscriptOffset); #endif } else @@ -1171,11 +1160,11 @@ static char* gDumpStyles[3] = { "normal", "italic", "oblique" }; static PRIntn DumpCharSet(PLHashEntry* he, PRIntn i, void* arg) { - printf(" %s\n", (char*) he->key); + PRINTF(" %s\n", (char*) he->key); nsFontCharSet* charSet = (nsFontCharSet*) he->value; for (int sizeIndex = 0; sizeIndex < charSet->mSizesCount; sizeIndex++) { nsFontXP* size = &charSet->mSizes[sizeIndex]; - printf(" %d %s\n", size->mSize, size->mName); + PRINTF(" %d %s\n", size->mSize, size->mName); } return HT_ENUMERATE_NEXT; } @@ -1186,15 +1175,15 @@ DumpFamily(nsFontFamily* aFamily) for (int styleIndex = 0; styleIndex < 3; styleIndex++) { nsFontStyle* style = aFamily->mStyles[styleIndex]; if (style) { - printf(" style: %s\n", gDumpStyles[styleIndex]); + PRINTF(" style: %s\n", gDumpStyles[styleIndex]); for (int weightIndex = 0; weightIndex < 8; weightIndex++) { nsFontWeight* weight = style->mWeights[weightIndex]; if (weight) { - printf(" weight: %d\n", (weightIndex + 1) * 100); + PRINTF(" weight: %d\n", (weightIndex + 1) * 100); for (int stretchIndex = 0; stretchIndex < 9; stretchIndex++) { nsFontStretch* stretch = weight->mStretches[stretchIndex]; if (stretch) { - printf(" stretch: %d\n", stretchIndex + 1); + PRINTF(" stretch: %d\n", stretchIndex + 1); PL_HashTableEnumerateEntries(stretch->mCharSets, DumpCharSet, nsnull); } @@ -1210,7 +1199,7 @@ DumpFamilyEnum(PLHashEntry* he, PRIntn i, void* arg) { char buf[256]; ((nsString*) he->key)->ToCString(buf, sizeof(buf)); - printf("family: %s\n", buf); + PRINTF("family: %s\n", buf); nsFontFamily* family = (nsFontFamily*) he->value; DumpFamily(family); @@ -1828,10 +1817,10 @@ PickASizeAndLoad(nsFontSearch* aSearch, nsFontStretch* aStretch, nsFontXP* result = s; if ((begin != nsnull) && (end != nsnull)) { for (s = begin; s < end; s++) { - printf("%d/%d ", s->mSize, s->mActualSize); + PRINTF("%d/%d ", s->mSize, s->mActualSize); } } - printf("%s[%s]: desired %d chose %d\n", aSearch->mFont->mName, + PRINTF("%s[%s]: desired %d chose %d\n", aSearch->mFont->mName, aSearch->mFont->mCharSetInfo->mCharSet, desiredSize, result->mActualSize); #endif @@ -2057,9 +2046,7 @@ TryCharSet(nsFontSearch* aSearch, nsFontCharSet* aCharSet) nsFontStyle* style = aCharSet->mStyles[f->mStyleIndex]; if (!style) { #ifdef REALLY_NOISY_FONTS -#ifdef DEBUG - printf(" ==> skiping style index %d\n", f->mStyleIndex); -#endif + PRINTF(" ==> skiping style index %d\n", f->mStyleIndex); #endif return; // skip dummy entries } @@ -2109,10 +2096,8 @@ TryCharSet(nsFontSearch* aSearch, nsFontCharSet* aCharSet) } #ifdef REALLY_NOISY_FONTS -#ifdef DEBUG - printf(" ==> charset=%s weightIndex=%d strechIndex=%d\n", aCharSet->mInfo->mCharSet, + PRINTF(" ==> charset=%s weightIndex=%d strechIndex=%d\n", aCharSet->mInfo->mCharSet, weightIndex, f->mStretchIndex); -#endif #endif PickASizeAndLoad(aSearch, weights[weightIndex]->mStretches[f->mStretchIndex], aCharSet); @@ -2131,10 +2116,8 @@ SearchCharSet(PLHashEntry* he, PRIntn i, void* arg) #endif PRUnichar c = search->mChar; #ifdef REALLY_NOISY_FONTS -#ifdef DEBUG - printf("%s: searching for character c=0x%x (%d) '%c' in %s\n", + PRINTF("%s: searching for character c=0x%x (%d) '%c' in %s\n", search->mFont ? search->mFont->mName : "(no-name)", c, c, c, charSetInfo->mCharSet); -#endif #endif if (charSetInfo->mCharSet) { if (!map) { @@ -2155,9 +2138,7 @@ SearchCharSet(PLHashEntry* he, PRIntn i, void* arg) if (m->mFontsIndex >= m->mFontsCount) { if (!IS_REPRESENTABLE(map, c)) { #ifdef REALLY_NOISY_FONTS -#ifdef DEBUG - printf(" ==> character not representable, trying next character set\n"); -#endif + PRINTF(" ==> character not representable, trying next character set\n"); #endif return HT_ENUMERATE_NEXT; } @@ -2172,9 +2153,7 @@ SearchCharSet(PLHashEntry* he, PRIntn i, void* arg) TryCharSet(search, charSet); if (search->mFont) { #ifdef REALLY_NOISY_FONTS -#ifdef DEBUG - printf(" ==> found '%s'\n", search->mFont->mName); -#endif + PRINTF(" ==> found '%s'\n", search->mFont->mName); #endif return HT_ENUMERATE_STOP; } @@ -2298,14 +2277,12 @@ GetFontNames(char* aPattern) } if (!charSetInfo) { #ifdef NOISY_FONTS -#ifdef DEBUG - printf("cannot find charset %s\n", charSetName); -#endif + PRINTF("cannot find charset %s\n", charSetName); #endif continue; } if (charSetInfo == &Ignore) { - // XXX printf("ignoring %s\n", charSetName); + // XXX PRINTF("ignoring %s\n", charSetName); continue; } @@ -2375,9 +2352,7 @@ GetFontNames(char* aPattern) int weightNumber = (int) PL_HashTableLookup(gWeights, weightName); if (!weightNumber) { #ifdef NOISY_FONTS -#ifdef DEBUG - printf("cannot find weight %s\n", weightName); -#endif + PRINTF("cannot find weight %s\n", weightName); #endif weightNumber = NS_FONT_WEIGHT_NORMAL; } @@ -2394,9 +2369,7 @@ GetFontNames(char* aPattern) int stretchIndex = (int) PL_HashTableLookup(gStretches, setWidth); if (!stretchIndex) { #ifdef NOISY_FONTS -#ifdef DEBUG - printf("cannot find stretch %s\n", setWidth); -#endif + PRINTF("cannot find stretch %s\n", setWidth); #endif stretchIndex = 5; } diff --git a/mozilla/gfx/src/xprint/nsXPrintContext.cpp b/mozilla/gfx/src/xprint/nsXPrintContext.cpp index f058e43e1d5..2188fdedafa 100644 --- a/mozilla/gfx/src/xprint/nsXPrintContext.cpp +++ b/mozilla/gfx/src/xprint/nsXPrintContext.cpp @@ -24,6 +24,11 @@ #include #include "xlibrgb.h" #include "nsXPrintContext.h" +#include "nslog.h" + +NS_IMPL_LOG(nsXPrintContextLog) +#define PRINTF NS_LOG_PRINTF(nsXPrintContextLog) +#define FLUSH NS_LOG_FLUSH(nsXPrintContextLog) #undef XPRINT_ON_SCREEN @@ -32,7 +37,7 @@ Display * nsXPrintContext::mDisplay = (Display *)0; static int xerror_handler(Display *display, XErrorEvent *ev) { char errmsg[80]; XGetErrorText(display, ev->error_code, errmsg, 80); - fprintf(stderr, "lib_xprint: Warning (X Error) - %s\n", errmsg); + PRINTF("lib_xprint: Warning (X Error) - %s\n", errmsg); return 0; } @@ -86,7 +91,7 @@ nsXPrintContext::Init(nsIDeviceContextSpecXP *aSpec) } if (nsnull == mDisplay) { if (!(mDisplay = XOpenDisplay(printservername))) { - fprintf(stderr,"failed to open display '%s'\n", printservername); + PRINTF("failed to open display '%s'\n", printservername); return NS_ERROR_FAILURE; } } diff --git a/mozilla/gfx/tests/btest/BitTest.cpp b/mozilla/gfx/tests/btest/BitTest.cpp index 7d880f6b369..0081cbd1197 100644 --- a/mozilla/gfx/tests/btest/BitTest.cpp +++ b/mozilla/gfx/tests/btest/BitTest.cpp @@ -45,6 +45,11 @@ #include "nsITextWidget.h" #include "nsIBlender.h" #include "nsIServiceManager.h" +#include "nslog.h" + +NS_IMPL_LOG(BitTestLog) +#define PRINTF NS_LOG_PRINTF(BitTestLog) +#define FLUSH NS_LOG_FLUSH(BitTestLog) // widget interface static NS_DEFINE_IID(kITextWidgetIID, NS_ITEXTWIDGET_IID); @@ -419,7 +424,7 @@ PRUint32 size; if(blendamount > 1.0) blendamount = 1.0f; - printf("\nSTARTING TIMING TEST\n"); + PRINTF("\nSTARTING TIMING TEST\n"); ::GetSystemTime(&thetime); min = thetime.wMinute; seconds = thetime.wSecond; @@ -449,7 +454,7 @@ PRUint32 size; else seconds = thetime.wMilliseconds; milli=seconds-milli; - printf("The Blending Time was %lu Milliseconds\n",milli); + PRINTF("The Blending Time was %lu Milliseconds\n",milli); return(milli); } @@ -607,7 +612,7 @@ speedtest(nsIImage *aTheImage,nsIRenderingContext *aSurface, PRInt32 aX, PRInt32 PRUint32 min,seconds,milli,i; SYSTEMTIME thetime; - printf("\nSTARTING TIMING TEST\n"); + PRINTF("\nSTARTING TIMING TEST\n"); ::GetSystemTime(&thetime); min = thetime.wMinute; seconds = thetime.wSecond; @@ -635,9 +640,9 @@ SYSTEMTIME thetime; milli=seconds-milli; if(aOptimize==PR_TRUE) - printf("The Optimized Blitting Time was %lu Milliseconds\n",milli); + PRINTF("The Optimized Blitting Time was %lu Milliseconds\n",milli); else - printf("The Non-Optimized Blitting Time was %lu Milliseconds\n",milli); + PRINTF("The Non-Optimized Blitting Time was %lu Milliseconds\n",milli); return(milli); } diff --git a/mozilla/gfx/tests/coverage/nsCoverage.cpp b/mozilla/gfx/tests/coverage/nsCoverage.cpp index 17c45726fa2..5cecfa58cf1 100644 --- a/mozilla/gfx/tests/coverage/nsCoverage.cpp +++ b/mozilla/gfx/tests/coverage/nsCoverage.cpp @@ -40,6 +40,11 @@ #include "nsIComponentManager.h" #include "nsWidgetsCID.h" #include "nsIAppShell.h" +#include "nslog.h" + +NS_IMPL_LOG(nsCoverageLog) +#define PRINTF NS_LOG_PRINTF(nsCoverageLog) +#define FLUSH NS_LOG_FLUSH(nsCoverageLog) //------------------------------------------------------------------------------ @@ -276,7 +281,7 @@ nsEventStatus PR_CALLBACK HandleEvent(nsGUIEvent *aEvent) (ke->isShift?"Pressed":"Released"), (ke->isControl?"Pressed":"Released"), (ke->isAlt?"Pressed":"Released")); - printf("%s\n", str); + PRINTF("%s\n", str); switch(ke->keyCode) { case 'U': gOffsetY -= 9; @@ -365,7 +370,7 @@ nsresult CoverageTest(int *argc, char **argv) fputs("Created AppShell\n", stderr); appShell->Create(argc, argv); } else { - printf("AppShell is null!\n"); + PRINTF("AppShell is null!\n"); } nsIDeviceContext* deviceContext = 0; diff --git a/mozilla/htmlparser/robot/nsDebugRobot.cpp b/mozilla/htmlparser/robot/nsDebugRobot.cpp index 41be60fa94d..5ddc1d7753c 100644 --- a/mozilla/htmlparser/robot/nsDebugRobot.cpp +++ b/mozilla/htmlparser/robot/nsDebugRobot.cpp @@ -37,6 +37,11 @@ static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID); #include "nsIComponentManager.h" #include "nsParserCIID.h" +#include "nslog.h" + +NS_IMPL_LOG(nsDebugRobotLog) +#define PRINTF NS_LOG_PRINTF(nsDebugRobotLog) +#define FLUSH NS_LOG_FLUSH(nsDebugRobotLog) static NS_DEFINE_IID(kIRobotSinkObserverIID, NS_IROBOTSINKOBSERVER_IID); @@ -260,9 +265,9 @@ extern "C" NS_EXPORT int DebugRobot( rv = uri->QueryInterface(NS_GET_IID(nsIURI), (void**)&url); NS_RELEASE(uri); if (NS_OK != rv) { - printf("invalid URL: '"); + PRINTF("invalid URL: '"); fputs(*urlName, stdout); - printf("'\n"); + PRINTF("'\n"); NS_RELEASE(myObserver); return -1; } @@ -288,7 +293,7 @@ extern "C" NS_EXPORT int DebugRobot( (void **)&parser); if (NS_OK != rv) { - printf("can't make parser\n"); + PRINTF("can't make parser\n"); NS_RELEASE(myObserver); return -1; } @@ -296,7 +301,7 @@ extern "C" NS_EXPORT int DebugRobot( nsIRobotSink* sink; rv = NS_NewRobotSink(&sink); if (NS_OK != rv) { - printf("can't make parser\n"); + PRINTF("can't make parser\n"); NS_RELEASE(myObserver); return -1; } diff --git a/mozilla/htmlparser/src/CNavDTD.cpp b/mozilla/htmlparser/src/CNavDTD.cpp index 28409508a84..d36312ff0ec 100644 --- a/mozilla/htmlparser/src/CNavDTD.cpp +++ b/mozilla/htmlparser/src/CNavDTD.cpp @@ -54,7 +54,11 @@ #include "nsVoidArray.h" #include "prmem.h" +#include "nslog.h" +NS_IMPL_LOG(CNavDTDLog) +#define PRINTF NS_LOG_PRINTF(CNavDTDLog) +#define FLUSH NS_LOG_FLUSH(CNavDTDLog) static NS_DEFINE_IID(kIHTMLContentSinkIID, NS_IHTML_CONTENT_SINK_IID); static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); @@ -474,9 +478,9 @@ nsresult CNavDTD::BuildModel(nsIParser* aParser,nsITokenizer* aTokenizer,nsIToke if(n>50) n=50; for(int i=0;iGetTokenAt(i); - printf("\nToken[%i],%p",i,theToken); + PRINTF("\nToken[%i],%p",i,theToken); } - printf("\n"); + PRINTF("\n"); #endif if(mDTDState!=NS_ERROR_HTMLPARSER_STOPPARSING) { @@ -578,11 +582,11 @@ nsresult CNavDTD::DidBuildModel(nsresult anErrorCode,PRBool aNotifySink,nsIParse if(2==gShowCRC) { if(mComputedCRC32!=mExpectedCRC32) { if(mExpectedCRC32!=0) { - printf("CRC Computed: %u Expected CRC: %u\n,",mComputedCRC32,mExpectedCRC32); + PRINTF("CRC Computed: %u Expected CRC: %u\n,",mComputedCRC32,mExpectedCRC32); result = aSink->DidBuildModel(2); } else { - printf("Computed CRC: %u.\n",mComputedCRC32); + PRINTF("Computed CRC: %u.\n",mComputedCRC32); result = aSink->DidBuildModel(3); } } @@ -642,7 +646,7 @@ nsresult CNavDTD::HandleToken(CToken* aToken,nsIParser* aParser){ --------------------------------------------------------------------------------- */ - // printf("token: %p\n",aToken); + // PRINTF("token: %p\n",aToken); if(mSkipTarget){ //handle a preexisting target... if((theTag==mSkipTarget) && (eToken_end==theType)){ diff --git a/mozilla/htmlparser/src/COtherDTD.cpp b/mozilla/htmlparser/src/COtherDTD.cpp index 8a5bd5cf7ef..f6e7cce65eb 100644 --- a/mozilla/htmlparser/src/COtherDTD.cpp +++ b/mozilla/htmlparser/src/COtherDTD.cpp @@ -50,7 +50,6 @@ #include "prmem.h" - static NS_DEFINE_IID(kIHTMLContentSinkIID, NS_IHTML_CONTENT_SINK_IID); static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); static NS_DEFINE_IID(kIDTDIID, NS_IDTD_IID); @@ -234,7 +233,7 @@ COtherDTD::~COtherDTD(){ #if 0 PRInt32 count=gNodeCount-mSharedNodes.GetSize(); if(count) { - printf("%i of %i nodes leaked!\n",count,gNodeCount); + PRINTF("%i of %i nodes leaked!\n",count,gNodeCount); } #endif #endif diff --git a/mozilla/htmlparser/src/COtherElements.h b/mozilla/htmlparser/src/COtherElements.h index 8f542b343a7..5998355db74 100644 --- a/mozilla/htmlparser/src/COtherElements.h +++ b/mozilla/htmlparser/src/COtherElements.h @@ -34,6 +34,11 @@ #define _COTHERELEMENTS_ #include "nsDTDUtils.h" +#include "nslog.h" + +NS_IMPL_LOG(COtherElementsLog) +#define PRINTF NS_LOG_PRINTF(COtherElementsLog) +#define FLUSH NS_LOG_FLUSH(COtherElementsLog) /************************************************************************ This union is a bitfield which describes the group membership @@ -2363,88 +2368,88 @@ void CElementTable::DebugDumpGroups(CElement* aTag){ const char* tag=nsHTMLTags::GetStringValue(aTag->mTag); const char* prefix=" "; - printf("\n\nTag: <%s>\n",tag); - printf(prefix); + PRINTF("\n\nTag: <%s>\n",tag); + PRINTF(prefix); if(aTag->IsContainer()) { - if(aTag->mContainsGroups.mBits.mHead) printf("head "); - if(aTag->mContainsGroups.mBits.mHeadMisc) printf("headmisc "); - if(aTag->mContainsGroups.mBits.mHeadContent) printf("headcontent "); - if(aTag->mContainsGroups.mBits.mTable) printf("table "); - if(aTag->mContainsGroups.mBits.mTextContainer) printf("text "); - if(aTag->mContainsGroups.mBits.mTopLevel) printf("toplevel "); - if(aTag->mContainsGroups.mBits.mDTDInternal) printf("internal "); + if(aTag->mContainsGroups.mBits.mHead) PRINTF("head "); + if(aTag->mContainsGroups.mBits.mHeadMisc) PRINTF("headmisc "); + if(aTag->mContainsGroups.mBits.mHeadContent) PRINTF("headcontent "); + if(aTag->mContainsGroups.mBits.mTable) PRINTF("table "); + if(aTag->mContainsGroups.mBits.mTextContainer) PRINTF("text "); + if(aTag->mContainsGroups.mBits.mTopLevel) PRINTF("toplevel "); + if(aTag->mContainsGroups.mBits.mDTDInternal) PRINTF("internal "); if(aTag->mContainsGroups.mBits.mFlowEntity) { - printf("block inline "); + PRINTF("block inline "); } else { if (aTag->mContainsGroups.mBits.mBlockEntity) { - printf("blockEntity "); + PRINTF("blockEntity "); } if (aTag->mContainsGroups.mBits.mBlock) { - printf("block "); + PRINTF("block "); } if(aTag->mContainsGroups.mBits.mInlineEntity) { - printf("inline "); + PRINTF("inline "); } else { - if(aTag->mContainsGroups.mBits.mFontStyle ) printf("fontstyle "); - if(aTag->mContainsGroups.mBits.mPhrase) printf("phrase "); - if(aTag->mContainsGroups.mBits.mSpecial) printf("special "); - if(aTag->mContainsGroups.mBits.mFormControl) printf("form "); - if(aTag->mContainsGroups.mBits.mHeading) printf("heading "); - if(aTag->mContainsGroups.mBits.mFrame) printf("frame "); - if(aTag->mContainsGroups.mBits.mList) printf("list "); - if(aTag->mContainsGroups.mBits.mPreformatted) printf("pre "); - if(aTag->mContainsGroups.mBits.mSelf) printf("self "); - if(aTag->mContainsGroups.mBits.mLeaf) printf("leaf "); - if(aTag->mContainsGroups.mBits.mWhiteSpace) printf("ws "); - if(aTag->mContainsGroups.mBits.mComment) printf("comment "); + if(aTag->mContainsGroups.mBits.mFontStyle ) PRINTF("fontstyle "); + if(aTag->mContainsGroups.mBits.mPhrase) PRINTF("phrase "); + if(aTag->mContainsGroups.mBits.mSpecial) PRINTF("special "); + if(aTag->mContainsGroups.mBits.mFormControl) PRINTF("form "); + if(aTag->mContainsGroups.mBits.mHeading) PRINTF("heading "); + if(aTag->mContainsGroups.mBits.mFrame) PRINTF("frame "); + if(aTag->mContainsGroups.mBits.mList) PRINTF("list "); + if(aTag->mContainsGroups.mBits.mPreformatted) PRINTF("pre "); + if(aTag->mContainsGroups.mBits.mSelf) PRINTF("self "); + if(aTag->mContainsGroups.mBits.mLeaf) PRINTF("leaf "); + if(aTag->mContainsGroups.mBits.mWhiteSpace) PRINTF("ws "); + if(aTag->mContainsGroups.mBits.mComment) PRINTF("comment "); } } if(aTag->mIncludeKids) { - printf("\n%s",prefix); + PRINTF("\n%s",prefix); eHTMLTags *theKid=aTag->mIncludeKids; - printf("+ "); + PRINTF("+ "); while(eHTMLTag_unknown!=*theKid){ tag=nsHTMLTags::GetCStringValue(*theKid++); - printf("%s ",tag); + PRINTF("%s ",tag); } } if(aTag->mExcludeKids) { - printf("\n%s",prefix); + PRINTF("\n%s",prefix); eHTMLTags *theKid=aTag->mExcludeKids; - printf("- "); + PRINTF("- "); while(eHTMLTag_unknown!=*theKid){ tag=nsHTMLTags::GetCStringValue(*theKid++); - printf("%s ",tag); + PRINTF("%s ",tag); } } if(!aTag->mContainsGroups.mBits.mSelf){ - printf("\n%s - self",prefix); + PRINTF("\n%s - self",prefix); } } else { - printf("empty\n"); + PRINTF("empty\n"); } } void CElementTable::DebugDumpContainment(CElement* anElement){ const char* tag=nsHTMLTags::GetStringValue(anElement->mTag); const char* prefix=" "; - printf("\n\nTag: <%s>\n",tag); - printf(prefix); + PRINTF("\n\nTag: <%s>\n",tag); + PRINTF(prefix); int count=0; int i=0; @@ -2452,11 +2457,11 @@ void CElementTable::DebugDumpContainment(CElement* anElement){ CElement* theChild=mElements[i]; if(anElement->CanContain(theChild,0)){ tag=nsHTMLTags::GetCStringValue(theChild->mTag); - printf("%s ",tag); + PRINTF("%s ",tag); count++; if(18==count) { count=0; - printf("\n%s",prefix); + PRINTF("\n%s",prefix); } } } @@ -2466,14 +2471,14 @@ void CElementTable::DebugDumpInlineElements(const char* aTitle) { PRInt32 theTagID=eHTMLTag_unknown; PRBool result=PR_FALSE; - printf("Inline Elements -- %s: \n",aTitle); + PRINTF("Inline Elements -- %s: \n",aTitle); while(theTagID<=eHTMLTag_userdefined) { CElement *theTag=GetElement((eHTMLTags)theTagID); if(theTag) { result=theTag->IsInlineElement(eHTMLTag_unknown); if(result) { const char* theName=nsHTMLTags::GetCStringValue(theTag->mTag); - printf(" %s\n",theName); + PRINTF(" %s\n",theName); } } theTagID++; @@ -2484,14 +2489,14 @@ void CElementTable::DebugDumpBlockElements(const char* aTitle) { PRInt32 theTagID=eHTMLTag_unknown; PRBool result=PR_FALSE; - printf("Block Elements -- %s: \n",aTitle); + PRINTF("Block Elements -- %s: \n",aTitle); while(theTagID<=eHTMLTag_userdefined) { CElement *theTag=GetElement((eHTMLTags)theTagID); if(theTag) { result=theTag->IsBlockElement(eHTMLTag_unknown); if(result) { const char* theName=nsHTMLTags::GetCStringValue(theTag->mTag); - printf(" %s\n",theName); + PRINTF(" %s\n",theName); } } theTagID++; @@ -2503,12 +2508,12 @@ void CElementTable::DebugDumpContainment(const char* aTitle){ DebugDumpContainment(mElements[eHTMLTag_head]); DebugDumpContainment(mElements[eHTMLTag_html]); DebugDumpContainment(mElements[eHTMLTag_table]); - printf("\n"); + PRINTF("\n"); #endif - printf("==================================================\n"); - printf("%s\n",aTitle); - printf("==================================================\n"); + PRINTF("==================================================\n"); + PRINTF("%s\n",aTitle); + PRINTF("==================================================\n"); int i=0; for(i=1;i50) n=50; for(int i=0;iGetTokenAt(i); - printf("\nToken[%i],%p",i,theToken); + PRINTF("\nToken[%i],%p",i,theToken); } - printf("\n"); + PRINTF("\n"); #endif CToken* theToken=mTokenizer->PopToken(); diff --git a/mozilla/htmlparser/src/nsDTDUtils.cpp b/mozilla/htmlparser/src/nsDTDUtils.cpp index 65d73a01952..b5f11feb60b 100644 --- a/mozilla/htmlparser/src/nsDTDUtils.cpp +++ b/mozilla/htmlparser/src/nsDTDUtils.cpp @@ -29,6 +29,11 @@ #include "nsIObserverService.h" #include "nsIServiceManager.h" +#include "nslog.h" + +NS_IMPL_LOG(nsDTDUtilsLog) +#define PRINTF NS_LOG_PRINTF(nsDTDUtilsLog) +#define FLUSH NS_LOG_FLUSH(nsDTDUtilsLog) MOZ_DECL_CTOR_COUNTER(nsEntryStack); MOZ_DECL_CTOR_COUNTER(nsDTDContext); @@ -1337,7 +1342,7 @@ CNodeRecycler::~CNodeRecycler() { #if 1 PRInt32 count=gNodeCount-mSharedNodes.GetSize(); if(count) { - printf("%i of %i nodes leaked!\n",count,gNodeCount); + PRINTF("%i of %i nodes leaked!\n",count,gNodeCount); } #endif #endif diff --git a/mozilla/htmlparser/src/nsHTMLContentSinkStream.cpp b/mozilla/htmlparser/src/nsHTMLContentSinkStream.cpp index 209b11fd8b8..c3052b24199 100644 --- a/mozilla/htmlparser/src/nsHTMLContentSinkStream.cpp +++ b/mozilla/htmlparser/src/nsHTMLContentSinkStream.cpp @@ -47,6 +47,11 @@ #include "nsFileStream.h" #include "nsNetUtil.h" // for NS_MakeAbsoluteURI +#include "nslog.h" + +NS_IMPL_LOG(nsHTMLContentSinkStreamLog) +#define PRINTF NS_LOG_PRINTF(nsHTMLContentSinkStreamLog) +#define FLUSH NS_LOG_FLUSH(nsHTMLContentSinkStreamLog) static NS_DEFINE_CID(kSaveAsCharsetCID, NS_SAVEASCHARSET_CID); static NS_DEFINE_CID(kEntityConverterCID, NS_ENTITYCONVERTER_CID); @@ -655,7 +660,7 @@ void nsHTMLContentSinkStream::AddStartTag(const nsIParserNode& aNode) #ifdef DEBUG_prettyprint if (isDirty) - printf("AddStartTag(%s): BBO=%d, BAO=%d, BBC=%d, BAC=%d\n", + PRINTF("AddStartTag(%s): BBO=%d, BAO=%d, BBC=%d, BAC=%d\n", name.ToNewCString(), BreakBeforeOpen(tag), BreakAfterOpen(tag), @@ -721,7 +726,7 @@ void nsHTMLContentSinkStream::AddEndTag(const nsIParserNode& aNode) #ifdef DEBUG_prettyprint if (isDirty) - printf("AddEndTag(%s): BBO=%d, BAO=%d, BBC=%d, BAC=%d\n", + PRINTF("AddEndTag(%s): BBO=%d, BAO=%d, BBC=%d, BAC=%d\n", aNode.GetText().ToNewCString(), BreakBeforeOpen(tag), BreakAfterOpen(tag), diff --git a/mozilla/htmlparser/src/nsHTMLToTXTSinkStream.cpp b/mozilla/htmlparser/src/nsHTMLToTXTSinkStream.cpp index 3ad9072040e..75a3559b890 100644 --- a/mozilla/htmlparser/src/nsHTMLToTXTSinkStream.cpp +++ b/mozilla/htmlparser/src/nsHTMLToTXTSinkStream.cpp @@ -52,6 +52,13 @@ #include "nsIOutputStream.h" #include "nsFileStream.h" #include "nsIPref.h" +#include "nslog.h" +#undef PRINTF +#undef FLUSH + +NS_IMPL_LOG(nsHTMLToTXTSinkStreamLog) +#define PRINTF NS_LOG_PRINTF(nsHTMLToTXTSinkStreamLog) +#define FLUSH NS_LOG_FLUSH(nsHTMLToTXTSinkStreamLog) static NS_DEFINE_CID(kCharsetConverterManagerCID, NS_ICHARSETCONVERTERMANAGER_CID); static NS_DEFINE_CID(kLWBrkCID, NS_LWBRK_CID); @@ -551,7 +558,7 @@ nsHTMLToTXTSinkStream::OpenContainer(const nsIParserNode& aNode) if (-1 != style.Find("-moz-pre-wrap", PR_TRUE, whitespace)) { #ifdef DEBUG_preformatted - printf("Set mPreFormatted based on style moz-pre-wrap\n"); + PRINTF("Set mPreFormatted based on style moz-pre-wrap\n"); #endif mPreFormatted = PR_TRUE; mCacheLine = PR_TRUE; @@ -574,7 +581,7 @@ nsHTMLToTXTSinkStream::OpenContainer(const nsIParserNode& aNode) { SetWrapColumn((PRUint32)col); #ifdef DEBUG_preformatted - printf("Set wrap column to %d based on style\n", mWrapColumn); + PRINTF("Set wrap column to %d based on style\n", mWrapColumn); #endif } } @@ -582,7 +589,7 @@ nsHTMLToTXTSinkStream::OpenContainer(const nsIParserNode& aNode) else if (-1 != style.Find("pre", PR_TRUE, whitespace)) { #ifdef DEBUG_preformatted - printf("Set mPreFormatted based on style pre\n"); + PRINTF("Set mPreFormatted based on style pre\n"); #endif mPreFormatted = PR_TRUE; mCacheLine = PR_TRUE; @@ -1396,7 +1403,7 @@ nsHTMLToTXTSinkStream::Write(const nsString& aString) { #ifdef DEBUG_wrapping char* foo = aString.ToNewCString(); - printf("Write(%s): wrap col = %d, mColPos = %d\n", foo, mWrapColumn, mColPos); + PRINTF("Write(%s): wrap col = %d, mColPos = %d\n", foo, mWrapColumn, mColPos); nsMemory::Free(foo); #endif @@ -1455,7 +1462,7 @@ nsHTMLToTXTSinkStream::Write(const nsString& aString) } #ifdef DEBUG_wrapping - printf("No wrapping: newline is %d, totLen is %d; leaving mColPos = %d\n", + PRINTF("No wrapping: newline is %d, totLen is %d; leaving mColPos = %d\n", newline, totLen, mColPos); #endif return; @@ -1475,8 +1482,8 @@ nsHTMLToTXTSinkStream::Write(const nsString& aString) nsString remaining; aString.Right(remaining, totLen - bol); foo = remaining.ToNewCString(); - // printf("Next line: bol = %d, newlinepos = %d, totLen = %d, string = '%s'\n", - // bol, nextpos, totLen, foo); + // PRINTF("Next line: bol = %d, newlinepos = %d, totLen = %d, string = '%s'\n", + // bol, nextpos, totLen, foo)); nsMemory::Free(foo); #endif @@ -1546,7 +1553,7 @@ nsHTMLToTXTSinkStream::Write(const nsString& aString) } } } - } // Continue looping over the string + }// Continue looping over the string } /** diff --git a/mozilla/htmlparser/src/nsParser.cpp b/mozilla/htmlparser/src/nsParser.cpp index e60264c3346..a165eeecdb2 100644 --- a/mozilla/htmlparser/src/nsParser.cpp +++ b/mozilla/htmlparser/src/nsParser.cpp @@ -48,6 +48,12 @@ #include "prenv.h" #include "nsParserCIID.h" #include "nsCOMPtr.h" +#include "nslog.h" + +NS_IMPL_LOG(nsParserLog) +#define PRINTF NS_LOG_PRINTF(nsParserLog) +#define FLUSH NS_LOG_FLUSH(nsParserLog) + //#define rickgdebug static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); @@ -1536,7 +1542,7 @@ nsresult nsParser::EnableParser(PRBool aState){ mParserContext->mParserEnabled=aState; if(aState) { - //printf(" Re-enable parser\n"); + //PRINTF(" Re-enable parser\n"); result=ResumeParse(); if(result!=NS_OK) @@ -1709,7 +1715,7 @@ aMimeType,PRBool aVerifyEnabled,PRBool aLastCall,nsDTDMode aMode){ pc->SetMimeType(aMimeType); mUnusedInput.Truncate(0); - //printf("Parse(string) iterate: %i",PR_FALSE); + //PRINTF("Parse(string) iterate: %i",PR_FALSE); pc->mScanner->Append(aSourceBuffer); result=ResumeParse(PR_FALSE); @@ -1869,7 +1875,7 @@ nsresult nsParser::ParseFragment(const nsAReadableString& aSourceBuffer,void* aK */ nsresult nsParser::ResumeParse(PRBool allowIteration, PRBool aIsFinalChunk) { - //printf(" Resume %i, prev-context: %p\n",allowIteration,mParserContext->mPrevContext); + //PRINTF(" Resume %i, prev-context: %p\n",allowIteration,mParserContext->mPrevContext); nsresult result=NS_OK; @@ -2311,7 +2317,7 @@ theContext->mTransferBufferSize; theNumRead, guess, guessSource)) { #ifdef DEBUG_XMLENCODING - printf("xmlencoding detect- %s\n", guess.ToNewCString()); + PRINTF("xmlencoding detect- %s\n", guess.ToNewCString()); #endif this->SetDocumentCharset(guess, guessSource); } @@ -2324,7 +2330,7 @@ theContext->mTransferBufferSize; unsigned int index=0; for(index=0;indexmTransferBuffer[index]){ - printf("\nNull found at buffer[%i] provided by netlib...\n",index); + PRINTF("\nNull found at buffer[%i] provided by netlib...\n",index); break; } } @@ -2334,7 +2340,7 @@ theContext->mTransferBufferSize; static int dump=0; if(dump) { theContext->mTransferBuffer[theNumRead]=0; - printf("\n\n-----------------------------------------------------%s\n",theContext->mTransferBuffer); + PRINTF("\n\n-----------------------------------------------------%s\n",theContext->mTransferBuffer); } #endif diff --git a/mozilla/htmlparser/src/nsParserModule.cpp b/mozilla/htmlparser/src/nsParserModule.cpp index 0437a40572c..a8b61416e86 100644 --- a/mozilla/htmlparser/src/nsParserModule.cpp +++ b/mozilla/htmlparser/src/nsParserModule.cpp @@ -45,6 +45,11 @@ #include "nsExpatTokenizer.h" #include "nsIParserService.h" #include "nsElementTable.h" +#include "nslog.h" + +NS_IMPL_LOG(nsParserModuleLog) +#define PRINTF NS_LOG_PRINTF(nsParserModuleLog) +#define FLUSH NS_LOG_FLUSH(nsParserModuleLog) static NS_DEFINE_IID(kIParserServiceIID, NS_IPARSERSERVICE_IID); @@ -393,10 +398,8 @@ nsParserModule::RegisterSelf(nsIComponentManager *aCompMgr, rv = aCompMgr->RegisterComponentSpec(*cp->mCID, cp->mDescription, nsnull, aPath, PR_TRUE, PR_TRUE); if (NS_FAILED(rv)) { -#ifdef DEBUG - printf("nsParserModule: unable to register %s component => %x\n", + PRINTF("nsParserModule: unable to register %s component => %x\n", cp->mDescription, rv); -#endif break; } cp++; @@ -414,10 +417,8 @@ nsParserModule::UnregisterSelf(nsIComponentManager *aCompMgr, while (cp < end) { nsresult rv = aCompMgr->UnregisterComponentSpec(*cp->mCID, aPath); if (NS_FAILED(rv)) { -#ifdef DEBUG - printf("nsParserModule: unable to unregister %s component => %x\n", + PRINTF("nsParserModule: unable to unregister %s component => %x\n", cp->mDescription, rv); -#endif } cp++; } diff --git a/mozilla/htmlparser/src/nsViewSourceHTML.cpp b/mozilla/htmlparser/src/nsViewSourceHTML.cpp index 4d40266f469..442d7ffe5f5 100644 --- a/mozilla/htmlparser/src/nsViewSourceHTML.cpp +++ b/mozilla/htmlparser/src/nsViewSourceHTML.cpp @@ -81,7 +81,11 @@ static NS_DEFINE_CID(kPrefCID, NS_PREF_CID); #include "plstr.h" #include "prmem.h" +#include "nslog.h" +NS_IMPL_LOG(nsViewSourceHTMLLog) +#define PRINTF NS_LOG_PRINTF(nsViewSourceHTMLLog) +#define FLUSH NS_LOG_FLUSH(nsViewSourceHTMLLog) #ifdef RAPTOR_PERF_METRICS #include "stopwatch.h" @@ -642,9 +646,9 @@ NS_IMETHODIMP CViewSourceHTML::DidBuildModel(nsresult anErrorCode,PRBool aNotify #ifdef RAPTOR_PERF_METRICS NS_STOP_STOPWATCH(vsTimer); - printf("viewsource timer: "); + PRINTF("viewsource timer: "); vsTimer.Print(); - printf("\n"); + PRINTF("\n"); #endif return result; diff --git a/mozilla/intl/chardet/src/nsCharDetModule.cpp b/mozilla/intl/chardet/src/nsCharDetModule.cpp index 8e6dd609ce2..e8bed2bc523 100644 --- a/mozilla/intl/chardet/src/nsCharDetModule.cpp +++ b/mozilla/intl/chardet/src/nsCharDetModule.cpp @@ -47,6 +47,11 @@ #include "nsDocumentCharsetInfo.h" #include "nsPSMDetectors.h" +#include "nslog.h" + +NS_IMPL_LOG(nsCharDetModuleLog) +#define PRINTF NS_LOG_PRINTF(nsCharDetModuleLog) +#define FLUSH NS_LOG_FLUSH(nsCharDetModuleLog) NS_DEFINE_CID(kJAPSMDetectorCID, NS_JA_PSMDETECTOR_CID); NS_DEFINE_CID(kJAStringPSMDetectorCID, NS_JA_STRING_PSMDETECTOR_CID); @@ -211,7 +216,7 @@ nsCharDetModule::GetClassObject(nsIComponentManager *aCompMgr, rv = NS_ERROR_FACTORY_NOT_REGISTERED; #ifdef DEBUG char* cs = aClass.ToString(); - printf("+++ nsCharDetModule: unable to create factory for %s\n", cs); + PRINTF("+++ nsCharDetModule: unable to create factory for %s\n", cs); nsCRT::free(cs); #endif } @@ -299,9 +304,7 @@ nsCharDetModule::RegisterSelf(nsIComponentManager *aCompMgr, { nsresult rv = NS_OK; -#ifdef DEBUG - printf("*** Registering CharDet components\n"); -#endif + PRINTF("*** Registering CharDet components\n"); Components* cp = gComponents; Components* end = cp + NUM_COMPONENTS; @@ -310,10 +313,8 @@ nsCharDetModule::RegisterSelf(nsIComponentManager *aCompMgr, cp->mContractID, aPath, PR_TRUE, PR_TRUE); if (NS_FAILED(rv)) { -#ifdef DEBUG - printf("nsCharDetModule: unable to register %s component => %x\n", + PRINTF("nsCharDetModule: unable to register %s component => %x\n", cp->mDescription, rv); -#endif break; } cp++; @@ -404,18 +405,14 @@ nsCharDetModule::UnregisterSelf(nsIComponentManager* aCompMgr, nsIFile* aPath, const char* registryLocation) { -#ifdef DEBUG - printf("*** Unregistering CharDet components\n"); -#endif + PRINTF("*** Unregistering CharDet components\n"); Components* cp = gComponents; Components* end = cp + NUM_COMPONENTS; while (cp < end) { nsresult rv = aCompMgr->UnregisterComponentSpec(*cp->mCID, aPath); if (NS_FAILED(rv)) { -#ifdef DEBUG - printf("nsCharDetModule: unable to unregister %s component => %x\n", + PRINTF("nsCharDetModule: unable to unregister %s component => %x\n", cp->mDescription, rv); -#endif } cp++; } diff --git a/mozilla/intl/chardet/src/nsCyrillicDetector.cpp b/mozilla/intl/chardet/src/nsCyrillicDetector.cpp index 102875b7add..71b08ecb30b 100644 --- a/mozilla/intl/chardet/src/nsCyrillicDetector.cpp +++ b/mozilla/intl/chardet/src/nsCyrillicDetector.cpp @@ -37,6 +37,12 @@ #include "nsISupports.h" #include "nsCharDetDll.h" #include "pratom.h" +#include "nslog.h" + +NS_IMPL_LOG(nsCyrillicDetectorLog) +#define PRINTF NS_LOG_PRINTF(nsCyrillicDetectorLog) +#define FLUSH NS_LOG_FLUSH(nsCyrillicDetectorLog) + // temp fix for XPCOM should be remove after alechf fix the xpcom one #define MY_NS_IMPL_QUERY_INTERFACE(_class,_classiiddef,_interface) \ NS_IMETHODIMP _class::QueryInterface(REFNSIID aIID, void** aInstancePtr) \ @@ -146,7 +152,7 @@ void nsCyrillicDetector::DataEnd() #ifdef DEBUG for(j=0;j\t%d\n", mCharsets[j], mProb[j]); + PRINTF("Charset %s->\t%d\n", mCharsets[j], mProb[j]); #endif this->Report(mCharsets[maxIdx]); mDone = PR_TRUE; diff --git a/mozilla/intl/chardet/src/nsPSMDetectors.cpp b/mozilla/intl/chardet/src/nsPSMDetectors.cpp index 8f0e3fdcb13..173e32cf645 100644 --- a/mozilla/intl/chardet/src/nsPSMDetectors.cpp +++ b/mozilla/intl/chardet/src/nsPSMDetectors.cpp @@ -46,6 +46,12 @@ #include "nsISupports.h" #include "nsCharDetDll.h" #include "pratom.h" +#include "nslog.h" + +NS_IMPL_LOG(nsPSMDetectorsLog) +#define PRINTF NS_LOG_PRINTF(nsPSMDetectorsLog) +#define FLUSH NS_LOG_FLUSH(nsPSMDetectorsLog) + // temp fix for XPCOM should be remove after alechf fix the xpcom one #define MY_NS_IMPL_QUERY_INTERFACE(_class,_classiiddef,_interface) \ NS_IMETHODIMP _class::QueryInterface(REFNSIID aIID, void** aInstancePtr) \ @@ -323,7 +329,7 @@ PRBool nsPSMDetector::HandleData(const char* aBuf, PRUint32 aLen) #ifdef ftang_TRACE_STATE if( mVerifier[mItemIdx[j]] == & TRACE_VERIFIER ) { - printf("%d = %d\n", i + mDbgLen, mState[j]); + PRINTF("%d = %d\n", i + mDbgLen, mState[j]); } #endif #ifdef DETECTOR_DEBUG @@ -333,12 +339,12 @@ PRBool nsPSMDetector::HandleData(const char* aBuf, PRUint32 aLen) if(eItsMe == st) { #ifdef DETECTOR_DEBUG - printf("It's %s- byte %d(%x) test %d\n", - mVerifier[mItemIdx[j]]->charset, - i+mDbgLen, - i+mDbgLen, - mDbgTest - ); + PRINTF("It's %s- byte %d(%x) test %d\n", + mVerifier[mItemIdx[j]]->charset, + i+mDbgLen, + i+mDbgLen, + mDbgTest + ); #endif Report( mVerifier[mItemIdx[j]]->charset); mDone = PR_TRUE; @@ -346,10 +352,10 @@ PRBool nsPSMDetector::HandleData(const char* aBuf, PRUint32 aLen) } else if (eError == st) { #ifdef DETECTOR_DEBUG - printf("It's NOT %s- byte %d(%x)\n", - mVerifier[mItemIdx[j]]->charset, - i+mDbgLen, - i+mDbgLen); + PRINTF("It's NOT %s- byte %d(%x)\n", + mVerifier[mItemIdx[j]]->charset, + i+mDbgLen, + i+mDbgLen); #endif mItems--; if(j < mItems ) @@ -365,11 +371,11 @@ PRBool nsPSMDetector::HandleData(const char* aBuf, PRUint32 aLen) { if( 1 == mItems) { #ifdef DETECTOR_DEBUG - printf("It's %s- byte %d (%x) Test %d. The only left\n", - mVerifier[mItemIdx[0]]->charset, - i+mDbgLen, - i+mDbgLen, - mDbgTest); + PRINTF("It's %s- byte %d (%x) Test %d. The only left\n", + mVerifier[mItemIdx[0]]->charset, + i+mDbgLen, + i+mDbgLen, + mDbgTest); #endif Report( mVerifier[mItemIdx[0]]->charset); } @@ -388,11 +394,11 @@ PRBool nsPSMDetector::HandleData(const char* aBuf, PRUint32 aLen) } if(1 == nonUCS2Num) { #ifdef DETECTOR_DEBUG - printf("It's %s- byte %d (%x) Test %d. The only left except UCS2LE/BE\n", - mVerifier[mItemIdx[nonUCS2Idx]]->charset, - i+mDbgLen, - i+mDbgLen, - mDbgTest); + PRINTF("It's %s- byte %d (%x) Test %d. The only left except UCS2LE/BE\n", + mVerifier[mItemIdx[nonUCS2Idx]]->charset, + i+mDbgLen, + i+mDbgLen, + mDbgTest); #endif Report( mVerifier[mItemIdx[nonUCS2Idx]]->charset); mDone = PR_TRUE; @@ -430,13 +436,13 @@ void nsPSMDetector::Sample(const char* aBuf, PRUint32 aLen, PRBool aLastChance) && (eucNum == nonUCS2Num)) { mSampler.CalFreq(); #ifdef DETECTOR_DEBUG - printf("We cannot figure out charset from the encoding, " + PRINTF("We cannot figure out charset from the encoding, " "All EUC based charset share the same encoding structure.\n" "Detect based on statistics"); if(aLastChance) { - printf(" after we receive all the data.\n"); + PRINTF(" after we receive all the data.\n"); } else { - printf(" after we receive enough data.\n"); + PRINTF(" after we receive enough data.\n"); } #endif PRInt32 bestIdx; @@ -452,7 +458,7 @@ void nsPSMDetector::Sample(const char* aBuf, PRUint32 aLen, PRBool aLastChance) mStatisticsData[mItemIdx[j]]->mSecoundByteFreq, mStatisticsData[mItemIdx[j]]->mSecoundByteWeight ); #ifdef DETECTOR_DEBUG - printf("Differences between %s and this data is %2.8f\n", + PRINTF("Differences between %s and this data is %2.8f\n", mVerifier[mItemIdx[j]]->charset, score); #endif @@ -463,8 +469,8 @@ void nsPSMDetector::Sample(const char* aBuf, PRUint32 aLen, PRBool aLastChance) } // if(nsnull != ...) } // for #ifdef DETECTOR_DEBUG - printf("Based on the statistic, we decide it is %s", - mVerifier[mItemIdx[bestIdx]]->charset); + PRINTF("Based on the statistic, we decide it is %s", + mVerifier[mItemIdx[bestIdx]]->charset); #endif Report( mVerifier[mItemIdx[bestIdx]]->charset); mDone = PR_TRUE; diff --git a/mozilla/intl/chardet/tests/DetectCharset.cpp b/mozilla/intl/chardet/tests/DetectCharset.cpp index 823c5e31488..b03144002ca 100644 --- a/mozilla/intl/chardet/tests/DetectCharset.cpp +++ b/mozilla/intl/chardet/tests/DetectCharset.cpp @@ -33,7 +33,11 @@ #ifdef XP_UNIX #include #endif +#include "nslog.h" +NS_IMPL_LOG(DetectCharsetLog) +#define PRINTF NS_LOG_PRINTF(DetectCharsetLog) +#define FLUSH NS_LOG_FLUSH(DetectCharsetLog) class nsStatis { public: @@ -124,33 +128,33 @@ void nsBaseStatis::Report() if(mNumOf2Bytes > 0) { /* - printf("LChar Ratio = %d : %d ( %5.3f)\n", + PRINTF("LChar Ratio = %d : %d ( %5.3f)\n", mNumOfLChar, mNumOf2Bytes, - ((float)mNumOfLChar / (float)mNumOf2Bytes) * 100); + ((float)mNumOfLChar / (float)mNumOf2Bytes) * 100); */ float rate = (float) mNumOfLChar / (float) mNumOf2Bytes; float delta = (rate - mR) / mR; delta *= delta * 1000; #ifdef EXPERIMENT - printf("Exp = %f \n",delta); + PRINTF("Exp = %f \n",delta); #endif } /* if(mNumOfLChar > 0) - printf("LWord Word = %d : %d (%5.3f)\n", + PRINTF("LWord Word = %d : %d (%5.3f)\n", mNumOfLWord, mNumOfLChar, - ((float)mNumOfLWord / (float)mNumOfLChar) * 100); + ((float)mNumOfLWord / (float)mNumOfLChar) * 100); if(mNumOfLWord > 0) { PRUint32 ac =0; for(PRUint32 i=0;i<10;i++) { ac += mLWordLen[i]; - printf("LWord Word Length[%d]= %d -> %5.3f%% %5.3f%%\n", i+1, + PRINTF("LWord Word Length[%d]= %d -> %5.3f%% %5.3f%%\n", i+1, mLWordLen[i], (((float)mLWordLen[i] / (float)mNumOfLWord) * 100), (((float)ac / (float)mNumOfLWord) * 100)); @@ -218,9 +222,9 @@ void nsSimpleStatis::Report() float delta = (rate - mR) / mR; delta = delta * delta * (float)100; #ifdef EXPERIMENT - printf("Exp = %f \n",delta); + PRINTF("Exp = %f \n",delta); if(delta < 1.0) - printf("This is %s\n" ,mCharset); + PRINTF("This is %s\n" ,mCharset); #endif } @@ -231,7 +235,7 @@ void nsSimpleStatis::Report() #define MAXBSIZE (1L << 13) void usage() { - printf("Usage: DetectFile detector blocksize\n" + PRINTF("Usage: DetectFile detector blocksize\n" " detector: " "ja_parallel_state_machine," "ko_parallel_state_machine," @@ -255,8 +259,8 @@ class nsReporter : public nsICharsetDetectionObserver NS_IMETHOD Notify(const char* aCharset, nsDetectionConfident aConf) { - printf("RESULT CHARSET : %s\n", aCharset); - printf("RESULT Confident : %d\n", aConf); + PRINTF("RESULT CHARSET : %s\n", aCharset); + PRINTF("RESULT Confident : %d\n", aConf); return NS_OK; }; }; @@ -294,14 +298,14 @@ int main(int argc, char** argv) { if( 3 != argc ) { usage(); - printf("Need 2 arguments\n"); + PRINTF("Need 2 arguments\n"); return(-1); } bs = atoi(argv[2]); if((bs <1)||(bs>MAXBSIZE)) { usage(); - printf("blocksize out of range - %s\n", argv[2]); + PRINTF("blocksize out of range - %s\n", argv[2]); return(-1); } nsresult rev = NS_OK; @@ -309,8 +313,8 @@ int main(int argc, char** argv) { rev = GetDetector(argv[1], &det); if(NS_FAILED(rev) || (nsnull == det) ){ usage(); - printf("Invalid Detector - %s\n", argv[1]); - printf("XPCOM ERROR CODE = %x\n", rev); + PRINTF("Invalid Detector - %s\n", argv[1]); + PRINTF("XPCOM ERROR CODE = %x\n", rev); return(-1); } nsICharsetDetectionObserver *obs = nsnull; @@ -320,11 +324,11 @@ int main(int argc, char** argv) { NS_IF_RELEASE(obs); if(NS_FAILED(rev)) { - printf("XPCOM ERROR CODE = %x\n", rev); + PRINTF("XPCOM ERROR CODE = %x\n", rev); return(-1); } } else { - printf("XPCOM ERROR CODE = %x\n", rev); + PRINTF("XPCOM ERROR CODE = %x\n", rev); return(-1); } @@ -339,12 +343,12 @@ int main(int argc, char** argv) { sz = read(0, buf, bs); if(sz > 0) { if(! done) { -printf("call DoIt %d\n",sz); + PRINTF("call DoIt %d\n",sz); rev = det->DoIt( buf, sz, &done); -printf("DoIt return Done = %d\n",done); + PRINTF("DoIt return Done = %d\n",done); if(NS_FAILED(rev)) { - printf("XPCOM ERROR CODE = %x\n", rev); + PRINTF("XPCOM ERROR CODE = %x\n", rev); return(-1); } } @@ -355,12 +359,12 @@ printf("DoIt return Done = %d\n",done); } while(sz > 0); if(!done) { -printf("Done = %d\n",done); -printf("call Done %d\n",sz); + PRINTF("Done = %d\n",done); + PRINTF("call Done %d\n",sz); rev = det->Done(); if(NS_FAILED(rev)) { - printf("XPCOM ERROR CODE = %x\n", rev); + PRINTF("XPCOM ERROR CODE = %x\n", rev); return(-1); } } @@ -368,9 +372,9 @@ printf("call Done %d\n",sz); stat[i]->DataEnd(); stat[i]->Report(); } -printf( "Done\n"); + PRINTF( "Done\n"); NS_IF_RELEASE(det); -printf( "Done 2\n"); + PRINTF( "Done 2\n"); return (0); } diff --git a/mozilla/intl/locale/src/mac/nsLocaleSHLIB.cpp b/mozilla/intl/locale/src/mac/nsLocaleSHLIB.cpp index 53f761e4279..06f8c0eb18d 100644 --- a/mozilla/intl/locale/src/mac/nsLocaleSHLIB.cpp +++ b/mozilla/intl/locale/src/mac/nsLocaleSHLIB.cpp @@ -38,6 +38,11 @@ #include "nsIServiceManager.h" #include "nsMacLocaleFactory.h" #include "nsILanguageAtomService.h" +#include "nslog.h" + +NS_IMPL_LOG(nsLocaleSHLIBLog) +#define PRINTF NS_LOG_PRINTF(nsLocaleSHLIBLog) +#define FLUSH NS_LOG_FLUSH(nsLocaleSHLIBLog) static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID); @@ -102,7 +107,7 @@ extern "C" NS_EXPORT nsresult NSGetFactory(nsISupports* serviceMgr, *aFactory = NULL; delete factory; } - printf("returning nsLocaleFactory\n"); + PRINTF("returning nsLocaleFactory\n"); return res; } diff --git a/mozilla/intl/locale/src/os2/nsLocaleModule.cpp b/mozilla/intl/locale/src/os2/nsLocaleModule.cpp index b86b09021e2..4de82227528 100644 --- a/mozilla/intl/locale/src/os2/nsLocaleModule.cpp +++ b/mozilla/intl/locale/src/os2/nsLocaleModule.cpp @@ -52,6 +52,11 @@ #include "nsCollationCID.h" #include "nsIServiceManager.h" #include "nsLanguageAtomService.h" +#include "nslog.h" + +NS_IMPL_LOG(nsLocaleModuleLog) +#define PRINTF NS_LOG_PRINTF(nsLocaleModuleLog) +#define FLUSH NS_LOG_FLUSH(nsLocaleModuleLog) static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID); @@ -255,9 +260,7 @@ nsLocaleModule::RegisterSelf(nsIComponentManager *aCompMgr, { nsresult rv = NS_OK; -#ifdef DEBUG - printf("*** Registering locale components\n"); -#endif + PRINTF("*** Registering locale components\n"); Components* cp = gComponents; Components* end = cp + NUM_COMPONENTS; @@ -266,10 +269,8 @@ nsLocaleModule::RegisterSelf(nsIComponentManager *aCompMgr, cp->mContractID, aPath, PR_TRUE, PR_TRUE); if (NS_FAILED(rv)) { -#ifdef DEBUG - printf("nsLocaleModule: unable to register %s component => %x\n", + PRINTF("nsLocaleModule: unable to register %s component => %x\n", cp->mDescription, rv); -#endif break; } cp++; @@ -283,18 +284,14 @@ nsLocaleModule::UnregisterSelf(nsIComponentManager* aCompMgr, nsIFile* aPath, const char* registryLocation) { -#ifdef DEBUG - printf("*** Unregistering locale components\n"); -#endif + PRINTF("*** Unregistering locale components\n"); Components* cp = gComponents; Components* end = cp + NUM_COMPONENTS; while (cp < end) { nsresult rv = aCompMgr->UnregisterComponentSpec(*cp->mCID, aPath); if (NS_FAILED(rv)) { -#ifdef DEBUG - printf("nsLocaleModule: unable to unregister %s component => %x\n", + PRINTF("nsLocaleModule: unable to unregister %s component => %x\n", cp->mDescription, rv); -#endif } cp++; } diff --git a/mozilla/intl/locale/src/unix/nsCollationUnix.cpp b/mozilla/intl/locale/src/unix/nsCollationUnix.cpp index 6509f444590..ccead673ae4 100644 --- a/mozilla/intl/locale/src/unix/nsCollationUnix.cpp +++ b/mozilla/intl/locale/src/unix/nsCollationUnix.cpp @@ -33,6 +33,12 @@ #include "nsCOMPtr.h" #include "nsFileSpec.h" /* for nsAutoString */ #include "nsIPref.h" +#include "nslog.h" + +NS_IMPL_LOG(nsCollationUnixLog) +#define PRINTF NS_LOG_PRINTF(nsCollationUnixLog) +#define FLUSH NS_LOG_FLUSH(nsCollationUnixLog) + //#define DEBUG_UNIX_COLLATION static NS_DEFINE_IID(kICollationIID, NS_ICOLLATION_IID); @@ -155,11 +161,11 @@ nsresult nsCollationUnix::Initialize(nsILocale* locale) #if defined(DEBUG_UNIX_COLLATION) nsAutoCString tmp(mLocale); if (NULL != (const char *)tmp) { - printf("nsCollationUnix::Initialize mLocale = %s\n", (const char *)tmp); + PRINTF("nsCollationUnix::Initialize mLocale = %s\n", (const char *)tmp); } nsAutoCString tmp2(mCharset); if (NULL != (const char *)tmp2) { - printf("nsCollationUnix::Initialize mCharset = %s\n", (const char *)tmp2); + PRINTF("nsCollationUnix::Initialize mCharset = %s\n", (const char *)tmp2); } #endif diff --git a/mozilla/intl/locale/src/unix/nsLocaleModule.cpp b/mozilla/intl/locale/src/unix/nsLocaleModule.cpp index b357a255dfa..e6300bde787 100644 --- a/mozilla/intl/locale/src/unix/nsLocaleModule.cpp +++ b/mozilla/intl/locale/src/unix/nsLocaleModule.cpp @@ -44,6 +44,11 @@ #include "nsIServiceManager.h" #include "nsCOMPtr.h" #include "nsLanguageAtomService.h" +#include "nslog.h" + +NS_IMPL_LOG(nsLocaleModuleLog) +#define PRINTF NS_LOG_PRINTF(nsLocaleModuleLog) +#define FLUSH NS_LOG_FLUSH(nsLocaleModuleLog) static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID); @@ -247,9 +252,7 @@ nsLocaleModule::RegisterSelf(nsIComponentManager *aCompMgr, { nsresult rv = NS_OK; -#ifdef DEBUG - printf("*** Registering locale components\n"); -#endif + PRINTF("*** Registering locale components\n"); Components* cp = gComponents; Components* end = cp + NUM_COMPONENTS; @@ -258,10 +261,8 @@ nsLocaleModule::RegisterSelf(nsIComponentManager *aCompMgr, cp->mContractID, aPath, PR_TRUE, PR_TRUE); if (NS_FAILED(rv)) { -#ifdef DEBUG - printf("nsLocaleModule: unable to register %s component => %x\n", + PRINTF("nsLocaleModule: unable to register %s component => %x\n", cp->mDescription, rv); -#endif break; } cp++; @@ -275,18 +276,14 @@ nsLocaleModule::UnregisterSelf(nsIComponentManager* aCompMgr, nsIFile* aPath, const char* registryLocation) { -#ifdef DEBUG - printf("*** Unregistering locale components\n"); -#endif + PRINTF("*** Unregistering locale components\n"); Components* cp = gComponents; Components* end = cp + NUM_COMPONENTS; while (cp < end) { nsresult rv = aCompMgr->UnregisterComponentSpec(*cp->mCID, aPath); if (NS_FAILED(rv)) { -#ifdef DEBUG - printf("nsLocaleModule: unable to unregister %s component => %x\n", + PRINTF("nsLocaleModule: unable to unregister %s component => %x\n", cp->mDescription, rv); -#endif } cp++; } diff --git a/mozilla/intl/locale/src/windows/nsIWin32LocaleImpl.cpp b/mozilla/intl/locale/src/windows/nsIWin32LocaleImpl.cpp index 6f61e67d6f6..08924c9b3b8 100644 --- a/mozilla/intl/locale/src/windows/nsIWin32LocaleImpl.cpp +++ b/mozilla/intl/locale/src/windows/nsIWin32LocaleImpl.cpp @@ -28,6 +28,11 @@ #include "nsLocaleCID.h" #include "prprf.h" #include +#include "nslog.h" + +NS_IMPL_LOG(nsIWin32LocaleImplLog) +#define PRINTF NS_LOG_PRINTF(nsIWin32LocaleImplLog) +#define FLUSH NS_LOG_FLUSH(nsIWin32LocaleImplLog) NS_DEFINE_IID(kIWin32LocaleIID, NS_IWIN32LOCALE_IID); NS_DEFINE_IID(kIWin32LocaleImplCID, NS_WIN32LOCALE_CID); @@ -534,7 +539,7 @@ test_internal_tables(void) for(i=1;i=0) - fprintf(stderr,"nsLocale: language_list %s and %s are not ordered\n",dbg_list[i-1].iso_code,dbg_list[i].iso_code); + PRINTF("nsLocale: language_list %s and %s are not ordered\n",dbg_list[i-1].iso_code,dbg_list[i].iso_code); } i=0; @@ -542,11 +547,11 @@ test_internal_tables(void) i++; } if (i!=LENGTH_MAPPING_LIST) - fprintf(stderr,"nsLocale: language_list length is %d, reported length is %d\n",i,LENGTH_MAPPING_LIST); + PRINTF("nsLocale: language_list length is %d, reported length is %d\n",i,LENGTH_MAPPING_LIST); for(i=0;iLoad(in); @@ -140,7 +143,7 @@ nsStringBundle::GetStringFromID(PRInt32 aID, nsString& aResult) #ifdef DEBUG_tao_ char *s = aResult.ToNewCString(); - printf("\n** GetStringFromID: aResult=%s, len=%d\n", s?s:"null", + PRINTF("\n** GetStringFromID: aResult=%s, len=%d\n", s?s:"null", aResult.Length()); delete s; #endif /* DEBUG_tao_ */ @@ -158,7 +161,7 @@ nsStringBundle::GetStringFromName(const nsString& aName, nsString& aResult) #ifdef DEBUG_tao_ char *s = aResult.ToNewCString(), *ss = aName.ToNewCString(); - printf("\n** GetStringFromName: aName=%s, aResult=%s, len=%d\n", + PRINTF("\n** GetStringFromName: aName=%s, aResult=%s, len=%d\n", ss?ss:"null", s?s:"null", aResult.Length()); delete s; #endif /* DEBUG_tao_ */ @@ -337,7 +340,7 @@ nsStringBundle::OpenInputStream(nsString& aURLStr, nsIInputStream*& in) #ifdef DEBUG_tao_ { char *s = aURLStr.ToNewCString(); - printf("\n** nsStringBundle::OpenInputStream: %s\n", s?s:"null"); + PRINTF("\n** nsStringBundle::OpenInputStream: %s\n", s?s:"null"); delete s; } #endif @@ -508,7 +511,7 @@ nsExtensibleStringBundle::nsExtensibleStringBundle(const char * aRegistryKey, res = mBundle->AppendElement(bundle); if (NS_FAILED(res)) goto done1; - // printf("Name = %s\n", name); + // PRINTF("Name = %s\n", name); done1: NS_IF_RELEASE(base); @@ -671,7 +674,7 @@ nsStringBundleService::nsStringBundleService() : mBundleMap(MAX_CACHED_BUNDLES, PR_TRUE) { #ifdef DEBUG_tao_ - printf("\n++ nsStringBundleService::nsStringBundleService ++\n"); + PRINTF("\n++ nsStringBundleService::nsStringBundleService ++\n"); #endif NS_INIT_REFCNT(); @@ -841,11 +844,11 @@ nsStringBundleService::CreateBundle(const char* aURLSpec, nsILocale* aLocale, nsIStringBundle** aResult) { #ifdef DEBUG_tao_ - printf("\n++ nsStringBundleService::CreateBundle ++\n"); + PRINTF("\n++ nsStringBundleService::CreateBundle ++\n"); { nsAutoString aURLStr(aURLSpec); char *s = aURLStr.ToNewCString(); - printf("\n** nsStringBundleService::CreateBundle: %s\n", s?s:"null"); + PRINTF("\n** nsStringBundleService::CreateBundle: %s\n", s?s:"null"); delete s; } #endif diff --git a/mozilla/intl/uconv/public/nsICharsetConverterManager.h b/mozilla/intl/uconv/public/nsICharsetConverterManager.h index 4ddee11a0f0..9fd3cf896ce 100644 --- a/mozilla/intl/uconv/public/nsICharsetConverterManager.h +++ b/mozilla/intl/uconv/public/nsICharsetConverterManager.h @@ -30,6 +30,10 @@ #include "nsIUnicodeEncoder.h" #include "nsIUnicodeDecoder.h" #include "nsVoidArray.h" +#include "nslog.h" + +#define CHARSET_PRINTF NS_LOG_PRINTF(nsICharsetConverterManagerLog) +#define CHARSET_FLUSH NS_LOG_FLUSH(nsICharsetConverterManagerLog) #define NS_ICHARSETCONVERTERMANAGER_IID \ {0x3c1c0161, 0x9bd0, 0x11d3, { 0x9d, 0x9, 0x0, 0x50, 0x4, 0x0, 0x7, 0xb2}} @@ -51,6 +55,7 @@ #define NS_IMPL_NSUCONVERTERREGSELF \ +NS_IMPL_LOG(nsICharsetConverterManagerLog) \ static NS_IMETHODIMP \ nsUConverterRegSelf( const char* aFromCharset, \ const char* aToCharset, \ @@ -60,7 +65,7 @@ nsUConverterRegSelf( const char* aFromCharset, \ nsRegistryKey key; \ char buff[1024]; \ PRBool isOpen = PR_FALSE; \ - NS_WITH_SERVICE( nsIRegistry, registry, NS_REGISTRY_CONTRACTID, &res); \ + NS_WITH_SERVICE( nsIRegistry, registry, NS_REGISTRY_CONTRACTID, &res);\ if (NS_FAILED(res)) \ goto done; \ res = registry->IsOpen(&isOpen); \ @@ -79,14 +84,14 @@ nsUConverterRegSelf( const char* aFromCharset, \ res = registry -> AddSubtree(nsIRegistry::Common, buff, &key); \ if (NS_FAILED(res)) \ goto done; \ - res = registry -> SetStringUTF8(key, "source", aFromCharset); \ + res = registry -> SetStringUTF8(key, "source", aFromCharset); \ if (NS_FAILED(res)) \ goto done; \ - res = registry -> SetStringUTF8(key, "destination", aToCharset); \ + res = registry -> SetStringUTF8(key, "destination", aToCharset); \ if (NS_FAILED(res)) \ goto done; \ - printf("RegSelf %s to %s converter complete\n", \ - aFromCharset, aToCharset); \ + CHARSET_PRINTF("RegSelf %s to %s converter complete\n", \ + aFromCharset, aToCharset); \ done: \ return res; \ } @@ -106,7 +111,7 @@ _InstanceClass##UnRegSelf (nsIComponentManager *aCompMgr, \ nsIFile *aPath, \ const char* registryLocation) \ { \ - printf("UnRegSelf " _From " to " _To "converter not implement\n"); \ + CHARSET_PRINTF("UnRegSelf " _From " to " _To "converter not implement\n"); \ return NS_OK; \ } diff --git a/mozilla/intl/uconv/src/nsUConvModule.cpp b/mozilla/intl/uconv/src/nsUConvModule.cpp index 3147f636bd6..be92edc4454 100644 --- a/mozilla/intl/uconv/src/nsUConvModule.cpp +++ b/mozilla/intl/uconv/src/nsUConvModule.cpp @@ -36,6 +36,12 @@ #include "nsUConvDll.h" #include "nsFileSpec.h" #include "nsIFile.h" +#include "nslog.h" + +NS_IMPL_LOG(nsUConvModuleLog) +#define PRINTF NS_LOG_PRINTF(nsUConvModuleLog) +#define FLUSH NS_LOG_FLUSH(nsUConvModuleLog) + //---------------------------------------------------------------------- // Global functions and data [declaration] @@ -184,9 +190,7 @@ nsUConvModule::RegisterSelf(nsIComponentManager *aCompMgr, { nsresult rv = NS_OK; -#ifdef DEBUG - printf("*** Registering uconv components\n"); -#endif + PRINTF("*** Registering uconv components\n"); Components* cp = gComponents; Components* end = cp + NUM_COMPONENTS; @@ -195,10 +199,8 @@ nsUConvModule::RegisterSelf(nsIComponentManager *aCompMgr, cp->mContractID, aPath, PR_TRUE, PR_TRUE); if (NS_FAILED(rv)) { -#ifdef DEBUG - printf("nsUConvModule: unable to register %s component => %x\n", + PRINTF("nsUConvModule: unable to register %s component => %x\n", cp->mDescription, rv); -#endif break; } cp++; @@ -215,18 +217,14 @@ nsUConvModule::UnregisterSelf(nsIComponentManager *aCompMgr, nsIFile* aPath, const char* registryLocation) { -#ifdef DEBUG - printf("*** Unregistering uconv components\n"); -#endif + PRINTF("*** Unregistering uconv components\n"); Components* cp = gComponents; Components* end = cp + NUM_COMPONENTS; while (cp < end) { nsresult rv = aCompMgr->UnregisterComponentSpec(*cp->mCID, aPath); if (NS_FAILED(rv)) { -#ifdef DEBUG - printf("nsUConvModule: unable to unregister %s component => %x\n", + PRINTF("nsUConvModule: unable to unregister %s component => %x\n", cp->mDescription, rv); -#endif } cp++; } diff --git a/mozilla/intl/uconv/tests/TestUConv.cpp b/mozilla/intl/uconv/tests/TestUConv.cpp index 941cf3f0007..52ad1769c81 100644 --- a/mozilla/intl/uconv/tests/TestUConv.cpp +++ b/mozilla/intl/uconv/tests/TestUConv.cpp @@ -24,6 +24,8 @@ #include "nsICharsetConverterManager.h" #include "nsICharsetConverterManager2.h" #include "nsString.h" +#undef printf +#undef fprintf //---------------------------------------------------------------------------- // Global functions and data [declaration] diff --git a/mozilla/intl/uconv/tests/convperf.cpp b/mozilla/intl/uconv/tests/convperf.cpp index 800d7ff3250..2fb0c1ba668 100644 --- a/mozilla/intl/uconv/tests/convperf.cpp +++ b/mozilla/intl/uconv/tests/convperf.cpp @@ -34,6 +34,9 @@ static NS_DEFINE_IID(kICharsetConverterManagerIID, NS_ICHARSETCONVERTERMANAGER_I #include #include #include +#undef printf +#undef fprintf + void usage() { printf( diff --git a/mozilla/intl/uconv/tests/nsTestUConv.cpp b/mozilla/intl/uconv/tests/nsTestUConv.cpp index 6e02a30b2c4..5d89308a29d 100644 --- a/mozilla/intl/uconv/tests/nsTestUConv.cpp +++ b/mozilla/intl/uconv/tests/nsTestUConv.cpp @@ -32,6 +32,8 @@ #include "nsIPlatformCharset.h" #include "nsICharRepresentable.h" #include "prmem.h" +#undef printf +#undef fprintf static NS_DEFINE_CID(kCharsetConverterManagerCID, NS_ICHARSETCONVERTERMANAGER_CID); static NS_DEFINE_IID(kICharsetConverterManagerIID, NS_ICHARSETCONVERTERMANAGER_IID); diff --git a/mozilla/intl/uconv/tests/nsconv.cpp b/mozilla/intl/uconv/tests/nsconv.cpp index fed0649b20b..62c200afb47 100644 --- a/mozilla/intl/uconv/tests/nsconv.cpp +++ b/mozilla/intl/uconv/tests/nsconv.cpp @@ -39,6 +39,9 @@ static NS_DEFINE_IID(kICharsetConverterManagerIID, NS_ICHARSETCONVERTERMANAGER_I #include #include #include +#undef printf +#undef fprintf + void usage() { printf( diff --git a/mozilla/intl/uconv/ucvcn/nsUnicodeToGB2312GL.cpp b/mozilla/intl/uconv/ucvcn/nsUnicodeToGB2312GL.cpp index 289c92ee2eb..73fe498f7fb 100644 --- a/mozilla/intl/uconv/ucvcn/nsUnicodeToGB2312GL.cpp +++ b/mozilla/intl/uconv/ucvcn/nsUnicodeToGB2312GL.cpp @@ -71,7 +71,6 @@ NS_IMETHODIMP nsUnicodeToGB2312GL::ConvertNoBuff(const PRUnichar * aSrc, PRInt32 i=0; PRInt32 iSrcLength = 0; DByte *pDestDBCode; - DByte *pSrcDBCode; PRInt32 iDestLength = 0; PRUnichar unicode; PRUint8 left, right; diff --git a/mozilla/intl/uconv/ucvja/nsUCvJaModule.cpp b/mozilla/intl/uconv/ucvja/nsUCvJaModule.cpp index e6191461e1d..78e77639517 100644 --- a/mozilla/intl/uconv/ucvja/nsUCvJaModule.cpp +++ b/mozilla/intl/uconv/ucvja/nsUCvJaModule.cpp @@ -42,6 +42,7 @@ #include "nsUnicodeToJISx0201.h" #include "nsUnicodeToJISx0208.h" #include "nsUnicodeToJISx0212.h" + //---------------------------------------------------------------------------- // Global functions and data [declaration] diff --git a/mozilla/layout/base/nsAutoCopy.cpp b/mozilla/layout/base/nsAutoCopy.cpp index e19b0a5c10f..530378bacfb 100644 --- a/mozilla/layout/base/nsAutoCopy.cpp +++ b/mozilla/layout/base/nsAutoCopy.cpp @@ -35,6 +35,11 @@ #include "nsIDocument.h" #include "nsSupportsPrimitives.h" +#include "nslog.h" + +NS_IMPL_LOG(nsAutoCopyLog) +#define PRINTF NS_LOG_PRINTF(nsAutoCopyLog) +#define FLUSH NS_LOG_FLUSH(nsAutoCopyLog) // private clipboard data flavors for html copy, used by editor when pasting #define kHTMLContext "text/_moz_htmlcontext" @@ -136,7 +141,7 @@ nsAutoCopyService::NotifySelectionChanged(nsIDOMDocument *aDoc, nsISelection *aS PRBool collapsed; if (!aDoc || !aSel || NS_FAILED(aSel->GetIsCollapsed(&collapsed)) || collapsed) { #ifdef DEBUG_CLIPBOARD - fprintf(stderr, "CLIPBOARD: no selection/collapsed selection\n"); + PRINTF("CLIPBOARD: no selection/collapsed selection\n"); #endif /* clear X clipboard? */ return NS_OK; @@ -216,7 +221,7 @@ nsAutoCopyService::NotifySelectionChanged(nsIDOMDocument *aDoc, nsISelection *aS nsAutoString str; aSel->ToString(str); char *selStr = str.ToNewCString(); - fprintf(stderr, "SELECTION: %s, %p, %p [%s]\n", reasons[reason], doc, aSel, + PRINTF("SELECTION: %s, %p, %p [%s]\n", reasons[reason], doc, aSel, selStr); nsMemory::Free(selStr); #endif diff --git a/mozilla/layout/base/nsCSSFrameConstructor.cpp b/mozilla/layout/base/nsCSSFrameConstructor.cpp index 516cf9a2511..404e24682cf 100644 --- a/mozilla/layout/base/nsCSSFrameConstructor.cpp +++ b/mozilla/layout/base/nsCSSFrameConstructor.cpp @@ -123,6 +123,11 @@ #include "nsPolygonFrame.h" #include "nsPolylineFrame.h" +#include "nslog.h" + +NS_IMPL_LOG(nsCSSFrameConstructorLog) +#define PRINTF NS_LOG_PRINTF(nsCSSFrameConstructorLog) +#define FLUSH NS_LOG_FLUSH(nsCSSFrameConstructorLog) nsresult @@ -8247,7 +8252,7 @@ nsCSSFrameConstructor::ContentAppended(nsIPresContext* aPresContext, { #ifdef DEBUG if (gNoisyContentUpdates) { - printf("nsCSSFrameConstructor::ContentAppended container=%p index=%d\n", + PRINTF("nsCSSFrameConstructor::ContentAppended container=%p index=%d\n", aContainer, aNewIndexInContainer); if (gReallyNoisyContentUpdates && aContainer) { aContainer->List(stdout, 0); @@ -8320,9 +8325,9 @@ nsCSSFrameConstructor::ContentAppended(nsIPresContext* aPresContext, // around. This logic guarantees a correct answer. #ifdef DEBUG if (gNoisyContentUpdates) { - printf("nsCSSFrameConstructor::ContentAppended: parentFrame="); + PRINTF("nsCSSFrameConstructor::ContentAppended: parentFrame="); nsFrame::ListTag(stdout, parentFrame); - printf(" is special\n"); + PRINTF(" is special\n"); } #endif return ReframeContainingBlock(aPresContext, parentFrame); @@ -8551,7 +8556,7 @@ nsCSSFrameConstructor::ContentInserted(nsIPresContext* aPresContext, { #ifdef DEBUG if (gNoisyContentUpdates) { - printf("nsCSSFrameConstructor::ContentInserted container=%p child=%p index=%d\n", + PRINTF("nsCSSFrameConstructor::ContentInserted container=%p child=%p index=%d\n", aContainer, aChild, aIndexInContainer); if (gReallyNoisyContentUpdates) { (aContainer ? aContainer : aChild)->List(stdout, 0); @@ -8748,9 +8753,9 @@ nsCSSFrameConstructor::ContentInserted(nsIPresContext* aPresContext, // around. This logic guarantees a correct answer. #ifdef DEBUG if (gNoisyContentUpdates) { - printf("nsCSSFrameConstructor::ContentInserted: parentFrame="); + PRINTF("nsCSSFrameConstructor::ContentInserted: parentFrame="); nsFrame::ListTag(stdout, parentFrame); - printf(" is special\n"); + PRINTF(" is special\n"); } #endif return ReframeContainingBlock(aPresContext, parentFrame); @@ -8829,10 +8834,10 @@ nsCSSFrameConstructor::ContentInserted(nsIPresContext* aPresContext, blockContent->GetParent(*getter_AddRefs(parentContainer)); #ifdef DEBUG if (gNoisyContentUpdates) { - printf("nsCSSFrameConstructor::ContentInserted: parentFrame="); + PRINTF("nsCSSFrameConstructor::ContentInserted: parentFrame="); nsFrame::ListTag(stdout, parentFrame); - printf(" is special inline\n"); - printf(" ==> blockContent=%p, parentContainer=%p\n", + PRINTF(" is special inline\n"); + PRINTF(" ==> blockContent=%p, parentContainer=%p\n", blockContent.get(), parentContainer.get()); } #endif @@ -9171,7 +9176,7 @@ nsCSSFrameConstructor::ContentRemoved(nsIPresContext* aPresContext, { #ifdef DEBUG if (gNoisyContentUpdates) { - printf("nsCSSFrameConstructor::ContentRemoved container=%p child=%p index=%d\n", + PRINTF("nsCSSFrameConstructor::ContentRemoved container=%p child=%p index=%d\n", aContainer, aChild, aIndexInContainer); if (gReallyNoisyContentUpdates) { aContainer->List(stdout, 0); @@ -9295,9 +9300,9 @@ nsCSSFrameConstructor::ContentRemoved(nsIPresContext* aPresContext, // around. This logic guarantees a correct answer. #ifdef DEBUG if (gNoisyContentUpdates) { - printf("nsCSSFrameConstructor::ContentRemoved: childFrame="); + PRINTF("nsCSSFrameConstructor::ContentRemoved: childFrame="); nsFrame::ListTag(stdout, childFrame); - printf(" is special\n"); + PRINTF(" is special\n"); } #endif return ReframeContainingBlock(aPresContext, childFrame); @@ -9320,13 +9325,13 @@ nsCSSFrameConstructor::ContentRemoved(nsIPresContext* aPresContext, // Trap out to special routine that handles adjusting a blocks // frame tree when first-letter style is present. #ifdef NOISY_FIRST_LETTER - printf("ContentRemoved: containingBlock="); + PRINTF("ContentRemoved: containingBlock="); nsFrame::ListTag(stdout, containingBlock); - printf(" parentFrame="); + PRINTF(" parentFrame="); nsFrame::ListTag(stdout, parentFrame); - printf(" childFrame="); + PRINTF(" childFrame="); nsFrame::ListTag(stdout, childFrame); - printf("\n"); + PRINTF("\n"); #endif // First update the containing blocks structure by removing the @@ -9343,11 +9348,11 @@ nsCSSFrameConstructor::ContentRemoved(nsIPresContext* aPresContext, childFrame->GetParent(&parentFrame); #ifdef NOISY_FIRST_LETTER - printf(" ==> revised parentFrame="); + PRINTF(" ==> revised parentFrame="); nsFrame::ListTag(stdout, parentFrame); - printf(" childFrame="); + PRINTF(" childFrame="); nsFrame::ListTag(stdout, childFrame); - printf("\n"); + PRINTF("\n"); #endif } @@ -9362,7 +9367,7 @@ nsCSSFrameConstructor::ContentRemoved(nsIPresContext* aPresContext, (const nsStyleStruct*&)display); if (display->IsFloating()) { #ifdef NOISY_FIRST_LETTER - printf(" ==> child display is still floating!\n"); + PRINTF(" ==> child display is still floating!\n"); #endif // Get the placeholder frame nsIFrame* placeholderFrame; @@ -9680,9 +9685,9 @@ nsCSSFrameConstructor::StyleChangeReflow(nsIPresContext* aPresContext, // around. This logic guarantees a correct answer. #ifdef DEBUG if (gNoisyContentUpdates) { - printf("nsCSSFrameConstructor::StyleChangeReflow: aFrame="); + PRINTF("nsCSSFrameConstructor::StyleChangeReflow: aFrame="); nsFrame::ListTag(stdout, aFrame); - printf(" is special\n"); + PRINTF(" is special\n"); } #endif ReframeContainingBlock(aPresContext, aFrame); @@ -12139,7 +12144,7 @@ nsCSSFrameConstructor::RemoveFloatingFirstLetterFrames( // Now that everything is set... #ifdef NOISY_FIRST_LETTER - printf("RemoveFloatingFirstLetterFrames: textContent=%p oldTextFrame=%p newTextFrame=%p\n", + PRINTF("RemoveFloatingFirstLetterFrames: textContent=%p oldTextFrame=%p newTextFrame=%p\n", textContent.get(), textFrame, newTextFrame); #endif aFrameManager->SetPlaceholderFrameFor(floater, nsnull); @@ -12705,17 +12710,17 @@ nsCSSFrameConstructor::ConstructInline(nsIPresShell* aPresShell, if (gNoisyInlineConstruction) { nsIFrameDebug* frameDebug; - printf("nsCSSFrameConstructor::ConstructInline:\n"); + PRINTF("nsCSSFrameConstructor::ConstructInline:\n"); if (NS_SUCCEEDED(aNewFrame->QueryInterface(NS_GET_IID(nsIFrameDebug), (void**)&frameDebug))) { - printf(" ==> leading inline frame:\n"); + PRINTF(" ==> leading inline frame:\n"); frameDebug->List(aPresContext, stdout, 2); } if (NS_SUCCEEDED(blockFrame->QueryInterface(NS_GET_IID(nsIFrameDebug), (void**)&frameDebug))) { - printf(" ==> block frame:\n"); + PRINTF(" ==> block frame:\n"); frameDebug->List(aPresContext, stdout, 2); } if (NS_SUCCEEDED(inlineFrame->QueryInterface(NS_GET_IID(nsIFrameDebug), (void**)&frameDebug))) { - printf(" ==> trailing inline frame:\n"); + PRINTF(" ==> trailing inline frame:\n"); frameDebug->List(aPresContext, stdout, 2); } } @@ -12896,7 +12901,7 @@ nsCSSFrameConstructor::WipeContainingBlock(nsIPresContext* aPresContext, aBlockContent->GetParent(*getter_AddRefs(parentContainer)); #ifdef DEBUG if (gNoisyContentUpdates) { - printf("nsCSSFrameConstructor::WipeContainingBlock: aBlockContent=%p parentContainer=%p\n", + PRINTF("nsCSSFrameConstructor::WipeContainingBlock: aBlockContent=%p parentContainer=%p\n", aBlockContent, parentContainer.get()); } #endif @@ -13107,7 +13112,7 @@ nsCSSFrameConstructor::ReframeContainingBlock(nsIPresContext* aPresContext, nsIF #ifdef DEBUG if (gNoisyContentUpdates) { - printf(" ==> blockContent=%p, parentContainer=%p\n", + PRINTF(" ==> blockContent=%p, parentContainer=%p\n", blockContent.get(), parentContainer.get()); } #endif diff --git a/mozilla/layout/base/nsCSSRendering.cpp b/mozilla/layout/base/nsCSSRendering.cpp index 411f2df3735..29bf434bca8 100644 --- a/mozilla/layout/base/nsCSSRendering.cpp +++ b/mozilla/layout/base/nsCSSRendering.cpp @@ -40,6 +40,11 @@ #include "nsHTMLAtoms.h" #include "nsIDocument.h" #include "nsIScrollableFrame.h" +#include "nslog.h" + +NS_IMPL_LOG(nsCSSRenderingLog) +#define PRINTF NS_LOG_PRINTF(nsCSSRenderingLog) +#define FLUSH NS_LOG_FLUSH(nsCSSRenderingLog) static NS_DEFINE_IID(kScrollViewIID, NS_ISCROLLABLEVIEW_IID); @@ -1049,8 +1054,8 @@ PRIntn whichSide=0; dashRect.y -= topEdge->mWidth; // account for the topmost left edge corner with the leftmost top edge if (0) { - printf(" L: totalLength = %d, borderOutside.y = %d, midpoint %d, dashRect.y = %d\n", - totalLength, borderOutside.y, borderOutside.y +(totalLength/2), dashRect.y); + PRINTF(" L: totalLength = %d, borderOutside.y = %d, midpoint %d, dashRect.y = %d\n", + totalLength, borderOutside.y, borderOutside.y +(totalLength/2), dashRect.y); } currRect = dashRect; @@ -1070,8 +1075,8 @@ PRIntn whichSide=0; //draw if necessary if (0) { - printf("DASHED LEFT: xywh in loop currRect = %d %d %d %d %s\n", - currRect.x, currRect.y, currRect.width, currRect.height, bSolid?"TRUE":"FALSE"); + PRINTF("DASHED LEFT: xywh in loop currRect = %d %d %d %d %s\n", + currRect.x, currRect.y, currRect.width, currRect.height, bSolid?"TRUE":"FALSE"); } if (bSolid) { aContext.FillRect(currRect); @@ -1104,8 +1109,8 @@ PRIntn whichSide=0; //draw if necessary if (0) { - printf("DASHED LEFT: xywh in loop currRect = %d %d %d %d %s\n", - currRect.x, currRect.y, currRect.width, currRect.height, bSolid?"TRUE":"FALSE"); + PRINTF("DASHED LEFT: xywh in loop currRect = %d %d %d %d %s\n", + currRect.x, currRect.y, currRect.width, currRect.height, bSolid?"TRUE":"FALSE"); } if (bSolid) { aContext.FillRect(currRect); @@ -1415,7 +1420,7 @@ PRBool GetBGColorForHTMLElement( nsIPresContext *aPresContext, }// if tag == html or body #ifdef DEBUG else { - printf( "Root Content is not HTML or BODY: cannot get bgColor of HTML or BODY\n"); + PRINTF( "Root Content is not HTML or BODY: cannot get bgColor of HTML or BODY\n"); } #endif NS_RELEASE(tag); diff --git a/mozilla/layout/base/nsCaret.cpp b/mozilla/layout/base/nsCaret.cpp index 6c4d4e367ea..ef9c7754735 100644 --- a/mozilla/layout/base/nsCaret.cpp +++ b/mozilla/layout/base/nsCaret.cpp @@ -49,6 +49,11 @@ #include "nsISelectionController.h" #include "nsCaret.h" +#include "nslog.h" + +NS_IMPL_LOG(nsCaretLog) +#define PRINTF NS_LOG_PRINTF(nsCaretLog) +#define FLUSH NS_LOG_FLUSH(nsCaretLog) // Because of drawing issues, we currently always make a new RC. See bug 28068 // Before removing this, stuff will need to be fixed and tested on all platforms. @@ -739,7 +744,7 @@ void nsCaret::DrawCaret() mLastCaretFrame->GetPointFromOffset(presContext, mRendContext, mLastContentOffset, &framePos); caretRect += framePos; - //printf("Content offset %ld, frame offset %ld\n", focusOffset, framePos.x); + //PRINTF("Content offset %ld, frame offset %ld\n", focusOffset, framePos.x); if(mCaretTwipsWidth < 0) {// need to re-compute the pixel width mCaretTwipsWidth = 15 * mCaretPixelsWidth;//uhhhh... diff --git a/mozilla/layout/base/nsDocumentViewer.cpp b/mozilla/layout/base/nsDocumentViewer.cpp index 59a576257a6..aa5642734f7 100644 --- a/mozilla/layout/base/nsDocumentViewer.cpp +++ b/mozilla/layout/base/nsDocumentViewer.cpp @@ -80,7 +80,6 @@ #include "nsIDOMHTMLFrameSetElement.h" #include "nsIFrameManager.h" - #include "nsIChromeRegistry.h" #include "nsIServiceManager.h" @@ -93,6 +92,11 @@ #include "nsISelectionController.h" #include "nsITransformMediator.h" +#include "nslog.h" + +NS_IMPL_LOG(nsDocumentViewerLog) +#define PRINTF NS_LOG_PRINTF(nsDocumentViewerLog) +#define FLUSH NS_LOG_FLUSH(nsDocumentViewerLog) static NS_DEFINE_CID(kEventQueueService, NS_EVENTQUEUESERVICE_CID); @@ -459,7 +463,7 @@ DocumentViewerImpl::BindToDocument(nsISupports *aDoc, const char *aCommand) NS_PRECONDITION(!mDocument, "Viewer is already bound to a document!"); #ifdef NOISY_VIEWER - printf("DocumentViewerImpl::BindToDocument\n"); + PRINTF("DocumentViewerImpl::BindToDocument\n"); #endif nsresult rv; @@ -1550,7 +1554,7 @@ PRInt32 width,height; if (factory) { #ifdef DEBUG_dcone - printf("PRINT JOB STARTING\n"); + PRINTF("PRINT JOB STARTING\n"); #endif nsIDeviceContextSpec *devspec = nsnull; @@ -1622,48 +1626,48 @@ PRInt32 width,height; float a1,a2; PRInt32 i1,i2; - printf("CRITICAL PRINTING INFORMATION\n"); - printf("PRESSHELL(%x) PRESCONTEXT(%x)\nVIEWMANAGER(%x) VIEW(%x)\n", - mPrintPS, mPrintPC,mPrintDC,mPrintVM,mPrintView); + PRINTF("CRITICAL PRINTING INFORMATION\n"); + PRINTF("PRESSHELL(%x) PRESCONTEXT(%x)\nVIEWMANAGER(%x) VIEW(%x)\n", + mPrintPS, mPrintPC,mPrintDC,mPrintVM,mPrintView); // DEVICE CONTEXT INFORMATION from PresContext - printf("DeviceContext of Presentation Context(%x)\n",dx); + PRINTF("DeviceContext of Presentation Context(%x)\n",dx); dx->GetDevUnitsToTwips(a1); dx->GetTwipsToDevUnits(a2); - printf(" DevToTwips = %f TwipToDev = %f\n",a1,a2); + PRINTF(" DevToTwips = %f TwipToDev = %f\n",a1,a2); dx->GetAppUnitsToDevUnits(a1); dx->GetDevUnitsToAppUnits(a2); - printf(" AppUnitsToDev = %f DevUnitsToApp = %f\n",a1,a2); + PRINTF(" AppUnitsToDev = %f DevUnitsToApp = %f\n",a1,a2); dx->GetCanonicalPixelScale(a1); - printf(" GetCanonicalPixelScale = %f\n",a1); + PRINTF(" GetCanonicalPixelScale = %f\n",a1); dx->GetScrollBarDimensions(a1, a2); - printf(" ScrollBar x = %f y = %f\n",a1,a2); + PRINTF(" ScrollBar x = %f y = %f\n",a1,a2); dx->GetZoom(a1); - printf(" Zoom = %f\n",a1); + PRINTF(" Zoom = %f\n",a1); dx->GetDepth((PRUint32&)i1); - printf(" Depth = %d\n",i1); + PRINTF(" Depth = %d\n",i1); dx->GetDeviceSurfaceDimensions(i1,i2); - printf(" DeviceDimension w = %d h = %d\n",i1,i2); + PRINTF(" DeviceDimension w = %d h = %d\n",i1,i2); // DEVICE CONTEXT INFORMATION - printf("DeviceContext created for print(%x)\n",mPrintDC); + PRINTF("DeviceContext created for print(%x)\n",mPrintDC); mPrintDC->GetDevUnitsToTwips(a1); mPrintDC->GetTwipsToDevUnits(a2); - printf(" DevToTwips = %f TwipToDev = %f\n",a1,a2); + PRINTF(" DevToTwips = %f TwipToDev = %f\n",a1,a2); mPrintDC->GetAppUnitsToDevUnits(a1); mPrintDC->GetDevUnitsToAppUnits(a2); - printf(" AppUnitsToDev = %f DevUnitsToApp = %f\n",a1,a2); + PRINTF(" AppUnitsToDev = %f DevUnitsToApp = %f\n",a1,a2); mPrintDC->GetCanonicalPixelScale(a1); - printf(" GetCanonicalPixelScale = %f\n",a1); + PRINTF(" GetCanonicalPixelScale = %f\n",a1); mPrintDC->GetScrollBarDimensions(a1, a2); - printf(" ScrollBar x = %f y = %f\n",a1,a2); + PRINTF(" ScrollBar x = %f y = %f\n",a1,a2); mPrintDC->GetZoom(a1); - printf(" Zoom = %f\n",a1); + PRINTF(" Zoom = %f\n",a1); mPrintDC->GetDepth((PRUint32&)i1); - printf(" Depth = %d\n",i1); + PRINTF(" Depth = %d\n",i1); mPrintDC->GetDeviceSurfaceDimensions(i1,i2); - printf(" DeviceDimension w = %d h = %d\n",i1,i2); + PRINTF(" DeviceDimension w = %d h = %d\n",i1,i2); #endif // Print listener setup... @@ -1682,12 +1686,12 @@ PRInt32 width,height; if(!mIsPrinting){ DocumentReadyForPrinting(); #ifdef DEBUG_dcone - printf("PRINT JOB ENDING, OBSERVER WAS NOT CALLED\n"); + PRINTF("PRINT JOB ENDING, OBSERVER WAS NOT CALLED\n"); #endif } else { // use the observer mechanism to finish the printing #ifdef DEBUG_dcone - printf("PRINTING OBSERVER STARTED\n"); + PRINTF("PRINTING OBSERVER STARTED\n"); #endif } } diff --git a/mozilla/layout/base/nsFrameManager.cpp b/mozilla/layout/base/nsFrameManager.cpp index 041f92f7dab..16c6382bcd8 100644 --- a/mozilla/layout/base/nsFrameManager.cpp +++ b/mozilla/layout/base/nsFrameManager.cpp @@ -53,6 +53,11 @@ #include "nsIContent.h" #include "nsINameSpaceManager.h" #include "nsIXMLContent.h" +#include "nslog.h" + +NS_IMPL_LOG(nsFrameManagerLog) +#define PRINTF NS_LOG_PRINTF(nsFrameManagerLog) +#define FLUSH NS_LOG_FLUSH(nsFrameManagerLog) #define NEW_CONTEXT_PARENTAGE_INVARIANT @@ -66,9 +71,9 @@ #ifdef NOISY_DEBUG #define NOISY_TRACE(_msg) \ - printf("%s",_msg); + PRINTF(("%s",_msg)); #define NOISY_TRACE_FRAME(_msg,_frame) \ - printf("%s ",_msg); nsFrame::ListTag(stdout,_frame); printf("\n"); + PRINTF(("%s ",_msg)); nsFrame::ListTag(stdout,_frame); PRINTF(("\n")); #else #define NOISY_TRACE(_msg); #define NOISY_TRACE_FRAME(_msg,_frame); @@ -386,7 +391,7 @@ NS_IMPL_RELEASE(FrameManager) FrameManager::~FrameManager() { #ifdef NOISY_EVENTS - printf("%p ~FrameManager() start\n", this); + PRINTF(("%p ~FrameManager() start\n", this)); #endif nsCOMPtr presContext; mPresShell->GetPresContext(getter_AddRefs(presContext)); @@ -410,7 +415,7 @@ FrameManager::~FrameManager() delete mUndisplayedMap; DestroyPropertyList(presContext); #ifdef NOISY_EVENTS - printf("%p ~FrameManager() end\n", this); + PRINTF(("%p ~FrameManager() end\n", this)); #endif } @@ -760,7 +765,7 @@ void FrameManager::RevokePostedEvents() { #ifdef NOISY_EVENTS - printf("%p ~RevokePostedEvents() start\n", this); + PRINTF(("%p ~RevokePostedEvents() start\n", this)); #endif if (mPostedEvents) { mPostedEvents = nsnull; @@ -784,7 +789,7 @@ FrameManager::RevokePostedEvents() } } #ifdef NOISY_EVENTS - printf("%p ~RevokePostedEvents() end\n", this); + PRINTF(("%p ~RevokePostedEvents() end\n", this)); #endif } @@ -843,7 +848,7 @@ FrameManager::DequeuePostedEventFor(nsIFrame* aFrame) void FrameManager::HandlePLEvent(CantRenderReplacedElementEvent* aEvent) { #ifdef NOISY_EVENTS - printf("FrameManager::HandlePLEvent() start for FM %p\n", aEvent->owner); + PRINTF(("FrameManager::HandlePLEvent() start for FM %p\n", aEvent->owner)); #endif FrameManager* frameManager = (FrameManager*)aEvent->owner; @@ -870,7 +875,7 @@ FrameManager::HandlePLEvent(CantRenderReplacedElementEvent* aEvent) { frameManager->mStyleSet->CantRenderReplacedElement(presContext, aEvent->mFrame); } #ifdef NOISY_EVENTS - printf("FrameManager::HandlePLEvent() end for FM %p\n", aEvent->owner); + PRINTF(("FrameManager::HandlePLEvent() end for FM %p\n", aEvent->owner)); #endif } @@ -895,7 +900,7 @@ FrameManager::CantRenderReplacedElement(nsIPresContext* aPresContext, nsIFrame* aFrame) { #ifdef NOISY_EVENTS - printf("%p FrameManager::CantRenderReplacedElement called\n", this); + PRINTF(("%p FrameManager::CantRenderReplacedElement called\n", this)); #endif nsIEventQueueService* eventService; nsresult rv; @@ -947,10 +952,10 @@ DumpContext(nsIFrame* aFrame, nsIStyleContext* aContext) frameDebug->GetFrameName(name); fputs(name, stdout); } - fprintf(stdout, " (%p)", aFrame); + PRINTF(" (%p)", aFrame); } if (aContext) { - fprintf(stdout, " style: %p ", aContext); + PRINTF(" style: %p ", aContext); nsIAtom* pseudoTag; aContext->GetPseudoType(pseudoTag); diff --git a/mozilla/layout/base/nsLayoutHistoryState.cpp b/mozilla/layout/base/nsLayoutHistoryState.cpp index f64d0e91e09..9497db37929 100644 --- a/mozilla/layout/base/nsLayoutHistoryState.cpp +++ b/mozilla/layout/base/nsLayoutHistoryState.cpp @@ -1,4 +1,4 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- * * The contents of this file are subject to the Netscape Public * License Version 1.1 (the "License"); you may not use this file @@ -24,6 +24,11 @@ #include "nsILayoutHistoryState.h" #include "nsHashtable.h" #include "nsIStatefulFrame.h" // Get StateType enum +#include "nslog.h" + +NS_IMPL_LOG(nsLayoutHistoryStateLog) +#define PRINTF NS_LOG_PRINTF(nsLayoutHistoryStateLog) +#define FLUSH NS_LOG_FLUSH(nsLayoutHistoryStateLog) MOZ_DECL_CTOR_COUNTER(HistoryKey); @@ -104,10 +109,8 @@ nsLayoutHistoryState::AddState(PRUint32 aContentID, PRBool replaced = mStates.Put (&key, aState); if (replaced) { - // done this way by indication of warren@netscape.com [ipg] -#if 0 - printf("nsLayoutHistoryState::AddState OOPS!. There was already a state in the hash table for the key\n"); -#endif + // done this way by indication of warren@netscape.com [ipg] + PRINTF("nsLayoutHistoryState::AddState OOPS!. There was already a state in the hash table for the key\n"); } return NS_OK; @@ -126,9 +129,7 @@ nsLayoutHistoryState::GetState(PRUint32 aContentID, *aState = (nsIPresState *)state; } else { -#if 0 - printf("nsLayoutHistoryState::GetState, ERROR getting History state for the key\n"); -#endif + PRINTF("nsLayoutHistoryState::GetState, ERROR getting History state for the key\n"); *aState = nsnull; rv = NS_OK; } diff --git a/mozilla/layout/base/nsPresShell.cpp b/mozilla/layout/base/nsPresShell.cpp index a45986d082e..1ea8bd9be59 100644 --- a/mozilla/layout/base/nsPresShell.cpp +++ b/mozilla/layout/base/nsPresShell.cpp @@ -139,6 +139,15 @@ // SubShell map #include "nsDST.h" +#include "nslog.h" +#undef fprintf +#undef PR_NewLogModule +#undef PRLogModuleInfo + +NS_IMPL_LOG(nsPresShellLog) +#define PRINTF NS_LOG_PRINTF(nsPresShellLog) +#define FLUSH NS_LOG_FLUSH(nsPresShellLog) + // supporting bugs 31816, 20760, 22963 // define USE_OVERRIDE to put prefs in as an override stylesheet // otherwise they go in as a Backstop stylesheets @@ -1144,24 +1153,24 @@ nsIPresShell::GetVerifyReflowEnable() if (VERIFY_REFLOW_ON & gVerifyReflowFlags) { gVerifyReflowEnabled = PR_TRUE; } - printf("Note: verifyreflow is %sabled", + PRINTF("Note: verifyreflow is %sabled", gVerifyReflowEnabled ? "en" : "dis"); if (VERIFY_REFLOW_NOISY & gVerifyReflowFlags) { - printf(" (noisy)"); + PRINTF(" (noisy)"); } if (VERIFY_REFLOW_ALL & gVerifyReflowFlags) { - printf(" (all)"); + PRINTF(" (all)"); } if (VERIFY_REFLOW_DUMP_COMMANDS & gVerifyReflowFlags) { - printf(" (show reflow commands)"); + PRINTF(" (show reflow commands)"); } if (VERIFY_REFLOW_NOISY_RC & gVerifyReflowFlags) { - printf(" (noisy reflow commands)"); + PRINTF(" (noisy reflow commands)"); if (VERIFY_REFLOW_REALLY_NOISY_RC & gVerifyReflowFlags) { - printf(" (REALLY noisy reflow commands)"); + PRINTF(" (REALLY noisy reflow commands)"); } } - printf("\n"); + PRINTF("\n"); } #endif return gVerifyReflowEnabled; @@ -1664,11 +1673,9 @@ PresShell::EnablePrefStyleRules(PRBool aEnable, PRUint8 aPrefType/*=0xFF*/) // set to desired state mEnablePrefStyleSheet = aEnable; -#ifdef NS_DEBUG - printf("PrefStyleSheet %s %s\n", - mEnablePrefStyleSheet ? "ENABLED" : "DISABLED", - bChanging ? "(state toggled)" : "(state unchanged)"); -#endif + PRINTF("PrefStyleSheet %s %s\n", + mEnablePrefStyleSheet ? "ENABLED" : "DISABLED", + bChanging ? "(state toggled)" : "(state unchanged)"); // deal with changing state if(bChanging){ @@ -1704,9 +1711,7 @@ PresShell::SetPreferenceStyleRules(PRBool aForceReflow) // XXX: may get more granularity later // (i.e. each pref may be controlled independently) if (!mEnablePrefStyleSheet) { -#ifdef NS_DEBUG - printf("PrefStyleSheet disabled\n"); -#endif + PRINTF("PrefStyleSheet disabled\n"); return PR_TRUE; } @@ -1727,9 +1732,7 @@ PresShell::SetPreferenceStyleRules(PRBool aForceReflow) } if (NS_SUCCEEDED(result)) { -#ifdef NS_DEBUG - printf("Setting Preference Style Rules:\n"); -#endif + PRINTF("Setting Preference Style Rules:\n"); // if here, we need to create rules for the prefs // - this includes the background-color, the text-color, // the link color, the visited link color and the link-underlining @@ -1756,14 +1759,10 @@ PresShell::SetPreferenceStyleRules(PRBool aForceReflow) } } } -#ifdef NS_DEBUG - printf( "Preference Style Rules set: error=%ld\n", (long)result); -#endif + PRINTF( "Preference Style Rules set: error=%ld\n", (long)result); if (aForceReflow){ -#ifdef NS_DEBUG - printf( "*** Forcing reframe! ***\n"); -#endif + PRINTF( "*** Forcing reframe! ***\n"); // this is harsh, but without it the new colors don't appear on the current page // Fortunately, it only happens when the prefs change, a rare event. // XXX - determine why the normal PresContext::RemapStyleAndReflow doesn't cut it @@ -1800,7 +1799,6 @@ nsresult PresShell::ClearPreferenceStyleRules(void) mStyleSet->RemoveBackstopStyleSheet(mPrefStyleSheet); #endif -#ifdef NS_DEBUG #ifdef PREFS_USE_OVERRIDE NS_ASSERTION((numBefore - 1) == mStyleSet->GetNumberOfOverrideStyleSheets(), "Pref stylesheet was not removed"); @@ -1808,8 +1806,7 @@ nsresult PresShell::ClearPreferenceStyleRules(void) NS_ASSERTION((numBefore - 1) == mStyleSet->GetNumberOfBackstopStyleSheets(), "Pref stylesheet was not removed"); #endif - printf("PrefStyleSheet removed\n"); -#endif + PRINTF("PrefStyleSheet removed\n"); // clear the sheet pointer: it is strictly historical now NS_IF_RELEASE(mPrefStyleSheet); } @@ -1843,9 +1840,7 @@ nsresult PresShell::CreatePreferenceStyleSheet(void) result = NS_ERROR_OUT_OF_MEMORY; } -#ifdef NS_DEBUG - printf("CreatePrefStyleSheet completed: error=%ld\n",(long)result); -#endif + PRINTF("CreatePrefStyleSheet completed: error=%ld\n",(long)result); return result; } @@ -1861,9 +1856,7 @@ nsresult PresShell::SetPrefColorRules(void) if (NS_SUCCEEDED(mPresContext->GetCachedBoolPref(kPresContext_UseDocumentColors, useDocColors))) { if (!useDocColors) { -#ifdef NS_DEBUG - printf(" - Creating rules for document colors\n"); -#endif + PRINTF(" - Creating rules for document colors\n"); // OK, not using document colors, so we have to force the user's colors via style rules if (!mPrefStyleSheet) { @@ -1933,9 +1926,7 @@ nsresult PresShell::SetPrefLinkRules(void) nsCOMPtr sheet(do_QueryInterface(mPrefStyleSheet,&result)); if (NS_SUCCEEDED(result)) { -#ifdef NS_DEBUG - printf(" - Creating rules for link and visited colors\n"); -#endif + PRINTF(" - Creating rules for link and visited colors\n"); // support default link colors: // this means the link colors need to be overridable, @@ -1999,15 +1990,11 @@ nsresult PresShell::SetPrefLinkRules(void) // no need for important, we want these to be overridable // NOTE: these must go in the backstop stylesheet or they cannot be // overridden by authors - #ifdef NS_DEBUG - printf (" - Creating rules for enabling link underlines\n"); - #endif + PRINTF (" - Creating rules for enabling link underlines\n"); // make a rule to make text-decoration: underline happen for links strRule.Append(NS_LITERAL_STRING(":link, :visited {text-decoration:underline;}")); } else { - #ifdef NS_DEBUG - printf (" - Creating rules for disabling link underlines\n"); - #endif + PRINTF (" - Creating rules for disabling link underlines\n"); // make a rule to make text-decoration: none happen for links strRule.Append(NS_LITERAL_STRING(":link, :visited {text-decoration:none;}")); } @@ -2247,7 +2234,7 @@ PresShell::InitialReflow(nscoord aWidth, nscoord aHeight) if (uri) { char* url = nsnull; uri->GetSpec(&url); - printf("*** PresShell::InitialReflow (this=%p, url='%s')\n", this, url); + PRINTF("*** PresShell::InitialReflow (this=%p, url='%s')\n", this, url); Recycle(url); } } @@ -2472,7 +2459,7 @@ PresShell::ResizeReflow(nscoord aWidth, nscoord aHeight) // XXX if debugging then we should assert that the cache is empty } else { #ifdef NOISY - printf("PresShell::ResizeReflow: null root frame\n"); + PRINTF("PresShell::ResizeReflow: null root frame\n"); #endif } DidCauseReflow(); @@ -3075,7 +3062,7 @@ PresShell::AlreadyInQueue(nsIReflowCommand* aReflowCommand) RCType == queuedRCType) { #ifdef DEBUG if (VERIFY_REFLOW_NOISY_RC & gVerifyReflowFlags) { - printf("*** PresShell::AlreadyInQueue(): Discarding reflow command: this=%p\n", this); + PRINTF("*** PresShell::AlreadyInQueue(): Discarding reflow command: this=%p\n", this); aReflowCommand->List(stdout); } #endif @@ -3094,15 +3081,15 @@ NS_IMETHODIMP PresShell::AppendReflowCommand(nsIReflowCommand* aReflowCommand) { #ifdef DEBUG - //printf("gShellCounter: %d\n", gShellCounter++); + //PRINTF("gShellCounter: %d\n", gShellCounter++); if (mInVerifyReflow) { return NS_OK; } if (VERIFY_REFLOW_NOISY_RC & gVerifyReflowFlags) { - printf("\nPresShell@%p: adding reflow command\n", this); + PRINTF("\nPresShell@%p: adding reflow command\n", this); aReflowCommand->List(stdout); if (VERIFY_REFLOW_REALLY_NOISY_RC & gVerifyReflowFlags) { - printf("Current content model:\n"); + PRINTF("Current content model:\n"); nsCOMPtr rootContent; rootContent = getter_AddRefs(mDocument->GetRootContent()); if (rootContent) { @@ -3178,9 +3165,9 @@ PresShell::CancelReflowCommand(nsIFrame* aTargetFrame, nsIReflowCommand::ReflowT } #ifdef DEBUG if (VERIFY_REFLOW_NOISY_RC & gVerifyReflowFlags) { - printf("PresShell: removing rc=%p for frame ", rc); + PRINTF("PresShell: removing rc=%p for frame ", rc); nsFrame::ListTag(stdout, aTargetFrame); - printf("\n"); + PRINTF("\n"); } #endif mReflowCommands.RemoveElementAt(i); @@ -5008,7 +4995,7 @@ struct ReflowEvent : public PLEvent { if (presShell) { #ifdef DEBUG if (VERIFY_REFLOW_NOISY_RC & gVerifyReflowFlags) { - printf("\n*** Handling reflow event: PresShell=%p, event=%p\n", presShell.get(), this); + PRINTF("\n*** Handling reflow event: PresShell=%p, event=%p\n", presShell.get(), this); } #endif // XXX Statically cast the pres shell pointer so that we can call @@ -5071,7 +5058,7 @@ PresShell::PostReflowEvent() mPendingReflowEvent = PR_TRUE; #ifdef DEBUG if (VERIFY_REFLOW_NOISY_RC & gVerifyReflowFlags) { - printf("\n*** PresShell::PostReflowEvent(), this=%p, event=%p\n", this, ev); + PRINTF("\n*** PresShell::PostReflowEvent(), this=%p, event=%p\n", this, ev); } #endif } @@ -5117,12 +5104,12 @@ PresShell::ProcessReflowCommands(PRBool aInterruptible) #ifdef DEBUG if (GetVerifyReflowEnable()) { if (VERIFY_REFLOW_ALL & gVerifyReflowFlags) { - printf("ProcessReflowCommands: begin incremental reflow\n"); + PRINTF("ProcessReflowCommands: begin incremental reflow\n"); } } if (VERIFY_REFLOW_DUMP_COMMANDS & gVerifyReflowFlags) { PRInt32 i, n = mReflowCommands.Count(); - printf("\nPresShell::ProcessReflowCommands: this=%p, count=%d\n", this, n); + PRINTF("\nPresShell::ProcessReflowCommands: this=%p, count=%d\n", this, n); for (i = 0; i < n; i++) { nsIReflowCommand* rc = (nsIReflowCommand*) mReflowCommands.ElementAt(i); @@ -5173,8 +5160,8 @@ PresShell::ProcessReflowCommands(PRBool aInterruptible) } #ifdef DEBUG if (VERIFY_REFLOW_DUMP_COMMANDS & gVerifyReflowFlags) { - printf("Time spent in PresShell::ProcessReflowCommands(), this=%p, time=%d micro seconds\n", - this, mAccumulatedReflowTime); + PRINTF("Time spent in PresShell::ProcessReflowCommands(), this=%p, time=%d micro seconds\n", + this, mAccumulatedReflowTime); } #endif mAccumulatedReflowTime = 0; @@ -5182,7 +5169,7 @@ PresShell::ProcessReflowCommands(PRBool aInterruptible) #ifdef DEBUG if (VERIFY_REFLOW_DUMP_COMMANDS & gVerifyReflowFlags) { - printf("\nPresShell::ProcessReflowCommands() finished: this=%p\n", this); + PRINTF("\nPresShell::ProcessReflowCommands() finished: this=%p\n", this); } if (nsIFrameDebug::GetVerifyTreeEnable()) { @@ -5204,12 +5191,12 @@ PresShell::ProcessReflowCommands(PRBool aInterruptible) PRBool ok = VerifyIncrementalReflow(); mInVerifyReflow = PR_FALSE; if (VERIFY_REFLOW_ALL & gVerifyReflowFlags) { - printf("ProcessReflowCommands: finished (%s)\n", + PRINTF("ProcessReflowCommands: finished (%s)\n", ok ? "ok" : "failed"); } if (0 != mReflowCommands.Count()) { - printf("XXX yikes! reflow commands queued during verify-reflow\n"); + PRINTF("XXX yikes! reflow commands queued during verify-reflow\n"); } } #endif @@ -5301,7 +5288,7 @@ PresShell::ReflowCommandAdded(nsIReflowCommand* aRC) } #ifdef DEBUG_nisheeth - printf("presshell=%p, mRCCreatedDuringLoad=%d\n", this, mRCCreatedDuringLoad); + PRINTF("presshell=%p, mRCCreatedDuringLoad=%d\n", this, mRCCreatedDuringLoad); #endif } } @@ -5318,7 +5305,7 @@ PresShell::ReflowCommandRemoved(nsIReflowCommand* aRC) if (flags & NS_RC_CREATED_DURING_DOCUMENT_LOAD) { mRCCreatedDuringLoad--; #ifdef DEBUG_nisheeth - printf("presshell=%p, mRCCreatedDuringLoad=%d\n", this, mRCCreatedDuringLoad); + PRINTF("presshell=%p, mRCCreatedDuringLoad=%d\n", this, mRCCreatedDuringLoad); #endif } @@ -5353,7 +5340,7 @@ PresShell::AddDummyLayoutRequest(void) } #ifdef DEBUG_nisheeth - printf("presshell=%p, Added dummy layout request.\n", this); + PRINTF("presshell=%p, Added dummy layout request.\n", this); #endif } return rv; @@ -5379,7 +5366,7 @@ PresShell::RemoveDummyLayoutRequest(void) } #ifdef DEBUG_nisheeth - printf("presshell=%p, Removed dummy layout request.\n", this); + PRINTF("presshell=%p, Removed dummy layout request.\n", this); #endif } return rv; @@ -5406,7 +5393,7 @@ static NS_DEFINE_CID(kWidgetCID, NS_CHILD_CID); static void LogVerifyMessage(nsIFrame* k1, nsIFrame* k2, const char* aMsg) { - printf("verifyreflow: "); + PRINTF("verifyreflow: "); nsAutoString name; if (nsnull != k1) { nsIFrameDebug* frameDebug; @@ -5419,9 +5406,9 @@ LogVerifyMessage(nsIFrame* k1, nsIFrame* k2, const char* aMsg) else { name.AssignWithConversion("(null)"); } - fputs(name, stdout); + PRINTF(NS_ConvertUCS2toUTF8(name)); - printf(" != "); + PRINTF(" != "); if (nsnull != k2) { nsIFrameDebug* frameDebug; @@ -5434,40 +5421,38 @@ LogVerifyMessage(nsIFrame* k1, nsIFrame* k2, const char* aMsg) else { name.AssignWithConversion("(null)"); } - fputs(name, stdout); + PRINTF(NS_ConvertUCS2toUTF8(name)); - printf(" %s", aMsg); + PRINTF(" %s", aMsg); } static void LogVerifyMessage(nsIFrame* k1, nsIFrame* k2, const char* aMsg, const nsRect& r1, const nsRect& r2) { - printf("VerifyReflow Error:\n"); + PRINTF("VerifyReflow Error:\n"); nsAutoString name; nsIFrameDebug* frameDebug; if (NS_SUCCEEDED(k1->QueryInterface(NS_GET_IID(nsIFrameDebug), (void**)&frameDebug))) { - fprintf(stdout, " "); + PRINTF(" "); frameDebug->GetFrameName(name); - fputs(name, stdout); - fprintf(stdout, " %p ", k1); + PRINTF("%s %p ", name, k1); } - printf("{%d, %d, %d, %d}", r1.x, r1.y, r1.width, r1.height); + PRINTF("{%d, %d, %d, %d}", r1.x, r1.y, r1.width, r1.height); - printf(" != \n"); + PRINTF(" != \n"); if (NS_SUCCEEDED(k2->QueryInterface(NS_GET_IID(nsIFrameDebug), (void**)&frameDebug))) { - fprintf(stdout, " "); + PRINTF(" "); frameDebug->GetFrameName(name); - fputs(name, stdout); - fprintf(stdout, " %p ", k2); + PRINTF("%s %p ", name, k2); } - printf("{%d, %d, %d, %d}\n", r2.x, r2.y, r2.width, r2.height); + PRINTF("{%d, %d, %d, %d}\n", r2.x, r2.y, r2.width, r2.height); - printf(" %s\n", aMsg); + PRINTF(" %s\n", aMsg); } static PRBool @@ -5488,7 +5473,7 @@ CompareTrees(nsIPresContext* aFirstPresContext, nsIFrame* aFirstFrame, if (l1 != l2) { ok = PR_FALSE; LogVerifyMessage(k1, k2, "child counts don't match: "); - printf("%d != %d\n", l1, l2); + PRINTF("%d != %d\n", l1, l2); if (0 == (VERIFY_REFLOW_ALL & gVerifyReflowFlags)) { break; } @@ -5608,8 +5593,8 @@ CompareTrees(nsIPresContext* aFirstPresContext, nsIFrame* aFirstFrame, if (band1.mCount != band2.mCount) { // count mismatch, stop comparing LogVerifyMessage(k1, k2, "band.mCount of space managers differs\n"); - printf("count1= %d, count2=%d, yOffset = %d, size=%d\n", - band1.mCount, band2.mCount, yOffset, small); + PRINTF("count1= %d, count2=%d, yOffset = %d, size=%d\n", + band1.mCount, band2.mCount, yOffset, small); ok = PR_FALSE; } @@ -5623,7 +5608,7 @@ CompareTrees(nsIPresContext* aFirstPresContext, nsIFrame* aFirstFrame, if (!match) { LogVerifyMessage(k1, k2, "band.mTrapezoids of space managers differs\n"); - printf ("index %d\n", trapIndex); + PRINTF("index %d\n", trapIndex); } } } @@ -5633,7 +5618,7 @@ CompareTrees(nsIPresContext* aFirstPresContext, nsIFrame* aFirstFrame, if (band1.mCount != band2.mCount) { // count mismatch, stop comparing LogVerifyMessage(k1, k2, "band.mCount of space managers differs\n"); - printf("count1= %d, count2=%d, yOffset = %d, size=%d\n", + PRINTF("count1= %d, count2=%d, yOffset = %d, size=%d\n", band1.mCount, band2.mCount, yOffset, small); ok = PR_FALSE; @@ -5648,7 +5633,7 @@ CompareTrees(nsIPresContext* aFirstPresContext, nsIFrame* aFirstFrame, if (!match) { LogVerifyMessage(k1, k2, "band.mTrapezoids of space managers differs\n"); - printf ("index %d\n", trapIndex); + PRINTF("index %d\n", trapIndex); } } } @@ -5693,18 +5678,18 @@ CompareTrees(nsIPresContext* aFirstPresContext, nsIFrame* aFirstFrame, nsAutoString tmp; if (nsnull != listName1) { listName1->ToString(tmp); - fputs(tmp, stdout); + PRINTF(NS_ConvertUCS2toUTF8(tmp)); } else - fputs("(null)", stdout); - printf(" != "); + PRINTF("(null)"); + PRINTF(" != "); if (nsnull != listName2) { listName2->ToString(tmp); - fputs(tmp, stdout); + PRINTF(NS_ConvertUCS2toUTF8(tmp)); } else - fputs("(null)", stdout); - printf("\n"); + PRINTF("(null)"); + PRINTF("\n"); NS_IF_RELEASE(listName1); NS_IF_RELEASE(listName2); break; @@ -5758,7 +5743,7 @@ PRBool PresShell::VerifyIncrementalReflow() { if (VERIFY_REFLOW_NOISY & gVerifyReflowFlags) { - printf("Building Verification Tree...\n"); + PRINTF("Building Verification Tree...\n"); } // All the stuff we are creating that needs releasing nsIPresContext* cx; @@ -5863,7 +5848,7 @@ PresShell::VerifyIncrementalReflow() sh->InitialReflow(r.width, r.height); sh->SetVerifyReflowEnable(PR_TRUE); // turn on verify reflow again now that we're done reflowing the test frame tree if (VERIFY_REFLOW_NOISY & gVerifyReflowFlags) { - printf("Verification Tree built, comparing...\n"); + PRINTF("Verification Tree built, comparing...\n"); } // Now that the document has been reflowed, use its frame tree to @@ -5874,14 +5859,14 @@ PresShell::VerifyIncrementalReflow() sh->GetRootFrame(&root2); PRBool ok = CompareTrees(mPresContext, root1, cx, root2); if (!ok && (VERIFY_REFLOW_NOISY & gVerifyReflowFlags)) { - printf("Verify reflow failed, primary tree:\n"); + PRINTF("Verify reflow failed, primary tree:\n"); nsIFrameDebug* frameDebug; if (NS_SUCCEEDED(root1->QueryInterface(NS_GET_IID(nsIFrameDebug), (void**)&frameDebug))) { frameDebug->List(mPresContext, stdout, 0); } - printf("Verification tree:\n"); + PRINTF("Verification tree:\n"); if (NS_SUCCEEDED(root2->QueryInterface(NS_GET_IID(nsIFrameDebug), (void**)&frameDebug))) { frameDebug->List(mPresContext, stdout, 0); @@ -5895,7 +5880,7 @@ PresShell::VerifyIncrementalReflow() NS_RELEASE(sh); NS_RELEASE(vm); if (VERIFY_REFLOW_NOISY & gVerifyReflowFlags) { - printf("Finished Verifying Reflow...\n"); + PRINTF("Finished Verifying Reflow...\n"); } return ok; @@ -6170,14 +6155,14 @@ void ReflowCounter::DisplayTotals(PRUint32 * aArray, const char * aTitle) } ReflowCounter * gTots = (ReflowCounter *)mMgr->LookUp(kGrandTotalsStr); - printf("%25s\t", aTitle); + PRINTF("%25s\t", aTitle); for (i=0;i 0) { gTots->Add((nsReflowReason)i, aArray[i]); } } - printf("%d\n", total); + PRINTF("%d\n", total); } //------------------------------------------------------------------ @@ -6305,16 +6290,16 @@ void ReflowCountMgr::DoGrandTotals() } static const char * title[] = {"Init", "Incrm", "Resze", "Style", "Dirty", "Total"}; - printf("\t\t\t"); + PRINTF("\t\t\t"); PRUint32 i; for (i=0;iGetIsCollapsed(&collapsed)) || collapsed) { #ifdef DEBUG_CLIPBOARD - fprintf(stderr, "CLIPBOARD: no selection/collapsed selection\n"); + PRINTF("CLIPBOARD: no selection/collapsed selection\n"); #endif /* clear X clipboard? */ return NS_OK; @@ -216,7 +221,7 @@ nsAutoCopyService::NotifySelectionChanged(nsIDOMDocument *aDoc, nsISelection *aS nsAutoString str; aSel->ToString(str); char *selStr = str.ToNewCString(); - fprintf(stderr, "SELECTION: %s, %p, %p [%s]\n", reasons[reason], doc, aSel, + PRINTF("SELECTION: %s, %p, %p [%s]\n", reasons[reason], doc, aSel, selStr); nsMemory::Free(selStr); #endif diff --git a/mozilla/layout/base/src/nsCaret.cpp b/mozilla/layout/base/src/nsCaret.cpp index 6c4d4e367ea..ef9c7754735 100644 --- a/mozilla/layout/base/src/nsCaret.cpp +++ b/mozilla/layout/base/src/nsCaret.cpp @@ -49,6 +49,11 @@ #include "nsISelectionController.h" #include "nsCaret.h" +#include "nslog.h" + +NS_IMPL_LOG(nsCaretLog) +#define PRINTF NS_LOG_PRINTF(nsCaretLog) +#define FLUSH NS_LOG_FLUSH(nsCaretLog) // Because of drawing issues, we currently always make a new RC. See bug 28068 // Before removing this, stuff will need to be fixed and tested on all platforms. @@ -739,7 +744,7 @@ void nsCaret::DrawCaret() mLastCaretFrame->GetPointFromOffset(presContext, mRendContext, mLastContentOffset, &framePos); caretRect += framePos; - //printf("Content offset %ld, frame offset %ld\n", focusOffset, framePos.x); + //PRINTF("Content offset %ld, frame offset %ld\n", focusOffset, framePos.x); if(mCaretTwipsWidth < 0) {// need to re-compute the pixel width mCaretTwipsWidth = 15 * mCaretPixelsWidth;//uhhhh... diff --git a/mozilla/layout/base/src/nsContentPolicy.cpp b/mozilla/layout/base/src/nsContentPolicy.cpp index 0e129563294..487492e5ab5 100644 --- a/mozilla/layout/base/src/nsContentPolicy.cpp +++ b/mozilla/layout/base/src/nsContentPolicy.cpp @@ -25,6 +25,15 @@ #include "nsContentPolicyUtils.h" #include "nsContentPolicy.h" #include "nsICategoryManager.h" +#include "nslog.h" + +#ifdef DEBUG_shaver +NS_IMPL_LOG_ENABLED(nsContentPolicyLog) +#else +NS_IMPL_LOG(nsContentPolicyLog) +#endif +#define PRINTF NS_LOG_PRINTF(nsContentPolicyLog) +#define FLUSH NS_LOG_FLUSH(nsContentPolicyLog) NS_IMPL_ISUPPORTS1(nsContentPolicy, nsIContentPolicy) @@ -85,9 +94,7 @@ nsContentPolicy::nsContentPolicy() if (NS_FAILED(string->GetData(getter_Copies(contractid)))) continue; -#ifdef DEBUG_shaver - fprintf(stderr, "POLICY: loading %s\n", (const char *)contractid); -#endif + PRINTF("POLICY: loading %s\n", (const char *)contractid); /* * Create this policy service and add to mPolicies. * diff --git a/mozilla/layout/base/src/nsDocumentViewer.cpp b/mozilla/layout/base/src/nsDocumentViewer.cpp index 59a576257a6..aa5642734f7 100644 --- a/mozilla/layout/base/src/nsDocumentViewer.cpp +++ b/mozilla/layout/base/src/nsDocumentViewer.cpp @@ -80,7 +80,6 @@ #include "nsIDOMHTMLFrameSetElement.h" #include "nsIFrameManager.h" - #include "nsIChromeRegistry.h" #include "nsIServiceManager.h" @@ -93,6 +92,11 @@ #include "nsISelectionController.h" #include "nsITransformMediator.h" +#include "nslog.h" + +NS_IMPL_LOG(nsDocumentViewerLog) +#define PRINTF NS_LOG_PRINTF(nsDocumentViewerLog) +#define FLUSH NS_LOG_FLUSH(nsDocumentViewerLog) static NS_DEFINE_CID(kEventQueueService, NS_EVENTQUEUESERVICE_CID); @@ -459,7 +463,7 @@ DocumentViewerImpl::BindToDocument(nsISupports *aDoc, const char *aCommand) NS_PRECONDITION(!mDocument, "Viewer is already bound to a document!"); #ifdef NOISY_VIEWER - printf("DocumentViewerImpl::BindToDocument\n"); + PRINTF("DocumentViewerImpl::BindToDocument\n"); #endif nsresult rv; @@ -1550,7 +1554,7 @@ PRInt32 width,height; if (factory) { #ifdef DEBUG_dcone - printf("PRINT JOB STARTING\n"); + PRINTF("PRINT JOB STARTING\n"); #endif nsIDeviceContextSpec *devspec = nsnull; @@ -1622,48 +1626,48 @@ PRInt32 width,height; float a1,a2; PRInt32 i1,i2; - printf("CRITICAL PRINTING INFORMATION\n"); - printf("PRESSHELL(%x) PRESCONTEXT(%x)\nVIEWMANAGER(%x) VIEW(%x)\n", - mPrintPS, mPrintPC,mPrintDC,mPrintVM,mPrintView); + PRINTF("CRITICAL PRINTING INFORMATION\n"); + PRINTF("PRESSHELL(%x) PRESCONTEXT(%x)\nVIEWMANAGER(%x) VIEW(%x)\n", + mPrintPS, mPrintPC,mPrintDC,mPrintVM,mPrintView); // DEVICE CONTEXT INFORMATION from PresContext - printf("DeviceContext of Presentation Context(%x)\n",dx); + PRINTF("DeviceContext of Presentation Context(%x)\n",dx); dx->GetDevUnitsToTwips(a1); dx->GetTwipsToDevUnits(a2); - printf(" DevToTwips = %f TwipToDev = %f\n",a1,a2); + PRINTF(" DevToTwips = %f TwipToDev = %f\n",a1,a2); dx->GetAppUnitsToDevUnits(a1); dx->GetDevUnitsToAppUnits(a2); - printf(" AppUnitsToDev = %f DevUnitsToApp = %f\n",a1,a2); + PRINTF(" AppUnitsToDev = %f DevUnitsToApp = %f\n",a1,a2); dx->GetCanonicalPixelScale(a1); - printf(" GetCanonicalPixelScale = %f\n",a1); + PRINTF(" GetCanonicalPixelScale = %f\n",a1); dx->GetScrollBarDimensions(a1, a2); - printf(" ScrollBar x = %f y = %f\n",a1,a2); + PRINTF(" ScrollBar x = %f y = %f\n",a1,a2); dx->GetZoom(a1); - printf(" Zoom = %f\n",a1); + PRINTF(" Zoom = %f\n",a1); dx->GetDepth((PRUint32&)i1); - printf(" Depth = %d\n",i1); + PRINTF(" Depth = %d\n",i1); dx->GetDeviceSurfaceDimensions(i1,i2); - printf(" DeviceDimension w = %d h = %d\n",i1,i2); + PRINTF(" DeviceDimension w = %d h = %d\n",i1,i2); // DEVICE CONTEXT INFORMATION - printf("DeviceContext created for print(%x)\n",mPrintDC); + PRINTF("DeviceContext created for print(%x)\n",mPrintDC); mPrintDC->GetDevUnitsToTwips(a1); mPrintDC->GetTwipsToDevUnits(a2); - printf(" DevToTwips = %f TwipToDev = %f\n",a1,a2); + PRINTF(" DevToTwips = %f TwipToDev = %f\n",a1,a2); mPrintDC->GetAppUnitsToDevUnits(a1); mPrintDC->GetDevUnitsToAppUnits(a2); - printf(" AppUnitsToDev = %f DevUnitsToApp = %f\n",a1,a2); + PRINTF(" AppUnitsToDev = %f DevUnitsToApp = %f\n",a1,a2); mPrintDC->GetCanonicalPixelScale(a1); - printf(" GetCanonicalPixelScale = %f\n",a1); + PRINTF(" GetCanonicalPixelScale = %f\n",a1); mPrintDC->GetScrollBarDimensions(a1, a2); - printf(" ScrollBar x = %f y = %f\n",a1,a2); + PRINTF(" ScrollBar x = %f y = %f\n",a1,a2); mPrintDC->GetZoom(a1); - printf(" Zoom = %f\n",a1); + PRINTF(" Zoom = %f\n",a1); mPrintDC->GetDepth((PRUint32&)i1); - printf(" Depth = %d\n",i1); + PRINTF(" Depth = %d\n",i1); mPrintDC->GetDeviceSurfaceDimensions(i1,i2); - printf(" DeviceDimension w = %d h = %d\n",i1,i2); + PRINTF(" DeviceDimension w = %d h = %d\n",i1,i2); #endif // Print listener setup... @@ -1682,12 +1686,12 @@ PRInt32 width,height; if(!mIsPrinting){ DocumentReadyForPrinting(); #ifdef DEBUG_dcone - printf("PRINT JOB ENDING, OBSERVER WAS NOT CALLED\n"); + PRINTF("PRINT JOB ENDING, OBSERVER WAS NOT CALLED\n"); #endif } else { // use the observer mechanism to finish the printing #ifdef DEBUG_dcone - printf("PRINTING OBSERVER STARTED\n"); + PRINTF("PRINTING OBSERVER STARTED\n"); #endif } } diff --git a/mozilla/layout/base/src/nsFrameImageLoader.cpp b/mozilla/layout/base/src/nsFrameImageLoader.cpp index 767d56a0565..63a5e6f194b 100644 --- a/mozilla/layout/base/src/nsFrameImageLoader.cpp +++ b/mozilla/layout/base/src/nsFrameImageLoader.cpp @@ -31,6 +31,15 @@ #include "nsCOMPtr.h" #include "nsIDeviceContext.h" #include "nsXPIDLString.h" +#include "nslog.h" + +#ifdef NOISY_IMAGE_LOADING +NS_IMPL_LOG_ENABLED(nsFrameImageLoaderLog) +#else +NS_IMPL_LOG(nsFrameImageLoaderLog) +#endif +#define PRINTF NS_LOG_PRINTF(nsFrameImageLoaderLog) +#define FLUSH NS_LOG_FLUSH(nsFrameImageLoaderLog) #ifdef DEBUG #undef NOISY_IMAGE_LOADING @@ -224,10 +233,8 @@ nsFrameImageLoader::AddFrame(nsIFrame* aFrame, NS_IMAGE_LOAD_STATUS_ERROR) & mImageLoadStatus)) { // Fire notification callback right away so that caller doesn't // miss it... -#ifdef NOISY_IMAGE_LOADING - printf("%p: AddFrame %p: notify frame=%p status=%x\n", + PRINTF("%p: AddFrame %p: notify frame=%p status=%x\n", this, pfd, pfd->mFrame, mImageLoadStatus); -#endif (*aCallBack)(mPresContext, this, pfd->mFrame, pfd->mClosure, mImageLoadStatus); pfd->mNeedSizeUpdate = PR_FALSE; @@ -263,11 +270,7 @@ nsFrameImageLoader::StopImageLoad(PRBool aStopChrome) return NS_ERROR_FAILURE; } -#ifdef NOISY_IMAGE_LOADING - printf(" %p: stopping ", this); - fputs(mURL, stdout); - printf("\n"); -#endif + PRINTF(" %p: stopping %s\n", this, mURL); if (nsnull != mImageRequest) { mImageRequest->RemoveObserver(this); NS_RELEASE(mImageRequest); @@ -459,12 +462,9 @@ nsFrameImageLoader::Notify(nsIImageRequest *aImageRequest, mNotifyLockCount++; -#ifdef NOISY_IMAGE_LOADING - printf("%p: loading ", this); - fputs(mURL, stdout); - printf(" notification=%d params=%d,%d,%p\n", aNotificationType, + PRINTF("%p: loading %s", this, mURL); + PRINTF(" notification=%d params=%d,%d,%p\n", aNotificationType, aParam1, aParam2, aParam3); -#endif switch (aNotificationType) { case nsImageNotification_kDimensions: mPresContext->GetScaledPixelsToTwips(&p2t); @@ -568,9 +568,7 @@ nsFrameImageLoader::NotifyFrames(PRBool aIsSizeUpdate) while (nsnull != (pfd = mCurNotifiedFrame)) { if ((aIsSizeUpdate && pfd->mNeedSizeUpdate) || !aIsSizeUpdate) { if (pfd->mCallBack) { -#ifdef NOISY_IMAGE_LOADING - printf(" notify pfd = %p frame=%p status=%x\n", pfd, pfd->mFrame, mImageLoadStatus); -#endif + PRINTF(" notify pfd = %p frame=%p status=%x\n", pfd, pfd->mFrame, mImageLoadStatus); (*pfd->mCallBack)(mPresContext, this, pfd->mFrame, pfd->mClosure, mImageLoadStatus); } diff --git a/mozilla/layout/base/src/nsFrameUtil.cpp b/mozilla/layout/base/src/nsFrameUtil.cpp index 8f867440e9f..06561cf0ba8 100644 --- a/mozilla/layout/base/src/nsFrameUtil.cpp +++ b/mozilla/layout/base/src/nsFrameUtil.cpp @@ -26,6 +26,12 @@ #include "nsRect.h" #include #include "plstr.h" +#include "nslog.h" +#undef fprintf + +NS_IMPL_LOG(nsFrameUtilLog) +#define PRINTF NS_LOG_PRINTF(nsFrameUtilLog) +#define FLUSH NS_LOG_FLUSH(nsFrameUtilLog) static NS_DEFINE_IID(kIFrameUtilIID, NS_IFRAME_UTIL_IID); @@ -526,29 +532,29 @@ nsFrameUtil::CompareTrees(Node* tree1, Node* tree2) if (nsnull == tree2) { break; } - printf("first tree prematurely ends\n"); + PRINTF("first tree prematurely ends\n"); return PR_FALSE; } else if (nsnull == tree2) { - printf("second tree prematurely ends\n"); + PRINTF("second tree prematurely ends\n"); return PR_FALSE; } // Check the attributes that we care about if (0 != PL_strcmp(tree1->type, tree2->type)) { - printf("frame type mismatch: %s vs. %s\n", tree1->type, tree2->type); - printf("Node 1:\n"); + PRINTF("frame type mismatch: %s vs. %s\n", tree1->type, tree2->type); + PRINTF("Node 1:\n"); DumpNode(tree1, stdout, 1); - printf("Node 2:\n"); + PRINTF("Node 2:\n"); DumpNode(tree2, stdout, 1); return PR_FALSE; } if (tree1->state != tree2->state) { - printf("frame state mismatch: 0x%x vs. 0x%x\n", + PRINTF("frame state mismatch: 0x%x vs. 0x%x\n", tree1->state, tree2->state); } if (tree1->bbox != tree2->bbox) { - printf("frame bbox mismatch: %d,%d,%d,%d vs. %d,%d,%d,%d\n", + PRINTF("frame bbox mismatch: %d,%d,%d,%d vs. %d,%d,%d,%d\n", tree1->bbox.x, tree1->bbox.y, tree1->bbox.width, tree1->bbox.height, tree2->bbox.x, tree2->bbox.y, @@ -561,10 +567,10 @@ nsFrameUtil::CompareTrees(Node* tree1, Node* tree2) for (;;) { if (nsnull == list1) { if (nsnull != list2) { - printf("first tree prematurely ends (no child lists)\n"); - printf("Node 1:\n"); + PRINTF("first tree prematurely ends (no child lists)\n"); + PRINTF("Node 1:\n"); DumpNode(tree1, stdout, 1); - printf("Node 2:\n"); + PRINTF("Node 2:\n"); DumpNode(tree2, stdout, 1); return PR_FALSE; } @@ -573,15 +579,15 @@ nsFrameUtil::CompareTrees(Node* tree1, Node* tree2) } } if (nsnull == list2) { - printf("second tree prematurely ends (no child lists)\n"); - printf("Node 1:\n"); + PRINTF("second tree prematurely ends (no child lists)\n"); + PRINTF("Node 1:\n"); DumpNode(tree1, stdout, 1); - printf("Node 2:\n"); + PRINTF("Node 2:\n"); DumpNode(tree2, stdout, 1); return PR_FALSE; } if (0 != PL_strcmp(list1->name, list2->name)) { - printf("child-list name mismatch: %s vs. %s\n", + PRINTF("child-list name mismatch: %s vs. %s\n", list1->name ? list1->name : "(null)", list2->name ? list2->name : "(null)"); } @@ -610,9 +616,9 @@ nsFrameUtil::CompareRegressionData(FILE* aFile1, FILE* aFile2) nsresult rv = NS_OK; if (!CompareTrees(tree1, tree2)) { - printf("Regression data 1:\n"); + PRINTF("Regression data 1:\n"); DumpTree(tree1, stdout, 0); - printf("Regression data 2:\n"); + PRINTF("Regression data 2:\n"); DumpTree(tree2, stdout, 0); rv = NS_ERROR_FAILURE; } diff --git a/mozilla/layout/base/src/nsLayoutHistoryState.cpp b/mozilla/layout/base/src/nsLayoutHistoryState.cpp index f64d0e91e09..9497db37929 100644 --- a/mozilla/layout/base/src/nsLayoutHistoryState.cpp +++ b/mozilla/layout/base/src/nsLayoutHistoryState.cpp @@ -1,4 +1,4 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- * * The contents of this file are subject to the Netscape Public * License Version 1.1 (the "License"); you may not use this file @@ -24,6 +24,11 @@ #include "nsILayoutHistoryState.h" #include "nsHashtable.h" #include "nsIStatefulFrame.h" // Get StateType enum +#include "nslog.h" + +NS_IMPL_LOG(nsLayoutHistoryStateLog) +#define PRINTF NS_LOG_PRINTF(nsLayoutHistoryStateLog) +#define FLUSH NS_LOG_FLUSH(nsLayoutHistoryStateLog) MOZ_DECL_CTOR_COUNTER(HistoryKey); @@ -104,10 +109,8 @@ nsLayoutHistoryState::AddState(PRUint32 aContentID, PRBool replaced = mStates.Put (&key, aState); if (replaced) { - // done this way by indication of warren@netscape.com [ipg] -#if 0 - printf("nsLayoutHistoryState::AddState OOPS!. There was already a state in the hash table for the key\n"); -#endif + // done this way by indication of warren@netscape.com [ipg] + PRINTF("nsLayoutHistoryState::AddState OOPS!. There was already a state in the hash table for the key\n"); } return NS_OK; @@ -126,9 +129,7 @@ nsLayoutHistoryState::GetState(PRUint32 aContentID, *aState = (nsIPresState *)state; } else { -#if 0 - printf("nsLayoutHistoryState::GetState, ERROR getting History state for the key\n"); -#endif + PRINTF("nsLayoutHistoryState::GetState, ERROR getting History state for the key\n"); *aState = nsnull; rv = NS_OK; } diff --git a/mozilla/layout/base/src/nsNodeInfoManager.cpp b/mozilla/layout/base/src/nsNodeInfoManager.cpp index 392dc58ebdc..451228da375 100644 --- a/mozilla/layout/base/src/nsNodeInfoManager.cpp +++ b/mozilla/layout/base/src/nsNodeInfoManager.cpp @@ -25,6 +25,15 @@ #include "nsCOMPtr.h" #include "nsString.h" #include "nsIAtom.h" +#include "nslog.h" + +#ifdef DEBUG_jst +NS_IMPL_LOG_ENABLED(nsNodeInfoManagerLog) +#else +NS_IMPL_LOG(nsNodeInfoManagerLog) +#endif +#define PRINTF NS_LOG_PRINTF(nsNodeInfoManagerLog) +#define FLUSH NS_LOG_FLUSH(nsNodeInfoManagerLog) nsNodeInfoManager* nsNodeInfoManager::gAnonymousNodeInfoManager = nsnull; PRUint32 nsNodeInfoManager::gNodeManagerCount = 0; @@ -65,9 +74,7 @@ nsNodeInfoManager::nsNodeInfoManager() nsNodeInfoInner::KeyCompare, PL_CompareValues, nsnull, nsnull); -#ifdef DEBUG_jst - printf ("Creating NodeInfoManager, gcount = %d\n", gNodeManagerCount); -#endif + PRINTF("Creating NodeInfoManager, gcount = %d\n", gNodeManagerCount); } @@ -88,9 +95,7 @@ nsNodeInfoManager::~nsNodeInfoManager() if (mNodeInfoHash) PL_HashTableDestroy(mNodeInfoHash); -#ifdef DEBUG_jst - printf ("Removing NodeInfoManager, gcount = %d\n", gNodeManagerCount); -#endif + PRINTF("Removing NodeInfoManager, gcount = %d\n", gNodeManagerCount); } diff --git a/mozilla/layout/base/src/nsPlainTextSerializer.cpp b/mozilla/layout/base/src/nsPlainTextSerializer.cpp index 1923f185431..5e9ddcf2b51 100644 --- a/mozilla/layout/base/src/nsPlainTextSerializer.cpp +++ b/mozilla/layout/base/src/nsPlainTextSerializer.cpp @@ -36,6 +36,11 @@ #include "nsITextContent.h" #include "nsTextFragment.h" #include "nsParserCIID.h" +#include "nslog.h" + +NS_IMPL_LOG(nsPlainTextSerializerLog) +#define PRINTF NS_LOG_PRINTF(nsPlainTextSerializerLog) +#define FLUSH NS_LOG_FLUSH(nsPlainTextSerializerLog) static NS_DEFINE_CID(kLWBrkCID, NS_LWBRK_CID); static NS_DEFINE_CID(kPrefServiceCID, NS_PREF_CID); @@ -482,7 +487,7 @@ nsPlainTextSerializer::DoOpenContainer(PRInt32 aTag) if (-1 != style.Find("-moz-pre-wrap", PR_TRUE, whitespace)) { #ifdef DEBUG_preformatted - printf("Set mPreFormatted based on style moz-pre-wrap\n"); + PRINTF("Set mPreFormatted based on style moz-pre-wrap\n"); #endif mPreFormatted = PR_TRUE; mCacheLine = PR_TRUE; @@ -504,14 +509,14 @@ nsPlainTextSerializer::DoOpenContainer(PRInt32 aTag) if (NS_SUCCEEDED(err)) { mWrapColumn = (PRUint32)col; #ifdef DEBUG_preformatted - printf("Set wrap column to %d based on style\n", mWrapColumn); + PRINTF("Set wrap column to %d based on style\n", mWrapColumn); #endif } } } else if (-1 != style.Find("pre", PR_TRUE, whitespace)) { #ifdef DEBUG_preformatted - printf("Set mPreFormatted based on style pre\n"); + PRINTF("Set mPreFormatted based on style pre\n"); #endif mPreFormatted = PR_TRUE; mCacheLine = PR_TRUE; @@ -1262,7 +1267,7 @@ nsPlainTextSerializer::Write(const nsString& aString) { #ifdef DEBUG_wrapping char* foo = aString.ToNewCString(); - printf("Write(%s): wrap col = %d, mColPos = %d\n", foo, mWrapColumn, mColPos); + PRINTF("Write(%s): wrap col = %d, mColPos = %d\n", foo, mWrapColumn, mColPos); nsMemory::Free(foo); #endif @@ -1328,7 +1333,7 @@ nsPlainTextSerializer::Write(const nsString& aString) } #ifdef DEBUG_wrapping - printf("No wrapping: newline is %d, totLen is %d; leaving mColPos = %d\n", + PRINTF("No wrapping: newline is %d, totLen is %d; leaving mColPos = %d\n", newline, totLen, mColPos); #endif return; @@ -1348,8 +1353,8 @@ nsPlainTextSerializer::Write(const nsString& aString) nsString remaining; aString.Right(remaining, totLen - bol); foo = remaining.ToNewCString(); - // printf("Next line: bol = %d, newlinepos = %d, totLen = %d, string = '%s'\n", - // bol, nextpos, totLen, foo); + // PRINTF("Next line: bol = %d, newlinepos = %d, totLen = %d, string = '%s'\n", + // bol, nextpos, totLen, foo))x; nsMemory::Free(foo); #endif @@ -1425,7 +1430,7 @@ nsPlainTextSerializer::Write(const nsString& aString) } } } - } // Continue looping over the string + }// Continue looping over the string } PRBool diff --git a/mozilla/layout/base/src/nsPrintPreviewContext.cpp b/mozilla/layout/base/src/nsPrintPreviewContext.cpp index 257be28270f..b71938080ad 100644 --- a/mozilla/layout/base/src/nsPrintPreviewContext.cpp +++ b/mozilla/layout/base/src/nsPrintPreviewContext.cpp @@ -27,6 +27,8 @@ #include "nsGfxCIID.h" #include "nsLayoutAtoms.h" #include "prlog.h" +#undef PRLogModuleInfo +#undef PR_NewLogModule static NS_DEFINE_IID(kIPresContextIID, NS_IPRESCONTEXT_IID); diff --git a/mozilla/layout/base/src/nsRange.cpp b/mozilla/layout/base/src/nsRange.cpp index ac6b041930b..66383c942ea 100644 --- a/mozilla/layout/base/src/nsRange.cpp +++ b/mozilla/layout/base/src/nsRange.cpp @@ -45,6 +45,11 @@ #include "nsIHTMLFragmentContentSink.h" // XXX Temporary inclusion to deal with fragment parsing #include "nsHTMLParts.h" +#include "nslog.h" + +NS_IMPL_LOG(nsRangeLog) +#define PRINTF NS_LOG_PRINTF(nsRangeLog) +#define FLUSH NS_LOG_FLUSH(nsRangeLog) static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); static NS_DEFINE_IID(kIScriptObjectOwnerIID, NS_ISCRIPTOBJECTOWNER_IID); @@ -1571,7 +1576,7 @@ nsresult nsRange::ToString(nsAWritableString& aReturn) } #ifdef DEBUG_range - printf("Range dump: -----------------------\n"); + PRINTF("Range dump: -----------------------\n"); #endif /* DEBUG */ // effeciency hack for simple case @@ -1585,7 +1590,7 @@ nsresult nsRange::ToString(nsAWritableString& aReturn) // If debug, dump it: nsCOMPtr cN (do_QueryInterface(mStartParent)); if (cN) cN->List(stdout); - printf("End Range dump: -----------------------\n"); + PRINTF("End Range dump: -----------------------\n"); #endif /* DEBUG */ // grab the text @@ -1646,7 +1651,7 @@ nsresult nsRange::ToString(nsAWritableString& aReturn) } #ifdef DEBUG_range - printf("End Range dump: -----------------------\n"); + PRINTF("End Range dump: -----------------------\n"); #endif /* DEBUG */ return NS_OK; } diff --git a/mozilla/layout/base/src/nsSelection.cpp b/mozilla/layout/base/src/nsSelection.cpp index 0f7d2fcdae7..a3f66a40f30 100644 --- a/mozilla/layout/base/src/nsSelection.cpp +++ b/mozilla/layout/base/src/nsSelection.cpp @@ -74,6 +74,11 @@ #include "nsIDocument.h" #include "nsISelectionController.h"//for the enums +#include "nslog.h" + +NS_IMPL_LOG(nsSelectionLog) +#define PRINTF NS_LOG_PRINTF(nsSelectionLog) +#define FLUSH NS_LOG_FLUSH(nsSelectionLog) #define STATUS_CHECK_RETURN_MACRO() {if (!mTracker) return NS_ERROR_FAILURE;} //#define DEBUG_TABLE 1 @@ -1243,7 +1248,7 @@ void printRange(nsIDOMRange *aDomRange) { if (!aDomRange) { - printf("NULL nsIDOMRange\n"); + PRINTF("NULL nsIDOMRange\n"); } nsCOMPtr startNode; nsCOMPtr endNode; @@ -1254,7 +1259,7 @@ void printRange(nsIDOMRange *aDomRange) aDomRange->GetEndParent(getter_AddRefs(endNode)); aDomRange->GetEndOffset(&endOffset); - printf("range: 0x%lx\t start: 0x%lx %ld, \t end: 0x%lx,%ld\n", + PRINTF("range: 0x%lx\t start: 0x%lx %ld, \t end: 0x%lx,%ld\n", (unsigned long)aDomRange, (unsigned long)(nsIDOMNode*)startNode, (long)startOffset, (unsigned long)(nsIDOMNode*)endNode, (long)endOffset); @@ -1341,7 +1346,7 @@ nsSelection::HandleTextEvent(nsGUIEvent *aGUIEvent) return NS_ERROR_NULL_POINTER; #ifdef DEBUG_TAGUE - printf("nsSelection: HandleTextEvent\n"); + PRINTF("nsSelection: HandleTextEvent\n"); #endif nsresult result(NS_OK); if (NS_TEXT_EVENT == aGUIEvent->message) { @@ -1838,7 +1843,7 @@ nsSelection::SetMouseDownState(PRBool aState) { // Mouse up kills dragging-table cell selection #ifdef DEBUG_TABLE_SELECTION -printf("SetMouseDownState to FALSE - stopping cell selection\n"); + PRINTF("SetMouseDownState to FALSE - stopping cell selection\n"); #endif mSelectingTableCells = PR_FALSE; mStartSelectedCell = nsnull; @@ -2277,7 +2282,7 @@ nsSelection::HandleTableSelection(nsIContent *aParentContent, PRInt32 aContentOf return NS_OK; } #ifdef DEBUG_TABLE_SELECTION -printf("HandleTableSelection: Dragged into a new column or row\n"); + PRINTF("HandleTableSelection: Dragged into a new column or row\n"); #endif // Continue dragging row or column selection return SelectRowOrColumn(childContent, mSelectingTableCellMode); @@ -2285,7 +2290,7 @@ printf("HandleTableSelection: Dragged into a new column or row\n"); else if (mSelectingTableCellMode == TABLESELECTION_CELL) { #ifdef DEBUG_TABLE_SELECTION -printf("HandleTableSelection: Dragged into a new cell\n"); + PRINTF("HandleTableSelection: Dragged into a new cell\n"); #endif // Clear this to be sure SelectBlockOfCells works correctly mAppendStartSelectedCell = nsnull; @@ -2329,7 +2334,7 @@ printf("HandleTableSelection: Dragged into a new cell\n"); if (mMouseDownState) { #ifdef DEBUG_TABLE_SELECTION -printf("HandleTableSelection: Mouse down event\n"); + PRINTF("HandleTableSelection: Mouse down event\n"); #endif // Clear cell we stored in mouse-down mUnselectCellOnMouseUp = nsnull; @@ -2370,7 +2375,7 @@ printf("HandleTableSelection: Mouse down event\n"); // Remember this cell to (possibly) unselect it on mouseup mUnselectCellOnMouseUp = childContent; #ifdef DEBUG_TABLE_SELECTION -printf("HandleTableSelection: Saving mUnselectCellOnMouseUp\n"); + PRINTF("HandleTableSelection: Saving mUnselectCellOnMouseUp\n"); #endif } else @@ -2422,7 +2427,7 @@ printf("HandleTableSelection: Saving mUnselectCellOnMouseUp\n"); else { #ifdef DEBUG_TABLE_SELECTION -printf("HandleTableSelection: Mouse UP event\n"); + PRINTF("HandleTableSelection: Mouse UP event\n"); #endif // First check if we are extending a block selection PRInt32 rangeCount; @@ -2445,7 +2450,7 @@ printf("HandleTableSelection: Mouse UP event\n"); nsCOMPtr range; PRInt32 offset; #ifdef DEBUG_TABLE_SELECTION -printf("HandleTableSelection: Unselecting mUnselectCellOnMouseUp; rangeCount=%d\n", rangeCount); + PRINTF("HandleTableSelection: Unselecting mUnselectCellOnMouseUp; rangeCount=%d\n", rangeCount); #endif for( PRInt32 i = 0; i < rangeCount; i++) { @@ -2476,7 +2481,7 @@ printf("HandleTableSelection: Unselecting mUnselectCellOnMouseUp; rangeCount=%d\ if (rangeCount == 1) { #ifdef DEBUG_TABLE_SELECTION -printf("HandleTableSelection: Unselecting single selected cell\n"); + PRINTF("HandleTableSelection: Unselecting single selected cell\n"); #endif // This was the only cell selected. // Collapse to "normal" selection inside the cell @@ -2490,7 +2495,7 @@ printf("HandleTableSelection: Unselecting single selected cell\n"); return mDomSelections[index]->Collapse(childNode, 0); } #ifdef DEBUG_TABLE_SELECTION -printf("HandleTableSelection: Removing cell from multi-cell selection\n"); + PRINTF("HandleTableSelection: Removing cell from multi-cell selection\n"); #endif //TODO: Should we try to reassign to a different existing cell? //mStartSelectedCell = nsnull; @@ -2510,7 +2515,7 @@ printf("HandleTableSelection: Removing cell from multi-cell selection\n"); // we may append by using Shift+click in another cell mAppendStartSelectedCell = childContent; #ifdef DEBUG_TABLE_SELECTION -printf("HandleTableSelection: Setting mAppendStartSelectedCell for append block\n"); + PRINTF("HandleTableSelection: Setting mAppendStartSelectedCell for append block\n"); #endif } } @@ -2530,7 +2535,7 @@ nsSelection::SelectBlockOfCells(nsIContent *aEndCell) { // We are appending a new block #ifdef DEBUG_TABLE_SELECTION -printf("SelectBlockOfCells -- using mAppendStartSelectedCell\n"); + PRINTF("SelectBlockOfCells -- using mAppendStartSelectedCell\n"); #endif startCell = mAppendStartSelectedCell; } @@ -2538,14 +2543,14 @@ printf("SelectBlockOfCells -- using mAppendStartSelectedCell\n"); { startCell = mStartSelectedCell; #ifdef DEBUG_TABLE_SELECTION -printf("SelectBlockOfCells -- using mStartSelectedCell\n"); + PRINTF("SelectBlockOfCells -- using mStartSelectedCell\n"); #endif } if (!startCell) { #ifdef DEBUG_TABLE_SELECTION -printf("SelectBlockOfCells -- NO START CELL!\n"); + PRINTF("SelectBlockOfCells -- NO START CELL!\n"); #endif return NS_OK; } @@ -2591,8 +2596,8 @@ printf("SelectBlockOfCells -- NO START CELL!\n"); if (NS_FAILED(result)) return result; #ifdef DEBUG_TABLE_SELECTION -if (!range) -printf("SelectBlockOfCells -- range is null\n"); + if (!range) + PRINTF("SelectBlockOfCells -- range is null\n"); #endif if (range && (curRowIndex < minRowIndex || curRowIndex > maxRowIndex || @@ -3094,7 +3099,7 @@ nsSelection::DeleteFromDocument() else { // Otherwise it's harder, have to find the previous node - printf("Sorry, don't know how to delete across frame boundaries yet\n"); + PRINTF("Sorry, don't know how to delete across frame boundaries yet\n"); return NS_ERROR_NOT_IMPLEMENTED; } } @@ -3126,7 +3131,7 @@ nsSelection::DeleteFromDocument() mDomSelections[index]->Collapse(mDomSelections[index]->FetchAnchorNode(), mDomSelections[index]->FetchAnchorOffset()); #ifdef DEBUG else - printf("Don't know how to set selection back past frame boundary\n"); + PRINTF("Don't know how to set selection back past frame boundary\n"); #endif return NS_OK; @@ -4720,12 +4725,12 @@ nsDOMSelection::Collapse(nsIDOMNode* aParentNode, PRInt32 aOffset) nsAutoString tagString; tag->ToString(tagString); char * tagCString = tagString.ToNewCString(); - printf ("Sel. Collapse to %p %s %d\n", content, tagCString, aOffset); + PRINTF ("Sel. Collapse to %p %s %d\n", content, tagCString, aOffset); delete [] tagCString; } } else { - printf ("Sel. Collapse set to null parent.\n"); + PRINTF ("Sel. Collapse set to null parent.\n"); } #endif @@ -5519,9 +5524,9 @@ nsDOMSelection::Extend(nsIDOMNode* aParentNode, PRInt32 aOffset) DEBUG_OUT_RANGE(range); #if 0 if (eDirNext == mDirection) - printf(" direction = 1 LEFT TO RIGHT\n"); + PRINTF(" direction = 1 LEFT TO RIGHT\n"); else - printf(" direction = 0 RIGHT TO LEFT\n"); + PRINTF(" direction = 0 RIGHT TO LEFT\n"); #endif SetDirection(dir); #ifdef DEBUG_SELECTION @@ -5536,12 +5541,12 @@ nsDOMSelection::Extend(nsIDOMNode* aParentNode, PRInt32 aOffset) nsAutoString tagString; tag->ToString(tagString); char * tagCString = tagString.ToNewCString(); - printf ("Sel. Extend to %p %s %d\n", content, tagCString, aOffset); + PRINTF ("Sel. Extend to %p %s %d\n", content, tagCString, aOffset); delete [] tagCString; } } else { - printf ("Sel. Extend set to null parent.\n"); + PRINTF ("Sel. Extend set to null parent.\n"); } #endif if (!mFrameSelection) @@ -5633,7 +5638,7 @@ nsDOMSelection::ContainsNode(nsIDOMNode* aNode, PRBool aRecursive, PRBool* aYes) nsAutoString name, value; aNode->GetNodeName(name); aNode->GetNodeValue(value); - printf("%s [%s]: %d, %d\n", name.ToNewCString(), value.ToNewCString(), + PRINTF("%s [%s]: %d, %d\n", name.ToNewCString(), value.ToNewCString(), nodeStartsBeforeRange, nodeEndsAfterRange); #endif PRUint16 nodeType; diff --git a/mozilla/layout/base/src/nsSpaceManager.cpp b/mozilla/layout/base/src/nsSpaceManager.cpp index 9a9f021a10c..6f3c303342b 100644 --- a/mozilla/layout/base/src/nsSpaceManager.cpp +++ b/mozilla/layout/base/src/nsSpaceManager.cpp @@ -31,6 +31,7 @@ #ifdef DEBUG #include "nsIFrameDebug.h" #endif + static NS_DEFINE_IID(kISpaceManagerIID, NS_ISPACEMANAGER_IID); ///////////////////////////////////////////////////////////////////////////// @@ -923,8 +924,7 @@ nsSpaceManager::List(FILE* out) if (NS_SUCCEEDED(mFrame->QueryInterface(NS_GET_IID(nsIFrameDebug), (void**)&frameDebug))) { frameDebug->GetFrameName(tmp); - fprintf(out, " frame="); - fputs(tmp, out); + fprintf(out, " frame=%s", tmp); fprintf(out, "@%p", mFrame); } } @@ -943,8 +943,7 @@ nsSpaceManager::List(FILE* out) if (NS_SUCCEEDED(band->mFrame->QueryInterface(NS_GET_IID(nsIFrameDebug), (void**)&frameDebug))) { frameDebug->GetFrameName(tmp); - fprintf(out, " frame="); - fputs(tmp, out); + fprintf(out, " frame=%s", tmp); fprintf(out, "@%p", band->mFrame); } } @@ -959,8 +958,7 @@ nsSpaceManager::List(FILE* out) if (NS_SUCCEEDED(frame->QueryInterface(NS_GET_IID(nsIFrameDebug), (void**)&frameDebug))) { frameDebug->GetFrameName(tmp); - fputs(tmp, out); - fprintf(out, "@%p ", frame); + fprintf(out, "%s@%p ", tmp, frame); } } } diff --git a/mozilla/layout/base/src/nsStyleContext.cpp b/mozilla/layout/base/src/nsStyleContext.cpp index 978f19add2c..43c6dfd18fe 100644 --- a/mozilla/layout/base/src/nsStyleContext.cpp +++ b/mozilla/layout/base/src/nsStyleContext.cpp @@ -49,6 +49,16 @@ #include "nsIStyleSet.h" #include "nsISizeOfHandler.h" #include "nsIPresShell.h" +#include "nslog.h" +#undef fprintf + +#ifdef NOISY_DEBUG +NS_IMPL_LOG_ENABLED(nsStyleContextLog) +#else +NS_IMPL_LOG(nsStyleContextLog) +#endif +#define PRINTF NS_LOG_PRINTF(nsStyleContextLog) +#define FLUSH NS_LOG_FLUSH(nsStyleContextLog) static NS_DEFINE_IID(kIStyleContextIID, NS_ISTYLECONTEXT_IID); @@ -2021,9 +2031,7 @@ PRUint32 nsStyleContextData::Release(void) --mRefCnt; NS_LOG_RELEASE(this,mRefCnt,"nsStyleContextData"); if (0 == mRefCnt) { -#ifdef NOISY_DEBUG - printf("deleting nsStyleContextData instance: (%ld)\n", (long)(--gInstanceCount)); -#endif + PRINTF("deleting nsStyleContextData instance: (%ld)\n", (long)(--gInstanceCount)); delete this; return 0; } @@ -2042,10 +2050,8 @@ nsStyleContextData *nsStyleContextData::Create(nsIPresContext *aPresContext) pData = new nsStyleContextData(aPresContext); if (pData) { NS_ADDREF(pData); -#ifdef NOISY_DEBUG - printf("new nsStyleContextData instance: (%ld) CRC=%lu\n", + PRINTF("new nsStyleContextData instance: (%ld) CRC=%lu\n", (long)(++gInstanceCount), (unsigned long)pData->ComputeCRC32(0)); -#endif // NOISY_DEBUG } } return pData; @@ -2907,14 +2913,10 @@ StyleContextImpl::RemapStyle(nsIPresContext* aPresContext, PRBool aRecurse) if ((NS_SUCCEEDED(mStyleSet->FindMatchingContext(this, &matchingSC))) && (nsnull != matchingSC)) { ShareStyleDataFrom(matchingSC); -#ifdef NOISY_DEBUG - printf("SC Data Shared :)\n"); -#endif + PRINTF("SC Data Shared :)\n"); NS_IF_RELEASE(matchingSC); } else { -#ifdef NOISY_DEBUG - printf("Unique SC Data - Not Shared :(\n"); -#endif + PRINTF("Unique SC Data - Not Shared :(\n"); } } // if(bDisableSharing==false) @@ -3130,7 +3132,7 @@ StyleContextImpl::StyleDataMatches(nsIStyleContext* aStyleContextToMatch, #ifdef DEBUG if (hint > 0) { gFalsePos++; - // printf("CRC match but CalcStyleDifference shows differences: crc is not sufficient?"); + // PRINTF("CRC match but CalcStyleDifference shows differences: crc is not sufficient?"); } #endif *aMatches = (0 == hint) ? PR_TRUE : PR_FALSE; @@ -3148,7 +3150,7 @@ StyleContextImpl::StyleDataMatches(nsIStyleContext* aStyleContextToMatch, NS_ASSERTION(hint>0,"!!!FALSE-NEGATIVE in StyleMatchesData!!!"); */ } - // printf("False-Pos: %ld - Screened: %ld\n", gFalsePos, gScreenedByCRC); + // PRINTF("False-Pos: %ld - Screened: %ld\n", gFalsePos, gScreenedByCRC); #endif } return rv; @@ -3249,32 +3251,32 @@ void StyleContextImpl::SizeOf(nsISizeOfHandler *aSizeOfHandler, PRUint32 &aSize) bDetailDumpDone = PR_TRUE; PRUint32 totalSize=0; - printf( "Detailed StyleContextImpl dump: basic class sizes of members\n" ); - printf( "*************************************\n"); - printf( " - StyleFontImpl: %ld\n", (long)sizeof(GETSCDATA(Font)) ); + PRINTF( "Detailed StyleContextImpl dump: basic class sizes of members\n" ); + PRINTF( "*************************************\n"); + PRINTF( " - StyleFontImpl: %ld\n", (long)sizeof(GETSCDATA(Font)) ); totalSize += (long)sizeof(GETSCDATA(Font)); - printf( " - StyleColorImpl: %ld\n", (long)sizeof(GETSCDATA(Color)) ); + PRINTF( " - StyleColorImpl: %ld\n", (long)sizeof(GETSCDATA(Color)) ); totalSize += (long)sizeof(GETSCDATA(Color)); - printf( " - StyleSpacingImpl: %ld\n", (long)sizeof(GETSCDATA(Spacing)) ); + PRINTF( " - StyleSpacingImpl: %ld\n", (long)sizeof(GETSCDATA(Spacing)) ); totalSize += (long)sizeof(GETSCDATA(Spacing)); - printf( " - StyleListImpl: %ld\n", (long)sizeof(GETSCDATA(List)) ); + PRINTF( " - StyleListImpl: %ld\n", (long)sizeof(GETSCDATA(List)) ); totalSize += (long)sizeof(GETSCDATA(List)); - printf( " - StylePositionImpl: %ld\n", (long)sizeof(GETSCDATA(Position)) ); + PRINTF( " - StylePositionImpl: %ld\n", (long)sizeof(GETSCDATA(Position)) ); totalSize += (long)sizeof(GETSCDATA(Position)); - printf( " - StyleTextImpl: %ld\n", (long)sizeof(GETSCDATA(Text)) ); + PRINTF( " - StyleTextImpl: %ld\n", (long)sizeof(GETSCDATA(Text)) ); totalSize += (long)sizeof(GETSCDATA(Text)); - printf( " - StyleDisplayImpl: %ld\n", (long)sizeof(GETSCDATA(Display)) ); + PRINTF( " - StyleDisplayImpl: %ld\n", (long)sizeof(GETSCDATA(Display)) ); totalSize += (long)sizeof(GETSCDATA(Display)); - printf( " - StyleTableImpl: %ld\n", (long)sizeof(GETSCDATA(Table)) ); + PRINTF( " - StyleTableImpl: %ld\n", (long)sizeof(GETSCDATA(Table)) ); totalSize += (long)sizeof(GETSCDATA(Table)); - printf( " - StyleContentImpl: %ld\n", (long)sizeof(GETSCDATA(Content)) ); + PRINTF( " - StyleContentImpl: %ld\n", (long)sizeof(GETSCDATA(Content)) ); totalSize += (long)sizeof(GETSCDATA(Content)); - printf( " - StyleUserInterfaceImpl: %ld\n", (long)sizeof(GETSCDATA(UserInterface)) ); + PRINTF( " - StyleUserInterfaceImpl: %ld\n", (long)sizeof(GETSCDATA(UserInterface)) ); totalSize += (long)sizeof(GETSCDATA(UserInterface)); - printf( " - StylePrintImpl: %ld\n", (long)sizeof(GETSCDATA(Print))); + PRINTF( " - StylePrintImpl: %ld\n", (long)sizeof(GETSCDATA(Print))); totalSize += (long)sizeof(GETSCDATA(Print)); - printf( " - Total: %ld\n", (long)totalSize); - printf( "*************************************\n"); + PRINTF( " - Total: %ld\n", (long)totalSize); + PRINTF( "*************************************\n"); } // first get the unique items collection diff --git a/mozilla/layout/base/src/nsStyleSet.cpp b/mozilla/layout/base/src/nsStyleSet.cpp index fd1cee1e16d..f1bfeff23ff 100644 --- a/mozilla/layout/base/src/nsStyleSet.cpp +++ b/mozilla/layout/base/src/nsStyleSet.cpp @@ -37,6 +37,11 @@ #include "nsICSSStyleSheet.h" #include "nsNetUtil.h" #include "nsIStyleRuleSupplier.h" +#include "nslog.h" + +NS_IMPL_LOG(nsStyleSetLog) +#define PRINTF NS_LOG_PRINTF(nsStyleSetLog) +#define FLUSH NS_LOG_FLUSH(nsStyleSetLog) #ifdef MOZ_PERF_METRICS #include "nsITimeRecorder.h" @@ -316,7 +321,7 @@ StyleSetImpl::~StyleSetImpl() #ifdef DEBUG NS_ASSERTION( mStyleContextCache.Count() == 0, "StyleContextCache is not empty in StyleSet destructor: style contexts are being leaked"); if (mStyleContextCache.Count() > 0) { - printf("*** Leaking %d style context instances (reported by the StyleContextCache) ***\n", mStyleContextCache.Count()); + PRINTF("*** Leaking %d style context instances (reported by the StyleContextCache) ***\n", mStyleContextCache.Count()); } #endif #endif @@ -677,9 +682,7 @@ NS_IMETHODIMP StyleSetImpl::EnableQuirkStyleSheet(PRBool aEnable) } } if (mQuirkStyleSheet) { -#ifdef DEBUG - printf( "%s Quirk StyleSheet\n", aEnable ? "Enabling" : "Disabling" ); -#endif + PRINTF( "%s Quirk StyleSheet\n", aEnable ? "Enabling" : "Disabling" ); mQuirkStyleSheet->SetEnabled(aEnable); } return rv; @@ -769,12 +772,12 @@ nsIStyleContext* StyleSetImpl::GetContext(nsIPresContext* aPresContext, aUsedRules = PRBool(nsnull != aRules); } #ifdef NOISY_DEBUG - fprintf(stdout, "+++ NewSC %d +++\n", ++gNewCount); + PRINTF("+++ NewSC %d +++\n", ++gNewCount); #endif } #ifdef NOISY_DEBUG else { - fprintf(stdout, "--- SharedSC %d ---\n", ++gSharedCount); + PRINTF("--- SharedSC %d ---\n", ++gSharedCount); } #endif @@ -1392,9 +1395,7 @@ StyleSetImpl::StartTimer(PRUint32 aTimerID) if (mTimerEnabled) { MOZ_TIMER_START(mStyleResolutionWatch); } else { -#ifdef NOISY_DEBUG - printf( "Attempt to start timer while disabled - ignoring\n" ); -#endif + PRINTF( "Attempt to start timer while disabled - ignoring\n" ); } } else @@ -1413,9 +1414,7 @@ StyleSetImpl::StopTimer(PRUint32 aTimerID) if (mTimerEnabled) { MOZ_TIMER_STOP(mStyleResolutionWatch); } else { -#ifdef NOISY_DEBUG - printf( "Attempt to stop timer while disabled - ignoring\n" ); -#endif + PRINTF( "Attempt to stop timer while disabled - ignoring\n" ); } } else @@ -1477,9 +1476,7 @@ PRUint32 StyleContextCache::Count(void) Tickle("From Count()"); #endif -#ifdef NOISY_DEBUG - printf("StyleContextCache count: %ld\n", (long)mCount); -#endif + PRINTF("StyleContextCache count: %ld\n", (long)mCount); return mCount; } @@ -1500,9 +1497,7 @@ nsresult StyleContextCache::AddContext(scKey aKey, nsIStyleContext *aContext) } DumpStats(); } else { -#ifdef DEBUG - printf( "Context already in list in StyleContextCache::AddContext\n"); -#endif + PRINTF( "Context already in list in StyleContextCache::AddContext\n"); rv = NS_ERROR_FAILURE; } } @@ -1528,11 +1523,9 @@ nsresult StyleContextCache::RemoveContext(scKey aKey, nsIStyleContext *aContext) if (NS_SUCCEEDED(rv)) { NS_ASSERTION(GetList(aKey) == nsnull, "Failed to delete list in StyleContextCache::RemoveContext"); } -#ifdef DEBUG else { - printf( "Error removing all contexts in StyleContextCache::RemoveContext\n"); + PRINTF( "Error removing all contexts in StyleContextCache::RemoveContext\n"); } -#endif } } return rv; @@ -1591,10 +1584,10 @@ PRBool HashTableEnumDump(nsHashKey *aKey, void *aData, void* closure) } if (nsnull == aKey && nsnull == aData && closure != nsnull) { // dump the cumulatives - printf("----------------------------------------------------------------------------------\n"); - printf("(%d lists, %ld contexts) List Lengths: Min=%ld Max=%ld Average=%ld Unary=%ld\n", + PRINTF("----------------------------------------------------------------------------------\n"); + PRINTF("(%d lists, %ld contexts) List Lengths: Min=%ld Max=%ld Average=%ld Unary=%ld\n", (int)nCount, (long)nTotal, (long)nMin, (long)nMax, (long)(nCount>0 ? nTotal/nCount : 0), (long)nUnary); - printf("----------------------------------------------------------------------------------\n"); + PRINTF("----------------------------------------------------------------------------------\n"); return PR_TRUE; } @@ -1602,7 +1595,7 @@ PRBool HashTableEnumDump(nsHashKey *aKey, void *aData, void* closure) nsVoidArray *pList = (nsVoidArray *)aData; if (pList) { PRUint32 count = pList->Count(); - printf("List Length at key %lu:\t%ld\n", + PRINTF("List Length at key %lu:\t%ld\n", (unsigned long)aKey->HashValue(), (long)count ); nCount++; @@ -1630,7 +1623,7 @@ PRBool HashTableEnumTickle(nsHashKey *aKey, void *aData, void* closure) if (pContext) { scKey key; pContext->GetStyleContextKey(key); - printf( "%p tickled\n"); + PRINTF( "%p tickled\n"); } } } @@ -1640,20 +1633,20 @@ PRBool HashTableEnumTickle(nsHashKey *aKey, void *aData, void* closure) void StyleContextCache::DumpStats(void) { #ifdef DUMP_CACHE_STATS - printf("StyleContextCache DumpStats BEGIN\n"); + PRINTF("StyleContextCache DumpStats BEGIN\n"); HashTableEnumDump(nsnull, nsnull, nsnull); mHashTable.Enumerate(HashTableEnumDump); HashTableEnumDump(nsnull, nsnull, "HACK!"); - printf("StyleContextCache DumpStats END\n"); + PRINTF("StyleContextCache DumpStats END\n"); #endif } void StyleContextCache::Tickle(const char *msg) { #ifdef DEBUG - printf("Tickling: %s\n", msg ? msg : ""); + PRINTF("Tickling: %s\n", msg ? msg : ""); mHashTable.Enumerate(HashTableEnumTickle); - printf("Tickle done.\n"); + PRINTF("Tickle done.\n"); #endif } @@ -1673,9 +1666,7 @@ StyleSetImpl::AddStyleContext(nsIStyleContext *aNewStyleContext) scKey key; aNewStyleContext->GetStyleContextKey(key); rv = mStyleContextCache.AddContext(key,aNewStyleContext); -#ifdef NOISY_DEBUG - printf( "StyleContextCount: %ld\n", (long)mStyleContextCache.Count()); -#endif + PRINTF( "StyleContextCount: %ld\n", (long)mStyleContextCache.Count()); } #else // DONT USE_FAST_CACHE @@ -1684,9 +1675,7 @@ StyleSetImpl::AddStyleContext(nsIStyleContext *aNewStyleContext) NS_ASSERTION((mStyleContextCache.IndexOf(aNewStyleContext) == -1), "StyleContext added in AddStyleContext is already in cache"); if (aNewStyleContext) { rv = mStyleContextCache.AppendElement(aNewStyleContext); -#ifdef NOISY_DEBUG - printf( "StyleContextCount: %ld\n", (long)mStyleContextCache.Count()); -#endif + PRINTF( "StyleContextCount: %ld\n", (long)mStyleContextCache.Count()); } #endif // USE_FAST_CACHE @@ -1708,9 +1697,7 @@ StyleSetImpl::RemoveStyleContext(nsIStyleContext *aNewStyleContext) scKey key; aNewStyleContext->GetStyleContextKey(key); rv = mStyleContextCache.RemoveContext(key,aNewStyleContext); -#ifdef NOISY_DEBUG - printf( "StyleContextCount: %ld\n", (long)mStyleContextCache.Count()); -#endif + PRINTF( "StyleContextCount: %ld\n", (long)mStyleContextCache.Count()); } #else //DONT USE_FAST_CACHE @@ -1719,9 +1706,7 @@ StyleSetImpl::RemoveStyleContext(nsIStyleContext *aNewStyleContext) NS_ASSERTION((mStyleContextCache.IndexOf(aNewStyleContext) != -1), "StyleContext removed in AddStyleContext is not in cache"); if (aNewStyleContext) { rv = mStyleContextCache.RemoveElement(aNewStyleContext); -#ifdef NOISY_DEBUG - printf( "StyleContextCount: %ld\n", (long)mStyleContextCache.Count()); -#endif + PRINTF( "StyleContextCount: %ld\n", (long)mStyleContextCache.Count()); } #endif //#ifdef USE_FAST_CACHE diff --git a/mozilla/layout/build/nsLayoutDLF.cpp b/mozilla/layout/build/nsLayoutDLF.cpp index 9f32e67c70a..ecc2311c8e6 100644 --- a/mozilla/layout/build/nsLayoutDLF.cpp +++ b/mozilla/layout/build/nsLayoutDLF.cpp @@ -39,6 +39,11 @@ #include "nsIXULContentSink.h" #include "nsIStreamLoadableDocument.h" #include "nsIDocStreamLoaderFactory.h" +#include "nslog.h" + +NS_IMPL_LOG(nsLayoutDLFLog) +#define PRINTF NS_LOG_PRINTF(nsLayoutDLFLog) +#define FLUSH NS_LOG_FLUSH(nsLayoutDLFLog) #define VIEW_SOURCE_HTML @@ -239,9 +244,7 @@ nsLayoutDLF::CreateInstance(const char *aCommand, } } if (NS_FAILED(rv)) { - #ifdef DEBUG - printf("*** open of %s failed: error=%x\n", UA_CSS_URL, rv); - #endif + PRINTF("*** open of %s failed: error=%x\n", UA_CSS_URL, rv); return rv; } } @@ -355,7 +358,7 @@ nsLayoutDLF::CreateDocument(const char* aCommand, nsAutoString tmp; aURL->ToString(tmp); fputs(tmp, stdout); - printf(": creating document\n"); + PRINTF(": creating document\n"); } #endif @@ -531,7 +534,7 @@ RegisterTypes(nsIComponentManager* aCompMgr, NS_DOCUMENT_LOADER_FACTORY_CONTRACTID_PREFIX "%s;1?type=%s", aCommand, contentType); #ifdef NOISY_REGISTRY - printf("Register %s => %s\n", contractid, aPath); + PRINTF("Register %s => %s\n", contractid, aPath); #endif rv = aCompMgr->RegisterComponentSpec(kDocumentFactoryImplCID, "Layout", contractid, aPath, PR_TRUE, PR_TRUE); diff --git a/mozilla/layout/build/nsLayoutFactory.cpp b/mozilla/layout/build/nsLayoutFactory.cpp index 5f197f4092f..9d994760e95 100644 --- a/mozilla/layout/build/nsLayoutFactory.cpp +++ b/mozilla/layout/build/nsLayoutFactory.cpp @@ -69,6 +69,11 @@ #include "nsINodeInfo.h" #include "nsIComputedDOMStyle.h" +#include "nslog.h" + +NS_IMPL_LOG(nsLayoutFactoryLog) +#define PRINTF NS_LOG_PRINTF(nsLayoutFactoryLog) +#define FLUSH NS_LOG_FLUSH(nsLayoutFactoryLog) class nsIDocumentLoaderFactory; @@ -177,7 +182,7 @@ nsLayoutFactory::nsLayoutFactory(const nsCID &aClass) mClassID = aClass; #if 0 char* cs = aClass.ToString(); - printf("+++ Creating layout factory for %s\n", cs); + PRINTF("+++ Creating layout factory for %s\n", cs); nsCRT::free(cs); #endif } @@ -186,7 +191,7 @@ nsLayoutFactory::~nsLayoutFactory() { #if 0 char* cs = mClassID.ToString(); - printf("+++ Destroying layout factory for %s\n", cs); + PRINTF("+++ Destroying layout factory for %s\n", cs); nsCRT::free(cs); #endif } @@ -195,7 +200,7 @@ NS_IMPL_ISUPPORTS(nsLayoutFactory, NS_GET_IID(nsIFactory)) #ifdef DEBUG #define LOG_NEW_FAILURE(_msg,_ec) \ - printf("nsLayoutFactory::CreateInstance failed for %s: error=%d(0x%x)\n", \ + PRINTF("nsLayoutFactory::CreateInstance failed for %s: error=%d(0x%x)\n", \ _msg, _ec, _ec) #else #define LOG_NEW_FAILURE(_msg,_ec) diff --git a/mozilla/layout/build/nsLayoutModule.cpp b/mozilla/layout/build/nsLayoutModule.cpp index bd9bc1f925a..aba19d4de29 100644 --- a/mozilla/layout/build/nsLayoutModule.cpp +++ b/mozilla/layout/build/nsLayoutModule.cpp @@ -73,6 +73,12 @@ #include "nsContentPolicyUtils.h" #define PRODUCT_NAME "Gecko" +#include "nslog.h" + +NS_IMPL_LOG(nsLayoutModuleLog) +#define PRINTF NS_LOG_PRINTF(nsLayoutModuleLog) +#define FLUSH NS_LOG_FLUSH(nsLayoutModuleLog) + static NS_DEFINE_CID(kHTTPHandlerCID, NS_IHTTPHANDLER_CID); static nsLayoutModule *gModule = NULL; @@ -398,9 +404,7 @@ nsLayoutModule::RegisterSelf(nsIComponentManager *aCompMgr, { nsresult rv = NS_OK; -#ifdef DEBUG - printf("*** Registering layout components\n"); -#endif + PRINTF("*** Registering layout components\n"); Components* cp = gComponents; Components* end = cp + NUM_COMPONENTS; @@ -408,10 +412,8 @@ nsLayoutModule::RegisterSelf(nsIComponentManager *aCompMgr, rv = aCompMgr->RegisterComponentSpec(cp->mCID, cp->mDescription, cp->mContractID, aPath, PR_TRUE, PR_TRUE); if (NS_FAILED(rv)) { -#ifdef DEBUG - printf("nsLayoutModule: unable to register %s component => %x\n", + PRINTF("nsLayoutModule: unable to register %s component => %x\n", cp->mDescription, rv); -#endif break; } cp++; @@ -427,18 +429,14 @@ nsLayoutModule::UnregisterSelf(nsIComponentManager* aCompMgr, nsIFile* aPath, const char* registryLocation) { -#ifdef DEBUG - printf("*** Unregistering layout components\n"); -#endif + PRINTF("*** Unregistering layout components\n"); Components* cp = gComponents; Components* end = cp + NUM_COMPONENTS; while (cp < end) { nsresult rv = aCompMgr->UnregisterComponentSpec(cp->mCID, aPath); if (NS_FAILED(rv)) { -#ifdef DEBUG - printf("nsLayoutModule: unable to unregister %s component => %x\n", + PRINTF("nsLayoutModule: unable to unregister %s component => %x\n", cp->mDescription, rv); -#endif } cp++; } diff --git a/mozilla/layout/events/src/nsDOMEvent.cpp b/mozilla/layout/events/src/nsDOMEvent.cpp index bc7a4175f36..1422175ac70 100644 --- a/mozilla/layout/events/src/nsDOMEvent.cpp +++ b/mozilla/layout/events/src/nsDOMEvent.cpp @@ -40,6 +40,11 @@ #include "nsIDOMAbstractView.h" #include "prmem.h" #include "nsLayoutAtoms.h" +#include "nslog.h" + +NS_IMPL_LOG(nsDOMEventLog) +#define PRINTF NS_LOG_PRINTF(nsDOMEventLog) +#define FLUSH NS_LOG_FLUSH(nsDOMEventLog) static NS_DEFINE_IID(kIFrameIID, NS_IFRAME_IID); @@ -581,7 +586,7 @@ NS_METHOD nsDOMEvent::GetCharCode(PRUint32* aCharCode) case NS_KEY_UP: case NS_KEY_DOWN: #if defined(NS_DEBUG) && defined(DEBUG_brade) - printf("GetCharCode used for wrong key event; should use onkeypress.\n"); + PRINTF("GetCharCode used for wrong key event; should use onkeypress.\n"); #endif *aCharCode = 0; break; @@ -589,7 +594,7 @@ NS_METHOD nsDOMEvent::GetCharCode(PRUint32* aCharCode) *aCharCode = ((nsKeyEvent*)mEvent)->charCode; #if defined(NS_DEBUG) && defined(DEBUG_buster) if (0==*aCharCode) - printf("GetCharCode used correctly but no valid key!\n"); + PRINTF("GetCharCode used correctly but no valid key!\n"); #endif break; default: diff --git a/mozilla/layout/events/src/nsEventListenerManager.cpp b/mozilla/layout/events/src/nsEventListenerManager.cpp index 4c981f4b261..f708a3bd783 100644 --- a/mozilla/layout/events/src/nsEventListenerManager.cpp +++ b/mozilla/layout/events/src/nsEventListenerManager.cpp @@ -56,6 +56,11 @@ #include "nsIJSContextStack.h" #include "nsIDocument.h" #include "nsIPresShell.h" +#include "nslog.h" + +NS_IMPL_LOG(nsEventListenerManagerLog) +#define PRINTF NS_LOG_PRINTF(nsEventListenerManagerLog) +#define FLUSH NS_LOG_FLUSH(nsEventListenerManagerLog) static NS_DEFINE_IID(kIEventListenerManagerIID, NS_IEVENTLISTENERMANAGER_IID); static NS_DEFINE_IID(kIDOMEventListenerIID, NS_IDOMEVENTLISTENER_IID); @@ -991,9 +996,7 @@ nsresult nsEventListenerManager::HandleEvent(nsIPresContext* aPresContext, case NS_COMPOSITION_END: case NS_COMPOSITION_QUERY: case NS_RECONVERSION_QUERY: -#if DEBUG_TAGUE - printf("DOM: got composition event\n"); -#endif + PRINTF("DOM: got composition event\n"); if (nsnull != mCompositionListeners) { if (nsnull == *aDOMEvent) { ret = NS_NewDOMUIEvent(aDOMEvent,aPresContext,empty,aEvent); @@ -1056,9 +1059,7 @@ nsresult nsEventListenerManager::HandleEvent(nsIPresContext* aPresContext, break; case NS_TEXT_EVENT: -#if DEBUG_TAGUE - printf("DOM: got text event\n"); -#endif + PRINTF("DOM: got text event\n"); if (nsnull != mTextListeners) { if (nsnull == *aDOMEvent) { ret = NS_NewDOMUIEvent(aDOMEvent,aPresContext,empty,aEvent); diff --git a/mozilla/layout/events/src/nsEventStateManager.cpp b/mozilla/layout/events/src/nsEventStateManager.cpp index 39ac748d710..f49658de2e5 100644 --- a/mozilla/layout/events/src/nsEventStateManager.cpp +++ b/mozilla/layout/events/src/nsEventStateManager.cpp @@ -71,6 +71,15 @@ #include "nsIDocShell.h" #include "nsIMarkupDocumentViewer.h" #include "nsITreeFrame.h" +#include "nslog.h" + +#ifdef DEBUG_hyatt +NS_IMPL_LOG_ENABLED(nsEventStateManagerLog) +#else +NS_IMPL_LOG(nsEventStateManagerLog) +#endif +#define PRINTF NS_LOG_PRINTF(nsEventStateManagerLog) +#define FLUSH NS_LOG_FLUSH(nsEventStateManagerLog) //we will use key binding by default now. this wil lbreak viewer for now #define NON_KEYBINDING 0 @@ -81,8 +90,6 @@ nsIContent * gLastFocusedContent = 0; // Strong reference nsIDocument * gLastFocusedDocument = 0; // Strong reference nsIPresContext* gLastFocusedPresContext = 0; // Weak reference -PRLogModuleInfo *MOUSEWHEEL; - PRUint32 nsEventStateManager::mInstanceCount = 0; enum { @@ -130,8 +137,6 @@ nsEventStateManager::nsEventStateManager() NS_INIT_REFCNT(); ++mInstanceCount; - if (!MOUSEWHEEL) - MOUSEWHEEL = PR_NewLogModule("MOUSEWHEEL"); } NS_IMETHODIMP @@ -314,9 +319,7 @@ nsEventStateManager::PreHandleEvent(nsIPresContext* aPresContext, break; case NS_GOTFOCUS: { -#ifdef DEBUG_hyatt - printf("Got focus.\n"); -#endif + PRINTF("Got focus.\n"); EnsureDocument(aPresContext); diff --git a/mozilla/layout/forms/nsButtonFrameRenderer.cpp b/mozilla/layout/forms/nsButtonFrameRenderer.cpp index d90e7a13c82..5d4e113b715 100644 --- a/mozilla/layout/forms/nsButtonFrameRenderer.cpp +++ b/mozilla/layout/forms/nsButtonFrameRenderer.cpp @@ -27,6 +27,11 @@ #include "nsIView.h" #include "nsIViewManager.h" #include "nsHTMLAtoms.h" +#include "nslog.h" + +NS_IMPL_LOG(nsButtonFrameRendererLog) +#define PRINTF NS_LOG_PRINTF(nsButtonFrameRendererLog) +#define FLUSH NS_LOG_FLUSH(nsButtonFrameRendererLog) #define ACTIVE "active" #define HOVER "hover" @@ -114,7 +119,7 @@ nsButtonFrameRenderer::PaintButton (nsIPresContext* aPresContext, nsFramePaintLayer aWhichLayer, const nsRect& aRect) { - //printf("painted width='%d' height='%d'\n",aRect.width, aRect.height); + //PRINTF("painted width='%d' height='%d'\n",aRect.width, aRect.height); // draw the border and background inside the focus and outline borders PaintBorderAndBackground(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer, aRect); diff --git a/mozilla/layout/forms/nsComboboxControlFrame.cpp b/mozilla/layout/forms/nsComboboxControlFrame.cpp index 4460a44522c..3aa1b5be06c 100644 --- a/mozilla/layout/forms/nsComboboxControlFrame.cpp +++ b/mozilla/layout/forms/nsComboboxControlFrame.cpp @@ -144,7 +144,7 @@ static PRInt32 gReflowInx = -1; if (mReflowId > -1) {\ gTotalReqs += gReflowControlCntRQ[mReflowId];\ gTotalReflows += gReflowControlCnt[mReflowId];\ - printf("** Id:%5d %s RF: %d RQ: %d %d/%d %5.2f\n", \ + PRINTF("** Id:%5d %s RF: %d RQ: %d %d/%d %5.2f\n", \ mReflowId, (__desc), \ gReflowControlCnt[mReflowId], \ gReflowControlCntRQ[mReflowId],\ @@ -162,10 +162,10 @@ static PRInt32 gReflowInx = -1; } // reflow messages -#define REFLOW_DEBUG_MSG(_msg1) printf((_msg1)) -#define REFLOW_DEBUG_MSG2(_msg1, _msg2) printf((_msg1), (_msg2)) -#define REFLOW_DEBUG_MSG3(_msg1, _msg2, _msg3) printf((_msg1), (_msg2), (_msg3)) -#define REFLOW_DEBUG_MSG4(_msg1, _msg2, _msg3, _msg4) printf((_msg1), (_msg2), (_msg3), (_msg4)) +#define REFLOW_DEBUG_MSG(_msg1) PRINTF((_msg1)) +#define REFLOW_DEBUG_MSG2(_msg1, _msg2) PRINTF((_msg1), (_msg2)) +#define REFLOW_DEBUG_MSG3(_msg1, _msg2, _msg3) PRINTF((_msg1), (_msg2), (_msg3)) +#define REFLOW_DEBUG_MSG4(_msg1, _msg2, _msg3, _msg4) PRINTF((_msg1), (_msg2), (_msg3), (_msg4)) #else //------------- @@ -186,10 +186,10 @@ static PRInt32 gReflowInx = -1; // This is for being VERY noisy //------------------------------------------ #ifdef DO_VERY_NOISY -#define REFLOW_NOISY_MSG(_msg1) printf((_msg1)) -#define REFLOW_NOISY_MSG2(_msg1, _msg2) printf((_msg1), (_msg2)) -#define REFLOW_NOISY_MSG3(_msg1, _msg2, _msg3) printf((_msg1), (_msg2), (_msg3)) -#define REFLOW_NOISY_MSG4(_msg1, _msg2, _msg3, _msg4) printf((_msg1), (_msg2), (_msg3), (_msg4)) +#define REFLOW_NOISY_MSG(_msg1) PRINTF((_msg1)) +#define REFLOW_NOISY_MSG2(_msg1, _msg2) PRINTF((_msg1), (_msg2)) +#define REFLOW_NOISY_MSG3(_msg1, _msg2, _msg3) PRINTF((_msg1), (_msg2), (_msg3)) +#define REFLOW_NOISY_MSG4(_msg1, _msg2, _msg3, _msg4) PRINTF((_msg1), (_msg2), (_msg3), (_msg4)) #else #define REFLOW_NOISY_MSG(_msg) #define REFLOW_NOISY_MSG2(_msg1, _msg2) @@ -215,7 +215,7 @@ static PRInt32 gReflowInx = -1; if (aReflowState.mComputedWidth != NS_UNCONSTRAINEDSIZE) { \ nscoord width = aDesiredSize.width - borderPadding.left - borderPadding.right; \ if (width != aReflowState.mComputedWidth) { \ - printf("aDesiredSize.width %d %d != aReflowState.mComputedWidth %d\n", aDesiredSize.width, width, aReflowState.mComputedWidth); \ + PRINTF("aDesiredSize.width %d %d != aReflowState.mComputedWidth %d\n", aDesiredSize.width, width, aReflowState.mComputedWidth); \ } \ NS_ASSERTION(width == aReflowState.mComputedWidth, "Returning bad value when constrained!"); \ } @@ -698,7 +698,7 @@ nsComboboxControlFrame::PositionDropdown(nsIPresContext* aPresContext, mDropdownFrame->SetRect(aPresContext, dropdownRect); #ifdef DEBUG_rodsXXXXXX - printf("%d Position Dropdown at: %d %d %d %d\n", counter++, dropdownRect.x, dropdownRect.y, dropdownRect.width, dropdownRect.height); + PRINTF("%d Position Dropdown at: %d %d %d %d\n", counter++, dropdownRect.x, dropdownRect.y, dropdownRect.width, dropdownRect.height); #endif return rv; @@ -774,7 +774,7 @@ nsComboboxControlFrame::ReflowItems(nsIPresContext* aPresContext, const nsHTMLReflowState& aReflowState, nsHTMLReflowMetrics& aDesiredSize) { - //printf("*****************\n"); + //PRINTF("*****************\n"); const nsStyleFont* dspFont; mDisplayFrame->GetStyleData(eStyleStruct_Font, (const nsStyleStruct *&)dspFont); nsCOMPtr deviceContext; @@ -798,7 +798,7 @@ nsComboboxControlFrame::ReflowItems(nsIPresContext* aPresContext, if (options) { PRUint32 numOptions; options->GetLength(&numOptions); - //printf("--- Num of Items %d ---\n", numOptions); + //PRINTF("--- Num of Items %d ---\n", numOptions); for (PRUint32 i=0;i optionElement = getter_AddRefs(GetOption(*options, i)); if (optionElement) { @@ -813,7 +813,7 @@ nsComboboxControlFrame::ReflowItems(nsIPresContext* aPresContext, maxWidth = width; } //maxWidth = PR_MAX(width, maxWidth); - //printf("[%d] - %d %s \n", i, width, text.ToNewCString()); + //PRINTF("[%d] - %d %s \n", i, width, text.ToNewCString()); } } } @@ -823,7 +823,7 @@ nsComboboxControlFrame::ReflowItems(nsIPresContext* aPresContext, maxWidth = 11 * 15; } char * str = maxStr.ToNewCString(); - printf("id: %d maxWidth %d [%s]\n", mReflowId, maxWidth, str); + PRINTF("id: %d maxWidth %d [%s]\n", mReflowId, maxWidth, str); delete [] str; // get the borderPadding for the display area @@ -842,7 +842,7 @@ nsComboboxControlFrame::ReflowItems(nsIPresContext* aPresContext, aDesiredSize.width = frmWidth; aDesiredSize.height = frmHeight; #else - printf("Size frm:%d,%d DS:%d,%d DIF:%d,%d(tp) %d,%d(px)\n", + PRINTF("Size frm:%d,%d DS:%d,%d DIF:%d,%d(tp) %d,%d(px)\n", frmWidth, frmHeight, aDesiredSize.width, aDesiredSize.height, frmWidth-aDesiredSize.width, frmHeight-aDesiredSize.height, @@ -1026,11 +1026,11 @@ static int myCounter = 0; static void printSize(char * aDesc, nscoord aSize) { - printf(" %s: ", aDesc); + PRINTF(" %s: ", aDesc); if (aSize == NS_UNCONSTRAINEDSIZE) { - printf("UC"); + PRINTF("UC"); } else { - printf("%d", PX(aSize)); + PRINTF("%d", PX(aSize)); } } #endif @@ -1051,21 +1051,21 @@ nsComboboxControlFrame::Reflow(nsIPresContext* aPresContext, REFLOW_COUNTER_REQUEST(); #ifdef DO_REFLOW_DEBUG - printf("-------------Starting Combobox Reflow ----------------------------\n"); - printf("%p ** Id: %d nsCCF::Reflow %d R: ", this, mReflowId, myCounter++); + PRINTF("-------------Starting Combobox Reflow ----------------------------\n"); + PRINTF("%p ** Id: %d nsCCF::Reflow %d R: ", this, mReflowId, myCounter++); switch (aReflowState.reason) { case eReflowReason_Initial: - printf("Ini");break; + PRINTF("Ini");break; case eReflowReason_Incremental: - printf("Inc");break; + PRINTF("Inc");break; case eReflowReason_Resize: - printf("Rsz");break; + PRINTF("Rsz");break; case eReflowReason_StyleChange: - printf("Sty");break; + PRINTF("Sty");break; case eReflowReason_Dirty: - printf("Drt "); + PRINTF("Drt "); break; - default:printf("%d", aReflowState.reason);break; + default:PRINTF("%d", aReflowState.reason);break; } printSize("AW", aReflowState.availableWidth); @@ -1078,7 +1078,7 @@ nsComboboxControlFrame::Reflow(nsIPresContext* aPresContext, optionsTemp->GetLength(&numOptions); printSize("NO", (nscoord)numOptions); - printf(" *\n"); + PRINTF(" *\n"); #endif @@ -1918,7 +1918,7 @@ NS_IMETHODIMP nsComboboxControlFrame::AddOption(nsIPresContext* aPresContext, PRInt32 aIndex) { #ifdef DO_REFLOW_DEBUG - printf("**********\n*********AddOption: %d\n", aIndex); + PRINTF("**********\n*********AddOption: %d\n", aIndex); #endif nsISelectControlFrame* listFrame = nsnull; nsresult rv = mDropdownFrame->QueryInterface(NS_GET_IID(nsISelectControlFrame), @@ -2424,8 +2424,8 @@ nsComboboxControlFrame::Paint(nsIPresContext* aPresContext, nsFramePaintLayer aWhichLayer) { #ifdef NOISY - printf("%p paint layer %d at (%d, %d, %d, %d)\n", this, aWhichLayer, - aDirtyRect.x, aDirtyRect.y, aDirtyRect.width, aDirtyRect.height); + PRINTF("%p paint layer %d at (%d, %d, %d, %d)\n", this, aWhichLayer, + aDirtyRect.x, aDirtyRect.y, aDirtyRect.width, aDirtyRect.height); #endif nsAreaFrame::Paint(aPresContext,aRenderingContext,aDirtyRect,aWhichLayer); diff --git a/mozilla/layout/forms/nsFieldSetFrame.cpp b/mozilla/layout/forms/nsFieldSetFrame.cpp index aa54c03bc0a..d9d859a0644 100644 --- a/mozilla/layout/forms/nsFieldSetFrame.cpp +++ b/mozilla/layout/forms/nsFieldSetFrame.cpp @@ -44,6 +44,11 @@ #include "nsStyleUtil.h" #include "nsFont.h" #include "nsCOMPtr.h" +#include "nslog.h" + +NS_IMPL_LOG(nsFieldSetFrameLog) +#define PRINTF NS_LOG_PRINTF(nsFieldSetFrameLog) +#define FLUSH NS_LOG_FLUSH(nsFieldSetFrameLog) static NS_DEFINE_IID(kLegendFrameCID, NS_LEGEND_FRAME_CID); static NS_DEFINE_IID(kIDOMHTMLFieldSetElementIID, NS_IDOMHTMLFIELDSETELEMENT_IID); @@ -368,9 +373,9 @@ nsFieldSetFrame::Reflow(nsIPresContext* aPresContext, ReflowChild(mLegendFrame, aPresContext, legendDesiredSize, legendReflowState, 0, 0, NS_FRAME_NO_MOVE_FRAME, aStatus); #ifdef NOISY_REFLOW - printf(" returned (%d, %d)\n", legendDesiredSize.width, legendDesiredSize.height); + PRINTF(" returned (%d, %d)\n", legendDesiredSize.width, legendDesiredSize.height); if (legendDesiredSize.maxElementSize) - printf(" and maxES (%d, %d)\n", + PRINTF(" and maxES (%d, %d)\n", legendDesiredSize.maxElementSize->width, legendDesiredSize.maxElementSize->height); #endif // figure out the legend's rectangle @@ -440,20 +445,20 @@ nsFieldSetFrame::Reflow(nsIPresContext* aPresContext, kidReflowState.mComputedMargin.left, kidReflowState.mComputedMargin.top, 0, aStatus); #ifdef NOISY_REFLOW - printf(" returned (%d, %d)\n", kidDesiredSize.width, kidDesiredSize.height); + PRINTF(" returned (%d, %d)\n", kidDesiredSize.width, kidDesiredSize.height); if (kidDesiredSize.maxElementSize) - printf(" and maxES (%d, %d)\n", + PRINTF(" and maxES (%d, %d)\n", kidDesiredSize.maxElementSize->width, kidDesiredSize.maxElementSize->height); #endif /* - printf("*** %p computedHgt: %d ", this, aReflowState.mComputedHeight); - printf("Reason: "); + PRINTF("*** %p computedHgt: %d ", this, aReflowState.mComputedHeight); + PRINTF("Reason: "); switch (aReflowState.reason) { - case eReflowReason_Initial:printf("Initil");break; - case eReflowReason_Incremental:printf("Increm");break; - case eReflowReason_Resize: printf("Resize"); break; - case eReflowReason_StyleChange:printf("eReflowReason_StyleChange");break; + case eReflowReason_Initial:PRINTF("Initil");break; + case eReflowReason_Incremental:PRINTF("Increm");break; + case eReflowReason_Resize: PRINTF("Resize"); break; + case eReflowReason_StyleChange:PRINTF("eReflowReason_StyleChange");break; } */ @@ -469,7 +474,7 @@ nsFieldSetFrame::Reflow(nsIPresContext* aPresContext, nsFrameState kidState; mContentFrame->GetFrameState(&kidState); - // printf("width: %d, height: %d\n", desiredSize.mCombinedArea.width, desiredSize.mCombinedArea.height); + // PRINTF("width: %d, height: %d\n", desiredSize.mCombinedArea.width, desiredSize.mCombinedArea.height); /* if (kidState & NS_FRAME_OUTSIDE_CHILDREN) { @@ -570,11 +575,11 @@ nsFieldSetFrame::Reflow(nsIPresContext* aPresContext, aDesiredSize.maxElementSize->height += borderPadding.top + borderPadding.bottom + mLegendRect.height; } #ifdef NOISY_REFLOW - printf("FIELDSET: w=%d, maxWidth=%d, MES=%d\n", + PRINTF("FIELDSET: w=%d, maxWidth=%d, MES=%d\n", aDesiredSize.width, aDesiredSize.mMaximumWidth, aDesiredSize.maxElementSize ? aDesiredSize.maxElementSize->width : -1); if (aDesiredSize.mFlags & NS_REFLOW_CALC_MAX_WIDTH) - printf(" and preferred size = %d\n", aDesiredSize.mMaximumWidth); + PRINTF(" and preferred size = %d\n", aDesiredSize.mMaximumWidth); #endif return NS_OK; diff --git a/mozilla/layout/forms/nsFormControlFrame.cpp b/mozilla/layout/forms/nsFormControlFrame.cpp index e1966a5a109..d86f9fc3503 100644 --- a/mozilla/layout/forms/nsFormControlFrame.cpp +++ b/mozilla/layout/forms/nsFormControlFrame.cpp @@ -61,6 +61,8 @@ #include "nsIEventStateManager.h" #include "nsIScrollableView.h" +NS_IMPL_LOG(nsFormControlFrameLog) + #ifdef DEBUG_evaughan //#define DEBUG_rods #endif @@ -70,15 +72,15 @@ #endif #ifdef FCF_NOISY -#define REFLOW_DEBUG_MSG(_msg1) printf((_msg1)) -#define REFLOW_DEBUG_MSG2(_msg1, _msg2) printf((_msg1), (_msg2)) -#define REFLOW_DEBUG_MSG3(_msg1, _msg2, _msg3) printf((_msg1), (_msg2), (_msg3)) -#define REFLOW_DEBUG_MSG4(_msg1, _msg2, _msg3, _msg4) printf((_msg1), (_msg2), (_msg3), (_msg4)) +#define REFLOW_DEBUG_MSG(_msg1) PRINTF((_msg1)) +#define REFLOW_DEBUG_MSG2(_msg1, _msg2) PRINTF((_msg1), (_msg2)) +#define REFLOW_DEBUG_MSG3(_msg1, _msg2, _msg3) PRINTF((_msg1), (_msg2), (_msg3)) +#define REFLOW_DEBUG_MSG4(_msg1, _msg2, _msg3, _msg4) PRINTF((_msg1), (_msg2), (_msg3), (_msg4)) -#define IF_REFLOW_DEBUG_MSG(_bool, _msg1) if ((_bool)) printf((_msg1)) -#define IF_REFLOW_DEBUG_MSG2(_bool, _msg1, _msg2) if ((_bool)) printf((_msg1), (_msg2)) -#define IF_REFLOW_DEBUG_MSG3(_bool, _msg1, _msg2, _msg3) if ((_bool)) printf((_msg1), (_msg2), (_msg3)) -#define IF_REFLOW_DEBUG_MSG4(_bool, _msg1, _msg2, _msg3, _msg4) if ((_bool)) printf((_msg1), (_msg2), (_msg3), (_msg4)) +#define IF_REFLOW_DEBUG_MSG(_bool, _msg1) if ((_bool)) PRINTF((_msg1)) +#define IF_REFLOW_DEBUG_MSG2(_bool, _msg1, _msg2) if ((_bool)) PRINTF((_msg1), (_msg2)) +#define IF_REFLOW_DEBUG_MSG3(_bool, _msg1, _msg2, _msg3) if ((_bool)) PRINTF((_msg1), (_msg2), (_msg3)) +#define IF_REFLOW_DEBUG_MSG4(_bool, _msg1, _msg2, _msg3, _msg4) if ((_bool)) PRINTF((_msg1), (_msg2), (_msg3), (_msg4)) #else //------------- #define REFLOW_DEBUG_MSG(_msg) @@ -283,7 +285,7 @@ void nsFormControlFrame::SkipResizeReflow(nsSize& aCacheSize, aBailOnWidth = aCacheSize.width != kSizeNotSet; #ifdef FCF_NOISY if (aBailOnWidth) { - printf("-------------- #1 Bailing on aCachedAvailableSize.width %d != kSizeNotSet\n", aCachedAvailableSize.width); + PRINTF("-------------- #1 Bailing on aCachedAvailableSize.width %d != kSizeNotSet\n", aCachedAvailableSize.width); } #endif } else { @@ -292,12 +294,12 @@ void nsFormControlFrame::SkipResizeReflow(nsSize& aCacheSize, aBailOnWidth = aCachedAvailableSize.width <= width && aCachedAvailableSize.width != kSizeNotSet; #ifdef FCF_NOISY if (aBailOnWidth) { - printf("-------------- #2 Bailing on aCachedAvailableSize.width %d <= width %d\n", aCachedAvailableSize.width, width ); + PRINTF("-------------- #2 Bailing on aCachedAvailableSize.width %d <= width %d\n", aCachedAvailableSize.width, width ); } else { aBailOnWidth = width <= (aCacheSize.width - aReflowState.mComputedBorderPadding.left - aReflowState.mComputedBorderPadding.right) && aCachedAvailableSize.width == kSizeNotSet; if (aBailOnWidth) { - printf("-------------- #2.2 Bailing on width %d <= aCachedAvailableSize.width %d\n",(aCacheSize.width - aReflowState.mComputedBorderPadding.left - aReflowState.mComputedBorderPadding.right), width ); + PRINTF("-------------- #2.2 Bailing on width %d <= aCachedAvailableSize.width %d\n",(aCacheSize.width - aReflowState.mComputedBorderPadding.left - aReflowState.mComputedBorderPadding.right), width ); } } #endif @@ -312,7 +314,7 @@ void nsFormControlFrame::SkipResizeReflow(nsSize& aCacheSize, //} #ifdef FCF_NOISY if (aBailOnWidth) { - printf("-------------- #3 Bailing on aCachedAvailableSize.width %d == aReflowState.mComputedWidth %d\n", aCachedAvailableSize.width, width ); + PRINTF("-------------- #3 Bailing on aCachedAvailableSize.width %d == aReflowState.mComputedWidth %d\n", aCachedAvailableSize.width, width ); } #endif } @@ -324,7 +326,7 @@ void nsFormControlFrame::SkipResizeReflow(nsSize& aCacheSize, aBailOnHeight = aCacheSize.height != kSizeNotSet; #ifdef FCF_NOISY if (aBailOnHeight) { - printf("-------------- #1 Bailing on aCachedAvailableSize.height %d != kSizeNotSet\n", aCachedAvailableSize.height); + PRINTF("-------------- #1 Bailing on aCachedAvailableSize.height %d != kSizeNotSet\n", aCachedAvailableSize.height); } #endif } else { @@ -333,12 +335,12 @@ void nsFormControlFrame::SkipResizeReflow(nsSize& aCacheSize, aBailOnHeight = aCachedAvailableSize.height <= height && aCachedAvailableSize.height != kSizeNotSet; #ifdef FCF_NOISY if (aBailOnHeight) { - printf("-------------- #2 Bailing on aCachedAvailableSize.height %d <= height %d\n", aCachedAvailableSize.height, height ); + PRINTF("-------------- #2 Bailing on aCachedAvailableSize.height %d <= height %d\n", aCachedAvailableSize.height, height ); } else { aBailOnHeight = height <= (aCacheSize.height - aReflowState.mComputedBorderPadding.left - aReflowState.mComputedBorderPadding.right) && aCachedAvailableSize.height == kSizeNotSet; if (aBailOnHeight) { - printf("-------------- #2.2 Bailing on height %d <= aCachedAvailableSize.height %d\n",(aCacheSize.height - aReflowState.mComputedBorderPadding.left - aReflowState.mComputedBorderPadding.right), height ); + PRINTF("-------------- #2.2 Bailing on height %d <= aCachedAvailableSize.height %d\n",(aCacheSize.height - aReflowState.mComputedBorderPadding.left - aReflowState.mComputedBorderPadding.right), height ); } } #endif @@ -353,7 +355,7 @@ void nsFormControlFrame::SkipResizeReflow(nsSize& aCacheSize, //} #ifdef FCF_NOISY if (aBailOnHeight) { - printf("-------------- #3 Bailing on aCachedAvailableSize.height %d == aReflowState.mComputedHeight %d\n", aCachedAvailableSize.height, height ); + PRINTF("-------------- #3 Bailing on aCachedAvailableSize.height %d == aReflowState.mComputedHeight %d\n", aCachedAvailableSize.height, height ); } #endif } diff --git a/mozilla/layout/forms/nsFormControlFrame.h b/mozilla/layout/forms/nsFormControlFrame.h index 37810728eee..c51fca0237b 100644 --- a/mozilla/layout/forms/nsFormControlFrame.h +++ b/mozilla/layout/forms/nsFormControlFrame.h @@ -33,6 +33,11 @@ #include "nsIStyleContext.h" #include "nsIPresContext.h" #include "nsCOMPtr.h" +#include "nslog.h" + +NS_DECL_LOG(nsFormControlFrameLog) +#define PRINTF NS_LOG_PRINTF(nsFormControlFrameLog) +#define FLUSH NS_LOG_FLUSH(nsFormControlFrameLog) class nsIView; class nsIPresContext; @@ -50,7 +55,7 @@ class nsFormFrame; { \ float t2p; \ aPresContext->GetTwipsToPixels(&t2p); \ - printf ("%-25s::Size=%4d,%4d %3d,%3d Nav:%3d,%3d Diffs: %3d,%3d\n", \ + PRINTF ("%-25s::Size=%4d,%4d %3d,%3d Nav:%3d,%3d Diffs: %3d,%3d\n", \ (__class), \ aDesiredSize.width, aDesiredSize.height, \ NSToCoordRound(aDesiredSize.width * t2p), \ diff --git a/mozilla/layout/forms/nsFormControlHelper.cpp b/mozilla/layout/forms/nsFormControlHelper.cpp index e9fde8362ff..d6a0bd5e863 100644 --- a/mozilla/layout/forms/nsFormControlHelper.cpp +++ b/mozilla/layout/forms/nsFormControlHelper.cpp @@ -63,6 +63,11 @@ #include "nsITextContent.h" #include "nsISupportsArray.h" #include "nsXPIDLString.h" +#include "nslog.h" + +NS_IMPL_LOG(nsFormControlHelperLog) +#define PRINTF NS_LOG_PRINTF(nsFormControlHelperLog) +#define FLUSH NS_LOG_FLUSH(nsFormControlHelperLog) static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID); static NS_DEFINE_CID(kStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID); @@ -343,8 +348,8 @@ nsFormControlHelper::CalcNavQuirkSizing(nsIPresContext* aPresContext, } #ifdef DEBUG_rodsXXXX - printf("********* Nav Quirks: %d,%d max:%d average:%d ascent:%d descent:%d\n", - width, height, maxCharWidth, average, ascent, descent); + PRINTF("********* Nav Quirks: %d,%d max:%d average:%d ascent:%d descent:%d\n", + width, height, maxCharWidth, average, ascent, descent); #endif aSize.width = NSIntPixelsToTwips(width, p2t); diff --git a/mozilla/layout/forms/nsHTMLButtonControlFrame.cpp b/mozilla/layout/forms/nsHTMLButtonControlFrame.cpp index dc3ae53a3e9..77563ce6e7e 100644 --- a/mozilla/layout/forms/nsHTMLButtonControlFrame.cpp +++ b/mozilla/layout/forms/nsHTMLButtonControlFrame.cpp @@ -516,21 +516,19 @@ void ButtonHack(nsHTMLReflowState& aReflowState, char* aMessage) if ((aReflowState.mComputedWidth != NS_INTRINSICSIZE) && (aReflowState.mComputedWidth > aReflowState.availableWidth) && (aReflowState.availableWidth > 0)) { -// printf("BUG - %s has a computed width = %d, available width = %d \n", -// aMessage, aReflowState.mComputedWidth, aReflowState.availableWidth); +// PRINTF("BUG - %s has a computed width = %d, available width = %d \n", +// aMessage, aReflowState.mComputedWidth, aReflowState.availableWidth)); aReflowState.mComputedWidth = aReflowState.availableWidth; - } - if (aReflowState.mComputedHeight == 0) { + } if (aReflowState.mComputedHeight == 0) { aReflowState.mComputedHeight = aReflowState.availableHeight; } if ((aReflowState.mComputedHeight != NS_INTRINSICSIZE) && (aReflowState.mComputedHeight > aReflowState.availableHeight) && (aReflowState.availableHeight > 0)) { -// printf("BUG - %s has a computed height = %d, available height = %d \n", -// aMessage, aReflowState.mComputedHeight, aReflowState.availableHeight); +// PRINTF("BUG - %s has a computed height = %d, available height = %d \n", +// aMessage, aReflowState.mComputedHeight, aReflowState.availableHeight)); aReflowState.mComputedHeight = aReflowState.availableHeight; - } -} + }} NS_IMETHODIMP nsHTMLButtonControlFrame::AddComputedBorderPaddingToDesiredSize(nsHTMLReflowMetrics& aDesiredSize, diff --git a/mozilla/layout/forms/nsListControlFrame.cpp b/mozilla/layout/forms/nsListControlFrame.cpp index 0a86aab6d53..1244d512834 100644 --- a/mozilla/layout/forms/nsListControlFrame.cpp +++ b/mozilla/layout/forms/nsListControlFrame.cpp @@ -131,7 +131,7 @@ static PRInt32 gReflowInx = -1; if (mReflowId > -1) {\ gTotalReqs += gReflowControlCntRQ[mReflowId];\ gTotalReflows += gReflowControlCnt[mReflowId];\ - printf("** Id:%5d %s RF: %d RQ: %d %d/%d %5.2f\n", \ + PRINTF("** Id:%5d %s RF: %d RQ: %d %d/%d %5.2f\n", \ mReflowId, (__desc), \ gReflowControlCnt[mReflowId], \ gReflowControlCntRQ[mReflowId],\ @@ -149,10 +149,10 @@ static PRInt32 gReflowInx = -1; } // reflow messages -#define REFLOW_DEBUG_MSG(_msg1) printf((_msg1)) -#define REFLOW_DEBUG_MSG2(_msg1, _msg2) printf((_msg1), (_msg2)) -#define REFLOW_DEBUG_MSG3(_msg1, _msg2, _msg3) printf((_msg1), (_msg2), (_msg3)) -#define REFLOW_DEBUG_MSG4(_msg1, _msg2, _msg3, _msg4) printf((_msg1), (_msg2), (_msg3), (_msg4)) +#define REFLOW_DEBUG_MSG(_msg1) PRINTF((_msg1)) +#define REFLOW_DEBUG_MSG2(_msg1, _msg2) PRINTF((_msg1), (_msg2)) +#define REFLOW_DEBUG_MSG3(_msg1, _msg2, _msg3) PRINTF((_msg1), (_msg2), (_msg3)) +#define REFLOW_DEBUG_MSG4(_msg1, _msg2, _msg3, _msg4) PRINTF((_msg1), (_msg2), (_msg3), (_msg4)) #else //------------- @@ -173,10 +173,10 @@ static PRInt32 gReflowInx = -1; // This is for being VERY noisy //------------------------------------------ #ifdef DO_VERY_NOISY -#define REFLOW_NOISY_MSG(_msg1) printf((_msg1)) -#define REFLOW_NOISY_MSG2(_msg1, _msg2) printf((_msg1), (_msg2)) -#define REFLOW_NOISY_MSG3(_msg1, _msg2, _msg3) printf((_msg1), (_msg2), (_msg3)) -#define REFLOW_NOISY_MSG4(_msg1, _msg2, _msg3, _msg4) printf((_msg1), (_msg2), (_msg3), (_msg4)) +#define REFLOW_NOISY_MSG(_msg1) PRINTF((_msg1)) +#define REFLOW_NOISY_MSG2(_msg1, _msg2) PRINTF((_msg1), (_msg2)) +#define REFLOW_NOISY_MSG3(_msg1, _msg2, _msg3) PRINTF((_msg1), (_msg2), (_msg3)) +#define REFLOW_NOISY_MSG4(_msg1, _msg2, _msg3, _msg4) PRINTF((_msg1), (_msg2), (_msg3), (_msg4)) #else #define REFLOW_NOISY_MSG(_msg) #define REFLOW_NOISY_MSG2(_msg1, _msg2) @@ -202,7 +202,7 @@ static PRInt32 gReflowInx = -1; if (aReflowState.mComputedWidth != NS_UNCONSTRAINEDSIZE) { \ nscoord width = aDesiredSize.width - borderPadding.left - borderPadding.right; \ if (width != aReflowState.mComputedWidth) { \ - printf("aDesiredSize.width %d %d != aReflowState.mComputedWidth %d\n", aDesiredSize.width, width, aReflowState.mComputedWidth); \ + PRINTF("aDesiredSize.width %d %d != aReflowState.mComputedWidth %d\n", aDesiredSize.width, width, aReflowState.mComputedWidth); \ } \ NS_ASSERTION(width == aReflowState.mComputedWidth, "Returning bad value when constrained!"); \ } @@ -344,11 +344,11 @@ static int myCounter = 0; static void printSize(char * aDesc, nscoord aSize) { - printf(" %s: ", aDesc); + PRINTF(" %s: ", aDesc); if (aSize == NS_UNCONSTRAINEDSIZE) { - printf("UNC"); + PRINTF("UNC"); } else { - printf("%d", aSize); + PRINTF("%d", aSize); } } #endif @@ -368,35 +368,35 @@ nsListControlFrame::Reflow(nsIPresContext* aPresContext, aStatus = NS_FRAME_COMPLETE; #ifdef DO_REFLOW_DEBUG - printf("%p ** Id: %d nsLCF::Reflow %d R: ", this, mReflowId, myCounter++); + PRINTF("%p ** Id: %d nsLCF::Reflow %d R: ", this, mReflowId, myCounter++); switch (aReflowState.reason) { case eReflowReason_Initial: - printf("Initia");break; + PRINTF("Initia");break; case eReflowReason_Incremental: - printf("Increm");break; + PRINTF("Increm");break; case eReflowReason_Resize: - printf("Resize");break; + PRINTF("Resize");break; case eReflowReason_StyleChange: - printf("StyleC");break; + PRINTF("StyleC");break; case eReflowReason_Dirty: - printf("Dirty ");break; - default:printf("%d", aReflowState.reason);break; + PRINTF("Dirty ");break; + default:PRINTF("%d", aReflowState.reason);break; } printSize("AW", aReflowState.availableWidth); printSize("AH", aReflowState.availableHeight); printSize("CW", aReflowState.mComputedWidth); printSize("CH", aReflowState.mComputedHeight); - printf("\n"); + PRINTF("\n"); #if 0 { const nsStyleDisplay* display; GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&)display); - printf("+++++++++++++++++++++++++++++++++ "); + PRINTF("+++++++++++++++++++++++++++++++++ "); switch (display->mVisible) { - case NS_STYLE_VISIBILITY_COLLAPSE: printf("NS_STYLE_VISIBILITY_COLLAPSE\n");break; - case NS_STYLE_VISIBILITY_HIDDEN: printf("NS_STYLE_VISIBILITY_HIDDEN\n");break; - case NS_STYLE_VISIBILITY_VISIBLE: printf("NS_STYLE_VISIBILITY_VISIBLE\n");break; + case NS_STYLE_VISIBILITY_COLLAPSE: PRINTF("NS_STYLE_VISIBILITY_COLLAPSE\n");break; + case NS_STYLE_VISIBILITY_HIDDEN: PRINTF("NS_STYLE_VISIBILITY_HIDDEN\n");break; + case NS_STYLE_VISIBILITY_VISIBLE: PRINTF("NS_STYLE_VISIBILITY_VISIBLE\n");break; } } #endif @@ -444,7 +444,7 @@ nsListControlFrame::Reflow(nsIPresContext* aPresContext, if (options) { PRUint32 numOptions; options->GetLength(&numOptions); - printf("--- Num of Items %d ---\n", numOptions); + PRINTF("--- Num of Items %d ---\n", numOptions); for (PRUint32 i=0;i optionElement = getter_AddRefs(GetOption(*options, i)); if (optionElement) { @@ -457,7 +457,7 @@ nsListControlFrame::Reflow(nsIPresContext* aPresContext, } else { text = "No Value"; } - printf("[%d] - %s\n", i, text.ToNewCString()); + PRINTF("[%d] - %s\n", i, text.ToNewCString()); } } } @@ -839,7 +839,7 @@ nsListControlFrame::Reflow(nsIPresContext* aPresContext, if (!isInDropDownMode) { PRInt32 numRows = 1; GetSizeAttribute(&numRows); - printf("%d ", numRows); + PRINTF("%d ", numRows); if (numRows == 2) { COMPARE_QUIRK_SIZE("nsListControlFrame", 56, 38) } else if (numRows == 3) { @@ -1345,9 +1345,9 @@ nsListControlFrame::HandleEvent(nsIPresContext* aPresContext, "NS_MOUSE_RIGHT_CLICK"}; int inx = aEvent->message-NS_MOUSE_MESSAGE_START; if (inx >= 0 && inx <= (NS_MOUSE_RIGHT_CLICK-NS_MOUSE_MESSAGE_START)) { - printf("Mouse in ListFrame %s [%d]\n", desc[inx], aEvent->message); + PRINTF("Mouse in ListFrame %s [%d]\n", desc[inx], aEvent->message); } else { - printf("Mouse in ListFrame [%d]\n", aEvent->message); + PRINTF("Mouse in ListFrame [%d]\n", aEvent->message); }*/ if (nsEventStatus_eConsumeNoDefault == *aEventStatus) @@ -1368,7 +1368,7 @@ nsListControlFrame::HandleEvent(nsIPresContext* aPresContext, if (NS_KEY_EVENT == aEvent->eventStructType) { #ifdef DEBUG_rodsXXX nsKeyEvent* keyEvent = (nsKeyEvent*)aEvent; - printf("---> %d %c\n", keyEvent->keyCode, keyEvent->keyCode); + PRINTF("---> %d %c\n", keyEvent->keyCode, keyEvent->keyCode); #endif //if (NS_VK_SPACE == keyEvent->keyCode || NS_VK_RETURN == keyEvent->keyCode) { // MouseClicked(aPresContext); @@ -1702,7 +1702,7 @@ nsListControlFrame::SetContentSelected(PRInt32 aIndex, PRBool aSelected) PRInt32 numOptions = 0; if (NS_SUCCEEDED(GetNumberOfOptions(&numOptions))) { if (aIndex >= numOptions || aIndex < 0) { - printf("Index: %d Range 0:%d (setting to %s)\n", aIndex, numOptions, aSelected?"TRUE":"FALSE"); + PRINTF("Index: %d Range 0:%d (setting to %s)\n", aIndex, numOptions, aSelected?"TRUE":"FALSE"); NS_ASSERTION(0, "Bad Index has been passed into SetContentSelected!"); } } else { @@ -2233,7 +2233,7 @@ NS_IMETHODIMP nsListControlFrame::AddOption(nsIPresContext* aPresContext, PRInt32 aIndex) { #ifdef DO_REFLOW_DEBUG - printf("---- Id: %d nsLCF %p Added Option %d\n", mReflowId, this, aIndex); + PRINTF("---- Id: %d nsLCF %p Added Option %d\n", mReflowId, this, aIndex); #endif if (!mIsAllContentHere) { @@ -2285,7 +2285,7 @@ nsListControlFrame::AddOption(nsIPresContext* aPresContext, PRInt32 aIndex) if (NS_CONTENT_ATTR_NOT_THERE == rv || 0 == text.Length()) { option->GetText(text); } - printf("|||||this %p Index: %d [%s] CB: %p\n", this, aIndex, text.ToNewCString(), mComboboxFrame); //leaks + PRINTF("|||||this %p Index: %d [%s] CB: %p\n", this, aIndex, text.ToNewCString(), mComboboxFrame); //leaks } #endif } @@ -2997,8 +2997,8 @@ nsListControlFrame::GetIndexFromDOMEvent(nsIDOMEvent* aMouseEvent, mPresContext->GetShell(getter_AddRefs(presShell)); nsIFrame * frame; nsresult result = presShell->GetPrimaryFrameFor(content, &frame); - printf("Target Frame: %p this: %p\n", frame, this); - printf("-->\n"); + PRINTF("Target Frame: %p this: %p\n", frame, this); + PRINTF("-->\n"); #endif nsresult rv = NS_ERROR_FAILURE; @@ -3011,11 +3011,11 @@ nsListControlFrame::GetIndexFromDOMEvent(nsIDOMEvent* aMouseEvent, if (optionContent) { aOldIndex = aCurIndex; aCurIndex = GetSelectedIndexFromContent(optionContent); - //printf("--> Old: %d New: %d\n", aOldIndex, aCurIndex); + //PRINTF("--> Old: %d New: %d\n", aOldIndex, aCurIndex); rv = NS_OK; } } - //printf("--> bailing\n"); + //PRINTF("--> bailing\n"); return rv; } @@ -3399,9 +3399,9 @@ nsListControlFrame::AdjustIndexForDisabledOpt(PRInt32 &anNewIndex, PRInt32 &anOl aWasDisabled = PR_FALSE; while (1) { // Special Debug Code - //printf("T:%d B:%d I:%d R:%d IM:%d I:%d\n", top, bottom, newIndex, aDoAdjustInc, aDoAdjustIncNext, doingReverse); + //PRINTF("T:%d B:%d I:%d R:%d IM:%d I:%d\n", top, bottom, newIndex, aDoAdjustInc, aDoAdjustIncNext, doingReverse); //if (newIndex < -30 || newIndex > 30) { - // printf("********************************* Stopped!\n"); + // PRINTF("********************************* Stopped!\n"); // return; //} // if the newIndex isn't disabled, we are golden, bail out diff --git a/mozilla/layout/generic/nsBlockBandData.cpp b/mozilla/layout/generic/nsBlockBandData.cpp index 97fcfe9a55a..c0faf742d19 100644 --- a/mozilla/layout/generic/nsBlockBandData.cpp +++ b/mozilla/layout/generic/nsBlockBandData.cpp @@ -28,6 +28,11 @@ #include "nsIFrameManager.h" #include "nsLayoutAtoms.h" #include "nsVoidArray.h" +#include "nslog.h" + +NS_IMPL_LOG(nsBlockBandDataLog) +#define PRINTF NS_LOG_PRINTF(nsBlockBandDataLog) +#define FLUSH NS_LOG_FLUSH(nsBlockBandDataLog) nsBlockBandData::nsBlockBandData() : mSpaceManager(nsnull), @@ -82,8 +87,8 @@ nsBlockBandData::GetAvailableSpace(nscoord aY, nsRect& aResult) ComputeAvailSpaceRect(); aResult = mAvailSpace; #ifdef REALLY_NOISY_COMPUTEAVAILSPACERECT - printf("nsBBD %p GetAvailableSpace(%d) returing (%d, %d, %d, %d)\n", - this, aY, aResult.x, aResult.y, aResult.width, aResult.height); + PRINTF("nsBBD %p GetAvailableSpace(%d) returing (%d, %d, %d, %d)\n", + this, aY, aResult.x, aResult.y, aResult.width, aResult.height); #endif return NS_OK; } @@ -144,7 +149,7 @@ void nsBlockBandData::ComputeAvailSpaceRect() { #ifdef REALLY_NOISY_COMPUTEAVAILSPACERECT - printf("nsBlockBandData::ComputeAvailSpaceRect %p with count %d\n", this, mCount); + PRINTF("nsBlockBandData::ComputeAvailSpaceRect %p with count %d\n", this, mCount); #endif if (0 == mCount) { mAvailSpace.x = 0; @@ -173,7 +178,7 @@ nsBlockBandData::ComputeAvailSpaceRect() trapezoid = &mTrapezoids[i]; if (trapezoid->mState != nsBandTrapezoid::Available) { #ifdef REALLY_NOISY_COMPUTEAVAILSPACERECT - printf("band %p checking !Avail trap %p with frame %p\n", this, trapezoid, trapezoid->mFrame); + PRINTF("band %p checking !Avail trap %p with frame %p\n", this, trapezoid, trapezoid->mFrame); #endif const nsStyleDisplay* display; if (nsBandTrapezoid::OccupiedMultiple == trapezoid->mState) { @@ -214,7 +219,7 @@ nsBlockBandData::ComputeAvailSpaceRect() leftFloaters = 1; } #ifdef REALLY_NOISY_COMPUTEAVAILSPACERECT - printf("band %p has floaters %d, %d\n", this, leftFloaters, rightFloaters); + PRINTF("band %p has floaters %d, %d\n", this, leftFloaters, rightFloaters); #endif mLeftFloaters = leftFloaters; mRightFloaters = rightFloaters; @@ -261,7 +266,7 @@ nsBlockBandData::ComputeAvailSpaceRect() mAvailSpace.width = NS_UNCONSTRAINEDSIZE; } #ifdef REALLY_NOISY_COMPUTEAVAILSPACERECT - printf(" ComputeAvailSpaceRect settting state mAvailSpace (%d,%d,%d,%d)\n", + PRINTF(" ComputeAvailSpaceRect settting state mAvailSpace (%d,%d,%d,%d)\n", mAvailSpace.x, mAvailSpace.y, mAvailSpace.width, mAvailSpace.height); #endif @@ -492,11 +497,11 @@ nsBlockBandData::GetMaxElementSize(nsIPresContext* aPresContext, #ifdef DEBUG void nsBlockBandData::List() { - printf("nsBlockBandData %p sm=%p, sm coord = (%d,%d), mSpace = (%d,%d)\n", + PRINTF("nsBlockBandData %p sm=%p, sm coord = (%d,%d), mSpace = (%d,%d)\n", this, mSpaceManager, mSpaceManagerX, mSpaceManagerY, - mSpace.width, mSpace.height); - printf(" availSpace=(%d, %d, %d, %d), floaters l=%d r=%d\n", + mSpace.width, mSpace.height); + PRINTF(" availSpace=(%d, %d, %d, %d), floaters l=%d r=%d\n", mAvailSpace.x, mAvailSpace.y, mAvailSpace.width, mAvailSpace.height, - mLeftFloaters, mRightFloaters); + mLeftFloaters, mRightFloaters); } #endif diff --git a/mozilla/layout/generic/nsBlockFrame.cpp b/mozilla/layout/generic/nsBlockFrame.cpp index c9a7aecd5dc..ff838739002 100644 --- a/mozilla/layout/generic/nsBlockFrame.cpp +++ b/mozilla/layout/generic/nsBlockFrame.cpp @@ -57,6 +57,12 @@ #include "nsSpaceManager.h" #include "prenv.h" #include "plstr.h" +#include "nslog.h" +#undef fprintf + +NS_IMPL_LOG(nsBlockFrameLog) +#define PRINTF NS_LOG_PRINTF(nsBlockFrameLog) +#define FLUSH NS_LOG_FLUSH(nsBlockFrameLog) #ifdef DEBUG @@ -92,14 +98,14 @@ static BlockDebugFlags gFlags[] = { static void ShowDebugFlags() { - printf("Here are the available GECKO_BLOCK_DEBUG_FLAGS:\n"); + PRINTF("Here are the available GECKO_BLOCK_DEBUG_FLAGS:\n"); BlockDebugFlags* bdf = gFlags; BlockDebugFlags* end = gFlags + NUM_DEBUG_FLAGS; for (; bdf < end; bdf++) { - printf(" %s\n", bdf->name); + PRINTF(" %s\n", bdf->name); } - printf("Note: GECKO_BLOCK_DEBUG_FLAGS is a comma seperated list of flag\n"); - printf("names (no whitespace)\n"); + PRINTF("Note: GECKO_BLOCK_DEBUG_FLAGS is a comma seperated list of flag\n"); + PRINTF("names (no whitespace)\n"); } static void @@ -121,7 +127,7 @@ InitDebugFlags() for (; bdf < end; bdf++) { if (PL_strcasecmp(bdf->name, flags) == 0) { *(bdf->on) = PR_TRUE; - printf("nsBlockFrame: setting %s debug flag on\n", bdf->name); + PRINTF("nsBlockFrame: setting %s debug flag on\n", bdf->name); gNoisy = PR_TRUE; found = PR_TRUE; break; @@ -192,17 +198,17 @@ DumpStyleGeneaology(nsIFrame* aFrame, const char* gap) { fputs(gap, stdout); nsFrame::ListTag(stdout, aFrame); - printf(": "); + PRINTF(": "); nsIStyleContext* sc; aFrame->GetStyleContext(&sc); while (nsnull != sc) { nsIStyleContext* psc; - printf("%p ", sc); + PRINTF("%p ", sc); psc = sc->GetParent(); NS_RELEASE(sc); sc = psc; } - printf("\n"); + PRINTF("\n"); } #endif @@ -240,7 +246,7 @@ RecordReflowStatus(PRBool aChildIsBlock, nsReflowStatus aFrameReflowStatus) // Log updates to the status that yield different values if (record[index] != newS) { record[index] = newS; - printf("record(%d): %02x %02x\n", index, record[0], record[1]); + PRINTF("record(%d): %02x %02x\n", index, record[0], record[1]); } } #endif @@ -311,7 +317,7 @@ public: #ifdef DEBUG if (gNoisyReflow) { nsFrame::IndentBy(stdout, gNoiseIndent); - printf("GetAvailableSpace: band=%d,%d,%d,%d count=%d\n", + PRINTF("GetAvailableSpace: band=%d,%d,%d,%d count=%d\n", mAvailSpaceRect.x, mAvailSpaceRect.y, mAvailSpaceRect.width, mAvailSpaceRect.height, mBand.GetTrapezoidCount()); @@ -332,7 +338,7 @@ public: #ifdef DEBUG if (gNoisyReflow) { nsFrame::IndentBy(stdout, gNoiseIndent); - printf("GetAvailableSpace: band=%d,%d,%d,%d count=%d\n", + PRINTF("GetAvailableSpace: band=%d,%d,%d,%d count=%d\n", mAvailSpaceRect.x, mAvailSpaceRect.y, mAvailSpaceRect.width, mAvailSpaceRect.height, mBand.GetTrapezoidCount()); @@ -387,10 +393,10 @@ public: (mMaxElementSize.height != oldSize.height)) { nsFrame::IndentBy(stdout, mBlock->GetDepth()); if (NS_UNCONSTRAINEDSIZE == mReflowState.availableWidth) { - printf("PASS1 "); + PRINTF("PASS1 "); } nsFrame::ListTag(stdout, mBlock); - printf(": old max-element-size=%d,%d new=%d,%d\n", + PRINTF(": old max-element-size=%d,%d new=%d,%d\n", oldSize.width, oldSize.height, mMaxElementSize.width, mMaxElementSize.height); } @@ -400,7 +406,7 @@ public: void UpdateMaximumWidth(nscoord aMaximumWidth) { if (aMaximumWidth > mMaximumWidth) { #ifdef NOISY_MAXIMUM_WIDTH - printf("nsBlockReflowState::UpdateMaximumWidth block %p caching max width %d\n", mBlock, aMaximumWidth); + PRINTF("nsBlockReflowState::UpdateMaximumWidth block %p caching max width %d\n", mBlock, aMaximumWidth); #endif mMaximumWidth = aMaximumWidth; } @@ -427,7 +433,7 @@ public: PRBool IsImpactedByFloater() { #ifdef REALLY_NOISY_REFLOW - printf("nsBlockReflowState::IsImpactedByFloater %p returned %d\n", + PRINTF("nsBlockReflowState::IsImpactedByFloater %p returned %d\n", this, mBand.GetFloaterCount()); #endif return mBand.GetFloaterCount(); @@ -721,7 +727,7 @@ nsBlockReflowState::nsBlockReflowState(const nsHTMLReflowState& aReflowState, SetFlag(BRS_COMPUTEMAXELEMENTSIZE, (nsnull != aMetrics.maxElementSize)); #ifdef NOISY_MAX_ELEMENT_SIZE - printf("BRS: setting compute-MES to %d\n", (nsnull != aMetrics.maxElementSize)); + PRINTF("BRS: setting compute-MES to %d\n", (nsnull != aMetrics.maxElementSize)); #endif mMaxElementSize.SizeTo(0, 0); SetFlag(BRS_COMPUTEMAXWIDTH, @@ -772,7 +778,7 @@ nsBlockReflowState::ComputeBlockAvailSpace(nsIFrame* aFrame, nsRect& aResult) { #ifdef REALLY_NOISY_REFLOW - printf("CBAS frame=%p has floater count %d\n", aFrame, mBand.GetFloaterCount()); + PRINTF("CBAS frame=%p has floater count %d\n", aFrame, mBand.GetFloaterCount()); mBand.List(); #endif aResult.y = mY; @@ -883,7 +889,7 @@ nsBlockReflowState::ComputeBlockAvailSpace(nsIFrame* aFrame, aResult.width = mAvailSpaceRect.width; } #ifdef REALLY_NOISY_REFLOW - printf(" CBAS: result %d %d %d %d\n", aResult.x, aResult.y, aResult.width, aResult.height); + PRINTF(" CBAS: result %d %d %d %d\n", aResult.x, aResult.y, aResult.width, aResult.height); #endif } @@ -902,7 +908,7 @@ nsBlockReflowState::ClearPastFloaters(PRUint8 aBreakType) ClearFloaters(saveY, aBreakType); #ifdef NOISY_FLOATER_CLEARING nsFrame::ListTag(stdout, mBlock); - printf(": ClearPastFloaters: mPrevBottomMargin=%d saveY=%d oldY=%d newY=%d deltaY=%d\n", + PRINTF(": ClearPastFloaters: mPrevBottomMargin=%d saveY=%d oldY=%d newY=%d deltaY=%d\n", mPrevBottomMargin, saveY, saveY - mPrevBottomMargin, mY, mY - saveY); #endif @@ -1012,17 +1018,17 @@ nsBlockReflowState::RecoverStateFrom(nsLineBox* aLine, #ifdef DEBUG if (CRAZY_WIDTH(xmost)) { nsFrame::ListTag(stdout, mBlock); - printf(": WARNING: xmost:%d\n", xmost); + PRINTF(": WARNING: xmost:%d\n", xmost); } #endif #ifdef NOISY_KIDXMOST - printf("%p RecoverState block %p aState.mKidXMost=%d\n", this, mBlock, xmost); + PRINTF("%p RecoverState block %p aState.mKidXMost=%d\n", this, mBlock, xmost); #endif mKidXMost = xmost; } if (GetFlag(BRS_COMPUTEMAXELEMENTSIZE)) { #ifdef NOISY_MAX_ELEMENT_SIZE - printf("nsBlockReflowState::RecoverStateFrom block %p caching max width %d\n", mBlock, aLine->mMaxElementWidth); + PRINTF("nsBlockReflowState::RecoverStateFrom block %p caching max width %d\n", mBlock, aLine->mMaxElementWidth); #endif UpdateMaxElementSize(nsSize(aLine->mMaxElementWidth, aLine->mBounds.height)); } @@ -1030,7 +1036,7 @@ nsBlockReflowState::RecoverStateFrom(nsLineBox* aLine, // If computing the maximum width, then update mMaximumWidth if (GetFlag(BRS_COMPUTEMAXWIDTH)) { #ifdef NOISY_MAXIMUM_WIDTH - printf("nsBlockReflowState::RecoverStateFrom block %p caching max width %d\n", mBlock, aLine->mMaximumWidth); + PRINTF("nsBlockReflowState::RecoverStateFrom block %p caching max width %d\n", mBlock, aLine->mMaximumWidth); #endif UpdateMaximumWidth(aLine->mMaximumWidth); } @@ -1041,9 +1047,9 @@ nsBlockReflowState::RecoverStateFrom(nsLineBox* aLine, aApplyTopMargin = ClearPastFloaters(aLine->GetBreakType()); #ifdef NOISY_VERTICAL_MARGINS nsFrame::ListTag(stdout, mBlock); - printf(": RecoverStateFrom: y=%d child ", mY); + PRINTF(": RecoverStateFrom: y=%d child ", mY); nsFrame::ListTag(stdout, aLine->mFirstChild); - printf(" has clear of %d => %s, mPrevBottomMargin=%d\n", aLine->mBreakType, + PRINTF(" has clear of %d => %s, mPrevBottomMargin=%d\n", aLine->mBreakType, aApplyTopMargin ? "applyTopMargin" : "nope", mPrevBottomMargin); #endif } @@ -1135,10 +1141,10 @@ nsBlockReflowState::RecoverStateFrom(nsLineBox* aLine, nscoord tx, ty; mSpaceManager->GetTranslation(tx, ty); nsFrame::IndentBy(stdout, gNoiseIndent); - printf("RecoverState: txy=%d,%d (%d,%d) ", + PRINTF("RecoverState: txy=%d,%d (%d,%d) ", tx, ty, mSpaceManagerX, mSpaceManagerY); nsFrame::ListTag(stdout, floater); - printf(" r.y=%d finalDeltaY=%d (sum=%d) region={%d,%d,%d,%d}\n", + PRINTF(" r.y=%d finalDeltaY=%d (sum=%d) region={%d,%d,%d,%d}\n", r.y, finalDeltaY, r.y + finalDeltaY, fc->mRegion.x, fc->mRegion.y, fc->mRegion.width, fc->mRegion.height); @@ -1278,7 +1284,7 @@ nsBlockFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) con IndentBy(out, aIndent); ListTag(out); #ifdef DEBUG_waterson - fprintf(out, " [parent=%p]", mParent); + FPRINTF(out, " [parent=%p]", mParent); #endif nsIView* view; GetView(aPresContext, &view); @@ -1508,7 +1514,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, if (gNoisyReflow) { IndentBy(stdout, gNoiseIndent); ListTag(stdout); - printf(": begin reflow type %d availSize=%d,%d computedSize=%d,%d\n", + PRINTF(": begin reflow type %d availSize=%d,%d computedSize=%d,%d\n", aReflowState.reason, aReflowState.availableWidth, aReflowState.availableHeight, aReflowState.mComputedWidth, aReflowState.mComputedHeight); } @@ -1582,7 +1588,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, extern char* nsPresShell_ReflowStackPointerTop; char marker; char* newsp = (char*) ▮ - printf("XXX: frame tree is too deep; approx stack size = %d\n", + PRINTF("XXX: frame tree is too deep; approx stack size = %d\n", nsPresShell_ReflowStackPointerTop - newsp); } #endif @@ -1605,7 +1611,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, nsHTMLReflowState& reflowState = (nsHTMLReflowState&)aReflowState; reflowState.mSpaceManager = spaceManager.get(); #ifdef NOISY_SPACEMANAGER - printf("constructed new space manager %p\n", reflowState.mSpaceManager); + PRINTF("constructed new space manager %p\n", reflowState.mSpaceManager); #endif } @@ -1624,7 +1630,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, case eReflowReason_Initial: #ifdef NOISY_REFLOW_REASON ListTag(stdout); - printf(": reflow=initial\n"); + PRINTF(": reflow=initial\n"); #endif DrainOverflowLines(aPresContext); rv = PrepareInitialReflow(state); @@ -1641,7 +1647,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, aReflowState.reflowCommand->GetType(type); #ifdef NOISY_REFLOW_REASON ListTag(stdout); - printf(": reflow=incremental type=%d\n", type); + PRINTF(": reflow=incremental type=%d\n", type); #endif switch (type) { case nsIReflowCommand::StyleChanged: @@ -1661,12 +1667,12 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, aReflowState.reflowCommand->GetNext(state.mNextRCFrame); #ifdef NOISY_REFLOW_REASON ListTag(stdout); - printf(": reflow=incremental"); + PRINTF(": reflow=incremental"); if (state.mNextRCFrame) { - printf(" next="); + PRINTF(" next="); nsFrame::ListTag(stdout, state.mNextRCFrame); } - printf("\n"); + PRINTF("\n"); #endif // this code does a correct job of propogating incremental reflows (bug 25510) @@ -1724,7 +1730,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, default: #ifdef NOISY_REFLOW_REASON ListTag(stdout); - printf(": reflow=resize (%d)\n", aReflowState.reason); + PRINTF(": reflow=resize (%d)\n", aReflowState.reason); #endif DrainOverflowLines(aPresContext); rv = PrepareResizeReflow(state); @@ -1749,7 +1755,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, } else { #ifdef DEBUG_kipp - ListTag(stdout); printf(": block is not complete\n"); + ListTag(stdout); PRINTF(": block is not complete\n"); #endif } } @@ -1769,7 +1775,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, if (xMost > aMetrics.width) { #ifdef NOISY_FINAL_SIZE ListTag(stdout); - printf(": changing desired width from %d to %d\n", aMetrics.width, xMost); + PRINTF(": changing desired width from %d to %d\n", aMetrics.width, xMost); #endif aMetrics.width = xMost; } @@ -1777,7 +1783,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, if (yMost > aMetrics.height) { #ifdef NOISY_FINAL_SIZE ListTag(stdout); - printf(": changing desired height from %d to %d\n", aMetrics.height, yMost); + PRINTF(": changing desired height from %d to %d\n", aMetrics.height, yMost); #endif aMetrics.height = yMost; } @@ -1810,7 +1816,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, if (NS_BLOCK_SPACE_MGR & mState) { nsHTMLReflowState& reflowState = (nsHTMLReflowState&)aReflowState; #ifdef NOISY_SPACEMANAGER - printf("restoring old space manager %p\n", oldSpaceManager); + PRINTF("restoring old space manager %p\n", oldSpaceManager); #endif reflowState.mSpaceManager = oldSpaceManager; } @@ -1819,7 +1825,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, nsHTMLReflowState& reflowState = (nsHTMLReflowState&)aReflowState; if (reflowState.mSpaceManager) { ListTag(stdout); - printf(": space-manager %p after reflow\n", reflowState.mSpaceManager); + PRINTF(": space-manager %p after reflow\n", reflowState.mSpaceManager); reflowState.mSpaceManager->List(stdout); } #endif @@ -1832,7 +1838,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, // Lots of things could have changed so damage our entire // bounds #ifdef NOISY_BLOCK_INVALIDATE - printf("%p invalidate 1 (%d, %d, %d, %d)\n", + PRINTF("%p invalidate 1 (%d, %d, %d, %d)\n", this, 0, 0, mRect.width, mRect.height); #endif Invalidate(aPresContext, nsRect(0, 0, mRect.width, mRect.height)); @@ -1862,7 +1868,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, damageRect.height = mRect.height; } #ifdef NOISY_BLOCK_INVALIDATE - printf("%p invalidate 2 (%d, %d, %d, %d)\n", + PRINTF("%p invalidate 2 (%d, %d, %d, %d)\n", this, damageRect.x, damageRect.y, damageRect.width, damageRect.height); #endif Invalidate(aPresContext, damageRect); @@ -1889,7 +1895,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, damageRect.height = border.bottom; } #ifdef NOISY_BLOCK_INVALIDATE - printf("%p invalidate 3 (%d, %d, %d, %d)\n", + PRINTF("%p invalidate 3 (%d, %d, %d, %d)\n", this, damageRect.x, damageRect.y, damageRect.width, damageRect.height); #endif Invalidate(aPresContext, damageRect); @@ -1933,23 +1939,23 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, if (gNoisyReflow) { IndentBy(stdout, gNoiseIndent); ListTag(stdout); - printf(": status=%x (%scomplete) metrics=%d,%d carriedMargin=%d", + PRINTF(": status=%x (%scomplete) metrics=%d,%d carriedMargin=%d", aStatus, NS_FRAME_IS_COMPLETE(aStatus) ? "" : "not ", aMetrics.width, aMetrics.height, aMetrics.mCarriedOutBottomMargin); if (mState & NS_FRAME_OUTSIDE_CHILDREN) { - printf(" combinedArea={%d,%d,%d,%d}", + PRINTF(" combinedArea={%d,%d,%d,%d}", aMetrics.mOverflowArea.x, aMetrics.mOverflowArea.y, aMetrics.mOverflowArea.width, aMetrics.mOverflowArea.height); } if (aMetrics.maxElementSize) { - printf(" maxElementSize=%d,%d", + PRINTF(" maxElementSize=%d,%d", aMetrics.maxElementSize->width, aMetrics.maxElementSize->height); } - printf("\n"); + PRINTF("\n"); } if (gLameReflowMetrics) { @@ -1968,12 +1974,12 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, PR_snprintf(buf, sizeof(buf), ": %lld elapsed (%lld per line) (%d lines; %d new lines)", delta, perLineDelta, numLines, ectc - ctc); - printf("%s\n", buf); + PRINTF("%s\n", buf); } #endif #ifdef NOISY_MAX_ELEMENT_SIZE if (aMetrics.maxElementSize) { - printf("block %p returning with maxElementSize=%d,%d\n", this, + PRINTF("block %p returning with maxElementSize=%d,%d\n", this, aMetrics.maxElementSize->width, aMetrics.maxElementSize->height); } @@ -2057,7 +2063,7 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState, const nsMargin& borderPadding = aState.BorderPadding(); #ifdef NOISY_FINAL_SIZE ListTag(stdout); - printf(": mY=%d mIsBottomMarginRoot=%s mPrevBottomMargin=%d bp=%d,%d\n", + PRINTF(": mY=%d mIsBottomMarginRoot=%s mPrevBottomMargin=%d bp=%d,%d\n", aState.mY, aState.GetFlag(BRS_ISBOTTOMMARGINROOT) ? "yes" : "no", aState.mPrevBottomMargin, borderPadding.top, borderPadding.bottom); @@ -2066,7 +2072,7 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState, // Compute final width nscoord maxWidth = 0, maxHeight = 0; #ifdef NOISY_KIDXMOST - printf("%p aState.mKidXMost=%d\n", this, aState.mKidXMost); + PRINTF("%p aState.mKidXMost=%d\n", this, aState.mKidXMost); #endif nscoord minWidth = aState.mKidXMost + borderPadding.right; if (!HaveAutoWidth(aReflowState)) { @@ -2276,8 +2282,8 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState, aMetrics.maxElementSize->width = maxWidth; aMetrics.maxElementSize->height = maxHeight; #ifdef NOISY_MAX_ELEMENT_SIZE - printf ("nsBlockFrame::CFS: %p returning MES %d\n", - this, aMetrics.maxElementSize->width); + PRINTF ("nsBlockFrame::CFS: %p returning MES %d\n", + this, aMetrics.maxElementSize->width); #endif } @@ -2288,12 +2294,12 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState, #ifdef DEBUG_blocks if (CRAZY_WIDTH(aMetrics.width) || CRAZY_HEIGHT(aMetrics.height)) { ListTag(stdout); - printf(": WARNING: desired:%d,%d\n", aMetrics.width, aMetrics.height); + PRINTF(": WARNING: desired:%d,%d\n", aMetrics.width, aMetrics.height); } if (aState.GetFlag(BRS_COMPUTEMAXELEMENTSIZE) && ((maxWidth > aMetrics.width) || (maxHeight > aMetrics.height))) { ListTag(stdout); - printf(": WARNING: max-element-size:%d,%d desired:%d,%d maxSize:%d,%d\n", + PRINTF(": WARNING: max-element-size:%d,%d desired:%d,%d maxSize:%d,%d\n", maxWidth, maxHeight, aMetrics.width, aMetrics.height, aState.mReflowState.availableWidth, aState.mReflowState.availableHeight); @@ -2303,10 +2309,10 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState, if (aState.GetFlag(BRS_COMPUTEMAXELEMENTSIZE)) { IndentBy(stdout, GetDepth()); if (NS_UNCONSTRAINEDSIZE == aState.mReflowState.availableWidth) { - printf("PASS1 "); + PRINTF("PASS1 "); } ListTag(stdout); - printf(": max-element-size:%d,%d desired:%d,%d maxSize:%d,%d\n", + PRINTF(": max-element-size:%d,%d desired:%d,%d maxSize:%d,%d\n", maxWidth, maxHeight, aMetrics.width, aMetrics.height, aState.mReflowState.availableWidth, aState.mReflowState.availableHeight); @@ -2318,7 +2324,7 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState, // We need to add in for the right border/padding aMetrics.mMaximumWidth = aState.mMaximumWidth + borderPadding.right; #ifdef NOISY_MAXIMUM_WIDTH - printf("nsBlockFrame::ComputeFinalSize block %p setting aMetrics.mMaximumWidth to %d\n", this, aMetrics.mMaximumWidth); + PRINTF("nsBlockFrame::ComputeFinalSize block %p setting aMetrics.mMaximumWidth to %d\n", this, aMetrics.mMaximumWidth); #endif } @@ -2368,7 +2374,7 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState, } #ifdef NOISY_COMBINED_AREA ListTag(stdout); - printf(": ca=%d,%d,%d,%d\n", xa, ya, xb-xa, yb-ya); + PRINTF(": ca=%d,%d,%d,%d\n", xa, ya, xb-xa, yb-ya); #endif // If the combined area of our children exceeds our bounding box @@ -2427,7 +2433,7 @@ nsBlockFrame::MarkLineDirty(nsLineBox* aLine, nsLineBox* aPrevLine) if (gNoisyReflow) { IndentBy(stdout, gNoiseIndent); ListTag(stdout); - printf(": mark line %p dirty\n", aLine); + PRINTF(": mark line %p dirty\n", aLine); } #endif @@ -2440,7 +2446,7 @@ nsBlockFrame::MarkLineDirty(nsLineBox* aLine, nsLineBox* aPrevLine) if (gNoisyReflow) { IndentBy(stdout, gNoiseIndent); ListTag(stdout); - printf(": mark prev-line %p dirty\n", aPrevLine); + PRINTF(": mark prev-line %p dirty\n", aPrevLine); } #endif } @@ -2554,7 +2560,7 @@ nsBlockFrame::PrepareResizeReflow(nsBlockReflowState& aState) mStyleContext->GetStyleData(eStyleStruct_Text); IndentBy(stdout, gNoiseIndent); ListTag(stdout); - printf(": marking all lines dirty: reason=%d availWidth=%d textAlign=%d\n", + PRINTF(": marking all lines dirty: reason=%d availWidth=%d textAlign=%d\n", aState.mReflowState.reason, aState.mReflowState.availableWidth, mStyleText->mTextAlign); @@ -2587,7 +2593,7 @@ nsBlockFrame::PrepareResizeReflow(nsBlockReflowState& aState) if (gNoisyReflow) { IndentBy(stdout, gNoiseIndent); ListTag(stdout); - printf(": trying to avoid marking all lines dirty\n"); + PRINTF(": trying to avoid marking all lines dirty\n"); } #endif @@ -2601,8 +2607,8 @@ nsBlockFrame::PrepareResizeReflow(nsBlockReflowState& aState) else { // We can avoid reflowing *some* inline lines in some cases. #ifdef REALLY_NOISY_REFLOW - printf("PrepareResizeReflow thinks line %p is %simpacted by floaters\n", - line, line->IsImpactedByFloater() ? "" : "not "); + PRINTF("PrepareResizeReflow thinks line %p is %simpacted by floaters\n", + line, line->IsImpactedByFloater() ? "" : "not "); #endif if (notWrapping) { // When no-wrap is set then the only line-breaking that @@ -2628,7 +2634,7 @@ nsBlockFrame::PrepareResizeReflow(nsBlockReflowState& aState) #ifdef DEBUG if (gNoisyReflow && !line->IsDirty() && !notWrapping) { IndentBy(stdout, gNoiseIndent + 1); - printf("skipped: line=%p next=%p %s %s %s%s%s breakType=%d xmost=%d\n", + PRINTF("skipped: line=%p next=%p %s %s %s%s%s breakType=%d xmost=%d\n", line, line->mNext, line->IsBlock() ? "block" : "inline", aState.GetFlag(BRS_NOWRAP) ? "no-wrap" : "wrapping", @@ -2779,8 +2785,8 @@ nsBlockFrame::PropogateReflowDamage(nsBlockReflowState& aState, PRBool wasImpactedByFloater = next->IsImpactedByFloater(); PRBool isImpactedByFloater = aState.IsImpactedByFloater() ? PR_TRUE : PR_FALSE; #ifdef REALLY_NOISY_REFLOW - printf("nsBlockFrame::PropogateReflowDamage %p was = %d, is=%d\n", - this, wasImpactedByFloater, isImpactedByFloater); + PRINTF("nsBlockFrame::PropogateReflowDamage %p was = %d, is=%d\n", + this, wasImpactedByFloater, isImpactedByFloater); #endif if (wasImpactedByFloater != isImpactedByFloater) { next->MarkDirty(); @@ -2865,16 +2871,16 @@ nsBlockFrame::ReflowDirtyLines(nsBlockReflowState& aState) aState.mReflowState.reflowCommand->GetType(type); IndentBy(stdout, gNoiseIndent); ListTag(stdout); - printf(": incrementally reflowing dirty lines: type=%s(%d) isInline=%s", + PRINTF(": incrementally reflowing dirty lines: type=%s(%d) isInline=%s", kReflowCommandType[type], type, aState.GetFlag(BRS_ISINLINEINCRREFLOW) ? "true" : "false"); } else { IndentBy(stdout, gNoiseIndent); ListTag(stdout); - printf(": reflowing dirty lines"); + PRINTF(": reflowing dirty lines"); } - printf(" computedWidth=%d\n", aState.mReflowState.mComputedWidth); + PRINTF(" computedWidth=%d\n", aState.mReflowState.mComputedWidth); gNoiseIndent++; } #endif @@ -2902,7 +2908,7 @@ nsBlockFrame::ReflowDirtyLines(nsBlockReflowState& aState) &damageRect : 0); if (incrementalReflow && !damageRect.IsEmpty()) { #ifdef NOISY_BLOCK_INVALIDATE - printf("%p invalidate 4 (%d, %d, %d, %d)\n", + PRINTF("%p invalidate 4 (%d, %d, %d, %d)\n", this, damageRect.x, damageRect.y, damageRect.width, damageRect.height); #endif Invalidate(aState.mPresContext, damageRect); @@ -2919,7 +2925,7 @@ nsBlockFrame::ReflowDirtyLines(nsBlockReflowState& aState) nsRect lca; line->GetCombinedArea(&lca); IndentBy(stdout, gNoiseIndent); - printf("line=%p mY=%d dirty=%s oldBounds={%d,%d,%d,%d} oldCombinedArea={%d,%d,%d,%d} deltaY=%d mPrevBottomMargin=%d\n", + PRINTF("line=%p mY=%d dirty=%s oldBounds={%d,%d,%d,%d} oldCombinedArea={%d,%d,%d,%d} deltaY=%d mPrevBottomMargin=%d\n", line, aState.mY, line->IsDirty() ? "yes" : "no", line->mBounds.x, line->mBounds.y, line->mBounds.width, line->mBounds.height, @@ -2977,7 +2983,7 @@ nsBlockFrame::ReflowDirtyLines(nsBlockReflowState& aState) &damageRect : 0); if (incrementalReflow && !damageRect.IsEmpty()) { #ifdef NOISY_BLOCK_INVALIDATE - printf("%p invalidate 5 (%d, %d, %d, %d)\n", + PRINTF("%p invalidate 5 (%d, %d, %d, %d)\n", this, damageRect.x, damageRect.y, damageRect.width, damageRect.height); #endif Invalidate(aState.mPresContext, damageRect); @@ -2990,7 +2996,7 @@ nsBlockFrame::ReflowDirtyLines(nsBlockReflowState& aState) nsRect lca; line->GetCombinedArea(&lca); IndentBy(stdout, gNoiseIndent); - printf("line=%p mY=%d newBounds={%d,%d,%d,%d} newCombinedArea={%d,%d,%d,%d} deltaY=%d mPrevBottomMargin=%d\n", + PRINTF("line=%p mY=%d newBounds={%d,%d,%d,%d} newCombinedArea={%d,%d,%d,%d} deltaY=%d mPrevBottomMargin=%d\n", line, aState.mY, line->mBounds.x, line->mBounds.y, line->mBounds.width, line->mBounds.height, @@ -3089,7 +3095,7 @@ nsBlockFrame::ReflowDirtyLines(nsBlockReflowState& aState) gNoiseIndent--; IndentBy(stdout, gNoiseIndent); ListTag(stdout); - printf(": done reflowing dirty lines (status=%x)\n", + PRINTF(": done reflowing dirty lines (status=%x)\n", aState.mReflowStatus); } #endif @@ -3154,7 +3160,7 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState, nsRect dirtyRect; dirtyRect.UnionRect(oldCombinedArea, lineCombinedArea); #ifdef NOISY_BLOCK_INVALIDATE - printf("%p invalidate 6 (%d, %d, %d, %d)\n", + PRINTF("%p invalidate 6 (%d, %d, %d, %d)\n", this, dirtyRect.x, dirtyRect.y, dirtyRect.width, dirtyRect.height); #endif Invalidate(aState.mPresContext, dirtyRect); @@ -3174,7 +3180,7 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState, dirtyRect.height = PR_MAX(oldCombinedArea.height, lineCombinedArea.height); #ifdef NOISY_BLOCK_INVALIDATE - printf("%p invalidate 7 (%d, %d, %d, %d)\n", + PRINTF("%p invalidate 7 (%d, %d, %d, %d)\n", this, dirtyRect.x, dirtyRect.y, dirtyRect.width, dirtyRect.height); #endif Invalidate(aState.mPresContext, dirtyRect); @@ -3193,7 +3199,7 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState, lineCombinedArea.YMost()) - dirtyRect.y; #ifdef NOISY_BLOCK_INVALIDATE - printf("%p invalidate 8 (%d, %d, %d, %d)\n", + PRINTF("%p invalidate 8 (%d, %d, %d, %d)\n", this, dirtyRect.x, dirtyRect.y, dirtyRect.width, dirtyRect.height); #endif Invalidate(aState.mPresContext, dirtyRect); @@ -3233,7 +3239,7 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState, // Update the line's maximum width aLine->mMaximumWidth = aLine->mBounds.XMost(); #ifdef NOISY_MAXIMUM_WIDTH - printf("nsBlockFrame::ReflowLine block %p line %p setting aLine.mMaximumWidth to %d\n", + PRINTF("nsBlockFrame::ReflowLine block %p line %p setting aLine.mMaximumWidth to %d\n", this, aLine, aLine->mMaximumWidth); #endif aState.UpdateMaximumWidth(aLine->mMaximumWidth); @@ -3263,7 +3269,7 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState, if (aState.GetFlag(BRS_COMPUTEMAXWIDTH)) { #ifdef NOISY_MAXIMUM_WIDTH - printf("nsBlockFrame::ReflowLine block %p line %p setting aLine.mMaximumWidth to %d\n", + PRINTF("nsBlockFrame::ReflowLine block %p line %p setting aLine.mMaximumWidth to %d\n", this, aLine, aLine->mMaximumWidth); #endif aState.UpdateMaximumWidth(aLine->mMaximumWidth); @@ -3271,7 +3277,7 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState, if (aState.GetFlag(BRS_COMPUTEMAXELEMENTSIZE)) { #ifdef NOISY_MAX_ELEMENT_SIZE - printf("nsBlockFrame::ReflowLine block %p line %p setting aLine.mMaxElementWidth to %d\n", + PRINTF("nsBlockFrame::ReflowLine block %p line %p setting aLine.mMaxElementWidth to %d\n", this, aLine, aLine->mMaxElementWidth); #endif aState.UpdateMaxElementSize(nsSize(aLine->mMaxElementWidth, aLine->mBounds.height)); @@ -3290,11 +3296,11 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState, nsRect dirtyRect; dirtyRect.UnionRect(oldCombinedArea, combinedArea); #ifdef NOISY_BLOCK_INVALIDATE - printf("%p invalidate because %s is true (%d, %d, %d, %d)\n", + PRINTF("%p invalidate because %s is true (%d, %d, %d, %d)\n", this, aDamageDirtyArea ? "aDamageDirtyArea" : "aLine->IsForceInvalidate", dirtyRect.x, dirtyRect.y, dirtyRect.width, dirtyRect.height); if (aLine->IsForceInvalidate()) - printf(" dirty line is %p\n"); + PRINTF(" dirty line is %p\n"); #endif Invalidate(aState.mPresContext, dirtyRect); } @@ -3525,7 +3531,7 @@ nsBlockFrame::UpdateSpaceManager(nsIPresContext* aPresContext, nscoord tx, ty; aSpaceManager->GetTranslation(tx, ty); nsFrame::ListTag(stdout, this); - printf(": UpdateSpaceManager: AddRectRegion: txy=%d,%d {%d,%d,%d,%d}\n", + PRINTF(": UpdateSpaceManager: AddRectRegion: txy=%d,%d {%d,%d,%d,%d}\n", tx, ty, fc->mRegion.x, fc->mRegion.y, fc->mRegion.width, fc->mRegion.height); @@ -3808,9 +3814,9 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState, } #ifdef NOISY_VERTICAL_MARGINS ListTag(stdout); - printf(": y=%d child ", aState.mY); + PRINTF(": y=%d child ", aState.mY); ListTag(stdout, frame); - printf(" has clear of %d => %s, mPrevBottomMargin=%d\n", + PRINTF(" has clear of %d => %s, mPrevBottomMargin=%d\n", breakType, applyTopMargin ? "applyTopMargin" : "nope", aState.mPrevBottomMargin); @@ -3850,7 +3856,7 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState, // Compute the available space for the block aState.GetAvailableSpace(); #ifdef REALLY_NOISY_REFLOW - printf("setting line %p isImpacted to %s\n", aLine, aState.IsImpactedByFloater()?"true":"false"); + PRINTF("setting line %p isImpacted to %s\n", aLine, aState.IsImpactedByFloater()?"true":"false"); #endif PRBool isImpacted = aState.IsImpactedByFloater() ? PR_TRUE : PR_FALSE; aLine->SetLineIsImpactedByFloater(isImpacted); @@ -3974,9 +3980,9 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState, // therefore zero out the running margin value. #ifdef NOISY_VERTICAL_MARGINS ListTag(stdout); - printf(": reflow incomplete, frame="); + PRINTF(": reflow incomplete, frame="); nsFrame::ListTag(stdout, frame); - printf(" prevBottomMargin=%d, setting to zero\n", + PRINTF(" prevBottomMargin=%d, setting to zero\n", aState.mPrevBottomMargin); #endif aState.mPrevBottomMargin = 0; @@ -3984,18 +3990,18 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState, else { #ifdef NOISY_VERTICAL_MARGINS ListTag(stdout); - printf(": reflow complete for "); + PRINTF(": reflow complete for "); nsFrame::ListTag(stdout, frame); - printf(" prevBottomMargin=%d collapsedBottomMargin=%d\n", + PRINTF(" prevBottomMargin=%d collapsedBottomMargin=%d\n", aState.mPrevBottomMargin, collapsedBottomMargin); #endif aState.mPrevBottomMargin = collapsedBottomMargin; } #ifdef NOISY_VERTICAL_MARGINS ListTag(stdout); - printf(": frame="); + PRINTF(": frame="); nsFrame::ListTag(stdout, frame); - printf(" carriedOutBottomMargin=%d collapsedBottomMargin=%d => %d\n", + PRINTF(" carriedOutBottomMargin=%d collapsedBottomMargin=%d => %d\n", aLine->GetCarriedOutBottomMargin(), collapsedBottomMargin, aState.mPrevBottomMargin); #endif @@ -4020,8 +4026,8 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState, const nsMargin& margin = brc.GetMargin(); aLine->mMaximumWidth += margin.left + margin.right; #ifdef NOISY_MAXIMUM_WIDTH - printf("nsBlockFrame::ReflowBlockFrame parent block %p line %p aLine->mMaximumWidth set to brc.GetMaximumWidth %d, updating aState.mMaximumWidth\n", - this, aLine, aLine->mMaximumWidth); + PRINTF("nsBlockFrame::ReflowBlockFrame parent block %p line %p aLine->mMaximumWidth set to brc.GetMaximumWidth %d, updating aState.mMaximumWidth\n", + this, aLine, aLine->mMaximumWidth); #endif aState.UpdateMaximumWidth(aLine->mMaximumWidth); @@ -4132,7 +4138,7 @@ nsBlockFrame::ReflowInlineFrames(nsBlockReflowState& aState, spins++; if (1000 == spins) { ListTag(stdout); - printf(": yikes! spinning on a line over 1000 times!\n"); + PRINTF(": yikes! spinning on a line over 1000 times!\n"); NS_ABORT(); } #endif @@ -4204,7 +4210,7 @@ nsBlockFrame::DoReflowInlineFrames(nsBlockReflowState& aState, PRBool impactedByFloaters = aState.IsImpactedByFloater() ? PR_TRUE : PR_FALSE; aLine->SetLineIsImpactedByFloater(impactedByFloaters); #ifdef REALLY_NOISY_REFLOW - printf("nsBlockFrame::DoReflowInlineFrames %p impacted = %d\n", + PRINTF("nsBlockFrame::DoReflowInlineFrames %p impacted = %d\n", this, impactedByFloaters); #endif @@ -4346,9 +4352,9 @@ nsBlockFrame::ReflowInlineFrame(nsBlockReflowState& aState, PRBool reflowingFirstLetter = aLineLayout.GetFirstLetterStyleOK(); #ifdef NOISY_FIRST_LETTER ListTag(stdout); - printf(": reflowing "); + PRINTF(": reflowing "); nsFrame::ListTag(stdout, aFrame); - printf(" reflowingFirstLetter=%s\n", reflowingFirstLetter ? "on" : "off"); + PRINTF(" reflowingFirstLetter=%s\n", reflowingFirstLetter ? "on" : "off"); #endif // Remember if we have a percentage aware child on this line @@ -4371,7 +4377,7 @@ nsBlockFrame::ReflowInlineFrame(nsBlockReflowState& aState, } #ifdef REALLY_NOISY_REFLOW_CHILD nsFrame::ListTag(stdout, aFrame); - printf(": status=%x\n", frameReflowStatus); + PRINTF(": status=%x\n", frameReflowStatus); #endif #if defined(REFLOW_STATUS_COVERAGE) @@ -4555,14 +4561,14 @@ nsBlockFrame::SplitLine(nsBlockReflowState& aState, #ifdef DEBUG if (gNoisyReflow) { nsFrame::IndentBy(stdout, gNoiseIndent); - printf("split line: from line=%p pushCount=%d aFrame=", aLine, pushCount); + PRINTF("split line: from line=%p pushCount=%d aFrame=", aLine, pushCount); if (aFrame) { nsFrame::ListTag(stdout, aFrame); } else { - printf("(null)"); + PRINTF("(null)"); } - printf("\n"); + PRINTF("\n"); if (gReallyNoisyReflow) { aLine->List(aState.mPresContext, stdout, gNoiseIndent+1); } @@ -4693,8 +4699,8 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState, lastHeight = aLine->mBounds.y; if (abs(aLine->mBounds.y - lastHeight) > CRAZY_H/10) { nsFrame::ListTag(stdout); - printf(": line=%p y=%d line.bounds.height=%d\n", - aLine, aLine->mBounds.y, aLine->mBounds.height); + PRINTF(": line=%p y=%d line.bounds.height=%d\n", + aLine, aLine->mBounds.y, aLine->mBounds.height); } } else { @@ -4775,10 +4781,10 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState, #ifdef NOISY_MAX_ELEMENT_SIZE IndentBy(stdout, GetDepth()); if (NS_UNCONSTRAINEDSIZE == aState.mReflowState.availableWidth) { - printf("PASS1 "); + PRINTF("PASS1 "); } ListTag(stdout); - printf(": line.floaters=%s band.floaterCount=%d\n", + PRINTF(": line.floaters=%s band.floaterCount=%d\n", //aLine->mFloaters.NotEmpty() ? "yes" : "no", aState.mHaveRightFloaters ? "(have right floaters)" : "", aState.mBand.GetFloaterCount()); @@ -4801,8 +4807,8 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState, // incremental reflow aLine->mMaxElementWidth = maxElementSize.width; #ifdef NOISY_MAX_ELEMENT_SIZE - printf ("nsBlockFrame::PlaceLine: %p setting MES for line %p to %d\n", - this, aLine, maxElementSize.width); + PRINTF ("nsBlockFrame::PlaceLine: %p setting MES for line %p to %d\n", + this, aLine, maxElementSize.width); #endif } @@ -4830,7 +4836,7 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState, aLine->GetCombinedArea(&lineCombinedArea); #ifdef NOISY_COMBINED_AREA ListTag(stdout); - printf(": lineCA=%d,%d,%d,%d floaterCA=%d,%d,%d,%d\n", + PRINTF(": lineCA=%d,%d,%d,%d floaterCA=%d,%d,%d,%d\n", lineCombinedArea.x, lineCombinedArea.y, lineCombinedArea.width, lineCombinedArea.height, aState.mFloaterCombinedArea.x, aState.mFloaterCombinedArea.y, @@ -4851,7 +4857,7 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState, // most edge of all the right floaters. Therefore, to accomplish our goal // all we do is set that X value to the lines XMost value. #ifdef NOISY_COMBINED_AREA - printf(" ==> rightFloaterCA=%d,%d,%d,%d lineXMost=%d\n", + PRINTF(" ==> rightFloaterCA=%d,%d,%d,%d lineXMost=%d\n", aState.mRightFloaterCombinedArea.x, aState.mRightFloaterCombinedArea.y, aState.mRightFloaterCombinedArea.width, @@ -4870,7 +4876,7 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState, } aLine->SetCombinedArea(lineCombinedArea); #ifdef NOISY_COMBINED_AREA - printf(" ==> final lineCA=%d,%d,%d,%d\n", + PRINTF(" ==> final lineCA=%d,%d,%d,%d\n", lineCombinedArea.x, lineCombinedArea.y, lineCombinedArea.width, lineCombinedArea.height); #endif @@ -4903,10 +4909,10 @@ nsBlockFrame::ComputeLineMaxElementSize(nsBlockReflowState& aState, #ifdef NOISY_MAX_ELEMENT_SIZE IndentBy(stdout, GetDepth()); if (NS_UNCONSTRAINEDSIZE == aState.mReflowState.availableWidth) { - printf("PASS1 "); + PRINTF("PASS1 "); } ListTag(stdout); - printf(": maxFloaterSize=%d,%d\n", maxWidth, maxHeight); + PRINTF(": maxFloaterSize=%d,%d\n", maxWidth, maxHeight); #endif // If the floaters are wider than the content, then use the maximum @@ -4933,8 +4939,8 @@ nsBlockFrame::ComputeLineMaxElementSize(nsBlockReflowState& aState, } } #ifdef NOISY_MAX_ELEMENT_SIZE - printf ("nsBlockFrame::ComputeLineMaxElementSize: %p returning MES %d\n", - this, aMaxElementSize->width); + PRINTF ("nsBlockFrame::ComputeLineMaxElementSize: %p returning MES %d\n", + this, aMaxElementSize->width); #endif } @@ -4960,8 +4966,8 @@ nsBlockFrame::PostPlaceLine(nsBlockReflowState& aState, // incremental reflow aLine->mMaxElementWidth = aMaxElementSize.width; #ifdef NOISY_MAX_ELEMENT_SIZE - printf ("nsBlockFrame::PostPlaceLine: %p setting line %p MES %d\n", - this, aLine, aMaxElementSize.width); + PRINTF ("nsBlockFrame::PostPlaceLine: %p setting line %p MES %d\n", + this, aLine, aMaxElementSize.width); #endif } @@ -4970,7 +4976,7 @@ nsBlockFrame::PostPlaceLine(nsBlockReflowState& aState, // calculate the maximum width if (aState.GetFlag(BRS_UNCONSTRAINEDWIDTH)) { #ifdef NOISY_MAXIMUM_WIDTH - printf("nsBlockFrame::PostPlaceLine during UC Reflow of block %p line %p caching max width %d\n", + PRINTF("nsBlockFrame::PostPlaceLine during UC Reflow of block %p line %p caching max width %d\n", this, aLine, aLine->mBounds.XMost()); #endif aLine->mMaximumWidth = aLine->mBounds.XMost(); @@ -4981,7 +4987,7 @@ nsBlockFrame::PostPlaceLine(nsBlockReflowState& aState, #ifdef DEBUG if (CRAZY_WIDTH(xmost)) { ListTag(stdout); - printf(": line=%p xmost=%d\n", aLine, xmost); + PRINTF(": line=%p xmost=%d\n", aLine, xmost); } #endif // If we're shrink wrapping our width and the line was wrapped, @@ -4989,13 +4995,13 @@ nsBlockFrame::PostPlaceLine(nsBlockReflowState& aState, if (aState.GetFlag(BRS_SHRINKWRAPWIDTH) && aLine->IsLineWrapped()) { aState.mKidXMost = aState.BorderPadding().left + aState.mContentArea.width; #ifdef NOISY_KIDXMOST - printf("%p PostPlaceLine A aState.mKidXMost=%d\n", this, aState.mKidXMost); + PRINTF("%p PostPlaceLine A aState.mKidXMost=%d\n", this, aState.mKidXMost); #endif } else if (xmost > aState.mKidXMost) { aState.mKidXMost = xmost; #ifdef NOISY_KIDXMOST - printf("%p PostPlaceLine B aState.mKidXMost=%d\n", this, aState.mKidXMost); + PRINTF("%p PostPlaceLine B aState.mKidXMost=%d\n", this, aState.mKidXMost); #endif } } @@ -5205,13 +5211,13 @@ nsBlockFrame::AppendFrames(nsIPresContext* aPresContext, // Add frames after the last child #ifdef NOISY_REFLOW_REASON ListTag(stdout); - printf(": append "); + PRINTF(": append "); nsFrame::ListTag(stdout, aFrameList); if (lastKid) { - printf(" after "); + PRINTF(" after "); nsFrame::ListTag(stdout, lastKid); } - printf("\n"); + PRINTF("\n"); #endif nsresult rv = AddFrames(aPresContext, aFrameList, lastKid); if (NS_SUCCEEDED(rv)) { @@ -5244,13 +5250,13 @@ nsBlockFrame::InsertFrames(nsIPresContext* aPresContext, #ifdef NOISY_REFLOW_REASON ListTag(stdout); - printf(": insert "); + PRINTF(": insert "); nsFrame::ListTag(stdout, aFrameList); if (aPrevFrame) { - printf(" after "); + PRINTF(" after "); nsFrame::ListTag(stdout, aPrevFrame); } - printf("\n"); + PRINTF("\n"); #endif nsresult rv = AddFrames(aPresContext, aFrameList, aPrevFrame); if (NS_SUCCEEDED(rv)) { @@ -5387,9 +5393,9 @@ nsBlockFrame::RemoveFrame(nsIPresContext* aPresContext, #ifdef NOISY_REFLOW_REASON ListTag(stdout); - printf(": remove "); + PRINTF(": remove "); nsFrame::ListTag(stdout, aOldFrame); - printf("\n"); + PRINTF("\n"); #endif if (nsLayoutAtoms::absoluteList == aListName) { @@ -5516,10 +5522,10 @@ nsBlockFrame::DoRemoveFrame(nsIPresContext* aPresContext, nsSplittableFrame::RemoveFromFlow(aDeletedFrame); } #ifdef NOISY_REMOVE_FRAME - printf("DoRemoveFrame: prevLine=%p line=%p frame=", + PRINTF("DoRemoveFrame: prevLine=%p line=%p frame=", prevLine, line); nsFrame::ListTag(stdout, aDeletedFrame); - printf(" prevSibling=%p nextInFlow=%p\n", prevSibling, nextInFlow); + PRINTF(" prevSibling=%p nextInFlow=%p\n", prevSibling, nextInFlow); #endif aDeletedFrame->Destroy(aPresContext); aDeletedFrame = nextInFlow; @@ -5537,7 +5543,7 @@ nsBlockFrame::DoRemoveFrame(nsIPresContext* aPresContext, nsRect lineCombinedArea; line->GetCombinedArea(&lineCombinedArea); #ifdef NOISY_BLOCK_INVALIDATE - printf("%p invalidate 10 (%d, %d, %d, %d)\n", + PRINTF("%p invalidate 10 (%d, %d, %d, %d)\n", this, lineCombinedArea.x, lineCombinedArea.y, lineCombinedArea.width, lineCombinedArea.height); #endif Invalidate(aPresContext, lineCombinedArea); @@ -5622,11 +5628,11 @@ nsBlockFrame::ReflowFloater(nsBlockReflowState& aState, nsMargin& aComputedOffsetsResult) { #ifdef NOISY_FLOATER - printf("Reflow Floater %p in parent %p, availSpace(%d,%d,%d,%d)\n", + PRINTF("Reflow Floater %p in parent %p, availSpace(%d,%d,%d,%d)\n", aPlaceholder->GetOutOfFlowFrame(), this, aState.mAvailSpaceRect.x, aState.mAvailSpaceRect.y, aState.mAvailSpaceRect.width, aState.mAvailSpaceRect.height - ); + ); #endif // XXX update this just aState.GetAvailableSpace(); @@ -5697,7 +5703,7 @@ nsBlockFrame::ReflowFloater(nsBlockReflowState& aState, aState.StoreMaxElementSize(floater, mes); } #ifdef NOISY_FLOATER - printf("end ReflowFloater %p, sized to %d,%d\n", floater, metrics.width, metrics.height); + PRINTF("end ReflowFloater %p, sized to %d,%d\n", floater, metrics.width, metrics.height); #endif return NS_OK; } @@ -6043,7 +6049,7 @@ nsBlockReflowState::PlaceFloater(nsFloaterCache* aFloaterCache, nscoord tx, ty; mSpaceManager->GetTranslation(tx, ty); nsFrame::ListTag(stdout, mBlock); - printf(": PlaceFloater: AddRectRegion: txy=%d,%d (%d,%d) {%d,%d,%d,%d}\n", + PRINTF(": PlaceFloater: AddRectRegion: txy=%d,%d (%d,%d) {%d,%d,%d,%d}\n", tx, ty, mSpaceManagerX, mSpaceManagerY, aFloaterCache->mRegion.x, aFloaterCache->mRegion.y, aFloaterCache->mRegion.width, aFloaterCache->mRegion.height); @@ -6102,9 +6108,9 @@ nsBlockReflowState::PlaceFloater(nsFloaterCache* aFloaterCache, nsRect r; floater->GetRect(r); nsFrame::IndentBy(stdout, gNoiseIndent); - printf("placed floater: "); + PRINTF("placed floater: "); ((nsFrame*)floater)->ListTag(stdout); - printf(" %d,%d,%d,%d\n", r.x, r.y, r.width, r.height); + PRINTF(" %d,%d,%d,%d\n", r.x, r.y, r.width, r.height); } #endif } @@ -6121,9 +6127,9 @@ nsBlockReflowState::PlaceBelowCurrentLineFloaters(nsFloaterCacheList& aList) #ifdef DEBUG if (gNoisyReflow) { nsFrame::IndentBy(stdout, gNoiseIndent); - printf("placing bcl floater: "); + PRINTF("placing bcl floater: "); nsFrame::ListTag(stdout, fc->mPlaceholder->GetOutOfFlowFrame()); - printf("\n"); + PRINTF("\n"); } #endif mBlock->ReflowFloater(*this, fc->mPlaceholder, fc->mCombinedArea, @@ -6143,13 +6149,13 @@ nsBlockReflowState::ClearFloaters(nscoord aY, PRUint8 aBreakType) #ifdef DEBUG if (gNoisyReflow) { nsFrame::IndentBy(stdout, gNoiseIndent); - printf("clear floaters: in: mY=%d aY=%d(%d)\n", + PRINTF("clear floaters: in: mY=%d aY=%d(%d)\n", mY, aY, aY - BorderPadding().top); } #endif #ifdef NOISY_FLOATER_CLEARING - printf("nsBlockReflowState::ClearFloaters: aY=%d breakType=%dn", + PRINTF("nsBlockReflowState::ClearFloaters: aY=%d breakType=%dn", aY, aBreakType); mSpaceManager->List(stdout); #endif @@ -6161,7 +6167,7 @@ nsBlockReflowState::ClearFloaters(nscoord aY, PRUint8 aBreakType) #ifdef DEBUG if (gNoisyReflow) { nsFrame::IndentBy(stdout, gNoiseIndent); - printf("clear floaters: out: mY=%d(%d)\n", mY, mY - bp.top); + PRINTF("clear floaters: out: mY=%d(%d)\n", mY, mY - bp.top); } #endif } @@ -6237,7 +6243,7 @@ nsBlockFrame::Paint(nsIPresContext* aPresContext, ComputeCombinedArea(mLines, mRect.width, mRect.height, ca); nsFrame::IndentBy(stdout, depth); ListTag(stdout); - printf(": bounds=%d,%d,%d,%d dirty=%d,%d,%d,%d ca=%d,%d,%d,%d\n", + PRINTF(": bounds=%d,%d,%d,%d dirty=%d,%d,%d,%d ca=%d,%d,%d,%d\n", mRect.x, mRect.y, mRect.width, mRect.height, aDirtyRect.x, aDirtyRect.y, aDirtyRect.width, aDirtyRect.height, ca.x, ca.y, ca.width, ca.height); @@ -6390,7 +6396,7 @@ nsBlockFrame::PaintChildren(nsIPresContext* aPresContext, nsRect lineCombinedArea; line->GetCombinedArea(&lineCombinedArea); nsFrame::IndentBy(stdout, depth+1); - printf("draw line=%p bounds=%d,%d,%d,%d ca=%d,%d,%d,%d\n", + PRINTF("draw line=%p bounds=%d,%d,%d,%d ca=%d,%d,%d,%d\n", line, line->mBounds.x, line->mBounds.y, line->mBounds.width, line->mBounds.height, lineCombinedArea.x, lineCombinedArea.y, @@ -6415,7 +6421,7 @@ nsBlockFrame::PaintChildren(nsIPresContext* aPresContext, nsRect lineCombinedArea; line->GetCombinedArea(&lineCombinedArea); nsFrame::IndentBy(stdout, depth+1); - printf("skip line=%p bounds=%d,%d,%d,%d ca=%d,%d,%d,%d\n", + PRINTF("skip line=%p bounds=%d,%d,%d,%d ca=%d,%d,%d,%d\n", line, line->mBounds.x, line->mBounds.y, line->mBounds.width, line->mBounds.height, lineCombinedArea.x, lineCombinedArea.y, @@ -6450,7 +6456,7 @@ nsBlockFrame::PaintChildren(nsIPresContext* aPresContext, ": %lld elapsed (%lld per line) lines=%d drawn=%d skip=%d", delta, deltaPerLine, numLines, drawnLines, numLines - drawnLines); - printf("%s\n", buf); + PRINTF("%s\n", buf); } #endif } @@ -6880,7 +6886,7 @@ nsBlockFrame::SetInitialChildList(nsIPresContext* aPresContext, mState |= NS_BLOCK_HAS_FIRST_LETTER_STYLE; #ifdef NOISY_FIRST_LETTER ListTag(stdout); - printf(": first-letter style found\n"); + PRINTF(": first-letter style found\n"); #endif NS_RELEASE(firstLetterStyle); } diff --git a/mozilla/layout/generic/nsBlockReflowContext.cpp b/mozilla/layout/generic/nsBlockReflowContext.cpp index 5cda9fdd24f..decdaef4ac6 100644 --- a/mozilla/layout/generic/nsBlockReflowContext.cpp +++ b/mozilla/layout/generic/nsBlockReflowContext.cpp @@ -34,6 +34,11 @@ #include "nsIDOMHTMLBodyElement.h" #include "nsLayoutAtoms.h" #include "nsCOMPtr.h" +#include "nslog.h" + +NS_IMPL_LOG(nsBlockReflowContextLog) +#define PRINTF NS_LOG_PRINTF(nsBlockReflowContextLog) +#define FLUSH NS_LOG_FLUSH(nsBlockReflowContextLog) #ifdef NS_DEBUG #undef NOISY_MAX_ELEMENT_SIZE @@ -111,7 +116,7 @@ nsBlockReflowContext::ComputeCollapsedTopMargin(nsIPresContext* aPresContext, #ifdef NOISY_VERTICAL_MARGINS nsFrame::ListTag(stdout, aRS.frame); - printf(": topMargin=%d generationalTopMargin=%d => %d\n", + PRINTF(": topMargin=%d generationalTopMargin=%d => %d\n", topMargin, generationalTopMargin, collapsedTopMargin); #endif @@ -418,9 +423,9 @@ nsBlockReflowContext::DoReflowBlock(nsHTMLReflowState &aReflowState, #ifdef NOISY_VERTICAL_MARGINS nsFrame::ListTag(stdout, mOuterReflowState.frame); - printf(": reflowing "); + PRINTF(": reflowing "); nsFrame::ListTag(stdout, aFrame); - printf(" prevBottomMargin=%d, collapsedTopMargin=%d => %d\n", + PRINTF(" prevBottomMargin=%d, collapsedTopMargin=%d => %d\n", aPrevBottomMargin, topMargin, MaxMargin(topMargin, aPrevBottomMargin)); #endif @@ -547,7 +552,7 @@ nsBlockReflowContext::DoReflowBlock(nsHTMLReflowState &aReflowState, // Update the reflow metrics with the maximum width mMetrics.mMaximumWidth = mMetrics.width; #ifdef NOISY_REFLOW - printf("*** nsBlockReflowContext::ReflowBlock block %p returning max width %d\n", + PRINTF("*** nsBlockReflowContext::ReflowBlock block %p returning max width %d\n", aFrame, mMetrics.mMaximumWidth); #endif // The second reflow is just as a resize reflow with the constrained @@ -564,16 +569,16 @@ nsBlockReflowContext::DoReflowBlock(nsHTMLReflowState &aReflowState, #ifdef DEBUG if (!NS_INLINE_IS_BREAK_BEFORE(aFrameReflowStatus)) { if (CRAZY_WIDTH(mMetrics.width) || CRAZY_HEIGHT(mMetrics.height)) { - printf("nsBlockReflowContext: "); + PRINTF("nsBlockReflowContext: "); nsFrame::ListTag(stdout, aFrame); - printf(" metrics=%d,%d!\n", mMetrics.width, mMetrics.height); + PRINTF(" metrics=%d,%d!\n", mMetrics.width, mMetrics.height); } if ((nsnull != mMetrics.maxElementSize) && ((nscoord(0xdeadbeef) == mMetrics.maxElementSize->width) || (nscoord(0xdeadbeef) == mMetrics.maxElementSize->height))) { - printf("nsBlockReflowContext: "); + PRINTF("nsBlockReflowContext: "); nsFrame::ListTag(stdout, aFrame); - printf(" didn't set max-element-size!\n"); + PRINTF(" didn't set max-element-size!\n"); mMetrics.maxElementSize->width = 0; mMetrics.maxElementSize->height = 0; } @@ -584,9 +589,9 @@ nsBlockReflowContext::DoReflowBlock(nsHTMLReflowState &aReflowState, if ((nsnull != mMetrics.maxElementSize) && ((mMetrics.maxElementSize->width > mMetrics.width) || (mMetrics.maxElementSize->height > mMetrics.height))) { - printf("nsBlockReflowContext: "); + PRINTF("nsBlockReflowContext: "); nsFrame::ListTag(stdout, aFrame); - printf(": WARNING: maxElementSize=%d,%d > metrics=%d,%d\n", + PRINTF(": WARNING: maxElementSize=%d,%d > metrics=%d,%d\n", mMetrics.maxElementSize->width, mMetrics.maxElementSize->height, mMetrics.width, mMetrics.height); @@ -596,9 +601,9 @@ nsBlockReflowContext::DoReflowBlock(nsHTMLReflowState &aReflowState, (mMetrics.height == nscoord(0xdeadbeef)) || (mMetrics.ascent == nscoord(0xdeadbeef)) || (mMetrics.descent == nscoord(0xdeadbeef))) { - printf("nsBlockReflowContext: "); + PRINTF("nsBlockReflowContext: "); nsFrame::ListTag(stdout, aFrame); - printf(" didn't set whad %d,%d,%d,%d!\n", + PRINTF(" didn't set whad %d,%d,%d,%d!\n", mMetrics.width, mMetrics.height, mMetrics.ascent, mMetrics.descent); } @@ -607,9 +612,9 @@ nsBlockReflowContext::DoReflowBlock(nsHTMLReflowState &aReflowState, #ifdef NOISY_MAX_ELEMENT_SIZE if (!NS_INLINE_IS_BREAK_BEFORE(aFrameReflowStatus)) { if (nsnull != mMetrics.maxElementSize) { - printf(" "); + PRINTF(" "); nsFrame::ListTag(stdout, aFrame); - printf(": maxElementSize=%d,%d wh=%d,%d\n", + PRINTF(": maxElementSize=%d,%d wh=%d,%d\n", mMetrics.maxElementSize->width, mMetrics.maxElementSize->height, mMetrics.width, mMetrics.height); @@ -693,11 +698,11 @@ nsBlockReflowContext::PlaceBlock(PRBool aForceFit, nscoord newBottomMargin = MaxMargin(collapsedBottomMargin, mTopMargin); *aBottomMarginResult = newBottomMargin; #ifdef NOISY_VERTICAL_MARGINS - printf(" "); + PRINTF(" "); nsFrame::ListTag(stdout, mOuterReflowState.frame); - printf(": "); + PRINTF(": "); nsFrame::ListTag(stdout, mFrame); - printf(" -- collapsing top & bottom margin together; y=%d spaceY=%d\n", + PRINTF(" -- collapsing top & bottom margin together; y=%d spaceY=%d\n", y, mSpace.y); #endif diff --git a/mozilla/layout/generic/nsBlockReflowState.cpp b/mozilla/layout/generic/nsBlockReflowState.cpp index c9a7aecd5dc..ff838739002 100644 --- a/mozilla/layout/generic/nsBlockReflowState.cpp +++ b/mozilla/layout/generic/nsBlockReflowState.cpp @@ -57,6 +57,12 @@ #include "nsSpaceManager.h" #include "prenv.h" #include "plstr.h" +#include "nslog.h" +#undef fprintf + +NS_IMPL_LOG(nsBlockFrameLog) +#define PRINTF NS_LOG_PRINTF(nsBlockFrameLog) +#define FLUSH NS_LOG_FLUSH(nsBlockFrameLog) #ifdef DEBUG @@ -92,14 +98,14 @@ static BlockDebugFlags gFlags[] = { static void ShowDebugFlags() { - printf("Here are the available GECKO_BLOCK_DEBUG_FLAGS:\n"); + PRINTF("Here are the available GECKO_BLOCK_DEBUG_FLAGS:\n"); BlockDebugFlags* bdf = gFlags; BlockDebugFlags* end = gFlags + NUM_DEBUG_FLAGS; for (; bdf < end; bdf++) { - printf(" %s\n", bdf->name); + PRINTF(" %s\n", bdf->name); } - printf("Note: GECKO_BLOCK_DEBUG_FLAGS is a comma seperated list of flag\n"); - printf("names (no whitespace)\n"); + PRINTF("Note: GECKO_BLOCK_DEBUG_FLAGS is a comma seperated list of flag\n"); + PRINTF("names (no whitespace)\n"); } static void @@ -121,7 +127,7 @@ InitDebugFlags() for (; bdf < end; bdf++) { if (PL_strcasecmp(bdf->name, flags) == 0) { *(bdf->on) = PR_TRUE; - printf("nsBlockFrame: setting %s debug flag on\n", bdf->name); + PRINTF("nsBlockFrame: setting %s debug flag on\n", bdf->name); gNoisy = PR_TRUE; found = PR_TRUE; break; @@ -192,17 +198,17 @@ DumpStyleGeneaology(nsIFrame* aFrame, const char* gap) { fputs(gap, stdout); nsFrame::ListTag(stdout, aFrame); - printf(": "); + PRINTF(": "); nsIStyleContext* sc; aFrame->GetStyleContext(&sc); while (nsnull != sc) { nsIStyleContext* psc; - printf("%p ", sc); + PRINTF("%p ", sc); psc = sc->GetParent(); NS_RELEASE(sc); sc = psc; } - printf("\n"); + PRINTF("\n"); } #endif @@ -240,7 +246,7 @@ RecordReflowStatus(PRBool aChildIsBlock, nsReflowStatus aFrameReflowStatus) // Log updates to the status that yield different values if (record[index] != newS) { record[index] = newS; - printf("record(%d): %02x %02x\n", index, record[0], record[1]); + PRINTF("record(%d): %02x %02x\n", index, record[0], record[1]); } } #endif @@ -311,7 +317,7 @@ public: #ifdef DEBUG if (gNoisyReflow) { nsFrame::IndentBy(stdout, gNoiseIndent); - printf("GetAvailableSpace: band=%d,%d,%d,%d count=%d\n", + PRINTF("GetAvailableSpace: band=%d,%d,%d,%d count=%d\n", mAvailSpaceRect.x, mAvailSpaceRect.y, mAvailSpaceRect.width, mAvailSpaceRect.height, mBand.GetTrapezoidCount()); @@ -332,7 +338,7 @@ public: #ifdef DEBUG if (gNoisyReflow) { nsFrame::IndentBy(stdout, gNoiseIndent); - printf("GetAvailableSpace: band=%d,%d,%d,%d count=%d\n", + PRINTF("GetAvailableSpace: band=%d,%d,%d,%d count=%d\n", mAvailSpaceRect.x, mAvailSpaceRect.y, mAvailSpaceRect.width, mAvailSpaceRect.height, mBand.GetTrapezoidCount()); @@ -387,10 +393,10 @@ public: (mMaxElementSize.height != oldSize.height)) { nsFrame::IndentBy(stdout, mBlock->GetDepth()); if (NS_UNCONSTRAINEDSIZE == mReflowState.availableWidth) { - printf("PASS1 "); + PRINTF("PASS1 "); } nsFrame::ListTag(stdout, mBlock); - printf(": old max-element-size=%d,%d new=%d,%d\n", + PRINTF(": old max-element-size=%d,%d new=%d,%d\n", oldSize.width, oldSize.height, mMaxElementSize.width, mMaxElementSize.height); } @@ -400,7 +406,7 @@ public: void UpdateMaximumWidth(nscoord aMaximumWidth) { if (aMaximumWidth > mMaximumWidth) { #ifdef NOISY_MAXIMUM_WIDTH - printf("nsBlockReflowState::UpdateMaximumWidth block %p caching max width %d\n", mBlock, aMaximumWidth); + PRINTF("nsBlockReflowState::UpdateMaximumWidth block %p caching max width %d\n", mBlock, aMaximumWidth); #endif mMaximumWidth = aMaximumWidth; } @@ -427,7 +433,7 @@ public: PRBool IsImpactedByFloater() { #ifdef REALLY_NOISY_REFLOW - printf("nsBlockReflowState::IsImpactedByFloater %p returned %d\n", + PRINTF("nsBlockReflowState::IsImpactedByFloater %p returned %d\n", this, mBand.GetFloaterCount()); #endif return mBand.GetFloaterCount(); @@ -721,7 +727,7 @@ nsBlockReflowState::nsBlockReflowState(const nsHTMLReflowState& aReflowState, SetFlag(BRS_COMPUTEMAXELEMENTSIZE, (nsnull != aMetrics.maxElementSize)); #ifdef NOISY_MAX_ELEMENT_SIZE - printf("BRS: setting compute-MES to %d\n", (nsnull != aMetrics.maxElementSize)); + PRINTF("BRS: setting compute-MES to %d\n", (nsnull != aMetrics.maxElementSize)); #endif mMaxElementSize.SizeTo(0, 0); SetFlag(BRS_COMPUTEMAXWIDTH, @@ -772,7 +778,7 @@ nsBlockReflowState::ComputeBlockAvailSpace(nsIFrame* aFrame, nsRect& aResult) { #ifdef REALLY_NOISY_REFLOW - printf("CBAS frame=%p has floater count %d\n", aFrame, mBand.GetFloaterCount()); + PRINTF("CBAS frame=%p has floater count %d\n", aFrame, mBand.GetFloaterCount()); mBand.List(); #endif aResult.y = mY; @@ -883,7 +889,7 @@ nsBlockReflowState::ComputeBlockAvailSpace(nsIFrame* aFrame, aResult.width = mAvailSpaceRect.width; } #ifdef REALLY_NOISY_REFLOW - printf(" CBAS: result %d %d %d %d\n", aResult.x, aResult.y, aResult.width, aResult.height); + PRINTF(" CBAS: result %d %d %d %d\n", aResult.x, aResult.y, aResult.width, aResult.height); #endif } @@ -902,7 +908,7 @@ nsBlockReflowState::ClearPastFloaters(PRUint8 aBreakType) ClearFloaters(saveY, aBreakType); #ifdef NOISY_FLOATER_CLEARING nsFrame::ListTag(stdout, mBlock); - printf(": ClearPastFloaters: mPrevBottomMargin=%d saveY=%d oldY=%d newY=%d deltaY=%d\n", + PRINTF(": ClearPastFloaters: mPrevBottomMargin=%d saveY=%d oldY=%d newY=%d deltaY=%d\n", mPrevBottomMargin, saveY, saveY - mPrevBottomMargin, mY, mY - saveY); #endif @@ -1012,17 +1018,17 @@ nsBlockReflowState::RecoverStateFrom(nsLineBox* aLine, #ifdef DEBUG if (CRAZY_WIDTH(xmost)) { nsFrame::ListTag(stdout, mBlock); - printf(": WARNING: xmost:%d\n", xmost); + PRINTF(": WARNING: xmost:%d\n", xmost); } #endif #ifdef NOISY_KIDXMOST - printf("%p RecoverState block %p aState.mKidXMost=%d\n", this, mBlock, xmost); + PRINTF("%p RecoverState block %p aState.mKidXMost=%d\n", this, mBlock, xmost); #endif mKidXMost = xmost; } if (GetFlag(BRS_COMPUTEMAXELEMENTSIZE)) { #ifdef NOISY_MAX_ELEMENT_SIZE - printf("nsBlockReflowState::RecoverStateFrom block %p caching max width %d\n", mBlock, aLine->mMaxElementWidth); + PRINTF("nsBlockReflowState::RecoverStateFrom block %p caching max width %d\n", mBlock, aLine->mMaxElementWidth); #endif UpdateMaxElementSize(nsSize(aLine->mMaxElementWidth, aLine->mBounds.height)); } @@ -1030,7 +1036,7 @@ nsBlockReflowState::RecoverStateFrom(nsLineBox* aLine, // If computing the maximum width, then update mMaximumWidth if (GetFlag(BRS_COMPUTEMAXWIDTH)) { #ifdef NOISY_MAXIMUM_WIDTH - printf("nsBlockReflowState::RecoverStateFrom block %p caching max width %d\n", mBlock, aLine->mMaximumWidth); + PRINTF("nsBlockReflowState::RecoverStateFrom block %p caching max width %d\n", mBlock, aLine->mMaximumWidth); #endif UpdateMaximumWidth(aLine->mMaximumWidth); } @@ -1041,9 +1047,9 @@ nsBlockReflowState::RecoverStateFrom(nsLineBox* aLine, aApplyTopMargin = ClearPastFloaters(aLine->GetBreakType()); #ifdef NOISY_VERTICAL_MARGINS nsFrame::ListTag(stdout, mBlock); - printf(": RecoverStateFrom: y=%d child ", mY); + PRINTF(": RecoverStateFrom: y=%d child ", mY); nsFrame::ListTag(stdout, aLine->mFirstChild); - printf(" has clear of %d => %s, mPrevBottomMargin=%d\n", aLine->mBreakType, + PRINTF(" has clear of %d => %s, mPrevBottomMargin=%d\n", aLine->mBreakType, aApplyTopMargin ? "applyTopMargin" : "nope", mPrevBottomMargin); #endif } @@ -1135,10 +1141,10 @@ nsBlockReflowState::RecoverStateFrom(nsLineBox* aLine, nscoord tx, ty; mSpaceManager->GetTranslation(tx, ty); nsFrame::IndentBy(stdout, gNoiseIndent); - printf("RecoverState: txy=%d,%d (%d,%d) ", + PRINTF("RecoverState: txy=%d,%d (%d,%d) ", tx, ty, mSpaceManagerX, mSpaceManagerY); nsFrame::ListTag(stdout, floater); - printf(" r.y=%d finalDeltaY=%d (sum=%d) region={%d,%d,%d,%d}\n", + PRINTF(" r.y=%d finalDeltaY=%d (sum=%d) region={%d,%d,%d,%d}\n", r.y, finalDeltaY, r.y + finalDeltaY, fc->mRegion.x, fc->mRegion.y, fc->mRegion.width, fc->mRegion.height); @@ -1278,7 +1284,7 @@ nsBlockFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) con IndentBy(out, aIndent); ListTag(out); #ifdef DEBUG_waterson - fprintf(out, " [parent=%p]", mParent); + FPRINTF(out, " [parent=%p]", mParent); #endif nsIView* view; GetView(aPresContext, &view); @@ -1508,7 +1514,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, if (gNoisyReflow) { IndentBy(stdout, gNoiseIndent); ListTag(stdout); - printf(": begin reflow type %d availSize=%d,%d computedSize=%d,%d\n", + PRINTF(": begin reflow type %d availSize=%d,%d computedSize=%d,%d\n", aReflowState.reason, aReflowState.availableWidth, aReflowState.availableHeight, aReflowState.mComputedWidth, aReflowState.mComputedHeight); } @@ -1582,7 +1588,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, extern char* nsPresShell_ReflowStackPointerTop; char marker; char* newsp = (char*) ▮ - printf("XXX: frame tree is too deep; approx stack size = %d\n", + PRINTF("XXX: frame tree is too deep; approx stack size = %d\n", nsPresShell_ReflowStackPointerTop - newsp); } #endif @@ -1605,7 +1611,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, nsHTMLReflowState& reflowState = (nsHTMLReflowState&)aReflowState; reflowState.mSpaceManager = spaceManager.get(); #ifdef NOISY_SPACEMANAGER - printf("constructed new space manager %p\n", reflowState.mSpaceManager); + PRINTF("constructed new space manager %p\n", reflowState.mSpaceManager); #endif } @@ -1624,7 +1630,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, case eReflowReason_Initial: #ifdef NOISY_REFLOW_REASON ListTag(stdout); - printf(": reflow=initial\n"); + PRINTF(": reflow=initial\n"); #endif DrainOverflowLines(aPresContext); rv = PrepareInitialReflow(state); @@ -1641,7 +1647,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, aReflowState.reflowCommand->GetType(type); #ifdef NOISY_REFLOW_REASON ListTag(stdout); - printf(": reflow=incremental type=%d\n", type); + PRINTF(": reflow=incremental type=%d\n", type); #endif switch (type) { case nsIReflowCommand::StyleChanged: @@ -1661,12 +1667,12 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, aReflowState.reflowCommand->GetNext(state.mNextRCFrame); #ifdef NOISY_REFLOW_REASON ListTag(stdout); - printf(": reflow=incremental"); + PRINTF(": reflow=incremental"); if (state.mNextRCFrame) { - printf(" next="); + PRINTF(" next="); nsFrame::ListTag(stdout, state.mNextRCFrame); } - printf("\n"); + PRINTF("\n"); #endif // this code does a correct job of propogating incremental reflows (bug 25510) @@ -1724,7 +1730,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, default: #ifdef NOISY_REFLOW_REASON ListTag(stdout); - printf(": reflow=resize (%d)\n", aReflowState.reason); + PRINTF(": reflow=resize (%d)\n", aReflowState.reason); #endif DrainOverflowLines(aPresContext); rv = PrepareResizeReflow(state); @@ -1749,7 +1755,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, } else { #ifdef DEBUG_kipp - ListTag(stdout); printf(": block is not complete\n"); + ListTag(stdout); PRINTF(": block is not complete\n"); #endif } } @@ -1769,7 +1775,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, if (xMost > aMetrics.width) { #ifdef NOISY_FINAL_SIZE ListTag(stdout); - printf(": changing desired width from %d to %d\n", aMetrics.width, xMost); + PRINTF(": changing desired width from %d to %d\n", aMetrics.width, xMost); #endif aMetrics.width = xMost; } @@ -1777,7 +1783,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, if (yMost > aMetrics.height) { #ifdef NOISY_FINAL_SIZE ListTag(stdout); - printf(": changing desired height from %d to %d\n", aMetrics.height, yMost); + PRINTF(": changing desired height from %d to %d\n", aMetrics.height, yMost); #endif aMetrics.height = yMost; } @@ -1810,7 +1816,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, if (NS_BLOCK_SPACE_MGR & mState) { nsHTMLReflowState& reflowState = (nsHTMLReflowState&)aReflowState; #ifdef NOISY_SPACEMANAGER - printf("restoring old space manager %p\n", oldSpaceManager); + PRINTF("restoring old space manager %p\n", oldSpaceManager); #endif reflowState.mSpaceManager = oldSpaceManager; } @@ -1819,7 +1825,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, nsHTMLReflowState& reflowState = (nsHTMLReflowState&)aReflowState; if (reflowState.mSpaceManager) { ListTag(stdout); - printf(": space-manager %p after reflow\n", reflowState.mSpaceManager); + PRINTF(": space-manager %p after reflow\n", reflowState.mSpaceManager); reflowState.mSpaceManager->List(stdout); } #endif @@ -1832,7 +1838,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, // Lots of things could have changed so damage our entire // bounds #ifdef NOISY_BLOCK_INVALIDATE - printf("%p invalidate 1 (%d, %d, %d, %d)\n", + PRINTF("%p invalidate 1 (%d, %d, %d, %d)\n", this, 0, 0, mRect.width, mRect.height); #endif Invalidate(aPresContext, nsRect(0, 0, mRect.width, mRect.height)); @@ -1862,7 +1868,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, damageRect.height = mRect.height; } #ifdef NOISY_BLOCK_INVALIDATE - printf("%p invalidate 2 (%d, %d, %d, %d)\n", + PRINTF("%p invalidate 2 (%d, %d, %d, %d)\n", this, damageRect.x, damageRect.y, damageRect.width, damageRect.height); #endif Invalidate(aPresContext, damageRect); @@ -1889,7 +1895,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, damageRect.height = border.bottom; } #ifdef NOISY_BLOCK_INVALIDATE - printf("%p invalidate 3 (%d, %d, %d, %d)\n", + PRINTF("%p invalidate 3 (%d, %d, %d, %d)\n", this, damageRect.x, damageRect.y, damageRect.width, damageRect.height); #endif Invalidate(aPresContext, damageRect); @@ -1933,23 +1939,23 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, if (gNoisyReflow) { IndentBy(stdout, gNoiseIndent); ListTag(stdout); - printf(": status=%x (%scomplete) metrics=%d,%d carriedMargin=%d", + PRINTF(": status=%x (%scomplete) metrics=%d,%d carriedMargin=%d", aStatus, NS_FRAME_IS_COMPLETE(aStatus) ? "" : "not ", aMetrics.width, aMetrics.height, aMetrics.mCarriedOutBottomMargin); if (mState & NS_FRAME_OUTSIDE_CHILDREN) { - printf(" combinedArea={%d,%d,%d,%d}", + PRINTF(" combinedArea={%d,%d,%d,%d}", aMetrics.mOverflowArea.x, aMetrics.mOverflowArea.y, aMetrics.mOverflowArea.width, aMetrics.mOverflowArea.height); } if (aMetrics.maxElementSize) { - printf(" maxElementSize=%d,%d", + PRINTF(" maxElementSize=%d,%d", aMetrics.maxElementSize->width, aMetrics.maxElementSize->height); } - printf("\n"); + PRINTF("\n"); } if (gLameReflowMetrics) { @@ -1968,12 +1974,12 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, PR_snprintf(buf, sizeof(buf), ": %lld elapsed (%lld per line) (%d lines; %d new lines)", delta, perLineDelta, numLines, ectc - ctc); - printf("%s\n", buf); + PRINTF("%s\n", buf); } #endif #ifdef NOISY_MAX_ELEMENT_SIZE if (aMetrics.maxElementSize) { - printf("block %p returning with maxElementSize=%d,%d\n", this, + PRINTF("block %p returning with maxElementSize=%d,%d\n", this, aMetrics.maxElementSize->width, aMetrics.maxElementSize->height); } @@ -2057,7 +2063,7 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState, const nsMargin& borderPadding = aState.BorderPadding(); #ifdef NOISY_FINAL_SIZE ListTag(stdout); - printf(": mY=%d mIsBottomMarginRoot=%s mPrevBottomMargin=%d bp=%d,%d\n", + PRINTF(": mY=%d mIsBottomMarginRoot=%s mPrevBottomMargin=%d bp=%d,%d\n", aState.mY, aState.GetFlag(BRS_ISBOTTOMMARGINROOT) ? "yes" : "no", aState.mPrevBottomMargin, borderPadding.top, borderPadding.bottom); @@ -2066,7 +2072,7 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState, // Compute final width nscoord maxWidth = 0, maxHeight = 0; #ifdef NOISY_KIDXMOST - printf("%p aState.mKidXMost=%d\n", this, aState.mKidXMost); + PRINTF("%p aState.mKidXMost=%d\n", this, aState.mKidXMost); #endif nscoord minWidth = aState.mKidXMost + borderPadding.right; if (!HaveAutoWidth(aReflowState)) { @@ -2276,8 +2282,8 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState, aMetrics.maxElementSize->width = maxWidth; aMetrics.maxElementSize->height = maxHeight; #ifdef NOISY_MAX_ELEMENT_SIZE - printf ("nsBlockFrame::CFS: %p returning MES %d\n", - this, aMetrics.maxElementSize->width); + PRINTF ("nsBlockFrame::CFS: %p returning MES %d\n", + this, aMetrics.maxElementSize->width); #endif } @@ -2288,12 +2294,12 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState, #ifdef DEBUG_blocks if (CRAZY_WIDTH(aMetrics.width) || CRAZY_HEIGHT(aMetrics.height)) { ListTag(stdout); - printf(": WARNING: desired:%d,%d\n", aMetrics.width, aMetrics.height); + PRINTF(": WARNING: desired:%d,%d\n", aMetrics.width, aMetrics.height); } if (aState.GetFlag(BRS_COMPUTEMAXELEMENTSIZE) && ((maxWidth > aMetrics.width) || (maxHeight > aMetrics.height))) { ListTag(stdout); - printf(": WARNING: max-element-size:%d,%d desired:%d,%d maxSize:%d,%d\n", + PRINTF(": WARNING: max-element-size:%d,%d desired:%d,%d maxSize:%d,%d\n", maxWidth, maxHeight, aMetrics.width, aMetrics.height, aState.mReflowState.availableWidth, aState.mReflowState.availableHeight); @@ -2303,10 +2309,10 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState, if (aState.GetFlag(BRS_COMPUTEMAXELEMENTSIZE)) { IndentBy(stdout, GetDepth()); if (NS_UNCONSTRAINEDSIZE == aState.mReflowState.availableWidth) { - printf("PASS1 "); + PRINTF("PASS1 "); } ListTag(stdout); - printf(": max-element-size:%d,%d desired:%d,%d maxSize:%d,%d\n", + PRINTF(": max-element-size:%d,%d desired:%d,%d maxSize:%d,%d\n", maxWidth, maxHeight, aMetrics.width, aMetrics.height, aState.mReflowState.availableWidth, aState.mReflowState.availableHeight); @@ -2318,7 +2324,7 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState, // We need to add in for the right border/padding aMetrics.mMaximumWidth = aState.mMaximumWidth + borderPadding.right; #ifdef NOISY_MAXIMUM_WIDTH - printf("nsBlockFrame::ComputeFinalSize block %p setting aMetrics.mMaximumWidth to %d\n", this, aMetrics.mMaximumWidth); + PRINTF("nsBlockFrame::ComputeFinalSize block %p setting aMetrics.mMaximumWidth to %d\n", this, aMetrics.mMaximumWidth); #endif } @@ -2368,7 +2374,7 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState, } #ifdef NOISY_COMBINED_AREA ListTag(stdout); - printf(": ca=%d,%d,%d,%d\n", xa, ya, xb-xa, yb-ya); + PRINTF(": ca=%d,%d,%d,%d\n", xa, ya, xb-xa, yb-ya); #endif // If the combined area of our children exceeds our bounding box @@ -2427,7 +2433,7 @@ nsBlockFrame::MarkLineDirty(nsLineBox* aLine, nsLineBox* aPrevLine) if (gNoisyReflow) { IndentBy(stdout, gNoiseIndent); ListTag(stdout); - printf(": mark line %p dirty\n", aLine); + PRINTF(": mark line %p dirty\n", aLine); } #endif @@ -2440,7 +2446,7 @@ nsBlockFrame::MarkLineDirty(nsLineBox* aLine, nsLineBox* aPrevLine) if (gNoisyReflow) { IndentBy(stdout, gNoiseIndent); ListTag(stdout); - printf(": mark prev-line %p dirty\n", aPrevLine); + PRINTF(": mark prev-line %p dirty\n", aPrevLine); } #endif } @@ -2554,7 +2560,7 @@ nsBlockFrame::PrepareResizeReflow(nsBlockReflowState& aState) mStyleContext->GetStyleData(eStyleStruct_Text); IndentBy(stdout, gNoiseIndent); ListTag(stdout); - printf(": marking all lines dirty: reason=%d availWidth=%d textAlign=%d\n", + PRINTF(": marking all lines dirty: reason=%d availWidth=%d textAlign=%d\n", aState.mReflowState.reason, aState.mReflowState.availableWidth, mStyleText->mTextAlign); @@ -2587,7 +2593,7 @@ nsBlockFrame::PrepareResizeReflow(nsBlockReflowState& aState) if (gNoisyReflow) { IndentBy(stdout, gNoiseIndent); ListTag(stdout); - printf(": trying to avoid marking all lines dirty\n"); + PRINTF(": trying to avoid marking all lines dirty\n"); } #endif @@ -2601,8 +2607,8 @@ nsBlockFrame::PrepareResizeReflow(nsBlockReflowState& aState) else { // We can avoid reflowing *some* inline lines in some cases. #ifdef REALLY_NOISY_REFLOW - printf("PrepareResizeReflow thinks line %p is %simpacted by floaters\n", - line, line->IsImpactedByFloater() ? "" : "not "); + PRINTF("PrepareResizeReflow thinks line %p is %simpacted by floaters\n", + line, line->IsImpactedByFloater() ? "" : "not "); #endif if (notWrapping) { // When no-wrap is set then the only line-breaking that @@ -2628,7 +2634,7 @@ nsBlockFrame::PrepareResizeReflow(nsBlockReflowState& aState) #ifdef DEBUG if (gNoisyReflow && !line->IsDirty() && !notWrapping) { IndentBy(stdout, gNoiseIndent + 1); - printf("skipped: line=%p next=%p %s %s %s%s%s breakType=%d xmost=%d\n", + PRINTF("skipped: line=%p next=%p %s %s %s%s%s breakType=%d xmost=%d\n", line, line->mNext, line->IsBlock() ? "block" : "inline", aState.GetFlag(BRS_NOWRAP) ? "no-wrap" : "wrapping", @@ -2779,8 +2785,8 @@ nsBlockFrame::PropogateReflowDamage(nsBlockReflowState& aState, PRBool wasImpactedByFloater = next->IsImpactedByFloater(); PRBool isImpactedByFloater = aState.IsImpactedByFloater() ? PR_TRUE : PR_FALSE; #ifdef REALLY_NOISY_REFLOW - printf("nsBlockFrame::PropogateReflowDamage %p was = %d, is=%d\n", - this, wasImpactedByFloater, isImpactedByFloater); + PRINTF("nsBlockFrame::PropogateReflowDamage %p was = %d, is=%d\n", + this, wasImpactedByFloater, isImpactedByFloater); #endif if (wasImpactedByFloater != isImpactedByFloater) { next->MarkDirty(); @@ -2865,16 +2871,16 @@ nsBlockFrame::ReflowDirtyLines(nsBlockReflowState& aState) aState.mReflowState.reflowCommand->GetType(type); IndentBy(stdout, gNoiseIndent); ListTag(stdout); - printf(": incrementally reflowing dirty lines: type=%s(%d) isInline=%s", + PRINTF(": incrementally reflowing dirty lines: type=%s(%d) isInline=%s", kReflowCommandType[type], type, aState.GetFlag(BRS_ISINLINEINCRREFLOW) ? "true" : "false"); } else { IndentBy(stdout, gNoiseIndent); ListTag(stdout); - printf(": reflowing dirty lines"); + PRINTF(": reflowing dirty lines"); } - printf(" computedWidth=%d\n", aState.mReflowState.mComputedWidth); + PRINTF(" computedWidth=%d\n", aState.mReflowState.mComputedWidth); gNoiseIndent++; } #endif @@ -2902,7 +2908,7 @@ nsBlockFrame::ReflowDirtyLines(nsBlockReflowState& aState) &damageRect : 0); if (incrementalReflow && !damageRect.IsEmpty()) { #ifdef NOISY_BLOCK_INVALIDATE - printf("%p invalidate 4 (%d, %d, %d, %d)\n", + PRINTF("%p invalidate 4 (%d, %d, %d, %d)\n", this, damageRect.x, damageRect.y, damageRect.width, damageRect.height); #endif Invalidate(aState.mPresContext, damageRect); @@ -2919,7 +2925,7 @@ nsBlockFrame::ReflowDirtyLines(nsBlockReflowState& aState) nsRect lca; line->GetCombinedArea(&lca); IndentBy(stdout, gNoiseIndent); - printf("line=%p mY=%d dirty=%s oldBounds={%d,%d,%d,%d} oldCombinedArea={%d,%d,%d,%d} deltaY=%d mPrevBottomMargin=%d\n", + PRINTF("line=%p mY=%d dirty=%s oldBounds={%d,%d,%d,%d} oldCombinedArea={%d,%d,%d,%d} deltaY=%d mPrevBottomMargin=%d\n", line, aState.mY, line->IsDirty() ? "yes" : "no", line->mBounds.x, line->mBounds.y, line->mBounds.width, line->mBounds.height, @@ -2977,7 +2983,7 @@ nsBlockFrame::ReflowDirtyLines(nsBlockReflowState& aState) &damageRect : 0); if (incrementalReflow && !damageRect.IsEmpty()) { #ifdef NOISY_BLOCK_INVALIDATE - printf("%p invalidate 5 (%d, %d, %d, %d)\n", + PRINTF("%p invalidate 5 (%d, %d, %d, %d)\n", this, damageRect.x, damageRect.y, damageRect.width, damageRect.height); #endif Invalidate(aState.mPresContext, damageRect); @@ -2990,7 +2996,7 @@ nsBlockFrame::ReflowDirtyLines(nsBlockReflowState& aState) nsRect lca; line->GetCombinedArea(&lca); IndentBy(stdout, gNoiseIndent); - printf("line=%p mY=%d newBounds={%d,%d,%d,%d} newCombinedArea={%d,%d,%d,%d} deltaY=%d mPrevBottomMargin=%d\n", + PRINTF("line=%p mY=%d newBounds={%d,%d,%d,%d} newCombinedArea={%d,%d,%d,%d} deltaY=%d mPrevBottomMargin=%d\n", line, aState.mY, line->mBounds.x, line->mBounds.y, line->mBounds.width, line->mBounds.height, @@ -3089,7 +3095,7 @@ nsBlockFrame::ReflowDirtyLines(nsBlockReflowState& aState) gNoiseIndent--; IndentBy(stdout, gNoiseIndent); ListTag(stdout); - printf(": done reflowing dirty lines (status=%x)\n", + PRINTF(": done reflowing dirty lines (status=%x)\n", aState.mReflowStatus); } #endif @@ -3154,7 +3160,7 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState, nsRect dirtyRect; dirtyRect.UnionRect(oldCombinedArea, lineCombinedArea); #ifdef NOISY_BLOCK_INVALIDATE - printf("%p invalidate 6 (%d, %d, %d, %d)\n", + PRINTF("%p invalidate 6 (%d, %d, %d, %d)\n", this, dirtyRect.x, dirtyRect.y, dirtyRect.width, dirtyRect.height); #endif Invalidate(aState.mPresContext, dirtyRect); @@ -3174,7 +3180,7 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState, dirtyRect.height = PR_MAX(oldCombinedArea.height, lineCombinedArea.height); #ifdef NOISY_BLOCK_INVALIDATE - printf("%p invalidate 7 (%d, %d, %d, %d)\n", + PRINTF("%p invalidate 7 (%d, %d, %d, %d)\n", this, dirtyRect.x, dirtyRect.y, dirtyRect.width, dirtyRect.height); #endif Invalidate(aState.mPresContext, dirtyRect); @@ -3193,7 +3199,7 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState, lineCombinedArea.YMost()) - dirtyRect.y; #ifdef NOISY_BLOCK_INVALIDATE - printf("%p invalidate 8 (%d, %d, %d, %d)\n", + PRINTF("%p invalidate 8 (%d, %d, %d, %d)\n", this, dirtyRect.x, dirtyRect.y, dirtyRect.width, dirtyRect.height); #endif Invalidate(aState.mPresContext, dirtyRect); @@ -3233,7 +3239,7 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState, // Update the line's maximum width aLine->mMaximumWidth = aLine->mBounds.XMost(); #ifdef NOISY_MAXIMUM_WIDTH - printf("nsBlockFrame::ReflowLine block %p line %p setting aLine.mMaximumWidth to %d\n", + PRINTF("nsBlockFrame::ReflowLine block %p line %p setting aLine.mMaximumWidth to %d\n", this, aLine, aLine->mMaximumWidth); #endif aState.UpdateMaximumWidth(aLine->mMaximumWidth); @@ -3263,7 +3269,7 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState, if (aState.GetFlag(BRS_COMPUTEMAXWIDTH)) { #ifdef NOISY_MAXIMUM_WIDTH - printf("nsBlockFrame::ReflowLine block %p line %p setting aLine.mMaximumWidth to %d\n", + PRINTF("nsBlockFrame::ReflowLine block %p line %p setting aLine.mMaximumWidth to %d\n", this, aLine, aLine->mMaximumWidth); #endif aState.UpdateMaximumWidth(aLine->mMaximumWidth); @@ -3271,7 +3277,7 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState, if (aState.GetFlag(BRS_COMPUTEMAXELEMENTSIZE)) { #ifdef NOISY_MAX_ELEMENT_SIZE - printf("nsBlockFrame::ReflowLine block %p line %p setting aLine.mMaxElementWidth to %d\n", + PRINTF("nsBlockFrame::ReflowLine block %p line %p setting aLine.mMaxElementWidth to %d\n", this, aLine, aLine->mMaxElementWidth); #endif aState.UpdateMaxElementSize(nsSize(aLine->mMaxElementWidth, aLine->mBounds.height)); @@ -3290,11 +3296,11 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState, nsRect dirtyRect; dirtyRect.UnionRect(oldCombinedArea, combinedArea); #ifdef NOISY_BLOCK_INVALIDATE - printf("%p invalidate because %s is true (%d, %d, %d, %d)\n", + PRINTF("%p invalidate because %s is true (%d, %d, %d, %d)\n", this, aDamageDirtyArea ? "aDamageDirtyArea" : "aLine->IsForceInvalidate", dirtyRect.x, dirtyRect.y, dirtyRect.width, dirtyRect.height); if (aLine->IsForceInvalidate()) - printf(" dirty line is %p\n"); + PRINTF(" dirty line is %p\n"); #endif Invalidate(aState.mPresContext, dirtyRect); } @@ -3525,7 +3531,7 @@ nsBlockFrame::UpdateSpaceManager(nsIPresContext* aPresContext, nscoord tx, ty; aSpaceManager->GetTranslation(tx, ty); nsFrame::ListTag(stdout, this); - printf(": UpdateSpaceManager: AddRectRegion: txy=%d,%d {%d,%d,%d,%d}\n", + PRINTF(": UpdateSpaceManager: AddRectRegion: txy=%d,%d {%d,%d,%d,%d}\n", tx, ty, fc->mRegion.x, fc->mRegion.y, fc->mRegion.width, fc->mRegion.height); @@ -3808,9 +3814,9 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState, } #ifdef NOISY_VERTICAL_MARGINS ListTag(stdout); - printf(": y=%d child ", aState.mY); + PRINTF(": y=%d child ", aState.mY); ListTag(stdout, frame); - printf(" has clear of %d => %s, mPrevBottomMargin=%d\n", + PRINTF(" has clear of %d => %s, mPrevBottomMargin=%d\n", breakType, applyTopMargin ? "applyTopMargin" : "nope", aState.mPrevBottomMargin); @@ -3850,7 +3856,7 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState, // Compute the available space for the block aState.GetAvailableSpace(); #ifdef REALLY_NOISY_REFLOW - printf("setting line %p isImpacted to %s\n", aLine, aState.IsImpactedByFloater()?"true":"false"); + PRINTF("setting line %p isImpacted to %s\n", aLine, aState.IsImpactedByFloater()?"true":"false"); #endif PRBool isImpacted = aState.IsImpactedByFloater() ? PR_TRUE : PR_FALSE; aLine->SetLineIsImpactedByFloater(isImpacted); @@ -3974,9 +3980,9 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState, // therefore zero out the running margin value. #ifdef NOISY_VERTICAL_MARGINS ListTag(stdout); - printf(": reflow incomplete, frame="); + PRINTF(": reflow incomplete, frame="); nsFrame::ListTag(stdout, frame); - printf(" prevBottomMargin=%d, setting to zero\n", + PRINTF(" prevBottomMargin=%d, setting to zero\n", aState.mPrevBottomMargin); #endif aState.mPrevBottomMargin = 0; @@ -3984,18 +3990,18 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState, else { #ifdef NOISY_VERTICAL_MARGINS ListTag(stdout); - printf(": reflow complete for "); + PRINTF(": reflow complete for "); nsFrame::ListTag(stdout, frame); - printf(" prevBottomMargin=%d collapsedBottomMargin=%d\n", + PRINTF(" prevBottomMargin=%d collapsedBottomMargin=%d\n", aState.mPrevBottomMargin, collapsedBottomMargin); #endif aState.mPrevBottomMargin = collapsedBottomMargin; } #ifdef NOISY_VERTICAL_MARGINS ListTag(stdout); - printf(": frame="); + PRINTF(": frame="); nsFrame::ListTag(stdout, frame); - printf(" carriedOutBottomMargin=%d collapsedBottomMargin=%d => %d\n", + PRINTF(" carriedOutBottomMargin=%d collapsedBottomMargin=%d => %d\n", aLine->GetCarriedOutBottomMargin(), collapsedBottomMargin, aState.mPrevBottomMargin); #endif @@ -4020,8 +4026,8 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState, const nsMargin& margin = brc.GetMargin(); aLine->mMaximumWidth += margin.left + margin.right; #ifdef NOISY_MAXIMUM_WIDTH - printf("nsBlockFrame::ReflowBlockFrame parent block %p line %p aLine->mMaximumWidth set to brc.GetMaximumWidth %d, updating aState.mMaximumWidth\n", - this, aLine, aLine->mMaximumWidth); + PRINTF("nsBlockFrame::ReflowBlockFrame parent block %p line %p aLine->mMaximumWidth set to brc.GetMaximumWidth %d, updating aState.mMaximumWidth\n", + this, aLine, aLine->mMaximumWidth); #endif aState.UpdateMaximumWidth(aLine->mMaximumWidth); @@ -4132,7 +4138,7 @@ nsBlockFrame::ReflowInlineFrames(nsBlockReflowState& aState, spins++; if (1000 == spins) { ListTag(stdout); - printf(": yikes! spinning on a line over 1000 times!\n"); + PRINTF(": yikes! spinning on a line over 1000 times!\n"); NS_ABORT(); } #endif @@ -4204,7 +4210,7 @@ nsBlockFrame::DoReflowInlineFrames(nsBlockReflowState& aState, PRBool impactedByFloaters = aState.IsImpactedByFloater() ? PR_TRUE : PR_FALSE; aLine->SetLineIsImpactedByFloater(impactedByFloaters); #ifdef REALLY_NOISY_REFLOW - printf("nsBlockFrame::DoReflowInlineFrames %p impacted = %d\n", + PRINTF("nsBlockFrame::DoReflowInlineFrames %p impacted = %d\n", this, impactedByFloaters); #endif @@ -4346,9 +4352,9 @@ nsBlockFrame::ReflowInlineFrame(nsBlockReflowState& aState, PRBool reflowingFirstLetter = aLineLayout.GetFirstLetterStyleOK(); #ifdef NOISY_FIRST_LETTER ListTag(stdout); - printf(": reflowing "); + PRINTF(": reflowing "); nsFrame::ListTag(stdout, aFrame); - printf(" reflowingFirstLetter=%s\n", reflowingFirstLetter ? "on" : "off"); + PRINTF(" reflowingFirstLetter=%s\n", reflowingFirstLetter ? "on" : "off"); #endif // Remember if we have a percentage aware child on this line @@ -4371,7 +4377,7 @@ nsBlockFrame::ReflowInlineFrame(nsBlockReflowState& aState, } #ifdef REALLY_NOISY_REFLOW_CHILD nsFrame::ListTag(stdout, aFrame); - printf(": status=%x\n", frameReflowStatus); + PRINTF(": status=%x\n", frameReflowStatus); #endif #if defined(REFLOW_STATUS_COVERAGE) @@ -4555,14 +4561,14 @@ nsBlockFrame::SplitLine(nsBlockReflowState& aState, #ifdef DEBUG if (gNoisyReflow) { nsFrame::IndentBy(stdout, gNoiseIndent); - printf("split line: from line=%p pushCount=%d aFrame=", aLine, pushCount); + PRINTF("split line: from line=%p pushCount=%d aFrame=", aLine, pushCount); if (aFrame) { nsFrame::ListTag(stdout, aFrame); } else { - printf("(null)"); + PRINTF("(null)"); } - printf("\n"); + PRINTF("\n"); if (gReallyNoisyReflow) { aLine->List(aState.mPresContext, stdout, gNoiseIndent+1); } @@ -4693,8 +4699,8 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState, lastHeight = aLine->mBounds.y; if (abs(aLine->mBounds.y - lastHeight) > CRAZY_H/10) { nsFrame::ListTag(stdout); - printf(": line=%p y=%d line.bounds.height=%d\n", - aLine, aLine->mBounds.y, aLine->mBounds.height); + PRINTF(": line=%p y=%d line.bounds.height=%d\n", + aLine, aLine->mBounds.y, aLine->mBounds.height); } } else { @@ -4775,10 +4781,10 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState, #ifdef NOISY_MAX_ELEMENT_SIZE IndentBy(stdout, GetDepth()); if (NS_UNCONSTRAINEDSIZE == aState.mReflowState.availableWidth) { - printf("PASS1 "); + PRINTF("PASS1 "); } ListTag(stdout); - printf(": line.floaters=%s band.floaterCount=%d\n", + PRINTF(": line.floaters=%s band.floaterCount=%d\n", //aLine->mFloaters.NotEmpty() ? "yes" : "no", aState.mHaveRightFloaters ? "(have right floaters)" : "", aState.mBand.GetFloaterCount()); @@ -4801,8 +4807,8 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState, // incremental reflow aLine->mMaxElementWidth = maxElementSize.width; #ifdef NOISY_MAX_ELEMENT_SIZE - printf ("nsBlockFrame::PlaceLine: %p setting MES for line %p to %d\n", - this, aLine, maxElementSize.width); + PRINTF ("nsBlockFrame::PlaceLine: %p setting MES for line %p to %d\n", + this, aLine, maxElementSize.width); #endif } @@ -4830,7 +4836,7 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState, aLine->GetCombinedArea(&lineCombinedArea); #ifdef NOISY_COMBINED_AREA ListTag(stdout); - printf(": lineCA=%d,%d,%d,%d floaterCA=%d,%d,%d,%d\n", + PRINTF(": lineCA=%d,%d,%d,%d floaterCA=%d,%d,%d,%d\n", lineCombinedArea.x, lineCombinedArea.y, lineCombinedArea.width, lineCombinedArea.height, aState.mFloaterCombinedArea.x, aState.mFloaterCombinedArea.y, @@ -4851,7 +4857,7 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState, // most edge of all the right floaters. Therefore, to accomplish our goal // all we do is set that X value to the lines XMost value. #ifdef NOISY_COMBINED_AREA - printf(" ==> rightFloaterCA=%d,%d,%d,%d lineXMost=%d\n", + PRINTF(" ==> rightFloaterCA=%d,%d,%d,%d lineXMost=%d\n", aState.mRightFloaterCombinedArea.x, aState.mRightFloaterCombinedArea.y, aState.mRightFloaterCombinedArea.width, @@ -4870,7 +4876,7 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState, } aLine->SetCombinedArea(lineCombinedArea); #ifdef NOISY_COMBINED_AREA - printf(" ==> final lineCA=%d,%d,%d,%d\n", + PRINTF(" ==> final lineCA=%d,%d,%d,%d\n", lineCombinedArea.x, lineCombinedArea.y, lineCombinedArea.width, lineCombinedArea.height); #endif @@ -4903,10 +4909,10 @@ nsBlockFrame::ComputeLineMaxElementSize(nsBlockReflowState& aState, #ifdef NOISY_MAX_ELEMENT_SIZE IndentBy(stdout, GetDepth()); if (NS_UNCONSTRAINEDSIZE == aState.mReflowState.availableWidth) { - printf("PASS1 "); + PRINTF("PASS1 "); } ListTag(stdout); - printf(": maxFloaterSize=%d,%d\n", maxWidth, maxHeight); + PRINTF(": maxFloaterSize=%d,%d\n", maxWidth, maxHeight); #endif // If the floaters are wider than the content, then use the maximum @@ -4933,8 +4939,8 @@ nsBlockFrame::ComputeLineMaxElementSize(nsBlockReflowState& aState, } } #ifdef NOISY_MAX_ELEMENT_SIZE - printf ("nsBlockFrame::ComputeLineMaxElementSize: %p returning MES %d\n", - this, aMaxElementSize->width); + PRINTF ("nsBlockFrame::ComputeLineMaxElementSize: %p returning MES %d\n", + this, aMaxElementSize->width); #endif } @@ -4960,8 +4966,8 @@ nsBlockFrame::PostPlaceLine(nsBlockReflowState& aState, // incremental reflow aLine->mMaxElementWidth = aMaxElementSize.width; #ifdef NOISY_MAX_ELEMENT_SIZE - printf ("nsBlockFrame::PostPlaceLine: %p setting line %p MES %d\n", - this, aLine, aMaxElementSize.width); + PRINTF ("nsBlockFrame::PostPlaceLine: %p setting line %p MES %d\n", + this, aLine, aMaxElementSize.width); #endif } @@ -4970,7 +4976,7 @@ nsBlockFrame::PostPlaceLine(nsBlockReflowState& aState, // calculate the maximum width if (aState.GetFlag(BRS_UNCONSTRAINEDWIDTH)) { #ifdef NOISY_MAXIMUM_WIDTH - printf("nsBlockFrame::PostPlaceLine during UC Reflow of block %p line %p caching max width %d\n", + PRINTF("nsBlockFrame::PostPlaceLine during UC Reflow of block %p line %p caching max width %d\n", this, aLine, aLine->mBounds.XMost()); #endif aLine->mMaximumWidth = aLine->mBounds.XMost(); @@ -4981,7 +4987,7 @@ nsBlockFrame::PostPlaceLine(nsBlockReflowState& aState, #ifdef DEBUG if (CRAZY_WIDTH(xmost)) { ListTag(stdout); - printf(": line=%p xmost=%d\n", aLine, xmost); + PRINTF(": line=%p xmost=%d\n", aLine, xmost); } #endif // If we're shrink wrapping our width and the line was wrapped, @@ -4989,13 +4995,13 @@ nsBlockFrame::PostPlaceLine(nsBlockReflowState& aState, if (aState.GetFlag(BRS_SHRINKWRAPWIDTH) && aLine->IsLineWrapped()) { aState.mKidXMost = aState.BorderPadding().left + aState.mContentArea.width; #ifdef NOISY_KIDXMOST - printf("%p PostPlaceLine A aState.mKidXMost=%d\n", this, aState.mKidXMost); + PRINTF("%p PostPlaceLine A aState.mKidXMost=%d\n", this, aState.mKidXMost); #endif } else if (xmost > aState.mKidXMost) { aState.mKidXMost = xmost; #ifdef NOISY_KIDXMOST - printf("%p PostPlaceLine B aState.mKidXMost=%d\n", this, aState.mKidXMost); + PRINTF("%p PostPlaceLine B aState.mKidXMost=%d\n", this, aState.mKidXMost); #endif } } @@ -5205,13 +5211,13 @@ nsBlockFrame::AppendFrames(nsIPresContext* aPresContext, // Add frames after the last child #ifdef NOISY_REFLOW_REASON ListTag(stdout); - printf(": append "); + PRINTF(": append "); nsFrame::ListTag(stdout, aFrameList); if (lastKid) { - printf(" after "); + PRINTF(" after "); nsFrame::ListTag(stdout, lastKid); } - printf("\n"); + PRINTF("\n"); #endif nsresult rv = AddFrames(aPresContext, aFrameList, lastKid); if (NS_SUCCEEDED(rv)) { @@ -5244,13 +5250,13 @@ nsBlockFrame::InsertFrames(nsIPresContext* aPresContext, #ifdef NOISY_REFLOW_REASON ListTag(stdout); - printf(": insert "); + PRINTF(": insert "); nsFrame::ListTag(stdout, aFrameList); if (aPrevFrame) { - printf(" after "); + PRINTF(" after "); nsFrame::ListTag(stdout, aPrevFrame); } - printf("\n"); + PRINTF("\n"); #endif nsresult rv = AddFrames(aPresContext, aFrameList, aPrevFrame); if (NS_SUCCEEDED(rv)) { @@ -5387,9 +5393,9 @@ nsBlockFrame::RemoveFrame(nsIPresContext* aPresContext, #ifdef NOISY_REFLOW_REASON ListTag(stdout); - printf(": remove "); + PRINTF(": remove "); nsFrame::ListTag(stdout, aOldFrame); - printf("\n"); + PRINTF("\n"); #endif if (nsLayoutAtoms::absoluteList == aListName) { @@ -5516,10 +5522,10 @@ nsBlockFrame::DoRemoveFrame(nsIPresContext* aPresContext, nsSplittableFrame::RemoveFromFlow(aDeletedFrame); } #ifdef NOISY_REMOVE_FRAME - printf("DoRemoveFrame: prevLine=%p line=%p frame=", + PRINTF("DoRemoveFrame: prevLine=%p line=%p frame=", prevLine, line); nsFrame::ListTag(stdout, aDeletedFrame); - printf(" prevSibling=%p nextInFlow=%p\n", prevSibling, nextInFlow); + PRINTF(" prevSibling=%p nextInFlow=%p\n", prevSibling, nextInFlow); #endif aDeletedFrame->Destroy(aPresContext); aDeletedFrame = nextInFlow; @@ -5537,7 +5543,7 @@ nsBlockFrame::DoRemoveFrame(nsIPresContext* aPresContext, nsRect lineCombinedArea; line->GetCombinedArea(&lineCombinedArea); #ifdef NOISY_BLOCK_INVALIDATE - printf("%p invalidate 10 (%d, %d, %d, %d)\n", + PRINTF("%p invalidate 10 (%d, %d, %d, %d)\n", this, lineCombinedArea.x, lineCombinedArea.y, lineCombinedArea.width, lineCombinedArea.height); #endif Invalidate(aPresContext, lineCombinedArea); @@ -5622,11 +5628,11 @@ nsBlockFrame::ReflowFloater(nsBlockReflowState& aState, nsMargin& aComputedOffsetsResult) { #ifdef NOISY_FLOATER - printf("Reflow Floater %p in parent %p, availSpace(%d,%d,%d,%d)\n", + PRINTF("Reflow Floater %p in parent %p, availSpace(%d,%d,%d,%d)\n", aPlaceholder->GetOutOfFlowFrame(), this, aState.mAvailSpaceRect.x, aState.mAvailSpaceRect.y, aState.mAvailSpaceRect.width, aState.mAvailSpaceRect.height - ); + ); #endif // XXX update this just aState.GetAvailableSpace(); @@ -5697,7 +5703,7 @@ nsBlockFrame::ReflowFloater(nsBlockReflowState& aState, aState.StoreMaxElementSize(floater, mes); } #ifdef NOISY_FLOATER - printf("end ReflowFloater %p, sized to %d,%d\n", floater, metrics.width, metrics.height); + PRINTF("end ReflowFloater %p, sized to %d,%d\n", floater, metrics.width, metrics.height); #endif return NS_OK; } @@ -6043,7 +6049,7 @@ nsBlockReflowState::PlaceFloater(nsFloaterCache* aFloaterCache, nscoord tx, ty; mSpaceManager->GetTranslation(tx, ty); nsFrame::ListTag(stdout, mBlock); - printf(": PlaceFloater: AddRectRegion: txy=%d,%d (%d,%d) {%d,%d,%d,%d}\n", + PRINTF(": PlaceFloater: AddRectRegion: txy=%d,%d (%d,%d) {%d,%d,%d,%d}\n", tx, ty, mSpaceManagerX, mSpaceManagerY, aFloaterCache->mRegion.x, aFloaterCache->mRegion.y, aFloaterCache->mRegion.width, aFloaterCache->mRegion.height); @@ -6102,9 +6108,9 @@ nsBlockReflowState::PlaceFloater(nsFloaterCache* aFloaterCache, nsRect r; floater->GetRect(r); nsFrame::IndentBy(stdout, gNoiseIndent); - printf("placed floater: "); + PRINTF("placed floater: "); ((nsFrame*)floater)->ListTag(stdout); - printf(" %d,%d,%d,%d\n", r.x, r.y, r.width, r.height); + PRINTF(" %d,%d,%d,%d\n", r.x, r.y, r.width, r.height); } #endif } @@ -6121,9 +6127,9 @@ nsBlockReflowState::PlaceBelowCurrentLineFloaters(nsFloaterCacheList& aList) #ifdef DEBUG if (gNoisyReflow) { nsFrame::IndentBy(stdout, gNoiseIndent); - printf("placing bcl floater: "); + PRINTF("placing bcl floater: "); nsFrame::ListTag(stdout, fc->mPlaceholder->GetOutOfFlowFrame()); - printf("\n"); + PRINTF("\n"); } #endif mBlock->ReflowFloater(*this, fc->mPlaceholder, fc->mCombinedArea, @@ -6143,13 +6149,13 @@ nsBlockReflowState::ClearFloaters(nscoord aY, PRUint8 aBreakType) #ifdef DEBUG if (gNoisyReflow) { nsFrame::IndentBy(stdout, gNoiseIndent); - printf("clear floaters: in: mY=%d aY=%d(%d)\n", + PRINTF("clear floaters: in: mY=%d aY=%d(%d)\n", mY, aY, aY - BorderPadding().top); } #endif #ifdef NOISY_FLOATER_CLEARING - printf("nsBlockReflowState::ClearFloaters: aY=%d breakType=%dn", + PRINTF("nsBlockReflowState::ClearFloaters: aY=%d breakType=%dn", aY, aBreakType); mSpaceManager->List(stdout); #endif @@ -6161,7 +6167,7 @@ nsBlockReflowState::ClearFloaters(nscoord aY, PRUint8 aBreakType) #ifdef DEBUG if (gNoisyReflow) { nsFrame::IndentBy(stdout, gNoiseIndent); - printf("clear floaters: out: mY=%d(%d)\n", mY, mY - bp.top); + PRINTF("clear floaters: out: mY=%d(%d)\n", mY, mY - bp.top); } #endif } @@ -6237,7 +6243,7 @@ nsBlockFrame::Paint(nsIPresContext* aPresContext, ComputeCombinedArea(mLines, mRect.width, mRect.height, ca); nsFrame::IndentBy(stdout, depth); ListTag(stdout); - printf(": bounds=%d,%d,%d,%d dirty=%d,%d,%d,%d ca=%d,%d,%d,%d\n", + PRINTF(": bounds=%d,%d,%d,%d dirty=%d,%d,%d,%d ca=%d,%d,%d,%d\n", mRect.x, mRect.y, mRect.width, mRect.height, aDirtyRect.x, aDirtyRect.y, aDirtyRect.width, aDirtyRect.height, ca.x, ca.y, ca.width, ca.height); @@ -6390,7 +6396,7 @@ nsBlockFrame::PaintChildren(nsIPresContext* aPresContext, nsRect lineCombinedArea; line->GetCombinedArea(&lineCombinedArea); nsFrame::IndentBy(stdout, depth+1); - printf("draw line=%p bounds=%d,%d,%d,%d ca=%d,%d,%d,%d\n", + PRINTF("draw line=%p bounds=%d,%d,%d,%d ca=%d,%d,%d,%d\n", line, line->mBounds.x, line->mBounds.y, line->mBounds.width, line->mBounds.height, lineCombinedArea.x, lineCombinedArea.y, @@ -6415,7 +6421,7 @@ nsBlockFrame::PaintChildren(nsIPresContext* aPresContext, nsRect lineCombinedArea; line->GetCombinedArea(&lineCombinedArea); nsFrame::IndentBy(stdout, depth+1); - printf("skip line=%p bounds=%d,%d,%d,%d ca=%d,%d,%d,%d\n", + PRINTF("skip line=%p bounds=%d,%d,%d,%d ca=%d,%d,%d,%d\n", line, line->mBounds.x, line->mBounds.y, line->mBounds.width, line->mBounds.height, lineCombinedArea.x, lineCombinedArea.y, @@ -6450,7 +6456,7 @@ nsBlockFrame::PaintChildren(nsIPresContext* aPresContext, ": %lld elapsed (%lld per line) lines=%d drawn=%d skip=%d", delta, deltaPerLine, numLines, drawnLines, numLines - drawnLines); - printf("%s\n", buf); + PRINTF("%s\n", buf); } #endif } @@ -6880,7 +6886,7 @@ nsBlockFrame::SetInitialChildList(nsIPresContext* aPresContext, mState |= NS_BLOCK_HAS_FIRST_LETTER_STYLE; #ifdef NOISY_FIRST_LETTER ListTag(stdout); - printf(": first-letter style found\n"); + PRINTF(": first-letter style found\n"); #endif NS_RELEASE(firstLetterStyle); } diff --git a/mozilla/layout/generic/nsBlockReflowState.h b/mozilla/layout/generic/nsBlockReflowState.h index c9a7aecd5dc..ff838739002 100644 --- a/mozilla/layout/generic/nsBlockReflowState.h +++ b/mozilla/layout/generic/nsBlockReflowState.h @@ -57,6 +57,12 @@ #include "nsSpaceManager.h" #include "prenv.h" #include "plstr.h" +#include "nslog.h" +#undef fprintf + +NS_IMPL_LOG(nsBlockFrameLog) +#define PRINTF NS_LOG_PRINTF(nsBlockFrameLog) +#define FLUSH NS_LOG_FLUSH(nsBlockFrameLog) #ifdef DEBUG @@ -92,14 +98,14 @@ static BlockDebugFlags gFlags[] = { static void ShowDebugFlags() { - printf("Here are the available GECKO_BLOCK_DEBUG_FLAGS:\n"); + PRINTF("Here are the available GECKO_BLOCK_DEBUG_FLAGS:\n"); BlockDebugFlags* bdf = gFlags; BlockDebugFlags* end = gFlags + NUM_DEBUG_FLAGS; for (; bdf < end; bdf++) { - printf(" %s\n", bdf->name); + PRINTF(" %s\n", bdf->name); } - printf("Note: GECKO_BLOCK_DEBUG_FLAGS is a comma seperated list of flag\n"); - printf("names (no whitespace)\n"); + PRINTF("Note: GECKO_BLOCK_DEBUG_FLAGS is a comma seperated list of flag\n"); + PRINTF("names (no whitespace)\n"); } static void @@ -121,7 +127,7 @@ InitDebugFlags() for (; bdf < end; bdf++) { if (PL_strcasecmp(bdf->name, flags) == 0) { *(bdf->on) = PR_TRUE; - printf("nsBlockFrame: setting %s debug flag on\n", bdf->name); + PRINTF("nsBlockFrame: setting %s debug flag on\n", bdf->name); gNoisy = PR_TRUE; found = PR_TRUE; break; @@ -192,17 +198,17 @@ DumpStyleGeneaology(nsIFrame* aFrame, const char* gap) { fputs(gap, stdout); nsFrame::ListTag(stdout, aFrame); - printf(": "); + PRINTF(": "); nsIStyleContext* sc; aFrame->GetStyleContext(&sc); while (nsnull != sc) { nsIStyleContext* psc; - printf("%p ", sc); + PRINTF("%p ", sc); psc = sc->GetParent(); NS_RELEASE(sc); sc = psc; } - printf("\n"); + PRINTF("\n"); } #endif @@ -240,7 +246,7 @@ RecordReflowStatus(PRBool aChildIsBlock, nsReflowStatus aFrameReflowStatus) // Log updates to the status that yield different values if (record[index] != newS) { record[index] = newS; - printf("record(%d): %02x %02x\n", index, record[0], record[1]); + PRINTF("record(%d): %02x %02x\n", index, record[0], record[1]); } } #endif @@ -311,7 +317,7 @@ public: #ifdef DEBUG if (gNoisyReflow) { nsFrame::IndentBy(stdout, gNoiseIndent); - printf("GetAvailableSpace: band=%d,%d,%d,%d count=%d\n", + PRINTF("GetAvailableSpace: band=%d,%d,%d,%d count=%d\n", mAvailSpaceRect.x, mAvailSpaceRect.y, mAvailSpaceRect.width, mAvailSpaceRect.height, mBand.GetTrapezoidCount()); @@ -332,7 +338,7 @@ public: #ifdef DEBUG if (gNoisyReflow) { nsFrame::IndentBy(stdout, gNoiseIndent); - printf("GetAvailableSpace: band=%d,%d,%d,%d count=%d\n", + PRINTF("GetAvailableSpace: band=%d,%d,%d,%d count=%d\n", mAvailSpaceRect.x, mAvailSpaceRect.y, mAvailSpaceRect.width, mAvailSpaceRect.height, mBand.GetTrapezoidCount()); @@ -387,10 +393,10 @@ public: (mMaxElementSize.height != oldSize.height)) { nsFrame::IndentBy(stdout, mBlock->GetDepth()); if (NS_UNCONSTRAINEDSIZE == mReflowState.availableWidth) { - printf("PASS1 "); + PRINTF("PASS1 "); } nsFrame::ListTag(stdout, mBlock); - printf(": old max-element-size=%d,%d new=%d,%d\n", + PRINTF(": old max-element-size=%d,%d new=%d,%d\n", oldSize.width, oldSize.height, mMaxElementSize.width, mMaxElementSize.height); } @@ -400,7 +406,7 @@ public: void UpdateMaximumWidth(nscoord aMaximumWidth) { if (aMaximumWidth > mMaximumWidth) { #ifdef NOISY_MAXIMUM_WIDTH - printf("nsBlockReflowState::UpdateMaximumWidth block %p caching max width %d\n", mBlock, aMaximumWidth); + PRINTF("nsBlockReflowState::UpdateMaximumWidth block %p caching max width %d\n", mBlock, aMaximumWidth); #endif mMaximumWidth = aMaximumWidth; } @@ -427,7 +433,7 @@ public: PRBool IsImpactedByFloater() { #ifdef REALLY_NOISY_REFLOW - printf("nsBlockReflowState::IsImpactedByFloater %p returned %d\n", + PRINTF("nsBlockReflowState::IsImpactedByFloater %p returned %d\n", this, mBand.GetFloaterCount()); #endif return mBand.GetFloaterCount(); @@ -721,7 +727,7 @@ nsBlockReflowState::nsBlockReflowState(const nsHTMLReflowState& aReflowState, SetFlag(BRS_COMPUTEMAXELEMENTSIZE, (nsnull != aMetrics.maxElementSize)); #ifdef NOISY_MAX_ELEMENT_SIZE - printf("BRS: setting compute-MES to %d\n", (nsnull != aMetrics.maxElementSize)); + PRINTF("BRS: setting compute-MES to %d\n", (nsnull != aMetrics.maxElementSize)); #endif mMaxElementSize.SizeTo(0, 0); SetFlag(BRS_COMPUTEMAXWIDTH, @@ -772,7 +778,7 @@ nsBlockReflowState::ComputeBlockAvailSpace(nsIFrame* aFrame, nsRect& aResult) { #ifdef REALLY_NOISY_REFLOW - printf("CBAS frame=%p has floater count %d\n", aFrame, mBand.GetFloaterCount()); + PRINTF("CBAS frame=%p has floater count %d\n", aFrame, mBand.GetFloaterCount()); mBand.List(); #endif aResult.y = mY; @@ -883,7 +889,7 @@ nsBlockReflowState::ComputeBlockAvailSpace(nsIFrame* aFrame, aResult.width = mAvailSpaceRect.width; } #ifdef REALLY_NOISY_REFLOW - printf(" CBAS: result %d %d %d %d\n", aResult.x, aResult.y, aResult.width, aResult.height); + PRINTF(" CBAS: result %d %d %d %d\n", aResult.x, aResult.y, aResult.width, aResult.height); #endif } @@ -902,7 +908,7 @@ nsBlockReflowState::ClearPastFloaters(PRUint8 aBreakType) ClearFloaters(saveY, aBreakType); #ifdef NOISY_FLOATER_CLEARING nsFrame::ListTag(stdout, mBlock); - printf(": ClearPastFloaters: mPrevBottomMargin=%d saveY=%d oldY=%d newY=%d deltaY=%d\n", + PRINTF(": ClearPastFloaters: mPrevBottomMargin=%d saveY=%d oldY=%d newY=%d deltaY=%d\n", mPrevBottomMargin, saveY, saveY - mPrevBottomMargin, mY, mY - saveY); #endif @@ -1012,17 +1018,17 @@ nsBlockReflowState::RecoverStateFrom(nsLineBox* aLine, #ifdef DEBUG if (CRAZY_WIDTH(xmost)) { nsFrame::ListTag(stdout, mBlock); - printf(": WARNING: xmost:%d\n", xmost); + PRINTF(": WARNING: xmost:%d\n", xmost); } #endif #ifdef NOISY_KIDXMOST - printf("%p RecoverState block %p aState.mKidXMost=%d\n", this, mBlock, xmost); + PRINTF("%p RecoverState block %p aState.mKidXMost=%d\n", this, mBlock, xmost); #endif mKidXMost = xmost; } if (GetFlag(BRS_COMPUTEMAXELEMENTSIZE)) { #ifdef NOISY_MAX_ELEMENT_SIZE - printf("nsBlockReflowState::RecoverStateFrom block %p caching max width %d\n", mBlock, aLine->mMaxElementWidth); + PRINTF("nsBlockReflowState::RecoverStateFrom block %p caching max width %d\n", mBlock, aLine->mMaxElementWidth); #endif UpdateMaxElementSize(nsSize(aLine->mMaxElementWidth, aLine->mBounds.height)); } @@ -1030,7 +1036,7 @@ nsBlockReflowState::RecoverStateFrom(nsLineBox* aLine, // If computing the maximum width, then update mMaximumWidth if (GetFlag(BRS_COMPUTEMAXWIDTH)) { #ifdef NOISY_MAXIMUM_WIDTH - printf("nsBlockReflowState::RecoverStateFrom block %p caching max width %d\n", mBlock, aLine->mMaximumWidth); + PRINTF("nsBlockReflowState::RecoverStateFrom block %p caching max width %d\n", mBlock, aLine->mMaximumWidth); #endif UpdateMaximumWidth(aLine->mMaximumWidth); } @@ -1041,9 +1047,9 @@ nsBlockReflowState::RecoverStateFrom(nsLineBox* aLine, aApplyTopMargin = ClearPastFloaters(aLine->GetBreakType()); #ifdef NOISY_VERTICAL_MARGINS nsFrame::ListTag(stdout, mBlock); - printf(": RecoverStateFrom: y=%d child ", mY); + PRINTF(": RecoverStateFrom: y=%d child ", mY); nsFrame::ListTag(stdout, aLine->mFirstChild); - printf(" has clear of %d => %s, mPrevBottomMargin=%d\n", aLine->mBreakType, + PRINTF(" has clear of %d => %s, mPrevBottomMargin=%d\n", aLine->mBreakType, aApplyTopMargin ? "applyTopMargin" : "nope", mPrevBottomMargin); #endif } @@ -1135,10 +1141,10 @@ nsBlockReflowState::RecoverStateFrom(nsLineBox* aLine, nscoord tx, ty; mSpaceManager->GetTranslation(tx, ty); nsFrame::IndentBy(stdout, gNoiseIndent); - printf("RecoverState: txy=%d,%d (%d,%d) ", + PRINTF("RecoverState: txy=%d,%d (%d,%d) ", tx, ty, mSpaceManagerX, mSpaceManagerY); nsFrame::ListTag(stdout, floater); - printf(" r.y=%d finalDeltaY=%d (sum=%d) region={%d,%d,%d,%d}\n", + PRINTF(" r.y=%d finalDeltaY=%d (sum=%d) region={%d,%d,%d,%d}\n", r.y, finalDeltaY, r.y + finalDeltaY, fc->mRegion.x, fc->mRegion.y, fc->mRegion.width, fc->mRegion.height); @@ -1278,7 +1284,7 @@ nsBlockFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) con IndentBy(out, aIndent); ListTag(out); #ifdef DEBUG_waterson - fprintf(out, " [parent=%p]", mParent); + FPRINTF(out, " [parent=%p]", mParent); #endif nsIView* view; GetView(aPresContext, &view); @@ -1508,7 +1514,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, if (gNoisyReflow) { IndentBy(stdout, gNoiseIndent); ListTag(stdout); - printf(": begin reflow type %d availSize=%d,%d computedSize=%d,%d\n", + PRINTF(": begin reflow type %d availSize=%d,%d computedSize=%d,%d\n", aReflowState.reason, aReflowState.availableWidth, aReflowState.availableHeight, aReflowState.mComputedWidth, aReflowState.mComputedHeight); } @@ -1582,7 +1588,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, extern char* nsPresShell_ReflowStackPointerTop; char marker; char* newsp = (char*) ▮ - printf("XXX: frame tree is too deep; approx stack size = %d\n", + PRINTF("XXX: frame tree is too deep; approx stack size = %d\n", nsPresShell_ReflowStackPointerTop - newsp); } #endif @@ -1605,7 +1611,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, nsHTMLReflowState& reflowState = (nsHTMLReflowState&)aReflowState; reflowState.mSpaceManager = spaceManager.get(); #ifdef NOISY_SPACEMANAGER - printf("constructed new space manager %p\n", reflowState.mSpaceManager); + PRINTF("constructed new space manager %p\n", reflowState.mSpaceManager); #endif } @@ -1624,7 +1630,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, case eReflowReason_Initial: #ifdef NOISY_REFLOW_REASON ListTag(stdout); - printf(": reflow=initial\n"); + PRINTF(": reflow=initial\n"); #endif DrainOverflowLines(aPresContext); rv = PrepareInitialReflow(state); @@ -1641,7 +1647,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, aReflowState.reflowCommand->GetType(type); #ifdef NOISY_REFLOW_REASON ListTag(stdout); - printf(": reflow=incremental type=%d\n", type); + PRINTF(": reflow=incremental type=%d\n", type); #endif switch (type) { case nsIReflowCommand::StyleChanged: @@ -1661,12 +1667,12 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, aReflowState.reflowCommand->GetNext(state.mNextRCFrame); #ifdef NOISY_REFLOW_REASON ListTag(stdout); - printf(": reflow=incremental"); + PRINTF(": reflow=incremental"); if (state.mNextRCFrame) { - printf(" next="); + PRINTF(" next="); nsFrame::ListTag(stdout, state.mNextRCFrame); } - printf("\n"); + PRINTF("\n"); #endif // this code does a correct job of propogating incremental reflows (bug 25510) @@ -1724,7 +1730,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, default: #ifdef NOISY_REFLOW_REASON ListTag(stdout); - printf(": reflow=resize (%d)\n", aReflowState.reason); + PRINTF(": reflow=resize (%d)\n", aReflowState.reason); #endif DrainOverflowLines(aPresContext); rv = PrepareResizeReflow(state); @@ -1749,7 +1755,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, } else { #ifdef DEBUG_kipp - ListTag(stdout); printf(": block is not complete\n"); + ListTag(stdout); PRINTF(": block is not complete\n"); #endif } } @@ -1769,7 +1775,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, if (xMost > aMetrics.width) { #ifdef NOISY_FINAL_SIZE ListTag(stdout); - printf(": changing desired width from %d to %d\n", aMetrics.width, xMost); + PRINTF(": changing desired width from %d to %d\n", aMetrics.width, xMost); #endif aMetrics.width = xMost; } @@ -1777,7 +1783,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, if (yMost > aMetrics.height) { #ifdef NOISY_FINAL_SIZE ListTag(stdout); - printf(": changing desired height from %d to %d\n", aMetrics.height, yMost); + PRINTF(": changing desired height from %d to %d\n", aMetrics.height, yMost); #endif aMetrics.height = yMost; } @@ -1810,7 +1816,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, if (NS_BLOCK_SPACE_MGR & mState) { nsHTMLReflowState& reflowState = (nsHTMLReflowState&)aReflowState; #ifdef NOISY_SPACEMANAGER - printf("restoring old space manager %p\n", oldSpaceManager); + PRINTF("restoring old space manager %p\n", oldSpaceManager); #endif reflowState.mSpaceManager = oldSpaceManager; } @@ -1819,7 +1825,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, nsHTMLReflowState& reflowState = (nsHTMLReflowState&)aReflowState; if (reflowState.mSpaceManager) { ListTag(stdout); - printf(": space-manager %p after reflow\n", reflowState.mSpaceManager); + PRINTF(": space-manager %p after reflow\n", reflowState.mSpaceManager); reflowState.mSpaceManager->List(stdout); } #endif @@ -1832,7 +1838,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, // Lots of things could have changed so damage our entire // bounds #ifdef NOISY_BLOCK_INVALIDATE - printf("%p invalidate 1 (%d, %d, %d, %d)\n", + PRINTF("%p invalidate 1 (%d, %d, %d, %d)\n", this, 0, 0, mRect.width, mRect.height); #endif Invalidate(aPresContext, nsRect(0, 0, mRect.width, mRect.height)); @@ -1862,7 +1868,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, damageRect.height = mRect.height; } #ifdef NOISY_BLOCK_INVALIDATE - printf("%p invalidate 2 (%d, %d, %d, %d)\n", + PRINTF("%p invalidate 2 (%d, %d, %d, %d)\n", this, damageRect.x, damageRect.y, damageRect.width, damageRect.height); #endif Invalidate(aPresContext, damageRect); @@ -1889,7 +1895,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, damageRect.height = border.bottom; } #ifdef NOISY_BLOCK_INVALIDATE - printf("%p invalidate 3 (%d, %d, %d, %d)\n", + PRINTF("%p invalidate 3 (%d, %d, %d, %d)\n", this, damageRect.x, damageRect.y, damageRect.width, damageRect.height); #endif Invalidate(aPresContext, damageRect); @@ -1933,23 +1939,23 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, if (gNoisyReflow) { IndentBy(stdout, gNoiseIndent); ListTag(stdout); - printf(": status=%x (%scomplete) metrics=%d,%d carriedMargin=%d", + PRINTF(": status=%x (%scomplete) metrics=%d,%d carriedMargin=%d", aStatus, NS_FRAME_IS_COMPLETE(aStatus) ? "" : "not ", aMetrics.width, aMetrics.height, aMetrics.mCarriedOutBottomMargin); if (mState & NS_FRAME_OUTSIDE_CHILDREN) { - printf(" combinedArea={%d,%d,%d,%d}", + PRINTF(" combinedArea={%d,%d,%d,%d}", aMetrics.mOverflowArea.x, aMetrics.mOverflowArea.y, aMetrics.mOverflowArea.width, aMetrics.mOverflowArea.height); } if (aMetrics.maxElementSize) { - printf(" maxElementSize=%d,%d", + PRINTF(" maxElementSize=%d,%d", aMetrics.maxElementSize->width, aMetrics.maxElementSize->height); } - printf("\n"); + PRINTF("\n"); } if (gLameReflowMetrics) { @@ -1968,12 +1974,12 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, PR_snprintf(buf, sizeof(buf), ": %lld elapsed (%lld per line) (%d lines; %d new lines)", delta, perLineDelta, numLines, ectc - ctc); - printf("%s\n", buf); + PRINTF("%s\n", buf); } #endif #ifdef NOISY_MAX_ELEMENT_SIZE if (aMetrics.maxElementSize) { - printf("block %p returning with maxElementSize=%d,%d\n", this, + PRINTF("block %p returning with maxElementSize=%d,%d\n", this, aMetrics.maxElementSize->width, aMetrics.maxElementSize->height); } @@ -2057,7 +2063,7 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState, const nsMargin& borderPadding = aState.BorderPadding(); #ifdef NOISY_FINAL_SIZE ListTag(stdout); - printf(": mY=%d mIsBottomMarginRoot=%s mPrevBottomMargin=%d bp=%d,%d\n", + PRINTF(": mY=%d mIsBottomMarginRoot=%s mPrevBottomMargin=%d bp=%d,%d\n", aState.mY, aState.GetFlag(BRS_ISBOTTOMMARGINROOT) ? "yes" : "no", aState.mPrevBottomMargin, borderPadding.top, borderPadding.bottom); @@ -2066,7 +2072,7 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState, // Compute final width nscoord maxWidth = 0, maxHeight = 0; #ifdef NOISY_KIDXMOST - printf("%p aState.mKidXMost=%d\n", this, aState.mKidXMost); + PRINTF("%p aState.mKidXMost=%d\n", this, aState.mKidXMost); #endif nscoord minWidth = aState.mKidXMost + borderPadding.right; if (!HaveAutoWidth(aReflowState)) { @@ -2276,8 +2282,8 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState, aMetrics.maxElementSize->width = maxWidth; aMetrics.maxElementSize->height = maxHeight; #ifdef NOISY_MAX_ELEMENT_SIZE - printf ("nsBlockFrame::CFS: %p returning MES %d\n", - this, aMetrics.maxElementSize->width); + PRINTF ("nsBlockFrame::CFS: %p returning MES %d\n", + this, aMetrics.maxElementSize->width); #endif } @@ -2288,12 +2294,12 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState, #ifdef DEBUG_blocks if (CRAZY_WIDTH(aMetrics.width) || CRAZY_HEIGHT(aMetrics.height)) { ListTag(stdout); - printf(": WARNING: desired:%d,%d\n", aMetrics.width, aMetrics.height); + PRINTF(": WARNING: desired:%d,%d\n", aMetrics.width, aMetrics.height); } if (aState.GetFlag(BRS_COMPUTEMAXELEMENTSIZE) && ((maxWidth > aMetrics.width) || (maxHeight > aMetrics.height))) { ListTag(stdout); - printf(": WARNING: max-element-size:%d,%d desired:%d,%d maxSize:%d,%d\n", + PRINTF(": WARNING: max-element-size:%d,%d desired:%d,%d maxSize:%d,%d\n", maxWidth, maxHeight, aMetrics.width, aMetrics.height, aState.mReflowState.availableWidth, aState.mReflowState.availableHeight); @@ -2303,10 +2309,10 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState, if (aState.GetFlag(BRS_COMPUTEMAXELEMENTSIZE)) { IndentBy(stdout, GetDepth()); if (NS_UNCONSTRAINEDSIZE == aState.mReflowState.availableWidth) { - printf("PASS1 "); + PRINTF("PASS1 "); } ListTag(stdout); - printf(": max-element-size:%d,%d desired:%d,%d maxSize:%d,%d\n", + PRINTF(": max-element-size:%d,%d desired:%d,%d maxSize:%d,%d\n", maxWidth, maxHeight, aMetrics.width, aMetrics.height, aState.mReflowState.availableWidth, aState.mReflowState.availableHeight); @@ -2318,7 +2324,7 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState, // We need to add in for the right border/padding aMetrics.mMaximumWidth = aState.mMaximumWidth + borderPadding.right; #ifdef NOISY_MAXIMUM_WIDTH - printf("nsBlockFrame::ComputeFinalSize block %p setting aMetrics.mMaximumWidth to %d\n", this, aMetrics.mMaximumWidth); + PRINTF("nsBlockFrame::ComputeFinalSize block %p setting aMetrics.mMaximumWidth to %d\n", this, aMetrics.mMaximumWidth); #endif } @@ -2368,7 +2374,7 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState, } #ifdef NOISY_COMBINED_AREA ListTag(stdout); - printf(": ca=%d,%d,%d,%d\n", xa, ya, xb-xa, yb-ya); + PRINTF(": ca=%d,%d,%d,%d\n", xa, ya, xb-xa, yb-ya); #endif // If the combined area of our children exceeds our bounding box @@ -2427,7 +2433,7 @@ nsBlockFrame::MarkLineDirty(nsLineBox* aLine, nsLineBox* aPrevLine) if (gNoisyReflow) { IndentBy(stdout, gNoiseIndent); ListTag(stdout); - printf(": mark line %p dirty\n", aLine); + PRINTF(": mark line %p dirty\n", aLine); } #endif @@ -2440,7 +2446,7 @@ nsBlockFrame::MarkLineDirty(nsLineBox* aLine, nsLineBox* aPrevLine) if (gNoisyReflow) { IndentBy(stdout, gNoiseIndent); ListTag(stdout); - printf(": mark prev-line %p dirty\n", aPrevLine); + PRINTF(": mark prev-line %p dirty\n", aPrevLine); } #endif } @@ -2554,7 +2560,7 @@ nsBlockFrame::PrepareResizeReflow(nsBlockReflowState& aState) mStyleContext->GetStyleData(eStyleStruct_Text); IndentBy(stdout, gNoiseIndent); ListTag(stdout); - printf(": marking all lines dirty: reason=%d availWidth=%d textAlign=%d\n", + PRINTF(": marking all lines dirty: reason=%d availWidth=%d textAlign=%d\n", aState.mReflowState.reason, aState.mReflowState.availableWidth, mStyleText->mTextAlign); @@ -2587,7 +2593,7 @@ nsBlockFrame::PrepareResizeReflow(nsBlockReflowState& aState) if (gNoisyReflow) { IndentBy(stdout, gNoiseIndent); ListTag(stdout); - printf(": trying to avoid marking all lines dirty\n"); + PRINTF(": trying to avoid marking all lines dirty\n"); } #endif @@ -2601,8 +2607,8 @@ nsBlockFrame::PrepareResizeReflow(nsBlockReflowState& aState) else { // We can avoid reflowing *some* inline lines in some cases. #ifdef REALLY_NOISY_REFLOW - printf("PrepareResizeReflow thinks line %p is %simpacted by floaters\n", - line, line->IsImpactedByFloater() ? "" : "not "); + PRINTF("PrepareResizeReflow thinks line %p is %simpacted by floaters\n", + line, line->IsImpactedByFloater() ? "" : "not "); #endif if (notWrapping) { // When no-wrap is set then the only line-breaking that @@ -2628,7 +2634,7 @@ nsBlockFrame::PrepareResizeReflow(nsBlockReflowState& aState) #ifdef DEBUG if (gNoisyReflow && !line->IsDirty() && !notWrapping) { IndentBy(stdout, gNoiseIndent + 1); - printf("skipped: line=%p next=%p %s %s %s%s%s breakType=%d xmost=%d\n", + PRINTF("skipped: line=%p next=%p %s %s %s%s%s breakType=%d xmost=%d\n", line, line->mNext, line->IsBlock() ? "block" : "inline", aState.GetFlag(BRS_NOWRAP) ? "no-wrap" : "wrapping", @@ -2779,8 +2785,8 @@ nsBlockFrame::PropogateReflowDamage(nsBlockReflowState& aState, PRBool wasImpactedByFloater = next->IsImpactedByFloater(); PRBool isImpactedByFloater = aState.IsImpactedByFloater() ? PR_TRUE : PR_FALSE; #ifdef REALLY_NOISY_REFLOW - printf("nsBlockFrame::PropogateReflowDamage %p was = %d, is=%d\n", - this, wasImpactedByFloater, isImpactedByFloater); + PRINTF("nsBlockFrame::PropogateReflowDamage %p was = %d, is=%d\n", + this, wasImpactedByFloater, isImpactedByFloater); #endif if (wasImpactedByFloater != isImpactedByFloater) { next->MarkDirty(); @@ -2865,16 +2871,16 @@ nsBlockFrame::ReflowDirtyLines(nsBlockReflowState& aState) aState.mReflowState.reflowCommand->GetType(type); IndentBy(stdout, gNoiseIndent); ListTag(stdout); - printf(": incrementally reflowing dirty lines: type=%s(%d) isInline=%s", + PRINTF(": incrementally reflowing dirty lines: type=%s(%d) isInline=%s", kReflowCommandType[type], type, aState.GetFlag(BRS_ISINLINEINCRREFLOW) ? "true" : "false"); } else { IndentBy(stdout, gNoiseIndent); ListTag(stdout); - printf(": reflowing dirty lines"); + PRINTF(": reflowing dirty lines"); } - printf(" computedWidth=%d\n", aState.mReflowState.mComputedWidth); + PRINTF(" computedWidth=%d\n", aState.mReflowState.mComputedWidth); gNoiseIndent++; } #endif @@ -2902,7 +2908,7 @@ nsBlockFrame::ReflowDirtyLines(nsBlockReflowState& aState) &damageRect : 0); if (incrementalReflow && !damageRect.IsEmpty()) { #ifdef NOISY_BLOCK_INVALIDATE - printf("%p invalidate 4 (%d, %d, %d, %d)\n", + PRINTF("%p invalidate 4 (%d, %d, %d, %d)\n", this, damageRect.x, damageRect.y, damageRect.width, damageRect.height); #endif Invalidate(aState.mPresContext, damageRect); @@ -2919,7 +2925,7 @@ nsBlockFrame::ReflowDirtyLines(nsBlockReflowState& aState) nsRect lca; line->GetCombinedArea(&lca); IndentBy(stdout, gNoiseIndent); - printf("line=%p mY=%d dirty=%s oldBounds={%d,%d,%d,%d} oldCombinedArea={%d,%d,%d,%d} deltaY=%d mPrevBottomMargin=%d\n", + PRINTF("line=%p mY=%d dirty=%s oldBounds={%d,%d,%d,%d} oldCombinedArea={%d,%d,%d,%d} deltaY=%d mPrevBottomMargin=%d\n", line, aState.mY, line->IsDirty() ? "yes" : "no", line->mBounds.x, line->mBounds.y, line->mBounds.width, line->mBounds.height, @@ -2977,7 +2983,7 @@ nsBlockFrame::ReflowDirtyLines(nsBlockReflowState& aState) &damageRect : 0); if (incrementalReflow && !damageRect.IsEmpty()) { #ifdef NOISY_BLOCK_INVALIDATE - printf("%p invalidate 5 (%d, %d, %d, %d)\n", + PRINTF("%p invalidate 5 (%d, %d, %d, %d)\n", this, damageRect.x, damageRect.y, damageRect.width, damageRect.height); #endif Invalidate(aState.mPresContext, damageRect); @@ -2990,7 +2996,7 @@ nsBlockFrame::ReflowDirtyLines(nsBlockReflowState& aState) nsRect lca; line->GetCombinedArea(&lca); IndentBy(stdout, gNoiseIndent); - printf("line=%p mY=%d newBounds={%d,%d,%d,%d} newCombinedArea={%d,%d,%d,%d} deltaY=%d mPrevBottomMargin=%d\n", + PRINTF("line=%p mY=%d newBounds={%d,%d,%d,%d} newCombinedArea={%d,%d,%d,%d} deltaY=%d mPrevBottomMargin=%d\n", line, aState.mY, line->mBounds.x, line->mBounds.y, line->mBounds.width, line->mBounds.height, @@ -3089,7 +3095,7 @@ nsBlockFrame::ReflowDirtyLines(nsBlockReflowState& aState) gNoiseIndent--; IndentBy(stdout, gNoiseIndent); ListTag(stdout); - printf(": done reflowing dirty lines (status=%x)\n", + PRINTF(": done reflowing dirty lines (status=%x)\n", aState.mReflowStatus); } #endif @@ -3154,7 +3160,7 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState, nsRect dirtyRect; dirtyRect.UnionRect(oldCombinedArea, lineCombinedArea); #ifdef NOISY_BLOCK_INVALIDATE - printf("%p invalidate 6 (%d, %d, %d, %d)\n", + PRINTF("%p invalidate 6 (%d, %d, %d, %d)\n", this, dirtyRect.x, dirtyRect.y, dirtyRect.width, dirtyRect.height); #endif Invalidate(aState.mPresContext, dirtyRect); @@ -3174,7 +3180,7 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState, dirtyRect.height = PR_MAX(oldCombinedArea.height, lineCombinedArea.height); #ifdef NOISY_BLOCK_INVALIDATE - printf("%p invalidate 7 (%d, %d, %d, %d)\n", + PRINTF("%p invalidate 7 (%d, %d, %d, %d)\n", this, dirtyRect.x, dirtyRect.y, dirtyRect.width, dirtyRect.height); #endif Invalidate(aState.mPresContext, dirtyRect); @@ -3193,7 +3199,7 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState, lineCombinedArea.YMost()) - dirtyRect.y; #ifdef NOISY_BLOCK_INVALIDATE - printf("%p invalidate 8 (%d, %d, %d, %d)\n", + PRINTF("%p invalidate 8 (%d, %d, %d, %d)\n", this, dirtyRect.x, dirtyRect.y, dirtyRect.width, dirtyRect.height); #endif Invalidate(aState.mPresContext, dirtyRect); @@ -3233,7 +3239,7 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState, // Update the line's maximum width aLine->mMaximumWidth = aLine->mBounds.XMost(); #ifdef NOISY_MAXIMUM_WIDTH - printf("nsBlockFrame::ReflowLine block %p line %p setting aLine.mMaximumWidth to %d\n", + PRINTF("nsBlockFrame::ReflowLine block %p line %p setting aLine.mMaximumWidth to %d\n", this, aLine, aLine->mMaximumWidth); #endif aState.UpdateMaximumWidth(aLine->mMaximumWidth); @@ -3263,7 +3269,7 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState, if (aState.GetFlag(BRS_COMPUTEMAXWIDTH)) { #ifdef NOISY_MAXIMUM_WIDTH - printf("nsBlockFrame::ReflowLine block %p line %p setting aLine.mMaximumWidth to %d\n", + PRINTF("nsBlockFrame::ReflowLine block %p line %p setting aLine.mMaximumWidth to %d\n", this, aLine, aLine->mMaximumWidth); #endif aState.UpdateMaximumWidth(aLine->mMaximumWidth); @@ -3271,7 +3277,7 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState, if (aState.GetFlag(BRS_COMPUTEMAXELEMENTSIZE)) { #ifdef NOISY_MAX_ELEMENT_SIZE - printf("nsBlockFrame::ReflowLine block %p line %p setting aLine.mMaxElementWidth to %d\n", + PRINTF("nsBlockFrame::ReflowLine block %p line %p setting aLine.mMaxElementWidth to %d\n", this, aLine, aLine->mMaxElementWidth); #endif aState.UpdateMaxElementSize(nsSize(aLine->mMaxElementWidth, aLine->mBounds.height)); @@ -3290,11 +3296,11 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState, nsRect dirtyRect; dirtyRect.UnionRect(oldCombinedArea, combinedArea); #ifdef NOISY_BLOCK_INVALIDATE - printf("%p invalidate because %s is true (%d, %d, %d, %d)\n", + PRINTF("%p invalidate because %s is true (%d, %d, %d, %d)\n", this, aDamageDirtyArea ? "aDamageDirtyArea" : "aLine->IsForceInvalidate", dirtyRect.x, dirtyRect.y, dirtyRect.width, dirtyRect.height); if (aLine->IsForceInvalidate()) - printf(" dirty line is %p\n"); + PRINTF(" dirty line is %p\n"); #endif Invalidate(aState.mPresContext, dirtyRect); } @@ -3525,7 +3531,7 @@ nsBlockFrame::UpdateSpaceManager(nsIPresContext* aPresContext, nscoord tx, ty; aSpaceManager->GetTranslation(tx, ty); nsFrame::ListTag(stdout, this); - printf(": UpdateSpaceManager: AddRectRegion: txy=%d,%d {%d,%d,%d,%d}\n", + PRINTF(": UpdateSpaceManager: AddRectRegion: txy=%d,%d {%d,%d,%d,%d}\n", tx, ty, fc->mRegion.x, fc->mRegion.y, fc->mRegion.width, fc->mRegion.height); @@ -3808,9 +3814,9 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState, } #ifdef NOISY_VERTICAL_MARGINS ListTag(stdout); - printf(": y=%d child ", aState.mY); + PRINTF(": y=%d child ", aState.mY); ListTag(stdout, frame); - printf(" has clear of %d => %s, mPrevBottomMargin=%d\n", + PRINTF(" has clear of %d => %s, mPrevBottomMargin=%d\n", breakType, applyTopMargin ? "applyTopMargin" : "nope", aState.mPrevBottomMargin); @@ -3850,7 +3856,7 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState, // Compute the available space for the block aState.GetAvailableSpace(); #ifdef REALLY_NOISY_REFLOW - printf("setting line %p isImpacted to %s\n", aLine, aState.IsImpactedByFloater()?"true":"false"); + PRINTF("setting line %p isImpacted to %s\n", aLine, aState.IsImpactedByFloater()?"true":"false"); #endif PRBool isImpacted = aState.IsImpactedByFloater() ? PR_TRUE : PR_FALSE; aLine->SetLineIsImpactedByFloater(isImpacted); @@ -3974,9 +3980,9 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState, // therefore zero out the running margin value. #ifdef NOISY_VERTICAL_MARGINS ListTag(stdout); - printf(": reflow incomplete, frame="); + PRINTF(": reflow incomplete, frame="); nsFrame::ListTag(stdout, frame); - printf(" prevBottomMargin=%d, setting to zero\n", + PRINTF(" prevBottomMargin=%d, setting to zero\n", aState.mPrevBottomMargin); #endif aState.mPrevBottomMargin = 0; @@ -3984,18 +3990,18 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState, else { #ifdef NOISY_VERTICAL_MARGINS ListTag(stdout); - printf(": reflow complete for "); + PRINTF(": reflow complete for "); nsFrame::ListTag(stdout, frame); - printf(" prevBottomMargin=%d collapsedBottomMargin=%d\n", + PRINTF(" prevBottomMargin=%d collapsedBottomMargin=%d\n", aState.mPrevBottomMargin, collapsedBottomMargin); #endif aState.mPrevBottomMargin = collapsedBottomMargin; } #ifdef NOISY_VERTICAL_MARGINS ListTag(stdout); - printf(": frame="); + PRINTF(": frame="); nsFrame::ListTag(stdout, frame); - printf(" carriedOutBottomMargin=%d collapsedBottomMargin=%d => %d\n", + PRINTF(" carriedOutBottomMargin=%d collapsedBottomMargin=%d => %d\n", aLine->GetCarriedOutBottomMargin(), collapsedBottomMargin, aState.mPrevBottomMargin); #endif @@ -4020,8 +4026,8 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState, const nsMargin& margin = brc.GetMargin(); aLine->mMaximumWidth += margin.left + margin.right; #ifdef NOISY_MAXIMUM_WIDTH - printf("nsBlockFrame::ReflowBlockFrame parent block %p line %p aLine->mMaximumWidth set to brc.GetMaximumWidth %d, updating aState.mMaximumWidth\n", - this, aLine, aLine->mMaximumWidth); + PRINTF("nsBlockFrame::ReflowBlockFrame parent block %p line %p aLine->mMaximumWidth set to brc.GetMaximumWidth %d, updating aState.mMaximumWidth\n", + this, aLine, aLine->mMaximumWidth); #endif aState.UpdateMaximumWidth(aLine->mMaximumWidth); @@ -4132,7 +4138,7 @@ nsBlockFrame::ReflowInlineFrames(nsBlockReflowState& aState, spins++; if (1000 == spins) { ListTag(stdout); - printf(": yikes! spinning on a line over 1000 times!\n"); + PRINTF(": yikes! spinning on a line over 1000 times!\n"); NS_ABORT(); } #endif @@ -4204,7 +4210,7 @@ nsBlockFrame::DoReflowInlineFrames(nsBlockReflowState& aState, PRBool impactedByFloaters = aState.IsImpactedByFloater() ? PR_TRUE : PR_FALSE; aLine->SetLineIsImpactedByFloater(impactedByFloaters); #ifdef REALLY_NOISY_REFLOW - printf("nsBlockFrame::DoReflowInlineFrames %p impacted = %d\n", + PRINTF("nsBlockFrame::DoReflowInlineFrames %p impacted = %d\n", this, impactedByFloaters); #endif @@ -4346,9 +4352,9 @@ nsBlockFrame::ReflowInlineFrame(nsBlockReflowState& aState, PRBool reflowingFirstLetter = aLineLayout.GetFirstLetterStyleOK(); #ifdef NOISY_FIRST_LETTER ListTag(stdout); - printf(": reflowing "); + PRINTF(": reflowing "); nsFrame::ListTag(stdout, aFrame); - printf(" reflowingFirstLetter=%s\n", reflowingFirstLetter ? "on" : "off"); + PRINTF(" reflowingFirstLetter=%s\n", reflowingFirstLetter ? "on" : "off"); #endif // Remember if we have a percentage aware child on this line @@ -4371,7 +4377,7 @@ nsBlockFrame::ReflowInlineFrame(nsBlockReflowState& aState, } #ifdef REALLY_NOISY_REFLOW_CHILD nsFrame::ListTag(stdout, aFrame); - printf(": status=%x\n", frameReflowStatus); + PRINTF(": status=%x\n", frameReflowStatus); #endif #if defined(REFLOW_STATUS_COVERAGE) @@ -4555,14 +4561,14 @@ nsBlockFrame::SplitLine(nsBlockReflowState& aState, #ifdef DEBUG if (gNoisyReflow) { nsFrame::IndentBy(stdout, gNoiseIndent); - printf("split line: from line=%p pushCount=%d aFrame=", aLine, pushCount); + PRINTF("split line: from line=%p pushCount=%d aFrame=", aLine, pushCount); if (aFrame) { nsFrame::ListTag(stdout, aFrame); } else { - printf("(null)"); + PRINTF("(null)"); } - printf("\n"); + PRINTF("\n"); if (gReallyNoisyReflow) { aLine->List(aState.mPresContext, stdout, gNoiseIndent+1); } @@ -4693,8 +4699,8 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState, lastHeight = aLine->mBounds.y; if (abs(aLine->mBounds.y - lastHeight) > CRAZY_H/10) { nsFrame::ListTag(stdout); - printf(": line=%p y=%d line.bounds.height=%d\n", - aLine, aLine->mBounds.y, aLine->mBounds.height); + PRINTF(": line=%p y=%d line.bounds.height=%d\n", + aLine, aLine->mBounds.y, aLine->mBounds.height); } } else { @@ -4775,10 +4781,10 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState, #ifdef NOISY_MAX_ELEMENT_SIZE IndentBy(stdout, GetDepth()); if (NS_UNCONSTRAINEDSIZE == aState.mReflowState.availableWidth) { - printf("PASS1 "); + PRINTF("PASS1 "); } ListTag(stdout); - printf(": line.floaters=%s band.floaterCount=%d\n", + PRINTF(": line.floaters=%s band.floaterCount=%d\n", //aLine->mFloaters.NotEmpty() ? "yes" : "no", aState.mHaveRightFloaters ? "(have right floaters)" : "", aState.mBand.GetFloaterCount()); @@ -4801,8 +4807,8 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState, // incremental reflow aLine->mMaxElementWidth = maxElementSize.width; #ifdef NOISY_MAX_ELEMENT_SIZE - printf ("nsBlockFrame::PlaceLine: %p setting MES for line %p to %d\n", - this, aLine, maxElementSize.width); + PRINTF ("nsBlockFrame::PlaceLine: %p setting MES for line %p to %d\n", + this, aLine, maxElementSize.width); #endif } @@ -4830,7 +4836,7 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState, aLine->GetCombinedArea(&lineCombinedArea); #ifdef NOISY_COMBINED_AREA ListTag(stdout); - printf(": lineCA=%d,%d,%d,%d floaterCA=%d,%d,%d,%d\n", + PRINTF(": lineCA=%d,%d,%d,%d floaterCA=%d,%d,%d,%d\n", lineCombinedArea.x, lineCombinedArea.y, lineCombinedArea.width, lineCombinedArea.height, aState.mFloaterCombinedArea.x, aState.mFloaterCombinedArea.y, @@ -4851,7 +4857,7 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState, // most edge of all the right floaters. Therefore, to accomplish our goal // all we do is set that X value to the lines XMost value. #ifdef NOISY_COMBINED_AREA - printf(" ==> rightFloaterCA=%d,%d,%d,%d lineXMost=%d\n", + PRINTF(" ==> rightFloaterCA=%d,%d,%d,%d lineXMost=%d\n", aState.mRightFloaterCombinedArea.x, aState.mRightFloaterCombinedArea.y, aState.mRightFloaterCombinedArea.width, @@ -4870,7 +4876,7 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState, } aLine->SetCombinedArea(lineCombinedArea); #ifdef NOISY_COMBINED_AREA - printf(" ==> final lineCA=%d,%d,%d,%d\n", + PRINTF(" ==> final lineCA=%d,%d,%d,%d\n", lineCombinedArea.x, lineCombinedArea.y, lineCombinedArea.width, lineCombinedArea.height); #endif @@ -4903,10 +4909,10 @@ nsBlockFrame::ComputeLineMaxElementSize(nsBlockReflowState& aState, #ifdef NOISY_MAX_ELEMENT_SIZE IndentBy(stdout, GetDepth()); if (NS_UNCONSTRAINEDSIZE == aState.mReflowState.availableWidth) { - printf("PASS1 "); + PRINTF("PASS1 "); } ListTag(stdout); - printf(": maxFloaterSize=%d,%d\n", maxWidth, maxHeight); + PRINTF(": maxFloaterSize=%d,%d\n", maxWidth, maxHeight); #endif // If the floaters are wider than the content, then use the maximum @@ -4933,8 +4939,8 @@ nsBlockFrame::ComputeLineMaxElementSize(nsBlockReflowState& aState, } } #ifdef NOISY_MAX_ELEMENT_SIZE - printf ("nsBlockFrame::ComputeLineMaxElementSize: %p returning MES %d\n", - this, aMaxElementSize->width); + PRINTF ("nsBlockFrame::ComputeLineMaxElementSize: %p returning MES %d\n", + this, aMaxElementSize->width); #endif } @@ -4960,8 +4966,8 @@ nsBlockFrame::PostPlaceLine(nsBlockReflowState& aState, // incremental reflow aLine->mMaxElementWidth = aMaxElementSize.width; #ifdef NOISY_MAX_ELEMENT_SIZE - printf ("nsBlockFrame::PostPlaceLine: %p setting line %p MES %d\n", - this, aLine, aMaxElementSize.width); + PRINTF ("nsBlockFrame::PostPlaceLine: %p setting line %p MES %d\n", + this, aLine, aMaxElementSize.width); #endif } @@ -4970,7 +4976,7 @@ nsBlockFrame::PostPlaceLine(nsBlockReflowState& aState, // calculate the maximum width if (aState.GetFlag(BRS_UNCONSTRAINEDWIDTH)) { #ifdef NOISY_MAXIMUM_WIDTH - printf("nsBlockFrame::PostPlaceLine during UC Reflow of block %p line %p caching max width %d\n", + PRINTF("nsBlockFrame::PostPlaceLine during UC Reflow of block %p line %p caching max width %d\n", this, aLine, aLine->mBounds.XMost()); #endif aLine->mMaximumWidth = aLine->mBounds.XMost(); @@ -4981,7 +4987,7 @@ nsBlockFrame::PostPlaceLine(nsBlockReflowState& aState, #ifdef DEBUG if (CRAZY_WIDTH(xmost)) { ListTag(stdout); - printf(": line=%p xmost=%d\n", aLine, xmost); + PRINTF(": line=%p xmost=%d\n", aLine, xmost); } #endif // If we're shrink wrapping our width and the line was wrapped, @@ -4989,13 +4995,13 @@ nsBlockFrame::PostPlaceLine(nsBlockReflowState& aState, if (aState.GetFlag(BRS_SHRINKWRAPWIDTH) && aLine->IsLineWrapped()) { aState.mKidXMost = aState.BorderPadding().left + aState.mContentArea.width; #ifdef NOISY_KIDXMOST - printf("%p PostPlaceLine A aState.mKidXMost=%d\n", this, aState.mKidXMost); + PRINTF("%p PostPlaceLine A aState.mKidXMost=%d\n", this, aState.mKidXMost); #endif } else if (xmost > aState.mKidXMost) { aState.mKidXMost = xmost; #ifdef NOISY_KIDXMOST - printf("%p PostPlaceLine B aState.mKidXMost=%d\n", this, aState.mKidXMost); + PRINTF("%p PostPlaceLine B aState.mKidXMost=%d\n", this, aState.mKidXMost); #endif } } @@ -5205,13 +5211,13 @@ nsBlockFrame::AppendFrames(nsIPresContext* aPresContext, // Add frames after the last child #ifdef NOISY_REFLOW_REASON ListTag(stdout); - printf(": append "); + PRINTF(": append "); nsFrame::ListTag(stdout, aFrameList); if (lastKid) { - printf(" after "); + PRINTF(" after "); nsFrame::ListTag(stdout, lastKid); } - printf("\n"); + PRINTF("\n"); #endif nsresult rv = AddFrames(aPresContext, aFrameList, lastKid); if (NS_SUCCEEDED(rv)) { @@ -5244,13 +5250,13 @@ nsBlockFrame::InsertFrames(nsIPresContext* aPresContext, #ifdef NOISY_REFLOW_REASON ListTag(stdout); - printf(": insert "); + PRINTF(": insert "); nsFrame::ListTag(stdout, aFrameList); if (aPrevFrame) { - printf(" after "); + PRINTF(" after "); nsFrame::ListTag(stdout, aPrevFrame); } - printf("\n"); + PRINTF("\n"); #endif nsresult rv = AddFrames(aPresContext, aFrameList, aPrevFrame); if (NS_SUCCEEDED(rv)) { @@ -5387,9 +5393,9 @@ nsBlockFrame::RemoveFrame(nsIPresContext* aPresContext, #ifdef NOISY_REFLOW_REASON ListTag(stdout); - printf(": remove "); + PRINTF(": remove "); nsFrame::ListTag(stdout, aOldFrame); - printf("\n"); + PRINTF("\n"); #endif if (nsLayoutAtoms::absoluteList == aListName) { @@ -5516,10 +5522,10 @@ nsBlockFrame::DoRemoveFrame(nsIPresContext* aPresContext, nsSplittableFrame::RemoveFromFlow(aDeletedFrame); } #ifdef NOISY_REMOVE_FRAME - printf("DoRemoveFrame: prevLine=%p line=%p frame=", + PRINTF("DoRemoveFrame: prevLine=%p line=%p frame=", prevLine, line); nsFrame::ListTag(stdout, aDeletedFrame); - printf(" prevSibling=%p nextInFlow=%p\n", prevSibling, nextInFlow); + PRINTF(" prevSibling=%p nextInFlow=%p\n", prevSibling, nextInFlow); #endif aDeletedFrame->Destroy(aPresContext); aDeletedFrame = nextInFlow; @@ -5537,7 +5543,7 @@ nsBlockFrame::DoRemoveFrame(nsIPresContext* aPresContext, nsRect lineCombinedArea; line->GetCombinedArea(&lineCombinedArea); #ifdef NOISY_BLOCK_INVALIDATE - printf("%p invalidate 10 (%d, %d, %d, %d)\n", + PRINTF("%p invalidate 10 (%d, %d, %d, %d)\n", this, lineCombinedArea.x, lineCombinedArea.y, lineCombinedArea.width, lineCombinedArea.height); #endif Invalidate(aPresContext, lineCombinedArea); @@ -5622,11 +5628,11 @@ nsBlockFrame::ReflowFloater(nsBlockReflowState& aState, nsMargin& aComputedOffsetsResult) { #ifdef NOISY_FLOATER - printf("Reflow Floater %p in parent %p, availSpace(%d,%d,%d,%d)\n", + PRINTF("Reflow Floater %p in parent %p, availSpace(%d,%d,%d,%d)\n", aPlaceholder->GetOutOfFlowFrame(), this, aState.mAvailSpaceRect.x, aState.mAvailSpaceRect.y, aState.mAvailSpaceRect.width, aState.mAvailSpaceRect.height - ); + ); #endif // XXX update this just aState.GetAvailableSpace(); @@ -5697,7 +5703,7 @@ nsBlockFrame::ReflowFloater(nsBlockReflowState& aState, aState.StoreMaxElementSize(floater, mes); } #ifdef NOISY_FLOATER - printf("end ReflowFloater %p, sized to %d,%d\n", floater, metrics.width, metrics.height); + PRINTF("end ReflowFloater %p, sized to %d,%d\n", floater, metrics.width, metrics.height); #endif return NS_OK; } @@ -6043,7 +6049,7 @@ nsBlockReflowState::PlaceFloater(nsFloaterCache* aFloaterCache, nscoord tx, ty; mSpaceManager->GetTranslation(tx, ty); nsFrame::ListTag(stdout, mBlock); - printf(": PlaceFloater: AddRectRegion: txy=%d,%d (%d,%d) {%d,%d,%d,%d}\n", + PRINTF(": PlaceFloater: AddRectRegion: txy=%d,%d (%d,%d) {%d,%d,%d,%d}\n", tx, ty, mSpaceManagerX, mSpaceManagerY, aFloaterCache->mRegion.x, aFloaterCache->mRegion.y, aFloaterCache->mRegion.width, aFloaterCache->mRegion.height); @@ -6102,9 +6108,9 @@ nsBlockReflowState::PlaceFloater(nsFloaterCache* aFloaterCache, nsRect r; floater->GetRect(r); nsFrame::IndentBy(stdout, gNoiseIndent); - printf("placed floater: "); + PRINTF("placed floater: "); ((nsFrame*)floater)->ListTag(stdout); - printf(" %d,%d,%d,%d\n", r.x, r.y, r.width, r.height); + PRINTF(" %d,%d,%d,%d\n", r.x, r.y, r.width, r.height); } #endif } @@ -6121,9 +6127,9 @@ nsBlockReflowState::PlaceBelowCurrentLineFloaters(nsFloaterCacheList& aList) #ifdef DEBUG if (gNoisyReflow) { nsFrame::IndentBy(stdout, gNoiseIndent); - printf("placing bcl floater: "); + PRINTF("placing bcl floater: "); nsFrame::ListTag(stdout, fc->mPlaceholder->GetOutOfFlowFrame()); - printf("\n"); + PRINTF("\n"); } #endif mBlock->ReflowFloater(*this, fc->mPlaceholder, fc->mCombinedArea, @@ -6143,13 +6149,13 @@ nsBlockReflowState::ClearFloaters(nscoord aY, PRUint8 aBreakType) #ifdef DEBUG if (gNoisyReflow) { nsFrame::IndentBy(stdout, gNoiseIndent); - printf("clear floaters: in: mY=%d aY=%d(%d)\n", + PRINTF("clear floaters: in: mY=%d aY=%d(%d)\n", mY, aY, aY - BorderPadding().top); } #endif #ifdef NOISY_FLOATER_CLEARING - printf("nsBlockReflowState::ClearFloaters: aY=%d breakType=%dn", + PRINTF("nsBlockReflowState::ClearFloaters: aY=%d breakType=%dn", aY, aBreakType); mSpaceManager->List(stdout); #endif @@ -6161,7 +6167,7 @@ nsBlockReflowState::ClearFloaters(nscoord aY, PRUint8 aBreakType) #ifdef DEBUG if (gNoisyReflow) { nsFrame::IndentBy(stdout, gNoiseIndent); - printf("clear floaters: out: mY=%d(%d)\n", mY, mY - bp.top); + PRINTF("clear floaters: out: mY=%d(%d)\n", mY, mY - bp.top); } #endif } @@ -6237,7 +6243,7 @@ nsBlockFrame::Paint(nsIPresContext* aPresContext, ComputeCombinedArea(mLines, mRect.width, mRect.height, ca); nsFrame::IndentBy(stdout, depth); ListTag(stdout); - printf(": bounds=%d,%d,%d,%d dirty=%d,%d,%d,%d ca=%d,%d,%d,%d\n", + PRINTF(": bounds=%d,%d,%d,%d dirty=%d,%d,%d,%d ca=%d,%d,%d,%d\n", mRect.x, mRect.y, mRect.width, mRect.height, aDirtyRect.x, aDirtyRect.y, aDirtyRect.width, aDirtyRect.height, ca.x, ca.y, ca.width, ca.height); @@ -6390,7 +6396,7 @@ nsBlockFrame::PaintChildren(nsIPresContext* aPresContext, nsRect lineCombinedArea; line->GetCombinedArea(&lineCombinedArea); nsFrame::IndentBy(stdout, depth+1); - printf("draw line=%p bounds=%d,%d,%d,%d ca=%d,%d,%d,%d\n", + PRINTF("draw line=%p bounds=%d,%d,%d,%d ca=%d,%d,%d,%d\n", line, line->mBounds.x, line->mBounds.y, line->mBounds.width, line->mBounds.height, lineCombinedArea.x, lineCombinedArea.y, @@ -6415,7 +6421,7 @@ nsBlockFrame::PaintChildren(nsIPresContext* aPresContext, nsRect lineCombinedArea; line->GetCombinedArea(&lineCombinedArea); nsFrame::IndentBy(stdout, depth+1); - printf("skip line=%p bounds=%d,%d,%d,%d ca=%d,%d,%d,%d\n", + PRINTF("skip line=%p bounds=%d,%d,%d,%d ca=%d,%d,%d,%d\n", line, line->mBounds.x, line->mBounds.y, line->mBounds.width, line->mBounds.height, lineCombinedArea.x, lineCombinedArea.y, @@ -6450,7 +6456,7 @@ nsBlockFrame::PaintChildren(nsIPresContext* aPresContext, ": %lld elapsed (%lld per line) lines=%d drawn=%d skip=%d", delta, deltaPerLine, numLines, drawnLines, numLines - drawnLines); - printf("%s\n", buf); + PRINTF("%s\n", buf); } #endif } @@ -6880,7 +6886,7 @@ nsBlockFrame::SetInitialChildList(nsIPresContext* aPresContext, mState |= NS_BLOCK_HAS_FIRST_LETTER_STYLE; #ifdef NOISY_FIRST_LETTER ListTag(stdout); - printf(": first-letter style found\n"); + PRINTF(": first-letter style found\n"); #endif NS_RELEASE(firstLetterStyle); } diff --git a/mozilla/layout/generic/nsContainerFrame.cpp b/mozilla/layout/generic/nsContainerFrame.cpp index 6a9ec3d0054..c25a8c93ba0 100644 --- a/mozilla/layout/generic/nsContainerFrame.cpp +++ b/mozilla/layout/generic/nsContainerFrame.cpp @@ -41,6 +41,12 @@ #include "nsCOMPtr.h" #include "nsLayoutAtoms.h" #include "nsIViewManager.h" +#include "nslog.h" +#undef fprintf + +NS_IMPL_LOG(nsContainerFrameLog) +#define PRINTF NS_LOG_PRINTF(nsContainerFrameLog) +#define FLUSH NS_LOG_FLUSH(nsContainerFrameLog) #ifdef NS_DEBUG #undef NOISY @@ -694,17 +700,17 @@ nsContainerFrame::ReflowChild(nsIFrame* aKidFrame, #ifdef DEBUG if (saveMaxElementSize != aDesiredSize.maxElementSize) { - printf("nsContainerFrame: "); + PRINTF("nsContainerFrame: "); nsFrame::ListTag(stdout, aKidFrame); - printf(" changed the maxElementSize *pointer* (baaaad boy!)\n"); + PRINTF(" changed the maxElementSize *pointer* (baaaad boy!)\n"); } #ifdef REALLY_NOISY_MAX_ELEMENT_SIZE if ((nsnull != aDesiredSize.maxElementSize) && ((nscoord(0xdeadbeef) == aDesiredSize.maxElementSize->width) || (nscoord(0xdeadbeef) == aDesiredSize.maxElementSize->height))) { - printf("nsContainerFrame: "); + PRINTF("nsContainerFrame: "); nsFrame::ListTag(stdout, aKidFrame); - printf(" didn't set max-element-size!\n"); + PRINTF(" didn't set max-element-size!\n"); aDesiredSize.maxElementSize->width = 0; aDesiredSize.maxElementSize->height = 0; } diff --git a/mozilla/layout/generic/nsFrame.cpp b/mozilla/layout/generic/nsFrame.cpp index c01ef2e0a45..39faafd66a9 100644 --- a/mozilla/layout/generic/nsFrame.cpp +++ b/mozilla/layout/generic/nsFrame.cpp @@ -65,6 +65,15 @@ #include "nsIGfxTextControlFrame.h" #include "nsINameSpaceManager.h" +#include "nslog.h" +#undef PRLogModuleInfo +#undef PR_NewLogModule +#undef fprintf + +NS_IMPL_LOG(nsFrameLog) +#define PRINTF NS_LOG_PRINTF(nsFrameLog) +#define FLUSH NS_LOG_FLUSH(nsFrameLog) + // For triple-click pref #include "nsIPref.h" #include "nsIServiceManager.h" @@ -133,7 +142,7 @@ nsIFrameDebug::GetVerifyTreeEnable() if (nsnull == gFrameVerifyTreeLogModuleInfo) { gFrameVerifyTreeLogModuleInfo = PR_NewLogModule("frameverifytree"); gFrameVerifyTreeEnable = 0 != gFrameVerifyTreeLogModuleInfo->level; - printf("Note: frameverifytree is %sabled\n", + PRINTF("Note: frameverifytree is %sabled", gFrameVerifyTreeEnable ? "en" : "dis"); } } @@ -157,7 +166,7 @@ nsIFrameDebug::GetVerifyStyleTreeEnable() if (nsnull == gStyleVerifyTreeLogModuleInfo) { gStyleVerifyTreeLogModuleInfo = PR_NewLogModule("styleverifytree"); gStyleVerifyTreeEnable = 0 != gStyleVerifyTreeLogModuleInfo->level; - printf("Note: styleverifytree is %sabled\n", + PRINTF("Note: styleverifytree is %sabled", gStyleVerifyTreeEnable ? "en" : "dis"); } } @@ -1248,8 +1257,8 @@ nsFrame::HandleMultiplePress(nsIPresContext* aPresContext, else return NS_OK; #ifdef DEBUG_akkana - if (selectPara) printf("Selecting Paragraph\n"); - else printf("Selecting Line\n"); + if (selectPara) PRINTF("Selecting Paragraph"); + else PRINTF("Selecting Line"); #endif // Line or paragraph selection: @@ -1680,13 +1689,12 @@ nsresult nsFrame::GetContentAndOffsetsFromPoint(nsIPresContext* aCX, } } - // printf(" 0x%.8x 0x%.8x %4d %4d\n", - // closestFrame, closestView, closestXDistance, closestYDistance); + // PRINTF(" 0x%.8x 0x%.8x %4d %4d", + // closestFrame, closestView, closestXDistance, closestYDistance)); return closestFrame->GetContentAndOffsetsFromPoint(aCX, newPoint, aNewContent, aContentOffset, aContentOffsetEnd,aBeginFrameContent); - } - } + } } if (!mContent) return NS_ERROR_NULL_POINTER; @@ -2654,7 +2662,7 @@ nsFrame::GetNextPrevLineFromeBlockFrame(nsIPresContext* aPresContext, //result = lastFrame->GetNextSibling(&lastFrame, searchingLine); result = it->GetNextSiblingOnLine(lastFrame, searchingLine); if (NS_FAILED(result)){ - NS_ASSERTION(0,"should not be reached nsFrame\n"); + NS_ASSERTION(0,"should not be reached nsFrame"); continue; } } @@ -2891,7 +2899,7 @@ nsFrame::PeekOffsetParagraph(nsIPresContext* aPresContext, nsPeekOffsetStruct *aPos) { #ifdef DEBUG_paragraph - printf("Selecting paragraph\n"); + PRINTF("Selecting paragraph"); #endif nsIFrame* blockFrame; nsCOMPtr iter (getter_AddRefs(GetBlockFrameAndLineIter(this, &blockFrame))); @@ -2901,7 +2909,7 @@ nsFrame::PeekOffsetParagraph(nsIPresContext* aPresContext, PRInt32 thisLine; nsresult result = iter->FindLineContaining(this, &thisLine); #ifdef DEBUG_paragraph - printf("Looping %s from line %d\n", + PRINTF("Looping %s from line %d", aPos->mDirection == eDirPrevious ? "back" : "forward", thisLine); #endif @@ -2924,7 +2932,7 @@ nsFrame::PeekOffsetParagraph(nsIPresContext* aPresContext, if (NS_FAILED(result) || !firstFrameOnLine || !numFramesOnLine) { #ifdef DEBUG_paragraph - printf("End loop at line %d\n", i); + PRINTF("End loop at line %d", i); #endif break; } @@ -2933,7 +2941,7 @@ nsFrame::PeekOffsetParagraph(nsIPresContext* aPresContext, { // Fill in aPos with the info on the new position #ifdef DEBUG_paragraph - printf("Found a paragraph break at line %d\n", i); + PRINTF("Found a paragraph break at line %d", i); #endif // Save the old direction, but now go one line back the other way @@ -2949,7 +2957,7 @@ nsFrame::PeekOffsetParagraph(nsIPresContext* aPresContext, i, 0); if (NS_FAILED(result)) - printf("GetNextPrevLineFromeBlockFrame failed\n"); + PRINTF("GetNextPrevLineFromeBlockFrame failed"); #else /* SIMPLE -- alas, nope */ int edgeCase = 0;//no edge case. this should look at thisLine @@ -3035,7 +3043,7 @@ DrillDownToEndOfLine(nsIFrame* aFrame, PRInt32 aLineNo, PRInt32 aLineFrameCount, if (!nextFrame) //premature leaving of loop. { nextFrame = currentFrame; //back it up. lets show a warning - NS_WARNING("lineFrame Count lied to us from nsILineIterator!\n"); + NS_WARNING("lineFrame Count lied to us from nsILineIterator!"); } nsPoint offsetPoint; //used for offset of result frame @@ -3060,7 +3068,7 @@ DrillDownToEndOfLine(nsIFrame* aFrame, PRInt32 aLineNo, PRInt32 aLineFrameCount, return PR_TRUE; #ifdef DEBUG_paragraph - NS_ASSERTION(PR_FALSE, "Looping around in PeekOffset\n"); + NS_ASSERTION(PR_FALSE, "Looping around in PeekOffset"); #endif aLineFrameCount--; if (aLineFrameCount == 0) @@ -3367,7 +3375,7 @@ nsFrame::GetFrameFromDirection(nsIPresContext* aPresContext, nsPeekOffsetStruct for (;lineFrameCount > 1;lineFrameCount --){ result = lastFrame->GetNextSibling(&lastFrame); if (NS_FAILED(result)){ - NS_ASSERTION(0,"should not be reached nsFrame\n"); + NS_ASSERTION(0,"should not be reached nsFrame"); return NS_ERROR_FAILURE; } } diff --git a/mozilla/layout/generic/nsFrame.h b/mozilla/layout/generic/nsFrame.h index 1b8226ce2ac..697f63f1e83 100644 --- a/mozilla/layout/generic/nsFrame.h +++ b/mozilla/layout/generic/nsFrame.h @@ -34,6 +34,7 @@ #include "nsIPresShell.h" #include "nsIReflowCommand.h" #include "nsIFrameSelection.h" +#include "prlog.h" /** * nsFrame logging constants. We redefine the nspr @@ -387,8 +388,7 @@ public: if (NS_SUCCEEDED(aFrame->QueryInterface(NS_GET_IID(nsIFrameDebug), (void**)&frameDebug))) { frameDebug->GetFrameName(tmp); } - fputs(tmp, out); - fprintf(out, "@%p", aFrame); + fprintf(out, "%s@%p", tmp, aFrame); } static void IndentBy(FILE* out, PRInt32 aIndent) { diff --git a/mozilla/layout/generic/nsFrameFrame.cpp b/mozilla/layout/generic/nsFrameFrame.cpp index 1d4127d968e..674adf45ea9 100644 --- a/mozilla/layout/generic/nsFrameFrame.cpp +++ b/mozilla/layout/generic/nsFrameFrame.cpp @@ -70,6 +70,11 @@ #include "nsIBrowserBoxObject.h" #include "nsISHistory.h" #endif +#include "nslog.h" + +NS_IMPL_LOG(nsFrameFrameLog) +#define PRINTF NS_LOG_PRINTF(nsFrameFrameLog) +#define FLUSH NS_LOG_FLUSH(nsFrameFrameLog) class nsHTMLFrame; @@ -215,7 +220,7 @@ nsHTMLFrameOuterFrame::nsHTMLFrameOuterFrame() nsHTMLFrameOuterFrame::~nsHTMLFrameOuterFrame() { - //printf("nsHTMLFrameOuterFrame destructor %X \n", this); + //PRINTF("nsHTMLFrameOuterFrame destructor %X \n", this); } NS_IMETHODIMP @@ -285,7 +290,7 @@ nsHTMLFrameOuterFrame::Paint(nsIPresContext* aPresContext, const nsRect& aDirtyRect, nsFramePaintLayer aWhichLayer) { - //printf("outer paint %X (%d,%d,%d,%d) \n", this, aDirtyRect.x, aDirtyRect.y, aDirtyRect.width, aDirtyRect.height); + //PRINTF("outer paint %X (%d,%d,%d,%d) \n", this, aDirtyRect.x, aDirtyRect.y, aDirtyRect.width, aDirtyRect.height); nsIFrame* firstChild = mFrames.FirstChild(); if (nsnull != firstChild) { firstChild->Paint(aPresContext, aRenderingContext, aDirtyRect, @@ -322,7 +327,7 @@ nsHTMLFrameOuterFrame::Reflow(nsIPresContext* aPresContext, nsReflowStatus& aStatus) { DO_GLOBAL_REFLOW_COUNT("nsHTMLFrameOuterFrame", aReflowState.reason); - //printf("OuterFrame::Reflow %X (%d,%d) \n", this, aReflowState.availableWidth, aReflowState.availableHeight); + //PRINTF("OuterFrame::Reflow %X (%d,%d) \n", this, aReflowState.availableWidth, aReflowState.availableHeight); NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS, ("enter nsHTMLFrameOuterFrame::Reflow: maxSize=%d,%d reason=%d", aReflowState.availableWidth, aReflowState.availableHeight, aReflowState.reason)); @@ -428,7 +433,7 @@ nsHTMLFrameOuterFrame::AttributeChanged(nsIPresContext* aPresContext, PRInt32 aHint) { if (nsHTMLAtoms::src == aAttribute) { - printf("got a request\n"); + PRINTF("got a request\n"); nsIFrame* firstChild = mFrames.FirstChild(); if (nsnull != firstChild) { return ((nsHTMLFrameInnerFrame*)firstChild)->ReloadURL(aPresContext); @@ -463,7 +468,7 @@ nsHTMLFrameInnerFrame::nsHTMLFrameInnerFrame() nsHTMLFrameInnerFrame::~nsHTMLFrameInnerFrame() { - //printf("nsHTMLFrameInnerFrame destructor %X \n", this); + //PRINTF("nsHTMLFrameInnerFrame destructor %X \n", this); #ifdef INCLUDE_XUL nsCOMPtr xulElt(do_QueryInterface(mContent)); @@ -650,7 +655,7 @@ nsHTMLFrameInnerFrame::Paint(nsIPresContext* aPresContext, const nsRect& aDirtyRect, nsFramePaintLayer aWhichLayer) { - //printf("inner paint %X (%d,%d,%d,%d) \n", this, aDirtyRect.x, aDirtyRect.y, aDirtyRect.width, aDirtyRect.height); + //PRINTF("inner paint %X (%d,%d,%d,%d) \n", this, aDirtyRect.x, aDirtyRect.y, aDirtyRect.width, aDirtyRect.height); // if there is not web shell paint based on our background color, // otherwise let the web shell paint the sub document if (!mSubShell) { diff --git a/mozilla/layout/generic/nsFrameSetFrame.cpp b/mozilla/layout/generic/nsFrameSetFrame.cpp index 376601f650e..cd6e70682f5 100644 --- a/mozilla/layout/generic/nsFrameSetFrame.cpp +++ b/mozilla/layout/generic/nsFrameSetFrame.cpp @@ -47,6 +47,13 @@ #include "nsILookAndFeel.h" #include "nsWidgetsCID.h" #include "nsIComponentManager.h" +#include "nslog.h" +#undef fprintf + +NS_IMPL_LOG(nsFrameSetFrameLog) +#define PRINTF NS_LOG_PRINTF(nsFrameSetFrameLog) +#define FLUSH NS_LOG_FLUSH(nsFrameSetFrameLog) + // masks for mEdgeVisibility #define LEFT_VIS 0x0001 #define RIGHT_VIS 0x0002 @@ -646,7 +653,7 @@ nsHTMLFramesetFrame::Paint(nsIPresContext* aPresContext, const nsRect& aDirtyRect, nsFramePaintLayer aWhichLayer) { - //printf("frameset paint %X (%d,%d,%d,%d) \n", this, aDirtyRect.x, aDirtyRect.y, aDirtyRect.width, aDirtyRect.height); + //PRINTF("frameset paint %X (%d,%d,%d,%d) \n", this, aDirtyRect.x, aDirtyRect.y, aDirtyRect.width, aDirtyRect.height); return nsHTMLContainerFrame::Paint(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer); } @@ -937,7 +944,7 @@ nsHTMLFramesetFrame::Reflow(nsIPresContext* aPresContext, nsCOMPtr shell; aPresContext->GetShell(getter_AddRefs(shell)); - //printf("FramesetFrame2::Reflow %X (%d,%d) \n", this, aReflowState.availableWidth, aReflowState.availableHeight); + //PRINTF("FramesetFrame2::Reflow %X (%d,%d) \n", this, aReflowState.availableWidth, aReflowState.availableHeight); // Always get the size so that the caller knows how big we are GetDesiredSize(aPresContext, aReflowState, aDesiredSize); PRBool firstTime = (0 == mNumRows); @@ -1567,7 +1574,7 @@ nsHTMLFramesetBorderFrame::nsHTMLFramesetBorderFrame(PRInt32 aWidth, nsHTMLFramesetBorderFrame::~nsHTMLFramesetBorderFrame() { - //printf("nsHTMLFramesetBorderFrame destructor %p \n", this); + //PRINTF("nsHTMLFramesetBorderFrame destructor %p \n", this); } void nsHTMLFramesetBorderFrame::GetDesiredSize(nsIPresContext* aPresContext, @@ -1612,7 +1619,7 @@ nsHTMLFramesetBorderFrame::Paint(nsIPresContext* aPresContext, if (NS_FRAME_PAINT_LAYER_FOREGROUND != aWhichLayer) { return NS_OK; } - //printf("border frame paint %X (%d,%d,%d,%d) \n", this, aDirtyRect.x, aDirtyRect.y, aDirtyRect.width, aDirtyRect.height); + //PRINTF("border frame paint %X (%d,%d,%d,%d) \n", this, aDirtyRect.x, aDirtyRect.y, aDirtyRect.width, aDirtyRect.height); nscolor WHITE = NS_RGB(255, 255, 255); nscolor bgColor = NS_RGB(200,200,200); nscolor fgColor = NS_RGB(0,0,0); @@ -1762,7 +1769,7 @@ NS_IMETHODIMP nsHTMLFramesetBorderFrame::GetFrameName(nsString& aResult) const nsHTMLFramesetBlankFrame::~nsHTMLFramesetBlankFrame() { - //printf("nsHTMLFramesetBlankFrame destructor %p \n", this); + //PRINTF("nsHTMLFramesetBlankFrame destructor %p \n", this); } void nsHTMLFramesetBlankFrame::GetDesiredSize(nsIPresContext* aPresContext, diff --git a/mozilla/layout/generic/nsFrameUtil.cpp b/mozilla/layout/generic/nsFrameUtil.cpp index 8f867440e9f..06561cf0ba8 100644 --- a/mozilla/layout/generic/nsFrameUtil.cpp +++ b/mozilla/layout/generic/nsFrameUtil.cpp @@ -26,6 +26,12 @@ #include "nsRect.h" #include #include "plstr.h" +#include "nslog.h" +#undef fprintf + +NS_IMPL_LOG(nsFrameUtilLog) +#define PRINTF NS_LOG_PRINTF(nsFrameUtilLog) +#define FLUSH NS_LOG_FLUSH(nsFrameUtilLog) static NS_DEFINE_IID(kIFrameUtilIID, NS_IFRAME_UTIL_IID); @@ -526,29 +532,29 @@ nsFrameUtil::CompareTrees(Node* tree1, Node* tree2) if (nsnull == tree2) { break; } - printf("first tree prematurely ends\n"); + PRINTF("first tree prematurely ends\n"); return PR_FALSE; } else if (nsnull == tree2) { - printf("second tree prematurely ends\n"); + PRINTF("second tree prematurely ends\n"); return PR_FALSE; } // Check the attributes that we care about if (0 != PL_strcmp(tree1->type, tree2->type)) { - printf("frame type mismatch: %s vs. %s\n", tree1->type, tree2->type); - printf("Node 1:\n"); + PRINTF("frame type mismatch: %s vs. %s\n", tree1->type, tree2->type); + PRINTF("Node 1:\n"); DumpNode(tree1, stdout, 1); - printf("Node 2:\n"); + PRINTF("Node 2:\n"); DumpNode(tree2, stdout, 1); return PR_FALSE; } if (tree1->state != tree2->state) { - printf("frame state mismatch: 0x%x vs. 0x%x\n", + PRINTF("frame state mismatch: 0x%x vs. 0x%x\n", tree1->state, tree2->state); } if (tree1->bbox != tree2->bbox) { - printf("frame bbox mismatch: %d,%d,%d,%d vs. %d,%d,%d,%d\n", + PRINTF("frame bbox mismatch: %d,%d,%d,%d vs. %d,%d,%d,%d\n", tree1->bbox.x, tree1->bbox.y, tree1->bbox.width, tree1->bbox.height, tree2->bbox.x, tree2->bbox.y, @@ -561,10 +567,10 @@ nsFrameUtil::CompareTrees(Node* tree1, Node* tree2) for (;;) { if (nsnull == list1) { if (nsnull != list2) { - printf("first tree prematurely ends (no child lists)\n"); - printf("Node 1:\n"); + PRINTF("first tree prematurely ends (no child lists)\n"); + PRINTF("Node 1:\n"); DumpNode(tree1, stdout, 1); - printf("Node 2:\n"); + PRINTF("Node 2:\n"); DumpNode(tree2, stdout, 1); return PR_FALSE; } @@ -573,15 +579,15 @@ nsFrameUtil::CompareTrees(Node* tree1, Node* tree2) } } if (nsnull == list2) { - printf("second tree prematurely ends (no child lists)\n"); - printf("Node 1:\n"); + PRINTF("second tree prematurely ends (no child lists)\n"); + PRINTF("Node 1:\n"); DumpNode(tree1, stdout, 1); - printf("Node 2:\n"); + PRINTF("Node 2:\n"); DumpNode(tree2, stdout, 1); return PR_FALSE; } if (0 != PL_strcmp(list1->name, list2->name)) { - printf("child-list name mismatch: %s vs. %s\n", + PRINTF("child-list name mismatch: %s vs. %s\n", list1->name ? list1->name : "(null)", list2->name ? list2->name : "(null)"); } @@ -610,9 +616,9 @@ nsFrameUtil::CompareRegressionData(FILE* aFile1, FILE* aFile2) nsresult rv = NS_OK; if (!CompareTrees(tree1, tree2)) { - printf("Regression data 1:\n"); + PRINTF("Regression data 1:\n"); DumpTree(tree1, stdout, 0); - printf("Regression data 2:\n"); + PRINTF("Regression data 2:\n"); DumpTree(tree2, stdout, 0); rv = NS_ERROR_FAILURE; } diff --git a/mozilla/layout/generic/nsGfxScrollFrame.cpp b/mozilla/layout/generic/nsGfxScrollFrame.cpp index 34e76d5670a..40ede89ae95 100644 --- a/mozilla/layout/generic/nsGfxScrollFrame.cpp +++ b/mozilla/layout/generic/nsGfxScrollFrame.cpp @@ -55,6 +55,11 @@ #include "nsIScrollbarMediator.h" #include "nsIGfxTextControlFrame.h" #include "nsIDOMHTMLTextAreaElement.h" +#include "nslog.h" + +NS_IMPL_LOG(nsGfxScrollFrameLog) +#define PRINTF NS_LOG_PRINTF(nsGfxScrollFrameLog) +#define FLUSH NS_LOG_FLUSH(nsGfxScrollFrameLog) static NS_DEFINE_IID(kWidgetCID, NS_CHILD_CID); static NS_DEFINE_IID(kScrollingViewCID, NS_SCROLLING_VIEW_CID); @@ -1173,7 +1178,7 @@ nsGfxScrollFrameInner::Layout(nsBoxLayoutState& aState) // suddenly need a vertical scrollbar. Is a special case but its // important. //if (!mHasVerticalScrollbar && scrolledContentSize.height > scrollAreaRect.height - sbSize.height) - // printf("****Gfx Scrollbar Special case hit!!*****\n"); + // PRINTF("****Gfx Scrollbar Special case hit!!*****\n"); } } else { @@ -1312,7 +1317,7 @@ nsGfxScrollFrameInner::ScrollbarChanged(nsIPresContext* aPresContext, nscoord aX { nsIScrollableView* scrollable = GetScrollableView(aPresContext); scrollable->ScrollTo(aX,aY, NS_SCROLL_PROPERTY_ALWAYS_BLIT); - // printf("scrolling to: %d, %d\n", aX, aY); + // PRINTF("scrolling to: %d, %d\n", aX, aY); } nsGfxScrollFrameInner::~nsGfxScrollFrameInner() diff --git a/mozilla/layout/generic/nsHTMLReflowState.cpp b/mozilla/layout/generic/nsHTMLReflowState.cpp index 1b1b5fd711f..fb9204752a4 100644 --- a/mozilla/layout/generic/nsHTMLReflowState.cpp +++ b/mozilla/layout/generic/nsHTMLReflowState.cpp @@ -34,6 +34,11 @@ #include "nsBlockFrame.h" #include "nsLineBox.h" #include "nsImageFrame.h" +#include "nslog.h" + +NS_IMPL_LOG(nsHTMLReflowStateLog) +#define PRINTF NS_LOG_PRINTF(nsHTMLReflowStateLog) +#define FLUSH NS_LOG_FLUSH(nsHTMLReflowStateLog) #ifdef NS_DEBUG #undef NOISY_VERTICAL_ALIGN @@ -1494,8 +1499,8 @@ nsHTMLReflowState::InitConstraints(nsIPresContext* aPresContext, } #if 0 - nsFrame::ListTag(stdout, frame); printf(": cb="); - nsFrame::ListTag(stdout, cbrs->frame); printf(" size=%d,%d\n", aContainingBlockWidth, aContainingBlockHeight); + nsFrame::ListTag(stdout, frame); PRINTF(": cb="); + nsFrame::ListTag(stdout, cbrs->frame); PRINTF(" size=%d,%d\n", aContainingBlockWidth, aContainingBlockHeight); #endif // See if the containing block height is based on the size of its diff --git a/mozilla/layout/generic/nsIFrame.h b/mozilla/layout/generic/nsIFrame.h index 416daa13bdb..c804588a271 100644 --- a/mozilla/layout/generic/nsIFrame.h +++ b/mozilla/layout/generic/nsIFrame.h @@ -34,6 +34,9 @@ #ifdef MOZ_MATHML #include "nsIRenderingContext.h" //to get struct nsBoundingMetrics #endif +#include "nslog.h" +#undef PRLogModuleInfo +#undef fprintf /** * New rules of reflow: diff --git a/mozilla/layout/generic/nsIFrameDebug.h b/mozilla/layout/generic/nsIFrameDebug.h index 29eaacbee54..2e54a17c132 100644 --- a/mozilla/layout/generic/nsIFrameDebug.h +++ b/mozilla/layout/generic/nsIFrameDebug.h @@ -25,6 +25,8 @@ #include "nslayout.h" #include "nsISupports.h" +#undef PRLogModuleInfo + class nsIFrame; class nsIPresContext; diff --git a/mozilla/layout/generic/nsImageFrame.cpp b/mozilla/layout/generic/nsImageFrame.cpp index 0b9fe558996..860d314b845 100644 --- a/mozilla/layout/generic/nsImageFrame.cpp +++ b/mozilla/layout/generic/nsImageFrame.cpp @@ -62,7 +62,11 @@ static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID); #include "nsIFrameManager.h" #include "nsIScriptSecurityManager.h" +#include "nslog.h" +NS_IMPL_LOG(nsImageFrameLog) +#define PRINTF NS_LOG_PRINTF(nsImageFrameLog) +#define FLUSH NS_LOG_FLUSH(nsImageFrameLog) #ifdef DEBUG #undef NOISY_IMAGE_LOADING @@ -205,7 +209,7 @@ nsImageFrame::UpdateImage(nsIPresContext* aPresContext, PRUint32 aStatus, void* { #ifdef NOISY_IMAGE_LOADING ListTag(stdout); - printf(": UpdateImage: status=%x\n", aStatus); + PRINTF(": UpdateImage: status=%x\n", aStatus); #endif nsCOMPtr presShell; @@ -1031,11 +1035,8 @@ nsImageFrame::AttributeChanged(nsIPresContext* aPresContext, if (!oldSRC.Equals(newSRC)) { #ifdef NOISY_IMAGE_LOADING ListTag(stdout); - printf(": new image source; old='"); - fputs(oldSRC, stdout); - printf("' new='"); - fputs(newSRC, stdout); - printf("'\n"); + PRINTF(": new image source; old='%s", oldSRC); + PRINTF("' new='%s'\n", newSRC); #endif if (mImageLoader.IsImageSizeKnown()) { diff --git a/mozilla/layout/generic/nsInlineFrame.cpp b/mozilla/layout/generic/nsInlineFrame.cpp index 4b624ed1cc3..9668d9b6aff 100644 --- a/mozilla/layout/generic/nsInlineFrame.cpp +++ b/mozilla/layout/generic/nsInlineFrame.cpp @@ -31,6 +31,11 @@ #include "nsIFontMetrics.h" #include "nsAbsoluteContainingBlock.h" #include "nsLayoutAtoms.h" +#include "nslog.h" + +NS_IMPL_LOG(nsInlineFrameLog) +#define PRINTF NS_LOG_PRINTF(nsInlineFrameLog) +#define FLUSH NS_LOG_FLUSH(nsInlineFrameLog) #ifdef DEBUG #undef NOISY_PUSHING @@ -287,7 +292,7 @@ nsInlineFrame::Reflow(nsIPresContext* aPresContext, extern char* nsPresShell_ReflowStackPointerTop; char marker; char* newsp = (char*) ▮ - printf("XXX: frame tree is too deep; approx stack size = %d\n", + PRINTF("XXX: frame tree is too deep; approx stack size = %d\n", nsPresShell_ReflowStackPointerTop - newsp); } #endif @@ -431,7 +436,7 @@ nsInlineFrame::ReflowFrames(nsIPresContext* aPresContext, PRBool isComplete; frame = PullOneFrame(aPresContext, irs, &isComplete); #ifdef NOISY_PUSHING - printf("%p pulled up %p\n", this, frame); + PRINTF("%p pulled up %p\n", this, frame); #endif if (nsnull == frame) { if (!isComplete) { @@ -538,11 +543,11 @@ nsInlineFrame::ReflowFrames(nsIPresContext* aPresContext, #ifdef NOISY_FINAL_SIZE ListTag(stdout); - printf(": metrics=%d,%d ascent=%d descent=%d\n", + PRINTF(": metrics=%d,%d ascent=%d descent=%d\n", aMetrics.width, aMetrics.height, aMetrics.ascent, aMetrics.descent); if (nsnull != aMetrics.maxElementSize) { - printf(" maxElementSize %d,%d\n", - aMetrics.maxElementSize->width, aMetrics.maxElementSize->height); + PRINTF(" maxElementSize %d,%d\n", + aMetrics.maxElementSize->width, aMetrics.maxElementSize->height); } #endif @@ -720,7 +725,7 @@ nsInlineFrame::PushFrames(nsIPresContext* aPresContext, #endif #ifdef NOISY_PUSHING - printf("%p pushing aFromChild %p, disconnecting from prev sib %p\n", + PRINTF("%p pushing aFromChild %p, disconnecting from prev sib %p\n", this, aFromChild, aPrevSibling); #endif // Disconnect aFromChild from its previous sibling diff --git a/mozilla/layout/generic/nsLineBox.cpp b/mozilla/layout/generic/nsLineBox.cpp index 17409c1c8be..d5eb2027cbb 100644 --- a/mozilla/layout/generic/nsLineBox.cpp +++ b/mozilla/layout/generic/nsLineBox.cpp @@ -25,6 +25,16 @@ #include "nsIStyleContext.h" #include "nsLineLayout.h" #include "prprf.h" +#include "nslog.h" +#undef fprintf + +#ifdef VERY_NOISY_REFLOW +NS_IMPL_LOG_ENABLED(nsLineBoxLog) +#else +NS_IMPL_LOG(nsLineBoxLog) +#endif +#define PRINTF NS_LOG_PRINTF(nsLineBoxLog) +#define FLUSH NS_LOG_FLUSH(nsLineBoxLog) #ifdef DEBUG #include "nsISizeOfHandler.h" @@ -427,10 +437,8 @@ nsLineBox::SetCombinedArea(const nsRect& aCombinedArea) } MaybeFreeData(); } -#ifdef VERY_NOISY_REFLOW - printf("nsLB::SetCombinedArea(1) %p (%d, %d, %d, %d)\n", + PRINTF("nsLB::SetCombinedArea(1) %p (%d, %d, %d, %d)\n", this, aCombinedArea.x, aCombinedArea.y, aCombinedArea.width, aCombinedArea.height); -#endif } void @@ -439,10 +447,8 @@ nsLineBox::GetCombinedArea(nsRect* aResult) NS_ASSERTION(aResult, "null arg"); if (aResult) { *aResult = mData ? mData->mCombinedArea : mBounds; -#ifdef VERY_NOISY_REFLOW - printf("nsLB::SetCombinedArea(1) %p (%d, %d, %d, %d)\n", - this, aResult->x, aResult->y, aResult->width, aResult->height); -#endif + PRINTF("nsLB::SetCombinedArea(1) %p (%d, %d, %d, %d)\n", + this, aResult->x, aResult->y, aResult->width, aResult->height); } } diff --git a/mozilla/layout/generic/nsLineLayout.cpp b/mozilla/layout/generic/nsLineLayout.cpp index f57fd41e023..701d9050d91 100644 --- a/mozilla/layout/generic/nsLineLayout.cpp +++ b/mozilla/layout/generic/nsLineLayout.cpp @@ -46,6 +46,11 @@ #include "nsIViewManager.h" #include "nsHTMLAtoms.h" #include "nsTextFragment.h" +#include "nslog.h" + +NS_IMPL_LOG(nsLineLayoutLog) +#define PRINTF NS_LOG_PRINTF(nsLineLayoutLog) +#define FLUSH NS_LOG_FLUSH(nsLineLayoutLog) #ifdef DEBUG #undef NOISY_HORIZONTAL_ALIGN @@ -179,20 +184,20 @@ nsLineLayout::BeginLineReflow(nscoord aX, nscoord aY, #ifdef DEBUG if ((aWidth != NS_UNCONSTRAINEDSIZE) && CRAZY_WIDTH(aWidth)) { nsFrame::ListTag(stdout, mBlockReflowState->frame); - printf(": Init: bad caller: width WAS %d(0x%x)\n", + PRINTF(": Init: bad caller: width WAS %d(0x%x)\n", aWidth, aWidth); aWidth = NS_UNCONSTRAINEDSIZE; } if ((aHeight != NS_UNCONSTRAINEDSIZE) && CRAZY_HEIGHT(aHeight)) { nsFrame::ListTag(stdout, mBlockReflowState->frame); - printf(": Init: bad caller: height WAS %d(0x%x)\n", + PRINTF(": Init: bad caller: height WAS %d(0x%x)\n", aHeight, aHeight); aHeight = NS_UNCONSTRAINEDSIZE; } #endif #ifdef NOISY_REFLOW nsFrame::ListTag(stdout, mBlockReflowState->frame); - printf(": BeginLineReflow: %d,%d,%d,%d impacted=%s %s\n", + PRINTF(": BeginLineReflow: %d,%d,%d,%d impacted=%s %s\n", aX, aY, aWidth, aHeight, aImpactedByFloaters?"true":"false", aIsTopOfPage ? "top-of-page" : ""); @@ -258,7 +263,7 @@ nsLineLayout::EndLineReflow() { #ifdef NOISY_REFLOW nsFrame::ListTag(stdout, mBlockReflowState->frame); - printf(": EndLineReflow: width=%d\n", mRootSpan->mX - mRootSpan->mLeftEdge); + PRINTF(": EndLineReflow: width=%d\n", mRootSpan->mX - mRootSpan->mLeftEdge); #endif FreeSpan(mRootSpan); @@ -271,11 +276,11 @@ nsLineLayout::EndLineReflow() static PRInt32 maxSpansAllocated = NS_LINELAYOUT_NUM_SPANS; static PRInt32 maxFramesAllocated = NS_LINELAYOUT_NUM_FRAMES; if (mSpansAllocated > maxSpansAllocated) { - printf("XXX: saw a line with %d spans\n", mSpansAllocated); + PRINTF("XXX: saw a line with %d spans\n", mSpansAllocated); maxSpansAllocated = mSpansAllocated; } if (mFramesAllocated > maxFramesAllocated) { - printf("XXX: saw a line with %d frames\n", mFramesAllocated); + PRINTF("XXX: saw a line with %d frames\n", mFramesAllocated); maxFramesAllocated = mFramesAllocated; } #endif @@ -293,7 +298,7 @@ nsLineLayout::UpdateBand(nscoord aX, nscoord aY, nsIFrame* aFloaterFrame) { #ifdef REALLY_NOISY_REFLOW - printf("nsLL::UpdateBand %d, %d, %d, %d, frame=%p placedLeft=%s\n will set mImpacted to PR_TRUE\n", + PRINTF("nsLL::UpdateBand %d, %d, %d, %d, frame=%p placedLeft=%s\n will set mImpacted to PR_TRUE\n", aX, aY, aWidth, aHeight, aFloaterFrame, aPlacedLeftFloater?"true":"false"); #endif PerSpanData* psd = mRootSpan; @@ -301,13 +306,13 @@ nsLineLayout::UpdateBand(nscoord aX, nscoord aY, #ifdef DEBUG if ((aWidth != NS_UNCONSTRAINEDSIZE) && CRAZY_WIDTH(aWidth)) { nsFrame::ListTag(stdout, mBlockReflowState->frame); - printf(": UpdateBand: bad caller: width WAS %d(0x%x)\n", + PRINTF(": UpdateBand: bad caller: width WAS %d(0x%x)\n", aWidth, aWidth); aWidth = NS_UNCONSTRAINEDSIZE; } if ((aHeight != NS_UNCONSTRAINEDSIZE) && CRAZY_HEIGHT(aHeight)) { nsFrame::ListTag(stdout, mBlockReflowState->frame); - printf(": UpdateBand: bad caller: height WAS %d(0x%x)\n", + PRINTF(": UpdateBand: bad caller: height WAS %d(0x%x)\n", aHeight, aHeight); aHeight = NS_UNCONSTRAINEDSIZE; } @@ -322,7 +327,7 @@ nsLineLayout::UpdateBand(nscoord aX, nscoord aY, } #ifdef NOISY_REFLOW nsFrame::ListTag(stdout, mBlockReflowState->frame); - printf(": UpdateBand: %d,%d,%d,%d deltaWidth=%d %s floater\n", + PRINTF(": UpdateBand: %d,%d,%d,%d deltaWidth=%d %s floater\n", aX, aY, aWidth, aHeight, deltaWidth, aPlacedLeftFloater ? "left" : "right"); #endif @@ -367,7 +372,7 @@ nsLineLayout::UpdateBand(nscoord aX, nscoord aY, } psd->mContainsFloater = PR_TRUE; #ifdef NOISY_REFLOW - printf(" span %p: oldRightEdge=%d newRightEdge=%d\n", + PRINTF(" span %p: oldRightEdge=%d newRightEdge=%d\n", psd, psd->mRightEdge - deltaWidth, psd->mRightEdge); #endif psd = psd->mParent; @@ -440,7 +445,7 @@ nsLineLayout::BeginSpan(nsIFrame* aFrame, #ifdef NOISY_REFLOW nsFrame::IndentBy(stdout, mSpanDepth+1); nsFrame::ListTag(stdout, aFrame); - printf(": BeginSpan leftEdge=%d rightEdge=%d\n", aLeftEdge, aRightEdge); + PRINTF(": BeginSpan leftEdge=%d rightEdge=%d\n", aLeftEdge, aRightEdge); #endif PerSpanData* psd; @@ -490,7 +495,7 @@ nsLineLayout::EndSpan(nsIFrame* aFrame, #ifdef NOISY_REFLOW nsFrame::IndentBy(stdout, mSpanDepth); nsFrame::ListTag(stdout, aFrame); - printf(": EndSpan width=%d\n", mCurrentSpan->mX - mCurrentSpan->mLeftEdge); + PRINTF(": EndSpan width=%d\n", mCurrentSpan->mX - mCurrentSpan->mLeftEdge); #endif PerSpanData* psd = mCurrentSpan; nscoord width = 0; @@ -569,7 +574,7 @@ nsLineLayout::SplitLineTo(PRInt32 aNewCount) NS_ASSERTION(mCurrentSpan == mRootSpan, "bad linelayout user"); #ifdef REALLY_NOISY_PUSHING - printf("SplitLineTo %d (current count=%d); before:\n", aNewCount, + PRINTF("SplitLineTo %d (current count=%d); before:\n", aNewCount, GetCurrentSpanCount()); DumpPerSpanData(mRootSpan, 1); #endif @@ -601,7 +606,7 @@ nsLineLayout::SplitLineTo(PRInt32 aNewCount) pfd = pfd->mNext; } #ifdef NOISY_PUSHING - printf("SplitLineTo %d (current count=%d); after:\n", aNewCount, + PRINTF("SplitLineTo %d (current count=%d); after:\n", aNewCount, GetCurrentSpanCount()); DumpPerSpanData(mRootSpan, 1); #endif @@ -615,7 +620,7 @@ nsLineLayout::PushFrame(nsIFrame* aFrame) #ifdef REALLY_NOISY_PUSHING nsFrame::IndentBy(stdout, mSpanDepth); - printf("PushFrame %p, before:\n", psd); + PRINTF("PushFrame %p, before:\n", psd); DumpPerSpanData(psd, 1); #endif @@ -643,7 +648,7 @@ nsLineLayout::PushFrame(nsIFrame* aFrame) } #ifdef NOISY_PUSHING nsFrame::IndentBy(stdout, mSpanDepth); - printf("PushFrame: %p after:\n", psd); + PRINTF("PushFrame: %p after:\n", psd); DumpPerSpanData(psd, 1); #endif } @@ -762,9 +767,9 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame, #ifdef REALLY_NOISY_REFLOW nsFrame::IndentBy(stdout, mSpanDepth); - printf("%p: Begin ReflowFrame pfd=%p ", psd, pfd); + PRINTF("%p: Begin ReflowFrame pfd=%p ", psd, pfd); nsFrame::ListTag(stdout, aFrame); - printf("\n"); + PRINTF("\n"); #endif // Compute the available size for the frame. This available width @@ -1027,16 +1032,16 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame, // frame will be reflowed another time. if (!NS_INLINE_IS_BREAK_BEFORE(aReflowStatus)) { if (CRAZY_WIDTH(metrics.width) || CRAZY_HEIGHT(metrics.height)) { - printf("nsLineLayout: "); + PRINTF("nsLineLayout: "); nsFrame::ListTag(stdout, aFrame); - printf(" metrics=%d,%d!\n", metrics.width, metrics.height); + PRINTF(" metrics=%d,%d!\n", metrics.width, metrics.height); } if (mComputeMaxElementSize && ((nscoord(0xdeadbeef) == metrics.maxElementSize->width) || (nscoord(0xdeadbeef) == metrics.maxElementSize->height))) { - printf("nsLineLayout: "); + PRINTF("nsLineLayout: "); nsFrame::ListTag(stdout, aFrame); - printf(" didn't set max-element-size!\n"); + PRINTF(" didn't set max-element-size!\n"); metrics.maxElementSize->width = 0; metrics.maxElementSize->height = 0; } @@ -1047,9 +1052,9 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame, if (mComputeMaxElementSize && ((metrics.maxElementSize->width > metrics.width) || (metrics.maxElementSize->height > metrics.height))) { - printf("nsLineLayout: "); + PRINTF("nsLineLayout: "); nsFrame::ListTag(stdout, aFrame); - printf(": WARNING: maxElementSize=%d,%d > metrics=%d,%d\n", + PRINTF(": WARNING: maxElementSize=%d,%d > metrics=%d,%d\n", metrics.maxElementSize->width, metrics.maxElementSize->height, metrics.width, metrics.height); @@ -1059,9 +1064,9 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame, (metrics.height == nscoord(0xdeadbeef)) || (metrics.ascent == nscoord(0xdeadbeef)) || (metrics.descent == nscoord(0xdeadbeef))) { - printf("nsLineLayout: "); + PRINTF("nsLineLayout: "); nsFrame::ListTag(stdout, aFrame); - printf(" didn't set whad %d,%d,%d,%d!\n", metrics.width, metrics.height, + PRINTF(" didn't set whad %d,%d,%d,%d!\n", metrics.width, metrics.height, metrics.ascent, metrics.descent); } } @@ -1069,9 +1074,9 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame, #ifdef NOISY_MAX_ELEMENT_SIZE if (!NS_INLINE_IS_BREAK_BEFORE(aReflowStatus)) { if (mComputeMaxElementSize) { - printf(" "); + PRINTF(" "); nsFrame::ListTag(stdout, aFrame); - printf(": maxElementSize=%d,%d wh=%d,%d,\n", + PRINTF(": maxElementSize=%d,%d wh=%d,%d,\n", metrics.maxElementSize->width, metrics.maxElementSize->height, metrics.width, metrics.height); @@ -1159,9 +1164,9 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame, #ifdef REALLY_NOISY_REFLOW nsFrame::IndentBy(stdout, mSpanDepth); - printf("End ReflowFrame "); + PRINTF("End ReflowFrame "); nsFrame::ListTag(stdout, aFrame); - printf(" status=%x\n", aReflowStatus); + PRINTF(" status=%x\n", aReflowStatus); #endif return rv; } @@ -1286,9 +1291,9 @@ nsLineLayout::CanPlaceFrame(PerFrameData* pfd, else { nsFrame::ListTag(stdout, mBlockReflowState->frame); } - printf(": aNotSafeToBreak=%s frame=", aNotSafeToBreak ? "true" : "false"); + PRINTF(": aNotSafeToBreak=%s frame=", aNotSafeToBreak ? "true" : "false"); nsFrame::ListTag(stdout, pfd->mFrame); - printf(" frameWidth=%d\n", pfd->mBounds.XMost() + rightMargin - psd->mX); + PRINTF(" frameWidth=%d\n", pfd->mBounds.XMost() + rightMargin - psd->mX); #endif // Set outside to PR_TRUE if the result of the reflow leads to the @@ -1297,7 +1302,7 @@ nsLineLayout::CanPlaceFrame(PerFrameData* pfd, if (!outside) { // If it fits, it fits #ifdef NOISY_CAN_PLACE_FRAME - printf(" ==> inside\n"); + PRINTF(" ==> inside\n"); #endif return PR_TRUE; } @@ -1307,7 +1312,7 @@ nsLineLayout::CanPlaceFrame(PerFrameData* pfd, if (0 == pfd->mMargin.left + pfd->mBounds.width + rightMargin) { // Empty frames always fit right where they are #ifdef NOISY_CAN_PLACE_FRAME - printf(" ==> empty frame fits\n"); + PRINTF(" ==> empty frame fits\n"); #endif return PR_TRUE; } @@ -1318,7 +1323,7 @@ nsLineLayout::CanPlaceFrame(PerFrameData* pfd, pfd->mFrame->GetFrameType(getter_AddRefs(frameType)); if (nsLayoutAtoms::brFrame == frameType.get()) { #ifdef NOISY_CAN_PLACE_FRAME - printf(" ==> BR frame fits\n"); + PRINTF(" ==> BR frame fits\n"); #endif return PR_TRUE; } @@ -1330,12 +1335,12 @@ nsLineLayout::CanPlaceFrame(PerFrameData* pfd, // current frame fits. if (!GetFlag(LL_IMPACTEDBYFLOATERS)) { #ifdef NOISY_CAN_PLACE_FRAME - printf(" ==> not-safe and not-impacted fits: "); + PRINTF(" ==> not-safe and not-impacted fits: "); while (nsnull != psd) { - printf(" ", psd, psd->mX, psd->mLeftEdge); + PRINTF(" ", psd, psd->mX, psd->mLeftEdge); psd = psd->mParent; } - printf("\n"); + PRINTF("\n"); #endif return PR_TRUE; } @@ -1362,7 +1367,7 @@ nsLineLayout::CanPlaceFrame(PerFrameData* pfd, if (pfd->GetFlag(PFD_ISSTICKY)) { #ifdef NOISY_CAN_PLACE_FRAME - printf(" ==> last floater was letter frame && frame is sticky\n"); + PRINTF(" ==> last floater was letter frame && frame is sticky\n"); #endif return PR_TRUE; } @@ -1436,7 +1441,7 @@ nsLineLayout::CanPlaceFrame(PerFrameData* pfd, } #ifdef NOISY_CAN_PLACE_FRAME - printf(" ==> didn't fit\n"); + PRINTF(" ==> didn't fit\n"); #endif aStatus = NS_INLINE_LINE_BREAK_BEFORE(); return PR_FALSE; @@ -1523,13 +1528,13 @@ void nsLineLayout::DumpPerSpanData(PerSpanData* psd, PRInt32 aIndent) { nsFrame::IndentBy(stdout, aIndent); - printf("%p: left=%d x=%d right=%d\n", psd, psd->mLeftEdge, + PRINTF("%p: left=%d x=%d right=%d\n", psd, psd->mLeftEdge, psd->mX, psd->mRightEdge); PerFrameData* pfd = psd->mFirstFrame; while (nsnull != pfd) { nsFrame::IndentBy(stdout, aIndent+1); nsFrame::ListTag(stdout, pfd->mFrame); - printf(" %d,%d,%d,%d\n", pfd->mBounds.x, pfd->mBounds.y, + PRINTF(" %d,%d,%d,%d\n", pfd->mBounds.x, pfd->mBounds.y, pfd->mBounds.width, pfd->mBounds.height); if (pfd->mSpan) { DumpPerSpanData(pfd->mSpan, aIndent + 1); @@ -1689,7 +1694,7 @@ nsLineLayout::VerticalAlignFrames(nsLineBox* aLineBox, lineHeight = mMaxTopBoxHeight; } #ifdef NOISY_VERTICAL_ALIGN - printf(" [line]==> lineHeight=%d baselineY=%d\n", lineHeight, baselineY); + PRINTF(" [line]==> lineHeight=%d baselineY=%d\n", lineHeight, baselineY); #endif // Now position all of the frames in the root span. We will also @@ -1751,9 +1756,9 @@ nsLineLayout::VerticalAlignFrames(nsLineBox* aLineBox, } pfd->mFrame->SetRect(mPresContext, pfd->mBounds); #ifdef NOISY_VERTICAL_ALIGN - printf(" [child of line]"); + PRINTF(" [child of line]"); nsFrame::ListTag(stdout, pfd->mFrame); - printf(": y=%d\n", pfd->mBounds.y); + PRINTF(": y=%d\n", pfd->mBounds.y); #endif if (span) { nscoord distanceFromTop = pfd->mBounds.y - mTopEdge; @@ -1807,9 +1812,9 @@ nsLineLayout::PlaceTopBottomFrames(PerSpanData* psd, } pfd->mFrame->SetRect(mPresContext, pfd->mBounds); #ifdef NOISY_VERTICAL_ALIGN - printf(" "); + PRINTF(" "); nsFrame::ListTag(stdout, pfd->mFrame); - printf(": y=%d dTop=%d [bp.top=%d topLeading=%d]\n", + PRINTF(": y=%d dTop=%d [bp.top=%d topLeading=%d]\n", pfd->mBounds.y, aDistanceFromTop, span ? pfd->mBorderPadding.top : 0, span ? span->mTopLeading : 0); @@ -1828,9 +1833,9 @@ nsLineLayout::PlaceTopBottomFrames(PerSpanData* psd, } pfd->mFrame->SetRect(mPresContext, pfd->mBounds); #ifdef NOISY_VERTICAL_ALIGN - printf(" "); + PRINTF(" "); nsFrame::ListTag(stdout, pfd->mFrame); - printf(": y=%d\n", pfd->mBounds.y); + PRINTF(": y=%d\n", pfd->mBounds.y); #endif break; } @@ -1880,15 +1885,15 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd) (0 == spanFramePFD->mBounds.width) && (0 == spanFramePFD->mBounds.height); #ifdef NOISY_VERTICAL_ALIGN - printf("[%sSpan]", (psd == mRootSpan)?"Root":""); + PRINTF("[%sSpan]", (psd == mRootSpan)?"Root":""); nsFrame::ListTag(stdout, spanFrame); - printf(": preMode=%s strictMode=%s w/h=%d,%d emptyContinuation=%s", + PRINTF(": preMode=%s strictMode=%s w/h=%d,%d emptyContinuation=%s", preMode ? "yes" : "no", InStrictMode() ? "yes" : "no", spanFramePFD->mBounds.width, spanFramePFD->mBounds.height, emptyContinuation ? "yes" : "no"); if (psd != mRootSpan) { - printf(" bp=%d,%d,%d,%d margin=%d,%d,%d,%d", + PRINTF(" bp=%d,%d,%d,%d margin=%d,%d,%d,%d", spanFramePFD->mBorderPadding.top, spanFramePFD->mBorderPadding.right, spanFramePFD->mBorderPadding.bottom, @@ -1898,7 +1903,7 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd) spanFramePFD->mMargin.bottom, spanFramePFD->mMargin.left); } - printf("\n"); + PRINTF("\n"); #endif // Compute the span's mZeroEffectiveSpanBox flag. What we are trying @@ -1968,9 +1973,9 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd) minY = VERTICAL_ALIGN_FRAMES_NO_MINIMUM; maxY = VERTICAL_ALIGN_FRAMES_NO_MAXIMUM; #ifdef NOISY_VERTICAL_ALIGN - printf("[RootSpan]"); + PRINTF("[RootSpan]"); nsFrame::ListTag(stdout, spanFrame); - printf(": pass1 valign frames: topEdge=%d minLineHeight=%d zeroEffectiveSpanBox=%s\n", + PRINTF(": pass1 valign frames: topEdge=%d minLineHeight=%d zeroEffectiveSpanBox=%s\n", mTopEdge, mMinLineHeight, zeroEffectiveSpanBox ? "yes" : "no"); #endif @@ -2017,9 +2022,9 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd) #ifdef NOISY_VERTICAL_ALIGN - printf("[%sSpan]", (psd == mRootSpan)?"Root":""); + PRINTF("[%sSpan]", (psd == mRootSpan)?"Root":""); nsFrame::ListTag(stdout, spanFrame); - printf(": baseLine=%d logicalHeight=%d topLeading=%d h=%d bp=%d,%d zeroEffectiveSpanBox=%s\n", + PRINTF(": baseLine=%d logicalHeight=%d topLeading=%d h=%d bp=%d,%d zeroEffectiveSpanBox=%s\n", baselineY, psd->mLogicalHeight, psd->mTopLeading, spanFramePFD->mBounds.height, spanFramePFD->mBorderPadding.top, spanFramePFD->mBorderPadding.bottom, @@ -2057,15 +2062,15 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd) nsStyleUnit verticalAlignUnit = textStyle->mVerticalAlign.GetUnit(); #ifdef DEBUG if (eStyleUnit_Inherit == verticalAlignUnit) { - printf("XXX: vertical-align: inherit not implemented for "); + PRINTF("XXX: vertical-align: inherit not implemented for "); nsFrame::ListTag(stdout, frame); - printf("\n"); + PRINTF("\n"); } #endif #ifdef NOISY_VERTICAL_ALIGN - printf(" [frame]"); + PRINTF(" [frame]"); nsFrame::ListTag(stdout, frame); - printf(": verticalAlignUnit=%d (enum == %d)\n", + PRINTF(": verticalAlignUnit=%d (enum == %d)\n", verticalAlignUnit, ((eStyleUnit_Enumerated == verticalAlignUnit) ? textStyle->mVerticalAlign.GetIntValue() @@ -2270,7 +2275,7 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd) if (yTop < minY) minY = yTop; if (yBottom > maxY) maxY = yBottom; #ifdef NOISY_VERTICAL_ALIGN - printf(" [frame]raw: a=%d d=%d h=%d bp=%d,%d logical: h=%d leading=%d y=%d minY=%d maxY=%d\n", + PRINTF(" [frame]raw: a=%d d=%d h=%d bp=%d,%d logical: h=%d leading=%d y=%d minY=%d maxY=%d\n", pfd->mAscent, pfd->mDescent, pfd->mBounds.height, pfd->mBorderPadding.top, pfd->mBorderPadding.bottom, logicalHeight, @@ -2332,7 +2337,7 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd) if (applyMinLH) { if ((psd->mX != psd->mLeftEdge) || preMode || foundLI) { #ifdef NOISY_VERTICAL_ALIGN - printf(" [span]==> adjusting min/maxY: currentValues: %d,%d", minY, maxY); + PRINTF(" [span]==> adjusting min/maxY: currentValues: %d,%d", minY, maxY); #endif nscoord minimumLineHeight = mMinLineHeight; nscoord fontAscent, fontHeight; @@ -2352,7 +2357,7 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd) if (yBottom > maxY) maxY = yBottom; #ifdef NOISY_VERTICAL_ALIGN - printf(" new values: %d,%d\n", minY, maxY); + PRINTF(" new values: %d,%d\n", minY, maxY); #endif } else { @@ -2363,7 +2368,7 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd) // XXX Are there other problems with this? #ifdef NOISY_VERTICAL_ALIGN - printf(" [span]==> zapping min/maxY: currentValues: %d,%d newValues: 0,0\n", + PRINTF(" [span]==> zapping min/maxY: currentValues: %d,%d newValues: 0,0\n", minY, maxY); #endif minY = maxY = 0; @@ -2378,8 +2383,8 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd) if ((psd != mRootSpan) && (psd->mZeroEffectiveSpanBox)) { #ifdef NOISY_VERTICAL_ALIGN - printf(" [span]adjusting for zeroEffectiveSpanBox\n"); - printf(" Original: minY=%d, maxY=%d, height=%d, ascent=%d, descent=%d, logicalHeight=%d, topLeading=%d, bottomLeading=%d\n", + PRINTF(" [span]adjusting for zeroEffectiveSpanBox\n"); + PRINTF(" Original: minY=%d, maxY=%d, height=%d, ascent=%d, descent=%d, logicalHeight=%d, topLeading=%d, bottomLeading=%d\n", minY, maxY, spanFramePFD->mBounds.height, spanFramePFD->mAscent, spanFramePFD->mDescent, psd->mLogicalHeight, psd->mTopLeading, psd->mBottomLeading); @@ -2423,7 +2428,7 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd) psd->mBottomLeading += adjust; } #ifdef NOISY_VERTICAL_ALIGN - printf(" New: minY=%d, maxY=%d, height=%d, ascent=%d, descent=%d, logicalHeight=%d, topLeading=%d, bottomLeading=%d\n", + PRINTF(" New: minY=%d, maxY=%d, height=%d, ascent=%d, descent=%d, logicalHeight=%d, topLeading=%d, bottomLeading=%d\n", minY, maxY, spanFramePFD->mBounds.height, spanFramePFD->mAscent, spanFramePFD->mDescent, psd->mLogicalHeight, psd->mTopLeading, psd->mBottomLeading); @@ -2433,7 +2438,7 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd) psd->mMinY = minY; psd->mMaxY = maxY; #ifdef NOISY_VERTICAL_ALIGN - printf(" [span]==> minY=%d maxY=%d delta=%d maxTopBoxHeight=%d maxBottomBoxHeight=%d\n", + PRINTF(" [span]==> minY=%d maxY=%d delta=%d maxTopBoxHeight=%d maxBottomBoxHeight=%d\n", minY, maxY, maxY - minY, maxTopBoxHeight, maxBottomBoxHeight); #endif if (maxTopBoxHeight > mMaxTopBoxHeight) { @@ -2465,9 +2470,9 @@ nsLineLayout::TrimTrailingWhiteSpaceIn(PerSpanData* psd, nsFrame::ListTag(stdout, (psd == mRootSpan ? mBlockReflowState->frame : psd->mFrame->mFrame)); - printf(": attempting trim of "); + PRINTF(": attempting trim of "); nsFrame::ListTag(stdout, pfd->mFrame); - printf("\n"); + PRINTF("\n"); #endif PerSpanData* childSpan = pfd->mSpan; if (childSpan) { @@ -2521,9 +2526,9 @@ nsLineLayout::TrimTrailingWhiteSpaceIn(PerSpanData* psd, nsFrame::ListTag(stdout, (psd == mRootSpan ? mBlockReflowState->frame : psd->mFrame->mFrame)); - printf(": trim of "); + PRINTF(": trim of "); nsFrame::ListTag(stdout, pfd->mFrame); - printf(" returned %d\n", deltaWidth); + PRINTF(" returned %d\n", deltaWidth); #endif if (deltaWidth) { if (pfd->mJustificationNumSpaces > 0) { @@ -2676,7 +2681,7 @@ nsLineLayout::HorizontalAlignFrames(nsRect& aLineBounds, // Don't bother horizontal aligning on pass1 table reflow #ifdef NOISY_HORIZONTAL_ALIGN nsFrame::ListTag(stdout, mBlockReflowState->frame); - printf(": skipping horizontal alignment in pass1 table reflow\n"); + PRINTF(": skipping horizontal alignment in pass1 table reflow\n"); #endif return PR_TRUE; } @@ -2684,7 +2689,7 @@ nsLineLayout::HorizontalAlignFrames(nsRect& aLineBounds, nscoord remainingWidth = availWidth - aLineBounds.width; #ifdef NOISY_HORIZONTAL_ALIGN nsFrame::ListTag(stdout, mBlockReflowState->frame); - printf(": availWidth=%d lineWidth=%d delta=%d\n", + PRINTF(": availWidth=%d lineWidth=%d delta=%d\n", availWidth, aLineBounds.width, remainingWidth); #endif if (remainingWidth > 0) { diff --git a/mozilla/layout/generic/nsObjectFrame.cpp b/mozilla/layout/generic/nsObjectFrame.cpp index 15ceaa9a8f2..38e1dadce5c 100644 --- a/mozilla/layout/generic/nsObjectFrame.cpp +++ b/mozilla/layout/generic/nsObjectFrame.cpp @@ -68,6 +68,11 @@ #include "nsMimeTypes.h" #include "nsObjectFrame.h" +#include "nslog.h" + +NS_IMPL_LOG(nsObjectFrameLog) +#define PRINTF NS_LOG_PRINTF(nsObjectFrameLog) +#define FLUSH NS_LOG_FLUSH(nsObjectFrameLog) static NS_DEFINE_IID(kIDOMMouseListenerIID, NS_IDOMMOUSELISTENER_IID); @@ -2159,7 +2164,7 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetDocumentBase(const char* *result) NS_IMETHODIMP nsPluginInstanceOwner::GetDocumentEncoding(const char* *result) { -printf("instance owner getdocumentencoding called\n"); + PRINTF("instance owner getdocumentencoding called\n"); return NS_ERROR_FAILURE; } @@ -2792,7 +2797,7 @@ static void GetWidgetPosAndClip(nsIWidget* aWidget,nscoord& aAbsX, nscoord& aAbs widget = getter_AddRefs(widget->GetParent()); if (widget == nsnull) { // Don't include the top-level windows offset - // printf("Top level window offset %d %d\n", wx, wy); + // PRINTF("Top level window offset %d %d\n", wx, wy); aAbsX -= wx; aAbsY -= wy; } @@ -2803,9 +2808,9 @@ static void GetWidgetPosAndClip(nsIWidget* aWidget,nscoord& aAbsX, nscoord& aAbs aClipRect.x += aAbsX; aClipRect.y += aAbsY; - //printf("--------------\n"); - //printf("Widget clip X %d Y %d rect %d %d %d %d\n", aAbsX, aAbsY, aClipRect.x, aClipRect.y, aClipRect.width, aClipRect.height ); - //printf("--------------\n"); + //PRINTF("--------------\n"); + //PRINTF("Widget clip X %d Y %d rect %d %d %d %d\n", aAbsX, aAbsY, aClipRect.x, aClipRect.y, aClipRect.width, aClipRect.height ); + //PRINTF("--------------\n"); } diff --git a/mozilla/layout/generic/nsPlaceholderFrame.cpp b/mozilla/layout/generic/nsPlaceholderFrame.cpp index bdb583a9ba6..c12b67b2a05 100644 --- a/mozilla/layout/generic/nsPlaceholderFrame.cpp +++ b/mozilla/layout/generic/nsPlaceholderFrame.cpp @@ -27,6 +27,12 @@ #include "nsIRenderingContext.h" #include "nsIStyleContext.h" #include "nsLayoutAtoms.h" +#include "nslog.h" +#undef fprintf + +NS_IMPL_LOG(nsPlaceholderFrameLog) +#define PRINTF NS_LOG_PRINTF(nsPlaceholderFrameLog) +#define FLUSH NS_LOG_FLUSH(nsPlaceholderFrameLog) nsresult NS_NewPlaceholderFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame) diff --git a/mozilla/layout/generic/nsSelection.cpp b/mozilla/layout/generic/nsSelection.cpp index 0f7d2fcdae7..a3f66a40f30 100644 --- a/mozilla/layout/generic/nsSelection.cpp +++ b/mozilla/layout/generic/nsSelection.cpp @@ -74,6 +74,11 @@ #include "nsIDocument.h" #include "nsISelectionController.h"//for the enums +#include "nslog.h" + +NS_IMPL_LOG(nsSelectionLog) +#define PRINTF NS_LOG_PRINTF(nsSelectionLog) +#define FLUSH NS_LOG_FLUSH(nsSelectionLog) #define STATUS_CHECK_RETURN_MACRO() {if (!mTracker) return NS_ERROR_FAILURE;} //#define DEBUG_TABLE 1 @@ -1243,7 +1248,7 @@ void printRange(nsIDOMRange *aDomRange) { if (!aDomRange) { - printf("NULL nsIDOMRange\n"); + PRINTF("NULL nsIDOMRange\n"); } nsCOMPtr startNode; nsCOMPtr endNode; @@ -1254,7 +1259,7 @@ void printRange(nsIDOMRange *aDomRange) aDomRange->GetEndParent(getter_AddRefs(endNode)); aDomRange->GetEndOffset(&endOffset); - printf("range: 0x%lx\t start: 0x%lx %ld, \t end: 0x%lx,%ld\n", + PRINTF("range: 0x%lx\t start: 0x%lx %ld, \t end: 0x%lx,%ld\n", (unsigned long)aDomRange, (unsigned long)(nsIDOMNode*)startNode, (long)startOffset, (unsigned long)(nsIDOMNode*)endNode, (long)endOffset); @@ -1341,7 +1346,7 @@ nsSelection::HandleTextEvent(nsGUIEvent *aGUIEvent) return NS_ERROR_NULL_POINTER; #ifdef DEBUG_TAGUE - printf("nsSelection: HandleTextEvent\n"); + PRINTF("nsSelection: HandleTextEvent\n"); #endif nsresult result(NS_OK); if (NS_TEXT_EVENT == aGUIEvent->message) { @@ -1838,7 +1843,7 @@ nsSelection::SetMouseDownState(PRBool aState) { // Mouse up kills dragging-table cell selection #ifdef DEBUG_TABLE_SELECTION -printf("SetMouseDownState to FALSE - stopping cell selection\n"); + PRINTF("SetMouseDownState to FALSE - stopping cell selection\n"); #endif mSelectingTableCells = PR_FALSE; mStartSelectedCell = nsnull; @@ -2277,7 +2282,7 @@ nsSelection::HandleTableSelection(nsIContent *aParentContent, PRInt32 aContentOf return NS_OK; } #ifdef DEBUG_TABLE_SELECTION -printf("HandleTableSelection: Dragged into a new column or row\n"); + PRINTF("HandleTableSelection: Dragged into a new column or row\n"); #endif // Continue dragging row or column selection return SelectRowOrColumn(childContent, mSelectingTableCellMode); @@ -2285,7 +2290,7 @@ printf("HandleTableSelection: Dragged into a new column or row\n"); else if (mSelectingTableCellMode == TABLESELECTION_CELL) { #ifdef DEBUG_TABLE_SELECTION -printf("HandleTableSelection: Dragged into a new cell\n"); + PRINTF("HandleTableSelection: Dragged into a new cell\n"); #endif // Clear this to be sure SelectBlockOfCells works correctly mAppendStartSelectedCell = nsnull; @@ -2329,7 +2334,7 @@ printf("HandleTableSelection: Dragged into a new cell\n"); if (mMouseDownState) { #ifdef DEBUG_TABLE_SELECTION -printf("HandleTableSelection: Mouse down event\n"); + PRINTF("HandleTableSelection: Mouse down event\n"); #endif // Clear cell we stored in mouse-down mUnselectCellOnMouseUp = nsnull; @@ -2370,7 +2375,7 @@ printf("HandleTableSelection: Mouse down event\n"); // Remember this cell to (possibly) unselect it on mouseup mUnselectCellOnMouseUp = childContent; #ifdef DEBUG_TABLE_SELECTION -printf("HandleTableSelection: Saving mUnselectCellOnMouseUp\n"); + PRINTF("HandleTableSelection: Saving mUnselectCellOnMouseUp\n"); #endif } else @@ -2422,7 +2427,7 @@ printf("HandleTableSelection: Saving mUnselectCellOnMouseUp\n"); else { #ifdef DEBUG_TABLE_SELECTION -printf("HandleTableSelection: Mouse UP event\n"); + PRINTF("HandleTableSelection: Mouse UP event\n"); #endif // First check if we are extending a block selection PRInt32 rangeCount; @@ -2445,7 +2450,7 @@ printf("HandleTableSelection: Mouse UP event\n"); nsCOMPtr range; PRInt32 offset; #ifdef DEBUG_TABLE_SELECTION -printf("HandleTableSelection: Unselecting mUnselectCellOnMouseUp; rangeCount=%d\n", rangeCount); + PRINTF("HandleTableSelection: Unselecting mUnselectCellOnMouseUp; rangeCount=%d\n", rangeCount); #endif for( PRInt32 i = 0; i < rangeCount; i++) { @@ -2476,7 +2481,7 @@ printf("HandleTableSelection: Unselecting mUnselectCellOnMouseUp; rangeCount=%d\ if (rangeCount == 1) { #ifdef DEBUG_TABLE_SELECTION -printf("HandleTableSelection: Unselecting single selected cell\n"); + PRINTF("HandleTableSelection: Unselecting single selected cell\n"); #endif // This was the only cell selected. // Collapse to "normal" selection inside the cell @@ -2490,7 +2495,7 @@ printf("HandleTableSelection: Unselecting single selected cell\n"); return mDomSelections[index]->Collapse(childNode, 0); } #ifdef DEBUG_TABLE_SELECTION -printf("HandleTableSelection: Removing cell from multi-cell selection\n"); + PRINTF("HandleTableSelection: Removing cell from multi-cell selection\n"); #endif //TODO: Should we try to reassign to a different existing cell? //mStartSelectedCell = nsnull; @@ -2510,7 +2515,7 @@ printf("HandleTableSelection: Removing cell from multi-cell selection\n"); // we may append by using Shift+click in another cell mAppendStartSelectedCell = childContent; #ifdef DEBUG_TABLE_SELECTION -printf("HandleTableSelection: Setting mAppendStartSelectedCell for append block\n"); + PRINTF("HandleTableSelection: Setting mAppendStartSelectedCell for append block\n"); #endif } } @@ -2530,7 +2535,7 @@ nsSelection::SelectBlockOfCells(nsIContent *aEndCell) { // We are appending a new block #ifdef DEBUG_TABLE_SELECTION -printf("SelectBlockOfCells -- using mAppendStartSelectedCell\n"); + PRINTF("SelectBlockOfCells -- using mAppendStartSelectedCell\n"); #endif startCell = mAppendStartSelectedCell; } @@ -2538,14 +2543,14 @@ printf("SelectBlockOfCells -- using mAppendStartSelectedCell\n"); { startCell = mStartSelectedCell; #ifdef DEBUG_TABLE_SELECTION -printf("SelectBlockOfCells -- using mStartSelectedCell\n"); + PRINTF("SelectBlockOfCells -- using mStartSelectedCell\n"); #endif } if (!startCell) { #ifdef DEBUG_TABLE_SELECTION -printf("SelectBlockOfCells -- NO START CELL!\n"); + PRINTF("SelectBlockOfCells -- NO START CELL!\n"); #endif return NS_OK; } @@ -2591,8 +2596,8 @@ printf("SelectBlockOfCells -- NO START CELL!\n"); if (NS_FAILED(result)) return result; #ifdef DEBUG_TABLE_SELECTION -if (!range) -printf("SelectBlockOfCells -- range is null\n"); + if (!range) + PRINTF("SelectBlockOfCells -- range is null\n"); #endif if (range && (curRowIndex < minRowIndex || curRowIndex > maxRowIndex || @@ -3094,7 +3099,7 @@ nsSelection::DeleteFromDocument() else { // Otherwise it's harder, have to find the previous node - printf("Sorry, don't know how to delete across frame boundaries yet\n"); + PRINTF("Sorry, don't know how to delete across frame boundaries yet\n"); return NS_ERROR_NOT_IMPLEMENTED; } } @@ -3126,7 +3131,7 @@ nsSelection::DeleteFromDocument() mDomSelections[index]->Collapse(mDomSelections[index]->FetchAnchorNode(), mDomSelections[index]->FetchAnchorOffset()); #ifdef DEBUG else - printf("Don't know how to set selection back past frame boundary\n"); + PRINTF("Don't know how to set selection back past frame boundary\n"); #endif return NS_OK; @@ -4720,12 +4725,12 @@ nsDOMSelection::Collapse(nsIDOMNode* aParentNode, PRInt32 aOffset) nsAutoString tagString; tag->ToString(tagString); char * tagCString = tagString.ToNewCString(); - printf ("Sel. Collapse to %p %s %d\n", content, tagCString, aOffset); + PRINTF ("Sel. Collapse to %p %s %d\n", content, tagCString, aOffset); delete [] tagCString; } } else { - printf ("Sel. Collapse set to null parent.\n"); + PRINTF ("Sel. Collapse set to null parent.\n"); } #endif @@ -5519,9 +5524,9 @@ nsDOMSelection::Extend(nsIDOMNode* aParentNode, PRInt32 aOffset) DEBUG_OUT_RANGE(range); #if 0 if (eDirNext == mDirection) - printf(" direction = 1 LEFT TO RIGHT\n"); + PRINTF(" direction = 1 LEFT TO RIGHT\n"); else - printf(" direction = 0 RIGHT TO LEFT\n"); + PRINTF(" direction = 0 RIGHT TO LEFT\n"); #endif SetDirection(dir); #ifdef DEBUG_SELECTION @@ -5536,12 +5541,12 @@ nsDOMSelection::Extend(nsIDOMNode* aParentNode, PRInt32 aOffset) nsAutoString tagString; tag->ToString(tagString); char * tagCString = tagString.ToNewCString(); - printf ("Sel. Extend to %p %s %d\n", content, tagCString, aOffset); + PRINTF ("Sel. Extend to %p %s %d\n", content, tagCString, aOffset); delete [] tagCString; } } else { - printf ("Sel. Extend set to null parent.\n"); + PRINTF ("Sel. Extend set to null parent.\n"); } #endif if (!mFrameSelection) @@ -5633,7 +5638,7 @@ nsDOMSelection::ContainsNode(nsIDOMNode* aNode, PRBool aRecursive, PRBool* aYes) nsAutoString name, value; aNode->GetNodeName(name); aNode->GetNodeValue(value); - printf("%s [%s]: %d, %d\n", name.ToNewCString(), value.ToNewCString(), + PRINTF("%s [%s]: %d, %d\n", name.ToNewCString(), value.ToNewCString(), nodeStartsBeforeRange, nodeEndsAfterRange); #endif PRUint16 nodeType; diff --git a/mozilla/layout/generic/nsSpaceManager.cpp b/mozilla/layout/generic/nsSpaceManager.cpp index 9a9f021a10c..6f3c303342b 100644 --- a/mozilla/layout/generic/nsSpaceManager.cpp +++ b/mozilla/layout/generic/nsSpaceManager.cpp @@ -31,6 +31,7 @@ #ifdef DEBUG #include "nsIFrameDebug.h" #endif + static NS_DEFINE_IID(kISpaceManagerIID, NS_ISPACEMANAGER_IID); ///////////////////////////////////////////////////////////////////////////// @@ -923,8 +924,7 @@ nsSpaceManager::List(FILE* out) if (NS_SUCCEEDED(mFrame->QueryInterface(NS_GET_IID(nsIFrameDebug), (void**)&frameDebug))) { frameDebug->GetFrameName(tmp); - fprintf(out, " frame="); - fputs(tmp, out); + fprintf(out, " frame=%s", tmp); fprintf(out, "@%p", mFrame); } } @@ -943,8 +943,7 @@ nsSpaceManager::List(FILE* out) if (NS_SUCCEEDED(band->mFrame->QueryInterface(NS_GET_IID(nsIFrameDebug), (void**)&frameDebug))) { frameDebug->GetFrameName(tmp); - fprintf(out, " frame="); - fputs(tmp, out); + fprintf(out, " frame=%s", tmp); fprintf(out, "@%p", band->mFrame); } } @@ -959,8 +958,7 @@ nsSpaceManager::List(FILE* out) if (NS_SUCCEEDED(frame->QueryInterface(NS_GET_IID(nsIFrameDebug), (void**)&frameDebug))) { frameDebug->GetFrameName(tmp); - fputs(tmp, out); - fprintf(out, "@%p ", frame); + fprintf(out, "%s@%p ", tmp, frame); } } } diff --git a/mozilla/layout/generic/nsSplittableFrame.cpp b/mozilla/layout/generic/nsSplittableFrame.cpp index 6b24487f846..006ef081675 100644 --- a/mozilla/layout/generic/nsSplittableFrame.cpp +++ b/mozilla/layout/generic/nsSplittableFrame.cpp @@ -24,6 +24,12 @@ #include "nsIPresContext.h" #include "nsIStyleContext.h" #include "nsISizeOfHandler.h" +#include "nslog.h" +#undef fprintf + +NS_IMPL_LOG(nsSplittableFrameLog) +#define PRINTF NS_LOG_PRINTF(nsSplittableFrameLog) +#define FLUSH NS_LOG_FLUSH(nsSplittableFrameLog) NS_IMETHODIMP nsSplittableFrame::Init(nsIPresContext* aPresContext, diff --git a/mozilla/layout/generic/nsTextFrame.cpp b/mozilla/layout/generic/nsTextFrame.cpp index 99d63180faa..77279ed4b8b 100644 --- a/mozilla/layout/generic/nsTextFrame.cpp +++ b/mozilla/layout/generic/nsTextFrame.cpp @@ -65,6 +65,12 @@ #include "nsIPref.h" #include "nsIServiceManager.h" +#include "nslog.h" +#undef fprintf + +NS_IMPL_LOG(nsTextFrameLog) +#define PRINTF NS_LOG_PRINTF(nsTextFrameLog) +#define FLUSH NS_LOG_FLUSH(nsTextFrameLog) #ifndef PR_ABS #define PR_ABS(x) ((x) < 0 ? -(x) : (x)) @@ -284,7 +290,7 @@ NS_IMETHODIMP_(void) nsBlinkTimer::Notify(nsITimer *timer) LL_SUB(delta, now, gLastTick); gLastTick = now; PR_snprintf(buf, sizeof(buf), "%lldusec", delta); - printf("%s\n", buf); + PRINTF("%s\n", buf); #endif PRInt32 i, n = mFrames.Count(); @@ -3978,7 +3984,7 @@ nsTextFrame::MeasureText(nsIPresContext* aPresContext, // frame and recorded it as part of the word. #ifdef DEBUG_WORD_WRAPPING ListTag(stdout); - printf(": in word; skipping\n"); + PRINTF(": in word; skipping\n"); #endif lineLayout.ForgetWordFrame(this); } @@ -4009,12 +4015,11 @@ nsTextFrame::MeasureText(nsIPresContext* aPresContext, #ifdef DEBUG_WORD_WRAPPING nsAutoString tmp(aTx.GetWordBuffer(), lastWordLen); ListTag(stdout); - printf(": start='"); - fputs(tmp, stdout); - printf("' lastWordLen=%d baseWidth=%d prevOffset=%d offset=%d next=", + PRINTF(": start='%s", tmp); + PRINTF("' lastWordLen=%d baseWidth=%d prevOffset=%d offset=%d next=", lastWordLen, lastWordWidth, prevOffset, aTextData.mOffset); ListTag(stdout, next); - printf("\n"); + PRINTF("\n"); #endif PRUnichar* pWordBuf = lastWordPtr; PRUint32 wordBufLen = aTx.GetWordBufferLength() - @@ -4069,7 +4074,7 @@ nsTextFrame::MeasureText(nsIPresContext* aPresContext, else { #ifdef NOISY_REFLOW ListTag(stdout); - printf(": look-ahead (didn't fit) x=%d wordWidth=%d lastWordWidth=%d\n", + PRINTF(": look-ahead (didn't fit) x=%d wordWidth=%d lastWordWidth=%d\n", aTextData.mX, wordWidth, lastWordWidth); #endif // The fully joined word won't fit. We need to reduce our @@ -4079,7 +4084,7 @@ nsTextFrame::MeasureText(nsIPresContext* aPresContext, aTextData.mOffset = prevOffset; column = prevColumn; #ifdef DEBUG_WORD_WRAPPING - printf(" x=%d maxWordWidth=%d len=%d\n", aTextData.mX, aTextData.mMaxWordWidth, + PRINTF(" x=%d maxWordWidth=%d len=%d\n", aTextData.mX, aTextData.mMaxWordWidth, aTextData.mOffset - startingOffset); #endif lineLayout.ForgetWordFrames(); @@ -4129,7 +4134,7 @@ nsTextFrame::Reflow(nsIPresContext* aPresContext, DO_GLOBAL_REFLOW_COUNT("nsTextFrame", aReflowState.reason); #ifdef NOISY_REFLOW ListTag(stdout); - printf(": BeginReflow: availableSize=%d,%d\n", + PRINTF(": BeginReflow: availableSize=%d,%d\n", aReflowState.availableWidth, aReflowState.availableHeight); #endif @@ -4267,11 +4272,11 @@ nsTextFrame::Reflow(nsIPresContext* aPresContext, // previous reflow measureText = PR_FALSE; #ifdef NOISY_REFLOW - printf(" => measureText=%s wrapping=%s skipWhitespace=%s", + PRINTF(" => measureText=%s wrapping=%s skipWhitespace=%s", measureText ? "yes" : "no", wrapping ? "yes" : "no", skipWhitespace ? "yes" : "no"); - printf(" realWidth=%d maxWidth=%d\n", + PRINTF(" realWidth=%d maxWidth=%d\n", realWidth, maxWidth); #endif } @@ -4364,7 +4369,7 @@ nsTextFrame::Reflow(nsIPresContext* aPresContext, aMetrics.mBoundingMetrics.descent = aMetrics.descent; aMetrics.mBoundingMetrics.width = aMetrics.width; #ifdef MOZ_MATHML_BOUNDINGMETRICS - printf("nsTextFrame: could not perform GetBoundingMetrics()\n"); + PRINTF("nsTextFrame: could not perform GetBoundingMetrics()\n"); #endif } } @@ -4402,7 +4407,7 @@ nsTextFrame::Reflow(nsIPresContext* aPresContext, #ifdef NOISY_REFLOW ListTag(stdout); - printf(": desiredSize=%d,%d(a=%d/d=%d) status=%x\n", + PRINTF(": desiredSize=%d,%d(a=%d/d=%d) status=%x\n", aMetrics.width, aMetrics.height, aMetrics.ascent, aMetrics.descent, aStatus); #endif @@ -4462,7 +4467,7 @@ nsTextFrame::TrimTrailingWhiteSpace(nsIPresContext* aPresContext, } #ifdef NOISY_TRIM ListTag(stdout); - printf(": trim => %d\n", dw); + PRINTF(": trim => %d\n", dw); #endif if (0 != dw) { mState |= TEXT_TRIMMED_WS; @@ -4506,9 +4511,9 @@ nsTextFrame::ComputeTotalWordWidth(nsIPresContext* aPresContext, nsIContent* content = nsnull; if ((NS_OK == aNextFrame->GetContent(&content)) && (nsnull != content)) { #ifdef DEBUG_WORD_WRAPPING - printf(" next textRun="); + PRINTF(" next textRun="); nsFrame::ListTag(stdout, aNextFrame); - printf("\n"); + PRINTF("\n"); #endif nsITextContent* tc; if (NS_OK == content->QueryInterface(kITextContentIID, (void**)&tc)) { @@ -4526,7 +4531,7 @@ nsTextFrame::ComputeTotalWordWidth(nsIPresContext* aPresContext, NS_RELEASE(content); addedWidth += moreWidth; #ifdef DEBUG_WORD_WRAPPING - printf(" moreWidth=%d (addedWidth=%d) stop=%c\n", moreWidth, + PRINTF(" moreWidth=%d (addedWidth=%d) stop=%c\n", moreWidth, addedWidth, stop?'T':'F'); #endif if (stop) { @@ -4548,7 +4553,7 @@ nsTextFrame::ComputeTotalWordWidth(nsIPresContext* aPresContext, done:; #ifdef DEBUG_WORD_WRAPPING - printf(" total word width=%d\n", aBaseWidth + addedWidth); + PRINTF(" total word width=%d\n", aBaseWidth + addedWidth); #endif return aBaseWidth + addedWidth; } @@ -4643,9 +4648,8 @@ nsTextFrame::ComputeWordFragmentWidth(nsIPresContext* aPresContext, #ifdef DEBUG_WORD_WRAPPING nsAutoString tmp(bp, wordLen); - printf(" fragment='"); - fputs(tmp, stdout); - printf("' width=%d [wordLen=%d contentLen=%d ContentLength=%d]\n", + PRINTF(" fragment='%s", tmp); + PRINTF("' width=%d [wordLen=%d contentLen=%d ContentLength=%d]\n", width, wordLen, contentLen, tx.GetContentLength()); #endif @@ -4732,7 +4736,7 @@ nsTextFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) cons IndentBy(out, aIndent); ListTag(out); #ifdef DEBUG_waterson - fprintf(out, " [parent=%p]", mParent); + FPRINTF(out, " [parent=%p]", mParent); #endif nsIView* view; GetView(aPresContext, &view); @@ -4773,13 +4777,11 @@ nsTextFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) cons aIndent++; IndentBy(out, aIndent); - fputs("\"", out); - fputs(tmp, out); - fputs("\"\n", out); + fprintf(out, "\"%s\"\n", tmp); aIndent--; IndentBy(out, aIndent); - fputs(">\n", out); + fprintf(out, ">\n"); return NS_OK; } diff --git a/mozilla/layout/generic/nsTextTransformer.cpp b/mozilla/layout/generic/nsTextTransformer.cpp index 6297fb2090b..c8b76b5aa98 100644 --- a/mozilla/layout/generic/nsTextTransformer.cpp +++ b/mozilla/layout/generic/nsTextTransformer.cpp @@ -34,6 +34,11 @@ #include "nsUnicharUtilCIID.h" #include "nsICaseConversion.h" #include "prenv.h" +#include "nslog.h" + +NS_IMPL_LOG(nsTextTransformerLog) +#define PRINTF NS_LOG_PRINTF(nsTextTransformerLog) +#define FLUSH NS_LOG_FLUSH(nsTextTransformerLog) nsAutoTextBuffer::nsAutoTextBuffer() : mBuffer(mAutoBuffer), @@ -1414,9 +1419,8 @@ nsTextTransformer::SelfTest(nsILineBreaker* aLineBreaker, // Do forwards test if (gNoisy) { nsAutoString uc2(st->text); - printf("%s forwards test: '", isAsciiTest ? "ascii" : "unicode"); - fputs(uc2, stdout); - printf("'\n"); + PRINTF("%s forwards test: '%s", isAsciiTest ? "ascii" : "unicode", uc2); + PRINTF("'\n"); } tx.Init2(&frag, 0, preModeValue[preMode], NS_STYLE_TEXT_TRANSFORM_NONE); @@ -1425,10 +1429,9 @@ nsTextTransformer::SelfTest(nsILineBreaker* aLineBreaker, while ((bp = tx.GetNextWord(PR_FALSE, &wordLen, &contentLen, &ws, &transformed))) { if (gNoisy) { - nsAutoString tmp(bp, wordLen); - printf(" '"); - fputs(tmp, stdout); - printf("': ws=%s wordLen=%d (%d) contentLen=%d (offset=%d)\n", + nsCAutoString tmp; tmp.AssignWithConversion(bp, wordLen); + PRINTF(" '%s", (const char*)tmp); + PRINTF("': ws=%s wordLen=%d (%d) contentLen=%d (offset=%d)\n", ws ? "yes" : "no", wordLen, *expectedResults, contentLen, tx.mOffset); } @@ -1447,9 +1450,8 @@ nsTextTransformer::SelfTest(nsILineBreaker* aLineBreaker, // Do backwards test if (gNoisy) { nsAutoString uc2(st->text); - printf("%s backwards test: '", isAsciiTest ? "ascii" : "unicode"); - fputs(uc2, stdout); - printf("'\n"); + PRINTF("%s backwards test: '%s", isAsciiTest ? "ascii" : "unicode", uc2); + PRINTF("'\n"); } tx.Init2(&frag, frag.GetLength(), NS_STYLE_WHITESPACE_NORMAL, NS_STYLE_TEXT_TRANSFORM_NONE); @@ -1457,10 +1459,9 @@ nsTextTransformer::SelfTest(nsILineBreaker* aLineBreaker, while ((bp = tx.GetPrevWord(PR_FALSE, &wordLen, &contentLen, &ws))) { --expectedResults; if (gNoisy) { - nsAutoString tmp(bp, wordLen); - printf(" '"); - fputs(tmp, stdout); - printf("': ws=%s wordLen=%d contentLen=%d (offset=%d)\n", + nsCAutoString tmp; tmp.AssignWithConversion(bp, wordLen); + PRINTF(" '%s", (const char*)tmp); + PRINTF("': ws=%s wordLen=%d contentLen=%d (offset=%d)\n", ws ? "yes" : "no", wordLen, contentLen, tx.mOffset); } @@ -1476,7 +1477,7 @@ nsTextTransformer::SelfTest(nsILineBreaker* aLineBreaker, } if (error) { - fprintf(stderr, "nsTextTransformer: self test %d failed\n", testNum); + PRINTF("nsTextTransformer: self test %d failed\n", testNum); } testNum++; } diff --git a/mozilla/layout/html/base/src/nsBlockBandData.cpp b/mozilla/layout/html/base/src/nsBlockBandData.cpp index 97fcfe9a55a..c0faf742d19 100644 --- a/mozilla/layout/html/base/src/nsBlockBandData.cpp +++ b/mozilla/layout/html/base/src/nsBlockBandData.cpp @@ -28,6 +28,11 @@ #include "nsIFrameManager.h" #include "nsLayoutAtoms.h" #include "nsVoidArray.h" +#include "nslog.h" + +NS_IMPL_LOG(nsBlockBandDataLog) +#define PRINTF NS_LOG_PRINTF(nsBlockBandDataLog) +#define FLUSH NS_LOG_FLUSH(nsBlockBandDataLog) nsBlockBandData::nsBlockBandData() : mSpaceManager(nsnull), @@ -82,8 +87,8 @@ nsBlockBandData::GetAvailableSpace(nscoord aY, nsRect& aResult) ComputeAvailSpaceRect(); aResult = mAvailSpace; #ifdef REALLY_NOISY_COMPUTEAVAILSPACERECT - printf("nsBBD %p GetAvailableSpace(%d) returing (%d, %d, %d, %d)\n", - this, aY, aResult.x, aResult.y, aResult.width, aResult.height); + PRINTF("nsBBD %p GetAvailableSpace(%d) returing (%d, %d, %d, %d)\n", + this, aY, aResult.x, aResult.y, aResult.width, aResult.height); #endif return NS_OK; } @@ -144,7 +149,7 @@ void nsBlockBandData::ComputeAvailSpaceRect() { #ifdef REALLY_NOISY_COMPUTEAVAILSPACERECT - printf("nsBlockBandData::ComputeAvailSpaceRect %p with count %d\n", this, mCount); + PRINTF("nsBlockBandData::ComputeAvailSpaceRect %p with count %d\n", this, mCount); #endif if (0 == mCount) { mAvailSpace.x = 0; @@ -173,7 +178,7 @@ nsBlockBandData::ComputeAvailSpaceRect() trapezoid = &mTrapezoids[i]; if (trapezoid->mState != nsBandTrapezoid::Available) { #ifdef REALLY_NOISY_COMPUTEAVAILSPACERECT - printf("band %p checking !Avail trap %p with frame %p\n", this, trapezoid, trapezoid->mFrame); + PRINTF("band %p checking !Avail trap %p with frame %p\n", this, trapezoid, trapezoid->mFrame); #endif const nsStyleDisplay* display; if (nsBandTrapezoid::OccupiedMultiple == trapezoid->mState) { @@ -214,7 +219,7 @@ nsBlockBandData::ComputeAvailSpaceRect() leftFloaters = 1; } #ifdef REALLY_NOISY_COMPUTEAVAILSPACERECT - printf("band %p has floaters %d, %d\n", this, leftFloaters, rightFloaters); + PRINTF("band %p has floaters %d, %d\n", this, leftFloaters, rightFloaters); #endif mLeftFloaters = leftFloaters; mRightFloaters = rightFloaters; @@ -261,7 +266,7 @@ nsBlockBandData::ComputeAvailSpaceRect() mAvailSpace.width = NS_UNCONSTRAINEDSIZE; } #ifdef REALLY_NOISY_COMPUTEAVAILSPACERECT - printf(" ComputeAvailSpaceRect settting state mAvailSpace (%d,%d,%d,%d)\n", + PRINTF(" ComputeAvailSpaceRect settting state mAvailSpace (%d,%d,%d,%d)\n", mAvailSpace.x, mAvailSpace.y, mAvailSpace.width, mAvailSpace.height); #endif @@ -492,11 +497,11 @@ nsBlockBandData::GetMaxElementSize(nsIPresContext* aPresContext, #ifdef DEBUG void nsBlockBandData::List() { - printf("nsBlockBandData %p sm=%p, sm coord = (%d,%d), mSpace = (%d,%d)\n", + PRINTF("nsBlockBandData %p sm=%p, sm coord = (%d,%d), mSpace = (%d,%d)\n", this, mSpaceManager, mSpaceManagerX, mSpaceManagerY, - mSpace.width, mSpace.height); - printf(" availSpace=(%d, %d, %d, %d), floaters l=%d r=%d\n", + mSpace.width, mSpace.height); + PRINTF(" availSpace=(%d, %d, %d, %d), floaters l=%d r=%d\n", mAvailSpace.x, mAvailSpace.y, mAvailSpace.width, mAvailSpace.height, - mLeftFloaters, mRightFloaters); + mLeftFloaters, mRightFloaters); } #endif diff --git a/mozilla/layout/html/base/src/nsBlockFrame.cpp b/mozilla/layout/html/base/src/nsBlockFrame.cpp index c9a7aecd5dc..ff838739002 100644 --- a/mozilla/layout/html/base/src/nsBlockFrame.cpp +++ b/mozilla/layout/html/base/src/nsBlockFrame.cpp @@ -57,6 +57,12 @@ #include "nsSpaceManager.h" #include "prenv.h" #include "plstr.h" +#include "nslog.h" +#undef fprintf + +NS_IMPL_LOG(nsBlockFrameLog) +#define PRINTF NS_LOG_PRINTF(nsBlockFrameLog) +#define FLUSH NS_LOG_FLUSH(nsBlockFrameLog) #ifdef DEBUG @@ -92,14 +98,14 @@ static BlockDebugFlags gFlags[] = { static void ShowDebugFlags() { - printf("Here are the available GECKO_BLOCK_DEBUG_FLAGS:\n"); + PRINTF("Here are the available GECKO_BLOCK_DEBUG_FLAGS:\n"); BlockDebugFlags* bdf = gFlags; BlockDebugFlags* end = gFlags + NUM_DEBUG_FLAGS; for (; bdf < end; bdf++) { - printf(" %s\n", bdf->name); + PRINTF(" %s\n", bdf->name); } - printf("Note: GECKO_BLOCK_DEBUG_FLAGS is a comma seperated list of flag\n"); - printf("names (no whitespace)\n"); + PRINTF("Note: GECKO_BLOCK_DEBUG_FLAGS is a comma seperated list of flag\n"); + PRINTF("names (no whitespace)\n"); } static void @@ -121,7 +127,7 @@ InitDebugFlags() for (; bdf < end; bdf++) { if (PL_strcasecmp(bdf->name, flags) == 0) { *(bdf->on) = PR_TRUE; - printf("nsBlockFrame: setting %s debug flag on\n", bdf->name); + PRINTF("nsBlockFrame: setting %s debug flag on\n", bdf->name); gNoisy = PR_TRUE; found = PR_TRUE; break; @@ -192,17 +198,17 @@ DumpStyleGeneaology(nsIFrame* aFrame, const char* gap) { fputs(gap, stdout); nsFrame::ListTag(stdout, aFrame); - printf(": "); + PRINTF(": "); nsIStyleContext* sc; aFrame->GetStyleContext(&sc); while (nsnull != sc) { nsIStyleContext* psc; - printf("%p ", sc); + PRINTF("%p ", sc); psc = sc->GetParent(); NS_RELEASE(sc); sc = psc; } - printf("\n"); + PRINTF("\n"); } #endif @@ -240,7 +246,7 @@ RecordReflowStatus(PRBool aChildIsBlock, nsReflowStatus aFrameReflowStatus) // Log updates to the status that yield different values if (record[index] != newS) { record[index] = newS; - printf("record(%d): %02x %02x\n", index, record[0], record[1]); + PRINTF("record(%d): %02x %02x\n", index, record[0], record[1]); } } #endif @@ -311,7 +317,7 @@ public: #ifdef DEBUG if (gNoisyReflow) { nsFrame::IndentBy(stdout, gNoiseIndent); - printf("GetAvailableSpace: band=%d,%d,%d,%d count=%d\n", + PRINTF("GetAvailableSpace: band=%d,%d,%d,%d count=%d\n", mAvailSpaceRect.x, mAvailSpaceRect.y, mAvailSpaceRect.width, mAvailSpaceRect.height, mBand.GetTrapezoidCount()); @@ -332,7 +338,7 @@ public: #ifdef DEBUG if (gNoisyReflow) { nsFrame::IndentBy(stdout, gNoiseIndent); - printf("GetAvailableSpace: band=%d,%d,%d,%d count=%d\n", + PRINTF("GetAvailableSpace: band=%d,%d,%d,%d count=%d\n", mAvailSpaceRect.x, mAvailSpaceRect.y, mAvailSpaceRect.width, mAvailSpaceRect.height, mBand.GetTrapezoidCount()); @@ -387,10 +393,10 @@ public: (mMaxElementSize.height != oldSize.height)) { nsFrame::IndentBy(stdout, mBlock->GetDepth()); if (NS_UNCONSTRAINEDSIZE == mReflowState.availableWidth) { - printf("PASS1 "); + PRINTF("PASS1 "); } nsFrame::ListTag(stdout, mBlock); - printf(": old max-element-size=%d,%d new=%d,%d\n", + PRINTF(": old max-element-size=%d,%d new=%d,%d\n", oldSize.width, oldSize.height, mMaxElementSize.width, mMaxElementSize.height); } @@ -400,7 +406,7 @@ public: void UpdateMaximumWidth(nscoord aMaximumWidth) { if (aMaximumWidth > mMaximumWidth) { #ifdef NOISY_MAXIMUM_WIDTH - printf("nsBlockReflowState::UpdateMaximumWidth block %p caching max width %d\n", mBlock, aMaximumWidth); + PRINTF("nsBlockReflowState::UpdateMaximumWidth block %p caching max width %d\n", mBlock, aMaximumWidth); #endif mMaximumWidth = aMaximumWidth; } @@ -427,7 +433,7 @@ public: PRBool IsImpactedByFloater() { #ifdef REALLY_NOISY_REFLOW - printf("nsBlockReflowState::IsImpactedByFloater %p returned %d\n", + PRINTF("nsBlockReflowState::IsImpactedByFloater %p returned %d\n", this, mBand.GetFloaterCount()); #endif return mBand.GetFloaterCount(); @@ -721,7 +727,7 @@ nsBlockReflowState::nsBlockReflowState(const nsHTMLReflowState& aReflowState, SetFlag(BRS_COMPUTEMAXELEMENTSIZE, (nsnull != aMetrics.maxElementSize)); #ifdef NOISY_MAX_ELEMENT_SIZE - printf("BRS: setting compute-MES to %d\n", (nsnull != aMetrics.maxElementSize)); + PRINTF("BRS: setting compute-MES to %d\n", (nsnull != aMetrics.maxElementSize)); #endif mMaxElementSize.SizeTo(0, 0); SetFlag(BRS_COMPUTEMAXWIDTH, @@ -772,7 +778,7 @@ nsBlockReflowState::ComputeBlockAvailSpace(nsIFrame* aFrame, nsRect& aResult) { #ifdef REALLY_NOISY_REFLOW - printf("CBAS frame=%p has floater count %d\n", aFrame, mBand.GetFloaterCount()); + PRINTF("CBAS frame=%p has floater count %d\n", aFrame, mBand.GetFloaterCount()); mBand.List(); #endif aResult.y = mY; @@ -883,7 +889,7 @@ nsBlockReflowState::ComputeBlockAvailSpace(nsIFrame* aFrame, aResult.width = mAvailSpaceRect.width; } #ifdef REALLY_NOISY_REFLOW - printf(" CBAS: result %d %d %d %d\n", aResult.x, aResult.y, aResult.width, aResult.height); + PRINTF(" CBAS: result %d %d %d %d\n", aResult.x, aResult.y, aResult.width, aResult.height); #endif } @@ -902,7 +908,7 @@ nsBlockReflowState::ClearPastFloaters(PRUint8 aBreakType) ClearFloaters(saveY, aBreakType); #ifdef NOISY_FLOATER_CLEARING nsFrame::ListTag(stdout, mBlock); - printf(": ClearPastFloaters: mPrevBottomMargin=%d saveY=%d oldY=%d newY=%d deltaY=%d\n", + PRINTF(": ClearPastFloaters: mPrevBottomMargin=%d saveY=%d oldY=%d newY=%d deltaY=%d\n", mPrevBottomMargin, saveY, saveY - mPrevBottomMargin, mY, mY - saveY); #endif @@ -1012,17 +1018,17 @@ nsBlockReflowState::RecoverStateFrom(nsLineBox* aLine, #ifdef DEBUG if (CRAZY_WIDTH(xmost)) { nsFrame::ListTag(stdout, mBlock); - printf(": WARNING: xmost:%d\n", xmost); + PRINTF(": WARNING: xmost:%d\n", xmost); } #endif #ifdef NOISY_KIDXMOST - printf("%p RecoverState block %p aState.mKidXMost=%d\n", this, mBlock, xmost); + PRINTF("%p RecoverState block %p aState.mKidXMost=%d\n", this, mBlock, xmost); #endif mKidXMost = xmost; } if (GetFlag(BRS_COMPUTEMAXELEMENTSIZE)) { #ifdef NOISY_MAX_ELEMENT_SIZE - printf("nsBlockReflowState::RecoverStateFrom block %p caching max width %d\n", mBlock, aLine->mMaxElementWidth); + PRINTF("nsBlockReflowState::RecoverStateFrom block %p caching max width %d\n", mBlock, aLine->mMaxElementWidth); #endif UpdateMaxElementSize(nsSize(aLine->mMaxElementWidth, aLine->mBounds.height)); } @@ -1030,7 +1036,7 @@ nsBlockReflowState::RecoverStateFrom(nsLineBox* aLine, // If computing the maximum width, then update mMaximumWidth if (GetFlag(BRS_COMPUTEMAXWIDTH)) { #ifdef NOISY_MAXIMUM_WIDTH - printf("nsBlockReflowState::RecoverStateFrom block %p caching max width %d\n", mBlock, aLine->mMaximumWidth); + PRINTF("nsBlockReflowState::RecoverStateFrom block %p caching max width %d\n", mBlock, aLine->mMaximumWidth); #endif UpdateMaximumWidth(aLine->mMaximumWidth); } @@ -1041,9 +1047,9 @@ nsBlockReflowState::RecoverStateFrom(nsLineBox* aLine, aApplyTopMargin = ClearPastFloaters(aLine->GetBreakType()); #ifdef NOISY_VERTICAL_MARGINS nsFrame::ListTag(stdout, mBlock); - printf(": RecoverStateFrom: y=%d child ", mY); + PRINTF(": RecoverStateFrom: y=%d child ", mY); nsFrame::ListTag(stdout, aLine->mFirstChild); - printf(" has clear of %d => %s, mPrevBottomMargin=%d\n", aLine->mBreakType, + PRINTF(" has clear of %d => %s, mPrevBottomMargin=%d\n", aLine->mBreakType, aApplyTopMargin ? "applyTopMargin" : "nope", mPrevBottomMargin); #endif } @@ -1135,10 +1141,10 @@ nsBlockReflowState::RecoverStateFrom(nsLineBox* aLine, nscoord tx, ty; mSpaceManager->GetTranslation(tx, ty); nsFrame::IndentBy(stdout, gNoiseIndent); - printf("RecoverState: txy=%d,%d (%d,%d) ", + PRINTF("RecoverState: txy=%d,%d (%d,%d) ", tx, ty, mSpaceManagerX, mSpaceManagerY); nsFrame::ListTag(stdout, floater); - printf(" r.y=%d finalDeltaY=%d (sum=%d) region={%d,%d,%d,%d}\n", + PRINTF(" r.y=%d finalDeltaY=%d (sum=%d) region={%d,%d,%d,%d}\n", r.y, finalDeltaY, r.y + finalDeltaY, fc->mRegion.x, fc->mRegion.y, fc->mRegion.width, fc->mRegion.height); @@ -1278,7 +1284,7 @@ nsBlockFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) con IndentBy(out, aIndent); ListTag(out); #ifdef DEBUG_waterson - fprintf(out, " [parent=%p]", mParent); + FPRINTF(out, " [parent=%p]", mParent); #endif nsIView* view; GetView(aPresContext, &view); @@ -1508,7 +1514,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, if (gNoisyReflow) { IndentBy(stdout, gNoiseIndent); ListTag(stdout); - printf(": begin reflow type %d availSize=%d,%d computedSize=%d,%d\n", + PRINTF(": begin reflow type %d availSize=%d,%d computedSize=%d,%d\n", aReflowState.reason, aReflowState.availableWidth, aReflowState.availableHeight, aReflowState.mComputedWidth, aReflowState.mComputedHeight); } @@ -1582,7 +1588,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, extern char* nsPresShell_ReflowStackPointerTop; char marker; char* newsp = (char*) ▮ - printf("XXX: frame tree is too deep; approx stack size = %d\n", + PRINTF("XXX: frame tree is too deep; approx stack size = %d\n", nsPresShell_ReflowStackPointerTop - newsp); } #endif @@ -1605,7 +1611,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, nsHTMLReflowState& reflowState = (nsHTMLReflowState&)aReflowState; reflowState.mSpaceManager = spaceManager.get(); #ifdef NOISY_SPACEMANAGER - printf("constructed new space manager %p\n", reflowState.mSpaceManager); + PRINTF("constructed new space manager %p\n", reflowState.mSpaceManager); #endif } @@ -1624,7 +1630,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, case eReflowReason_Initial: #ifdef NOISY_REFLOW_REASON ListTag(stdout); - printf(": reflow=initial\n"); + PRINTF(": reflow=initial\n"); #endif DrainOverflowLines(aPresContext); rv = PrepareInitialReflow(state); @@ -1641,7 +1647,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, aReflowState.reflowCommand->GetType(type); #ifdef NOISY_REFLOW_REASON ListTag(stdout); - printf(": reflow=incremental type=%d\n", type); + PRINTF(": reflow=incremental type=%d\n", type); #endif switch (type) { case nsIReflowCommand::StyleChanged: @@ -1661,12 +1667,12 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, aReflowState.reflowCommand->GetNext(state.mNextRCFrame); #ifdef NOISY_REFLOW_REASON ListTag(stdout); - printf(": reflow=incremental"); + PRINTF(": reflow=incremental"); if (state.mNextRCFrame) { - printf(" next="); + PRINTF(" next="); nsFrame::ListTag(stdout, state.mNextRCFrame); } - printf("\n"); + PRINTF("\n"); #endif // this code does a correct job of propogating incremental reflows (bug 25510) @@ -1724,7 +1730,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, default: #ifdef NOISY_REFLOW_REASON ListTag(stdout); - printf(": reflow=resize (%d)\n", aReflowState.reason); + PRINTF(": reflow=resize (%d)\n", aReflowState.reason); #endif DrainOverflowLines(aPresContext); rv = PrepareResizeReflow(state); @@ -1749,7 +1755,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, } else { #ifdef DEBUG_kipp - ListTag(stdout); printf(": block is not complete\n"); + ListTag(stdout); PRINTF(": block is not complete\n"); #endif } } @@ -1769,7 +1775,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, if (xMost > aMetrics.width) { #ifdef NOISY_FINAL_SIZE ListTag(stdout); - printf(": changing desired width from %d to %d\n", aMetrics.width, xMost); + PRINTF(": changing desired width from %d to %d\n", aMetrics.width, xMost); #endif aMetrics.width = xMost; } @@ -1777,7 +1783,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, if (yMost > aMetrics.height) { #ifdef NOISY_FINAL_SIZE ListTag(stdout); - printf(": changing desired height from %d to %d\n", aMetrics.height, yMost); + PRINTF(": changing desired height from %d to %d\n", aMetrics.height, yMost); #endif aMetrics.height = yMost; } @@ -1810,7 +1816,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, if (NS_BLOCK_SPACE_MGR & mState) { nsHTMLReflowState& reflowState = (nsHTMLReflowState&)aReflowState; #ifdef NOISY_SPACEMANAGER - printf("restoring old space manager %p\n", oldSpaceManager); + PRINTF("restoring old space manager %p\n", oldSpaceManager); #endif reflowState.mSpaceManager = oldSpaceManager; } @@ -1819,7 +1825,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, nsHTMLReflowState& reflowState = (nsHTMLReflowState&)aReflowState; if (reflowState.mSpaceManager) { ListTag(stdout); - printf(": space-manager %p after reflow\n", reflowState.mSpaceManager); + PRINTF(": space-manager %p after reflow\n", reflowState.mSpaceManager); reflowState.mSpaceManager->List(stdout); } #endif @@ -1832,7 +1838,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, // Lots of things could have changed so damage our entire // bounds #ifdef NOISY_BLOCK_INVALIDATE - printf("%p invalidate 1 (%d, %d, %d, %d)\n", + PRINTF("%p invalidate 1 (%d, %d, %d, %d)\n", this, 0, 0, mRect.width, mRect.height); #endif Invalidate(aPresContext, nsRect(0, 0, mRect.width, mRect.height)); @@ -1862,7 +1868,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, damageRect.height = mRect.height; } #ifdef NOISY_BLOCK_INVALIDATE - printf("%p invalidate 2 (%d, %d, %d, %d)\n", + PRINTF("%p invalidate 2 (%d, %d, %d, %d)\n", this, damageRect.x, damageRect.y, damageRect.width, damageRect.height); #endif Invalidate(aPresContext, damageRect); @@ -1889,7 +1895,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, damageRect.height = border.bottom; } #ifdef NOISY_BLOCK_INVALIDATE - printf("%p invalidate 3 (%d, %d, %d, %d)\n", + PRINTF("%p invalidate 3 (%d, %d, %d, %d)\n", this, damageRect.x, damageRect.y, damageRect.width, damageRect.height); #endif Invalidate(aPresContext, damageRect); @@ -1933,23 +1939,23 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, if (gNoisyReflow) { IndentBy(stdout, gNoiseIndent); ListTag(stdout); - printf(": status=%x (%scomplete) metrics=%d,%d carriedMargin=%d", + PRINTF(": status=%x (%scomplete) metrics=%d,%d carriedMargin=%d", aStatus, NS_FRAME_IS_COMPLETE(aStatus) ? "" : "not ", aMetrics.width, aMetrics.height, aMetrics.mCarriedOutBottomMargin); if (mState & NS_FRAME_OUTSIDE_CHILDREN) { - printf(" combinedArea={%d,%d,%d,%d}", + PRINTF(" combinedArea={%d,%d,%d,%d}", aMetrics.mOverflowArea.x, aMetrics.mOverflowArea.y, aMetrics.mOverflowArea.width, aMetrics.mOverflowArea.height); } if (aMetrics.maxElementSize) { - printf(" maxElementSize=%d,%d", + PRINTF(" maxElementSize=%d,%d", aMetrics.maxElementSize->width, aMetrics.maxElementSize->height); } - printf("\n"); + PRINTF("\n"); } if (gLameReflowMetrics) { @@ -1968,12 +1974,12 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, PR_snprintf(buf, sizeof(buf), ": %lld elapsed (%lld per line) (%d lines; %d new lines)", delta, perLineDelta, numLines, ectc - ctc); - printf("%s\n", buf); + PRINTF("%s\n", buf); } #endif #ifdef NOISY_MAX_ELEMENT_SIZE if (aMetrics.maxElementSize) { - printf("block %p returning with maxElementSize=%d,%d\n", this, + PRINTF("block %p returning with maxElementSize=%d,%d\n", this, aMetrics.maxElementSize->width, aMetrics.maxElementSize->height); } @@ -2057,7 +2063,7 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState, const nsMargin& borderPadding = aState.BorderPadding(); #ifdef NOISY_FINAL_SIZE ListTag(stdout); - printf(": mY=%d mIsBottomMarginRoot=%s mPrevBottomMargin=%d bp=%d,%d\n", + PRINTF(": mY=%d mIsBottomMarginRoot=%s mPrevBottomMargin=%d bp=%d,%d\n", aState.mY, aState.GetFlag(BRS_ISBOTTOMMARGINROOT) ? "yes" : "no", aState.mPrevBottomMargin, borderPadding.top, borderPadding.bottom); @@ -2066,7 +2072,7 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState, // Compute final width nscoord maxWidth = 0, maxHeight = 0; #ifdef NOISY_KIDXMOST - printf("%p aState.mKidXMost=%d\n", this, aState.mKidXMost); + PRINTF("%p aState.mKidXMost=%d\n", this, aState.mKidXMost); #endif nscoord minWidth = aState.mKidXMost + borderPadding.right; if (!HaveAutoWidth(aReflowState)) { @@ -2276,8 +2282,8 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState, aMetrics.maxElementSize->width = maxWidth; aMetrics.maxElementSize->height = maxHeight; #ifdef NOISY_MAX_ELEMENT_SIZE - printf ("nsBlockFrame::CFS: %p returning MES %d\n", - this, aMetrics.maxElementSize->width); + PRINTF ("nsBlockFrame::CFS: %p returning MES %d\n", + this, aMetrics.maxElementSize->width); #endif } @@ -2288,12 +2294,12 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState, #ifdef DEBUG_blocks if (CRAZY_WIDTH(aMetrics.width) || CRAZY_HEIGHT(aMetrics.height)) { ListTag(stdout); - printf(": WARNING: desired:%d,%d\n", aMetrics.width, aMetrics.height); + PRINTF(": WARNING: desired:%d,%d\n", aMetrics.width, aMetrics.height); } if (aState.GetFlag(BRS_COMPUTEMAXELEMENTSIZE) && ((maxWidth > aMetrics.width) || (maxHeight > aMetrics.height))) { ListTag(stdout); - printf(": WARNING: max-element-size:%d,%d desired:%d,%d maxSize:%d,%d\n", + PRINTF(": WARNING: max-element-size:%d,%d desired:%d,%d maxSize:%d,%d\n", maxWidth, maxHeight, aMetrics.width, aMetrics.height, aState.mReflowState.availableWidth, aState.mReflowState.availableHeight); @@ -2303,10 +2309,10 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState, if (aState.GetFlag(BRS_COMPUTEMAXELEMENTSIZE)) { IndentBy(stdout, GetDepth()); if (NS_UNCONSTRAINEDSIZE == aState.mReflowState.availableWidth) { - printf("PASS1 "); + PRINTF("PASS1 "); } ListTag(stdout); - printf(": max-element-size:%d,%d desired:%d,%d maxSize:%d,%d\n", + PRINTF(": max-element-size:%d,%d desired:%d,%d maxSize:%d,%d\n", maxWidth, maxHeight, aMetrics.width, aMetrics.height, aState.mReflowState.availableWidth, aState.mReflowState.availableHeight); @@ -2318,7 +2324,7 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState, // We need to add in for the right border/padding aMetrics.mMaximumWidth = aState.mMaximumWidth + borderPadding.right; #ifdef NOISY_MAXIMUM_WIDTH - printf("nsBlockFrame::ComputeFinalSize block %p setting aMetrics.mMaximumWidth to %d\n", this, aMetrics.mMaximumWidth); + PRINTF("nsBlockFrame::ComputeFinalSize block %p setting aMetrics.mMaximumWidth to %d\n", this, aMetrics.mMaximumWidth); #endif } @@ -2368,7 +2374,7 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState, } #ifdef NOISY_COMBINED_AREA ListTag(stdout); - printf(": ca=%d,%d,%d,%d\n", xa, ya, xb-xa, yb-ya); + PRINTF(": ca=%d,%d,%d,%d\n", xa, ya, xb-xa, yb-ya); #endif // If the combined area of our children exceeds our bounding box @@ -2427,7 +2433,7 @@ nsBlockFrame::MarkLineDirty(nsLineBox* aLine, nsLineBox* aPrevLine) if (gNoisyReflow) { IndentBy(stdout, gNoiseIndent); ListTag(stdout); - printf(": mark line %p dirty\n", aLine); + PRINTF(": mark line %p dirty\n", aLine); } #endif @@ -2440,7 +2446,7 @@ nsBlockFrame::MarkLineDirty(nsLineBox* aLine, nsLineBox* aPrevLine) if (gNoisyReflow) { IndentBy(stdout, gNoiseIndent); ListTag(stdout); - printf(": mark prev-line %p dirty\n", aPrevLine); + PRINTF(": mark prev-line %p dirty\n", aPrevLine); } #endif } @@ -2554,7 +2560,7 @@ nsBlockFrame::PrepareResizeReflow(nsBlockReflowState& aState) mStyleContext->GetStyleData(eStyleStruct_Text); IndentBy(stdout, gNoiseIndent); ListTag(stdout); - printf(": marking all lines dirty: reason=%d availWidth=%d textAlign=%d\n", + PRINTF(": marking all lines dirty: reason=%d availWidth=%d textAlign=%d\n", aState.mReflowState.reason, aState.mReflowState.availableWidth, mStyleText->mTextAlign); @@ -2587,7 +2593,7 @@ nsBlockFrame::PrepareResizeReflow(nsBlockReflowState& aState) if (gNoisyReflow) { IndentBy(stdout, gNoiseIndent); ListTag(stdout); - printf(": trying to avoid marking all lines dirty\n"); + PRINTF(": trying to avoid marking all lines dirty\n"); } #endif @@ -2601,8 +2607,8 @@ nsBlockFrame::PrepareResizeReflow(nsBlockReflowState& aState) else { // We can avoid reflowing *some* inline lines in some cases. #ifdef REALLY_NOISY_REFLOW - printf("PrepareResizeReflow thinks line %p is %simpacted by floaters\n", - line, line->IsImpactedByFloater() ? "" : "not "); + PRINTF("PrepareResizeReflow thinks line %p is %simpacted by floaters\n", + line, line->IsImpactedByFloater() ? "" : "not "); #endif if (notWrapping) { // When no-wrap is set then the only line-breaking that @@ -2628,7 +2634,7 @@ nsBlockFrame::PrepareResizeReflow(nsBlockReflowState& aState) #ifdef DEBUG if (gNoisyReflow && !line->IsDirty() && !notWrapping) { IndentBy(stdout, gNoiseIndent + 1); - printf("skipped: line=%p next=%p %s %s %s%s%s breakType=%d xmost=%d\n", + PRINTF("skipped: line=%p next=%p %s %s %s%s%s breakType=%d xmost=%d\n", line, line->mNext, line->IsBlock() ? "block" : "inline", aState.GetFlag(BRS_NOWRAP) ? "no-wrap" : "wrapping", @@ -2779,8 +2785,8 @@ nsBlockFrame::PropogateReflowDamage(nsBlockReflowState& aState, PRBool wasImpactedByFloater = next->IsImpactedByFloater(); PRBool isImpactedByFloater = aState.IsImpactedByFloater() ? PR_TRUE : PR_FALSE; #ifdef REALLY_NOISY_REFLOW - printf("nsBlockFrame::PropogateReflowDamage %p was = %d, is=%d\n", - this, wasImpactedByFloater, isImpactedByFloater); + PRINTF("nsBlockFrame::PropogateReflowDamage %p was = %d, is=%d\n", + this, wasImpactedByFloater, isImpactedByFloater); #endif if (wasImpactedByFloater != isImpactedByFloater) { next->MarkDirty(); @@ -2865,16 +2871,16 @@ nsBlockFrame::ReflowDirtyLines(nsBlockReflowState& aState) aState.mReflowState.reflowCommand->GetType(type); IndentBy(stdout, gNoiseIndent); ListTag(stdout); - printf(": incrementally reflowing dirty lines: type=%s(%d) isInline=%s", + PRINTF(": incrementally reflowing dirty lines: type=%s(%d) isInline=%s", kReflowCommandType[type], type, aState.GetFlag(BRS_ISINLINEINCRREFLOW) ? "true" : "false"); } else { IndentBy(stdout, gNoiseIndent); ListTag(stdout); - printf(": reflowing dirty lines"); + PRINTF(": reflowing dirty lines"); } - printf(" computedWidth=%d\n", aState.mReflowState.mComputedWidth); + PRINTF(" computedWidth=%d\n", aState.mReflowState.mComputedWidth); gNoiseIndent++; } #endif @@ -2902,7 +2908,7 @@ nsBlockFrame::ReflowDirtyLines(nsBlockReflowState& aState) &damageRect : 0); if (incrementalReflow && !damageRect.IsEmpty()) { #ifdef NOISY_BLOCK_INVALIDATE - printf("%p invalidate 4 (%d, %d, %d, %d)\n", + PRINTF("%p invalidate 4 (%d, %d, %d, %d)\n", this, damageRect.x, damageRect.y, damageRect.width, damageRect.height); #endif Invalidate(aState.mPresContext, damageRect); @@ -2919,7 +2925,7 @@ nsBlockFrame::ReflowDirtyLines(nsBlockReflowState& aState) nsRect lca; line->GetCombinedArea(&lca); IndentBy(stdout, gNoiseIndent); - printf("line=%p mY=%d dirty=%s oldBounds={%d,%d,%d,%d} oldCombinedArea={%d,%d,%d,%d} deltaY=%d mPrevBottomMargin=%d\n", + PRINTF("line=%p mY=%d dirty=%s oldBounds={%d,%d,%d,%d} oldCombinedArea={%d,%d,%d,%d} deltaY=%d mPrevBottomMargin=%d\n", line, aState.mY, line->IsDirty() ? "yes" : "no", line->mBounds.x, line->mBounds.y, line->mBounds.width, line->mBounds.height, @@ -2977,7 +2983,7 @@ nsBlockFrame::ReflowDirtyLines(nsBlockReflowState& aState) &damageRect : 0); if (incrementalReflow && !damageRect.IsEmpty()) { #ifdef NOISY_BLOCK_INVALIDATE - printf("%p invalidate 5 (%d, %d, %d, %d)\n", + PRINTF("%p invalidate 5 (%d, %d, %d, %d)\n", this, damageRect.x, damageRect.y, damageRect.width, damageRect.height); #endif Invalidate(aState.mPresContext, damageRect); @@ -2990,7 +2996,7 @@ nsBlockFrame::ReflowDirtyLines(nsBlockReflowState& aState) nsRect lca; line->GetCombinedArea(&lca); IndentBy(stdout, gNoiseIndent); - printf("line=%p mY=%d newBounds={%d,%d,%d,%d} newCombinedArea={%d,%d,%d,%d} deltaY=%d mPrevBottomMargin=%d\n", + PRINTF("line=%p mY=%d newBounds={%d,%d,%d,%d} newCombinedArea={%d,%d,%d,%d} deltaY=%d mPrevBottomMargin=%d\n", line, aState.mY, line->mBounds.x, line->mBounds.y, line->mBounds.width, line->mBounds.height, @@ -3089,7 +3095,7 @@ nsBlockFrame::ReflowDirtyLines(nsBlockReflowState& aState) gNoiseIndent--; IndentBy(stdout, gNoiseIndent); ListTag(stdout); - printf(": done reflowing dirty lines (status=%x)\n", + PRINTF(": done reflowing dirty lines (status=%x)\n", aState.mReflowStatus); } #endif @@ -3154,7 +3160,7 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState, nsRect dirtyRect; dirtyRect.UnionRect(oldCombinedArea, lineCombinedArea); #ifdef NOISY_BLOCK_INVALIDATE - printf("%p invalidate 6 (%d, %d, %d, %d)\n", + PRINTF("%p invalidate 6 (%d, %d, %d, %d)\n", this, dirtyRect.x, dirtyRect.y, dirtyRect.width, dirtyRect.height); #endif Invalidate(aState.mPresContext, dirtyRect); @@ -3174,7 +3180,7 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState, dirtyRect.height = PR_MAX(oldCombinedArea.height, lineCombinedArea.height); #ifdef NOISY_BLOCK_INVALIDATE - printf("%p invalidate 7 (%d, %d, %d, %d)\n", + PRINTF("%p invalidate 7 (%d, %d, %d, %d)\n", this, dirtyRect.x, dirtyRect.y, dirtyRect.width, dirtyRect.height); #endif Invalidate(aState.mPresContext, dirtyRect); @@ -3193,7 +3199,7 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState, lineCombinedArea.YMost()) - dirtyRect.y; #ifdef NOISY_BLOCK_INVALIDATE - printf("%p invalidate 8 (%d, %d, %d, %d)\n", + PRINTF("%p invalidate 8 (%d, %d, %d, %d)\n", this, dirtyRect.x, dirtyRect.y, dirtyRect.width, dirtyRect.height); #endif Invalidate(aState.mPresContext, dirtyRect); @@ -3233,7 +3239,7 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState, // Update the line's maximum width aLine->mMaximumWidth = aLine->mBounds.XMost(); #ifdef NOISY_MAXIMUM_WIDTH - printf("nsBlockFrame::ReflowLine block %p line %p setting aLine.mMaximumWidth to %d\n", + PRINTF("nsBlockFrame::ReflowLine block %p line %p setting aLine.mMaximumWidth to %d\n", this, aLine, aLine->mMaximumWidth); #endif aState.UpdateMaximumWidth(aLine->mMaximumWidth); @@ -3263,7 +3269,7 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState, if (aState.GetFlag(BRS_COMPUTEMAXWIDTH)) { #ifdef NOISY_MAXIMUM_WIDTH - printf("nsBlockFrame::ReflowLine block %p line %p setting aLine.mMaximumWidth to %d\n", + PRINTF("nsBlockFrame::ReflowLine block %p line %p setting aLine.mMaximumWidth to %d\n", this, aLine, aLine->mMaximumWidth); #endif aState.UpdateMaximumWidth(aLine->mMaximumWidth); @@ -3271,7 +3277,7 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState, if (aState.GetFlag(BRS_COMPUTEMAXELEMENTSIZE)) { #ifdef NOISY_MAX_ELEMENT_SIZE - printf("nsBlockFrame::ReflowLine block %p line %p setting aLine.mMaxElementWidth to %d\n", + PRINTF("nsBlockFrame::ReflowLine block %p line %p setting aLine.mMaxElementWidth to %d\n", this, aLine, aLine->mMaxElementWidth); #endif aState.UpdateMaxElementSize(nsSize(aLine->mMaxElementWidth, aLine->mBounds.height)); @@ -3290,11 +3296,11 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState, nsRect dirtyRect; dirtyRect.UnionRect(oldCombinedArea, combinedArea); #ifdef NOISY_BLOCK_INVALIDATE - printf("%p invalidate because %s is true (%d, %d, %d, %d)\n", + PRINTF("%p invalidate because %s is true (%d, %d, %d, %d)\n", this, aDamageDirtyArea ? "aDamageDirtyArea" : "aLine->IsForceInvalidate", dirtyRect.x, dirtyRect.y, dirtyRect.width, dirtyRect.height); if (aLine->IsForceInvalidate()) - printf(" dirty line is %p\n"); + PRINTF(" dirty line is %p\n"); #endif Invalidate(aState.mPresContext, dirtyRect); } @@ -3525,7 +3531,7 @@ nsBlockFrame::UpdateSpaceManager(nsIPresContext* aPresContext, nscoord tx, ty; aSpaceManager->GetTranslation(tx, ty); nsFrame::ListTag(stdout, this); - printf(": UpdateSpaceManager: AddRectRegion: txy=%d,%d {%d,%d,%d,%d}\n", + PRINTF(": UpdateSpaceManager: AddRectRegion: txy=%d,%d {%d,%d,%d,%d}\n", tx, ty, fc->mRegion.x, fc->mRegion.y, fc->mRegion.width, fc->mRegion.height); @@ -3808,9 +3814,9 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState, } #ifdef NOISY_VERTICAL_MARGINS ListTag(stdout); - printf(": y=%d child ", aState.mY); + PRINTF(": y=%d child ", aState.mY); ListTag(stdout, frame); - printf(" has clear of %d => %s, mPrevBottomMargin=%d\n", + PRINTF(" has clear of %d => %s, mPrevBottomMargin=%d\n", breakType, applyTopMargin ? "applyTopMargin" : "nope", aState.mPrevBottomMargin); @@ -3850,7 +3856,7 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState, // Compute the available space for the block aState.GetAvailableSpace(); #ifdef REALLY_NOISY_REFLOW - printf("setting line %p isImpacted to %s\n", aLine, aState.IsImpactedByFloater()?"true":"false"); + PRINTF("setting line %p isImpacted to %s\n", aLine, aState.IsImpactedByFloater()?"true":"false"); #endif PRBool isImpacted = aState.IsImpactedByFloater() ? PR_TRUE : PR_FALSE; aLine->SetLineIsImpactedByFloater(isImpacted); @@ -3974,9 +3980,9 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState, // therefore zero out the running margin value. #ifdef NOISY_VERTICAL_MARGINS ListTag(stdout); - printf(": reflow incomplete, frame="); + PRINTF(": reflow incomplete, frame="); nsFrame::ListTag(stdout, frame); - printf(" prevBottomMargin=%d, setting to zero\n", + PRINTF(" prevBottomMargin=%d, setting to zero\n", aState.mPrevBottomMargin); #endif aState.mPrevBottomMargin = 0; @@ -3984,18 +3990,18 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState, else { #ifdef NOISY_VERTICAL_MARGINS ListTag(stdout); - printf(": reflow complete for "); + PRINTF(": reflow complete for "); nsFrame::ListTag(stdout, frame); - printf(" prevBottomMargin=%d collapsedBottomMargin=%d\n", + PRINTF(" prevBottomMargin=%d collapsedBottomMargin=%d\n", aState.mPrevBottomMargin, collapsedBottomMargin); #endif aState.mPrevBottomMargin = collapsedBottomMargin; } #ifdef NOISY_VERTICAL_MARGINS ListTag(stdout); - printf(": frame="); + PRINTF(": frame="); nsFrame::ListTag(stdout, frame); - printf(" carriedOutBottomMargin=%d collapsedBottomMargin=%d => %d\n", + PRINTF(" carriedOutBottomMargin=%d collapsedBottomMargin=%d => %d\n", aLine->GetCarriedOutBottomMargin(), collapsedBottomMargin, aState.mPrevBottomMargin); #endif @@ -4020,8 +4026,8 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState, const nsMargin& margin = brc.GetMargin(); aLine->mMaximumWidth += margin.left + margin.right; #ifdef NOISY_MAXIMUM_WIDTH - printf("nsBlockFrame::ReflowBlockFrame parent block %p line %p aLine->mMaximumWidth set to brc.GetMaximumWidth %d, updating aState.mMaximumWidth\n", - this, aLine, aLine->mMaximumWidth); + PRINTF("nsBlockFrame::ReflowBlockFrame parent block %p line %p aLine->mMaximumWidth set to brc.GetMaximumWidth %d, updating aState.mMaximumWidth\n", + this, aLine, aLine->mMaximumWidth); #endif aState.UpdateMaximumWidth(aLine->mMaximumWidth); @@ -4132,7 +4138,7 @@ nsBlockFrame::ReflowInlineFrames(nsBlockReflowState& aState, spins++; if (1000 == spins) { ListTag(stdout); - printf(": yikes! spinning on a line over 1000 times!\n"); + PRINTF(": yikes! spinning on a line over 1000 times!\n"); NS_ABORT(); } #endif @@ -4204,7 +4210,7 @@ nsBlockFrame::DoReflowInlineFrames(nsBlockReflowState& aState, PRBool impactedByFloaters = aState.IsImpactedByFloater() ? PR_TRUE : PR_FALSE; aLine->SetLineIsImpactedByFloater(impactedByFloaters); #ifdef REALLY_NOISY_REFLOW - printf("nsBlockFrame::DoReflowInlineFrames %p impacted = %d\n", + PRINTF("nsBlockFrame::DoReflowInlineFrames %p impacted = %d\n", this, impactedByFloaters); #endif @@ -4346,9 +4352,9 @@ nsBlockFrame::ReflowInlineFrame(nsBlockReflowState& aState, PRBool reflowingFirstLetter = aLineLayout.GetFirstLetterStyleOK(); #ifdef NOISY_FIRST_LETTER ListTag(stdout); - printf(": reflowing "); + PRINTF(": reflowing "); nsFrame::ListTag(stdout, aFrame); - printf(" reflowingFirstLetter=%s\n", reflowingFirstLetter ? "on" : "off"); + PRINTF(" reflowingFirstLetter=%s\n", reflowingFirstLetter ? "on" : "off"); #endif // Remember if we have a percentage aware child on this line @@ -4371,7 +4377,7 @@ nsBlockFrame::ReflowInlineFrame(nsBlockReflowState& aState, } #ifdef REALLY_NOISY_REFLOW_CHILD nsFrame::ListTag(stdout, aFrame); - printf(": status=%x\n", frameReflowStatus); + PRINTF(": status=%x\n", frameReflowStatus); #endif #if defined(REFLOW_STATUS_COVERAGE) @@ -4555,14 +4561,14 @@ nsBlockFrame::SplitLine(nsBlockReflowState& aState, #ifdef DEBUG if (gNoisyReflow) { nsFrame::IndentBy(stdout, gNoiseIndent); - printf("split line: from line=%p pushCount=%d aFrame=", aLine, pushCount); + PRINTF("split line: from line=%p pushCount=%d aFrame=", aLine, pushCount); if (aFrame) { nsFrame::ListTag(stdout, aFrame); } else { - printf("(null)"); + PRINTF("(null)"); } - printf("\n"); + PRINTF("\n"); if (gReallyNoisyReflow) { aLine->List(aState.mPresContext, stdout, gNoiseIndent+1); } @@ -4693,8 +4699,8 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState, lastHeight = aLine->mBounds.y; if (abs(aLine->mBounds.y - lastHeight) > CRAZY_H/10) { nsFrame::ListTag(stdout); - printf(": line=%p y=%d line.bounds.height=%d\n", - aLine, aLine->mBounds.y, aLine->mBounds.height); + PRINTF(": line=%p y=%d line.bounds.height=%d\n", + aLine, aLine->mBounds.y, aLine->mBounds.height); } } else { @@ -4775,10 +4781,10 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState, #ifdef NOISY_MAX_ELEMENT_SIZE IndentBy(stdout, GetDepth()); if (NS_UNCONSTRAINEDSIZE == aState.mReflowState.availableWidth) { - printf("PASS1 "); + PRINTF("PASS1 "); } ListTag(stdout); - printf(": line.floaters=%s band.floaterCount=%d\n", + PRINTF(": line.floaters=%s band.floaterCount=%d\n", //aLine->mFloaters.NotEmpty() ? "yes" : "no", aState.mHaveRightFloaters ? "(have right floaters)" : "", aState.mBand.GetFloaterCount()); @@ -4801,8 +4807,8 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState, // incremental reflow aLine->mMaxElementWidth = maxElementSize.width; #ifdef NOISY_MAX_ELEMENT_SIZE - printf ("nsBlockFrame::PlaceLine: %p setting MES for line %p to %d\n", - this, aLine, maxElementSize.width); + PRINTF ("nsBlockFrame::PlaceLine: %p setting MES for line %p to %d\n", + this, aLine, maxElementSize.width); #endif } @@ -4830,7 +4836,7 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState, aLine->GetCombinedArea(&lineCombinedArea); #ifdef NOISY_COMBINED_AREA ListTag(stdout); - printf(": lineCA=%d,%d,%d,%d floaterCA=%d,%d,%d,%d\n", + PRINTF(": lineCA=%d,%d,%d,%d floaterCA=%d,%d,%d,%d\n", lineCombinedArea.x, lineCombinedArea.y, lineCombinedArea.width, lineCombinedArea.height, aState.mFloaterCombinedArea.x, aState.mFloaterCombinedArea.y, @@ -4851,7 +4857,7 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState, // most edge of all the right floaters. Therefore, to accomplish our goal // all we do is set that X value to the lines XMost value. #ifdef NOISY_COMBINED_AREA - printf(" ==> rightFloaterCA=%d,%d,%d,%d lineXMost=%d\n", + PRINTF(" ==> rightFloaterCA=%d,%d,%d,%d lineXMost=%d\n", aState.mRightFloaterCombinedArea.x, aState.mRightFloaterCombinedArea.y, aState.mRightFloaterCombinedArea.width, @@ -4870,7 +4876,7 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState, } aLine->SetCombinedArea(lineCombinedArea); #ifdef NOISY_COMBINED_AREA - printf(" ==> final lineCA=%d,%d,%d,%d\n", + PRINTF(" ==> final lineCA=%d,%d,%d,%d\n", lineCombinedArea.x, lineCombinedArea.y, lineCombinedArea.width, lineCombinedArea.height); #endif @@ -4903,10 +4909,10 @@ nsBlockFrame::ComputeLineMaxElementSize(nsBlockReflowState& aState, #ifdef NOISY_MAX_ELEMENT_SIZE IndentBy(stdout, GetDepth()); if (NS_UNCONSTRAINEDSIZE == aState.mReflowState.availableWidth) { - printf("PASS1 "); + PRINTF("PASS1 "); } ListTag(stdout); - printf(": maxFloaterSize=%d,%d\n", maxWidth, maxHeight); + PRINTF(": maxFloaterSize=%d,%d\n", maxWidth, maxHeight); #endif // If the floaters are wider than the content, then use the maximum @@ -4933,8 +4939,8 @@ nsBlockFrame::ComputeLineMaxElementSize(nsBlockReflowState& aState, } } #ifdef NOISY_MAX_ELEMENT_SIZE - printf ("nsBlockFrame::ComputeLineMaxElementSize: %p returning MES %d\n", - this, aMaxElementSize->width); + PRINTF ("nsBlockFrame::ComputeLineMaxElementSize: %p returning MES %d\n", + this, aMaxElementSize->width); #endif } @@ -4960,8 +4966,8 @@ nsBlockFrame::PostPlaceLine(nsBlockReflowState& aState, // incremental reflow aLine->mMaxElementWidth = aMaxElementSize.width; #ifdef NOISY_MAX_ELEMENT_SIZE - printf ("nsBlockFrame::PostPlaceLine: %p setting line %p MES %d\n", - this, aLine, aMaxElementSize.width); + PRINTF ("nsBlockFrame::PostPlaceLine: %p setting line %p MES %d\n", + this, aLine, aMaxElementSize.width); #endif } @@ -4970,7 +4976,7 @@ nsBlockFrame::PostPlaceLine(nsBlockReflowState& aState, // calculate the maximum width if (aState.GetFlag(BRS_UNCONSTRAINEDWIDTH)) { #ifdef NOISY_MAXIMUM_WIDTH - printf("nsBlockFrame::PostPlaceLine during UC Reflow of block %p line %p caching max width %d\n", + PRINTF("nsBlockFrame::PostPlaceLine during UC Reflow of block %p line %p caching max width %d\n", this, aLine, aLine->mBounds.XMost()); #endif aLine->mMaximumWidth = aLine->mBounds.XMost(); @@ -4981,7 +4987,7 @@ nsBlockFrame::PostPlaceLine(nsBlockReflowState& aState, #ifdef DEBUG if (CRAZY_WIDTH(xmost)) { ListTag(stdout); - printf(": line=%p xmost=%d\n", aLine, xmost); + PRINTF(": line=%p xmost=%d\n", aLine, xmost); } #endif // If we're shrink wrapping our width and the line was wrapped, @@ -4989,13 +4995,13 @@ nsBlockFrame::PostPlaceLine(nsBlockReflowState& aState, if (aState.GetFlag(BRS_SHRINKWRAPWIDTH) && aLine->IsLineWrapped()) { aState.mKidXMost = aState.BorderPadding().left + aState.mContentArea.width; #ifdef NOISY_KIDXMOST - printf("%p PostPlaceLine A aState.mKidXMost=%d\n", this, aState.mKidXMost); + PRINTF("%p PostPlaceLine A aState.mKidXMost=%d\n", this, aState.mKidXMost); #endif } else if (xmost > aState.mKidXMost) { aState.mKidXMost = xmost; #ifdef NOISY_KIDXMOST - printf("%p PostPlaceLine B aState.mKidXMost=%d\n", this, aState.mKidXMost); + PRINTF("%p PostPlaceLine B aState.mKidXMost=%d\n", this, aState.mKidXMost); #endif } } @@ -5205,13 +5211,13 @@ nsBlockFrame::AppendFrames(nsIPresContext* aPresContext, // Add frames after the last child #ifdef NOISY_REFLOW_REASON ListTag(stdout); - printf(": append "); + PRINTF(": append "); nsFrame::ListTag(stdout, aFrameList); if (lastKid) { - printf(" after "); + PRINTF(" after "); nsFrame::ListTag(stdout, lastKid); } - printf("\n"); + PRINTF("\n"); #endif nsresult rv = AddFrames(aPresContext, aFrameList, lastKid); if (NS_SUCCEEDED(rv)) { @@ -5244,13 +5250,13 @@ nsBlockFrame::InsertFrames(nsIPresContext* aPresContext, #ifdef NOISY_REFLOW_REASON ListTag(stdout); - printf(": insert "); + PRINTF(": insert "); nsFrame::ListTag(stdout, aFrameList); if (aPrevFrame) { - printf(" after "); + PRINTF(" after "); nsFrame::ListTag(stdout, aPrevFrame); } - printf("\n"); + PRINTF("\n"); #endif nsresult rv = AddFrames(aPresContext, aFrameList, aPrevFrame); if (NS_SUCCEEDED(rv)) { @@ -5387,9 +5393,9 @@ nsBlockFrame::RemoveFrame(nsIPresContext* aPresContext, #ifdef NOISY_REFLOW_REASON ListTag(stdout); - printf(": remove "); + PRINTF(": remove "); nsFrame::ListTag(stdout, aOldFrame); - printf("\n"); + PRINTF("\n"); #endif if (nsLayoutAtoms::absoluteList == aListName) { @@ -5516,10 +5522,10 @@ nsBlockFrame::DoRemoveFrame(nsIPresContext* aPresContext, nsSplittableFrame::RemoveFromFlow(aDeletedFrame); } #ifdef NOISY_REMOVE_FRAME - printf("DoRemoveFrame: prevLine=%p line=%p frame=", + PRINTF("DoRemoveFrame: prevLine=%p line=%p frame=", prevLine, line); nsFrame::ListTag(stdout, aDeletedFrame); - printf(" prevSibling=%p nextInFlow=%p\n", prevSibling, nextInFlow); + PRINTF(" prevSibling=%p nextInFlow=%p\n", prevSibling, nextInFlow); #endif aDeletedFrame->Destroy(aPresContext); aDeletedFrame = nextInFlow; @@ -5537,7 +5543,7 @@ nsBlockFrame::DoRemoveFrame(nsIPresContext* aPresContext, nsRect lineCombinedArea; line->GetCombinedArea(&lineCombinedArea); #ifdef NOISY_BLOCK_INVALIDATE - printf("%p invalidate 10 (%d, %d, %d, %d)\n", + PRINTF("%p invalidate 10 (%d, %d, %d, %d)\n", this, lineCombinedArea.x, lineCombinedArea.y, lineCombinedArea.width, lineCombinedArea.height); #endif Invalidate(aPresContext, lineCombinedArea); @@ -5622,11 +5628,11 @@ nsBlockFrame::ReflowFloater(nsBlockReflowState& aState, nsMargin& aComputedOffsetsResult) { #ifdef NOISY_FLOATER - printf("Reflow Floater %p in parent %p, availSpace(%d,%d,%d,%d)\n", + PRINTF("Reflow Floater %p in parent %p, availSpace(%d,%d,%d,%d)\n", aPlaceholder->GetOutOfFlowFrame(), this, aState.mAvailSpaceRect.x, aState.mAvailSpaceRect.y, aState.mAvailSpaceRect.width, aState.mAvailSpaceRect.height - ); + ); #endif // XXX update this just aState.GetAvailableSpace(); @@ -5697,7 +5703,7 @@ nsBlockFrame::ReflowFloater(nsBlockReflowState& aState, aState.StoreMaxElementSize(floater, mes); } #ifdef NOISY_FLOATER - printf("end ReflowFloater %p, sized to %d,%d\n", floater, metrics.width, metrics.height); + PRINTF("end ReflowFloater %p, sized to %d,%d\n", floater, metrics.width, metrics.height); #endif return NS_OK; } @@ -6043,7 +6049,7 @@ nsBlockReflowState::PlaceFloater(nsFloaterCache* aFloaterCache, nscoord tx, ty; mSpaceManager->GetTranslation(tx, ty); nsFrame::ListTag(stdout, mBlock); - printf(": PlaceFloater: AddRectRegion: txy=%d,%d (%d,%d) {%d,%d,%d,%d}\n", + PRINTF(": PlaceFloater: AddRectRegion: txy=%d,%d (%d,%d) {%d,%d,%d,%d}\n", tx, ty, mSpaceManagerX, mSpaceManagerY, aFloaterCache->mRegion.x, aFloaterCache->mRegion.y, aFloaterCache->mRegion.width, aFloaterCache->mRegion.height); @@ -6102,9 +6108,9 @@ nsBlockReflowState::PlaceFloater(nsFloaterCache* aFloaterCache, nsRect r; floater->GetRect(r); nsFrame::IndentBy(stdout, gNoiseIndent); - printf("placed floater: "); + PRINTF("placed floater: "); ((nsFrame*)floater)->ListTag(stdout); - printf(" %d,%d,%d,%d\n", r.x, r.y, r.width, r.height); + PRINTF(" %d,%d,%d,%d\n", r.x, r.y, r.width, r.height); } #endif } @@ -6121,9 +6127,9 @@ nsBlockReflowState::PlaceBelowCurrentLineFloaters(nsFloaterCacheList& aList) #ifdef DEBUG if (gNoisyReflow) { nsFrame::IndentBy(stdout, gNoiseIndent); - printf("placing bcl floater: "); + PRINTF("placing bcl floater: "); nsFrame::ListTag(stdout, fc->mPlaceholder->GetOutOfFlowFrame()); - printf("\n"); + PRINTF("\n"); } #endif mBlock->ReflowFloater(*this, fc->mPlaceholder, fc->mCombinedArea, @@ -6143,13 +6149,13 @@ nsBlockReflowState::ClearFloaters(nscoord aY, PRUint8 aBreakType) #ifdef DEBUG if (gNoisyReflow) { nsFrame::IndentBy(stdout, gNoiseIndent); - printf("clear floaters: in: mY=%d aY=%d(%d)\n", + PRINTF("clear floaters: in: mY=%d aY=%d(%d)\n", mY, aY, aY - BorderPadding().top); } #endif #ifdef NOISY_FLOATER_CLEARING - printf("nsBlockReflowState::ClearFloaters: aY=%d breakType=%dn", + PRINTF("nsBlockReflowState::ClearFloaters: aY=%d breakType=%dn", aY, aBreakType); mSpaceManager->List(stdout); #endif @@ -6161,7 +6167,7 @@ nsBlockReflowState::ClearFloaters(nscoord aY, PRUint8 aBreakType) #ifdef DEBUG if (gNoisyReflow) { nsFrame::IndentBy(stdout, gNoiseIndent); - printf("clear floaters: out: mY=%d(%d)\n", mY, mY - bp.top); + PRINTF("clear floaters: out: mY=%d(%d)\n", mY, mY - bp.top); } #endif } @@ -6237,7 +6243,7 @@ nsBlockFrame::Paint(nsIPresContext* aPresContext, ComputeCombinedArea(mLines, mRect.width, mRect.height, ca); nsFrame::IndentBy(stdout, depth); ListTag(stdout); - printf(": bounds=%d,%d,%d,%d dirty=%d,%d,%d,%d ca=%d,%d,%d,%d\n", + PRINTF(": bounds=%d,%d,%d,%d dirty=%d,%d,%d,%d ca=%d,%d,%d,%d\n", mRect.x, mRect.y, mRect.width, mRect.height, aDirtyRect.x, aDirtyRect.y, aDirtyRect.width, aDirtyRect.height, ca.x, ca.y, ca.width, ca.height); @@ -6390,7 +6396,7 @@ nsBlockFrame::PaintChildren(nsIPresContext* aPresContext, nsRect lineCombinedArea; line->GetCombinedArea(&lineCombinedArea); nsFrame::IndentBy(stdout, depth+1); - printf("draw line=%p bounds=%d,%d,%d,%d ca=%d,%d,%d,%d\n", + PRINTF("draw line=%p bounds=%d,%d,%d,%d ca=%d,%d,%d,%d\n", line, line->mBounds.x, line->mBounds.y, line->mBounds.width, line->mBounds.height, lineCombinedArea.x, lineCombinedArea.y, @@ -6415,7 +6421,7 @@ nsBlockFrame::PaintChildren(nsIPresContext* aPresContext, nsRect lineCombinedArea; line->GetCombinedArea(&lineCombinedArea); nsFrame::IndentBy(stdout, depth+1); - printf("skip line=%p bounds=%d,%d,%d,%d ca=%d,%d,%d,%d\n", + PRINTF("skip line=%p bounds=%d,%d,%d,%d ca=%d,%d,%d,%d\n", line, line->mBounds.x, line->mBounds.y, line->mBounds.width, line->mBounds.height, lineCombinedArea.x, lineCombinedArea.y, @@ -6450,7 +6456,7 @@ nsBlockFrame::PaintChildren(nsIPresContext* aPresContext, ": %lld elapsed (%lld per line) lines=%d drawn=%d skip=%d", delta, deltaPerLine, numLines, drawnLines, numLines - drawnLines); - printf("%s\n", buf); + PRINTF("%s\n", buf); } #endif } @@ -6880,7 +6886,7 @@ nsBlockFrame::SetInitialChildList(nsIPresContext* aPresContext, mState |= NS_BLOCK_HAS_FIRST_LETTER_STYLE; #ifdef NOISY_FIRST_LETTER ListTag(stdout); - printf(": first-letter style found\n"); + PRINTF(": first-letter style found\n"); #endif NS_RELEASE(firstLetterStyle); } diff --git a/mozilla/layout/html/base/src/nsBlockReflowContext.cpp b/mozilla/layout/html/base/src/nsBlockReflowContext.cpp index 5cda9fdd24f..decdaef4ac6 100644 --- a/mozilla/layout/html/base/src/nsBlockReflowContext.cpp +++ b/mozilla/layout/html/base/src/nsBlockReflowContext.cpp @@ -34,6 +34,11 @@ #include "nsIDOMHTMLBodyElement.h" #include "nsLayoutAtoms.h" #include "nsCOMPtr.h" +#include "nslog.h" + +NS_IMPL_LOG(nsBlockReflowContextLog) +#define PRINTF NS_LOG_PRINTF(nsBlockReflowContextLog) +#define FLUSH NS_LOG_FLUSH(nsBlockReflowContextLog) #ifdef NS_DEBUG #undef NOISY_MAX_ELEMENT_SIZE @@ -111,7 +116,7 @@ nsBlockReflowContext::ComputeCollapsedTopMargin(nsIPresContext* aPresContext, #ifdef NOISY_VERTICAL_MARGINS nsFrame::ListTag(stdout, aRS.frame); - printf(": topMargin=%d generationalTopMargin=%d => %d\n", + PRINTF(": topMargin=%d generationalTopMargin=%d => %d\n", topMargin, generationalTopMargin, collapsedTopMargin); #endif @@ -418,9 +423,9 @@ nsBlockReflowContext::DoReflowBlock(nsHTMLReflowState &aReflowState, #ifdef NOISY_VERTICAL_MARGINS nsFrame::ListTag(stdout, mOuterReflowState.frame); - printf(": reflowing "); + PRINTF(": reflowing "); nsFrame::ListTag(stdout, aFrame); - printf(" prevBottomMargin=%d, collapsedTopMargin=%d => %d\n", + PRINTF(" prevBottomMargin=%d, collapsedTopMargin=%d => %d\n", aPrevBottomMargin, topMargin, MaxMargin(topMargin, aPrevBottomMargin)); #endif @@ -547,7 +552,7 @@ nsBlockReflowContext::DoReflowBlock(nsHTMLReflowState &aReflowState, // Update the reflow metrics with the maximum width mMetrics.mMaximumWidth = mMetrics.width; #ifdef NOISY_REFLOW - printf("*** nsBlockReflowContext::ReflowBlock block %p returning max width %d\n", + PRINTF("*** nsBlockReflowContext::ReflowBlock block %p returning max width %d\n", aFrame, mMetrics.mMaximumWidth); #endif // The second reflow is just as a resize reflow with the constrained @@ -564,16 +569,16 @@ nsBlockReflowContext::DoReflowBlock(nsHTMLReflowState &aReflowState, #ifdef DEBUG if (!NS_INLINE_IS_BREAK_BEFORE(aFrameReflowStatus)) { if (CRAZY_WIDTH(mMetrics.width) || CRAZY_HEIGHT(mMetrics.height)) { - printf("nsBlockReflowContext: "); + PRINTF("nsBlockReflowContext: "); nsFrame::ListTag(stdout, aFrame); - printf(" metrics=%d,%d!\n", mMetrics.width, mMetrics.height); + PRINTF(" metrics=%d,%d!\n", mMetrics.width, mMetrics.height); } if ((nsnull != mMetrics.maxElementSize) && ((nscoord(0xdeadbeef) == mMetrics.maxElementSize->width) || (nscoord(0xdeadbeef) == mMetrics.maxElementSize->height))) { - printf("nsBlockReflowContext: "); + PRINTF("nsBlockReflowContext: "); nsFrame::ListTag(stdout, aFrame); - printf(" didn't set max-element-size!\n"); + PRINTF(" didn't set max-element-size!\n"); mMetrics.maxElementSize->width = 0; mMetrics.maxElementSize->height = 0; } @@ -584,9 +589,9 @@ nsBlockReflowContext::DoReflowBlock(nsHTMLReflowState &aReflowState, if ((nsnull != mMetrics.maxElementSize) && ((mMetrics.maxElementSize->width > mMetrics.width) || (mMetrics.maxElementSize->height > mMetrics.height))) { - printf("nsBlockReflowContext: "); + PRINTF("nsBlockReflowContext: "); nsFrame::ListTag(stdout, aFrame); - printf(": WARNING: maxElementSize=%d,%d > metrics=%d,%d\n", + PRINTF(": WARNING: maxElementSize=%d,%d > metrics=%d,%d\n", mMetrics.maxElementSize->width, mMetrics.maxElementSize->height, mMetrics.width, mMetrics.height); @@ -596,9 +601,9 @@ nsBlockReflowContext::DoReflowBlock(nsHTMLReflowState &aReflowState, (mMetrics.height == nscoord(0xdeadbeef)) || (mMetrics.ascent == nscoord(0xdeadbeef)) || (mMetrics.descent == nscoord(0xdeadbeef))) { - printf("nsBlockReflowContext: "); + PRINTF("nsBlockReflowContext: "); nsFrame::ListTag(stdout, aFrame); - printf(" didn't set whad %d,%d,%d,%d!\n", + PRINTF(" didn't set whad %d,%d,%d,%d!\n", mMetrics.width, mMetrics.height, mMetrics.ascent, mMetrics.descent); } @@ -607,9 +612,9 @@ nsBlockReflowContext::DoReflowBlock(nsHTMLReflowState &aReflowState, #ifdef NOISY_MAX_ELEMENT_SIZE if (!NS_INLINE_IS_BREAK_BEFORE(aFrameReflowStatus)) { if (nsnull != mMetrics.maxElementSize) { - printf(" "); + PRINTF(" "); nsFrame::ListTag(stdout, aFrame); - printf(": maxElementSize=%d,%d wh=%d,%d\n", + PRINTF(": maxElementSize=%d,%d wh=%d,%d\n", mMetrics.maxElementSize->width, mMetrics.maxElementSize->height, mMetrics.width, mMetrics.height); @@ -693,11 +698,11 @@ nsBlockReflowContext::PlaceBlock(PRBool aForceFit, nscoord newBottomMargin = MaxMargin(collapsedBottomMargin, mTopMargin); *aBottomMarginResult = newBottomMargin; #ifdef NOISY_VERTICAL_MARGINS - printf(" "); + PRINTF(" "); nsFrame::ListTag(stdout, mOuterReflowState.frame); - printf(": "); + PRINTF(": "); nsFrame::ListTag(stdout, mFrame); - printf(" -- collapsing top & bottom margin together; y=%d spaceY=%d\n", + PRINTF(" -- collapsing top & bottom margin together; y=%d spaceY=%d\n", y, mSpace.y); #endif diff --git a/mozilla/layout/html/base/src/nsBlockReflowState.cpp b/mozilla/layout/html/base/src/nsBlockReflowState.cpp index c9a7aecd5dc..ff838739002 100644 --- a/mozilla/layout/html/base/src/nsBlockReflowState.cpp +++ b/mozilla/layout/html/base/src/nsBlockReflowState.cpp @@ -57,6 +57,12 @@ #include "nsSpaceManager.h" #include "prenv.h" #include "plstr.h" +#include "nslog.h" +#undef fprintf + +NS_IMPL_LOG(nsBlockFrameLog) +#define PRINTF NS_LOG_PRINTF(nsBlockFrameLog) +#define FLUSH NS_LOG_FLUSH(nsBlockFrameLog) #ifdef DEBUG @@ -92,14 +98,14 @@ static BlockDebugFlags gFlags[] = { static void ShowDebugFlags() { - printf("Here are the available GECKO_BLOCK_DEBUG_FLAGS:\n"); + PRINTF("Here are the available GECKO_BLOCK_DEBUG_FLAGS:\n"); BlockDebugFlags* bdf = gFlags; BlockDebugFlags* end = gFlags + NUM_DEBUG_FLAGS; for (; bdf < end; bdf++) { - printf(" %s\n", bdf->name); + PRINTF(" %s\n", bdf->name); } - printf("Note: GECKO_BLOCK_DEBUG_FLAGS is a comma seperated list of flag\n"); - printf("names (no whitespace)\n"); + PRINTF("Note: GECKO_BLOCK_DEBUG_FLAGS is a comma seperated list of flag\n"); + PRINTF("names (no whitespace)\n"); } static void @@ -121,7 +127,7 @@ InitDebugFlags() for (; bdf < end; bdf++) { if (PL_strcasecmp(bdf->name, flags) == 0) { *(bdf->on) = PR_TRUE; - printf("nsBlockFrame: setting %s debug flag on\n", bdf->name); + PRINTF("nsBlockFrame: setting %s debug flag on\n", bdf->name); gNoisy = PR_TRUE; found = PR_TRUE; break; @@ -192,17 +198,17 @@ DumpStyleGeneaology(nsIFrame* aFrame, const char* gap) { fputs(gap, stdout); nsFrame::ListTag(stdout, aFrame); - printf(": "); + PRINTF(": "); nsIStyleContext* sc; aFrame->GetStyleContext(&sc); while (nsnull != sc) { nsIStyleContext* psc; - printf("%p ", sc); + PRINTF("%p ", sc); psc = sc->GetParent(); NS_RELEASE(sc); sc = psc; } - printf("\n"); + PRINTF("\n"); } #endif @@ -240,7 +246,7 @@ RecordReflowStatus(PRBool aChildIsBlock, nsReflowStatus aFrameReflowStatus) // Log updates to the status that yield different values if (record[index] != newS) { record[index] = newS; - printf("record(%d): %02x %02x\n", index, record[0], record[1]); + PRINTF("record(%d): %02x %02x\n", index, record[0], record[1]); } } #endif @@ -311,7 +317,7 @@ public: #ifdef DEBUG if (gNoisyReflow) { nsFrame::IndentBy(stdout, gNoiseIndent); - printf("GetAvailableSpace: band=%d,%d,%d,%d count=%d\n", + PRINTF("GetAvailableSpace: band=%d,%d,%d,%d count=%d\n", mAvailSpaceRect.x, mAvailSpaceRect.y, mAvailSpaceRect.width, mAvailSpaceRect.height, mBand.GetTrapezoidCount()); @@ -332,7 +338,7 @@ public: #ifdef DEBUG if (gNoisyReflow) { nsFrame::IndentBy(stdout, gNoiseIndent); - printf("GetAvailableSpace: band=%d,%d,%d,%d count=%d\n", + PRINTF("GetAvailableSpace: band=%d,%d,%d,%d count=%d\n", mAvailSpaceRect.x, mAvailSpaceRect.y, mAvailSpaceRect.width, mAvailSpaceRect.height, mBand.GetTrapezoidCount()); @@ -387,10 +393,10 @@ public: (mMaxElementSize.height != oldSize.height)) { nsFrame::IndentBy(stdout, mBlock->GetDepth()); if (NS_UNCONSTRAINEDSIZE == mReflowState.availableWidth) { - printf("PASS1 "); + PRINTF("PASS1 "); } nsFrame::ListTag(stdout, mBlock); - printf(": old max-element-size=%d,%d new=%d,%d\n", + PRINTF(": old max-element-size=%d,%d new=%d,%d\n", oldSize.width, oldSize.height, mMaxElementSize.width, mMaxElementSize.height); } @@ -400,7 +406,7 @@ public: void UpdateMaximumWidth(nscoord aMaximumWidth) { if (aMaximumWidth > mMaximumWidth) { #ifdef NOISY_MAXIMUM_WIDTH - printf("nsBlockReflowState::UpdateMaximumWidth block %p caching max width %d\n", mBlock, aMaximumWidth); + PRINTF("nsBlockReflowState::UpdateMaximumWidth block %p caching max width %d\n", mBlock, aMaximumWidth); #endif mMaximumWidth = aMaximumWidth; } @@ -427,7 +433,7 @@ public: PRBool IsImpactedByFloater() { #ifdef REALLY_NOISY_REFLOW - printf("nsBlockReflowState::IsImpactedByFloater %p returned %d\n", + PRINTF("nsBlockReflowState::IsImpactedByFloater %p returned %d\n", this, mBand.GetFloaterCount()); #endif return mBand.GetFloaterCount(); @@ -721,7 +727,7 @@ nsBlockReflowState::nsBlockReflowState(const nsHTMLReflowState& aReflowState, SetFlag(BRS_COMPUTEMAXELEMENTSIZE, (nsnull != aMetrics.maxElementSize)); #ifdef NOISY_MAX_ELEMENT_SIZE - printf("BRS: setting compute-MES to %d\n", (nsnull != aMetrics.maxElementSize)); + PRINTF("BRS: setting compute-MES to %d\n", (nsnull != aMetrics.maxElementSize)); #endif mMaxElementSize.SizeTo(0, 0); SetFlag(BRS_COMPUTEMAXWIDTH, @@ -772,7 +778,7 @@ nsBlockReflowState::ComputeBlockAvailSpace(nsIFrame* aFrame, nsRect& aResult) { #ifdef REALLY_NOISY_REFLOW - printf("CBAS frame=%p has floater count %d\n", aFrame, mBand.GetFloaterCount()); + PRINTF("CBAS frame=%p has floater count %d\n", aFrame, mBand.GetFloaterCount()); mBand.List(); #endif aResult.y = mY; @@ -883,7 +889,7 @@ nsBlockReflowState::ComputeBlockAvailSpace(nsIFrame* aFrame, aResult.width = mAvailSpaceRect.width; } #ifdef REALLY_NOISY_REFLOW - printf(" CBAS: result %d %d %d %d\n", aResult.x, aResult.y, aResult.width, aResult.height); + PRINTF(" CBAS: result %d %d %d %d\n", aResult.x, aResult.y, aResult.width, aResult.height); #endif } @@ -902,7 +908,7 @@ nsBlockReflowState::ClearPastFloaters(PRUint8 aBreakType) ClearFloaters(saveY, aBreakType); #ifdef NOISY_FLOATER_CLEARING nsFrame::ListTag(stdout, mBlock); - printf(": ClearPastFloaters: mPrevBottomMargin=%d saveY=%d oldY=%d newY=%d deltaY=%d\n", + PRINTF(": ClearPastFloaters: mPrevBottomMargin=%d saveY=%d oldY=%d newY=%d deltaY=%d\n", mPrevBottomMargin, saveY, saveY - mPrevBottomMargin, mY, mY - saveY); #endif @@ -1012,17 +1018,17 @@ nsBlockReflowState::RecoverStateFrom(nsLineBox* aLine, #ifdef DEBUG if (CRAZY_WIDTH(xmost)) { nsFrame::ListTag(stdout, mBlock); - printf(": WARNING: xmost:%d\n", xmost); + PRINTF(": WARNING: xmost:%d\n", xmost); } #endif #ifdef NOISY_KIDXMOST - printf("%p RecoverState block %p aState.mKidXMost=%d\n", this, mBlock, xmost); + PRINTF("%p RecoverState block %p aState.mKidXMost=%d\n", this, mBlock, xmost); #endif mKidXMost = xmost; } if (GetFlag(BRS_COMPUTEMAXELEMENTSIZE)) { #ifdef NOISY_MAX_ELEMENT_SIZE - printf("nsBlockReflowState::RecoverStateFrom block %p caching max width %d\n", mBlock, aLine->mMaxElementWidth); + PRINTF("nsBlockReflowState::RecoverStateFrom block %p caching max width %d\n", mBlock, aLine->mMaxElementWidth); #endif UpdateMaxElementSize(nsSize(aLine->mMaxElementWidth, aLine->mBounds.height)); } @@ -1030,7 +1036,7 @@ nsBlockReflowState::RecoverStateFrom(nsLineBox* aLine, // If computing the maximum width, then update mMaximumWidth if (GetFlag(BRS_COMPUTEMAXWIDTH)) { #ifdef NOISY_MAXIMUM_WIDTH - printf("nsBlockReflowState::RecoverStateFrom block %p caching max width %d\n", mBlock, aLine->mMaximumWidth); + PRINTF("nsBlockReflowState::RecoverStateFrom block %p caching max width %d\n", mBlock, aLine->mMaximumWidth); #endif UpdateMaximumWidth(aLine->mMaximumWidth); } @@ -1041,9 +1047,9 @@ nsBlockReflowState::RecoverStateFrom(nsLineBox* aLine, aApplyTopMargin = ClearPastFloaters(aLine->GetBreakType()); #ifdef NOISY_VERTICAL_MARGINS nsFrame::ListTag(stdout, mBlock); - printf(": RecoverStateFrom: y=%d child ", mY); + PRINTF(": RecoverStateFrom: y=%d child ", mY); nsFrame::ListTag(stdout, aLine->mFirstChild); - printf(" has clear of %d => %s, mPrevBottomMargin=%d\n", aLine->mBreakType, + PRINTF(" has clear of %d => %s, mPrevBottomMargin=%d\n", aLine->mBreakType, aApplyTopMargin ? "applyTopMargin" : "nope", mPrevBottomMargin); #endif } @@ -1135,10 +1141,10 @@ nsBlockReflowState::RecoverStateFrom(nsLineBox* aLine, nscoord tx, ty; mSpaceManager->GetTranslation(tx, ty); nsFrame::IndentBy(stdout, gNoiseIndent); - printf("RecoverState: txy=%d,%d (%d,%d) ", + PRINTF("RecoverState: txy=%d,%d (%d,%d) ", tx, ty, mSpaceManagerX, mSpaceManagerY); nsFrame::ListTag(stdout, floater); - printf(" r.y=%d finalDeltaY=%d (sum=%d) region={%d,%d,%d,%d}\n", + PRINTF(" r.y=%d finalDeltaY=%d (sum=%d) region={%d,%d,%d,%d}\n", r.y, finalDeltaY, r.y + finalDeltaY, fc->mRegion.x, fc->mRegion.y, fc->mRegion.width, fc->mRegion.height); @@ -1278,7 +1284,7 @@ nsBlockFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) con IndentBy(out, aIndent); ListTag(out); #ifdef DEBUG_waterson - fprintf(out, " [parent=%p]", mParent); + FPRINTF(out, " [parent=%p]", mParent); #endif nsIView* view; GetView(aPresContext, &view); @@ -1508,7 +1514,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, if (gNoisyReflow) { IndentBy(stdout, gNoiseIndent); ListTag(stdout); - printf(": begin reflow type %d availSize=%d,%d computedSize=%d,%d\n", + PRINTF(": begin reflow type %d availSize=%d,%d computedSize=%d,%d\n", aReflowState.reason, aReflowState.availableWidth, aReflowState.availableHeight, aReflowState.mComputedWidth, aReflowState.mComputedHeight); } @@ -1582,7 +1588,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, extern char* nsPresShell_ReflowStackPointerTop; char marker; char* newsp = (char*) ▮ - printf("XXX: frame tree is too deep; approx stack size = %d\n", + PRINTF("XXX: frame tree is too deep; approx stack size = %d\n", nsPresShell_ReflowStackPointerTop - newsp); } #endif @@ -1605,7 +1611,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, nsHTMLReflowState& reflowState = (nsHTMLReflowState&)aReflowState; reflowState.mSpaceManager = spaceManager.get(); #ifdef NOISY_SPACEMANAGER - printf("constructed new space manager %p\n", reflowState.mSpaceManager); + PRINTF("constructed new space manager %p\n", reflowState.mSpaceManager); #endif } @@ -1624,7 +1630,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, case eReflowReason_Initial: #ifdef NOISY_REFLOW_REASON ListTag(stdout); - printf(": reflow=initial\n"); + PRINTF(": reflow=initial\n"); #endif DrainOverflowLines(aPresContext); rv = PrepareInitialReflow(state); @@ -1641,7 +1647,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, aReflowState.reflowCommand->GetType(type); #ifdef NOISY_REFLOW_REASON ListTag(stdout); - printf(": reflow=incremental type=%d\n", type); + PRINTF(": reflow=incremental type=%d\n", type); #endif switch (type) { case nsIReflowCommand::StyleChanged: @@ -1661,12 +1667,12 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, aReflowState.reflowCommand->GetNext(state.mNextRCFrame); #ifdef NOISY_REFLOW_REASON ListTag(stdout); - printf(": reflow=incremental"); + PRINTF(": reflow=incremental"); if (state.mNextRCFrame) { - printf(" next="); + PRINTF(" next="); nsFrame::ListTag(stdout, state.mNextRCFrame); } - printf("\n"); + PRINTF("\n"); #endif // this code does a correct job of propogating incremental reflows (bug 25510) @@ -1724,7 +1730,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, default: #ifdef NOISY_REFLOW_REASON ListTag(stdout); - printf(": reflow=resize (%d)\n", aReflowState.reason); + PRINTF(": reflow=resize (%d)\n", aReflowState.reason); #endif DrainOverflowLines(aPresContext); rv = PrepareResizeReflow(state); @@ -1749,7 +1755,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, } else { #ifdef DEBUG_kipp - ListTag(stdout); printf(": block is not complete\n"); + ListTag(stdout); PRINTF(": block is not complete\n"); #endif } } @@ -1769,7 +1775,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, if (xMost > aMetrics.width) { #ifdef NOISY_FINAL_SIZE ListTag(stdout); - printf(": changing desired width from %d to %d\n", aMetrics.width, xMost); + PRINTF(": changing desired width from %d to %d\n", aMetrics.width, xMost); #endif aMetrics.width = xMost; } @@ -1777,7 +1783,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, if (yMost > aMetrics.height) { #ifdef NOISY_FINAL_SIZE ListTag(stdout); - printf(": changing desired height from %d to %d\n", aMetrics.height, yMost); + PRINTF(": changing desired height from %d to %d\n", aMetrics.height, yMost); #endif aMetrics.height = yMost; } @@ -1810,7 +1816,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, if (NS_BLOCK_SPACE_MGR & mState) { nsHTMLReflowState& reflowState = (nsHTMLReflowState&)aReflowState; #ifdef NOISY_SPACEMANAGER - printf("restoring old space manager %p\n", oldSpaceManager); + PRINTF("restoring old space manager %p\n", oldSpaceManager); #endif reflowState.mSpaceManager = oldSpaceManager; } @@ -1819,7 +1825,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, nsHTMLReflowState& reflowState = (nsHTMLReflowState&)aReflowState; if (reflowState.mSpaceManager) { ListTag(stdout); - printf(": space-manager %p after reflow\n", reflowState.mSpaceManager); + PRINTF(": space-manager %p after reflow\n", reflowState.mSpaceManager); reflowState.mSpaceManager->List(stdout); } #endif @@ -1832,7 +1838,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, // Lots of things could have changed so damage our entire // bounds #ifdef NOISY_BLOCK_INVALIDATE - printf("%p invalidate 1 (%d, %d, %d, %d)\n", + PRINTF("%p invalidate 1 (%d, %d, %d, %d)\n", this, 0, 0, mRect.width, mRect.height); #endif Invalidate(aPresContext, nsRect(0, 0, mRect.width, mRect.height)); @@ -1862,7 +1868,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, damageRect.height = mRect.height; } #ifdef NOISY_BLOCK_INVALIDATE - printf("%p invalidate 2 (%d, %d, %d, %d)\n", + PRINTF("%p invalidate 2 (%d, %d, %d, %d)\n", this, damageRect.x, damageRect.y, damageRect.width, damageRect.height); #endif Invalidate(aPresContext, damageRect); @@ -1889,7 +1895,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, damageRect.height = border.bottom; } #ifdef NOISY_BLOCK_INVALIDATE - printf("%p invalidate 3 (%d, %d, %d, %d)\n", + PRINTF("%p invalidate 3 (%d, %d, %d, %d)\n", this, damageRect.x, damageRect.y, damageRect.width, damageRect.height); #endif Invalidate(aPresContext, damageRect); @@ -1933,23 +1939,23 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, if (gNoisyReflow) { IndentBy(stdout, gNoiseIndent); ListTag(stdout); - printf(": status=%x (%scomplete) metrics=%d,%d carriedMargin=%d", + PRINTF(": status=%x (%scomplete) metrics=%d,%d carriedMargin=%d", aStatus, NS_FRAME_IS_COMPLETE(aStatus) ? "" : "not ", aMetrics.width, aMetrics.height, aMetrics.mCarriedOutBottomMargin); if (mState & NS_FRAME_OUTSIDE_CHILDREN) { - printf(" combinedArea={%d,%d,%d,%d}", + PRINTF(" combinedArea={%d,%d,%d,%d}", aMetrics.mOverflowArea.x, aMetrics.mOverflowArea.y, aMetrics.mOverflowArea.width, aMetrics.mOverflowArea.height); } if (aMetrics.maxElementSize) { - printf(" maxElementSize=%d,%d", + PRINTF(" maxElementSize=%d,%d", aMetrics.maxElementSize->width, aMetrics.maxElementSize->height); } - printf("\n"); + PRINTF("\n"); } if (gLameReflowMetrics) { @@ -1968,12 +1974,12 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, PR_snprintf(buf, sizeof(buf), ": %lld elapsed (%lld per line) (%d lines; %d new lines)", delta, perLineDelta, numLines, ectc - ctc); - printf("%s\n", buf); + PRINTF("%s\n", buf); } #endif #ifdef NOISY_MAX_ELEMENT_SIZE if (aMetrics.maxElementSize) { - printf("block %p returning with maxElementSize=%d,%d\n", this, + PRINTF("block %p returning with maxElementSize=%d,%d\n", this, aMetrics.maxElementSize->width, aMetrics.maxElementSize->height); } @@ -2057,7 +2063,7 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState, const nsMargin& borderPadding = aState.BorderPadding(); #ifdef NOISY_FINAL_SIZE ListTag(stdout); - printf(": mY=%d mIsBottomMarginRoot=%s mPrevBottomMargin=%d bp=%d,%d\n", + PRINTF(": mY=%d mIsBottomMarginRoot=%s mPrevBottomMargin=%d bp=%d,%d\n", aState.mY, aState.GetFlag(BRS_ISBOTTOMMARGINROOT) ? "yes" : "no", aState.mPrevBottomMargin, borderPadding.top, borderPadding.bottom); @@ -2066,7 +2072,7 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState, // Compute final width nscoord maxWidth = 0, maxHeight = 0; #ifdef NOISY_KIDXMOST - printf("%p aState.mKidXMost=%d\n", this, aState.mKidXMost); + PRINTF("%p aState.mKidXMost=%d\n", this, aState.mKidXMost); #endif nscoord minWidth = aState.mKidXMost + borderPadding.right; if (!HaveAutoWidth(aReflowState)) { @@ -2276,8 +2282,8 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState, aMetrics.maxElementSize->width = maxWidth; aMetrics.maxElementSize->height = maxHeight; #ifdef NOISY_MAX_ELEMENT_SIZE - printf ("nsBlockFrame::CFS: %p returning MES %d\n", - this, aMetrics.maxElementSize->width); + PRINTF ("nsBlockFrame::CFS: %p returning MES %d\n", + this, aMetrics.maxElementSize->width); #endif } @@ -2288,12 +2294,12 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState, #ifdef DEBUG_blocks if (CRAZY_WIDTH(aMetrics.width) || CRAZY_HEIGHT(aMetrics.height)) { ListTag(stdout); - printf(": WARNING: desired:%d,%d\n", aMetrics.width, aMetrics.height); + PRINTF(": WARNING: desired:%d,%d\n", aMetrics.width, aMetrics.height); } if (aState.GetFlag(BRS_COMPUTEMAXELEMENTSIZE) && ((maxWidth > aMetrics.width) || (maxHeight > aMetrics.height))) { ListTag(stdout); - printf(": WARNING: max-element-size:%d,%d desired:%d,%d maxSize:%d,%d\n", + PRINTF(": WARNING: max-element-size:%d,%d desired:%d,%d maxSize:%d,%d\n", maxWidth, maxHeight, aMetrics.width, aMetrics.height, aState.mReflowState.availableWidth, aState.mReflowState.availableHeight); @@ -2303,10 +2309,10 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState, if (aState.GetFlag(BRS_COMPUTEMAXELEMENTSIZE)) { IndentBy(stdout, GetDepth()); if (NS_UNCONSTRAINEDSIZE == aState.mReflowState.availableWidth) { - printf("PASS1 "); + PRINTF("PASS1 "); } ListTag(stdout); - printf(": max-element-size:%d,%d desired:%d,%d maxSize:%d,%d\n", + PRINTF(": max-element-size:%d,%d desired:%d,%d maxSize:%d,%d\n", maxWidth, maxHeight, aMetrics.width, aMetrics.height, aState.mReflowState.availableWidth, aState.mReflowState.availableHeight); @@ -2318,7 +2324,7 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState, // We need to add in for the right border/padding aMetrics.mMaximumWidth = aState.mMaximumWidth + borderPadding.right; #ifdef NOISY_MAXIMUM_WIDTH - printf("nsBlockFrame::ComputeFinalSize block %p setting aMetrics.mMaximumWidth to %d\n", this, aMetrics.mMaximumWidth); + PRINTF("nsBlockFrame::ComputeFinalSize block %p setting aMetrics.mMaximumWidth to %d\n", this, aMetrics.mMaximumWidth); #endif } @@ -2368,7 +2374,7 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState, } #ifdef NOISY_COMBINED_AREA ListTag(stdout); - printf(": ca=%d,%d,%d,%d\n", xa, ya, xb-xa, yb-ya); + PRINTF(": ca=%d,%d,%d,%d\n", xa, ya, xb-xa, yb-ya); #endif // If the combined area of our children exceeds our bounding box @@ -2427,7 +2433,7 @@ nsBlockFrame::MarkLineDirty(nsLineBox* aLine, nsLineBox* aPrevLine) if (gNoisyReflow) { IndentBy(stdout, gNoiseIndent); ListTag(stdout); - printf(": mark line %p dirty\n", aLine); + PRINTF(": mark line %p dirty\n", aLine); } #endif @@ -2440,7 +2446,7 @@ nsBlockFrame::MarkLineDirty(nsLineBox* aLine, nsLineBox* aPrevLine) if (gNoisyReflow) { IndentBy(stdout, gNoiseIndent); ListTag(stdout); - printf(": mark prev-line %p dirty\n", aPrevLine); + PRINTF(": mark prev-line %p dirty\n", aPrevLine); } #endif } @@ -2554,7 +2560,7 @@ nsBlockFrame::PrepareResizeReflow(nsBlockReflowState& aState) mStyleContext->GetStyleData(eStyleStruct_Text); IndentBy(stdout, gNoiseIndent); ListTag(stdout); - printf(": marking all lines dirty: reason=%d availWidth=%d textAlign=%d\n", + PRINTF(": marking all lines dirty: reason=%d availWidth=%d textAlign=%d\n", aState.mReflowState.reason, aState.mReflowState.availableWidth, mStyleText->mTextAlign); @@ -2587,7 +2593,7 @@ nsBlockFrame::PrepareResizeReflow(nsBlockReflowState& aState) if (gNoisyReflow) { IndentBy(stdout, gNoiseIndent); ListTag(stdout); - printf(": trying to avoid marking all lines dirty\n"); + PRINTF(": trying to avoid marking all lines dirty\n"); } #endif @@ -2601,8 +2607,8 @@ nsBlockFrame::PrepareResizeReflow(nsBlockReflowState& aState) else { // We can avoid reflowing *some* inline lines in some cases. #ifdef REALLY_NOISY_REFLOW - printf("PrepareResizeReflow thinks line %p is %simpacted by floaters\n", - line, line->IsImpactedByFloater() ? "" : "not "); + PRINTF("PrepareResizeReflow thinks line %p is %simpacted by floaters\n", + line, line->IsImpactedByFloater() ? "" : "not "); #endif if (notWrapping) { // When no-wrap is set then the only line-breaking that @@ -2628,7 +2634,7 @@ nsBlockFrame::PrepareResizeReflow(nsBlockReflowState& aState) #ifdef DEBUG if (gNoisyReflow && !line->IsDirty() && !notWrapping) { IndentBy(stdout, gNoiseIndent + 1); - printf("skipped: line=%p next=%p %s %s %s%s%s breakType=%d xmost=%d\n", + PRINTF("skipped: line=%p next=%p %s %s %s%s%s breakType=%d xmost=%d\n", line, line->mNext, line->IsBlock() ? "block" : "inline", aState.GetFlag(BRS_NOWRAP) ? "no-wrap" : "wrapping", @@ -2779,8 +2785,8 @@ nsBlockFrame::PropogateReflowDamage(nsBlockReflowState& aState, PRBool wasImpactedByFloater = next->IsImpactedByFloater(); PRBool isImpactedByFloater = aState.IsImpactedByFloater() ? PR_TRUE : PR_FALSE; #ifdef REALLY_NOISY_REFLOW - printf("nsBlockFrame::PropogateReflowDamage %p was = %d, is=%d\n", - this, wasImpactedByFloater, isImpactedByFloater); + PRINTF("nsBlockFrame::PropogateReflowDamage %p was = %d, is=%d\n", + this, wasImpactedByFloater, isImpactedByFloater); #endif if (wasImpactedByFloater != isImpactedByFloater) { next->MarkDirty(); @@ -2865,16 +2871,16 @@ nsBlockFrame::ReflowDirtyLines(nsBlockReflowState& aState) aState.mReflowState.reflowCommand->GetType(type); IndentBy(stdout, gNoiseIndent); ListTag(stdout); - printf(": incrementally reflowing dirty lines: type=%s(%d) isInline=%s", + PRINTF(": incrementally reflowing dirty lines: type=%s(%d) isInline=%s", kReflowCommandType[type], type, aState.GetFlag(BRS_ISINLINEINCRREFLOW) ? "true" : "false"); } else { IndentBy(stdout, gNoiseIndent); ListTag(stdout); - printf(": reflowing dirty lines"); + PRINTF(": reflowing dirty lines"); } - printf(" computedWidth=%d\n", aState.mReflowState.mComputedWidth); + PRINTF(" computedWidth=%d\n", aState.mReflowState.mComputedWidth); gNoiseIndent++; } #endif @@ -2902,7 +2908,7 @@ nsBlockFrame::ReflowDirtyLines(nsBlockReflowState& aState) &damageRect : 0); if (incrementalReflow && !damageRect.IsEmpty()) { #ifdef NOISY_BLOCK_INVALIDATE - printf("%p invalidate 4 (%d, %d, %d, %d)\n", + PRINTF("%p invalidate 4 (%d, %d, %d, %d)\n", this, damageRect.x, damageRect.y, damageRect.width, damageRect.height); #endif Invalidate(aState.mPresContext, damageRect); @@ -2919,7 +2925,7 @@ nsBlockFrame::ReflowDirtyLines(nsBlockReflowState& aState) nsRect lca; line->GetCombinedArea(&lca); IndentBy(stdout, gNoiseIndent); - printf("line=%p mY=%d dirty=%s oldBounds={%d,%d,%d,%d} oldCombinedArea={%d,%d,%d,%d} deltaY=%d mPrevBottomMargin=%d\n", + PRINTF("line=%p mY=%d dirty=%s oldBounds={%d,%d,%d,%d} oldCombinedArea={%d,%d,%d,%d} deltaY=%d mPrevBottomMargin=%d\n", line, aState.mY, line->IsDirty() ? "yes" : "no", line->mBounds.x, line->mBounds.y, line->mBounds.width, line->mBounds.height, @@ -2977,7 +2983,7 @@ nsBlockFrame::ReflowDirtyLines(nsBlockReflowState& aState) &damageRect : 0); if (incrementalReflow && !damageRect.IsEmpty()) { #ifdef NOISY_BLOCK_INVALIDATE - printf("%p invalidate 5 (%d, %d, %d, %d)\n", + PRINTF("%p invalidate 5 (%d, %d, %d, %d)\n", this, damageRect.x, damageRect.y, damageRect.width, damageRect.height); #endif Invalidate(aState.mPresContext, damageRect); @@ -2990,7 +2996,7 @@ nsBlockFrame::ReflowDirtyLines(nsBlockReflowState& aState) nsRect lca; line->GetCombinedArea(&lca); IndentBy(stdout, gNoiseIndent); - printf("line=%p mY=%d newBounds={%d,%d,%d,%d} newCombinedArea={%d,%d,%d,%d} deltaY=%d mPrevBottomMargin=%d\n", + PRINTF("line=%p mY=%d newBounds={%d,%d,%d,%d} newCombinedArea={%d,%d,%d,%d} deltaY=%d mPrevBottomMargin=%d\n", line, aState.mY, line->mBounds.x, line->mBounds.y, line->mBounds.width, line->mBounds.height, @@ -3089,7 +3095,7 @@ nsBlockFrame::ReflowDirtyLines(nsBlockReflowState& aState) gNoiseIndent--; IndentBy(stdout, gNoiseIndent); ListTag(stdout); - printf(": done reflowing dirty lines (status=%x)\n", + PRINTF(": done reflowing dirty lines (status=%x)\n", aState.mReflowStatus); } #endif @@ -3154,7 +3160,7 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState, nsRect dirtyRect; dirtyRect.UnionRect(oldCombinedArea, lineCombinedArea); #ifdef NOISY_BLOCK_INVALIDATE - printf("%p invalidate 6 (%d, %d, %d, %d)\n", + PRINTF("%p invalidate 6 (%d, %d, %d, %d)\n", this, dirtyRect.x, dirtyRect.y, dirtyRect.width, dirtyRect.height); #endif Invalidate(aState.mPresContext, dirtyRect); @@ -3174,7 +3180,7 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState, dirtyRect.height = PR_MAX(oldCombinedArea.height, lineCombinedArea.height); #ifdef NOISY_BLOCK_INVALIDATE - printf("%p invalidate 7 (%d, %d, %d, %d)\n", + PRINTF("%p invalidate 7 (%d, %d, %d, %d)\n", this, dirtyRect.x, dirtyRect.y, dirtyRect.width, dirtyRect.height); #endif Invalidate(aState.mPresContext, dirtyRect); @@ -3193,7 +3199,7 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState, lineCombinedArea.YMost()) - dirtyRect.y; #ifdef NOISY_BLOCK_INVALIDATE - printf("%p invalidate 8 (%d, %d, %d, %d)\n", + PRINTF("%p invalidate 8 (%d, %d, %d, %d)\n", this, dirtyRect.x, dirtyRect.y, dirtyRect.width, dirtyRect.height); #endif Invalidate(aState.mPresContext, dirtyRect); @@ -3233,7 +3239,7 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState, // Update the line's maximum width aLine->mMaximumWidth = aLine->mBounds.XMost(); #ifdef NOISY_MAXIMUM_WIDTH - printf("nsBlockFrame::ReflowLine block %p line %p setting aLine.mMaximumWidth to %d\n", + PRINTF("nsBlockFrame::ReflowLine block %p line %p setting aLine.mMaximumWidth to %d\n", this, aLine, aLine->mMaximumWidth); #endif aState.UpdateMaximumWidth(aLine->mMaximumWidth); @@ -3263,7 +3269,7 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState, if (aState.GetFlag(BRS_COMPUTEMAXWIDTH)) { #ifdef NOISY_MAXIMUM_WIDTH - printf("nsBlockFrame::ReflowLine block %p line %p setting aLine.mMaximumWidth to %d\n", + PRINTF("nsBlockFrame::ReflowLine block %p line %p setting aLine.mMaximumWidth to %d\n", this, aLine, aLine->mMaximumWidth); #endif aState.UpdateMaximumWidth(aLine->mMaximumWidth); @@ -3271,7 +3277,7 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState, if (aState.GetFlag(BRS_COMPUTEMAXELEMENTSIZE)) { #ifdef NOISY_MAX_ELEMENT_SIZE - printf("nsBlockFrame::ReflowLine block %p line %p setting aLine.mMaxElementWidth to %d\n", + PRINTF("nsBlockFrame::ReflowLine block %p line %p setting aLine.mMaxElementWidth to %d\n", this, aLine, aLine->mMaxElementWidth); #endif aState.UpdateMaxElementSize(nsSize(aLine->mMaxElementWidth, aLine->mBounds.height)); @@ -3290,11 +3296,11 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState, nsRect dirtyRect; dirtyRect.UnionRect(oldCombinedArea, combinedArea); #ifdef NOISY_BLOCK_INVALIDATE - printf("%p invalidate because %s is true (%d, %d, %d, %d)\n", + PRINTF("%p invalidate because %s is true (%d, %d, %d, %d)\n", this, aDamageDirtyArea ? "aDamageDirtyArea" : "aLine->IsForceInvalidate", dirtyRect.x, dirtyRect.y, dirtyRect.width, dirtyRect.height); if (aLine->IsForceInvalidate()) - printf(" dirty line is %p\n"); + PRINTF(" dirty line is %p\n"); #endif Invalidate(aState.mPresContext, dirtyRect); } @@ -3525,7 +3531,7 @@ nsBlockFrame::UpdateSpaceManager(nsIPresContext* aPresContext, nscoord tx, ty; aSpaceManager->GetTranslation(tx, ty); nsFrame::ListTag(stdout, this); - printf(": UpdateSpaceManager: AddRectRegion: txy=%d,%d {%d,%d,%d,%d}\n", + PRINTF(": UpdateSpaceManager: AddRectRegion: txy=%d,%d {%d,%d,%d,%d}\n", tx, ty, fc->mRegion.x, fc->mRegion.y, fc->mRegion.width, fc->mRegion.height); @@ -3808,9 +3814,9 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState, } #ifdef NOISY_VERTICAL_MARGINS ListTag(stdout); - printf(": y=%d child ", aState.mY); + PRINTF(": y=%d child ", aState.mY); ListTag(stdout, frame); - printf(" has clear of %d => %s, mPrevBottomMargin=%d\n", + PRINTF(" has clear of %d => %s, mPrevBottomMargin=%d\n", breakType, applyTopMargin ? "applyTopMargin" : "nope", aState.mPrevBottomMargin); @@ -3850,7 +3856,7 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState, // Compute the available space for the block aState.GetAvailableSpace(); #ifdef REALLY_NOISY_REFLOW - printf("setting line %p isImpacted to %s\n", aLine, aState.IsImpactedByFloater()?"true":"false"); + PRINTF("setting line %p isImpacted to %s\n", aLine, aState.IsImpactedByFloater()?"true":"false"); #endif PRBool isImpacted = aState.IsImpactedByFloater() ? PR_TRUE : PR_FALSE; aLine->SetLineIsImpactedByFloater(isImpacted); @@ -3974,9 +3980,9 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState, // therefore zero out the running margin value. #ifdef NOISY_VERTICAL_MARGINS ListTag(stdout); - printf(": reflow incomplete, frame="); + PRINTF(": reflow incomplete, frame="); nsFrame::ListTag(stdout, frame); - printf(" prevBottomMargin=%d, setting to zero\n", + PRINTF(" prevBottomMargin=%d, setting to zero\n", aState.mPrevBottomMargin); #endif aState.mPrevBottomMargin = 0; @@ -3984,18 +3990,18 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState, else { #ifdef NOISY_VERTICAL_MARGINS ListTag(stdout); - printf(": reflow complete for "); + PRINTF(": reflow complete for "); nsFrame::ListTag(stdout, frame); - printf(" prevBottomMargin=%d collapsedBottomMargin=%d\n", + PRINTF(" prevBottomMargin=%d collapsedBottomMargin=%d\n", aState.mPrevBottomMargin, collapsedBottomMargin); #endif aState.mPrevBottomMargin = collapsedBottomMargin; } #ifdef NOISY_VERTICAL_MARGINS ListTag(stdout); - printf(": frame="); + PRINTF(": frame="); nsFrame::ListTag(stdout, frame); - printf(" carriedOutBottomMargin=%d collapsedBottomMargin=%d => %d\n", + PRINTF(" carriedOutBottomMargin=%d collapsedBottomMargin=%d => %d\n", aLine->GetCarriedOutBottomMargin(), collapsedBottomMargin, aState.mPrevBottomMargin); #endif @@ -4020,8 +4026,8 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState, const nsMargin& margin = brc.GetMargin(); aLine->mMaximumWidth += margin.left + margin.right; #ifdef NOISY_MAXIMUM_WIDTH - printf("nsBlockFrame::ReflowBlockFrame parent block %p line %p aLine->mMaximumWidth set to brc.GetMaximumWidth %d, updating aState.mMaximumWidth\n", - this, aLine, aLine->mMaximumWidth); + PRINTF("nsBlockFrame::ReflowBlockFrame parent block %p line %p aLine->mMaximumWidth set to brc.GetMaximumWidth %d, updating aState.mMaximumWidth\n", + this, aLine, aLine->mMaximumWidth); #endif aState.UpdateMaximumWidth(aLine->mMaximumWidth); @@ -4132,7 +4138,7 @@ nsBlockFrame::ReflowInlineFrames(nsBlockReflowState& aState, spins++; if (1000 == spins) { ListTag(stdout); - printf(": yikes! spinning on a line over 1000 times!\n"); + PRINTF(": yikes! spinning on a line over 1000 times!\n"); NS_ABORT(); } #endif @@ -4204,7 +4210,7 @@ nsBlockFrame::DoReflowInlineFrames(nsBlockReflowState& aState, PRBool impactedByFloaters = aState.IsImpactedByFloater() ? PR_TRUE : PR_FALSE; aLine->SetLineIsImpactedByFloater(impactedByFloaters); #ifdef REALLY_NOISY_REFLOW - printf("nsBlockFrame::DoReflowInlineFrames %p impacted = %d\n", + PRINTF("nsBlockFrame::DoReflowInlineFrames %p impacted = %d\n", this, impactedByFloaters); #endif @@ -4346,9 +4352,9 @@ nsBlockFrame::ReflowInlineFrame(nsBlockReflowState& aState, PRBool reflowingFirstLetter = aLineLayout.GetFirstLetterStyleOK(); #ifdef NOISY_FIRST_LETTER ListTag(stdout); - printf(": reflowing "); + PRINTF(": reflowing "); nsFrame::ListTag(stdout, aFrame); - printf(" reflowingFirstLetter=%s\n", reflowingFirstLetter ? "on" : "off"); + PRINTF(" reflowingFirstLetter=%s\n", reflowingFirstLetter ? "on" : "off"); #endif // Remember if we have a percentage aware child on this line @@ -4371,7 +4377,7 @@ nsBlockFrame::ReflowInlineFrame(nsBlockReflowState& aState, } #ifdef REALLY_NOISY_REFLOW_CHILD nsFrame::ListTag(stdout, aFrame); - printf(": status=%x\n", frameReflowStatus); + PRINTF(": status=%x\n", frameReflowStatus); #endif #if defined(REFLOW_STATUS_COVERAGE) @@ -4555,14 +4561,14 @@ nsBlockFrame::SplitLine(nsBlockReflowState& aState, #ifdef DEBUG if (gNoisyReflow) { nsFrame::IndentBy(stdout, gNoiseIndent); - printf("split line: from line=%p pushCount=%d aFrame=", aLine, pushCount); + PRINTF("split line: from line=%p pushCount=%d aFrame=", aLine, pushCount); if (aFrame) { nsFrame::ListTag(stdout, aFrame); } else { - printf("(null)"); + PRINTF("(null)"); } - printf("\n"); + PRINTF("\n"); if (gReallyNoisyReflow) { aLine->List(aState.mPresContext, stdout, gNoiseIndent+1); } @@ -4693,8 +4699,8 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState, lastHeight = aLine->mBounds.y; if (abs(aLine->mBounds.y - lastHeight) > CRAZY_H/10) { nsFrame::ListTag(stdout); - printf(": line=%p y=%d line.bounds.height=%d\n", - aLine, aLine->mBounds.y, aLine->mBounds.height); + PRINTF(": line=%p y=%d line.bounds.height=%d\n", + aLine, aLine->mBounds.y, aLine->mBounds.height); } } else { @@ -4775,10 +4781,10 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState, #ifdef NOISY_MAX_ELEMENT_SIZE IndentBy(stdout, GetDepth()); if (NS_UNCONSTRAINEDSIZE == aState.mReflowState.availableWidth) { - printf("PASS1 "); + PRINTF("PASS1 "); } ListTag(stdout); - printf(": line.floaters=%s band.floaterCount=%d\n", + PRINTF(": line.floaters=%s band.floaterCount=%d\n", //aLine->mFloaters.NotEmpty() ? "yes" : "no", aState.mHaveRightFloaters ? "(have right floaters)" : "", aState.mBand.GetFloaterCount()); @@ -4801,8 +4807,8 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState, // incremental reflow aLine->mMaxElementWidth = maxElementSize.width; #ifdef NOISY_MAX_ELEMENT_SIZE - printf ("nsBlockFrame::PlaceLine: %p setting MES for line %p to %d\n", - this, aLine, maxElementSize.width); + PRINTF ("nsBlockFrame::PlaceLine: %p setting MES for line %p to %d\n", + this, aLine, maxElementSize.width); #endif } @@ -4830,7 +4836,7 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState, aLine->GetCombinedArea(&lineCombinedArea); #ifdef NOISY_COMBINED_AREA ListTag(stdout); - printf(": lineCA=%d,%d,%d,%d floaterCA=%d,%d,%d,%d\n", + PRINTF(": lineCA=%d,%d,%d,%d floaterCA=%d,%d,%d,%d\n", lineCombinedArea.x, lineCombinedArea.y, lineCombinedArea.width, lineCombinedArea.height, aState.mFloaterCombinedArea.x, aState.mFloaterCombinedArea.y, @@ -4851,7 +4857,7 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState, // most edge of all the right floaters. Therefore, to accomplish our goal // all we do is set that X value to the lines XMost value. #ifdef NOISY_COMBINED_AREA - printf(" ==> rightFloaterCA=%d,%d,%d,%d lineXMost=%d\n", + PRINTF(" ==> rightFloaterCA=%d,%d,%d,%d lineXMost=%d\n", aState.mRightFloaterCombinedArea.x, aState.mRightFloaterCombinedArea.y, aState.mRightFloaterCombinedArea.width, @@ -4870,7 +4876,7 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState, } aLine->SetCombinedArea(lineCombinedArea); #ifdef NOISY_COMBINED_AREA - printf(" ==> final lineCA=%d,%d,%d,%d\n", + PRINTF(" ==> final lineCA=%d,%d,%d,%d\n", lineCombinedArea.x, lineCombinedArea.y, lineCombinedArea.width, lineCombinedArea.height); #endif @@ -4903,10 +4909,10 @@ nsBlockFrame::ComputeLineMaxElementSize(nsBlockReflowState& aState, #ifdef NOISY_MAX_ELEMENT_SIZE IndentBy(stdout, GetDepth()); if (NS_UNCONSTRAINEDSIZE == aState.mReflowState.availableWidth) { - printf("PASS1 "); + PRINTF("PASS1 "); } ListTag(stdout); - printf(": maxFloaterSize=%d,%d\n", maxWidth, maxHeight); + PRINTF(": maxFloaterSize=%d,%d\n", maxWidth, maxHeight); #endif // If the floaters are wider than the content, then use the maximum @@ -4933,8 +4939,8 @@ nsBlockFrame::ComputeLineMaxElementSize(nsBlockReflowState& aState, } } #ifdef NOISY_MAX_ELEMENT_SIZE - printf ("nsBlockFrame::ComputeLineMaxElementSize: %p returning MES %d\n", - this, aMaxElementSize->width); + PRINTF ("nsBlockFrame::ComputeLineMaxElementSize: %p returning MES %d\n", + this, aMaxElementSize->width); #endif } @@ -4960,8 +4966,8 @@ nsBlockFrame::PostPlaceLine(nsBlockReflowState& aState, // incremental reflow aLine->mMaxElementWidth = aMaxElementSize.width; #ifdef NOISY_MAX_ELEMENT_SIZE - printf ("nsBlockFrame::PostPlaceLine: %p setting line %p MES %d\n", - this, aLine, aMaxElementSize.width); + PRINTF ("nsBlockFrame::PostPlaceLine: %p setting line %p MES %d\n", + this, aLine, aMaxElementSize.width); #endif } @@ -4970,7 +4976,7 @@ nsBlockFrame::PostPlaceLine(nsBlockReflowState& aState, // calculate the maximum width if (aState.GetFlag(BRS_UNCONSTRAINEDWIDTH)) { #ifdef NOISY_MAXIMUM_WIDTH - printf("nsBlockFrame::PostPlaceLine during UC Reflow of block %p line %p caching max width %d\n", + PRINTF("nsBlockFrame::PostPlaceLine during UC Reflow of block %p line %p caching max width %d\n", this, aLine, aLine->mBounds.XMost()); #endif aLine->mMaximumWidth = aLine->mBounds.XMost(); @@ -4981,7 +4987,7 @@ nsBlockFrame::PostPlaceLine(nsBlockReflowState& aState, #ifdef DEBUG if (CRAZY_WIDTH(xmost)) { ListTag(stdout); - printf(": line=%p xmost=%d\n", aLine, xmost); + PRINTF(": line=%p xmost=%d\n", aLine, xmost); } #endif // If we're shrink wrapping our width and the line was wrapped, @@ -4989,13 +4995,13 @@ nsBlockFrame::PostPlaceLine(nsBlockReflowState& aState, if (aState.GetFlag(BRS_SHRINKWRAPWIDTH) && aLine->IsLineWrapped()) { aState.mKidXMost = aState.BorderPadding().left + aState.mContentArea.width; #ifdef NOISY_KIDXMOST - printf("%p PostPlaceLine A aState.mKidXMost=%d\n", this, aState.mKidXMost); + PRINTF("%p PostPlaceLine A aState.mKidXMost=%d\n", this, aState.mKidXMost); #endif } else if (xmost > aState.mKidXMost) { aState.mKidXMost = xmost; #ifdef NOISY_KIDXMOST - printf("%p PostPlaceLine B aState.mKidXMost=%d\n", this, aState.mKidXMost); + PRINTF("%p PostPlaceLine B aState.mKidXMost=%d\n", this, aState.mKidXMost); #endif } } @@ -5205,13 +5211,13 @@ nsBlockFrame::AppendFrames(nsIPresContext* aPresContext, // Add frames after the last child #ifdef NOISY_REFLOW_REASON ListTag(stdout); - printf(": append "); + PRINTF(": append "); nsFrame::ListTag(stdout, aFrameList); if (lastKid) { - printf(" after "); + PRINTF(" after "); nsFrame::ListTag(stdout, lastKid); } - printf("\n"); + PRINTF("\n"); #endif nsresult rv = AddFrames(aPresContext, aFrameList, lastKid); if (NS_SUCCEEDED(rv)) { @@ -5244,13 +5250,13 @@ nsBlockFrame::InsertFrames(nsIPresContext* aPresContext, #ifdef NOISY_REFLOW_REASON ListTag(stdout); - printf(": insert "); + PRINTF(": insert "); nsFrame::ListTag(stdout, aFrameList); if (aPrevFrame) { - printf(" after "); + PRINTF(" after "); nsFrame::ListTag(stdout, aPrevFrame); } - printf("\n"); + PRINTF("\n"); #endif nsresult rv = AddFrames(aPresContext, aFrameList, aPrevFrame); if (NS_SUCCEEDED(rv)) { @@ -5387,9 +5393,9 @@ nsBlockFrame::RemoveFrame(nsIPresContext* aPresContext, #ifdef NOISY_REFLOW_REASON ListTag(stdout); - printf(": remove "); + PRINTF(": remove "); nsFrame::ListTag(stdout, aOldFrame); - printf("\n"); + PRINTF("\n"); #endif if (nsLayoutAtoms::absoluteList == aListName) { @@ -5516,10 +5522,10 @@ nsBlockFrame::DoRemoveFrame(nsIPresContext* aPresContext, nsSplittableFrame::RemoveFromFlow(aDeletedFrame); } #ifdef NOISY_REMOVE_FRAME - printf("DoRemoveFrame: prevLine=%p line=%p frame=", + PRINTF("DoRemoveFrame: prevLine=%p line=%p frame=", prevLine, line); nsFrame::ListTag(stdout, aDeletedFrame); - printf(" prevSibling=%p nextInFlow=%p\n", prevSibling, nextInFlow); + PRINTF(" prevSibling=%p nextInFlow=%p\n", prevSibling, nextInFlow); #endif aDeletedFrame->Destroy(aPresContext); aDeletedFrame = nextInFlow; @@ -5537,7 +5543,7 @@ nsBlockFrame::DoRemoveFrame(nsIPresContext* aPresContext, nsRect lineCombinedArea; line->GetCombinedArea(&lineCombinedArea); #ifdef NOISY_BLOCK_INVALIDATE - printf("%p invalidate 10 (%d, %d, %d, %d)\n", + PRINTF("%p invalidate 10 (%d, %d, %d, %d)\n", this, lineCombinedArea.x, lineCombinedArea.y, lineCombinedArea.width, lineCombinedArea.height); #endif Invalidate(aPresContext, lineCombinedArea); @@ -5622,11 +5628,11 @@ nsBlockFrame::ReflowFloater(nsBlockReflowState& aState, nsMargin& aComputedOffsetsResult) { #ifdef NOISY_FLOATER - printf("Reflow Floater %p in parent %p, availSpace(%d,%d,%d,%d)\n", + PRINTF("Reflow Floater %p in parent %p, availSpace(%d,%d,%d,%d)\n", aPlaceholder->GetOutOfFlowFrame(), this, aState.mAvailSpaceRect.x, aState.mAvailSpaceRect.y, aState.mAvailSpaceRect.width, aState.mAvailSpaceRect.height - ); + ); #endif // XXX update this just aState.GetAvailableSpace(); @@ -5697,7 +5703,7 @@ nsBlockFrame::ReflowFloater(nsBlockReflowState& aState, aState.StoreMaxElementSize(floater, mes); } #ifdef NOISY_FLOATER - printf("end ReflowFloater %p, sized to %d,%d\n", floater, metrics.width, metrics.height); + PRINTF("end ReflowFloater %p, sized to %d,%d\n", floater, metrics.width, metrics.height); #endif return NS_OK; } @@ -6043,7 +6049,7 @@ nsBlockReflowState::PlaceFloater(nsFloaterCache* aFloaterCache, nscoord tx, ty; mSpaceManager->GetTranslation(tx, ty); nsFrame::ListTag(stdout, mBlock); - printf(": PlaceFloater: AddRectRegion: txy=%d,%d (%d,%d) {%d,%d,%d,%d}\n", + PRINTF(": PlaceFloater: AddRectRegion: txy=%d,%d (%d,%d) {%d,%d,%d,%d}\n", tx, ty, mSpaceManagerX, mSpaceManagerY, aFloaterCache->mRegion.x, aFloaterCache->mRegion.y, aFloaterCache->mRegion.width, aFloaterCache->mRegion.height); @@ -6102,9 +6108,9 @@ nsBlockReflowState::PlaceFloater(nsFloaterCache* aFloaterCache, nsRect r; floater->GetRect(r); nsFrame::IndentBy(stdout, gNoiseIndent); - printf("placed floater: "); + PRINTF("placed floater: "); ((nsFrame*)floater)->ListTag(stdout); - printf(" %d,%d,%d,%d\n", r.x, r.y, r.width, r.height); + PRINTF(" %d,%d,%d,%d\n", r.x, r.y, r.width, r.height); } #endif } @@ -6121,9 +6127,9 @@ nsBlockReflowState::PlaceBelowCurrentLineFloaters(nsFloaterCacheList& aList) #ifdef DEBUG if (gNoisyReflow) { nsFrame::IndentBy(stdout, gNoiseIndent); - printf("placing bcl floater: "); + PRINTF("placing bcl floater: "); nsFrame::ListTag(stdout, fc->mPlaceholder->GetOutOfFlowFrame()); - printf("\n"); + PRINTF("\n"); } #endif mBlock->ReflowFloater(*this, fc->mPlaceholder, fc->mCombinedArea, @@ -6143,13 +6149,13 @@ nsBlockReflowState::ClearFloaters(nscoord aY, PRUint8 aBreakType) #ifdef DEBUG if (gNoisyReflow) { nsFrame::IndentBy(stdout, gNoiseIndent); - printf("clear floaters: in: mY=%d aY=%d(%d)\n", + PRINTF("clear floaters: in: mY=%d aY=%d(%d)\n", mY, aY, aY - BorderPadding().top); } #endif #ifdef NOISY_FLOATER_CLEARING - printf("nsBlockReflowState::ClearFloaters: aY=%d breakType=%dn", + PRINTF("nsBlockReflowState::ClearFloaters: aY=%d breakType=%dn", aY, aBreakType); mSpaceManager->List(stdout); #endif @@ -6161,7 +6167,7 @@ nsBlockReflowState::ClearFloaters(nscoord aY, PRUint8 aBreakType) #ifdef DEBUG if (gNoisyReflow) { nsFrame::IndentBy(stdout, gNoiseIndent); - printf("clear floaters: out: mY=%d(%d)\n", mY, mY - bp.top); + PRINTF("clear floaters: out: mY=%d(%d)\n", mY, mY - bp.top); } #endif } @@ -6237,7 +6243,7 @@ nsBlockFrame::Paint(nsIPresContext* aPresContext, ComputeCombinedArea(mLines, mRect.width, mRect.height, ca); nsFrame::IndentBy(stdout, depth); ListTag(stdout); - printf(": bounds=%d,%d,%d,%d dirty=%d,%d,%d,%d ca=%d,%d,%d,%d\n", + PRINTF(": bounds=%d,%d,%d,%d dirty=%d,%d,%d,%d ca=%d,%d,%d,%d\n", mRect.x, mRect.y, mRect.width, mRect.height, aDirtyRect.x, aDirtyRect.y, aDirtyRect.width, aDirtyRect.height, ca.x, ca.y, ca.width, ca.height); @@ -6390,7 +6396,7 @@ nsBlockFrame::PaintChildren(nsIPresContext* aPresContext, nsRect lineCombinedArea; line->GetCombinedArea(&lineCombinedArea); nsFrame::IndentBy(stdout, depth+1); - printf("draw line=%p bounds=%d,%d,%d,%d ca=%d,%d,%d,%d\n", + PRINTF("draw line=%p bounds=%d,%d,%d,%d ca=%d,%d,%d,%d\n", line, line->mBounds.x, line->mBounds.y, line->mBounds.width, line->mBounds.height, lineCombinedArea.x, lineCombinedArea.y, @@ -6415,7 +6421,7 @@ nsBlockFrame::PaintChildren(nsIPresContext* aPresContext, nsRect lineCombinedArea; line->GetCombinedArea(&lineCombinedArea); nsFrame::IndentBy(stdout, depth+1); - printf("skip line=%p bounds=%d,%d,%d,%d ca=%d,%d,%d,%d\n", + PRINTF("skip line=%p bounds=%d,%d,%d,%d ca=%d,%d,%d,%d\n", line, line->mBounds.x, line->mBounds.y, line->mBounds.width, line->mBounds.height, lineCombinedArea.x, lineCombinedArea.y, @@ -6450,7 +6456,7 @@ nsBlockFrame::PaintChildren(nsIPresContext* aPresContext, ": %lld elapsed (%lld per line) lines=%d drawn=%d skip=%d", delta, deltaPerLine, numLines, drawnLines, numLines - drawnLines); - printf("%s\n", buf); + PRINTF("%s\n", buf); } #endif } @@ -6880,7 +6886,7 @@ nsBlockFrame::SetInitialChildList(nsIPresContext* aPresContext, mState |= NS_BLOCK_HAS_FIRST_LETTER_STYLE; #ifdef NOISY_FIRST_LETTER ListTag(stdout); - printf(": first-letter style found\n"); + PRINTF(": first-letter style found\n"); #endif NS_RELEASE(firstLetterStyle); } diff --git a/mozilla/layout/html/base/src/nsBlockReflowState.h b/mozilla/layout/html/base/src/nsBlockReflowState.h index c9a7aecd5dc..ff838739002 100644 --- a/mozilla/layout/html/base/src/nsBlockReflowState.h +++ b/mozilla/layout/html/base/src/nsBlockReflowState.h @@ -57,6 +57,12 @@ #include "nsSpaceManager.h" #include "prenv.h" #include "plstr.h" +#include "nslog.h" +#undef fprintf + +NS_IMPL_LOG(nsBlockFrameLog) +#define PRINTF NS_LOG_PRINTF(nsBlockFrameLog) +#define FLUSH NS_LOG_FLUSH(nsBlockFrameLog) #ifdef DEBUG @@ -92,14 +98,14 @@ static BlockDebugFlags gFlags[] = { static void ShowDebugFlags() { - printf("Here are the available GECKO_BLOCK_DEBUG_FLAGS:\n"); + PRINTF("Here are the available GECKO_BLOCK_DEBUG_FLAGS:\n"); BlockDebugFlags* bdf = gFlags; BlockDebugFlags* end = gFlags + NUM_DEBUG_FLAGS; for (; bdf < end; bdf++) { - printf(" %s\n", bdf->name); + PRINTF(" %s\n", bdf->name); } - printf("Note: GECKO_BLOCK_DEBUG_FLAGS is a comma seperated list of flag\n"); - printf("names (no whitespace)\n"); + PRINTF("Note: GECKO_BLOCK_DEBUG_FLAGS is a comma seperated list of flag\n"); + PRINTF("names (no whitespace)\n"); } static void @@ -121,7 +127,7 @@ InitDebugFlags() for (; bdf < end; bdf++) { if (PL_strcasecmp(bdf->name, flags) == 0) { *(bdf->on) = PR_TRUE; - printf("nsBlockFrame: setting %s debug flag on\n", bdf->name); + PRINTF("nsBlockFrame: setting %s debug flag on\n", bdf->name); gNoisy = PR_TRUE; found = PR_TRUE; break; @@ -192,17 +198,17 @@ DumpStyleGeneaology(nsIFrame* aFrame, const char* gap) { fputs(gap, stdout); nsFrame::ListTag(stdout, aFrame); - printf(": "); + PRINTF(": "); nsIStyleContext* sc; aFrame->GetStyleContext(&sc); while (nsnull != sc) { nsIStyleContext* psc; - printf("%p ", sc); + PRINTF("%p ", sc); psc = sc->GetParent(); NS_RELEASE(sc); sc = psc; } - printf("\n"); + PRINTF("\n"); } #endif @@ -240,7 +246,7 @@ RecordReflowStatus(PRBool aChildIsBlock, nsReflowStatus aFrameReflowStatus) // Log updates to the status that yield different values if (record[index] != newS) { record[index] = newS; - printf("record(%d): %02x %02x\n", index, record[0], record[1]); + PRINTF("record(%d): %02x %02x\n", index, record[0], record[1]); } } #endif @@ -311,7 +317,7 @@ public: #ifdef DEBUG if (gNoisyReflow) { nsFrame::IndentBy(stdout, gNoiseIndent); - printf("GetAvailableSpace: band=%d,%d,%d,%d count=%d\n", + PRINTF("GetAvailableSpace: band=%d,%d,%d,%d count=%d\n", mAvailSpaceRect.x, mAvailSpaceRect.y, mAvailSpaceRect.width, mAvailSpaceRect.height, mBand.GetTrapezoidCount()); @@ -332,7 +338,7 @@ public: #ifdef DEBUG if (gNoisyReflow) { nsFrame::IndentBy(stdout, gNoiseIndent); - printf("GetAvailableSpace: band=%d,%d,%d,%d count=%d\n", + PRINTF("GetAvailableSpace: band=%d,%d,%d,%d count=%d\n", mAvailSpaceRect.x, mAvailSpaceRect.y, mAvailSpaceRect.width, mAvailSpaceRect.height, mBand.GetTrapezoidCount()); @@ -387,10 +393,10 @@ public: (mMaxElementSize.height != oldSize.height)) { nsFrame::IndentBy(stdout, mBlock->GetDepth()); if (NS_UNCONSTRAINEDSIZE == mReflowState.availableWidth) { - printf("PASS1 "); + PRINTF("PASS1 "); } nsFrame::ListTag(stdout, mBlock); - printf(": old max-element-size=%d,%d new=%d,%d\n", + PRINTF(": old max-element-size=%d,%d new=%d,%d\n", oldSize.width, oldSize.height, mMaxElementSize.width, mMaxElementSize.height); } @@ -400,7 +406,7 @@ public: void UpdateMaximumWidth(nscoord aMaximumWidth) { if (aMaximumWidth > mMaximumWidth) { #ifdef NOISY_MAXIMUM_WIDTH - printf("nsBlockReflowState::UpdateMaximumWidth block %p caching max width %d\n", mBlock, aMaximumWidth); + PRINTF("nsBlockReflowState::UpdateMaximumWidth block %p caching max width %d\n", mBlock, aMaximumWidth); #endif mMaximumWidth = aMaximumWidth; } @@ -427,7 +433,7 @@ public: PRBool IsImpactedByFloater() { #ifdef REALLY_NOISY_REFLOW - printf("nsBlockReflowState::IsImpactedByFloater %p returned %d\n", + PRINTF("nsBlockReflowState::IsImpactedByFloater %p returned %d\n", this, mBand.GetFloaterCount()); #endif return mBand.GetFloaterCount(); @@ -721,7 +727,7 @@ nsBlockReflowState::nsBlockReflowState(const nsHTMLReflowState& aReflowState, SetFlag(BRS_COMPUTEMAXELEMENTSIZE, (nsnull != aMetrics.maxElementSize)); #ifdef NOISY_MAX_ELEMENT_SIZE - printf("BRS: setting compute-MES to %d\n", (nsnull != aMetrics.maxElementSize)); + PRINTF("BRS: setting compute-MES to %d\n", (nsnull != aMetrics.maxElementSize)); #endif mMaxElementSize.SizeTo(0, 0); SetFlag(BRS_COMPUTEMAXWIDTH, @@ -772,7 +778,7 @@ nsBlockReflowState::ComputeBlockAvailSpace(nsIFrame* aFrame, nsRect& aResult) { #ifdef REALLY_NOISY_REFLOW - printf("CBAS frame=%p has floater count %d\n", aFrame, mBand.GetFloaterCount()); + PRINTF("CBAS frame=%p has floater count %d\n", aFrame, mBand.GetFloaterCount()); mBand.List(); #endif aResult.y = mY; @@ -883,7 +889,7 @@ nsBlockReflowState::ComputeBlockAvailSpace(nsIFrame* aFrame, aResult.width = mAvailSpaceRect.width; } #ifdef REALLY_NOISY_REFLOW - printf(" CBAS: result %d %d %d %d\n", aResult.x, aResult.y, aResult.width, aResult.height); + PRINTF(" CBAS: result %d %d %d %d\n", aResult.x, aResult.y, aResult.width, aResult.height); #endif } @@ -902,7 +908,7 @@ nsBlockReflowState::ClearPastFloaters(PRUint8 aBreakType) ClearFloaters(saveY, aBreakType); #ifdef NOISY_FLOATER_CLEARING nsFrame::ListTag(stdout, mBlock); - printf(": ClearPastFloaters: mPrevBottomMargin=%d saveY=%d oldY=%d newY=%d deltaY=%d\n", + PRINTF(": ClearPastFloaters: mPrevBottomMargin=%d saveY=%d oldY=%d newY=%d deltaY=%d\n", mPrevBottomMargin, saveY, saveY - mPrevBottomMargin, mY, mY - saveY); #endif @@ -1012,17 +1018,17 @@ nsBlockReflowState::RecoverStateFrom(nsLineBox* aLine, #ifdef DEBUG if (CRAZY_WIDTH(xmost)) { nsFrame::ListTag(stdout, mBlock); - printf(": WARNING: xmost:%d\n", xmost); + PRINTF(": WARNING: xmost:%d\n", xmost); } #endif #ifdef NOISY_KIDXMOST - printf("%p RecoverState block %p aState.mKidXMost=%d\n", this, mBlock, xmost); + PRINTF("%p RecoverState block %p aState.mKidXMost=%d\n", this, mBlock, xmost); #endif mKidXMost = xmost; } if (GetFlag(BRS_COMPUTEMAXELEMENTSIZE)) { #ifdef NOISY_MAX_ELEMENT_SIZE - printf("nsBlockReflowState::RecoverStateFrom block %p caching max width %d\n", mBlock, aLine->mMaxElementWidth); + PRINTF("nsBlockReflowState::RecoverStateFrom block %p caching max width %d\n", mBlock, aLine->mMaxElementWidth); #endif UpdateMaxElementSize(nsSize(aLine->mMaxElementWidth, aLine->mBounds.height)); } @@ -1030,7 +1036,7 @@ nsBlockReflowState::RecoverStateFrom(nsLineBox* aLine, // If computing the maximum width, then update mMaximumWidth if (GetFlag(BRS_COMPUTEMAXWIDTH)) { #ifdef NOISY_MAXIMUM_WIDTH - printf("nsBlockReflowState::RecoverStateFrom block %p caching max width %d\n", mBlock, aLine->mMaximumWidth); + PRINTF("nsBlockReflowState::RecoverStateFrom block %p caching max width %d\n", mBlock, aLine->mMaximumWidth); #endif UpdateMaximumWidth(aLine->mMaximumWidth); } @@ -1041,9 +1047,9 @@ nsBlockReflowState::RecoverStateFrom(nsLineBox* aLine, aApplyTopMargin = ClearPastFloaters(aLine->GetBreakType()); #ifdef NOISY_VERTICAL_MARGINS nsFrame::ListTag(stdout, mBlock); - printf(": RecoverStateFrom: y=%d child ", mY); + PRINTF(": RecoverStateFrom: y=%d child ", mY); nsFrame::ListTag(stdout, aLine->mFirstChild); - printf(" has clear of %d => %s, mPrevBottomMargin=%d\n", aLine->mBreakType, + PRINTF(" has clear of %d => %s, mPrevBottomMargin=%d\n", aLine->mBreakType, aApplyTopMargin ? "applyTopMargin" : "nope", mPrevBottomMargin); #endif } @@ -1135,10 +1141,10 @@ nsBlockReflowState::RecoverStateFrom(nsLineBox* aLine, nscoord tx, ty; mSpaceManager->GetTranslation(tx, ty); nsFrame::IndentBy(stdout, gNoiseIndent); - printf("RecoverState: txy=%d,%d (%d,%d) ", + PRINTF("RecoverState: txy=%d,%d (%d,%d) ", tx, ty, mSpaceManagerX, mSpaceManagerY); nsFrame::ListTag(stdout, floater); - printf(" r.y=%d finalDeltaY=%d (sum=%d) region={%d,%d,%d,%d}\n", + PRINTF(" r.y=%d finalDeltaY=%d (sum=%d) region={%d,%d,%d,%d}\n", r.y, finalDeltaY, r.y + finalDeltaY, fc->mRegion.x, fc->mRegion.y, fc->mRegion.width, fc->mRegion.height); @@ -1278,7 +1284,7 @@ nsBlockFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) con IndentBy(out, aIndent); ListTag(out); #ifdef DEBUG_waterson - fprintf(out, " [parent=%p]", mParent); + FPRINTF(out, " [parent=%p]", mParent); #endif nsIView* view; GetView(aPresContext, &view); @@ -1508,7 +1514,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, if (gNoisyReflow) { IndentBy(stdout, gNoiseIndent); ListTag(stdout); - printf(": begin reflow type %d availSize=%d,%d computedSize=%d,%d\n", + PRINTF(": begin reflow type %d availSize=%d,%d computedSize=%d,%d\n", aReflowState.reason, aReflowState.availableWidth, aReflowState.availableHeight, aReflowState.mComputedWidth, aReflowState.mComputedHeight); } @@ -1582,7 +1588,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, extern char* nsPresShell_ReflowStackPointerTop; char marker; char* newsp = (char*) ▮ - printf("XXX: frame tree is too deep; approx stack size = %d\n", + PRINTF("XXX: frame tree is too deep; approx stack size = %d\n", nsPresShell_ReflowStackPointerTop - newsp); } #endif @@ -1605,7 +1611,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, nsHTMLReflowState& reflowState = (nsHTMLReflowState&)aReflowState; reflowState.mSpaceManager = spaceManager.get(); #ifdef NOISY_SPACEMANAGER - printf("constructed new space manager %p\n", reflowState.mSpaceManager); + PRINTF("constructed new space manager %p\n", reflowState.mSpaceManager); #endif } @@ -1624,7 +1630,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, case eReflowReason_Initial: #ifdef NOISY_REFLOW_REASON ListTag(stdout); - printf(": reflow=initial\n"); + PRINTF(": reflow=initial\n"); #endif DrainOverflowLines(aPresContext); rv = PrepareInitialReflow(state); @@ -1641,7 +1647,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, aReflowState.reflowCommand->GetType(type); #ifdef NOISY_REFLOW_REASON ListTag(stdout); - printf(": reflow=incremental type=%d\n", type); + PRINTF(": reflow=incremental type=%d\n", type); #endif switch (type) { case nsIReflowCommand::StyleChanged: @@ -1661,12 +1667,12 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, aReflowState.reflowCommand->GetNext(state.mNextRCFrame); #ifdef NOISY_REFLOW_REASON ListTag(stdout); - printf(": reflow=incremental"); + PRINTF(": reflow=incremental"); if (state.mNextRCFrame) { - printf(" next="); + PRINTF(" next="); nsFrame::ListTag(stdout, state.mNextRCFrame); } - printf("\n"); + PRINTF("\n"); #endif // this code does a correct job of propogating incremental reflows (bug 25510) @@ -1724,7 +1730,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, default: #ifdef NOISY_REFLOW_REASON ListTag(stdout); - printf(": reflow=resize (%d)\n", aReflowState.reason); + PRINTF(": reflow=resize (%d)\n", aReflowState.reason); #endif DrainOverflowLines(aPresContext); rv = PrepareResizeReflow(state); @@ -1749,7 +1755,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, } else { #ifdef DEBUG_kipp - ListTag(stdout); printf(": block is not complete\n"); + ListTag(stdout); PRINTF(": block is not complete\n"); #endif } } @@ -1769,7 +1775,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, if (xMost > aMetrics.width) { #ifdef NOISY_FINAL_SIZE ListTag(stdout); - printf(": changing desired width from %d to %d\n", aMetrics.width, xMost); + PRINTF(": changing desired width from %d to %d\n", aMetrics.width, xMost); #endif aMetrics.width = xMost; } @@ -1777,7 +1783,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, if (yMost > aMetrics.height) { #ifdef NOISY_FINAL_SIZE ListTag(stdout); - printf(": changing desired height from %d to %d\n", aMetrics.height, yMost); + PRINTF(": changing desired height from %d to %d\n", aMetrics.height, yMost); #endif aMetrics.height = yMost; } @@ -1810,7 +1816,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, if (NS_BLOCK_SPACE_MGR & mState) { nsHTMLReflowState& reflowState = (nsHTMLReflowState&)aReflowState; #ifdef NOISY_SPACEMANAGER - printf("restoring old space manager %p\n", oldSpaceManager); + PRINTF("restoring old space manager %p\n", oldSpaceManager); #endif reflowState.mSpaceManager = oldSpaceManager; } @@ -1819,7 +1825,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, nsHTMLReflowState& reflowState = (nsHTMLReflowState&)aReflowState; if (reflowState.mSpaceManager) { ListTag(stdout); - printf(": space-manager %p after reflow\n", reflowState.mSpaceManager); + PRINTF(": space-manager %p after reflow\n", reflowState.mSpaceManager); reflowState.mSpaceManager->List(stdout); } #endif @@ -1832,7 +1838,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, // Lots of things could have changed so damage our entire // bounds #ifdef NOISY_BLOCK_INVALIDATE - printf("%p invalidate 1 (%d, %d, %d, %d)\n", + PRINTF("%p invalidate 1 (%d, %d, %d, %d)\n", this, 0, 0, mRect.width, mRect.height); #endif Invalidate(aPresContext, nsRect(0, 0, mRect.width, mRect.height)); @@ -1862,7 +1868,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, damageRect.height = mRect.height; } #ifdef NOISY_BLOCK_INVALIDATE - printf("%p invalidate 2 (%d, %d, %d, %d)\n", + PRINTF("%p invalidate 2 (%d, %d, %d, %d)\n", this, damageRect.x, damageRect.y, damageRect.width, damageRect.height); #endif Invalidate(aPresContext, damageRect); @@ -1889,7 +1895,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, damageRect.height = border.bottom; } #ifdef NOISY_BLOCK_INVALIDATE - printf("%p invalidate 3 (%d, %d, %d, %d)\n", + PRINTF("%p invalidate 3 (%d, %d, %d, %d)\n", this, damageRect.x, damageRect.y, damageRect.width, damageRect.height); #endif Invalidate(aPresContext, damageRect); @@ -1933,23 +1939,23 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, if (gNoisyReflow) { IndentBy(stdout, gNoiseIndent); ListTag(stdout); - printf(": status=%x (%scomplete) metrics=%d,%d carriedMargin=%d", + PRINTF(": status=%x (%scomplete) metrics=%d,%d carriedMargin=%d", aStatus, NS_FRAME_IS_COMPLETE(aStatus) ? "" : "not ", aMetrics.width, aMetrics.height, aMetrics.mCarriedOutBottomMargin); if (mState & NS_FRAME_OUTSIDE_CHILDREN) { - printf(" combinedArea={%d,%d,%d,%d}", + PRINTF(" combinedArea={%d,%d,%d,%d}", aMetrics.mOverflowArea.x, aMetrics.mOverflowArea.y, aMetrics.mOverflowArea.width, aMetrics.mOverflowArea.height); } if (aMetrics.maxElementSize) { - printf(" maxElementSize=%d,%d", + PRINTF(" maxElementSize=%d,%d", aMetrics.maxElementSize->width, aMetrics.maxElementSize->height); } - printf("\n"); + PRINTF("\n"); } if (gLameReflowMetrics) { @@ -1968,12 +1974,12 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext, PR_snprintf(buf, sizeof(buf), ": %lld elapsed (%lld per line) (%d lines; %d new lines)", delta, perLineDelta, numLines, ectc - ctc); - printf("%s\n", buf); + PRINTF("%s\n", buf); } #endif #ifdef NOISY_MAX_ELEMENT_SIZE if (aMetrics.maxElementSize) { - printf("block %p returning with maxElementSize=%d,%d\n", this, + PRINTF("block %p returning with maxElementSize=%d,%d\n", this, aMetrics.maxElementSize->width, aMetrics.maxElementSize->height); } @@ -2057,7 +2063,7 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState, const nsMargin& borderPadding = aState.BorderPadding(); #ifdef NOISY_FINAL_SIZE ListTag(stdout); - printf(": mY=%d mIsBottomMarginRoot=%s mPrevBottomMargin=%d bp=%d,%d\n", + PRINTF(": mY=%d mIsBottomMarginRoot=%s mPrevBottomMargin=%d bp=%d,%d\n", aState.mY, aState.GetFlag(BRS_ISBOTTOMMARGINROOT) ? "yes" : "no", aState.mPrevBottomMargin, borderPadding.top, borderPadding.bottom); @@ -2066,7 +2072,7 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState, // Compute final width nscoord maxWidth = 0, maxHeight = 0; #ifdef NOISY_KIDXMOST - printf("%p aState.mKidXMost=%d\n", this, aState.mKidXMost); + PRINTF("%p aState.mKidXMost=%d\n", this, aState.mKidXMost); #endif nscoord minWidth = aState.mKidXMost + borderPadding.right; if (!HaveAutoWidth(aReflowState)) { @@ -2276,8 +2282,8 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState, aMetrics.maxElementSize->width = maxWidth; aMetrics.maxElementSize->height = maxHeight; #ifdef NOISY_MAX_ELEMENT_SIZE - printf ("nsBlockFrame::CFS: %p returning MES %d\n", - this, aMetrics.maxElementSize->width); + PRINTF ("nsBlockFrame::CFS: %p returning MES %d\n", + this, aMetrics.maxElementSize->width); #endif } @@ -2288,12 +2294,12 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState, #ifdef DEBUG_blocks if (CRAZY_WIDTH(aMetrics.width) || CRAZY_HEIGHT(aMetrics.height)) { ListTag(stdout); - printf(": WARNING: desired:%d,%d\n", aMetrics.width, aMetrics.height); + PRINTF(": WARNING: desired:%d,%d\n", aMetrics.width, aMetrics.height); } if (aState.GetFlag(BRS_COMPUTEMAXELEMENTSIZE) && ((maxWidth > aMetrics.width) || (maxHeight > aMetrics.height))) { ListTag(stdout); - printf(": WARNING: max-element-size:%d,%d desired:%d,%d maxSize:%d,%d\n", + PRINTF(": WARNING: max-element-size:%d,%d desired:%d,%d maxSize:%d,%d\n", maxWidth, maxHeight, aMetrics.width, aMetrics.height, aState.mReflowState.availableWidth, aState.mReflowState.availableHeight); @@ -2303,10 +2309,10 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState, if (aState.GetFlag(BRS_COMPUTEMAXELEMENTSIZE)) { IndentBy(stdout, GetDepth()); if (NS_UNCONSTRAINEDSIZE == aState.mReflowState.availableWidth) { - printf("PASS1 "); + PRINTF("PASS1 "); } ListTag(stdout); - printf(": max-element-size:%d,%d desired:%d,%d maxSize:%d,%d\n", + PRINTF(": max-element-size:%d,%d desired:%d,%d maxSize:%d,%d\n", maxWidth, maxHeight, aMetrics.width, aMetrics.height, aState.mReflowState.availableWidth, aState.mReflowState.availableHeight); @@ -2318,7 +2324,7 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState, // We need to add in for the right border/padding aMetrics.mMaximumWidth = aState.mMaximumWidth + borderPadding.right; #ifdef NOISY_MAXIMUM_WIDTH - printf("nsBlockFrame::ComputeFinalSize block %p setting aMetrics.mMaximumWidth to %d\n", this, aMetrics.mMaximumWidth); + PRINTF("nsBlockFrame::ComputeFinalSize block %p setting aMetrics.mMaximumWidth to %d\n", this, aMetrics.mMaximumWidth); #endif } @@ -2368,7 +2374,7 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState, } #ifdef NOISY_COMBINED_AREA ListTag(stdout); - printf(": ca=%d,%d,%d,%d\n", xa, ya, xb-xa, yb-ya); + PRINTF(": ca=%d,%d,%d,%d\n", xa, ya, xb-xa, yb-ya); #endif // If the combined area of our children exceeds our bounding box @@ -2427,7 +2433,7 @@ nsBlockFrame::MarkLineDirty(nsLineBox* aLine, nsLineBox* aPrevLine) if (gNoisyReflow) { IndentBy(stdout, gNoiseIndent); ListTag(stdout); - printf(": mark line %p dirty\n", aLine); + PRINTF(": mark line %p dirty\n", aLine); } #endif @@ -2440,7 +2446,7 @@ nsBlockFrame::MarkLineDirty(nsLineBox* aLine, nsLineBox* aPrevLine) if (gNoisyReflow) { IndentBy(stdout, gNoiseIndent); ListTag(stdout); - printf(": mark prev-line %p dirty\n", aPrevLine); + PRINTF(": mark prev-line %p dirty\n", aPrevLine); } #endif } @@ -2554,7 +2560,7 @@ nsBlockFrame::PrepareResizeReflow(nsBlockReflowState& aState) mStyleContext->GetStyleData(eStyleStruct_Text); IndentBy(stdout, gNoiseIndent); ListTag(stdout); - printf(": marking all lines dirty: reason=%d availWidth=%d textAlign=%d\n", + PRINTF(": marking all lines dirty: reason=%d availWidth=%d textAlign=%d\n", aState.mReflowState.reason, aState.mReflowState.availableWidth, mStyleText->mTextAlign); @@ -2587,7 +2593,7 @@ nsBlockFrame::PrepareResizeReflow(nsBlockReflowState& aState) if (gNoisyReflow) { IndentBy(stdout, gNoiseIndent); ListTag(stdout); - printf(": trying to avoid marking all lines dirty\n"); + PRINTF(": trying to avoid marking all lines dirty\n"); } #endif @@ -2601,8 +2607,8 @@ nsBlockFrame::PrepareResizeReflow(nsBlockReflowState& aState) else { // We can avoid reflowing *some* inline lines in some cases. #ifdef REALLY_NOISY_REFLOW - printf("PrepareResizeReflow thinks line %p is %simpacted by floaters\n", - line, line->IsImpactedByFloater() ? "" : "not "); + PRINTF("PrepareResizeReflow thinks line %p is %simpacted by floaters\n", + line, line->IsImpactedByFloater() ? "" : "not "); #endif if (notWrapping) { // When no-wrap is set then the only line-breaking that @@ -2628,7 +2634,7 @@ nsBlockFrame::PrepareResizeReflow(nsBlockReflowState& aState) #ifdef DEBUG if (gNoisyReflow && !line->IsDirty() && !notWrapping) { IndentBy(stdout, gNoiseIndent + 1); - printf("skipped: line=%p next=%p %s %s %s%s%s breakType=%d xmost=%d\n", + PRINTF("skipped: line=%p next=%p %s %s %s%s%s breakType=%d xmost=%d\n", line, line->mNext, line->IsBlock() ? "block" : "inline", aState.GetFlag(BRS_NOWRAP) ? "no-wrap" : "wrapping", @@ -2779,8 +2785,8 @@ nsBlockFrame::PropogateReflowDamage(nsBlockReflowState& aState, PRBool wasImpactedByFloater = next->IsImpactedByFloater(); PRBool isImpactedByFloater = aState.IsImpactedByFloater() ? PR_TRUE : PR_FALSE; #ifdef REALLY_NOISY_REFLOW - printf("nsBlockFrame::PropogateReflowDamage %p was = %d, is=%d\n", - this, wasImpactedByFloater, isImpactedByFloater); + PRINTF("nsBlockFrame::PropogateReflowDamage %p was = %d, is=%d\n", + this, wasImpactedByFloater, isImpactedByFloater); #endif if (wasImpactedByFloater != isImpactedByFloater) { next->MarkDirty(); @@ -2865,16 +2871,16 @@ nsBlockFrame::ReflowDirtyLines(nsBlockReflowState& aState) aState.mReflowState.reflowCommand->GetType(type); IndentBy(stdout, gNoiseIndent); ListTag(stdout); - printf(": incrementally reflowing dirty lines: type=%s(%d) isInline=%s", + PRINTF(": incrementally reflowing dirty lines: type=%s(%d) isInline=%s", kReflowCommandType[type], type, aState.GetFlag(BRS_ISINLINEINCRREFLOW) ? "true" : "false"); } else { IndentBy(stdout, gNoiseIndent); ListTag(stdout); - printf(": reflowing dirty lines"); + PRINTF(": reflowing dirty lines"); } - printf(" computedWidth=%d\n", aState.mReflowState.mComputedWidth); + PRINTF(" computedWidth=%d\n", aState.mReflowState.mComputedWidth); gNoiseIndent++; } #endif @@ -2902,7 +2908,7 @@ nsBlockFrame::ReflowDirtyLines(nsBlockReflowState& aState) &damageRect : 0); if (incrementalReflow && !damageRect.IsEmpty()) { #ifdef NOISY_BLOCK_INVALIDATE - printf("%p invalidate 4 (%d, %d, %d, %d)\n", + PRINTF("%p invalidate 4 (%d, %d, %d, %d)\n", this, damageRect.x, damageRect.y, damageRect.width, damageRect.height); #endif Invalidate(aState.mPresContext, damageRect); @@ -2919,7 +2925,7 @@ nsBlockFrame::ReflowDirtyLines(nsBlockReflowState& aState) nsRect lca; line->GetCombinedArea(&lca); IndentBy(stdout, gNoiseIndent); - printf("line=%p mY=%d dirty=%s oldBounds={%d,%d,%d,%d} oldCombinedArea={%d,%d,%d,%d} deltaY=%d mPrevBottomMargin=%d\n", + PRINTF("line=%p mY=%d dirty=%s oldBounds={%d,%d,%d,%d} oldCombinedArea={%d,%d,%d,%d} deltaY=%d mPrevBottomMargin=%d\n", line, aState.mY, line->IsDirty() ? "yes" : "no", line->mBounds.x, line->mBounds.y, line->mBounds.width, line->mBounds.height, @@ -2977,7 +2983,7 @@ nsBlockFrame::ReflowDirtyLines(nsBlockReflowState& aState) &damageRect : 0); if (incrementalReflow && !damageRect.IsEmpty()) { #ifdef NOISY_BLOCK_INVALIDATE - printf("%p invalidate 5 (%d, %d, %d, %d)\n", + PRINTF("%p invalidate 5 (%d, %d, %d, %d)\n", this, damageRect.x, damageRect.y, damageRect.width, damageRect.height); #endif Invalidate(aState.mPresContext, damageRect); @@ -2990,7 +2996,7 @@ nsBlockFrame::ReflowDirtyLines(nsBlockReflowState& aState) nsRect lca; line->GetCombinedArea(&lca); IndentBy(stdout, gNoiseIndent); - printf("line=%p mY=%d newBounds={%d,%d,%d,%d} newCombinedArea={%d,%d,%d,%d} deltaY=%d mPrevBottomMargin=%d\n", + PRINTF("line=%p mY=%d newBounds={%d,%d,%d,%d} newCombinedArea={%d,%d,%d,%d} deltaY=%d mPrevBottomMargin=%d\n", line, aState.mY, line->mBounds.x, line->mBounds.y, line->mBounds.width, line->mBounds.height, @@ -3089,7 +3095,7 @@ nsBlockFrame::ReflowDirtyLines(nsBlockReflowState& aState) gNoiseIndent--; IndentBy(stdout, gNoiseIndent); ListTag(stdout); - printf(": done reflowing dirty lines (status=%x)\n", + PRINTF(": done reflowing dirty lines (status=%x)\n", aState.mReflowStatus); } #endif @@ -3154,7 +3160,7 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState, nsRect dirtyRect; dirtyRect.UnionRect(oldCombinedArea, lineCombinedArea); #ifdef NOISY_BLOCK_INVALIDATE - printf("%p invalidate 6 (%d, %d, %d, %d)\n", + PRINTF("%p invalidate 6 (%d, %d, %d, %d)\n", this, dirtyRect.x, dirtyRect.y, dirtyRect.width, dirtyRect.height); #endif Invalidate(aState.mPresContext, dirtyRect); @@ -3174,7 +3180,7 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState, dirtyRect.height = PR_MAX(oldCombinedArea.height, lineCombinedArea.height); #ifdef NOISY_BLOCK_INVALIDATE - printf("%p invalidate 7 (%d, %d, %d, %d)\n", + PRINTF("%p invalidate 7 (%d, %d, %d, %d)\n", this, dirtyRect.x, dirtyRect.y, dirtyRect.width, dirtyRect.height); #endif Invalidate(aState.mPresContext, dirtyRect); @@ -3193,7 +3199,7 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState, lineCombinedArea.YMost()) - dirtyRect.y; #ifdef NOISY_BLOCK_INVALIDATE - printf("%p invalidate 8 (%d, %d, %d, %d)\n", + PRINTF("%p invalidate 8 (%d, %d, %d, %d)\n", this, dirtyRect.x, dirtyRect.y, dirtyRect.width, dirtyRect.height); #endif Invalidate(aState.mPresContext, dirtyRect); @@ -3233,7 +3239,7 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState, // Update the line's maximum width aLine->mMaximumWidth = aLine->mBounds.XMost(); #ifdef NOISY_MAXIMUM_WIDTH - printf("nsBlockFrame::ReflowLine block %p line %p setting aLine.mMaximumWidth to %d\n", + PRINTF("nsBlockFrame::ReflowLine block %p line %p setting aLine.mMaximumWidth to %d\n", this, aLine, aLine->mMaximumWidth); #endif aState.UpdateMaximumWidth(aLine->mMaximumWidth); @@ -3263,7 +3269,7 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState, if (aState.GetFlag(BRS_COMPUTEMAXWIDTH)) { #ifdef NOISY_MAXIMUM_WIDTH - printf("nsBlockFrame::ReflowLine block %p line %p setting aLine.mMaximumWidth to %d\n", + PRINTF("nsBlockFrame::ReflowLine block %p line %p setting aLine.mMaximumWidth to %d\n", this, aLine, aLine->mMaximumWidth); #endif aState.UpdateMaximumWidth(aLine->mMaximumWidth); @@ -3271,7 +3277,7 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState, if (aState.GetFlag(BRS_COMPUTEMAXELEMENTSIZE)) { #ifdef NOISY_MAX_ELEMENT_SIZE - printf("nsBlockFrame::ReflowLine block %p line %p setting aLine.mMaxElementWidth to %d\n", + PRINTF("nsBlockFrame::ReflowLine block %p line %p setting aLine.mMaxElementWidth to %d\n", this, aLine, aLine->mMaxElementWidth); #endif aState.UpdateMaxElementSize(nsSize(aLine->mMaxElementWidth, aLine->mBounds.height)); @@ -3290,11 +3296,11 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState, nsRect dirtyRect; dirtyRect.UnionRect(oldCombinedArea, combinedArea); #ifdef NOISY_BLOCK_INVALIDATE - printf("%p invalidate because %s is true (%d, %d, %d, %d)\n", + PRINTF("%p invalidate because %s is true (%d, %d, %d, %d)\n", this, aDamageDirtyArea ? "aDamageDirtyArea" : "aLine->IsForceInvalidate", dirtyRect.x, dirtyRect.y, dirtyRect.width, dirtyRect.height); if (aLine->IsForceInvalidate()) - printf(" dirty line is %p\n"); + PRINTF(" dirty line is %p\n"); #endif Invalidate(aState.mPresContext, dirtyRect); } @@ -3525,7 +3531,7 @@ nsBlockFrame::UpdateSpaceManager(nsIPresContext* aPresContext, nscoord tx, ty; aSpaceManager->GetTranslation(tx, ty); nsFrame::ListTag(stdout, this); - printf(": UpdateSpaceManager: AddRectRegion: txy=%d,%d {%d,%d,%d,%d}\n", + PRINTF(": UpdateSpaceManager: AddRectRegion: txy=%d,%d {%d,%d,%d,%d}\n", tx, ty, fc->mRegion.x, fc->mRegion.y, fc->mRegion.width, fc->mRegion.height); @@ -3808,9 +3814,9 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState, } #ifdef NOISY_VERTICAL_MARGINS ListTag(stdout); - printf(": y=%d child ", aState.mY); + PRINTF(": y=%d child ", aState.mY); ListTag(stdout, frame); - printf(" has clear of %d => %s, mPrevBottomMargin=%d\n", + PRINTF(" has clear of %d => %s, mPrevBottomMargin=%d\n", breakType, applyTopMargin ? "applyTopMargin" : "nope", aState.mPrevBottomMargin); @@ -3850,7 +3856,7 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState, // Compute the available space for the block aState.GetAvailableSpace(); #ifdef REALLY_NOISY_REFLOW - printf("setting line %p isImpacted to %s\n", aLine, aState.IsImpactedByFloater()?"true":"false"); + PRINTF("setting line %p isImpacted to %s\n", aLine, aState.IsImpactedByFloater()?"true":"false"); #endif PRBool isImpacted = aState.IsImpactedByFloater() ? PR_TRUE : PR_FALSE; aLine->SetLineIsImpactedByFloater(isImpacted); @@ -3974,9 +3980,9 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState, // therefore zero out the running margin value. #ifdef NOISY_VERTICAL_MARGINS ListTag(stdout); - printf(": reflow incomplete, frame="); + PRINTF(": reflow incomplete, frame="); nsFrame::ListTag(stdout, frame); - printf(" prevBottomMargin=%d, setting to zero\n", + PRINTF(" prevBottomMargin=%d, setting to zero\n", aState.mPrevBottomMargin); #endif aState.mPrevBottomMargin = 0; @@ -3984,18 +3990,18 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState, else { #ifdef NOISY_VERTICAL_MARGINS ListTag(stdout); - printf(": reflow complete for "); + PRINTF(": reflow complete for "); nsFrame::ListTag(stdout, frame); - printf(" prevBottomMargin=%d collapsedBottomMargin=%d\n", + PRINTF(" prevBottomMargin=%d collapsedBottomMargin=%d\n", aState.mPrevBottomMargin, collapsedBottomMargin); #endif aState.mPrevBottomMargin = collapsedBottomMargin; } #ifdef NOISY_VERTICAL_MARGINS ListTag(stdout); - printf(": frame="); + PRINTF(": frame="); nsFrame::ListTag(stdout, frame); - printf(" carriedOutBottomMargin=%d collapsedBottomMargin=%d => %d\n", + PRINTF(" carriedOutBottomMargin=%d collapsedBottomMargin=%d => %d\n", aLine->GetCarriedOutBottomMargin(), collapsedBottomMargin, aState.mPrevBottomMargin); #endif @@ -4020,8 +4026,8 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState, const nsMargin& margin = brc.GetMargin(); aLine->mMaximumWidth += margin.left + margin.right; #ifdef NOISY_MAXIMUM_WIDTH - printf("nsBlockFrame::ReflowBlockFrame parent block %p line %p aLine->mMaximumWidth set to brc.GetMaximumWidth %d, updating aState.mMaximumWidth\n", - this, aLine, aLine->mMaximumWidth); + PRINTF("nsBlockFrame::ReflowBlockFrame parent block %p line %p aLine->mMaximumWidth set to brc.GetMaximumWidth %d, updating aState.mMaximumWidth\n", + this, aLine, aLine->mMaximumWidth); #endif aState.UpdateMaximumWidth(aLine->mMaximumWidth); @@ -4132,7 +4138,7 @@ nsBlockFrame::ReflowInlineFrames(nsBlockReflowState& aState, spins++; if (1000 == spins) { ListTag(stdout); - printf(": yikes! spinning on a line over 1000 times!\n"); + PRINTF(": yikes! spinning on a line over 1000 times!\n"); NS_ABORT(); } #endif @@ -4204,7 +4210,7 @@ nsBlockFrame::DoReflowInlineFrames(nsBlockReflowState& aState, PRBool impactedByFloaters = aState.IsImpactedByFloater() ? PR_TRUE : PR_FALSE; aLine->SetLineIsImpactedByFloater(impactedByFloaters); #ifdef REALLY_NOISY_REFLOW - printf("nsBlockFrame::DoReflowInlineFrames %p impacted = %d\n", + PRINTF("nsBlockFrame::DoReflowInlineFrames %p impacted = %d\n", this, impactedByFloaters); #endif @@ -4346,9 +4352,9 @@ nsBlockFrame::ReflowInlineFrame(nsBlockReflowState& aState, PRBool reflowingFirstLetter = aLineLayout.GetFirstLetterStyleOK(); #ifdef NOISY_FIRST_LETTER ListTag(stdout); - printf(": reflowing "); + PRINTF(": reflowing "); nsFrame::ListTag(stdout, aFrame); - printf(" reflowingFirstLetter=%s\n", reflowingFirstLetter ? "on" : "off"); + PRINTF(" reflowingFirstLetter=%s\n", reflowingFirstLetter ? "on" : "off"); #endif // Remember if we have a percentage aware child on this line @@ -4371,7 +4377,7 @@ nsBlockFrame::ReflowInlineFrame(nsBlockReflowState& aState, } #ifdef REALLY_NOISY_REFLOW_CHILD nsFrame::ListTag(stdout, aFrame); - printf(": status=%x\n", frameReflowStatus); + PRINTF(": status=%x\n", frameReflowStatus); #endif #if defined(REFLOW_STATUS_COVERAGE) @@ -4555,14 +4561,14 @@ nsBlockFrame::SplitLine(nsBlockReflowState& aState, #ifdef DEBUG if (gNoisyReflow) { nsFrame::IndentBy(stdout, gNoiseIndent); - printf("split line: from line=%p pushCount=%d aFrame=", aLine, pushCount); + PRINTF("split line: from line=%p pushCount=%d aFrame=", aLine, pushCount); if (aFrame) { nsFrame::ListTag(stdout, aFrame); } else { - printf("(null)"); + PRINTF("(null)"); } - printf("\n"); + PRINTF("\n"); if (gReallyNoisyReflow) { aLine->List(aState.mPresContext, stdout, gNoiseIndent+1); } @@ -4693,8 +4699,8 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState, lastHeight = aLine->mBounds.y; if (abs(aLine->mBounds.y - lastHeight) > CRAZY_H/10) { nsFrame::ListTag(stdout); - printf(": line=%p y=%d line.bounds.height=%d\n", - aLine, aLine->mBounds.y, aLine->mBounds.height); + PRINTF(": line=%p y=%d line.bounds.height=%d\n", + aLine, aLine->mBounds.y, aLine->mBounds.height); } } else { @@ -4775,10 +4781,10 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState, #ifdef NOISY_MAX_ELEMENT_SIZE IndentBy(stdout, GetDepth()); if (NS_UNCONSTRAINEDSIZE == aState.mReflowState.availableWidth) { - printf("PASS1 "); + PRINTF("PASS1 "); } ListTag(stdout); - printf(": line.floaters=%s band.floaterCount=%d\n", + PRINTF(": line.floaters=%s band.floaterCount=%d\n", //aLine->mFloaters.NotEmpty() ? "yes" : "no", aState.mHaveRightFloaters ? "(have right floaters)" : "", aState.mBand.GetFloaterCount()); @@ -4801,8 +4807,8 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState, // incremental reflow aLine->mMaxElementWidth = maxElementSize.width; #ifdef NOISY_MAX_ELEMENT_SIZE - printf ("nsBlockFrame::PlaceLine: %p setting MES for line %p to %d\n", - this, aLine, maxElementSize.width); + PRINTF ("nsBlockFrame::PlaceLine: %p setting MES for line %p to %d\n", + this, aLine, maxElementSize.width); #endif } @@ -4830,7 +4836,7 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState, aLine->GetCombinedArea(&lineCombinedArea); #ifdef NOISY_COMBINED_AREA ListTag(stdout); - printf(": lineCA=%d,%d,%d,%d floaterCA=%d,%d,%d,%d\n", + PRINTF(": lineCA=%d,%d,%d,%d floaterCA=%d,%d,%d,%d\n", lineCombinedArea.x, lineCombinedArea.y, lineCombinedArea.width, lineCombinedArea.height, aState.mFloaterCombinedArea.x, aState.mFloaterCombinedArea.y, @@ -4851,7 +4857,7 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState, // most edge of all the right floaters. Therefore, to accomplish our goal // all we do is set that X value to the lines XMost value. #ifdef NOISY_COMBINED_AREA - printf(" ==> rightFloaterCA=%d,%d,%d,%d lineXMost=%d\n", + PRINTF(" ==> rightFloaterCA=%d,%d,%d,%d lineXMost=%d\n", aState.mRightFloaterCombinedArea.x, aState.mRightFloaterCombinedArea.y, aState.mRightFloaterCombinedArea.width, @@ -4870,7 +4876,7 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState, } aLine->SetCombinedArea(lineCombinedArea); #ifdef NOISY_COMBINED_AREA - printf(" ==> final lineCA=%d,%d,%d,%d\n", + PRINTF(" ==> final lineCA=%d,%d,%d,%d\n", lineCombinedArea.x, lineCombinedArea.y, lineCombinedArea.width, lineCombinedArea.height); #endif @@ -4903,10 +4909,10 @@ nsBlockFrame::ComputeLineMaxElementSize(nsBlockReflowState& aState, #ifdef NOISY_MAX_ELEMENT_SIZE IndentBy(stdout, GetDepth()); if (NS_UNCONSTRAINEDSIZE == aState.mReflowState.availableWidth) { - printf("PASS1 "); + PRINTF("PASS1 "); } ListTag(stdout); - printf(": maxFloaterSize=%d,%d\n", maxWidth, maxHeight); + PRINTF(": maxFloaterSize=%d,%d\n", maxWidth, maxHeight); #endif // If the floaters are wider than the content, then use the maximum @@ -4933,8 +4939,8 @@ nsBlockFrame::ComputeLineMaxElementSize(nsBlockReflowState& aState, } } #ifdef NOISY_MAX_ELEMENT_SIZE - printf ("nsBlockFrame::ComputeLineMaxElementSize: %p returning MES %d\n", - this, aMaxElementSize->width); + PRINTF ("nsBlockFrame::ComputeLineMaxElementSize: %p returning MES %d\n", + this, aMaxElementSize->width); #endif } @@ -4960,8 +4966,8 @@ nsBlockFrame::PostPlaceLine(nsBlockReflowState& aState, // incremental reflow aLine->mMaxElementWidth = aMaxElementSize.width; #ifdef NOISY_MAX_ELEMENT_SIZE - printf ("nsBlockFrame::PostPlaceLine: %p setting line %p MES %d\n", - this, aLine, aMaxElementSize.width); + PRINTF ("nsBlockFrame::PostPlaceLine: %p setting line %p MES %d\n", + this, aLine, aMaxElementSize.width); #endif } @@ -4970,7 +4976,7 @@ nsBlockFrame::PostPlaceLine(nsBlockReflowState& aState, // calculate the maximum width if (aState.GetFlag(BRS_UNCONSTRAINEDWIDTH)) { #ifdef NOISY_MAXIMUM_WIDTH - printf("nsBlockFrame::PostPlaceLine during UC Reflow of block %p line %p caching max width %d\n", + PRINTF("nsBlockFrame::PostPlaceLine during UC Reflow of block %p line %p caching max width %d\n", this, aLine, aLine->mBounds.XMost()); #endif aLine->mMaximumWidth = aLine->mBounds.XMost(); @@ -4981,7 +4987,7 @@ nsBlockFrame::PostPlaceLine(nsBlockReflowState& aState, #ifdef DEBUG if (CRAZY_WIDTH(xmost)) { ListTag(stdout); - printf(": line=%p xmost=%d\n", aLine, xmost); + PRINTF(": line=%p xmost=%d\n", aLine, xmost); } #endif // If we're shrink wrapping our width and the line was wrapped, @@ -4989,13 +4995,13 @@ nsBlockFrame::PostPlaceLine(nsBlockReflowState& aState, if (aState.GetFlag(BRS_SHRINKWRAPWIDTH) && aLine->IsLineWrapped()) { aState.mKidXMost = aState.BorderPadding().left + aState.mContentArea.width; #ifdef NOISY_KIDXMOST - printf("%p PostPlaceLine A aState.mKidXMost=%d\n", this, aState.mKidXMost); + PRINTF("%p PostPlaceLine A aState.mKidXMost=%d\n", this, aState.mKidXMost); #endif } else if (xmost > aState.mKidXMost) { aState.mKidXMost = xmost; #ifdef NOISY_KIDXMOST - printf("%p PostPlaceLine B aState.mKidXMost=%d\n", this, aState.mKidXMost); + PRINTF("%p PostPlaceLine B aState.mKidXMost=%d\n", this, aState.mKidXMost); #endif } } @@ -5205,13 +5211,13 @@ nsBlockFrame::AppendFrames(nsIPresContext* aPresContext, // Add frames after the last child #ifdef NOISY_REFLOW_REASON ListTag(stdout); - printf(": append "); + PRINTF(": append "); nsFrame::ListTag(stdout, aFrameList); if (lastKid) { - printf(" after "); + PRINTF(" after "); nsFrame::ListTag(stdout, lastKid); } - printf("\n"); + PRINTF("\n"); #endif nsresult rv = AddFrames(aPresContext, aFrameList, lastKid); if (NS_SUCCEEDED(rv)) { @@ -5244,13 +5250,13 @@ nsBlockFrame::InsertFrames(nsIPresContext* aPresContext, #ifdef NOISY_REFLOW_REASON ListTag(stdout); - printf(": insert "); + PRINTF(": insert "); nsFrame::ListTag(stdout, aFrameList); if (aPrevFrame) { - printf(" after "); + PRINTF(" after "); nsFrame::ListTag(stdout, aPrevFrame); } - printf("\n"); + PRINTF("\n"); #endif nsresult rv = AddFrames(aPresContext, aFrameList, aPrevFrame); if (NS_SUCCEEDED(rv)) { @@ -5387,9 +5393,9 @@ nsBlockFrame::RemoveFrame(nsIPresContext* aPresContext, #ifdef NOISY_REFLOW_REASON ListTag(stdout); - printf(": remove "); + PRINTF(": remove "); nsFrame::ListTag(stdout, aOldFrame); - printf("\n"); + PRINTF("\n"); #endif if (nsLayoutAtoms::absoluteList == aListName) { @@ -5516,10 +5522,10 @@ nsBlockFrame::DoRemoveFrame(nsIPresContext* aPresContext, nsSplittableFrame::RemoveFromFlow(aDeletedFrame); } #ifdef NOISY_REMOVE_FRAME - printf("DoRemoveFrame: prevLine=%p line=%p frame=", + PRINTF("DoRemoveFrame: prevLine=%p line=%p frame=", prevLine, line); nsFrame::ListTag(stdout, aDeletedFrame); - printf(" prevSibling=%p nextInFlow=%p\n", prevSibling, nextInFlow); + PRINTF(" prevSibling=%p nextInFlow=%p\n", prevSibling, nextInFlow); #endif aDeletedFrame->Destroy(aPresContext); aDeletedFrame = nextInFlow; @@ -5537,7 +5543,7 @@ nsBlockFrame::DoRemoveFrame(nsIPresContext* aPresContext, nsRect lineCombinedArea; line->GetCombinedArea(&lineCombinedArea); #ifdef NOISY_BLOCK_INVALIDATE - printf("%p invalidate 10 (%d, %d, %d, %d)\n", + PRINTF("%p invalidate 10 (%d, %d, %d, %d)\n", this, lineCombinedArea.x, lineCombinedArea.y, lineCombinedArea.width, lineCombinedArea.height); #endif Invalidate(aPresContext, lineCombinedArea); @@ -5622,11 +5628,11 @@ nsBlockFrame::ReflowFloater(nsBlockReflowState& aState, nsMargin& aComputedOffsetsResult) { #ifdef NOISY_FLOATER - printf("Reflow Floater %p in parent %p, availSpace(%d,%d,%d,%d)\n", + PRINTF("Reflow Floater %p in parent %p, availSpace(%d,%d,%d,%d)\n", aPlaceholder->GetOutOfFlowFrame(), this, aState.mAvailSpaceRect.x, aState.mAvailSpaceRect.y, aState.mAvailSpaceRect.width, aState.mAvailSpaceRect.height - ); + ); #endif // XXX update this just aState.GetAvailableSpace(); @@ -5697,7 +5703,7 @@ nsBlockFrame::ReflowFloater(nsBlockReflowState& aState, aState.StoreMaxElementSize(floater, mes); } #ifdef NOISY_FLOATER - printf("end ReflowFloater %p, sized to %d,%d\n", floater, metrics.width, metrics.height); + PRINTF("end ReflowFloater %p, sized to %d,%d\n", floater, metrics.width, metrics.height); #endif return NS_OK; } @@ -6043,7 +6049,7 @@ nsBlockReflowState::PlaceFloater(nsFloaterCache* aFloaterCache, nscoord tx, ty; mSpaceManager->GetTranslation(tx, ty); nsFrame::ListTag(stdout, mBlock); - printf(": PlaceFloater: AddRectRegion: txy=%d,%d (%d,%d) {%d,%d,%d,%d}\n", + PRINTF(": PlaceFloater: AddRectRegion: txy=%d,%d (%d,%d) {%d,%d,%d,%d}\n", tx, ty, mSpaceManagerX, mSpaceManagerY, aFloaterCache->mRegion.x, aFloaterCache->mRegion.y, aFloaterCache->mRegion.width, aFloaterCache->mRegion.height); @@ -6102,9 +6108,9 @@ nsBlockReflowState::PlaceFloater(nsFloaterCache* aFloaterCache, nsRect r; floater->GetRect(r); nsFrame::IndentBy(stdout, gNoiseIndent); - printf("placed floater: "); + PRINTF("placed floater: "); ((nsFrame*)floater)->ListTag(stdout); - printf(" %d,%d,%d,%d\n", r.x, r.y, r.width, r.height); + PRINTF(" %d,%d,%d,%d\n", r.x, r.y, r.width, r.height); } #endif } @@ -6121,9 +6127,9 @@ nsBlockReflowState::PlaceBelowCurrentLineFloaters(nsFloaterCacheList& aList) #ifdef DEBUG if (gNoisyReflow) { nsFrame::IndentBy(stdout, gNoiseIndent); - printf("placing bcl floater: "); + PRINTF("placing bcl floater: "); nsFrame::ListTag(stdout, fc->mPlaceholder->GetOutOfFlowFrame()); - printf("\n"); + PRINTF("\n"); } #endif mBlock->ReflowFloater(*this, fc->mPlaceholder, fc->mCombinedArea, @@ -6143,13 +6149,13 @@ nsBlockReflowState::ClearFloaters(nscoord aY, PRUint8 aBreakType) #ifdef DEBUG if (gNoisyReflow) { nsFrame::IndentBy(stdout, gNoiseIndent); - printf("clear floaters: in: mY=%d aY=%d(%d)\n", + PRINTF("clear floaters: in: mY=%d aY=%d(%d)\n", mY, aY, aY - BorderPadding().top); } #endif #ifdef NOISY_FLOATER_CLEARING - printf("nsBlockReflowState::ClearFloaters: aY=%d breakType=%dn", + PRINTF("nsBlockReflowState::ClearFloaters: aY=%d breakType=%dn", aY, aBreakType); mSpaceManager->List(stdout); #endif @@ -6161,7 +6167,7 @@ nsBlockReflowState::ClearFloaters(nscoord aY, PRUint8 aBreakType) #ifdef DEBUG if (gNoisyReflow) { nsFrame::IndentBy(stdout, gNoiseIndent); - printf("clear floaters: out: mY=%d(%d)\n", mY, mY - bp.top); + PRINTF("clear floaters: out: mY=%d(%d)\n", mY, mY - bp.top); } #endif } @@ -6237,7 +6243,7 @@ nsBlockFrame::Paint(nsIPresContext* aPresContext, ComputeCombinedArea(mLines, mRect.width, mRect.height, ca); nsFrame::IndentBy(stdout, depth); ListTag(stdout); - printf(": bounds=%d,%d,%d,%d dirty=%d,%d,%d,%d ca=%d,%d,%d,%d\n", + PRINTF(": bounds=%d,%d,%d,%d dirty=%d,%d,%d,%d ca=%d,%d,%d,%d\n", mRect.x, mRect.y, mRect.width, mRect.height, aDirtyRect.x, aDirtyRect.y, aDirtyRect.width, aDirtyRect.height, ca.x, ca.y, ca.width, ca.height); @@ -6390,7 +6396,7 @@ nsBlockFrame::PaintChildren(nsIPresContext* aPresContext, nsRect lineCombinedArea; line->GetCombinedArea(&lineCombinedArea); nsFrame::IndentBy(stdout, depth+1); - printf("draw line=%p bounds=%d,%d,%d,%d ca=%d,%d,%d,%d\n", + PRINTF("draw line=%p bounds=%d,%d,%d,%d ca=%d,%d,%d,%d\n", line, line->mBounds.x, line->mBounds.y, line->mBounds.width, line->mBounds.height, lineCombinedArea.x, lineCombinedArea.y, @@ -6415,7 +6421,7 @@ nsBlockFrame::PaintChildren(nsIPresContext* aPresContext, nsRect lineCombinedArea; line->GetCombinedArea(&lineCombinedArea); nsFrame::IndentBy(stdout, depth+1); - printf("skip line=%p bounds=%d,%d,%d,%d ca=%d,%d,%d,%d\n", + PRINTF("skip line=%p bounds=%d,%d,%d,%d ca=%d,%d,%d,%d\n", line, line->mBounds.x, line->mBounds.y, line->mBounds.width, line->mBounds.height, lineCombinedArea.x, lineCombinedArea.y, @@ -6450,7 +6456,7 @@ nsBlockFrame::PaintChildren(nsIPresContext* aPresContext, ": %lld elapsed (%lld per line) lines=%d drawn=%d skip=%d", delta, deltaPerLine, numLines, drawnLines, numLines - drawnLines); - printf("%s\n", buf); + PRINTF("%s\n", buf); } #endif } @@ -6880,7 +6886,7 @@ nsBlockFrame::SetInitialChildList(nsIPresContext* aPresContext, mState |= NS_BLOCK_HAS_FIRST_LETTER_STYLE; #ifdef NOISY_FIRST_LETTER ListTag(stdout); - printf(": first-letter style found\n"); + PRINTF(": first-letter style found\n"); #endif NS_RELEASE(firstLetterStyle); } diff --git a/mozilla/layout/html/base/src/nsContainerFrame.cpp b/mozilla/layout/html/base/src/nsContainerFrame.cpp index 6a9ec3d0054..c25a8c93ba0 100644 --- a/mozilla/layout/html/base/src/nsContainerFrame.cpp +++ b/mozilla/layout/html/base/src/nsContainerFrame.cpp @@ -41,6 +41,12 @@ #include "nsCOMPtr.h" #include "nsLayoutAtoms.h" #include "nsIViewManager.h" +#include "nslog.h" +#undef fprintf + +NS_IMPL_LOG(nsContainerFrameLog) +#define PRINTF NS_LOG_PRINTF(nsContainerFrameLog) +#define FLUSH NS_LOG_FLUSH(nsContainerFrameLog) #ifdef NS_DEBUG #undef NOISY @@ -694,17 +700,17 @@ nsContainerFrame::ReflowChild(nsIFrame* aKidFrame, #ifdef DEBUG if (saveMaxElementSize != aDesiredSize.maxElementSize) { - printf("nsContainerFrame: "); + PRINTF("nsContainerFrame: "); nsFrame::ListTag(stdout, aKidFrame); - printf(" changed the maxElementSize *pointer* (baaaad boy!)\n"); + PRINTF(" changed the maxElementSize *pointer* (baaaad boy!)\n"); } #ifdef REALLY_NOISY_MAX_ELEMENT_SIZE if ((nsnull != aDesiredSize.maxElementSize) && ((nscoord(0xdeadbeef) == aDesiredSize.maxElementSize->width) || (nscoord(0xdeadbeef) == aDesiredSize.maxElementSize->height))) { - printf("nsContainerFrame: "); + PRINTF("nsContainerFrame: "); nsFrame::ListTag(stdout, aKidFrame); - printf(" didn't set max-element-size!\n"); + PRINTF(" didn't set max-element-size!\n"); aDesiredSize.maxElementSize->width = 0; aDesiredSize.maxElementSize->height = 0; } diff --git a/mozilla/layout/html/base/src/nsDST.cpp b/mozilla/layout/html/base/src/nsDST.cpp index 9c0b1898a84..850bc5b0657 100644 --- a/mozilla/layout/html/base/src/nsDST.cpp +++ b/mozilla/layout/html/base/src/nsDST.cpp @@ -797,7 +797,7 @@ nsDST::Dump(FILE* out) const for (int i = 1; i < height; i++) { fprintf(out, ", %d", nodesPerLevel[i]); } - fputs("\n", out); + fprintf(out, "\n"); } #endif diff --git a/mozilla/layout/html/base/src/nsFrame.cpp b/mozilla/layout/html/base/src/nsFrame.cpp index c01ef2e0a45..39faafd66a9 100644 --- a/mozilla/layout/html/base/src/nsFrame.cpp +++ b/mozilla/layout/html/base/src/nsFrame.cpp @@ -65,6 +65,15 @@ #include "nsIGfxTextControlFrame.h" #include "nsINameSpaceManager.h" +#include "nslog.h" +#undef PRLogModuleInfo +#undef PR_NewLogModule +#undef fprintf + +NS_IMPL_LOG(nsFrameLog) +#define PRINTF NS_LOG_PRINTF(nsFrameLog) +#define FLUSH NS_LOG_FLUSH(nsFrameLog) + // For triple-click pref #include "nsIPref.h" #include "nsIServiceManager.h" @@ -133,7 +142,7 @@ nsIFrameDebug::GetVerifyTreeEnable() if (nsnull == gFrameVerifyTreeLogModuleInfo) { gFrameVerifyTreeLogModuleInfo = PR_NewLogModule("frameverifytree"); gFrameVerifyTreeEnable = 0 != gFrameVerifyTreeLogModuleInfo->level; - printf("Note: frameverifytree is %sabled\n", + PRINTF("Note: frameverifytree is %sabled", gFrameVerifyTreeEnable ? "en" : "dis"); } } @@ -157,7 +166,7 @@ nsIFrameDebug::GetVerifyStyleTreeEnable() if (nsnull == gStyleVerifyTreeLogModuleInfo) { gStyleVerifyTreeLogModuleInfo = PR_NewLogModule("styleverifytree"); gStyleVerifyTreeEnable = 0 != gStyleVerifyTreeLogModuleInfo->level; - printf("Note: styleverifytree is %sabled\n", + PRINTF("Note: styleverifytree is %sabled", gStyleVerifyTreeEnable ? "en" : "dis"); } } @@ -1248,8 +1257,8 @@ nsFrame::HandleMultiplePress(nsIPresContext* aPresContext, else return NS_OK; #ifdef DEBUG_akkana - if (selectPara) printf("Selecting Paragraph\n"); - else printf("Selecting Line\n"); + if (selectPara) PRINTF("Selecting Paragraph"); + else PRINTF("Selecting Line"); #endif // Line or paragraph selection: @@ -1680,13 +1689,12 @@ nsresult nsFrame::GetContentAndOffsetsFromPoint(nsIPresContext* aCX, } } - // printf(" 0x%.8x 0x%.8x %4d %4d\n", - // closestFrame, closestView, closestXDistance, closestYDistance); + // PRINTF(" 0x%.8x 0x%.8x %4d %4d", + // closestFrame, closestView, closestXDistance, closestYDistance)); return closestFrame->GetContentAndOffsetsFromPoint(aCX, newPoint, aNewContent, aContentOffset, aContentOffsetEnd,aBeginFrameContent); - } - } + } } if (!mContent) return NS_ERROR_NULL_POINTER; @@ -2654,7 +2662,7 @@ nsFrame::GetNextPrevLineFromeBlockFrame(nsIPresContext* aPresContext, //result = lastFrame->GetNextSibling(&lastFrame, searchingLine); result = it->GetNextSiblingOnLine(lastFrame, searchingLine); if (NS_FAILED(result)){ - NS_ASSERTION(0,"should not be reached nsFrame\n"); + NS_ASSERTION(0,"should not be reached nsFrame"); continue; } } @@ -2891,7 +2899,7 @@ nsFrame::PeekOffsetParagraph(nsIPresContext* aPresContext, nsPeekOffsetStruct *aPos) { #ifdef DEBUG_paragraph - printf("Selecting paragraph\n"); + PRINTF("Selecting paragraph"); #endif nsIFrame* blockFrame; nsCOMPtr iter (getter_AddRefs(GetBlockFrameAndLineIter(this, &blockFrame))); @@ -2901,7 +2909,7 @@ nsFrame::PeekOffsetParagraph(nsIPresContext* aPresContext, PRInt32 thisLine; nsresult result = iter->FindLineContaining(this, &thisLine); #ifdef DEBUG_paragraph - printf("Looping %s from line %d\n", + PRINTF("Looping %s from line %d", aPos->mDirection == eDirPrevious ? "back" : "forward", thisLine); #endif @@ -2924,7 +2932,7 @@ nsFrame::PeekOffsetParagraph(nsIPresContext* aPresContext, if (NS_FAILED(result) || !firstFrameOnLine || !numFramesOnLine) { #ifdef DEBUG_paragraph - printf("End loop at line %d\n", i); + PRINTF("End loop at line %d", i); #endif break; } @@ -2933,7 +2941,7 @@ nsFrame::PeekOffsetParagraph(nsIPresContext* aPresContext, { // Fill in aPos with the info on the new position #ifdef DEBUG_paragraph - printf("Found a paragraph break at line %d\n", i); + PRINTF("Found a paragraph break at line %d", i); #endif // Save the old direction, but now go one line back the other way @@ -2949,7 +2957,7 @@ nsFrame::PeekOffsetParagraph(nsIPresContext* aPresContext, i, 0); if (NS_FAILED(result)) - printf("GetNextPrevLineFromeBlockFrame failed\n"); + PRINTF("GetNextPrevLineFromeBlockFrame failed"); #else /* SIMPLE -- alas, nope */ int edgeCase = 0;//no edge case. this should look at thisLine @@ -3035,7 +3043,7 @@ DrillDownToEndOfLine(nsIFrame* aFrame, PRInt32 aLineNo, PRInt32 aLineFrameCount, if (!nextFrame) //premature leaving of loop. { nextFrame = currentFrame; //back it up. lets show a warning - NS_WARNING("lineFrame Count lied to us from nsILineIterator!\n"); + NS_WARNING("lineFrame Count lied to us from nsILineIterator!"); } nsPoint offsetPoint; //used for offset of result frame @@ -3060,7 +3068,7 @@ DrillDownToEndOfLine(nsIFrame* aFrame, PRInt32 aLineNo, PRInt32 aLineFrameCount, return PR_TRUE; #ifdef DEBUG_paragraph - NS_ASSERTION(PR_FALSE, "Looping around in PeekOffset\n"); + NS_ASSERTION(PR_FALSE, "Looping around in PeekOffset"); #endif aLineFrameCount--; if (aLineFrameCount == 0) @@ -3367,7 +3375,7 @@ nsFrame::GetFrameFromDirection(nsIPresContext* aPresContext, nsPeekOffsetStruct for (;lineFrameCount > 1;lineFrameCount --){ result = lastFrame->GetNextSibling(&lastFrame); if (NS_FAILED(result)){ - NS_ASSERTION(0,"should not be reached nsFrame\n"); + NS_ASSERTION(0,"should not be reached nsFrame"); return NS_ERROR_FAILURE; } } diff --git a/mozilla/layout/html/base/src/nsFrame.h b/mozilla/layout/html/base/src/nsFrame.h index 1b8226ce2ac..697f63f1e83 100644 --- a/mozilla/layout/html/base/src/nsFrame.h +++ b/mozilla/layout/html/base/src/nsFrame.h @@ -34,6 +34,7 @@ #include "nsIPresShell.h" #include "nsIReflowCommand.h" #include "nsIFrameSelection.h" +#include "prlog.h" /** * nsFrame logging constants. We redefine the nspr @@ -387,8 +388,7 @@ public: if (NS_SUCCEEDED(aFrame->QueryInterface(NS_GET_IID(nsIFrameDebug), (void**)&frameDebug))) { frameDebug->GetFrameName(tmp); } - fputs(tmp, out); - fprintf(out, "@%p", aFrame); + fprintf(out, "%s@%p", tmp, aFrame); } static void IndentBy(FILE* out, PRInt32 aIndent) { diff --git a/mozilla/layout/html/base/src/nsFrameManager.cpp b/mozilla/layout/html/base/src/nsFrameManager.cpp index 041f92f7dab..16c6382bcd8 100644 --- a/mozilla/layout/html/base/src/nsFrameManager.cpp +++ b/mozilla/layout/html/base/src/nsFrameManager.cpp @@ -53,6 +53,11 @@ #include "nsIContent.h" #include "nsINameSpaceManager.h" #include "nsIXMLContent.h" +#include "nslog.h" + +NS_IMPL_LOG(nsFrameManagerLog) +#define PRINTF NS_LOG_PRINTF(nsFrameManagerLog) +#define FLUSH NS_LOG_FLUSH(nsFrameManagerLog) #define NEW_CONTEXT_PARENTAGE_INVARIANT @@ -66,9 +71,9 @@ #ifdef NOISY_DEBUG #define NOISY_TRACE(_msg) \ - printf("%s",_msg); + PRINTF(("%s",_msg)); #define NOISY_TRACE_FRAME(_msg,_frame) \ - printf("%s ",_msg); nsFrame::ListTag(stdout,_frame); printf("\n"); + PRINTF(("%s ",_msg)); nsFrame::ListTag(stdout,_frame); PRINTF(("\n")); #else #define NOISY_TRACE(_msg); #define NOISY_TRACE_FRAME(_msg,_frame); @@ -386,7 +391,7 @@ NS_IMPL_RELEASE(FrameManager) FrameManager::~FrameManager() { #ifdef NOISY_EVENTS - printf("%p ~FrameManager() start\n", this); + PRINTF(("%p ~FrameManager() start\n", this)); #endif nsCOMPtr presContext; mPresShell->GetPresContext(getter_AddRefs(presContext)); @@ -410,7 +415,7 @@ FrameManager::~FrameManager() delete mUndisplayedMap; DestroyPropertyList(presContext); #ifdef NOISY_EVENTS - printf("%p ~FrameManager() end\n", this); + PRINTF(("%p ~FrameManager() end\n", this)); #endif } @@ -760,7 +765,7 @@ void FrameManager::RevokePostedEvents() { #ifdef NOISY_EVENTS - printf("%p ~RevokePostedEvents() start\n", this); + PRINTF(("%p ~RevokePostedEvents() start\n", this)); #endif if (mPostedEvents) { mPostedEvents = nsnull; @@ -784,7 +789,7 @@ FrameManager::RevokePostedEvents() } } #ifdef NOISY_EVENTS - printf("%p ~RevokePostedEvents() end\n", this); + PRINTF(("%p ~RevokePostedEvents() end\n", this)); #endif } @@ -843,7 +848,7 @@ FrameManager::DequeuePostedEventFor(nsIFrame* aFrame) void FrameManager::HandlePLEvent(CantRenderReplacedElementEvent* aEvent) { #ifdef NOISY_EVENTS - printf("FrameManager::HandlePLEvent() start for FM %p\n", aEvent->owner); + PRINTF(("FrameManager::HandlePLEvent() start for FM %p\n", aEvent->owner)); #endif FrameManager* frameManager = (FrameManager*)aEvent->owner; @@ -870,7 +875,7 @@ FrameManager::HandlePLEvent(CantRenderReplacedElementEvent* aEvent) { frameManager->mStyleSet->CantRenderReplacedElement(presContext, aEvent->mFrame); } #ifdef NOISY_EVENTS - printf("FrameManager::HandlePLEvent() end for FM %p\n", aEvent->owner); + PRINTF(("FrameManager::HandlePLEvent() end for FM %p\n", aEvent->owner)); #endif } @@ -895,7 +900,7 @@ FrameManager::CantRenderReplacedElement(nsIPresContext* aPresContext, nsIFrame* aFrame) { #ifdef NOISY_EVENTS - printf("%p FrameManager::CantRenderReplacedElement called\n", this); + PRINTF(("%p FrameManager::CantRenderReplacedElement called\n", this)); #endif nsIEventQueueService* eventService; nsresult rv; @@ -947,10 +952,10 @@ DumpContext(nsIFrame* aFrame, nsIStyleContext* aContext) frameDebug->GetFrameName(name); fputs(name, stdout); } - fprintf(stdout, " (%p)", aFrame); + PRINTF(" (%p)", aFrame); } if (aContext) { - fprintf(stdout, " style: %p ", aContext); + PRINTF(" style: %p ", aContext); nsIAtom* pseudoTag; aContext->GetPseudoType(pseudoTag); diff --git a/mozilla/layout/html/base/src/nsGfxScrollFrame.cpp b/mozilla/layout/html/base/src/nsGfxScrollFrame.cpp index 34e76d5670a..40ede89ae95 100644 --- a/mozilla/layout/html/base/src/nsGfxScrollFrame.cpp +++ b/mozilla/layout/html/base/src/nsGfxScrollFrame.cpp @@ -55,6 +55,11 @@ #include "nsIScrollbarMediator.h" #include "nsIGfxTextControlFrame.h" #include "nsIDOMHTMLTextAreaElement.h" +#include "nslog.h" + +NS_IMPL_LOG(nsGfxScrollFrameLog) +#define PRINTF NS_LOG_PRINTF(nsGfxScrollFrameLog) +#define FLUSH NS_LOG_FLUSH(nsGfxScrollFrameLog) static NS_DEFINE_IID(kWidgetCID, NS_CHILD_CID); static NS_DEFINE_IID(kScrollingViewCID, NS_SCROLLING_VIEW_CID); @@ -1173,7 +1178,7 @@ nsGfxScrollFrameInner::Layout(nsBoxLayoutState& aState) // suddenly need a vertical scrollbar. Is a special case but its // important. //if (!mHasVerticalScrollbar && scrolledContentSize.height > scrollAreaRect.height - sbSize.height) - // printf("****Gfx Scrollbar Special case hit!!*****\n"); + // PRINTF("****Gfx Scrollbar Special case hit!!*****\n"); } } else { @@ -1312,7 +1317,7 @@ nsGfxScrollFrameInner::ScrollbarChanged(nsIPresContext* aPresContext, nscoord aX { nsIScrollableView* scrollable = GetScrollableView(aPresContext); scrollable->ScrollTo(aX,aY, NS_SCROLL_PROPERTY_ALWAYS_BLIT); - // printf("scrolling to: %d, %d\n", aX, aY); + // PRINTF("scrolling to: %d, %d\n", aX, aY); } nsGfxScrollFrameInner::~nsGfxScrollFrameInner() diff --git a/mozilla/layout/html/base/src/nsHTMLImageLoader.cpp b/mozilla/layout/html/base/src/nsHTMLImageLoader.cpp index ec683286a66..f905d318171 100644 --- a/mozilla/layout/html/base/src/nsHTMLImageLoader.cpp +++ b/mozilla/layout/html/base/src/nsHTMLImageLoader.cpp @@ -24,6 +24,11 @@ #include "nsFrame.h" #include "nsIURL.h" #include "nsNetUtil.h" +#include "nslog.h" + +NS_IMPL_LOG(nsHTMLImageLoaderLog) +#define PRINTF NS_LOG_PRINTF(nsHTMLImageLoaderLog) +#define FLUSH NS_LOG_FLUSH(nsHTMLImageLoaderLog) #ifdef DEBUG #undef NOISY_IMAGE_LOADING @@ -141,7 +146,7 @@ nsHTMLImageLoader::Update(nsIPresContext* aPresContext, { #ifdef NOISY_IMAGE_LOADING nsFrame::ListTag(stdout, aFrame); - printf(": update: status=%x [loader=%p] callBack=%p squelch=%s\n", + PRINTF(": update: status=%x [loader=%p] callBack=%p squelch=%s\n", aStatus, mImageLoader, mCallBack, mFlags.mSquelchCallback ? "yes" : "no"); #endif @@ -217,25 +222,25 @@ nsHTMLImageLoader::StartLoadImage(nsIPresContext* aPresContext) mFrame, &mImageLoader); #ifdef NOISY_IMAGE_LOADING nsFrame::ListTag(stdout, mFrame); - printf(": loading image '"); + PRINTF(": loading image '"); fputs(mURL, stdout); - printf("' @ "); + PRINTF("' @ "); if (mFlags.mNeedIntrinsicImageSize) { - printf("intrinsic size "); + PRINTF("intrinsic size "); } - printf("%d,%d; oldLoader=%p newLoader=%p", + PRINTF("%d,%d; oldLoader=%p newLoader=%p", mComputedImageSize.width, mComputedImageSize.height, oldLoader, mImageLoader); if (sizeToLoadWidth) { - printf(" sizeToLoadWidth=%d,%d", + PRINTF(" sizeToLoadWidth=%d,%d", sizeToLoadWidth->width, sizeToLoadWidth->height); } else { - printf(" autoImageSize=%s needIntrinsicImageSize=%s", + PRINTF(" autoImageSize=%s needIntrinsicImageSize=%s", mFlags.mAutoImageSize ? "yes" : "no", mFlags.mNeedIntrinsicImageSize ? "yes" : "no"); } - printf("\n"); + PRINTF("\n"); #endif if (oldLoader != mImageLoader) { @@ -456,7 +461,7 @@ nsHTMLImageLoader::GetDesiredSize(nsIPresContext* aPresContext, mComputedImageSize.height = newHeight; #ifdef NOISY_IMAGE_LOADING nsFrame::ListTag(stdout, mFrame); - printf(": %s%scomputedSize=%d,%d min=%d,%d max=%d,%d fixed=%s,%s\n", + PRINTF(": %s%scomputedSize=%d,%d min=%d,%d max=%d,%d fixed=%s,%s\n", mFlags.mNeedIntrinsicImageSize ? "need-instrinsic-size " : "", mFlags.mHaveComputedSize ? "have-computed-size " : "", mComputedImageSize.width, mComputedImageSize.height, @@ -482,7 +487,7 @@ nsHTMLImageLoader::GetDesiredSize(nsIPresContext* aPresContext, if (mFlags.mNeedIntrinsicImageSize && mFlags.mHaveIntrinsicImageSize) { // We just learned our intrinisic size. Start over from the top... #ifdef NOISY_IMAGE_LOADING - printf(" *** size arrived during StartLoadImage, looping...\n"); + PRINTF(" *** size arrived during StartLoadImage, looping...\n"); #endif continue; } @@ -493,7 +498,7 @@ nsHTMLImageLoader::GetDesiredSize(nsIPresContext* aPresContext, aDesiredSize.width = mComputedImageSize.width; aDesiredSize.height = mComputedImageSize.height; #ifdef NOISY_IMAGE_LOADING - printf("nsHTMLImageLoader::GetDesiredSize returning %d, %d\n", + PRINTF("nsHTMLImageLoader::GetDesiredSize returning %d, %d\n", aDesiredSize.width, aDesiredSize.height); #endif if ((mFlags.mNeedIntrinsicImageSize && !mFlags.mHaveIntrinsicImageSize) || diff --git a/mozilla/layout/html/base/src/nsHTMLReflowState.cpp b/mozilla/layout/html/base/src/nsHTMLReflowState.cpp index 1b1b5fd711f..fb9204752a4 100644 --- a/mozilla/layout/html/base/src/nsHTMLReflowState.cpp +++ b/mozilla/layout/html/base/src/nsHTMLReflowState.cpp @@ -34,6 +34,11 @@ #include "nsBlockFrame.h" #include "nsLineBox.h" #include "nsImageFrame.h" +#include "nslog.h" + +NS_IMPL_LOG(nsHTMLReflowStateLog) +#define PRINTF NS_LOG_PRINTF(nsHTMLReflowStateLog) +#define FLUSH NS_LOG_FLUSH(nsHTMLReflowStateLog) #ifdef NS_DEBUG #undef NOISY_VERTICAL_ALIGN @@ -1494,8 +1499,8 @@ nsHTMLReflowState::InitConstraints(nsIPresContext* aPresContext, } #if 0 - nsFrame::ListTag(stdout, frame); printf(": cb="); - nsFrame::ListTag(stdout, cbrs->frame); printf(" size=%d,%d\n", aContainingBlockWidth, aContainingBlockHeight); + nsFrame::ListTag(stdout, frame); PRINTF(": cb="); + nsFrame::ListTag(stdout, cbrs->frame); PRINTF(" size=%d,%d\n", aContainingBlockWidth, aContainingBlockHeight); #endif // See if the containing block height is based on the size of its diff --git a/mozilla/layout/html/base/src/nsImageFrame.cpp b/mozilla/layout/html/base/src/nsImageFrame.cpp index 0b9fe558996..860d314b845 100644 --- a/mozilla/layout/html/base/src/nsImageFrame.cpp +++ b/mozilla/layout/html/base/src/nsImageFrame.cpp @@ -62,7 +62,11 @@ static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID); #include "nsIFrameManager.h" #include "nsIScriptSecurityManager.h" +#include "nslog.h" +NS_IMPL_LOG(nsImageFrameLog) +#define PRINTF NS_LOG_PRINTF(nsImageFrameLog) +#define FLUSH NS_LOG_FLUSH(nsImageFrameLog) #ifdef DEBUG #undef NOISY_IMAGE_LOADING @@ -205,7 +209,7 @@ nsImageFrame::UpdateImage(nsIPresContext* aPresContext, PRUint32 aStatus, void* { #ifdef NOISY_IMAGE_LOADING ListTag(stdout); - printf(": UpdateImage: status=%x\n", aStatus); + PRINTF(": UpdateImage: status=%x\n", aStatus); #endif nsCOMPtr presShell; @@ -1031,11 +1035,8 @@ nsImageFrame::AttributeChanged(nsIPresContext* aPresContext, if (!oldSRC.Equals(newSRC)) { #ifdef NOISY_IMAGE_LOADING ListTag(stdout); - printf(": new image source; old='"); - fputs(oldSRC, stdout); - printf("' new='"); - fputs(newSRC, stdout); - printf("'\n"); + PRINTF(": new image source; old='%s", oldSRC); + PRINTF("' new='%s'\n", newSRC); #endif if (mImageLoader.IsImageSizeKnown()) { diff --git a/mozilla/layout/html/base/src/nsInlineFrame.cpp b/mozilla/layout/html/base/src/nsInlineFrame.cpp index 4b624ed1cc3..9668d9b6aff 100644 --- a/mozilla/layout/html/base/src/nsInlineFrame.cpp +++ b/mozilla/layout/html/base/src/nsInlineFrame.cpp @@ -31,6 +31,11 @@ #include "nsIFontMetrics.h" #include "nsAbsoluteContainingBlock.h" #include "nsLayoutAtoms.h" +#include "nslog.h" + +NS_IMPL_LOG(nsInlineFrameLog) +#define PRINTF NS_LOG_PRINTF(nsInlineFrameLog) +#define FLUSH NS_LOG_FLUSH(nsInlineFrameLog) #ifdef DEBUG #undef NOISY_PUSHING @@ -287,7 +292,7 @@ nsInlineFrame::Reflow(nsIPresContext* aPresContext, extern char* nsPresShell_ReflowStackPointerTop; char marker; char* newsp = (char*) ▮ - printf("XXX: frame tree is too deep; approx stack size = %d\n", + PRINTF("XXX: frame tree is too deep; approx stack size = %d\n", nsPresShell_ReflowStackPointerTop - newsp); } #endif @@ -431,7 +436,7 @@ nsInlineFrame::ReflowFrames(nsIPresContext* aPresContext, PRBool isComplete; frame = PullOneFrame(aPresContext, irs, &isComplete); #ifdef NOISY_PUSHING - printf("%p pulled up %p\n", this, frame); + PRINTF("%p pulled up %p\n", this, frame); #endif if (nsnull == frame) { if (!isComplete) { @@ -538,11 +543,11 @@ nsInlineFrame::ReflowFrames(nsIPresContext* aPresContext, #ifdef NOISY_FINAL_SIZE ListTag(stdout); - printf(": metrics=%d,%d ascent=%d descent=%d\n", + PRINTF(": metrics=%d,%d ascent=%d descent=%d\n", aMetrics.width, aMetrics.height, aMetrics.ascent, aMetrics.descent); if (nsnull != aMetrics.maxElementSize) { - printf(" maxElementSize %d,%d\n", - aMetrics.maxElementSize->width, aMetrics.maxElementSize->height); + PRINTF(" maxElementSize %d,%d\n", + aMetrics.maxElementSize->width, aMetrics.maxElementSize->height); } #endif @@ -720,7 +725,7 @@ nsInlineFrame::PushFrames(nsIPresContext* aPresContext, #endif #ifdef NOISY_PUSHING - printf("%p pushing aFromChild %p, disconnecting from prev sib %p\n", + PRINTF("%p pushing aFromChild %p, disconnecting from prev sib %p\n", this, aFromChild, aPrevSibling); #endif // Disconnect aFromChild from its previous sibling diff --git a/mozilla/layout/html/base/src/nsLineBox.cpp b/mozilla/layout/html/base/src/nsLineBox.cpp index 17409c1c8be..d5eb2027cbb 100644 --- a/mozilla/layout/html/base/src/nsLineBox.cpp +++ b/mozilla/layout/html/base/src/nsLineBox.cpp @@ -25,6 +25,16 @@ #include "nsIStyleContext.h" #include "nsLineLayout.h" #include "prprf.h" +#include "nslog.h" +#undef fprintf + +#ifdef VERY_NOISY_REFLOW +NS_IMPL_LOG_ENABLED(nsLineBoxLog) +#else +NS_IMPL_LOG(nsLineBoxLog) +#endif +#define PRINTF NS_LOG_PRINTF(nsLineBoxLog) +#define FLUSH NS_LOG_FLUSH(nsLineBoxLog) #ifdef DEBUG #include "nsISizeOfHandler.h" @@ -427,10 +437,8 @@ nsLineBox::SetCombinedArea(const nsRect& aCombinedArea) } MaybeFreeData(); } -#ifdef VERY_NOISY_REFLOW - printf("nsLB::SetCombinedArea(1) %p (%d, %d, %d, %d)\n", + PRINTF("nsLB::SetCombinedArea(1) %p (%d, %d, %d, %d)\n", this, aCombinedArea.x, aCombinedArea.y, aCombinedArea.width, aCombinedArea.height); -#endif } void @@ -439,10 +447,8 @@ nsLineBox::GetCombinedArea(nsRect* aResult) NS_ASSERTION(aResult, "null arg"); if (aResult) { *aResult = mData ? mData->mCombinedArea : mBounds; -#ifdef VERY_NOISY_REFLOW - printf("nsLB::SetCombinedArea(1) %p (%d, %d, %d, %d)\n", - this, aResult->x, aResult->y, aResult->width, aResult->height); -#endif + PRINTF("nsLB::SetCombinedArea(1) %p (%d, %d, %d, %d)\n", + this, aResult->x, aResult->y, aResult->width, aResult->height); } } diff --git a/mozilla/layout/html/base/src/nsLineLayout.cpp b/mozilla/layout/html/base/src/nsLineLayout.cpp index f57fd41e023..701d9050d91 100644 --- a/mozilla/layout/html/base/src/nsLineLayout.cpp +++ b/mozilla/layout/html/base/src/nsLineLayout.cpp @@ -46,6 +46,11 @@ #include "nsIViewManager.h" #include "nsHTMLAtoms.h" #include "nsTextFragment.h" +#include "nslog.h" + +NS_IMPL_LOG(nsLineLayoutLog) +#define PRINTF NS_LOG_PRINTF(nsLineLayoutLog) +#define FLUSH NS_LOG_FLUSH(nsLineLayoutLog) #ifdef DEBUG #undef NOISY_HORIZONTAL_ALIGN @@ -179,20 +184,20 @@ nsLineLayout::BeginLineReflow(nscoord aX, nscoord aY, #ifdef DEBUG if ((aWidth != NS_UNCONSTRAINEDSIZE) && CRAZY_WIDTH(aWidth)) { nsFrame::ListTag(stdout, mBlockReflowState->frame); - printf(": Init: bad caller: width WAS %d(0x%x)\n", + PRINTF(": Init: bad caller: width WAS %d(0x%x)\n", aWidth, aWidth); aWidth = NS_UNCONSTRAINEDSIZE; } if ((aHeight != NS_UNCONSTRAINEDSIZE) && CRAZY_HEIGHT(aHeight)) { nsFrame::ListTag(stdout, mBlockReflowState->frame); - printf(": Init: bad caller: height WAS %d(0x%x)\n", + PRINTF(": Init: bad caller: height WAS %d(0x%x)\n", aHeight, aHeight); aHeight = NS_UNCONSTRAINEDSIZE; } #endif #ifdef NOISY_REFLOW nsFrame::ListTag(stdout, mBlockReflowState->frame); - printf(": BeginLineReflow: %d,%d,%d,%d impacted=%s %s\n", + PRINTF(": BeginLineReflow: %d,%d,%d,%d impacted=%s %s\n", aX, aY, aWidth, aHeight, aImpactedByFloaters?"true":"false", aIsTopOfPage ? "top-of-page" : ""); @@ -258,7 +263,7 @@ nsLineLayout::EndLineReflow() { #ifdef NOISY_REFLOW nsFrame::ListTag(stdout, mBlockReflowState->frame); - printf(": EndLineReflow: width=%d\n", mRootSpan->mX - mRootSpan->mLeftEdge); + PRINTF(": EndLineReflow: width=%d\n", mRootSpan->mX - mRootSpan->mLeftEdge); #endif FreeSpan(mRootSpan); @@ -271,11 +276,11 @@ nsLineLayout::EndLineReflow() static PRInt32 maxSpansAllocated = NS_LINELAYOUT_NUM_SPANS; static PRInt32 maxFramesAllocated = NS_LINELAYOUT_NUM_FRAMES; if (mSpansAllocated > maxSpansAllocated) { - printf("XXX: saw a line with %d spans\n", mSpansAllocated); + PRINTF("XXX: saw a line with %d spans\n", mSpansAllocated); maxSpansAllocated = mSpansAllocated; } if (mFramesAllocated > maxFramesAllocated) { - printf("XXX: saw a line with %d frames\n", mFramesAllocated); + PRINTF("XXX: saw a line with %d frames\n", mFramesAllocated); maxFramesAllocated = mFramesAllocated; } #endif @@ -293,7 +298,7 @@ nsLineLayout::UpdateBand(nscoord aX, nscoord aY, nsIFrame* aFloaterFrame) { #ifdef REALLY_NOISY_REFLOW - printf("nsLL::UpdateBand %d, %d, %d, %d, frame=%p placedLeft=%s\n will set mImpacted to PR_TRUE\n", + PRINTF("nsLL::UpdateBand %d, %d, %d, %d, frame=%p placedLeft=%s\n will set mImpacted to PR_TRUE\n", aX, aY, aWidth, aHeight, aFloaterFrame, aPlacedLeftFloater?"true":"false"); #endif PerSpanData* psd = mRootSpan; @@ -301,13 +306,13 @@ nsLineLayout::UpdateBand(nscoord aX, nscoord aY, #ifdef DEBUG if ((aWidth != NS_UNCONSTRAINEDSIZE) && CRAZY_WIDTH(aWidth)) { nsFrame::ListTag(stdout, mBlockReflowState->frame); - printf(": UpdateBand: bad caller: width WAS %d(0x%x)\n", + PRINTF(": UpdateBand: bad caller: width WAS %d(0x%x)\n", aWidth, aWidth); aWidth = NS_UNCONSTRAINEDSIZE; } if ((aHeight != NS_UNCONSTRAINEDSIZE) && CRAZY_HEIGHT(aHeight)) { nsFrame::ListTag(stdout, mBlockReflowState->frame); - printf(": UpdateBand: bad caller: height WAS %d(0x%x)\n", + PRINTF(": UpdateBand: bad caller: height WAS %d(0x%x)\n", aHeight, aHeight); aHeight = NS_UNCONSTRAINEDSIZE; } @@ -322,7 +327,7 @@ nsLineLayout::UpdateBand(nscoord aX, nscoord aY, } #ifdef NOISY_REFLOW nsFrame::ListTag(stdout, mBlockReflowState->frame); - printf(": UpdateBand: %d,%d,%d,%d deltaWidth=%d %s floater\n", + PRINTF(": UpdateBand: %d,%d,%d,%d deltaWidth=%d %s floater\n", aX, aY, aWidth, aHeight, deltaWidth, aPlacedLeftFloater ? "left" : "right"); #endif @@ -367,7 +372,7 @@ nsLineLayout::UpdateBand(nscoord aX, nscoord aY, } psd->mContainsFloater = PR_TRUE; #ifdef NOISY_REFLOW - printf(" span %p: oldRightEdge=%d newRightEdge=%d\n", + PRINTF(" span %p: oldRightEdge=%d newRightEdge=%d\n", psd, psd->mRightEdge - deltaWidth, psd->mRightEdge); #endif psd = psd->mParent; @@ -440,7 +445,7 @@ nsLineLayout::BeginSpan(nsIFrame* aFrame, #ifdef NOISY_REFLOW nsFrame::IndentBy(stdout, mSpanDepth+1); nsFrame::ListTag(stdout, aFrame); - printf(": BeginSpan leftEdge=%d rightEdge=%d\n", aLeftEdge, aRightEdge); + PRINTF(": BeginSpan leftEdge=%d rightEdge=%d\n", aLeftEdge, aRightEdge); #endif PerSpanData* psd; @@ -490,7 +495,7 @@ nsLineLayout::EndSpan(nsIFrame* aFrame, #ifdef NOISY_REFLOW nsFrame::IndentBy(stdout, mSpanDepth); nsFrame::ListTag(stdout, aFrame); - printf(": EndSpan width=%d\n", mCurrentSpan->mX - mCurrentSpan->mLeftEdge); + PRINTF(": EndSpan width=%d\n", mCurrentSpan->mX - mCurrentSpan->mLeftEdge); #endif PerSpanData* psd = mCurrentSpan; nscoord width = 0; @@ -569,7 +574,7 @@ nsLineLayout::SplitLineTo(PRInt32 aNewCount) NS_ASSERTION(mCurrentSpan == mRootSpan, "bad linelayout user"); #ifdef REALLY_NOISY_PUSHING - printf("SplitLineTo %d (current count=%d); before:\n", aNewCount, + PRINTF("SplitLineTo %d (current count=%d); before:\n", aNewCount, GetCurrentSpanCount()); DumpPerSpanData(mRootSpan, 1); #endif @@ -601,7 +606,7 @@ nsLineLayout::SplitLineTo(PRInt32 aNewCount) pfd = pfd->mNext; } #ifdef NOISY_PUSHING - printf("SplitLineTo %d (current count=%d); after:\n", aNewCount, + PRINTF("SplitLineTo %d (current count=%d); after:\n", aNewCount, GetCurrentSpanCount()); DumpPerSpanData(mRootSpan, 1); #endif @@ -615,7 +620,7 @@ nsLineLayout::PushFrame(nsIFrame* aFrame) #ifdef REALLY_NOISY_PUSHING nsFrame::IndentBy(stdout, mSpanDepth); - printf("PushFrame %p, before:\n", psd); + PRINTF("PushFrame %p, before:\n", psd); DumpPerSpanData(psd, 1); #endif @@ -643,7 +648,7 @@ nsLineLayout::PushFrame(nsIFrame* aFrame) } #ifdef NOISY_PUSHING nsFrame::IndentBy(stdout, mSpanDepth); - printf("PushFrame: %p after:\n", psd); + PRINTF("PushFrame: %p after:\n", psd); DumpPerSpanData(psd, 1); #endif } @@ -762,9 +767,9 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame, #ifdef REALLY_NOISY_REFLOW nsFrame::IndentBy(stdout, mSpanDepth); - printf("%p: Begin ReflowFrame pfd=%p ", psd, pfd); + PRINTF("%p: Begin ReflowFrame pfd=%p ", psd, pfd); nsFrame::ListTag(stdout, aFrame); - printf("\n"); + PRINTF("\n"); #endif // Compute the available size for the frame. This available width @@ -1027,16 +1032,16 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame, // frame will be reflowed another time. if (!NS_INLINE_IS_BREAK_BEFORE(aReflowStatus)) { if (CRAZY_WIDTH(metrics.width) || CRAZY_HEIGHT(metrics.height)) { - printf("nsLineLayout: "); + PRINTF("nsLineLayout: "); nsFrame::ListTag(stdout, aFrame); - printf(" metrics=%d,%d!\n", metrics.width, metrics.height); + PRINTF(" metrics=%d,%d!\n", metrics.width, metrics.height); } if (mComputeMaxElementSize && ((nscoord(0xdeadbeef) == metrics.maxElementSize->width) || (nscoord(0xdeadbeef) == metrics.maxElementSize->height))) { - printf("nsLineLayout: "); + PRINTF("nsLineLayout: "); nsFrame::ListTag(stdout, aFrame); - printf(" didn't set max-element-size!\n"); + PRINTF(" didn't set max-element-size!\n"); metrics.maxElementSize->width = 0; metrics.maxElementSize->height = 0; } @@ -1047,9 +1052,9 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame, if (mComputeMaxElementSize && ((metrics.maxElementSize->width > metrics.width) || (metrics.maxElementSize->height > metrics.height))) { - printf("nsLineLayout: "); + PRINTF("nsLineLayout: "); nsFrame::ListTag(stdout, aFrame); - printf(": WARNING: maxElementSize=%d,%d > metrics=%d,%d\n", + PRINTF(": WARNING: maxElementSize=%d,%d > metrics=%d,%d\n", metrics.maxElementSize->width, metrics.maxElementSize->height, metrics.width, metrics.height); @@ -1059,9 +1064,9 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame, (metrics.height == nscoord(0xdeadbeef)) || (metrics.ascent == nscoord(0xdeadbeef)) || (metrics.descent == nscoord(0xdeadbeef))) { - printf("nsLineLayout: "); + PRINTF("nsLineLayout: "); nsFrame::ListTag(stdout, aFrame); - printf(" didn't set whad %d,%d,%d,%d!\n", metrics.width, metrics.height, + PRINTF(" didn't set whad %d,%d,%d,%d!\n", metrics.width, metrics.height, metrics.ascent, metrics.descent); } } @@ -1069,9 +1074,9 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame, #ifdef NOISY_MAX_ELEMENT_SIZE if (!NS_INLINE_IS_BREAK_BEFORE(aReflowStatus)) { if (mComputeMaxElementSize) { - printf(" "); + PRINTF(" "); nsFrame::ListTag(stdout, aFrame); - printf(": maxElementSize=%d,%d wh=%d,%d,\n", + PRINTF(": maxElementSize=%d,%d wh=%d,%d,\n", metrics.maxElementSize->width, metrics.maxElementSize->height, metrics.width, metrics.height); @@ -1159,9 +1164,9 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame, #ifdef REALLY_NOISY_REFLOW nsFrame::IndentBy(stdout, mSpanDepth); - printf("End ReflowFrame "); + PRINTF("End ReflowFrame "); nsFrame::ListTag(stdout, aFrame); - printf(" status=%x\n", aReflowStatus); + PRINTF(" status=%x\n", aReflowStatus); #endif return rv; } @@ -1286,9 +1291,9 @@ nsLineLayout::CanPlaceFrame(PerFrameData* pfd, else { nsFrame::ListTag(stdout, mBlockReflowState->frame); } - printf(": aNotSafeToBreak=%s frame=", aNotSafeToBreak ? "true" : "false"); + PRINTF(": aNotSafeToBreak=%s frame=", aNotSafeToBreak ? "true" : "false"); nsFrame::ListTag(stdout, pfd->mFrame); - printf(" frameWidth=%d\n", pfd->mBounds.XMost() + rightMargin - psd->mX); + PRINTF(" frameWidth=%d\n", pfd->mBounds.XMost() + rightMargin - psd->mX); #endif // Set outside to PR_TRUE if the result of the reflow leads to the @@ -1297,7 +1302,7 @@ nsLineLayout::CanPlaceFrame(PerFrameData* pfd, if (!outside) { // If it fits, it fits #ifdef NOISY_CAN_PLACE_FRAME - printf(" ==> inside\n"); + PRINTF(" ==> inside\n"); #endif return PR_TRUE; } @@ -1307,7 +1312,7 @@ nsLineLayout::CanPlaceFrame(PerFrameData* pfd, if (0 == pfd->mMargin.left + pfd->mBounds.width + rightMargin) { // Empty frames always fit right where they are #ifdef NOISY_CAN_PLACE_FRAME - printf(" ==> empty frame fits\n"); + PRINTF(" ==> empty frame fits\n"); #endif return PR_TRUE; } @@ -1318,7 +1323,7 @@ nsLineLayout::CanPlaceFrame(PerFrameData* pfd, pfd->mFrame->GetFrameType(getter_AddRefs(frameType)); if (nsLayoutAtoms::brFrame == frameType.get()) { #ifdef NOISY_CAN_PLACE_FRAME - printf(" ==> BR frame fits\n"); + PRINTF(" ==> BR frame fits\n"); #endif return PR_TRUE; } @@ -1330,12 +1335,12 @@ nsLineLayout::CanPlaceFrame(PerFrameData* pfd, // current frame fits. if (!GetFlag(LL_IMPACTEDBYFLOATERS)) { #ifdef NOISY_CAN_PLACE_FRAME - printf(" ==> not-safe and not-impacted fits: "); + PRINTF(" ==> not-safe and not-impacted fits: "); while (nsnull != psd) { - printf(" ", psd, psd->mX, psd->mLeftEdge); + PRINTF(" ", psd, psd->mX, psd->mLeftEdge); psd = psd->mParent; } - printf("\n"); + PRINTF("\n"); #endif return PR_TRUE; } @@ -1362,7 +1367,7 @@ nsLineLayout::CanPlaceFrame(PerFrameData* pfd, if (pfd->GetFlag(PFD_ISSTICKY)) { #ifdef NOISY_CAN_PLACE_FRAME - printf(" ==> last floater was letter frame && frame is sticky\n"); + PRINTF(" ==> last floater was letter frame && frame is sticky\n"); #endif return PR_TRUE; } @@ -1436,7 +1441,7 @@ nsLineLayout::CanPlaceFrame(PerFrameData* pfd, } #ifdef NOISY_CAN_PLACE_FRAME - printf(" ==> didn't fit\n"); + PRINTF(" ==> didn't fit\n"); #endif aStatus = NS_INLINE_LINE_BREAK_BEFORE(); return PR_FALSE; @@ -1523,13 +1528,13 @@ void nsLineLayout::DumpPerSpanData(PerSpanData* psd, PRInt32 aIndent) { nsFrame::IndentBy(stdout, aIndent); - printf("%p: left=%d x=%d right=%d\n", psd, psd->mLeftEdge, + PRINTF("%p: left=%d x=%d right=%d\n", psd, psd->mLeftEdge, psd->mX, psd->mRightEdge); PerFrameData* pfd = psd->mFirstFrame; while (nsnull != pfd) { nsFrame::IndentBy(stdout, aIndent+1); nsFrame::ListTag(stdout, pfd->mFrame); - printf(" %d,%d,%d,%d\n", pfd->mBounds.x, pfd->mBounds.y, + PRINTF(" %d,%d,%d,%d\n", pfd->mBounds.x, pfd->mBounds.y, pfd->mBounds.width, pfd->mBounds.height); if (pfd->mSpan) { DumpPerSpanData(pfd->mSpan, aIndent + 1); @@ -1689,7 +1694,7 @@ nsLineLayout::VerticalAlignFrames(nsLineBox* aLineBox, lineHeight = mMaxTopBoxHeight; } #ifdef NOISY_VERTICAL_ALIGN - printf(" [line]==> lineHeight=%d baselineY=%d\n", lineHeight, baselineY); + PRINTF(" [line]==> lineHeight=%d baselineY=%d\n", lineHeight, baselineY); #endif // Now position all of the frames in the root span. We will also @@ -1751,9 +1756,9 @@ nsLineLayout::VerticalAlignFrames(nsLineBox* aLineBox, } pfd->mFrame->SetRect(mPresContext, pfd->mBounds); #ifdef NOISY_VERTICAL_ALIGN - printf(" [child of line]"); + PRINTF(" [child of line]"); nsFrame::ListTag(stdout, pfd->mFrame); - printf(": y=%d\n", pfd->mBounds.y); + PRINTF(": y=%d\n", pfd->mBounds.y); #endif if (span) { nscoord distanceFromTop = pfd->mBounds.y - mTopEdge; @@ -1807,9 +1812,9 @@ nsLineLayout::PlaceTopBottomFrames(PerSpanData* psd, } pfd->mFrame->SetRect(mPresContext, pfd->mBounds); #ifdef NOISY_VERTICAL_ALIGN - printf(" "); + PRINTF(" "); nsFrame::ListTag(stdout, pfd->mFrame); - printf(": y=%d dTop=%d [bp.top=%d topLeading=%d]\n", + PRINTF(": y=%d dTop=%d [bp.top=%d topLeading=%d]\n", pfd->mBounds.y, aDistanceFromTop, span ? pfd->mBorderPadding.top : 0, span ? span->mTopLeading : 0); @@ -1828,9 +1833,9 @@ nsLineLayout::PlaceTopBottomFrames(PerSpanData* psd, } pfd->mFrame->SetRect(mPresContext, pfd->mBounds); #ifdef NOISY_VERTICAL_ALIGN - printf(" "); + PRINTF(" "); nsFrame::ListTag(stdout, pfd->mFrame); - printf(": y=%d\n", pfd->mBounds.y); + PRINTF(": y=%d\n", pfd->mBounds.y); #endif break; } @@ -1880,15 +1885,15 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd) (0 == spanFramePFD->mBounds.width) && (0 == spanFramePFD->mBounds.height); #ifdef NOISY_VERTICAL_ALIGN - printf("[%sSpan]", (psd == mRootSpan)?"Root":""); + PRINTF("[%sSpan]", (psd == mRootSpan)?"Root":""); nsFrame::ListTag(stdout, spanFrame); - printf(": preMode=%s strictMode=%s w/h=%d,%d emptyContinuation=%s", + PRINTF(": preMode=%s strictMode=%s w/h=%d,%d emptyContinuation=%s", preMode ? "yes" : "no", InStrictMode() ? "yes" : "no", spanFramePFD->mBounds.width, spanFramePFD->mBounds.height, emptyContinuation ? "yes" : "no"); if (psd != mRootSpan) { - printf(" bp=%d,%d,%d,%d margin=%d,%d,%d,%d", + PRINTF(" bp=%d,%d,%d,%d margin=%d,%d,%d,%d", spanFramePFD->mBorderPadding.top, spanFramePFD->mBorderPadding.right, spanFramePFD->mBorderPadding.bottom, @@ -1898,7 +1903,7 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd) spanFramePFD->mMargin.bottom, spanFramePFD->mMargin.left); } - printf("\n"); + PRINTF("\n"); #endif // Compute the span's mZeroEffectiveSpanBox flag. What we are trying @@ -1968,9 +1973,9 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd) minY = VERTICAL_ALIGN_FRAMES_NO_MINIMUM; maxY = VERTICAL_ALIGN_FRAMES_NO_MAXIMUM; #ifdef NOISY_VERTICAL_ALIGN - printf("[RootSpan]"); + PRINTF("[RootSpan]"); nsFrame::ListTag(stdout, spanFrame); - printf(": pass1 valign frames: topEdge=%d minLineHeight=%d zeroEffectiveSpanBox=%s\n", + PRINTF(": pass1 valign frames: topEdge=%d minLineHeight=%d zeroEffectiveSpanBox=%s\n", mTopEdge, mMinLineHeight, zeroEffectiveSpanBox ? "yes" : "no"); #endif @@ -2017,9 +2022,9 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd) #ifdef NOISY_VERTICAL_ALIGN - printf("[%sSpan]", (psd == mRootSpan)?"Root":""); + PRINTF("[%sSpan]", (psd == mRootSpan)?"Root":""); nsFrame::ListTag(stdout, spanFrame); - printf(": baseLine=%d logicalHeight=%d topLeading=%d h=%d bp=%d,%d zeroEffectiveSpanBox=%s\n", + PRINTF(": baseLine=%d logicalHeight=%d topLeading=%d h=%d bp=%d,%d zeroEffectiveSpanBox=%s\n", baselineY, psd->mLogicalHeight, psd->mTopLeading, spanFramePFD->mBounds.height, spanFramePFD->mBorderPadding.top, spanFramePFD->mBorderPadding.bottom, @@ -2057,15 +2062,15 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd) nsStyleUnit verticalAlignUnit = textStyle->mVerticalAlign.GetUnit(); #ifdef DEBUG if (eStyleUnit_Inherit == verticalAlignUnit) { - printf("XXX: vertical-align: inherit not implemented for "); + PRINTF("XXX: vertical-align: inherit not implemented for "); nsFrame::ListTag(stdout, frame); - printf("\n"); + PRINTF("\n"); } #endif #ifdef NOISY_VERTICAL_ALIGN - printf(" [frame]"); + PRINTF(" [frame]"); nsFrame::ListTag(stdout, frame); - printf(": verticalAlignUnit=%d (enum == %d)\n", + PRINTF(": verticalAlignUnit=%d (enum == %d)\n", verticalAlignUnit, ((eStyleUnit_Enumerated == verticalAlignUnit) ? textStyle->mVerticalAlign.GetIntValue() @@ -2270,7 +2275,7 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd) if (yTop < minY) minY = yTop; if (yBottom > maxY) maxY = yBottom; #ifdef NOISY_VERTICAL_ALIGN - printf(" [frame]raw: a=%d d=%d h=%d bp=%d,%d logical: h=%d leading=%d y=%d minY=%d maxY=%d\n", + PRINTF(" [frame]raw: a=%d d=%d h=%d bp=%d,%d logical: h=%d leading=%d y=%d minY=%d maxY=%d\n", pfd->mAscent, pfd->mDescent, pfd->mBounds.height, pfd->mBorderPadding.top, pfd->mBorderPadding.bottom, logicalHeight, @@ -2332,7 +2337,7 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd) if (applyMinLH) { if ((psd->mX != psd->mLeftEdge) || preMode || foundLI) { #ifdef NOISY_VERTICAL_ALIGN - printf(" [span]==> adjusting min/maxY: currentValues: %d,%d", minY, maxY); + PRINTF(" [span]==> adjusting min/maxY: currentValues: %d,%d", minY, maxY); #endif nscoord minimumLineHeight = mMinLineHeight; nscoord fontAscent, fontHeight; @@ -2352,7 +2357,7 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd) if (yBottom > maxY) maxY = yBottom; #ifdef NOISY_VERTICAL_ALIGN - printf(" new values: %d,%d\n", minY, maxY); + PRINTF(" new values: %d,%d\n", minY, maxY); #endif } else { @@ -2363,7 +2368,7 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd) // XXX Are there other problems with this? #ifdef NOISY_VERTICAL_ALIGN - printf(" [span]==> zapping min/maxY: currentValues: %d,%d newValues: 0,0\n", + PRINTF(" [span]==> zapping min/maxY: currentValues: %d,%d newValues: 0,0\n", minY, maxY); #endif minY = maxY = 0; @@ -2378,8 +2383,8 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd) if ((psd != mRootSpan) && (psd->mZeroEffectiveSpanBox)) { #ifdef NOISY_VERTICAL_ALIGN - printf(" [span]adjusting for zeroEffectiveSpanBox\n"); - printf(" Original: minY=%d, maxY=%d, height=%d, ascent=%d, descent=%d, logicalHeight=%d, topLeading=%d, bottomLeading=%d\n", + PRINTF(" [span]adjusting for zeroEffectiveSpanBox\n"); + PRINTF(" Original: minY=%d, maxY=%d, height=%d, ascent=%d, descent=%d, logicalHeight=%d, topLeading=%d, bottomLeading=%d\n", minY, maxY, spanFramePFD->mBounds.height, spanFramePFD->mAscent, spanFramePFD->mDescent, psd->mLogicalHeight, psd->mTopLeading, psd->mBottomLeading); @@ -2423,7 +2428,7 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd) psd->mBottomLeading += adjust; } #ifdef NOISY_VERTICAL_ALIGN - printf(" New: minY=%d, maxY=%d, height=%d, ascent=%d, descent=%d, logicalHeight=%d, topLeading=%d, bottomLeading=%d\n", + PRINTF(" New: minY=%d, maxY=%d, height=%d, ascent=%d, descent=%d, logicalHeight=%d, topLeading=%d, bottomLeading=%d\n", minY, maxY, spanFramePFD->mBounds.height, spanFramePFD->mAscent, spanFramePFD->mDescent, psd->mLogicalHeight, psd->mTopLeading, psd->mBottomLeading); @@ -2433,7 +2438,7 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd) psd->mMinY = minY; psd->mMaxY = maxY; #ifdef NOISY_VERTICAL_ALIGN - printf(" [span]==> minY=%d maxY=%d delta=%d maxTopBoxHeight=%d maxBottomBoxHeight=%d\n", + PRINTF(" [span]==> minY=%d maxY=%d delta=%d maxTopBoxHeight=%d maxBottomBoxHeight=%d\n", minY, maxY, maxY - minY, maxTopBoxHeight, maxBottomBoxHeight); #endif if (maxTopBoxHeight > mMaxTopBoxHeight) { @@ -2465,9 +2470,9 @@ nsLineLayout::TrimTrailingWhiteSpaceIn(PerSpanData* psd, nsFrame::ListTag(stdout, (psd == mRootSpan ? mBlockReflowState->frame : psd->mFrame->mFrame)); - printf(": attempting trim of "); + PRINTF(": attempting trim of "); nsFrame::ListTag(stdout, pfd->mFrame); - printf("\n"); + PRINTF("\n"); #endif PerSpanData* childSpan = pfd->mSpan; if (childSpan) { @@ -2521,9 +2526,9 @@ nsLineLayout::TrimTrailingWhiteSpaceIn(PerSpanData* psd, nsFrame::ListTag(stdout, (psd == mRootSpan ? mBlockReflowState->frame : psd->mFrame->mFrame)); - printf(": trim of "); + PRINTF(": trim of "); nsFrame::ListTag(stdout, pfd->mFrame); - printf(" returned %d\n", deltaWidth); + PRINTF(" returned %d\n", deltaWidth); #endif if (deltaWidth) { if (pfd->mJustificationNumSpaces > 0) { @@ -2676,7 +2681,7 @@ nsLineLayout::HorizontalAlignFrames(nsRect& aLineBounds, // Don't bother horizontal aligning on pass1 table reflow #ifdef NOISY_HORIZONTAL_ALIGN nsFrame::ListTag(stdout, mBlockReflowState->frame); - printf(": skipping horizontal alignment in pass1 table reflow\n"); + PRINTF(": skipping horizontal alignment in pass1 table reflow\n"); #endif return PR_TRUE; } @@ -2684,7 +2689,7 @@ nsLineLayout::HorizontalAlignFrames(nsRect& aLineBounds, nscoord remainingWidth = availWidth - aLineBounds.width; #ifdef NOISY_HORIZONTAL_ALIGN nsFrame::ListTag(stdout, mBlockReflowState->frame); - printf(": availWidth=%d lineWidth=%d delta=%d\n", + PRINTF(": availWidth=%d lineWidth=%d delta=%d\n", availWidth, aLineBounds.width, remainingWidth); #endif if (remainingWidth > 0) { diff --git a/mozilla/layout/html/base/src/nsObjectFrame.cpp b/mozilla/layout/html/base/src/nsObjectFrame.cpp index 15ceaa9a8f2..38e1dadce5c 100644 --- a/mozilla/layout/html/base/src/nsObjectFrame.cpp +++ b/mozilla/layout/html/base/src/nsObjectFrame.cpp @@ -68,6 +68,11 @@ #include "nsMimeTypes.h" #include "nsObjectFrame.h" +#include "nslog.h" + +NS_IMPL_LOG(nsObjectFrameLog) +#define PRINTF NS_LOG_PRINTF(nsObjectFrameLog) +#define FLUSH NS_LOG_FLUSH(nsObjectFrameLog) static NS_DEFINE_IID(kIDOMMouseListenerIID, NS_IDOMMOUSELISTENER_IID); @@ -2159,7 +2164,7 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetDocumentBase(const char* *result) NS_IMETHODIMP nsPluginInstanceOwner::GetDocumentEncoding(const char* *result) { -printf("instance owner getdocumentencoding called\n"); + PRINTF("instance owner getdocumentencoding called\n"); return NS_ERROR_FAILURE; } @@ -2792,7 +2797,7 @@ static void GetWidgetPosAndClip(nsIWidget* aWidget,nscoord& aAbsX, nscoord& aAbs widget = getter_AddRefs(widget->GetParent()); if (widget == nsnull) { // Don't include the top-level windows offset - // printf("Top level window offset %d %d\n", wx, wy); + // PRINTF("Top level window offset %d %d\n", wx, wy); aAbsX -= wx; aAbsY -= wy; } @@ -2803,9 +2808,9 @@ static void GetWidgetPosAndClip(nsIWidget* aWidget,nscoord& aAbsX, nscoord& aAbs aClipRect.x += aAbsX; aClipRect.y += aAbsY; - //printf("--------------\n"); - //printf("Widget clip X %d Y %d rect %d %d %d %d\n", aAbsX, aAbsY, aClipRect.x, aClipRect.y, aClipRect.width, aClipRect.height ); - //printf("--------------\n"); + //PRINTF("--------------\n"); + //PRINTF("Widget clip X %d Y %d rect %d %d %d %d\n", aAbsX, aAbsY, aClipRect.x, aClipRect.y, aClipRect.width, aClipRect.height ); + //PRINTF("--------------\n"); } diff --git a/mozilla/layout/html/base/src/nsPlaceholderFrame.cpp b/mozilla/layout/html/base/src/nsPlaceholderFrame.cpp index bdb583a9ba6..c12b67b2a05 100644 --- a/mozilla/layout/html/base/src/nsPlaceholderFrame.cpp +++ b/mozilla/layout/html/base/src/nsPlaceholderFrame.cpp @@ -27,6 +27,12 @@ #include "nsIRenderingContext.h" #include "nsIStyleContext.h" #include "nsLayoutAtoms.h" +#include "nslog.h" +#undef fprintf + +NS_IMPL_LOG(nsPlaceholderFrameLog) +#define PRINTF NS_LOG_PRINTF(nsPlaceholderFrameLog) +#define FLUSH NS_LOG_FLUSH(nsPlaceholderFrameLog) nsresult NS_NewPlaceholderFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame) diff --git a/mozilla/layout/html/base/src/nsPresShell.cpp b/mozilla/layout/html/base/src/nsPresShell.cpp index a45986d082e..1ea8bd9be59 100644 --- a/mozilla/layout/html/base/src/nsPresShell.cpp +++ b/mozilla/layout/html/base/src/nsPresShell.cpp @@ -139,6 +139,15 @@ // SubShell map #include "nsDST.h" +#include "nslog.h" +#undef fprintf +#undef PR_NewLogModule +#undef PRLogModuleInfo + +NS_IMPL_LOG(nsPresShellLog) +#define PRINTF NS_LOG_PRINTF(nsPresShellLog) +#define FLUSH NS_LOG_FLUSH(nsPresShellLog) + // supporting bugs 31816, 20760, 22963 // define USE_OVERRIDE to put prefs in as an override stylesheet // otherwise they go in as a Backstop stylesheets @@ -1144,24 +1153,24 @@ nsIPresShell::GetVerifyReflowEnable() if (VERIFY_REFLOW_ON & gVerifyReflowFlags) { gVerifyReflowEnabled = PR_TRUE; } - printf("Note: verifyreflow is %sabled", + PRINTF("Note: verifyreflow is %sabled", gVerifyReflowEnabled ? "en" : "dis"); if (VERIFY_REFLOW_NOISY & gVerifyReflowFlags) { - printf(" (noisy)"); + PRINTF(" (noisy)"); } if (VERIFY_REFLOW_ALL & gVerifyReflowFlags) { - printf(" (all)"); + PRINTF(" (all)"); } if (VERIFY_REFLOW_DUMP_COMMANDS & gVerifyReflowFlags) { - printf(" (show reflow commands)"); + PRINTF(" (show reflow commands)"); } if (VERIFY_REFLOW_NOISY_RC & gVerifyReflowFlags) { - printf(" (noisy reflow commands)"); + PRINTF(" (noisy reflow commands)"); if (VERIFY_REFLOW_REALLY_NOISY_RC & gVerifyReflowFlags) { - printf(" (REALLY noisy reflow commands)"); + PRINTF(" (REALLY noisy reflow commands)"); } } - printf("\n"); + PRINTF("\n"); } #endif return gVerifyReflowEnabled; @@ -1664,11 +1673,9 @@ PresShell::EnablePrefStyleRules(PRBool aEnable, PRUint8 aPrefType/*=0xFF*/) // set to desired state mEnablePrefStyleSheet = aEnable; -#ifdef NS_DEBUG - printf("PrefStyleSheet %s %s\n", - mEnablePrefStyleSheet ? "ENABLED" : "DISABLED", - bChanging ? "(state toggled)" : "(state unchanged)"); -#endif + PRINTF("PrefStyleSheet %s %s\n", + mEnablePrefStyleSheet ? "ENABLED" : "DISABLED", + bChanging ? "(state toggled)" : "(state unchanged)"); // deal with changing state if(bChanging){ @@ -1704,9 +1711,7 @@ PresShell::SetPreferenceStyleRules(PRBool aForceReflow) // XXX: may get more granularity later // (i.e. each pref may be controlled independently) if (!mEnablePrefStyleSheet) { -#ifdef NS_DEBUG - printf("PrefStyleSheet disabled\n"); -#endif + PRINTF("PrefStyleSheet disabled\n"); return PR_TRUE; } @@ -1727,9 +1732,7 @@ PresShell::SetPreferenceStyleRules(PRBool aForceReflow) } if (NS_SUCCEEDED(result)) { -#ifdef NS_DEBUG - printf("Setting Preference Style Rules:\n"); -#endif + PRINTF("Setting Preference Style Rules:\n"); // if here, we need to create rules for the prefs // - this includes the background-color, the text-color, // the link color, the visited link color and the link-underlining @@ -1756,14 +1759,10 @@ PresShell::SetPreferenceStyleRules(PRBool aForceReflow) } } } -#ifdef NS_DEBUG - printf( "Preference Style Rules set: error=%ld\n", (long)result); -#endif + PRINTF( "Preference Style Rules set: error=%ld\n", (long)result); if (aForceReflow){ -#ifdef NS_DEBUG - printf( "*** Forcing reframe! ***\n"); -#endif + PRINTF( "*** Forcing reframe! ***\n"); // this is harsh, but without it the new colors don't appear on the current page // Fortunately, it only happens when the prefs change, a rare event. // XXX - determine why the normal PresContext::RemapStyleAndReflow doesn't cut it @@ -1800,7 +1799,6 @@ nsresult PresShell::ClearPreferenceStyleRules(void) mStyleSet->RemoveBackstopStyleSheet(mPrefStyleSheet); #endif -#ifdef NS_DEBUG #ifdef PREFS_USE_OVERRIDE NS_ASSERTION((numBefore - 1) == mStyleSet->GetNumberOfOverrideStyleSheets(), "Pref stylesheet was not removed"); @@ -1808,8 +1806,7 @@ nsresult PresShell::ClearPreferenceStyleRules(void) NS_ASSERTION((numBefore - 1) == mStyleSet->GetNumberOfBackstopStyleSheets(), "Pref stylesheet was not removed"); #endif - printf("PrefStyleSheet removed\n"); -#endif + PRINTF("PrefStyleSheet removed\n"); // clear the sheet pointer: it is strictly historical now NS_IF_RELEASE(mPrefStyleSheet); } @@ -1843,9 +1840,7 @@ nsresult PresShell::CreatePreferenceStyleSheet(void) result = NS_ERROR_OUT_OF_MEMORY; } -#ifdef NS_DEBUG - printf("CreatePrefStyleSheet completed: error=%ld\n",(long)result); -#endif + PRINTF("CreatePrefStyleSheet completed: error=%ld\n",(long)result); return result; } @@ -1861,9 +1856,7 @@ nsresult PresShell::SetPrefColorRules(void) if (NS_SUCCEEDED(mPresContext->GetCachedBoolPref(kPresContext_UseDocumentColors, useDocColors))) { if (!useDocColors) { -#ifdef NS_DEBUG - printf(" - Creating rules for document colors\n"); -#endif + PRINTF(" - Creating rules for document colors\n"); // OK, not using document colors, so we have to force the user's colors via style rules if (!mPrefStyleSheet) { @@ -1933,9 +1926,7 @@ nsresult PresShell::SetPrefLinkRules(void) nsCOMPtr sheet(do_QueryInterface(mPrefStyleSheet,&result)); if (NS_SUCCEEDED(result)) { -#ifdef NS_DEBUG - printf(" - Creating rules for link and visited colors\n"); -#endif + PRINTF(" - Creating rules for link and visited colors\n"); // support default link colors: // this means the link colors need to be overridable, @@ -1999,15 +1990,11 @@ nsresult PresShell::SetPrefLinkRules(void) // no need for important, we want these to be overridable // NOTE: these must go in the backstop stylesheet or they cannot be // overridden by authors - #ifdef NS_DEBUG - printf (" - Creating rules for enabling link underlines\n"); - #endif + PRINTF (" - Creating rules for enabling link underlines\n"); // make a rule to make text-decoration: underline happen for links strRule.Append(NS_LITERAL_STRING(":link, :visited {text-decoration:underline;}")); } else { - #ifdef NS_DEBUG - printf (" - Creating rules for disabling link underlines\n"); - #endif + PRINTF (" - Creating rules for disabling link underlines\n"); // make a rule to make text-decoration: none happen for links strRule.Append(NS_LITERAL_STRING(":link, :visited {text-decoration:none;}")); } @@ -2247,7 +2234,7 @@ PresShell::InitialReflow(nscoord aWidth, nscoord aHeight) if (uri) { char* url = nsnull; uri->GetSpec(&url); - printf("*** PresShell::InitialReflow (this=%p, url='%s')\n", this, url); + PRINTF("*** PresShell::InitialReflow (this=%p, url='%s')\n", this, url); Recycle(url); } } @@ -2472,7 +2459,7 @@ PresShell::ResizeReflow(nscoord aWidth, nscoord aHeight) // XXX if debugging then we should assert that the cache is empty } else { #ifdef NOISY - printf("PresShell::ResizeReflow: null root frame\n"); + PRINTF("PresShell::ResizeReflow: null root frame\n"); #endif } DidCauseReflow(); @@ -3075,7 +3062,7 @@ PresShell::AlreadyInQueue(nsIReflowCommand* aReflowCommand) RCType == queuedRCType) { #ifdef DEBUG if (VERIFY_REFLOW_NOISY_RC & gVerifyReflowFlags) { - printf("*** PresShell::AlreadyInQueue(): Discarding reflow command: this=%p\n", this); + PRINTF("*** PresShell::AlreadyInQueue(): Discarding reflow command: this=%p\n", this); aReflowCommand->List(stdout); } #endif @@ -3094,15 +3081,15 @@ NS_IMETHODIMP PresShell::AppendReflowCommand(nsIReflowCommand* aReflowCommand) { #ifdef DEBUG - //printf("gShellCounter: %d\n", gShellCounter++); + //PRINTF("gShellCounter: %d\n", gShellCounter++); if (mInVerifyReflow) { return NS_OK; } if (VERIFY_REFLOW_NOISY_RC & gVerifyReflowFlags) { - printf("\nPresShell@%p: adding reflow command\n", this); + PRINTF("\nPresShell@%p: adding reflow command\n", this); aReflowCommand->List(stdout); if (VERIFY_REFLOW_REALLY_NOISY_RC & gVerifyReflowFlags) { - printf("Current content model:\n"); + PRINTF("Current content model:\n"); nsCOMPtr rootContent; rootContent = getter_AddRefs(mDocument->GetRootContent()); if (rootContent) { @@ -3178,9 +3165,9 @@ PresShell::CancelReflowCommand(nsIFrame* aTargetFrame, nsIReflowCommand::ReflowT } #ifdef DEBUG if (VERIFY_REFLOW_NOISY_RC & gVerifyReflowFlags) { - printf("PresShell: removing rc=%p for frame ", rc); + PRINTF("PresShell: removing rc=%p for frame ", rc); nsFrame::ListTag(stdout, aTargetFrame); - printf("\n"); + PRINTF("\n"); } #endif mReflowCommands.RemoveElementAt(i); @@ -5008,7 +4995,7 @@ struct ReflowEvent : public PLEvent { if (presShell) { #ifdef DEBUG if (VERIFY_REFLOW_NOISY_RC & gVerifyReflowFlags) { - printf("\n*** Handling reflow event: PresShell=%p, event=%p\n", presShell.get(), this); + PRINTF("\n*** Handling reflow event: PresShell=%p, event=%p\n", presShell.get(), this); } #endif // XXX Statically cast the pres shell pointer so that we can call @@ -5071,7 +5058,7 @@ PresShell::PostReflowEvent() mPendingReflowEvent = PR_TRUE; #ifdef DEBUG if (VERIFY_REFLOW_NOISY_RC & gVerifyReflowFlags) { - printf("\n*** PresShell::PostReflowEvent(), this=%p, event=%p\n", this, ev); + PRINTF("\n*** PresShell::PostReflowEvent(), this=%p, event=%p\n", this, ev); } #endif } @@ -5117,12 +5104,12 @@ PresShell::ProcessReflowCommands(PRBool aInterruptible) #ifdef DEBUG if (GetVerifyReflowEnable()) { if (VERIFY_REFLOW_ALL & gVerifyReflowFlags) { - printf("ProcessReflowCommands: begin incremental reflow\n"); + PRINTF("ProcessReflowCommands: begin incremental reflow\n"); } } if (VERIFY_REFLOW_DUMP_COMMANDS & gVerifyReflowFlags) { PRInt32 i, n = mReflowCommands.Count(); - printf("\nPresShell::ProcessReflowCommands: this=%p, count=%d\n", this, n); + PRINTF("\nPresShell::ProcessReflowCommands: this=%p, count=%d\n", this, n); for (i = 0; i < n; i++) { nsIReflowCommand* rc = (nsIReflowCommand*) mReflowCommands.ElementAt(i); @@ -5173,8 +5160,8 @@ PresShell::ProcessReflowCommands(PRBool aInterruptible) } #ifdef DEBUG if (VERIFY_REFLOW_DUMP_COMMANDS & gVerifyReflowFlags) { - printf("Time spent in PresShell::ProcessReflowCommands(), this=%p, time=%d micro seconds\n", - this, mAccumulatedReflowTime); + PRINTF("Time spent in PresShell::ProcessReflowCommands(), this=%p, time=%d micro seconds\n", + this, mAccumulatedReflowTime); } #endif mAccumulatedReflowTime = 0; @@ -5182,7 +5169,7 @@ PresShell::ProcessReflowCommands(PRBool aInterruptible) #ifdef DEBUG if (VERIFY_REFLOW_DUMP_COMMANDS & gVerifyReflowFlags) { - printf("\nPresShell::ProcessReflowCommands() finished: this=%p\n", this); + PRINTF("\nPresShell::ProcessReflowCommands() finished: this=%p\n", this); } if (nsIFrameDebug::GetVerifyTreeEnable()) { @@ -5204,12 +5191,12 @@ PresShell::ProcessReflowCommands(PRBool aInterruptible) PRBool ok = VerifyIncrementalReflow(); mInVerifyReflow = PR_FALSE; if (VERIFY_REFLOW_ALL & gVerifyReflowFlags) { - printf("ProcessReflowCommands: finished (%s)\n", + PRINTF("ProcessReflowCommands: finished (%s)\n", ok ? "ok" : "failed"); } if (0 != mReflowCommands.Count()) { - printf("XXX yikes! reflow commands queued during verify-reflow\n"); + PRINTF("XXX yikes! reflow commands queued during verify-reflow\n"); } } #endif @@ -5301,7 +5288,7 @@ PresShell::ReflowCommandAdded(nsIReflowCommand* aRC) } #ifdef DEBUG_nisheeth - printf("presshell=%p, mRCCreatedDuringLoad=%d\n", this, mRCCreatedDuringLoad); + PRINTF("presshell=%p, mRCCreatedDuringLoad=%d\n", this, mRCCreatedDuringLoad); #endif } } @@ -5318,7 +5305,7 @@ PresShell::ReflowCommandRemoved(nsIReflowCommand* aRC) if (flags & NS_RC_CREATED_DURING_DOCUMENT_LOAD) { mRCCreatedDuringLoad--; #ifdef DEBUG_nisheeth - printf("presshell=%p, mRCCreatedDuringLoad=%d\n", this, mRCCreatedDuringLoad); + PRINTF("presshell=%p, mRCCreatedDuringLoad=%d\n", this, mRCCreatedDuringLoad); #endif } @@ -5353,7 +5340,7 @@ PresShell::AddDummyLayoutRequest(void) } #ifdef DEBUG_nisheeth - printf("presshell=%p, Added dummy layout request.\n", this); + PRINTF("presshell=%p, Added dummy layout request.\n", this); #endif } return rv; @@ -5379,7 +5366,7 @@ PresShell::RemoveDummyLayoutRequest(void) } #ifdef DEBUG_nisheeth - printf("presshell=%p, Removed dummy layout request.\n", this); + PRINTF("presshell=%p, Removed dummy layout request.\n", this); #endif } return rv; @@ -5406,7 +5393,7 @@ static NS_DEFINE_CID(kWidgetCID, NS_CHILD_CID); static void LogVerifyMessage(nsIFrame* k1, nsIFrame* k2, const char* aMsg) { - printf("verifyreflow: "); + PRINTF("verifyreflow: "); nsAutoString name; if (nsnull != k1) { nsIFrameDebug* frameDebug; @@ -5419,9 +5406,9 @@ LogVerifyMessage(nsIFrame* k1, nsIFrame* k2, const char* aMsg) else { name.AssignWithConversion("(null)"); } - fputs(name, stdout); + PRINTF(NS_ConvertUCS2toUTF8(name)); - printf(" != "); + PRINTF(" != "); if (nsnull != k2) { nsIFrameDebug* frameDebug; @@ -5434,40 +5421,38 @@ LogVerifyMessage(nsIFrame* k1, nsIFrame* k2, const char* aMsg) else { name.AssignWithConversion("(null)"); } - fputs(name, stdout); + PRINTF(NS_ConvertUCS2toUTF8(name)); - printf(" %s", aMsg); + PRINTF(" %s", aMsg); } static void LogVerifyMessage(nsIFrame* k1, nsIFrame* k2, const char* aMsg, const nsRect& r1, const nsRect& r2) { - printf("VerifyReflow Error:\n"); + PRINTF("VerifyReflow Error:\n"); nsAutoString name; nsIFrameDebug* frameDebug; if (NS_SUCCEEDED(k1->QueryInterface(NS_GET_IID(nsIFrameDebug), (void**)&frameDebug))) { - fprintf(stdout, " "); + PRINTF(" "); frameDebug->GetFrameName(name); - fputs(name, stdout); - fprintf(stdout, " %p ", k1); + PRINTF("%s %p ", name, k1); } - printf("{%d, %d, %d, %d}", r1.x, r1.y, r1.width, r1.height); + PRINTF("{%d, %d, %d, %d}", r1.x, r1.y, r1.width, r1.height); - printf(" != \n"); + PRINTF(" != \n"); if (NS_SUCCEEDED(k2->QueryInterface(NS_GET_IID(nsIFrameDebug), (void**)&frameDebug))) { - fprintf(stdout, " "); + PRINTF(" "); frameDebug->GetFrameName(name); - fputs(name, stdout); - fprintf(stdout, " %p ", k2); + PRINTF("%s %p ", name, k2); } - printf("{%d, %d, %d, %d}\n", r2.x, r2.y, r2.width, r2.height); + PRINTF("{%d, %d, %d, %d}\n", r2.x, r2.y, r2.width, r2.height); - printf(" %s\n", aMsg); + PRINTF(" %s\n", aMsg); } static PRBool @@ -5488,7 +5473,7 @@ CompareTrees(nsIPresContext* aFirstPresContext, nsIFrame* aFirstFrame, if (l1 != l2) { ok = PR_FALSE; LogVerifyMessage(k1, k2, "child counts don't match: "); - printf("%d != %d\n", l1, l2); + PRINTF("%d != %d\n", l1, l2); if (0 == (VERIFY_REFLOW_ALL & gVerifyReflowFlags)) { break; } @@ -5608,8 +5593,8 @@ CompareTrees(nsIPresContext* aFirstPresContext, nsIFrame* aFirstFrame, if (band1.mCount != band2.mCount) { // count mismatch, stop comparing LogVerifyMessage(k1, k2, "band.mCount of space managers differs\n"); - printf("count1= %d, count2=%d, yOffset = %d, size=%d\n", - band1.mCount, band2.mCount, yOffset, small); + PRINTF("count1= %d, count2=%d, yOffset = %d, size=%d\n", + band1.mCount, band2.mCount, yOffset, small); ok = PR_FALSE; } @@ -5623,7 +5608,7 @@ CompareTrees(nsIPresContext* aFirstPresContext, nsIFrame* aFirstFrame, if (!match) { LogVerifyMessage(k1, k2, "band.mTrapezoids of space managers differs\n"); - printf ("index %d\n", trapIndex); + PRINTF("index %d\n", trapIndex); } } } @@ -5633,7 +5618,7 @@ CompareTrees(nsIPresContext* aFirstPresContext, nsIFrame* aFirstFrame, if (band1.mCount != band2.mCount) { // count mismatch, stop comparing LogVerifyMessage(k1, k2, "band.mCount of space managers differs\n"); - printf("count1= %d, count2=%d, yOffset = %d, size=%d\n", + PRINTF("count1= %d, count2=%d, yOffset = %d, size=%d\n", band1.mCount, band2.mCount, yOffset, small); ok = PR_FALSE; @@ -5648,7 +5633,7 @@ CompareTrees(nsIPresContext* aFirstPresContext, nsIFrame* aFirstFrame, if (!match) { LogVerifyMessage(k1, k2, "band.mTrapezoids of space managers differs\n"); - printf ("index %d\n", trapIndex); + PRINTF("index %d\n", trapIndex); } } } @@ -5693,18 +5678,18 @@ CompareTrees(nsIPresContext* aFirstPresContext, nsIFrame* aFirstFrame, nsAutoString tmp; if (nsnull != listName1) { listName1->ToString(tmp); - fputs(tmp, stdout); + PRINTF(NS_ConvertUCS2toUTF8(tmp)); } else - fputs("(null)", stdout); - printf(" != "); + PRINTF("(null)"); + PRINTF(" != "); if (nsnull != listName2) { listName2->ToString(tmp); - fputs(tmp, stdout); + PRINTF(NS_ConvertUCS2toUTF8(tmp)); } else - fputs("(null)", stdout); - printf("\n"); + PRINTF("(null)"); + PRINTF("\n"); NS_IF_RELEASE(listName1); NS_IF_RELEASE(listName2); break; @@ -5758,7 +5743,7 @@ PRBool PresShell::VerifyIncrementalReflow() { if (VERIFY_REFLOW_NOISY & gVerifyReflowFlags) { - printf("Building Verification Tree...\n"); + PRINTF("Building Verification Tree...\n"); } // All the stuff we are creating that needs releasing nsIPresContext* cx; @@ -5863,7 +5848,7 @@ PresShell::VerifyIncrementalReflow() sh->InitialReflow(r.width, r.height); sh->SetVerifyReflowEnable(PR_TRUE); // turn on verify reflow again now that we're done reflowing the test frame tree if (VERIFY_REFLOW_NOISY & gVerifyReflowFlags) { - printf("Verification Tree built, comparing...\n"); + PRINTF("Verification Tree built, comparing...\n"); } // Now that the document has been reflowed, use its frame tree to @@ -5874,14 +5859,14 @@ PresShell::VerifyIncrementalReflow() sh->GetRootFrame(&root2); PRBool ok = CompareTrees(mPresContext, root1, cx, root2); if (!ok && (VERIFY_REFLOW_NOISY & gVerifyReflowFlags)) { - printf("Verify reflow failed, primary tree:\n"); + PRINTF("Verify reflow failed, primary tree:\n"); nsIFrameDebug* frameDebug; if (NS_SUCCEEDED(root1->QueryInterface(NS_GET_IID(nsIFrameDebug), (void**)&frameDebug))) { frameDebug->List(mPresContext, stdout, 0); } - printf("Verification tree:\n"); + PRINTF("Verification tree:\n"); if (NS_SUCCEEDED(root2->QueryInterface(NS_GET_IID(nsIFrameDebug), (void**)&frameDebug))) { frameDebug->List(mPresContext, stdout, 0); @@ -5895,7 +5880,7 @@ PresShell::VerifyIncrementalReflow() NS_RELEASE(sh); NS_RELEASE(vm); if (VERIFY_REFLOW_NOISY & gVerifyReflowFlags) { - printf("Finished Verifying Reflow...\n"); + PRINTF("Finished Verifying Reflow...\n"); } return ok; @@ -6170,14 +6155,14 @@ void ReflowCounter::DisplayTotals(PRUint32 * aArray, const char * aTitle) } ReflowCounter * gTots = (ReflowCounter *)mMgr->LookUp(kGrandTotalsStr); - printf("%25s\t", aTitle); + PRINTF("%25s\t", aTitle); for (i=0;i 0) { gTots->Add((nsReflowReason)i, aArray[i]); } } - printf("%d\n", total); + PRINTF("%d\n", total); } //------------------------------------------------------------------ @@ -6305,16 +6290,16 @@ void ReflowCountMgr::DoGrandTotals() } static const char * title[] = {"Init", "Incrm", "Resze", "Style", "Dirty", "Total"}; - printf("\t\t\t"); + PRINTF("\t\t\t"); PRUint32 i; for (i=0;i scrollArea-height=%d\n", + PRINTF(": kid-height=%d > scrollArea-height=%d\n", kidDesiredSize.height, scrollAreaSize.height); #endif } diff --git a/mozilla/layout/html/base/src/nsSplittableFrame.cpp b/mozilla/layout/html/base/src/nsSplittableFrame.cpp index 6b24487f846..006ef081675 100644 --- a/mozilla/layout/html/base/src/nsSplittableFrame.cpp +++ b/mozilla/layout/html/base/src/nsSplittableFrame.cpp @@ -24,6 +24,12 @@ #include "nsIPresContext.h" #include "nsIStyleContext.h" #include "nsISizeOfHandler.h" +#include "nslog.h" +#undef fprintf + +NS_IMPL_LOG(nsSplittableFrameLog) +#define PRINTF NS_LOG_PRINTF(nsSplittableFrameLog) +#define FLUSH NS_LOG_FLUSH(nsSplittableFrameLog) NS_IMETHODIMP nsSplittableFrame::Init(nsIPresContext* aPresContext, diff --git a/mozilla/layout/html/base/src/nsTextFrame.cpp b/mozilla/layout/html/base/src/nsTextFrame.cpp index 99d63180faa..77279ed4b8b 100644 --- a/mozilla/layout/html/base/src/nsTextFrame.cpp +++ b/mozilla/layout/html/base/src/nsTextFrame.cpp @@ -65,6 +65,12 @@ #include "nsIPref.h" #include "nsIServiceManager.h" +#include "nslog.h" +#undef fprintf + +NS_IMPL_LOG(nsTextFrameLog) +#define PRINTF NS_LOG_PRINTF(nsTextFrameLog) +#define FLUSH NS_LOG_FLUSH(nsTextFrameLog) #ifndef PR_ABS #define PR_ABS(x) ((x) < 0 ? -(x) : (x)) @@ -284,7 +290,7 @@ NS_IMETHODIMP_(void) nsBlinkTimer::Notify(nsITimer *timer) LL_SUB(delta, now, gLastTick); gLastTick = now; PR_snprintf(buf, sizeof(buf), "%lldusec", delta); - printf("%s\n", buf); + PRINTF("%s\n", buf); #endif PRInt32 i, n = mFrames.Count(); @@ -3978,7 +3984,7 @@ nsTextFrame::MeasureText(nsIPresContext* aPresContext, // frame and recorded it as part of the word. #ifdef DEBUG_WORD_WRAPPING ListTag(stdout); - printf(": in word; skipping\n"); + PRINTF(": in word; skipping\n"); #endif lineLayout.ForgetWordFrame(this); } @@ -4009,12 +4015,11 @@ nsTextFrame::MeasureText(nsIPresContext* aPresContext, #ifdef DEBUG_WORD_WRAPPING nsAutoString tmp(aTx.GetWordBuffer(), lastWordLen); ListTag(stdout); - printf(": start='"); - fputs(tmp, stdout); - printf("' lastWordLen=%d baseWidth=%d prevOffset=%d offset=%d next=", + PRINTF(": start='%s", tmp); + PRINTF("' lastWordLen=%d baseWidth=%d prevOffset=%d offset=%d next=", lastWordLen, lastWordWidth, prevOffset, aTextData.mOffset); ListTag(stdout, next); - printf("\n"); + PRINTF("\n"); #endif PRUnichar* pWordBuf = lastWordPtr; PRUint32 wordBufLen = aTx.GetWordBufferLength() - @@ -4069,7 +4074,7 @@ nsTextFrame::MeasureText(nsIPresContext* aPresContext, else { #ifdef NOISY_REFLOW ListTag(stdout); - printf(": look-ahead (didn't fit) x=%d wordWidth=%d lastWordWidth=%d\n", + PRINTF(": look-ahead (didn't fit) x=%d wordWidth=%d lastWordWidth=%d\n", aTextData.mX, wordWidth, lastWordWidth); #endif // The fully joined word won't fit. We need to reduce our @@ -4079,7 +4084,7 @@ nsTextFrame::MeasureText(nsIPresContext* aPresContext, aTextData.mOffset = prevOffset; column = prevColumn; #ifdef DEBUG_WORD_WRAPPING - printf(" x=%d maxWordWidth=%d len=%d\n", aTextData.mX, aTextData.mMaxWordWidth, + PRINTF(" x=%d maxWordWidth=%d len=%d\n", aTextData.mX, aTextData.mMaxWordWidth, aTextData.mOffset - startingOffset); #endif lineLayout.ForgetWordFrames(); @@ -4129,7 +4134,7 @@ nsTextFrame::Reflow(nsIPresContext* aPresContext, DO_GLOBAL_REFLOW_COUNT("nsTextFrame", aReflowState.reason); #ifdef NOISY_REFLOW ListTag(stdout); - printf(": BeginReflow: availableSize=%d,%d\n", + PRINTF(": BeginReflow: availableSize=%d,%d\n", aReflowState.availableWidth, aReflowState.availableHeight); #endif @@ -4267,11 +4272,11 @@ nsTextFrame::Reflow(nsIPresContext* aPresContext, // previous reflow measureText = PR_FALSE; #ifdef NOISY_REFLOW - printf(" => measureText=%s wrapping=%s skipWhitespace=%s", + PRINTF(" => measureText=%s wrapping=%s skipWhitespace=%s", measureText ? "yes" : "no", wrapping ? "yes" : "no", skipWhitespace ? "yes" : "no"); - printf(" realWidth=%d maxWidth=%d\n", + PRINTF(" realWidth=%d maxWidth=%d\n", realWidth, maxWidth); #endif } @@ -4364,7 +4369,7 @@ nsTextFrame::Reflow(nsIPresContext* aPresContext, aMetrics.mBoundingMetrics.descent = aMetrics.descent; aMetrics.mBoundingMetrics.width = aMetrics.width; #ifdef MOZ_MATHML_BOUNDINGMETRICS - printf("nsTextFrame: could not perform GetBoundingMetrics()\n"); + PRINTF("nsTextFrame: could not perform GetBoundingMetrics()\n"); #endif } } @@ -4402,7 +4407,7 @@ nsTextFrame::Reflow(nsIPresContext* aPresContext, #ifdef NOISY_REFLOW ListTag(stdout); - printf(": desiredSize=%d,%d(a=%d/d=%d) status=%x\n", + PRINTF(": desiredSize=%d,%d(a=%d/d=%d) status=%x\n", aMetrics.width, aMetrics.height, aMetrics.ascent, aMetrics.descent, aStatus); #endif @@ -4462,7 +4467,7 @@ nsTextFrame::TrimTrailingWhiteSpace(nsIPresContext* aPresContext, } #ifdef NOISY_TRIM ListTag(stdout); - printf(": trim => %d\n", dw); + PRINTF(": trim => %d\n", dw); #endif if (0 != dw) { mState |= TEXT_TRIMMED_WS; @@ -4506,9 +4511,9 @@ nsTextFrame::ComputeTotalWordWidth(nsIPresContext* aPresContext, nsIContent* content = nsnull; if ((NS_OK == aNextFrame->GetContent(&content)) && (nsnull != content)) { #ifdef DEBUG_WORD_WRAPPING - printf(" next textRun="); + PRINTF(" next textRun="); nsFrame::ListTag(stdout, aNextFrame); - printf("\n"); + PRINTF("\n"); #endif nsITextContent* tc; if (NS_OK == content->QueryInterface(kITextContentIID, (void**)&tc)) { @@ -4526,7 +4531,7 @@ nsTextFrame::ComputeTotalWordWidth(nsIPresContext* aPresContext, NS_RELEASE(content); addedWidth += moreWidth; #ifdef DEBUG_WORD_WRAPPING - printf(" moreWidth=%d (addedWidth=%d) stop=%c\n", moreWidth, + PRINTF(" moreWidth=%d (addedWidth=%d) stop=%c\n", moreWidth, addedWidth, stop?'T':'F'); #endif if (stop) { @@ -4548,7 +4553,7 @@ nsTextFrame::ComputeTotalWordWidth(nsIPresContext* aPresContext, done:; #ifdef DEBUG_WORD_WRAPPING - printf(" total word width=%d\n", aBaseWidth + addedWidth); + PRINTF(" total word width=%d\n", aBaseWidth + addedWidth); #endif return aBaseWidth + addedWidth; } @@ -4643,9 +4648,8 @@ nsTextFrame::ComputeWordFragmentWidth(nsIPresContext* aPresContext, #ifdef DEBUG_WORD_WRAPPING nsAutoString tmp(bp, wordLen); - printf(" fragment='"); - fputs(tmp, stdout); - printf("' width=%d [wordLen=%d contentLen=%d ContentLength=%d]\n", + PRINTF(" fragment='%s", tmp); + PRINTF("' width=%d [wordLen=%d contentLen=%d ContentLength=%d]\n", width, wordLen, contentLen, tx.GetContentLength()); #endif @@ -4732,7 +4736,7 @@ nsTextFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) cons IndentBy(out, aIndent); ListTag(out); #ifdef DEBUG_waterson - fprintf(out, " [parent=%p]", mParent); + FPRINTF(out, " [parent=%p]", mParent); #endif nsIView* view; GetView(aPresContext, &view); @@ -4773,13 +4777,11 @@ nsTextFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) cons aIndent++; IndentBy(out, aIndent); - fputs("\"", out); - fputs(tmp, out); - fputs("\"\n", out); + fprintf(out, "\"%s\"\n", tmp); aIndent--; IndentBy(out, aIndent); - fputs(">\n", out); + fprintf(out, ">\n"); return NS_OK; } diff --git a/mozilla/layout/html/base/src/nsTextTransformer.cpp b/mozilla/layout/html/base/src/nsTextTransformer.cpp index 6297fb2090b..c8b76b5aa98 100644 --- a/mozilla/layout/html/base/src/nsTextTransformer.cpp +++ b/mozilla/layout/html/base/src/nsTextTransformer.cpp @@ -34,6 +34,11 @@ #include "nsUnicharUtilCIID.h" #include "nsICaseConversion.h" #include "prenv.h" +#include "nslog.h" + +NS_IMPL_LOG(nsTextTransformerLog) +#define PRINTF NS_LOG_PRINTF(nsTextTransformerLog) +#define FLUSH NS_LOG_FLUSH(nsTextTransformerLog) nsAutoTextBuffer::nsAutoTextBuffer() : mBuffer(mAutoBuffer), @@ -1414,9 +1419,8 @@ nsTextTransformer::SelfTest(nsILineBreaker* aLineBreaker, // Do forwards test if (gNoisy) { nsAutoString uc2(st->text); - printf("%s forwards test: '", isAsciiTest ? "ascii" : "unicode"); - fputs(uc2, stdout); - printf("'\n"); + PRINTF("%s forwards test: '%s", isAsciiTest ? "ascii" : "unicode", uc2); + PRINTF("'\n"); } tx.Init2(&frag, 0, preModeValue[preMode], NS_STYLE_TEXT_TRANSFORM_NONE); @@ -1425,10 +1429,9 @@ nsTextTransformer::SelfTest(nsILineBreaker* aLineBreaker, while ((bp = tx.GetNextWord(PR_FALSE, &wordLen, &contentLen, &ws, &transformed))) { if (gNoisy) { - nsAutoString tmp(bp, wordLen); - printf(" '"); - fputs(tmp, stdout); - printf("': ws=%s wordLen=%d (%d) contentLen=%d (offset=%d)\n", + nsCAutoString tmp; tmp.AssignWithConversion(bp, wordLen); + PRINTF(" '%s", (const char*)tmp); + PRINTF("': ws=%s wordLen=%d (%d) contentLen=%d (offset=%d)\n", ws ? "yes" : "no", wordLen, *expectedResults, contentLen, tx.mOffset); } @@ -1447,9 +1450,8 @@ nsTextTransformer::SelfTest(nsILineBreaker* aLineBreaker, // Do backwards test if (gNoisy) { nsAutoString uc2(st->text); - printf("%s backwards test: '", isAsciiTest ? "ascii" : "unicode"); - fputs(uc2, stdout); - printf("'\n"); + PRINTF("%s backwards test: '%s", isAsciiTest ? "ascii" : "unicode", uc2); + PRINTF("'\n"); } tx.Init2(&frag, frag.GetLength(), NS_STYLE_WHITESPACE_NORMAL, NS_STYLE_TEXT_TRANSFORM_NONE); @@ -1457,10 +1459,9 @@ nsTextTransformer::SelfTest(nsILineBreaker* aLineBreaker, while ((bp = tx.GetPrevWord(PR_FALSE, &wordLen, &contentLen, &ws))) { --expectedResults; if (gNoisy) { - nsAutoString tmp(bp, wordLen); - printf(" '"); - fputs(tmp, stdout); - printf("': ws=%s wordLen=%d contentLen=%d (offset=%d)\n", + nsCAutoString tmp; tmp.AssignWithConversion(bp, wordLen); + PRINTF(" '%s", (const char*)tmp); + PRINTF("': ws=%s wordLen=%d contentLen=%d (offset=%d)\n", ws ? "yes" : "no", wordLen, contentLen, tx.mOffset); } @@ -1476,7 +1477,7 @@ nsTextTransformer::SelfTest(nsILineBreaker* aLineBreaker, } if (error) { - fprintf(stderr, "nsTextTransformer: self test %d failed\n", testNum); + PRINTF("nsTextTransformer: self test %d failed\n", testNum); } testNum++; } diff --git a/mozilla/layout/html/content/src/nsGenericHTMLElement.cpp b/mozilla/layout/html/content/src/nsGenericHTMLElement.cpp index 10249427b59..d60ad988cbd 100644 --- a/mozilla/layout/html/content/src/nsGenericHTMLElement.cpp +++ b/mozilla/layout/html/content/src/nsGenericHTMLElement.cpp @@ -91,6 +91,13 @@ #include "nsIHTMLContentSink.h" #include "nsHTMLContentSinkStream.h" #include "nsLayoutCID.h" +#include "nslog.h" +#undef fprintf + +NS_IMPL_LOG(nsGenericHTMLElementLog) +#define PRINTF NS_LOG_PRINTF(nsGenericHTMLElementLog) +#define FLUSH NS_LOG_FLUSH(nsGenericHTMLElementLog) + // XXX todo: add in missing out-of-memory checks #include "nsIPref.h" // Used by the temp pref, should be removed! diff --git a/mozilla/layout/html/document/src/nsFrameFrame.cpp b/mozilla/layout/html/document/src/nsFrameFrame.cpp index 1d4127d968e..674adf45ea9 100644 --- a/mozilla/layout/html/document/src/nsFrameFrame.cpp +++ b/mozilla/layout/html/document/src/nsFrameFrame.cpp @@ -70,6 +70,11 @@ #include "nsIBrowserBoxObject.h" #include "nsISHistory.h" #endif +#include "nslog.h" + +NS_IMPL_LOG(nsFrameFrameLog) +#define PRINTF NS_LOG_PRINTF(nsFrameFrameLog) +#define FLUSH NS_LOG_FLUSH(nsFrameFrameLog) class nsHTMLFrame; @@ -215,7 +220,7 @@ nsHTMLFrameOuterFrame::nsHTMLFrameOuterFrame() nsHTMLFrameOuterFrame::~nsHTMLFrameOuterFrame() { - //printf("nsHTMLFrameOuterFrame destructor %X \n", this); + //PRINTF("nsHTMLFrameOuterFrame destructor %X \n", this); } NS_IMETHODIMP @@ -285,7 +290,7 @@ nsHTMLFrameOuterFrame::Paint(nsIPresContext* aPresContext, const nsRect& aDirtyRect, nsFramePaintLayer aWhichLayer) { - //printf("outer paint %X (%d,%d,%d,%d) \n", this, aDirtyRect.x, aDirtyRect.y, aDirtyRect.width, aDirtyRect.height); + //PRINTF("outer paint %X (%d,%d,%d,%d) \n", this, aDirtyRect.x, aDirtyRect.y, aDirtyRect.width, aDirtyRect.height); nsIFrame* firstChild = mFrames.FirstChild(); if (nsnull != firstChild) { firstChild->Paint(aPresContext, aRenderingContext, aDirtyRect, @@ -322,7 +327,7 @@ nsHTMLFrameOuterFrame::Reflow(nsIPresContext* aPresContext, nsReflowStatus& aStatus) { DO_GLOBAL_REFLOW_COUNT("nsHTMLFrameOuterFrame", aReflowState.reason); - //printf("OuterFrame::Reflow %X (%d,%d) \n", this, aReflowState.availableWidth, aReflowState.availableHeight); + //PRINTF("OuterFrame::Reflow %X (%d,%d) \n", this, aReflowState.availableWidth, aReflowState.availableHeight); NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS, ("enter nsHTMLFrameOuterFrame::Reflow: maxSize=%d,%d reason=%d", aReflowState.availableWidth, aReflowState.availableHeight, aReflowState.reason)); @@ -428,7 +433,7 @@ nsHTMLFrameOuterFrame::AttributeChanged(nsIPresContext* aPresContext, PRInt32 aHint) { if (nsHTMLAtoms::src == aAttribute) { - printf("got a request\n"); + PRINTF("got a request\n"); nsIFrame* firstChild = mFrames.FirstChild(); if (nsnull != firstChild) { return ((nsHTMLFrameInnerFrame*)firstChild)->ReloadURL(aPresContext); @@ -463,7 +468,7 @@ nsHTMLFrameInnerFrame::nsHTMLFrameInnerFrame() nsHTMLFrameInnerFrame::~nsHTMLFrameInnerFrame() { - //printf("nsHTMLFrameInnerFrame destructor %X \n", this); + //PRINTF("nsHTMLFrameInnerFrame destructor %X \n", this); #ifdef INCLUDE_XUL nsCOMPtr xulElt(do_QueryInterface(mContent)); @@ -650,7 +655,7 @@ nsHTMLFrameInnerFrame::Paint(nsIPresContext* aPresContext, const nsRect& aDirtyRect, nsFramePaintLayer aWhichLayer) { - //printf("inner paint %X (%d,%d,%d,%d) \n", this, aDirtyRect.x, aDirtyRect.y, aDirtyRect.width, aDirtyRect.height); + //PRINTF("inner paint %X (%d,%d,%d,%d) \n", this, aDirtyRect.x, aDirtyRect.y, aDirtyRect.width, aDirtyRect.height); // if there is not web shell paint based on our background color, // otherwise let the web shell paint the sub document if (!mSubShell) { diff --git a/mozilla/layout/html/document/src/nsFrameSetFrame.cpp b/mozilla/layout/html/document/src/nsFrameSetFrame.cpp index 376601f650e..cd6e70682f5 100644 --- a/mozilla/layout/html/document/src/nsFrameSetFrame.cpp +++ b/mozilla/layout/html/document/src/nsFrameSetFrame.cpp @@ -47,6 +47,13 @@ #include "nsILookAndFeel.h" #include "nsWidgetsCID.h" #include "nsIComponentManager.h" +#include "nslog.h" +#undef fprintf + +NS_IMPL_LOG(nsFrameSetFrameLog) +#define PRINTF NS_LOG_PRINTF(nsFrameSetFrameLog) +#define FLUSH NS_LOG_FLUSH(nsFrameSetFrameLog) + // masks for mEdgeVisibility #define LEFT_VIS 0x0001 #define RIGHT_VIS 0x0002 @@ -646,7 +653,7 @@ nsHTMLFramesetFrame::Paint(nsIPresContext* aPresContext, const nsRect& aDirtyRect, nsFramePaintLayer aWhichLayer) { - //printf("frameset paint %X (%d,%d,%d,%d) \n", this, aDirtyRect.x, aDirtyRect.y, aDirtyRect.width, aDirtyRect.height); + //PRINTF("frameset paint %X (%d,%d,%d,%d) \n", this, aDirtyRect.x, aDirtyRect.y, aDirtyRect.width, aDirtyRect.height); return nsHTMLContainerFrame::Paint(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer); } @@ -937,7 +944,7 @@ nsHTMLFramesetFrame::Reflow(nsIPresContext* aPresContext, nsCOMPtr shell; aPresContext->GetShell(getter_AddRefs(shell)); - //printf("FramesetFrame2::Reflow %X (%d,%d) \n", this, aReflowState.availableWidth, aReflowState.availableHeight); + //PRINTF("FramesetFrame2::Reflow %X (%d,%d) \n", this, aReflowState.availableWidth, aReflowState.availableHeight); // Always get the size so that the caller knows how big we are GetDesiredSize(aPresContext, aReflowState, aDesiredSize); PRBool firstTime = (0 == mNumRows); @@ -1567,7 +1574,7 @@ nsHTMLFramesetBorderFrame::nsHTMLFramesetBorderFrame(PRInt32 aWidth, nsHTMLFramesetBorderFrame::~nsHTMLFramesetBorderFrame() { - //printf("nsHTMLFramesetBorderFrame destructor %p \n", this); + //PRINTF("nsHTMLFramesetBorderFrame destructor %p \n", this); } void nsHTMLFramesetBorderFrame::GetDesiredSize(nsIPresContext* aPresContext, @@ -1612,7 +1619,7 @@ nsHTMLFramesetBorderFrame::Paint(nsIPresContext* aPresContext, if (NS_FRAME_PAINT_LAYER_FOREGROUND != aWhichLayer) { return NS_OK; } - //printf("border frame paint %X (%d,%d,%d,%d) \n", this, aDirtyRect.x, aDirtyRect.y, aDirtyRect.width, aDirtyRect.height); + //PRINTF("border frame paint %X (%d,%d,%d,%d) \n", this, aDirtyRect.x, aDirtyRect.y, aDirtyRect.width, aDirtyRect.height); nscolor WHITE = NS_RGB(255, 255, 255); nscolor bgColor = NS_RGB(200,200,200); nscolor fgColor = NS_RGB(0,0,0); @@ -1762,7 +1769,7 @@ NS_IMETHODIMP nsHTMLFramesetBorderFrame::GetFrameName(nsString& aResult) const nsHTMLFramesetBlankFrame::~nsHTMLFramesetBlankFrame() { - //printf("nsHTMLFramesetBlankFrame destructor %p \n", this); + //PRINTF("nsHTMLFramesetBlankFrame destructor %p \n", this); } void nsHTMLFramesetBlankFrame::GetDesiredSize(nsIPresContext* aPresContext, diff --git a/mozilla/layout/html/document/src/nsHTMLContentSink.cpp b/mozilla/layout/html/document/src/nsHTMLContentSink.cpp index bb71c69854a..4d3a03c1499 100644 --- a/mozilla/layout/html/document/src/nsHTMLContentSink.cpp +++ b/mozilla/layout/html/document/src/nsHTMLContentSink.cpp @@ -110,6 +110,13 @@ #include "nsContentPolicyUtils.h" #include "nsWeakReference.h"//nshtmlelementfactory supports weak references +#include "nslog.h" +#undef PRLogModuleInfo +#undef PR_NewLogModule + +NS_IMPL_LOG(nsHTMLContentSinkLog) +#define PRINTF NS_LOG_PRINTF(nsHTMLContentSinkLog) +#define FLUSH NS_LOG_FLUSH(nsHTMLContentSinkLog) #ifdef ALLOW_ASYNCH_STYLE_SHEETS const PRBool kBlockByDefault=PR_FALSE; @@ -1011,7 +1018,7 @@ GetOptionText(const nsIParserNode& aNode, nsString& aText) } nsAutoString x; char* y = aText.ToNewCString(); - printf("foo"); + PRINTF("foo"); } #endif diff --git a/mozilla/layout/html/document/src/nsHTMLDocument.cpp b/mozilla/layout/html/document/src/nsHTMLDocument.cpp index 54ecc620d18..003c61c4bf8 100644 --- a/mozilla/layout/html/document/src/nsHTMLDocument.cpp +++ b/mozilla/layout/html/document/src/nsHTMLDocument.cpp @@ -108,6 +108,11 @@ #include "nsICachedNetData.h" #include "nsIXMLContent.h" //for createelementNS #include "nsHTMLParts.h" //for createelementNS +#include "nslog.h" + +NS_IMPL_LOG(nsHTMLDocumentLog) +#define PRINTF NS_LOG_PRINTF(nsHTMLDocumentLog) +#define FLUSH NS_LOG_FLUSH(nsHTMLDocumentLog) #define DETECTOR_CONTRACTID_MAX 127 @@ -566,7 +571,7 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand, { #ifdef DEBUG_charset char* cCharset = charset.ToNewCString(); - printf("From HTTP Header, charset = %s\n", cCharset); + PRINTF("From HTTP Header, charset = %s\n", cCharset); Recycle(cCharset); #endif charset = preferred; @@ -710,7 +715,7 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand, #ifdef DEBUG_charset nsAutoString d(defaultCharsetFromWebShell); char* cCharset = d.ToNewCString(); - printf("From default charset, charset = %s\n", cCharset); + PRINTF("From default charset, charset = %s\n", cCharset); Recycle(cCharset); #endif charset = defaultCharsetFromWebShell; @@ -735,7 +740,7 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand, #ifdef DEBUG_charset nsAutoString d(requestCharset); char* cCharset = d.ToNewCString(); - printf("From request charset, charset = %s req=%d->%d\n", + PRINTF("From request charset, charset = %s req=%d->%d\n", cCharset, charsetSource, requestCharsetSource); Recycle(cCharset); #endif @@ -755,7 +760,7 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand, #ifdef DEBUG_charset nsAutoString d(forceCharsetFromWebShell); char* cCharset = d.ToNewCString(); - printf("From force, charset = %s \n", cCharset); + PRINTF("From force, charset = %s \n", cCharset); Recycle(cCharset); #endif charset = forceCharsetFromWebShell; @@ -860,7 +865,7 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand, csAtom->ToString(charset); charsetSource = kCharsetFromParentFrame; - // printf("### 0 >>> Having parent CS = %s\n", charset.ToNewCString()); + // PRINTF("### 0 >>> Having parent CS = %s\n", charset.ToNewCString()); } } } @@ -934,7 +939,7 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand, #ifdef DEBUG_charset char* cCharset = charset.ToNewCString(); - printf("set to parser charset = %s source %d\n", + PRINTF("set to parser charset = %s source %d\n", cCharset, charsetSource); Recycle(cCharset); #endif @@ -3719,7 +3724,7 @@ void printDOMRefs(nsIDOMNode * aNode, PRInt32 aLevel) PRInt32 i; for (i=0;i"), aNode); + PRINTF("[%s] (0x%x)\n", (cStr?cStr:""), aNode); delete[] cStr; PRBool hasChildren; diff --git a/mozilla/layout/html/forms/src/nsButtonFrameRenderer.cpp b/mozilla/layout/html/forms/src/nsButtonFrameRenderer.cpp index d90e7a13c82..5d4e113b715 100644 --- a/mozilla/layout/html/forms/src/nsButtonFrameRenderer.cpp +++ b/mozilla/layout/html/forms/src/nsButtonFrameRenderer.cpp @@ -27,6 +27,11 @@ #include "nsIView.h" #include "nsIViewManager.h" #include "nsHTMLAtoms.h" +#include "nslog.h" + +NS_IMPL_LOG(nsButtonFrameRendererLog) +#define PRINTF NS_LOG_PRINTF(nsButtonFrameRendererLog) +#define FLUSH NS_LOG_FLUSH(nsButtonFrameRendererLog) #define ACTIVE "active" #define HOVER "hover" @@ -114,7 +119,7 @@ nsButtonFrameRenderer::PaintButton (nsIPresContext* aPresContext, nsFramePaintLayer aWhichLayer, const nsRect& aRect) { - //printf("painted width='%d' height='%d'\n",aRect.width, aRect.height); + //PRINTF("painted width='%d' height='%d'\n",aRect.width, aRect.height); // draw the border and background inside the focus and outline borders PaintBorderAndBackground(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer, aRect); diff --git a/mozilla/layout/html/forms/src/nsComboboxControlFrame.cpp b/mozilla/layout/html/forms/src/nsComboboxControlFrame.cpp index 4460a44522c..3aa1b5be06c 100644 --- a/mozilla/layout/html/forms/src/nsComboboxControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsComboboxControlFrame.cpp @@ -144,7 +144,7 @@ static PRInt32 gReflowInx = -1; if (mReflowId > -1) {\ gTotalReqs += gReflowControlCntRQ[mReflowId];\ gTotalReflows += gReflowControlCnt[mReflowId];\ - printf("** Id:%5d %s RF: %d RQ: %d %d/%d %5.2f\n", \ + PRINTF("** Id:%5d %s RF: %d RQ: %d %d/%d %5.2f\n", \ mReflowId, (__desc), \ gReflowControlCnt[mReflowId], \ gReflowControlCntRQ[mReflowId],\ @@ -162,10 +162,10 @@ static PRInt32 gReflowInx = -1; } // reflow messages -#define REFLOW_DEBUG_MSG(_msg1) printf((_msg1)) -#define REFLOW_DEBUG_MSG2(_msg1, _msg2) printf((_msg1), (_msg2)) -#define REFLOW_DEBUG_MSG3(_msg1, _msg2, _msg3) printf((_msg1), (_msg2), (_msg3)) -#define REFLOW_DEBUG_MSG4(_msg1, _msg2, _msg3, _msg4) printf((_msg1), (_msg2), (_msg3), (_msg4)) +#define REFLOW_DEBUG_MSG(_msg1) PRINTF((_msg1)) +#define REFLOW_DEBUG_MSG2(_msg1, _msg2) PRINTF((_msg1), (_msg2)) +#define REFLOW_DEBUG_MSG3(_msg1, _msg2, _msg3) PRINTF((_msg1), (_msg2), (_msg3)) +#define REFLOW_DEBUG_MSG4(_msg1, _msg2, _msg3, _msg4) PRINTF((_msg1), (_msg2), (_msg3), (_msg4)) #else //------------- @@ -186,10 +186,10 @@ static PRInt32 gReflowInx = -1; // This is for being VERY noisy //------------------------------------------ #ifdef DO_VERY_NOISY -#define REFLOW_NOISY_MSG(_msg1) printf((_msg1)) -#define REFLOW_NOISY_MSG2(_msg1, _msg2) printf((_msg1), (_msg2)) -#define REFLOW_NOISY_MSG3(_msg1, _msg2, _msg3) printf((_msg1), (_msg2), (_msg3)) -#define REFLOW_NOISY_MSG4(_msg1, _msg2, _msg3, _msg4) printf((_msg1), (_msg2), (_msg3), (_msg4)) +#define REFLOW_NOISY_MSG(_msg1) PRINTF((_msg1)) +#define REFLOW_NOISY_MSG2(_msg1, _msg2) PRINTF((_msg1), (_msg2)) +#define REFLOW_NOISY_MSG3(_msg1, _msg2, _msg3) PRINTF((_msg1), (_msg2), (_msg3)) +#define REFLOW_NOISY_MSG4(_msg1, _msg2, _msg3, _msg4) PRINTF((_msg1), (_msg2), (_msg3), (_msg4)) #else #define REFLOW_NOISY_MSG(_msg) #define REFLOW_NOISY_MSG2(_msg1, _msg2) @@ -215,7 +215,7 @@ static PRInt32 gReflowInx = -1; if (aReflowState.mComputedWidth != NS_UNCONSTRAINEDSIZE) { \ nscoord width = aDesiredSize.width - borderPadding.left - borderPadding.right; \ if (width != aReflowState.mComputedWidth) { \ - printf("aDesiredSize.width %d %d != aReflowState.mComputedWidth %d\n", aDesiredSize.width, width, aReflowState.mComputedWidth); \ + PRINTF("aDesiredSize.width %d %d != aReflowState.mComputedWidth %d\n", aDesiredSize.width, width, aReflowState.mComputedWidth); \ } \ NS_ASSERTION(width == aReflowState.mComputedWidth, "Returning bad value when constrained!"); \ } @@ -698,7 +698,7 @@ nsComboboxControlFrame::PositionDropdown(nsIPresContext* aPresContext, mDropdownFrame->SetRect(aPresContext, dropdownRect); #ifdef DEBUG_rodsXXXXXX - printf("%d Position Dropdown at: %d %d %d %d\n", counter++, dropdownRect.x, dropdownRect.y, dropdownRect.width, dropdownRect.height); + PRINTF("%d Position Dropdown at: %d %d %d %d\n", counter++, dropdownRect.x, dropdownRect.y, dropdownRect.width, dropdownRect.height); #endif return rv; @@ -774,7 +774,7 @@ nsComboboxControlFrame::ReflowItems(nsIPresContext* aPresContext, const nsHTMLReflowState& aReflowState, nsHTMLReflowMetrics& aDesiredSize) { - //printf("*****************\n"); + //PRINTF("*****************\n"); const nsStyleFont* dspFont; mDisplayFrame->GetStyleData(eStyleStruct_Font, (const nsStyleStruct *&)dspFont); nsCOMPtr deviceContext; @@ -798,7 +798,7 @@ nsComboboxControlFrame::ReflowItems(nsIPresContext* aPresContext, if (options) { PRUint32 numOptions; options->GetLength(&numOptions); - //printf("--- Num of Items %d ---\n", numOptions); + //PRINTF("--- Num of Items %d ---\n", numOptions); for (PRUint32 i=0;i optionElement = getter_AddRefs(GetOption(*options, i)); if (optionElement) { @@ -813,7 +813,7 @@ nsComboboxControlFrame::ReflowItems(nsIPresContext* aPresContext, maxWidth = width; } //maxWidth = PR_MAX(width, maxWidth); - //printf("[%d] - %d %s \n", i, width, text.ToNewCString()); + //PRINTF("[%d] - %d %s \n", i, width, text.ToNewCString()); } } } @@ -823,7 +823,7 @@ nsComboboxControlFrame::ReflowItems(nsIPresContext* aPresContext, maxWidth = 11 * 15; } char * str = maxStr.ToNewCString(); - printf("id: %d maxWidth %d [%s]\n", mReflowId, maxWidth, str); + PRINTF("id: %d maxWidth %d [%s]\n", mReflowId, maxWidth, str); delete [] str; // get the borderPadding for the display area @@ -842,7 +842,7 @@ nsComboboxControlFrame::ReflowItems(nsIPresContext* aPresContext, aDesiredSize.width = frmWidth; aDesiredSize.height = frmHeight; #else - printf("Size frm:%d,%d DS:%d,%d DIF:%d,%d(tp) %d,%d(px)\n", + PRINTF("Size frm:%d,%d DS:%d,%d DIF:%d,%d(tp) %d,%d(px)\n", frmWidth, frmHeight, aDesiredSize.width, aDesiredSize.height, frmWidth-aDesiredSize.width, frmHeight-aDesiredSize.height, @@ -1026,11 +1026,11 @@ static int myCounter = 0; static void printSize(char * aDesc, nscoord aSize) { - printf(" %s: ", aDesc); + PRINTF(" %s: ", aDesc); if (aSize == NS_UNCONSTRAINEDSIZE) { - printf("UC"); + PRINTF("UC"); } else { - printf("%d", PX(aSize)); + PRINTF("%d", PX(aSize)); } } #endif @@ -1051,21 +1051,21 @@ nsComboboxControlFrame::Reflow(nsIPresContext* aPresContext, REFLOW_COUNTER_REQUEST(); #ifdef DO_REFLOW_DEBUG - printf("-------------Starting Combobox Reflow ----------------------------\n"); - printf("%p ** Id: %d nsCCF::Reflow %d R: ", this, mReflowId, myCounter++); + PRINTF("-------------Starting Combobox Reflow ----------------------------\n"); + PRINTF("%p ** Id: %d nsCCF::Reflow %d R: ", this, mReflowId, myCounter++); switch (aReflowState.reason) { case eReflowReason_Initial: - printf("Ini");break; + PRINTF("Ini");break; case eReflowReason_Incremental: - printf("Inc");break; + PRINTF("Inc");break; case eReflowReason_Resize: - printf("Rsz");break; + PRINTF("Rsz");break; case eReflowReason_StyleChange: - printf("Sty");break; + PRINTF("Sty");break; case eReflowReason_Dirty: - printf("Drt "); + PRINTF("Drt "); break; - default:printf("%d", aReflowState.reason);break; + default:PRINTF("%d", aReflowState.reason);break; } printSize("AW", aReflowState.availableWidth); @@ -1078,7 +1078,7 @@ nsComboboxControlFrame::Reflow(nsIPresContext* aPresContext, optionsTemp->GetLength(&numOptions); printSize("NO", (nscoord)numOptions); - printf(" *\n"); + PRINTF(" *\n"); #endif @@ -1918,7 +1918,7 @@ NS_IMETHODIMP nsComboboxControlFrame::AddOption(nsIPresContext* aPresContext, PRInt32 aIndex) { #ifdef DO_REFLOW_DEBUG - printf("**********\n*********AddOption: %d\n", aIndex); + PRINTF("**********\n*********AddOption: %d\n", aIndex); #endif nsISelectControlFrame* listFrame = nsnull; nsresult rv = mDropdownFrame->QueryInterface(NS_GET_IID(nsISelectControlFrame), @@ -2424,8 +2424,8 @@ nsComboboxControlFrame::Paint(nsIPresContext* aPresContext, nsFramePaintLayer aWhichLayer) { #ifdef NOISY - printf("%p paint layer %d at (%d, %d, %d, %d)\n", this, aWhichLayer, - aDirtyRect.x, aDirtyRect.y, aDirtyRect.width, aDirtyRect.height); + PRINTF("%p paint layer %d at (%d, %d, %d, %d)\n", this, aWhichLayer, + aDirtyRect.x, aDirtyRect.y, aDirtyRect.width, aDirtyRect.height); #endif nsAreaFrame::Paint(aPresContext,aRenderingContext,aDirtyRect,aWhichLayer); diff --git a/mozilla/layout/html/forms/src/nsFieldSetFrame.cpp b/mozilla/layout/html/forms/src/nsFieldSetFrame.cpp index aa54c03bc0a..d9d859a0644 100644 --- a/mozilla/layout/html/forms/src/nsFieldSetFrame.cpp +++ b/mozilla/layout/html/forms/src/nsFieldSetFrame.cpp @@ -44,6 +44,11 @@ #include "nsStyleUtil.h" #include "nsFont.h" #include "nsCOMPtr.h" +#include "nslog.h" + +NS_IMPL_LOG(nsFieldSetFrameLog) +#define PRINTF NS_LOG_PRINTF(nsFieldSetFrameLog) +#define FLUSH NS_LOG_FLUSH(nsFieldSetFrameLog) static NS_DEFINE_IID(kLegendFrameCID, NS_LEGEND_FRAME_CID); static NS_DEFINE_IID(kIDOMHTMLFieldSetElementIID, NS_IDOMHTMLFIELDSETELEMENT_IID); @@ -368,9 +373,9 @@ nsFieldSetFrame::Reflow(nsIPresContext* aPresContext, ReflowChild(mLegendFrame, aPresContext, legendDesiredSize, legendReflowState, 0, 0, NS_FRAME_NO_MOVE_FRAME, aStatus); #ifdef NOISY_REFLOW - printf(" returned (%d, %d)\n", legendDesiredSize.width, legendDesiredSize.height); + PRINTF(" returned (%d, %d)\n", legendDesiredSize.width, legendDesiredSize.height); if (legendDesiredSize.maxElementSize) - printf(" and maxES (%d, %d)\n", + PRINTF(" and maxES (%d, %d)\n", legendDesiredSize.maxElementSize->width, legendDesiredSize.maxElementSize->height); #endif // figure out the legend's rectangle @@ -440,20 +445,20 @@ nsFieldSetFrame::Reflow(nsIPresContext* aPresContext, kidReflowState.mComputedMargin.left, kidReflowState.mComputedMargin.top, 0, aStatus); #ifdef NOISY_REFLOW - printf(" returned (%d, %d)\n", kidDesiredSize.width, kidDesiredSize.height); + PRINTF(" returned (%d, %d)\n", kidDesiredSize.width, kidDesiredSize.height); if (kidDesiredSize.maxElementSize) - printf(" and maxES (%d, %d)\n", + PRINTF(" and maxES (%d, %d)\n", kidDesiredSize.maxElementSize->width, kidDesiredSize.maxElementSize->height); #endif /* - printf("*** %p computedHgt: %d ", this, aReflowState.mComputedHeight); - printf("Reason: "); + PRINTF("*** %p computedHgt: %d ", this, aReflowState.mComputedHeight); + PRINTF("Reason: "); switch (aReflowState.reason) { - case eReflowReason_Initial:printf("Initil");break; - case eReflowReason_Incremental:printf("Increm");break; - case eReflowReason_Resize: printf("Resize"); break; - case eReflowReason_StyleChange:printf("eReflowReason_StyleChange");break; + case eReflowReason_Initial:PRINTF("Initil");break; + case eReflowReason_Incremental:PRINTF("Increm");break; + case eReflowReason_Resize: PRINTF("Resize"); break; + case eReflowReason_StyleChange:PRINTF("eReflowReason_StyleChange");break; } */ @@ -469,7 +474,7 @@ nsFieldSetFrame::Reflow(nsIPresContext* aPresContext, nsFrameState kidState; mContentFrame->GetFrameState(&kidState); - // printf("width: %d, height: %d\n", desiredSize.mCombinedArea.width, desiredSize.mCombinedArea.height); + // PRINTF("width: %d, height: %d\n", desiredSize.mCombinedArea.width, desiredSize.mCombinedArea.height); /* if (kidState & NS_FRAME_OUTSIDE_CHILDREN) { @@ -570,11 +575,11 @@ nsFieldSetFrame::Reflow(nsIPresContext* aPresContext, aDesiredSize.maxElementSize->height += borderPadding.top + borderPadding.bottom + mLegendRect.height; } #ifdef NOISY_REFLOW - printf("FIELDSET: w=%d, maxWidth=%d, MES=%d\n", + PRINTF("FIELDSET: w=%d, maxWidth=%d, MES=%d\n", aDesiredSize.width, aDesiredSize.mMaximumWidth, aDesiredSize.maxElementSize ? aDesiredSize.maxElementSize->width : -1); if (aDesiredSize.mFlags & NS_REFLOW_CALC_MAX_WIDTH) - printf(" and preferred size = %d\n", aDesiredSize.mMaximumWidth); + PRINTF(" and preferred size = %d\n", aDesiredSize.mMaximumWidth); #endif return NS_OK; diff --git a/mozilla/layout/html/forms/src/nsFormControlFrame.cpp b/mozilla/layout/html/forms/src/nsFormControlFrame.cpp index e1966a5a109..d86f9fc3503 100644 --- a/mozilla/layout/html/forms/src/nsFormControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsFormControlFrame.cpp @@ -61,6 +61,8 @@ #include "nsIEventStateManager.h" #include "nsIScrollableView.h" +NS_IMPL_LOG(nsFormControlFrameLog) + #ifdef DEBUG_evaughan //#define DEBUG_rods #endif @@ -70,15 +72,15 @@ #endif #ifdef FCF_NOISY -#define REFLOW_DEBUG_MSG(_msg1) printf((_msg1)) -#define REFLOW_DEBUG_MSG2(_msg1, _msg2) printf((_msg1), (_msg2)) -#define REFLOW_DEBUG_MSG3(_msg1, _msg2, _msg3) printf((_msg1), (_msg2), (_msg3)) -#define REFLOW_DEBUG_MSG4(_msg1, _msg2, _msg3, _msg4) printf((_msg1), (_msg2), (_msg3), (_msg4)) +#define REFLOW_DEBUG_MSG(_msg1) PRINTF((_msg1)) +#define REFLOW_DEBUG_MSG2(_msg1, _msg2) PRINTF((_msg1), (_msg2)) +#define REFLOW_DEBUG_MSG3(_msg1, _msg2, _msg3) PRINTF((_msg1), (_msg2), (_msg3)) +#define REFLOW_DEBUG_MSG4(_msg1, _msg2, _msg3, _msg4) PRINTF((_msg1), (_msg2), (_msg3), (_msg4)) -#define IF_REFLOW_DEBUG_MSG(_bool, _msg1) if ((_bool)) printf((_msg1)) -#define IF_REFLOW_DEBUG_MSG2(_bool, _msg1, _msg2) if ((_bool)) printf((_msg1), (_msg2)) -#define IF_REFLOW_DEBUG_MSG3(_bool, _msg1, _msg2, _msg3) if ((_bool)) printf((_msg1), (_msg2), (_msg3)) -#define IF_REFLOW_DEBUG_MSG4(_bool, _msg1, _msg2, _msg3, _msg4) if ((_bool)) printf((_msg1), (_msg2), (_msg3), (_msg4)) +#define IF_REFLOW_DEBUG_MSG(_bool, _msg1) if ((_bool)) PRINTF((_msg1)) +#define IF_REFLOW_DEBUG_MSG2(_bool, _msg1, _msg2) if ((_bool)) PRINTF((_msg1), (_msg2)) +#define IF_REFLOW_DEBUG_MSG3(_bool, _msg1, _msg2, _msg3) if ((_bool)) PRINTF((_msg1), (_msg2), (_msg3)) +#define IF_REFLOW_DEBUG_MSG4(_bool, _msg1, _msg2, _msg3, _msg4) if ((_bool)) PRINTF((_msg1), (_msg2), (_msg3), (_msg4)) #else //------------- #define REFLOW_DEBUG_MSG(_msg) @@ -283,7 +285,7 @@ void nsFormControlFrame::SkipResizeReflow(nsSize& aCacheSize, aBailOnWidth = aCacheSize.width != kSizeNotSet; #ifdef FCF_NOISY if (aBailOnWidth) { - printf("-------------- #1 Bailing on aCachedAvailableSize.width %d != kSizeNotSet\n", aCachedAvailableSize.width); + PRINTF("-------------- #1 Bailing on aCachedAvailableSize.width %d != kSizeNotSet\n", aCachedAvailableSize.width); } #endif } else { @@ -292,12 +294,12 @@ void nsFormControlFrame::SkipResizeReflow(nsSize& aCacheSize, aBailOnWidth = aCachedAvailableSize.width <= width && aCachedAvailableSize.width != kSizeNotSet; #ifdef FCF_NOISY if (aBailOnWidth) { - printf("-------------- #2 Bailing on aCachedAvailableSize.width %d <= width %d\n", aCachedAvailableSize.width, width ); + PRINTF("-------------- #2 Bailing on aCachedAvailableSize.width %d <= width %d\n", aCachedAvailableSize.width, width ); } else { aBailOnWidth = width <= (aCacheSize.width - aReflowState.mComputedBorderPadding.left - aReflowState.mComputedBorderPadding.right) && aCachedAvailableSize.width == kSizeNotSet; if (aBailOnWidth) { - printf("-------------- #2.2 Bailing on width %d <= aCachedAvailableSize.width %d\n",(aCacheSize.width - aReflowState.mComputedBorderPadding.left - aReflowState.mComputedBorderPadding.right), width ); + PRINTF("-------------- #2.2 Bailing on width %d <= aCachedAvailableSize.width %d\n",(aCacheSize.width - aReflowState.mComputedBorderPadding.left - aReflowState.mComputedBorderPadding.right), width ); } } #endif @@ -312,7 +314,7 @@ void nsFormControlFrame::SkipResizeReflow(nsSize& aCacheSize, //} #ifdef FCF_NOISY if (aBailOnWidth) { - printf("-------------- #3 Bailing on aCachedAvailableSize.width %d == aReflowState.mComputedWidth %d\n", aCachedAvailableSize.width, width ); + PRINTF("-------------- #3 Bailing on aCachedAvailableSize.width %d == aReflowState.mComputedWidth %d\n", aCachedAvailableSize.width, width ); } #endif } @@ -324,7 +326,7 @@ void nsFormControlFrame::SkipResizeReflow(nsSize& aCacheSize, aBailOnHeight = aCacheSize.height != kSizeNotSet; #ifdef FCF_NOISY if (aBailOnHeight) { - printf("-------------- #1 Bailing on aCachedAvailableSize.height %d != kSizeNotSet\n", aCachedAvailableSize.height); + PRINTF("-------------- #1 Bailing on aCachedAvailableSize.height %d != kSizeNotSet\n", aCachedAvailableSize.height); } #endif } else { @@ -333,12 +335,12 @@ void nsFormControlFrame::SkipResizeReflow(nsSize& aCacheSize, aBailOnHeight = aCachedAvailableSize.height <= height && aCachedAvailableSize.height != kSizeNotSet; #ifdef FCF_NOISY if (aBailOnHeight) { - printf("-------------- #2 Bailing on aCachedAvailableSize.height %d <= height %d\n", aCachedAvailableSize.height, height ); + PRINTF("-------------- #2 Bailing on aCachedAvailableSize.height %d <= height %d\n", aCachedAvailableSize.height, height ); } else { aBailOnHeight = height <= (aCacheSize.height - aReflowState.mComputedBorderPadding.left - aReflowState.mComputedBorderPadding.right) && aCachedAvailableSize.height == kSizeNotSet; if (aBailOnHeight) { - printf("-------------- #2.2 Bailing on height %d <= aCachedAvailableSize.height %d\n",(aCacheSize.height - aReflowState.mComputedBorderPadding.left - aReflowState.mComputedBorderPadding.right), height ); + PRINTF("-------------- #2.2 Bailing on height %d <= aCachedAvailableSize.height %d\n",(aCacheSize.height - aReflowState.mComputedBorderPadding.left - aReflowState.mComputedBorderPadding.right), height ); } } #endif @@ -353,7 +355,7 @@ void nsFormControlFrame::SkipResizeReflow(nsSize& aCacheSize, //} #ifdef FCF_NOISY if (aBailOnHeight) { - printf("-------------- #3 Bailing on aCachedAvailableSize.height %d == aReflowState.mComputedHeight %d\n", aCachedAvailableSize.height, height ); + PRINTF("-------------- #3 Bailing on aCachedAvailableSize.height %d == aReflowState.mComputedHeight %d\n", aCachedAvailableSize.height, height ); } #endif } diff --git a/mozilla/layout/html/forms/src/nsFormControlFrame.h b/mozilla/layout/html/forms/src/nsFormControlFrame.h index 37810728eee..c51fca0237b 100644 --- a/mozilla/layout/html/forms/src/nsFormControlFrame.h +++ b/mozilla/layout/html/forms/src/nsFormControlFrame.h @@ -33,6 +33,11 @@ #include "nsIStyleContext.h" #include "nsIPresContext.h" #include "nsCOMPtr.h" +#include "nslog.h" + +NS_DECL_LOG(nsFormControlFrameLog) +#define PRINTF NS_LOG_PRINTF(nsFormControlFrameLog) +#define FLUSH NS_LOG_FLUSH(nsFormControlFrameLog) class nsIView; class nsIPresContext; @@ -50,7 +55,7 @@ class nsFormFrame; { \ float t2p; \ aPresContext->GetTwipsToPixels(&t2p); \ - printf ("%-25s::Size=%4d,%4d %3d,%3d Nav:%3d,%3d Diffs: %3d,%3d\n", \ + PRINTF ("%-25s::Size=%4d,%4d %3d,%3d Nav:%3d,%3d Diffs: %3d,%3d\n", \ (__class), \ aDesiredSize.width, aDesiredSize.height, \ NSToCoordRound(aDesiredSize.width * t2p), \ diff --git a/mozilla/layout/html/forms/src/nsFormControlHelper.cpp b/mozilla/layout/html/forms/src/nsFormControlHelper.cpp index e9fde8362ff..d6a0bd5e863 100644 --- a/mozilla/layout/html/forms/src/nsFormControlHelper.cpp +++ b/mozilla/layout/html/forms/src/nsFormControlHelper.cpp @@ -63,6 +63,11 @@ #include "nsITextContent.h" #include "nsISupportsArray.h" #include "nsXPIDLString.h" +#include "nslog.h" + +NS_IMPL_LOG(nsFormControlHelperLog) +#define PRINTF NS_LOG_PRINTF(nsFormControlHelperLog) +#define FLUSH NS_LOG_FLUSH(nsFormControlHelperLog) static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID); static NS_DEFINE_CID(kStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID); @@ -343,8 +348,8 @@ nsFormControlHelper::CalcNavQuirkSizing(nsIPresContext* aPresContext, } #ifdef DEBUG_rodsXXXX - printf("********* Nav Quirks: %d,%d max:%d average:%d ascent:%d descent:%d\n", - width, height, maxCharWidth, average, ascent, descent); + PRINTF("********* Nav Quirks: %d,%d max:%d average:%d ascent:%d descent:%d\n", + width, height, maxCharWidth, average, ascent, descent); #endif aSize.width = NSIntPixelsToTwips(width, p2t); diff --git a/mozilla/layout/html/forms/src/nsFormFrame.cpp b/mozilla/layout/html/forms/src/nsFormFrame.cpp index f46da124c11..b32a85434d7 100644 --- a/mozilla/layout/html/forms/src/nsFormFrame.cpp +++ b/mozilla/layout/html/forms/src/nsFormFrame.cpp @@ -647,7 +647,7 @@ PRIVATE void DebugPrint(char* aLabel, nsString aString) { char* out = aString.ToNewCString(); - printf("\n %s=%s\n", aLabel, out); + PRINTF("\n %s=%s\n", aLabel, out); delete [] out; } @@ -1010,7 +1010,7 @@ void nsFormFrame::GetSubmitCharset(nsString& oCharset) } } #ifdef DEBUG_ftang - printf("accept-charset = %s\n", acceptCharsetValue.ToNewUTF8String()); + PRINTF("accept-charset = %s\n", acceptCharsetValue.ToNewUTF8String()); #endif PRInt32 l = acceptCharsetValue.Length(); if(l > 0 ) { @@ -1026,7 +1026,7 @@ void nsFormFrame::GetSubmitCharset(nsString& oCharset) nsAutoString charset; acceptCharsetValue.Mid(charset, offset, cnt); #ifdef DEBUG_ftang - printf("charset[i] = %s\n",charset.ToNewUTF8String()); + PRINTF("charset[i] = %s\n",charset.ToNewUTF8String()); #endif if(NS_SUCCEEDED(calias->GetPreferred(charset,oCharset))) return; @@ -1053,7 +1053,7 @@ NS_IMETHODIMP nsFormFrame::GetEncoder(nsIUnicodeEncoder** encoder) nsresult rv = NS_OK; GetSubmitCharset(charset); #ifdef DEBUG_ftang - printf("charset=%s\n", charset.ToNewCString()); + PRINTF("charset=%s\n", charset.ToNewCString()); #endif // Get Charset, get the encoder. diff --git a/mozilla/layout/html/forms/src/nsGfxListControlFrame.cpp b/mozilla/layout/html/forms/src/nsGfxListControlFrame.cpp index 24ec9e6b6d5..04480d948b7 100644 --- a/mozilla/layout/html/forms/src/nsGfxListControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsGfxListControlFrame.cpp @@ -69,6 +69,7 @@ #include "nsIDeviceContext.h" #include "nsITimer.h" #include "nsITimerCallback.h" +#include "nslog.h" #define STATUS_CHECK_RETURN_MACRO() {if (!mTracker) return NS_ERROR_FAILURE;} @@ -141,7 +142,7 @@ static PRInt32 gReflowInx = -1; if (mReflowId > -1) {\ gTotalReqs += gReflowControlCntRQ[mReflowId];\ gTotalReflows += gReflowControlCnt[mReflowId];\ - printf("** Id:%5d %s RF: %d RQ: %d %d/%d %5.2f\n", \ + PRINTF("** Id:%5d %s RF: %d RQ: %d %d/%d %5.2f\n", \ mReflowId, (__desc), \ gReflowControlCnt[mReflowId], \ gReflowControlCntRQ[mReflowId],\ @@ -159,10 +160,10 @@ static PRInt32 gReflowInx = -1; } // reflow messages -#define REFLOW_DEBUG_MSG(_msg1) printf((_msg1)) -#define REFLOW_DEBUG_MSG2(_msg1, _msg2) printf((_msg1), (_msg2)) -#define REFLOW_DEBUG_MSG3(_msg1, _msg2, _msg3) printf((_msg1), (_msg2), (_msg3)) -#define REFLOW_DEBUG_MSG4(_msg1, _msg2, _msg3, _msg4) printf((_msg1), (_msg2), (_msg3), (_msg4)) +#define REFLOW_DEBUG_MSG(_msg1) PRINTF((_msg1)) +#define REFLOW_DEBUG_MSG2(_msg1, _msg2) PRINTF((_msg1), (_msg2)) +#define REFLOW_DEBUG_MSG3(_msg1, _msg2, _msg3) PRINTF((_msg1), (_msg2), (_msg3)) +#define REFLOW_DEBUG_MSG4(_msg1, _msg2, _msg3, _msg4) PRINTF((_msg1), (_msg2), (_msg3), (_msg4)) #else //------------- @@ -183,10 +184,10 @@ static PRInt32 gReflowInx = -1; // This is for being VERY noisy //------------------------------------------ #ifdef DO_VERY_NOISY -#define REFLOW_NOISY_MSG(_msg1) printf((_msg1)) -#define REFLOW_NOISY_MSG2(_msg1, _msg2) printf((_msg1), (_msg2)) -#define REFLOW_NOISY_MSG3(_msg1, _msg2, _msg3) printf((_msg1), (_msg2), (_msg3)) -#define REFLOW_NOISY_MSG4(_msg1, _msg2, _msg3, _msg4) printf((_msg1), (_msg2), (_msg3), (_msg4)) +#define REFLOW_NOISY_MSG(_msg1) PRINTF((_msg1)) +#define REFLOW_NOISY_MSG2(_msg1, _msg2) PRINTF((_msg1), (_msg2)) +#define REFLOW_NOISY_MSG3(_msg1, _msg2, _msg3) PRINTF((_msg1), (_msg2), (_msg3)) +#define REFLOW_NOISY_MSG4(_msg1, _msg2, _msg3, _msg4) PRINTF((_msg1), (_msg2), (_msg3), (_msg4)) #else #define REFLOW_NOISY_MSG(_msg) #define REFLOW_NOISY_MSG2(_msg1, _msg2) @@ -212,7 +213,7 @@ static PRInt32 gReflowInx = -1; if (aReflowState.mComputedWidth != NS_UNCONSTRAINEDSIZE) { \ nscoord width = aDesiredSize.width - borderPadding.left - borderPadding.right; \ if (width != aReflowState.mComputedWidth) { \ - printf("aDesiredSize.width %d %d != aReflowState.mComputedWidth %d\n", aDesiredSize.width, width, aReflowState.mComputedWidth); \ + PRINTF("aDesiredSize.width %d %d != aReflowState.mComputedWidth %d\n", aDesiredSize.width, width, aReflowState.mComputedWidth); \ } \ NS_ASSERTION(width == aReflowState.mComputedWidth, "Returning bad value when constrained!"); \ } @@ -353,11 +354,11 @@ static int myCounter = 0; static void printSize(char * aDesc, nscoord aSize) { - printf(" %s: ", aDesc); + PRINTF(" %s: ", aDesc); if (aSize == NS_UNCONSTRAINEDSIZE) { - printf("UNC"); + PRINTF("UNC"); } else { - printf("%d", aSize); + PRINTF("%d", aSize); } } #endif @@ -384,35 +385,35 @@ nsGfxListControlFrame::Reflow(nsIPresContext* aPresContext, aStatus = NS_FRAME_COMPLETE; #ifdef DO_REFLOW_DEBUG - printf("%p ** Id: %d nsLCF::Reflow %d R: ", this, mReflowId, myCounter++); + PRINTF("%p ** Id: %d nsLCF::Reflow %d R: ", this, mReflowId, myCounter++); switch (aReflowState.reason) { case eReflowReason_Initial: - printf("Initia");break; + PRINTF("Initia");break; case eReflowReason_Incremental: - printf("Increm");break; + PRINTF("Increm");break; case eReflowReason_Resize: - printf("Resize");break; + PRINTF("Resize");break; case eReflowReason_StyleChange: - printf("StyleC");break; + PRINTF("StyleC");break; case eReflowReason_Dirty: - printf("Dirty ");break; - default:printf("%d", aReflowState.reason);break; + PRINTF("Dirty ");break; + default:PRINTF("%d", aReflowState.reason);break; } printSize("AW", aReflowState.availableWidth); printSize("AH", aReflowState.availableHeight); printSize("CW", aReflowState.mComputedWidth); printSize("CH", aReflowState.mComputedHeight); - printf("\n"); + PRINTF("\n"); #if 0 { const nsStyleDisplay* display; GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&)display); - printf("+++++++++++++++++++++++++++++++++ "); + PRINTF("+++++++++++++++++++++++++++++++++ "); switch (display->mVisible) { - case NS_STYLE_VISIBILITY_COLLAPSE: printf("NS_STYLE_VISIBILITY_COLLAPSE\n");break; - case NS_STYLE_VISIBILITY_HIDDEN: printf("NS_STYLE_VISIBILITY_HIDDEN\n");break; - case NS_STYLE_VISIBILITY_VISIBLE: printf("NS_STYLE_VISIBILITY_VISIBLE\n");break; + case NS_STYLE_VISIBILITY_COLLAPSE: PRINTF("NS_STYLE_VISIBILITY_COLLAPSE\n");break; + case NS_STYLE_VISIBILITY_HIDDEN: PRINTF("NS_STYLE_VISIBILITY_HIDDEN\n");break; + case NS_STYLE_VISIBILITY_VISIBLE: PRINTF("NS_STYLE_VISIBILITY_VISIBLE\n");break; } } #endif @@ -430,7 +431,7 @@ nsGfxListControlFrame::Reflow(nsIPresContext* aPresContext, aDesiredSize.maxElementSize->height = aDesiredSize.height; } aStatus = NS_FRAME_COMPLETE; - printf("--------------------------> Skipping reflow\n"); + PRINTF("--------------------------> Skipping reflow\n"); NS_ASSERTION(aDesiredSize.width < 100000, "Width is still NS_UNCONSTRAINEDSIZE"); NS_ASSERTION(aDesiredSize.height < 100000, "Height is still NS_UNCONSTRAINEDSIZE"); return NS_OK; @@ -515,7 +516,7 @@ nsGfxListControlFrame::Reflow(nsIPresContext* aPresContext, } aDesiredSize.ascent = aDesiredSize.height; aDesiredSize.descent = 0; - printf("Bottom# DW: %d DH: %d\n", aDesiredSize.width, aDesiredSize.height); + PRINTF("Bottom# DW: %d DH: %d\n", aDesiredSize.width, aDesiredSize.height); nsIView * view; GetView(aPresContext, &view); @@ -567,7 +568,7 @@ nsGfxListControlFrame::Reflow(nsIPresContext* aPresContext, scrollSpacing->CalcBorderPaddingFor(firstChildFrame, scrollBorderPadding); rect.width -= (scrollBorderPadding.left + scrollBorderPadding.right); rect.height -= (scrollBorderPadding.top + scrollBorderPadding.bottom)*2; - printf("Inc Pass CW: %d CH: %d\n", rect.width, rect.height); + PRINTF("Inc Pass CW: %d CH: %d\n", rect.width, rect.height); nsHTMLReflowState childReflowState(aPresContext, aReflowState, firstChildFrame, nsSize(rect.width, rect.height)); @@ -587,7 +588,7 @@ nsGfxListControlFrame::Reflow(nsIPresContext* aPresContext, childReflowState, aStatus); #endif - printf("AfterInc DW: %d CH: %d\n", aDesiredSize.width, aDesiredSize.height); +PRINTF("AfterInc DW: %d CH: %d\n", aDesiredSize.width, aDesiredSize.height); aDesiredSize.width = mCacheSize.width; aDesiredSize.height = mCacheSize.height; @@ -597,7 +598,7 @@ nsGfxListControlFrame::Reflow(nsIPresContext* aPresContext, } aDesiredSize.ascent = aDesiredSize.height; aDesiredSize.descent = 0; - printf("Bottom* DW: %d DH: %d\n", aDesiredSize.width, aDesiredSize.height); + PRINTF("Bottom* DW: %d DH: %d\n", aDesiredSize.width, aDesiredSize.height); NS_ASSERTION(aDesiredSize.width < 100000, "Width is still NS_UNCONSTRAINEDSIZE"); NS_ASSERTION(aDesiredSize.height < 100000, "Height is still NS_UNCONSTRAINEDSIZE"); return NS_OK; @@ -701,12 +702,12 @@ nsGfxListControlFrame::Reflow(nsIPresContext* aPresContext, nsSize scrolledAreaSize(0,0); nsHTMLReflowMetrics scrolledAreaDesiredSize(&scrolledAreaSize); - printf("1st Pass CW: %d CH: %d\n", childReflowState.mComputedWidth, childReflowState.mComputedHeight); + PRINTF("1st Pass CW: %d CH: %d\n", childReflowState.mComputedWidth, childReflowState.mComputedHeight); firstChildFrame->Reflow(aPresContext, scrolledAreaDesiredSize, childReflowState, aStatus); - printf("After1st DW: %d DH: %d\n", scrolledAreaDesiredSize.width, scrolledAreaDesiredSize.height); + PRINTF("After1st DW: %d DH: %d\n", scrolledAreaDesiredSize.width, scrolledAreaDesiredSize.height); nsIScrollableFrame * scrollableFrame = nsnull; @@ -956,7 +957,7 @@ nsGfxListControlFrame::Reflow(nsIPresContext* aPresContext, secondPassState.reason = eReflowReason_Resize; - printf("2nd Pass CW: %d CH: %d\n", visibleWidth, visibleHeight); + PRINTF("2nd Pass CW: %d CH: %d\n", visibleWidth, visibleHeight); mCachedScrollFrameSize.width = visibleWidth; mCachedScrollFrameSize.height = visibleHeight; // Reflow @@ -980,7 +981,7 @@ nsGfxListControlFrame::Reflow(nsIPresContext* aPresContext, nsRect rr; firstChildFrame->GetRect(rr); - printf("After2nd DW: %d DH: %d\n", scrolledAreaDesiredSize.width, scrolledAreaDesiredSize.height); + PRINTF("After2nd DW: %d DH: %d\n", scrolledAreaDesiredSize.width, scrolledAreaDesiredSize.height); //mCachedScrollFrameSize.width = scrolledAreaDesiredSize.width; //mCachedScrollFrameSize.height = scrolledAreaDesiredSize.height; @@ -1026,7 +1027,7 @@ nsGfxListControlFrame::Reflow(nsIPresContext* aPresContext, if (!isInDropDownMode) { PRInt32 numRows = 1; GetSizeAttribute(&numRows); - printf("%d ", numRows); + PRINTF("%d ", numRows); if (numRows == 2) { COMPARE_QUIRK_SIZE("nsGfxListControlFrame", 42, 38) } if (numRows == 3) { @@ -1043,7 +1044,7 @@ nsGfxListControlFrame::Reflow(nsIPresContext* aPresContext, } nsFormControlFrame::SetupCachedSizes(mCacheSize, mCachedMaxElementSize, aDesiredSize); - printf("Bottom DW: %d DH: %d\n", aDesiredSize.width, aDesiredSize.height); + PRINTF("Bottom DW: %d DH: %d\n", aDesiredSize.width, aDesiredSize.height); NS_ASSERTION(aDesiredSize.width < 100000, "Width is still NS_UNCONSTRAINEDSIZE"); NS_ASSERTION(aDesiredSize.height < 100000, "Height is still NS_UNCONSTRAINEDSIZE"); return NS_OK; @@ -1417,7 +1418,7 @@ nsGfxListControlFrame::HasSameContent(nsIFrame* aFrame1, nsIFrame* aFrame2) NS_IMETHODIMP nsGfxListControlFrame::CaptureMouseEvents(nsIPresContext* aPresContext, PRBool aGrabMouseEvents) { - printf("}}}}}}}}}}}}}}}}}}}} Setting Capture to %s\n", aGrabMouseEvents?"On":"Off"); + PRINTF("}}}}}}}}}}}}}}}}}}}} Setting Capture to %s\n", aGrabMouseEvents?"On":"Off"); nsIFrame * firstChildFrame = nsnull; FirstChild(mPresContext, nsnull, &firstChildFrame); @@ -1451,7 +1452,7 @@ nsGfxListControlFrame::CaptureMouseEvents(nsIPresContext* aPresContext, PRBool a nsIWidget * widget; view->GetWidget(widget); if (nsnull != widget) { - printf("Capture is set on widget to %s\n", aGrabMouseEvents?"On":"Off"); + PRINTF("Capture is set on widget to %s\n", aGrabMouseEvents?"On":"Off"); widget->CaptureMouse(aGrabMouseEvents); NS_RELEASE(widget); } @@ -1526,9 +1527,9 @@ nsGfxListControlFrame::HandleEvent(nsIPresContext* aPresContext, "NS_MOUSE_RIGHT_CLICK"}; int inx = aEvent->message-NS_MOUSE_MESSAGE_START; if (inx >= 0 && inx <= (NS_MOUSE_RIGHT_CLICK-NS_MOUSE_MESSAGE_START)) { - printf("Mouse in ListFrame %s [%d]\n", desc[inx], aEvent->message); + PRINTF("Mouse in ListFrame %s [%d]\n", desc[inx], aEvent->message); } else { - printf("Mouse in ListFrame [%d]\n", aEvent->message); + PRINTF("Mouse in ListFrame [%d]\n", aEvent->message); }*/ if (nsEventStatus_eConsumeNoDefault == *aEventStatus) @@ -1542,7 +1543,7 @@ nsGfxListControlFrame::HandleEvent(nsIPresContext* aPresContext, if (NS_KEY_EVENT == aEvent->eventStructType) { #ifdef DEBUG_rodsXXX nsKeyEvent* keyEvent = (nsKeyEvent*)aEvent; - printf("---> %d %c\n", keyEvent->keyCode, keyEvent->keyCode); + PRINTF("---> %d %c\n", keyEvent->keyCode, keyEvent->keyCode); #endif //if (NS_VK_SPACE == keyEvent->keyCode || NS_VK_RETURN == keyEvent->keyCode) { // MouseClicked(aPresContext); @@ -1888,7 +1889,7 @@ nsGfxListControlFrame::SetContentSelected(PRInt32 aIndex, PRBool aSelected) PRInt32 numOptions = 0; if (NS_SUCCEEDED(GetNumberOfOptions(&numOptions))) { if (aIndex >= numOptions || aIndex < 0) { - printf("Index: %d Range 0:%d (setting to %s)\n", aIndex, numOptions, aSelected?"TRUE":"FALSE"); + PRINTF("Index: %d Range 0:%d (setting to %s)\n", aIndex, numOptions, aSelected?"TRUE":"FALSE"); NS_ASSERTION(0, "Bad Index has been passed into SetContentSelected!"); } } else { @@ -2414,7 +2415,7 @@ NS_IMETHODIMP nsGfxListControlFrame::AddOption(nsIPresContext* aPresContext, PRInt32 aIndex) { #ifdef DO_REFLOW_DEBUG - printf("---- Id: %d nsLCF %p Added Option %d\n", mReflowId, this, aIndex); + PRINTF("---- Id: %d nsLCF %p Added Option %d\n", mReflowId, this, aIndex); #endif if (!mIsAllContentHere) { @@ -2465,7 +2466,7 @@ nsGfxListControlFrame::AddOption(nsIPresContext* aPresContext, PRInt32 aIndex) if (NS_CONTENT_ATTR_NOT_THERE == rv || 0 == text.Length()) { option->GetText(text); } - printf("this %p Index: %d [%s] CB: %p\n", this, aIndex, text.ToNewCString(), mComboboxFrame); //leaks + PRINTF("this %p Index: %d [%s] CB: %p\n", this, aIndex, text.ToNewCString(), mComboboxFrame); //leaks } #endif } @@ -3426,8 +3427,8 @@ nsGfxListControlFrame::DragMove(nsIDOMEvent* aMouseEvent) } } mLastDragCoordY = scrY; - //printf("%d %d %d %d %d %d isInside: %d mIsDragScrollingDown: %d\n", scrX, scrY, - // absPixelRect.x, absPixelRect.y, absPixelRect.width, absPixelRect.height, isInside, mIsDragScrollingDown); + //PRINTF("%d %d %d %d %d %d isInside: %d mIsDragScrollingDown: %d\n", scrX, scrY, + // absPixelRect.x, absPixelRect.y, absPixelRect.width, absPixelRect.height, isInside, mIsDragScrollingDown)); if (!isInside) { #ifdef DO_LISTBOX_DRAGGING @@ -3482,7 +3483,7 @@ nsGfxListControlFrame::DragMove(nsIDOMEvent* aMouseEvent) } } } - } else { // Fix Bug 44454 + }else { // Fix Bug 44454 // get the currently moused over item PRInt32 oldIndex; PRInt32 curIndex = mSelectedIndex; @@ -3608,9 +3609,9 @@ nsGfxListControlFrame::AdjustIndexForDisabledOpt(PRInt32 &anNewIndex, PRInt32 &a aWasDisabled = PR_FALSE; while (1) { // Special Debug Code - //printf("T:%d B:%d I:%d R:%d IM:%d I:%d\n", top, bottom, newIndex, aDoAdjustInc, aDoAdjustIncNext, doingReverse); + //PRINTF("T:%d B:%d I:%d R:%d IM:%d I:%d\n", top, bottom, newIndex, aDoAdjustInc, aDoAdjustIncNext, doingReverse); //if (newIndex < -30 || newIndex > 30) { - // printf("********************************* Stopped!\n"); + // PRINTF("********************************* Stopped!\n"); // return; //} // if the newIndex isn't disabled, we are golden, bail out @@ -4361,7 +4362,7 @@ nsGfxListControlFrame::DoAutoScroll(nsIPresContext *aPresContext, nsIFrame *aFra if (options) { PRUint32 numOptions; options->GetLength(&numOptions); - printf("Cur: %d Num: %d\n", curIndex, numOptions); + PRINTF("Cur: %d Num: %d\n", curIndex, numOptions); if (curIndex >= (PRInt32)numOptions) { bail = PR_TRUE; } @@ -4383,14 +4384,14 @@ nsGfxListControlFrame::DoAutoScroll(nsIPresContext *aPresContext, nsIFrame *aFra //} if (!mIsDragScrollingDown) { if (mSelectedIndex != mStartExtendedIndex) { - printf("%s Toggling Index %d\n", mIsDragScrollingDown?"DN":"UP", mSelectedIndex); + PRINTF("%s Toggling Index %d\n", mIsDragScrollingDown?"DN":"UP", mSelectedIndex); ToggleSelected(mSelectedIndex); } } mSelectedIndex = curIndex; //SetContentSelected(mSelectedIndex, PR_TRUE); if (mSelectedIndex != mStartExtendedIndex) { - printf("%s Toggling Index %d\n", mIsDragScrollingDown?"DN":"UP", curIndex); + PRINTF("%s Toggling Index %d\n", mIsDragScrollingDown?"DN":"UP", curIndex); ToggleSelected(mSelectedIndex); } diff --git a/mozilla/layout/html/forms/src/nsGfxTextControlFrame.cpp b/mozilla/layout/html/forms/src/nsGfxTextControlFrame.cpp index 0390ed50883..fc7fe941f0f 100644 --- a/mozilla/layout/html/forms/src/nsGfxTextControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsGfxTextControlFrame.cpp @@ -106,6 +106,11 @@ #include "nsINodeInfo.h" #include "nsLayoutAtoms.h" +#include "nslog.h" + +NS_IMPL_LOG(nsGfxTextControlFrameLog) +#define PRINTF NS_LOG_PRINTF(nsGfxTextControlFrameLog) +#define FLUSH NS_LOG_FLUSH(nsGfxTextControlFrameLog) static NS_DEFINE_IID(kIFrameIID, NS_IFRAME_IID); static NS_DEFINE_IID(kIFormControlIID, NS_IFORMCONTROL_IID); @@ -383,11 +388,11 @@ nsGfxTextControlFrame::~nsGfxTextControlFrame() } #ifdef DEBUG #if NOISY - printf("gfxTC: %p reflow stats at destructor:\n\ttotal\tresize\tunconst\tchanged\tmoved\n", this); - printf("\t%d\t%d\t%d\t%d\t%d\n", + PRINTF("gfxTC: %p reflow stats at destructor:\n\ttotal\tresize\tunconst\tchanged\tmoved\n", this); + PRINTF("\t%d\t%d\t%d\t%d\t%d\n", mDebugTotalReflows, mDebugResizeReflows, mDebugResizeUnconstrained, - mDebugResizeReflowsThatChangedMySize, mDebugReflowsThatMovedSubdoc); + mDebugResizeReflowsThatChangedMySize, mDebugReflowsThatMovedSubdoc); #endif #endif } @@ -1369,7 +1374,7 @@ nsGfxTextControlFrame::CreateSubDoc(nsRect *aSizeOfSubdocContainer) NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_TRUE(mDocShell, NS_ERROR_FAILURE); #ifdef NOISY - printf("%p docshell in CreateSubDoc set to bounds: x=%d, y=%d, w=%d, h=%d\n", mDocShell.get(), subBounds.x, subBounds.y, subBounds.width, subBounds.height); + PRINTF("%p docshell in CreateSubDoc set to bounds: x=%d, y=%d, w=%d, h=%d\n", mDocShell.get(), subBounds.x, subBounds.y, subBounds.width, subBounds.height); #endif nsCOMPtr docShellWin(do_QueryInterface(mDocShell)); NS_ENSURE_TRUE(docShellWin, NS_ERROR_FAILURE); @@ -1516,8 +1521,8 @@ nsGfxTextControlFrame::Paint(nsIPresContext* aPresContext, nsFramePaintLayer aWhichLayer) { #ifdef NOISY - printf("%p paint layer %d at (%d, %d, %d, %d)\n", this, aWhichLayer, - aDirtyRect.x, aDirtyRect.y, aDirtyRect.width, aDirtyRect.height); + PRINTF("%p paint layer %d at (%d, %d, %d, %d)\n", this, aWhichLayer, + aDirtyRect.x, aDirtyRect.y, aDirtyRect.width, aDirtyRect.height); #endif if (NS_FRAME_PAINT_LAYER_FOREGROUND == aWhichLayer) { @@ -1647,8 +1652,8 @@ nsGfxTextControlFrame::PaintTextControl(nsIPresContext* aPresContext, } #ifdef DEBUG #ifdef NOISY - printf("gfxTC: %p totalPaints=%d, paintsSinceLastReflow=%d\n", - mDebugTotalPaints, mDebugPaintsSinceLastReflow); + PRINTF("gfxTC: %p totalPaints=%d, paintsSinceLastReflow=%d\n", + mDebugTotalPaints, mDebugPaintsSinceLastReflow); #endif #endif } @@ -1951,7 +1956,7 @@ nsGfxTextControlFrame::CreateDocShell(nsIPresContext* aPresContext, nsRect viewBounds(origin.x, origin.y, aSize.width, aSize.height); #ifdef NOISY - printf("%p view bounds: x=%d, y=%d, w=%d, h=%d\n", view, origin.x, origin.y, aSize.width, aSize.height); + PRINTF("%p view bounds: x=%d, y=%d, w=%d, h=%d\n", view, origin.x, origin.y, aSize.width, aSize.height); #endif nsCOMPtr viewMan; @@ -2444,7 +2449,7 @@ nsGfxTextControlFrame::Reflow(nsIPresContext* aPresContext, nsFormFrame::AddFormControlFrame(aPresContext, *NS_STATIC_CAST(nsIFrame*, this)); } #ifdef NOISY - printf("gfxTCF: reflow reason=%d\n", aReflowState.reason); + PRINTF("gfxTCF: reflow reason=%d\n", aReflowState.reason); #endif // Turning off optimization for now @@ -2531,8 +2536,8 @@ nsGfxTextControlFrame::Reflow(nsIPresContext* aPresContext, #endif #ifdef NOISY - printf ("exit nsGfxTextControlFrame::Reflow: size=%d,%d\n", - aDesiredSize.width, aDesiredSize.height); + PRINTF ("exit nsGfxTextControlFrame::Reflow: size=%d,%d\n", + aDesiredSize.width, aDesiredSize.height); #endif float t2p, p2t; @@ -2563,7 +2568,7 @@ nsGfxTextControlFrame::Reflow(nsIPresContext* aPresContext, else if (mDisplayFrame) { #ifdef NOISY - printf("Error in nsGfxTextControlFrame: already created display content on intial reflow!\n"); + PRINTF("Error in nsGfxTextControlFrame: already created display content on intial reflow!\n"); #endif } else @@ -2703,7 +2708,7 @@ nsGfxTextControlFrame::Reflow(nsIPresContext* aPresContext, mDisplayFrame = nsnull; } #ifdef NOISY - printf("%p docshell in reflow set to bounds: x=%d, y=%d, w=%d, h=%d\n", mDocShell.get(), subBoundsInPixels.x, subBoundsInPixels.y, subBoundsInPixels.width, subBoundsInPixels.height); + PRINTF("%p docshell in reflow set to bounds: x=%d, y=%d, w=%d, h=%d\n", mDocShell.get(), subBoundsInPixels.x, subBoundsInPixels.y, subBoundsInPixels.width, subBoundsInPixels.height); #endif #ifdef DEBUG mDebugReflowsThatMovedSubdoc++; @@ -2756,7 +2761,7 @@ nsGfxTextControlFrame::Reflow(nsIPresContext* aPresContext, rv = mDisplayFrame->Reflow(aPresContext, kidSize, kidReflowState, status); // notice how status is ignored here #ifdef NOISY - printf("%p mDisplayFrame resized to: x=%d, y=%d, w=%d, h=%d\n", mDisplayFrame, subBounds.x, subBounds.y, subBounds.width, subBounds.height); + PRINTF("%p mDisplayFrame resized to: x=%d, y=%d, w=%d, h=%d\n", mDisplayFrame, subBounds.x, subBounds.y, subBounds.width, subBounds.height); #endif mDisplayFrame->SetRect(aPresContext, subBounds); // finish the reflow @@ -2766,7 +2771,7 @@ nsGfxTextControlFrame::Reflow(nsIPresContext* aPresContext, } #ifdef NOISY - printf("at the time of the reflow, the frame looks like...\n"); + PRINTF("at the time of the reflow, the frame looks like...\n"); List(aPresContext, stdout, 0); #endif @@ -2836,11 +2841,11 @@ nsGfxTextControlFrame::Reflow(nsIPresContext* aPresContext, #endif #ifdef DEBUG #if NOISY - printf("gfxTC: %p reflow stats at end of reflow:\n\ttotal\tresize\tunconst\tchanged\tmoved\n", this); - printf("\t%d\t%d\t%d\t%d\t%d\n", + PRINTF("gfxTC: %p reflow stats at end of reflow:\n\ttotal\tresize\tunconst\tchanged\tmoved\n", this); + PRINTF("\t%d\t%d\t%d\t%d\t%d\n", mDebugTotalReflows, mDebugResizeReflows, mDebugResizeUnconstrained, - mDebugResizeReflowsThatChangedMySize, mDebugReflowsThatMovedSubdoc); + mDebugResizeReflowsThatChangedMySize, mDebugReflowsThatMovedSubdoc); #endif #endif return NS_OK; @@ -3637,11 +3642,11 @@ nsGfxTextControlFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIn nsIView* view; GetView(aPresContext, &view); if (nsnull != view) { - fprintf(out, " [view=%p]", view); + FPRINTF(out, " [view=%p]", view); } - fprintf(out, " {%d,%d,%d,%d}", mRect.x, mRect.y, mRect.width, mRect.height); + FPRINTF(out, " {%d,%d,%d,%d}", mRect.x, mRect.y, mRect.width, mRect.height); if (0 != mState) { - fprintf(out, " [state=%08x]", mState); + FPRINTF(out, " [state=%08x]", mState); } fputs("<\n", out); @@ -4973,7 +4978,7 @@ nsEnderListenerForContent::HandleEvent(nsIDOMEvent* aEvent) nsresult nsEnderListenerForContent::DragGesture(nsIDOMEvent* aDragEvent) { - //printf("frame forContent DragGesture\n"); + //PRINTF("frame forContent DragGesture\n"); // ...figure out if a drag should be started... // ...until we have this implemented, just eat the drag event so it @@ -4987,7 +4992,7 @@ nsEnderListenerForContent::DragGesture(nsIDOMEvent* aDragEvent) nsresult nsEnderListenerForContent::DragEnter(nsIDOMEvent* aDragEvent) { - //printf("frame forContent DragEnter\n"); + //PRINTF("frame forContent DragEnter\n"); // see nsTextEditorDragListener return NS_OK; } @@ -4996,7 +5001,7 @@ nsEnderListenerForContent::DragEnter(nsIDOMEvent* aDragEvent) nsresult nsEnderListenerForContent::DragOver(nsIDOMEvent* aDragEvent) { - //printf("frame forContent DragOver\n"); + //PRINTF("frame forContent DragOver\n"); // see nsTextEditorDragListener return NS_OK; } @@ -5005,7 +5010,7 @@ nsEnderListenerForContent::DragOver(nsIDOMEvent* aDragEvent) nsresult nsEnderListenerForContent::DragExit(nsIDOMEvent* aDragEvent) { - //printf("frame forContent DragExit\n"); + //PRINTF("frame forContent DragExit\n"); // see nsTextEditorDragListener return NS_OK; } @@ -5015,7 +5020,7 @@ nsEnderListenerForContent::DragExit(nsIDOMEvent* aDragEvent) nsresult nsEnderListenerForContent::DragDrop(nsIDOMEvent* aMouseEvent) { - //printf("frame forContent DragDrop\n"); + //PRINTF("frame forContent DragDrop\n"); // see nsTextEditorDragListener return NS_OK; } diff --git a/mozilla/layout/html/forms/src/nsGfxTextControlFrame2.cpp b/mozilla/layout/html/forms/src/nsGfxTextControlFrame2.cpp index d86a0ffc325..40266826312 100644 --- a/mozilla/layout/html/forms/src/nsGfxTextControlFrame2.cpp +++ b/mozilla/layout/html/forms/src/nsGfxTextControlFrame2.cpp @@ -100,7 +100,6 @@ #define DEFAULT_COLUMN_WIDTH 20 #define GUESS_INPUT_SIZE 150 // 10 pixels wide - static NS_DEFINE_CID(kHTMLEditorCID, NS_HTMLEDITOR_CID); static NS_DEFINE_CID(kFrameSelectionCID, NS_FRAMESELECTION_CID); @@ -1375,8 +1374,8 @@ nsGfxTextControlFrame2::CalculateSizeStandard (nsIPresContext* aPresContex aDesiredSize.width = charWidth; #ifdef DEBUG_rodsXXX - printf("Ave: %d MA: %d %d\n", charWidth, measAveWidth, charWidth-measAveWidth); - printf("Ave: %d MA: %d %d\n", charWidth/15, measAveWidth/15, (charWidth/15)-(measAveWidth/15)); + PRINTF("Ave: %d MA: %d %d\n", charWidth, measAveWidth, charWidth-measAveWidth); + PRINTF("Ave: %d MA: %d %d\n", charWidth/15, measAveWidth/15, (charWidth/15)-(measAveWidth/15)); #endif // set the default col size back @@ -2084,7 +2083,7 @@ nsGfxTextControlFrame2::GetPrefSize(nsBoxLayoutState& aState, nsSize& aSize) nsSize size(169, 24); nsSize actual(aSize.width/15, aSize.height/15); - printf("nsGfxText(field) %d,%d %d,%d %d,%d\n", + PRINTF("nsGfxText(field) %d,%d %d,%d %d,%d\n", size.width, size.height, actual.width, actual.height, actual.width-size.width, actual.height-size.height); // text field } #endif diff --git a/mozilla/layout/html/forms/src/nsHTMLButtonControlFrame.cpp b/mozilla/layout/html/forms/src/nsHTMLButtonControlFrame.cpp index dc3ae53a3e9..77563ce6e7e 100644 --- a/mozilla/layout/html/forms/src/nsHTMLButtonControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsHTMLButtonControlFrame.cpp @@ -516,21 +516,19 @@ void ButtonHack(nsHTMLReflowState& aReflowState, char* aMessage) if ((aReflowState.mComputedWidth != NS_INTRINSICSIZE) && (aReflowState.mComputedWidth > aReflowState.availableWidth) && (aReflowState.availableWidth > 0)) { -// printf("BUG - %s has a computed width = %d, available width = %d \n", -// aMessage, aReflowState.mComputedWidth, aReflowState.availableWidth); +// PRINTF("BUG - %s has a computed width = %d, available width = %d \n", +// aMessage, aReflowState.mComputedWidth, aReflowState.availableWidth)); aReflowState.mComputedWidth = aReflowState.availableWidth; - } - if (aReflowState.mComputedHeight == 0) { + } if (aReflowState.mComputedHeight == 0) { aReflowState.mComputedHeight = aReflowState.availableHeight; } if ((aReflowState.mComputedHeight != NS_INTRINSICSIZE) && (aReflowState.mComputedHeight > aReflowState.availableHeight) && (aReflowState.availableHeight > 0)) { -// printf("BUG - %s has a computed height = %d, available height = %d \n", -// aMessage, aReflowState.mComputedHeight, aReflowState.availableHeight); +// PRINTF("BUG - %s has a computed height = %d, available height = %d \n", +// aMessage, aReflowState.mComputedHeight, aReflowState.availableHeight)); aReflowState.mComputedHeight = aReflowState.availableHeight; - } -} + }} NS_IMETHODIMP nsHTMLButtonControlFrame::AddComputedBorderPaddingToDesiredSize(nsHTMLReflowMetrics& aDesiredSize, diff --git a/mozilla/layout/html/forms/src/nsLabelFrame.cpp b/mozilla/layout/html/forms/src/nsLabelFrame.cpp index 56a87c82f66..816c1229dc7 100644 --- a/mozilla/layout/html/forms/src/nsLabelFrame.cpp +++ b/mozilla/layout/html/forms/src/nsLabelFrame.cpp @@ -480,7 +480,7 @@ void LabelHack(nsHTMLReflowState& aReflowState, char* aMessage) if ((aReflowState.mComputedWidth != NS_INTRINSICSIZE) && (aReflowState.mComputedWidth > aReflowState.availableWidth) && (aReflowState.availableWidth > 0)) { - printf("BUG - %s has a computed width = %d, available width = %d \n", + PRINTF("BUG - %s has a computed width = %d, available width = %d \n", aMessage, aReflowState.mComputedWidth, aReflowState.availableWidth); aReflowState.mComputedWidth = aReflowState.availableWidth; NS_ASSERTION(0, "LabelHack: Path #2"); @@ -492,7 +492,7 @@ void LabelHack(nsHTMLReflowState& aReflowState, char* aMessage) if ((aReflowState.mComputedHeight != NS_INTRINSICSIZE) && (aReflowState.mComputedHeight > aReflowState.availableHeight) && (aReflowState.availableHeight > 0)) { - printf("BUG - %s has a computed height = %d, available height = %d \n", + PRINTF("BUG - %s has a computed height = %d, available height = %d \n", aMessage, aReflowState.mComputedHeight, aReflowState.availableHeight); aReflowState.mComputedHeight = aReflowState.availableHeight; NS_ASSERTION(0, "LabelHack: Path #4"); diff --git a/mozilla/layout/html/forms/src/nsListControlFrame.cpp b/mozilla/layout/html/forms/src/nsListControlFrame.cpp index 0a86aab6d53..1244d512834 100644 --- a/mozilla/layout/html/forms/src/nsListControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsListControlFrame.cpp @@ -131,7 +131,7 @@ static PRInt32 gReflowInx = -1; if (mReflowId > -1) {\ gTotalReqs += gReflowControlCntRQ[mReflowId];\ gTotalReflows += gReflowControlCnt[mReflowId];\ - printf("** Id:%5d %s RF: %d RQ: %d %d/%d %5.2f\n", \ + PRINTF("** Id:%5d %s RF: %d RQ: %d %d/%d %5.2f\n", \ mReflowId, (__desc), \ gReflowControlCnt[mReflowId], \ gReflowControlCntRQ[mReflowId],\ @@ -149,10 +149,10 @@ static PRInt32 gReflowInx = -1; } // reflow messages -#define REFLOW_DEBUG_MSG(_msg1) printf((_msg1)) -#define REFLOW_DEBUG_MSG2(_msg1, _msg2) printf((_msg1), (_msg2)) -#define REFLOW_DEBUG_MSG3(_msg1, _msg2, _msg3) printf((_msg1), (_msg2), (_msg3)) -#define REFLOW_DEBUG_MSG4(_msg1, _msg2, _msg3, _msg4) printf((_msg1), (_msg2), (_msg3), (_msg4)) +#define REFLOW_DEBUG_MSG(_msg1) PRINTF((_msg1)) +#define REFLOW_DEBUG_MSG2(_msg1, _msg2) PRINTF((_msg1), (_msg2)) +#define REFLOW_DEBUG_MSG3(_msg1, _msg2, _msg3) PRINTF((_msg1), (_msg2), (_msg3)) +#define REFLOW_DEBUG_MSG4(_msg1, _msg2, _msg3, _msg4) PRINTF((_msg1), (_msg2), (_msg3), (_msg4)) #else //------------- @@ -173,10 +173,10 @@ static PRInt32 gReflowInx = -1; // This is for being VERY noisy //------------------------------------------ #ifdef DO_VERY_NOISY -#define REFLOW_NOISY_MSG(_msg1) printf((_msg1)) -#define REFLOW_NOISY_MSG2(_msg1, _msg2) printf((_msg1), (_msg2)) -#define REFLOW_NOISY_MSG3(_msg1, _msg2, _msg3) printf((_msg1), (_msg2), (_msg3)) -#define REFLOW_NOISY_MSG4(_msg1, _msg2, _msg3, _msg4) printf((_msg1), (_msg2), (_msg3), (_msg4)) +#define REFLOW_NOISY_MSG(_msg1) PRINTF((_msg1)) +#define REFLOW_NOISY_MSG2(_msg1, _msg2) PRINTF((_msg1), (_msg2)) +#define REFLOW_NOISY_MSG3(_msg1, _msg2, _msg3) PRINTF((_msg1), (_msg2), (_msg3)) +#define REFLOW_NOISY_MSG4(_msg1, _msg2, _msg3, _msg4) PRINTF((_msg1), (_msg2), (_msg3), (_msg4)) #else #define REFLOW_NOISY_MSG(_msg) #define REFLOW_NOISY_MSG2(_msg1, _msg2) @@ -202,7 +202,7 @@ static PRInt32 gReflowInx = -1; if (aReflowState.mComputedWidth != NS_UNCONSTRAINEDSIZE) { \ nscoord width = aDesiredSize.width - borderPadding.left - borderPadding.right; \ if (width != aReflowState.mComputedWidth) { \ - printf("aDesiredSize.width %d %d != aReflowState.mComputedWidth %d\n", aDesiredSize.width, width, aReflowState.mComputedWidth); \ + PRINTF("aDesiredSize.width %d %d != aReflowState.mComputedWidth %d\n", aDesiredSize.width, width, aReflowState.mComputedWidth); \ } \ NS_ASSERTION(width == aReflowState.mComputedWidth, "Returning bad value when constrained!"); \ } @@ -344,11 +344,11 @@ static int myCounter = 0; static void printSize(char * aDesc, nscoord aSize) { - printf(" %s: ", aDesc); + PRINTF(" %s: ", aDesc); if (aSize == NS_UNCONSTRAINEDSIZE) { - printf("UNC"); + PRINTF("UNC"); } else { - printf("%d", aSize); + PRINTF("%d", aSize); } } #endif @@ -368,35 +368,35 @@ nsListControlFrame::Reflow(nsIPresContext* aPresContext, aStatus = NS_FRAME_COMPLETE; #ifdef DO_REFLOW_DEBUG - printf("%p ** Id: %d nsLCF::Reflow %d R: ", this, mReflowId, myCounter++); + PRINTF("%p ** Id: %d nsLCF::Reflow %d R: ", this, mReflowId, myCounter++); switch (aReflowState.reason) { case eReflowReason_Initial: - printf("Initia");break; + PRINTF("Initia");break; case eReflowReason_Incremental: - printf("Increm");break; + PRINTF("Increm");break; case eReflowReason_Resize: - printf("Resize");break; + PRINTF("Resize");break; case eReflowReason_StyleChange: - printf("StyleC");break; + PRINTF("StyleC");break; case eReflowReason_Dirty: - printf("Dirty ");break; - default:printf("%d", aReflowState.reason);break; + PRINTF("Dirty ");break; + default:PRINTF("%d", aReflowState.reason);break; } printSize("AW", aReflowState.availableWidth); printSize("AH", aReflowState.availableHeight); printSize("CW", aReflowState.mComputedWidth); printSize("CH", aReflowState.mComputedHeight); - printf("\n"); + PRINTF("\n"); #if 0 { const nsStyleDisplay* display; GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&)display); - printf("+++++++++++++++++++++++++++++++++ "); + PRINTF("+++++++++++++++++++++++++++++++++ "); switch (display->mVisible) { - case NS_STYLE_VISIBILITY_COLLAPSE: printf("NS_STYLE_VISIBILITY_COLLAPSE\n");break; - case NS_STYLE_VISIBILITY_HIDDEN: printf("NS_STYLE_VISIBILITY_HIDDEN\n");break; - case NS_STYLE_VISIBILITY_VISIBLE: printf("NS_STYLE_VISIBILITY_VISIBLE\n");break; + case NS_STYLE_VISIBILITY_COLLAPSE: PRINTF("NS_STYLE_VISIBILITY_COLLAPSE\n");break; + case NS_STYLE_VISIBILITY_HIDDEN: PRINTF("NS_STYLE_VISIBILITY_HIDDEN\n");break; + case NS_STYLE_VISIBILITY_VISIBLE: PRINTF("NS_STYLE_VISIBILITY_VISIBLE\n");break; } } #endif @@ -444,7 +444,7 @@ nsListControlFrame::Reflow(nsIPresContext* aPresContext, if (options) { PRUint32 numOptions; options->GetLength(&numOptions); - printf("--- Num of Items %d ---\n", numOptions); + PRINTF("--- Num of Items %d ---\n", numOptions); for (PRUint32 i=0;i optionElement = getter_AddRefs(GetOption(*options, i)); if (optionElement) { @@ -457,7 +457,7 @@ nsListControlFrame::Reflow(nsIPresContext* aPresContext, } else { text = "No Value"; } - printf("[%d] - %s\n", i, text.ToNewCString()); + PRINTF("[%d] - %s\n", i, text.ToNewCString()); } } } @@ -839,7 +839,7 @@ nsListControlFrame::Reflow(nsIPresContext* aPresContext, if (!isInDropDownMode) { PRInt32 numRows = 1; GetSizeAttribute(&numRows); - printf("%d ", numRows); + PRINTF("%d ", numRows); if (numRows == 2) { COMPARE_QUIRK_SIZE("nsListControlFrame", 56, 38) } else if (numRows == 3) { @@ -1345,9 +1345,9 @@ nsListControlFrame::HandleEvent(nsIPresContext* aPresContext, "NS_MOUSE_RIGHT_CLICK"}; int inx = aEvent->message-NS_MOUSE_MESSAGE_START; if (inx >= 0 && inx <= (NS_MOUSE_RIGHT_CLICK-NS_MOUSE_MESSAGE_START)) { - printf("Mouse in ListFrame %s [%d]\n", desc[inx], aEvent->message); + PRINTF("Mouse in ListFrame %s [%d]\n", desc[inx], aEvent->message); } else { - printf("Mouse in ListFrame [%d]\n", aEvent->message); + PRINTF("Mouse in ListFrame [%d]\n", aEvent->message); }*/ if (nsEventStatus_eConsumeNoDefault == *aEventStatus) @@ -1368,7 +1368,7 @@ nsListControlFrame::HandleEvent(nsIPresContext* aPresContext, if (NS_KEY_EVENT == aEvent->eventStructType) { #ifdef DEBUG_rodsXXX nsKeyEvent* keyEvent = (nsKeyEvent*)aEvent; - printf("---> %d %c\n", keyEvent->keyCode, keyEvent->keyCode); + PRINTF("---> %d %c\n", keyEvent->keyCode, keyEvent->keyCode); #endif //if (NS_VK_SPACE == keyEvent->keyCode || NS_VK_RETURN == keyEvent->keyCode) { // MouseClicked(aPresContext); @@ -1702,7 +1702,7 @@ nsListControlFrame::SetContentSelected(PRInt32 aIndex, PRBool aSelected) PRInt32 numOptions = 0; if (NS_SUCCEEDED(GetNumberOfOptions(&numOptions))) { if (aIndex >= numOptions || aIndex < 0) { - printf("Index: %d Range 0:%d (setting to %s)\n", aIndex, numOptions, aSelected?"TRUE":"FALSE"); + PRINTF("Index: %d Range 0:%d (setting to %s)\n", aIndex, numOptions, aSelected?"TRUE":"FALSE"); NS_ASSERTION(0, "Bad Index has been passed into SetContentSelected!"); } } else { @@ -2233,7 +2233,7 @@ NS_IMETHODIMP nsListControlFrame::AddOption(nsIPresContext* aPresContext, PRInt32 aIndex) { #ifdef DO_REFLOW_DEBUG - printf("---- Id: %d nsLCF %p Added Option %d\n", mReflowId, this, aIndex); + PRINTF("---- Id: %d nsLCF %p Added Option %d\n", mReflowId, this, aIndex); #endif if (!mIsAllContentHere) { @@ -2285,7 +2285,7 @@ nsListControlFrame::AddOption(nsIPresContext* aPresContext, PRInt32 aIndex) if (NS_CONTENT_ATTR_NOT_THERE == rv || 0 == text.Length()) { option->GetText(text); } - printf("|||||this %p Index: %d [%s] CB: %p\n", this, aIndex, text.ToNewCString(), mComboboxFrame); //leaks + PRINTF("|||||this %p Index: %d [%s] CB: %p\n", this, aIndex, text.ToNewCString(), mComboboxFrame); //leaks } #endif } @@ -2997,8 +2997,8 @@ nsListControlFrame::GetIndexFromDOMEvent(nsIDOMEvent* aMouseEvent, mPresContext->GetShell(getter_AddRefs(presShell)); nsIFrame * frame; nsresult result = presShell->GetPrimaryFrameFor(content, &frame); - printf("Target Frame: %p this: %p\n", frame, this); - printf("-->\n"); + PRINTF("Target Frame: %p this: %p\n", frame, this); + PRINTF("-->\n"); #endif nsresult rv = NS_ERROR_FAILURE; @@ -3011,11 +3011,11 @@ nsListControlFrame::GetIndexFromDOMEvent(nsIDOMEvent* aMouseEvent, if (optionContent) { aOldIndex = aCurIndex; aCurIndex = GetSelectedIndexFromContent(optionContent); - //printf("--> Old: %d New: %d\n", aOldIndex, aCurIndex); + //PRINTF("--> Old: %d New: %d\n", aOldIndex, aCurIndex); rv = NS_OK; } } - //printf("--> bailing\n"); + //PRINTF("--> bailing\n"); return rv; } @@ -3399,9 +3399,9 @@ nsListControlFrame::AdjustIndexForDisabledOpt(PRInt32 &anNewIndex, PRInt32 &anOl aWasDisabled = PR_FALSE; while (1) { // Special Debug Code - //printf("T:%d B:%d I:%d R:%d IM:%d I:%d\n", top, bottom, newIndex, aDoAdjustInc, aDoAdjustIncNext, doingReverse); + //PRINTF("T:%d B:%d I:%d R:%d IM:%d I:%d\n", top, bottom, newIndex, aDoAdjustInc, aDoAdjustIncNext, doingReverse); //if (newIndex < -30 || newIndex > 30) { - // printf("********************************* Stopped!\n"); + // PRINTF("********************************* Stopped!\n"); // return; //} // if the newIndex isn't disabled, we are golden, bail out diff --git a/mozilla/layout/html/forms/src/nsNativeFormControlFrame.cpp b/mozilla/layout/html/forms/src/nsNativeFormControlFrame.cpp index 6b8063aa11d..3965424e3e2 100644 --- a/mozilla/layout/html/forms/src/nsNativeFormControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsNativeFormControlFrame.cpp @@ -31,6 +31,11 @@ #include "nsIFormControl.h" #include "nsFormFrame.h" #include "nsNativeFormControlFrame.h" +#include "nslog.h" + +NS_IMPL_LOG(nsNativeFormControlFrameLog) +#define PRINTF NS_LOG_PRINTF(nsNativeFormControlFrameLog) +#define FLUSH NS_LOG_FLUSH(nsNativeFormControlFrameLog) static NS_DEFINE_IID(kIWidgetIID, NS_IWIDGET_IID); static NS_DEFINE_IID(kViewCID, NS_VIEW_CID); @@ -293,8 +298,8 @@ NS_METHOD nsNativeFormControlFrame::HandleEvent(nsIPresContext* aPresContext, // unfortunately native widgets don't seem to handle this right. // so use the old code for native stuff. -EDV - //printf(" %d %d %d %d (%d,%d) \n", this, aEvent->widget, aEvent->widgetSupports, - // aEvent->message, aEvent->point.x, aEvent->point.y); + //PRINTF(" %d %d %d %d (%d,%d) \n", this, aEvent->widget, aEvent->widgetSupports, + // aEvent->message, aEvent->point.x, aEvent->point.y)); PRInt32 type; GetType(&type); @@ -329,4 +334,3 @@ NS_METHOD nsNativeFormControlFrame::HandleEvent(nsIPresContext* aPresContext, *aEventStatus = nsEventStatus_eConsumeDoDefault; return NS_OK; } - diff --git a/mozilla/layout/html/style/src/nsCSSDeclaration.cpp b/mozilla/layout/html/style/src/nsCSSDeclaration.cpp index 395e9339987..cbef66fd3d4 100644 --- a/mozilla/layout/html/style/src/nsCSSDeclaration.cpp +++ b/mozilla/layout/html/style/src/nsCSSDeclaration.cpp @@ -31,6 +31,11 @@ #include "nsCOMPtr.h" #include "nsIStyleSet.h" #include "nsISizeOfHandler.h" +#include "nslog.h" + +NS_IMPL_LOG(nsCSSDeclarationLog) +#define PRINTF NS_LOG_PRINTF(nsCSSDeclarationLog) +#define FLUSH NS_LOG_FLUSH(nsCSSDeclarationLog) // #define DEBUG_REFS @@ -1062,7 +1067,7 @@ CSSDeclarationImpl::CSSDeclarationImpl(void) NS_INIT_REFCNT(); #ifdef DEBUG_REFS ++gInstanceCount; - fprintf(stdout, "CSSDeclaration Instances (ctor): %ld\n", (long)gInstanceCount); + FPRINTF(stdout, "CSSDeclaration Instances (ctor): %ld\n", (long)gInstanceCount); #endif } @@ -1088,7 +1093,7 @@ CSSDeclarationImpl::CSSDeclarationImpl(const CSSDeclarationImpl& aCopy) #ifdef DEBUG_REFS ++gInstanceCount; - fprintf(stdout, "CSSDeclaration Instances (cp-ctor): %ld\n", (long)gInstanceCount); + FPRINTF(stdout, "CSSDeclaration Instances (cp-ctor): %ld\n", (long)gInstanceCount); #endif if (aCopy.mImportant) { @@ -1134,7 +1139,7 @@ CSSDeclarationImpl::~CSSDeclarationImpl(void) #ifdef DEBUG_REFS --gInstanceCount; - fprintf(stdout, "CSSDeclaration Instances (dtor): %ld\n", (long)gInstanceCount); + FPRINTF(stdout, "CSSDeclaration Instances (dtor): %ld\n", (long)gInstanceCount); #endif } diff --git a/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp b/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp index 516cf9a2511..404e24682cf 100644 --- a/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp +++ b/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp @@ -123,6 +123,11 @@ #include "nsPolygonFrame.h" #include "nsPolylineFrame.h" +#include "nslog.h" + +NS_IMPL_LOG(nsCSSFrameConstructorLog) +#define PRINTF NS_LOG_PRINTF(nsCSSFrameConstructorLog) +#define FLUSH NS_LOG_FLUSH(nsCSSFrameConstructorLog) nsresult @@ -8247,7 +8252,7 @@ nsCSSFrameConstructor::ContentAppended(nsIPresContext* aPresContext, { #ifdef DEBUG if (gNoisyContentUpdates) { - printf("nsCSSFrameConstructor::ContentAppended container=%p index=%d\n", + PRINTF("nsCSSFrameConstructor::ContentAppended container=%p index=%d\n", aContainer, aNewIndexInContainer); if (gReallyNoisyContentUpdates && aContainer) { aContainer->List(stdout, 0); @@ -8320,9 +8325,9 @@ nsCSSFrameConstructor::ContentAppended(nsIPresContext* aPresContext, // around. This logic guarantees a correct answer. #ifdef DEBUG if (gNoisyContentUpdates) { - printf("nsCSSFrameConstructor::ContentAppended: parentFrame="); + PRINTF("nsCSSFrameConstructor::ContentAppended: parentFrame="); nsFrame::ListTag(stdout, parentFrame); - printf(" is special\n"); + PRINTF(" is special\n"); } #endif return ReframeContainingBlock(aPresContext, parentFrame); @@ -8551,7 +8556,7 @@ nsCSSFrameConstructor::ContentInserted(nsIPresContext* aPresContext, { #ifdef DEBUG if (gNoisyContentUpdates) { - printf("nsCSSFrameConstructor::ContentInserted container=%p child=%p index=%d\n", + PRINTF("nsCSSFrameConstructor::ContentInserted container=%p child=%p index=%d\n", aContainer, aChild, aIndexInContainer); if (gReallyNoisyContentUpdates) { (aContainer ? aContainer : aChild)->List(stdout, 0); @@ -8748,9 +8753,9 @@ nsCSSFrameConstructor::ContentInserted(nsIPresContext* aPresContext, // around. This logic guarantees a correct answer. #ifdef DEBUG if (gNoisyContentUpdates) { - printf("nsCSSFrameConstructor::ContentInserted: parentFrame="); + PRINTF("nsCSSFrameConstructor::ContentInserted: parentFrame="); nsFrame::ListTag(stdout, parentFrame); - printf(" is special\n"); + PRINTF(" is special\n"); } #endif return ReframeContainingBlock(aPresContext, parentFrame); @@ -8829,10 +8834,10 @@ nsCSSFrameConstructor::ContentInserted(nsIPresContext* aPresContext, blockContent->GetParent(*getter_AddRefs(parentContainer)); #ifdef DEBUG if (gNoisyContentUpdates) { - printf("nsCSSFrameConstructor::ContentInserted: parentFrame="); + PRINTF("nsCSSFrameConstructor::ContentInserted: parentFrame="); nsFrame::ListTag(stdout, parentFrame); - printf(" is special inline\n"); - printf(" ==> blockContent=%p, parentContainer=%p\n", + PRINTF(" is special inline\n"); + PRINTF(" ==> blockContent=%p, parentContainer=%p\n", blockContent.get(), parentContainer.get()); } #endif @@ -9171,7 +9176,7 @@ nsCSSFrameConstructor::ContentRemoved(nsIPresContext* aPresContext, { #ifdef DEBUG if (gNoisyContentUpdates) { - printf("nsCSSFrameConstructor::ContentRemoved container=%p child=%p index=%d\n", + PRINTF("nsCSSFrameConstructor::ContentRemoved container=%p child=%p index=%d\n", aContainer, aChild, aIndexInContainer); if (gReallyNoisyContentUpdates) { aContainer->List(stdout, 0); @@ -9295,9 +9300,9 @@ nsCSSFrameConstructor::ContentRemoved(nsIPresContext* aPresContext, // around. This logic guarantees a correct answer. #ifdef DEBUG if (gNoisyContentUpdates) { - printf("nsCSSFrameConstructor::ContentRemoved: childFrame="); + PRINTF("nsCSSFrameConstructor::ContentRemoved: childFrame="); nsFrame::ListTag(stdout, childFrame); - printf(" is special\n"); + PRINTF(" is special\n"); } #endif return ReframeContainingBlock(aPresContext, childFrame); @@ -9320,13 +9325,13 @@ nsCSSFrameConstructor::ContentRemoved(nsIPresContext* aPresContext, // Trap out to special routine that handles adjusting a blocks // frame tree when first-letter style is present. #ifdef NOISY_FIRST_LETTER - printf("ContentRemoved: containingBlock="); + PRINTF("ContentRemoved: containingBlock="); nsFrame::ListTag(stdout, containingBlock); - printf(" parentFrame="); + PRINTF(" parentFrame="); nsFrame::ListTag(stdout, parentFrame); - printf(" childFrame="); + PRINTF(" childFrame="); nsFrame::ListTag(stdout, childFrame); - printf("\n"); + PRINTF("\n"); #endif // First update the containing blocks structure by removing the @@ -9343,11 +9348,11 @@ nsCSSFrameConstructor::ContentRemoved(nsIPresContext* aPresContext, childFrame->GetParent(&parentFrame); #ifdef NOISY_FIRST_LETTER - printf(" ==> revised parentFrame="); + PRINTF(" ==> revised parentFrame="); nsFrame::ListTag(stdout, parentFrame); - printf(" childFrame="); + PRINTF(" childFrame="); nsFrame::ListTag(stdout, childFrame); - printf("\n"); + PRINTF("\n"); #endif } @@ -9362,7 +9367,7 @@ nsCSSFrameConstructor::ContentRemoved(nsIPresContext* aPresContext, (const nsStyleStruct*&)display); if (display->IsFloating()) { #ifdef NOISY_FIRST_LETTER - printf(" ==> child display is still floating!\n"); + PRINTF(" ==> child display is still floating!\n"); #endif // Get the placeholder frame nsIFrame* placeholderFrame; @@ -9680,9 +9685,9 @@ nsCSSFrameConstructor::StyleChangeReflow(nsIPresContext* aPresContext, // around. This logic guarantees a correct answer. #ifdef DEBUG if (gNoisyContentUpdates) { - printf("nsCSSFrameConstructor::StyleChangeReflow: aFrame="); + PRINTF("nsCSSFrameConstructor::StyleChangeReflow: aFrame="); nsFrame::ListTag(stdout, aFrame); - printf(" is special\n"); + PRINTF(" is special\n"); } #endif ReframeContainingBlock(aPresContext, aFrame); @@ -12139,7 +12144,7 @@ nsCSSFrameConstructor::RemoveFloatingFirstLetterFrames( // Now that everything is set... #ifdef NOISY_FIRST_LETTER - printf("RemoveFloatingFirstLetterFrames: textContent=%p oldTextFrame=%p newTextFrame=%p\n", + PRINTF("RemoveFloatingFirstLetterFrames: textContent=%p oldTextFrame=%p newTextFrame=%p\n", textContent.get(), textFrame, newTextFrame); #endif aFrameManager->SetPlaceholderFrameFor(floater, nsnull); @@ -12705,17 +12710,17 @@ nsCSSFrameConstructor::ConstructInline(nsIPresShell* aPresShell, if (gNoisyInlineConstruction) { nsIFrameDebug* frameDebug; - printf("nsCSSFrameConstructor::ConstructInline:\n"); + PRINTF("nsCSSFrameConstructor::ConstructInline:\n"); if (NS_SUCCEEDED(aNewFrame->QueryInterface(NS_GET_IID(nsIFrameDebug), (void**)&frameDebug))) { - printf(" ==> leading inline frame:\n"); + PRINTF(" ==> leading inline frame:\n"); frameDebug->List(aPresContext, stdout, 2); } if (NS_SUCCEEDED(blockFrame->QueryInterface(NS_GET_IID(nsIFrameDebug), (void**)&frameDebug))) { - printf(" ==> block frame:\n"); + PRINTF(" ==> block frame:\n"); frameDebug->List(aPresContext, stdout, 2); } if (NS_SUCCEEDED(inlineFrame->QueryInterface(NS_GET_IID(nsIFrameDebug), (void**)&frameDebug))) { - printf(" ==> trailing inline frame:\n"); + PRINTF(" ==> trailing inline frame:\n"); frameDebug->List(aPresContext, stdout, 2); } } @@ -12896,7 +12901,7 @@ nsCSSFrameConstructor::WipeContainingBlock(nsIPresContext* aPresContext, aBlockContent->GetParent(*getter_AddRefs(parentContainer)); #ifdef DEBUG if (gNoisyContentUpdates) { - printf("nsCSSFrameConstructor::WipeContainingBlock: aBlockContent=%p parentContainer=%p\n", + PRINTF("nsCSSFrameConstructor::WipeContainingBlock: aBlockContent=%p parentContainer=%p\n", aBlockContent, parentContainer.get()); } #endif @@ -13107,7 +13112,7 @@ nsCSSFrameConstructor::ReframeContainingBlock(nsIPresContext* aPresContext, nsIF #ifdef DEBUG if (gNoisyContentUpdates) { - printf(" ==> blockContent=%p, parentContainer=%p\n", + PRINTF(" ==> blockContent=%p, parentContainer=%p\n", blockContent.get(), parentContainer.get()); } #endif diff --git a/mozilla/layout/html/style/src/nsCSSLayout.cpp b/mozilla/layout/html/style/src/nsCSSLayout.cpp index dbb288b89be..d4df8a36286 100644 --- a/mozilla/layout/html/style/src/nsCSSLayout.cpp +++ b/mozilla/layout/html/style/src/nsCSSLayout.cpp @@ -31,6 +31,11 @@ #include "nsRect.h" #include "nsIPtr.h" #include "nsHTMLIIDs.h" +#include "nslog.h" + +NS_IMPL_LOG(nsCSSLayoutLog) +#define PRINTF NS_LOG_PRINTF(nsCSSLayoutLog) +#define FLUSH NS_LOG_FLUSH(nsCSSLayoutLog) NS_DEF_PTR(nsIStyleContext); NS_DEF_PTR(nsIContent); @@ -104,7 +109,7 @@ nsCSSLayout::RelativePositionChildren(nsIPresContext* aCX, nscoord dx = 0; switch (kidPosition->mOffset.GetLeftUnit()) { case eStyleUnit_Percent: - printf("XXX: not yet implemented: % relative position\n"); + PRINTF("XXX: not yet implemented: % relative position\n"); case eStyleUnit_Auto: break; case eStyleUnit_Coord: @@ -114,7 +119,7 @@ nsCSSLayout::RelativePositionChildren(nsIPresContext* aCX, nscoord dy = 0; switch (kidPosition->mOffset.GetTopUnit()) { case eStyleUnit_Percent: - printf("XXX: not yet implemented: % relative position\n"); + PRINTF("XXX: not yet implemented: % relative position\n"); case eStyleUnit_Auto: break; case eStyleUnit_Coord: diff --git a/mozilla/layout/html/style/src/nsCSSLoader.cpp b/mozilla/layout/html/style/src/nsCSSLoader.cpp index 4d7ca1cf4e9..077fb2b995d 100644 --- a/mozilla/layout/html/style/src/nsCSSLoader.cpp +++ b/mozilla/layout/html/style/src/nsCSSLoader.cpp @@ -59,6 +59,12 @@ #include +#include "nslog.h" + +NS_IMPL_LOG(nsCSSLoaderLog) +#define PRINTF NS_LOG_PRINTF(nsCSSLoaderLog) +#define FLUSH NS_LOG_FLUSH(nsCSSLoaderLog) + static NS_DEFINE_IID(kICSSLoaderIID, NS_ICSS_LOADER_IID); //static NS_DEFINE_IID(kICSSParserIID, NS_ICSS_PARSER_IID); //static NS_DEFINE_IID(kICSSStyleSheetIID, NS_ICSS_STYLE_SHEET_IID); @@ -922,10 +928,8 @@ CSSLoaderImpl::DidLoadStyle(nsIStreamLoader* aLoader, // Dump error message to console. char *url; aLoadData->mURL->GetSpec(&url); -#ifdef DEBUG - cerr << "CSSLoaderImpl::DidLoadStyle: Load of URL '" << url - << "' failed. Error code: " << NS_ERROR_GET_CODE(aStatus) << "\n"; -#endif + PRINTF("CSSLoaderImpl::DidLoadStyle: Load of URL '%s' failed. Error code: %x\n", + url, aStatus); nsCRT::free(url); } @@ -1198,10 +1202,8 @@ CSSLoaderImpl::LoadSheet(URLKey& aKey, SheetLoadData* aData) // Dump an error message to the console char *url; aKey.mURL->GetSpec(&url); -#ifdef DEBUG - cerr << "CSSLoaderImpl::LoadSheet: Load of URL '" << url - << "' failed. Error code: " << NS_ERROR_GET_CODE(result) << "\n"; -#endif + PRINTF("CSSLoaderImpl::LoadSheet: Load of URL '%s' failed. Error code: %x\n", + url, result); nsCRT::free(url); } } @@ -1531,10 +1533,8 @@ CSSLoaderImpl::LoadAgentSheet(nsIURI* aURL, // Dump an error message to the console char *url; aURL->GetSpec(&url); -#ifdef DEBUG - cerr << "CSSLoaderImpl::LoadAgentSheet: Load of URL '" << url - << "' failed. Error code: " << NS_ERROR_GET_CODE(result) << "\n"; -#endif + PRINTF("CSSLoaderImpl::LoadAgentSheet: Load of URL '%s' failed. Error code: %x\n", + url, result); nsCRT::free(url); } } diff --git a/mozilla/layout/html/style/src/nsCSSRendering.cpp b/mozilla/layout/html/style/src/nsCSSRendering.cpp index 411f2df3735..29bf434bca8 100644 --- a/mozilla/layout/html/style/src/nsCSSRendering.cpp +++ b/mozilla/layout/html/style/src/nsCSSRendering.cpp @@ -40,6 +40,11 @@ #include "nsHTMLAtoms.h" #include "nsIDocument.h" #include "nsIScrollableFrame.h" +#include "nslog.h" + +NS_IMPL_LOG(nsCSSRenderingLog) +#define PRINTF NS_LOG_PRINTF(nsCSSRenderingLog) +#define FLUSH NS_LOG_FLUSH(nsCSSRenderingLog) static NS_DEFINE_IID(kScrollViewIID, NS_ISCROLLABLEVIEW_IID); @@ -1049,8 +1054,8 @@ PRIntn whichSide=0; dashRect.y -= topEdge->mWidth; // account for the topmost left edge corner with the leftmost top edge if (0) { - printf(" L: totalLength = %d, borderOutside.y = %d, midpoint %d, dashRect.y = %d\n", - totalLength, borderOutside.y, borderOutside.y +(totalLength/2), dashRect.y); + PRINTF(" L: totalLength = %d, borderOutside.y = %d, midpoint %d, dashRect.y = %d\n", + totalLength, borderOutside.y, borderOutside.y +(totalLength/2), dashRect.y); } currRect = dashRect; @@ -1070,8 +1075,8 @@ PRIntn whichSide=0; //draw if necessary if (0) { - printf("DASHED LEFT: xywh in loop currRect = %d %d %d %d %s\n", - currRect.x, currRect.y, currRect.width, currRect.height, bSolid?"TRUE":"FALSE"); + PRINTF("DASHED LEFT: xywh in loop currRect = %d %d %d %d %s\n", + currRect.x, currRect.y, currRect.width, currRect.height, bSolid?"TRUE":"FALSE"); } if (bSolid) { aContext.FillRect(currRect); @@ -1104,8 +1109,8 @@ PRIntn whichSide=0; //draw if necessary if (0) { - printf("DASHED LEFT: xywh in loop currRect = %d %d %d %d %s\n", - currRect.x, currRect.y, currRect.width, currRect.height, bSolid?"TRUE":"FALSE"); + PRINTF("DASHED LEFT: xywh in loop currRect = %d %d %d %d %s\n", + currRect.x, currRect.y, currRect.width, currRect.height, bSolid?"TRUE":"FALSE"); } if (bSolid) { aContext.FillRect(currRect); @@ -1415,7 +1420,7 @@ PRBool GetBGColorForHTMLElement( nsIPresContext *aPresContext, }// if tag == html or body #ifdef DEBUG else { - printf( "Root Content is not HTML or BODY: cannot get bgColor of HTML or BODY\n"); + PRINTF( "Root Content is not HTML or BODY: cannot get bgColor of HTML or BODY\n"); } #endif NS_RELEASE(tag); diff --git a/mozilla/layout/html/style/src/nsCSSScanner.cpp b/mozilla/layout/html/style/src/nsCSSScanner.cpp index 0c1e5a9171b..76b39ec58ad 100644 --- a/mozilla/layout/html/style/src/nsCSSScanner.cpp +++ b/mozilla/layout/html/style/src/nsCSSScanner.cpp @@ -24,6 +24,11 @@ #include "nsIUnicharInputStream.h" #include "nsString.h" #include "nsCRT.h" +#include "nslog.h" + +NS_IMPL_LOG(nsCSSScannerLog) +#define PRINTF NS_LOG_PRINTF(nsCSSScannerLog) +#define FLUSH NS_LOG_FLUSH(nsCSSScannerLog) #ifdef NS_DEBUG static char* kNullPointer = "null pointer"; @@ -215,7 +220,7 @@ void nsCSSScanner::InitErrorReporting(nsIURI* aURI) void nsCSSScanner::ReportError(const nsAReadableString& aError) { - printf("CSS Error (%s :%u.%u): %s.\n", + PRINTF("CSS Error (%s :%u.%u): %s.\n", mFileName.get(), mLineNumber, mColNumber, @@ -287,7 +292,7 @@ PRInt32 nsCSSScanner::Read(PRInt32& aErrorCode) #endif } mLastRead = rv; -//printf("Read => %x\n", rv); +//PRINTF("Read => %x\n", rv); return rv; } @@ -301,7 +306,7 @@ PRInt32 nsCSSScanner::Peek(PRInt32& aErrorCode) mPushback[0] = PRUnichar(ch); mPushbackCount++; } -//printf("Peek => %x\n", mLookAhead); +//PRINTF("Peek => %x\n", mLookAhead); return PRInt32(mPushback[mPushbackCount - 1]); } diff --git a/mozilla/layout/html/style/src/nsCSSStyleRule.cpp b/mozilla/layout/html/style/src/nsCSSStyleRule.cpp index 0fd73f6c51e..92e56e9a7a5 100644 --- a/mozilla/layout/html/style/src/nsCSSStyleRule.cpp +++ b/mozilla/layout/html/style/src/nsCSSStyleRule.cpp @@ -54,12 +54,17 @@ #include "nsIStyleSet.h" #include "nsISizeOfHandler.h" - // MJA: bug 31816 #include "nsIPresShell.h" #include "nsIDocShellTreeItem.h" // - END MJA +#include "nslog.h" + +NS_IMPL_LOG(nsCSSStyleRuleLog) +#define PRINTF NS_LOG_PRINTF(nsCSSStyleRuleLog) +#define FLUSH NS_LOG_FLUSH(nsCSSStyleRuleLog) + // #define DEBUG_REFS static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); @@ -164,7 +169,7 @@ nsAttrSelector::nsAttrSelector(PRInt32 aNameSpace, const nsString& aAttr) #ifdef DEBUG_REFS gAttrSelectorCount++; - printf( "nsAttrSelector Instances (ctor): %ld\n", (long)gAttrSelectorCount); + PRINTF( "nsAttrSelector Instances (ctor): %ld\n", (long)gAttrSelectorCount); #endif mAttr = NS_NewAtom(aAttr); @@ -183,7 +188,7 @@ nsAttrSelector::nsAttrSelector(PRInt32 aNameSpace, const nsString& aAttr, PRUint #ifdef DEBUG_REFS gAttrSelectorCount++; - printf( "nsAttrSelector Instances (ctor): %ld\n", (long)gAttrSelectorCount); + PRINTF( "nsAttrSelector Instances (ctor): %ld\n", (long)gAttrSelectorCount); #endif mAttr = NS_NewAtom(aAttr); @@ -201,7 +206,7 @@ nsAttrSelector::nsAttrSelector(const nsAttrSelector& aCopy) #ifdef DEBUG_REFS gAttrSelectorCount++; - printf( "nsAttrSelector Instances (cp-ctor): %ld\n", (long)gAttrSelectorCount); + PRINTF( "nsAttrSelector Instances (cp-ctor): %ld\n", (long)gAttrSelectorCount); #endif NS_IF_ADDREF(mAttr); @@ -214,7 +219,7 @@ nsAttrSelector::~nsAttrSelector(void) #ifdef DEBUG_REFS gAttrSelectorCount--; - printf( "nsAttrSelector Instances (dtor): %ld\n", (long)gAttrSelectorCount); + PRINTF( "nsAttrSelector Instances (dtor): %ld\n", (long)gAttrSelectorCount); #endif NS_IF_RELEASE(mAttr); @@ -304,7 +309,7 @@ nsCSSSelector::nsCSSSelector(void) #ifdef DEBUG_REFS gSelectorCount++; - printf( "nsCSSSelector Instances (ctor): %ld\n", (long)gSelectorCount); + PRINTF( "nsCSSSelector Instances (ctor): %ld\n", (long)gSelectorCount); #endif } @@ -326,7 +331,7 @@ nsCSSSelector::nsCSSSelector(const nsCSSSelector& aCopy) #ifdef DEBUG_REFS gSelectorCount++; - printf( "nsCSSSelector Instances (cp-ctor): %ld\n", (long)gSelectorCount); + PRINTF( "nsCSSSelector Instances (cp-ctor): %ld\n", (long)gSelectorCount); #endif } @@ -337,7 +342,7 @@ nsCSSSelector::~nsCSSSelector(void) #ifdef DEBUG_REFS gSelectorCount--; - printf( "nsCSSSelector Instances (dtor): %ld\n", (long)gSelectorCount); + PRINTF( "nsCSSSelector Instances (dtor): %ld\n", (long)gSelectorCount); #endif } @@ -1080,7 +1085,7 @@ CSSStyleRuleImpl::CSSStyleRuleImpl(const nsCSSSelector& aSelector) { #ifdef DEBUG_REFS gStyleRuleCount++; - printf( "CSSStyleRuleImpl Instances (ctor): %ld\n", (long)gStyleRuleCount); + PRINTF( "CSSStyleRuleImpl Instances (ctor): %ld\n", (long)gStyleRuleCount); #endif } @@ -1095,7 +1100,7 @@ CSSStyleRuleImpl::CSSStyleRuleImpl(const CSSStyleRuleImpl& aCopy) { #ifdef DEBUG_REFS gStyleRuleCount++; - printf( "CSSStyleRuleImpl Instances (cp-ctor): %ld\n", (long)gStyleRuleCount); + PRINTF( "CSSStyleRuleImpl Instances (cp-ctor): %ld\n", (long)gStyleRuleCount); #endif nsCSSSelector* copySel = aCopy.mSelector.mNext; @@ -1118,7 +1123,7 @@ CSSStyleRuleImpl::~CSSStyleRuleImpl(void) { #ifdef DEBUG_REFS gStyleRuleCount--; - printf( "CSSStyleRuleImpl Instances (dtor): %ld\n", (long)gStyleRuleCount); + PRINTF( "CSSStyleRuleImpl Instances (dtor): %ld\n", (long)gStyleRuleCount); #endif nsCSSSelector* next = mSelector.mNext; diff --git a/mozilla/layout/html/style/src/nsCSSStyleSheet.cpp b/mozilla/layout/html/style/src/nsCSSStyleSheet.cpp index 2f0d70b0b1c..0e8f57c2bc8 100644 --- a/mozilla/layout/html/style/src/nsCSSStyleSheet.cpp +++ b/mozilla/layout/html/style/src/nsCSSStyleSheet.cpp @@ -66,6 +66,11 @@ #include "nsIStyleSet.h" #include "nsISizeOfHandler.h" #include "nsStyleUtil.h" +#include "nslog.h" + +NS_IMPL_LOG(nsCSSStyleSheetLog) +#define PRINTF NS_LOG_PRINTF(nsCSSStyleSheetLog) +#define FLUSH NS_LOG_FLUSH(nsCSSStyleSheetLog) //#define DEBUG_RULES //#define EVENT_DEBUG @@ -1975,7 +1980,7 @@ CSSStyleSheetImpl::CheckRuleForAttributes(nsICSSRule *aRule) nsAutoString str; sel->mAttr->ToString(str); char * chars = str.ToNewCString(); - fprintf(stderr, "[%s@%p]", chars, this); + FPRINTF(stderr, "[%s@%p]", chars, this); nsMemory::Free(chars); #endif AtomKey key(sel->mAttr); @@ -3008,7 +3013,7 @@ static PRBool SelectorMatches(nsIPresContext* aPresContext, if (contentTag) { contentTag->ToString(strTag); } - printf("Tag: %s PseudoClass: %s EventState: %d\n", + PRINTF("Tag: %s PseudoClass: %s EventState: %d\n", strTag.ToNewCString(), strPseudo.ToNewCString(), (int)eventState); #endif } diff --git a/mozilla/layout/html/style/src/nsStyleUtil.cpp b/mozilla/layout/html/style/src/nsStyleUtil.cpp index 66fdb313db8..153b325f502 100644 --- a/mozilla/layout/html/style/src/nsStyleUtil.cpp +++ b/mozilla/layout/html/style/src/nsStyleUtil.cpp @@ -40,6 +40,11 @@ #include "nsIServiceManager.h" #include "nsIPref.h" +#include "nslog.h" + +NS_IMPL_LOG(nsStyleUtilLog) +#define PRINTF NS_LOG_PRINTF(nsStyleUtilLog) +#define FLUSH NS_LOG_FLUSH(nsStyleUtilLog) static NS_DEFINE_CID(kPrefCID, NS_PREF_CID); @@ -676,106 +681,106 @@ void DumpFontSizes(nsIPresContext* aPresContext) for (short i=0; i<2; i ++) { doWinRounding ^= true; - printf("\n\n\n"); - printf("---------------------------------------------------------------\n"); - printf(" CSS \n"); - printf(" Rounding %s\n", (doWinRounding ? "ON" : "OFF")); - printf("---------------------------------------------------------------\n"); - printf("\n"); - printf("NEW SIZES:\n"); - printf("----------\n"); - printf(" xx-small x-small small medium large x-large xx-large\n"); + PRINTF("\n\n\n"); + PRINTF("---------------------------------------------------------------\n"); + PRINTF(" CSS \n"); + PRINTF(" Rounding %s\n", (doWinRounding ? "ON" : "OFF")); + PRINTF("---------------------------------------------------------------\n"); + PRINTF("\n"); + PRINTF("NEW SIZES:\n"); + PRINTF("----------\n"); + PRINTF(" xx-small x-small small medium large x-large xx-large\n"); for (baseSize = 9; baseSize <= 20; baseSize++) { - printf("%2d: ", baseSize); + PRINTF("%2d: ", baseSize); for (cssSize = 0; cssSize <= 6; cssSize++) { val = NewCalcFontPointSize(cssSize, baseSize*dev2app, 1.0f, aPresContext, eFontSize_CSS); - printf("%2d ", RoundSize(val, aPresContext, false)); + PRINTF("%2d ", RoundSize(val, aPresContext, false)); } - printf("\n"); + PRINTF("\n"); } - printf("\n"); - printf("OLD SIZES:\n"); - printf("----------\n"); - printf(" xx-small x-small small medium large x-large xx-large\n"); + PRINTF("\n"); + PRINTF("OLD SIZES:\n"); + PRINTF("----------\n"); + PRINTF(" xx-small x-small small medium large x-large xx-large\n"); for (baseSize = 9; baseSize <= 20; baseSize++) { - printf("%2d: ", baseSize); + PRINTF("%2d: ", baseSize); for (cssSize = 0; cssSize <= 6; cssSize++) { val = OldCalcFontPointSize(cssSize, baseSize*dev2app, 1.0f); - printf("%2d ", RoundSize(val, aPresContext, doWinRounding)); + PRINTF("%2d ", RoundSize(val, aPresContext, doWinRounding)); } - printf("\n"); + PRINTF("\n"); } - printf("\n"); - printf("DIFFS:\n"); - printf("------\n"); - printf(" xx-small x-small small medium large x-large xx-large\n"); + PRINTF("\n"); + PRINTF("DIFFS:\n"); + PRINTF("------\n"); + PRINTF(" xx-small x-small small medium large x-large xx-large\n"); for (baseSize = 9; baseSize <= 20; baseSize++) { - printf("%2d: ", baseSize); + PRINTF("%2d: ", baseSize); for (cssSize = 0; cssSize <= 6; cssSize++) { oldVal = OldCalcFontPointSize(cssSize, baseSize*dev2app, 1.0f); val = NewCalcFontPointSize(cssSize, baseSize*dev2app, 1.0f, aPresContext, eFontSize_CSS); if (RoundSize(oldVal, aPresContext, doWinRounding) <= 8) - printf(" ."); + PRINTF(" ."); else - printf("%2d", (RoundSize(val, aPresContext, false)-RoundSize(oldVal, aPresContext, doWinRounding))); - printf(" "); + PRINTF("%2d", (RoundSize(val, aPresContext, false)-RoundSize(oldVal, aPresContext, doWinRounding))); + PRINTF(" "); } - printf("\n"); + PRINTF("\n"); } - printf("\n\n\n"); - printf("---------------------------------------------------------------\n"); - printf(" HTML \n"); - printf(" Rounding %s\n", (doWinRounding ? "ON" : "OFF")); - printf("---------------------------------------------------------------\n"); - printf("\n"); - printf("NEW SIZES:\n"); - printf("----------\n"); - printf(" #1 #2 #3 #4 #5 #6 #7\n"); + PRINTF("\n\n\n"); + PRINTF("---------------------------------------------------------------\n"); + PRINTF(" HTML \n"); + PRINTF(" Rounding %s\n", (doWinRounding ? "ON" : "OFF")); + PRINTF("---------------------------------------------------------------\n"); + PRINTF("\n"); + PRINTF("NEW SIZES:\n"); + PRINTF("----------\n"); + PRINTF(" #1 #2 #3 #4 #5 #6 #7\n"); for (baseSize = 9; baseSize <= 20; baseSize++) { - printf("%2d: ", baseSize); + PRINTF("%2d: ", baseSize); for (htmlSize = 1; htmlSize <= 7; htmlSize++) { val = NewCalcFontPointSize(htmlSize, baseSize*dev2app, 1.0f, aPresContext, eFontSize_HTML); - printf("%2d ", RoundSize(val, aPresContext, false)); + PRINTF("%2d ", RoundSize(val, aPresContext, false)); } - printf("\n"); + PRINTF("\n"); } - printf("\n"); - printf("OLD SIZES:\n"); - printf("----------\n"); - printf(" #1 #2 #3 #4 #5 #6 #7\n"); + PRINTF("\n"); + PRINTF("OLD SIZES:\n"); + PRINTF("----------\n"); + PRINTF(" #1 #2 #3 #4 #5 #6 #7\n"); for (baseSize = 9; baseSize <= 20; baseSize++) { - printf("%2d: ", baseSize); + PRINTF("%2d: ", baseSize); for (htmlSize = 1; htmlSize <= 7; htmlSize++) { val = OldCalcFontPointSize(htmlSize, baseSize*dev2app, 1.0f); - printf("%2d ", RoundSize(val, aPresContext, doWinRounding)); + PRINTF("%2d ", RoundSize(val, aPresContext, doWinRounding)); } - printf("\n"); + PRINTF("\n"); } - printf("\n"); - printf("DIFFS:\n"); - printf("------\n"); - printf(" #1 #2 #3 #4 #5 #6 #7\n"); + PRINTF("\n"); + PRINTF("DIFFS:\n"); + PRINTF("------\n"); + PRINTF(" #1 #2 #3 #4 #5 #6 #7\n"); for (baseSize = 9; baseSize <= 20; baseSize++) { - printf("%2d: ", baseSize); + PRINTF("%2d: ", baseSize); for (htmlSize = 1; htmlSize <= 7; htmlSize++) { oldVal = OldCalcFontPointSize(htmlSize, baseSize*dev2app, 1.0f); val = NewCalcFontPointSize(htmlSize, baseSize*dev2app, 1.0f, aPresContext, eFontSize_HTML); if (RoundSize(oldVal, aPresContext, doWinRounding) <= 8) - printf(" ."); + PRINTF(" ."); else - printf("%2d", (RoundSize(val, aPresContext, false)-RoundSize(oldVal, aPresContext, doWinRounding))); - printf(" "); + PRINTF("%2d", (RoundSize(val, aPresContext, false)-RoundSize(oldVal, aPresContext, doWinRounding))); + PRINTF(" "); } - printf("\n"); + PRINTF("\n"); } - printf("\n\n\n"); + PRINTF("\n\n\n"); } } } diff --git a/mozilla/layout/html/table/src/BasicTableLayoutStrategy.cpp b/mozilla/layout/html/table/src/BasicTableLayoutStrategy.cpp index 6e12c506d3a..a4887d56dc2 100644 --- a/mozilla/layout/html/table/src/BasicTableLayoutStrategy.cpp +++ b/mozilla/layout/html/table/src/BasicTableLayoutStrategy.cpp @@ -29,6 +29,11 @@ #include "nsStyleConsts.h" #include "nsVoidArray.h" #include "nsHTMLIIDs.h" +#include "nslog.h" + +NS_IMPL_LOG(BasicTableLayoutStrategyLog) +#define PRINTF NS_LOG_PRINTF(BasicTableLayoutStrategyLog) +#define FLUSH NS_LOG_FLUSH(BasicTableLayoutStrategyLog) #if 1 static PRBool gsDebugAssign = PR_FALSE; @@ -156,7 +161,7 @@ PRBool BCW_Wrapup(nsIPresContext* aPresContext, { if (aAllocTypes) delete [] aAllocTypes; - if (gsDebugBalance) {printf("BalanceColumnWidths ex \n"); aTableFrame->Dump(aPresContext, PR_FALSE, PR_TRUE, PR_FALSE);} + if (gsDebugBalance) {PRINTF("BalanceColumnWidths ex \n"); aTableFrame->Dump(aPresContext, PR_FALSE, PR_TRUE, PR_FALSE);} return PR_TRUE; } @@ -166,7 +171,7 @@ BasicTableLayoutStrategy::BalanceColumnWidths(nsIPresContext* aPresCont const nsHTMLReflowState& aReflowState, nscoord aMaxWidthIn) { - if (gsDebugBalance) {printf("BalanceColumnWidths en max=%d count=%d \n", aMaxWidthIn, gsDebugCount++); mTableFrame->Dump(aPresContext, PR_FALSE, PR_TRUE, PR_FALSE);} + if (gsDebugBalance) {PRINTF("BalanceColumnWidths en max=%d count=%d \n", aMaxWidthIn, gsDebugCount++); mTableFrame->Dump(aPresContext, PR_FALSE, PR_TRUE, PR_FALSE);} float p2t; aPresContext->GetScaledPixelsToTwips(&p2t); @@ -770,7 +775,7 @@ BasicTableLayoutStrategy::AssignNonPctColumnWidths(nsIPresContext* aPre const nsHTMLReflowState& aReflowState, float aPixelToTwips) { - if (gsDebugAssign) {printf("AssignNonPctColWidths en max=%d count=%d \n", aMaxWidth, gsDebugCount++); mTableFrame->Dump(aPresContext, PR_FALSE, PR_TRUE, PR_FALSE);} + if (gsDebugAssign) {PRINTF("AssignNonPctColWidths en max=%d count=%d \n", aMaxWidth, gsDebugCount++); mTableFrame->Dump(aPresContext, PR_FALSE, PR_TRUE, PR_FALSE);} PRBool rv = PR_FALSE; PRInt32 numRows = mTableFrame->GetRowCount(); PRInt32 numCols = mTableFrame->GetColCount(); @@ -950,7 +955,7 @@ BasicTableLayoutStrategy::AssignNonPctColumnWidths(nsIPresContext* aPre mTableFrame->SetColumnWidth(colX, minWidth); } - if (gsDebugAssign) {printf("AssignNonPctColWidths ex\n"); mTableFrame->Dump(aPresContext, PR_FALSE, PR_TRUE, PR_FALSE);} + if (gsDebugAssign) {PRINTF("AssignNonPctColWidths ex\n"); mTableFrame->Dump(aPresContext, PR_FALSE, PR_TRUE, PR_FALSE);} return rv; } @@ -1914,11 +1919,11 @@ void BasicTableLayoutStrategy::Dump(PRInt32 aIndent) } indent[aIndent] = 0; - printf("%s**START BASIC STRATEGY DUMP** table=%p cols=%X", + PRINTF("%s**START BASIC STRATEGY DUMP** table=%p cols=%X", indent, mTableFrame, mCols); - printf("\n%s cellSpacing=%d propRatio=%.2f navQuirks=%d", - indent, mCellSpacingTotal, mMinToDesProportionRatio, mIsNavQuirksMode); - printf(" **END BASIC STRATEGY DUMP** \n"); + PRINTF("\n%s cellSpacing=%d propRatio=%.2f navQuirks=%d", + indent, mCellSpacingTotal, mMinToDesProportionRatio, mIsNavQuirksMode); + PRINTF(" **END BASIC STRATEGY DUMP** \n"); delete [] indent; } diff --git a/mozilla/layout/html/table/src/nsCellMap.cpp b/mozilla/layout/html/table/src/nsCellMap.cpp index 744e10d29ca..54d2d5a9cb2 100644 --- a/mozilla/layout/html/table/src/nsCellMap.cpp +++ b/mozilla/layout/html/table/src/nsCellMap.cpp @@ -26,6 +26,11 @@ #include "nsTableFrame.h" #include "nsTableCellFrame.h" #include "nsTableRowGroupFrame.h" +#include "nslog.h" + +NS_IMPL_LOG(nsCellMapLog) +#define PRINTF NS_LOG_PRINTF(nsCellMapLog) +#define FLUSH NS_LOG_FLUSH(nsCellMapLog) // colspan=0 gets a minimum number of cols initially to make computations easier #define MIN_NUM_COLS_FOR_ZERO_COLSPAN 2 @@ -407,20 +412,20 @@ nsTableCellMap::GetNumCellsOriginatingInCol(PRInt32 aColIndex) const void nsTableCellMap::Dump() const { - printf("***** START TABLE CELL MAP DUMP ***** %p\n", this); + PRINTF("***** START TABLE CELL MAP DUMP ***** %p\n", this); // output col info PRInt32 colCount = mCols.Count(); - printf ("cols array orig/span-> %p", this); + PRINTF ("cols array orig/span-> %p", this); for (PRInt32 colX = 0; colX < colCount; colX++) { nsColInfo* colInfo = (nsColInfo *)mCols.ElementAt(colX); - printf ("%d=%d/%d ", colX, colInfo->mNumCellsOrig, colInfo->mNumCellsSpan); + PRINTF ("%d=%d/%d ", colX, colInfo->mNumCellsOrig, colInfo->mNumCellsSpan); } nsCellMap* cellMap = mFirstMap; while (cellMap) { cellMap->Dump(); cellMap = cellMap->GetNextSibling(); } - printf("***** END TABLE CELL MAP DUMP *****\n"); + PRINTF("***** END TABLE CELL MAP DUMP *****\n"); } #endif @@ -775,7 +780,7 @@ nsCellMap::AppendCell(nsTableCellMap& aMap, } } } - //printf("appended cell=%p row=%d \n", &aCellFrame, aRowIndex); + //PRINTF("appended cell=%p row=%d \n", &aCellFrame, aRowIndex); //aMap.Dump(); return startColIndex; } @@ -1481,40 +1486,40 @@ void nsCellMap::RemoveCell(nsTableCellMap& aMap, #ifdef NS_DEBUG void nsCellMap::Dump() const { - printf("\n ***** START GROUP CELL MAP DUMP ***** %p\n", this); + PRINTF("\n ***** START GROUP CELL MAP DUMP ***** %p\n", this); PRInt32 mapRowCount = mRows.Count(); - printf(" mapRowCount=%d tableRowCount=%d \n", mapRowCount, mRowCount); + PRINTF(" mapRowCount=%d tableRowCount=%d \n", mapRowCount, mRowCount); PRInt32 rowIndex, colIndex; for (rowIndex = 0; rowIndex < mapRowCount; rowIndex++) { nsVoidArray* row = (nsVoidArray *)mRows.ElementAt(rowIndex); - printf(" row %d : ", rowIndex); + PRINTF(" row %d : ", rowIndex); PRInt32 colCount = row->Count(); for (colIndex = 0; colIndex < colCount; colIndex++) { CellData* cd = (CellData *)row->ElementAt(colIndex); if (cd) { if (cd->IsOrig()) { - printf("C%d,%d ", rowIndex, colIndex); + PRINTF("C%d,%d ", rowIndex, colIndex); } else { nsTableCellFrame* cell = nsnull; if (cd->IsRowSpan()) { cell = GetCellFrame(rowIndex, colIndex, *cd, PR_TRUE); - printf("R "); + PRINTF("R "); } if (cd->IsColSpan()) { cell = GetCellFrame(rowIndex, colIndex, *cd, PR_FALSE); - printf("C "); + PRINTF("C "); } if (!(cd->IsRowSpan() && cd->IsColSpan())) { - printf(" "); + PRINTF(" "); } - printf(" "); + PRINTF(" "); } } else { - printf("---- "); + PRINTF("---- "); } } - printf("\n"); + PRINTF("\n"); } // output info mapping Ci,j to cell address @@ -1522,7 +1527,7 @@ void nsCellMap::Dump() const for (PRInt32 rIndex = 0; rIndex < mapRowCount; rIndex++) { nsVoidArray* row = (nsVoidArray *)mRows.ElementAt(rIndex); PRInt32 colCount = row->Count(); - printf(" "); + PRINTF(" "); for (colIndex = 0; colIndex < colCount; colIndex++) { CellData* cd = (CellData *)row->ElementAt(colIndex); if (cd) { @@ -1530,15 +1535,15 @@ void nsCellMap::Dump() const nsTableCellFrame* cellFrame = cd->GetCellFrame(); PRInt32 cellFrameColIndex; cellFrame->GetColIndex(cellFrameColIndex); - printf("C%d,%d=%p(%d) ", rIndex, colIndex, cellFrame, cellFrameColIndex); + PRINTF("C%d,%d=%p(%d) ", rIndex, colIndex, cellFrame, cellFrameColIndex); cellCount++; } } } - printf("\n"); + PRINTF("\n"); } - printf(" ***** END GROUP CELL MAP DUMP *****\n"); + PRINTF(" ***** END GROUP CELL MAP DUMP *****\n"); } #endif diff --git a/mozilla/layout/html/table/src/nsTableCellFrame.cpp b/mozilla/layout/html/table/src/nsTableCellFrame.cpp index d37cb8db708..03ec99870b0 100644 --- a/mozilla/layout/html/table/src/nsTableCellFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableCellFrame.cpp @@ -50,6 +50,11 @@ //TABLECELL SELECTION #include "nsIFrameSelection.h" #include "nsILookAndFeel.h" +#include "nslog.h" + +NS_IMPL_LOG(nsTableCellFrameLog) +#define PRINTF NS_LOG_PRINTF(nsTableCellFrameLog) +#define FLUSH NS_LOG_FLUSH(nsTableCellFrameLog) static NS_DEFINE_IID(kIHTMLTableCellElementIID, NS_IHTMLTABLECELLELEMENT_IID); static NS_DEFINE_IID(kIDOMHTMLTableCellElementIID, NS_IDOMHTMLTABLECELLELEMENT_IID); @@ -659,28 +664,28 @@ void DebugCheckChildSize(nsIFrame* aChild, if (aMet.width > aAvailSize.width) { nsAutoString tmp; aChild->GetFrameName(tmp); - printf("WARNING: cell "); + PRINTF("WARNING: cell "); fputs(tmp, stdout); - printf(" content has desired width %d given avail width %d\n", - aMet.width, aAvailSize.width); + PRINTF(" content has desired width %d given avail width %d\n", + aMet.width, aAvailSize.width); } */ if (aIsPass2Reflow) { if ((aMet.width < 0) || (aMet.width > 60000)) { - printf("WARNING: cell content %p has large width %d \n", aChild, aMet.width); + PRINTF("WARNING: cell content %p has large width %d \n", aChild, aMet.width); } if ((aMet.height < 0) || (aMet.height > 60000)) { - printf("WARNING: cell content %p has large height %d \n", aChild, aMet.height); + PRINTF("WARNING: cell content %p has large height %d \n", aChild, aMet.height); } } if (aMet.maxElementSize) { nscoord tmp = aMet.maxElementSize->width; if ((tmp < 0) || (tmp > 60000)) { - printf("WARNING: cell content %p has large max element width %d \n", aChild, tmp); + PRINTF("WARNING: cell content %p has large max element width %d \n", aChild, tmp); } tmp = aMet.maxElementSize->height; if ((tmp < 0) || (tmp > 60000)) { - printf("WARNING: cell content %p has large max element height %d \n", aChild, tmp); + PRINTF("WARNING: cell content %p has large max element height %d \n", aChild, tmp); } } } @@ -1124,7 +1129,7 @@ void nsTableCellFrame::MapHAlignAttribute(nsIPresContext* aPresContext, NS_METHOD nsTableCellFrame::DidSetStyleContext(nsIPresContext* aPresContext) { #ifdef NOISY_STYLE - printf("nsTableCellFrame::DidSetStyleContext \n"); + PRINTF("nsTableCellFrame::DidSetStyleContext \n"); #endif MapBorderPadding(aPresContext); diff --git a/mozilla/layout/html/table/src/nsTableColFrame.cpp b/mozilla/layout/html/table/src/nsTableColFrame.cpp index 8b2b9e061a5..a6f23ef3f94 100644 --- a/mozilla/layout/html/table/src/nsTableColFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableColFrame.cpp @@ -32,6 +32,11 @@ #include "nsLayoutAtoms.h" #include "nsIContent.h" #include "nsIDOMHTMLTableColElement.h" +#include "nslog.h" + +NS_IMPL_LOG(nsTableColFrameLog) +#define PRINTF NS_LOG_PRINTF(nsTableColFrameLog) +#define FLUSH NS_LOG_FLUSH(nsTableColFrameLog) #define COL_TYPE_CONTENT 0x0 #define COL_TYPE_ANONYMOUS_COL 0x1 @@ -187,7 +192,7 @@ void nsTableColFrame::SetWidth(PRUint32 aWidthType, if (aWidth > 0) { nscoord minWidth = GetMinWidth(); if ((MIN_CON != aWidthType) && (aWidth < minWidth)) { - printf("non min width set to lower than min \n"); + PRINTF("non min width set to lower than min \n"); } } #endif @@ -221,13 +226,13 @@ void nsTableColFrame::Dump(PRInt32 aIndent) } indent[aIndent] = 0; - printf("%s**START COL DUMP** colIndex=%d isAnonymous=%d constraint=%d", - indent, mColIndex, mIsAnonymous, mConstraint); - printf("\n%s widths=", indent); + PRINTF("%s**START COL DUMP** colIndex=%d isAnonymous=%d constraint=%d", + indent, mColIndex, mIsAnonymous, mConstraint); + PRINTF("\n%s widths=", indent); for (PRInt32 widthX = 0; widthX < NUM_WIDTHS; widthX++) { - printf("%d ", mWidths[widthX]); + PRINTF("%d ", mWidths[widthX]); } - printf(" **END COL DUMP** "); + PRINTF(" **END COL DUMP** "); delete [] indent; } diff --git a/mozilla/layout/html/table/src/nsTableFrame.cpp b/mozilla/layout/html/table/src/nsTableFrame.cpp index 367ecc4352d..3b004c7095f 100644 --- a/mozilla/layout/html/table/src/nsTableFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableFrame.cpp @@ -60,6 +60,12 @@ #include "nsIScrollableFrame.h" #include "nsHTMLReflowCommand.h" #include "nsIFrameManager.h" +#include "nslog.h" +#undef fprintf + +NS_IMPL_LOG(nsTableFrameLog) +#define PRINTF NS_LOG_PRINTF(nsTableFrameLog) +#define FLUSH NS_LOG_FLUSH(nsTableFrameLog) static NS_DEFINE_IID(kIHTMLElementIID, NS_IDOMHTMLELEMENT_IID); static NS_DEFINE_IID(kIBodyElementIID, NS_IDOMHTMLBODYELEMENT_IID); @@ -1048,7 +1054,7 @@ nsTableFrame::InsertRows(nsIPresContext& aPresContext, PRInt32 aRowIndex, PRBool aConsiderSpans) { - //printf("insertRowsBefore firstRow=%d \n", aRowIndex); + //PRINTF("insertRowsBefore firstRow=%d \n", aRowIndex); //Dump(PR_TRUE, PR_FALSE, PR_TRUE); PRInt32 numColsToAdd = 0; @@ -1076,7 +1082,7 @@ nsTableFrame::InsertRows(nsIPresContext& aPresContext, } } - //printf("insertRowsAfter \n"); + //PRINTF("insertRowsAfter \n"); //Dump(PR_TRUE, PR_FALSE, PR_TRUE); return numColsToAdd; @@ -1088,7 +1094,7 @@ void nsTableFrame::RemoveRows(nsIPresContext& aPresContext, PRInt32 aNumRowsToRemove, PRBool aConsiderSpans) { - //printf("removeRowsBefore firstRow=%d numRows=%d\n", aFirstRowIndex, aNumRowsToRemove); + //PRINTF("removeRowsBefore firstRow=%d numRows=%d\n", aFirstRowIndex, aNumRowsToRemove); //Dump(PR_TRUE, PR_FALSE, PR_TRUE); nsTableCellMap* cellMap = GetCellMap(); @@ -1104,7 +1110,7 @@ void nsTableFrame::RemoveRows(nsIPresContext& aPresContext, } } AdjustRowIndices(&aPresContext, aFirstRowIndex, -aNumRowsToRemove); - //printf("removeRowsAfter\n"); + //PRINTF("removeRowsAfter\n"); //Dump(PR_TRUE, PR_FALSE, PR_TRUE); } @@ -1347,7 +1353,7 @@ NS_METHOD nsTableFrame::Paint(nsIPresContext* aPresContext, } else { - //printf("paint table frame\n"); + //PRINTF("paint table frame\n"); nsBorderEdges* edges = nsnull; if (mBorderCollapser) { edges = mBorderCollapser->GetEdges(); @@ -4347,7 +4353,7 @@ nsTableFrame::DumpRowGroup(nsIPresContext* aPresContext, nsIFrame* aKidFrame) nsIAtom* rowType; rowFrame->GetFrameType(&rowType); if (nsLayoutAtoms::tableRowFrame == rowType) { - printf("row(%d)=%p ", ((nsTableRowFrame*)rowFrame)->GetRowIndex(), rowFrame); + PRINTF("row(%d)=%p ", ((nsTableRowFrame*)rowFrame)->GetRowIndex(), rowFrame); nsIFrame* cellFrame; rowFrame->FirstChild(aPresContext, nsnull, &cellFrame); while (cellFrame) { @@ -4356,12 +4362,12 @@ nsTableFrame::DumpRowGroup(nsIPresContext* aPresContext, nsIFrame* aKidFrame) if (nsLayoutAtoms::tableCellFrame == cellType) { PRInt32 colIndex; ((nsTableCellFrame*)cellFrame)->GetColIndex(colIndex); - printf("cell(%d)=%p ", colIndex, cellFrame); + PRINTF("cell(%d)=%p ", colIndex, cellFrame); } NS_IF_RELEASE(cellType); cellFrame->GetNextSibling(&cellFrame); } - printf("\n"); + PRINTF("\n"); } else { DumpRowGroup(aPresContext, rowFrame); @@ -4377,15 +4383,15 @@ void nsTableFrame::Dump(nsIPresContext* aPresContext, PRBool aDumpCols, PRBool aDumpCellMap) { - printf("***START TABLE DUMP*** \n"); + PRINTF("***START TABLE DUMP*** \n"); // dump the columns widths array - printf("mColWidths="); + PRINTF("mColWidths="); PRInt32 numCols = GetColCount(); PRInt32 colX; for (colX = 0; colX < numCols; colX++) { - printf("%d ", mColumnWidths[colX]); + PRINTF("%d ", mColumnWidths[colX]); } - printf("\n"); + PRINTF("\n"); if (aDumpRows) { nsIFrame* kidFrame = mFrames.FirstChild(); @@ -4397,16 +4403,16 @@ void nsTableFrame::Dump(nsIPresContext* aPresContext, if (aDumpCols) { // output col frame cache - printf("\n col frame cache ->"); + PRINTF("\n col frame cache ->"); for (colX = 0; colX < numCols; colX++) { nsTableColFrame* colFrame = (nsTableColFrame *)mColFrames.ElementAt(colX); if (0 == (colX % 8)) { - printf("\n"); + PRINTF("\n"); } - printf ("%d=%p ", colX, colFrame); + PRINTF ("%d=%p ", colX, colFrame); } for (colX = 0; colX < numCols; colX++) { - printf("\n"); + PRINTF("\n"); nsTableColFrame* colFrame = GetColFrame(colX); colFrame->Dump(1); } @@ -4417,7 +4423,7 @@ void nsTableFrame::Dump(nsIPresContext* aPresContext, cellMap->Dump(); #endif } - printf(" ***END TABLE DUMP*** \n"); + PRINTF(" ***END TABLE DUMP*** \n"); } // nsTableIterator @@ -4650,16 +4656,16 @@ void nsTableFrame::DebugReflow(char* aMessage, { char indent[256]; nsTableFrame::DebugGetIndent(aFrame, indent); - printf("%s%s %p ", indent, aMessage, aFrame); + PRINTF("%s%s %p ", indent, aMessage, aFrame); char width[32]; char height[32]; if (aState) { PrettyUC(aState->availableWidth, width); PrettyUC(aState->availableHeight, height); - printf("rea=%d av=(%s,%s) ", aState->reason, width, height); + PRINTF("rea=%d av=(%s,%s) ", aState->reason, width, height); PrettyUC(aState->mComputedWidth, width); PrettyUC(aState->mComputedHeight, height); - printf("comp=(%s,%s) count=%d \n ", width, height, gRflCount); + PRINTF("comp=(%s,%s) count=%d \n ", width, height, gRflCount); gRflCount++; //if (32 == gRflCount) { // NS_ASSERTION(PR_FALSE, "stop"); @@ -4667,23 +4673,23 @@ void nsTableFrame::DebugReflow(char* aMessage, } if (aMetrics) { if (aState) { - printf("%s", indent); + PRINTF("%s", indent); } PrettyUC(aMetrics->width, width); PrettyUC(aMetrics->height, height); - printf("des=(%s,%s) ", width, height); + PRINTF("des=(%s,%s) ", width, height); if (aMetrics->maxElementSize) { PrettyUC(aMetrics->maxElementSize->width, width); PrettyUC(aMetrics->maxElementSize->height, height); - printf("maxElem=(%s,%s)", width, height); + PRINTF("maxElem=(%s,%s)", width, height); } if (aMetrics->mFlags & NS_REFLOW_CALC_MAX_WIDTH) { - printf("max=%d ", aMetrics->mMaximumWidth); + PRINTF("max=%d ", aMetrics->mMaximumWidth); } if (NS_FRAME_COMPLETE != aStatus) { - printf("status=%d", aStatus); + PRINTF("status=%d", aStatus); } - printf("\n"); + PRINTF("\n"); } } diff --git a/mozilla/layout/html/table/src/nsTableRowFrame.cpp b/mozilla/layout/html/table/src/nsTableRowFrame.cpp index a1aeb314d15..aebab5ebd6f 100644 --- a/mozilla/layout/html/table/src/nsTableRowFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableRowFrame.cpp @@ -44,6 +44,11 @@ static NS_DEFINE_IID(kIHTMLTableCellElementIID, NS_IHTMLTABLECELLELEMENT_IID); // end includes for style optimizations that require real content knowledge +#include "nslog.h" + +NS_IMPL_LOG(nsTableRowFrameLog) +#define PRINTF NS_LOG_PRINTF(nsTableRowFrameLog) +#define FLUSH NS_LOG_FLUSH(nsTableRowFrameLog) struct nsTableCellReflowState : public nsHTMLReflowState { @@ -969,8 +974,8 @@ NS_METHOD nsTableRowFrame::ResizeReflow(nsIPresContext* aPresContext, #ifdef NS_DEBUG_karnaze if (desiredSize.width > availWidth) { - printf("WARNING: cell returned desired width %d given avail width %d\n", - desiredSize.width, availWidth); + PRINTF("WARNING: cell returned desired width %d given avail width %d\n", + desiredSize.width, availWidth); } #endif @@ -1057,7 +1062,7 @@ NS_METHOD nsTableRowFrame::ResizeReflow(nsIPresContext* aPresContext, float p2t; aPresContext->GetScaledPixelsToTwips(&p2t); if (overAllocated > p2t) { - printf("row over allocated by %d\n twips", overAllocated); + PRINTF("row over allocated by %d\n twips", overAllocated); } } #endif @@ -1121,15 +1126,15 @@ nsTableRowFrame::InitialReflow(nsIPresContext* aPresContext, // the following signals bugs in the content frames. if (kidMaxElementSize.width > kidSize.width) { #ifdef DEBUG_karnaze - printf("WARNING - table cell content max element width %d greater than desired width %d\n", - kidMaxElementSize.width, kidSize.width); + PRINTF("WARNING - table cell content max element width %d greater than desired width %d\n", + kidMaxElementSize.width, kidSize.width); #endif kidSize.width = kidMaxElementSize.width; } if (kidMaxElementSize.height > kidSize.height) { #ifdef DEBUG_karnaze - printf("Warning - table cell content max element height %d greater than desired height %d\n", - kidMaxElementSize.height, kidSize.height); + PRINTF("Warning - table cell content max element height %d greater than desired height %d\n", + kidMaxElementSize.height, kidSize.height); #endif kidSize.height = kidMaxElementSize.height; } diff --git a/mozilla/layout/mathml/base/src/nsMathMLChar.cpp b/mozilla/layout/mathml/base/src/nsMathMLChar.cpp index cb26999dcf1..b6594093ae8 100644 --- a/mozilla/layout/mathml/base/src/nsMathMLChar.cpp +++ b/mozilla/layout/mathml/base/src/nsMathMLChar.cpp @@ -43,6 +43,11 @@ #include "nsMathMLOperators.h" #include "nsMathMLChar.h" +#include "nslog.h" + +NS_IMPL_LOG(nsMathMLCharLog) +#define PRINTF NS_LOG_PRINTF(nsMathMLCharLog) +#define FLUSH NS_LOG_FLUSH(nsMathMLCharLog) // List of all stretchy MathML chars with their attributes -------------- // ---------------------------------------------------------------------- @@ -358,8 +363,8 @@ nsGlyphTableList::Init(nsIPresContext* aPresContext, #ifdef NS_DEBUG char str[50]; localName.ToCString(str, sizeof(str)); - printf("WARNING *** Missing the %s font to stretch MathML symbols!\n", str); - printf(" Why don't you install the %s font on your system for a better MathML experience!\n", str); + PRINTF("WARNING *** Missing the %s font to stretch MathML symbols!\n", str); + PRINTF(" Why don't you install the %s font on your system for a better MathML experience!\n", str); #endif } glyphTable++; @@ -822,7 +827,7 @@ nsMathMLChar::Stretch(nsIPresContext* aPresContext, PRUint32(mData.Length()), mBoundingMetrics); if (NS_FAILED(rv)) { - printf ("GetBoundingMetrics failed\n"); + PRINTF ("GetBoundingMetrics failed\n"); // ensure that the char later behaves like a normal char mEnum = eMathMLChar_DONT_STRETCH; // XXX need to reset in dynamic updates return rv; @@ -892,8 +897,8 @@ nsMathMLChar::Stretch(nsIPresContext* aPresContext, nsBoundingMetrics bestbm = mBoundingMetrics; #ifdef NOISY_SEARCH - printf("Searching a font with a glyph of appropriate size for: 0x%04X:%c\n", - mData[0], mData[0]&0x00FF); + PRINTF("Searching a font with a glyph of appropriate size for: 0x%04X:%c\n", + mData[0], mData[0]&0x00FF); #endif nsGlyphTable* glyphTable = gGlyphTableList.FirstTable(); while (glyphTable && !sizeOK) { @@ -905,7 +910,7 @@ nsMathMLChar::Stretch(nsIPresContext* aPresContext, #ifdef NOISY_SEARCH char str[50]; fontName.ToCString(str, sizeof(str)); - printf(" searching in %s ...\n", str); + PRINTF(" searching in %s ...\n", str); #endif size = 1; // size=0 is the char at its normal size ch = glyphTable->BigOf(mEnum, size++); @@ -921,7 +926,7 @@ nsMathMLChar::Stretch(nsIPresContext* aPresContext, IsSizeOK(w, aContainerSize.width, aStretchHint))) { #ifdef NOISY_SEARCH - printf(" size:%d OK!\n", size-1); + PRINTF(" size:%d OK!\n", size-1); #endif bestbm = bm; bestGlyphTable = glyphTable; @@ -938,7 +943,7 @@ nsMathMLChar::Stretch(nsIPresContext* aPresContext, aContainerSize.width, aStretchHint))) { #ifdef NOISY_SEARCH - printf(" size:%d Current best\n", size-1); + PRINTF(" size:%d Current best\n", size-1); #endif bestGlyphTable = glyphTable; bestGlyph = ch; @@ -946,7 +951,7 @@ nsMathMLChar::Stretch(nsIPresContext* aPresContext, } #ifdef NOISY_SEARCH else { - printf(" size:%d Rejected!\n", size-1); + PRINTF(" size:%d Rejected!\n", size-1); } #endif } @@ -962,7 +967,7 @@ nsMathMLChar::Stretch(nsIPresContext* aPresContext, if (!sizeOK) { #ifdef NOISY_SEARCH - printf(" searching for the font with the smallest glue\n"); + PRINTF(" searching for the font with the smallest glue\n"); #endif if (gCharInfo[mEnum].mGlyphTable == &gGlyphTableUNDEFINED) { // first time // gCharInfo[mEnum].mGlyphTable is not yet initialized, scan the global list @@ -988,14 +993,14 @@ nsMathMLChar::Stretch(nsIPresContext* aPresContext, #ifdef NOISY_SEARCH char str[50]; fontName.ToCString(str, sizeof(str)); - printf(" %s glue:%d Current best\n", str, lengthGlue); + PRINTF(" %s glue:%d Current best\n", str, lengthGlue); #endif } #ifdef NOISY_SEARCH else { char str[50]; fontName.ToCString(str, sizeof(str)); - printf(" %s glue:%d Rejected!\n", str, length); + PRINTF(" %s glue:%d Rejected!\n", str, length); } #endif } @@ -1007,7 +1012,7 @@ nsMathMLChar::Stretch(nsIPresContext* aPresContext, gCharInfo[mEnum].mGlyphTable->GetFontName(fontName); char str[50]; fontName.ToCString(str, sizeof(str)); - printf(" Found %s in the global list\n", str); + PRINTF(" Found %s in the global list\n", str); } #endif } @@ -1016,10 +1021,10 @@ nsMathMLChar::Stretch(nsIPresContext* aPresContext, gCharInfo[mEnum].mGlyphTable->GetFontName(fontName); char str[50]; fontName.ToCString(str, sizeof(str)); - printf(" Found %s in the cache\n", str); + PRINTF(" Found %s in the cache\n", str); } else { - printf(" no font found\n"); + PRINTF(" no font found\n"); } #endif } @@ -1053,7 +1058,7 @@ nsMathMLChar::Stretch(nsIPresContext* aPresContext, if (!ch) ch = glyphTable->GlueOf(mEnum); // empty slots are filled with the glue rv = glyphTable->GetBoundingMetrics(aRenderingContext, ch, bm); if (NS_FAILED(rv)) { - printf("GetBoundingMetrics failed for %04X:%c\n", ch, ch&0x00FF); + PRINTF("GetBoundingMetrics failed for %04X:%c\n", ch, ch&0x00FF); // stop if we failed to compute the bounding metrics of a part. // we will use the best glyph encountered earlier break; @@ -1210,14 +1215,14 @@ nsMathMLChar::Paint(nsIPresContext* aPresContext, if (eMathMLChar_DONT_STRETCH == mEnum || NS_STRETCH_DIRECTION_UNSUPPORTED == mDirection) { // normal drawing if there is nothing special about this char ... - //printf("Painting %04X like a normal char\n", mData[0]); + //PRINTF("Painting %04X like a normal char\n", mData[0]); //aRenderingContext.SetColor(NS_RGB(255,0,0)); aRenderingContext.DrawString(mData.GetUnicode(), PRUint32(mData.Length()), mRect.x, mRect.y - (fontAscent - mBoundingMetrics.ascent)); } else if (0 < mGlyph) { // wow, there is a glyph of appropriate size! - //printf("Painting %04X with a glyph of appropriate size\n", mData[0]); + //PRINTF("Painting %04X with a glyph of appropriate size\n", mData[0]); //aRenderingContext.SetColor(NS_RGB(0,0,255)); mGlyphTable->DrawGlyph(aRenderingContext, mGlyph, mRect.x, @@ -1273,7 +1278,7 @@ nsMathMLChar::PaintVertically(nsIPresContext* aPresContext, if (!ch) ch = aGlyphTable->GlueOf(aCharEnum); rv = aGlyphTable->GetBoundingMetrics(aRenderingContext, ch, bm); if (NS_FAILED(rv)) { - printf("GetBoundingMetrics failed for %04X:%c\n", ch, ch&0x00FF); + PRINTF("GetBoundingMetrics failed for %04X:%c\n", ch, ch&0x00FF); return rv; } chdata[i] = ch; @@ -1390,7 +1395,7 @@ nsMathMLChar::PaintHorizontally(nsIPresContext* aPresContext, if (!ch) ch = aGlyphTable->GlueOf(aCharEnum); rv = aGlyphTable->GetBoundingMetrics(aRenderingContext, ch, bm); if (NS_FAILED(rv)) { - printf("GetBoundingMetrics failed for %04X:%c\n", ch, ch&0x00FF); + PRINTF("GetBoundingMetrics failed for %04X:%c\n", ch, ch&0x00FF); return rv; } chdata[i] = ch; diff --git a/mozilla/layout/mathml/base/src/nsMathMLContainerFrame.cpp b/mozilla/layout/mathml/base/src/nsMathMLContainerFrame.cpp index 8d8ba28a899..27788873e95 100644 --- a/mozilla/layout/mathml/base/src/nsMathMLContainerFrame.cpp +++ b/mozilla/layout/mathml/base/src/nsMathMLContainerFrame.cpp @@ -44,6 +44,11 @@ #include "nsMathMLParts.h" #include "nsMathMLChar.h" #include "nsMathMLContainerFrame.h" +#include "nslog.h" + +NS_IMPL_LOG(nsMathMLContainerFrameLog) +#define PRINTF NS_LOG_PRINTF(nsMathMLContainerFrameLog) +#define FLUSH NS_LOG_FLUSH(nsMathMLContainerFrameLog) // // nsMathMLContainerFrame implementation @@ -200,8 +205,8 @@ nsMathMLContainerFrame::GetRuleThickness(nsIRenderingContext& aRenderingContext, rv = aRenderingContext.GetBoundingMetrics(&sqrt, PRUint32(1), bm); nscoord sqrtrule = bm.ascent; // according to TeX, the ascent should be the rule - printf("xheight:%4d rule:%4d oldrule:%4d sqrtrule:%4d\n", - xHeight, aRuleThickness, oldRuleThickness, sqrtrule); + PRINTF("xheight:%4d rule:%4d oldrule:%4d sqrtrule:%4d\n", + xHeight, aRuleThickness, oldRuleThickness, sqrtrule); #endif } @@ -233,8 +238,8 @@ nsMathMLContainerFrame::GetAxisHeight(nsIRenderingContext& aRenderingContext, rv = aRenderingContext.GetBoundingMetrics(&plus, PRUint32(1), bm); nscoord plusAxis = bm.ascent - (bm.ascent + bm.descent)/2;; - printf("xheight:%4d Axis:%4d oldAxis:%4d plusAxis:%4d\n", - xHeight, aAxisHeight, oldAxis, plusAxis); + PRINTF("xheight:%4d Axis:%4d oldAxis:%4d plusAxis:%4d\n", + xHeight, aAxisHeight, oldAxis, plusAxis); #endif } @@ -303,7 +308,7 @@ char s1[50], s2[50], s3[50]; aString.ToCString(s1, 50); number.ToCString(s2, 50); unit.ToCString(s3, 50); -printf("String:%s, Number:%s, Unit:%s\n", s1, s2, s3); + PRINTF("String:%s, Number:%s, Unit:%s\n", s1, s2, s3); #endif // Convert number to floating point @@ -473,7 +478,7 @@ nsMathMLContainerFrame::ReflowError(nsIPresContext* aPresContext, PRUint32(errorMsg.Length()), mBoundingMetrics); if (NS_FAILED(rv)) { - printf("GetBoundingMetrics failed\n"); + PRINTF("GetBoundingMetrics failed\n"); aDesiredSize.width = aDesiredSize.height = 0; aDesiredSize.ascent = aDesiredSize.descent = 0; return NS_OK; @@ -605,8 +610,8 @@ nsMathMLContainerFrame::GetReflowAndBoundingMetricsFor(nsIFrame* aFra aMathMLFrame->GetBoundingMetrics(aBoundingMetrics); #if 0 nsFrame::ListTag(stdout, aFrame); - printf(" subItalicCorrection:%d supItalicCorrection:%d\n", - aBoundingMetrics.subItalicCorrection, aBoundingMetrics.supItalicCorrection); + PRINTF(" subItalicCorrection:%d supItalicCorrection:%d\n", + aBoundingMetrics.subItalicCorrection, aBoundingMetrics.supItalicCorrection); #endif } else { // aFrame is not a MathML frame, just return the reflow metrics @@ -614,9 +619,9 @@ nsMathMLContainerFrame::GetReflowAndBoundingMetricsFor(nsIFrame* aFra aBoundingMetrics.ascent = aReflowMetrics.ascent; aBoundingMetrics.width = aReflowMetrics.width; #if 0 - printf("GetBoundingMetrics() failed for: "); /* getchar(); */ + PRINTF("GetBoundingMetrics() failed for: "); /* getchar(); */ nsFrame::ListTag(stdout, aFrame); - printf("\n"); + PRINTF("\n"); #endif } } @@ -637,14 +642,14 @@ nsMathMLContainerFrame::Stretch(nsIPresContext* aPresContext, if (NS_MATHML_IS_EMBELLISH_OPERATOR(mEmbellishData.flags)) { if (NS_MATHML_STRETCH_WAS_DONE(mEmbellishData.flags)) { - printf("WARNING *** it is wrong to fire stretch more than once on a frame...\n"); + PRINTF("WARNING *** it is wrong to fire stretch more than once on a frame...\n"); // NS_ASSERTION(PR_FALSE,"Stretch() was fired more than once on a frame!"); return NS_OK; } mEmbellishData.flags |= NS_MATHML_STRETCH_DONE; if (NS_MATHML_HAS_ERROR(mPresentationData.flags)) { - printf("WARNING *** it is wrong to fire stretch on a erroneous frame...\n"); + PRINTF("WARNING *** it is wrong to fire stretch on a erroneous frame...\n"); return NS_OK; } @@ -1083,7 +1088,7 @@ nsMathMLContainerFrame::InsertScriptLevelStyleContext(nsIPresContext* aPresConte else { char str[50]; value.ToCString(str, 50); - printf("Invalid attribute scriptminsize=%s\n", str); + PRINTF("Invalid attribute scriptminsize=%s\n", str); } #endif } @@ -1126,11 +1131,11 @@ nsMathMLContainerFrame::InsertScriptLevelStyleContext(nsIPresContext* aPresConte smallestFontIndex = nsStyleUtil::FindNextSmallerFontSize(smallestFontSize, (PRInt32)defaultFont.size, scaleFactor, aPresContext); smallestFontSize = nsStyleUtil::CalcFontPointSize(smallestFontIndex, (PRInt32)defaultFont.size, scaleFactor, aPresContext); //((nsFrame*)childFrame)->ListTag(stdout); -//printf(" About to move to fontsize:%dpt(%dtwips)\n", +//PRINTF(" About to move to fontsize:%dpt(%dtwips)\n", //NSTwipsToFloorIntPoints(smallestFontSize), smallestFontSize); if (smallestFontSize < scriptminsize) { // don't bother doing any work -//printf("..... stopping ......\n"); +//PRINTF(("..... stopping ......\n")); // XXX there should be a mechanism so that we never try this subtree again break; } @@ -1365,11 +1370,11 @@ nsMathMLContainerFrame::ReflowTokenFor(nsIFrame* aFrame, nsIFrame* targetFrame; aReflowState.reflowCommand->GetTarget(targetFrame); #ifdef MATHML_NOISY_INCREMENTAL_REFLOW -printf("nsMathMLContainerFrame::ReflowTokenFor:IncrementalReflow received by: "); + PRINTF("nsMathMLContainerFrame::ReflowTokenFor:IncrementalReflow received by: "); nsFrame::ListTag(stdout, aFrame); -printf("for target: "); + PRINTF("for target: "); nsFrame::ListTag(stdout, targetFrame); -printf("\n"); + PRINTF("\n"); #endif if (aFrame == targetFrame) { } @@ -1525,11 +1530,11 @@ nsMathMLContainerFrame::Reflow(nsIPresContext* aPresContext, nsIFrame* targetFrame; aReflowState.reflowCommand->GetTarget(targetFrame); #ifdef MATHML_NOISY_INCREMENTAL_REFLOW -printf("nsMathMLContainerFrame::Reflow:IncrementalReflow received by: "); + PRINTF("nsMathMLContainerFrame::Reflow:IncrementalReflow received by: "); nsFrame::ListTag(stdout, this); -printf("for target: "); + PRINTF("for target: "); nsFrame::ListTag(stdout, targetFrame); -printf("\n"); + PRINTF("\n"); #endif if (this == targetFrame) { // XXX We are the target of the incremental reflow. @@ -1752,11 +1757,11 @@ nsMathMLWrapperFrame::Reflow(nsIPresContext* aPresContext, nsIFrame* targetFrame; aReflowState.reflowCommand->GetTarget(targetFrame); #ifdef MATHML_NOISY_INCREMENTAL_REFLOW -printf("nsMathMLWrapperFrame::Reflow:IncrementalReflow received by: "); + PRINTF("nsMathMLWrapperFrame::Reflow:IncrementalReflow received by: "); nsFrame::ListTag(stdout, this); -printf("for target: "); + PRINTF("for target: "); nsFrame::ListTag(stdout, targetFrame); -printf("\n"); + PRINTF("\n"); #endif if (this == targetFrame) { } diff --git a/mozilla/layout/mathml/base/src/nsMathMLmactionFrame.cpp b/mozilla/layout/mathml/base/src/nsMathMLmactionFrame.cpp index e016ce2ed05..f1d12ab93d6 100644 --- a/mozilla/layout/mathml/base/src/nsMathMLmactionFrame.cpp +++ b/mozilla/layout/mathml/base/src/nsMathMLmactionFrame.cpp @@ -49,6 +49,11 @@ #include "nsIDOMMouseListener.h" #include "nsMathMLmactionFrame.h" +#include "nslog.h" + +NS_IMPL_LOG(nsMathMLmactionFrameLog) +#define PRINTF NS_LOG_PRINTF(nsMathMLmactionFrameLog) +#define FLUSH NS_LOG_FLUSH(nsMathMLmactionFrameLog) // // -- bind actions to a subexpression - implementation @@ -98,7 +103,7 @@ nsMathMLmactionFrame::nsMathMLmactionFrame() nsMathMLmactionFrame::~nsMathMLmactionFrame() { // unregister us as a mouse event listener ... -// printf("maction:%p unregistering as mouse event listener ...\n", this); +// PRINTF("maction:%p unregistering as mouse event listener ...\n", this); nsCOMPtr receiver(do_QueryInterface(mContent)); receiver->RemoveEventListenerByIID(this, NS_GET_IID(nsIDOMMouseListener)); } @@ -263,7 +268,7 @@ nsMathMLmactionFrame::SetInitialChildList(nsIPresContext* aPresContext, GetSelectedFrame(); // register us as a mouse event listener ... -// printf("maction:%p registering as mouse event listener ...\n", this); +// PRINTF("maction:%p registering as mouse event listener ...\n", this); nsCOMPtr receiver(do_QueryInterface(mContent)); receiver->AddEventListenerByIID(this, NS_GET_IID(nsIDOMMouseListener)); diff --git a/mozilla/layout/mathml/base/src/nsMathMLmactionFrame.h b/mozilla/layout/mathml/base/src/nsMathMLmactionFrame.h index 7e56b01956d..efb12f1ef61 100644 --- a/mozilla/layout/mathml/base/src/nsMathMLmactionFrame.h +++ b/mozilla/layout/mathml/base/src/nsMathMLmactionFrame.h @@ -24,6 +24,11 @@ #include "nsCOMPtr.h" #include "nsMathMLContainerFrame.h" +#include "nslog.h" + +NS_IMPL_LOG(nsMathMLmactionFrameLog) +#define PRINTF NS_LOG_PRINTF(nsMathMLmactionFrameLog) +#define FLUSH NS_LOG_FLUSH(nsMathMLmactionFrameLog) // // -- bind actions to a subexpression @@ -32,7 +37,7 @@ //#define DEBUG_mouse 1 #if DEBUG_mouse -#define MOUSE(_msg) printf("maction:%p MOUSE: "#_msg" ...\n", this); +#define MOUSE(_msg) PRINTF("maction:%p MOUSE: "#_msg" ...\n", this); #else #define MOUSE(_msg) #endif diff --git a/mozilla/layout/mathml/base/src/nsMathMLmfracFrame.cpp b/mozilla/layout/mathml/base/src/nsMathMLmfracFrame.cpp index 0413c26cf84..646b7a4aa85 100644 --- a/mozilla/layout/mathml/base/src/nsMathMLmfracFrame.cpp +++ b/mozilla/layout/mathml/base/src/nsMathMLmfracFrame.cpp @@ -39,6 +39,11 @@ #include "nsStyleUtil.h" #include "nsMathMLmfracFrame.h" +#include "nslog.h" + +NS_IMPL_LOG(nsMathMLmfracFrameLog) +#define PRINTF NS_LOG_PRINTF(nsMathMLmfracFrameLog) +#define FLUSH NS_LOG_FLUSH(nsMathMLmfracFrameLog) // // -- form a fraction from two subexpressions - implementation @@ -147,7 +152,7 @@ nsMathMLmfracFrame::CalcLineThickness(nsIPresContext* aPresContext, else { char str[50]; aThicknessAttribute.ToCString(str, 50); - printf("Invalid attribute linethickness=%s\n", str); + PRINTF("Invalid attribute linethickness=%s\n", str); } #endif } @@ -269,7 +274,7 @@ nsMathMLmfracFrame::Place(nsIPresContext* aPresContext, rv = childFrame->GetNextSibling(&childFrame); } #ifdef NS_DEBUG - if (2 != count) printf("mfrac: invalid markup"); + if (2 != count) PRINTF("mfrac: invalid markup"); #endif if ((2 != count) || !frameNum || !frameDen) { // report an error, encourage people to get their markups in order diff --git a/mozilla/layout/mathml/base/src/nsMathMLmoFrame.cpp b/mozilla/layout/mathml/base/src/nsMathMLmoFrame.cpp index fe4be92e9aa..fbbd3731774 100644 --- a/mozilla/layout/mathml/base/src/nsMathMLmoFrame.cpp +++ b/mozilla/layout/mathml/base/src/nsMathMLmoFrame.cpp @@ -41,6 +41,11 @@ #include "nsIDOMText.h" #include "nsMathMLmoFrame.h" +#include "nslog.h" + +NS_IMPL_LOG(nsMathMLmoFrameLog) +#define PRINTF NS_LOG_PRINTF(nsMathMLmoFrameLog) +#define FLUSH NS_LOG_FLUSH(nsMathMLmoFrameLog) // // -- operator, fence, or separator - implementation @@ -594,7 +599,7 @@ nsMathMLmoFrame::Stretch(nsIPresContext* aPresContext, nsHTMLReflowMetrics& aDesiredStretchSize) { if (NS_MATHML_STRETCH_WAS_DONE(mEmbellishData.flags)) { - printf("WARNING *** it is wrong to fire stretch more than once on a frame...\n"); + PRINTF("WARNING *** it is wrong to fire stretch more than once on a frame...\n"); return NS_OK; } mEmbellishData.flags |= NS_MATHML_STRETCH_DONE; diff --git a/mozilla/layout/mathml/base/src/nsMathMLmoverFrame.cpp b/mozilla/layout/mathml/base/src/nsMathMLmoverFrame.cpp index 77d9c6784a8..bb90e523058 100644 --- a/mozilla/layout/mathml/base/src/nsMathMLmoverFrame.cpp +++ b/mozilla/layout/mathml/base/src/nsMathMLmoverFrame.cpp @@ -40,6 +40,11 @@ #include "nsStyleUtil.h" #include "nsMathMLmoverFrame.h" +#include "nslog.h" + +NS_IMPL_LOG(nsMathMLmoverFrameLog) +#define PRINTF NS_LOG_PRINTF(nsMathMLmoverFrameLog) +#define FLUSH NS_LOG_FLUSH(nsMathMLmoverFrameLog) // // -- attach an overscript to a base - implementation @@ -262,7 +267,7 @@ nsMathMLmoverFrame::Place(nsIPresContext* aPresContext, } if ((2 != count) || !baseFrame || !overFrame) { #ifdef NS_DEBUG - printf("mover: invalid markup"); + PRINTF("mover: invalid markup"); #endif // report an error, encourage people to get their markups in order return ReflowError(aPresContext, aRenderingContext, aDesiredSize); diff --git a/mozilla/layout/mathml/base/src/nsMathMLmpaddedFrame.cpp b/mozilla/layout/mathml/base/src/nsMathMLmpaddedFrame.cpp index f7d3236291b..f86e0db441b 100644 --- a/mozilla/layout/mathml/base/src/nsMathMLmpaddedFrame.cpp +++ b/mozilla/layout/mathml/base/src/nsMathMLmpaddedFrame.cpp @@ -40,6 +40,11 @@ #include "nsMathMLmpaddedFrame.h" #include "xp_str.h" // to get XP_IS_SPACE +#include "nslog.h" + +NS_IMPL_LOG(nsMathMLmpaddedFrameLog) +#define PRINTF NS_LOG_PRINTF(nsMathMLmpaddedFrameLog) +#define FLUSH NS_LOG_FLUSH(nsMathMLmpaddedFrameLog) // // -- adjust space around content - implementation @@ -193,7 +198,7 @@ nsMathMLmpaddedFrame::ParseAttribute(nsString& aString, #ifdef NS_DEBUG char str[50]; aString.ToCString(str, 50); - printf("mpadded: attribute with bad numeric value: %s\n", str); + PRINTF("mpadded: attribute with bad numeric value: %s\n", str); #endif aSign = NS_MATHML_SIGN_INVALID; return PR_FALSE; @@ -221,7 +226,7 @@ nsMathMLmpaddedFrame::ParseAttribute(nsString& aString, #ifdef NS_DEBUG char str[50]; aString.ToCString(str, 50); - printf("mpadded: attribute with bad numeric value: %s\n", str); + PRINTF("mpadded: attribute with bad numeric value: %s\n", str); #endif aCSSValue.Reset(); aSign = NS_MATHML_SIGN_INVALID; @@ -276,7 +281,7 @@ nsMathMLmpaddedFrame::ParseAttribute(nsString& aString, #ifdef NS_DEBUG char str[50]; aString.ToCString(str, 50); - printf("mpadded: attribute with bad numeric value: %s\n", str); + PRINTF("mpadded: attribute with bad numeric value: %s\n", str); #endif aCSSValue.Reset(); aSign = NS_MATHML_SIGN_INVALID; diff --git a/mozilla/layout/mathml/base/src/nsMathMLmrootFrame.cpp b/mozilla/layout/mathml/base/src/nsMathMLmrootFrame.cpp index f1bc87d36de..db13fa35283 100644 --- a/mozilla/layout/mathml/base/src/nsMathMLmrootFrame.cpp +++ b/mozilla/layout/mathml/base/src/nsMathMLmrootFrame.cpp @@ -40,6 +40,11 @@ #include "nsStyleUtil.h" #include "nsMathMLmrootFrame.h" +#include "nslog.h" + +NS_IMPL_LOG(nsMathMLmrootFrameLog) +#define PRINTF NS_LOG_PRINTF(nsMathMLmrootFrameLog) +#define FLUSH NS_LOG_FLUSH(nsMathMLmrootFrameLog) // // and -- form a radical - implementation @@ -214,7 +219,7 @@ nsMathMLmrootFrame::Reflow(nsIPresContext* aPresContext, } if ((2 != count) || !baseFrame || !indexFrame) { #ifdef NS_DEBUG - printf("mroot: invalid markup"); + PRINTF("mroot: invalid markup"); #endif // report an error, encourage people to get their markups in order return ReflowError(aPresContext, renderingContext, aDesiredSize); diff --git a/mozilla/layout/mathml/base/src/nsMathMLmsubFrame.cpp b/mozilla/layout/mathml/base/src/nsMathMLmsubFrame.cpp index 34a993a5df9..11174ed3e27 100644 --- a/mozilla/layout/mathml/base/src/nsMathMLmsubFrame.cpp +++ b/mozilla/layout/mathml/base/src/nsMathMLmsubFrame.cpp @@ -39,6 +39,11 @@ #include "nsStyleUtil.h" #include "nsMathMLmsubFrame.h" +#include "nslog.h" + +NS_IMPL_LOG(nsMathMLmsubFrameLog) +#define PRINTF NS_LOG_PRINTF(nsMathMLmsubFrameLog) +#define FLUSH NS_LOG_FLUSH(nsMathMLmsubFrameLog) // // -- attach a subscript to a base - implementation @@ -142,7 +147,7 @@ nsMathMLmsubFrame::Place(nsIPresContext* aPresContext, NS_ASSERTION(NS_SUCCEEDED(rv),"failed to get next child"); } #ifdef NS_DEBUG - if (2 != count) printf("msub: invalid markup"); + if (2 != count) PRINTF("msub: invalid markup"); #endif if ((2 != count) || !baseFrame || !subScriptFrame) { // report an error, encourage people to get their markups in order diff --git a/mozilla/layout/mathml/base/src/nsMathMLmsubsupFrame.cpp b/mozilla/layout/mathml/base/src/nsMathMLmsubsupFrame.cpp index a47d888ecf9..e445ed937dd 100644 --- a/mozilla/layout/mathml/base/src/nsMathMLmsubsupFrame.cpp +++ b/mozilla/layout/mathml/base/src/nsMathMLmsubsupFrame.cpp @@ -39,6 +39,11 @@ #include "nsStyleUtil.h" #include "nsMathMLmsubsupFrame.h" +#include "nslog.h" + +NS_IMPL_LOG(nsMathMLmsubsupFrameLog) +#define PRINTF NS_LOG_PRINTF(nsMathMLmsubsupFrameLog) +#define FLUSH NS_LOG_FLUSH(nsMathMLmsubsupFrameLog) // // -- attach a subscript-superscript pair to a base - implementation @@ -165,7 +170,7 @@ nsMathMLmsubsupFrame::Place(nsIPresContext* aPresContext, NS_ASSERTION(NS_SUCCEEDED(rv),"failed to get next child"); } #ifdef NS_DEBUG - if (3 != count) printf("msubsup: invalid markup"); + if (3 != count) PRINTF("msubsup: invalid markup"); #endif if ((3 != count) || !baseFrame || !subScriptFrame || !supScriptFrame) { // report an error, encourage people to get their markups in order diff --git a/mozilla/layout/mathml/base/src/nsMathMLmsupFrame.cpp b/mozilla/layout/mathml/base/src/nsMathMLmsupFrame.cpp index 1798e09de99..ad3b01f3a90 100644 --- a/mozilla/layout/mathml/base/src/nsMathMLmsupFrame.cpp +++ b/mozilla/layout/mathml/base/src/nsMathMLmsupFrame.cpp @@ -38,6 +38,11 @@ #include "nsStyleUtil.h" #include "nsMathMLmsupFrame.h" +#include "nslog.h" + +NS_IMPL_LOG(nsMathMLmsupFrameLog) +#define PRINTF NS_LOG_PRINTF(nsMathMLmsupFrameLog) +#define FLUSH NS_LOG_FLUSH(nsMathMLmsupFrameLog) // // -- attach a superscript to a base - implementation @@ -142,7 +147,7 @@ nsMathMLmsupFrame::Place(nsIPresContext* aPresContext, NS_ASSERTION(NS_SUCCEEDED(rv),"failed to get next child"); } #ifdef NS_DEBUG - if (2 != count) printf("msup: invalid markup"); + if (2 != count) PRINTF("msup: invalid markup"); #endif if ((2 != count) || !baseFrame || !supScriptFrame) { // report an error, encourage people to get their markups in order diff --git a/mozilla/layout/mathml/base/src/nsMathMLmunderFrame.cpp b/mozilla/layout/mathml/base/src/nsMathMLmunderFrame.cpp index 3c8c7013f09..a23b50aad66 100644 --- a/mozilla/layout/mathml/base/src/nsMathMLmunderFrame.cpp +++ b/mozilla/layout/mathml/base/src/nsMathMLmunderFrame.cpp @@ -40,6 +40,11 @@ #include "nsStyleUtil.h" #include "nsMathMLmunderFrame.h" +#include "nslog.h" + +NS_IMPL_LOG(nsMathMLmunderFrameLog) +#define PRINTF NS_LOG_PRINTF(nsMathMLmunderFrameLog) +#define FLUSH NS_LOG_FLUSH(nsMathMLmunderFrameLog) // // -- attach an underscript to a base - implementation @@ -261,7 +266,7 @@ nsMathMLmunderFrame::Place(nsIPresContext* aPresContext, } if ((2 != count) || !baseFrame || !underFrame) { #ifdef NS_DEBUG - printf("munder: invalid markup"); + PRINTF("munder: invalid markup"); #endif // report an error, encourage people to get their markups in order return ReflowError(aPresContext, aRenderingContext, aDesiredSize); diff --git a/mozilla/layout/mathml/base/src/nsMathMLmunderoverFrame.cpp b/mozilla/layout/mathml/base/src/nsMathMLmunderoverFrame.cpp index 1811d9f2417..18de1297469 100644 --- a/mozilla/layout/mathml/base/src/nsMathMLmunderoverFrame.cpp +++ b/mozilla/layout/mathml/base/src/nsMathMLmunderoverFrame.cpp @@ -40,6 +40,11 @@ #include "nsStyleUtil.h" #include "nsMathMLmunderoverFrame.h" +#include "nslog.h" + +NS_IMPL_LOG(nsMathMLmunderoverFrameLog) +#define PRINTF NS_LOG_PRINTF(nsMathMLmunderoverFrameLog) +#define FLUSH NS_LOG_FLUSH(nsMathMLmunderoverFrameLog) // // -- attach an underscript-overscript pair to a base - implementation @@ -303,7 +308,7 @@ nsMathMLmunderoverFrame::Place(nsIPresContext* aPresContext, } if ((3 != count) || !baseFrame || !underFrame || !overFrame) { #ifdef NS_DEBUG - printf("munderover: invalid markup\n"); + PRINTF("munderover: invalid markup\n"); #endif // report an error, encourage people to get their markups in order return ReflowError(aPresContext, aRenderingContext, aDesiredSize); diff --git a/mozilla/layout/mathml/content/src/nsMathMLOperators.cpp b/mozilla/layout/mathml/content/src/nsMathMLOperators.cpp index ab69a0bfa68..e248cce4c0e 100644 --- a/mozilla/layout/mathml/content/src/nsMathMLOperators.cpp +++ b/mozilla/layout/mathml/content/src/nsMathMLOperators.cpp @@ -30,6 +30,11 @@ #include "nsMathMLOperatorList.h" #undef WANT_MATHML_OPERATOR_COUNT +#include "nslog.h" + +NS_IMPL_LOG(nsMathMLOperatorsLog) +#define PRINTF NS_LOG_PRINTF(nsMathMLOperatorsLog) +#define FLUSH NS_LOG_FLUSH(nsMathMLOperatorsLog) // define a zero-separated linear array of all MathML Operators in Unicode const PRUnichar kMathMLOperator[] = { @@ -267,9 +272,9 @@ void DEBUG_PrintString(const nsString aString) for (PRInt32 i = 0; i +#include "nslog.h" + +NS_IMPL_LOG(nsCSSLoaderLog) +#define PRINTF NS_LOG_PRINTF(nsCSSLoaderLog) +#define FLUSH NS_LOG_FLUSH(nsCSSLoaderLog) + static NS_DEFINE_IID(kICSSLoaderIID, NS_ICSS_LOADER_IID); //static NS_DEFINE_IID(kICSSParserIID, NS_ICSS_PARSER_IID); //static NS_DEFINE_IID(kICSSStyleSheetIID, NS_ICSS_STYLE_SHEET_IID); @@ -922,10 +928,8 @@ CSSLoaderImpl::DidLoadStyle(nsIStreamLoader* aLoader, // Dump error message to console. char *url; aLoadData->mURL->GetSpec(&url); -#ifdef DEBUG - cerr << "CSSLoaderImpl::DidLoadStyle: Load of URL '" << url - << "' failed. Error code: " << NS_ERROR_GET_CODE(aStatus) << "\n"; -#endif + PRINTF("CSSLoaderImpl::DidLoadStyle: Load of URL '%s' failed. Error code: %x\n", + url, aStatus); nsCRT::free(url); } @@ -1198,10 +1202,8 @@ CSSLoaderImpl::LoadSheet(URLKey& aKey, SheetLoadData* aData) // Dump an error message to the console char *url; aKey.mURL->GetSpec(&url); -#ifdef DEBUG - cerr << "CSSLoaderImpl::LoadSheet: Load of URL '" << url - << "' failed. Error code: " << NS_ERROR_GET_CODE(result) << "\n"; -#endif + PRINTF("CSSLoaderImpl::LoadSheet: Load of URL '%s' failed. Error code: %x\n", + url, result); nsCRT::free(url); } } @@ -1531,10 +1533,8 @@ CSSLoaderImpl::LoadAgentSheet(nsIURI* aURL, // Dump an error message to the console char *url; aURL->GetSpec(&url); -#ifdef DEBUG - cerr << "CSSLoaderImpl::LoadAgentSheet: Load of URL '" << url - << "' failed. Error code: " << NS_ERROR_GET_CODE(result) << "\n"; -#endif + PRINTF("CSSLoaderImpl::LoadAgentSheet: Load of URL '%s' failed. Error code: %x\n", + url, result); nsCRT::free(url); } } diff --git a/mozilla/layout/style/nsCSSScanner.cpp b/mozilla/layout/style/nsCSSScanner.cpp index 0c1e5a9171b..76b39ec58ad 100644 --- a/mozilla/layout/style/nsCSSScanner.cpp +++ b/mozilla/layout/style/nsCSSScanner.cpp @@ -24,6 +24,11 @@ #include "nsIUnicharInputStream.h" #include "nsString.h" #include "nsCRT.h" +#include "nslog.h" + +NS_IMPL_LOG(nsCSSScannerLog) +#define PRINTF NS_LOG_PRINTF(nsCSSScannerLog) +#define FLUSH NS_LOG_FLUSH(nsCSSScannerLog) #ifdef NS_DEBUG static char* kNullPointer = "null pointer"; @@ -215,7 +220,7 @@ void nsCSSScanner::InitErrorReporting(nsIURI* aURI) void nsCSSScanner::ReportError(const nsAReadableString& aError) { - printf("CSS Error (%s :%u.%u): %s.\n", + PRINTF("CSS Error (%s :%u.%u): %s.\n", mFileName.get(), mLineNumber, mColNumber, @@ -287,7 +292,7 @@ PRInt32 nsCSSScanner::Read(PRInt32& aErrorCode) #endif } mLastRead = rv; -//printf("Read => %x\n", rv); +//PRINTF("Read => %x\n", rv); return rv; } @@ -301,7 +306,7 @@ PRInt32 nsCSSScanner::Peek(PRInt32& aErrorCode) mPushback[0] = PRUnichar(ch); mPushbackCount++; } -//printf("Peek => %x\n", mLookAhead); +//PRINTF("Peek => %x\n", mLookAhead); return PRInt32(mPushback[mPushbackCount - 1]); } diff --git a/mozilla/layout/style/nsCSSStruct.cpp b/mozilla/layout/style/nsCSSStruct.cpp index 395e9339987..cbef66fd3d4 100644 --- a/mozilla/layout/style/nsCSSStruct.cpp +++ b/mozilla/layout/style/nsCSSStruct.cpp @@ -31,6 +31,11 @@ #include "nsCOMPtr.h" #include "nsIStyleSet.h" #include "nsISizeOfHandler.h" +#include "nslog.h" + +NS_IMPL_LOG(nsCSSDeclarationLog) +#define PRINTF NS_LOG_PRINTF(nsCSSDeclarationLog) +#define FLUSH NS_LOG_FLUSH(nsCSSDeclarationLog) // #define DEBUG_REFS @@ -1062,7 +1067,7 @@ CSSDeclarationImpl::CSSDeclarationImpl(void) NS_INIT_REFCNT(); #ifdef DEBUG_REFS ++gInstanceCount; - fprintf(stdout, "CSSDeclaration Instances (ctor): %ld\n", (long)gInstanceCount); + FPRINTF(stdout, "CSSDeclaration Instances (ctor): %ld\n", (long)gInstanceCount); #endif } @@ -1088,7 +1093,7 @@ CSSDeclarationImpl::CSSDeclarationImpl(const CSSDeclarationImpl& aCopy) #ifdef DEBUG_REFS ++gInstanceCount; - fprintf(stdout, "CSSDeclaration Instances (cp-ctor): %ld\n", (long)gInstanceCount); + FPRINTF(stdout, "CSSDeclaration Instances (cp-ctor): %ld\n", (long)gInstanceCount); #endif if (aCopy.mImportant) { @@ -1134,7 +1139,7 @@ CSSDeclarationImpl::~CSSDeclarationImpl(void) #ifdef DEBUG_REFS --gInstanceCount; - fprintf(stdout, "CSSDeclaration Instances (dtor): %ld\n", (long)gInstanceCount); + FPRINTF(stdout, "CSSDeclaration Instances (dtor): %ld\n", (long)gInstanceCount); #endif } diff --git a/mozilla/layout/style/nsCSSStyleRule.cpp b/mozilla/layout/style/nsCSSStyleRule.cpp index 0fd73f6c51e..92e56e9a7a5 100644 --- a/mozilla/layout/style/nsCSSStyleRule.cpp +++ b/mozilla/layout/style/nsCSSStyleRule.cpp @@ -54,12 +54,17 @@ #include "nsIStyleSet.h" #include "nsISizeOfHandler.h" - // MJA: bug 31816 #include "nsIPresShell.h" #include "nsIDocShellTreeItem.h" // - END MJA +#include "nslog.h" + +NS_IMPL_LOG(nsCSSStyleRuleLog) +#define PRINTF NS_LOG_PRINTF(nsCSSStyleRuleLog) +#define FLUSH NS_LOG_FLUSH(nsCSSStyleRuleLog) + // #define DEBUG_REFS static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); @@ -164,7 +169,7 @@ nsAttrSelector::nsAttrSelector(PRInt32 aNameSpace, const nsString& aAttr) #ifdef DEBUG_REFS gAttrSelectorCount++; - printf( "nsAttrSelector Instances (ctor): %ld\n", (long)gAttrSelectorCount); + PRINTF( "nsAttrSelector Instances (ctor): %ld\n", (long)gAttrSelectorCount); #endif mAttr = NS_NewAtom(aAttr); @@ -183,7 +188,7 @@ nsAttrSelector::nsAttrSelector(PRInt32 aNameSpace, const nsString& aAttr, PRUint #ifdef DEBUG_REFS gAttrSelectorCount++; - printf( "nsAttrSelector Instances (ctor): %ld\n", (long)gAttrSelectorCount); + PRINTF( "nsAttrSelector Instances (ctor): %ld\n", (long)gAttrSelectorCount); #endif mAttr = NS_NewAtom(aAttr); @@ -201,7 +206,7 @@ nsAttrSelector::nsAttrSelector(const nsAttrSelector& aCopy) #ifdef DEBUG_REFS gAttrSelectorCount++; - printf( "nsAttrSelector Instances (cp-ctor): %ld\n", (long)gAttrSelectorCount); + PRINTF( "nsAttrSelector Instances (cp-ctor): %ld\n", (long)gAttrSelectorCount); #endif NS_IF_ADDREF(mAttr); @@ -214,7 +219,7 @@ nsAttrSelector::~nsAttrSelector(void) #ifdef DEBUG_REFS gAttrSelectorCount--; - printf( "nsAttrSelector Instances (dtor): %ld\n", (long)gAttrSelectorCount); + PRINTF( "nsAttrSelector Instances (dtor): %ld\n", (long)gAttrSelectorCount); #endif NS_IF_RELEASE(mAttr); @@ -304,7 +309,7 @@ nsCSSSelector::nsCSSSelector(void) #ifdef DEBUG_REFS gSelectorCount++; - printf( "nsCSSSelector Instances (ctor): %ld\n", (long)gSelectorCount); + PRINTF( "nsCSSSelector Instances (ctor): %ld\n", (long)gSelectorCount); #endif } @@ -326,7 +331,7 @@ nsCSSSelector::nsCSSSelector(const nsCSSSelector& aCopy) #ifdef DEBUG_REFS gSelectorCount++; - printf( "nsCSSSelector Instances (cp-ctor): %ld\n", (long)gSelectorCount); + PRINTF( "nsCSSSelector Instances (cp-ctor): %ld\n", (long)gSelectorCount); #endif } @@ -337,7 +342,7 @@ nsCSSSelector::~nsCSSSelector(void) #ifdef DEBUG_REFS gSelectorCount--; - printf( "nsCSSSelector Instances (dtor): %ld\n", (long)gSelectorCount); + PRINTF( "nsCSSSelector Instances (dtor): %ld\n", (long)gSelectorCount); #endif } @@ -1080,7 +1085,7 @@ CSSStyleRuleImpl::CSSStyleRuleImpl(const nsCSSSelector& aSelector) { #ifdef DEBUG_REFS gStyleRuleCount++; - printf( "CSSStyleRuleImpl Instances (ctor): %ld\n", (long)gStyleRuleCount); + PRINTF( "CSSStyleRuleImpl Instances (ctor): %ld\n", (long)gStyleRuleCount); #endif } @@ -1095,7 +1100,7 @@ CSSStyleRuleImpl::CSSStyleRuleImpl(const CSSStyleRuleImpl& aCopy) { #ifdef DEBUG_REFS gStyleRuleCount++; - printf( "CSSStyleRuleImpl Instances (cp-ctor): %ld\n", (long)gStyleRuleCount); + PRINTF( "CSSStyleRuleImpl Instances (cp-ctor): %ld\n", (long)gStyleRuleCount); #endif nsCSSSelector* copySel = aCopy.mSelector.mNext; @@ -1118,7 +1123,7 @@ CSSStyleRuleImpl::~CSSStyleRuleImpl(void) { #ifdef DEBUG_REFS gStyleRuleCount--; - printf( "CSSStyleRuleImpl Instances (dtor): %ld\n", (long)gStyleRuleCount); + PRINTF( "CSSStyleRuleImpl Instances (dtor): %ld\n", (long)gStyleRuleCount); #endif nsCSSSelector* next = mSelector.mNext; diff --git a/mozilla/layout/style/nsCSSStyleSheet.cpp b/mozilla/layout/style/nsCSSStyleSheet.cpp index 2f0d70b0b1c..0e8f57c2bc8 100644 --- a/mozilla/layout/style/nsCSSStyleSheet.cpp +++ b/mozilla/layout/style/nsCSSStyleSheet.cpp @@ -66,6 +66,11 @@ #include "nsIStyleSet.h" #include "nsISizeOfHandler.h" #include "nsStyleUtil.h" +#include "nslog.h" + +NS_IMPL_LOG(nsCSSStyleSheetLog) +#define PRINTF NS_LOG_PRINTF(nsCSSStyleSheetLog) +#define FLUSH NS_LOG_FLUSH(nsCSSStyleSheetLog) //#define DEBUG_RULES //#define EVENT_DEBUG @@ -1975,7 +1980,7 @@ CSSStyleSheetImpl::CheckRuleForAttributes(nsICSSRule *aRule) nsAutoString str; sel->mAttr->ToString(str); char * chars = str.ToNewCString(); - fprintf(stderr, "[%s@%p]", chars, this); + FPRINTF(stderr, "[%s@%p]", chars, this); nsMemory::Free(chars); #endif AtomKey key(sel->mAttr); @@ -3008,7 +3013,7 @@ static PRBool SelectorMatches(nsIPresContext* aPresContext, if (contentTag) { contentTag->ToString(strTag); } - printf("Tag: %s PseudoClass: %s EventState: %d\n", + PRINTF("Tag: %s PseudoClass: %s EventState: %d\n", strTag.ToNewCString(), strPseudo.ToNewCString(), (int)eventState); #endif } diff --git a/mozilla/layout/style/nsStyleContext.cpp b/mozilla/layout/style/nsStyleContext.cpp index 978f19add2c..43c6dfd18fe 100644 --- a/mozilla/layout/style/nsStyleContext.cpp +++ b/mozilla/layout/style/nsStyleContext.cpp @@ -49,6 +49,16 @@ #include "nsIStyleSet.h" #include "nsISizeOfHandler.h" #include "nsIPresShell.h" +#include "nslog.h" +#undef fprintf + +#ifdef NOISY_DEBUG +NS_IMPL_LOG_ENABLED(nsStyleContextLog) +#else +NS_IMPL_LOG(nsStyleContextLog) +#endif +#define PRINTF NS_LOG_PRINTF(nsStyleContextLog) +#define FLUSH NS_LOG_FLUSH(nsStyleContextLog) static NS_DEFINE_IID(kIStyleContextIID, NS_ISTYLECONTEXT_IID); @@ -2021,9 +2031,7 @@ PRUint32 nsStyleContextData::Release(void) --mRefCnt; NS_LOG_RELEASE(this,mRefCnt,"nsStyleContextData"); if (0 == mRefCnt) { -#ifdef NOISY_DEBUG - printf("deleting nsStyleContextData instance: (%ld)\n", (long)(--gInstanceCount)); -#endif + PRINTF("deleting nsStyleContextData instance: (%ld)\n", (long)(--gInstanceCount)); delete this; return 0; } @@ -2042,10 +2050,8 @@ nsStyleContextData *nsStyleContextData::Create(nsIPresContext *aPresContext) pData = new nsStyleContextData(aPresContext); if (pData) { NS_ADDREF(pData); -#ifdef NOISY_DEBUG - printf("new nsStyleContextData instance: (%ld) CRC=%lu\n", + PRINTF("new nsStyleContextData instance: (%ld) CRC=%lu\n", (long)(++gInstanceCount), (unsigned long)pData->ComputeCRC32(0)); -#endif // NOISY_DEBUG } } return pData; @@ -2907,14 +2913,10 @@ StyleContextImpl::RemapStyle(nsIPresContext* aPresContext, PRBool aRecurse) if ((NS_SUCCEEDED(mStyleSet->FindMatchingContext(this, &matchingSC))) && (nsnull != matchingSC)) { ShareStyleDataFrom(matchingSC); -#ifdef NOISY_DEBUG - printf("SC Data Shared :)\n"); -#endif + PRINTF("SC Data Shared :)\n"); NS_IF_RELEASE(matchingSC); } else { -#ifdef NOISY_DEBUG - printf("Unique SC Data - Not Shared :(\n"); -#endif + PRINTF("Unique SC Data - Not Shared :(\n"); } } // if(bDisableSharing==false) @@ -3130,7 +3132,7 @@ StyleContextImpl::StyleDataMatches(nsIStyleContext* aStyleContextToMatch, #ifdef DEBUG if (hint > 0) { gFalsePos++; - // printf("CRC match but CalcStyleDifference shows differences: crc is not sufficient?"); + // PRINTF("CRC match but CalcStyleDifference shows differences: crc is not sufficient?"); } #endif *aMatches = (0 == hint) ? PR_TRUE : PR_FALSE; @@ -3148,7 +3150,7 @@ StyleContextImpl::StyleDataMatches(nsIStyleContext* aStyleContextToMatch, NS_ASSERTION(hint>0,"!!!FALSE-NEGATIVE in StyleMatchesData!!!"); */ } - // printf("False-Pos: %ld - Screened: %ld\n", gFalsePos, gScreenedByCRC); + // PRINTF("False-Pos: %ld - Screened: %ld\n", gFalsePos, gScreenedByCRC); #endif } return rv; @@ -3249,32 +3251,32 @@ void StyleContextImpl::SizeOf(nsISizeOfHandler *aSizeOfHandler, PRUint32 &aSize) bDetailDumpDone = PR_TRUE; PRUint32 totalSize=0; - printf( "Detailed StyleContextImpl dump: basic class sizes of members\n" ); - printf( "*************************************\n"); - printf( " - StyleFontImpl: %ld\n", (long)sizeof(GETSCDATA(Font)) ); + PRINTF( "Detailed StyleContextImpl dump: basic class sizes of members\n" ); + PRINTF( "*************************************\n"); + PRINTF( " - StyleFontImpl: %ld\n", (long)sizeof(GETSCDATA(Font)) ); totalSize += (long)sizeof(GETSCDATA(Font)); - printf( " - StyleColorImpl: %ld\n", (long)sizeof(GETSCDATA(Color)) ); + PRINTF( " - StyleColorImpl: %ld\n", (long)sizeof(GETSCDATA(Color)) ); totalSize += (long)sizeof(GETSCDATA(Color)); - printf( " - StyleSpacingImpl: %ld\n", (long)sizeof(GETSCDATA(Spacing)) ); + PRINTF( " - StyleSpacingImpl: %ld\n", (long)sizeof(GETSCDATA(Spacing)) ); totalSize += (long)sizeof(GETSCDATA(Spacing)); - printf( " - StyleListImpl: %ld\n", (long)sizeof(GETSCDATA(List)) ); + PRINTF( " - StyleListImpl: %ld\n", (long)sizeof(GETSCDATA(List)) ); totalSize += (long)sizeof(GETSCDATA(List)); - printf( " - StylePositionImpl: %ld\n", (long)sizeof(GETSCDATA(Position)) ); + PRINTF( " - StylePositionImpl: %ld\n", (long)sizeof(GETSCDATA(Position)) ); totalSize += (long)sizeof(GETSCDATA(Position)); - printf( " - StyleTextImpl: %ld\n", (long)sizeof(GETSCDATA(Text)) ); + PRINTF( " - StyleTextImpl: %ld\n", (long)sizeof(GETSCDATA(Text)) ); totalSize += (long)sizeof(GETSCDATA(Text)); - printf( " - StyleDisplayImpl: %ld\n", (long)sizeof(GETSCDATA(Display)) ); + PRINTF( " - StyleDisplayImpl: %ld\n", (long)sizeof(GETSCDATA(Display)) ); totalSize += (long)sizeof(GETSCDATA(Display)); - printf( " - StyleTableImpl: %ld\n", (long)sizeof(GETSCDATA(Table)) ); + PRINTF( " - StyleTableImpl: %ld\n", (long)sizeof(GETSCDATA(Table)) ); totalSize += (long)sizeof(GETSCDATA(Table)); - printf( " - StyleContentImpl: %ld\n", (long)sizeof(GETSCDATA(Content)) ); + PRINTF( " - StyleContentImpl: %ld\n", (long)sizeof(GETSCDATA(Content)) ); totalSize += (long)sizeof(GETSCDATA(Content)); - printf( " - StyleUserInterfaceImpl: %ld\n", (long)sizeof(GETSCDATA(UserInterface)) ); + PRINTF( " - StyleUserInterfaceImpl: %ld\n", (long)sizeof(GETSCDATA(UserInterface)) ); totalSize += (long)sizeof(GETSCDATA(UserInterface)); - printf( " - StylePrintImpl: %ld\n", (long)sizeof(GETSCDATA(Print))); + PRINTF( " - StylePrintImpl: %ld\n", (long)sizeof(GETSCDATA(Print))); totalSize += (long)sizeof(GETSCDATA(Print)); - printf( " - Total: %ld\n", (long)totalSize); - printf( "*************************************\n"); + PRINTF( " - Total: %ld\n", (long)totalSize); + PRINTF( "*************************************\n"); } // first get the unique items collection diff --git a/mozilla/layout/style/nsStyleSet.cpp b/mozilla/layout/style/nsStyleSet.cpp index fd1cee1e16d..f1bfeff23ff 100644 --- a/mozilla/layout/style/nsStyleSet.cpp +++ b/mozilla/layout/style/nsStyleSet.cpp @@ -37,6 +37,11 @@ #include "nsICSSStyleSheet.h" #include "nsNetUtil.h" #include "nsIStyleRuleSupplier.h" +#include "nslog.h" + +NS_IMPL_LOG(nsStyleSetLog) +#define PRINTF NS_LOG_PRINTF(nsStyleSetLog) +#define FLUSH NS_LOG_FLUSH(nsStyleSetLog) #ifdef MOZ_PERF_METRICS #include "nsITimeRecorder.h" @@ -316,7 +321,7 @@ StyleSetImpl::~StyleSetImpl() #ifdef DEBUG NS_ASSERTION( mStyleContextCache.Count() == 0, "StyleContextCache is not empty in StyleSet destructor: style contexts are being leaked"); if (mStyleContextCache.Count() > 0) { - printf("*** Leaking %d style context instances (reported by the StyleContextCache) ***\n", mStyleContextCache.Count()); + PRINTF("*** Leaking %d style context instances (reported by the StyleContextCache) ***\n", mStyleContextCache.Count()); } #endif #endif @@ -677,9 +682,7 @@ NS_IMETHODIMP StyleSetImpl::EnableQuirkStyleSheet(PRBool aEnable) } } if (mQuirkStyleSheet) { -#ifdef DEBUG - printf( "%s Quirk StyleSheet\n", aEnable ? "Enabling" : "Disabling" ); -#endif + PRINTF( "%s Quirk StyleSheet\n", aEnable ? "Enabling" : "Disabling" ); mQuirkStyleSheet->SetEnabled(aEnable); } return rv; @@ -769,12 +772,12 @@ nsIStyleContext* StyleSetImpl::GetContext(nsIPresContext* aPresContext, aUsedRules = PRBool(nsnull != aRules); } #ifdef NOISY_DEBUG - fprintf(stdout, "+++ NewSC %d +++\n", ++gNewCount); + PRINTF("+++ NewSC %d +++\n", ++gNewCount); #endif } #ifdef NOISY_DEBUG else { - fprintf(stdout, "--- SharedSC %d ---\n", ++gSharedCount); + PRINTF("--- SharedSC %d ---\n", ++gSharedCount); } #endif @@ -1392,9 +1395,7 @@ StyleSetImpl::StartTimer(PRUint32 aTimerID) if (mTimerEnabled) { MOZ_TIMER_START(mStyleResolutionWatch); } else { -#ifdef NOISY_DEBUG - printf( "Attempt to start timer while disabled - ignoring\n" ); -#endif + PRINTF( "Attempt to start timer while disabled - ignoring\n" ); } } else @@ -1413,9 +1414,7 @@ StyleSetImpl::StopTimer(PRUint32 aTimerID) if (mTimerEnabled) { MOZ_TIMER_STOP(mStyleResolutionWatch); } else { -#ifdef NOISY_DEBUG - printf( "Attempt to stop timer while disabled - ignoring\n" ); -#endif + PRINTF( "Attempt to stop timer while disabled - ignoring\n" ); } } else @@ -1477,9 +1476,7 @@ PRUint32 StyleContextCache::Count(void) Tickle("From Count()"); #endif -#ifdef NOISY_DEBUG - printf("StyleContextCache count: %ld\n", (long)mCount); -#endif + PRINTF("StyleContextCache count: %ld\n", (long)mCount); return mCount; } @@ -1500,9 +1497,7 @@ nsresult StyleContextCache::AddContext(scKey aKey, nsIStyleContext *aContext) } DumpStats(); } else { -#ifdef DEBUG - printf( "Context already in list in StyleContextCache::AddContext\n"); -#endif + PRINTF( "Context already in list in StyleContextCache::AddContext\n"); rv = NS_ERROR_FAILURE; } } @@ -1528,11 +1523,9 @@ nsresult StyleContextCache::RemoveContext(scKey aKey, nsIStyleContext *aContext) if (NS_SUCCEEDED(rv)) { NS_ASSERTION(GetList(aKey) == nsnull, "Failed to delete list in StyleContextCache::RemoveContext"); } -#ifdef DEBUG else { - printf( "Error removing all contexts in StyleContextCache::RemoveContext\n"); + PRINTF( "Error removing all contexts in StyleContextCache::RemoveContext\n"); } -#endif } } return rv; @@ -1591,10 +1584,10 @@ PRBool HashTableEnumDump(nsHashKey *aKey, void *aData, void* closure) } if (nsnull == aKey && nsnull == aData && closure != nsnull) { // dump the cumulatives - printf("----------------------------------------------------------------------------------\n"); - printf("(%d lists, %ld contexts) List Lengths: Min=%ld Max=%ld Average=%ld Unary=%ld\n", + PRINTF("----------------------------------------------------------------------------------\n"); + PRINTF("(%d lists, %ld contexts) List Lengths: Min=%ld Max=%ld Average=%ld Unary=%ld\n", (int)nCount, (long)nTotal, (long)nMin, (long)nMax, (long)(nCount>0 ? nTotal/nCount : 0), (long)nUnary); - printf("----------------------------------------------------------------------------------\n"); + PRINTF("----------------------------------------------------------------------------------\n"); return PR_TRUE; } @@ -1602,7 +1595,7 @@ PRBool HashTableEnumDump(nsHashKey *aKey, void *aData, void* closure) nsVoidArray *pList = (nsVoidArray *)aData; if (pList) { PRUint32 count = pList->Count(); - printf("List Length at key %lu:\t%ld\n", + PRINTF("List Length at key %lu:\t%ld\n", (unsigned long)aKey->HashValue(), (long)count ); nCount++; @@ -1630,7 +1623,7 @@ PRBool HashTableEnumTickle(nsHashKey *aKey, void *aData, void* closure) if (pContext) { scKey key; pContext->GetStyleContextKey(key); - printf( "%p tickled\n"); + PRINTF( "%p tickled\n"); } } } @@ -1640,20 +1633,20 @@ PRBool HashTableEnumTickle(nsHashKey *aKey, void *aData, void* closure) void StyleContextCache::DumpStats(void) { #ifdef DUMP_CACHE_STATS - printf("StyleContextCache DumpStats BEGIN\n"); + PRINTF("StyleContextCache DumpStats BEGIN\n"); HashTableEnumDump(nsnull, nsnull, nsnull); mHashTable.Enumerate(HashTableEnumDump); HashTableEnumDump(nsnull, nsnull, "HACK!"); - printf("StyleContextCache DumpStats END\n"); + PRINTF("StyleContextCache DumpStats END\n"); #endif } void StyleContextCache::Tickle(const char *msg) { #ifdef DEBUG - printf("Tickling: %s\n", msg ? msg : ""); + PRINTF("Tickling: %s\n", msg ? msg : ""); mHashTable.Enumerate(HashTableEnumTickle); - printf("Tickle done.\n"); + PRINTF("Tickle done.\n"); #endif } @@ -1673,9 +1666,7 @@ StyleSetImpl::AddStyleContext(nsIStyleContext *aNewStyleContext) scKey key; aNewStyleContext->GetStyleContextKey(key); rv = mStyleContextCache.AddContext(key,aNewStyleContext); -#ifdef NOISY_DEBUG - printf( "StyleContextCount: %ld\n", (long)mStyleContextCache.Count()); -#endif + PRINTF( "StyleContextCount: %ld\n", (long)mStyleContextCache.Count()); } #else // DONT USE_FAST_CACHE @@ -1684,9 +1675,7 @@ StyleSetImpl::AddStyleContext(nsIStyleContext *aNewStyleContext) NS_ASSERTION((mStyleContextCache.IndexOf(aNewStyleContext) == -1), "StyleContext added in AddStyleContext is already in cache"); if (aNewStyleContext) { rv = mStyleContextCache.AppendElement(aNewStyleContext); -#ifdef NOISY_DEBUG - printf( "StyleContextCount: %ld\n", (long)mStyleContextCache.Count()); -#endif + PRINTF( "StyleContextCount: %ld\n", (long)mStyleContextCache.Count()); } #endif // USE_FAST_CACHE @@ -1708,9 +1697,7 @@ StyleSetImpl::RemoveStyleContext(nsIStyleContext *aNewStyleContext) scKey key; aNewStyleContext->GetStyleContextKey(key); rv = mStyleContextCache.RemoveContext(key,aNewStyleContext); -#ifdef NOISY_DEBUG - printf( "StyleContextCount: %ld\n", (long)mStyleContextCache.Count()); -#endif + PRINTF( "StyleContextCount: %ld\n", (long)mStyleContextCache.Count()); } #else //DONT USE_FAST_CACHE @@ -1719,9 +1706,7 @@ StyleSetImpl::RemoveStyleContext(nsIStyleContext *aNewStyleContext) NS_ASSERTION((mStyleContextCache.IndexOf(aNewStyleContext) != -1), "StyleContext removed in AddStyleContext is not in cache"); if (aNewStyleContext) { rv = mStyleContextCache.RemoveElement(aNewStyleContext); -#ifdef NOISY_DEBUG - printf( "StyleContextCount: %ld\n", (long)mStyleContextCache.Count()); -#endif + PRINTF( "StyleContextCount: %ld\n", (long)mStyleContextCache.Count()); } #endif //#ifdef USE_FAST_CACHE diff --git a/mozilla/layout/style/nsStyleUtil.cpp b/mozilla/layout/style/nsStyleUtil.cpp index 66fdb313db8..153b325f502 100644 --- a/mozilla/layout/style/nsStyleUtil.cpp +++ b/mozilla/layout/style/nsStyleUtil.cpp @@ -40,6 +40,11 @@ #include "nsIServiceManager.h" #include "nsIPref.h" +#include "nslog.h" + +NS_IMPL_LOG(nsStyleUtilLog) +#define PRINTF NS_LOG_PRINTF(nsStyleUtilLog) +#define FLUSH NS_LOG_FLUSH(nsStyleUtilLog) static NS_DEFINE_CID(kPrefCID, NS_PREF_CID); @@ -676,106 +681,106 @@ void DumpFontSizes(nsIPresContext* aPresContext) for (short i=0; i<2; i ++) { doWinRounding ^= true; - printf("\n\n\n"); - printf("---------------------------------------------------------------\n"); - printf(" CSS \n"); - printf(" Rounding %s\n", (doWinRounding ? "ON" : "OFF")); - printf("---------------------------------------------------------------\n"); - printf("\n"); - printf("NEW SIZES:\n"); - printf("----------\n"); - printf(" xx-small x-small small medium large x-large xx-large\n"); + PRINTF("\n\n\n"); + PRINTF("---------------------------------------------------------------\n"); + PRINTF(" CSS \n"); + PRINTF(" Rounding %s\n", (doWinRounding ? "ON" : "OFF")); + PRINTF("---------------------------------------------------------------\n"); + PRINTF("\n"); + PRINTF("NEW SIZES:\n"); + PRINTF("----------\n"); + PRINTF(" xx-small x-small small medium large x-large xx-large\n"); for (baseSize = 9; baseSize <= 20; baseSize++) { - printf("%2d: ", baseSize); + PRINTF("%2d: ", baseSize); for (cssSize = 0; cssSize <= 6; cssSize++) { val = NewCalcFontPointSize(cssSize, baseSize*dev2app, 1.0f, aPresContext, eFontSize_CSS); - printf("%2d ", RoundSize(val, aPresContext, false)); + PRINTF("%2d ", RoundSize(val, aPresContext, false)); } - printf("\n"); + PRINTF("\n"); } - printf("\n"); - printf("OLD SIZES:\n"); - printf("----------\n"); - printf(" xx-small x-small small medium large x-large xx-large\n"); + PRINTF("\n"); + PRINTF("OLD SIZES:\n"); + PRINTF("----------\n"); + PRINTF(" xx-small x-small small medium large x-large xx-large\n"); for (baseSize = 9; baseSize <= 20; baseSize++) { - printf("%2d: ", baseSize); + PRINTF("%2d: ", baseSize); for (cssSize = 0; cssSize <= 6; cssSize++) { val = OldCalcFontPointSize(cssSize, baseSize*dev2app, 1.0f); - printf("%2d ", RoundSize(val, aPresContext, doWinRounding)); + PRINTF("%2d ", RoundSize(val, aPresContext, doWinRounding)); } - printf("\n"); + PRINTF("\n"); } - printf("\n"); - printf("DIFFS:\n"); - printf("------\n"); - printf(" xx-small x-small small medium large x-large xx-large\n"); + PRINTF("\n"); + PRINTF("DIFFS:\n"); + PRINTF("------\n"); + PRINTF(" xx-small x-small small medium large x-large xx-large\n"); for (baseSize = 9; baseSize <= 20; baseSize++) { - printf("%2d: ", baseSize); + PRINTF("%2d: ", baseSize); for (cssSize = 0; cssSize <= 6; cssSize++) { oldVal = OldCalcFontPointSize(cssSize, baseSize*dev2app, 1.0f); val = NewCalcFontPointSize(cssSize, baseSize*dev2app, 1.0f, aPresContext, eFontSize_CSS); if (RoundSize(oldVal, aPresContext, doWinRounding) <= 8) - printf(" ."); + PRINTF(" ."); else - printf("%2d", (RoundSize(val, aPresContext, false)-RoundSize(oldVal, aPresContext, doWinRounding))); - printf(" "); + PRINTF("%2d", (RoundSize(val, aPresContext, false)-RoundSize(oldVal, aPresContext, doWinRounding))); + PRINTF(" "); } - printf("\n"); + PRINTF("\n"); } - printf("\n\n\n"); - printf("---------------------------------------------------------------\n"); - printf(" HTML \n"); - printf(" Rounding %s\n", (doWinRounding ? "ON" : "OFF")); - printf("---------------------------------------------------------------\n"); - printf("\n"); - printf("NEW SIZES:\n"); - printf("----------\n"); - printf(" #1 #2 #3 #4 #5 #6 #7\n"); + PRINTF("\n\n\n"); + PRINTF("---------------------------------------------------------------\n"); + PRINTF(" HTML \n"); + PRINTF(" Rounding %s\n", (doWinRounding ? "ON" : "OFF")); + PRINTF("---------------------------------------------------------------\n"); + PRINTF("\n"); + PRINTF("NEW SIZES:\n"); + PRINTF("----------\n"); + PRINTF(" #1 #2 #3 #4 #5 #6 #7\n"); for (baseSize = 9; baseSize <= 20; baseSize++) { - printf("%2d: ", baseSize); + PRINTF("%2d: ", baseSize); for (htmlSize = 1; htmlSize <= 7; htmlSize++) { val = NewCalcFontPointSize(htmlSize, baseSize*dev2app, 1.0f, aPresContext, eFontSize_HTML); - printf("%2d ", RoundSize(val, aPresContext, false)); + PRINTF("%2d ", RoundSize(val, aPresContext, false)); } - printf("\n"); + PRINTF("\n"); } - printf("\n"); - printf("OLD SIZES:\n"); - printf("----------\n"); - printf(" #1 #2 #3 #4 #5 #6 #7\n"); + PRINTF("\n"); + PRINTF("OLD SIZES:\n"); + PRINTF("----------\n"); + PRINTF(" #1 #2 #3 #4 #5 #6 #7\n"); for (baseSize = 9; baseSize <= 20; baseSize++) { - printf("%2d: ", baseSize); + PRINTF("%2d: ", baseSize); for (htmlSize = 1; htmlSize <= 7; htmlSize++) { val = OldCalcFontPointSize(htmlSize, baseSize*dev2app, 1.0f); - printf("%2d ", RoundSize(val, aPresContext, doWinRounding)); + PRINTF("%2d ", RoundSize(val, aPresContext, doWinRounding)); } - printf("\n"); + PRINTF("\n"); } - printf("\n"); - printf("DIFFS:\n"); - printf("------\n"); - printf(" #1 #2 #3 #4 #5 #6 #7\n"); + PRINTF("\n"); + PRINTF("DIFFS:\n"); + PRINTF("------\n"); + PRINTF(" #1 #2 #3 #4 #5 #6 #7\n"); for (baseSize = 9; baseSize <= 20; baseSize++) { - printf("%2d: ", baseSize); + PRINTF("%2d: ", baseSize); for (htmlSize = 1; htmlSize <= 7; htmlSize++) { oldVal = OldCalcFontPointSize(htmlSize, baseSize*dev2app, 1.0f); val = NewCalcFontPointSize(htmlSize, baseSize*dev2app, 1.0f, aPresContext, eFontSize_HTML); if (RoundSize(oldVal, aPresContext, doWinRounding) <= 8) - printf(" ."); + PRINTF(" ."); else - printf("%2d", (RoundSize(val, aPresContext, false)-RoundSize(oldVal, aPresContext, doWinRounding))); - printf(" "); + PRINTF("%2d", (RoundSize(val, aPresContext, false)-RoundSize(oldVal, aPresContext, doWinRounding))); + PRINTF(" "); } - printf("\n"); + PRINTF("\n"); } - printf("\n\n\n"); + PRINTF("\n\n\n"); } } } diff --git a/mozilla/layout/svg/base/src/nsPolygonFrame.cpp b/mozilla/layout/svg/base/src/nsPolygonFrame.cpp index c28134ce7a8..2351ceb49e0 100644 --- a/mozilla/layout/svg/base/src/nsPolygonFrame.cpp +++ b/mozilla/layout/svg/base/src/nsPolygonFrame.cpp @@ -39,6 +39,12 @@ #include "nsIDeviceContext.h" #include "nsIReflowCommand.h" +#include "nslog.h" + +NS_IMPL_LOG(nsPolygonFrameLog) +#define PRINTF NS_LOG_PRINTF(nsPolygonFrameLog) +#define FLUSH NS_LOG_FLUSH(nsPolygonFrameLog) + extern nsresult NS_NewHTMLReflowCommand(nsIReflowCommand** aInstancePtrResult, nsIFrame* aTargetFrame, @@ -264,9 +270,9 @@ nsPolygonFrame::GetPoints() } mPnts[mNumPnts-1] = mPnts[0]; - //printf("0x%X Points are:\n", this); + //PRINTF("0x%X Points are:\n", this); //for (PRInt32 i=0;i [%d,%d]\n", i, mPnts[i].x, mPnts[i].y); + // PRINTF("%d -> [%d,%d]\n", i, mPnts[i].x, mPnts[i].y); //} return NS_OK; diff --git a/mozilla/layout/svg/base/src/nsSVGContainerFrame.cpp b/mozilla/layout/svg/base/src/nsSVGContainerFrame.cpp index 1e2d0a3439d..3d052300cc9 100644 --- a/mozilla/layout/svg/base/src/nsSVGContainerFrame.cpp +++ b/mozilla/layout/svg/base/src/nsSVGContainerFrame.cpp @@ -42,7 +42,11 @@ #include "nsIPref.h" #include "nsIServiceManager.h" #include "nsISVGFrame.h" +#include "nslog.h" +NS_IMPL_LOG(nsSVGContainerFrameLog) +#define PRINTF NS_LOG_PRINTF(nsSVGContainerFrameLog) +#define FLUSH NS_LOG_FLUSH(nsSVGContainerFrameLog) nsresult NS_NewSVGContainerFrame ( nsIPresShell* aPresShell, nsIFrame** aNewFrame, PRBool aIsRoot) @@ -404,11 +408,11 @@ nsSVGContainerFrame::Paint ( nsIPresContext* aPresContext, // if we aren't visible then we are done. if (!disp->IsVisibleOrCollapsed()) return NS_OK; - //printf("nsSVGContainerFrame::Paint Start\n"); + //PRINTF("nsSVGContainerFrame::Paint Start\n"); // if we are visible then tell our superclass to paint nsresult r = nsHTMLContainerFrame::Paint(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer); - //printf("nsSVGContainerFrame::Paint End\n"); + //PRINTF("nsSVGContainerFrame::Paint End\n"); return r; } diff --git a/mozilla/layout/tables/BasicTableLayoutStrategy.cpp b/mozilla/layout/tables/BasicTableLayoutStrategy.cpp index 6e12c506d3a..a4887d56dc2 100644 --- a/mozilla/layout/tables/BasicTableLayoutStrategy.cpp +++ b/mozilla/layout/tables/BasicTableLayoutStrategy.cpp @@ -29,6 +29,11 @@ #include "nsStyleConsts.h" #include "nsVoidArray.h" #include "nsHTMLIIDs.h" +#include "nslog.h" + +NS_IMPL_LOG(BasicTableLayoutStrategyLog) +#define PRINTF NS_LOG_PRINTF(BasicTableLayoutStrategyLog) +#define FLUSH NS_LOG_FLUSH(BasicTableLayoutStrategyLog) #if 1 static PRBool gsDebugAssign = PR_FALSE; @@ -156,7 +161,7 @@ PRBool BCW_Wrapup(nsIPresContext* aPresContext, { if (aAllocTypes) delete [] aAllocTypes; - if (gsDebugBalance) {printf("BalanceColumnWidths ex \n"); aTableFrame->Dump(aPresContext, PR_FALSE, PR_TRUE, PR_FALSE);} + if (gsDebugBalance) {PRINTF("BalanceColumnWidths ex \n"); aTableFrame->Dump(aPresContext, PR_FALSE, PR_TRUE, PR_FALSE);} return PR_TRUE; } @@ -166,7 +171,7 @@ BasicTableLayoutStrategy::BalanceColumnWidths(nsIPresContext* aPresCont const nsHTMLReflowState& aReflowState, nscoord aMaxWidthIn) { - if (gsDebugBalance) {printf("BalanceColumnWidths en max=%d count=%d \n", aMaxWidthIn, gsDebugCount++); mTableFrame->Dump(aPresContext, PR_FALSE, PR_TRUE, PR_FALSE);} + if (gsDebugBalance) {PRINTF("BalanceColumnWidths en max=%d count=%d \n", aMaxWidthIn, gsDebugCount++); mTableFrame->Dump(aPresContext, PR_FALSE, PR_TRUE, PR_FALSE);} float p2t; aPresContext->GetScaledPixelsToTwips(&p2t); @@ -770,7 +775,7 @@ BasicTableLayoutStrategy::AssignNonPctColumnWidths(nsIPresContext* aPre const nsHTMLReflowState& aReflowState, float aPixelToTwips) { - if (gsDebugAssign) {printf("AssignNonPctColWidths en max=%d count=%d \n", aMaxWidth, gsDebugCount++); mTableFrame->Dump(aPresContext, PR_FALSE, PR_TRUE, PR_FALSE);} + if (gsDebugAssign) {PRINTF("AssignNonPctColWidths en max=%d count=%d \n", aMaxWidth, gsDebugCount++); mTableFrame->Dump(aPresContext, PR_FALSE, PR_TRUE, PR_FALSE);} PRBool rv = PR_FALSE; PRInt32 numRows = mTableFrame->GetRowCount(); PRInt32 numCols = mTableFrame->GetColCount(); @@ -950,7 +955,7 @@ BasicTableLayoutStrategy::AssignNonPctColumnWidths(nsIPresContext* aPre mTableFrame->SetColumnWidth(colX, minWidth); } - if (gsDebugAssign) {printf("AssignNonPctColWidths ex\n"); mTableFrame->Dump(aPresContext, PR_FALSE, PR_TRUE, PR_FALSE);} + if (gsDebugAssign) {PRINTF("AssignNonPctColWidths ex\n"); mTableFrame->Dump(aPresContext, PR_FALSE, PR_TRUE, PR_FALSE);} return rv; } @@ -1914,11 +1919,11 @@ void BasicTableLayoutStrategy::Dump(PRInt32 aIndent) } indent[aIndent] = 0; - printf("%s**START BASIC STRATEGY DUMP** table=%p cols=%X", + PRINTF("%s**START BASIC STRATEGY DUMP** table=%p cols=%X", indent, mTableFrame, mCols); - printf("\n%s cellSpacing=%d propRatio=%.2f navQuirks=%d", - indent, mCellSpacingTotal, mMinToDesProportionRatio, mIsNavQuirksMode); - printf(" **END BASIC STRATEGY DUMP** \n"); + PRINTF("\n%s cellSpacing=%d propRatio=%.2f navQuirks=%d", + indent, mCellSpacingTotal, mMinToDesProportionRatio, mIsNavQuirksMode); + PRINTF(" **END BASIC STRATEGY DUMP** \n"); delete [] indent; } diff --git a/mozilla/layout/tables/nsCellMap.cpp b/mozilla/layout/tables/nsCellMap.cpp index 744e10d29ca..54d2d5a9cb2 100644 --- a/mozilla/layout/tables/nsCellMap.cpp +++ b/mozilla/layout/tables/nsCellMap.cpp @@ -26,6 +26,11 @@ #include "nsTableFrame.h" #include "nsTableCellFrame.h" #include "nsTableRowGroupFrame.h" +#include "nslog.h" + +NS_IMPL_LOG(nsCellMapLog) +#define PRINTF NS_LOG_PRINTF(nsCellMapLog) +#define FLUSH NS_LOG_FLUSH(nsCellMapLog) // colspan=0 gets a minimum number of cols initially to make computations easier #define MIN_NUM_COLS_FOR_ZERO_COLSPAN 2 @@ -407,20 +412,20 @@ nsTableCellMap::GetNumCellsOriginatingInCol(PRInt32 aColIndex) const void nsTableCellMap::Dump() const { - printf("***** START TABLE CELL MAP DUMP ***** %p\n", this); + PRINTF("***** START TABLE CELL MAP DUMP ***** %p\n", this); // output col info PRInt32 colCount = mCols.Count(); - printf ("cols array orig/span-> %p", this); + PRINTF ("cols array orig/span-> %p", this); for (PRInt32 colX = 0; colX < colCount; colX++) { nsColInfo* colInfo = (nsColInfo *)mCols.ElementAt(colX); - printf ("%d=%d/%d ", colX, colInfo->mNumCellsOrig, colInfo->mNumCellsSpan); + PRINTF ("%d=%d/%d ", colX, colInfo->mNumCellsOrig, colInfo->mNumCellsSpan); } nsCellMap* cellMap = mFirstMap; while (cellMap) { cellMap->Dump(); cellMap = cellMap->GetNextSibling(); } - printf("***** END TABLE CELL MAP DUMP *****\n"); + PRINTF("***** END TABLE CELL MAP DUMP *****\n"); } #endif @@ -775,7 +780,7 @@ nsCellMap::AppendCell(nsTableCellMap& aMap, } } } - //printf("appended cell=%p row=%d \n", &aCellFrame, aRowIndex); + //PRINTF("appended cell=%p row=%d \n", &aCellFrame, aRowIndex); //aMap.Dump(); return startColIndex; } @@ -1481,40 +1486,40 @@ void nsCellMap::RemoveCell(nsTableCellMap& aMap, #ifdef NS_DEBUG void nsCellMap::Dump() const { - printf("\n ***** START GROUP CELL MAP DUMP ***** %p\n", this); + PRINTF("\n ***** START GROUP CELL MAP DUMP ***** %p\n", this); PRInt32 mapRowCount = mRows.Count(); - printf(" mapRowCount=%d tableRowCount=%d \n", mapRowCount, mRowCount); + PRINTF(" mapRowCount=%d tableRowCount=%d \n", mapRowCount, mRowCount); PRInt32 rowIndex, colIndex; for (rowIndex = 0; rowIndex < mapRowCount; rowIndex++) { nsVoidArray* row = (nsVoidArray *)mRows.ElementAt(rowIndex); - printf(" row %d : ", rowIndex); + PRINTF(" row %d : ", rowIndex); PRInt32 colCount = row->Count(); for (colIndex = 0; colIndex < colCount; colIndex++) { CellData* cd = (CellData *)row->ElementAt(colIndex); if (cd) { if (cd->IsOrig()) { - printf("C%d,%d ", rowIndex, colIndex); + PRINTF("C%d,%d ", rowIndex, colIndex); } else { nsTableCellFrame* cell = nsnull; if (cd->IsRowSpan()) { cell = GetCellFrame(rowIndex, colIndex, *cd, PR_TRUE); - printf("R "); + PRINTF("R "); } if (cd->IsColSpan()) { cell = GetCellFrame(rowIndex, colIndex, *cd, PR_FALSE); - printf("C "); + PRINTF("C "); } if (!(cd->IsRowSpan() && cd->IsColSpan())) { - printf(" "); + PRINTF(" "); } - printf(" "); + PRINTF(" "); } } else { - printf("---- "); + PRINTF("---- "); } } - printf("\n"); + PRINTF("\n"); } // output info mapping Ci,j to cell address @@ -1522,7 +1527,7 @@ void nsCellMap::Dump() const for (PRInt32 rIndex = 0; rIndex < mapRowCount; rIndex++) { nsVoidArray* row = (nsVoidArray *)mRows.ElementAt(rIndex); PRInt32 colCount = row->Count(); - printf(" "); + PRINTF(" "); for (colIndex = 0; colIndex < colCount; colIndex++) { CellData* cd = (CellData *)row->ElementAt(colIndex); if (cd) { @@ -1530,15 +1535,15 @@ void nsCellMap::Dump() const nsTableCellFrame* cellFrame = cd->GetCellFrame(); PRInt32 cellFrameColIndex; cellFrame->GetColIndex(cellFrameColIndex); - printf("C%d,%d=%p(%d) ", rIndex, colIndex, cellFrame, cellFrameColIndex); + PRINTF("C%d,%d=%p(%d) ", rIndex, colIndex, cellFrame, cellFrameColIndex); cellCount++; } } } - printf("\n"); + PRINTF("\n"); } - printf(" ***** END GROUP CELL MAP DUMP *****\n"); + PRINTF(" ***** END GROUP CELL MAP DUMP *****\n"); } #endif diff --git a/mozilla/layout/tables/nsTableCellFrame.cpp b/mozilla/layout/tables/nsTableCellFrame.cpp index d37cb8db708..03ec99870b0 100644 --- a/mozilla/layout/tables/nsTableCellFrame.cpp +++ b/mozilla/layout/tables/nsTableCellFrame.cpp @@ -50,6 +50,11 @@ //TABLECELL SELECTION #include "nsIFrameSelection.h" #include "nsILookAndFeel.h" +#include "nslog.h" + +NS_IMPL_LOG(nsTableCellFrameLog) +#define PRINTF NS_LOG_PRINTF(nsTableCellFrameLog) +#define FLUSH NS_LOG_FLUSH(nsTableCellFrameLog) static NS_DEFINE_IID(kIHTMLTableCellElementIID, NS_IHTMLTABLECELLELEMENT_IID); static NS_DEFINE_IID(kIDOMHTMLTableCellElementIID, NS_IDOMHTMLTABLECELLELEMENT_IID); @@ -659,28 +664,28 @@ void DebugCheckChildSize(nsIFrame* aChild, if (aMet.width > aAvailSize.width) { nsAutoString tmp; aChild->GetFrameName(tmp); - printf("WARNING: cell "); + PRINTF("WARNING: cell "); fputs(tmp, stdout); - printf(" content has desired width %d given avail width %d\n", - aMet.width, aAvailSize.width); + PRINTF(" content has desired width %d given avail width %d\n", + aMet.width, aAvailSize.width); } */ if (aIsPass2Reflow) { if ((aMet.width < 0) || (aMet.width > 60000)) { - printf("WARNING: cell content %p has large width %d \n", aChild, aMet.width); + PRINTF("WARNING: cell content %p has large width %d \n", aChild, aMet.width); } if ((aMet.height < 0) || (aMet.height > 60000)) { - printf("WARNING: cell content %p has large height %d \n", aChild, aMet.height); + PRINTF("WARNING: cell content %p has large height %d \n", aChild, aMet.height); } } if (aMet.maxElementSize) { nscoord tmp = aMet.maxElementSize->width; if ((tmp < 0) || (tmp > 60000)) { - printf("WARNING: cell content %p has large max element width %d \n", aChild, tmp); + PRINTF("WARNING: cell content %p has large max element width %d \n", aChild, tmp); } tmp = aMet.maxElementSize->height; if ((tmp < 0) || (tmp > 60000)) { - printf("WARNING: cell content %p has large max element height %d \n", aChild, tmp); + PRINTF("WARNING: cell content %p has large max element height %d \n", aChild, tmp); } } } @@ -1124,7 +1129,7 @@ void nsTableCellFrame::MapHAlignAttribute(nsIPresContext* aPresContext, NS_METHOD nsTableCellFrame::DidSetStyleContext(nsIPresContext* aPresContext) { #ifdef NOISY_STYLE - printf("nsTableCellFrame::DidSetStyleContext \n"); + PRINTF("nsTableCellFrame::DidSetStyleContext \n"); #endif MapBorderPadding(aPresContext); diff --git a/mozilla/layout/tables/nsTableColFrame.cpp b/mozilla/layout/tables/nsTableColFrame.cpp index 8b2b9e061a5..a6f23ef3f94 100644 --- a/mozilla/layout/tables/nsTableColFrame.cpp +++ b/mozilla/layout/tables/nsTableColFrame.cpp @@ -32,6 +32,11 @@ #include "nsLayoutAtoms.h" #include "nsIContent.h" #include "nsIDOMHTMLTableColElement.h" +#include "nslog.h" + +NS_IMPL_LOG(nsTableColFrameLog) +#define PRINTF NS_LOG_PRINTF(nsTableColFrameLog) +#define FLUSH NS_LOG_FLUSH(nsTableColFrameLog) #define COL_TYPE_CONTENT 0x0 #define COL_TYPE_ANONYMOUS_COL 0x1 @@ -187,7 +192,7 @@ void nsTableColFrame::SetWidth(PRUint32 aWidthType, if (aWidth > 0) { nscoord minWidth = GetMinWidth(); if ((MIN_CON != aWidthType) && (aWidth < minWidth)) { - printf("non min width set to lower than min \n"); + PRINTF("non min width set to lower than min \n"); } } #endif @@ -221,13 +226,13 @@ void nsTableColFrame::Dump(PRInt32 aIndent) } indent[aIndent] = 0; - printf("%s**START COL DUMP** colIndex=%d isAnonymous=%d constraint=%d", - indent, mColIndex, mIsAnonymous, mConstraint); - printf("\n%s widths=", indent); + PRINTF("%s**START COL DUMP** colIndex=%d isAnonymous=%d constraint=%d", + indent, mColIndex, mIsAnonymous, mConstraint); + PRINTF("\n%s widths=", indent); for (PRInt32 widthX = 0; widthX < NUM_WIDTHS; widthX++) { - printf("%d ", mWidths[widthX]); + PRINTF("%d ", mWidths[widthX]); } - printf(" **END COL DUMP** "); + PRINTF(" **END COL DUMP** "); delete [] indent; } diff --git a/mozilla/layout/tables/nsTableFrame.cpp b/mozilla/layout/tables/nsTableFrame.cpp index 367ecc4352d..3b004c7095f 100644 --- a/mozilla/layout/tables/nsTableFrame.cpp +++ b/mozilla/layout/tables/nsTableFrame.cpp @@ -60,6 +60,12 @@ #include "nsIScrollableFrame.h" #include "nsHTMLReflowCommand.h" #include "nsIFrameManager.h" +#include "nslog.h" +#undef fprintf + +NS_IMPL_LOG(nsTableFrameLog) +#define PRINTF NS_LOG_PRINTF(nsTableFrameLog) +#define FLUSH NS_LOG_FLUSH(nsTableFrameLog) static NS_DEFINE_IID(kIHTMLElementIID, NS_IDOMHTMLELEMENT_IID); static NS_DEFINE_IID(kIBodyElementIID, NS_IDOMHTMLBODYELEMENT_IID); @@ -1048,7 +1054,7 @@ nsTableFrame::InsertRows(nsIPresContext& aPresContext, PRInt32 aRowIndex, PRBool aConsiderSpans) { - //printf("insertRowsBefore firstRow=%d \n", aRowIndex); + //PRINTF("insertRowsBefore firstRow=%d \n", aRowIndex); //Dump(PR_TRUE, PR_FALSE, PR_TRUE); PRInt32 numColsToAdd = 0; @@ -1076,7 +1082,7 @@ nsTableFrame::InsertRows(nsIPresContext& aPresContext, } } - //printf("insertRowsAfter \n"); + //PRINTF("insertRowsAfter \n"); //Dump(PR_TRUE, PR_FALSE, PR_TRUE); return numColsToAdd; @@ -1088,7 +1094,7 @@ void nsTableFrame::RemoveRows(nsIPresContext& aPresContext, PRInt32 aNumRowsToRemove, PRBool aConsiderSpans) { - //printf("removeRowsBefore firstRow=%d numRows=%d\n", aFirstRowIndex, aNumRowsToRemove); + //PRINTF("removeRowsBefore firstRow=%d numRows=%d\n", aFirstRowIndex, aNumRowsToRemove); //Dump(PR_TRUE, PR_FALSE, PR_TRUE); nsTableCellMap* cellMap = GetCellMap(); @@ -1104,7 +1110,7 @@ void nsTableFrame::RemoveRows(nsIPresContext& aPresContext, } } AdjustRowIndices(&aPresContext, aFirstRowIndex, -aNumRowsToRemove); - //printf("removeRowsAfter\n"); + //PRINTF("removeRowsAfter\n"); //Dump(PR_TRUE, PR_FALSE, PR_TRUE); } @@ -1347,7 +1353,7 @@ NS_METHOD nsTableFrame::Paint(nsIPresContext* aPresContext, } else { - //printf("paint table frame\n"); + //PRINTF("paint table frame\n"); nsBorderEdges* edges = nsnull; if (mBorderCollapser) { edges = mBorderCollapser->GetEdges(); @@ -4347,7 +4353,7 @@ nsTableFrame::DumpRowGroup(nsIPresContext* aPresContext, nsIFrame* aKidFrame) nsIAtom* rowType; rowFrame->GetFrameType(&rowType); if (nsLayoutAtoms::tableRowFrame == rowType) { - printf("row(%d)=%p ", ((nsTableRowFrame*)rowFrame)->GetRowIndex(), rowFrame); + PRINTF("row(%d)=%p ", ((nsTableRowFrame*)rowFrame)->GetRowIndex(), rowFrame); nsIFrame* cellFrame; rowFrame->FirstChild(aPresContext, nsnull, &cellFrame); while (cellFrame) { @@ -4356,12 +4362,12 @@ nsTableFrame::DumpRowGroup(nsIPresContext* aPresContext, nsIFrame* aKidFrame) if (nsLayoutAtoms::tableCellFrame == cellType) { PRInt32 colIndex; ((nsTableCellFrame*)cellFrame)->GetColIndex(colIndex); - printf("cell(%d)=%p ", colIndex, cellFrame); + PRINTF("cell(%d)=%p ", colIndex, cellFrame); } NS_IF_RELEASE(cellType); cellFrame->GetNextSibling(&cellFrame); } - printf("\n"); + PRINTF("\n"); } else { DumpRowGroup(aPresContext, rowFrame); @@ -4377,15 +4383,15 @@ void nsTableFrame::Dump(nsIPresContext* aPresContext, PRBool aDumpCols, PRBool aDumpCellMap) { - printf("***START TABLE DUMP*** \n"); + PRINTF("***START TABLE DUMP*** \n"); // dump the columns widths array - printf("mColWidths="); + PRINTF("mColWidths="); PRInt32 numCols = GetColCount(); PRInt32 colX; for (colX = 0; colX < numCols; colX++) { - printf("%d ", mColumnWidths[colX]); + PRINTF("%d ", mColumnWidths[colX]); } - printf("\n"); + PRINTF("\n"); if (aDumpRows) { nsIFrame* kidFrame = mFrames.FirstChild(); @@ -4397,16 +4403,16 @@ void nsTableFrame::Dump(nsIPresContext* aPresContext, if (aDumpCols) { // output col frame cache - printf("\n col frame cache ->"); + PRINTF("\n col frame cache ->"); for (colX = 0; colX < numCols; colX++) { nsTableColFrame* colFrame = (nsTableColFrame *)mColFrames.ElementAt(colX); if (0 == (colX % 8)) { - printf("\n"); + PRINTF("\n"); } - printf ("%d=%p ", colX, colFrame); + PRINTF ("%d=%p ", colX, colFrame); } for (colX = 0; colX < numCols; colX++) { - printf("\n"); + PRINTF("\n"); nsTableColFrame* colFrame = GetColFrame(colX); colFrame->Dump(1); } @@ -4417,7 +4423,7 @@ void nsTableFrame::Dump(nsIPresContext* aPresContext, cellMap->Dump(); #endif } - printf(" ***END TABLE DUMP*** \n"); + PRINTF(" ***END TABLE DUMP*** \n"); } // nsTableIterator @@ -4650,16 +4656,16 @@ void nsTableFrame::DebugReflow(char* aMessage, { char indent[256]; nsTableFrame::DebugGetIndent(aFrame, indent); - printf("%s%s %p ", indent, aMessage, aFrame); + PRINTF("%s%s %p ", indent, aMessage, aFrame); char width[32]; char height[32]; if (aState) { PrettyUC(aState->availableWidth, width); PrettyUC(aState->availableHeight, height); - printf("rea=%d av=(%s,%s) ", aState->reason, width, height); + PRINTF("rea=%d av=(%s,%s) ", aState->reason, width, height); PrettyUC(aState->mComputedWidth, width); PrettyUC(aState->mComputedHeight, height); - printf("comp=(%s,%s) count=%d \n ", width, height, gRflCount); + PRINTF("comp=(%s,%s) count=%d \n ", width, height, gRflCount); gRflCount++; //if (32 == gRflCount) { // NS_ASSERTION(PR_FALSE, "stop"); @@ -4667,23 +4673,23 @@ void nsTableFrame::DebugReflow(char* aMessage, } if (aMetrics) { if (aState) { - printf("%s", indent); + PRINTF("%s", indent); } PrettyUC(aMetrics->width, width); PrettyUC(aMetrics->height, height); - printf("des=(%s,%s) ", width, height); + PRINTF("des=(%s,%s) ", width, height); if (aMetrics->maxElementSize) { PrettyUC(aMetrics->maxElementSize->width, width); PrettyUC(aMetrics->maxElementSize->height, height); - printf("maxElem=(%s,%s)", width, height); + PRINTF("maxElem=(%s,%s)", width, height); } if (aMetrics->mFlags & NS_REFLOW_CALC_MAX_WIDTH) { - printf("max=%d ", aMetrics->mMaximumWidth); + PRINTF("max=%d ", aMetrics->mMaximumWidth); } if (NS_FRAME_COMPLETE != aStatus) { - printf("status=%d", aStatus); + PRINTF("status=%d", aStatus); } - printf("\n"); + PRINTF("\n"); } } diff --git a/mozilla/layout/tables/nsTableRowFrame.cpp b/mozilla/layout/tables/nsTableRowFrame.cpp index a1aeb314d15..aebab5ebd6f 100644 --- a/mozilla/layout/tables/nsTableRowFrame.cpp +++ b/mozilla/layout/tables/nsTableRowFrame.cpp @@ -44,6 +44,11 @@ static NS_DEFINE_IID(kIHTMLTableCellElementIID, NS_IHTMLTABLECELLELEMENT_IID); // end includes for style optimizations that require real content knowledge +#include "nslog.h" + +NS_IMPL_LOG(nsTableRowFrameLog) +#define PRINTF NS_LOG_PRINTF(nsTableRowFrameLog) +#define FLUSH NS_LOG_FLUSH(nsTableRowFrameLog) struct nsTableCellReflowState : public nsHTMLReflowState { @@ -969,8 +974,8 @@ NS_METHOD nsTableRowFrame::ResizeReflow(nsIPresContext* aPresContext, #ifdef NS_DEBUG_karnaze if (desiredSize.width > availWidth) { - printf("WARNING: cell returned desired width %d given avail width %d\n", - desiredSize.width, availWidth); + PRINTF("WARNING: cell returned desired width %d given avail width %d\n", + desiredSize.width, availWidth); } #endif @@ -1057,7 +1062,7 @@ NS_METHOD nsTableRowFrame::ResizeReflow(nsIPresContext* aPresContext, float p2t; aPresContext->GetScaledPixelsToTwips(&p2t); if (overAllocated > p2t) { - printf("row over allocated by %d\n twips", overAllocated); + PRINTF("row over allocated by %d\n twips", overAllocated); } } #endif @@ -1121,15 +1126,15 @@ nsTableRowFrame::InitialReflow(nsIPresContext* aPresContext, // the following signals bugs in the content frames. if (kidMaxElementSize.width > kidSize.width) { #ifdef DEBUG_karnaze - printf("WARNING - table cell content max element width %d greater than desired width %d\n", - kidMaxElementSize.width, kidSize.width); + PRINTF("WARNING - table cell content max element width %d greater than desired width %d\n", + kidMaxElementSize.width, kidSize.width); #endif kidSize.width = kidMaxElementSize.width; } if (kidMaxElementSize.height > kidSize.height) { #ifdef DEBUG_karnaze - printf("Warning - table cell content max element height %d greater than desired height %d\n", - kidMaxElementSize.height, kidSize.height); + PRINTF("Warning - table cell content max element height %d greater than desired height %d\n", + kidMaxElementSize.height, kidSize.height); #endif kidSize.height = kidMaxElementSize.height; } diff --git a/mozilla/layout/xbl/src/nsXBLBinding.cpp b/mozilla/layout/xbl/src/nsXBLBinding.cpp index 0a7b5045a40..574366b552b 100644 --- a/mozilla/layout/xbl/src/nsXBLBinding.cpp +++ b/mozilla/layout/xbl/src/nsXBLBinding.cpp @@ -80,6 +80,11 @@ #include "nsXBLLoadHandler.h" #include "nsXBLBinding.h" +#include "nslog.h" + +NS_IMPL_LOG(nsXBLBindingLog) +#define PRINTF NS_LOG_PRINTF(nsXBLBindingLog) +#define FLUSH NS_LOG_FLUSH(nsXBLBindingLog) // Static IIDs/CIDs. Try to minimize these. static char kNameSpaceSeparator = ':'; @@ -228,7 +233,7 @@ nsXBLBinding::nsXBLBinding(nsIXBLPrototypeBinding* aBinding) NS_INIT_REFCNT(); mPrototypeBinding = aBinding; gRefCnt++; - // printf("REF COUNT UP: %d %s\n", gRefCnt, (const char*)mID); + // PRINTF("REF COUNT UP: %d %s\n", gRefCnt, (const char*)mID); if (gRefCnt == 1) { kXULTemplateAtom = NS_NewAtom("template"); @@ -268,7 +273,7 @@ nsXBLBinding::nsXBLBinding(nsIXBLPrototypeBinding* aBinding) nsXBLBinding::~nsXBLBinding(void) { gRefCnt--; - // printf("REF COUNT DOWN: %d %s\n", gRefCnt, (const char*)mID); + // PRINTF("REF COUNT DOWN: %d %s\n", gRefCnt, (const char*)mID); if (gRefCnt == 0) { NS_RELEASE(kXULTemplateAtom); diff --git a/mozilla/layout/xbl/src/nsXBLPrototypeBinding.cpp b/mozilla/layout/xbl/src/nsXBLPrototypeBinding.cpp index 6b9c772958a..27df22d5a43 100644 --- a/mozilla/layout/xbl/src/nsXBLPrototypeBinding.cpp +++ b/mozilla/layout/xbl/src/nsXBLPrototypeBinding.cpp @@ -49,6 +49,11 @@ #include "nsXBLService.h" #include "nsXBLPrototypeBinding.h" #include "nsFixedSizeAllocator.h" +#include "nslog.h" + +NS_IMPL_LOG(nsXBLPrototypeBindingLog) +#define PRINTF NS_LOG_PRINTF(nsXBLPrototypeBindingLog) +#define FLUSH NS_LOG_FLUSH(nsXBLPrototypeBindingLog) // Helper Classes ===================================================================== @@ -147,7 +152,7 @@ nsXBLPrototypeBinding::nsXBLPrototypeBinding(const nsCString& aID, nsIContent* a mXBLDocInfoWeak = getter_AddRefs(NS_GetWeakReference(aInfo)); gRefCnt++; - // printf("REF COUNT UP: %d %s\n", gRefCnt, (const char*)mID); + // PRINTF("REF COUNT UP: %d %s\n", gRefCnt, (const char*)mID); if (gRefCnt == 1) { kPool.Init("XBL Attribute Entries", kBucketSizes, kNumBuckets, kInitialSize); diff --git a/mozilla/layout/xbl/src/nsXBLService.cpp b/mozilla/layout/xbl/src/nsXBLService.cpp index dba82016e00..d55e18f2924 100644 --- a/mozilla/layout/xbl/src/nsXBLService.cpp +++ b/mozilla/layout/xbl/src/nsXBLService.cpp @@ -282,7 +282,7 @@ nsXBLStreamListener::OnStopRequest(nsIChannel* aChannel, nsISupports* aCtxt, nsr } if (NS_FAILED(rv) || NS_FAILED(aStatus)) { - NS_WARNING("Failed to load XBL document!!!!!!!!!!!!!\n"); + NS_WARNING("Failed to load XBL document!!!!!!!!!!!!!"); PRUint32 count = mBindingRequests.Count(); for (PRUint32 i = 0; i < count; i++) { @@ -321,7 +321,7 @@ nsXBLStreamListener::Load(nsIDOMEvent* aEvent) // See if we're still alive. nsCOMPtr doc(do_QueryReferent(mDocument)); if (!doc) { - NS_WARNING("XBL load did not complete until after document went away! Modal dialog bug?\n"); + NS_WARNING("XBL load did not complete until after document went away! Modal dialog bug?"); } else { // Remove ourselves from the set of pending docs. diff --git a/mozilla/layout/xbl/src/nsXBLWindowKeyHandler.cpp b/mozilla/layout/xbl/src/nsXBLWindowKeyHandler.cpp index ede299c0f22..53392e8444f 100644 --- a/mozilla/layout/xbl/src/nsXBLWindowKeyHandler.cpp +++ b/mozilla/layout/xbl/src/nsXBLWindowKeyHandler.cpp @@ -45,6 +45,11 @@ #include "nsIDOMDocument.h" #include "nsIDocument.h" #include "nsIDOMElement.h" +#include "nslog.h" + +NS_IMPL_LOG(nsXBLWindowKeyHandlerLog) +#define PRINTF NS_LOG_PRINTF(nsXBLWindowKeyHandlerLog) +#define FLUSH NS_LOG_FLUSH(nsXBLWindowKeyHandlerLog) PRUint32 nsXBLWindowKeyHandler::gRefCnt = 0; nsIAtom* nsXBLWindowKeyHandler::kKeyDownAtom = nsnull; @@ -94,7 +99,7 @@ nsXBLWindowKeyHandler::IsEditor() nsCOMPtr commandDispatcher; privateWindow->GetRootCommandDispatcher(getter_AddRefs(commandDispatcher)); if (!commandDispatcher) { - NS_WARNING("********* Problem for embedding. They have no command dispatcher!!!\n"); + NS_WARNING("********* Problem for embedding. They have no command dispatcher!!!"); return PR_FALSE; } @@ -244,7 +249,7 @@ nsXBLWindowKeyHandler::WalkHandlersInternal(nsIDOMKeyEvent* aKeyEvent, nsIAtom* nsCAutoString idc; idc.AssignWithConversion(id); if (!idc.IsEmpty()) - printf("Key matched with id of: %s\n", (const char*)idc); + PRINTF("Key matched with id of: %s", (const char*)idc); */ elt->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::disabled, disabled); diff --git a/mozilla/layout/xml/content/src/nsXMLCDATASection.cpp b/mozilla/layout/xml/content/src/nsXMLCDATASection.cpp index 4ac16673bcf..2a0c727a693 100644 --- a/mozilla/layout/xml/content/src/nsXMLCDATASection.cpp +++ b/mozilla/layout/xml/content/src/nsXMLCDATASection.cpp @@ -31,6 +31,12 @@ #include "nsCRT.h" #include "nsLayoutAtoms.h" #include "nsIXMLContent.h" +#include "nslog.h" +#undef fprintf + +NS_IMPL_LOG(nsXMLCDATASectionLog) +#define PRINTF NS_LOG_PRINTF(nsXMLCDATASectionLog) +#define FLUSH NS_LOG_FLUSH(nsXMLCDATASectionLog) class nsXMLCDATASection : public nsIDOMCDATASection, diff --git a/mozilla/layout/xml/content/src/nsXMLDocumentType.cpp b/mozilla/layout/xml/content/src/nsXMLDocumentType.cpp index cf6c546d2e8..68745a02d56 100644 --- a/mozilla/layout/xml/content/src/nsXMLDocumentType.cpp +++ b/mozilla/layout/xml/content/src/nsXMLDocumentType.cpp @@ -33,6 +33,12 @@ #include "nsIXMLContent.h" #include "nsISizeOfHandler.h" #include "nsDOMAttributeMap.h" +#include "nslog.h" +#undef fprintf + +NS_IMPL_LOG(nsXMLDocumentTypeLog) +#define PRINTF NS_LOG_PRINTF(nsXMLDocumentTypeLog) +#define FLUSH NS_LOG_FLUSH(nsXMLDocumentTypeLog) class nsXMLDocumentType : public nsIDOMDocumentType, diff --git a/mozilla/layout/xml/content/src/nsXMLEntity.cpp b/mozilla/layout/xml/content/src/nsXMLEntity.cpp index 0dce994ece4..d2cf63910e4 100644 --- a/mozilla/layout/xml/content/src/nsXMLEntity.cpp +++ b/mozilla/layout/xml/content/src/nsXMLEntity.cpp @@ -31,6 +31,12 @@ #include "nsLayoutAtoms.h" #include "nsString.h" #include "nsIXMLContent.h" +#include "nslog.h" +#undef fprintf + +NS_IMPL_LOG(nsXMLEntityLog) +#define PRINTF NS_LOG_PRINTF(nsXMLEntityLog) +#define FLUSH NS_LOG_FLUSH(nsXMLEntityLog) class nsXMLEntity : public nsIDOMEntity, diff --git a/mozilla/layout/xml/content/src/nsXMLNotation.cpp b/mozilla/layout/xml/content/src/nsXMLNotation.cpp index 44ab03f3a79..5b52676a205 100644 --- a/mozilla/layout/xml/content/src/nsXMLNotation.cpp +++ b/mozilla/layout/xml/content/src/nsXMLNotation.cpp @@ -31,6 +31,12 @@ #include "nsLayoutAtoms.h" #include "nsString.h" #include "nsIXMLContent.h" +#include "nslog.h" +#undef fprintf + +NS_IMPL_LOG(nsXMLNotationLog) +#define PRINTF NS_LOG_PRINTF(nsXMLNotationLog) +#define FLUSH NS_LOG_FLUSH(nsXMLNotationLog) class nsXMLNotation : public nsIDOMNotation, diff --git a/mozilla/layout/xml/content/src/nsXMLProcessingInstruction.cpp b/mozilla/layout/xml/content/src/nsXMLProcessingInstruction.cpp index b782501fcb6..414b3f68d80 100644 --- a/mozilla/layout/xml/content/src/nsXMLProcessingInstruction.cpp +++ b/mozilla/layout/xml/content/src/nsXMLProcessingInstruction.cpp @@ -39,6 +39,12 @@ #include "nsIXMLContent.h" #include "nsNetUtil.h" +#include "nslog.h" +#undef fprintf + +NS_IMPL_LOG(nsXMLProcessingInstructionLog) +#define PRINTF NS_LOG_PRINTF(nsXMLProcessingInstructionLog) +#define FLUSH NS_LOG_FLUSH(nsXMLProcessingInstructionLog) class nsXMLProcessingInstruction : public nsIDOMProcessingInstruction, diff --git a/mozilla/layout/xml/document/src/nsXMLContentSink.cpp b/mozilla/layout/xml/document/src/nsXMLContentSink.cpp index f342509d898..7deb7dd8415 100644 --- a/mozilla/layout/xml/document/src/nsXMLContentSink.cpp +++ b/mozilla/layout/xml/document/src/nsXMLContentSink.cpp @@ -75,6 +75,12 @@ // XXX misnamed header file, but oh well #include "nsHTMLTokens.h" +#include "nslog.h" + +NS_IMPL_LOG(nsXMLContentSinkLog) +#define PRINTF NS_LOG_PRINTF(nsXMLContentSinkLog) +#define FLUSH NS_LOG_FLUSH(nsXMLContentSinkLog) + static char kNameSpaceSeparator = ':'; static char kNameSpaceDef[] = "xmlns"; static char kStyleSheetPI[] = "xml-stylesheet"; @@ -768,7 +774,7 @@ NS_IMETHODIMP nsXMLContentSink::AddXMLDecl(const nsIParserNode& aNode) { // XXX We'll ignore it for now - printf("nsXMLContentSink::AddXMLDecl\n"); + PRINTF("nsXMLContentSink::AddXMLDecl\n"); return NS_OK; } @@ -1369,21 +1375,21 @@ nsXMLContentSink::AddText(const nsString& aString) NS_IMETHODIMP nsXMLContentSink::AddUnparsedEntity(const nsIParserNode& aNode) { - printf("nsXMLContentSink::AddUnparsedEntity\n"); + PRINTF("nsXMLContentSink::AddUnparsedEntity\n"); return NS_OK; } NS_IMETHODIMP nsXMLContentSink::AddNotation(const nsIParserNode& aNode) { - printf("nsXMLContentSink::AddNotation\n"); + PRINTF("nsXMLContentSink::AddNotation\n"); return NS_OK; } NS_IMETHODIMP nsXMLContentSink::AddEntityReference(const nsIParserNode& aNode) { - printf("nsXMLContentSink::AddEntityReference\n"); + PRINTF("nsXMLContentSink::AddEntityReference\n"); return NS_OK; } diff --git a/mozilla/layout/xml/document/src/nsXMLDocument.cpp b/mozilla/layout/xml/document/src/nsXMLDocument.cpp index fddb9ec912e..c5b04c4df0e 100644 --- a/mozilla/layout/xml/document/src/nsXMLDocument.cpp +++ b/mozilla/layout/xml/document/src/nsXMLDocument.cpp @@ -72,6 +72,11 @@ #include "nsDOMError.h" #include "nsScriptSecurityManager.h" #include "nsIPrincipal.h" +#include "nslog.h" + +NS_IMPL_LOG(nsXMLDocumentLog) +#define PRINTF NS_LOG_PRINTF(nsXMLDocumentLog) +#define FLUSH NS_LOG_FLUSH(nsXMLDocumentLog) // XXX The XML world depends on the html atoms @@ -453,7 +458,7 @@ nsXMLDocument::StartDocumentLoad(const char* aCommand, #ifdef DEBUG_charset nsAutoString d(defaultCharsetFromDocShell); char* cCharset = d.ToNewCString(); - printf("From default charset, charset = %s\n", cCharset); + PRINTF("From default charset, charset = %s\n", cCharset); Recycle(cCharset); #endif charset = defaultCharsetFromDocShell; @@ -470,7 +475,7 @@ nsXMLDocument::StartDocumentLoad(const char* aCommand, #ifdef DEBUG_charset nsAutoString d(requestCharset); char* cCharset = d.ToNewCString(); - printf("From request charset, charset = %s req=%d->%d\n", + PRINTF("From request charset, charset = %s req=%d->%d\n", cCharset, charsetSource, requestCharsetSource); Recycle(cCharset); #endif @@ -492,7 +497,7 @@ nsXMLDocument::StartDocumentLoad(const char* aCommand, #ifdef DEBUG_charset nsAutoString d(forceCharsetFromDocShell); char* cCharset = d.ToNewCString(); - printf("From force, charset = %s \n", cCharset); + PRINTF("From force, charset = %s \n", cCharset); Recycle(cCharset); #endif charset = forceCharsetFromDocShell; diff --git a/mozilla/layout/xul/base/src/nsBox.cpp b/mozilla/layout/xul/base/src/nsBox.cpp index 996b7e519d7..459fb046ecb 100644 --- a/mozilla/layout/xul/base/src/nsBox.cpp +++ b/mozilla/layout/xul/base/src/nsBox.cpp @@ -41,6 +41,12 @@ #include "nsIDOMNode.h" #include "nsIDOMNamedNodeMap.h" #include "nsIDOMAttr.h" +#include "nslog.h" +#undef fprintf + +NS_IMPL_LOG(nsBoxLog) +#define PRINTF NS_LOG_PRINTF(nsBoxLog) +#define FLUSH NS_LOG_FLUSH(nsBoxLog) //#define DEBUG_LAYOUT @@ -58,7 +64,7 @@ nsBoxAddIndents() { for(PRInt32 i=0; i < gIndent; i++) { - printf(" "); + PRINTF(" "); } } #endif @@ -164,9 +170,9 @@ nsBox::BeginLayout(nsBoxLayoutState& aState) char ch[100]; reason.ToCString(ch,100); - printf("%s Layout: ", ch); + PRINTF("%s Layout: ", ch); DumpBox(stdout); - printf("\n"); + PRINTF("\n"); gIndent++; #endif @@ -193,7 +199,7 @@ nsBox::EndLayout(nsBoxLayoutState& aState) #ifdef REFLOW_COELESCED void Coelesced() { - printf("Coelesed=%d\n", ++coelesced); + PRINTF("Coelesed=%d\n", ++coelesced); } @@ -361,7 +367,7 @@ nsBox::MarkChildrenStyleChange() // only reflow if we aren't already dirty. if (HasStyleChange()) { #ifdef DEBUG_COELESCED - printf("StyleChange reflows coelesced=%d\n", ++StyleCoelesced); + PRINTF("StyleChange reflows coelesced=%d\n", ++StyleCoelesced); #endif return NS_OK; } diff --git a/mozilla/layout/xul/base/src/nsBoxFrame.cpp b/mozilla/layout/xul/base/src/nsBoxFrame.cpp index af665974e08..ae15d7c49c5 100644 --- a/mozilla/layout/xul/base/src/nsBoxFrame.cpp +++ b/mozilla/layout/xul/base/src/nsBoxFrame.cpp @@ -82,6 +82,11 @@ #include "nsViewsCID.h" #include "nsIScrollableView.h" #include "nsHTMLContainerFrame.h" +#include "nslog.h" + +NS_IMPL_LOG(nsBoxFrameLog) +#define PRINTF NS_LOG_PRINTF(nsBoxFrameLog) +#define FLUSH NS_LOG_FLUSH(nsBoxFrameLog) static NS_DEFINE_IID(kWidgetCID, NS_CHILD_CID); static NS_DEFINE_IID(kScrollViewIID, NS_ISCROLLABLEVIEW_IID); @@ -282,7 +287,7 @@ nsBoxFrame::SetInitialChildList(nsIPresContext* aPresContext, nsBoxLayoutState state(shell); InitChildren(state, aChildList); } else { - printf("Warning add child failed!!\n"); + PRINTF("Warning add child failed!!\n"); } SanityCheck(mFrames); @@ -361,9 +366,9 @@ void nsBoxFrameInner::CacheAttributes() { /* - printf("Caching: "); + PRINTF("Caching: "); mOuter->DumpBox(stdout); - printf("\n"); + PRINTF("\n"); */ mValign = nsBoxFrame::vAlign_Top; @@ -671,11 +676,11 @@ nsBoxFrame::DidReflow(nsIPresContext* aPresContext, static int myCounter = 0; static void printSize(char * aDesc, nscoord aSize) { - printf(" %s: ", aDesc); + PRINTF(" %s: ", aDesc); if (aSize == NS_UNCONSTRAINEDSIZE) { - printf("UC"); + PRINTF("UC"); } else { - printf("%d", aSize); + PRINTF("%d", aSize); } } #endif @@ -691,21 +696,21 @@ nsBoxFrame::Reflow(nsIPresContext* aPresContext, NS_ASSERTION(aReflowState.mComputedWidth >=0 && aReflowState.mComputedHeight >= 0, "Computed Size < 0"); #ifdef DO_NOISY_REFLOW - printf("\n-------------Starting BoxFrame Reflow ----------------------------\n"); - printf("%p ** nsBF::Reflow %d R: ", this, myCounter++); + PRINTF("\n-------------Starting BoxFrame Reflow ----------------------------\n"); + PRINTF("%p ** nsBF::Reflow %d R: ", this, myCounter++); switch (aReflowState.reason) { case eReflowReason_Initial: - printf("Ini");break; + PRINTF("Ini");break; case eReflowReason_Incremental: - printf("Inc");break; + PRINTF("Inc");break; case eReflowReason_Resize: - printf("Rsz");break; + PRINTF("Rsz");break; case eReflowReason_StyleChange: - printf("Sty");break; + PRINTF("Sty");break; case eReflowReason_Dirty: - printf("Drt "); + PRINTF("Drt "); break; - default:printf("%d", aReflowState.reason);break; + default:PRINTF("%d", aReflowState.reason);break; } printSize("AW", aReflowState.availableWidth); @@ -713,7 +718,7 @@ nsBoxFrame::Reflow(nsIPresContext* aPresContext, printSize("CW", aReflowState.mComputedWidth); printSize("CH", aReflowState.mComputedHeight); - printf(" *\n"); + PRINTF(" *\n"); #endif @@ -832,12 +837,12 @@ nsBoxFrame::Reflow(nsIPresContext* aPresContext, } #ifdef DO_NOISY_REFLOW { - printf("%p ** nsBF(done) W:%d H:%d ", this, aDesiredSize.width, aDesiredSize.height); + PRINTF("%p ** nsBF(done) W:%d H:%d ", this, aDesiredSize.width, aDesiredSize.height); if (maxElementSize) { - printf("MW:%d MH:%d\n", maxElementSize->width, maxElementSize->height); + PRINTF("MW:%d MH:%d\n", maxElementSize->width, maxElementSize->height); } else { - printf("MW:? MH:?\n"); + PRINTF("MW:? MH:?\n"); } } @@ -1109,7 +1114,7 @@ nsBoxFrame::InsertFrames(nsIPresContext* aPresContext, nsIBox* prevBox = GetBox(aPrevFrame); if (prevBox == nsnull && aPrevFrame != nsnull) { - printf("Warning prev sibling is not in our list!!!"); + PRINTF("Warning prev sibling is not in our list!!!"); aPrevFrame = nsnull; } @@ -1833,9 +1838,9 @@ nsBoxFrame::GetCursor(nsIPresContext* aPresContext, { /* #ifdef NS_DEBUG - printf("Get Cursor: "); + PRINTF("Get Cursor: "); nsFrame::ListTag(stdout, this); - printf("\n"); + PRINTF("\n"); #endif */ @@ -2288,7 +2293,7 @@ nsBoxFrameInner::DisplayDebugInfoFor(nsIBox* aBox, if (!insideBorder.Contains(nsPoint(x,y))) return NS_ERROR_FAILURE; - //printf("%%%%%% inside box %%%%%%%\n"); + //PRINTF("%%%%%% inside box %%%%%%%\n"); int count = 0; nsIBox* child = nsnull; @@ -2306,7 +2311,7 @@ nsBoxFrameInner::DisplayDebugInfoFor(nsIBox* aBox, if ((isHorizontal && y < insideBorder.y + m.top) || (!isHorizontal && x < insideBorder.x + m.left)) { - //printf("**** inside debug border *******\n"); + //PRINTF("**** inside debug border *******\n"); while (child) { nsRect r; @@ -2326,17 +2331,17 @@ nsBoxFrameInner::DisplayDebugInfoFor(nsIBox* aBox, ourFrame->GetContent(getter_AddRefs(content)); if (content) { - printf("---------------\n"); + PRINTF("---------------\n"); mOuter->DumpBox(stdout); - printf("\n"); + PRINTF("\n"); } childFrame->GetContent(getter_AddRefs(content)); if (content) { - printf("child #%d: ", count); + PRINTF("child #%d: ", count); child->DumpBox(stdout); - printf("\n"); + PRINTF("\n"); } @@ -2380,13 +2385,13 @@ nsBoxFrameInner::DisplayDebugInfoFor(nsIBox* aBox, GetValue(aPresContext, flexSize, flexCSS, flex); - printf("min%s, pref%s, max%s, actual%s, flex=%s\n\n", + PRINTF("min%s, pref%s, max%s, actual%s, flex=%s\n\n", min, pref, max, calc, flex - ); + ); return NS_OK; } diff --git a/mozilla/layout/xul/base/src/nsBoxLayoutState.cpp b/mozilla/layout/xul/base/src/nsBoxLayoutState.cpp index fe781b3af8a..de22b97a79b 100644 --- a/mozilla/layout/xul/base/src/nsBoxLayoutState.cpp +++ b/mozilla/layout/xul/base/src/nsBoxLayoutState.cpp @@ -36,6 +36,11 @@ #include "nsIContent.h" #include "nsINameSpaceManager.h" #include "nsIPresContext.h" +#include "nslog.h" + +NS_IMPL_LOG(nsBoxLayoutStateLog) +#define PRINTF NS_LOG_PRINTF(nsBoxLayoutStateLog) +#define FLUSH NS_LOG_FLUSH(nsBoxLayoutStateLog) nsBoxLayoutState::nsBoxLayoutState(nsIPresContext* aPresContext):mPresContext(aPresContext), mReflowState(nsnull), @@ -160,7 +165,7 @@ nsBoxLayoutState::HandleReflow(nsIBox* aRootBox) break; case eReflowReason_StyleChange: - // printf("STYLE CHANGE REFLOW. Blowing away all box caches!!\n"); + // PRINTF("STYLE CHANGE REFLOW. Blowing away all box caches!!\n"); aRootBox->MarkChildrenStyleChange(); // fall through to dirty diff --git a/mozilla/layout/xul/base/src/nsBoxToBlockAdaptor.cpp b/mozilla/layout/xul/base/src/nsBoxToBlockAdaptor.cpp index 75f1b902d33..42151eff4eb 100644 --- a/mozilla/layout/xul/base/src/nsBoxToBlockAdaptor.cpp +++ b/mozilla/layout/xul/base/src/nsBoxToBlockAdaptor.cpp @@ -55,6 +55,11 @@ #include "nsIFontMetrics.h" #include "nsHTMLContainerFrame.h" #include "nsWidgetsCID.h" +#include "nslog.h" + +NS_IMPL_LOG(nsBoxToBlockAdaptorLog) +#define PRINTF NS_LOG_PRINTF(nsBoxToBlockAdaptorLog) +#define FLUSH NS_LOG_FLUSH(nsBoxToBlockAdaptorLog) static NS_DEFINE_IID(kWidgetCID, NS_CHILD_CID); @@ -70,7 +75,7 @@ nsAdaptorAddIndents() { for(PRInt32 i=0; i < gIndent2; i++) { - printf(" "); + PRINTF(" "); } } @@ -115,7 +120,7 @@ nsAdaptorPrintReason(nsHTMLReflowState& aReflowState) break; } - printf("%s",reflowReasonString); + PRINTF("%s",reflowReasonString); } #endif @@ -554,7 +559,7 @@ nsBoxToBlockAdaptor::DoLayout(nsBoxLayoutState& aState) #ifdef DEBUG_GROW DumpBox(stdout); - printf(" GREW from (%d,%d) -> (%d,%d)\n", ourRect.width, ourRect.height, desiredSize.width, desiredSize.height); + PRINTF(" GREW from (%d,%d) -> (%d,%d)\n", ourRect.width, ourRect.height, desiredSize.width, desiredSize.height); #endif if (desiredSize.width > ourRect.width) @@ -593,13 +598,13 @@ nsBoxToBlockAdaptor::Reflow(nsBoxLayoutState& aState, #ifdef DEBUG_REFLOW nsAdaptorAddIndents(); - printf("Reflowing: "); + PRINTF("Reflowing: "); nsFrame::ListTag(stdout, mFrame); - printf("\n"); + PRINTF("\n"); gIndent2++; #endif - //printf("width=%d, height=%d\n", aWidth, aHeight); + //PRINTF("width=%d, height=%d\n", aWidth, aHeight); nsIBox* parent; GetParentBox(&parent); nsIFrame* frame; @@ -608,7 +613,7 @@ nsBoxToBlockAdaptor::Reflow(nsBoxLayoutState& aState, frame->GetFrameState(&frameState); // if (frameState & NS_STATE_CURRENTLY_IN_DEBUG) - // printf("In debug\n"); + // PRINTF("In debug\n"); if (mSpaceManager == nsnull) { mSpaceManager = new nsSpaceManager(mFrame); @@ -728,7 +733,7 @@ nsBoxToBlockAdaptor::Reflow(nsBoxLayoutState& aState, if (needsReflow) { Redraw(aState); redrawAfterReflow = PR_TRUE; - //printf("Redrawing!!!/n"); + //PRINTF("Redrawing!!!/n"); } } break; @@ -833,10 +838,10 @@ nsBoxToBlockAdaptor::Reflow(nsBoxLayoutState& aState, if (type != nsIReflowCommand::StyleChanged) { #ifdef DEBUG_REFLOW nsAdaptorAddIndents(); - printf("Size=(%d,%d)\n",reflowState.mComputedWidth, reflowState.mComputedHeight); + PRINTF("Size=(%d,%d)\n",reflowState.mComputedWidth, reflowState.mComputedHeight); nsAdaptorAddIndents(); nsAdaptorPrintReason(reflowState); - printf("\n"); + PRINTF("\n"); #endif mFrame->WillReflow(aPresContext); @@ -854,10 +859,10 @@ nsBoxToBlockAdaptor::Reflow(nsBoxLayoutState& aState, #ifdef DEBUG_REFLOW nsAdaptorAddIndents(); - printf("Size=(%d,%d)\n",reflowState.mComputedWidth, reflowState.mComputedHeight); + PRINTF("Size=(%d,%d)\n",reflowState.mComputedWidth, reflowState.mComputedHeight); nsAdaptorAddIndents(); nsAdaptorPrintReason(reflowState); - printf("\n"); + PRINTF("\n"); #endif // place the child and reflow @@ -870,7 +875,7 @@ nsBoxToBlockAdaptor::Reflow(nsBoxLayoutState& aState, nsFrameState kidState; mFrame->GetFrameState(&kidState); - // printf("width: %d, height: %d\n", aDesiredSize.mCombinedArea.width, aDesiredSize.mCombinedArea.height); + // PRINTF("width: %d, height: %d\n", aDesiredSize.mCombinedArea.width, aDesiredSize.mCombinedArea.height); // see if the overflow option is set. If it is then if our child's bounds overflow then // we will set the child's rect to include the overflow size. @@ -881,7 +886,7 @@ nsBoxToBlockAdaptor::Reflow(nsBoxLayoutState& aState, // include the overflow size in our child's rect? if (mIncludeOverflow) { - //printf("OutsideChildren width=%d, height=%d\n", aDesiredSize.mOverflowArea.width, aDesiredSize.mOverflowArea.height); + //PRINTF("OutsideChildren width=%d, height=%d\n", aDesiredSize.mOverflowArea.width, aDesiredSize.mOverflowArea.height); aDesiredSize.width = aDesiredSize.mOverflowArea.width; if (aDesiredSize.width <= aWidth) aDesiredSize.height = aDesiredSize.mOverflowArea.height; @@ -896,7 +901,7 @@ nsBoxToBlockAdaptor::Reflow(nsBoxLayoutState& aState, #ifdef DEBUG_REFLOW nsAdaptorAddIndents(); nsAdaptorPrintReason(reflowState); - printf("\n"); + PRINTF("\n"); #endif mFrame->WillReflow(aPresContext); mFrame->Reflow(aPresContext, aDesiredSize, reflowState, aStatus); @@ -969,13 +974,13 @@ nsBoxToBlockAdaptor::Reflow(nsBoxLayoutState& aState, if (aHeight != NS_INTRINSICSIZE && aDesiredSize.height != aHeight) { nsAdaptorAddIndents(); - printf("*****got taller!*****\n"); + PRINTF("*****got taller!*****\n"); } if (aWidth != NS_INTRINSICSIZE && aDesiredSize.width != aWidth) { nsAdaptorAddIndents(); - printf("*****got wider!******\n"); + PRINTF("*****got wider!******\n"); } #endif diff --git a/mozilla/layout/xul/base/src/nsMenuFrame.cpp b/mozilla/layout/xul/base/src/nsMenuFrame.cpp index 4ed933e72ec..7db3ce292ae 100644 --- a/mozilla/layout/xul/base/src/nsMenuFrame.cpp +++ b/mozilla/layout/xul/base/src/nsMenuFrame.cpp @@ -65,6 +65,11 @@ #include "nsCSSFrameConstructor.h" #include "nsIDOMKeyEvent.h" #include "nsIPref.h" +#include "nslog.h" + +NS_IMPL_LOG(nsMenuFrameLog) +#define PRINTF NS_LOG_PRINTF(nsMenuFrameLog) +#define FLUSH NS_LOG_FLUSH(nsMenuFrameLog) #define NS_MENU_POPUP_LIST_INDEX 0 @@ -861,7 +866,7 @@ nsMenuFrame::DoLayout(nsBoxLayoutState& aState) if (bounds.width < prefSize.width + width) { bounds.width += width; - //printf("Width=%d\n",width); + //PRINTF("Width=%d\n",width); ibox->SetBounds(aState, bounds); } } diff --git a/mozilla/layout/xul/base/src/nsMenuPopupFrame.cpp b/mozilla/layout/xul/base/src/nsMenuPopupFrame.cpp index 6fd0ce49226..8471bfecf10 100644 --- a/mozilla/layout/xul/base/src/nsMenuPopupFrame.cpp +++ b/mozilla/layout/xul/base/src/nsMenuPopupFrame.cpp @@ -51,6 +51,11 @@ #include "nsILookAndFeel.h" #include "nsIComponentManager.h" #include "nsBoxLayoutState.h" +#include "nslog.h" + +NS_IMPL_LOG(nsMenuPopupFrameLog) +#define PRINTF NS_LOG_PRINTF(nsMenuPopupFrameLog) +#define FLUSH NS_LOG_FLUSH(nsMenuPopupFrameLog) static NS_DEFINE_IID(kLookAndFeelCID, NS_LOOKANDFEEL_CID); static NS_DEFINE_IID(kILookAndFeelIID, NS_ILOOKANDFEEL_IID); @@ -174,7 +179,7 @@ nsMenuPopupFrame::Init(nsIPresContext* aPresContext, // XXX make sure we are hidden (shouldn't this be done automatically?) ourView->SetVisibility(nsViewVisibility_kHide); #ifdef XP_MAC - printf("XP Popups: This is a nag to indicate that an inconsistent hack is being done on the Mac for popups.\n"); + PRINTF("XP Popups: This is a nag to indicate that an inconsistent hack is being done on the Mac for popups.\n"); static NS_DEFINE_IID(kCPopupCID, NS_POPUP_CID); ourView->CreateWidget(kCPopupCID, &widgetData, nsnull); #else diff --git a/mozilla/layout/xul/base/src/nsMonumentLayout.cpp b/mozilla/layout/xul/base/src/nsMonumentLayout.cpp index eda63316487..7d743894cd0 100644 --- a/mozilla/layout/xul/base/src/nsMonumentLayout.cpp +++ b/mozilla/layout/xul/base/src/nsMonumentLayout.cpp @@ -32,6 +32,11 @@ #include "nsIBox.h" #include "nsIScrollableFrame.h" #include "nsBox.h" +#include "nslog.h" + +NS_IMPL_LOG(nsMonumentLayoutLog) +#define PRINTF NS_LOG_PRINTF(nsMonumentLayoutLog) +#define FLUSH NS_LOG_FLUSH(nsMonumentLayoutLog) // ----- Monument Iterator ----- @@ -186,7 +191,7 @@ nsBoxSizeListNodeImpl::~nsBoxSizeListNodeImpl() { MOZ_COUNT_DTOR(nsBoxSizeListNodeImpl); //_nodes--; - //printf("Nodes %d\n",_nodes); + //PRINTF("Nodes %d\n",_nodes); } void @@ -240,7 +245,7 @@ nsBoxSizeListNodeImpl::nsBoxSizeListNodeImpl(nsIBox* aBox):mNext(nsnull), { MOZ_COUNT_CTOR(nsBoxSizeListNodeImpl); // _nodes++; - // printf("Created. Nodes %d\n",_nodes); + // PRINTF("Created. Nodes %d\n",_nodes); } nsBoxSizeList* @@ -286,7 +291,7 @@ nsBoxSizeListImpl::nsBoxSizeListImpl(nsIBox* aBox):nsBoxSizeListNodeImpl(aBox), { MOZ_COUNT_CTOR(nsBoxSizeListImpl); // _lists++; - // printf("Lists %d\n",_lists); + // PRINTF("Lists %d\n",_lists); } @@ -294,7 +299,7 @@ nsBoxSizeListImpl::~nsBoxSizeListImpl() { MOZ_COUNT_DTOR(nsBoxSizeListImpl); // _lists--; - // printf("Lists %d\n",_lists); + // PRINTF("Lists %d\n",_lists); } /* Ownership model nsMonumentLayout diff --git a/mozilla/layout/xul/base/src/nsPopupSetFrame.cpp b/mozilla/layout/xul/base/src/nsPopupSetFrame.cpp index e71b31422c8..e17044ccae7 100644 --- a/mozilla/layout/xul/base/src/nsPopupSetFrame.cpp +++ b/mozilla/layout/xul/base/src/nsPopupSetFrame.cpp @@ -53,6 +53,11 @@ #include "nsBoxLayoutState.h" #include "nsIScrollableFrame.h" #include "nsCSSFrameConstructor.h" +#include "nslog.h" + +NS_IMPL_LOG(nsPopupSetFrameLog) +#define PRINTF NS_LOG_PRINTF(nsPopupSetFrameLog) +#define FLUSH NS_LOG_FLUSH(nsPopupSetFrameLog) #define NS_MENU_POPUP_LIST_INDEX 0 @@ -278,7 +283,7 @@ nsPopupSetFrame::DoLayout(nsBoxLayoutState& aState) if (bounds.width < prefSize.width + width) { bounds.width += width; - //printf("Width=%d\n",width); + //PRINTF("Width=%d\n",width); ibox->SetBounds(aState, bounds); } } @@ -461,8 +466,8 @@ nsPopupSetFrame::CreatePopup(nsIContent* aElementContent, nsIContent* aPopupCont return NS_OK; #ifdef DEBUG_PINK - printf("X Pos: %d\n", mXPos); - printf("Y Pos: %d\n", mYPos); + PRINTF("X Pos: %d\n", mXPos); + PRINTF("Y Pos: %d\n", mYPos); #endif // Generate the popup. diff --git a/mozilla/layout/xul/base/src/nsRepeatService.cpp b/mozilla/layout/xul/base/src/nsRepeatService.cpp index 31b7faff7d9..3b432263ab0 100644 --- a/mozilla/layout/xul/base/src/nsRepeatService.cpp +++ b/mozilla/layout/xul/base/src/nsRepeatService.cpp @@ -28,6 +28,11 @@ // #include "nsRepeatService.h" +#include "nslog.h" + +NS_IMPL_LOG(nsRepeatServiceLog) +#define PRINTF NS_LOG_PRINTF(nsRepeatServiceLog) +#define FLUSH NS_LOG_FLUSH(nsRepeatServiceLog) #if XP_MAC #define INITAL_REPEAT_DELAY 250 @@ -73,7 +78,7 @@ void nsRepeatService::Start(nsITimerCallback* aCallback) void nsRepeatService::Stop() { - //printf("Stopping repeat timer\n"); + //PRINTF("Stopping repeat timer\n"); if (mRepeatTimer) { mRepeatTimer->Cancel(); mRepeatTimer = nsnull; diff --git a/mozilla/layout/xul/base/src/nsRootBoxFrame.cpp b/mozilla/layout/xul/base/src/nsRootBoxFrame.cpp index be7588085fc..b6f98ee63e2 100644 --- a/mozilla/layout/xul/base/src/nsRootBoxFrame.cpp +++ b/mozilla/layout/xul/base/src/nsRootBoxFrame.cpp @@ -45,6 +45,11 @@ #include "nsIPresShell.h" #include "nsBoxFrame.h" #include "nsStackLayout.h" +#include "nslog.h" + +NS_IMPL_LOG(nsRootBoxFrameLog) +#define PRINTF NS_LOG_PRINTF(nsRootBoxFrameLog) +#define FLUSH NS_LOG_FLUSH(nsRootBoxFrameLog) // Interface IDs static NS_DEFINE_IID(kScrollViewIID, NS_ISCROLLABLEVIEW_IID); @@ -205,7 +210,7 @@ nsRootBoxFrame::Reflow(nsIPresContext* aPresContext, #ifdef DEBUG_REFLOW gReflows++; - printf("----Reflow %d----\n", gReflows); + PRINTF("----Reflow %d----\n", gReflows); #endif return nsBoxFrame::Reflow(aPresContext, aDesiredSize, aReflowState, aStatus); } diff --git a/mozilla/layout/xul/base/src/nsScrollbarFrame.cpp b/mozilla/layout/xul/base/src/nsScrollbarFrame.cpp index 2f730e96254..858ae3b3d6a 100644 --- a/mozilla/layout/xul/base/src/nsScrollbarFrame.cpp +++ b/mozilla/layout/xul/base/src/nsScrollbarFrame.cpp @@ -46,6 +46,11 @@ #include "nsHTMLValue.h" #include "nsIAnonymousContent.h" #include "nsIView.h" +#include "nslog.h" + +NS_IMPL_LOG(nsScrollbarFrameLog) +#define PRINTF NS_LOG_PRINTF(nsScrollbarFrameLog) +#define FLUSH NS_LOG_FLUSH(nsScrollbarFrameLog) class AnonymousElement : public nsXMLElement, public nsIAnonymousContent @@ -97,7 +102,7 @@ AnonymousElement::List(FILE* out, PRInt32 aIndent) const PRInt32 indx; for (indx = aIndent; --indx >= 0; ) fputs(" ", out); - fprintf(out, "Comment refcount=%d<", mRefCnt); + FPRINTF(out, "Comment refcount=%d<", mRefCnt); nsAutoString tmp; mInner.ToCString(tmp, 0, mInner.mText.GetLength()); diff --git a/mozilla/layout/xul/base/src/nsSliderFrame.cpp b/mozilla/layout/xul/base/src/nsSliderFrame.cpp index a6f4d16516d..ec0713ce2cb 100644 --- a/mozilla/layout/xul/base/src/nsSliderFrame.cpp +++ b/mozilla/layout/xul/base/src/nsSliderFrame.cpp @@ -67,6 +67,11 @@ #include "nsSprocketLayout.h" #include "nsIPref.h" #include "nsIServiceManager.h" +#include "nslog.h" + +NS_IMPL_LOG(nsSliderFrameLog) +#define PRINTF NS_LOG_PRINTF(nsSliderFrameLog) +#define FLUSH NS_LOG_FLUSH(nsSliderFrameLog) #define DEBUG_SLIDER PR_FALSE @@ -375,7 +380,7 @@ nsSliderFrame::DoLayout(nsBoxLayoutState& aState) if (DEBUG_SLIDER) { PRInt32 c = GetCurrentPosition(scrollbar); PRInt32 m = GetMaxPosition(scrollbar); - printf("Current=%d, max=%d\n",c,m); + PRINTF("Current=%d, max=%d\n",c,m); } // redraw only if thumb changed size. @@ -446,7 +451,7 @@ nsSliderFrame::HandleEvent(nsIPresContext* aPresContext, parent->GetParent(&parent); } - //printf("Translated to start=%d\n",start); + //PRINTF("Translated to start=%d\n",start); start -= mThumbStart; @@ -471,7 +476,7 @@ nsSliderFrame::HandleEvent(nsIPresContext* aPresContext, case NS_MOUSE_LEFT_BUTTON_UP: // stop capturing - //printf("stop capturing\n"); + //PRINTF("stop capturing\n"); AddListener(); DragThumb(aPresContext, PR_FALSE); mRedrawImmediate = PR_FALSE;//we MUST call nsFrame HandleEvent for mouse ups to maintain the selection state and capture state. @@ -718,7 +723,7 @@ nsSliderFrame::SetCurrentPosition(nsIContent* scrollbar, nsIFrame* aThumbFrame, scrollbar->SetAttribute(kNameSpaceID_None, nsXULAtoms::curpos, NS_ConvertASCIItoUCS2(ch), PR_TRUE); if (DEBUG_SLIDER) - printf("Current Pos=%s\n",ch); + PRINTF("Current Pos=%s\n",ch); } @@ -790,7 +795,7 @@ nsSliderMediator::MouseUp(nsIDOMEvent* aMouseEvent) nsresult nsSliderFrame::MouseDown(nsIDOMEvent* aMouseEvent) { - //printf("Begin dragging\n"); + //PRINTF("Begin dragging\n"); PRBool isHorizontal = IsHorizontal(); @@ -884,7 +889,7 @@ nsSliderFrame::MouseDown(nsIDOMEvent* aMouseEvent) else mThumbStart = thumbRect.y; - //printf("Pressed mDragStartPx=%d\n",mDragStartPx); + //PRINTF("Pressed mDragStartPx=%d\n",mDragStartPx); return NS_OK; } @@ -892,7 +897,7 @@ nsSliderFrame::MouseDown(nsIDOMEvent* aMouseEvent) nsresult nsSliderFrame::MouseUp(nsIDOMEvent* aMouseEvent) { - // printf("Finish dragging\n"); + // PRINTF("Finish dragging\n"); return NS_OK; } diff --git a/mozilla/layout/xul/base/src/nsSplitterFrame.cpp b/mozilla/layout/xul/base/src/nsSplitterFrame.cpp index 63ababf015f..369c9a5987e 100644 --- a/mozilla/layout/xul/base/src/nsSplitterFrame.cpp +++ b/mozilla/layout/xul/base/src/nsSplitterFrame.cpp @@ -54,6 +54,11 @@ #include "nsIXBLService.h" #include "nsIServiceManager.h" #include "nsHTMLContainerFrame.h" +#include "nslog.h" + +NS_IMPL_LOG(nsSplitterFrameLog) +#define PRINTF NS_LOG_PRINTF(nsSplitterFrameLog) +#define FLUSH NS_LOG_FLUSH(nsSplitterFrameLog) #define REAL_TIME_DRAG @@ -513,7 +518,7 @@ nsSplitterFrameInner::MouseUp(nsIPresContext* aPresContext, nsGUIEvent* aEvent) mPressed = PR_FALSE; - //printf("MouseUp\n"); + //PRINTF("MouseUp\n"); } } @@ -523,7 +528,7 @@ nsSplitterFrameInner::MouseDrag(nsIPresContext* aPresContext, nsGUIEvent* aEvent { if (mDragging) { - //printf("Dragging\n"); + //PRINTF("Dragging\n"); PRBool isHorizontal = !mOuter->IsHorizontal(); // convert coord to pixels @@ -568,7 +573,7 @@ nsSplitterFrameInner::MouseDrag(nsIPresContext* aPresContext, nsGUIEvent* aEvent // take our current position and substract the start location pos -= start; - //printf("Diff=%d\n", pos); + //PRINTF("Diff=%d\n", pos); ResizeType resizeAfter = GetResizeAfter(); @@ -600,7 +605,7 @@ nsSplitterFrameInner::MouseDrag(nsIPresContext* aPresContext, nsGUIEvent* aEvent if (currentState == Dragging) { if (oldPos > 0 && oldPos > pos) { - //printf("Collapse right\n"); + //PRINTF("Collapse right\n"); if (GetCollapseDirection() == After) { mOuter->mContent->SetAttribute(kNameSpaceID_None, nsXULAtoms::state, NS_ConvertASCIItoUCS2("collapsed"), PR_TRUE); @@ -609,7 +614,7 @@ nsSplitterFrameInner::MouseDrag(nsIPresContext* aPresContext, nsGUIEvent* aEvent } else if (oldPos < 0 && oldPos < pos) { - //printf("Collapse left\n"); + //PRINTF("Collapse left\n"); if (GetCollapseDirection() == Before) { mOuter->mContent->SetAttribute(kNameSpaceID_None, nsXULAtoms::state, NS_ConvertASCIItoUCS2("collapsed"), PR_TRUE); @@ -634,12 +639,12 @@ nsSplitterFrameInner::MouseDrag(nsIPresContext* aPresContext, nsGUIEvent* aEvent - // printf("----- resize ----- "); + // PRINTF("----- resize ----- "); /* for (i=0; i < mChildInfosBeforeCount; i++) - printf("before, index=%d, current=%d, changed=%d\n", mChildInfosBefore[i].index, mChildInfosBefore[i].current, mChildInfosBefore[i].changed); + PRINTF("before, index=%d, current=%d, changed=%d\n", mChildInfosBefore[i].index, mChildInfosBefore[i].current, mChildInfosBefore[i].changed); for (i=0; i < mChildInfosAfterCount; i++) - printf("after, index=%d, current=%d, changed=%d\n", mChildInfosAfter[i].index, mChildInfosAfter[i].current, mChildInfosAfter[i].changed); + PRINTF("after, index=%d, current=%d, changed=%d\n", mChildInfosAfter[i].index, mChildInfosAfter[i].current, mChildInfosAfter[i].changed); */ /* @@ -915,7 +920,7 @@ nsSplitterFrameInner::MouseDown(nsIDOMEvent* aMouseEvent) mDragStartPx = c; - //printf("Pressed mDragStartPx=%d\n",mDragStartPx); + //PRINTF("Pressed mDragStartPx=%d\n",mDragStartPx); return NS_OK; } @@ -923,7 +928,7 @@ nsSplitterFrameInner::MouseDown(nsIDOMEvent* aMouseEvent) nsresult nsSplitterFrameInner::MouseMove(nsIDOMEvent* aMouseEvent) { - //printf("Mouse move\n"); + //PRINTF("Mouse move\n"); if (!mPressed) return NS_OK; @@ -1044,7 +1049,7 @@ nsSplitterFrameInner::AdjustChildren(nsIPresContext* aPresContext) AdjustChildren(aPresContext, mChildInfosAfter, mChildInfosAfterCount, isHorizontal); - // printf("----- Posting Dirty -----\n"); + // PRINTF("----- Posting Dirty -----\n"); #ifdef REAL_TIME_DRAG @@ -1117,7 +1122,7 @@ nsSplitterFrameInner::AdjustChildren(nsIPresContext* aPresContext) void nsSplitterFrameInner::AdjustChildren(nsIPresContext* aPresContext, nsSplitterInfo* aChildInfos, PRInt32 aCount, PRBool aIsHorizontal) { - ///printf("------- AdjustChildren------\n"); + ///PRINTF("------- AdjustChildren------\n"); nsBoxLayoutState state(aPresContext); @@ -1150,7 +1155,7 @@ nsSplitterFrameInner::AdjustChildren(nsIPresContext* aPresContext, nsSplitterInf void nsSplitterFrameInner::SetPreferredSize(nsBoxLayoutState& aState, nsIBox* aChildBox, nscoord aOnePixel, PRBool aIsHorizontal, nscoord* aSize) { - //printf("current=%d, pref=%d", current/onePixel, pref/onePixel); + //PRINTF("current=%d, pref=%d", current/onePixel, pref/onePixel); nscoord current = 0; @@ -1207,7 +1212,7 @@ nsSplitterFrameInner::SetPreferredSize(nsBoxLayoutState& aState, nsIBox* aChildB aChildBox->MarkDirty(aState); #endif - //printf("\n"); + //PRINTF("\n"); } diff --git a/mozilla/layout/xul/base/src/nsSprocketLayout.cpp b/mozilla/layout/xul/base/src/nsSprocketLayout.cpp index 970825c1a4b..d2133eff456 100644 --- a/mozilla/layout/xul/base/src/nsSprocketLayout.cpp +++ b/mozilla/layout/xul/base/src/nsSprocketLayout.cpp @@ -43,6 +43,11 @@ #include "nsHTMLAtoms.h" #include "nsXULAtoms.h" #include "nsBoxFrame.h" +#include "nslog.h" + +NS_IMPL_LOG(nsSprocketLayoutLog) +#define PRINTF NS_LOG_PRINTF(nsSprocketLayoutLog) +#define FLUSH NS_LOG_FLUSH(nsSprocketLayoutLog) nsCOMPtr nsSprocketLayout::gInstance = new nsSprocketLayout(); @@ -124,7 +129,7 @@ nsSprocketLayout::Layout(nsIBox* aBox, nsBoxLayoutState& aState) GetFrameState(aBox, frameState); //if (frameState & NS_STATE_CURRENTLY_IN_DEBUG) - // printf("In debug\n"); + // PRINTF("In debug\n"); // ----- build a list of our child desired sizes and computeds sizes ------ @@ -198,7 +203,7 @@ nsSprocketLayout::Layout(nsIBox* aBox, nsBoxLayoutState& aState) #ifdef DEBUG_REFLOW if (passes > 0) { AddIndents(); - printf("ChildResized doing pass: %d\n", passes); + PRINTF("ChildResized doing pass: %d\n", passes); } #endif @@ -411,7 +416,7 @@ nsSprocketLayout::Layout(nsIBox* aBox, nsBoxLayoutState& aState) { #ifdef DEBUG_GROW child->DumpBox(stdout); - printf(" GREW from (%d,%d) -> (%d,%d)\n", childRect.width, childRect.height, newChildRect.width, newChildRect.height); + PRINTF(" GREW from (%d,%d) -> (%d,%d)\n", childRect.width, childRect.height, newChildRect.width, newChildRect.height); #endif newChildRect.Inflate(margin); childRect.Inflate(margin); @@ -605,7 +610,7 @@ nsSprocketLayout::PopulateBoxSizes(nsIBox* aBox, nsBoxLayoutState& aState, nsBox GetFrameState(aBox, frameState); //if (frameState & NS_STATE_CURRENTLY_IN_DEBUG) - // printf("In debug\n"); + // PRINTF("In debug\n"); aMinSize = 0; aMaxSize = NS_INTRINSICSIZE; diff --git a/mozilla/layout/xul/base/src/nsStackFrame.cpp b/mozilla/layout/xul/base/src/nsStackFrame.cpp index c187b2cfaab..4e446b0f583 100644 --- a/mozilla/layout/xul/base/src/nsStackFrame.cpp +++ b/mozilla/layout/xul/base/src/nsStackFrame.cpp @@ -45,6 +45,11 @@ #include "nsIViewManager.h" #include "nsBoxLayoutState.h" #include "nsStackLayout.h" +#include "nslog.h" + +NS_IMPL_LOG(nsStackFrameLog) +#define PRINTF NS_LOG_PRINTF(nsStackFrameLog) +#define FLUSH NS_LOG_FLUSH(nsStackFrameLog) nsresult NS_NewStackFrame ( nsIPresShell* aPresShell, nsIFrame** aNewFrame, nsIBoxLayout* aLayoutManager) @@ -141,11 +146,11 @@ nsStackFrame::GetFrameForPoint(nsIPresContext* aPresContext, #ifdef NS_DEBUG - printf("\n------------"); + PRINTF("\n------------"); if (*aFrame) nsFrame::ListTag(stdout, *aFrame); - printf("--------------\n"); + PRINTF("--------------\n"); #endif diff --git a/mozilla/layout/xul/base/src/nsStackLayout.cpp b/mozilla/layout/xul/base/src/nsStackLayout.cpp index 1491624ac07..eb98b91922c 100644 --- a/mozilla/layout/xul/base/src/nsStackLayout.cpp +++ b/mozilla/layout/xul/base/src/nsStackLayout.cpp @@ -32,6 +32,11 @@ #include "nsCOMPtr.h" #include "nsBoxLayoutState.h" #include "nsBox.h" +#include "nslog.h" + +NS_IMPL_LOG(nsStackLayoutLog) +#define PRINTF NS_LOG_PRINTF(nsStackLayoutLog) +#define FLUSH NS_LOG_FLUSH(nsStackLayoutLog) nsCOMPtr nsStackLayout::gInstance = new nsStackLayout(); @@ -262,7 +267,7 @@ nsStackLayout::Layout(nsIBox* aBox, nsBoxLayoutState& aState) } NS_BOX_ASSERTION(aBox, passes < 10,"Infinite loop! Someone won't stop growing!!"); //if (passes > 3) - // printf("Growing!!!\n"); + // PRINTF("Growing!!!\n"); passes++; } while(grow); diff --git a/mozilla/layout/xul/base/src/nsTextBoxFrame.cpp b/mozilla/layout/xul/base/src/nsTextBoxFrame.cpp index c0daa16f613..87b52d0a602 100644 --- a/mozilla/layout/xul/base/src/nsTextBoxFrame.cpp +++ b/mozilla/layout/xul/base/src/nsTextBoxFrame.cpp @@ -41,6 +41,11 @@ #include "nsINameSpaceManager.h" #include "nsBoxLayoutState.h" #include "nsMenuBarListener.h" +#include "nslog.h" + +NS_IMPL_LOG(nsTextBoxFrameLog) +#define PRINTF NS_LOG_PRINTF(nsTextBoxFrameLog) +#define FLUSH NS_LOG_FLUSH(nsTextBoxFrameLog) #define ELLIPSIS "..." @@ -460,7 +465,7 @@ nsTextBoxFrame::CalculateTitleForWidth(nsIPresContext* aPresContext, char chc[100]; copy.ToCString(chc,100); - printf("i=%d, i2=%d, diff=%d, old='%s', new='%s', aWidth=%d\n", i, i2, i2-i, cht,chc, aWidth); + PRINTF("i=%d, i2=%d, diff=%d, old='%s', new='%s', aWidth=%d\n", i, i2, i2-i, cht,chc, aWidth); */ mCroppedTitle.Insert(ellipsisLeft + copy, 0); diff --git a/mozilla/layout/xul/base/src/nsTitledButtonFrame.cpp b/mozilla/layout/xul/base/src/nsTitledButtonFrame.cpp index 89a47319c66..86ff73a3811 100644 --- a/mozilla/layout/xul/base/src/nsTitledButtonFrame.cpp +++ b/mozilla/layout/xul/base/src/nsTitledButtonFrame.cpp @@ -76,6 +76,11 @@ #include "nsMenuBarListener.h" #include "nsFormControlHelper.h" +#include "nslog.h" + +NS_IMPL_LOG(nsTitledButtonFrameLog) +#define PRINTF NS_LOG_PRINTF(nsTitledButtonFrameLog) +#define FLUSH NS_LOG_FLUSH(nsTitledButtonFrameLog) #define ONLOAD_CALLED_TOO_EARLY 1 @@ -425,7 +430,7 @@ nsTitledButtonFrame::UpdateAttributes(nsIPresContext* aPresContext, nsIAtom* aA mTitle.ToCString(a,100); value.ToCString(b,100); - printf(" value changed '%s'->'%s'\n",a,b); + PRINTF(" value changed '%s'->'%s'\n",a,b); */ aResize = PR_TRUE; mTitle = value; @@ -487,14 +492,14 @@ nsTitledButtonFrame::Paint(nsIPresContext* aPresContext, { #ifdef DEBUG_shaver if (dump_stack) { - fprintf(stderr, "Paint(%p)\n", this); + FPRINTF(stderr, "Paint(%p)\n", this); void *bt[15]; int n = backtrace(bt, sizeof bt / sizeof (bt[0])); if (n) { char **names = backtrace_symbols(bt, n); for (int i = 5; i < n; ++i) - printf("\t\t%s\n", names[i]); + PRINTF("\t\t%s\n", names[i]); free(names); } } @@ -812,7 +817,7 @@ nsTitledButtonFrame::CalculateTitleForWidth(nsIPresContext* aPresContext, nsIRen char chc[100]; copy.ToCString(chc,100); - printf("i=%d, i2=%d, diff=%d, old='%s', new='%s', aWidth=%d\n", i, i2, i2-i, cht,chc, aWidth); + PRINTF("i=%d, i2=%d, diff=%d, old='%s', new='%s', aWidth=%d\n", i, i2, i2-i, cht,chc, aWidth); */ mCroppedTitle = elipsisLeft + copy + mCroppedTitle; break; diff --git a/mozilla/layout/xul/base/src/nsToolbarItemFrame.cpp b/mozilla/layout/xul/base/src/nsToolbarItemFrame.cpp index 82f84e48535..4937f1f6c87 100644 --- a/mozilla/layout/xul/base/src/nsToolbarItemFrame.cpp +++ b/mozilla/layout/xul/base/src/nsToolbarItemFrame.cpp @@ -25,6 +25,11 @@ #include "nsCOMPtr.h" #include "nsWidgetsCID.h" +#include "nslog.h" + +NS_IMPL_LOG(nsToolbarItemFrameLog) +#define PRINTF NS_LOG_PRINTF(nsToolbarItemFrameLog) +#define FLUSH NS_LOG_FLUSH(nsToolbarItemFrameLog) // Drag & Drop, Clipboard Support static NS_DEFINE_CID(kCDragServiceCID, NS_DRAGSERVICE_CID); @@ -152,7 +157,7 @@ nsToolbarItemFrame::HandleEvent(nsIPresContext* aPresContext, } nsServiceManager::ReleaseService(kCDragServiceCID, dragService); } */ - printf("ToolbarItem %d\n", aEvent->message); + PRINTF("ToolbarItem %d\n", aEvent->message); return nsBoxFrame::HandleEvent(aPresContext, aEvent, aEventStatus); } diff --git a/mozilla/layout/xul/base/src/nsXULTreeOuterGroupFrame.cpp b/mozilla/layout/xul/base/src/nsXULTreeOuterGroupFrame.cpp index b5f6ec14372..1071f3926d3 100644 --- a/mozilla/layout/xul/base/src/nsXULTreeOuterGroupFrame.cpp +++ b/mozilla/layout/xul/base/src/nsXULTreeOuterGroupFrame.cpp @@ -44,6 +44,11 @@ #include "nsTempleLayout.h" #include "nsTreeLayout.h" #include "nsITimer.h" +#include "nslog.h" + +NS_IMPL_LOG(nsXULTreeOuterGroupFrameLog) +#define PRINTF NS_LOG_PRINTF(nsXULTreeOuterGroupFrameLog) +#define FLUSH NS_LOG_FLUSH(nsXULTreeOuterGroupFrameLog) #define TICK_FACTOR 50 @@ -193,7 +198,7 @@ void nsScrollSmoother::Stop() NS_IMETHODIMP_(void) nsScrollSmoother::Notify(nsITimer *timer) { - //printf("Timer Callback!\n"); + //PRINTF("Timer Callback!\n"); Stop(); @@ -565,7 +570,7 @@ nsXULTreeOuterGroupFrame::PositionChanged(PRInt32 aOldIndex, PRInt32& aNewIndex) nsScrollSmoother* smoother = GetSmoother(); - //printf("%d rows, %d per row, Estimated time needed %d, Threshhold %d (%s)\n", rowDelta, mTimePerRow, mTimePerRow * rowDelta, USER_TIME_THRESHOLD, (mTimePerRow * rowDelta > USER_TIME_THRESHOLD) ? "Nope" : "Yep"); + //PRINTF("%d rows, %d per row, Estimated time needed %d, Threshhold %d (%s)\n", rowDelta, mTimePerRow, mTimePerRow * rowDelta, USER_TIME_THRESHOLD, (mTimePerRow * rowDelta > USER_TIME_THRESHOLD) ? "Nope" : "Yep"); // if we can't scroll the rows in time then start a timer. We will eat // events until the user stops moving and the timer stops. @@ -579,7 +584,7 @@ nsXULTreeOuterGroupFrame::PositionChanged(PRInt32 aOldIndex, PRInt32& aNewIndex) smoother->mDelta = newTwipIndex > oldTwipIndex ? rowDelta : -rowDelta; - //printf("Eating scroll!\n"); + //PRINTF("Eating scroll!\n"); smoother->Start(); @@ -635,7 +640,7 @@ nsXULTreeOuterGroupFrame::InternalPositionChanged(PRBool aUp, PRInt32 aDelta) // begin timing how long it takes to scroll a row PRTime start = PR_Now(); - //printf("Actually doing scroll mCurrentIndex=%d, delta=%d!\n", mCurrentIndex, aDelta); + //PRINTF("Actually doing scroll mCurrentIndex=%d, delta=%d!\n", mCurrentIndex, aDelta); //if (mContentChain) { // XXX Eventually we need to make the code smart enough to look at a content chain @@ -731,7 +736,7 @@ nsXULTreeOuterGroupFrame::InternalPositionChanged(PRBool aUp, PRInt32 aDelta) // average old and new mTimePerRow = (newTime + mTimePerRow)/2; - //printf("time per row=%d\n", mTimePerRow); + //PRINTF("time per row=%d\n", mTimePerRow); return NS_OK; } @@ -1320,14 +1325,14 @@ nsXULTreeOuterGroupFrame :: HandleAutoScrollTracking ( const nsPoint & aPoint ) PRBool scrollUp = PR_FALSE; if ( IsInDragScrollRegion(aPoint, &scrollUp) ) { if ( mAutoScrollTimerStarted ) { -printf("waiting...\n"); + PRINTF("waiting...\n"); if ( mAutoScrollTimerHasFired ) { // we're in the right area and the timer has fired, so scroll ScrollToIndex ( scrollUp ? mCurrentIndex - 1 : mCurrentIndex + 1); } } else { -printf("starting timer\n"); + PRINTF("starting timer\n"); // timer hasn't started yet, kick it off. Remember, this timer is a one-shot mAutoScrollTimer = do_CreateInstance("@mozilla.org/timer;1"); if ( mAutoScrollTimer ) { @@ -1418,7 +1423,7 @@ nsXULTreeOuterGroupFrame :: IsInDragScrollRegion ( const nsPoint& inPoint, PRBoo void nsXULTreeOuterGroupFrame :: Notify ( nsITimer* timer ) { -printf("000 FIRE\n"); + PRINTF("000 FIRE\n"); mAutoScrollTimerHasFired = PR_TRUE; } @@ -1426,7 +1431,7 @@ printf("000 FIRE\n"); nsresult nsXULTreeOuterGroupFrame :: StopScrollTracking() { -printf("--stop\n"); + PRINTF("--stop\n"); if ( mAutoScrollTimer && mAutoScrollTimerStarted ) mAutoScrollTimer->Cancel(); mAutoScrollTimerHasFired = PR_FALSE; diff --git a/mozilla/mailnews/absync/src/nsAbSync.cpp b/mozilla/mailnews/absync/src/nsAbSync.cpp index 995ee883396..e3c41b526d2 100644 --- a/mozilla/mailnews/absync/src/nsAbSync.cpp +++ b/mozilla/mailnews/absync/src/nsAbSync.cpp @@ -45,6 +45,11 @@ #include "nsIInterfaceRequestor.h" #include "nsIDocShellTreeItem.h" #include "nsIDocShellTreeNode.h" +#include "nslog.h" + +NS_IMPL_LOG(nsAbSyncLog) +#define PRINTF NS_LOG_PRINTF(nsAbSyncLog) +#define FLUSH NS_LOG_FLUSH(nsAbSyncLog) static NS_DEFINE_CID(kCAbSyncPostEngineCID, NS_ABSYNC_POST_ENGINE_CID); static NS_DEFINE_CID(kPrefCID, NS_PREF_CID); @@ -553,7 +558,7 @@ NS_IMETHODIMP nsAbSync::OnStopOperation(PRInt32 aTransactionID, nsresult aStatus mCurrentState = nsIAbSyncState::nsIAbSyncIdle; #ifdef DEBUG_rhp - printf("ABSYNC: OnStopOperation: Status = %d\n", aStatus); + PRINTF("ABSYNC: OnStopOperation: Status = %d\n", aStatus); #endif return NS_OK; } @@ -749,7 +754,7 @@ nsAbSync::GenerateProtocolForCard(nsIAbCard *aCard, PRBool aAddId, nsString &pro return NS_ERROR_FAILURE; #ifdef DEBUG_rhp - printf("ABSYNC: GENERATING PROTOCOL FOR CARD - Address Book Card Key: %d\n", aKey); + PRINTF("ABSYNC: GENERATING PROTOCOL FOR CARD - Address Book Card Key: %d\n", aKey); #endif char *tVal = PR_smprintf("%d", (aKey * -1)); @@ -1117,7 +1122,7 @@ nsAbSync::AnalyzeAllRecords(nsIAddrDatabase *aDatabase, nsIAbDirectory *director mCurrentPostRecord = 1; #ifdef DEBUG_rhp - printf("ABSYNC: AnalyzeAllRecords:\n"); + PRINTF("ABSYNC: AnalyzeAllRecords:\n"); #endif // @@ -1327,11 +1332,11 @@ nsAbSync::AnalyzeAllRecords(nsIAddrDatabase *aDatabase, nsIAbDirectory *director } #ifdef DEBUG_rhp - printf("------ Entry #%d --------\n", readCount); - printf("Old Sync Table: %d\n", mOldSyncMapingTable[readCount].serverID); - printf("Old Sync Table: %d\n", mOldSyncMapingTable[readCount].localID); - printf("Old Sync Table: %d\n", mOldSyncMapingTable[readCount].CRC); - printf("Old Sync Table: %d\n", mOldSyncMapingTable[readCount].flags); + PRINTF("------ Entry #%d --------\n", readCount); + PRINTF("Old Sync Table: %d\n", mOldSyncMapingTable[readCount].serverID); + PRINTF("Old Sync Table: %d\n", mOldSyncMapingTable[readCount].localID); + PRINTF("Old Sync Table: %d\n", mOldSyncMapingTable[readCount].CRC); + PRINTF("Old Sync Table: %d\n", mOldSyncMapingTable[readCount].flags); #endif readCount++; @@ -1400,7 +1405,7 @@ nsAbSync::AnalyzeAllRecords(nsIAddrDatabase *aDatabase, nsIAbDirectory *director { #ifdef DEBUG_rhp char *t = singleProtocolLine.ToNewCString(); - printf("ABSYNC: ADDING Card: %s\n", t); + PRINTF("ABSYNC: ADDING Card: %s\n", t); PR_FREEIF(t); #endif char *tVal3 = PR_smprintf("%d", mCurrentPostRecord); @@ -1420,7 +1425,7 @@ nsAbSync::AnalyzeAllRecords(nsIAddrDatabase *aDatabase, nsIAbDirectory *director { #ifdef DEBUG_rhp char *t = singleProtocolLine.ToNewCString(); - printf("ABSYNC: MODIFYING Card: %s\n", t); + PRINTF("ABSYNC: MODIFYING Card: %s\n", t); PR_FREEIF(t); #endif char *tVal4 = PR_smprintf("%d", mCurrentPostRecord); @@ -1460,7 +1465,7 @@ nsAbSync::AnalyzeAllRecords(nsIAddrDatabase *aDatabase, nsIAbDirectory *director if (tVal) { #ifdef DEBUG_rhp - printf("ABSYNC: DELETING Card: %d\n", mOldSyncMapingTable[readCount].serverID); + PRINTF("ABSYNC: DELETING Card: %d\n", mOldSyncMapingTable[readCount].serverID); #endif char *tVal2 = PR_smprintf("%d", mCurrentPostRecord); @@ -1562,7 +1567,7 @@ nsAbSync::PatchHistoryTableWithNewID(PRInt32 clientID, PRInt32 serverID, PRInt32 if (mNewSyncMapingTable[i].localID == (clientID * aMultiplier)) { #ifdef DEBUG_rhp - printf("ABSYNC: PATCHING History Table - Client: %d - Server: %d\n", clientID, serverID); + PRINTF("ABSYNC: PATCHING History Table - Client: %d - Server: %d\n", clientID, serverID); #endif mNewSyncMapingTable[i].serverID = serverID; @@ -2608,7 +2613,7 @@ nsAbSync::AddNewUsers() serverID = val->ToInteger(&errorCode); #ifdef DEBUG_rhp - printf("ABSYNC: ADDING Card: %d\n", serverID); + PRINTF("ABSYNC: ADDING Card: %d\n", serverID); #endif } @@ -2889,7 +2894,7 @@ nsAbSync::AddValueToNewCard(nsIAbCard *aCard, nsString *aTagName, nsString *aTag { #ifdef DEBUG_rhp char *t = aTagValue->ToNewCString(); - printf("Email: %s\n", t); + PRINTF("Email: %s\n", t); PR_FREEIF(t); #endif aCard->SetPrimaryEmail(aTagValue->GetUnicode()); diff --git a/mozilla/mailnews/absync/src/nsAbSyncPostEngine.cpp b/mozilla/mailnews/absync/src/nsAbSyncPostEngine.cpp index 06b7c59dd07..10565fe6ab5 100644 --- a/mozilla/mailnews/absync/src/nsAbSyncPostEngine.cpp +++ b/mozilla/mailnews/absync/src/nsAbSyncPostEngine.cpp @@ -46,6 +46,11 @@ #include "nsICookieService.h" #include "nsIAbSync.h" #include "nsAbSyncCID.h" +#include "nslog.h" + +NS_IMPL_LOG(nsAbSyncPostEngineLog) +#define PRINTF NS_LOG_PRINTF(nsAbSyncPostEngineLog) +#define FLUSH NS_LOG_FLUSH(nsAbSyncPostEngineLog) static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID); static NS_DEFINE_CID(kPrefCID, NS_PREF_CID); @@ -430,7 +435,7 @@ nsresult nsAbSyncPostEngine::OnStopRequest(nsIChannel *aChannel, nsISupports * /* ctxt */, nsresult aStatus, const PRUnichar* aMsg) { #ifdef NS_DEBUG_rhp - printf("nsAbSyncPostEngine::OnStopRequest()\n"); + PRINTF("nsAbSyncPostEngine::OnStopRequest()\n"); #endif char *tProtResponse = nsnull; @@ -804,7 +809,7 @@ nsAbSyncPostEngine::KickTheSyncOperation(void) PR_FREEIF(protString); #ifdef DEBUG_rhp - printf("COMMAND = %s\n", tCommand); + PRINTF("COMMAND = %s\n", tCommand); #endif if (!tCommand) diff --git a/mozilla/mailnews/addrbook/src/nsAddressBook.cpp b/mozilla/mailnews/addrbook/src/nsAddressBook.cpp index ab74a6a1c1e..548a490a0ec 100644 --- a/mozilla/mailnews/addrbook/src/nsAddressBook.cpp +++ b/mozilla/mailnews/addrbook/src/nsAddressBook.cpp @@ -53,6 +53,11 @@ #include "nsIFilePicker.h" #include "nsIPref.h" #include "nsVoidArray.h" +#include "nslog.h" + +NS_IMPL_LOG(nsAddressBookLog) +#define PRINTF NS_LOG_PRINTF(nsAddressBookLog) +#define FLUSH NS_LOG_FLUSH(nsAddressBookLog) static NS_DEFINE_CID(kPrefCID, NS_PREF_CID); static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID); @@ -251,7 +256,7 @@ nsresult nsAddressBook::DoCommand(nsIRDFCompositeDataSource* db, char *command, NS_IMETHODIMP nsAddressBook::PrintCard() { #ifdef DEBUG_seth - printf("nsAddressBook::PrintCard()\n"); + PRINTF("nsAddressBook::PrintCard()\n"); #endif nsresult rv = NS_ERROR_FAILURE; @@ -259,7 +264,7 @@ NS_IMETHODIMP nsAddressBook::PrintCard() if (!mDocShell) { #ifdef DEBUG_seth - printf("can't print, there is no docshell\n"); + PRINTF("can't print, there is no docshell\n"); #endif return rv; } @@ -274,13 +279,13 @@ NS_IMETHODIMP nsAddressBook::PrintCard() } #ifdef DEBUG_seth else { - printf("content viewer does not support printing\n"); + PRINTF("content viewer does not support printing\n"); } #endif } #ifdef DEBUG_seth else { - printf("failed to get the viewer for printing\n"); + PRINTF("failed to get the viewer for printing\n"); } #endif @@ -290,7 +295,7 @@ NS_IMETHODIMP nsAddressBook::PrintCard() NS_IMETHODIMP nsAddressBook::PrintAddressbook() { #ifdef DEBUG_seth - printf("nsAddressBook::PrintAddressbook()\n"); + PRINTF("nsAddressBook::PrintAddressbook()\n"); #endif return NS_ERROR_NOT_IMPLEMENTED; } @@ -1421,7 +1426,7 @@ NS_IMETHODIMP nsAddressBook::ConvertNA2toLDIF(nsIFileSpec *srcFileSpec, nsIFileS do { rv = abUpgrader->ContinueExport(&done); // todo: put this in the msg status - printf("converting na2 to ldif...\n"); + PRINTF("converting na2 to ldif...\n"); } while (NS_SUCCEEDED(rv) && !done); } return rv; @@ -1474,7 +1479,7 @@ NS_IMETHODIMP nsAddressBook::ImportAddressBook() nsCOMPtr abUpgrader = do_GetService(NS_AB4xUPGRADER_CONTRACTID, &rv); if (NS_FAILED(rv) || !abUpgrader) { // todo: make this an alert - printf("this product can't import Netscape 4.x addressbooks. use the commercial build\n"); + PRINTF("this product can't import Netscape 4.x addressbooks. use the commercial build\n"); return NS_ERROR_FAILURE; } diff --git a/mozilla/mailnews/addrbook/src/nsDirPrefs.cpp b/mozilla/mailnews/addrbook/src/nsDirPrefs.cpp index 6f8d1b8c88b..904fc6bd104 100644 --- a/mozilla/mailnews/addrbook/src/nsDirPrefs.cpp +++ b/mozilla/mailnews/addrbook/src/nsDirPrefs.cpp @@ -39,6 +39,11 @@ #include "xp_str.h" #include "xp_file.h" #include "prprf.h" +#include "nslog.h" + +NS_IMPL_LOG(nsDirPrefsLog) +#define PRINTF NS_LOG_PRINTF(nsDirPrefsLog) +#define FLUSH NS_LOG_FLUSH(nsDirPrefsLog) static NS_DEFINE_CID(kPrefCID, NS_PREF_CID); static NS_DEFINE_CID(kAddrBookSessionCID, NS_ADDRBOOKSESSION_CID); @@ -476,7 +481,7 @@ nsresult DIR_AddNewAddressBook(const PRUnichar *dirName, const char *fileName, P } #ifdef DEBUG_sspitzer else { - printf("don't set the prefs, they are already set since this ab was migrated\n"); + PRINTF("don't set the prefs, they are already set since this ab was migrated\n"); } #endif *pServer = server; @@ -3439,13 +3444,13 @@ nsresult DIR_GetServerPreferences(nsVoidArray** list) nsCOMPtr abUpgrader = do_GetService(NS_AB4xUPGRADER_CONTRACTID, &rv); if (NS_FAILED(rv) || !abUpgrader) { #ifdef DEBUG_sspitzer_ - printf("move the pab aside, since we don't have the ab upgrader\n"); + PRINTF("move the pab aside, since we don't have the ab upgrader\n"); #endif dir_ConvertToMabFileName(); } #ifdef DEBUG_sspitzer_ else { - printf("don't touch the 4.x pab. we will migrate it\n"); + PRINTF("don't touch the 4.x pab. we will migrate it\n"); } #endif } diff --git a/mozilla/mailnews/base/search/src/nsMsgFilter.cpp b/mozilla/mailnews/base/search/src/nsMsgFilter.cpp index 00f705593fc..a30d33f157e 100644 --- a/mozilla/mailnews/base/search/src/nsMsgFilter.cpp +++ b/mozilla/mailnews/base/search/src/nsMsgFilter.cpp @@ -36,6 +36,11 @@ #include "nsMsgSearchScopeTerm.h" #include "nsIMsgAccountManager.h" #include "nsMsgSearchValue.h" +#include "nslog.h" + +NS_IMPL_LOG(nsMsgFilterLog) +#define PRINTF NS_LOG_PRINTF(nsMsgFilterLog) +#define FLUSH NS_LOG_FLUSH(nsMsgFilterLog) static const char *kImapPrefix = "//imap:"; @@ -615,7 +620,7 @@ nsMsgFilter::GetVersion() #ifdef DEBUG void nsMsgFilter::Dump() { - printf("filter %s type = %c desc = %s\n", m_filterName.GetBuffer(), m_type + '0', m_description.GetBuffer()); + PRINTF("filter %s type = %c desc = %s\n", m_filterName.GetBuffer(), m_type + '0', m_description.GetBuffer()); } #endif diff --git a/mozilla/mailnews/base/search/src/nsMsgFilterDataSource.cpp b/mozilla/mailnews/base/search/src/nsMsgFilterDataSource.cpp index a933516cd92..dc0845f12e2 100644 --- a/mozilla/mailnews/base/search/src/nsMsgFilterDataSource.cpp +++ b/mozilla/mailnews/base/search/src/nsMsgFilterDataSource.cpp @@ -146,7 +146,7 @@ nsMsgFilterDataSource::GetTargets(nsIRDFResource *aSource, } else { - NS_WARNING("ArcLabelsOut(): unknown filter delegate!\n"); + NS_WARNING("ArcLabelsOut(): unknown filter delegate!"); } } @@ -191,7 +191,7 @@ nsMsgFilterDataSource::GetTarget(nsIRDFResource *aSource, rv = getFilterTarget(filter, aProperty, aTruthValue, aResult); else { - NS_WARNING("GetTarget(): unknown filter delegate!\n"); + NS_WARNING("GetTarget(): unknown filter delegate!"); } } @@ -237,7 +237,7 @@ nsMsgFilterDataSource::ArcLabelsOut(nsIRDFResource *aSource, arcs = mFilterArcsOut; else { - NS_WARNING("GetTargets(): unknown filter delegate!\n"); + NS_WARNING("GetTargets(): unknown filter delegate!"); } } diff --git a/mozilla/mailnews/base/search/src/nsMsgFilterList.cpp b/mozilla/mailnews/base/search/src/nsMsgFilterList.cpp index 558621825aa..555923d0b79 100644 --- a/mozilla/mailnews/base/search/src/nsMsgFilterList.cpp +++ b/mozilla/mailnews/base/search/src/nsMsgFilterList.cpp @@ -36,6 +36,11 @@ #include "nsMsgBaseCID.h" #include "nsIMsgFilterService.h" +#include "nslog.h" + +NS_IMPL_LOG(nsMsgFilterListLog) +#define PRINTF NS_LOG_PRINTF(nsMsgFilterListLog) +#define FLUSH NS_LOG_FLUSH(nsMsgFilterListLog) static NS_DEFINE_CID(kMsgFilterServiceCID, NS_MSGFILTERSERVICE_CID); @@ -908,7 +913,7 @@ void nsMsgFilterList::Dump() { PRUint32 filterCount; m_filters->Count(&filterCount); - printf("%d filters\n", filterCount); + PRINTF("%d filters\n", filterCount); for (PRUint32 i = 0; i < filterCount; i++) { diff --git a/mozilla/mailnews/base/search/src/nsMsgSearchDataSource.cpp b/mozilla/mailnews/base/search/src/nsMsgSearchDataSource.cpp index 342d0949484..d758ca248c5 100644 --- a/mozilla/mailnews/base/search/src/nsMsgSearchDataSource.cpp +++ b/mozilla/mailnews/base/search/src/nsMsgSearchDataSource.cpp @@ -34,6 +34,12 @@ #include "nsXPIDLString.h" #endif +#include "nslog.h" + +NS_IMPL_LOG(nsMsgSearchDataSourceLog) +#define PRINTF NS_LOG_PRINTF(nsMsgSearchDataSourceLog) +#define FLUSH NS_LOG_FLUSH(nsMsgSearchDataSourceLog) + nsCOMPtr nsMsgSearchDataSource::kNC_MessageChild; nsrefcnt nsMsgSearchDataSource::gInstanceCount = 0; PRUint32 nsMsgSearchDataSource::gCurrentURINum = 0; @@ -85,7 +91,7 @@ nsMsgSearchDataSource::OnSearchHit(nsIMsgDBHdr* aMsgHdr, nsIMsgFolder *folder) nsresult rv; #ifdef DEBUG - printf("nsMsgSearchDataSource::OnSearchHit!!\n"); + PRINTF("nsMsgSearchDataSource::OnSearchHit!!\n"); #endif nsCOMPtr message; diff --git a/mozilla/mailnews/base/src/nsMessenger.cpp b/mozilla/mailnews/base/src/nsMessenger.cpp index 485c8153285..b1e3f216743 100644 --- a/mozilla/mailnews/base/src/nsMessenger.cpp +++ b/mozilla/mailnews/base/src/nsMessenger.cpp @@ -107,6 +107,12 @@ // Find / Find Again #include "nsIFindComponent.h" +#include "nslog.h" + +NS_IMPL_LOG(nsMessengerLog) +#define PRINTF NS_LOG_PRINTF(nsMessengerLog) +#define FLUSH NS_LOG_FLUSH(nsMessengerLog) + static NS_DEFINE_CID(kIStreamConverterServiceCID, NS_STREAMCONVERTERSERVICE_CID); static NS_DEFINE_CID(kCMsgMailSessionCID, NS_MSGMAILSESSION_CID); static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID); @@ -488,7 +494,7 @@ nsMessenger::OpenURL(const char * url) if (url) { #ifdef DEBUG_MESSENGER - printf("nsMessenger::OpenURL(%s)\n",url); + PRINTF("nsMessenger::OpenURL(%s)\n",url); #endif // This is to setup the display DocShell as UTF-8 capable... @@ -664,7 +670,7 @@ nsMessenger::SaveAttachment(const char * url, const char * displayName, if (!url) goto done; #ifdef DEBUG_MESSENGER - printf("nsMessenger::SaveAttachment(%s)\n",url); + PRINTF("nsMessenger::SaveAttachment(%s)\n",url); #endif unescapedUrl = PL_strdup(url); if (!unescapedUrl) goto done; @@ -1379,8 +1385,8 @@ SendLaterListener::OnStopSending(nsresult aStatus, const PRUnichar *aMsg, PRUint { #ifdef NS_DEBUG if (NS_SUCCEEDED(aStatus)) - printf("SendLaterListener::OnStopSending: Tried to send %d messages. %d successful.\n", - aTotalTried, aSuccessful); + PRINTF("SendLaterListener::OnStopSending: Tried to send %d messages. %d successful.\n", + aTotalTried, aSuccessful); #endif return NS_OK; @@ -1396,7 +1402,7 @@ nsMessenger::SendUnsentMessages(nsIMsgIdentity *aIdentity) if (NS_SUCCEEDED(rv) && pMsgSendLater) { #ifdef DEBUG - printf("We succesfully obtained a nsIMsgSendLater interface....\n"); + PRINTF("We succesfully obtained a nsIMsgSendLater interface....\n"); #endif SendLaterListener *sendLaterListener = new SendLaterListener(); @@ -1415,7 +1421,7 @@ nsMessenger::SendUnsentMessages(nsIMsgIdentity *aIdentity) NS_IMETHODIMP nsMessenger::DoPrint() { #ifdef DEBUG_MESSENGER - printf("nsMessenger::DoPrint()\n"); + PRINTF("nsMessenger::DoPrint()\n"); #endif nsresult rv = NS_ERROR_FAILURE; @@ -1433,13 +1439,13 @@ NS_IMETHODIMP nsMessenger::DoPrint() } #ifdef DEBUG_MESSENGER else { - printf("the content viewer does not support printing\n"); + PRINTF("the content viewer does not support printing\n"); } #endif } #ifdef DEBUG_MESSENGER else { - printf("failed to get the viewer for printing\n"); + PRINTF("failed to get the viewer for printing\n"); } #endif @@ -1450,7 +1456,7 @@ NS_IMETHODIMP nsMessenger::DoPrintPreview() { nsresult rv = NS_ERROR_NOT_IMPLEMENTED; #ifdef DEBUG_MESSENGER - printf("nsMessenger::DoPrintPreview() not implemented yet\n"); + PRINTF("nsMessenger::DoPrintPreview() not implemented yet\n"); #endif return rv; } diff --git a/mozilla/mailnews/base/src/nsMessengerMigrator.cpp b/mozilla/mailnews/base/src/nsMessengerMigrator.cpp index b9975d8bd42..48bda9c032d 100644 --- a/mozilla/mailnews/base/src/nsMessengerMigrator.cpp +++ b/mozilla/mailnews/base/src/nsMessengerMigrator.cpp @@ -72,6 +72,11 @@ #include "nsIMsgFilterList.h" #include "nsIPrefMigration.h" // for NEW_LOCAL_MAIL_DIR_NAME +#include "nslog.h" + +NS_IMPL_LOG(nsMessengerMigratorLog) +#define PRINTF NS_LOG_PRINTF(nsMessengerMigratorLog) +#define FLUSH NS_LOG_FLUSH(nsMessengerMigratorLog) #define BUF_STR_LEN 1024 @@ -469,7 +474,7 @@ nsMessengerMigrator::ProceedWithMigration() } else { #ifdef DEBUG_MIGRATOR - printf("Unrecognized server type %d\n", m_oldMailType); + PRINTF("Unrecognized server type %d\n", m_oldMailType); #endif rv = NS_ERROR_UNEXPECTED; } @@ -597,13 +602,13 @@ nsMessengerMigrator::UpgradePrefs() rv = ProceedWithMigration(); if (NS_FAILED(rv)) { #ifdef DEBUG_MIGRATOR - printf("FAIL: don't proceed with migration.\n"); + PRINTF("FAIL: don't proceed with migration.\n"); #endif return rv; } #ifdef DEBUG_MIGRATOR else { - printf("PASS: proceed with migration.\n"); + PRINTF("PASS: proceed with migration.\n"); } #endif @@ -660,7 +665,7 @@ nsMessengerMigrator::UpgradePrefs() #endif /* HAVE_MOVEMAIL */ else { #ifdef DEBUG_MIGRATOR - printf("Unrecognized server type %d\n", m_oldMailType); + PRINTF("Unrecognized server type %d\n", m_oldMailType); #endif return NS_ERROR_UNEXPECTED; } @@ -890,7 +895,7 @@ nsMessengerMigrator::Convert4XUri(const char *old_uri, PRBool for_news, const ch } #ifdef DEBUG_MIGRATOR - printf("old 4.x folder uri = >%s<\n", old_uri); + PRINTF("old 4.x folder uri = >%s<\n", old_uri); #endif /* DEBUG_MIGRATOR */ if (PL_strncasecmp(IMAP_SCHEMA,old_uri,IMAP_SCHEMA_LENGTH) == 0) { @@ -927,7 +932,7 @@ nsMessengerMigrator::Convert4XUri(const char *old_uri, PRBool for_news, const ch else { // new_uri = imap://@/ #ifdef DEBUG_MIGRATOR - printf("new_uri = %s/%s@%s/%s\n",IMAP_SCHEMA, imap_username, (const char *)hostname, default_folder_name); + PRINTF("new_uri = %s/%s@%s/%s\n",IMAP_SCHEMA, imap_username, (const char *)hostname, default_folder_name); #endif /* DEBUG_MIGRATOR */ *new_uri = PR_smprintf("%s/%s@%s/%s",IMAP_SCHEMA, imap_username, (const char *)hostname, default_folder_name); return NS_OK; @@ -936,7 +941,7 @@ nsMessengerMigrator::Convert4XUri(const char *old_uri, PRBool for_news, const ch else { // IMAP uri's began with "IMAP:/". we need that to be "imap:/" #ifdef DEBUG_MIGRATOR - printf("new_uri = %s%s\n",IMAP_SCHEMA,old_uri+IMAP_SCHEMA_LENGTH); + PRINTF("new_uri = %s%s\n",IMAP_SCHEMA,old_uri+IMAP_SCHEMA_LENGTH); #endif /* DEBUG_MIGRATOR */ *new_uri = PR_smprintf("%s%s",IMAP_SCHEMA,old_uri+IMAP_SCHEMA_LENGTH); return NS_OK; @@ -952,7 +957,7 @@ nsMessengerMigrator::Convert4XUri(const char *old_uri, PRBool for_news, const ch } if (NS_FAILED(rv) || !mail_directory_value || (PL_strlen(mail_directory_value) == 0)) { #ifdef DEBUG_MIGRATOR - printf("%s was not set, attempting to use %s instead.\n",PREF_PREMIGRATION_MAIL_DIRECTORY,PREF_MAIL_DIRECTORY); + PRINTF("%s was not set, attempting to use %s instead.\n",PREF_PREMIGRATION_MAIL_DIRECTORY,PREF_MAIL_DIRECTORY); #endif PR_FREEIF(mail_directory_value); @@ -1001,7 +1006,7 @@ nsMessengerMigrator::Convert4XUri(const char *old_uri, PRBool for_news, const ch #endif /* HAVE_MOVEMAIL */ else { #ifdef DEBUG_MIGRATOR - printf("Unrecognized server type %d\n", m_oldMailType); + PRINTF("Unrecognized server type %d\n", m_oldMailType); #endif return NS_ERROR_UNEXPECTED; } @@ -1011,7 +1016,7 @@ nsMessengerMigrator::Convert4XUri(const char *old_uri, PRBool for_news, const ch // mail_directory_value is already in UNIX style at this point... if (PL_strncasecmp(MAILBOX_SCHEMA,old_uri,MAILBOX_SCHEMA_LENGTH) == 0) { #ifdef DEBUG_MIGRATOR - printf("turn %s into %s/%s/(%s - %s)\n",old_uri,MAILBOX_SCHEMA,usernameAtHostname,old_uri + MAILBOX_SCHEMA_LENGTH,mail_directory_value); + PRINTF("turn %s into %s/%s/(%s - %s)\n",old_uri,MAILBOX_SCHEMA,usernameAtHostname,old_uri + MAILBOX_SCHEMA_LENGTH,mail_directory_value); #endif // the extra -1 is because in 4.x, we had this: // mailbox: instead of mailbox:/ @@ -1019,7 +1024,7 @@ nsMessengerMigrator::Convert4XUri(const char *old_uri, PRBool for_news, const ch } else { #ifdef DEBUG_MIGRATOR - printf("turn %s into %s/%s/(%s - %s)\n",old_uri,MAILBOX_SCHEMA,usernameAtHostname,old_uri,mail_directory_value); + PRINTF("turn %s into %s/%s/(%s - %s)\n",old_uri,MAILBOX_SCHEMA,usernameAtHostname,old_uri,mail_directory_value); #endif folderPath = old_uri + PL_strlen(mail_directory_value); } @@ -1041,7 +1046,7 @@ nsMessengerMigrator::Convert4XUri(const char *old_uri, PRBool for_news, const ch if (!*new_uri) { #ifdef DEBUG_MIGRATOR - printf("failed to convert 4.x uri: %s\n", old_uri); + PRINTF("failed to convert 4.x uri: %s\n", old_uri); #endif NS_ASSERTION(0,"uri conversion code not complete"); return NS_ERROR_FAILURE; @@ -1351,8 +1356,8 @@ nsMessengerMigrator::MigratePopAccount(nsIMsgIdentity *identity) #ifdef DEBUG_MIGRATOR PRInt32 portValue; rv = server->GetPort(&portValue); - printf("HOSTNAME = %s\n", (const char *)hostname); - printf("PORT = %d\n", portValue); + PRINTF("HOSTNAME = %s\n", (const char *)hostname); + PRINTF("PORT = %d\n", portValue); #endif /* DEBUG_MIGRATOR */ rv = MigrateOldMailPrefs(server); @@ -1582,8 +1587,8 @@ nsMessengerMigrator::MigrateImapAccount(nsIMsgIdentity *identity, const char *ho #ifdef DEBUG_MIGRATOR PRInt32 portValue; rv = server->GetPort(&portValue); - printf("HOSTNAME = %s\n", (const char *)hostname); - printf("PORT = %d\n", portValue); + PRINTF("HOSTNAME = %s\n", (const char *)hostname); + PRINTF("PORT = %d\n", portValue); #endif /* DEBUG_MIGRATOR */ // create the identity @@ -1753,7 +1758,7 @@ nsMessengerMigrator::migrateAddressBookPrefEnum(const char *aPref, void *aClosur nsIPref *prefs = (nsIPref *)aClosure; #ifdef DEBUG_AB_MIGRATION - printf("investigate pref: %s\n",aPref); + PRINTF("investigate pref: %s\n",aPref); #endif // we only care about ldap_2.servers.*.filename" prefs if (!charEndsWith(aPref, ADDRESSBOOK_PREF_NAME_SUFFIX)) return; @@ -1770,7 +1775,7 @@ nsMessengerMigrator::migrateAddressBookPrefEnum(const char *aPref, void *aClosur if (!(PL_strlen((const char *)abFileName))) return; #ifdef DEBUG_AB_MIGRATION - printf("pref value: %s\n",(const char *)abFileName); + PRINTF("pref value: %s\n",(const char *)abFileName); #endif /* DEBUG_AB_MIGRATION */ // if this a 5.x addressbook file name, skip it. if (charEndsWith((const char *)abFileName, ADDRESSBOOK_PREF_VALUE_5x_SUFFIX)) return; @@ -1791,7 +1796,7 @@ nsMessengerMigrator::migrateAddressBookPrefEnum(const char *aPref, void *aClosur nsCOMPtr tmpLDIFFileSpec; #ifdef DEBUG_AB_MIGRATION - printf("turn %s%s into %s%s\n", (const char *)abName,ADDRESSBOOK_PREF_VALUE_4x_SUFFIX,(const char *)abName,TEMP_LDIF_FILE_SUFFIX); + PRINTF("turn %s%s into %s%s\n", (const char *)abName,ADDRESSBOOK_PREF_VALUE_4x_SUFFIX,(const char *)abName,TEMP_LDIF_FILE_SUFFIX); #endif /* DEBUG_AB_MIGRATION */ rv = NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR, getter_AddRefs(ab4xFile)); @@ -1874,7 +1879,7 @@ nsMessengerMigrator::migrateAddressBookPrefEnum(const char *aPref, void *aClosur // this sucks. // ConvertLDIFtoMAB should set this pref value for us. #ifdef DEBUG_AB_MIGRATION - printf("set %s the pref to %s%s\n",aPref,(const char *)abName,ADDRESSBOOK_PREF_VALUE_5x_SUFFIX); + PRINTF("set %s the pref to %s%s\n",aPref,(const char *)abName,ADDRESSBOOK_PREF_VALUE_5x_SUFFIX); #endif /* DEBUG_AB_MIGRATION */ nsCAutoString newPrefValue; @@ -1885,7 +1890,7 @@ nsMessengerMigrator::migrateAddressBookPrefEnum(const char *aPref, void *aClosur if (NS_FAILED(rv)) return; #ifdef DEBUG_AB_MIGRATION - printf("remove the tmp file\n"); + PRINTF("remove the tmp file\n"); #endif /* DEBUG_AB_MIGRATION */ rv = tmpLDIFFile->Delete(PR_TRUE); NS_ASSERTION(NS_SUCCEEDED(rv),"failed to delete the temp ldif file"); @@ -1901,7 +1906,7 @@ nsMessengerMigrator::MigrateAddressBooks() nsCOMPtr abUpgrader = do_GetService(NS_AB4xUPGRADER_CONTRACTID, &rv); if (NS_FAILED(rv) || !abUpgrader) { - printf("the addressbook migrator is only in the commercial builds.\n"); + PRINTF("the addressbook migrator is only in the commercial builds.\n"); return NS_OK; } @@ -2106,7 +2111,7 @@ nsMessengerMigrator::MigrateNewsAccounts(nsIMsgIdentity *identity) if ((PL_strncmp(NEWSRC_FILE_PREFIX_IN_5x, filename, PL_strlen(NEWSRC_FILE_PREFIX_IN_5x)) == 0) && (PL_strlen(filename) > PL_strlen(NEWSRC_FILE_PREFIX_IN_5x))) { #ifdef DEBUG_MIGRATOR - printf("found a newsrc file: %s\n", filename); + PRINTF("found a newsrc file: %s\n", filename); #endif char *hostname = filename + PL_strlen(NEWSRC_FILE_PREFIX_IN_5x); rv = MigrateNewsAccount(identity, hostname, possibleRcFile, newsHostsDir, PR_FALSE /* isSecure */); @@ -2118,7 +2123,7 @@ nsMessengerMigrator::MigrateNewsAccounts(nsIMsgIdentity *identity) } else if ((PL_strncmp(SNEWSRC_FILE_PREFIX_IN_5x, filename, PL_strlen(SNEWSRC_FILE_PREFIX_IN_5x)) == 0) && (PL_strlen(filename) > PL_strlen(SNEWSRC_FILE_PREFIX_IN_5x))) { #ifdef DEBUG_MIGRATOR - printf("found a secure newsrc file: %s\n", filename); + PRINTF("found a secure newsrc file: %s\n", filename); #endif char *hostname = filename + PL_strlen(SNEWSRC_FILE_PREFIX_IN_5x); rv = MigrateNewsAccount(identity, hostname, possibleRcFile, newsHostsDir, PR_TRUE /* isSecure */); @@ -2182,8 +2187,8 @@ nsMessengerMigrator::MigrateNewsAccount(nsIMsgIdentity *identity, const char *ho #ifdef DEBUG_MIGRATOR PRInt32 portValue; rv = server->GetPort(&portValue); - printf("HOSTNAME = %s\n", (const char *)hostname); - printf("PORT = %d\n", portValue); + PRINTF("HOSTNAME = %s\n", (const char *)hostname); + PRINTF("PORT = %d\n", portValue); #endif /* DEBUG_MIGRATOR */ // we only need to do this once @@ -2234,7 +2239,7 @@ nsMessengerMigrator::MigrateNewsAccount(nsIMsgIdentity *identity, const char *ho if (NS_FAILED(rv)) return rv; #ifdef DEBUG_MIGRATOR - printf("migrate old nntp prefs\n"); + PRINTF("migrate old nntp prefs\n"); #endif /* DEBUG_MIGRATOR */ rv = MigrateOldNntpPrefs(server, hostAndPort, newsrcfile); @@ -2265,7 +2270,7 @@ nsMessengerMigrator::MigrateNewsAccount(nsIMsgIdentity *identity, const char *ho rv = newsDir->GetUnixStyleFilePath(getter_Copies(nativePathStr)); if (NS_FAILED(rv)) return rv; - printf("set the local path for this nntp server to: %s\n",(const char *)nativePathStr); + PRINTF("set the local path for this nntp server to: %s\n",(const char *)nativePathStr); #endif rv = server->SetLocalPath(newsDir); if (NS_FAILED(rv)) return rv; diff --git a/mozilla/mailnews/base/src/nsMsgAccount.cpp b/mozilla/mailnews/base/src/nsMsgAccount.cpp index ae6ec132ca7..f13dd36c01b 100644 --- a/mozilla/mailnews/base/src/nsMsgAccount.cpp +++ b/mozilla/mailnews/base/src/nsMsgAccount.cpp @@ -38,6 +38,11 @@ #include "nsIMsgFolderCache.h" #include "nsIMsgAccountManager.h" #include "nsIMsgMailSession.h" +#include "nslog.h" + +NS_IMPL_LOG(nsMsgAccountLog) +#define PRINTF NS_LOG_PRINTF(nsMsgAccountLog) +#define FLUSH NS_LOG_FLUSH(nsMsgAccountLog) static NS_DEFINE_CID(kMsgIdentityCID, NS_MSGIDENTITY_CID); static NS_DEFINE_CID(kPrefServiceCID, NS_PREF_CID); @@ -122,7 +127,7 @@ nsMsgAccount::createIncomingServer() if (NS_FAILED(rv)) return rv; #ifdef DEBUG_alecf - printf("\t%s's server: %s\n", (const char*)m_accountKey, (const char*)serverKey); + PRINTF("\t%s's server: %s\n", (const char*)m_accountKey, (const char*)serverKey); #endif // get the servertype @@ -142,9 +147,9 @@ nsMsgAccount::createIncomingServer() #ifdef DEBUG_alecf if (NS_FAILED(rv)) { - printf("\tCould not read pref %s\n", (const char*)serverTypePref); + PRINTF("\tCould not read pref %s\n", (const char*)serverTypePref); } else { - printf("\t%s's type: %s\n", + PRINTF("\t%s's type: %s\n", (const char*)m_accountKey, (const char*)serverType); } #endif @@ -159,7 +164,7 @@ nsMsgAccount::createIncomingServer() NS_ENSURE_SUCCESS(rv, rv); #ifdef DEBUG_alecf - printf("%s loaded.\n", (const char*)m_accountKey); + PRINTF("%s loaded.\n", (const char*)m_accountKey); #endif // store the server in this structure m_incomingServer = server; @@ -239,7 +244,7 @@ nsMsgAccount::createIdentities() if (NS_FAILED(rv)) return rv; #ifdef DEBUG_alecf - printf("%s's identities: %s\n", + PRINTF("%s's identities: %s\n", (const char*)m_accountKey, (const char*)identityKey); #endif diff --git a/mozilla/mailnews/base/src/nsMsgAccountManager.cpp b/mozilla/mailnews/base/src/nsMsgAccountManager.cpp index 6e3c1113e80..4b4c04810b9 100644 --- a/mozilla/mailnews/base/src/nsMsgAccountManager.cpp +++ b/mozilla/mailnews/base/src/nsMsgAccountManager.cpp @@ -58,6 +58,11 @@ #include "nsMsgFolderFlags.h" #include "nsIRDFService.h" #include "nsRDFCID.h" +#include "nslog.h" + +NS_IMPL_LOG(nsMsgAccountManagerLog) +#define PRINTF NS_LOG_PRINTF(nsMsgAccountManagerLog) +#define FLUSH NS_LOG_FLUSH(nsMsgAccountManagerLog) #if defined(DEBUG_alecf) || defined(DEBUG_sspitzer) || defined(DEBUG_seth) #define DEBUG_ACCOUNTMANAGER 1 @@ -455,7 +460,7 @@ nsMsgAccountManager::createKeyedServer(const char* key, // finally, create the server #ifdef DEBUG_ACCOUNTMANAGER - printf("serverContractID = %s\n", (const char *)serverContractID); + PRINTF("serverContractID = %s\n", (const char *)serverContractID); #endif rv = nsComponentManager::CreateInstance(serverContractID, nsnull, @@ -674,7 +679,7 @@ nsMsgAccountManager::GetDefaultAccount(nsIMsgAccount * *aDefaultAccount) PRUint32 count; m_accounts->Count(&count); #ifdef DEBUG_ACCOUNTMANAGER - printf("There are %d accounts\n", count); + PRINTF("There are %d accounts\n", count); #endif if (count == 0) { *aDefaultAccount=nsnull; @@ -997,7 +1002,7 @@ nsMsgAccountManager::addIdentityIfUnique(nsISupports *element, void *aData) nsresult rv; nsCOMPtr identity = do_QueryInterface(element, &rv); if (NS_FAILED(rv)) { - printf("addIdentityIfUnique problem\n"); + PRINTF("addIdentityIfUnique problem\n"); return PR_TRUE; } @@ -1118,7 +1123,7 @@ nsMsgAccountManager::LoadAccounts() if (NS_FAILED(rv) || !accountList || !accountList[0]) { #ifdef DEBUG_ACCOUNTMANAGER - printf("No accounts.\n"); + PRINTF("No accounts.\n"); #endif return NS_OK; } @@ -1127,7 +1132,7 @@ nsMsgAccountManager::LoadAccounts() /* parse accountList and run loadAccount on each string, comma-separated */ #ifdef DEBUG_ACCOUNTMANAGER - printf("accountList = %s\n", (const char*)accountList); + PRINTF("accountList = %s\n", (const char*)accountList); #endif nsCOMPtr account; @@ -1142,7 +1147,7 @@ nsMsgAccountManager::LoadAccounts() if (!str.IsEmpty()) { #ifdef DEBUG_ACCOUNTMANAGER - printf("account = %s\n",(const char *)str.GetBuffer()); + PRINTF("account = %s\n",(const char *)str.GetBuffer()); #endif rv = GetAccount(str.GetBuffer(), getter_AddRefs(account)); } @@ -1495,7 +1500,7 @@ nsMsgAccountManager::FindServer(const char* username, nsCOMPtr servers; #ifdef DEBUG_ACCOUNTMANAGER - printf("FindServer(%s,%s,%s,??)\n", username,hostname,type); + PRINTF("FindServer(%s,%s,%s,??)\n", username,hostname,type); #endif rv = GetAllServers(getter_AddRefs(servers)); diff --git a/mozilla/mailnews/base/src/nsMsgAccountManagerDS.cpp b/mozilla/mailnews/base/src/nsMsgAccountManagerDS.cpp index 9f9bc4e20cc..5cd974e6e7b 100644 --- a/mozilla/mailnews/base/src/nsMsgAccountManagerDS.cpp +++ b/mozilla/mailnews/base/src/nsMsgAccountManagerDS.cpp @@ -40,6 +40,11 @@ #include "nsMsgRDFUtils.h" #include "nsIMsgFolder.h" #include "nsMsgBaseCID.h" +#include "nslog.h" + +NS_IMPL_LOG(nsMsgAccountManagerDSLog) +#define PRINTF NS_LOG_PRINTF(nsMsgAccountManagerDSLog) +#define FLUSH NS_LOG_FLUSH(nsMsgAccountManagerDSLog) // turn this on to see useful output #undef DEBUG_amds @@ -119,7 +124,7 @@ nsCOMPtr nsMsgAccountManagerDataSource::mAccountRootArcsOut; nsMsgAccountManagerDataSource::nsMsgAccountManagerDataSource() { #ifdef DEBUG_amds - printf("nsMsgAccountManagerDataSource() being created\n"); + PRINTF("nsMsgAccountManagerDataSource() being created\n"); #endif // do per-class initialization here @@ -428,7 +433,7 @@ nsMsgAccountManagerDataSource::GetTargets(nsIRDFResource *source, rv = property->GetValue(getter_Copies(property_arc)); if (NS_FAILED(rv)) return rv; - printf("GetTargets(%s with arc %s...)\n", + PRINTF("GetTargets(%s with arc %s...)\n", (const char*)source_value, (const char*)property_arc); #endif @@ -466,7 +471,7 @@ nsMsgAccountManagerDataSource::createRootResources(nsIRDFResource *property, #ifdef DEBUG_amds PRUint32 nodecount; aNodeArray->Count(&nodecount); - printf("GetTargets(): added %d servers on %s\n", nodecount, + PRINTF("GetTargets(): added %d servers on %s\n", nodecount, (const char*)property_arc); #endif // for the "settings" arc, we also want to do an SMTP tag @@ -477,7 +482,7 @@ nsMsgAccountManagerDataSource::createRootResources(nsIRDFResource *property, #ifdef DEBUG_amds else { - printf("unknown arc %s on msgaccounts:/\n", (const char*)property_arc); + PRINTF("unknown arc %s on msgaccounts:/\n", (const char*)property_arc); } #endif @@ -640,7 +645,7 @@ nsMsgAccountManagerDataSource::ArcLabelsOut(nsIRDFResource *source, if (NS_FAILED(rv)) return rv; #ifdef DEBUG_amds_ - printf("GetArcLabelsOut(%s): Adding child, settings, and name arclabels\n", value); + PRINTF("GetArcLabelsOut(%s): Adding child, settings, and name arclabels\n", value); #endif return NS_OK; @@ -882,7 +887,7 @@ nsMsgAccountManagerDataSource::OnServerLoaded(nsIMsgIncomingServer* aServer) #ifdef DEBUG_alecf nsXPIDLCString serverUri; serverResource->GetValue(getter_Copies(serverUri)); - printf("nsMsgAccountmanagerDataSource::OnServerLoaded(%s)\n", (const char*)serverUri); + PRINTF("nsMsgAccountmanagerDataSource::OnServerLoaded(%s)\n", (const char*)serverUri); #endif NotifyObservers(kNC_AccountRoot, kNC_Child, serverResource, PR_TRUE, PR_FALSE); diff --git a/mozilla/mailnews/base/src/nsMsgFolderDataSource.cpp b/mozilla/mailnews/base/src/nsMsgFolderDataSource.cpp index b13055e5de5..b9d950a68d6 100644 --- a/mozilla/mailnews/base/src/nsMsgFolderDataSource.cpp +++ b/mozilla/mailnews/base/src/nsMsgFolderDataSource.cpp @@ -49,6 +49,11 @@ #include "nsTraceRefcnt.h" #include "nsIMsgFolder.h" // TO include biffState enum. Change to bool later... +#include "nslog.h" + +NS_IMPL_LOG(nsMsgFolderDataSourceLog) +#define PRINTF NS_LOG_PRINTF(nsMsgFolderDataSourceLog) +#define FLUSH NS_LOG_FLUSH(nsMsgFolderDataSourceLog) static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID); static NS_DEFINE_CID(kMsgMailSessionCID, NS_MSGMAILSESSION_CID); @@ -311,7 +316,7 @@ NS_IMETHODIMP nsMsgFolderDataSource::GetTarget(nsIRDFResource* source, property->GetValue(getter_Copies(propval)); // (*target)->GetValue(getter_Copies(targetval)); - printf("nsMsgFolderDataSource::GetTarget(%s, %s, %s, (%s))\n", + PRINTF("nsMsgFolderDataSource::GetTarget(%s, %s, %s, (%s))\n", (const char*)srcval, (const char*)propval, tv ? "TRUE" : "FALSE", (const char*)""); @@ -350,7 +355,7 @@ NS_IMETHODIMP nsMsgFolderDataSource::GetTargets(nsIRDFResource* source, property->GetValue(getter_Copies(propval)); // (*target)->GetValue(getter_Copies(targetval)); - printf("nsMsgFolderDataSource::GetTargets(%s, %s, %s, (%s))\n", + PRINTF("nsMsgFolderDataSource::GetTargets(%s, %s, %s, (%s))\n", (const char*)srcval, (const char*)propval, tv ? "TRUE" : "FALSE", (const char*)""); @@ -442,7 +447,7 @@ NS_IMETHODIMP nsMsgFolderDataSource::HasAssertion(nsIRDFResource* source, source->GetValue(getter_Copies(sourceval)); property->GetValue(getter_Copies(propval)); /* target->GetValue(getter_Copies(targetval)); */ - printf("HasAssertion(%s, %s, ??...)\n", (const char*)sourceval, (const char*)propval); + PRINTF("HasAssertion(%s, %s, ??...)\n", (const char*)sourceval, (const char*)propval); #endif nsCOMPtr folder(do_QueryInterface(source, &rv)); diff --git a/mozilla/mailnews/base/src/nsMsgServiceProvider.cpp b/mozilla/mailnews/base/src/nsMsgServiceProvider.cpp index cd714f908bc..a6cf41f9ffe 100644 --- a/mozilla/mailnews/base/src/nsMsgServiceProvider.cpp +++ b/mozilla/mailnews/base/src/nsMsgServiceProvider.cpp @@ -34,6 +34,11 @@ #include "nsIFileSpec.h" #include "nsAppDirectoryServiceDefs.h" +#include "nslog.h" + +NS_IMPL_LOG(nsMsgServiceProviderLog) +#define PRINTF NS_LOG_PRINTF(nsMsgServiceProviderLog) +#define FLUSH NS_LOG_FLUSH(nsMsgServiceProviderLog) static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID); static NS_DEFINE_CID(kRDFCompositeDataSourceCID, NS_RDFCOMPOSITEDATASOURCE_CID); @@ -147,7 +152,7 @@ nsMsgServiceProviderService::LoadDataSource(const char *aURI) rv = remote->GetLoaded(&loaded); NS_ASSERTION(NS_SUCCEEDED(rv), "failed getload\n"); - printf("Before refresh: datasource is %s\n", loaded ? "loaded" : "not loaded"); + PRINTF("Before refresh: datasource is %s\n", loaded ? "loaded" : "not loaded"); #endif // for now load synchronously (async seems to be busted) @@ -157,7 +162,7 @@ nsMsgServiceProviderService::LoadDataSource(const char *aURI) #ifdef DEBUG_alecf rv = remote->GetLoaded(&loaded); NS_ASSERTION(NS_SUCCEEDED(rv), "failed getload\n"); - printf("After refresh: datasource is %s\n", loaded ? "loaded" : "not loaded"); + PRINTF("After refresh: datasource is %s\n", loaded ? "loaded" : "not loaded"); #endif rv = mInnerDataSource->AddDataSource(ds); diff --git a/mozilla/mailnews/base/src/nsSubscribableServer.cpp b/mozilla/mailnews/base/src/nsSubscribableServer.cpp index 2736a7fc86a..d60761d17a4 100644 --- a/mozilla/mailnews/base/src/nsSubscribableServer.cpp +++ b/mozilla/mailnews/base/src/nsSubscribableServer.cpp @@ -33,6 +33,11 @@ #include "rdf.h" #include "nsICharsetConverterManager.h" +#include "nslog.h" + +NS_IMPL_LOG(nsSubscribableServerLog) +#define PRINTF NS_LOG_PRINTF(nsSubscribableServerLog) +#define FLUSH NS_LOG_FLUSH(nsSubscribableServerLog) #if defined(DEBUG_sspitzer_) || defined(DEBUG_seth_) #define DEBUG_SUBSCRIBE 1 @@ -170,7 +175,7 @@ nsSubscribableServer::AddToSubscribeDS(const char *aName, PRBool addAsSubscribed if (!aName) return NS_ERROR_FAILURE; #ifdef DEBUG_SUBSCRIBE - printf("AddToSubscribeDS(%s,%d,%d)\n",aName,addAsSubscribed,changeIfExists); + PRINTF("AddToSubscribeDS(%s,%d,%d)\n",aName,addAsSubscribed,changeIfExists); #endif nsXPIDLCString serverUri; @@ -205,7 +210,7 @@ nsSubscribableServer::SetPropertiesInSubscribeDS(const char *uri, const PRUnicha nsresult rv; #ifdef DEBUG_SUBSCRIBE - printf("SetPropertiesInSubscribeDS(%s,??,??,%d,%d)\n",uri,subscribed,changeIfExists); + PRINTF("SetPropertiesInSubscribeDS(%s,??,??,%d,%d)\n",uri,subscribed,changeIfExists); #endif nsCOMPtr nameLiteral; @@ -299,7 +304,7 @@ nsSubscribableServer::FindAndAddParentToSubscribeDS(const char *uri, const char { nsresult rv; #ifdef DEBUG_SUBSCRIBE - printf("FindAndAddParentToSubscribeDS(%s,%s,%s,??)\n",uri,serverUri,aName); + PRINTF("FindAndAddParentToSubscribeDS(%s,%s,%s,??)\n",uri,serverUri,aName); #endif nsCOMPtr parentResource; diff --git a/mozilla/mailnews/base/util/nsMsgDBFolder.cpp b/mozilla/mailnews/base/util/nsMsgDBFolder.cpp index 0a04799ecd8..42f1bff51a7 100644 --- a/mozilla/mailnews/base/util/nsMsgDBFolder.cpp +++ b/mozilla/mailnews/base/util/nsMsgDBFolder.cpp @@ -33,6 +33,11 @@ #include "nsIMsgAccountManager.h" #include "nsXPIDLString.h" #include "nsLocalFolderSummarySpec.h" +#include "nslog.h" + +NS_IMPL_LOG(nsMsgDBFolderLog) +#define PRINTF NS_LOG_PRINTF(nsMsgDBFolderLog) +#define FLUSH NS_LOG_FLUSH(nsMsgDBFolderLog) #if defined(XP_OS2) #define MAX_FILE_LENGTH_WITHOUT_EXTENSION 8 @@ -773,7 +778,7 @@ NS_IMETHODIMP nsMsgDBFolder::OnAnnouncerGoingAway(nsIDBChangeAnnouncer * NS_IMETHODIMP nsMsgDBFolder::ManyHeadersToDownload(PRBool *retval) { - PRInt32 numTotalMessages; +// PRInt32 numTotalMessages; if (!retval) return NS_ERROR_NULL_POINTER; @@ -816,7 +821,7 @@ NS_IMETHODIMP nsMsgDBFolder::ReadFromFolderCacheElem(nsIMsgFolderCacheElement *e char *uri; GetURI(&uri); - printf("read total %ld for %s\n", mNumTotalMessages, uri); + PRINTF("read total %ld for %s\n", mNumTotalMessages, uri); PR_Free(uri); #endif mCharset.AssignWithConversion(charset); @@ -953,7 +958,7 @@ NS_IMETHODIMP nsMsgDBFolder::WriteToFolderCacheElem(nsIMsgFolderCacheElement *el char *uri; GetURI(&uri); - printf("writing total %ld for %s\n", mNumTotalMessages, uri); + PRINTF("writing total %ld for %s\n", mNumTotalMessages, uri); PR_Free(uri); #endif return rv; diff --git a/mozilla/mailnews/base/util/nsMsgFolder.cpp b/mozilla/mailnews/base/util/nsMsgFolder.cpp index bc268f27138..04326b21420 100644 --- a/mozilla/mailnews/base/util/nsMsgFolder.cpp +++ b/mozilla/mailnews/base/util/nsMsgFolder.cpp @@ -51,6 +51,11 @@ #include "nsIIOService.h" #include "nsIURL.h" +#include "nslog.h" + +NS_IMPL_LOG(nsMsgFolderLog) +#define PRINTF NS_LOG_PRINTF(nsMsgFolderLog) +#define FLUSH NS_LOG_FLUSH(nsMsgFolderLog) static NS_DEFINE_CID(kStandardUrlCID, NS_STANDARDURL_CID); static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID); @@ -627,7 +632,7 @@ nsMsgFolder::parseURI(PRBool needServer) // was never called // (we should ALWAYS handle this case, but try to design // the code so we have a parent wherever possible) - printf("No parent->"); + PRINTF("No parent->"); #endif rv = accountManager->FindServer(userName, hostName, diff --git a/mozilla/mailnews/base/util/nsMsgIncomingServer.cpp b/mozilla/mailnews/base/util/nsMsgIncomingServer.cpp index f152fd18636..0d2100d8036 100644 --- a/mozilla/mailnews/base/util/nsMsgIncomingServer.cpp +++ b/mozilla/mailnews/base/util/nsMsgIncomingServer.cpp @@ -51,6 +51,11 @@ #include "nsIRDFService.h" #include "nsRDFCID.h" #include "nsIInterfaceRequestor.h" +#include "nslog.h" + +NS_IMPL_LOG(nsMsgIncomingServerLog) +#define PRINTF NS_LOG_PRINTF(nsMsgIncomingServerLog) +#define FLUSH NS_LOG_FLUSH(nsMsgIncomingServerLog) #ifdef DEBUG_sspitzer #define DEBUG_MSGINCOMING_SERVER @@ -142,7 +147,7 @@ NS_IMETHODIMP nsMsgIncomingServer::PerformExpand(nsIMsgWindow *aMsgWindow) { #ifdef DEBUG_sspitzer - printf("PerformExpand()\n"); + PRINTF("PerformExpand()\n"); #endif return NS_OK; } @@ -842,13 +847,13 @@ nsMsgIncomingServer::Equals(nsIMsgIncomingServer *server, PRBool *_retval) // compare the server keys if (PL_strcmp((const char *)key1,(const char *)key2)) { #ifdef DEBUG_MSGINCOMING_SERVER - printf("%s and %s are different, servers are not the same\n",(const char *)key1,(const char *)key2); + PRINTF("%s and %s are different, servers are not the same\n",(const char *)key1,(const char *)key2); #endif /* DEBUG_MSGINCOMING_SERVER */ *_retval = PR_FALSE; } else { #ifdef DEBUG_MSGINCOMING_SERVER - printf("%s and %s are equal, servers are the same\n",(const char *)key1,(const char *)key2); + PRINTF("%s and %s are equal, servers are the same\n",(const char *)key1,(const char *)key2); #endif /* DEBUG_MSGINCOMING_SERVER */ *_retval = PR_TRUE; } @@ -875,7 +880,7 @@ nsMsgIncomingServer::RemoveFiles() // and in use. I need to think about this some more. #if 0 #ifdef DEBUG_MSGINCOMING_SERVER - printf("remove files for %s\n", (const char *)m_serverKey); + PRINTF("remove files for %s\n", (const char *)m_serverKey); #endif /* DEBUG_MSGINCOMING_SERVER */ nsresult rv = NS_OK; nsCOMPtr localPath; diff --git a/mozilla/mailnews/base/util/nsMsgKeySet.cpp b/mozilla/mailnews/base/util/nsMsgKeySet.cpp index a70aff76f1e..f4b6bc37be2 100644 --- a/mozilla/mailnews/base/util/nsMsgKeySet.cpp +++ b/mozilla/mailnews/base/util/nsMsgKeySet.cpp @@ -26,6 +26,11 @@ #include "MailNewsTypes.h" #include "nsMsgKeySet.h" #include "prprf.h" +#include "nslog.h" + +NS_IMPL_LOG(nsMsgKeySetLog) +#define PRINTF NS_LOG_PRINTF(nsMsgKeySetLog) +#define FLUSH NS_LOG_FLUSH(nsMsgKeySetLog) #if defined(DEBUG_seth_) || defined(DEBUG_sspitzer_) #define DEBUG_MSGKEYSET 1 @@ -221,7 +226,7 @@ nsMsgKeySet* nsMsgKeySet::Create(const char* value /* , MSG_NewsHost* host */) { #ifdef DEBUG_MSGKEYSET - printf("create from %s\n",value); + PRINTF("create from %s\n",value); #endif nsMsgKeySet* set = new nsMsgKeySet(value /* , host */); @@ -663,7 +668,7 @@ nsMsgKeySet::Add(PRInt32 number) PRInt32 *end; #ifdef DEBUG_MSGKEYSET - printf("add %d\n",number); + PRINTF("add %d\n",number); #endif size = m_length; @@ -759,7 +764,7 @@ nsMsgKeySet::Remove(PRInt32 number) PRInt32 *tail; PRInt32 *end; #ifdef DEBUG_MSGKEYSET - printf("remove %d\n",number); + PRINTF("remove %d\n",number); #endif size = m_length; @@ -1171,7 +1176,7 @@ nsMsgKeySet::test_decoder (const char *string) nsMsgKeySet set(string /* , NULL */); char* tmp; set.Output(&tmp); - printf ("\t\"%s\"\t--> \"%s\"\n", string, tmp); + PRINTF ("\t\"%s\"\t--> \"%s\"\n", string, tmp); nsMemory::Free(tmp); } @@ -1183,7 +1188,7 @@ nsMsgKeySet::test_decoder (const char *string) #define FROB(N,PUSHP) \ i = N; \ if (!(NS_SUCCEEDED(set->Output(&s)))) abort (); \ - printf ("%3lu: %-58s %c %3lu =\n", (unsigned long)set->m_length, s, \ + PRINTF ("%3lu: %-58s %c %3lu =\n", (unsigned long)set->m_length, s, \ (PUSHP ? '+' : '-'), (unsigned long)i); \ nsMemory::Free(s); \ if (PUSHP \ @@ -1191,12 +1196,12 @@ nsMsgKeySet::test_decoder (const char *string) : set->Remove(i) < 0) \ abort (); \ if (!(NS_SUCCEEDED(set->Output(&s)))) abort (); \ - printf ("%3lu: %-58s optimized =\n", (unsigned long)set->m_length, s); \ + PRINTF ("%3lu: %-58s optimized =\n", (unsigned long)set->m_length, s); \ nsMemory::Free(s); \ #define END() \ if (!(NS_SUCCEEDED(set->Output(&s)))) abort (); \ - printf ("%3lu: %s\n\n", (unsigned long)set->m_length, s); \ + PRINTF ("%3lu: %s\n\n", (unsigned long)set->m_length, s); \ nsMemory::Free(s); \ delete set; \ @@ -1292,11 +1297,11 @@ nsMsgKeySet::test_adder (void) i = N; \ j = M; \ if (!(NS_SUCCEEDED(set->Output(&s)))) abort (); \ - printf ("%3lu: %-58s + %3lu-%3lu =\n", (unsigned long)set->m_length, s, (unsigned long)i, (unsigned long)j); \ + PRINTF ("%3lu: %-58s + %3lu-%3lu =\n", (unsigned long)set->m_length, s, (unsigned long)i, (unsigned long)j); \ nsMemory::Free(s); \ switch (set->AddRange(i, j)) { \ case 0: \ - printf("(no-op)\n"); \ + PRINTF("(no-op)\n"); \ break; \ case 1: \ break; \ @@ -1304,13 +1309,13 @@ nsMsgKeySet::test_adder (void) abort(); \ } \ if (!(NS_SUCCEEDED(set->Output(&s)))) abort (); \ - printf ("%3lu: %-58s\n", (unsigned long)set->m_length, s); \ + PRINTF ("%3lu: %-58s\n", (unsigned long)set->m_length, s); \ nsMemory::Free(s); \ #define END() \ if (!(NS_SUCCEEDED(set->Output(&s)))) abort (); \ - printf ("%3lu: %s\n\n", (unsigned long)set->m_length, s); \ + PRINTF ("%3lu: %s\n\n", (unsigned long)set->m_length, s); \ nsMemory::Free(s); \ delete set; @@ -1350,7 +1355,7 @@ nsMsgKeySet::test_ranges(void) #define TEST(N) \ if (! with_cache) set->m_cached_value = -1; \ if (!(NS_SUCCEEDED(set->Output(&s)))) abort (); \ - printf (" %3d = %s\n", N, \ + PRINTF (" %3d = %s\n", N, \ (set->IsMember(N) ? "true" : "false")); \ delete [] s @@ -1361,7 +1366,7 @@ nsMsgKeySet::test_member(PRBool with_cache) char *s; s = "1-70,72-99,105,107,110-111,117-200"; - printf ("\n\nTesting %s (with%s cache)\n", s, with_cache ? "" : "out"); + PRINTF ("\n\nTesting %s (with%s cache)\n", s, with_cache ? "" : "out"); if (!(set = Create(s))) { abort (); } @@ -1373,7 +1378,7 @@ nsMsgKeySet::test_member(PRBool with_cache) delete set; s = "0-70,72-99,105,107,110-111,117-200"; - printf ("\n\nTesting %s (with%s cache)\n", s, with_cache ? "" : "out"); + PRINTF ("\n\nTesting %s (with%s cache)\n", s, with_cache ? "" : "out"); if (!(set = Create(s))) { abort (); } diff --git a/mozilla/mailnews/base/util/nsMsgLineBuffer.cpp b/mozilla/mailnews/base/util/nsMsgLineBuffer.cpp index 1a6b50109c7..2a84143941d 100644 --- a/mozilla/mailnews/base/util/nsMsgLineBuffer.cpp +++ b/mozilla/mailnews/base/util/nsMsgLineBuffer.cpp @@ -25,6 +25,11 @@ #include "nsMsgLineBuffer.h" #include "nsIInputStream.h" // used by nsMsgLineStreamBuffer +#include "nslog.h" + +NS_IMPL_LOG(nsMsgLineBufferLog) +#define PRINTF NS_LOG_PRINTF(nsMsgLineBufferLog) +#define FLUSH NS_LOG_FLUSH(nsMsgLineBufferLog) MOZ_DECL_CTOR_COUNTER(nsByteArray); @@ -195,7 +200,7 @@ PRInt32 nsMsgLineBuffer::BufferInput(const char *net_buffer, PRInt32 net_buffer_ m_bufferPos = 0; } #ifdef DEBUG_bienvenu - printf("returning from buffer input m_bufferPos = %ld\n", m_bufferPos); + PRINTF("returning from buffer input m_bufferPos = %ld\n", m_bufferPos); #endif return 0; } @@ -352,7 +357,7 @@ char * nsMsgLineStreamBuffer::ReadNextLine(nsIInputStream * aInputStream, PRUint m_startPos = 0; startOfLine = m_dataBuffer; numFreeBytesInBuffer = m_dataBufferSize - m_numBytesInBuffer; -// printf("moving data in read line around because buffer filling up\n"); +// PRINTF("moving data in read line around because buffer filling up\n"); } else if (!m_startPos) { diff --git a/mozilla/mailnews/base/util/nsMsgMailNewsUrl.cpp b/mozilla/mailnews/base/util/nsMsgMailNewsUrl.cpp index 9ae7553cc62..72f3f6ceaba 100644 --- a/mozilla/mailnews/base/util/nsMsgMailNewsUrl.cpp +++ b/mozilla/mailnews/base/util/nsMsgMailNewsUrl.cpp @@ -34,6 +34,11 @@ #include "nsIWebProgressListener.h" #include "nsIInterfaceRequestor.h" #include "nsIIOService.h" +#include "nslog.h" + +NS_IMPL_LOG(nsMsgMailNewsUrlLog) +#define PRINTF NS_LOG_PRINTF(nsMsgMailNewsUrlLog) +#define FLUSH NS_LOG_FLUSH(nsMsgMailNewsUrlLog) static NS_DEFINE_CID(kUrlListenerManagerCID, NS_URLLISTENERMANAGER_CID); static NS_DEFINE_CID(kStandardUrlCID, NS_STANDARDURL_CID); @@ -110,7 +115,7 @@ nsresult nsMsgMailNewsUrl::SetUrlState(PRBool aRunningUrl, nsresult aExitCode) } } else - printf("no listeners in set url state\n"); + PRINTF("no listeners in set url state\n"); return NS_OK; } diff --git a/mozilla/mailnews/base/util/nsMsgUtils.cpp b/mozilla/mailnews/base/util/nsMsgUtils.cpp index 0fe7fbdf34d..e994b4783ba 100644 --- a/mozilla/mailnews/base/util/nsMsgUtils.cpp +++ b/mozilla/mailnews/base/util/nsMsgUtils.cpp @@ -37,6 +37,11 @@ #include "nsMsgBaseCID.h" #include "nsMsgImapCID.h" #include "nsMsgI18N.h" +#include "nslog.h" + +NS_IMPL_LOG(nsMsgUtilsLog) +#define PRINTF NS_LOG_PRINTF(nsMsgUtilsLog) +#define FLUSH NS_LOG_FLUSH(nsMsgUtilsLog) static NS_DEFINE_CID(kImapUrlCID, NS_IMAPURL_CID); static NS_DEFINE_CID(kCMailboxUrl, NS_MAILBOXURL_CID); @@ -308,7 +313,7 @@ nsresult NS_MsgHashIfNecessary(nsCAutoString &name) nsCAutoString str(name); #ifdef DEBUG_NS_MsgHashIfNecessary - printf("in: %s\n",str.GetBuffer()); + PRINTF("in: %s\n",str.GetBuffer()); #endif // Given a name, use either that name, if it fits on our @@ -329,7 +334,7 @@ nsresult NS_MsgHashIfNecessary(nsCAutoString &name) } name = hashedname; #ifdef DEBUG_NS_MsgHashIfNecessary - printf("out: %s\n",hashedname); + PRINTF("out: %s\n",hashedname); #endif return NS_OK; diff --git a/mozilla/mailnews/compose/src/nsMsgAttachmentHandler.cpp b/mozilla/mailnews/compose/src/nsMsgAttachmentHandler.cpp index b600c74f370..e8949c3520e 100644 --- a/mozilla/mailnews/compose/src/nsMsgAttachmentHandler.cpp +++ b/mozilla/mailnews/compose/src/nsMsgAttachmentHandler.cpp @@ -41,6 +41,11 @@ #include "nsMsgUtils.h" #include "nsMsgPrompts.h" #include "nsTextFormatter.h" +#include "nslog.h" + +NS_IMPL_LOG(nsMsgAttachmentHandlerLog) +#define PRINTF NS_LOG_PRINTF(nsMsgAttachmentHandlerLog) +#define FLUSH NS_LOG_FLUSH(nsMsgAttachmentHandlerLog) static NS_DEFINE_CID(kPrefCID, NS_PREF_CID); @@ -719,7 +724,7 @@ nsMsgAttachmentHandler::SnarfAttachment(nsMsgCompFields *compFields) // For now, just do the encoding, but in the old world we would ask the // user about doing this conversion - printf("...we could ask the user about this conversion, but for now, nahh..\n"); + PRINTF("...we could ask the user about this conversion, but for now, nahh..\n"); } /* make sure the file type and create are set. */ diff --git a/mozilla/mailnews/compose/src/nsMsgCompUtils.cpp b/mozilla/mailnews/compose/src/nsMsgCompUtils.cpp index 96aab1f0c13..c1c6c8f43e0 100644 --- a/mozilla/mailnews/compose/src/nsMsgCompUtils.cpp +++ b/mozilla/mailnews/compose/src/nsMsgCompUtils.cpp @@ -39,6 +39,11 @@ #include "nsIDocumentEncoder.h" // for editor output flags #include "nsIURI.h" #include "nsMsgPrompts.h" +#include "nslog.h" + +NS_IMPL_LOG(nsMsgCompUtilsLog) +#define PRINTF NS_LOG_PRINTF(nsMsgCompUtilsLog) +#define FLUSH NS_LOG_FLUSH(nsMsgCompUtilsLog) /* for StrAllocCat */ #include "xp_str.h" @@ -528,7 +533,7 @@ mime_generate_headers (nsMsgCompFields *fields, #ifdef NS_DEBUG else { - printf("SUCCESS: %s -> %s\n",n2,newHeader); + PRINTF("SUCCESS: %s -> %s\n",n2,newHeader); } #endif } diff --git a/mozilla/mailnews/compose/src/nsMsgCompose.cpp b/mozilla/mailnews/compose/src/nsMsgCompose.cpp index b6e3b9675f2..b2f4b060d59 100644 --- a/mozilla/mailnews/compose/src/nsMsgCompose.cpp +++ b/mozilla/mailnews/compose/src/nsMsgCompose.cpp @@ -73,6 +73,11 @@ #include "nsIMsgMailSession.h" #include "nsMsgBaseCID.h" #include "nsIPrompt.h" +#include "nslog.h" + +NS_IMPL_LOG(nsMsgComposeLog) +#define PRINTF NS_LOG_PRINTF(nsMsgComposeLog) +#define FLUSH NS_LOG_FLUSH(nsMsgComposeLog) // Defines.... static NS_DEFINE_CID(kMsgQuoteCID, NS_MSGQUOTE_CID); @@ -525,15 +530,15 @@ nsresult nsMsgCompose::_SendMsg(MSG_DeliverMode deliverMode, nsIMsgIdentity *ide m_compFields->SetOrganization(organization); #if defined(DEBUG_ducarroz) || defined(DEBUG_seth_) - printf("----------------------------\n"); - printf("-- Sending Mail Message --\n"); - printf("----------------------------\n"); - printf("from: %s\n", m_compFields->GetFrom()); - printf("To: %s Cc: %s Bcc: %s\n", m_compFields->GetTo(), m_compFields->GetCc(), m_compFields->GetBcc()); - printf("Newsgroups: %s\n", m_compFields->GetNewsgroups()); - printf("Subject: %s \nMsg: %s\n", m_compFields->GetSubject(), m_compFields->GetBody()); - printf("Attachments: %s\n",m_compFields->GetAttachments()); - printf("----------------------------\n"); + PRINTF("----------------------------\n"); + PRINTF("-- Sending Mail Message --\n"); + PRINTF("----------------------------\n"); + PRINTF("from: %s\n", m_compFields->GetFrom()); + PRINTF("To: %s Cc: %s Bcc: %s\n", m_compFields->GetTo(), m_compFields->GetCc(), m_compFields->GetBcc()); + PRINTF("Newsgroups: %s\n", m_compFields->GetNewsgroups()); + PRINTF("Subject: %s \nMsg: %s\n", m_compFields->GetSubject(), m_compFields->GetBody()); + PRINTF("Attachments: %s\n",m_compFields->GetAttachments()); + PRINTF("----------------------------\n"); #endif //DEBUG nsMsgComposeAndSend *tMsgComp = new nsMsgComposeAndSend(); @@ -586,7 +591,7 @@ nsresult nsMsgCompose::_SendMsg(MSG_DeliverMode deliverMode, nsIMsgIdentity *ide if (!tArray) { #ifdef DEBUG - printf("Error creating listener array.\n"); + PRINTF("Error creating listener array.\n"); #endif return NS_ERROR_FAILURE; } @@ -1553,7 +1558,7 @@ nsMsgCompose::QuoteOriginalMessage(const PRUnichar *originalMsgURI, PRInt32 what if (!mQuoteStreamListener) { #ifdef NS_DEBUG - printf("Failed to create mQuoteStreamListener\n"); + PRINTF("Failed to create mQuoteStreamListener\n"); #endif return NS_ERROR_FAILURE; } @@ -1668,7 +1673,7 @@ nsresult nsMsgComposeSendListener::OnStartSending(const char *aMsgID, PRUint32 aMsgSize) { #ifdef NS_DEBUG - printf("nsMsgComposeSendListener::OnStartSending()\n"); + PRINTF("nsMsgComposeSendListener::OnStartSending()\n"); #endif return NS_OK; } @@ -1677,7 +1682,7 @@ nsresult nsMsgComposeSendListener::OnProgress(const char *aMsgID, PRUint32 aProgress, PRUint32 aProgressMax) { #ifdef NS_DEBUG - printf("nsMsgComposeSendListener::OnProgress()\n"); + PRINTF("nsMsgComposeSendListener::OnProgress()\n"); #endif return NS_OK; } @@ -1686,7 +1691,7 @@ nsresult nsMsgComposeSendListener::OnStatus(const char *aMsgID, const PRUnichar *aMsg) { #ifdef NS_DEBUG - printf("nsMsgComposeSendListener::OnStatus()\n"); + PRINTF("nsMsgComposeSendListener::OnStatus()\n"); #endif return NS_OK; @@ -1702,7 +1707,7 @@ nsresult nsMsgComposeSendListener::OnStopSending(const char *aMsgID, nsresult aS if (NS_SUCCEEDED(aStatus)) { #ifdef NS_DEBUG - printf("nsMsgComposeSendListener: Success on the message send operation!\n"); + PRINTF("nsMsgComposeSendListener: Success on the message send operation!\n"); #endif nsIMsgCompFields *compFields = nsnull; mComposeObj->GetCompFields(&compFields); //GetCompFields will addref, you need to release when your are done with it @@ -1732,7 +1737,7 @@ nsresult nsMsgComposeSendListener::OnStopSending(const char *aMsgID, nsresult aS else { #ifdef NS_DEBUG - printf("nsMsgComposeSendListener: the message send operation failed!\n"); + PRINTF("nsMsgComposeSendListener: the message send operation failed!\n"); #endif mComposeObj->NotifyStateListeners(nsMsgCompose::eSaveAndSendProcessDone); mComposeObj->ShowWindow(PR_TRUE); @@ -1749,7 +1754,7 @@ nsresult nsMsgComposeSendListener::OnStartCopy() { #ifdef NS_DEBUG - printf("nsMsgComposeSendListener::OnStartCopy()\n"); + PRINTF("nsMsgComposeSendListener::OnStartCopy()\n"); #endif return NS_OK; @@ -1759,7 +1764,7 @@ nsresult nsMsgComposeSendListener::OnProgress(PRUint32 aProgress, PRUint32 aProgressMax) { #ifdef NS_DEBUG - printf("nsMsgComposeSendListener::OnProgress() - COPY\n"); + PRINTF("nsMsgComposeSendListener::OnProgress() - COPY\n"); #endif return NS_OK; } @@ -1777,7 +1782,7 @@ nsMsgComposeSendListener::OnStopCopy(nsresult aStatus) if (NS_SUCCEEDED(aStatus)) { #ifdef NS_DEBUG - printf("nsMsgComposeSendListener: Success on the message copy operation!\n"); + PRINTF("nsMsgComposeSendListener: Success on the message copy operation!\n"); #endif mComposeObj->NotifyStateListeners(nsMsgCompose::eSaveAndSendProcessDone); // We should only close the window if we are done. Things like templates @@ -1789,7 +1794,7 @@ nsMsgComposeSendListener::OnStopCopy(nsresult aStatus) else { #ifdef NS_DEBUG - printf("nsMsgComposeSendListener: the message copy operation failed!\n"); + PRINTF("nsMsgComposeSendListener: the message copy operation failed!\n"); #endif mComposeObj->NotifyStateListeners(nsMsgCompose::eSaveAndSendProcessDone); mComposeObj->ShowWindow(PR_TRUE); diff --git a/mozilla/mailnews/compose/src/nsMsgCopy.cpp b/mozilla/mailnews/compose/src/nsMsgCopy.cpp index dc050244723..14fe4526e18 100644 --- a/mozilla/mailnews/compose/src/nsMsgCopy.cpp +++ b/mozilla/mailnews/compose/src/nsMsgCopy.cpp @@ -42,6 +42,11 @@ #include "prcmon.h" #include "nsIMsgImapMailFolder.h" #include "nsIEventQueueService.h" +#include "nslog.h" + +NS_IMPL_LOG(nsMsgCopyLog) +#define PRINTF NS_LOG_PRINTF(nsMsgCopyLog) +#define FLUSH NS_LOG_FLUSH(nsMsgCopyLog) static NS_DEFINE_CID(kStandardUrlCID, NS_STANDARDURL_CID); static NS_DEFINE_CID(kMsgCopyServiceCID,NS_MSGCOPYSERVICE_CID); @@ -76,7 +81,7 @@ nsresult CopyListener::OnStartCopy() { #ifdef NS_DEBUG - printf("CopyListener::OnStartCopy()\n"); + PRINTF("CopyListener::OnStartCopy()\n"); #endif if (mComposeAndSend) @@ -88,7 +93,7 @@ nsresult CopyListener::OnProgress(PRUint32 aProgress, PRUint32 aProgressMax) { #ifdef NS_DEBUG - printf("CopyListener::OnProgress() %d of %d\n", aProgress, aProgressMax); + PRINTF("CopyListener::OnProgress() %d of %d\n", aProgress, aProgressMax); #endif if (mComposeAndSend) @@ -119,13 +124,13 @@ CopyListener::OnStopCopy(nsresult aStatus) if (NS_SUCCEEDED(aStatus)) { #ifdef NS_DEBUG - printf("CopyListener: SUCCESSFUL ON THE COPY OPERATION!\n"); + PRINTF("CopyListener: SUCCESSFUL ON THE COPY OPERATION!\n"); #endif } else { #ifdef NS_DEBUG - printf("CopyListener: COPY OPERATION FAILED!\n"); + PRINTF("CopyListener: COPY OPERATION FAILED!\n"); #endif } diff --git a/mozilla/mailnews/compose/src/nsMsgCreate.cpp b/mozilla/mailnews/compose/src/nsMsgCreate.cpp index d7aebdc8686..133e43fc123 100644 --- a/mozilla/mailnews/compose/src/nsMsgCreate.cpp +++ b/mozilla/mailnews/compose/src/nsMsgCreate.cpp @@ -56,6 +56,11 @@ #include "nsIMsgMailSession.h" #include "nsIMsgMailNewsUrl.h" #include "nsMsgBaseCID.h" +#include "nslog.h" + +NS_IMPL_LOG(nsMsgCreateLog) +#define PRINTF NS_LOG_PRINTF(nsMsgCreateLog) +#define FLUSH NS_LOG_FLUSH(nsMsgCreateLog) // CID's needed @@ -168,7 +173,7 @@ nsMsgDraft::ProcessDraftOrTemplateOperation(const PRUnichar *msgURI, nsMimeOutpu ReleaseMessageServiceFromURI(mURI, mMessageService); mMessageService = nsnull; #ifdef NS_DEBUG - printf("Failed to create MIME stream converter...\n"); + PRINTF("Failed to create MIME stream converter...\n"); #endif return rv; } @@ -189,7 +194,7 @@ nsMsgDraft::ProcessDraftOrTemplateOperation(const PRUnichar *msgURI, nsMimeOutpu ReleaseMessageServiceFromURI(mURI, mMessageService); mMessageService = nsnull; #ifdef NS_DEBUG - printf("Unable to get the nsIStreamListener interface from libmime\n"); + PRINTF("Unable to get the nsIStreamListener interface from libmime\n"); #endif return NS_ERROR_UNEXPECTED; } @@ -227,7 +232,7 @@ nsMsgDraft::ProcessDraftOrTemplateOperation(const PRUnichar *msgURI, nsMimeOutpu ReleaseMessageServiceFromURI(mURI, mMessageService); mMessageService = nsnull; #ifdef NS_DEBUG - printf("Unable to set the output stream for the mime parser...\ncould be failure to create internal libmime data\n"); + PRINTF("Unable to set the output stream for the mime parser...\ncould be failure to create internal libmime data\n"); #endif return NS_ERROR_UNEXPECTED; diff --git a/mozilla/mailnews/compose/src/nsMsgDeliveryListener.cpp b/mozilla/mailnews/compose/src/nsMsgDeliveryListener.cpp index 8e02da5a4ad..ba3a03fd4d0 100644 --- a/mozilla/mailnews/compose/src/nsMsgDeliveryListener.cpp +++ b/mozilla/mailnews/compose/src/nsMsgDeliveryListener.cpp @@ -25,6 +25,11 @@ #include "nsMsgDeliveryListener.h" #include "nsIMsgMailNewsUrl.h" #include "nsMsgPrompts.h" +#include "nslog.h" + +NS_IMPL_LOG(nsMsgDeliveryListenerLog) +#define PRINTF NS_LOG_PRINTF(nsMsgDeliveryListenerLog) +#define FLUSH NS_LOG_FLUSH(nsMsgDeliveryListenerLog) NS_IMPL_ISUPPORTS(nsMsgDeliveryListener, NS_GET_IID(nsIUrlListener)) @@ -32,7 +37,7 @@ nsresult nsMsgDeliveryListener::OnStartRunningUrl(nsIURI * aUrl) { #ifdef NS_DEBUG -// printf("Starting to run the delivery operation\n"); +// PRINTF("Starting to run the delivery operation\n"); #endif if (mMsgSendObj) @@ -49,7 +54,7 @@ nsMsgDeliveryListener::OnStopRunningUrl(nsIURI * aUrl, nsresult aExitCode) { nsresult rv = NS_ERROR_UNEXPECTED; #ifdef NS_DEBUG -// printf("\nOnStopRunningUrl() called!\n"); +// PRINTF("\nOnStopRunningUrl() called!\n"); #endif // First, stop being a listener since we are done. diff --git a/mozilla/mailnews/compose/src/nsMsgQuote.cpp b/mozilla/mailnews/compose/src/nsMsgQuote.cpp index 2cbd9a02af8..37bd76a52dc 100644 --- a/mozilla/mailnews/compose/src/nsMsgQuote.cpp +++ b/mozilla/mailnews/compose/src/nsMsgQuote.cpp @@ -45,6 +45,11 @@ #include "nsMsgCompose.h" #include "nsMsgMailNewsUrl.h" #include "nsXPIDLString.h" +#include "nslog.h" + +NS_IMPL_LOG(nsMsgQuoteLog) +#define PRINTF NS_LOG_PRINTF(nsMsgQuoteLog) +#define FLUSH NS_LOG_FLUSH(nsMsgQuoteLog) static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID); static NS_DEFINE_CID(kIStreamConverterServiceCID, NS_STREAMCONVERTERSERVICE_CID); @@ -89,7 +94,7 @@ NS_IMETHODIMP nsMsgQuoteListener::GetMsgQuote(nsIMsgQuote ** aMsgQuote) nsresult nsMsgQuoteListener::OnHeadersReady(nsIMimeHeaders * headers) { - printf("RECEIVE CALLBACK: OnHeadersReady\n"); + PRINTF("RECEIVE CALLBACK: OnHeadersReady\n"); nsCOMPtr aStreamListener; if (mMsgQuote) mMsgQuote->GetStreamListener(getter_AddRefs(aStreamListener)); diff --git a/mozilla/mailnews/compose/src/nsMsgSend.cpp b/mozilla/mailnews/compose/src/nsMsgSend.cpp index 17ff62a9a5d..282ea0b78dc 100644 --- a/mozilla/mailnews/compose/src/nsMsgSend.cpp +++ b/mozilla/mailnews/compose/src/nsMsgSend.cpp @@ -78,6 +78,11 @@ #include "nsAppShellCIDs.h" // TODO remove later #include "nsIAppShellService.h" // TODO remove later #include "nsIXULWindow.h" // TODO remove later +#include "nslog.h" + +NS_IMPL_LOG(nsMsgSendLog) +#define PRINTF NS_LOG_PRINTF(nsMsgSendLog) +#define FLUSH NS_LOG_FLUSH(nsMsgSendLog) // use these macros to define a class IID for our component. Our object currently // supports two interfaces (nsISupports and nsIMsgCompose) so we want to define constants @@ -236,7 +241,7 @@ void nsMsgComposeAndSend::Clear() { #ifdef NS_DEBUG - printf("\nTHE CLEANUP ROUTINE FOR nsMsgComposeAndSend() WAS CALLED\n"); + PRINTF("\nTHE CLEANUP ROUTINE FOR nsMsgComposeAndSend() WAS CALLED\n"); #endif PR_FREEIF (m_attachment1_type); PR_FREEIF (m_attachment1_encoding); @@ -1749,7 +1754,7 @@ nsMsgComposeAndSend::CountCompFieldAttachments() // parse the attachment list #ifdef NS_DEBUG - printf("Comp fields attachment list = %s\n", (const char*)attachmentList); + PRINTF("Comp fields attachment list = %s\n", (const char*)attachmentList); #endif char *token = nsnull; @@ -1771,16 +1776,16 @@ nsMsgComposeAndSend::CountCompFieldAttachments() { mCompFieldLocalAttachments++; #ifdef NS_DEBUG - printf("Counting LOCAL attachment %d: %s\n", - mCompFieldLocalAttachments, str.GetBuffer()); + PRINTF("Counting LOCAL attachment %d: %s\n", + mCompFieldLocalAttachments, str.GetBuffer()); #endif } else // This is a remote URL... { mCompFieldRemoteAttachments++; #ifdef NS_DEBUG - printf("Counting REMOTE attachment %d: %s\n", - mCompFieldRemoteAttachments, str.GetBuffer()); + PRINTF("Counting REMOTE attachment %d: %s\n", + mCompFieldRemoteAttachments, str.GetBuffer()); #endif } @@ -1829,7 +1834,7 @@ nsMsgComposeAndSend::AddCompFieldLocalAttachments() if (str.CompareWithConversion("file://", PR_TRUE, 7) == 0) { #ifdef NS_DEBUG - printf("Adding LOCAL attachment %d: %s\n", newLoc, str.GetBuffer()); + PRINTF("Adding LOCAL attachment %d: %s\n", newLoc, str.GetBuffer()); #endif #ifdef XP_WIN str.ReplaceChar('|', ':'); @@ -1943,7 +1948,7 @@ nsMsgComposeAndSend::AddCompFieldRemoteAttachments(PRUint32 aStartLocation, if (str.CompareWithConversion("file://", PR_TRUE, 7) != 0) { #ifdef NS_DEBUG - printf("Adding REMOTE attachment %d: %s\n", newLoc, str.GetBuffer()); + PRINTF("Adding REMOTE attachment %d: %s\n", newLoc, str.GetBuffer()); #endif m_attachments[newLoc].mDeleteFile = PR_TRUE; @@ -2989,7 +2994,7 @@ nsMsgComposeAndSend::DoDeliveryExitProcessing(nsIURI * aUri, nsresult aExitCode, if (NS_FAILED(aExitCode)) { #ifdef NS_DEBUG - printf("\nMessage Delivery Failed!\n"); + PRINTF("\nMessage Delivery Failed!\n"); #endif nsXPIDLString eMsg; @@ -3020,7 +3025,7 @@ nsMsgComposeAndSend::DoDeliveryExitProcessing(nsIURI * aUri, nsresult aExitCode, } #ifdef NS_DEBUG else - printf("\nMessage Delivery SUCCEEDED!\n"); + PRINTF("\nMessage Delivery SUCCEEDED!\n"); #endif @@ -3057,7 +3062,7 @@ nsMsgComposeAndSend::DoDeliveryExitProcessing(nsIURI * aUri, nsresult aExitCode, if (NS_FAILED(retCode)) { #ifdef NS_DEBUG - printf("\nDoDeliveryExitProcessing(): DoFcc() call Failed!\n"); + PRINTF("\nDoDeliveryExitProcessing(): DoFcc() call Failed!\n"); #endif return; } @@ -3095,7 +3100,7 @@ nsMsgComposeAndSend::DoFcc() if (!mCompFields->GetFcc() || !*mCompFields->GetFcc()) { #ifdef NS_DEBUG - printf("\nCopy operation disabled by user!\n"); + PRINTF("\nCopy operation disabled by user!\n"); #endif NotifyListenersOnStopSending(nsnull, NS_OK, nsnull, nsnull); diff --git a/mozilla/mailnews/compose/src/nsMsgSendLater.cpp b/mozilla/mailnews/compose/src/nsMsgSendLater.cpp index 10f5138605c..8fcafe6e637 100644 --- a/mozilla/mailnews/compose/src/nsMsgSendLater.cpp +++ b/mozilla/mailnews/compose/src/nsMsgSendLater.cpp @@ -53,6 +53,11 @@ #include "nsIURI.h" #include "nsISmtpUrl.h" #include "nsIChannel.h" +#include "nslog.h" + +NS_IMPL_LOG(nsMsgSendLaterLog) +#define PRINTF NS_LOG_PRINTF(nsMsgSendLaterLog) +#define FLUSH NS_LOG_FLUSH(nsMsgSendLaterLog) static NS_DEFINE_CID(kPrefCID, NS_PREF_CID); static NS_DEFINE_CID(kCMsgMailSessionCID, NS_MSGMAILSESSION_CID); @@ -167,7 +172,7 @@ nsMsgSendLater::OnStopRequest(nsIChannel *channel, nsISupports *ctxt, nsresult s rv = CompleteMailFileSend(); #ifdef NS_DEBUG - printf("nsMsgSendLater: Success on getting message...\n"); + PRINTF("nsMsgSendLater: Success on getting message...\n"); #endif // If the send operation failed..try the next one... @@ -349,7 +354,7 @@ nsresult SendOperationListener::OnStartSending(const char *aMsgID, PRUint32 aMsgSize) { #ifdef NS_DEBUG - printf("SendOperationListener::OnStartSending()\n"); + PRINTF("SendOperationListener::OnStartSending()\n"); #endif return NS_OK; } @@ -358,7 +363,7 @@ nsresult SendOperationListener::OnProgress(const char *aMsgID, PRUint32 aProgress, PRUint32 aProgressMax) { #ifdef NS_DEBUG - printf("SendOperationListener::OnProgress()\n"); + PRINTF("SendOperationListener::OnProgress()\n"); #endif return NS_OK; } @@ -367,7 +372,7 @@ nsresult SendOperationListener::OnStatus(const char *aMsgID, const PRUnichar *aMsg) { #ifdef NS_DEBUG - printf("SendOperationListener::OnStatus()\n"); + PRINTF("SendOperationListener::OnStatus()\n"); #endif return NS_OK; @@ -384,7 +389,7 @@ SendOperationListener::OnStopSending(const char *aMsgID, nsresult aStatus, const if (NS_SUCCEEDED(aStatus)) { #ifdef NS_DEBUG - printf("nsMsgSendLater: Success on the message send operation!\n"); + PRINTF("nsMsgSendLater: Success on the message send operation!\n"); #endif PRBool deleteMsgs = PR_TRUE; @@ -564,7 +569,7 @@ nsMsgSendLater::StartNextMailFileSend() { // Call any listeners on this operation and then exit cleanly #ifdef NS_DEBUG - printf("nsMsgSendLater: Finished \"Send Later\" operation.\n"); + PRINTF("nsMsgSendLater: Finished \"Send Later\" operation.\n"); #endif NotifyListenersOnStopSending(NS_OK, nsnull, mTotalSendCount, mTotalSentSuccessfully); return NS_OK; @@ -596,7 +601,7 @@ nsMsgSendLater::StartNextMailFileSend() #ifdef NS_DEBUG nsXPIDLCString subject; mMessage->GetSubject(getter_Copies(subject)); - printf("Sending message: [%s]\n", (const char*)subject); + PRINTF("Sending message: [%s]\n", (const char*)subject); #endif mTempFileSpec = nsMsgCreateTempFileSpec("nsqmail.tmp"); diff --git a/mozilla/mailnews/compose/src/nsSmtpDataSource.cpp b/mozilla/mailnews/compose/src/nsSmtpDataSource.cpp index 86517305432..f3088f16e5f 100644 --- a/mozilla/mailnews/compose/src/nsSmtpDataSource.cpp +++ b/mozilla/mailnews/compose/src/nsSmtpDataSource.cpp @@ -29,6 +29,11 @@ #include "nsISmtpServer.h" #include "nsSmtpDataSource.h" #include "nsMsgCompCID.h" +#include "nslog.h" + +NS_IMPL_LOG(nsSmtpDataSourceLog) +#define PRINTF NS_LOG_PRINTF(nsSmtpDataSourceLog) +#define FLUSH NS_LOG_FLUSH(nsSmtpDataSourceLog) static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID); static NS_DEFINE_CID(kSmtpServiceCID, NS_SMTPSERVICE_CID); @@ -170,19 +175,19 @@ nsSmtpDataSource::GetTarget(nsIRDFResource *aSource, nsCOMPtr testServer; if (aProperty == kNC_IsDefaultServer.get()) { - printf("Checking for default.."); + PRINTF("Checking for default.."); smtpService->GetDefaultServer(getter_AddRefs(testServer)); } else if (aProperty == kNC_IsSessionDefaultServer.get()) { - printf("checking for session default.."); + PRINTF("checking for session default.."); smtpService->GetSessionDefaultServer(getter_AddRefs(testServer)); } if (testServer.get() == smtpServer.get()) truthValue = PR_TRUE; - printf("%s\n", truthValue ? "TRUE" : "FALSE"); + PRINTF("%s\n", truthValue ? "TRUE" : "FALSE"); if (truthValue) { *aResult = kTrueLiteral; NS_ADDREF(*aResult); @@ -190,7 +195,7 @@ nsSmtpDataSource::GetTarget(nsIRDFResource *aSource, } else { - printf("smtpDatasource: Unknown property\n"); + PRINTF("smtpDatasource: Unknown property\n"); } return NS_OK; diff --git a/mozilla/mailnews/compose/src/nsURLFetcher.cpp b/mozilla/mailnews/compose/src/nsURLFetcher.cpp index fad11eb9124..d8f636150a3 100644 --- a/mozilla/mailnews/compose/src/nsURLFetcher.cpp +++ b/mozilla/mailnews/compose/src/nsURLFetcher.cpp @@ -40,6 +40,11 @@ #include "nsMimeTypes.h" #include "nsIHTTPChannel.h" #include "nsIWebProgress.h" +#include "nslog.h" + +NS_IMPL_LOG(nsURLFetcherLog) +#define PRINTF NS_LOG_PRINTF(nsURLFetcherLog) +#define FLUSH NS_LOG_FLUSH(nsURLFetcherLog) static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID); @@ -271,7 +276,7 @@ nsresult nsURLFetcher::OnStopRequest(nsIChannel *aChannel, nsISupports * /* ctxt */, nsresult aStatus, const PRUnichar* aMsg) { #ifdef NS_DEBUG_rhp - printf("nsURLFetcher::OnStopRequest()\n"); + PRINTF("nsURLFetcher::OnStopRequest()\n"); #endif // it's possible we could get in here from the channel calling us with an OnStopRequest and from our diff --git a/mozilla/mailnews/compose/tests/compose/test.cpp b/mozilla/mailnews/compose/tests/compose/test.cpp index 55fb37d6e7d..1a212eef6fd 100644 --- a/mozilla/mailnews/compose/tests/compose/test.cpp +++ b/mozilla/mailnews/compose/tests/compose/test.cpp @@ -65,6 +65,11 @@ #include #endif #include "nsMimeTypes.h" +#include "nslog.h" + +NS_IMPL_LOG(testLog) +#define PRINTF NS_LOG_PRINTF(testLog) +#define FLUSH NS_LOG_FLUSH(testLog) #ifdef XP_PC #define XPCOM_DLL "xpcom32.dll" @@ -263,7 +268,7 @@ SetupRegistry(void) nsresult res = nsServiceManager::GetService(kCharsetConverterManagerCID, NS_GET_IID(nsICharsetConverterManager), (nsISupports **)&ccMan); if (NS_FAILED(res)) { - printf("ERROR at GetService() code=0x%x.\n",res); + PRINTF("ERROR at GetService() code=0x%x.\n",res); return NS_ERROR_FAILURE; } @@ -290,7 +295,7 @@ GetHackIdentity() NS_MSGACCOUNTMANAGER_CONTRACTID, &rv); if (NS_FAILED(rv)) return nsnull; { - printf("Failure on AccountManager Init!\n"); + PRINTF("Failure on AccountManager Init!\n"); return nsnull; } @@ -307,7 +312,7 @@ GetHackIdentity() (void **)getter_AddRefs(identity)); if (NS_FAILED(rv)) { - printf("Failure getting Identity!\n"); + PRINTF("Failure getting Identity!\n"); return nsnull; } @@ -339,14 +344,14 @@ int main(int argc, char *argv[]) NS_WITH_SERVICE(nsIEventQueueService, pEventQService, kEventQueueServiceCID, &rv); if (NS_FAILED(rv)) { - printf("Failed to get event queue\n"); + PRINTF("Failed to get event queue\n"); return rv; } rv = pEventQService->CreateThreadEventQueue(); if (NS_FAILED(rv)) { - printf("Failed to create event queue\n"); + PRINTF("Failed to create event queue\n"); return rv; } @@ -362,12 +367,12 @@ int main(int argc, char *argv[]) if (NS_FAILED(prefs->StartUp())) { - printf("Failed to start up prefs!\n"); + PRINTF("Failed to start up prefs!\n"); exit(rv); } if (NS_FAILED(prefs->ReadUserPrefs())) { - printf("Failed on reading user prefs!\n"); + PRINTF("Failed on reading user prefs!\n"); exit(rv); } @@ -378,7 +383,7 @@ int main(int argc, char *argv[]) rv = nsComponentManager::CreateInstance(kMsgSendCID, NULL, NS_GET_IID(nsIMsgSend), (void **) &pMsgSend); if (NS_SUCCEEDED(rv) && pMsgSend) { - printf("We succesfully obtained a nsIMsgSend interface....\n"); + PRINTF("We succesfully obtained a nsIMsgSend interface....\n"); rv = nsComponentManager::CreateInstance(kMsgCompFieldsCID, NULL, NS_GET_IID(nsIMsgCompFields), (void **) &pMsgCompFields); if (NS_SUCCEEDED(rv) && pMsgCompFields) @@ -427,7 +432,7 @@ int main(int argc, char *argv[]) sendListener = new SendOperationListener(); if (!sendListener) { - printf("Failure creating send listener!\n"); + PRINTF("Failure creating send listener!\n"); return NS_ERROR_FAILURE; } NS_ADDREF(sendListener); @@ -453,7 +458,7 @@ int main(int argc, char *argv[]) } #if defined(XP_PC) && !defined(XP_OS2) - printf("Sitting in an event processing loop ...Hit Cntl-C to exit..."); + PRINTF("Sitting in an event processing loop ...Hit Cntl-C to exit..."); while (keepOnRunning) { MSG msg; @@ -466,7 +471,7 @@ int main(int argc, char *argv[]) #endif NS_RELEASE(sendListener); - printf("Releasing the interfaces now...\n"); + PRINTF("Releasing the interfaces now...\n"); pMsgSend->Release(); pMsgCompFields->Release(); diff --git a/mozilla/mailnews/compose/tests/compose2/test2.cpp b/mozilla/mailnews/compose/tests/compose2/test2.cpp index 3c08c1b44b3..6165db1282e 100644 --- a/mozilla/mailnews/compose/tests/compose2/test2.cpp +++ b/mozilla/mailnews/compose/tests/compose2/test2.cpp @@ -50,6 +50,11 @@ #include "nsCRT.h" #include "prmem.h" #include "nsFileStream.h" +#include "nslog.h" + +NS_IMPL_LOG(test2Log) +#define PRINTF NS_LOG_PRINTF(test2Log) +#define FLUSH NS_LOG_FLUSH(test2Log) #ifdef XP_PC #ifdef XP_OS2 @@ -133,7 +138,7 @@ nsresult rv; NS_MSGACCOUNTMANAGER_CONTRACTID, &rv); if (NS_FAILED(rv)) { - printf("Failure on Mail Session Init!\n"); + PRINTF("Failure on Mail Session Init!\n"); return nsnull; } @@ -149,7 +154,7 @@ nsresult rv; (void **)getter_AddRefs(identity)); if (NS_FAILED(rv)) { - printf("Failure getting Identity!\n"); + PRINTF("Failure getting Identity!\n"); return nsnull; } @@ -237,7 +242,7 @@ nsresult SendOperationListener::OnStartSending(const char *aMsgID, PRUint32 aMsgSize) { #ifdef NS_DEBUG - printf("SendOperationListener::OnStartSending()\n"); + PRINTF("SendOperationListener::OnStartSending()\n"); #endif return NS_OK; } @@ -246,7 +251,7 @@ nsresult SendOperationListener::OnProgress(const char *aMsgID, PRUint32 aProgress, PRUint32 aProgressMax) { #ifdef NS_DEBUG - printf("SendOperationListener::OnProgress()\n"); + PRINTF("SendOperationListener::OnProgress()\n"); #endif return NS_OK; } @@ -255,7 +260,7 @@ nsresult SendOperationListener::OnStatus(const char *aMsgID, const PRUnichar *aMsg) { #ifdef NS_DEBUG - printf("SendOperationListener::OnStatus()\n"); + PRINTF("SendOperationListener::OnStatus()\n"); #endif return NS_OK; @@ -267,15 +272,15 @@ SendOperationListener::OnStopSending(const char *aMsgID, nsresult aStatus, const { if (NS_SUCCEEDED(aStatus)) { - printf("Save Mail File Operation Completed Successfully!\n"); + PRINTF("Save Mail File Operation Completed Successfully!\n"); } else { - printf("Save Mail File Operation FAILED!\n"); + PRINTF("Save Mail File Operation FAILED!\n"); } keepOnRunning = PR_FALSE; - printf("Exit code = [%d]\n", aStatus); + PRINTF("Exit code = [%d]\n", aStatus); return NS_OK; } @@ -371,14 +376,14 @@ int main(int argc, char *argv[]) if (NS_FAILED(rv)) { - printf("Failed to get event queue\n"); + PRINTF("Failed to get event queue\n"); return rv; } rv = pEventQService->CreateThreadEventQueue(); if (NS_FAILED(rv)) { - printf("Failed to create event queue\n"); + PRINTF("Failed to create event queue\n"); return rv; } @@ -389,21 +394,21 @@ int main(int argc, char *argv[]) NS_WITH_SERVICE(nsIPref, prefs, kPrefCID, &rv); if (NS_FAILED(rv) || (prefs == nsnull)) { - printf("Failed to get the prefs service...\n"); + PRINTF("Failed to get the prefs service...\n"); exit(rv); } if (NS_FAILED(prefs->ReadUserPrefs())) { - printf("Failed on reading user prefs!\n"); + PRINTF("Failed on reading user prefs!\n"); exit(rv); } - printf("Creating temp mail file...\n"); + PRINTF("Creating temp mail file...\n"); mailFile = nsMsgCreateTempFileSpec("mailTest.eml"); if (NS_FAILED(WriteTempMailFile(mailFile))) { - printf("Failed to create temp mail file!\n"); + PRINTF("Failed to create temp mail file!\n"); return 0; } @@ -414,7 +419,7 @@ int main(int argc, char *argv[]) rv = nsComponentManager::CreateInstance(kMsgSendCID, NULL, kIMsgSendIID, (void **) &pMsgSend); if (NS_SUCCEEDED(rv) && pMsgSend) { - printf("We succesfully obtained a nsIMsgSend interface....\n"); + PRINTF("We succesfully obtained a nsIMsgSend interface....\n"); rv = nsComponentManager::CreateInstance(kMsgCompFieldsCID, NULL, kIMsgCompFieldsIID, (void **) &pMsgCompFields); if (NS_SUCCEEDED(rv) && pMsgCompFields) @@ -430,7 +435,7 @@ int main(int argc, char *argv[]) nsIMsgSendListener **tArray = CreateListenerArray(mSendListener); if (!tArray) { - printf("Error creating listener array.\n"); + PRINTF("Error creating listener array.\n"); return NS_ERROR_FAILURE; } @@ -447,7 +452,7 @@ int main(int argc, char *argv[]) } #if defined(XP_PC) && !defined(XP_OS2) - printf("Sitting in an event processing loop ...Hit Cntl-C to exit..."); + PRINTF("Sitting in an event processing loop ...Hit Cntl-C to exit..."); while (keepOnRunning) { MSG msg; @@ -459,7 +464,7 @@ int main(int argc, char *argv[]) } #endif - printf("Releasing the interface now...\n"); + PRINTF("Releasing the interface now...\n"); pMsgSend->Release(); pMsgCompFields->Release(); diff --git a/mozilla/mailnews/compose/tests/geturl/geturl.cpp b/mozilla/mailnews/compose/tests/geturl/geturl.cpp index 84ef5d6b70f..915a03ff915 100644 --- a/mozilla/mailnews/compose/tests/geturl/geturl.cpp +++ b/mozilla/mailnews/compose/tests/geturl/geturl.cpp @@ -55,6 +55,8 @@ static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID); #include "windows.h" #endif +#undef fprintf + //////////////////////////////////////////////////////////////////////////////////// // THIS IS THE STUFF TO GET THE TEST HARNESS OFF THE GROUND //////////////////////////////////////////////////////////////////////////////////// @@ -100,7 +102,7 @@ SetupRegistry(void) nsresult res = nsServiceManager::GetService(kCharsetConverterManagerCID, NS_GET_IID(nsICharsetConverterManager), (nsISupports **)&ccMan); if (NS_FAILED(res)) { - printf("ERROR at GetService() code=0x%x.\n",res); + fprintf(stderr, "ERROR at GetService() code=0x%x.\n",res); return NS_ERROR_FAILURE; } @@ -194,7 +196,7 @@ FlushEvents(void) nsresult MyCallback(nsIURI* aURL, nsresult aStatus, PRInt32 totalSize, const PRUnichar* aMsg, void *tagData) { - printf("Done with URL Request. Exit Code = [%d] - Received [%d] bytes\n", aStatus, totalSize); + fprintf(stderr, "Done with URL Request. Exit Code = [%d] - Received [%d] bytes\n", aStatus, totalSize); return NS_OK; } @@ -226,7 +228,7 @@ main(int argc, char** argv) // Create an nsIURI object needed for the URL operation IO... if (NS_FAILED(nsMsgNewURL(&aURL, argv[1]))) { - printf("Unable to create URL\n"); + fprintf(stderr, "Unable to create URL\n"); return NS_ERROR_FAILURE; } @@ -234,7 +236,7 @@ main(int argc, char** argv) nsURLFetcher *sFetcher = new nsURLFetcher(); if (!sFetcher) { - printf("Failed to create an attachment stream listener...\n"); + fprintf(stderr, "Failed to create an attachment stream listener...\n"); return rv; } @@ -242,14 +244,14 @@ main(int argc, char** argv) nsOutputFileStream dstFile(fSpec, PR_WRONLY | PR_CREATE_FILE | PR_TRUNCATE ); if (!dstFile.is_open() ) { - printf("Failed to open the output file!\n"); + fprintf(stderr, "Failed to open the output file!\n"); return rv; } rv = sFetcher->FireURLRequest(aURL, &dstFile, MyCallback, sFetcher); if (NS_FAILED(rv)) { - printf("Failed to fire the URL request\n"); + fprintf(stderr, "Failed to fire the URL request\n"); return rv; } diff --git a/mozilla/mailnews/compose/tests/sendlater/test.cpp b/mozilla/mailnews/compose/tests/sendlater/test.cpp index a763aa91517..0492f060e7e 100644 --- a/mozilla/mailnews/compose/tests/sendlater/test.cpp +++ b/mozilla/mailnews/compose/tests/sendlater/test.cpp @@ -73,6 +73,12 @@ #endif #endif +#include "nslog.h" + +NS_IMPL_LOG(testLog) +#define PRINTF NS_LOG_PRINTF(testLog) +#define FLUSH NS_LOG_FLUSH(testLog) + ///////////////////////////////////////////////////////////////////////////////// // Define keys for all of the interfaces we are going to require for this test ///////////////////////////////////////////////////////////////////////////////// @@ -103,14 +109,14 @@ int main(int argc, char *argv[]) if (NS_FAILED(rv)) { - printf("Failed to get event queue\n"); + PRINTF("Failed to get event queue\n"); return rv; } rv = pEventQService->CreateThreadEventQueue(); if (NS_FAILED(rv)) { - printf("Failed to create event queue\n"); + PRINTF("Failed to create event queue\n"); return rv; } @@ -124,7 +130,7 @@ int main(int argc, char *argv[]) } if (NS_FAILED(prefs->ReadUserPrefs())) { - printf("Failed on reading user prefs!\n"); + PRINTF("Failed on reading user prefs!\n"); exit(-1); } @@ -132,7 +138,7 @@ int main(int argc, char *argv[]) NS_WITH_SERVICE(nsIMsgAccountManager, accountManager, NS_MSGACCOUNTMANAGER_CONTRACTID, &rv); if (NS_FAILED(rv)) { - printf("Failure getting Mail Session!\n"); + PRINTF("Failure getting Mail Session!\n"); return rv; } @@ -148,7 +154,7 @@ int main(int argc, char *argv[]) (void **)getter_AddRefs(identity)); if (NS_FAILED(rv)) { - printf("Failure getting Identity!\n"); + PRINTF("Failure getting Identity!\n"); return rv; } @@ -157,12 +163,12 @@ int main(int argc, char *argv[]) (void **) getter_AddRefs(pMsgSendLater)); if (NS_SUCCEEDED(rv) && pMsgSendLater) { - printf("We succesfully obtained a nsIMsgSendLater interface....\n"); + PRINTF("We succesfully obtained a nsIMsgSendLater interface....\n"); pMsgSendLater->SendUnsentMessages(identity, nsnull); } #if defined(XP_PC) && !defined(XP_OS2) - printf("Sitting in an event processing loop ...Hit Cntl-C to exit..."); + PRINTF("Sitting in an event processing loop ...Hit Cntl-C to exit..."); while (1) { MSG msg; diff --git a/mozilla/mailnews/compose/tests/sendpage/Test.cpp b/mozilla/mailnews/compose/tests/sendpage/Test.cpp index a29a1038bfe..fe16a8d955c 100644 --- a/mozilla/mailnews/compose/tests/sendpage/Test.cpp +++ b/mozilla/mailnews/compose/tests/sendpage/Test.cpp @@ -38,6 +38,11 @@ #include "nsIMsgSendListener.h" #include "nsIMsgCopyServiceListener.h" #include "nsIIOService.h" +#include "nslog.h" + +NS_IMPL_LOG(TestLog) +#define PRINTF NS_LOG_PRINTF(TestLog) +#define FLUSH NS_LOG_FLUSH(TestLog) #include #if defined(XP_PC) && !defined(XP_OS2) @@ -155,7 +160,7 @@ nsresult SendOperationListener::OnStartSending(const char *aMsgID, PRUint32 aMsgSize) { #ifdef NS_DEBUG - printf("SendOperationListener::OnStartSending()\n"); + PRINTF("SendOperationListener::OnStartSending()\n"); #endif return NS_OK; } @@ -164,7 +169,7 @@ nsresult SendOperationListener::OnProgress(const char *aMsgID, PRUint32 aProgress, PRUint32 aProgressMax) { #ifdef NS_DEBUG - printf("SendOperationListener::OnProgress()\n"); + PRINTF("SendOperationListener::OnProgress()\n"); #endif return NS_OK; } @@ -173,7 +178,7 @@ nsresult SendOperationListener::OnStatus(const char *aMsgID, const PRUnichar *aMsg) { #ifdef NS_DEBUG - printf("SendOperationListener::OnStatus()\n"); + PRINTF("SendOperationListener::OnStatus()\n"); #endif return NS_OK; @@ -186,14 +191,14 @@ SendOperationListener::OnStopSending(const char *aMsgID, nsresult aStatus, const { if (NS_SUCCEEDED(aStatus)) { - printf("Send Mail Operation Completed Successfully!\n"); + PRINTF("Send Mail Operation Completed Successfully!\n"); } else { - printf("Send Mail Operation FAILED!\n"); + PRINTF("Send Mail Operation FAILED!\n"); } - printf("Exit code = [%d]\n", aStatus); + PRINTF("Exit code = [%d]\n", aStatus); keepOnRunning = PR_FALSE; return NS_OK; } @@ -202,7 +207,7 @@ nsresult SendOperationListener::OnStartCopy() { #ifdef NS_DEBUG - printf("SendOperationListener::OnStartCopy()\n"); + PRINTF("SendOperationListener::OnStartCopy()\n"); #endif return NS_OK; @@ -212,7 +217,7 @@ nsresult SendOperationListener::OnProgress(PRUint32 aProgress, PRUint32 aProgressMax) { #ifdef NS_DEBUG - printf("SendOperationListener::OnProgress() - COPY\n"); + PRINTF("SendOperationListener::OnProgress() - COPY\n"); #endif return NS_OK; } @@ -222,11 +227,11 @@ SendOperationListener::OnStopCopy(nsresult aStatus) { if (NS_SUCCEEDED(aStatus)) { - printf("SendOperationListener::OnStopCopy() Completed Successfully!\n"); + PRINTF("SendOperationListener::OnStopCopy() Completed Successfully!\n"); } else { - printf("SendOperationListener::OnStopCopy() Completed FAILED!\n"); + PRINTF("SendOperationListener::OnStopCopy() Completed FAILED!\n"); } return NS_OK; @@ -296,7 +301,7 @@ nsresult rv; NS_WITH_SERVICE(nsIMsgAccountManager, accountManager, NS_MSGACCOUNTMANAGER_CONTRACTID, &rv); if (NS_FAILED(rv)) { - printf("Failure on Mail Session Init!\n"); + PRINTF("Failure on Mail Session Init!\n"); return nsnull; } @@ -312,7 +317,7 @@ nsresult rv; (void **)getter_AddRefs(identity)); if (NS_FAILED(rv)) { - printf("Failure getting Identity!\n"); + PRINTF("Failure getting Identity!\n"); return nsnull; } @@ -332,7 +337,7 @@ main(int argc, char *argv[]) // Before anything, do some sanity checking :-) if (argc < 4) { - printf("Usage: %s \n", argv[0]); + PRINTF("Usage: %s \n", argv[0]); exit(0); } SetupRegistry(); @@ -341,14 +346,14 @@ main(int argc, char *argv[]) NS_WITH_SERVICE(nsIEventQueueService, pEventQService, kEventQueueServiceCID, &rv); if (NS_FAILED(rv)) { - printf("Failed to get event queue\n"); + PRINTF("Failed to get event queue\n"); return rv; } rv = pEventQService->CreateThreadEventQueue(); if (NS_FAILED(rv)) { - printf("Failed to create event queue\n"); + PRINTF("Failed to create event queue\n"); return rv; } @@ -356,12 +361,12 @@ main(int argc, char *argv[]) NS_WITH_SERVICE(nsIPref, prefs, kPrefCID, &rv); if (NS_FAILED(rv) || (!prefs)) { - printf("Failed on prefs service!\n"); + PRINTF("Failed on prefs service!\n"); exit(rv); } if (NS_FAILED(prefs->ReadUserPrefs())) { - printf("Failed on reading user prefs!\n"); + PRINTF("Failed on reading user prefs!\n"); exit(rv); } @@ -369,7 +374,7 @@ main(int argc, char *argv[]) rv = nsComponentManager::CreateInstance(kMsgSendCID, NULL, NS_GET_IID(nsIMsgSend), (void **) &pMsgSend); if (NS_SUCCEEDED(rv) && pMsgSend) { - printf("We succesfully obtained a nsIMsgSend interface....\n"); + PRINTF("We succesfully obtained a nsIMsgSend interface....\n"); rv = nsComponentManager::CreateInstance(kMsgCompFieldsCID, NULL, NS_GET_IID(nsIMsgCompFields), (void **) &pMsgCompFields); if (NS_SUCCEEDED(rv) && pMsgCompFields) @@ -402,7 +407,7 @@ main(int argc, char *argv[]) nsMsgNewURL(&url, argv[2]); if (!url) { - printf("Error creating new URL object.\n"); + PRINTF("Error creating new URL object.\n"); return -1; } @@ -417,7 +422,7 @@ main(int argc, char *argv[]) nsIMsgSendListener **tArray = CreateListenerArray(mSendListener); if (!tArray) { - printf("Error creating listener array.\n"); + PRINTF("Error creating listener array.\n"); return NS_ERROR_FAILURE; } @@ -426,7 +431,7 @@ main(int argc, char *argv[]) } #if defined(XP_PC) && !defined(XP_OS2) - printf("Sitting in an event processing loop ...Hit Cntl-C to exit..."); + PRINTF("Sitting in an event processing loop ...Hit Cntl-C to exit..."); while (keepOnRunning) { MSG msg; @@ -438,7 +443,7 @@ main(int argc, char *argv[]) } #endif - printf("Releasing the interface now...\n"); + PRINTF("Releasing the interface now...\n"); if (pMsgSend) pMsgSend->Release(); if (pMsgCompFields) diff --git a/mozilla/mailnews/compose/tests/smtp/smtpTest.cpp b/mozilla/mailnews/compose/tests/smtp/smtpTest.cpp index d4767371965..891f97712c6 100644 --- a/mozilla/mailnews/compose/tests/smtp/smtpTest.cpp +++ b/mozilla/mailnews/compose/tests/smtp/smtpTest.cpp @@ -69,6 +69,12 @@ #endif #endif +#include "nslog.h" + +NS_IMPL_LOG(smtpTestLog) +#define PRINTF NS_LOG_PRINTF(smtpTestLog) +#define FLUSH NS_LOG_FLUSH(smtpTestLog) + ///////////////////////////////////////////////////////////////////////////////// // Define keys for all of the interfaces we are going to require for this test ///////////////////////////////////////////////////////////////////////////////// @@ -96,7 +102,7 @@ static NS_DEFINE_IID(kEventQueueCID, NS_EVENTQUEUE_CID); #ifdef XP_UNIX extern "C" char *fe_GetConfigDir(void) { - printf("XXX: return /tmp for fe_GetConfigDir\n"); + PRINTF("XXX: return /tmp for fe_GetConfigDir\n"); return PL_strdup("/tmp"); } #endif /* XP_UNIX */ @@ -203,9 +209,9 @@ nsresult nsSmtpTestDriver::OnStopRunningUrl(nsIURI * aUrl, nsresult aExitCode) // the following strings are used by QA as part of the smoketest. DO NOT REMOVE THEM!!!!!!! /////////////////////////////////////////////////////////////////////////////////////////// if (NS_SUCCEEDED(aExitCode)) - printf("\nMessage Sent: PASSED\n"); + PRINTF("\nMessage Sent: PASSED\n"); else - printf("\nMessage Sent: FAILED!\n"); + PRINTF("\nMessage Sent: FAILED!\n"); return NS_OK; } @@ -282,7 +288,7 @@ void nsSmtpTestDriver::InitializeTestDriver() PL_strcpy(m_urlSpec, DEFAULT_URL_TYPE); // copy "sockstub://" part into url spec... // prompt user for port... - printf("Enter port to use [%d]: ", m_port); + PRINTF("Enter port to use [%d]: ", m_port); fgets(portString, sizeof(portString), stdin); strip_nonprintable(portString); if (portString && *portString) @@ -291,7 +297,7 @@ void nsSmtpTestDriver::InitializeTestDriver() } // now prompt for the host name.... - printf("Enter host name to use [%s]: ", m_host); + PRINTF("Enter host name to use [%s]: ", m_host); fgets(hostString, sizeof(hostString), stdin); strip_nonprintable(hostString); if(hostString && *hostString) @@ -311,9 +317,9 @@ nsresult nsSmtpTestDriver::PromptForUserDataAndBuildUrl(const char * userPrompt) tempBuffer[0] = '\0'; if (userPrompt) - printf(userPrompt); + PRINTF(userPrompt); else - printf("Enter data for command: "); + PRINTF("Enter data for command: "); fgets(tempBuffer, sizeof(tempBuffer), stdin); strip_nonprintable(tempBuffer); @@ -333,7 +339,7 @@ nsresult nsSmtpTestDriver::ReadAndDispatchCommand() char commandString[5]; commandString[0] = '\0'; - printf("Enter command number: "); + PRINTF("Enter command number: "); fgets(commandString, sizeof(commandString), stdin); strip_nonprintable(commandString); if (commandString && *commandString) @@ -360,10 +366,10 @@ nsresult nsSmtpTestDriver::ReadAndDispatchCommand() nsresult nsSmtpTestDriver::ListCommands() { - printf("Commands currently available: \n"); - printf("0) List commands. \n"); - printf("1) Send a message in a file. \n"); - printf("9) Exit the test application. \n"); + PRINTF("Commands currently available: \n"); + PRINTF("0) List commands. \n"); + PRINTF("1) Send a message in a file. \n"); + PRINTF("9) Exit the test application. \n"); return NS_OK; } @@ -373,7 +379,7 @@ nsresult nsSmtpTestDriver::ListCommands() nsresult nsSmtpTestDriver::OnExit() { - printf("Terminating Smtp test harness....\n"); + PRINTF("Terminating Smtp test harness....\n"); m_runTestHarness = PR_FALSE; // next time through the test driver loop, we'll kick out.... return NS_OK; } @@ -416,7 +422,7 @@ nsresult nsSmtpTestDriver::OnSendMessageInFile() nsCOMPtr senderIdentity; senderIdentity = null_nsCOMPtr(); - printf("passing in null for the sender identity will cause the send to fail, but at least it builds. I need to talk to rhp / mscott about this.\n"); + PRINTF("passing in null for the sender identity will cause the send to fail, but at least it builds. I need to talk to rhp / mscott about this.\n"); m_smtpService->SendMailMessage(aIFileSpec, recipients, senderIdentity, this, nsnull, &url); if (url) @@ -458,7 +464,7 @@ int main() prefs->StartUp(); if (NS_FAILED(prefs->ReadUserPrefs())) { - printf("Failed on reading user prefs!\n"); + PRINTF("Failed on reading user prefs!\n"); exit(-1); } @@ -472,7 +478,7 @@ int main() result = pEventQService->GetThreadEventQueue(NS_CURRENT_THREAD,&queue); if (NS_FAILED(result) || !queue) { - printf("unable to get event queue.\n"); + PRINTF("unable to get event queue.\n"); return 1; } diff --git a/mozilla/mailnews/db/msgdb/src/nsImapMailDatabase.cpp b/mozilla/mailnews/db/msgdb/src/nsImapMailDatabase.cpp index b6fdc7e0d86..083004fae39 100644 --- a/mozilla/mailnews/db/msgdb/src/nsImapMailDatabase.cpp +++ b/mozilla/mailnews/db/msgdb/src/nsImapMailDatabase.cpp @@ -25,6 +25,11 @@ #include "nsImapMailDatabase.h" #include "nsDBFolderInfo.h" #include "nsLocalFolderSummarySpec.h" +#include "nslog.h" + +NS_IMPL_LOG(nsImapMailDatabaseLog) +#define PRINTF NS_LOG_PRINTF(nsImapMailDatabaseLog) +#define FLUSH NS_LOG_FLUSH(nsImapMailDatabaseLog) nsImapMailDatabase::nsImapMailDatabase() { @@ -62,7 +67,7 @@ NS_IMETHODIMP nsImapMailDatabase::Open(nsIFileSpec *aFolderName, PRBool create, } #if defined(DEBUG_bienvenu) || defined(DEBUG_jefft) - printf("really opening db in nsImapMailDatabase::Open(%s, %s, %p, %s) -> %s\n", + PRINTF("really opening db in nsImapMailDatabase::Open(%s, %s, %p, %s) -> %s\n", (const char*)folderName, create ? "TRUE":"FALSE", pMessageDB, upgrading ? "TRUE":"FALSE", (const char*)folderName); #endif diff --git a/mozilla/mailnews/db/msgdb/src/nsMailDatabase.cpp b/mozilla/mailnews/db/msgdb/src/nsMailDatabase.cpp index 95acae46d5d..332f003eb21 100644 --- a/mozilla/mailnews/db/msgdb/src/nsMailDatabase.cpp +++ b/mozilla/mailnews/db/msgdb/src/nsMailDatabase.cpp @@ -27,6 +27,11 @@ #include "nsFileStream.h" #include "nsLocalFolderSummarySpec.h" #include "nsFileSpec.h" +#include "nslog.h" + +NS_IMPL_LOG(nsMailDatabaseLog) +#define PRINTF NS_LOG_PRINTF(nsMailDatabaseLog) +#define FLUSH NS_LOG_FLUSH(nsMailDatabaseLog) nsMailDatabase::nsMailDatabase() @@ -317,16 +322,16 @@ void nsMailDatabase::UpdateFolderFlag(nsIMsgDBHdr *mailHdr, PRBool bSet, } } else { - printf("Didn't find %s where expected at position %ld\n" + PRINTF("Didn't find %s where expected at position %ld\n" "instead, found %s.\n", - X_MOZILLA_STATUS, (long) position, buf); + X_MOZILLA_STATUS, (long) position, buf); SetReparse(PR_TRUE); } } else { - printf("Couldn't read old status line at all at position %ld\n", - (long) position); + PRINTF("Couldn't read old status line at all at position %ld\n", + (long) position); SetReparse(PR_TRUE); } #ifdef XP_MAC @@ -339,7 +344,7 @@ void nsMailDatabase::UpdateFolderFlag(nsIMsgDBHdr *mailHdr, PRBool bSet, } else { - printf("Couldn't open mail folder for update%s!\n", + PRINTF("Couldn't open mail folder for update%s!\n", (const char*)m_folderSpec); PR_ASSERT(PR_FALSE); } @@ -471,7 +476,7 @@ nsresult nsMailDatabase::SetFolderInfoValid(nsFileSpec *folderName, int num, int if (pMessageDB == NULL) { - printf("Exception opening summary file\n"); + PRINTF("Exception opening summary file\n"); return NS_MSG_ERROR_FOLDER_SUMMARY_OUT_OF_DATE; } diff --git a/mozilla/mailnews/db/msgdb/src/nsMsgDatabase.cpp b/mozilla/mailnews/db/msgdb/src/nsMsgDatabase.cpp index af15c41fae9..23847a29d60 100644 --- a/mozilla/mailnews/db/msgdb/src/nsMsgDatabase.cpp +++ b/mozilla/mailnews/db/msgdb/src/nsMsgDatabase.cpp @@ -60,6 +60,12 @@ static NS_DEFINE_CID(kCMorkFactory, NS_MORK_CID); #define DEBUG_MSGKEYSET 1 #endif +#include "nslog.h" + +NS_IMPL_LOG(nsMsgDatabaseLog) +#define PRINTF NS_LOG_PRINTF(nsMsgDatabaseLog) +#define FLUSH NS_LOG_FLUSH(nsMsgDatabaseLog) + static NS_DEFINE_IID(kIPrefIID, NS_IPREF_IID); static NS_DEFINE_CID(kPrefCID, NS_PREF_CID); static NS_DEFINE_CID(kCMimeConverterCID, NS_MIME_CONVERTER_CID); @@ -417,7 +423,7 @@ NS_IMETHODIMP nsMsgDatabase::NotifyKeyAddedAll(nsMsgKey keyAdded, nsMsgKey paren nsIDBChangeListener *instigator) { #ifdef DEBUG_bienvenu1 - printf("notifying add of %ld parent %ld\n", keyAdded, parentKey); + PRINTF("notifying add of %ld parent %ld\n", keyAdded, parentKey); #endif if (m_ChangeListeners == nsnull) return NS_OK; @@ -671,7 +677,7 @@ nsMsgDatabase::~nsMsgDatabase() char *str = nsnull; nsresult rv = m_newSet->Output(&str); if (NS_SUCCEEDED(rv) && str) { - printf("setStr = %s on destroy\n",str); + PRINTF("setStr = %s on destroy\n",str); nsMemory::Free(str); str = nsnull; } @@ -948,7 +954,7 @@ NS_IMETHODIMP nsMsgDatabase::ForceClosed() if (m_headersInUse && m_headersInUse->entryCount > 0) { // NS_ASSERTION(PR_FALSE, "leaking headers"); - printf("leaking %d headers in %s\n", m_headersInUse->entryCount, (const char *) m_dbName); + PRINTF("leaking %d headers in %s\n", m_headersInUse->entryCount, (const char *) m_dbName); } #endif ClearUseHdrCache(); @@ -3274,7 +3280,7 @@ nsresult nsMsgDatabase::DumpContents() msgHdr->GetMessageKey(&key); msgHdr->GetAuthor(getter_Copies(author)); msgHdr->GetSubject(getter_Copies(subject)); - printf("hdr key = %u, author = %s subject = %s\n", key, + PRINTF("hdr key = %u, author = %s subject = %s\n", key, ((const char *)author) ? (const char *)author : "", ((const char*)subject) ? (const char*)subject : ""); NS_RELEASE(msgHdr); @@ -3285,7 +3291,7 @@ nsresult nsMsgDatabase::DumpContents() for ( i = 0; i < threads.GetSize(); i++) { key = threads[i]; - printf("thread key = %u\n", key); + PRINTF("thread key = %u\n", key); // DumpThread(key); } diff --git a/mozilla/mailnews/db/msgdb/src/nsMsgThread.cpp b/mozilla/mailnews/db/msgdb/src/nsMsgThread.cpp index 70ac4014c4e..1a9e55edf37 100644 --- a/mozilla/mailnews/db/msgdb/src/nsMsgThread.cpp +++ b/mozilla/mailnews/db/msgdb/src/nsMsgThread.cpp @@ -25,6 +25,11 @@ #include "nsMsgThread.h" #include "nsMsgDatabase.h" #include "nsCOMPtr.h" +#include "nslog.h" + +NS_IMPL_LOG(nsMsgThreadLog) +#define PRINTF NS_LOG_PRINTF(nsMsgThreadLog) +#define FLUSH NS_LOG_FLUSH(nsMsgThreadLog) NS_IMPL_ISUPPORTS(nsMsgThread, NS_GET_IID(nsMsgThread)) @@ -236,7 +241,7 @@ NS_IMETHODIMP nsMsgThread::AddChild(nsIMsgDBHdr *child, nsIMsgDBHdr *inReplyTo, announcer->NotifyParentChangedAll(msgKey, oldThreadParent, newHdrKey, nsnull); #ifdef DEBUG_bienvenu1 if (newHdrKey != m_threadKey) - printf("adding second level child\n"); + PRINTF("adding second level child\n"); #endif // If this hdr was the root, then the new hdr is the root. if (msgKey == m_threadRootKey) @@ -671,7 +676,7 @@ nsMsgThreadEnumerator::nsMsgThreadEnumerator(nsMsgThread *thread, nsMsgKey start child->GetMessageKey(&msgKey); child->GetThreadParent(&threadParent); - printf("index = %ld key = %ld parent = %lx\n", childIndex, msgKey, threadParent); + PRINTF("index = %ld key = %ld parent = %lx\n", childIndex, msgKey, threadParent); } } #endif @@ -721,7 +726,7 @@ PRInt32 nsMsgThreadEnumerator::MsgKeyFirstChildIndex(nsMsgKey inMsgKey) } } #ifdef DEBUG_bienvenu1 - printf("first child index of %ld = %ld\n", inMsgKey, firstChildIndex); + PRINTF("first child index of %ld = %ld\n", inMsgKey, firstChildIndex); #endif return firstChildIndex; } @@ -803,7 +808,7 @@ nsresult nsMsgThreadEnumerator::Prefetch() #ifdef DEBUG_bienvenu1 nsMsgKey debugMsgKey; mResultHdr->GetMessageKey(&debugMsgKey); - printf("next for %ld = %ld\n", mThreadParentKey, debugMsgKey); + PRINTF("next for %ld = %ld\n", mThreadParentKey, debugMsgKey); #endif return rv; @@ -875,7 +880,7 @@ NS_IMETHODIMP nsMsgThread::GetRootHdr(PRInt32 *resultIndex, nsIMsgDBHdr **result return ret; else { - printf("need to reset thread root key\n"); + PRINTF("need to reset thread root key\n"); PRUint32 numChildren; nsMsgKey threadParentKey = nsMsgKey_None; GetNumChildren(&numChildren); diff --git a/mozilla/mailnews/db/msgdb/src/nsNewsDatabase.cpp b/mozilla/mailnews/db/msgdb/src/nsNewsDatabase.cpp index 627b2e3c337..e42ad0d338e 100644 --- a/mozilla/mailnews/db/msgdb/src/nsNewsDatabase.cpp +++ b/mozilla/mailnews/db/msgdb/src/nsNewsDatabase.cpp @@ -27,6 +27,11 @@ #include "nsNewsSummarySpec.h" #include "nsMsgKeySet.h" #include "nsCOMPtr.h" +#include "nslog.h" + +NS_IMPL_LOG(nsNewsDatabaseLog) +#define PRINTF NS_LOG_PRINTF(nsNewsDatabaseLog) +#define FLUSH NS_LOG_FLUSH(nsNewsDatabaseLog) #if defined(DEBUG_sspitzer_) || defined(DEBUG_seth_) #define DEBUG_NEWS_DATABASE 1 @@ -88,9 +93,9 @@ NS_IMETHODIMP nsNewsDatabase::Open(nsIFileSpec *aNewsgroupName, PRBool create, P nsresult err = NS_OK; #ifdef DEBUG_NEWS_DATABASE - printf("nsNewsDatabase::Open(%s, %s, %p, %s) -> %s\n", + PRINTF("nsNewsDatabase::Open(%s, %s, %p, %s) -> %s\n", (const char*)newsgroupName, create ? "TRUE":"FALSE", - pMessageDB, upgrading ? "TRUE":"FALSE", (const char *)summarySpec); + pMessageDB, upgrading ? "TRUE":"FALSE", (const char *)summarySpec); #endif nsFileSpec dbPath(summarySpec); @@ -109,7 +114,7 @@ NS_IMETHODIMP nsNewsDatabase::Open(nsIFileSpec *aNewsgroupName, PRBool create, P if (!newsDB) { #ifdef DEBUG_NEWS_DATABASE - printf("NS_ERROR_OUT_OF_MEMORY\n"); + PRINTF("NS_ERROR_OUT_OF_MEMORY\n"); #endif return NS_ERROR_OUT_OF_MEMORY; } @@ -120,7 +125,7 @@ NS_IMETHODIMP nsNewsDatabase::Open(nsIFileSpec *aNewsgroupName, PRBool create, P err = newsDB->OpenMDB((const char *) summarySpec, create); if (NS_SUCCEEDED(err)) { #ifdef DEBUG_NEWS_DATABASE - printf("newsDB->OpenMDB succeeded!\n"); + PRINTF("newsDB->OpenMDB succeeded!\n"); #endif *pMessageDB = newsDB; if (newsDB) { @@ -129,7 +134,7 @@ NS_IMETHODIMP nsNewsDatabase::Open(nsIFileSpec *aNewsgroupName, PRBool create, P } else { #ifdef DEBUG_NEWS_DATABASE - printf("newsDB->OpenMDB failed!\n"); + PRINTF("newsDB->OpenMDB failed!\n"); #endif *pMessageDB = nsnull; if (newsDB) { @@ -376,7 +381,7 @@ PRBool nsNewsDatabase::SetHdrReadFlag(nsIMsgDBHdr *msgHdr, PRBool bRead) if (!bRead) { #ifdef DEBUG_NEWS_DATABASE - printf("remove %d from the set\n",messageKey); + PRINTF("remove %d from the set\n",messageKey); #endif rv = m_readSet->Remove(messageKey); @@ -387,7 +392,7 @@ PRBool nsNewsDatabase::SetHdrReadFlag(nsIMsgDBHdr *msgHdr, PRBool bRead) } else { #ifdef DEBUG_NEWS_DATABASE - printf("add %d to the set\n",messageKey); + PRINTF("add %d to the set\n",messageKey); #endif rv = m_readSet->Add(messageKey); diff --git a/mozilla/mailnews/imap/src/nsImapIncomingServer.cpp b/mozilla/mailnews/imap/src/nsImapIncomingServer.cpp index 66f2efaee83..0cea0a0f031 100644 --- a/mozilla/mailnews/imap/src/nsImapIncomingServer.cpp +++ b/mozilla/mailnews/imap/src/nsImapIncomingServer.cpp @@ -67,6 +67,11 @@ #include "nsINetDataCacheManager.h" #include "nsINetDataCache.h" #include "nsICachedNetData.h" +#include "nslog.h" + +NS_IMPL_LOG(nsImapIncomingServerLog) +#define PRINTF NS_LOG_PRINTF(nsImapIncomingServerLog) +#define FLUSH NS_LOG_FLUSH(nsImapIncomingServerLog) #include "nsITimer.h" static NS_DEFINE_CID(kCImapHostSessionList, NS_IIMAPHOSTSESSIONLIST_CID); @@ -2136,7 +2141,7 @@ nsImapIncomingServer::PopulateSubscribeDatasourceWithUri(nsIMsgWindow *aMsgWindo { nsresult rv; #ifdef DEBUG_sspitzer - printf("in PopulateSubscribeDatasourceWithUri(%s)\n",uri); + PRINTF("in PopulateSubscribeDatasourceWithUri(%s)\n",uri); #endif mDoingSubscribeDialog = PR_TRUE; @@ -2158,7 +2163,7 @@ nsImapIncomingServer::PopulateSubscribeDatasourceWithUri(nsIMsgWindow *aMsgWindo */ const char *path = uri + nsCRT::strlen((const char *)serverUri) + 1; #ifdef DEBUG_seth - printf("path = %s\n",path); + PRINTF("path = %s\n",path); #endif rv = imapService->BuildSubscribeDatasourceWithPath(this, aMsgWindow, path); @@ -2172,7 +2177,7 @@ nsImapIncomingServer::PopulateSubscribeDatasource(nsIMsgWindow *aMsgWindow, PRBo { nsresult rv; #ifdef DEBUG_sspitzer - printf("in PopulateSubscribeDatasource()\n"); + PRINTF("in PopulateSubscribeDatasource()\n"); #endif mDoingSubscribeDialog = PR_TRUE; @@ -2259,7 +2264,7 @@ NS_IMETHODIMP nsImapIncomingServer::UpdateSubscribedInSubscribeDS() { #ifdef DEBUG_sspitzer - printf("for imap, do this when we populate\n"); + PRINTF("for imap, do this when we populate\n"); #endif return NS_OK; } diff --git a/mozilla/mailnews/imap/src/nsImapMailFolder.cpp b/mozilla/mailnews/imap/src/nsImapMailFolder.cpp index 6321b87c5ec..78a9adcddea 100644 --- a/mozilla/mailnews/imap/src/nsImapMailFolder.cpp +++ b/mozilla/mailnews/imap/src/nsImapMailFolder.cpp @@ -68,8 +68,12 @@ #include "nsIProgressEventSink.h" #include "nsIMsgWindow.h" #include "nsIMsgFolder.h" // TO include biffState enum. Change to bool later... - #include "nsIMsgAccountManager.h" +#include "nslog.h" + +NS_IMPL_LOG(nsImapMailFolderLog) +#define PRINTF NS_LOG_PRINTF(nsImapMailFolderLog) +#define FLUSH NS_LOG_FLUSH(nsImapMailFolderLog) static NS_DEFINE_CID(kMsgAccountManagerCID, NS_MSGACCOUNTMANAGER_CID); static NS_DEFINE_CID(kNetSupportDialogCID, NS_NETSUPPORTDIALOG_CID); @@ -1315,9 +1319,9 @@ NS_IMETHODIMP nsImapMailFolder::ReadFromFolderCacheElem(nsIMsgFolderCacheElement m_onlineFolderName.Assign(onlineName); #ifdef DEBUG_bienvenu if (!nsCRT::strcasecmp((const char *) onlineName, "Sent")) - printf("loading folder cache elem for %s flags = %lx", (const char *) onlineName, mFlags); + PRINTF("loading folder cache elem for %s flags = %lx", (const char *) onlineName, mFlags); else if (!nsCRT::strcasecmp((const char *) onlineName, "INBOX")) - printf("loading folder cache elem for %s flags = %lx", (const char *) onlineName, mFlags); + PRINTF("loading folder cache elem for %s flags = %lx", (const char *) onlineName, mFlags); #endif return rv; } @@ -2360,7 +2364,7 @@ NS_IMETHODIMP nsImapMailFolder::ApplyFilterHit(nsIMsgFilter *filter, PRBool *app } // look at action - currently handle move #ifdef DEBUG_bienvenu - printf("got a rule hit!\n"); + PRINTF("got a rule hit!\n"); #endif if (NS_SUCCEEDED(filter->GetAction(&actionType))) { @@ -3315,7 +3319,7 @@ nsImapMailFolder::OnStopRunningUrl(nsIURI *aUrl, nsresult aExitCode) #ifdef DEBUG_bienvenu1 nsXPIDLCString urlSpec; aUrl->GetSpec(getter_Copies(urlSpec)); - printf("stop running url %s\n", (const char *) urlSpec); + PRINTF("stop running url %s\n", (const char *) urlSpec); #endif if (imapUrl) @@ -3798,7 +3802,7 @@ NS_IMETHODIMP nsImapMailFolder::GetPath(nsIFileSpec ** aPathName) return NS_ERROR_OUT_OF_MEMORY; rv = nsImapURI2Path(kImapRootURI, mURI, *m_pathName); - // printf("constructing path %s\n", (const char *) *m_pathName); + // PRINTF("constructing path %s\n", (const char *) *m_pathName); if (NS_FAILED(rv)) return rv; } rv = NS_NewFileSpecWithSpec(*m_pathName, aPathName); diff --git a/mozilla/mailnews/imap/src/nsImapProtocol.cpp b/mozilla/mailnews/imap/src/nsImapProtocol.cpp index b95a1589f5d..19fc2f976ea 100644 --- a/mozilla/mailnews/imap/src/nsImapProtocol.cpp +++ b/mozilla/mailnews/imap/src/nsImapProtocol.cpp @@ -64,7 +64,6 @@ #include "nsICachedNetData.h" #include "nsCOMPtr.h" -PRLogModuleInfo *IMAP; // netlib required files #include "nsIStreamListener.h" @@ -77,6 +76,11 @@ PRLogModuleInfo *IMAP; #if 0 #include "nsIHashAlgorithm.h" #endif +#include "nslog.h" + +NS_IMPL_LOG(IMAPLog) +#define PRINTF NS_LOG_PRINTF(IMAPLog) +#define FLUSH NS_LOG_FLUSH(IMAPLog) #define ONE_SECOND ((PRUint32)1000) // one second @@ -280,10 +284,6 @@ nsImapProtocol::nsImapProtocol() : Configure(gTooFastTime, gIdealTime, gChunkAddSize, gChunkSize, gChunkThreshold, gFetchByChunks, gMaxChunkSize); - - // where should we do this? Perhaps in the factory object? - if (!IMAP) - IMAP = PR_NewLogModule("IMAP"); } nsresult nsImapProtocol::Configure(PRInt32 TooFastTime, PRInt32 IdealTime, @@ -871,7 +871,7 @@ nsImapProtocol::PseudoInterruptMsgLoad(nsIImapUrl *aImapUrl, PRBool *interrupted } } #ifdef DEBUG_bienvenu - printf("interrupt msg load : %s\n", (*interrupted) ? "TRUE" : "FALSE"); + PRINTF("interrupt msg load : %s\n", (*interrupted) ? "TRUE" : "FALSE"); #endif return NS_OK; } @@ -907,7 +907,7 @@ nsImapProtocol::ImapThreadMainLoop() PR_ExitMonitor(m_urlReadyToRunMonitor); if (err == PR_FAILURE && PR_PENDING_INTERRUPT_ERROR == PR_GetError()) { - printf("error waiting for monitor\n"); + PRINTF("error waiting for monitor\n"); break; } @@ -998,7 +998,7 @@ PRBool nsImapProtocol::ProcessCurrentURL() #ifdef DEBUG_bienvenu1 nsXPIDLCString urlSpec; mailnewsurl->GetSpec(getter_Copies(urlSpec)); - printf("processing url %s\n", (const char *) urlSpec); + PRINTF("processing url %s\n", (const char *) urlSpec); #endif if (NS_SUCCEEDED(rv) && mailnewsurl && m_imapMiscellaneousSink) { @@ -1111,7 +1111,7 @@ PRBool nsImapProtocol::ProcessCurrentURL() #ifdef DEBUG_bienvenu1 mailnewsurl->GetSpec(getter_Copies(urlSpec)); - printf("end processing url %s\n", (const char *) urlSpec); + PRINTF("end processing url %s\n", (const char *) urlSpec); #endif // this is so hokey...we MUST clear any local references to the url // BEFORE calling ReleaseUrlState @@ -1333,7 +1333,7 @@ nsresult nsImapProtocol::LoadUrl(nsIURI * aURL, nsISupports * aConsumer) #ifdef DEBUG_bienvenu1 nsXPIDLCString urlSpec; aURL->GetSpec(getter_Copies(urlSpec)); - printf("loading url %s\n", (const char *) urlSpec); + PRINTF("loading url %s\n", (const char *) urlSpec); #endif m_urlInProgress = PR_TRUE; rv = SetupWithUrl(aURL, aConsumer); @@ -1518,9 +1518,9 @@ NS_IMETHODIMP nsImapProtocol::CanHandleUrl(nsIImapUrl * aImapUrl, } } #ifdef DEBUG_bienvenu1 - printf("proposed url = %s folder for connection %s has To Wait = %s can run = %s\n", + PRINTF("proposed url = %s folder for connection %s has To Wait = %s can run = %s\n", folderNameForProposedUrl, curUrlFolderName.GetBuffer(), - (*hasToWait) ? "TRUE" : "FALSE", (*aCanRunUrl) ? "TRUE" : "FALSE"); + (*hasToWait) ? "TRUE" : "FALSE", (*aCanRunUrl) ? "TRUE" : "FALSE"); #endif PR_FREEIF(folderNameForProposedUrl); } @@ -1732,7 +1732,7 @@ void nsImapProtocol::ProcessSelectedStateURL() { // The shell wasn't in the cache. Deal with this case later. Log("SHELL",NULL,"Loading part, shell not found in cache!"); - //PR_LOG(IMAP, out, ("BODYSHELL: Loading part, shell not found in cache!")); + //PRINTF("BODYSHELL: Loading part, shell not found in cache!"); // The parser will extract the part number from the current URL. SetContentModified(modType); Bodystructure(messageIdString, bMessageIdsAreUids); @@ -1740,7 +1740,7 @@ void nsImapProtocol::ProcessSelectedStateURL() else { Log("SHELL", NULL, "Loading Part, using cached shell."); - //PR_LOG(IMAP, out, ("BODYSHELL: Loading part, using cached shell.")); + //PRINTF("BODYSHELL: Loading part, using cached shell."); SetContentModified(modType); foundShell->SetConnection(this); GetServerStateParser().UseCachedShell(foundShell); @@ -1795,7 +1795,7 @@ void nsImapProtocol::ProcessSelectedStateURL() if (foundShell) { Log("SHELL",NULL,"Loading message, using cached shell."); - //PR_LOG(IMAP, out, ("BODYSHELL: Loading message, using cached shell.")); + //PRINTF("BODYSHELL: Loading message, using cached shell."); foundShell->SetConnection(this); GetServerStateParser().UseCachedShell(foundShell); foundShell->Generate(NULL); @@ -3301,7 +3301,7 @@ PRBool nsImapProtocol::CheckNewMail() // log info including current state... void nsImapProtocol::Log(const char *logSubName, const char *extraInfo, const char *logData) { - if (PR_LOG_TEST(IMAP, PR_LOG_ALWAYS)) + if (NS_LOG_ENABLED(IMAPLog)) { static char *nonAuthStateName = "NA"; static char *authStateName = "A"; @@ -3315,9 +3315,9 @@ void nsImapProtocol::Log(const char *logSubName, const char *extraInfo, const ch if (m_runningUrl) { if (extraInfo) - PR_LOG(IMAP, PR_LOG_ALWAYS, ("%s:%s-%s:%s:%s: %s", hostName,selectedStateName, GetServerStateParser().GetSelectedMailboxName(), logSubName, extraInfo, logData)); + PRINTF("%s:%s-%s:%s:%s: %s", hostName,selectedStateName, GetServerStateParser().GetSelectedMailboxName(), logSubName, extraInfo, logData); else - PR_LOG(IMAP, PR_LOG_ALWAYS, ("%s:%s-%s:%s: %s", hostName,selectedStateName, GetServerStateParser().GetSelectedMailboxName(), logSubName, logData)); + PRINTF("%s:%s-%s:%s: %s", hostName,selectedStateName, GetServerStateParser().GetSelectedMailboxName(), logSubName, logData); } return; break; @@ -3337,9 +3337,9 @@ void nsImapProtocol::Log(const char *logSubName, const char *extraInfo, const ch if (m_runningUrl) { if (extraInfo) - PR_LOG(IMAP, PR_LOG_ALWAYS, ("%s:%s:%s:%s: %s", hostName,stateName,logSubName,extraInfo,logData)); + PRINTF("%s:%s:%s:%s: %s", hostName,stateName,logSubName,extraInfo,logData); else - PR_LOG(IMAP, PR_LOG_ALWAYS, ("%s:%s:%s: %s",hostName,stateName,logSubName,logData)); + PRINTF("%s:%s:%s: %s",hostName,stateName,logSubName,logData); } } } @@ -3690,7 +3690,7 @@ char* nsImapProtocol::CreateNewLineFromSocket() // death signal may have been received which means we should still kick out of the loop. do { -// printf("waiting for data\n"); +// PRINTF("waiting for data\n"); // wait on the data available monitor!! PR_EnterMonitor(m_dataAvailableMonitor); // wait for data arrival diff --git a/mozilla/mailnews/imap/src/nsImapServerResponseParser.cpp b/mozilla/mailnews/imap/src/nsImapServerResponseParser.cpp index ef43f397d78..5a23c32b15a 100644 --- a/mozilla/mailnews/imap/src/nsImapServerResponseParser.cpp +++ b/mozilla/mailnews/imap/src/nsImapServerResponseParser.cpp @@ -37,7 +37,9 @@ ////////////////// nsImapServerResponseParser ///////////////////////// -extern PRLogModuleInfo* IMAP; +#include "nslog.h" + +NS_DECL_LOG(IMAPLog) nsImapServerResponseParser::nsImapServerResponseParser(nsImapProtocol &imapProtocolConnection) : nsIMAPGenericParser(), @@ -445,7 +447,7 @@ void nsImapServerResponseParser::ProcessOkCommand(const char *commandToken) // If we have a valid shell that has not already been cached, then cache it. if (!m_shell->IsShellCached() && fHostSessionList) // cache is responsible for destroying it { - PR_LOG(IMAP, PR_LOG_ALWAYS, + PR_LOG(IMAPLog, PR_LOG_ALWAYS, ("BODYSHELL: Adding shell to cache.")); const char *serverKey = fServerConnection.GetImapServerKey(); fHostSessionList->AddShellToCacheForHost( @@ -2375,7 +2377,7 @@ void nsImapServerResponseParser::UseCachedShell(nsIMAPBodyShell *cachedShell) // We shouldn't already have another shell we're dealing with. if (m_shell && cachedShell) { - PR_LOG(IMAP, PR_LOG_ALWAYS, ("PARSER: Shell Collision")); + PR_LOG(IMAPLog, PR_LOG_ALWAYS, ("PARSER: Shell Collision")); NS_ASSERTION(PR_FALSE, "shell collision"); } m_shell = cachedShell; @@ -2465,7 +2467,7 @@ PRBool nsImapServerResponseParser::msg_fetch_literal(PRBool chunk, PRInt32 origi // This would be a good thing to log. if (lastCRLFwasCRCRLF) - PR_LOG(IMAP, PR_LOG_ALWAYS, ("PARSER: CR/LF fell on chunk boundary.")); + PR_LOG(IMAPLog, PR_LOG_ALWAYS, ("PARSER: CR/LF fell on chunk boundary.")); if (ContinueParse()) { diff --git a/mozilla/mailnews/imap/src/nsImapService.cpp b/mozilla/mailnews/imap/src/nsImapService.cpp index f124c635eaa..a93eb6a3b0a 100644 --- a/mozilla/mailnews/imap/src/nsImapService.cpp +++ b/mozilla/mailnews/imap/src/nsImapService.cpp @@ -55,6 +55,11 @@ #include "nsIDirectoryService.h" #include "nsAppDirectoryServiceDefs.h" #include "nsIWebNavigation.h" +#include "nslog.h" + +NS_IMPL_LOG(nsImapServiceLog) +#define PRINTF NS_LOG_PRINTF(nsImapServiceLog) +#define FLUSH NS_LOG_FLUSH(nsImapServiceLog) #define PREF_MAIL_ROOT_IMAP "mail.root.imap" @@ -2981,7 +2986,7 @@ nsImapService::BuildSubscribeDatasourceWithPath(nsIImapIncomingServer *aServer, nsresult rv; #ifdef DEBUG_sspitzer - printf("BuildSubscribeDatasourceWithPath(%s)\n",folderPath); + PRINTF("BuildSubscribeDatasourceWithPath(%s)\n",folderPath); #endif nsCOMPtr server = do_QueryInterface(aServer); if (!server) return NS_ERROR_FAILURE; diff --git a/mozilla/mailnews/import/eudora/src/EudoraDebugLog.h b/mozilla/mailnews/import/eudora/src/EudoraDebugLog.h index 74963aaa613..969c7f05197 100644 --- a/mozilla/mailnews/import/eudora/src/EudoraDebugLog.h +++ b/mozilla/mailnews/import/eudora/src/EudoraDebugLog.h @@ -23,13 +23,19 @@ #define IMPORT_DEBUG 1 #endif +#include "nslog.h" + +NS_DECL_LOG(EudoraDebugLogLog) +#define PRINTF NS_LOG_PRINTF(EudoraDebugLogLog) +#define FLUSH NS_LOG_FLUSH(EudoraDebugLogLog) + #ifdef IMPORT_DEBUG #include "stdio.h" -#define IMPORT_LOG0( x) printf( x) -#define IMPORT_LOG1( x, y) printf( x, y) -#define IMPORT_LOG2( x, y, z) printf( x, y, z) -#define IMPORT_LOG3( a, b, c, d) printf( a, b, c, d) +#define IMPORT_LOG0( x) PRINTF( x) +#define IMPORT_LOG1( x, y) PRINTF( x, y) +#define IMPORT_LOG2( x, y, z) PRINTF( x, y, z) +#define IMPORT_LOG3( a, b, c, d) PRINTF( a, b, c, d) #else diff --git a/mozilla/mailnews/import/eudora/src/nsEudoraFactory.cpp b/mozilla/mailnews/import/eudora/src/nsEudoraFactory.cpp index 3274af19d5d..643fda3a057 100644 --- a/mozilla/mailnews/import/eudora/src/nsEudoraFactory.cpp +++ b/mozilla/mailnews/import/eudora/src/nsEudoraFactory.cpp @@ -32,8 +32,9 @@ #include "nsEudoraStringBundle.h" #include "EudoraDebugLog.h" -static NS_DEFINE_CID(kEudoraImportCID, NS_EUDORAIMPORT_CID); +NS_IMPL_LOG(EudoraDebugLogLog) +static NS_DEFINE_CID(kEudoraImportCID, NS_EUDORAIMPORT_CID); /////////////////////////////////////////////////////////////////////// diff --git a/mozilla/mailnews/import/oexpress/OEDebugLog.h b/mozilla/mailnews/import/oexpress/OEDebugLog.h index b8194dc7953..cbdade764c8 100644 --- a/mozilla/mailnews/import/oexpress/OEDebugLog.h +++ b/mozilla/mailnews/import/oexpress/OEDebugLog.h @@ -29,13 +29,19 @@ #endif */ +#include "nslog.h" + +NS_DECL_LOG(OEDebugLogLog) +#define PRINTF NS_LOG_PRINTF(OEDebugLogLog) +#define FLUSH NS_LOG_FLUSH(OEDebugLogLog) + #ifdef IMPORT_DEBUG #include "stdio.h" -#define IMPORT_LOG0( x) printf( x) -#define IMPORT_LOG1( x, y) printf( x, y) -#define IMPORT_LOG2( x, y, z) printf( x, y, z) -#define IMPORT_LOG3( a, b, c, d) printf( a, b, c, d) +#define IMPORT_LOG0( x) PRINTF( x) +#define IMPORT_LOG1( x, y) PRINTF( x, y) +#define IMPORT_LOG2( x, y, z) PRINTF( x, y, z) +#define IMPORT_LOG3( a, b, c, d) PRINTF( a, b, c, d) #else diff --git a/mozilla/mailnews/import/oexpress/nsOEFactory.cpp b/mozilla/mailnews/import/oexpress/nsOEFactory.cpp index 80c75e41a49..43bd53f87c6 100644 --- a/mozilla/mailnews/import/oexpress/nsOEFactory.cpp +++ b/mozilla/mailnews/import/oexpress/nsOEFactory.cpp @@ -36,6 +36,8 @@ #include "nsOEStringBundle.h" #include "OEDebugLog.h" +NS_IMPL_LOG(OEDebugLogLog) + static NS_DEFINE_CID(kOEImportCID, NS_OEIMPORT_CID); //////////////////////////////////////////////////////////////////// diff --git a/mozilla/mailnews/import/outlook/src/MapiDbgLog.h b/mozilla/mailnews/import/outlook/src/MapiDbgLog.h index a1068ab7f21..a06936edd4a 100644 --- a/mozilla/mailnews/import/outlook/src/MapiDbgLog.h +++ b/mozilla/mailnews/import/outlook/src/MapiDbgLog.h @@ -29,15 +29,21 @@ #endif */ +#include "nslog.h" + +NS_DECL_LOG(MapiDbgLogLog) +#define PRINTF NS_LOG_PRINTF(MapiDbgLogLog) +#define FLUSH NS_LOG_FLUSH(MapiDbgLogLog) + #ifdef MAPI_DEBUG #include "stdio.h" -#define MAPI_DUMP_STRING( x) printf( "%s", (const char *)x) -#define MAPI_TRACE0( x) printf( x) -#define MAPI_TRACE1( x, y) printf( x, y) -#define MAPI_TRACE2( x, y, z) printf( x, y, z) -#define MAPI_TRACE3( x, y, z, a) printf( x, y, z, a) -#define MAPI_TRACE4( x, y, z, a, b) printf( x, y, z, a, b) +#define MAPI_DUMP_STRING( x) PRINTF( "%s", (const char *)x) +#define MAPI_TRACE0( x) PRINTF( x) +#define MAPI_TRACE1( x, y) PRINTF( x, y) +#define MAPI_TRACE2( x, y, z) PRINTF( x, y, z) +#define MAPI_TRACE3( x, y, z, a) PRINTF( x, y, z, a) +#define MAPI_TRACE4( x, y, z, a, b) PRINTF( x, y, z, a, b) #else diff --git a/mozilla/mailnews/import/outlook/src/OutlookDebugLog.h b/mozilla/mailnews/import/outlook/src/OutlookDebugLog.h index d11e5a68266..4717f3ec49b 100644 --- a/mozilla/mailnews/import/outlook/src/OutlookDebugLog.h +++ b/mozilla/mailnews/import/outlook/src/OutlookDebugLog.h @@ -27,13 +27,19 @@ #define IMPORT_DEBUG 1 #endif +#include "nslog.h" + +NS_DECL_LOG(OutlookDebugLogLog) +#define PRINTF NS_LOG_PRINTF(OutlookDebugLogLog) +#define FLUSH NS_LOG_FLUSH(OutlookDebugLogLog) + #ifdef IMPORT_DEBUG #include "stdio.h" -#define IMPORT_LOG0( x) printf( x) -#define IMPORT_LOG1( x, y) printf( x, y) -#define IMPORT_LOG2( x, y, z) printf( x, y, z) -#define IMPORT_LOG3( a, b, c, d) printf( a, b, c, d) +#define IMPORT_LOG0( x) PRINTF( x) +#define IMPORT_LOG1( x, y) PRINTF( x, y) +#define IMPORT_LOG2( x, y, z) PRINTF( x, y, z) +#define IMPORT_LOG3( a, b, c, d) PRINTF( a, b, c, d) #else diff --git a/mozilla/mailnews/import/outlook/src/nsOutlookFactory.cpp b/mozilla/mailnews/import/outlook/src/nsOutlookFactory.cpp index 0dabe0108a8..ed86c21f14f 100644 --- a/mozilla/mailnews/import/outlook/src/nsOutlookFactory.cpp +++ b/mozilla/mailnews/import/outlook/src/nsOutlookFactory.cpp @@ -36,6 +36,9 @@ #include "nsOutlookStringBundle.h" #include "OutlookDebugLog.h" +NS_IMPL_LOG(OutlookDebugLogLog) +NS_IMPL_LOG(MapiDbgLogLog) + static NS_DEFINE_CID(kOutlookImportCID, NS_OUTLOOKIMPORT_CID); //////////////////////////////////////////////////////////////////////////// diff --git a/mozilla/mailnews/import/src/ImportDebug.h b/mozilla/mailnews/import/src/ImportDebug.h index 6d3529e7cbe..0baa306778c 100644 --- a/mozilla/mailnews/import/src/ImportDebug.h +++ b/mozilla/mailnews/import/src/ImportDebug.h @@ -27,13 +27,19 @@ #define IMPORT_DEBUG 1 #endif +#include "nslog.h" + +NS_DECL_LOG(ImportDebugLog) +#define PRINTF NS_LOG_PRINTF(ImportDebugLog) +#define FLUSH NS_LOG_FLUSH(ImportDebugLog) + #ifdef IMPORT_DEBUG #include -#define IMPORT_LOG0( x) printf( x) -#define IMPORT_LOG1( x, y) printf( x, y) -#define IMPORT_LOG2( x, y, z) printf( x, y, z) -#define IMPORT_LOG3( a, b, c, d) printf( a, b, c, d) +#define IMPORT_LOG0( x) PRINTF( x) +#define IMPORT_LOG1( x, y) PRINTF( x, y) +#define IMPORT_LOG2( x, y, z) PRINTF( x, y, z) +#define IMPORT_LOG3( a, b, c, d) PRINTF( a, b, c, d) #else diff --git a/mozilla/mailnews/import/src/nsImportFactory.cpp b/mozilla/mailnews/import/src/nsImportFactory.cpp index e86784b3229..892c7586627 100644 --- a/mozilla/mailnews/import/src/nsImportFactory.cpp +++ b/mozilla/mailnews/import/src/nsImportFactory.cpp @@ -28,6 +28,7 @@ #include "nsImportStringBundle.h" #include "ImportDebug.h" +NS_IMPL_LOG(ImportDebugLog) extern NS_METHOD NS_NewImportService(nsISupports* aOuter, REFNSIID aIID, void **aResult); diff --git a/mozilla/mailnews/import/src/nsImportService.cpp b/mozilla/mailnews/import/src/nsImportService.cpp index ca2865cf958..0c9ac1a9d9d 100644 --- a/mozilla/mailnews/import/src/nsImportService.cpp +++ b/mozilla/mailnews/import/src/nsImportService.cpp @@ -48,7 +48,6 @@ #include "prmem.h" #include "ImportDebug.h" - static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID); static NS_DEFINE_CID(kImportServiceCID, NS_IMPORTSERVICE_CID); static NS_DEFINE_IID(kImportModuleIID, NS_IIMPORTMODULE_IID); diff --git a/mozilla/mailnews/import/text/src/TextDebugLog.h b/mozilla/mailnews/import/text/src/TextDebugLog.h index 70c091b3989..961a2c6fcf5 100644 --- a/mozilla/mailnews/import/text/src/TextDebugLog.h +++ b/mozilla/mailnews/import/text/src/TextDebugLog.h @@ -23,13 +23,19 @@ #define IMPORT_DEBUG 1 #endif +#include "nslog.h" + +NS_DECL_LOG(TextDebugLogLog) +#define PRINTF NS_LOG_PRINTF(TextDebugLogLog) +#define FLUSH NS_LOG_FLUSH(TextDebugLogLog) + #ifdef IMPORT_DEBUG #include "stdio.h" -#define IMPORT_LOG0( x) printf( x) -#define IMPORT_LOG1( x, y) printf( x, y) -#define IMPORT_LOG2( x, y, z) printf( x, y, z) -#define IMPORT_LOG3( a, b, c, d) printf( a, b, c, d) +#define IMPORT_LOG0( x) PRINTF( x) +#define IMPORT_LOG1( x, y) PRINTF( x, y) +#define IMPORT_LOG2( x, y, z) PRINTF( x, y, z) +#define IMPORT_LOG3( a, b, c, d) PRINTF( a, b, c, d) #else diff --git a/mozilla/mailnews/import/text/src/nsTextFactory.cpp b/mozilla/mailnews/import/text/src/nsTextFactory.cpp index 8b1637f549e..d47799f9ae0 100644 --- a/mozilla/mailnews/import/text/src/nsTextFactory.cpp +++ b/mozilla/mailnews/import/text/src/nsTextFactory.cpp @@ -33,6 +33,8 @@ #include "TextDebugLog.h" +NS_IMPL_LOG(TextDebugLogLog, 0) + static NS_DEFINE_CID(kTextImportCID, NS_TEXTIMPORT_CID); diff --git a/mozilla/mailnews/local/src/nsNoIncomingServer.cpp b/mozilla/mailnews/local/src/nsNoIncomingServer.cpp index 78b58728c69..8d5445ea8d9 100644 --- a/mozilla/mailnews/local/src/nsNoIncomingServer.cpp +++ b/mozilla/mailnews/local/src/nsNoIncomingServer.cpp @@ -38,6 +38,11 @@ #include "nsIChromeRegistry.h" #include "nsIDirectoryService.h" #include "nsAppDirectoryServiceDefs.h" +#include "nslog.h" + +NS_IMPL_LOG(nsNoIncomingServerLog) +#define PRINTF NS_LOG_PRINTF(nsNoIncomingServerLog) +#define FLUSH NS_LOG_FLUSH(nsNoIncomingServerLog) static NS_DEFINE_CID(kChromeRegistryCID, NS_CHROMEREGISTRY_CID); @@ -168,7 +173,7 @@ NS_IMETHODIMP nsNoIncomingServer::CopyDefaultMessages(const char *folderNameOnDi // if it exists add to the end, else copy if (exists) { #ifdef DEBUG_sspitzer - printf("append default %s\n",folderNameOnDisk); + PRINTF("append default %s\n",folderNameOnDisk); #endif // todo for bug #1181 // open folderFile, seek to end @@ -176,7 +181,7 @@ NS_IMETHODIMP nsNoIncomingServer::CopyDefaultMessages(const char *folderNameOnDi } else { #ifdef DEBUG_sspitzer - printf("copy default %s\n",folderNameOnDisk); + PRINTF("copy default %s\n",folderNameOnDisk); #endif rv = defaultMessagesFile->CopyTo(localParentDir, nsnull); if (NS_FAILED(rv)) return rv; diff --git a/mozilla/mailnews/local/src/nsParseMailbox.cpp b/mozilla/mailnews/local/src/nsParseMailbox.cpp index a3dd016e339..151645c41a7 100644 --- a/mozilla/mailnews/local/src/nsParseMailbox.cpp +++ b/mozilla/mailnews/local/src/nsParseMailbox.cpp @@ -50,6 +50,11 @@ #include "nsIPref.h" #include "nsIRDFService.h" #include "nsMsgI18N.h" +#include "nslog.h" + +NS_IMPL_LOG(nsParseMailboxLog) +#define PRINTF NS_LOG(nsParseMailboxLog) +#define FLUSH NS_LOG_FLUSH(nsParseMailboxLog) static NS_DEFINE_CID(kCMailDB, NS_MAILDB_CID); @@ -131,7 +136,7 @@ NS_IMETHODIMP nsMsgMailboxParser::OnStartRequest(nsIChannel * /* aChannel */, ns } NS_ASSERTION(m_mailDB, "failed to open mail db parsing folder"); #ifdef DEBUG_mscott - printf("url file = %s\n", (const char *)fileName); + PRINTF("url file = %s\n", (const char *)fileName); #endif } } @@ -177,7 +182,7 @@ NS_IMETHODIMP nsMsgMailboxParser::OnStopRequest(nsIChannel * /* aChannel */, nsI msgHdr->GetSubject(&subject); #ifdef DEBUG_bienvenu // leak nsString return values... - printf("hdr key = %d, author = %s subject = %s\n", key, author.GetBuffer(), subject.GetBuffer()); + PRINTF("hdr key = %d, author = %s subject = %s\n", key, author.GetBuffer(), subject.GetBuffer()); #endif } } @@ -1706,7 +1711,7 @@ NS_IMETHODIMP nsParseNewMailState::ApplyFilterHit(nsIMsgFilter *filter, PRBool * // look at action - currently handle move #ifdef DEBUG_bienvenu - printf("got a rule hit!\n"); + PRINTF("got a rule hit!\n"); #endif if (NS_SUCCEEDED(filter->GetAction(&actionType))) { diff --git a/mozilla/mailnews/local/src/nsPop3Protocol.cpp b/mozilla/mailnews/local/src/nsPop3Protocol.cpp index b9d75698284..1d4af97ac25 100644 --- a/mozilla/mailnews/local/src/nsPop3Protocol.cpp +++ b/mozilla/mailnews/local/src/nsPop3Protocol.cpp @@ -51,11 +51,16 @@ #include "nsIPref.h" #include "nsIMsgWindow.h" #include "nsIMsgFolder.h" // TO include biffState enum. Change to bool later... +#include "nslog.h" + +NS_IMPL_LOG(nsPop3ProtocolLog) +#define PRINTF NS_LOG_PRINTF(nsPop3ProtocolLog) +#define FLUSH NS_LOG_FLUSH(nsPop3ProtocolLog) #define PREF_MAIL_ALLOW_AT_SIGN_IN_USER_NAME "mail.allow_at_sign_in_user_name" #define EXTRA_SAFETY_SPACE 3096 -static PRLogModuleInfo *POP3LOGMODULE = nsnull; +NS_IMPL_LOG(POP3LOGMODULE) static NS_DEFINE_CID(kPrefServiceCID, NS_PREF_CID); @@ -431,9 +436,6 @@ nsresult nsPop3Protocol::Initialize(nsIURI * aURL) return rv; } // if we got a url... - if (!POP3LOGMODULE) - POP3LOGMODULE = PR_NewLogModule("POP3"); - m_lineStreamBuffer = new nsMsgLineStreamBuffer(OUTPUT_BUFFER_SIZE, CRLF, PR_TRUE); if(!m_lineStreamBuffer) return NS_ERROR_OUT_OF_MEMORY; @@ -1836,13 +1838,13 @@ nsPop3Protocol::GetMsg() // We'll leave a debug message to warn people. #ifdef DEBUG - printf("Call to GetDiskSpaceAvailable FAILED! \n"); + PRINTF("Call to GetDiskSpaceAvailable FAILED! \n"); #endif } else { #ifdef DEBUG - printf("GetDiskSpaceAvailable returned: %d bytes\n", mailboxSpaceLeft); + PRINTF("GetDiskSpaceAvailable returned: %d bytes\n", mailboxSpaceLeft); #endif // Original comment from old implimentation follows... @@ -1865,7 +1867,7 @@ nsPop3Protocol::GetMsg() { // Not enough disk space! #ifdef DEBUG - printf("Not enough disk space! Raising error! \n"); + PRINTF("Not enough disk space! Raising error! \n"); #endif // Should raise an error at this point. // First, we need to delete our references to the two interfaces.. diff --git a/mozilla/mailnews/local/src/nsPop3Sink.cpp b/mozilla/mailnews/local/src/nsPop3Sink.cpp index 004bb0b1751..02d59740597 100644 --- a/mozilla/mailnews/local/src/nsPop3Sink.cpp +++ b/mozilla/mailnews/local/src/nsPop3Sink.cpp @@ -34,6 +34,11 @@ #include "nsLocalUtils.h" #include "nsMsgLocalFolderHdrs.h" #include "nsIMsgFolder.h" // TO include biffState enum. Change to bool later... +#include "nslog.h" + +NS_IMPL_LOG(nsPop3SinkLog) +#define PRINTF NS_LOG_PRINTF(nsPop3SinkLog) +#define FLUSH NS_LOG_FLUSH(nsPop3SinkLog) NS_IMPL_ISUPPORTS(nsPop3Sink, NS_GET_IID(nsIPop3Sink)); @@ -72,9 +77,9 @@ nsPop3Sink::SetUserAuthenticated(PRBool authed) { #ifdef DEBUG if (authed) - printf("User is authenticated. \n"); + PRINTF("User is authenticated. \n"); else - printf("User is NOT authenticated. \n"); + PRINTF("User is NOT authenticated. \n"); #endif m_authed = authed; return NS_OK; @@ -95,9 +100,9 @@ nsPop3Sink::SetSenderAuthedFlag(void* closure, PRBool authed) { #ifdef DEBUG if (authed) - printf("Sender is authenticated. \n"); + PRINTF("Sender is authenticated. \n"); else - printf("Sender is NOT authenticated. \n"); + PRINTF("Sender is NOT authenticated. \n"); #endif m_authed = authed; return NS_OK; @@ -183,7 +188,7 @@ nsPop3Sink::BeginMailDelivery(PRBool uidlDownload, PRBool* aBool) m_newMailParser->DisableFilters(); #ifdef DEBUG - printf("Begin mail message delivery.\n"); + PRINTF("Begin mail message delivery.\n"); #endif if (aBool) *aBool = PR_TRUE; @@ -208,7 +213,7 @@ nsPop3Sink::EndMailDelivery() } #ifdef DEBUG - printf("End mail message delivery.\n"); + PRINTF("End mail message delivery.\n"); #endif return NS_OK; } @@ -222,7 +227,7 @@ nsPop3Sink::AbortMailDelivery() m_outFileStream = 0; } #ifdef DEBUG - printf("Abort mail message delivery.\n"); + PRINTF("Abort mail message delivery.\n"); #endif return NS_OK; } @@ -234,9 +239,9 @@ nsPop3Sink::IncorporateBegin(const char* uidlString, void** closure) { #ifdef DEBUG - printf("Incorporate message begin:\n"); + PRINTF("Incorporate message begin:\n"); if (uidlString) - printf("uidl string: %s\n", uidlString); + PRINTF("uidl string: %s\n", uidlString); #endif if (closure) *closure = (void*) this; @@ -399,7 +404,7 @@ nsPop3Sink::IncorporateComplete(void* closure) // do not take out this printf as it is used by QA // as part of the smoketest process!. They depend on seeing // this string printed out to the screen. - printf("Incorporate message complete.\n"); + PRINTF("Incorporate message complete.\n"); return NS_OK; } @@ -409,7 +414,7 @@ nsPop3Sink::IncorporateAbort(void* closure, PRInt32 status) WriteLineToMailbox(MSG_LINEBREAK); #ifdef DEBUG - printf("Incorporate message abort.\n"); + PRINTF("Incorporate message abort.\n"); #endif return NS_OK; } @@ -418,7 +423,7 @@ nsresult nsPop3Sink::BiffGetNewMail() { #ifdef DEBUG - printf("Biff get new mail.\n"); + PRINTF("Biff get new mail.\n"); #endif return NS_OK; } @@ -427,7 +432,7 @@ nsresult nsPop3Sink::SetBiffStateAndUpdateFE(PRUint32 aBiffState, PRInt32 numNewMessages) { #ifdef DEBUG - printf("Set biff state: %d\n", aBiffState); + PRINTF("Set biff state: %d\n", aBiffState); #endif m_biffState = aBiffState; @@ -443,13 +448,13 @@ nsPop3Sink::SetBiffStateAndUpdateFE(PRUint32 aBiffState, PRInt32 numNewMessages) { case nsIMsgFolder::nsMsgBiffState_Unknown: default: - printf("Excuse me, Sir. I have no idea.\n"); + PRINTF("Excuse me, Sir. I have no idea.\n"); break; case nsIMsgFolder::nsMsgBiffState_NewMail: - printf("Y'all got mail!\n"); + PRINTF("Y'all got mail!\n"); break; case nsIMsgFolder::nsMsgBiffState_NoMail: - printf("You have no mail.\n"); + PRINTF("You have no mail.\n"); break; } return NS_OK; diff --git a/mozilla/mailnews/mime/cthandlers/vcard/nsVCard.cpp b/mozilla/mailnews/mime/cthandlers/vcard/nsVCard.cpp index f7b62801b76..0219d4e2de3 100644 --- a/mozilla/mailnews/mime/cthandlers/vcard/nsVCard.cpp +++ b/mozilla/mailnews/mime/cthandlers/vcard/nsVCard.cpp @@ -70,6 +70,11 @@ DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable. #include "nsVCardObj.h" #include "nsFileStream.h" #include "prprf.h" +#include "nslog.h" + +NS_IMPL_LOG(nsVCardLog) +#define PRINTF NS_LOG_PRINTF(nsVCardLog) +#define FLUSH NS_LOG_FLUSH(nsVCardLog) #ifndef lint char yysccsid[] = "@(#)yaccpar 1.4 (Berkeley) 02/25/90"; @@ -1301,8 +1306,8 @@ yyloop: yys = 0; if (yychar <= YYPR_MAXTOKEN) yys = yyname[yychar]; if (!yys) yys = "illegal-symbol"; - printf("yydebug: state %d, reading %d (%s)\n", yystate, - yychar, yys); + PRINTF("yydebug: state %d, reading %d (%s)\n", yystate, + yychar, yys); } #endif } @@ -1311,8 +1316,8 @@ yyloop: { #if YYDEBUG if (yydebug) - printf("yydebug: state %d, shifting to state %d\n", - yystate, yytable[yyn]); + PRINTF("yydebug: state %d, shifting to state %d\n", + yystate, yytable[yyn]); #endif if (yyssp >= yyss + yystacksize - 1) { @@ -1352,7 +1357,7 @@ yyinrecovery: { #if YYDEBUG if (yydebug) - printf("yydebug: state %d, error recovery shifting\ + PRINTF("yydebug: state %d, error recovery shifting\ to state %d\n", *yyssp, yytable[yyn]); #endif if (yyssp >= yyss + yystacksize - 1) @@ -1367,8 +1372,8 @@ yyinrecovery: { #if YYDEBUG if (yydebug) - printf("yydebug: error recovery discarding state %d\n", - *yyssp); + PRINTF("yydebug: error recovery discarding state %d\n", + *yyssp); #endif if (yyssp <= yyss) goto yyabort; --yyssp; @@ -1385,8 +1390,8 @@ yyinrecovery: yys = 0; if (yychar <= YYPR_MAXTOKEN) yys = yyname[yychar]; if (!yys) yys = "illegal-symbol"; - printf("yydebug: state %d, error recovery discards token %d (%s)\n", - yystate, yychar, yys); + PRINTF("yydebug: state %d, error recovery discards token %d (%s)\n", + yystate, yychar, yys); } #endif yychar = (-1); @@ -1395,8 +1400,8 @@ yyinrecovery: yyreduce: #if YYDEBUG if (yydebug) - printf("yydebug: state %d, reducing by rule %d (%s)\n", - yystate, yyn, yyrule[yyn]); + PRINTF("yydebug: state %d, reducing by rule %d (%s)\n", + yystate, yyn, yyrule[yyn]); #endif yym = yylen[yyn]; yyval = yyvsp[1-yym]; @@ -1571,7 +1576,7 @@ break; { #if YYDEBUG if (yydebug) - printf("yydebug: after reduction, shifting from state 0 to\ + PRINTF("yydebug: after reduction, shifting from state 0 to\ state %d\n", YYFINAL); #endif yystate = YYFINAL; @@ -1586,8 +1591,8 @@ break; yys = 0; if (yychar <= YYPR_MAXTOKEN) yys = yyname[yychar]; if (!yys) yys = "illegal-symbol"; - printf("yydebug: state %d, reading %d (%s)\n", - YYFINAL, yychar, yys); + PRINTF("yydebug: state %d, reading %d (%s)\n", + YYFINAL, yychar, yys); } #endif } @@ -1601,7 +1606,7 @@ break; yystate = yydgoto[yym]; #if YYDEBUG if (yydebug) - printf("yydebug: after reduction, shifting from state %d \ + PRINTF("yydebug: after reduction, shifting from state %d \ to state %d\n", *yyssp, yystate); #endif if (yyssp >= yyss + yystacksize - 1) diff --git a/mozilla/mailnews/mime/src/comi18n.cpp b/mozilla/mailnews/mime/src/comi18n.cpp index 65b6fe48899..3ed2bd733b4 100644 --- a/mozilla/mailnews/mime/src/comi18n.cpp +++ b/mozilla/mailnews/mime/src/comi18n.cpp @@ -45,6 +45,11 @@ #include "nsTextFormatter.h" #include "nsMsgI18N.h" #include "nsMimeTypes.h" +#include "nslog.h" + +NS_IMPL_LOG(comi18nLog) +#define PRINTF NS_LOG_PRINTF(comi18nLog) +#define FLUSH NS_LOG_FLUSH(comi18nLog) static NS_DEFINE_CID(kPrefCID, NS_PREF_CID); static NS_DEFINE_CID(kCharsetConverterManagerCID, NS_ICHARSETCONVERTERMANAGER_CID); @@ -1557,10 +1562,10 @@ void comi18n_destructor() main() { char *encoded, *decoded; - printf("mime\n"); + PRINTF("mime\n"); encoded = intl_EncodeMimePartIIStr("hello worldÉ", INTL_CsidToCharsetNamePt(0), PR_TRUE, kMIME_ENCODED_WORD_SIZE); - printf("%s\n", encoded); +PRINTF("%s\n", encoded); decoded = intl_DecodeMimePartIIStr((const char *) encoded, nsCRT::strlen(encoded), PR_TRUE); diff --git a/mozilla/mailnews/mime/src/mimecont.cpp b/mozilla/mailnews/mime/src/mimecont.cpp index 82168acd934..f29169387bd 100644 --- a/mozilla/mailnews/mime/src/mimecont.cpp +++ b/mozilla/mailnews/mime/src/mimecont.cpp @@ -26,6 +26,11 @@ #include "prio.h" #include "mimecont.h" #include "nsMimeStringResources.h" +#include "nslog.h" + +NS_IMPL_LOG(mimecontLog) +#define PRINTF NS_LOG_PRINTF(mimecontLog) +#define FLUSH NS_LOG_FLUSH(mimecontLog) #define MIME_SUPERCLASS mimeObjectClass MimeDefClass(MimeContainer, MimeContainerClass, @@ -216,7 +221,7 @@ MimeContainer_debug_print (MimeObject *obj, PRFileDesc *stream, PRInt32 depth) /* if (cont->nchildren > 0) - fprintf(stream, "\n"); + FPRINTF(stream, "\n"); */ for (i = 0; i < cont->nchildren; i++) @@ -228,7 +233,7 @@ MimeContainer_debug_print (MimeObject *obj, PRFileDesc *stream, PRInt32 depth) /* if (cont->nchildren > 0) - fprintf(stream, "\n"); + FPRINTF(stream, "\n"); */ return 0; diff --git a/mozilla/mailnews/mime/src/mimedrft.cpp b/mozilla/mailnews/mime/src/mimedrft.cpp index ad42112140c..6fea04fec6b 100644 --- a/mozilla/mailnews/mime/src/mimedrft.cpp +++ b/mozilla/mailnews/mime/src/mimedrft.cpp @@ -59,6 +59,11 @@ #include "nsCExternalHandlerService.h" #include "nsIMIMEService.h" #include "nsIMIMEInfo.h" +#include "nslog.h" + +NS_IMPL_LOG(mimedrftLog) +#define PRINTF NS_LOG_PRINTF(mimedrftLog) +#define FLUSH NS_LOG_FLUSH(mimedrftLog) // // Header strings... @@ -142,22 +147,22 @@ mime_dump_attachments ( nsMsgAttachmentData *attachData ) while ( (tmp) && (tmp->real_name) ) { - printf("Real Name : %s\n", tmp->real_name); + PRINTF("Real Name : %s\n", tmp->real_name); if ( tmp->url ) { char *spec = nsnull; tmp->url->GetSpec(&spec); - printf("URL : %s\n", spec); + PRINTF("URL : %s\n", spec); } - printf("Desired Type : %s\n", tmp->desired_type); - printf("Real Type : %s\n", tmp->real_type); - printf("Real Encoding : %s\n", tmp->real_encoding); - printf("Description : %s\n", tmp->description); - printf("Mac Type : %s\n", tmp->x_mac_type); - printf("Mac Creator : %s\n", tmp->x_mac_creator); + PRINTF("Desired Type : %s\n", tmp->desired_type); + PRINTF("Real Type : %s\n", tmp->real_type); + PRINTF("Real Encoding : %s\n", tmp->real_encoding); + PRINTF("Description : %s\n", tmp->description); + PRINTF("Mac Type : %s\n", tmp->x_mac_type); + PRINTF("Mac Creator : %s\n", tmp->x_mac_creator); i++; tmp++; } @@ -174,7 +179,7 @@ nsresult rv; MSG_ComposeFormat format = nsIMsgCompFormat::Default; #ifdef NS_DEBUG -printf("RICHIE: Need to do something with the attachment data!!!!\n"); + PRINTF("RICHIE: Need to do something with the attachment data!!!!\n"); mime_dump_attachments ( attachmentList ); #endif @@ -1362,14 +1367,14 @@ mime_parse_stream_complete (nsMIMESession *stream) if (mdd->format_out == nsMimeOutput::nsMimeMessageEditorTemplate) { #ifdef NS_DEBUG - printf("RICHIE: Time to create the EDITOR with this template - HAS a body!!!!\n"); + PRINTF("RICHIE: Time to create the EDITOR with this template - HAS a body!!!!\n"); #endif CreateTheComposeWindow(fields, newAttachData, nsIMsgCompType::Template, composeFormat, mdd->identity); } else { #ifdef NS_DEBUG - printf("Time to create the composition window WITH a body!!!!\n"); + PRINTF("Time to create the composition window WITH a body!!!!\n"); #endif if (mdd->forwardInline) CreateTheComposeWindow(fields, newAttachData, nsIMsgCompType::ForwardInline, composeFormat, mdd->identity); @@ -1393,14 +1398,14 @@ mime_parse_stream_complete (nsMIMESession *stream) if (mdd->format_out == nsMimeOutput::nsMimeMessageEditorTemplate) { #ifdef NS_DEBUG - printf("RICHIE: Time to create the EDITOR with this template - NO body!!!!\n"); + PRINTF("RICHIE: Time to create the EDITOR with this template - NO body!!!!\n"); #endif CreateTheComposeWindow(fields, newAttachData, nsIMsgCompType::Template, nsIMsgCompFormat::Default, mdd->identity); } else { #ifdef NS_DEBUG - printf("Time to create the composition window WITHOUT a body!!!!\n"); + PRINTF("Time to create the composition window WITHOUT a body!!!!\n"); #endif if (mdd->forwardInline) CreateTheComposeWindow(fields, newAttachData, nsIMsgCompType::ForwardInline, nsIMsgCompFormat::Default, mdd->identity); diff --git a/mozilla/mailnews/mime/src/mimeebod.cpp b/mozilla/mailnews/mime/src/mimeebod.cpp index e8fc1d16529..1fe036b0aeb 100644 --- a/mozilla/mailnews/mime/src/mimeebod.cpp +++ b/mozilla/mailnews/mime/src/mimeebod.cpp @@ -33,6 +33,11 @@ #include "nsMimeTransition.h" #include "nsMimeStringResources.h" #include "mimemoz2.h" +#include "nslog.h" + +NS_IMPL_LOG(mimeebodLog) +#define PRINTF NS_LOG_PRINTF(mimeebodLog) +#define FLUSH NS_LOG_FLUSH(mimeebodLog) #define MIME_SUPERCLASS mimeObjectClass MimeDefClass(MimeExternalBody, MimeExternalBodyClass, @@ -483,7 +488,7 @@ MimeExternalBody_debug_print (MimeObject *obj, PRFileDesc *stream, PRInt32 depth for (i=0; i < depth; i++) PR_Write(stream, " ", 2); /*** - fprintf(stream, + FPRINTF(stream, "<%s %s\n" "\tcontent-type: %s\n" "\tcontent-type: %s\n" diff --git a/mozilla/mailnews/mime/src/mimefilt.cpp b/mozilla/mailnews/mime/src/mimefilt.cpp index 4befb212256..2375fd51f14 100644 --- a/mozilla/mailnews/mime/src/mimefilt.cpp +++ b/mozilla/mailnews/mime/src/mimefilt.cpp @@ -61,6 +61,11 @@ #include "secmod.h" #include "pk11func.h" #include "nsMimeStringResources.h" +#include "nslog.h" + +NS_IMPL_LOG(mimefiltLog, 0) +#define PRINTF NS_LOG_PRINTF(mimefiltLog) +#define FLUSH NS_LOG_FLUSH(mimefiltLog) #ifndef XP_UNIX ERROR! This is a unix-only file for the "mimefilt" standalone program. @@ -146,16 +151,16 @@ test_output_init_fn (const char *type, void *stream_closure) { FILE *out = (FILE *) stream_closure; - fprintf(out, "CONTENT-TYPE: %s", type); + FPRINTF(out, "CONTENT-TYPE: %s", type); if (charset) - fprintf(out, "; charset=\"%s\"", charset); + FPRINTF(out, "; charset=\"%s\"", charset); if (name) - fprintf(out, "; name=\"%s\"", name); + FPRINTF(out, "; name=\"%s\"", name); if (x_mac_type || x_mac_creator) - fprintf(out, "; x-mac-type=\"%s\"; x-mac-creator=\"%s\"", + FPRINTF(out, "; x-mac-type=\"%s\"; x-mac-creator=\"%s\"", x_mac_type ? x_mac_type : "", - x_mac_creator ? x_mac_type : ""); - fprintf(out, CRLF CRLF); + x_mac_creator ? x_mac_type : ""); + FPRINTF(out, CRLF CRLF); return 0; } @@ -225,7 +230,7 @@ static char * test_passwd_prompt (PK11SlotInfo *slot, void *wincx) { char buf[2048], *s; - fprintf(stdout, "#### Password required: "); + FPRINTF(stdout, "#### Password required: "); s = fgets(buf, sizeof(buf)-1, stdin); if (!s) return s; if (s[nsCRT::strlen(s)-1] == '\r' || @@ -327,11 +332,11 @@ test(FILE *in, FILE *out, if (outline_p) { - fprintf(out, "\n\n" - "###############################################################\n"); + FPRINTF(out, "\n\n" + "###############################################################\n"); obj->class->debug_print(obj, stderr, 0); - fprintf(out, - "###############################################################\n"); + FPRINTF(out, + "###############################################################\n"); } mime_free (obj); @@ -428,7 +433,7 @@ main (int argc, char **argv) dexlate_p = PR_TRUE; else { - fprintf(stderr, + FPRINTF(stderr, "usage: %s [ URL [ -fancy | -no-fancy | -html | -raw | -outline | -dexlate ]]\n" " < message/rfc822 > output\n", (PL_strrchr(argv[0], '/') ? @@ -441,7 +446,7 @@ main (int argc, char **argv) } i = test(stdin, stdout, url, fancy_p, html_p, outline_p, dexlate_p, PR_TRUE); - fprintf(stdout, "\n"); + FPRINTF(stdout, "\n"); fflush(stdout); FAIL: diff --git a/mozilla/mailnews/mime/src/mimemoz2.cpp b/mozilla/mailnews/mime/src/mimemoz2.cpp index 261e120027f..54041d34a5e 100644 --- a/mozilla/mailnews/mime/src/mimemoz2.cpp +++ b/mozilla/mailnews/mime/src/mimemoz2.cpp @@ -70,8 +70,12 @@ #include "nsIIOService.h" #include "nsIURI.h" #include "nsIMsgWindow.h" - #include "mimeebod.h" +#include "nslog.h" + +NS_IMPL_LOG(mimemoz2Log) +#define PRINTF NS_LOG_PRINTF(mimemoz2Log) +#define FLUSH NS_LOG_FLUSH(mimemoz2Log) static NS_DEFINE_IID(kIPrefIID, NS_IPREF_IID); static NS_DEFINE_CID(kPrefCID, NS_PREF_CID); @@ -513,14 +517,14 @@ NotifyEmittersOfAttachmentList(MimeDisplayOptions *opt, /* rhp - for now, just leave these here, but they are really not necessary - printf("URL for Part : %s\n", spec); - printf("Real Name : %s\n", tmp->real_name); - printf("Desired Type : %s\n", tmp->desired_type); - printf("Real Type : %s\n", tmp->real_type); - printf("Real Encoding : %s\n", tmp->real_encoding); - printf("Description : %s\n", tmp->description); - printf("Mac Type : %s\n", tmp->x_mac_type); - printf("Mac Creator : %s\n", tmp->x_mac_creator); + PRINTF("URL for Part : %s\n", spec); + PRINTF("Real Name : %s\n", tmp->real_name); + PRINTF("Desired Type : %s\n", tmp->desired_type); + PRINTF("Real Type : %s\n", tmp->real_type); + PRINTF("Real Encoding : %s\n", tmp->real_encoding); + PRINTF("Description : %s\n", tmp->description); + PRINTF("Mac Type : %s\n", tmp->x_mac_type); + PRINTF("Mac Creator : %s\n", tmp->x_mac_creator); */ } diff --git a/mozilla/mailnews/mime/src/mimemsg.cpp b/mozilla/mailnews/mime/src/mimemsg.cpp index 9064dd63abe..8f9409c0545 100644 --- a/mozilla/mailnews/mime/src/mimemsg.cpp +++ b/mozilla/mailnews/mime/src/mimemsg.cpp @@ -36,6 +36,11 @@ #include "nsEscape.h" #include "nsString.h" #include "mimetext.h" +#include "nslog.h" + +NS_IMPL_LOG(mimemsgLog) +#define PRINTF NS_LOG_PRINTF(mimemsgLog) +#define FLUSH NS_LOG_FLUSH(mimemsgLog) #define MIME_SUPERCLASS mimeContainerClass MimeDefClass(MimeMessage, MimeMessageClass, mimeMessageClass, @@ -827,7 +832,7 @@ MimeMessage_debug_print (MimeObject *obj, PRFileDesc *stream, PRInt32 depth) for (i=0; i < depth; i++) PR_Write(stream, " ", 2); /* - fprintf(stream, "<%s %s%s 0x%08X>\n", + FPRINTF(stream, "<%s %s%s 0x%08X>\n", obj->clazz->class_name, addr ? addr : "???", (msg->container.nchildren == 0 ? " (no body)" : ""), diff --git a/mozilla/mailnews/mime/src/mimemult.cpp b/mozilla/mailnews/mime/src/mimemult.cpp index 580222ea584..456ebe84c8d 100644 --- a/mozilla/mailnews/mime/src/mimemult.cpp +++ b/mozilla/mailnews/mime/src/mimemult.cpp @@ -30,6 +30,11 @@ #include "prio.h" #include "nsMimeStringResources.h" #include "nsMimeTypes.h" +#include "nslog.h" + +NS_IMPL_LOG(mimemultLog) +#define PRINTF NS_LOG_PRINTF(mimemultLog) +#define FLUSH NS_LOG_FLUSH(mimemultLog) #define MIME_SUPERCLASS mimeContainerClass MimeDefClass(MimeMultipart, MimeMultipartClass, @@ -587,7 +592,7 @@ MimeMultipart_debug_print (MimeObject *obj, PRFileDesc *stream, PRInt32 depth) for (i=0; i < depth; i++) PR_Write(stream, " ", 2); /** - fprintf(stream, "<%s %s (%d kid%s) boundary=%s 0x%08X>\n", + FPRINTF(stream, "<%s %s (%d kid%s) boundary=%s 0x%08X>\n", obj->clazz->class_name, addr ? addr : "???", cont->nchildren, (cont->nchildren == 1 ? "" : "s"), @@ -598,7 +603,7 @@ MimeMultipart_debug_print (MimeObject *obj, PRFileDesc *stream, PRInt32 depth) /* if (cont->nchildren > 0) - fprintf(stream, "\n"); + FPRINTF(stream, "\n"); */ for (i = 0; i < cont->nchildren; i++) @@ -610,7 +615,7 @@ MimeMultipart_debug_print (MimeObject *obj, PRFileDesc *stream, PRInt32 depth) /* if (cont->nchildren > 0) - fprintf(stream, "\n"); + FPRINTF(stream, "\n"); */ return 0; diff --git a/mozilla/mailnews/mime/src/mimeobj.cpp b/mozilla/mailnews/mime/src/mimeobj.cpp index 03d078a397a..3cab4336f1e 100644 --- a/mozilla/mailnews/mime/src/mimeobj.cpp +++ b/mozilla/mailnews/mime/src/mimeobj.cpp @@ -41,6 +41,11 @@ # include "mimetpla.h" # include "mimethtm.h" # include "mimecont.h" +#include "nslog.h" + +NS_IMPL_LOG(mimeobjLog) +#define PRINTF NS_LOG_PRINTF(mimeobjLog) +#define FLUSH NS_LOG_FLUSH(mimeobjLog) MimeDefClass (MimeObject, MimeObjectClass, mimeObjectClass, NULL); @@ -330,7 +335,7 @@ MimeObject_debug_print (MimeObject *obj, PRFileDesc *stream, PRInt32 depth) for (i=0; i < depth; i++) PR_Write(stream, " ", 2); /* - fprintf(stream, "<%s %s 0x%08X>\n", obj->clazz->class_name, + FPRINTF(stream, "<%s %s 0x%08X>\n", obj->clazz->class_name, addr ? addr : "???", (PRUint32) obj); */ diff --git a/mozilla/mailnews/mime/src/nsStreamConverter.cpp b/mozilla/mailnews/mime/src/nsStreamConverter.cpp index e7c1ad647ac..3d37a7a6610 100644 --- a/mozilla/mailnews/mime/src/nsStreamConverter.cpp +++ b/mozilla/mailnews/mime/src/nsStreamConverter.cpp @@ -48,6 +48,11 @@ #include "nsNetUtil.h" #include "mozITXTToHTMLConv.h" #include "nsIMsgMailNewsUrl.h" +#include "nslog.h" + +NS_IMPL_LOG(nsStreamConverterLog) +#define PRINTF NS_LOG_PRINTF(nsStreamConverterLog) +#define FLUSH NS_LOG_FLUSH(nsStreamConverterLog) #define PREF_MAIL_DISPLAY_GLYPH "mail.display_glyph" #define PREF_MAIL_DISPLAY_STRUCT "mail.display_struct" @@ -614,7 +619,7 @@ NS_IMETHODIMP nsStreamConverter::Init(nsIURI *aURI, nsIStreamListener * aOutList if ((NS_FAILED(rv)) || (!mEmitter)) { #ifdef DEBUG_rhp - printf("Unable to create the correct converter!\n"); + PRINTF("Unable to create the correct converter!\n"); #endif return NS_ERROR_OUT_OF_MEMORY; } @@ -865,7 +870,7 @@ nsresult nsStreamConverter::OnStartRequest(nsIChannel * aChannel, nsISupports *ctxt) { #ifdef DEBUG_rhp - printf("nsStreamConverter::OnStartRequest()\n"); + PRINTF("nsStreamConverter::OnStartRequest()\n"); #endif #ifdef DEBUG_mscott @@ -897,7 +902,7 @@ nsresult nsStreamConverter::OnStopRequest(nsIChannel * aChannel, nsISupports *ctxt, nsresult status, const PRUnichar *errorMsg) { #ifdef DEBUG_rhp - printf("nsStreamConverter::OnStopRequest()\n"); + PRINTF("nsStreamConverter::OnStopRequest()\n"); #endif // @@ -968,7 +973,7 @@ nsStreamConverter::OnStopRequest(nsIChannel * aChannel, nsISupports *ctxt, nsres #ifdef DEBUG_mscott // print out the mime timing information BEFORE we flush to layout // otherwise we'll be including layout information. - printf("Time Spent in mime: %d ms\n", PR_IntervalToMilliseconds(PR_IntervalNow() - mConvertContentTime)); + PRINTF("Time Spent in mime: %d ms\n", PR_IntervalToMilliseconds(PR_IntervalNow() - mConvertContentTime)); #endif // forward on top request to any listeners diff --git a/mozilla/mailnews/news/src/nsNNTPArticleList.cpp b/mozilla/mailnews/news/src/nsNNTPArticleList.cpp index 1bd2ff47ca0..4c390af967c 100644 --- a/mozilla/mailnews/news/src/nsNNTPArticleList.cpp +++ b/mozilla/mailnews/news/src/nsNNTPArticleList.cpp @@ -27,6 +27,11 @@ #include "nsINNTPArticleList.h" #include "nsMsgKeySet.h" #include "nsNNTPArticleList.h" +#include "nslog.h" + +NS_IMPL_LOG(nsNNTPArticleListLog) +#define PRINTF NS_LOG_PRINTF(nsNNTPArticleListLog) +#define FLUSH NS_LOG_FLUSH(nsNNTPArticleListLog) NS_IMPL_ISUPPORTS(nsNNTPArticleList, GetIID()) @@ -82,7 +87,7 @@ nsNNTPArticleList::AddArticleKey(PRInt32 key) char * groupname = nsnull; if (m_newsgroup) m_newsgroup->GetName(&groupname); - printf("Adding article key %d for group %s.\n", key, groupname ? groupname : "unspecified"); + PRINTF("Adding article key %d for group %s.\n", key, groupname ? groupname : "unspecified"); PR_FREEIF(groupname); #endif m_idsOnServer.set->Add(key); diff --git a/mozilla/mailnews/news/src/nsNNTPCategoryContainer.cpp b/mozilla/mailnews/news/src/nsNNTPCategoryContainer.cpp index 3479a6f89dd..4d58009c6c6 100644 --- a/mozilla/mailnews/news/src/nsNNTPCategoryContainer.cpp +++ b/mozilla/mailnews/news/src/nsNNTPCategoryContainer.cpp @@ -25,6 +25,11 @@ the NNTP protocol */ #include "nsNNTPCategoryContainer.h" +#include "nslog.h" + +NS_IMPL_LOG(nsNNTPCategoryContainerLog) +#define PRINTF NS_LOG_PRINTF(nsNNTPCategoryContainerLog) +#define FLUSH NS_LOG_FLUSH(nsNNTPCategoryContainerLog) NS_IMPL_ISUPPORTS(nsNNTPCategoryContainer, NS_GET_IID(nsINNTPCategoryContainer)); @@ -36,7 +41,7 @@ nsNNTPCategoryContainer::nsNNTPCategoryContainer() nsNNTPCategoryContainer::~nsNNTPCategoryContainer() { - printf("Destroying category container. \n"); + PRINTF("Destroying category container. \n"); NS_IF_RELEASE(m_newsgroup); } @@ -65,7 +70,7 @@ nsresult nsNNTPCategoryContainer::SetRootCategory(nsINNTPNewsgroup * aRootCatego char * name = nsnull; aRootCategory->GetName(&name); #ifdef DEBUG_NEWS - printf("Setting root category for container to %s", name ? name : "unspecified"); + PRINTF("Setting root category for container to %s", name ? name : "unspecified"); #endif m_newsgroup = aRootCategory; NS_IF_ADDREF(m_newsgroup); diff --git a/mozilla/mailnews/news/src/nsNNTPHost.cpp b/mozilla/mailnews/news/src/nsNNTPHost.cpp index 6955e97af17..523a88c9f1a 100644 --- a/mozilla/mailnews/news/src/nsNNTPHost.cpp +++ b/mozilla/mailnews/news/src/nsNNTPHost.cpp @@ -26,6 +26,11 @@ #include "prlog.h" #include "nsMsgNewsCID.h" +#include "nslog.h" + +NS_IMPL_LOG(nsNNTPHostLog) +#define PRINTF NS_LOG_PRINTF(nsNNTPHostLog) +#define FLUSH NS_LOG_FLUSH(nsNNTPHostLog) static NS_DEFINE_CID(kNNTPNewsgroupCID, NS_NNTPNEWSGROUP_CID); static NS_DEFINE_CID(kNNTPNewsgroupListCID, NS_NNTPNEWSGROUPLIST_CID); @@ -933,7 +938,7 @@ nsNNTPHost::FindGroup(const char* name, nsINNTPNewsgroup* *_retval) return NS_ERROR_NULL_POINTER; } #ifdef DEBUG_NEWS - printf("FindGroup(%s)\n",name); + PRINTF("FindGroup(%s)\n",name); #endif if (!m_groups) return result; @@ -949,7 +954,7 @@ nsNNTPHost::FindGroup(const char* name, nsINNTPNewsgroup* *_retval) rv = info->GetName(&groupname); #ifdef DEBUG_NEWS - printf("%d = %s\n",i,groupname?groupname:"null"); + PRINTF("%d = %s\n",i,groupname?groupname:"null"); #endif if (NS_SUCCEEDED(rv) && (name != nsnull) && PL_strcmp(name, groupname) == 0) { @@ -975,7 +980,7 @@ nsNNTPHost::AddGroup(const char *name, nsINNTPNewsgroup **_retval) { #ifdef DEBUG_NEWS - printf("nsNNTPHost::AddGroup(%s)\n",name); + PRINTF("nsNNTPHost::AddGroup(%s)\n",name); #endif nsINNTPNewsgroup *newsInfo = nsnull; nsCOMPtr categoryContainer; @@ -2424,7 +2429,7 @@ nsNNTPHost::GetNewsgroupList(const char* name, nsINNTPNewsgroupList **_retval) return NS_ERROR_NULL_POINTER; } #ifdef DEBUG_NEWS - printf("GetNewsgroupList(%s)\n",name); + PRINTF("GetNewsgroupList(%s)\n",name); #endif if (!m_newsgrouplists) return result; @@ -2438,7 +2443,7 @@ nsNNTPHost::GetNewsgroupList(const char* name, nsINNTPNewsgroupList **_retval) rv = list->GetGroupName(&newsgroupname); #ifdef DEBUG_NEWS - printf("%d = %s\n",i,newsgroupname?newsgroupname:"null"); + PRINTF("%d = %s\n",i,newsgroupname?newsgroupname:"null"); #endif if (NS_SUCCEEDED(rv) && newsgroupname && PL_strcmp(name,newsgroupname) == 0) { @@ -2491,7 +2496,7 @@ nsNNTPHost::AddNewNewsgroup(const char *name, nsMsgGroupRecord *groupRecord = nsnull; #ifdef DEBUG_NEWS - printf("nsNNTPHost::AddNewNewsgroup(%s,...)\n",name); + PRINTF("nsNNTPHost::AddNewNewsgroup(%s,...)\n",name); #endif PRInt32 status = NoticeNewGroup(name, &groupRecord); diff --git a/mozilla/mailnews/news/src/nsNNTPNewsgroup.cpp b/mozilla/mailnews/news/src/nsNNTPNewsgroup.cpp index 43f8193c4cc..7a5b33c37e4 100644 --- a/mozilla/mailnews/news/src/nsNNTPNewsgroup.cpp +++ b/mozilla/mailnews/news/src/nsNNTPNewsgroup.cpp @@ -32,6 +32,11 @@ #include "nsNNTPNewsgroup.h" #include "nsCOMPtr.h" +#include "nslog.h" + +NS_IMPL_LOG(nsNNTPNewsgroupLog) +#define PRINTF NS_LOG_PRINTF(nsNNTPNewsgroupLog) +#define FLUSH NS_LOG_FLUSH(nsNNTPNewsgroupLog) nsNNTPNewsgroup::nsNNTPNewsgroup() { @@ -45,7 +50,7 @@ nsNNTPNewsgroup::nsNNTPNewsgroup() nsNNTPNewsgroup::~nsNNTPNewsgroup() { #ifdef DEBUG_NEWS - printf("destroying newsgroup: %s", m_groupName ? m_groupName : ""); + PRINTF("destroying newsgroup: %s", m_groupName ? m_groupName : ""); #endif PR_FREEIF(m_groupName); PR_FREEIF(m_prettyName); @@ -68,7 +73,7 @@ nsresult nsNNTPNewsgroup::SetName(const char *aName) if (aName) { #ifdef DEBUG_NEWS - printf("Setting newsgroup name to %s. \n", aName); + PRINTF("Setting newsgroup name to %s. \n", aName); #endif m_groupName = PL_strdup(aName); } @@ -91,7 +96,7 @@ nsresult nsNNTPNewsgroup::SetPrettyName(const char *aName) if (aName) { #ifdef DEBUG_NEWS - printf("Setting pretty newsgroup name to %s. \n", aName); + PRINTF("Setting pretty newsgroup name to %s. \n", aName); #endif m_prettyName = PL_strdup(aName); } @@ -114,7 +119,7 @@ nsresult nsNNTPNewsgroup::SetNeedsExtraInfo(PRBool aNeedsExtraInfo) if (aNeedsExtraInfo) { #ifdef DEBUG_NEWS - printf("Setting needs extra info for newsgroup %s to %s. \n", m_groupName, aNeedsExtraInfo ? "TRUE" : "FALSE" ); + PRINTF("Setting needs extra info for newsgroup %s to %s. \n", m_groupName, aNeedsExtraInfo ? "TRUE" : "FALSE" ); #endif m_needsExtraInfo = aNeedsExtraInfo; } @@ -125,7 +130,7 @@ nsresult nsNNTPNewsgroup::SetNeedsExtraInfo(PRBool aNeedsExtraInfo) nsresult nsNNTPNewsgroup::IsOfflineArticle(PRInt32 num, PRBool *_retval) { #ifdef DEBUG_NEWS - printf("Testing for offline article %d in %s. \n", num, m_groupName); + PRINTF("Testing for offline article %d in %s. \n", num, m_groupName); #endif if (_retval) *_retval = PR_FALSE; @@ -148,7 +153,7 @@ nsresult nsNNTPNewsgroup::SetCategory(PRBool aCategory) if (aCategory) { #ifdef DEBUG_NEWS - printf("Setting is category for newsgroup %s to %s. \n", m_groupName, aCategory ? "TRUE" : "FALSE" ); + PRINTF("Setting is category for newsgroup %s to %s. \n", m_groupName, aCategory ? "TRUE" : "FALSE" ); #endif m_category = aCategory; } @@ -188,7 +193,7 @@ nsresult nsNNTPNewsgroup::SetWantNewTotals(PRBool aWantNewTotals) if (aWantNewTotals) { #ifdef DEBUG_NEWS - printf("Setting wants new totals for newsgroup %s to %s. \n", m_groupName, aWantNewTotals ? "TRUE" : "FALSE" ); + PRINTF("Setting wants new totals for newsgroup %s to %s. \n", m_groupName, aWantNewTotals ? "TRUE" : "FALSE" ); #endif m_wantsNewTotals = aWantNewTotals; } @@ -212,7 +217,7 @@ nsresult nsNNTPNewsgroup::SetNewsgroupList(nsINNTPNewsgroupList * aNewsgroupList if (aNewsgroupList) { #ifdef DEBUG_NEWS - printf("Setting newsgroup list for newsgroup %s. \n", m_groupName); + PRINTF("Setting newsgroup list for newsgroup %s. \n", m_groupName); #endif m_newsgroupList = aNewsgroupList; NS_IF_ADDREF(aNewsgroupList); @@ -224,7 +229,7 @@ nsresult nsNNTPNewsgroup::SetNewsgroupList(nsINNTPNewsgroupList * aNewsgroupList nsresult nsNNTPNewsgroup::UpdateSummaryFromNNTPInfo(PRInt32 oldest, PRInt32 youngest, PRInt32 total_messages) { #ifdef DEBUG_NEWS - printf("Updating summary with oldest= %d, youngest= %d, and total messages = %d. \n", oldest, youngest, total_messages); + PRINTF("Updating summary with oldest= %d, youngest= %d, and total messages = %d. \n", oldest, youngest, total_messages); #endif return NS_OK; } @@ -234,7 +239,7 @@ nsresult nsNNTPNewsgroup::Initialize(const char *name, PRBool subscribed) { #ifdef DEBUG_NEWS - printf("nsNNTPNewsgroup::Intialize(name = %s, subscribed = %s)\n",name?name:"(null)", subscribed?"TRUE":"FALSE"); + PRINTF("nsNNTPNewsgroup::Intialize(name = %s, subscribed = %s)\n",name?name:"(null)", subscribed?"TRUE":"FALSE"); #endif nsresult rv = NS_OK; diff --git a/mozilla/mailnews/news/src/nsNNTPNewsgroupList.cpp b/mozilla/mailnews/news/src/nsNNTPNewsgroupList.cpp index 06ce2d08b2b..4718f904e58 100644 --- a/mozilla/mailnews/news/src/nsNNTPNewsgroupList.cpp +++ b/mozilla/mailnews/news/src/nsNNTPNewsgroupList.cpp @@ -82,6 +82,11 @@ #include "nsIScriptGlobalObject.h" #include "nsIDocShell.h" #include "nsIScriptContext.h" +#include "nslog.h" + +NS_IMPL_LOG(nsNNTPNewsgroupListLog) +#define PRINTF NS_LOG_PRINTF(nsNNTPNewsgroupListLog) +#define FLUSH NS_LOG_FLUSH(nsNNTPNewsgroupListLog) static NS_DEFINE_CID(kCNewsDB, NS_NEWSDB_CID); static NS_DEFINE_CID(kCPrefServiceCID, NS_PREF_CID); @@ -205,17 +210,17 @@ nsNNTPNewsgroupList::GetDatabase(const char *uri, nsIMsgDatabase **db) newsDBOpen = newsDBFactory->Open(dbFileSpec, PR_TRUE, PR_FALSE, (nsIMsgDatabase **) db); #ifdef DEBUG_NEWS if (NS_SUCCEEDED(newsDBOpen)) { - printf ("newsDBFactory->Open() succeeded\n"); + PRINTF ("newsDBFactory->Open() succeeded\n"); } else { - printf ("newsDBFactory->Open() failed\n"); + PRINTF ("newsDBFactory->Open() failed\n"); } #endif /* DEBUG_NEWS */ return rv; } #ifdef DEBUG_NEWS else { - printf("nsComponentManager::CreateInstance(kCNewsDB,...) failed\n"); + PRINTF("nsComponentManager::CreateInstance(kCNewsDB,...) failed\n"); } #endif } @@ -464,9 +469,9 @@ nsNNTPNewsgroupList::GetRangeOfArtsToDownload(nsIMsgWindow * aMsgWindow, // don't use prefs for dialog values, use the arg block // m_promptedAlready may not be saved #ifdef DEBUG_NEWS - printf("Download Header Dialog: %d\n",*last - *first + 1); - printf("download = %d\n", download); - printf("download all = %d\n", m_downloadAll); + PRINTF("Download Header Dialog: %d\n",*last - *first + 1); + PRINTF("download = %d\n", download); + PRINTF("download all = %d\n", m_downloadAll); #endif /* DEBUG_NEWS */ nsCOMPtr ioParamBlock = do_CreateInstance(kDialogParamBlockCID, &rv); @@ -541,7 +546,7 @@ nsNNTPNewsgroupList::GetRangeOfArtsToDownload(nsIMsgWindow * aMsgWindow, } } #ifdef DEBUG_NEWS - printf("GetRangeOfArtsToDownload(first possible = %d, last possible = %d, first = %d, last = %d maxextra = %d\n",first_possible, last_possible, *first, *last, maxextra); + PRINTF("GetRangeOfArtsToDownload(first possible = %d, last possible = %d, first = %d, last = %d maxextra = %d\n",first_possible, last_possible, *first, *last, maxextra); #endif /* DEBUG_NEWS */ m_firstMsgToDownload = *first; m_lastMsgToDownload = *last; @@ -714,7 +719,7 @@ nsNNTPNewsgroupList::ParseLine(char *line, PRUint32 * message_number) GET_TOKEN (); #ifdef DEBUG_NEWS /* message number */ - printf("message number = %ld\n", atol(line)); + PRINTF("message number = %ld\n", atol(line)); #endif *message_number = atol(line); @@ -750,7 +755,7 @@ nsNNTPNewsgroupList::ParseLine(char *line, PRUint32 * message_number) if (! (flags & MSG_FLAG_READ)) rv = newMsgHdr->OrFlags(MSG_FLAG_NEW, &flags); #ifdef DEBUG_NEWS - printf("subject = %s\n",subject); + PRINTF("subject = %s\n",subject); #endif rv = newMsgHdr->SetSubject(subject); if (NS_FAILED(rv)) return rv; @@ -760,7 +765,7 @@ nsNNTPNewsgroupList::ParseLine(char *line, PRUint32 * message_number) GET_TOKEN (); /* author */ if (line) { #ifdef DEBUG_spitzer - printf("author = %s\n", line); + PRINTF("author = %s\n", line); #endif rv = newMsgHdr->SetAuthor(line); if (NS_FAILED(rv)) return rv; @@ -773,7 +778,7 @@ nsNNTPNewsgroupList::ParseLine(char *line, PRUint32 * message_number) if (PR_SUCCESS == status) { #ifdef DEBUG_NEWS - printf("date = %s\n", line); + PRINTF("date = %s\n", line); #endif rv = newMsgHdr->SetDate(date); /* date */ if (NS_FAILED(rv)) return rv; @@ -783,7 +788,7 @@ nsNNTPNewsgroupList::ParseLine(char *line, PRUint32 * message_number) GET_TOKEN (); /* message id */ if (line) { #ifdef DEBUG_NEWS - printf("message id = %s\n", line); + PRINTF("message id = %s\n", line); #endif char *strippedId = line; @@ -802,7 +807,7 @@ nsNNTPNewsgroupList::ParseLine(char *line, PRUint32 * message_number) GET_TOKEN (); /* references */ if (line) { #ifdef DEBUG_NEWS - printf("references = %s\n",line); + PRINTF("references = %s\n",line); #endif rv = newMsgHdr->SetReferences(line); if (NS_FAILED(rv)) return rv; @@ -814,7 +819,7 @@ nsNNTPNewsgroupList::ParseLine(char *line, PRUint32 * message_number) msgSize = (line) ? atol (line) : 0; #ifdef DEBUG_NEWS - printf("bytes = %d\n", msgSize); + PRINTF("bytes = %d\n", msgSize); #endif rv = newMsgHdr->SetMessageSize(msgSize); if (NS_FAILED(rv)) return rv; @@ -825,7 +830,7 @@ nsNNTPNewsgroupList::ParseLine(char *line, PRUint32 * message_number) PRUint32 numLines = 0; numLines = line ? atol (line) : 0; #ifdef DEBUG_NEWS - printf("lines = %d\n", numLines); + PRINTF("lines = %d\n", numLines); #endif rv = newMsgHdr->SetLineCount(numLines); if (NS_FAILED(rv)) return rv; @@ -970,7 +975,7 @@ nsNNTPNewsgroupList::FinishXOVERLINE(int status, int *newstatus) if (m_newsDB) { #ifdef DEBUG_NEWS - printf("committing summary file changes\n"); + PRINTF("committing summary file changes\n"); #endif m_newsDB->Commit(nsMsgDBCommitType::kSessionCommit); m_newsDB->Close(PR_TRUE); @@ -1085,7 +1090,7 @@ void nsNNTPNewsgroupList::SetProgressBarPercent(int percent) { #ifdef DEBUG_NEWS - printf("nsNNTPNewsgroupList::SetProgressBarPercent(%d)\n",percent); + PRINTF("nsNNTPNewsgroupList::SetProgressBarPercent(%d)\n",percent); #endif if (!m_runningURL) return; @@ -1104,7 +1109,7 @@ void nsNNTPNewsgroupList::SetProgressStatus(char *message) { #ifdef DEBUG_NEWS - printf("nsNNTPNewsgroupList::SetProgressStatus(%s)\n",message); + PRINTF("nsNNTPNewsgroupList::SetProgressStatus(%s)\n",message); #endif PRUnichar *progressMsg = nsnull; // PRUnichar *progressMsg = NNTPGetStringByID(aMsgId); diff --git a/mozilla/mailnews/news/src/nsNNTPNewsgroupPost.cpp b/mozilla/mailnews/news/src/nsNNTPNewsgroupPost.cpp index 2e3327ef891..734272a14de 100644 --- a/mozilla/mailnews/news/src/nsNNTPNewsgroupPost.cpp +++ b/mozilla/mailnews/news/src/nsNNTPNewsgroupPost.cpp @@ -28,6 +28,11 @@ #include "plstr.h" #include "prmem.h" +#include "nslog.h" + +NS_IMPL_LOG(nsNNTPNewsgroupPostLog) +#define PRINTF NS_LOG_PRINTF(nsNNTPNewsgroupPostLog) +#define FLUSH NS_LOG_FLUSH(nsNNTPNewsgroupPostLog) // for CRLF //#include "fe_proto.h" @@ -103,7 +108,7 @@ nsNNTPNewsgroupPost::IsValid(PRBool *_retval) } *_retval=valid; - printf("nsNNTPNewsgroupPost::IsValid() -> %s (%d is first invalid)\n", + PRINTF("nsNNTPNewsgroupPost::IsValid() -> %s (%d is first invalid)\n", *_retval ? "TRUE": "FALSE", i); return NS_OK; } @@ -163,7 +168,7 @@ nsNNTPNewsgroupPost::GetFullMessage(char **message) *message=m_messageBuffer; - printf("Assembled message:\n%s\n",m_messageBuffer); + PRINTF("Assembled message:\n%s\n",m_messageBuffer); return NS_OK; } diff --git a/mozilla/mailnews/news/src/nsNNTPProtocol.cpp b/mozilla/mailnews/news/src/nsNNTPProtocol.cpp index 3ca1717620a..df145aec7f3 100644 --- a/mozilla/mailnews/news/src/nsNNTPProtocol.cpp +++ b/mozilla/mailnews/news/src/nsNNTPProtocol.cpp @@ -163,24 +163,20 @@ typedef struct _cancelInfoEntry { char *MSG_UnEscapeSearchUrl (const char *commandSpecificData); /* Logging stuff */ +#include "nslog.h" -PRLogModuleInfo* NNTP = NULL; -#define out PR_LOG_ALWAYS +NS_IMPL_LOG(NNTPLog) +#define PRINTF NS_LOG_PRINTF(NNTPLog) +#define FLUSH NS_LOG_FLUSH(NNTPLog) #define NNTP_LOG_READ(buf) \ -if (NNTP==NULL) \ - NNTP = PR_NewLogModule("NNTP"); \ -PR_LOG(NNTP, out, ("Receiving: %s", buf)) ; + PRINTF("Receiving: %s", buf) #define NNTP_LOG_WRITE(buf) \ -if (NNTP==NULL) \ - NNTP = PR_NewLogModule("NNTP"); \ -PR_LOG(NNTP, out, ("Sending: %s", buf)) ; + PRINTF("Sending: %s", buf) #define NNTP_LOG_NOTE(buf) \ -if (NNTP==NULL) \ - NNTP = PR_NewLogModule("NNTP"); \ -PR_LOG(NNTP, out, ("%s",buf)) ; + PRINTF("%s",buf) char *stateLabels[] = { "NNTP_RESPONSE", @@ -438,9 +434,6 @@ NS_INTERFACE_MAP_END_INHERITING(nsMsgProtocol) nsNNTPProtocol::nsNNTPProtocol(nsIURI * aURL, nsIMsgWindow *aMsgWindow) : nsMsgProtocol(aURL) { - if (!NNTP) - NNTP = PR_NewLogModule("NNTP"); - m_ProxyServer = nsnull; m_lineStreamBuffer = nsnull; m_responseText = nsnull; @@ -627,7 +620,7 @@ nsNNTPProtocol::InitializeNewsFolderFromUri(const char *uri) NS_ENSURE_ARG_POINTER(uri); - PR_LOG(NNTP,PR_LOG_ALWAYS,("InitializeNewsFolderFromUri(%s)",uri)); + PRINTF("InitializeNewsFolderFromUri(%s)",uri); NS_WITH_SERVICE(nsIRDFService, rdf, kRDFServiceCID, &rv); if (NS_FAILED(rv)) return(rv); @@ -1214,7 +1207,7 @@ PRInt32 nsNNTPProtocol::SendData(nsIURI * aURL, const char * dataBuffer) { NNTP_LOG_WRITE(dataBuffer); #ifdef DEBUG_sspitzer - printf("SEND: %s\n",dataBuffer); + PRINTF("SEND: %s\n",dataBuffer); #endif return nsMsgProtocol::SendData(aURL, dataBuffer); // base class actually transmits the data } @@ -1265,7 +1258,7 @@ PRInt32 nsNNTPProtocol::NewsResponse(nsIInputStream * inputStream, PRUint32 leng PR_sscanf(line, "%d", &m_responseCode); #ifdef DEBUG_sspitzer - printf("RECV: %s\n",line); + PRINTF("RECV: %s\n",line); #endif if (m_responseCode == MK_NNTP_RESPONSE_AUTHINFO_DENIED) { @@ -2300,7 +2293,7 @@ PRInt32 nsNNTPProtocol::ReadArticle(nsIInputStream * inputStream, PRUint32 lengt // now mark the message as read #ifdef DEBUG_sspitzer - printf("should we be marking later, after the message has finished loading?\n"); + PRINTF("should we be marking later, after the message has finished loading?\n"); #endif nsCOMPtr msgHdr; nsresult rv = NS_OK; @@ -2447,7 +2440,7 @@ nsNNTPProtocol::CreateNewsFolderURI(const char *username, const char *hostname, *uri = PL_strdup((const char *)folderURI); if (!*uri) return NS_ERROR_OUT_OF_MEMORY; #ifdef DEBUG_sspitzer - printf("news uri=%s\n",*uri); + PRINTF("news uri=%s\n",*uri); #endif /* DEBUG_sspitzer */ return NS_OK; } @@ -2484,8 +2477,8 @@ PRInt32 nsNNTPProtocol::BeginAuthorization() } else { #ifdef DEBUG_sspitzer - printf("we don't know the folder\n"); - printf("this can happen if someone gives us just an article url\n"); + PRINTF("we don't know the folder\n"); + PRINTF("this can happen if someone gives us just an article url\n"); #endif return(MK_NNTP_AUTH_FAILED); } @@ -2502,11 +2495,11 @@ PRInt32 nsNNTPProtocol::BeginAuthorization() NET_SACopy(&command, "AUTHINFO user "); if (cachedUsername) { - PR_LOG(NNTP,PR_LOG_ALWAYS,("use %s as the username",(const char *)cachedUsername)); + PRINTF("use %s as the username", (const char *)cachedUsername); NET_SACat(&command, (const char *)cachedUsername); } else { - PR_LOG(NNTP,PR_LOG_ALWAYS,("use %s as the username",(const char *)username)); + PRINTF("use %s as the username", (const char *)username); NET_SACat(&command, (const char *)username); } NET_SACat(&command, CRLF); @@ -2603,10 +2596,10 @@ PRInt32 nsNNTPProtocol::AuthorizationResponse() NET_SACopy(&command, "AUTHINFO pass "); if (cachedPassword) { - PR_LOG(NNTP,PR_LOG_ALWAYS,("use %s as the password",(const char *)cachedPassword)); NET_SACat(&command, (const char *)cachedPassword); + PRINTF("use %s as the password", (const char *)cachedPassword); NET_SACat(&command, (const char *)cachedPassword); } else { - PR_LOG(NNTP,PR_LOG_ALWAYS,("use %s as the password",(const char *)password)); + PRINTF("use %s as the password", (const char *)password); NET_SACat(&command, (const char *)password); } NET_SACat(&command, CRLF); @@ -2701,7 +2694,7 @@ PRInt32 nsNNTPProtocol::DisplayNewsgroups() m_nextState = NEWS_DONE; ClearFlag(NNTP_PAUSE_FOR_READ); - PR_LOG(NNTP,PR_LOG_ALWAYS,("about to display newsgroups. path: %s",m_path)); + PRINTF("about to display newsgroups. path: %s", m_path); #if 0 /* #### Now ignoring "news:alt.fan.*" @@ -2765,7 +2758,7 @@ PRInt32 nsNNTPProtocol::ProcessNewsgroups(nsIInputStream * inputStream, PRUint32 rv = m_newsHost->FindGroup(groupName, getter_AddRefs(m_newsgroup)); NS_ASSERTION(NS_SUCCEEDED(rv), "FindGroup failed"); m_nextState = NNTP_LIST_XACTIVE; - PR_LOG(NNTP,PR_LOG_ALWAYS,("listing xactive for %s", groupName)); + PRINTF("listing xactive for %s", groupName); PR_FREEIF(line); return 0; } @@ -3073,7 +3066,7 @@ PRInt32 nsNNTPProtocol::FigureNextChunk() if (NS_SUCCEEDED(rv)) rv = m_newsHost->GetNewsgroupList(groupName, getter_AddRefs(m_newsgroupList)); - PR_LOG(NNTP,PR_LOG_ALWAYS,("add to known articles: %d - %d", m_firstArticle, m_lastArticle)); + PRINTF("add to known articles: %d - %d", m_firstArticle, m_lastArticle); if (NS_SUCCEEDED(rv) && m_newsgroupList) { rv = m_newsgroupList->AddToKnownArticles(m_firstArticle, @@ -3128,7 +3121,7 @@ PRInt32 nsNNTPProtocol::FigureNextChunk() return 0; } - PR_LOG(NNTP,PR_LOG_ALWAYS,("Chunk will be (%d-%d)", m_firstArticle, m_lastArticle)); + PRINTF("Chunk will be (%d-%d)", m_firstArticle, m_lastArticle); m_articleNumber = m_firstArticle; @@ -3163,7 +3156,7 @@ PRInt32 nsNNTPProtocol::XoverSend() m_firstArticle, m_lastArticle); - PR_LOG(NNTP,PR_LOG_ALWAYS,("XOVER %d-%d", m_firstArticle, m_lastArticle)); + PRINTF("XOVER %d-%d", m_firstArticle, m_lastArticle); NNTP_LOG_WRITE(outputBuffer); m_nextState = NNTP_RESPONSE; @@ -3368,7 +3361,7 @@ PRInt32 nsNNTPProtocol::ReadNewsgroupBody(nsIInputStream * inputStream, PRUint32 if(!line) return status; - PR_LOG(NNTP,PR_LOG_ALWAYS,("read_group_body: got line: %s|",line)); + PRINTF("read_group_body: got line: %s|", line); /* End of body? */ if (line[0]=='.' && line[1]=='\0') @@ -3858,7 +3851,7 @@ PRBool nsNNTPProtocol::CheckIfAuthor(nsISupports *aElement, void *data) if (identity) { identity->GetEmail(&cancelInfo->from); - PR_LOG(NNTP,PR_LOG_ALWAYS,("from = %s", cancelInfo->from)); + PRINTF("from = %s", cancelInfo->from); } nsCOMPtr parser; @@ -3882,7 +3875,7 @@ PRBool nsNNTPProtocol::CheckIfAuthor(nsISupports *aElement, void *data) nsresult rv1 = parser->ExtractHeaderAddressMailboxes(nsnull, cancelInfo->from, &us); nsresult rv2 = parser->ExtractHeaderAddressMailboxes(nsnull, cancelInfo->old_from, &them); - PR_LOG(NNTP,PR_LOG_ALWAYS,("us = %s, them = %s", us, them)); + PRINTF("us = %s, them = %s", us, them); if ((NS_FAILED(rv1) || NS_FAILED(rv2) || PL_strcasecmp(us, them))) { NNTP_LOG_NOTE("no match. don't set cancel email"); @@ -4009,7 +4002,7 @@ PRInt32 nsNNTPProtocol::DoCancel() goto FAIL; } else { - PR_LOG(NNTP,PR_LOG_ALWAYS,("CANCELCHK not supported, so post the cancel message as %s",cancelInfo.from)); + PRINTF("CANCELCHK not supported, so post the cancel message as %s",cancelInfo.from); } } else { @@ -4313,7 +4306,7 @@ PRInt32 nsNNTPProtocol::ListPrettyNamesResponse(nsIInputStream * inputStream, PR if (i > 0) m_newsHost->SetPrettyName(line,prettyName); - PR_LOG(NNTP,PR_LOG_ALWAYS,("adding pretty name %s", prettyName)); + PRINTF("adding pretty name %s", prettyName); } else { @@ -4423,7 +4416,7 @@ PRInt32 nsNNTPProtocol::ListXActiveResponse(nsIInputStream * inputStream, PRUint /* we're either going to list prettynames first, or list all prettynames every time, so we won't care so much if it gets interrupted. */ - PR_LOG(NNTP,PR_LOG_ALWAYS,("got xactive for %s of %s", line, flags)); + PRINTF("got xactive for %s of %s", line, flags); /* This isn't required, because the extra info is initialized to false for new groups. And it's an expensive call. @@ -4449,7 +4442,7 @@ PRInt32 nsNNTPProtocol::ListXActiveResponse(nsIInputStream * inputStream, PRUint (old_newsgroup != m_newsgroup)) /* make sure we're not stuck on the same group */ { - PR_LOG(NNTP,PR_LOG_ALWAYS,("listing xactive for %s", groupName)); + PRINTF("listing xactive for %s", groupName); m_nextState = NNTP_LIST_XACTIVE; ClearFlag(NNTP_PAUSE_FOR_READ); PR_FREEIF(line); @@ -4671,7 +4664,7 @@ nsresult nsNNTPProtocol::ProcessProtocolState(nsIURI * url, nsIInputStream * inp while(!TestFlag(NNTP_PAUSE_FOR_READ)) { - PR_LOG(NNTP,PR_LOG_ALWAYS,("Next state: %s",stateLabels[m_nextState])); + PRINTF("Next state: %s",stateLabels[m_nextState]); // examine our current state and call an appropriate handler for that state..... switch(m_nextState) { diff --git a/mozilla/mailnews/news/src/nsNewsFolder.cpp b/mozilla/mailnews/news/src/nsNewsFolder.cpp index fa0eca46fc2..f9a3aec6e7c 100644 --- a/mozilla/mailnews/news/src/nsNewsFolder.cpp +++ b/mozilla/mailnews/news/src/nsNewsFolder.cpp @@ -70,6 +70,11 @@ #include "nsIInterfaceRequestor.h" #include "nsReadableUtils.h" +#include "nslog.h" + +NS_IMPL_LOG(nsNewsFolderLog) +#define PRINTF NS_LOG_PRINTF(nsNewsFolderLog) +#define FLUSH NS_LOG_FLUSH(nsNewsFolderLog) // we need this because of an egcs 1.0 (and possibly gcc) compiler bug // that doesn't allow you to call ::nsISupports::GetIID() inside of a class @@ -157,7 +162,7 @@ nsMsgNewsFolder::CreateSubFolders(nsFileSpec &path) if (isNewsServer) { #ifdef DEBUG_NEWS - printf("CreateSubFolders: %s = %s\n", mURI, (const char *)path); + PRINTF("CreateSubFolders: %s = %s\n", mURI, (const char *)path); #endif nsCOMPtr nntpServer; @@ -172,7 +177,7 @@ nsMsgNewsFolder::CreateSubFolders(nsFileSpec &path) } else { #ifdef DEBUG_NEWS - printf("%s is not a host, so it has no newsgroups. (what about categories??)\n", mURI); + PRINTF("%s is not a host, so it has no newsgroups. (what about categories??)\n", mURI); #endif rv = NS_OK; } @@ -201,7 +206,7 @@ nsMsgNewsFolder::AddNewsgroup(const char *name, const char *setStr, nsIMsgFolder if (!name) return NS_ERROR_NULL_POINTER; #ifdef DEBUG_NEWS - printf("AddNewsgroup(%s,??,%s)\n",name,setStr); + PRINTF("AddNewsgroup(%s,??,%s)\n",name,setStr); #endif nsCOMPtr nntpServer; @@ -445,7 +450,7 @@ NS_IMETHODIMP nsMsgNewsFolder::GetMessages(nsIMsgWindow *aMsgWindow, nsISimpleEnumerator* *result) { #ifdef DEBUG_NEWS - printf("nsMsgNewsFolder::GetMessages(%s)\n",mURI); + PRINTF("nsMsgNewsFolder::GetMessages(%s)\n",mURI); #endif nsresult rv = NS_OK; @@ -754,7 +759,7 @@ nsMsgNewsFolder::UpdateSummaryFromNNTPInfo(PRInt32 oldest, PRInt32 youngest, PRI { nsresult rv = NS_OK; #ifdef DEBUG_NEWS - printf("oldest=%d,youngest=%d,total=%d\n",oldest,youngest,total); + PRINTF("oldest=%d,youngest=%d,total=%d\n",oldest,youngest,total); #endif PRBool newsrcHasChanged = PR_FALSE; PRInt32 oldUnreadMessages = mNumUnreadMessages; @@ -851,7 +856,7 @@ NS_IMETHODIMP nsMsgNewsFolder::UpdateSummaryTotals(PRBool force) return NS_OK; #ifdef DEBUG_NEWS - printf("nsMsgNewsFolder::UpdateSummaryTotals(%s)\n",mURI); + PRINTF("nsMsgNewsFolder::UpdateSummaryTotals(%s)\n",mURI); #endif PRInt32 oldUnreadMessages = mNumUnreadMessages; @@ -944,7 +949,7 @@ nsresult nsMsgNewsFolder::GetNewsMessages(nsIMsgWindow *aMsgWindow, PRBool aGetO nsresult rv = NS_OK; #ifdef DEBUG_NEWS - printf("GetNewsMessages() uri = %s\n",mURI); + PRINTF("GetNewsMessages() uri = %s\n",mURI); #endif PRBool isNewsServer = PR_FALSE; @@ -964,7 +969,7 @@ nsresult nsMsgNewsFolder::GetNewsMessages(nsIMsgWindow *aMsgWindow, PRBool aGetO if (NS_FAILED(rv)) return rv; #ifdef DEBUG_NEWS - printf("Getting news articles....\n"); + PRINTF("Getting news articles....\n"); #endif rv = nntpService->GetNewNews(nntpServer, mURI, aGetOld, this, aMsgWindow, nsnull); @@ -1018,7 +1023,7 @@ nsMsgNewsFolder::LoadNewsrcFileAndCreateNewsgroups() if (!exists) { #ifdef DEBUG_NEWS - printf("it is ok for the newsrc file to not exist yet\n"); + PRINTF("it is ok for the newsrc file to not exist yet\n"); #endif return NS_OK; } @@ -1067,7 +1072,7 @@ nsMsgNewsFolder::HandleNewsrcLine(char* line, PRUint32 line_size) line[line_size] = 0; #ifdef DEBUG_NEWS_ - printf("nsMsgNewsFolder::HandleNewsrcLine(%s,%d)\n",line,line_size); + PRINTF("nsMsgNewsFolder::HandleNewsrcLine(%s,%d)\n",line,line_size); #endif if ((line[0] == 'o' || line[0] == 'O') && @@ -1117,14 +1122,14 @@ nsMsgNewsFolder::HandleNewsrcLine(char* line, PRUint32 line_size) // 3746EF3F.6080309%40netscape.com: if (PL_strstr(line,"@") || PL_strstr(line,"%40")) { #ifdef DEBUG_NEWS - printf("skipping %s. it contains @ or %%40\n",line); + PRINTF("skipping %s. it contains @ or %%40\n",line); #endif subscribed = PR_FALSE; } if (subscribed) { #ifdef DEBUG_NEWS - printf("subscribed: %s\n", line); + PRINTF("subscribed: %s\n", line); #endif // we're subscribed, so add it @@ -1136,7 +1141,7 @@ nsMsgNewsFolder::HandleNewsrcLine(char* line, PRUint32 line_size) } else { #ifdef DEBUG_NEWS - printf("NOT subscribed: %s\n", line); + PRINTF("NOT subscribed: %s\n", line); #endif rv = RememberUnsubscribedGroup(line, setStr); if (NS_FAILED(rv)) return -1; @@ -1202,7 +1207,7 @@ nsresult nsMsgNewsFolder::RememberUnsubscribedGroup(const char *newsgroup, const char *setStr) { #ifdef DEBUG_NEWS - printf("RememberUnsubscribedGroup(%s,%s)\n",newsgroup,setStr); + PRINTF("RememberUnsubscribedGroup(%s,%s)\n",newsgroup,setStr); #endif /* DEBUG_NEWS */ if (newsgroup) { @@ -1217,7 +1222,7 @@ nsMsgNewsFolder::RememberUnsubscribedGroup(const char *newsgroup, const char *se } #ifdef DEBUG_NEWS - printf("mUnsubscribedNewsgroupLines:\n%s",(const char *)mUnsubscribedNewsgroupLines); + PRINTF("mUnsubscribedNewsgroupLines:\n%s",(const char *)mUnsubscribedNewsgroupLines); #endif /* DEBUG_NEWS */ return NS_OK; } @@ -1226,7 +1231,7 @@ PRInt32 nsMsgNewsFolder::RememberLine(const char* line) { #ifdef DEBUG_NEWS - printf("RemeberLine(%s)\n",line); + PRINTF("RemeberLine(%s)\n",line); #endif /* DEBUG_NEWS */ mOptionLines = line; @@ -1583,7 +1588,7 @@ nsMsgNewsFolder::SetCachedNewsrcLine(const char *newsrcLine) { if (!newsrcLine) return NS_ERROR_NULL_POINTER; #ifdef DEBUG_NEWS - printf("SetCachedNewsrcLine: [%s]\n", newsrcLine); + PRINTF("SetCachedNewsrcLine: [%s]\n", newsrcLine); #endif mCachedNewsrcLine = nsCRT::strdup(newsrcLine); diff --git a/mozilla/mailnews/news/src/nsNewsUtils.cpp b/mozilla/mailnews/news/src/nsNewsUtils.cpp index a5cb72dd150..d060d6f4b8a 100644 --- a/mozilla/mailnews/news/src/nsNewsUtils.cpp +++ b/mozilla/mailnews/news/src/nsNewsUtils.cpp @@ -31,13 +31,18 @@ #include "nsINntpIncomingServer.h" #include "nsMsgBaseCID.h" #include "nsMsgUtils.h" +#include "nslog.h" + +NS_IMPL_LOG(nsNewsUtilsLog) +#define PRINTF NS_LOG_PRINTF(nsNewsUtilsLog) +#define FLUSH NS_LOG_FLUSH(nsNewsUtilsLog) static nsresult nsGetNewsServer(const char* username, const char *hostname, nsIMsgIncomingServer** aResult) { #ifdef DEBUG_NEWS - printf("nsGetNewsServer(%s,%s,??)\n",username,hostname); + PRINTF("nsGetNewsServer(%s,%s,??)\n",username,hostname); #endif nsresult rv = NS_OK; @@ -65,7 +70,7 @@ nsresult nsNewsURI2Path(const char* rootURI, const char* uriStr, nsFileSpec& pathResult) { #ifdef DEBUG_NEWS - printf("nsNewsURI2Path(%s,%s,??)\n",rootURI,uriStr); + PRINTF("nsNewsURI2Path(%s,%s,??)\n",rootURI,uriStr); #endif nsresult rv = NS_OK; @@ -109,7 +114,7 @@ nsNewsURI2Path(const char* rootURI, const char* uriStr, nsFileSpec& pathResult) if (atPos != -1) { hostname.Left(username, atPos); #ifdef DEBUG_NEWS - printf("username = %s\n",username.GetBuffer()); + PRINTF("username = %s\n",username.GetBuffer()); #endif } @@ -134,7 +139,7 @@ nsNewsURI2Path(const char* rootURI, const char* uriStr, nsFileSpec& pathResult) else { exacthostname = hostname.GetBuffer(); #ifdef DEBUG_NEWS - printf("exacthostname = %s, hostname = %s\n",exacthostname.GetBuffer(),hostname.GetBuffer()); + PRINTF("exacthostname = %s, hostname = %s\n",exacthostname.GetBuffer(),hostname.GetBuffer()); #endif } diff --git a/mozilla/mailnews/news/src/nsNntpIncomingServer.cpp b/mozilla/mailnews/news/src/nsNntpIncomingServer.cpp index 23d9d764371..26dd001acf8 100644 --- a/mozilla/mailnews/news/src/nsNntpIncomingServer.cpp +++ b/mozilla/mailnews/news/src/nsNntpIncomingServer.cpp @@ -38,6 +38,11 @@ #include "nsNNTPProtocol.h" #include "nsIDirectoryService.h" #include "nsAppDirectoryServiceDefs.h" +#include "nslog.h" + +NS_IMPL_LOG(nsNntpIncomingServerLog) +#define PRINTF NS_LOG_PRINTF(nsNntpIncomingServerLog) +#define FLUSH NS_LOG_FLUSH(nsNntpIncomingServerLog) #define VALID_VERSION 1 #define NEW_NEWS_DIR_NAME "News" @@ -288,7 +293,7 @@ nsNntpIncomingServer::WriteNewsrcFile() if (newsrcHasChanged) { #ifdef DEBUG_NEWS - printf("write newsrc file for %s\n", (const char *)hostname); + PRINTF("write newsrc file for %s\n", (const char *)hostname); #endif nsCOMPtr newsrcFile; rv = GetNewsrcFilePath(getter_AddRefs(newsrcFile)); @@ -313,12 +318,12 @@ nsNntpIncomingServer::WriteNewsrcFile() if (NS_SUCCEEDED(rv) && ((const char *)optionLines)) { newsrcStream << (const char *)optionLines; #ifdef DEBUG_NEWS - printf("option lines:\n%s",(const char *)optionLines); + PRINTF("option lines:\n%s",(const char *)optionLines); #endif /* DEBUG_NEWS */ } #ifdef DEBUG_NEWS else { - printf("no option lines to write out\n"); + PRINTF("no option lines to write out\n"); } #endif /* DEBUG_NEWS */ @@ -327,12 +332,12 @@ nsNntpIncomingServer::WriteNewsrcFile() if (NS_SUCCEEDED(rv) && ((const char *)unsubscribedLines)) { newsrcStream << (const char *)unsubscribedLines; #ifdef DEBUG_NEWS - printf("unsubscribedLines:\n%s",(const char *)unsubscribedLines); + PRINTF("unsubscribedLines:\n%s",(const char *)unsubscribedLines); #endif /* DEBUG_NEWS */ } #ifdef DEBUG_NEWS else { - printf("no unsubscribed lines to write out\n"); + PRINTF("no unsubscribed lines to write out\n"); } #endif /* DEBUG_NEWS */ @@ -355,8 +360,8 @@ nsNntpIncomingServer::WriteNewsrcFile() if (NS_SUCCEEDED(rv) && ((const char *)newsrcLine)) { newsrcStream << (const char *)newsrcLine; #ifdef DEBUG_NEWS - printf("writing to newsrc file:\n"); - printf("%s",(const char *)newsrcLine); + PRINTF("writing to newsrc file:\n"); + PRINTF("%s",(const char *)newsrcLine); #endif /* DEBUG_NEWS */ } } @@ -371,7 +376,7 @@ nsNntpIncomingServer::WriteNewsrcFile() } #ifdef DEBUG_NEWS else { - printf("no need to write newsrc file for %s, it was not dirty\n", (const char *)hostname); + PRINTF("no need to write newsrc file for %s, it was not dirty\n", (const char *)hostname); } #endif /* DEBUG_NEWS */ @@ -565,7 +570,7 @@ nsNntpIncomingServer::PerformExpand(nsIMsgWindow *aMsgWindow) { nsresult rv; #ifdef DEBUG_NEWS - printf("PerformExpand for nntp\n"); + PRINTF("PerformExpand for nntp\n"); #endif nsCOMPtr nntpService = do_GetService(kNntpServiceCID, &rv); @@ -656,7 +661,7 @@ nsNntpIncomingServer::DisplaySubscribedGroup(nsIMsgNewsFolder *aMsgFolder, PRInt if (!aMsgFolder) return NS_ERROR_NULL_POINTER; #ifdef DEBUG_NEWS - printf("DisplaySubscribedGroup(...,%ld,%ld,%ld)\n",aFirstMessage,aLastMessage,aTotalMessages); + PRINTF("DisplaySubscribedGroup(...,%ld,%ld,%ld)\n",aFirstMessage,aLastMessage,aTotalMessages); #endif rv = aMsgFolder->UpdateSummaryFromNNTPInfo(aFirstMessage,aLastMessage,aTotalMessages); return rv; @@ -666,7 +671,7 @@ NS_IMETHODIMP nsNntpIncomingServer::PerformBiff() { #ifdef DEBUG_NEWS - printf("PerformBiff for nntp\n"); + PRINTF("PerformBiff for nntp\n"); #endif return PerformExpand(nsnull); } @@ -766,7 +771,7 @@ nsNntpIncomingServer::WriteHostInfoFile() { nsresult rv; #ifdef DEBUG_NEWS - printf("WriteHostInfoFile()\n"); + PRINTF("WriteHostInfoFile()\n"); #endif PRInt32 firstnewdate; @@ -785,7 +790,7 @@ nsNntpIncomingServer::WriteHostInfoFile() nsIOFileStream hostinfoStream(hostinfoFileSpec, (PR_RDWR | PR_CREATE_FILE | PR_TRUNCATE)); #ifdef DEBUG_NEWS - printf("xxx todo missing some formatting, need to fix this, see nsNNTPHost.cpp\n"); + PRINTF("xxx todo missing some formatting, need to fix this, see nsNNTPHost.cpp\n"); #endif hostinfoStream << "# News host information file." << MSG_LINEBREAK; @@ -852,7 +857,7 @@ nsNntpIncomingServer::LoadHostInfoFile() hostinfoStream.close(); #ifdef DEBUG_NEWS - printf("LoadHostInfoFile()\n"); + PRINTF("LoadHostInfoFile()\n"); #endif mHostInfoLoaded = PR_TRUE; return NS_OK; @@ -863,7 +868,7 @@ nsNntpIncomingServer::PopulateSubscribeDatasourceFromHostInfo() { nsresult rv; #ifdef DEBUG_NEWS - printf("PopulateSubscribeDatasourceFromHostInfo()\n"); + PRINTF("PopulateSubscribeDatasourceFromHostInfo()\n"); #endif mGroupsOnServerCount = mGroupsOnServer.Count(); nsCString currentGroup; @@ -873,7 +878,7 @@ nsNntpIncomingServer::PopulateSubscribeDatasourceFromHostInfo() rv = AddToSubscribeDS((const char *)currentGroup, PR_FALSE, PR_TRUE); if (NS_FAILED(rv)) return rv; #ifdef DEBUG_NEWS - printf("%d = %s\n",mGroupsOnServerIndex,(const char *)currentGroup); + PRINTF("%d = %s\n",mGroupsOnServerIndex,(const char *)currentGroup); #endif mGroupsOnServerIndex++; @@ -898,7 +903,7 @@ nsNntpIncomingServer::PopulateSubscribeDatasourceFromHostInfo() if (mGroupsOnServerIndex < mGroupsOnServerCount) { #ifdef DEBUG_NEWS - printf("there is more to do...\n"); + PRINTF("there is more to do...\n"); #endif if (mUpdateTimer) { mUpdateTimer->Cancel(); @@ -916,7 +921,7 @@ nsNntpIncomingServer::PopulateSubscribeDatasourceFromHostInfo() } else { #ifdef DEBUG_NEWS - printf("we are done\n"); + PRINTF("we are done\n"); #endif rv = UpdateSubscribedInSubscribeDS(); if (NS_FAILED(rv)) return rv; @@ -942,7 +947,7 @@ nsNntpIncomingServer::PopulateSubscribeDatasourceWithUri(nsIMsgWindow *aMsgWindo nsresult rv; #ifdef DEBUG_NEWS - printf("PopulateSubscribeDatasourceWithUri(%s)\n",uri); + PRINTF("PopulateSubscribeDatasourceWithUri(%s)\n",uri); #endif rv = StopPopulatingSubscribeDS(); diff --git a/mozilla/mailnews/news/src/nsNntpService.cpp b/mozilla/mailnews/news/src/nsNntpService.cpp index 2bd5e5f0142..87ea894077f 100644 --- a/mozilla/mailnews/news/src/nsNntpService.cpp +++ b/mozilla/mailnews/news/src/nsNntpService.cpp @@ -58,6 +58,11 @@ #include "nsIMsgSearchSession.h" #include "nsAppDirectoryServiceDefs.h" #include "nsIWebNavigation.h" +#include "nslog.h" + +NS_IMPL_LOG(nsNntpServiceLog) +#define PRINTF NS_LOG_PRINTF(nsNntpServiceLog) +#define FLUSH NS_LOG_FLUSH(nsNntpServiceLog) #undef GetPort // XXX Windows! #undef SetPort // XXX Windows! @@ -115,7 +120,7 @@ nsNntpService::SaveMessageToDisk(const char *aMessageURI, return NS_ERROR_NULL_POINTER; #ifdef DEBUG_NEWS - printf("nsNntpService::SaveMessageToDisk(%s,...)\n",aMessageURI); + PRINTF("nsNntpService::SaveMessageToDisk(%s,...)\n",aMessageURI); #endif nsCAutoString uri(aMessageURI); @@ -166,7 +171,7 @@ nsNntpService::DisplayMessage(const char* aMessageURI, nsISupports * aDisplayCon } #ifdef DEBUG_NEWS - printf("nsNntpService::DisplayMessage(%s,...)\n",aMessageURI); + PRINTF("nsNntpService::DisplayMessage(%s,...)\n",aMessageURI); #endif nsCAutoString uri(aMessageURI); @@ -306,7 +311,7 @@ nsresult nsNntpService::ConvertNewsMessageURI2NewsURI(const char *messageURI, ns } #ifdef DEBUG_NEWS - printf("ConvertNewsMessageURI2NewsURI(%s,??) -> %s %u\n", messageURI, newsgroupName.GetBuffer(), *key); + PRINTF("ConvertNewsMessageURI2NewsURI(%s,??) -> %s %u\n", messageURI, newsgroupName.GetBuffer(), *key); #endif nsFileSpec pathResult; @@ -348,8 +353,8 @@ nsresult nsNntpService::ConvertNewsMessageURI2NewsURI(const char *messageURI, ns rv = msgHdr->GetMessageSize(&bytes); rv = msgHdr->GetLineCount(&lines); - printf("bytes = %u\n",bytes); - printf("lines = %u\n",lines); + PRINTF("bytes = %u\n",bytes); + PRINTF("lines = %u\n",lines); #endif if (NS_FAILED(rv)) { @@ -363,7 +368,7 @@ nsresult nsNntpService::ConvertNewsMessageURI2NewsURI(const char *messageURI, ns newsURI += (const char*)messageId; #ifdef DEBUG_NEWS - printf("newsURI = %s\n", (const char *)nsCAutoString(newsURI)); + PRINTF("newsURI = %s\n", (const char *)nsCAutoString(newsURI)); #endif return NS_OK; @@ -490,7 +495,7 @@ nsNntpService::SetUpNntpUrlForPosting(nsINntpUrl *nntpUrl, const char *newsgroup if (PL_strlen(newsgroupsNames) == 0) return NS_ERROR_FAILURE; #ifdef DEBUG_NEWS - printf("newsgroupsNames == %s\n",newsgroupsNames); + PRINTF("newsgroupsNames == %s\n",newsgroupsNames); #endif // newsgroupsNames can be a comma seperated list of these: @@ -522,7 +527,7 @@ nsNntpService::SetUpNntpUrlForPosting(nsINntpUrl *nntpUrl, const char *newsgroup if (!str.IsEmpty()) { #ifdef DEBUG_NEWS - printf("value = %s\n", str.GetBuffer()); + PRINTF("value = %s\n", str.GetBuffer()); #endif nsCAutoString theRest; nsCAutoString currentHost; @@ -535,7 +540,7 @@ nsNntpService::SetUpNntpUrlForPosting(nsINntpUrl *nntpUrl, const char *newsgroup } else if (str.Find(":/") != -1) { #ifdef DEBUG_NEWS - printf("we have x:/y where x != news. this is bad, return failure\n"); + PRINTF("we have x:/y where x != news. this is bad, return failure\n"); #endif CRTFREEIF(list); return NS_ERROR_FAILURE; @@ -545,7 +550,7 @@ nsNntpService::SetUpNntpUrlForPosting(nsINntpUrl *nntpUrl, const char *newsgroup } #ifdef DEBUG_NEWS - printf("theRest == %s\n",theRest.GetBuffer()); + PRINTF("theRest == %s\n",theRest.GetBuffer()); #endif // theRest is "group" or "host/group" @@ -555,7 +560,7 @@ nsNntpService::SetUpNntpUrlForPosting(nsINntpUrl *nntpUrl, const char *newsgroup theRest.Left(currentHost, slashpos); theRest.Right(currentGroup, slashpos); #ifdef DEBUG_NEWS - printf("currentHost == %s\n", currentHost.GetBuffer()); + PRINTF("currentHost == %s\n", currentHost.GetBuffer()); #endif } else if (newshost && nsCRT::strlen(newshost) > 0) @@ -581,7 +586,7 @@ nsNntpService::SetUpNntpUrlForPosting(nsINntpUrl *nntpUrl, const char *newsgroup } else { if (!host.Equals(currentHost)) { - printf("todo, implement an alert: no cross posting to multiple hosts!\n"); + PRINTF("todo, implement an alert: no cross posting to multiple hosts!\n"); CRTFREEIF(list); return NS_ERROR_FAILURE; } @@ -592,7 +597,7 @@ nsNntpService::SetUpNntpUrlForPosting(nsINntpUrl *nntpUrl, const char *newsgroup } #ifdef DEBUG_NEWS else { - printf("nothing between two commas. ignore and keep going...\n"); + PRINTF("nothing between two commas. ignore and keep going...\n"); } #endif token = nsCRT::strtok(rest, ",", &rest); @@ -628,7 +633,7 @@ nsNntpService::ConvertNewsgroupsString(const char *newsgroupsNames, char **_retv if (PL_strlen(newsgroupsNames) == 0) return NS_ERROR_FAILURE; #ifdef DEBUG_NEWS - printf("newsgroupsNames == %s\n",newsgroupsNames); + PRINTF("newsgroupsNames == %s\n",newsgroupsNames); #endif // newsgroupsNames can be a comma seperated list of these: @@ -655,7 +660,7 @@ nsNntpService::ConvertNewsgroupsString(const char *newsgroupsNames, char **_retv if (!str.IsEmpty()) { #ifdef DEBUG_NEWS - printf("value = %s\n", str.GetBuffer()); + PRINTF("value = %s\n", str.GetBuffer()); #endif nsCAutoString currentHost; nsCAutoString theRest; @@ -668,7 +673,7 @@ nsNntpService::ConvertNewsgroupsString(const char *newsgroupsNames, char **_retv } else if (str.Find(":/") != -1) { #ifdef DEBUG_NEWS - printf("we have x:/y where x != news. this is bad, return failure\n"); + PRINTF("we have x:/y where x != news. this is bad, return failure\n"); #endif CRTFREEIF(list); return NS_ERROR_FAILURE; @@ -678,7 +683,7 @@ nsNntpService::ConvertNewsgroupsString(const char *newsgroupsNames, char **_retv } #ifdef DEBUG_NEWS - printf("theRest == %s\n",theRest.GetBuffer()); + PRINTF("theRest == %s\n",theRest.GetBuffer()); #endif // theRest is "group" or "host/group" @@ -690,7 +695,7 @@ nsNntpService::ConvertNewsgroupsString(const char *newsgroupsNames, char **_retv theRest.Left(currentHost, slashpos); #ifdef DEBUG_NEWS - printf("currentHost == %s\n", currentHost.GetBuffer()); + PRINTF("currentHost == %s\n", currentHost.GetBuffer()); #endif // from "host/group", put "group" into currentGroup; theRest.Right(currentGroup, theRest.Length() - currentHost.Length() - 1); @@ -724,7 +729,7 @@ nsNntpService::ConvertNewsgroupsString(const char *newsgroupsNames, char **_retv if (currentHost.IsEmpty()) { #ifdef DEBUG_NEWS - printf("empty current host!\n"); + PRINTF("empty current host!\n"); #endif CRTFREEIF(list); return NS_ERROR_FAILURE; @@ -732,14 +737,14 @@ nsNntpService::ConvertNewsgroupsString(const char *newsgroupsNames, char **_retv if (host.IsEmpty()) { #ifdef DEBUG_NEWS - printf("got a host, set it\n"); + PRINTF("got a host, set it\n"); #endif host = currentHost; } else { if (!host.Equals(currentHost)) { #ifdef DEBUG_NEWS - printf("no cross posting to multiple hosts!\n"); + PRINTF("no cross posting to multiple hosts!\n"); #endif CRTFREEIF(list); return NS_ERROR_NNTP_NO_CROSS_POSTING; @@ -751,7 +756,7 @@ nsNntpService::ConvertNewsgroupsString(const char *newsgroupsNames, char **_retv } #ifdef DEBUG_NEWS else { - printf("nothing between two commas. ignore and keep going...\n"); + PRINTF("nothing between two commas. ignore and keep going...\n"); } #endif token = nsCRT::strtok(rest, ",", &rest); @@ -762,7 +767,7 @@ nsNntpService::ConvertNewsgroupsString(const char *newsgroupsNames, char **_retv if (!*_retval) return NS_ERROR_OUT_OF_MEMORY; #ifdef DEBUG_NEWS - printf("Newsgroups header = %s\n", *_retval); + PRINTF("Newsgroups header = %s\n", *_retval); #endif return NS_OK; @@ -772,7 +777,7 @@ NS_IMETHODIMP nsNntpService::PostMessage(nsIFileSpec *fileToPost, const char *newsgroupsNames, const char *newshost, nsIUrlListener * aUrlListener, nsIMsgWindow *aMsgWindow, nsIURI **_retval) { #ifdef DEBUG_NEWS - printf("nsNntpService::PostMessage(??,%s,??,??)\n",newsgroupsNames); + PRINTF("nsNntpService::PostMessage(??,%s,??,??)\n",newsgroupsNames); #endif if (!aMsgWindow) return NS_ERROR_NULL_POINTER; if (!newsgroupsNames) return NS_ERROR_NULL_POINTER; @@ -929,7 +934,7 @@ nsNntpService::GetProtocolForUri(nsIURI *aUri, nsIMsgWindow *aMsgWindow, nsINNTP #ifdef DEBUG_sspitzer nsXPIDLCString spec; rv = aUri->GetSpec(getter_Copies(spec)); - printf("GetProtocolForUri(%s,...)\n",(const char *)spec); + PRINTF("GetProtocolForUri(%s,...)\n",(const char *)spec); #endif rv = aUri->GetHost(getter_Copies(hostName)); @@ -948,7 +953,7 @@ nsNntpService::GetProtocolForUri(nsIURI *aUri, nsIMsgWindow *aMsgWindow, nsINNTP nsCOMPtr nntpServer; #ifdef DEBUG_sspitzer - printf("for bug, #36661, see if there are any accounts, if not, try migrating. should this be pushed into FindServer()?\n"); + PRINTF("for bug, #36661, see if there are any accounts, if not, try migrating. should this be pushed into FindServer()?\n"); #endif nsCOMPtr accounts; rv = accountManager->GetAccounts(getter_AddRefs(accounts)); @@ -1017,7 +1022,7 @@ NS_IMETHODIMP nsNntpService::GetNewNews(nsINntpIncomingServer *nntpServer, const if (!uri) return NS_ERROR_NULL_POINTER; #ifdef DEBUG_NEWS - printf("nsNntpService::GetNewNews(%s)\n", uri); + PRINTF("nsNntpService::GetNewNews(%s)\n", uri); #endif NS_LOCK_INSTANCE(); @@ -1035,16 +1040,16 @@ NS_IMETHODIMP nsNntpService::GetNewNews(nsINntpIncomingServer *nntpServer, const } #ifdef DEBUG_NEWS else { - printf("server == nsnull\n"); + PRINTF("server == nsnull\n"); } #endif #ifdef DEBUG_NEWS if (nntpHostName) { - printf("get news from news://%s\n", (const char *) nntpHostName); + PRINTF("get news from news://%s\n", (const char *) nntpHostName); } else { - printf("nntpHostName is null\n"); + PRINTF("nntpHostName is null\n"); } #endif @@ -1125,7 +1130,7 @@ NS_IMETHODIMP nsNntpService::CancelMessages(const char *hostname, const char *ne rv = messages->Count(&count); if (NS_FAILED(rv)) { #ifdef DEBUG_NEWS - printf("Count failed\n"); + PRINTF("Count failed\n"); #endif return rv; } @@ -1161,7 +1166,7 @@ NS_IMETHODIMP nsNntpService::CancelMessages(const char *hostname, const char *ne urlStr += "?cancel"; #ifdef DEBUG_NEWS - printf("attempt to cancel the message (key,ID,cancel url): (%d,%s,%s)\n", key, (const char *)messageId, (const char *)urlStr); + PRINTF("attempt to cancel the message (key,ID,cancel url): (%d,%s,%s)\n", key, (const char *)messageId, (const char *)urlStr); #endif /* DEBUG_NEWS */ nsCAutoString newsgroupNameStr(newsgroupname); @@ -1397,7 +1402,7 @@ nsNntpService::UpdateCounts(nsINntpIncomingServer *aNntpServer, nsIMsgWindow *aM { nsresult rv; #ifdef DEBUG_NEWS - printf("in UpdateCountsForNewsgroup()\n"); + PRINTF("in UpdateCountsForNewsgroup()\n"); #endif if (!aNntpServer) return NS_ERROR_NULL_POINTER; @@ -1425,7 +1430,7 @@ nsNntpService::BuildSubscribeDatasource(nsINntpIncomingServer *aNntpServer, nsIM { nsresult rv; #ifdef DEBUG_NEWS - printf("in BuildSubscribeDatasource()\n"); + PRINTF("in BuildSubscribeDatasource()\n"); #endif if (!aNntpServer) return NS_ERROR_NULL_POINTER; diff --git a/mozilla/modules/appfilelocprovider/src/nsAppFileLocationProvider.cpp b/mozilla/modules/appfilelocprovider/src/nsAppFileLocationProvider.cpp index ab7ea6bf7ab..abe6119a4a0 100755 --- a/mozilla/modules/appfilelocprovider/src/nsAppFileLocationProvider.cpp +++ b/mozilla/modules/appfilelocprovider/src/nsAppFileLocationProvider.cpp @@ -139,11 +139,12 @@ nsAppFileLocationProvider::nsAppFileLocationProvider() // 2. If that doesn't work, set it to be the current process directory NS_WITH_SERVICE(nsIProperties, directoryService, NS_DIRECTORY_SERVICE_CONTRACTID, &rv); - if (NS_SUCCEEDED(rv)) + if (NS_SUCCEEDED(rv)) { rv = directoryService->Get(NS_XPCOM_CURRENT_PROCESS_DIR, NS_GET_IID(nsIFile), getter_AddRefs(mMozBinDirectory)); - if (NS_FAILED(rv)) { - rv = directoryService->Get(NS_OS_CURRENT_PROCESS_DIR, NS_GET_IID(nsIFile), getter_AddRefs(mMozBinDirectory)); + if (NS_FAILED(rv)) { + rv = directoryService->Get(NS_OS_CURRENT_PROCESS_DIR, NS_GET_IID(nsIFile), getter_AddRefs(mMozBinDirectory)); + } } } diff --git a/mozilla/modules/libimg/gifcom/gif.cpp b/mozilla/modules/libimg/gifcom/gif.cpp index 57db33f1e8b..f4303fc98a4 100644 --- a/mozilla/modules/libimg/gifcom/gif.cpp +++ b/mozilla/modules/libimg/gifcom/gif.cpp @@ -73,12 +73,16 @@ mailing address. #include "nsIImgDCallbk.h" #include "ilISystemServices.h" +#include "nslog.h" + +NS_IMPL_LOG(IMGLIBLog) +#define PRINTF NS_LOG_PRINTF(IMGLIBLog) +#define FLUSH NS_LOG_FLUSH(IMGLIBLog) #define HOWMANY(x, r) (((x) + ((r) - 1)) / (r)) #define ROUNDUP(x, r) (HOWMANY(x, r) * (r)) int il_debug; -PRLogModuleInfo *il_log_module = NULL; #ifndef MAX # define MAX(x, y) (((x) > (y)) ? (x) : (y)) diff --git a/mozilla/modules/libimg/jpgcom/jpeg.cpp b/mozilla/modules/libimg/jpgcom/jpeg.cpp index d9db3246a16..e44bf9e06cb 100644 --- a/mozilla/modules/libimg/jpgcom/jpeg.cpp +++ b/mozilla/modules/libimg/jpgcom/jpeg.cpp @@ -22,7 +22,7 @@ /* * jpeg.c --- Glue code to Independent JPEG Group decoder library - * $Id: jpeg.cpp,v 1.22 2000-09-27 22:18:33 pchen%netscape.com Exp $ + * $Id: jpeg.cpp,v 1.23 2000-10-27 22:41:10 warren%netscape.com Exp $ */ @@ -65,7 +65,11 @@ PR_END_EXTERN_C #define MAX_JPEG_MARKER_LENGTH (((PRUint32)1 << 16) - 1) int il_debug; -PRLogModuleInfo *il_log_module = NULL; +#include "nslog.h" + +NS_IMPL_LOG(IMGLIBLog) +#define PRINTF NS_LOG_PRINTF(IMGLIBLog) +#define FLUSH NS_LOG_FLUSH(IMGLIBLog) /* * States that the jpeg decoder might be in diff --git a/mozilla/modules/libimg/pngcom/ipng.cpp b/mozilla/modules/libimg/pngcom/ipng.cpp index 834155ce3d0..94841fda56b 100644 --- a/mozilla/modules/libimg/pngcom/ipng.cpp +++ b/mozilla/modules/libimg/pngcom/ipng.cpp @@ -42,6 +42,11 @@ #include "nsPNGDecoder.h" #include "nsIImgDCallbk.h" #include "ilISystemServices.h" +#include "nslog.h" + +NS_IMPL_LOG(IMGLIBLog) +#define PRINTF NS_LOG_PRINTF(IMGLIBLog) +#define FLUSH NS_LOG_FLUSH(IMGLIBLog) #define MINIMUM_DELAY_TIME 10 @@ -52,7 +57,6 @@ static void PR_CALLBACK end_callback(png_structp png_ptr, png_infop info); static void PR_CALLBACK il_png_error_handler(png_structp png_ptr, png_const_charp msg); int il_debug; -PRLogModuleInfo *il_log_module = NULL; #define CAN_SUPPORT_8_BIT_MASK @@ -424,14 +428,14 @@ il_png_error_handler(png_structp png_ptr, png_const_charp msg) * been defined. Adapted from readpng2_error_handler() in "PNG: The * Definitive Guide" (O'Reilly, 1999). */ - fprintf(stderr, "nspng libpng error: %s\n", msg); - fflush(stderr); + PRINTF("nspng libpng error: %s\n", msg); + FLUSH(); ipng_p = (ipng_structp)png_get_error_ptr(png_ptr); if (ipng_p == NULL) { /* we are completely hosed now */ - fprintf(stderr, "nspng severe error: jmpbuf not recoverable.\n"); - fflush(stderr); - PR_ASSERT(ipng_p != NULL); /* instead of exit(99); */ + PRINTF("nspng severe error: jmpbuf not recoverable.\n"); + FLUSH(); + PR_ASSERT(ipng_p != NULL); /* instead of exit(99); */ } longjmp(ipng_p->jmpbuf, 1); diff --git a/mozilla/modules/libimg/public_com/if_struct.h b/mozilla/modules/libimg/public_com/if_struct.h index 64d1c11e164..9c7d14dcb65 100644 --- a/mozilla/modules/libimg/public_com/if_struct.h +++ b/mozilla/modules/libimg/public_com/if_struct.h @@ -22,7 +22,7 @@ /* if.h --- Top-level image library internal routines * - * $Id: if_struct.h,v 1.14 2000-08-26 18:18:25 pnunn%netscape.com Exp $ + * $Id: if_struct.h,v 1.15 2000-10-27 22:41:13 warren%netscape.com Exp $ */ #ifndef _if_h @@ -68,12 +68,12 @@ typedef struct il_container_struct il_container; group observer notification. */ /* #define DEBUG_GROUP_OBSERVER */ +#include "nslog.h" +NS_DECL_LOG(IMGLIBLog) +#define ILTRACE(l,t) NS_LOG_PRINTF(IMGLIBLog) t // level, l, no longer used + #ifdef DEBUG extern int il_debug; -extern PRLogModuleInfo *il_log_module; -#define ILTRACE(l,t) { if(il_debug>l) {PR_LOG(il_log_module, 1, t);} } -#else -#define ILTRACE(l,t) {} #endif #define FREE_IF_NOT_NULL(x) do {if (x) {PR_FREEIF(x); (x) = NULL;}} while (0) diff --git a/mozilla/modules/libimg/src/if.cpp b/mozilla/modules/libimg/src/if.cpp index a87231d4bff..106a15a0b35 100644 --- a/mozilla/modules/libimg/src/if.cpp +++ b/mozilla/modules/libimg/src/if.cpp @@ -40,6 +40,11 @@ #include "nsIPresContext.h" #include "nsICookieService.h" #include "nsIServiceManager.h" +#include "nslog.h" + +NS_IMPL_LOG(IMGLIBLog) +#define PRINTF NS_LOG_PRINTF(IMGLIBLog) +#define FLUSH NS_LOG_FLUSH(IMGLIBLog) #define HOWMANY(x, r) (((x) + ((r) - 1)) / (r)) @@ -1276,10 +1281,10 @@ IL_ChromeAlphaAbuseCheck(il_container *ic) num255++; } if (num000+num255 == header->width*header->height) { - fprintf(stderr, "CHROME ALPHA ABUSE\n"); - fprintf(stderr, "\tusing an 8-bit alpha channel to represent binary alpha\n"); - fprintf(stderr, "\t%s\n", ic->url_address); - fprintf(stderr, "\tnum000=%d num255=%d sum=%d w*h=%d\n", + PRINTF("CHROME ALPHA ABUSE\n"); + PRINTF("\tusing an 8-bit alpha channel to represent binary alpha\n"); + PRINTF("\t%s\n", ic->url_address); + PRINTF("\tnum000=%d num255=%d sum=%d w*h=%d\n", num000, num255, num000+num255, header->width*header->height); } } else if (ic->image->header.alpha_bits == 1) { @@ -1308,9 +1313,9 @@ IL_ChromeAlphaAbuseCheck(il_container *ic) } if (constAlpha) { - fprintf(stderr, "CHROME ALPHA ABUSE\n"); - fprintf(stderr, "\tfully opaque 1-bit alpha mask\n"); - fprintf(stderr, "\t%s\n", ic->url_address); + PRINTF("CHROME ALPHA ABUSE\n"); + PRINTF("\tfully opaque 1-bit alpha mask\n"); + PRINTF("\t%s\n", ic->url_address); } } } diff --git a/mozilla/modules/libimg/src/if.h b/mozilla/modules/libimg/src/if.h index 80257ad995c..c037b1607ab 100644 --- a/mozilla/modules/libimg/src/if.h +++ b/mozilla/modules/libimg/src/if.h @@ -22,7 +22,7 @@ /* if.h --- Top-level image library internal routines * - * $Id: if.h,v 3.24 2000-08-26 18:17:25 pnunn%netscape.com Exp $ + * $Id: if.h,v 3.25 2000-10-27 22:41:14 warren%netscape.com Exp $ */ #ifndef _if_h @@ -71,14 +71,9 @@ typedef struct il_container_struct il_container; /* #define DEBUG_GROUP_OBSERVER */ - -#ifdef DEBUG -extern int il_debug; -extern PRLogModuleInfo *il_log_module; -#define ILTRACE(l,t) { if(il_debug>l) {PR_LOG(il_log_module, 1, t);} } -#else -#define ILTRACE(l,t) {} -#endif +#include "nslog.h" +NS_DECL_LOG(IMGLIBLog) +#define ILTRACE(l,t) NS_LOG_PRINTF(IMGLIBLog) t // level, l, no longer used #define FREE_IF_NOT_NULL(x) do {if (x) {PR_FREEIF(x); (x) = NULL;}} while (0) diff --git a/mozilla/modules/libimg/src/ilclient.cpp b/mozilla/modules/libimg/src/ilclient.cpp index 1c35e9a7cb7..51ec336aff2 100644 --- a/mozilla/modules/libimg/src/ilclient.cpp +++ b/mozilla/modules/libimg/src/ilclient.cpp @@ -34,6 +34,11 @@ #include "nsIFactory.h" #include "nsCRT.h" #include "xpcompat.h" //temporary, for timers +#include "nslog.h" + +NS_IMPL_LOG(ilclientLog) +#define PRINTF NS_LOG_PRINTF(ilclientLog) +#define FLUSH NS_LOG_FLUSH(ilclientLog) #undef PIN_CHROME /* Note that default cache size is set in @@ -42,7 +47,7 @@ static PRUint32 image_cache_size; static PRUint32 max_cache_items = 192; -PRLogModuleInfo *il_log_module = NULL; +//PRLogModuleInfo *il_log_module = NULL; ilISystemServices *il_ss = NULL; /* simple list, in use order */ @@ -638,7 +643,7 @@ il_delete_container(il_container *ic) */ if (ic->is_url_loading) { #ifdef DEBUG_kipp - printf("il_delete_container: bad: can't delete ic=%p '%s'\n", + PRINTF("il_delete_container: bad: can't delete ic=%p '%s'\n", ic, ic->url_address ? ic->url_address : "(null)"); #endif ic->state = IC_ABORT_PENDING; @@ -658,7 +663,7 @@ il_delete_container(il_container *ic) /* delete the image */ if (!(ic->image || ic->mask)) { #ifdef DEBUG_kipp - printf("il_delete_container: bad: ic=%p '%s' image=%p mask=%p\n", + PRINTF("il_delete_container: bad: ic=%p '%s' image=%p mask=%p\n", ic, ic->url_address ? ic->url_address : "(null)", ic->image, ic->mask); #endif @@ -872,7 +877,7 @@ IL_FlushCache(PRUint8 img_catagory) { if (ic->is_in_use ||((img_catagory == 0 )&&(ic->moz_type == TYPE_CHROME))){ #ifdef DEBUG_kipp - printf("IL_FlushCache: il_container %p in use '%s'\n", + PRINTF("IL_FlushCache: il_container %p in use '%s'\n", ic, ic->url_address ? ic->url_address : "(null)"); #endif ic = ic->next; @@ -1055,9 +1060,6 @@ il_delete_all_clients(il_container *ic) IL_IMPLEMENT(int) IL_Init(ilISystemServices *ss) { - if (il_log_module == NULL) { - il_log_module = PR_NewLogModule("IMGLIB"); - } il_ss = ss; /* XXXM12N - finish me. */ diff --git a/mozilla/modules/libjar/nsJAR.cpp b/mozilla/modules/libjar/nsJAR.cpp index 21a51a19cc7..519457275bc 100644 --- a/mozilla/modules/libjar/nsJAR.cpp +++ b/mozilla/modules/libjar/nsJAR.cpp @@ -32,6 +32,11 @@ #include "nsIServiceManager.h" #include "plbase64.h" #include "nsIConsoleService.h" +#include "nslog.h" + +NS_IMPL_LOG(nsJARLog) +#define PRINTF NS_LOG_PRINTF(nsJARLog) +#define FLUSH NS_LOG_FLUSH(nsJARLog) #ifdef XP_UNIX #include @@ -813,7 +818,7 @@ void nsJAR::ReportError(const char* aFilename, PRInt16 errorCode) { char* messageCstr = message.ToNewCString(); if (!messageCstr) return; - fprintf(stderr, "%s\n", messageCstr); + PRINTF("%s\n", messageCstr); nsMemory::Free(messageCstr); } } @@ -889,7 +894,7 @@ PrintManItem(nsHashKey* aKey, void* aData, void* closure) nsCStringKey* key2 = (nsCStringKey*)aKey; char* name = key2->GetString().ToNewCString(); if (!(PL_strcmp(name, "") == 0)) - printf("%s s=%i\n",name, manItem->status); + PRINTF("%s s=%i\n",name, manItem->status); } return PR_TRUE; } @@ -898,18 +903,18 @@ PrintManItem(nsHashKey* aKey, void* aData, void* closure) void nsJAR::DumpMetadata(const char* aMessage) { #if 0 - printf("### nsJAR::DumpMetadata at %s ###\n", aMessage); + PRINTF("### nsJAR::DumpMetadata at %s ###\n", aMessage); if (mPrincipal) { char* toStr; mPrincipal->ToString(&toStr); - printf("Principal: %s.\n", toStr); + PRINTF("Principal: %s.\n", toStr); PR_FREEIF(toStr); } else - printf("No Principal. \n"); + PRINTF("No Principal. \n"); mManifestData.Enumerate(PrintManItem); - printf("\n"); + PRINTF("\n"); #endif } @@ -1143,7 +1148,7 @@ nsZipReaderCache::~nsZipReaderCache() mZips.Enumerate(DropZipReaderCache, nsnull); #ifdef ZIP_CACHE_HIT_RATE - printf("nsZipReaderCache size=%d hits=%d lookups=%d rate=%f%% flushes=%d\n", + PRINTF("nsZipReaderCache size=%d hits=%d lookups=%d rate=%f%% flushes=%d\n", mZipCacheHits, mZipCacheLookups, (float)mZipCacheHits / mZipCacheLookups, mZipCacheFlushes); #endif diff --git a/mozilla/modules/libjar/nsJARInputStream.cpp b/mozilla/modules/libjar/nsJARInputStream.cpp index a194ae3c93a..cc37dbe2014 100644 --- a/mozilla/modules/libjar/nsJARInputStream.cpp +++ b/mozilla/modules/libjar/nsJARInputStream.cpp @@ -22,6 +22,11 @@ #include "nsJARInputStream.h" #include "zipfile.h" // defines ZIP error codes #include "nsZipArchive.h" +#include "nslog.h" + +NS_IMPL_LOG(nsJARInputStreamLog) +#define PRINTF NS_LOG_PRINTF(nsJARInputStreamLog) +#define FLUSH NS_LOG_FLUSH(nsJARInputStreamLog) /*--------------------------------------------- @@ -56,7 +61,7 @@ nsJARInputStream::Read(char* buf, PRUint32 count, PRUint32 *bytesRead) PRInt32 err = Zip()->Read(mReadInfo, buf, count, bytesRead); #ifdef DEBUG_warren -// printf("read %d from %s\n", *bytesRead, mEntryName); +// PRINTF("read %d from %s\n", *bytesRead, mEntryName); #endif return err == ZIP_OK ? NS_OK : NS_ERROR_FAILURE; } diff --git a/mozilla/modules/libpref/src/nsPref.cpp b/mozilla/modules/libpref/src/nsPref.cpp index da107d60e81..c9b908fae7f 100644 --- a/mozilla/modules/libpref/src/nsPref.cpp +++ b/mozilla/modules/libpref/src/nsPref.cpp @@ -89,6 +89,12 @@ #define DEBUG_prefs #endif +#include "nslog.h" + +NS_IMPL_LOG(nsPrefLog) +#define PRINTF NS_LOG_PRINTF(nsPrefLog) +#define FLUSH NS_LOG_FLUSH(nsPrefLog) + static NS_DEFINE_CID(kSecurityManagerCID, NS_SCRIPTSECURITYMANAGER_CID); static NS_DEFINE_CID(kStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID); @@ -318,15 +324,11 @@ nsresult nsPref::getLockPrefFileInfo() if (NS_SUCCEEDED(rv = CopyCharPref("general.config.filename", &gLockFileName)) && (gLockFileName)) { -#ifdef NS_DEBUG - printf("\ngLockFileName %s \n", gLockFileName); -#endif + PRINTF("\ngLockFileName %s \n", gLockFileName); if (NS_SUCCEEDED(rv = CopyCharPref("general.config.vendor", &gLockVendor)) && (gLockVendor)) { -#ifdef NS_DEBUG - printf("\ngLockVendor %s \n", gLockVendor); -#endif + PRINTF("\ngLockVendor %s \n", gLockVendor); } else { @@ -362,25 +364,19 @@ nsresult nsPref::useLockPrefFile() if (NS_SUCCEEDED(rv = GetLocalizedUnicharPref("browser.startup.homepage", getter_Copies(prefVal)) && (prefVal))) { -#ifdef DEBUG_tao - printf("\nStartup homepage %s \n", (const char *)NS_ConvertUCS2toUTF8(prefVal)); -#endif + PRINTF("\nStartup homepage %s \n", (const char *)NS_ConvertUCS2toUTF8(prefVal)); } if (NS_SUCCEEDED(rv = CopyCharPref("general.config.filename", getter_Copies(lockFileName)) && (lockFileName))) { -#ifdef NS_DEBUG - printf("\nlockFile %s \n", (const char *)lockFileName); -#endif + PRINTF("\nlockFile %s \n", (const char *)lockFileName); } if (NS_SUCCEEDED(rv = CopyCharPref("general.config.vendor", getter_Copies(lockVendor)) && (lockVendor))) { -#ifdef NS_DEBUG - printf("\nlockVendor %s \n", (const char *)lockVendor); -#endif + PRINTF("\nlockVendor %s \n", (const char *)lockVendor); } if ((gLockFileName == nsnull) && (gLockVendor == nsnull)) @@ -487,10 +483,8 @@ nsresult nsPref::useLockPrefFile() JS_EndRequest(gMochaContext); } } - GetLocalizedUnicharPref("browser.startup.homepage",getter_Copies(prefVal)); -#ifdef DEBUG_tao - printf("\nStartup homepage %s \n", (const char *)NS_ConvertUCS2toUTF8(prefVal)); -#endif + GetLocalizedUnicharPref("browser.startup.homepage",getter_Copies(prefVal)); + PRINTF("\nStartup homepage %s \n", (const char *)NS_ConvertUCS2toUTF8(prefVal)); } return rv; } // nsPref::useLockPrefFile @@ -620,9 +614,7 @@ NS_IMETHODIMP nsPref::ShutDown() //---------------------------------------------------------------------------------------- { mObservers.Enumerate(UnregisterObservers, nsnull); -#ifdef DEBUG_alecf - printf("PREF_Cleanup()\n"); -#endif + PRINTF("PREF_Cleanup()\n"); PREF_Cleanup(); return NS_OK; } // nsPref::ShutDown @@ -890,7 +882,7 @@ static void checkPref(const char* fname, const char* pref) { nsCString cstr(strArr[i]); while (cstr.Length()) { if (pref == cstr) { - printf("\n --> %s:: SHALL use GetLocalizedUnicharPrefto get --%s--\n", fname, pref); + PRINTF("\n --> %s:: SHALL use GetLocalizedUnicharPrefto get --%s--\n", fname, pref); NS_ASSERTION(0, "\n\n"); return; } @@ -935,7 +927,7 @@ NS_IMETHODIMP nsPref::GetLocalizedUnicharPref(const char *pref, PRUnichar **return_buf) { #if defined(DEBUG_tao_) - printf("\n --> nsPref::GetLocalizedUnicharPref(%s) --", pref); + PRINTF("\n --> nsPref::GetLocalizedUnicharPref(%s) --", pref); #endif // if the user has set this pref, then just return the user value if (PREF_HasUserPref(pref)) @@ -1505,13 +1497,11 @@ PRBool pref_VerifyLockFileSpec(char* buf, long buflen) (int)digest[8],(int)digest[9],(int)digest[10],(int)digest[11], (int)digest[12],(int)digest[13],(int)digest[14],(int)digest[15]); -#ifdef DEBUG_neeti - printf("%02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x", + PRINTF("%02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x", (int)digest[0],(int)digest[1],(int)digest[2],(int)digest[3], (int)digest[4],(int)digest[5],(int)digest[6],(int)digest[7], (int)digest[8],(int)digest[9],(int)digest[10],(int)digest[11], (int)digest[12],(int)digest[13],(int)digest[14],(int)digest[15]); -#endif success = ( PL_strncmp((const char*) buf + 3, szHash, (PRUint32)(hash_length - 4)) == 0 ); @@ -1683,7 +1673,7 @@ extern "C" JSBool pref_InitInitialObjects() // Keep this child #ifdef DEBUG_prefs - printf("Parsing default JS files.\n"); + PRINTF("Parsing default JS files.\n"); #endif /* DEBUG_prefs */ for (; Exists(dirIterator); dirIterator->Next()) { @@ -1708,7 +1698,7 @@ extern "C" JSBool pref_InitInitialObjects() if (shouldParse) { #ifdef DEBUG_prefs - printf("Adding %s to the list to be sorted\n", leafName); + PRINTF("Adding %s to the list to be sorted\n", leafName); #endif /* DEBUG_prefs */ rv = NS_NewFileSpec(&(defaultPrefFiles[numFiles])); NS_ASSERTION(NS_SUCCEEDED(rv),"failed to create a file spec"); @@ -1733,7 +1723,7 @@ extern "C" JSBool pref_InitInitialObjects() } } #ifdef DEBUG_prefs - printf("Sort defaultPrefFiles. we need them sorted so all-ns.js will override all.js (where override == parsed later)\n"); + PRINTF("Sort defaultPrefFiles. we need them sorted so all-ns.js will override all.js (where override == parsed later)\n"); #endif /* DEBUG_prefs */ NS_QuickSort((void *)defaultPrefFiles, numFiles,sizeof(nsIFileSpec *), inplaceSortCallback, nsnull); @@ -1742,7 +1732,7 @@ extern "C" JSBool pref_InitInitialObjects() if (defaultPrefFiles[k]) { rv = defaultPrefFiles[k]->GetLeafName(¤tLeafName); #ifdef DEBUG_prefs - printf("Parsing %s\n", currentLeafName); + PRINTF("Parsing %s\n", currentLeafName); #endif /* DEBUG_prefs */ if (currentLeafName) nsCRT::free((char*)currentLeafName); @@ -1764,7 +1754,7 @@ extern "C" JSBool pref_InitInitialObjects() defaultPrefFiles = nsnull; #ifdef DEBUG_prefs - printf("Parsing platform-specific JS files.\n"); + PRINTF("Parsing platform-specific JS files.\n"); #endif /* DEBUG_prefs */ // Finally, parse any other special files (platform-specific ones). for (k = 1; k < (int) (sizeof(specialFiles) / sizeof(char*)); k++) @@ -1783,7 +1773,7 @@ extern "C" JSBool pref_InitInitialObjects() if (NS_FAILED(rv)) continue; #ifdef DEBUG_prefs - printf("Parsing %s\n", specialFiles[k]); + PRINTF("Parsing %s\n", specialFiles[k]); #endif /* DEBUG_prefs */ if (NS_FAILED(anotherSpecialChild2->Exists(&exists)) || !exists) diff --git a/mozilla/modules/libreg/xpcom/nsRegistry.cpp b/mozilla/modules/libreg/xpcom/nsRegistry.cpp index a510429259e..036922a52e4 100644 --- a/mozilla/modules/libreg/xpcom/nsRegistry.cpp +++ b/mozilla/modules/libreg/xpcom/nsRegistry.cpp @@ -44,6 +44,12 @@ #include #endif +#include "nslog.h" + +NS_IMPL_LOG(nsRegistryLog) +#define PRINTF NS_LOG_PRINTF(nsRegistryLog) +#define FLUSH NS_LOG_FLUSH(nsRegistryLog) + /* extra locking for the paranoid */ /* #define EXTRA_THREADSAFE */ #ifndef EXTRA_THREADSAFE @@ -51,9 +57,7 @@ #define PR_Unlock(x) (void)0 #endif -// Logging of debug output -#define FORCE_PR_LOG /* Allow logging in the release build */ -extern PRLogModuleInfo *nsComponentManagerLog; +#define nsComponentManagerLog nsRegistryLog PRUnichar widestrFormat[] = { PRUnichar('%'),PRUnichar('s'),PRUnichar(0)}; @@ -386,9 +390,7 @@ NS_IMETHODIMP nsRegistry::Open( const char *regFile ) { return OpenWellKnownRegistry(nsIRegistry::ApplicationRegistry); } -#ifdef DEBUG_dp - printf("nsRegistry: Opening registry %s\n", regFile); -#endif /* DEBUG_dp */ + PRINTF("nsRegistry: Opening registry %s\n", regFile); if (mCurRegID != nsIRegistry::None && mCurRegID != nsIRegistry::ApplicationCustomRegistry) { @@ -478,7 +480,7 @@ NS_IMETHODIMP nsRegistry::OpenWellKnownRegistry( nsWellKnownRegistry regid ) "%s/" NS_MOZILLA_DIR_NAME, settings); if (PR_Access(settingsMozillaDir, PR_ACCESS_EXISTS) != PR_SUCCESS) { PR_MkDir(settingsMozillaDir, NS_MOZILLA_DIR_PERMISSION); - printf("nsComponentManager: Creating Directory %s\n", settingsMozillaDir); + PRINTF("nsComponentManager: Creating Directory %s\n", settingsMozillaDir); PR_LOG(nsComponentManagerLog, PR_LOG_ALWAYS, ("nsComponentManager: Creating Directory %s", settingsMozillaDir)); } @@ -560,9 +562,7 @@ NS_IMETHODIMP nsRegistry::OpenWellKnownRegistry( nsWellKnownRegistry regid ) return NS_ERROR_REG_BADTYPE; } -#ifdef DEBUG_dp - printf("nsRegistry: Opening std registry %s\n", regFile); -#endif /* DEBUG_dp */ + PRINTF("nsRegistry: Opening std registry %s\n", regFile); PR_Lock(mregLock); err = NR_RegOpen((char*)regFile, &mReg ); @@ -1076,9 +1076,7 @@ NS_IMETHODIMP nsRegistry::RemoveSubtree( nsRegistryKey baseKey, const char *path while (NR_RegEnumSubkeys(mReg, key, &state, subkeyname, sizeof(subkeyname), REGENUM_NORMAL) == REGERR_OK) { -#ifdef DEBUG_dp - printf("...recursing into %s\n", subkeyname); -#endif /* DEBUG_dp */ + PRINTF("...recursing into %s\n", subkeyname); // Even though this is not a "Raw" API the subkeys may still, in fact, // *be* raw. Since we're recursively deleting this will work either way. // If we were guaranteed none would be raw then a depth-first enumeration @@ -1090,9 +1088,7 @@ NS_IMETHODIMP nsRegistry::RemoveSubtree( nsRegistryKey baseKey, const char *path // If success in deleting all subkeys, delete this key too if (err == REGERR_OK) { -#ifdef DEBUG_dp - printf("...deleting %s\n", path); -#endif /* DEBUG_dp */ + PRINTF("...deleting %s\n", path); PR_Lock(mregLock); err = NR_RegDeleteKey(mReg, baseKey, (char *)path); PR_Unlock(mregLock); @@ -1133,9 +1129,7 @@ NS_IMETHODIMP nsRegistry::RemoveSubtreeRaw( nsRegistryKey baseKey, const char *k subkeyname[0] = '\0'; while (NR_RegEnumSubkeys(mReg, key, &state, subkeyname, n, REGENUM_NORMAL) == REGERR_OK) { -#ifdef DEBUG_dp - printf("...recursing into %s\n", subkeyname); -#endif /* DEBUG_dp */ + PRINTF("...recursing into %s\n", subkeyname); err = RemoveSubtreeRaw(key, subkeyname); if (err != REGERR_OK) break; } @@ -1143,9 +1137,7 @@ NS_IMETHODIMP nsRegistry::RemoveSubtreeRaw( nsRegistryKey baseKey, const char *k // If success in deleting all subkeys, delete this key too if (err == REGERR_OK) { -#ifdef DEBUG_dp - printf("...deleting %s\n", keyname); -#endif /* DEBUG_dp */ + PRINTF("...deleting %s\n", keyname); PR_Lock(mregLock); err = NR_RegDeleteKeyRaw(mReg, baseKey, (char *)keyname); PR_Unlock(mregLock); diff --git a/mozilla/modules/libutil/src/stopwatch.cpp b/mozilla/modules/libutil/src/stopwatch.cpp index 0934f0419c1..d9a841d743e 100644 --- a/mozilla/modules/libutil/src/stopwatch.cpp +++ b/mozilla/modules/libutil/src/stopwatch.cpp @@ -8,6 +8,11 @@ #ifdef XP_WIN #include "windows.h" #endif +#include "nslog.h" + +NS_IMPL_LOG(stopwatchLog) +#define PRINTF NS_LOG_PRINTF(stopwatchLog) +#define FLUSH NS_LOG_FLUSH(stopwatchLog) // #define MILLISECOND_RESOLUTION to track time with greater precision // If not defined the resolution is to the second only @@ -227,7 +232,7 @@ double Stopwatch::GetCPUTime(){ &ftUser.ftFileTime); if (ret != PR_TRUE){ ret = GetLastError (); - printf("%s 0x%lx\n"," Error on GetProcessTimes", (int)ret); + PRINTF("%s 0x%lx\n"," Error on GetProcessTimes", (int)ret); } /* @@ -263,7 +268,7 @@ void Stopwatch::Print(void) { #ifdef MOZ_PERF_METRICS RAPTOR_STOPWATCH_TRACE(("Real time %d:%d:%d.%d, CP time %.3f\n", hours, min, sec, ms, CpuTime())); #else - printf("Real time %d:%d:%d.%d, CP time %.3f\n", hours, min, sec, ms, CpuTime()); + PRINTF("Real time %d:%d:%d.%d, CP time %.3f\n", hours, min, sec, ms, CpuTime()); #endif } diff --git a/mozilla/modules/plugin/bad/badapter.cpp b/mozilla/modules/plugin/bad/badapter.cpp index 7d9cabe08fa..f75c867662d 100644 --- a/mozilla/modules/plugin/bad/badapter.cpp +++ b/mozilla/modules/plugin/bad/badapter.cpp @@ -40,6 +40,11 @@ #include "nsLiveConnect.h" #include "nsplugin.h" #include "nsDebug.h" +#include "nslog.h" + +NS_IMPL_LOG(badapterLog, 0) +#define PRINTF NS_LOG_PRINTF(badapterLog) +#define FLUSH NS_LOG_FLUSH(badapterLog) //////////////////////////////////////////////////////////////////////////////// // SECTION 3 - Classes @@ -577,22 +582,22 @@ nsresult fromNPError[] = { char* NPP_GetMIMEDescription(void) { int freeFac = 0; - //fprintf(stderr, "MIME description\n"); + PRINTF("MIME description\n"); if (thePlugin == NULL) { freeFac = 1; NSGetFactory(thePluginManager, kPluginCID, NULL, NULL, (nsIFactory** )&thePlugin); } - //fprintf(stderr, "Allocated Plugin 0x%08x\n", thePlugin); + PRINTF("Allocated Plugin 0x%08x\n", thePlugin); const char * ret; nsresult err = thePlugin->GetMIMEDescription(&ret); if (err) return NULL; - //fprintf(stderr, "Get response %s\n", ret); + PRINTF("Get response %s\n", ret); if (freeFac) { - //fprintf(stderr, "Freeing plugin..."); + PRINTF("Freeing plugin..."); thePlugin->Release(); thePlugin = NULL; } - //fprintf(stderr, "Done\n"); + PRINTF("Done\n"); return (char*)ret; } @@ -618,22 +623,22 @@ NPP_SetValue(NPP instance, NPNVariable variable, void *value) NPError NPP_GetValue(NPP instance, NPPVariable variable, void *value) { int freeFac = 0; - //fprintf(stderr, "MIME description\n"); + PRINTF("MIME description\n"); if (thePlugin == NULL) { freeFac = 1; if (NSGetFactory(thePluginManager, kPluginCID, NULL, NULL, (nsIFactory** )&thePlugin) != NS_OK) return NPERR_GENERIC_ERROR; } - //fprintf(stderr, "Allocated Plugin 0x%08x\n", thePlugin); + PRINTF("Allocated Plugin 0x%08x\n", thePlugin); nsresult err = thePlugin->GetValue((nsPluginVariable)variable, value); if (err) return NPERR_GENERIC_ERROR; - //fprintf(stderr, "Get response %08x\n", ret); + PRINTF("Get response %08x\n", ret); if (freeFac) { - //fprintf(stderr, "Freeing plugin..."); + PRINTF("Freeing plugin..."); thePlugin->Release(); thePlugin = NULL; } - //fprintf(stderr, "Done\n"); + PRINTF("Done\n"); return NPERR_NO_ERROR; } #endif // XP_UNIX diff --git a/mozilla/modules/plugin/base/src/ns4xPlugin.cpp b/mozilla/modules/plugin/base/src/ns4xPlugin.cpp index 56d4b1d17a0..17d7b6fd777 100644 --- a/mozilla/modules/plugin/base/src/ns4xPlugin.cpp +++ b/mozilla/modules/plugin/base/src/ns4xPlugin.cpp @@ -37,6 +37,11 @@ #endif #include "nsIPref.h" +#include "nslog.h" + +NS_IMPL_LOG(ns4xPluginLog, 0) +#define PRINTF NS_LOG_PRINTF(ns4xPluginLog) +#define FLUSH NS_LOG_FLUSH(ns4xPluginLog) static NS_DEFINE_CID(kPrefServiceCID, NS_PREF_CID); static NS_DEFINE_IID(kCPluginManagerCID, NS_PLUGINMANAGER_CID); @@ -203,7 +208,7 @@ ns4xPlugin::CreatePlugin(nsIServiceManager* aServiceMgr, } #ifdef NS_DEBUG - printf("debug: edburns ns4xPlugin::CreatePlugin\n"); + PRINTF("debug: edburns ns4xPlugin::CreatePlugin\n"); #endif #ifdef XP_UNIX @@ -215,7 +220,7 @@ ns4xPlugin::CreatePlugin(nsIServiceManager* aServiceMgr, callbacks.size = sizeof(callbacks); #ifdef NS_DEBUG - printf("debug: edburns ns4xPlugin::CreatePlugin: cleared callbacks\n"); + PRINTF("debug: edburns ns4xPlugin::CreatePlugin: cleared callbacks\n"); #endif NP_PLUGINSHUTDOWN pfnShutdown = @@ -244,8 +249,8 @@ ns4xPlugin::CreatePlugin(nsIServiceManager* aServiceMgr, return NS_ERROR_UNEXPECTED; #ifdef NS_DEBUG - printf("debug: edburns: ns4xPlugin::CreatePlugin: callbacks->newstream: %p\n", - callbacks.newstream); + PRINTF("debug: edburns: ns4xPlugin::CreatePlugin: callbacks->newstream: %p\n", + callbacks.newstream); #endif // now copy function table back to ns4xPlugin instance @@ -432,7 +437,7 @@ ns4xPlugin::Shutdown(void) if (nsnull != fShutdownEntry) { #ifdef NS_DEBUG - printf("shutting down plugin %08x\n",(int)this); + PRINTF("shutting down plugin %08x\n",(int)this); #endif #ifdef XP_MAC #if !TARGET_CARBON @@ -454,7 +459,7 @@ nsresult ns4xPlugin::GetMIMEDescription(const char* *resultingDesc) { #ifdef NS_DEBUG - printf("plugin getmimedescription called\n"); + PRINTF("plugin getmimedescription called\n"); #endif const char* (*npGetMIMEDescrpition)() = (const char* (*)()) PR_FindSymbol(fLibrary, "NP_GetMIMEDescription"); @@ -467,7 +472,7 @@ nsresult ns4xPlugin::GetValue(nsPluginVariable variable, void *value) { #ifdef NS_DEBUG - printf("plugin getvalue %d called\n", variable); + PRINTF("plugin getvalue %d called\n", variable); #endif NPError (*npGetValue)(void*, nsPluginVariable, void*) = diff --git a/mozilla/modules/plugin/base/src/ns4xPluginInstance.cpp b/mozilla/modules/plugin/base/src/ns4xPluginInstance.cpp index 10883910cb2..b37dba4f08c 100644 --- a/mozilla/modules/plugin/base/src/ns4xPluginInstance.cpp +++ b/mozilla/modules/plugin/base/src/ns4xPluginInstance.cpp @@ -36,6 +36,11 @@ #include "nsPluginSafety.h" #include "nsIPref.h" // needed for NS_TRY_SAFE_CALL_* +#include "nslog.h" + +NS_IMPL_LOG(ns4xPluginInstanceLog) +#define PRINTF NS_LOG_PRINTF(ns4xPluginInstanceLog) +#define FLUSH NS_LOG_FLUSH(ns4xPluginInstanceLog) static NS_DEFINE_CID(kPrefServiceCID, NS_PREF_CID); // needed for NS_TRY_SAFE_CALL_* static NS_DEFINE_IID(kCPluginManagerCID, NS_PLUGINMANAGER_CID); @@ -384,7 +389,7 @@ ns4xPluginInstance :: ns4xPluginInstance(NPPluginFuncs* callbacks, PRLibrary* aL ns4xPluginInstance :: ~ns4xPluginInstance(void) { #ifdef NS_DEBUG - printf("ns4xPluginInstance::~ns4xPluginInstance()\n"); + PRINTF("ns4xPluginInstance::~ns4xPluginInstance()\n"); #endif #if defined(MOZ_WIDGET_GTK) if (mXtBin) @@ -428,7 +433,7 @@ NS_IMETHODIMP ns4xPluginInstance::GetPeer(nsIPluginInstancePeer* *resultingPeer) NS_IMETHODIMP ns4xPluginInstance::Start(void) { #ifdef NS_DEBUG - printf("Inside ns4xPluginInstance::Start(void)...\n"); + PRINTF("Inside ns4xPluginInstance::Start(void)...\n"); #endif if(mStarted) @@ -442,7 +447,7 @@ NS_IMETHODIMP ns4xPluginInstance::Stop(void) NPError error; #ifdef NS_DEBUG - printf("ns4xPluginInstance::Stop()\n"); + PRINTF("ns4xPluginInstance::Stop()\n"); #endif #ifdef MOZ_WIDGET_GTK @@ -541,7 +546,7 @@ NS_IMETHODIMP ns4xPluginInstance::SetWindow(nsPluginWindow* window) // XXX 4.x plugins don't want a SetWindow(NULL). #ifdef NS_DEBUG - printf("Inside ns4xPluginInstance::SetWindow(%p)...\n", window); + PRINTF("Inside ns4xPluginInstance::SetWindow(%p)...\n", window); #endif if (!window || !mStarted) @@ -553,7 +558,7 @@ NS_IMETHODIMP ns4xPluginInstance::SetWindow(nsPluginWindow* window) // Allocate and fill out the ws_info data if (!window->ws_info) { #ifdef NS_DEBUG - printf("About to create new ws_info...\n"); + PRINTF("About to create new ws_info...\n"); #endif // allocate a new NPSetWindowCallbackStruct structure at ws_info @@ -567,10 +572,8 @@ NS_IMETHODIMP ns4xPluginInstance::SetWindow(nsPluginWindow* window) GdkWindow *win = gdk_window_lookup((XID)window->window); if (win) { -#ifdef NS_DEBUG - printf("About to create new xtbin of %i X %i from %p...\n", + PRINTF("About to create new xtbin of %i X %i from %p...\n", window->width, window->height, win); -#endif #if 1 // if we destroyed the plugin when we left the page, we could remove this @@ -598,11 +601,11 @@ NS_IMETHODIMP ns4xPluginInstance::SetWindow(nsPluginWindow* window) gtk_widget_set_usize(mXtBin, window->width, window->height); #ifdef NS_DEBUG - printf("About to show xtbin(%p)...\n", mXtBin); fflush(NULL); + PRINTF("About to show xtbin(%p)...\n", mXtBin); fflush(NULL); #endif gtk_widget_show(mXtBin); #ifdef NS_DEBUG - printf("completed gtk_widget_show(%p)\n", mXtBin); fflush(NULL); + PRINTF("completed gtk_widget_show(%p)\n", mXtBin); fflush(NULL); #endif } @@ -630,7 +633,7 @@ NS_IMETHODIMP ns4xPluginInstance::SetWindow(nsPluginWindow* window) // relies on routine descriptors, not present in carbon. We // need to fix this. #ifdef NS_DEBUG - printf("About to call CallNPP_SetWindowProc()...\n"); + PRINTF("About to call CallNPP_SetWindowProc()...\n"); fflush(NULL); #endif @@ -646,7 +649,7 @@ NS_IMETHODIMP ns4xPluginInstance::SetWindow(nsPluginWindow* window) } #ifdef NS_DEBUG - printf("Falling out of ns4xPluginInstance::SetWindow()...\n"); + PRINTF("Falling out of ns4xPluginInstance::SetWindow()...\n"); #endif return NS_OK; } diff --git a/mozilla/modules/plugin/base/src/nsPluginHostImpl.cpp b/mozilla/modules/plugin/base/src/nsPluginHostImpl.cpp index 19ed8775c7c..5171c5b027e 100644 --- a/mozilla/modules/plugin/base/src/nsPluginHostImpl.cpp +++ b/mozilla/modules/plugin/base/src/nsPluginHostImpl.cpp @@ -50,6 +50,11 @@ #include "nsNetUtil.h" #include "nsIProgressEventSink.h" #include "nsIDocument.h" +#include "nslog.h" + +NS_IMPL_LOG(nsPluginHostImplLog, 0) +#define PRINTF NS_LOG_PRINTF(nsPluginHostImplLog) +#define FLUSH NS_LOG_FLUSH(nsPluginHostImplLog) // Friggin' X11 has to "#define None". Lame! #ifdef None @@ -981,7 +986,7 @@ nsPluginStreamListenerPeer::~nsPluginStreamListenerPeer() { char* spec; (void)mURL->GetSpec(&spec); - printf("killing stream for %s\n", mURL ? spec : "(unknown URL)"); + PRINTF("killing stream for %s\n", mURL ? spec : "(unknown URL)"); nsCRT::free(spec); } #endif @@ -1037,7 +1042,7 @@ nsresult nsPluginStreamListenerPeer::Initialize(nsIURI *aURL, #ifdef NS_DEBUG char* spec; (void)aURL->GetSpec(&spec); - printf("created stream for %s\n", spec); + PRINTF("created stream for %s\n", spec); nsCRT::free(spec); #endif @@ -1070,7 +1075,7 @@ nsresult nsPluginStreamListenerPeer::InitializeEmbeded(nsIURI *aURL, #ifdef NS_DEBUG char* spec; (void)aURL->GetSpec(&spec); - printf("created stream for %s\n", spec); + PRINTF("created stream for %s\n", spec); nsCRT::free(spec); #endif @@ -1102,8 +1107,8 @@ nsresult nsPluginStreamListenerPeer::InitializeEmbeded(nsIURI *aURL, nsresult nsPluginStreamListenerPeer::InitializeFullPage(nsIPluginInstance *aInstance) { #ifdef NS_DEBUG - printf("created stream for (unknown URL)\n"); - printf("Inside nsPluginStreamListenerPeer::InitializeFullPage...\n"); + PRINTF("created stream for (unknown URL)\n"); + PRINTF("Inside nsPluginStreamListenerPeer::InitializeFullPage...\n"); #endif NS_ASSERTION(mInstance == nsnull, "nsPluginStreamListenerPeer::InitializeFullPage mInstance != nsnull"); @@ -1474,7 +1479,7 @@ nsPluginHostImpl::nsPluginHostImpl() nsPluginHostImpl::~nsPluginHostImpl() { #ifdef NS_DEBUG -printf("killing plugin host\n"); + PRINTF("killing plugin host\n"); #endif Destroy(); if (nsnull != mPluginPath) @@ -2074,13 +2079,13 @@ NS_IMETHODIMP nsPluginHostImpl::InstantiateEmbededPlugin(const char *aMimeType, #ifdef NS_DEBUG if(aMimeType) - printf("InstantiateEmbededPlugin for %s\n",aMimeType); + PRINTF("InstantiateEmbededPlugin for %s\n",aMimeType); #endif if(FindStoppedPluginForURL(aURL, aOwner) == NS_OK) { #ifdef NS_DEBUG - printf("InstantiateEmbededPlugin find stopped\n"); + PRINTF("InstantiateEmbededPlugin find stopped\n"); #endif aOwner->GetInstance(instance); @@ -2185,7 +2190,7 @@ NS_IMETHODIMP nsPluginHostImpl::InstantiateEmbededPlugin(const char *aMimeType, } #ifdef NS_DEBUG - printf("InstantiateEmbededPlugin.. returning\n"); + PRINTF("InstantiateEmbededPlugin.. returning\n"); #endif return rv; } @@ -2202,7 +2207,7 @@ NS_IMETHODIMP nsPluginHostImpl::InstantiateFullPagePlugin(const char *aMimeType, PRBool isJavaEnabled = PR_TRUE; #ifdef NS_DEBUG - printf("InstantiateFullPagePlugin for %s\n",aMimeType); + PRINTF("InstantiateFullPagePlugin for %s\n",aMimeType); #endif //create a URL so that the instantiator can do file ext. @@ -2215,7 +2220,7 @@ NS_IMETHODIMP nsPluginHostImpl::InstantiateFullPagePlugin(const char *aMimeType, if(FindStoppedPluginForURL(url, aOwner) == NS_OK) { #ifdef NS_DEBUG - printf("InstantiateFullPagePlugin, got a stopped plugin\n"); + PRINTF("InstantiateFullPagePlugin, got a stopped plugin\n"); #endif nsIPluginInstance* instance; @@ -2236,7 +2241,7 @@ NS_IMETHODIMP nsPluginHostImpl::InstantiateFullPagePlugin(const char *aMimeType, nsPluginWindow *window = nsnull; #ifdef NS_DEBUG - printf("InstantiateFullPagePlugin, got it... now stream\n"); + PRINTF("InstantiateFullPagePlugin, got it... now stream\n"); #endif //we got a plugin built, now stream @@ -2259,7 +2264,7 @@ NS_IMETHODIMP nsPluginHostImpl::InstantiateFullPagePlugin(const char *aMimeType, } #ifdef NS_DEBUG - printf("Falling out of InstantiateFullPagePlugin...\n"); + PRINTF("Falling out of InstantiateFullPagePlugin...\n"); #endif return rv; } @@ -2272,7 +2277,7 @@ nsresult nsPluginHostImpl::FindStoppedPluginForURL(nsIURI* aURL, return NS_ERROR_FAILURE; #ifdef NS_DEBUG - printf("Inside nsPluginHostImpl::FindStoppedPluginForURL...\n"); + PRINTF("Inside nsPluginHostImpl::FindStoppedPluginForURL...\n"); #endif (void)aURL->GetSpec(&url); @@ -2844,7 +2849,7 @@ NS_IMETHODIMP nsPluginHostImpl::GetPluginFactory(const char *aMimeType, nsIPlugi #ifdef XP_WIN // actually load a dll on Windows #ifdef NS_DEBUG - printf("For %s found plugin %s\n", aMimeType, pluginTag->mFileName); + PRINTF("For %s found plugin %s\n", aMimeType, pluginTag->mFileName); #endif nsFileSpec file(pluginTag->mFileName); diff --git a/mozilla/modules/plugin/base/src/nsPluginInstancePeer.cpp b/mozilla/modules/plugin/base/src/nsPluginInstancePeer.cpp index 768a0fb2648..c1c4a12206b 100644 --- a/mozilla/modules/plugin/base/src/nsPluginInstancePeer.cpp +++ b/mozilla/modules/plugin/base/src/nsPluginInstancePeer.cpp @@ -44,6 +44,12 @@ #include "winbase.h" #endif +#include "nslog.h" + +NS_IMPL_LOG(nsPluginInstancePeerLog, 0) +#define PRINTF NS_LOG_PRINTF(nsPluginInstancePeerLog) +#define FLUSH NS_LOG_FLUSH(nsPluginInstancePeerLog) + nsPluginInstancePeerImpl::nsPluginInstancePeerImpl() { NS_INIT_REFCNT(); @@ -126,7 +132,7 @@ nsresult nsPluginInstancePeerImpl::QueryInterface(const nsIID& iid, void** insta NS_IMETHODIMP nsPluginInstancePeerImpl::GetValue(nsPluginInstancePeerVariable variable, void *value) { -printf("instance peer getvalue %d called\n", variable); + PRINTF("instance peer getvalue %d called\n", variable); return NS_ERROR_FAILURE; } @@ -226,7 +232,7 @@ nsPluginStreamToFile::nsPluginStreamToFile(const char* target, nsIPluginInstance // construct the URL we'll use later in calls to GetURL() mFileURL = mFileSpec; - printf("File URL = %s\n", mFileURL.GetAsString()); + PRINTF("File URL = %s\n", mFileURL.GetAsString()); } nsPluginStreamToFile::~nsPluginStreamToFile() @@ -833,7 +839,7 @@ NS_IMETHODIMP nsPluginInstancePeerImpl::GetMayScript(PRBool *result) NS_IMETHODIMP nsPluginInstancePeerImpl::SetWindowSize(PRUint32 width, PRUint32 height) { -printf("instance peer setwindowsize called\n"); + PRINTF("instance peer setwindowsize called\n"); return NS_OK; } diff --git a/mozilla/modules/plugin/base/src/nsPluginViewer.cpp b/mozilla/modules/plugin/base/src/nsPluginViewer.cpp index a3f070dffc6..f0d7ecb3ed3 100644 --- a/mozilla/modules/plugin/base/src/nsPluginViewer.cpp +++ b/mozilla/modules/plugin/base/src/nsPluginViewer.cpp @@ -43,6 +43,11 @@ #include "nsIWebBrowserChrome.h" #include "nsIDOMDocument.h" #include "nsPluginViewer.h" +#include "nslog.h" + +NS_IMPL_LOG(nsPluginViewerLog, 0) +#define PRINTF NS_LOG_PRINTF(nsPluginViewerLog) +#define FLUSH NS_LOG_FLUSH(nsPluginViewerLog) // Class IDs static NS_DEFINE_IID(kChildWindowCID, NS_CHILD_CID); @@ -266,9 +271,7 @@ PluginViewerImpl::~PluginViewerImpl() NS_IMETHODIMP PluginViewerImpl::BindToDocument(nsISupports *aDoc, const char *aCommand) { -#ifdef NS_DEBUG - printf("PluginViewerImpl::BindToDocument\n"); -#endif + PRINTF("PluginViewerImpl::BindToDocument\n"); return aDoc->QueryInterface(kIDocumentIID, (void**)&mDocument); return NS_OK; } @@ -319,7 +322,7 @@ PluginViewerImpl::StartLoad(nsIChannel* channel, nsIStreamListener*& aResult) #ifdef DEBUG char* contentType; mChannel->GetContentType(&contentType); - printf("PluginViewerImpl::StartLoad: content-type=%s\n", contentType); + PRINTF("PluginViewerImpl::StartLoad: content-type=%s\n", contentType); nsCRT::free(contentType); #endif diff --git a/mozilla/modules/plugin/base/src/nsPluginsDirBeOS.cpp b/mozilla/modules/plugin/base/src/nsPluginsDirBeOS.cpp index 3b485653e8e..4d04267d7ba 100644 --- a/mozilla/modules/plugin/base/src/nsPluginsDirBeOS.cpp +++ b/mozilla/modules/plugin/base/src/nsPluginsDirBeOS.cpp @@ -32,6 +32,11 @@ #include "prlink.h" #include "plstr.h" #include "prmem.h" +#include "nslog.h" + +NS_IMPL_LOG(nsPluginsDirBeOSLog, 0) +#define PRINTF NS_LOG_PRINTF(nsPluginsDirBeOSLog) +#define FLUSH NS_LOG_FLUSH(nsPluginsDirBeOSLog) #include "nsSpecialSystemDirectory.h" @@ -97,9 +102,7 @@ PRBool nsPluginsDir::IsPluginFile(const nsFileSpec& fileSpec) { const char* pathname = fileSpec.GetCString(); -#ifdef NS_DEBUG - printf("IsPluginFile(%s)\n", pathname); -#endif + PRINTF("IsPluginFile(%s)\n", pathname); return PR_TRUE; } @@ -128,9 +131,7 @@ nsresult nsPluginFile::LoadPlugin(PRLibrary* &outLibrary) const char* path = this->GetCString(); pLibrary = outLibrary = PR_LoadLibrary(path); -#ifdef NS_DEBUG - printf("LoadPlugin() %s returned %lx\n",path,(unsigned long)pLibrary); -#endif + PRINTF("LoadPlugin() %s returned %lx\n",path,(unsigned long)pLibrary); return NS_OK; } @@ -153,18 +154,14 @@ nsresult nsPluginFile::GetPluginInfo(nsPluginInfo& info) if((procedure = (BeOS_Plugin_GetMIMEDescription)PR_FindSymbol(pLibrary,"NP_GetMIMEDescription")) != 0) { mimedescr = procedure(); } else { -#ifdef NS_DEBUG - printf("Cannot get plugin info: no GetMIMEDescription procedure!\n"); -#endif + PRINTF("Cannot get plugin info: no GetMIMEDescription procedure!\n"); return NS_ERROR_FAILURE; } info.fName = GetFileName(path); -#ifdef NS_DEBUG - printf("GetMIMEDescription() %lx returned \"%s\"\n", + PRINTF("GetMIMEDescription() %lx returned \"%s\"\n", (unsigned long)procedure, mimedescr); -#endif // copy string @@ -202,9 +199,7 @@ nsresult nsPluginFile::GetPluginInfo(nsPluginInfo& info) if(descr) *descr++=0; -#ifdef NS_DEBUG - printf("Registering plugin for: \"%s\",\"%s\",\"%s\"\n", mtype,descr ? descr : "null",exten ? exten : "null"); -#endif + PRINTF("Registering plugin for: \"%s\",\"%s\",\"%s\"\n", mtype,descr ? descr : "null",exten ? exten : "null"); if(!*mtype && !descr && !exten) { i--; diff --git a/mozilla/modules/plugin/base/src/nsPluginsDirWin.cpp b/mozilla/modules/plugin/base/src/nsPluginsDirWin.cpp index e6abe2ef035..2763c1dfdcb 100644 --- a/mozilla/modules/plugin/base/src/nsPluginsDirWin.cpp +++ b/mozilla/modules/plugin/base/src/nsPluginsDirWin.cpp @@ -38,6 +38,11 @@ #include "winbase.h" #include "nsSpecialSystemDirectory.h" +#include "nslog.h" + +NS_IMPL_LOG(nsPluginsDirWinLog, 0) +#define PRINTF NS_LOG_PRINTF(nsPluginsDirWinLog) +#define FLUSH NS_LOG_FLUSH(nsPluginsDirWinLog) /////////////////////////////////////////////////////////////////////////// @@ -209,7 +214,7 @@ nsPluginsDir::nsPluginsDir(PRUint16 location) #ifdef NS_DEBUG if (path[0] != 0) - printf("plugins at: %s\n", path); + PRINTF("plugins at: %s\n", path); #endif } diff --git a/mozilla/modules/plugin/default/unix/npshell.c b/mozilla/modules/plugin/default/unix/npshell.c index 494769b8a32..9e43d9738ac 100644 --- a/mozilla/modules/plugin/default/unix/npshell.c +++ b/mozilla/modules/plugin/default/unix/npshell.c @@ -44,6 +44,11 @@ #include "npapi.h" #include "nullplugin.h" #include "strings.h" +#include "nslog.h" + +NS_IMPL_LOG(npshellLog, 0) +#define PRINTF NS_LOG_PRINTF(npshellLog) +#define FLUSH NS_LOG_FLUSH(npshellLog) /*********************************************************************** * @@ -201,11 +206,11 @@ NPP_SetWindow(NPP instance, NPWindow* window) id. */ #ifdef DEBUG - fprintf(stderr, "Nullplugin: plugin received window resize.\n"); - fprintf(stderr, "Window=(%i)\n", (int)window); + PRINTF("Nullplugin: plugin received window resize.\n"); + PRINTF("Window=(%i)\n", (int)window); if (window) { - fprintf(stderr, "W=(%i) H=(%i)\n", - (int)window->width, (int)window->height); + PRINTF("W=(%i) H=(%i)\n", + (int)window->width, (int)window->height); } #endif return NPERR_NO_ERROR; diff --git a/mozilla/modules/plugin/default/unix/npunix.c b/mozilla/modules/plugin/default/unix/npunix.c index 2f6d2e57823..8c8a885ba12 100644 --- a/mozilla/modules/plugin/default/unix/npunix.c +++ b/mozilla/modules/plugin/default/unix/npunix.c @@ -40,6 +40,11 @@ #include #include "npapi.h" #include "npupp.h" +#include "nslog.h" + +NS_IMPL_LOG(npunixLog, 0) +#define PRINTF NS_LOG_PRINTF(npunixLog) +#define FLUSH NS_LOG_FLUSH(npunixLog) /* * Define PLUGIN_TRACE to have the wrapper functions print @@ -48,7 +53,7 @@ #ifdef PLUGIN_TRACE #include -#define PLUGINDEBUGSTR(msg) fprintf(stderr, "%s\n", msg) +#define PLUGINDEBUGSTR(msg) PRINTF("%s\n", msg) #else #define PLUGINDEBUGSTR(msg) #endif diff --git a/mozilla/modules/plugin/nglsrc/ns4xPlugin.cpp b/mozilla/modules/plugin/nglsrc/ns4xPlugin.cpp index 56d4b1d17a0..17d7b6fd777 100644 --- a/mozilla/modules/plugin/nglsrc/ns4xPlugin.cpp +++ b/mozilla/modules/plugin/nglsrc/ns4xPlugin.cpp @@ -37,6 +37,11 @@ #endif #include "nsIPref.h" +#include "nslog.h" + +NS_IMPL_LOG(ns4xPluginLog, 0) +#define PRINTF NS_LOG_PRINTF(ns4xPluginLog) +#define FLUSH NS_LOG_FLUSH(ns4xPluginLog) static NS_DEFINE_CID(kPrefServiceCID, NS_PREF_CID); static NS_DEFINE_IID(kCPluginManagerCID, NS_PLUGINMANAGER_CID); @@ -203,7 +208,7 @@ ns4xPlugin::CreatePlugin(nsIServiceManager* aServiceMgr, } #ifdef NS_DEBUG - printf("debug: edburns ns4xPlugin::CreatePlugin\n"); + PRINTF("debug: edburns ns4xPlugin::CreatePlugin\n"); #endif #ifdef XP_UNIX @@ -215,7 +220,7 @@ ns4xPlugin::CreatePlugin(nsIServiceManager* aServiceMgr, callbacks.size = sizeof(callbacks); #ifdef NS_DEBUG - printf("debug: edburns ns4xPlugin::CreatePlugin: cleared callbacks\n"); + PRINTF("debug: edburns ns4xPlugin::CreatePlugin: cleared callbacks\n"); #endif NP_PLUGINSHUTDOWN pfnShutdown = @@ -244,8 +249,8 @@ ns4xPlugin::CreatePlugin(nsIServiceManager* aServiceMgr, return NS_ERROR_UNEXPECTED; #ifdef NS_DEBUG - printf("debug: edburns: ns4xPlugin::CreatePlugin: callbacks->newstream: %p\n", - callbacks.newstream); + PRINTF("debug: edburns: ns4xPlugin::CreatePlugin: callbacks->newstream: %p\n", + callbacks.newstream); #endif // now copy function table back to ns4xPlugin instance @@ -432,7 +437,7 @@ ns4xPlugin::Shutdown(void) if (nsnull != fShutdownEntry) { #ifdef NS_DEBUG - printf("shutting down plugin %08x\n",(int)this); + PRINTF("shutting down plugin %08x\n",(int)this); #endif #ifdef XP_MAC #if !TARGET_CARBON @@ -454,7 +459,7 @@ nsresult ns4xPlugin::GetMIMEDescription(const char* *resultingDesc) { #ifdef NS_DEBUG - printf("plugin getmimedescription called\n"); + PRINTF("plugin getmimedescription called\n"); #endif const char* (*npGetMIMEDescrpition)() = (const char* (*)()) PR_FindSymbol(fLibrary, "NP_GetMIMEDescription"); @@ -467,7 +472,7 @@ nsresult ns4xPlugin::GetValue(nsPluginVariable variable, void *value) { #ifdef NS_DEBUG - printf("plugin getvalue %d called\n", variable); + PRINTF("plugin getvalue %d called\n", variable); #endif NPError (*npGetValue)(void*, nsPluginVariable, void*) = diff --git a/mozilla/modules/plugin/nglsrc/ns4xPluginInstance.cpp b/mozilla/modules/plugin/nglsrc/ns4xPluginInstance.cpp index 10883910cb2..b37dba4f08c 100644 --- a/mozilla/modules/plugin/nglsrc/ns4xPluginInstance.cpp +++ b/mozilla/modules/plugin/nglsrc/ns4xPluginInstance.cpp @@ -36,6 +36,11 @@ #include "nsPluginSafety.h" #include "nsIPref.h" // needed for NS_TRY_SAFE_CALL_* +#include "nslog.h" + +NS_IMPL_LOG(ns4xPluginInstanceLog) +#define PRINTF NS_LOG_PRINTF(ns4xPluginInstanceLog) +#define FLUSH NS_LOG_FLUSH(ns4xPluginInstanceLog) static NS_DEFINE_CID(kPrefServiceCID, NS_PREF_CID); // needed for NS_TRY_SAFE_CALL_* static NS_DEFINE_IID(kCPluginManagerCID, NS_PLUGINMANAGER_CID); @@ -384,7 +389,7 @@ ns4xPluginInstance :: ns4xPluginInstance(NPPluginFuncs* callbacks, PRLibrary* aL ns4xPluginInstance :: ~ns4xPluginInstance(void) { #ifdef NS_DEBUG - printf("ns4xPluginInstance::~ns4xPluginInstance()\n"); + PRINTF("ns4xPluginInstance::~ns4xPluginInstance()\n"); #endif #if defined(MOZ_WIDGET_GTK) if (mXtBin) @@ -428,7 +433,7 @@ NS_IMETHODIMP ns4xPluginInstance::GetPeer(nsIPluginInstancePeer* *resultingPeer) NS_IMETHODIMP ns4xPluginInstance::Start(void) { #ifdef NS_DEBUG - printf("Inside ns4xPluginInstance::Start(void)...\n"); + PRINTF("Inside ns4xPluginInstance::Start(void)...\n"); #endif if(mStarted) @@ -442,7 +447,7 @@ NS_IMETHODIMP ns4xPluginInstance::Stop(void) NPError error; #ifdef NS_DEBUG - printf("ns4xPluginInstance::Stop()\n"); + PRINTF("ns4xPluginInstance::Stop()\n"); #endif #ifdef MOZ_WIDGET_GTK @@ -541,7 +546,7 @@ NS_IMETHODIMP ns4xPluginInstance::SetWindow(nsPluginWindow* window) // XXX 4.x plugins don't want a SetWindow(NULL). #ifdef NS_DEBUG - printf("Inside ns4xPluginInstance::SetWindow(%p)...\n", window); + PRINTF("Inside ns4xPluginInstance::SetWindow(%p)...\n", window); #endif if (!window || !mStarted) @@ -553,7 +558,7 @@ NS_IMETHODIMP ns4xPluginInstance::SetWindow(nsPluginWindow* window) // Allocate and fill out the ws_info data if (!window->ws_info) { #ifdef NS_DEBUG - printf("About to create new ws_info...\n"); + PRINTF("About to create new ws_info...\n"); #endif // allocate a new NPSetWindowCallbackStruct structure at ws_info @@ -567,10 +572,8 @@ NS_IMETHODIMP ns4xPluginInstance::SetWindow(nsPluginWindow* window) GdkWindow *win = gdk_window_lookup((XID)window->window); if (win) { -#ifdef NS_DEBUG - printf("About to create new xtbin of %i X %i from %p...\n", + PRINTF("About to create new xtbin of %i X %i from %p...\n", window->width, window->height, win); -#endif #if 1 // if we destroyed the plugin when we left the page, we could remove this @@ -598,11 +601,11 @@ NS_IMETHODIMP ns4xPluginInstance::SetWindow(nsPluginWindow* window) gtk_widget_set_usize(mXtBin, window->width, window->height); #ifdef NS_DEBUG - printf("About to show xtbin(%p)...\n", mXtBin); fflush(NULL); + PRINTF("About to show xtbin(%p)...\n", mXtBin); fflush(NULL); #endif gtk_widget_show(mXtBin); #ifdef NS_DEBUG - printf("completed gtk_widget_show(%p)\n", mXtBin); fflush(NULL); + PRINTF("completed gtk_widget_show(%p)\n", mXtBin); fflush(NULL); #endif } @@ -630,7 +633,7 @@ NS_IMETHODIMP ns4xPluginInstance::SetWindow(nsPluginWindow* window) // relies on routine descriptors, not present in carbon. We // need to fix this. #ifdef NS_DEBUG - printf("About to call CallNPP_SetWindowProc()...\n"); + PRINTF("About to call CallNPP_SetWindowProc()...\n"); fflush(NULL); #endif @@ -646,7 +649,7 @@ NS_IMETHODIMP ns4xPluginInstance::SetWindow(nsPluginWindow* window) } #ifdef NS_DEBUG - printf("Falling out of ns4xPluginInstance::SetWindow()...\n"); + PRINTF("Falling out of ns4xPluginInstance::SetWindow()...\n"); #endif return NS_OK; } diff --git a/mozilla/modules/plugin/nglsrc/nsPluginHostImpl.cpp b/mozilla/modules/plugin/nglsrc/nsPluginHostImpl.cpp index 19ed8775c7c..5171c5b027e 100644 --- a/mozilla/modules/plugin/nglsrc/nsPluginHostImpl.cpp +++ b/mozilla/modules/plugin/nglsrc/nsPluginHostImpl.cpp @@ -50,6 +50,11 @@ #include "nsNetUtil.h" #include "nsIProgressEventSink.h" #include "nsIDocument.h" +#include "nslog.h" + +NS_IMPL_LOG(nsPluginHostImplLog, 0) +#define PRINTF NS_LOG_PRINTF(nsPluginHostImplLog) +#define FLUSH NS_LOG_FLUSH(nsPluginHostImplLog) // Friggin' X11 has to "#define None". Lame! #ifdef None @@ -981,7 +986,7 @@ nsPluginStreamListenerPeer::~nsPluginStreamListenerPeer() { char* spec; (void)mURL->GetSpec(&spec); - printf("killing stream for %s\n", mURL ? spec : "(unknown URL)"); + PRINTF("killing stream for %s\n", mURL ? spec : "(unknown URL)"); nsCRT::free(spec); } #endif @@ -1037,7 +1042,7 @@ nsresult nsPluginStreamListenerPeer::Initialize(nsIURI *aURL, #ifdef NS_DEBUG char* spec; (void)aURL->GetSpec(&spec); - printf("created stream for %s\n", spec); + PRINTF("created stream for %s\n", spec); nsCRT::free(spec); #endif @@ -1070,7 +1075,7 @@ nsresult nsPluginStreamListenerPeer::InitializeEmbeded(nsIURI *aURL, #ifdef NS_DEBUG char* spec; (void)aURL->GetSpec(&spec); - printf("created stream for %s\n", spec); + PRINTF("created stream for %s\n", spec); nsCRT::free(spec); #endif @@ -1102,8 +1107,8 @@ nsresult nsPluginStreamListenerPeer::InitializeEmbeded(nsIURI *aURL, nsresult nsPluginStreamListenerPeer::InitializeFullPage(nsIPluginInstance *aInstance) { #ifdef NS_DEBUG - printf("created stream for (unknown URL)\n"); - printf("Inside nsPluginStreamListenerPeer::InitializeFullPage...\n"); + PRINTF("created stream for (unknown URL)\n"); + PRINTF("Inside nsPluginStreamListenerPeer::InitializeFullPage...\n"); #endif NS_ASSERTION(mInstance == nsnull, "nsPluginStreamListenerPeer::InitializeFullPage mInstance != nsnull"); @@ -1474,7 +1479,7 @@ nsPluginHostImpl::nsPluginHostImpl() nsPluginHostImpl::~nsPluginHostImpl() { #ifdef NS_DEBUG -printf("killing plugin host\n"); + PRINTF("killing plugin host\n"); #endif Destroy(); if (nsnull != mPluginPath) @@ -2074,13 +2079,13 @@ NS_IMETHODIMP nsPluginHostImpl::InstantiateEmbededPlugin(const char *aMimeType, #ifdef NS_DEBUG if(aMimeType) - printf("InstantiateEmbededPlugin for %s\n",aMimeType); + PRINTF("InstantiateEmbededPlugin for %s\n",aMimeType); #endif if(FindStoppedPluginForURL(aURL, aOwner) == NS_OK) { #ifdef NS_DEBUG - printf("InstantiateEmbededPlugin find stopped\n"); + PRINTF("InstantiateEmbededPlugin find stopped\n"); #endif aOwner->GetInstance(instance); @@ -2185,7 +2190,7 @@ NS_IMETHODIMP nsPluginHostImpl::InstantiateEmbededPlugin(const char *aMimeType, } #ifdef NS_DEBUG - printf("InstantiateEmbededPlugin.. returning\n"); + PRINTF("InstantiateEmbededPlugin.. returning\n"); #endif return rv; } @@ -2202,7 +2207,7 @@ NS_IMETHODIMP nsPluginHostImpl::InstantiateFullPagePlugin(const char *aMimeType, PRBool isJavaEnabled = PR_TRUE; #ifdef NS_DEBUG - printf("InstantiateFullPagePlugin for %s\n",aMimeType); + PRINTF("InstantiateFullPagePlugin for %s\n",aMimeType); #endif //create a URL so that the instantiator can do file ext. @@ -2215,7 +2220,7 @@ NS_IMETHODIMP nsPluginHostImpl::InstantiateFullPagePlugin(const char *aMimeType, if(FindStoppedPluginForURL(url, aOwner) == NS_OK) { #ifdef NS_DEBUG - printf("InstantiateFullPagePlugin, got a stopped plugin\n"); + PRINTF("InstantiateFullPagePlugin, got a stopped plugin\n"); #endif nsIPluginInstance* instance; @@ -2236,7 +2241,7 @@ NS_IMETHODIMP nsPluginHostImpl::InstantiateFullPagePlugin(const char *aMimeType, nsPluginWindow *window = nsnull; #ifdef NS_DEBUG - printf("InstantiateFullPagePlugin, got it... now stream\n"); + PRINTF("InstantiateFullPagePlugin, got it... now stream\n"); #endif //we got a plugin built, now stream @@ -2259,7 +2264,7 @@ NS_IMETHODIMP nsPluginHostImpl::InstantiateFullPagePlugin(const char *aMimeType, } #ifdef NS_DEBUG - printf("Falling out of InstantiateFullPagePlugin...\n"); + PRINTF("Falling out of InstantiateFullPagePlugin...\n"); #endif return rv; } @@ -2272,7 +2277,7 @@ nsresult nsPluginHostImpl::FindStoppedPluginForURL(nsIURI* aURL, return NS_ERROR_FAILURE; #ifdef NS_DEBUG - printf("Inside nsPluginHostImpl::FindStoppedPluginForURL...\n"); + PRINTF("Inside nsPluginHostImpl::FindStoppedPluginForURL...\n"); #endif (void)aURL->GetSpec(&url); @@ -2844,7 +2849,7 @@ NS_IMETHODIMP nsPluginHostImpl::GetPluginFactory(const char *aMimeType, nsIPlugi #ifdef XP_WIN // actually load a dll on Windows #ifdef NS_DEBUG - printf("For %s found plugin %s\n", aMimeType, pluginTag->mFileName); + PRINTF("For %s found plugin %s\n", aMimeType, pluginTag->mFileName); #endif nsFileSpec file(pluginTag->mFileName); diff --git a/mozilla/modules/plugin/nglsrc/nsPluginInstancePeer.cpp b/mozilla/modules/plugin/nglsrc/nsPluginInstancePeer.cpp index 768a0fb2648..c1c4a12206b 100644 --- a/mozilla/modules/plugin/nglsrc/nsPluginInstancePeer.cpp +++ b/mozilla/modules/plugin/nglsrc/nsPluginInstancePeer.cpp @@ -44,6 +44,12 @@ #include "winbase.h" #endif +#include "nslog.h" + +NS_IMPL_LOG(nsPluginInstancePeerLog, 0) +#define PRINTF NS_LOG_PRINTF(nsPluginInstancePeerLog) +#define FLUSH NS_LOG_FLUSH(nsPluginInstancePeerLog) + nsPluginInstancePeerImpl::nsPluginInstancePeerImpl() { NS_INIT_REFCNT(); @@ -126,7 +132,7 @@ nsresult nsPluginInstancePeerImpl::QueryInterface(const nsIID& iid, void** insta NS_IMETHODIMP nsPluginInstancePeerImpl::GetValue(nsPluginInstancePeerVariable variable, void *value) { -printf("instance peer getvalue %d called\n", variable); + PRINTF("instance peer getvalue %d called\n", variable); return NS_ERROR_FAILURE; } @@ -226,7 +232,7 @@ nsPluginStreamToFile::nsPluginStreamToFile(const char* target, nsIPluginInstance // construct the URL we'll use later in calls to GetURL() mFileURL = mFileSpec; - printf("File URL = %s\n", mFileURL.GetAsString()); + PRINTF("File URL = %s\n", mFileURL.GetAsString()); } nsPluginStreamToFile::~nsPluginStreamToFile() @@ -833,7 +839,7 @@ NS_IMETHODIMP nsPluginInstancePeerImpl::GetMayScript(PRBool *result) NS_IMETHODIMP nsPluginInstancePeerImpl::SetWindowSize(PRUint32 width, PRUint32 height) { -printf("instance peer setwindowsize called\n"); + PRINTF("instance peer setwindowsize called\n"); return NS_OK; } diff --git a/mozilla/modules/plugin/nglsrc/nsPluginViewer.cpp b/mozilla/modules/plugin/nglsrc/nsPluginViewer.cpp index a3f070dffc6..f0d7ecb3ed3 100644 --- a/mozilla/modules/plugin/nglsrc/nsPluginViewer.cpp +++ b/mozilla/modules/plugin/nglsrc/nsPluginViewer.cpp @@ -43,6 +43,11 @@ #include "nsIWebBrowserChrome.h" #include "nsIDOMDocument.h" #include "nsPluginViewer.h" +#include "nslog.h" + +NS_IMPL_LOG(nsPluginViewerLog, 0) +#define PRINTF NS_LOG_PRINTF(nsPluginViewerLog) +#define FLUSH NS_LOG_FLUSH(nsPluginViewerLog) // Class IDs static NS_DEFINE_IID(kChildWindowCID, NS_CHILD_CID); @@ -266,9 +271,7 @@ PluginViewerImpl::~PluginViewerImpl() NS_IMETHODIMP PluginViewerImpl::BindToDocument(nsISupports *aDoc, const char *aCommand) { -#ifdef NS_DEBUG - printf("PluginViewerImpl::BindToDocument\n"); -#endif + PRINTF("PluginViewerImpl::BindToDocument\n"); return aDoc->QueryInterface(kIDocumentIID, (void**)&mDocument); return NS_OK; } @@ -319,7 +322,7 @@ PluginViewerImpl::StartLoad(nsIChannel* channel, nsIStreamListener*& aResult) #ifdef DEBUG char* contentType; mChannel->GetContentType(&contentType); - printf("PluginViewerImpl::StartLoad: content-type=%s\n", contentType); + PRINTF("PluginViewerImpl::StartLoad: content-type=%s\n", contentType); nsCRT::free(contentType); #endif diff --git a/mozilla/modules/plugin/nglsrc/nsPluginsDirBeOS.cpp b/mozilla/modules/plugin/nglsrc/nsPluginsDirBeOS.cpp index 3b485653e8e..4d04267d7ba 100644 --- a/mozilla/modules/plugin/nglsrc/nsPluginsDirBeOS.cpp +++ b/mozilla/modules/plugin/nglsrc/nsPluginsDirBeOS.cpp @@ -32,6 +32,11 @@ #include "prlink.h" #include "plstr.h" #include "prmem.h" +#include "nslog.h" + +NS_IMPL_LOG(nsPluginsDirBeOSLog, 0) +#define PRINTF NS_LOG_PRINTF(nsPluginsDirBeOSLog) +#define FLUSH NS_LOG_FLUSH(nsPluginsDirBeOSLog) #include "nsSpecialSystemDirectory.h" @@ -97,9 +102,7 @@ PRBool nsPluginsDir::IsPluginFile(const nsFileSpec& fileSpec) { const char* pathname = fileSpec.GetCString(); -#ifdef NS_DEBUG - printf("IsPluginFile(%s)\n", pathname); -#endif + PRINTF("IsPluginFile(%s)\n", pathname); return PR_TRUE; } @@ -128,9 +131,7 @@ nsresult nsPluginFile::LoadPlugin(PRLibrary* &outLibrary) const char* path = this->GetCString(); pLibrary = outLibrary = PR_LoadLibrary(path); -#ifdef NS_DEBUG - printf("LoadPlugin() %s returned %lx\n",path,(unsigned long)pLibrary); -#endif + PRINTF("LoadPlugin() %s returned %lx\n",path,(unsigned long)pLibrary); return NS_OK; } @@ -153,18 +154,14 @@ nsresult nsPluginFile::GetPluginInfo(nsPluginInfo& info) if((procedure = (BeOS_Plugin_GetMIMEDescription)PR_FindSymbol(pLibrary,"NP_GetMIMEDescription")) != 0) { mimedescr = procedure(); } else { -#ifdef NS_DEBUG - printf("Cannot get plugin info: no GetMIMEDescription procedure!\n"); -#endif + PRINTF("Cannot get plugin info: no GetMIMEDescription procedure!\n"); return NS_ERROR_FAILURE; } info.fName = GetFileName(path); -#ifdef NS_DEBUG - printf("GetMIMEDescription() %lx returned \"%s\"\n", + PRINTF("GetMIMEDescription() %lx returned \"%s\"\n", (unsigned long)procedure, mimedescr); -#endif // copy string @@ -202,9 +199,7 @@ nsresult nsPluginFile::GetPluginInfo(nsPluginInfo& info) if(descr) *descr++=0; -#ifdef NS_DEBUG - printf("Registering plugin for: \"%s\",\"%s\",\"%s\"\n", mtype,descr ? descr : "null",exten ? exten : "null"); -#endif + PRINTF("Registering plugin for: \"%s\",\"%s\",\"%s\"\n", mtype,descr ? descr : "null",exten ? exten : "null"); if(!*mtype && !descr && !exten) { i--; diff --git a/mozilla/modules/plugin/nglsrc/nsPluginsDirWin.cpp b/mozilla/modules/plugin/nglsrc/nsPluginsDirWin.cpp index e6abe2ef035..2763c1dfdcb 100644 --- a/mozilla/modules/plugin/nglsrc/nsPluginsDirWin.cpp +++ b/mozilla/modules/plugin/nglsrc/nsPluginsDirWin.cpp @@ -38,6 +38,11 @@ #include "winbase.h" #include "nsSpecialSystemDirectory.h" +#include "nslog.h" + +NS_IMPL_LOG(nsPluginsDirWinLog, 0) +#define PRINTF NS_LOG_PRINTF(nsPluginsDirWinLog) +#define FLUSH NS_LOG_FLUSH(nsPluginsDirWinLog) /////////////////////////////////////////////////////////////////////////// @@ -209,7 +214,7 @@ nsPluginsDir::nsPluginsDir(PRUint16 location) #ifdef NS_DEBUG if (path[0] != 0) - printf("plugins at: %s\n", path); + PRINTF("plugins at: %s\n", path); #endif } diff --git a/mozilla/modules/plugin/samples/backward/badapter.cpp b/mozilla/modules/plugin/samples/backward/badapter.cpp index 7d9cabe08fa..f75c867662d 100644 --- a/mozilla/modules/plugin/samples/backward/badapter.cpp +++ b/mozilla/modules/plugin/samples/backward/badapter.cpp @@ -40,6 +40,11 @@ #include "nsLiveConnect.h" #include "nsplugin.h" #include "nsDebug.h" +#include "nslog.h" + +NS_IMPL_LOG(badapterLog, 0) +#define PRINTF NS_LOG_PRINTF(badapterLog) +#define FLUSH NS_LOG_FLUSH(badapterLog) //////////////////////////////////////////////////////////////////////////////// // SECTION 3 - Classes @@ -577,22 +582,22 @@ nsresult fromNPError[] = { char* NPP_GetMIMEDescription(void) { int freeFac = 0; - //fprintf(stderr, "MIME description\n"); + PRINTF("MIME description\n"); if (thePlugin == NULL) { freeFac = 1; NSGetFactory(thePluginManager, kPluginCID, NULL, NULL, (nsIFactory** )&thePlugin); } - //fprintf(stderr, "Allocated Plugin 0x%08x\n", thePlugin); + PRINTF("Allocated Plugin 0x%08x\n", thePlugin); const char * ret; nsresult err = thePlugin->GetMIMEDescription(&ret); if (err) return NULL; - //fprintf(stderr, "Get response %s\n", ret); + PRINTF("Get response %s\n", ret); if (freeFac) { - //fprintf(stderr, "Freeing plugin..."); + PRINTF("Freeing plugin..."); thePlugin->Release(); thePlugin = NULL; } - //fprintf(stderr, "Done\n"); + PRINTF("Done\n"); return (char*)ret; } @@ -618,22 +623,22 @@ NPP_SetValue(NPP instance, NPNVariable variable, void *value) NPError NPP_GetValue(NPP instance, NPPVariable variable, void *value) { int freeFac = 0; - //fprintf(stderr, "MIME description\n"); + PRINTF("MIME description\n"); if (thePlugin == NULL) { freeFac = 1; if (NSGetFactory(thePluginManager, kPluginCID, NULL, NULL, (nsIFactory** )&thePlugin) != NS_OK) return NPERR_GENERIC_ERROR; } - //fprintf(stderr, "Allocated Plugin 0x%08x\n", thePlugin); + PRINTF("Allocated Plugin 0x%08x\n", thePlugin); nsresult err = thePlugin->GetValue((nsPluginVariable)variable, value); if (err) return NPERR_GENERIC_ERROR; - //fprintf(stderr, "Get response %08x\n", ret); + PRINTF("Get response %08x\n", ret); if (freeFac) { - //fprintf(stderr, "Freeing plugin..."); + PRINTF("Freeing plugin..."); thePlugin->Release(); thePlugin = NULL; } - //fprintf(stderr, "Done\n"); + PRINTF("Done\n"); return NPERR_NO_ERROR; } #endif // XP_UNIX diff --git a/mozilla/modules/plugin/samples/default/unix/npshell.c b/mozilla/modules/plugin/samples/default/unix/npshell.c index 494769b8a32..9e43d9738ac 100644 --- a/mozilla/modules/plugin/samples/default/unix/npshell.c +++ b/mozilla/modules/plugin/samples/default/unix/npshell.c @@ -44,6 +44,11 @@ #include "npapi.h" #include "nullplugin.h" #include "strings.h" +#include "nslog.h" + +NS_IMPL_LOG(npshellLog, 0) +#define PRINTF NS_LOG_PRINTF(npshellLog) +#define FLUSH NS_LOG_FLUSH(npshellLog) /*********************************************************************** * @@ -201,11 +206,11 @@ NPP_SetWindow(NPP instance, NPWindow* window) id. */ #ifdef DEBUG - fprintf(stderr, "Nullplugin: plugin received window resize.\n"); - fprintf(stderr, "Window=(%i)\n", (int)window); + PRINTF("Nullplugin: plugin received window resize.\n"); + PRINTF("Window=(%i)\n", (int)window); if (window) { - fprintf(stderr, "W=(%i) H=(%i)\n", - (int)window->width, (int)window->height); + PRINTF("W=(%i) H=(%i)\n", + (int)window->width, (int)window->height); } #endif return NPERR_NO_ERROR; diff --git a/mozilla/modules/plugin/samples/default/unix/npunix.c b/mozilla/modules/plugin/samples/default/unix/npunix.c index 2f6d2e57823..8c8a885ba12 100644 --- a/mozilla/modules/plugin/samples/default/unix/npunix.c +++ b/mozilla/modules/plugin/samples/default/unix/npunix.c @@ -40,6 +40,11 @@ #include #include "npapi.h" #include "npupp.h" +#include "nslog.h" + +NS_IMPL_LOG(npunixLog, 0) +#define PRINTF NS_LOG_PRINTF(npunixLog) +#define FLUSH NS_LOG_FLUSH(npunixLog) /* * Define PLUGIN_TRACE to have the wrapper functions print @@ -48,7 +53,7 @@ #ifdef PLUGIN_TRACE #include -#define PLUGINDEBUGSTR(msg) fprintf(stderr, "%s\n", msg) +#define PLUGINDEBUGSTR(msg) PRINTF("%s\n", msg) #else #define PLUGINDEBUGSTR(msg) #endif diff --git a/mozilla/netwerk/base/src/nsIOService.cpp b/mozilla/netwerk/base/src/nsIOService.cpp index e54fe8fc063..d5a4ec717b8 100644 --- a/mozilla/netwerk/base/src/nsIOService.cpp +++ b/mozilla/netwerk/base/src/nsIOService.cpp @@ -34,6 +34,11 @@ #include "nsXPIDLString.h" #include "nsIErrorService.h" #include "netCore.h" +#include "nslog.h" + +NS_IMPL_LOG(nsIOServiceLog) +#define PRINTF NS_LOG_PRINTF(nsIOServiceLog) +#define FLUSH NS_LOG_FLUSH(nsIOServiceLog) static NS_DEFINE_CID(kFileTransportService, NS_FILETRANSPORTSERVICE_CID); static NS_DEFINE_CID(kEventQueueService, NS_EVENTQUEUESERVICE_CID); @@ -163,9 +168,7 @@ nsIOService::CacheProtocolHandler(const char *scheme, nsIProtocolHandler *handle { // Dont cache handlers that dont support weak reference as // there is real danger of a circular reference. -#ifdef DEBUG_dp - printf("DEBUG: %s protcol handler doesn't support weak ref. Not cached.\n", scheme); -#endif /* DEBUG_dp */ + PRINTF("DEBUG: %s protcol handler doesn't support weak ref. Not cached.\n", scheme); return NS_ERROR_FAILURE; } mWeakHandler[i] = getter_AddRefs(NS_GetWeakReference(handler)); diff --git a/mozilla/netwerk/base/src/nsSocketTransport.cpp b/mozilla/netwerk/base/src/nsSocketTransport.cpp index 96c9593ed94..5dc592ba86a 100644 --- a/mozilla/netwerk/base/src/nsSocketTransport.cpp +++ b/mozilla/netwerk/base/src/nsSocketTransport.cpp @@ -41,6 +41,22 @@ #include "nsNetUtil.h" #include "nsISecureSocketInfo.h" #include "nsMemory.h" +#include "nslog.h" + +// +// Log module for SocketTransport logging... +// +// To enable logging (see prlog.h for full details): +// +// set NSPR_LOG_MODULES=nsSocketTransportLog:5 +// set NSPR_LOG_FILE=nspr.log +// +// this enables PR_LOG_DEBUG level information and places all output in +// the file nspr.log +// +NS_IMPL_LOG(nsSocketTransportLog) +#define PRINTF NS_LOG_PRINTF(nsSocketTransportLog) +#define FLUSH NS_LOG_FLUSH(nsSocketTransportLog) static NS_DEFINE_CID(kSocketProviderService, NS_SOCKETPROVIDERSERVICE_CID); static NS_DEFINE_CID(kDNSService, NS_DNSSERVICE_CID); @@ -102,22 +118,6 @@ nsSocketState gStateTable[eSocketOperation_Max][eSocketState_Max] = { static PRIntervalTime gConnectTimeout = PR_INTERVAL_NO_WAIT; -#if defined(PR_LOGGING) -// -// Log module for SocketTransport logging... -// -// To enable logging (see prlog.h for full details): -// -// set NSPR_LOG_MODULES=nsSocketTransport:5 -// set NSPR_LOG_FILE=nspr.log -// -// this enables PR_LOG_DEBUG level information and places all output in -// the file nspr.log -// -PRLogModuleInfo* gSocketLog = nsnull; - -#endif /* PR_LOGGING */ - static PRUint32 sTotalTransportsCreated = 0; static PRUint32 sTotalTransportsDeleted = 0; @@ -182,24 +182,14 @@ nsSocketTransport::nsSocketTransport(): gConnectTimeout = PR_MillisecondsToInterval(CONNECT_TIMEOUT_IN_MS); } -#if defined(PR_LOGGING) - // - // Initialize the global PRLogModule for socket transport logging - // if necessary... - // - if (nsnull == gSocketLog) { - gSocketLog = PR_NewLogModule("nsSocketTransport"); - } -#endif /* PR_LOGGING */ - - PR_LOG(gSocketLog, PR_LOG_DEBUG, + PR_LOG(nsSocketTransportLog, PR_LOG_DEBUG, ("Creating nsSocketTransport [%x], TotalCreated=%d, TotalDeleted=%d\n", this, ++sTotalTransportsCreated, sTotalTransportsDeleted)); } nsSocketTransport::~nsSocketTransport() { - PR_LOG(gSocketLog, PR_LOG_DEBUG, + PR_LOG(nsSocketTransportLog, PR_LOG_DEBUG, ("Deleting nsSocketTransport [%s:%d %x], TotalCreated=%d, TotalDeleted=%d\n", mHostName, mPort, this, sTotalTransportsCreated, ++sTotalTransportsDeleted)); @@ -308,9 +298,7 @@ nsresult nsSocketTransport::Init(nsSocketTransportService* aService, const char * socketType = aSocketTypes[type]; if (socketType == nsnull) continue; -#ifdef DEBUG - printf("pushing io layer: %s\n", socketType); -#endif + PRINTF("pushing io layer: %s\n", socketType); mSocketTypes[mSocketTypeCount] = nsCRT::strdup(socketType); if (!mSocketTypes[mSocketTypeCount]) { @@ -349,7 +337,7 @@ nsresult nsSocketTransport::Init(nsSocketTransportService* aService, mLastActiveTime = PR_IntervalNow (); PR_AtomicIncrement (&mService -> mTotalTransports); - PR_LOG(gSocketLog, PR_LOG_DEBUG, + PR_LOG(nsSocketTransportLog, PR_LOG_DEBUG, ("Initializing nsSocketTransport [%s:%d %x]. rv = %x", mHostName, mPort, this, rv)); @@ -378,7 +366,7 @@ nsresult nsSocketTransport::CheckForTimeout (PRIntervalTime aCurrentTime) && idleInterval >= mSocketTimeout) { PR_LOG ( - gSocketLog, PR_LOG_ERROR, ("nsSocketTransport::CheckForTimeout() [%s:%d %x].\t" + nsSocketTransportLog, PR_LOG_ERROR, ("nsSocketTransport::CheckForTimeout() [%s:%d %x].\t" "TIMED OUT... Idle interval: %d\n", mHostName, mPort, this, idleInterval) ); @@ -402,7 +390,7 @@ nsresult nsSocketTransport::Process(PRInt16 aSelectFlags) // PR_EnterMonitor(mMonitor); - PR_LOG(gSocketLog, PR_LOG_DEBUG, + PR_LOG(nsSocketTransportLog, PR_LOG_DEBUG, ("+++ Entering nsSocketTransport::Process() [%s:%d %x].\t" "aSelectFlags = %x.\t" "CurrentState = %d\n", @@ -412,7 +400,7 @@ nsresult nsSocketTransport::Process(PRInt16 aSelectFlags) // Check for an error during PR_Poll(...) // if (PR_POLL_EXCEPT & aSelectFlags) { - PR_LOG(gSocketLog, PR_LOG_ERROR, + PR_LOG(nsSocketTransportLog, PR_LOG_ERROR, ("Operation failed via PR_POLL_EXCEPT. [%s:%d %x].\n", mHostName, mPort, this)); // An error has occurred, so cancel the read and/or write operation... @@ -423,7 +411,7 @@ nsresult nsSocketTransport::Process(PRInt16 aSelectFlags) } if (PR_POLL_HUP & aSelectFlags) { - PR_LOG(gSocketLog, PR_LOG_ERROR, + PR_LOG(nsSocketTransportLog, PR_LOG_ERROR, ("Operation failed via PR_POLL_HUP. [%s:%d %x].\n", mHostName, mPort, this)); if (mCurrentState == eSocketState_WaitConnect) { @@ -441,7 +429,7 @@ nsresult nsSocketTransport::Process(PRInt16 aSelectFlags) // This removes the transport from the select list... // if (mSuspendCount) { - PR_LOG(gSocketLog, PR_LOG_DEBUG, + PR_LOG(nsSocketTransportLog, PR_LOG_DEBUG, ("Transport [%s:%d %x] is suspended.\n", mHostName, mPort, this)); @@ -456,7 +444,7 @@ nsresult nsSocketTransport::Process(PRInt16 aSelectFlags) // transport to move into the error state and end the request... // if (NS_FAILED(mCancelStatus)) { - PR_LOG(gSocketLog, PR_LOG_DEBUG, + PR_LOG(nsSocketTransportLog, PR_LOG_DEBUG, ("Transport [%s:%d %x] has been cancelled.\n", mHostName, mPort, this)); @@ -513,7 +501,7 @@ nsresult nsSocketTransport::Process(PRInt16 aSelectFlags) break; case eSocketState_Error: - PR_LOG(gSocketLog, PR_LOG_DEBUG, + PR_LOG(nsSocketTransportLog, PR_LOG_DEBUG, ("Transport [%s:%d %x] is in error state.\n", mHostName, mPort, this)); @@ -533,7 +521,7 @@ nsresult nsSocketTransport::Process(PRInt16 aSelectFlags) // Fall into the Done state... // case eSocketState_Done: - PR_LOG(gSocketLog, PR_LOG_DEBUG, + PR_LOG(nsSocketTransportLog, PR_LOG_DEBUG, ("Transport [%s:%d %x] is in done state.\n", mHostName, mPort, this)); @@ -689,7 +677,7 @@ nsresult nsSocketTransport::Process(PRInt16 aSelectFlags) // Update the active time for timeout purposes... mLastActiveTime = PR_IntervalNow(); - PR_LOG(gSocketLog, PR_LOG_DEBUG, + PR_LOG(nsSocketTransportLog, PR_LOG_DEBUG, ("--- Leaving nsSocketTransport::Process() [%s:%d %x]. mStatus = %x.\t" "CurrentState = %d\n\n", mHostName, mPort, this, mStatus, mCurrentState)); @@ -718,7 +706,7 @@ nsresult nsSocketTransport::doResolveHost(void) NS_ASSERTION(eSocketState_WaitDNS == mCurrentState, "Wrong state."); - PR_LOG(gSocketLog, PR_LOG_DEBUG, + PR_LOG(nsSocketTransportLog, PR_LOG_DEBUG, ("+++ Entering nsSocketTransport::doResolveHost() [%s:%d %x].\n", mHostName, mPort, this)); @@ -774,7 +762,7 @@ nsresult nsSocketTransport::doResolveHost(void) } } - PR_LOG(gSocketLog, PR_LOG_DEBUG, + PR_LOG(nsSocketTransportLog, PR_LOG_DEBUG, ("--- Leaving nsSocketTransport::doResolveHost() [%s:%d %x].\t" "rv = %x.\n\n", mHostName, mPort, this, rv)); @@ -806,7 +794,7 @@ nsresult nsSocketTransport::doConnection(PRInt16 aSelectFlags) NS_ASSERTION(eSocketState_WaitConnect == mCurrentState, "Wrong state."); - PR_LOG(gSocketLog, PR_LOG_DEBUG, + PR_LOG(nsSocketTransportLog, PR_LOG_DEBUG, ("+++ Entering nsSocketTransport::doConnection() [%s:%d %x].\t" "aSelectFlags = %x.\n", mHostName, mPort, this, aSelectFlags)); @@ -952,7 +940,7 @@ nsresult nsSocketTransport::doConnection(PRInt16 aSelectFlags) // else { // Connection refused... - PR_LOG(gSocketLog, PR_LOG_ERROR, + PR_LOG(nsSocketTransportLog, PR_LOG_ERROR, ("Connection Refused [%s:%d %x]. PRErrorCode = %x\n", mHostName, mPort, this, code)); @@ -967,7 +955,7 @@ nsresult nsSocketTransport::doConnection(PRInt16 aSelectFlags) // else if (aSelectFlags) { if (PR_POLL_EXCEPT & aSelectFlags) { - PR_LOG(gSocketLog, PR_LOG_ERROR, + PR_LOG(nsSocketTransportLog, PR_LOG_ERROR, ("Connection Refused via PR_POLL_EXCEPT. [%s:%d %x].\n", mHostName, mPort, this)); @@ -986,7 +974,7 @@ nsresult nsSocketTransport::doConnection(PRInt16 aSelectFlags) rv = NS_BASE_STREAM_WOULD_BLOCK; } - PR_LOG(gSocketLog, PR_LOG_DEBUG, + PR_LOG(nsSocketTransportLog, PR_LOG_DEBUG, ("--- Leaving nsSocketTransport::doConnection() [%s:%d %x].\t" "rv = %x.\n\n", mHostName, mPort, this, rv)); @@ -1049,7 +1037,7 @@ nsReadFromSocket(nsIOutputStream* out, else { PRInt32 osCode = PR_GetOSError (); - PR_LOG (gSocketLog, PR_LOG_ERROR, ("PR_Read() failed. PRErrorCode = %x, os_error=%d\n", code, osCode)); + PR_LOG (nsSocketTransportLog, PR_LOG_ERROR, ("PR_Read() failed. PRErrorCode = %x, os_error=%d\n", code, osCode)); info -> bEOF = PR_TRUE; @@ -1059,7 +1047,7 @@ nsReadFromSocket(nsIOutputStream* out, } } - PR_LOG(gSocketLog, PR_LOG_DEBUG, + PR_LOG(nsSocketTransportLog, PR_LOG_DEBUG, ("nsReadFromSocket [fd=%x]. rv = %x. Buffer space = %d. Bytes read =%d\n", info->fd, rv, count, *readCount)); @@ -1094,7 +1082,7 @@ nsWriteToSocket(nsIInputStream* in, rv = NS_BASE_STREAM_WOULD_BLOCK; } else { - PR_LOG(gSocketLog, PR_LOG_ERROR, + PR_LOG(nsSocketTransportLog, PR_LOG_ERROR, ("PR_Write() failed. PRErrorCode = %x\n", code)); // XXX: What should this error code be? @@ -1103,7 +1091,7 @@ nsWriteToSocket(nsIInputStream* in, } } - PR_LOG(gSocketLog, PR_LOG_DEBUG, + PR_LOG(nsSocketTransportLog, PR_LOG_DEBUG, ("nsWriteToSocket [fd=%x]. rv = %x. Buffer space = %d. Bytes written =%d\n", fd, rv, count, *writeCount)); @@ -1134,7 +1122,7 @@ nsresult nsSocketTransport::doRead(PRInt16 aSelectFlags) NS_ASSERTION(eSocketState_WaitReadWrite == mCurrentState, "Wrong state."); NS_ASSERTION(GetReadType() != eSocketRead_None, "Bad Read Type!"); - PR_LOG(gSocketLog, PR_LOG_DEBUG, + PR_LOG(nsSocketTransportLog, PR_LOG_DEBUG, ("+++ Entering nsSocketTransport::doRead() [%s:%d %x].\t" "aSelectFlags = %x.\t", mHostName, mPort, this, aSelectFlags)); @@ -1155,7 +1143,7 @@ nsresult nsSocketTransport::doRead(PRInt16 aSelectFlags) MAX_IO_TRANSFER_SIZE, &totalBytesWritten); PR_EnterMonitor(mMonitor); - PR_LOG(gSocketLog, PR_LOG_DEBUG, + PR_LOG(nsSocketTransportLog, PR_LOG_DEBUG, ("WriteSegments [fd=%x]. rv = %x. Bytes read =%d\n", mSocketFD, rv, totalBytesWritten)); @@ -1198,7 +1186,7 @@ nsresult nsSocketTransport::doRead(PRInt16 aSelectFlags) } } - PR_LOG(gSocketLog, PR_LOG_DEBUG, + PR_LOG(nsSocketTransportLog, PR_LOG_DEBUG, ("--- Leaving nsSocketTransport::doRead() [%s:%d %x]. rv = %x.\t" "Total bytes read: %d\n\n", mHostName, mPort, this, rv, totalBytesWritten)); @@ -1234,7 +1222,7 @@ nsresult nsSocketTransport::doWrite(PRInt16 aSelectFlags) NS_ASSERTION(eSocketState_WaitReadWrite == mCurrentState, "Wrong state."); NS_ASSERTION(GetWriteType() != eSocketWrite_None, "Bad Write Type!"); - PR_LOG(gSocketLog, PR_LOG_DEBUG, + PR_LOG(nsSocketTransportLog, PR_LOG_DEBUG, ("+++ Entering nsSocketTransport::doWrite() [%s:%d %x].\t" "aSelectFlags = %x.\t" "mWriteCount = %d\n", @@ -1293,7 +1281,7 @@ nsresult nsSocketTransport::doWrite(PRInt16 aSelectFlags) } } - PR_LOG(gSocketLog, PR_LOG_DEBUG, + PR_LOG(nsSocketTransportLog, PR_LOG_DEBUG, ("--- Leaving nsSocketTransport::doWrite() [%s:%d %x]. rv = %x.\t" "Total bytes written: %d\n\n", mHostName, mPort, this, rv, totalBytesWritten)); @@ -1338,7 +1326,7 @@ nsresult nsSocketTransport::doWriteFromBuffer(PRUint32 *aCount) transferCount, aCount); PR_EnterMonitor(mMonitor); - PR_LOG(gSocketLog, PR_LOG_DEBUG, + PR_LOG(nsSocketTransportLog, PR_LOG_DEBUG, ("ReadSegments [fd=%x]. rv = %x. Bytes written =%d\n", mSocketFD, rv, *aCount)); @@ -1573,7 +1561,7 @@ nsSocketTransport::Cancel(nsresult status) mLastActiveTime = PR_IntervalNow (); rv = mService->AddToWorkQ(this); - PR_LOG(gSocketLog, PR_LOG_DEBUG, + PR_LOG(nsSocketTransportLog, PR_LOG_DEBUG, ("Canceling nsSocketTransport [%s:%d %x]. rv = %x\n", mHostName, mPort, this, rv)); @@ -1600,7 +1588,7 @@ nsSocketTransport::Suspend(void) rv = mService->AddToWorkQ(this); } - PR_LOG(gSocketLog, PR_LOG_DEBUG, + PR_LOG(nsSocketTransportLog, PR_LOG_DEBUG, ("Suspending nsSocketTransport [%s:%d %x]. rv = %x\t" "mSuspendCount = %d.\n", mHostName, mPort, this, rv, mSuspendCount)); @@ -1632,7 +1620,7 @@ nsSocketTransport::Resume(void) rv = NS_ERROR_FAILURE; } - PR_LOG(gSocketLog, PR_LOG_DEBUG, + PR_LOG(nsSocketTransportLog, PR_LOG_DEBUG, ("Resuming nsSocketTransport [%s:%d %x]. rv = %x\t" "mSuspendCount = %d.\n", mHostName, mPort, this, rv, mSuspendCount)); @@ -1653,7 +1641,7 @@ nsSocketTransport::Resume(void) NS_IMETHODIMP nsSocketTransport::OnFull(nsIOutputStream* out) { - PR_LOG(gSocketLog, PR_LOG_DEBUG, + PR_LOG(nsSocketTransportLog, PR_LOG_DEBUG, ("nsSocketTransport::OnFull() [%s:%d %x] nsIOutputStream=%x.\n", mHostName, mPort, this, out)); @@ -1686,7 +1674,7 @@ nsSocketTransport::OnWrite(nsIOutputStream* out, PRUint32 aCount) { nsresult rv = NS_OK; - PR_LOG(gSocketLog, PR_LOG_DEBUG, + PR_LOG(nsSocketTransportLog, PR_LOG_DEBUG, ("nsSocketTransport::OnWrite() [%s:%d %x]. nsIOutputStream=%x Count=%d\n", mHostName, mPort, this, out, aCount)); @@ -1719,7 +1707,7 @@ nsSocketTransport::OnEmpty(nsIInputStream* in) { nsresult rv = NS_OK; - PR_LOG(gSocketLog, PR_LOG_DEBUG, + PR_LOG(nsSocketTransportLog, PR_LOG_DEBUG, ("nsSocketTransport::OnEmpty() [%s:%d %x] nsIInputStream=%x.\n", mHostName, mPort, this, in)); @@ -1756,7 +1744,7 @@ nsSocketTransport::OnClose(nsIInputStream* inStr) NS_IMETHODIMP nsSocketTransport::OnStartLookup(nsISupports *aContext, const char *aHostName) { - PR_LOG(gSocketLog, PR_LOG_DEBUG, + PR_LOG(nsSocketTransportLog, PR_LOG_DEBUG, ("nsSocketTransport::OnStartLookup(...) [%s:%d %x]. Host is %s\n", mHostName, mPort, this, aHostName)); @@ -1784,7 +1772,7 @@ nsSocketTransport::OnFound(nsISupports *aContext, } #ifdef PR_LOGGING PR_NetAddrToString(&mNetAddress, addrbuf, sizeof(addrbuf)); - PR_LOG(gSocketLog, PR_LOG_DEBUG, + PR_LOG(nsSocketTransportLog, PR_LOG_DEBUG, ("nsSocketTransport::OnFound(...) [%s:%d %x]." " DNS lookup succeeded => %s (%s)\n", mHostName, mPort, this, @@ -1796,7 +1784,7 @@ nsSocketTransport::OnFound(nsISupports *aContext, // there are *no* A records... rv = NS_ERROR_FAILURE; - PR_LOG(gSocketLog, PR_LOG_DEBUG, + PR_LOG(nsSocketTransportLog, PR_LOG_DEBUG, ("nsSocketTransport::OnFound(...) [%s:%d %x]." " DNS lookup succeeded (%s) but no address returned!", mHostName, mPort, this, @@ -1814,7 +1802,7 @@ nsSocketTransport::OnStopLookup(nsISupports *aContext, // Enter the socket transport lock... nsAutoMonitor mon(mMonitor); - PR_LOG(gSocketLog, PR_LOG_DEBUG, + PR_LOG(nsSocketTransportLog, PR_LOG_DEBUG, ("nsSocketTransport::OnStopLookup(...) [%s:%d %x]." " Status = %x Host is %s\n", mHostName, mPort, this, aStatus, aHostName)); @@ -1897,7 +1885,7 @@ nsSocketTransport::AsyncRead(nsIStreamListener* aListener, // Enter the socket transport lock... nsAutoMonitor mon(mMonitor); - PR_LOG(gSocketLog, PR_LOG_DEBUG, + PR_LOG(nsSocketTransportLog, PR_LOG_DEBUG, ("+++ Entering nsSocketTransport::AsyncRead() [%s:%d %x]\n", mHostName, mPort, this)); @@ -1940,7 +1928,7 @@ nsSocketTransport::AsyncRead(nsIStreamListener* aListener, rv = mService->AddToWorkQ(this); } - PR_LOG(gSocketLog, PR_LOG_DEBUG, + PR_LOG(nsSocketTransportLog, PR_LOG_DEBUG, ("--- Leaving nsSocketTransport::AsyncRead() [%s:%d %x]. rv = %x.\n", mHostName, mPort, this, rv)); @@ -1958,7 +1946,7 @@ nsSocketTransport::AsyncWrite(nsIInputStream* aFromStream, // Enter the socket transport lock... nsAutoMonitor mon(mMonitor); - PR_LOG(gSocketLog, PR_LOG_DEBUG, + PR_LOG(nsSocketTransportLog, PR_LOG_DEBUG, ("+++ Entering nsSocketTransport::AsyncWrite() [%s:%d %x]\n", mHostName, mPort, this)); @@ -2014,7 +2002,7 @@ nsSocketTransport::AsyncWrite(nsIInputStream* aFromStream, rv = mService->AddToWorkQ(this); } - PR_LOG(gSocketLog, PR_LOG_DEBUG, + PR_LOG(nsSocketTransportLog, PR_LOG_DEBUG, ("--- Leaving nsSocketTransport::AsyncWrite() [%s:%d %x]. rv = %x.\n", mHostName, mPort, this, rv)); @@ -2030,7 +2018,7 @@ nsSocketTransport::OpenInputStream(nsIInputStream* *result) // Enter the socket transport lock... nsAutoMonitor mon(mMonitor); - PR_LOG(gSocketLog, PR_LOG_DEBUG, + PR_LOG(nsSocketTransportLog, PR_LOG_DEBUG, ("+++ Entering nsSocketTransport::OpenInputStream() [%s:%d %x].\n", mHostName, mPort, this)); @@ -2069,7 +2057,7 @@ nsSocketTransport::OpenInputStream(nsIInputStream* *result) rv = mService->AddToWorkQ(this); } - PR_LOG(gSocketLog, PR_LOG_DEBUG, + PR_LOG(nsSocketTransportLog, PR_LOG_DEBUG, ("--- Leaving nsSocketTransport::OpenInputStream() [%s:%d %x].\t" "rv = %x.\n", mHostName, mPort, this, rv)); @@ -2086,7 +2074,7 @@ nsSocketTransport::OpenOutputStream(nsIOutputStream* *result) // Enter the socket transport lock... nsAutoMonitor mon(mMonitor); - PR_LOG(gSocketLog, PR_LOG_DEBUG, + PR_LOG(nsSocketTransportLog, PR_LOG_DEBUG, ("+++ Entering nsSocketTransport::OpenOutputStream() [%s:%d %x].\n", mHostName, mPort, this)); @@ -2135,7 +2123,7 @@ nsSocketTransport::OpenOutputStream(nsIOutputStream* *result) rv = mService->AddToWorkQ(this); } */ - PR_LOG(gSocketLog, PR_LOG_DEBUG, + PR_LOG(nsSocketTransportLog, PR_LOG_DEBUG, ("--- Leaving nsSocketTransport::OpenOutputStream() [%s:%d %x].\t" "rv = %x.\n", mHostName, mPort, this, rv)); diff --git a/mozilla/netwerk/cache/filecache/nsDBAccessor.cpp b/mozilla/netwerk/cache/filecache/nsDBAccessor.cpp index 1b4a6ed793d..06d1a53e01b 100644 --- a/mozilla/netwerk/cache/filecache/nsDBAccessor.cpp +++ b/mozilla/netwerk/cache/filecache/nsDBAccessor.cpp @@ -42,6 +42,12 @@ #include "plhash.h" #include "nsCRT.h" #include "nsIFile.h" +#include "nslog.h" + +NS_IMPL_LOG(nsDBAccessorLog) +#define PRINTF NS_LOG_PRINTF(nsDBAccessorLog) +#define FLUSH NS_LOG_FLUSH(nsDBAccessorLog) + nsDBAccessor::nsDBAccessor() : mDB(0) , mDBFile(0) , @@ -422,7 +428,7 @@ nsDBAccessor::Sync(void) if (PR_IntervalToMilliseconds(duration) > SyncInterval) { int status = (*mDB->sync)(mDB, 0) ; if(status == 0) { -// printf("\tsynced\n") ; + PRINTF("\tsynced\n") ; mLastSyncTime = time ; // update db filesize here @@ -431,7 +437,7 @@ nsDBAccessor::Sync(void) } else return NS_ERROR_FAILURE ; } else { -// printf("\tnot synced\n") ; + PRINTF("\tnot synced\n") ; return NS_OK ; } } diff --git a/mozilla/netwerk/cache/filecache/nsDiskCacheRecord.cpp b/mozilla/netwerk/cache/filecache/nsDiskCacheRecord.cpp index 7857b97eda9..b10a4a582d1 100644 --- a/mozilla/netwerk/cache/filecache/nsDiskCacheRecord.cpp +++ b/mozilla/netwerk/cache/filecache/nsDiskCacheRecord.cpp @@ -42,6 +42,11 @@ #include "nsDBAccessor.h" #include "nsILocalFile.h" +#include "nslog.h" + +NS_IMPL_LOG(nsDiskCacheRecordLog) +#define PRINTF NS_LOG_PRINTF(nsDiskCacheRecordLog) +#define FLUSH NS_LOG_FLUSH(nsDiskCacheRecordLog) #if !defined(IS_LITTLE_ENDIAN) && !defined(IS_BIG_ENDIAN) ERROR! Must have a byte order @@ -74,9 +79,7 @@ nsDiskCacheRecord::nsDiskCacheRecord(nsIDBAccessor* db, nsNetDiskCache* aCache) NS_INIT_REFCNT(); NS_ASSERTION(mDiskCache, "Must have an nsNetDiskCache"); NS_ADDREF(mDiskCache); -#ifdef DEBUG_dp - printf("CACHE: nsDiskCacheRecord(): %p created\n", this); -#endif /* DEBUG_dp */ + PRINTF("CACHE: nsDiskCacheRecord(): %p created\n", this); } // mem alloced. so caller should do free() on key. @@ -118,9 +121,7 @@ nsDiskCacheRecord::Init(const char* key, PRUint32 length, PRInt32 ID) nsDiskCacheRecord::~nsDiskCacheRecord() { -#ifdef DEBUG_dp - printf("CACHE: ~nsDiskCacheRecord(%d, %s): %p destroyed\n", mRecordID, mKey, this); -#endif /* DEBUG_dp */ + PRINTF("CACHE: ~nsDiskCacheRecord(%d, %s): %p destroyed\n", mRecordID, mKey, this); if(mKey) nsMemory::Free(mKey) ; if(mMetaData) diff --git a/mozilla/netwerk/cache/filecache/nsNetDiskCache.cpp b/mozilla/netwerk/cache/filecache/nsNetDiskCache.cpp index 48244e54c83..cc0ad51b5c4 100644 --- a/mozilla/netwerk/cache/filecache/nsNetDiskCache.cpp +++ b/mozilla/netwerk/cache/filecache/nsNetDiskCache.cpp @@ -45,6 +45,11 @@ #include "nsIFile.h" #include "nsILocalFile.h" #include "nsString.h" +#include "nslog.h" + +NS_IMPL_LOG(nsNetDiskCacheLog) +#define PRINTF NS_LOG_PRINTF(nsNetDiskCacheLog) +#define FLUSH NS_LOG_FLUSH(nsNetDiskCacheLog) #if !defined(IS_LITTLE_ENDIAN) && !defined(IS_BIG_ENDIAN) ERROR! Must have a byte order @@ -201,9 +206,7 @@ nsNetDiskCache::Observe(nsISupports *aSubject, const PRUnichar *aTopic, NS_IMETHODIMP nsNetDiskCache::InitCacheFolder() { -#ifdef DEBUG_dp - printf("CACHE: InitCacheFolder()\n"); -#endif /* DEBUG_dp */ + PRINTF("CACHE: InitCacheFolder()"); // don't initialize if no cache folder is set. if(!mDiskCacheFolder) return NS_OK ; @@ -454,9 +457,7 @@ nsNetDiskCache::GetCachedNetData(const char* key, PRUint32 length, nsINetDataCac if ( NS_FAILED( rv ) ) DBRecovery(); -#ifdef DEBUG_dp - printf("CACHE: GetCachedNetData(%s) created nsDiskCacheRecord %p id=%d\n", key, _retval, id); -#endif /* DEBUG_dp */ + PRINTF("CACHE: GetCachedNetData(%s) created nsDiskCacheRecord %p id=%d", key, _retval, id); return rv; } @@ -488,9 +489,7 @@ nsNetDiskCache::GetCachedNetDataByID(PRInt32 RecordID, nsINetDataCacheRecord **_ } else { delete newRecord; } -#ifdef DEBUG_dp - printf("CACHE: GetCachedNetDataByID(id=%d) created nsDiskCacheRecord %p\n", RecordID, *_retval); -#endif /* DEBUG_dp */ + PRINTF("CACHE: GetCachedNetDataByID(id=%d) created nsDiskCacheRecord %p", RecordID, *_retval); return rv; } @@ -512,11 +511,9 @@ nsNetDiskCache::GetCachedNetDataByID(PRInt32 RecordID, nsINetDataCacheRecord **_ rv = NS_ERROR_FAILURE; } -#ifdef DEBUG_dp - printf("CACHE: GetCachedNetDataByID(id=%d) = RecordID not in DB\n", RecordID); -#endif /* DEBUG_dp */ + PRINTF("CACHE: GetCachedNetDataByID(id=%d) = RecordID not in DB", RecordID); - NS_WARNING("Error: RecordID not in DB\n"); + NS_WARNING("Error: RecordID not in DB"); return rv; } @@ -613,9 +610,7 @@ nsNetDiskCache::GetStorageInUse(PRUint32 *aStorageInUse) NS_IMETHODIMP nsNetDiskCache::RemoveAll(void) { -#ifdef DEBUG_dp - printf("CACHE: RemoveAll()\n"); -#endif /* DEBUG_dp */ + PRINTF("CACHE: RemoveAll()"); NS_ASSERTION(mDB, "no db.") ; NS_ASSERTION(mDiskCacheFolder, "no cache folder.") ; nsresult rv; diff --git a/mozilla/netwerk/dns/daemon/nsDnsAsyncLookup.cpp b/mozilla/netwerk/dns/daemon/nsDnsAsyncLookup.cpp index 37b89ff93fd..789ce1512d6 100644 --- a/mozilla/netwerk/dns/daemon/nsDnsAsyncLookup.cpp +++ b/mozilla/netwerk/dns/daemon/nsDnsAsyncLookup.cpp @@ -67,6 +67,12 @@ #include // for res_init() and _res #endif +#include "nslog.h" + +NS_IMPL_LOG(nsDnsAsyncLookupLog, 0) +#define PRINTF NS_LOG_PRINTF(nsDnsAsyncLookupLog) +#define FLUSH NS_LOG_FLUSH(nsDnsAsyncLookupLog) + #if defined(__linux) // Didn't find gettdtablehi() or gettdtablesize() on linux. Using FD_SETSIZE #define getdtablehi() FD_SETSIZE @@ -404,14 +410,14 @@ blockingGethostbyname (const char *name, int out_fd) char *p = buf + sizeof (int); #if defined(DNS_DEBUG) - printf("gethostbyname complete\n"); + PRINTF("gethostbyname complete\n"); for (i=0; h->h_addr_list[i]; i++); - printf("%d addresses for %s\n",i,h->h_name); - printf("address: "); + PRINTF("%d addresses for %s\n",i,h->h_name); + PRINTF("address: "); for (i = 0; i <= h->h_length; i++){ - printf("%2.2x", (unsigned char)h->h_addr_list[0][i]); + PRINTF("%2.2x", (unsigned char)h->h_addr_list[0][i]); } - printf("\n"); + PRINTF("\n"); #endif hostentToBytes (h, p, &size); @@ -446,7 +452,7 @@ spawnHelperProcess (const char *name) if (pipe(fds)) { - fprintf (stderr, "Can't make pipe\n"); + PRINTF("Can't make pipe\n"); return 0; } @@ -455,7 +461,7 @@ spawnHelperProcess (const char *name) switch (forked = fork()) { case -1: - fprintf (stderr, "Can't fork\n"); + PRINTF("Can't fork\n"); removeFromDnsQueue (obj); break; @@ -582,14 +588,14 @@ int main (int argc, char **argv) else if (!strncmp (buffer, "lookup:", 7)) { #if defined(DNS_DEBUG) - printf("received lookup request for: %s\n",name); + PRINTF("received lookup request for: %s\n",name); #endif obj = spawnHelperProcess (name); obj->accept_fd = accept_fd; char hId[5]; *(int *)&hId[0] = (int) obj->id; if (!obj) - fprintf (stderr, "spawn Error\n"); + PRINTF("spawn Error\n"); else { send (obj->accept_fd, hId, sizeof (int), 0); diff --git a/mozilla/netwerk/dns/src/nsDnsService.cpp b/mozilla/netwerk/dns/src/nsDnsService.cpp index b298cdef1bc..9b3efced89e 100644 --- a/mozilla/netwerk/dns/src/nsDnsService.cpp +++ b/mozilla/netwerk/dns/src/nsDnsService.cpp @@ -37,6 +37,12 @@ #include "prtime.h" #endif #include "prsystem.h" +#include "nslog.h" +#undef fprintf + +NS_IMPL_LOG(nsDnsServiceLog) +#define PRINTF NS_LOG_PRINTF(nsDnsServiceLog) +#define FLUSH NS_LOG_FLUSH(nsDnsServiceLog) //static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID); @@ -147,14 +153,14 @@ public: PR_ExplodeTime(mExpires, PR_LocalTimeParameters, &et); PR_FormatTimeUSEnglish(buf, sizeof(buf), "%c", &et); - fprintf(stderr, "\nDNS %s expires %s\n", mHostName, buf); + PRINTF("\nDNS %s expires %s\n", mHostName, buf); PR_ExplodeTime(nsTime(), PR_LocalTimeParameters, &et); PR_FormatTimeUSEnglish(buf, sizeof(buf), "%c", &et); - fprintf(stderr, "now %s ==> %s\n", buf, + PRINTF("now %s ==> %s\n", buf, mExpires < nsTime() ? "expired" : "valid"); - fflush(stderr); + FLUSH(); #endif return mExpires < nsTime(); } @@ -405,7 +411,7 @@ nsDNSLookup::Reset(void) mComplete = PR_FALSE; mStatus = NS_OK; mExpires = LL_ZERO; -// fprintf(stderr, "DNS reset for %s\n", mHostName); +// PRINTF("DNS reset for %s\n", mHostName); } nsDNSLookup::~nsDNSLookup(void) @@ -686,7 +692,7 @@ nsDNSLookup::Resume(nsDNSRequest* req) PRUint32 reqCount; if (mComplete && !IsExpired()) { -// fprintf(stderr, "\nDNS cache hit for %s\n", mHostName); +// PRINTF("\nDNS cache hit for %s\n", mHostName); rv = req->FireStop(mStatus); return rv; } @@ -704,11 +710,11 @@ nsDNSLookup::Resume(nsDNSRequest* req) if (reqCount == 1) { // if this was the first request, then we need to kick off // the lookup -// fprintf(stderr, "\nDNS cache miss for %s\n", mHostName); +// PRINTF("\nDNS cache miss for %s\n", mHostName); rv = InitiateLookup(); } else { -// fprintf(stderr, "DNS consolidating lookup for %s\n", mHostName); +// PRINTF("DNS consolidating lookup for %s\n", mHostName); } return rv; } diff --git a/mozilla/netwerk/protocol/finger/src/nsFingerChannel.cpp b/mozilla/netwerk/protocol/finger/src/nsFingerChannel.cpp index 8c99900fdb1..a4d98e4c1bb 100644 --- a/mozilla/netwerk/protocol/finger/src/nsFingerChannel.cpp +++ b/mozilla/netwerk/protocol/finger/src/nsFingerChannel.cpp @@ -32,6 +32,15 @@ #include "nsMimeTypes.h" #include "nsIStreamConverterService.h" #include "nsITXTToHTMLConv.h" +#include "nslog.h" + +#ifdef DEBUG_bryner +NS_IMPL_LOG_ENABLED(nsFingerChannelLog) +#else +NS_IMPL_LOG(nsFingerChannelLog) +#endif +#define PRINTF NS_LOG_PRINTF(nsFingerChannelLog) +#define FLUSH NS_LOG_FLUSH(nsFingerChannelLog) static NS_DEFINE_CID(kSocketTransportServiceCID, NS_SOCKETTRANSPORTSERVICE_CID); static NS_DEFINE_CID(kStreamConverterServiceCID, NS_STREAMCONVERTERSERVICE_CID); @@ -95,10 +104,8 @@ nsFingerChannel::Init(nsIURI* uri) mHost = cString; } -#ifdef DEBUG_bryner - printf("Status:mUser = %s, mHost = %s\n", (const char*)mUser, + PRINTF("Status:mUser = %s, mHost = %s\n", (const char*)mUser, (const char*)mHost); -#endif if (!*(const char *)mHost) return NS_ERROR_NOT_INITIALIZED; return NS_OK; @@ -452,11 +459,9 @@ NS_IMETHODIMP nsFingerChannel::OnStopRequest(nsIChannel* aChannel, nsISupports* aContext, nsresult aStatus, const PRUnichar* aStatusArg) { -#ifdef DEBUG_bryner - printf("nsFingerChannel::OnStopRequest, mActAsObserver=%d\n", - mActAsObserver); - printf(" aChannel = %p\n", aChannel); -#endif + PRINTF("nsFingerChannel::OnStopRequest, mActAsObserver=%d\n", + mActAsObserver); + PRINTF(" aChannel = %p\n", aChannel); nsresult rv = NS_OK; if (NS_FAILED(aStatus) || !mActAsObserver) { @@ -534,9 +539,7 @@ nsFingerChannel::SendRequest(nsIChannel* aChannel) { charstream = do_QueryInterface(result, &rv); if (NS_FAILED(rv)) return rv; -#ifdef DEBUG_bryner - printf("Sending: %s\n", requestBuffer.GetBuffer()); -#endif + PRINTF("Sending: %s\n", requestBuffer.GetBuffer()); rv = aChannel->SetTransferCount(requestBuffer.Length()); if (NS_FAILED(rv)) return rv; diff --git a/mozilla/netwerk/protocol/http/src/nsHTTPChannel.cpp b/mozilla/netwerk/protocol/http/src/nsHTTPChannel.cpp index 882cbf4dee7..52b825df60f 100644 --- a/mozilla/netwerk/protocol/http/src/nsHTTPChannel.cpp +++ b/mozilla/netwerk/protocol/http/src/nsHTTPChannel.cpp @@ -65,16 +65,16 @@ // platforms #include "nsIPref.h" #include "nsIAuthenticator.h" +#include "nslog.h" + +NS_DECL_LOG(HTTPLog) +#define PRINTF NS_LOG_PRINTF(HTTPLog) +#define FLUSH NS_LOG_FLUSH(HTTPLog) static NS_DEFINE_CID(kNetModuleMgrCID, NS_NETMODULEMGR_CID); static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID); static NS_DEFINE_CID(kWalletServiceCID, NS_WALLETSERVICE_CID); -#if defined(PR_LOGGING) -extern PRLogModuleInfo* gHTTPLog; -#endif /* PR_LOGGING */ - - nsHTTPChannel::nsHTTPChannel(nsIURI* i_URL, nsHTTPHandler* i_Handler): mResponse(nsnull), mHandler(dont_QueryInterface(i_Handler)), @@ -112,7 +112,7 @@ nsHTTPChannel::nsHTTPChannel(nsIURI* i_URL, nsHTTPHandler* i_Handler): nsXPIDLCString urlCString; mURI->GetSpec(getter_Copies(urlCString)); - PR_LOG(gHTTPLog, PR_LOG_DEBUG, + PR_LOG(HTTPLog, PR_LOG_DEBUG, ("Creating nsHTTPChannel [this=%x] for URI: %s.\n", this, (const char *)urlCString)); #endif @@ -124,7 +124,7 @@ nsHTTPChannel::nsHTTPChannel(nsIURI* i_URL, nsHTTPHandler* i_Handler): nsHTTPChannel::~nsHTTPChannel() { - PR_LOG(gHTTPLog, PR_LOG_ALWAYS, + PR_LOG(HTTPLog, PR_LOG_ALWAYS, ("Deleting nsHTTPChannel [this=%x].\n", this)); #ifdef NS_DEBUG @@ -1082,7 +1082,7 @@ nsHTTPChannel::CheckCache() // If validation is inhibited, we'll just use whatever data is in // the cache, regardless of whether or not it has expired. if (mLoadAttributes & nsIChannel::VALIDATE_NEVER) { - PR_LOG(gHTTPLog, PR_LOG_ALWAYS, + PR_LOG(HTTPLog, PR_LOG_ALWAYS, ("nsHTTPChannel::checkCache() [this=%x].\t" "obeying VALIDATE_NEVER\n", this)); mCachedContentIsValid = PR_TRUE; @@ -1222,7 +1222,7 @@ nsHTTPChannel::ReadFromCache() URLSpec = nsCRT::strdup("?"); } - PR_LOG(gHTTPLog, PR_LOG_ALWAYS, + PR_LOG(HTTPLog, PR_LOG_ALWAYS, ("nsHTTPChannel::ReadFromCache [this=%x].\t" "Using cache copy for: %s\n", this, URLSpec)); @@ -1740,7 +1740,7 @@ nsresult nsHTTPChannel::Redirect(const char *aNewLocation, log_rv = newURI->GetSpec(&newURLSpec); if (NS_FAILED(log_rv)) newURLSpec = nsCRT::strdup("?"); - PR_LOG(gHTTPLog, PR_LOG_ALWAYS, + PR_LOG(HTTPLog, PR_LOG_ALWAYS, ("ProcessRedirect [this=%x].\tRedirecting to: %s.\n", this, newURLSpec)); nsMemory::Free(newURLSpec); @@ -1831,7 +1831,7 @@ nsresult nsHTTPChannel::ResponseCompleted(nsIStreamListener *aListener, { nsresult rv = NS_OK; - PR_LOG(gHTTPLog, PR_LOG_ERROR, + PR_LOG(HTTPLog, PR_LOG_ERROR, ("nsHTTPChannel::ResponseComplete() [this=%x] " " mDataListenet=%x, Status=%o\n", this, (void*)mResponseDataListener, aStatus)); @@ -1924,7 +1924,7 @@ nsresult nsHTTPChannel::ResponseCompleted(nsIStreamListener *aListener, if (NS_FAILED (rv)) { - PR_LOG(gHTTPLog, PR_LOG_ERROR, ("nsHTTPChannel::OnStopRequest(...) [this=%x]." + PR_LOG(HTTPLog, PR_LOG_ERROR, ("nsHTTPChannel::OnStopRequest(...) [this=%x]." "\tOnStopRequest to consumer failed! Status:%x\n", this, rv)); } @@ -2115,7 +2115,7 @@ nsHTTPChannel::Authenticate(const char *iChallenge, PRBool iProxyAuth) authLine.Left(authType, space); #if defined(DEBUG_shaver) || defined(DEBUG_gagan) - fprintf(stderr, "Auth type: \"%s\"\n", authType.GetBuffer()); + PRINTF("Auth type: \"%s\"\n", authType.GetBuffer()); #endif // normalize to lowercase char *authLower = nsCRT::strdup(authType.GetBuffer()); @@ -2200,9 +2200,7 @@ nsHTTPChannel::Authenticate(const char *iChallenge, PRBool iProxyAuth) if (pEngine) pEngine->GetAuthStringForRealm(mURI, authRealm, getter_Copies(authString)); -#ifdef DEBUG_darin - fprintf(stderr, "\n>>>>> Authentication for Realm: [realm=%s, auth=%s]\n\n", (const char*) authRealm, (const char*) authString); -#endif + PRINTF(">>>>> Authentication for Realm: [realm=%s, auth=%s]\n\n", (const char*) authRealm, (const char*) authString); } // Skip prompting if we already have an authentication string. @@ -2258,7 +2256,7 @@ nsHTTPChannel::Authenticate(const char *iChallenge, PRBool iProxyAuth) } #if defined(DEBUG_shaver) || defined(DEBUG_gagan) - fprintf(stderr, "Auth string: %s\n", (const char *)authString); + PRINTF("Auth string: %s\n", (const char *)authString); #endif // Construct a new channel @@ -2322,7 +2320,7 @@ nsHTTPChannel::FinishedResponseHeaders(void) rv = NS_OK; - PR_LOG(gHTTPLog, PR_LOG_ALWAYS, + PR_LOG(HTTPLog, PR_LOG_ALWAYS, ("nsHTTPChannel::FinishedResponseHeaders [this=%x].\n", this)); @@ -2378,9 +2376,7 @@ nsHTTPChannel::ProcessStatusCode(void) { rv = GetRequestHeader(nsHTTPAtoms::Authorization, getter_Copies(authString)); -#ifdef DEBUG_darin - fprintf(stderr, "\n>>>>> Auth Accepted!! [realm=%s, auth=%s]\n\n", mAuthRealm, (const char*) authString); -#endif + PRINTF(">>>>> Auth Accepted!! [realm=%s, auth=%s]\n\n", mAuthRealm, (const char*) authString); if (mAuthRealm) pEngine->SetAuthStringForRealm(mURI, mAuthRealm, authString); else @@ -2388,11 +2384,9 @@ nsHTTPChannel::ProcessStatusCode(void) } else // clear out entry from single signon and our cache. { -#ifdef DEBUG_darin rv = GetRequestHeader(nsHTTPAtoms::Authorization, getter_Copies(authString)); - fprintf(stderr, "\n>>>>> Auth Rejected!! [realm=%s, auth=%s]\n\n", mAuthRealm, (const char*) authString); -#endif + PRINTF(">>>>> Auth Rejected!! [realm=%s, auth=%s]\n\n", mAuthRealm, (const char*) authString); pEngine->SetAuthString(mURI, 0); NS_WITH_SERVICE(nsIWalletService, walletService, @@ -2426,7 +2420,7 @@ nsHTTPChannel::ProcessStatusCode(void) // Informational: 1xx // case 1: - PR_LOG(gHTTPLog, PR_LOG_ALWAYS, + PR_LOG(HTTPLog, PR_LOG_ALWAYS, ("ProcessStatusCode [this=%x].\tStatus - Informational: %d.\n", this, statusCode)); break; @@ -2435,7 +2429,7 @@ nsHTTPChannel::ProcessStatusCode(void) // Successful: 2xx // case 2: - PR_LOG(gHTTPLog, PR_LOG_ALWAYS, + PR_LOG(HTTPLog, PR_LOG_ALWAYS, ("ProcessStatusCode [this=%x].\tStatus - Successful: %d.\n", this, statusCode)); @@ -2449,7 +2443,7 @@ nsHTTPChannel::ProcessStatusCode(void) } if (statusCode == 204) { - PR_LOG(gHTTPLog, PR_LOG_ALWAYS, + PR_LOG(HTTPLog, PR_LOG_ALWAYS, ("ProcessStatusCode [this=%x].\tStatus - Successful: %d.\n", this, statusCode)); } @@ -2459,7 +2453,7 @@ nsHTTPChannel::ProcessStatusCode(void) // Redirection: 3xx // case 3: - PR_LOG(gHTTPLog, PR_LOG_ALWAYS, + PR_LOG(HTTPLog, PR_LOG_ALWAYS, ("ProcessStatusCode [this=%x].\tStatus - Redirection: %d.\n", this, statusCode)); @@ -2487,7 +2481,7 @@ nsHTTPChannel::ProcessStatusCode(void) // Client Error: 4xx // case 4: - PR_LOG(gHTTPLog, PR_LOG_ALWAYS, + PR_LOG(HTTPLog, PR_LOG_ALWAYS, ("ProcessStatusCode [this=%x].\tStatus - Client Error: %d.\n", this, statusCode)); if ((401 == statusCode) || (407 == statusCode)) { @@ -2501,7 +2495,7 @@ nsHTTPChannel::ProcessStatusCode(void) // Server Error: 5xo // case 5: - PR_LOG(gHTTPLog, PR_LOG_ALWAYS, + PR_LOG(HTTPLog, PR_LOG_ALWAYS, ("ProcessStatusCode [this=%x].\tStatus - Server Error: %d.\n", this, statusCode)); break; @@ -2510,7 +2504,7 @@ nsHTTPChannel::ProcessStatusCode(void) // Unknown Status Code category... // default: - PR_LOG(gHTTPLog, PR_LOG_ALWAYS, + PR_LOG(HTTPLog, PR_LOG_ALWAYS, ("ProcessStatusCode [this=%x].\tStatus - " "Unknown Status Code category: %d.\n", this, statusCode)); @@ -2546,7 +2540,7 @@ nsHTTPChannel::ProcessNotModifiedResponse(nsIStreamListener *aListener) URLSpec = nsCRT::strdup("?"); } - PR_LOG(gHTTPLog, PR_LOG_ALWAYS, + PR_LOG(HTTPLog, PR_LOG_ALWAYS, ("nsHTTPChannel::ProcessNotModifiedResponse [this=%x].\t" "Using cache copy for: %s\n", this, URLSpec)); diff --git a/mozilla/netwerk/protocol/http/src/nsHTTPHandler.cpp b/mozilla/netwerk/protocol/http/src/nsHTTPHandler.cpp index 6fcb8ce5d01..49486b84a32 100644 --- a/mozilla/netwerk/protocol/http/src/nsHTTPHandler.cpp +++ b/mozilla/netwerk/protocol/http/src/nsHTTPHandler.cpp @@ -55,6 +55,11 @@ #include "nsHTTPRequest.h" #include "nsIWebFilters.h" +#include "nslog.h" + +NS_IMPL_LOG(HTTPLog) +#define PRINTF NS_LOG_PRINTF(HTTPLog) +#define FLUSH NS_LOG_FLUSH(HTTPLog) #ifdef XP_UNIX #include @@ -64,21 +69,6 @@ #include #endif -#if defined(PR_LOGGING) -// -// Log module for HTTP Protocol logging... -// -// To enable logging (see prlog.h for full details): -// -// set NSPR_LOG_MODULES=nsHTTPProtocol:5 -// set NSPR_LOG_FILE=nspr.log -// -// this enables PR_LOG_ALWAYS level information and places all output in -// the file nspr.log -// -PRLogModuleInfo* gHTTPLog = nsnull; -#endif /* PR_LOGGING */ - static PRInt32 PR_CALLBACK HTTPPrefsCallback(const char* pref, void* instance); static const char NETWORK_PREFS[] = "network."; static const char INTL_ACCEPT_LANGUAGES[] = "intl.accept_languages"; @@ -160,7 +150,7 @@ CategoryCreateService( const char *category ) } #ifdef DEBUG_HTTP_STARTUP_CATEGORY - printf("HTTP Handler: Instantiating contractid %s \ + PRINTF("HTTP Handler: Instantiating contractid %s \ in http startup category.\n", (const char *)contractID); #endif /* DEBUG_HTTP_STARTUP_CATEGORY */ nsCOMPtr instance = do_GetService(contractID, &rv); @@ -777,13 +767,9 @@ nsHTTPHandler::Init() HTTPPrefsCallback, (void *)this); PrefsChanged(); -#if defined (PR_LOGGING) - gHTTPLog = PR_NewLogModule("nsHTTPProtocol"); -#endif /* PR_LOGGING */ - mSessionStartTime = PR_Now(); - PR_LOG(gHTTPLog, PR_LOG_ALWAYS, ("Creating nsHTTPHandler [this=%x].\n", + PR_LOG(HTTPLog, PR_LOG_ALWAYS, ("Creating nsHTTPHandler [this=%x].\n", this)); // Initialize the Atoms used by the HTTP protocol... @@ -818,7 +804,7 @@ nsHTTPHandler::Init() nsHTTPHandler::~nsHTTPHandler() { - PR_LOG(gHTTPLog, PR_LOG_ALWAYS, + PR_LOG(HTTPLog, PR_LOG_ALWAYS, ("Deleting nsHTTPHandler [this=%x].\n", this)); mIdleTransports ->Clear(); @@ -980,7 +966,7 @@ nsresult nsHTTPHandler::RequestTransport(nsIURI* i_Uri, ? NS_OK : NS_ERROR_FAILURE; NS_ASSERTION (NS_SUCCEEDED(rv), "AppendElement failed"); - PR_LOG (gHTTPLog, PR_LOG_ALWAYS, + PR_LOG (HTTPLog, PR_LOG_ALWAYS, ("nsHTTPHandler::RequestTransport.""\tAll socket transports are busy." "\tAdding nsHTTPChannel [%x] to pending list.\n", i_Channel)); @@ -1024,7 +1010,7 @@ nsresult nsHTTPHandler::RequestTransport(nsIURI* i_Uri, *o_pTrans = trans; NS_IF_ADDREF(*o_pTrans); - PR_LOG(gHTTPLog, PR_LOG_ALWAYS, + PR_LOG(HTTPLog, PR_LOG_ALWAYS, ("nsHTTPHandler::RequestTransport." "\tGot a socket transport for nsHTTPChannel [%x]. %d " " Active transports.\n", @@ -1087,7 +1073,7 @@ nsHTTPHandler::ReleaseTransport (nsIChannel* i_pTrans , PRUint32 capabilities = (mCapabilities & aCapabilities); - PR_LOG (gHTTPLog, PR_LOG_DEBUG, ("nsHTTPHandler::ReleaseTransport [this=%x] " + PR_LOG (HTTPLog, PR_LOG_DEBUG, ("nsHTTPHandler::ReleaseTransport [this=%x] " "i_pTrans=%x, aCapabilites=%o, aKeepAliveTimeout=%d, aKeepAliveMaxCon=%d, " "maxKeepAlives=%d\n", this, i_pTrans, aCapabilities, @@ -1102,7 +1088,7 @@ nsHTTPHandler::ReleaseTransport (nsIChannel* i_pTrans , if (aKeepAliveTimeout > (PRUint32)mKeepAliveTimeout) aKeepAliveTimeout = (PRUint32)mKeepAliveTimeout; - PR_LOG (gHTTPLog, PR_LOG_ALWAYS, + PR_LOG (HTTPLog, PR_LOG_ALWAYS, ("nsHTTPHandler::ReleaseTransport." "\tReleasing socket transport %x.\n", i_pTrans)); @@ -1225,7 +1211,7 @@ nsHTTPHandler::ReleaseTransport (nsIChannel* i_pTrans , mPendingChannelList->Count(&count); mTransportList->Count(&transportsInUseCount); - PR_LOG (gHTTPLog, PR_LOG_ALWAYS, ("nsHTTPHandler::ReleaseTransport():" + PR_LOG (HTTPLog, PR_LOG_ALWAYS, ("nsHTTPHandler::ReleaseTransport():" "pendingChannels=%d, InUseCount=%d\n", count, transportsInUseCount)); if (!count || (transportsInUseCount >= (PRUint32) mMaxConnections)) @@ -1240,7 +1226,7 @@ nsHTTPHandler::ReleaseTransport (nsIChannel* i_pTrans , mPendingChannelList->RemoveElement(item); channel = (nsHTTPChannel*)(nsIRequest*)(nsISupports*)item; - PR_LOG (gHTTPLog, PR_LOG_ALWAYS, ("nsHTTPHandler::ReleaseTransport." + PR_LOG (HTTPLog, PR_LOG_ALWAYS, ("nsHTTPHandler::ReleaseTransport." "\tRestarting nsHTTPChannel [%x]\n", channel)); channel->Open(); @@ -1257,7 +1243,7 @@ nsresult nsHTTPHandler::CancelPendingChannel(nsHTTPChannel* aChannel) ret = (PRBool) mPendingChannelList->RemoveElement( (nsISupports*)(nsIRequest*)aChannel); - PR_LOG(gHTTPLog, PR_LOG_ALWAYS, + PR_LOG(HTTPLog, PR_LOG_ALWAYS, ("nsHTTPHandler::CancelPendingChannel." "\tCancelling nsHTTPChannel [%x]\n", aChannel)); diff --git a/mozilla/netwerk/protocol/http/src/nsHTTPRequest.cpp b/mozilla/netwerk/protocol/http/src/nsHTTPRequest.cpp index 42fb91e1505..1d0594a3160 100644 --- a/mozilla/netwerk/protocol/http/src/nsHTTPRequest.cpp +++ b/mozilla/netwerk/protocol/http/src/nsHTTPRequest.cpp @@ -43,10 +43,9 @@ #include "nsISocketTransport.h" #include "nsISecureSocketInfo.h" #include "plstr.h" +#include "nslog.h" -#if defined(PR_LOGGING) -extern PRLogModuleInfo* gHTTPLog; -#endif /* PR_LOGGING */ +NS_DECL_LOG(HTTPLog) static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID); static NS_DEFINE_CID(kHTTPHandlerCID, NS_IHTTPHANDLER_CID); @@ -83,7 +82,7 @@ nsHTTPRequest::nsHTTPRequest(nsIURI* i_URL, nsXPIDLCString urlCString; mURI->GetSpec(getter_Copies(urlCString)); - PR_LOG(gHTTPLog, PR_LOG_DEBUG, + PR_LOG(HTTPLog, PR_LOG_DEBUG, ("Creating nsHTTPRequest [this=%p] for URI: %s.\n", this,(const char *)urlCString)); #endif @@ -101,7 +100,7 @@ nsHTTPRequest::nsHTTPRequest(nsIURI* i_URL, nsHTTPRequest::~nsHTTPRequest() { - PR_LOG(gHTTPLog, PR_LOG_ALWAYS, + PR_LOG(HTTPLog, PR_LOG_ALWAYS, ("Deleting nsHTTPRequest [this=%x].\n", this)); CRTFREEIF(mRequestSpec); @@ -564,7 +563,7 @@ nsHTTPPipelinedRequest::nsHTTPPipelinedRequest(nsHTTPHandler* i_Handler, const c NS_INIT_REFCNT(); mHost = host; - PR_LOG(gHTTPLog, PR_LOG_DEBUG,("Creating nsHTTPPipelinedRequest [this=%p], created=%d, deleted=%d\n", + PR_LOG(HTTPLog, PR_LOG_DEBUG,("Creating nsHTTPPipelinedRequest [this=%p], created=%d, deleted=%d\n", this, ++sPipelinedRequestCreated, sPipelinedRequestDeleted)); NS_NewISupportsArray(getter_AddRefs(mRequests)); @@ -577,7 +576,7 @@ nsHTTPPipelinedRequest::~nsHTTPPipelinedRequest() PRUint32 count = 0; PRInt32 index; - PR_LOG(gHTTPLog, PR_LOG_DEBUG,("Deleting nsHTTPPipelinedRequest [this=%p], created=%d, deleted=%d\n", + PR_LOG(HTTPLog, PR_LOG_DEBUG,("Deleting nsHTTPPipelinedRequest [this=%p], created=%d, deleted=%d\n", this, sPipelinedRequestCreated, ++sPipelinedRequestDeleted)); if (mRequests) @@ -629,7 +628,7 @@ nsHTTPPipelinedRequest::WriteRequest(nsIInputStream* iRequestStream) PRUint32 count = 0; PRUint32 index; - PR_LOG(gHTTPLog, PR_LOG_ALWAYS, ("nsHTTPPipelinedRequest::WriteRequest()[%p], mOnStopDone=%d, mTransport=%x\n", this, mOnStopDone, mTransport.get())); + PR_LOG(HTTPLog, PR_LOG_ALWAYS, ("nsHTTPPipelinedRequest::WriteRequest()[%p], mOnStopDone=%d, mTransport=%x\n", this, mOnStopDone, mTransport.get())); if (!mRequests) return NS_ERROR_FAILURE; @@ -693,7 +692,7 @@ nsHTTPPipelinedRequest::WriteRequest(nsIInputStream* iRequestStream) // // Build up the request into mRequestBuffer... // - PR_LOG(gHTTPLog, PR_LOG_ALWAYS, + PR_LOG(HTTPLog, PR_LOG_ALWAYS, ("\nnsHTTPRequest::Build() [this=%p].\tWriting Request:\n" "=== Start\n%s=== End\n", this, mRequestBuffer.GetBuffer())); @@ -744,7 +743,7 @@ nsHTTPPipelinedRequest::WriteRequest(nsIInputStream* iRequestStream) NS_IMETHODIMP nsHTTPPipelinedRequest::OnStartRequest(nsIChannel* channel, nsISupports* i_Context) { - PR_LOG(gHTTPLog, PR_LOG_ALWAYS, + PR_LOG(HTTPLog, PR_LOG_ALWAYS, ("nsHTTPRequest [this=%x]. Starting to write data to the server.\n", this)); // this needs to propogate up if mInputStream was set... @@ -762,7 +761,7 @@ nsHTTPPipelinedRequest::OnStopRequest(nsIChannel* channel, nsISupports* i_Contex rv = aStatus; - PR_LOG(gHTTPLog, PR_LOG_DEBUG,("\nnsHTTPRequest::OnStopRequest() [this=%x], aStatus=%u\n", this, aStatus)); + PR_LOG(HTTPLog, PR_LOG_DEBUG,("\nnsHTTPRequest::OnStopRequest() [this=%x], aStatus=%u\n", this, aStatus)); if (NS_SUCCEEDED(rv)) { @@ -778,7 +777,7 @@ nsHTTPPipelinedRequest::OnStopRequest(nsIChannel* channel, nsISupports* i_Contex // if (mInputStream) { - PR_LOG(gHTTPLog, PR_LOG_ALWAYS, + PR_LOG(HTTPLog, PR_LOG_ALWAYS, ("nsHTTPRequest [this=%x]. " "Writing PUT/POST data to the server.\n", this)); @@ -792,7 +791,7 @@ nsHTTPPipelinedRequest::OnStopRequest(nsIChannel* channel, nsISupports* i_Contex // else { - PR_LOG(gHTTPLog, PR_LOG_ALWAYS, + PR_LOG(HTTPLog, PR_LOG_ALWAYS, ("nsHTTPRequest [this=%p]. " "Finished writing request to server." "\tStatus: %x\n", this, aStatus)); @@ -830,7 +829,7 @@ nsHTTPPipelinedRequest::OnStopRequest(nsIChannel* channel, nsISupports* i_Contex // else { - PR_LOG(gHTTPLog, PR_LOG_ERROR, + PR_LOG(HTTPLog, PR_LOG_ERROR, ("nsHTTPRequest [this=%p]. Error writing request to server." "\tStatus: %x\n", this, aStatus)); rv = aStatus; @@ -854,7 +853,7 @@ nsHTTPPipelinedRequest::OnStopRequest(nsIChannel* channel, nsISupports* i_Contex req->mConnection->GetStatus(&channelStatus); - PR_LOG(gHTTPLog, PR_LOG_DEBUG,("nsHTTPRequest::OnStopRequest() [this=%p]. wasKeptAlive=%d, channelStatus=%x\n", this, wasKeptAlive, channelStatus)); + PR_LOG(HTTPLog, PR_LOG_DEBUG,("nsHTTPRequest::OnStopRequest() [this=%p]. wasKeptAlive=%d, channelStatus=%x\n", this, wasKeptAlive, channelStatus)); if (wasKeptAlive && NS_SUCCEEDED(channelStatus)) { @@ -921,7 +920,7 @@ nsHTTPPipelinedRequest::RestartRequest(PRUint32 aType) { nsresult rval = NS_ERROR_FAILURE; - PR_LOG(gHTTPLog, PR_LOG_DEBUG,("nsHTTPPipelinedRequest::RestartRequest() [this=%p], mTotalProcessed=%u\n", this, mTotalProcessed)); + PR_LOG(HTTPLog, PR_LOG_DEBUG,("nsHTTPPipelinedRequest::RestartRequest() [this=%p], mTotalProcessed=%u\n", this, mTotalProcessed)); if (aType == REQUEST_RESTART_SSL) { @@ -975,7 +974,7 @@ nsHTTPPipelinedRequest::RestartRequest(PRUint32 aType) NS_RELEASE(req); } - PR_LOG(gHTTPLog, PR_LOG_DEBUG,("nsHTTPPipelinedRequest::RestartRequest() [this=%p], wasKepAlive=%u, mAttempts=%d, mOnStopDone=%d\n", this, wasKeptAlive, mAttempts, mOnStopDone)); + PR_LOG(HTTPLog, PR_LOG_DEBUG,("nsHTTPPipelinedRequest::RestartRequest() [this=%p], wasKepAlive=%u, mAttempts=%d, mOnStopDone=%d\n", this, wasKeptAlive, mAttempts, mOnStopDone)); if (wasKeptAlive && mAttempts == 0 && NS_SUCCEEDED(channelStatus)) { @@ -1103,7 +1102,7 @@ nsHTTPPipelinedRequest::AddToPipeline(nsHTTPRequest *aRequest) if (sLongestPipeline < count + 1) sLongestPipeline = count + 1; - PR_LOG(gHTTPLog, PR_LOG_DEBUG, + PR_LOG(HTTPLog, PR_LOG_DEBUG, ("nsHTTPPipelinedRequest::AddToPipeline() [this=%p]" " count=%u, longest pipeline=%u\n", this, count + 1, sLongestPipeline)); diff --git a/mozilla/netwerk/protocol/http/src/nsHTTPResponse.cpp b/mozilla/netwerk/protocol/http/src/nsHTTPResponse.cpp index 78eb7e92d9a..3c9e1b59fe0 100644 --- a/mozilla/netwerk/protocol/http/src/nsHTTPResponse.cpp +++ b/mozilla/netwerk/protocol/http/src/nsHTTPResponse.cpp @@ -30,10 +30,9 @@ #include "nsString.h" #include "nsXPIDLString.h" #include "nsHTTPAtoms.h" +#include "nslog.h" -#if defined(PR_LOGGING) -extern PRLogModuleInfo* gHTTPLog; -#endif /* PR_LOGGING */ +NS_DECL_LOG(HTTPLog) // When deciding heuristically whether or not to validate an HTTP response with // the server, this constant can be used to tune how conservative the algorithm @@ -294,7 +293,7 @@ nsresult nsHTTPResponse::ParseStatusLine(nsCString& aStatusLine) rv = SetServerVersion(token); if (NS_FAILED(rv)) return rv; - PR_LOG(gHTTPLog, PR_LOG_ALWAYS, + PR_LOG(HTTPLog, PR_LOG_ALWAYS, ("\tParseStatusLine [this=%x].\tHTTP-Version: %s\n", this, token)); @@ -317,7 +316,7 @@ nsresult nsHTTPResponse::ParseStatusLine(nsCString& aStatusLine) SetStatus(statusCode); - PR_LOG(gHTTPLog, PR_LOG_ALWAYS, + PR_LOG(HTTPLog, PR_LOG_ALWAYS, ("\tParseStatusLine [this=%x].\tStatus-Code: %d\n", this, statusCode)); @@ -329,7 +328,7 @@ nsresult nsHTTPResponse::ParseStatusLine(nsCString& aStatusLine) token = aStatusLine.GetBuffer(); SetStatusString(token); - PR_LOG(gHTTPLog, PR_LOG_ALWAYS, + PR_LOG(HTTPLog, PR_LOG_ALWAYS, ("\tParseStatusLine [this=%x].\tReason-Phrase: %s\n", this, token)); @@ -796,7 +795,7 @@ nsresult nsHTTPResponse::UpdateHeaders(nsISimpleEnumerator *aEnumerator) nsCOMPtr headerAtom; nsXPIDLCString headerValue; - PR_LOG(gHTTPLog, PR_LOG_DEBUG, + PR_LOG(HTTPLog, PR_LOG_DEBUG, ("nsHTTPResponse::UpdateHeaders [this=%x].\n", this)); rv = aEnumerator->HasMoreElements(&bMoreHeaders); @@ -842,7 +841,7 @@ nsresult nsHTTPResponse::UpdateHeaders(nsISimpleEnumerator *aEnumerator) // Convert the atom name from unicode to ascii... atom->GetUnicode(&name); nameBuffer.AssignWithConversion(name); - PR_LOG(gHTTPLog, PR_LOG_ALWAYS, + PR_LOG(HTTPLog, PR_LOG_ALWAYS, ("\tUpdateHeaders [this=%x]." "\tIgnoring response header: \'%s\'\n", this, nameBuffer.GetBuffer())); @@ -864,7 +863,7 @@ nsresult nsHTTPResponse::UpdateHeaders(nsISimpleEnumerator *aEnumerator) atom->GetUnicode(&name); nameBuffer.AssignWithConversion(name); - PR_LOG(gHTTPLog, PR_LOG_ALWAYS, + PR_LOG(HTTPLog, PR_LOG_ALWAYS, ("\tUpdateHeaders [this=%x].\tNew response header: \'%s: %s\'\n", this, nameBuffer.GetBuffer(), (const char*)headerValue)); #endif /* PR_LOGGING */ diff --git a/mozilla/netwerk/protocol/http/src/nsHTTPResponseListener.cpp b/mozilla/netwerk/protocol/http/src/nsHTTPResponseListener.cpp index ef63fbedf24..31c470a18ca 100644 --- a/mozilla/netwerk/protocol/http/src/nsHTTPResponseListener.cpp +++ b/mozilla/netwerk/protocol/http/src/nsHTTPResponseListener.cpp @@ -45,13 +45,12 @@ #include "nsXPIDLString.h" #include "nsIIOService.h" +#include "nslog.h" + +NS_DECL_LOG(HTTPLog) static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID) ; -#if defined(PR_LOGGING) -extern PRLogModuleInfo* gHTTPLog; -#endif /* PR_LOGGING */ - // // This specifies the maximum allowable size for a server Status-Line // or Response-Header. @@ -80,7 +79,7 @@ nsHTTPResponseListener::nsHTTPResponseListener(nsHTTPChannel *aChannel, url->GetSpec(getter_Copies(urlCString)) ; } - PR_LOG(gHTTPLog, PR_LOG_DEBUG, + PR_LOG(HTTPLog, PR_LOG_DEBUG, ("Creating nsHTTPResponseListener [this=%x] for URI: %s.\n", this,(const char *) urlCString)) ; #endif @@ -121,14 +120,14 @@ NS_IMPL_QUERY_INTERFACE2(nsHTTPResponseListener, nsHTTPCacheListener::nsHTTPCacheListener(nsHTTPChannel* aChannel, nsHTTPHandler *handler) : nsHTTPResponseListener(aChannel, handler) { - PR_LOG(gHTTPLog, PR_LOG_ALWAYS, + PR_LOG(HTTPLog, PR_LOG_ALWAYS, ("Creating nsHTTPCacheListener [this=%x].\n", this)) ; } nsHTTPCacheListener::~nsHTTPCacheListener() { - PR_LOG(gHTTPLog, PR_LOG_ALWAYS, + PR_LOG(HTTPLog, PR_LOG_ALWAYS, ("Deleting nsHTTPCacheListener [this=%x].\n", this)) ; } @@ -139,7 +138,7 @@ NS_IMETHODIMP nsHTTPCacheListener::OnStartRequest(nsIChannel *aChannel, nsISupports *aContext) { - PR_LOG(gHTTPLog, PR_LOG_DEBUG, + PR_LOG(HTTPLog, PR_LOG_DEBUG, ("nsHTTPCacheListener::OnStartRequest [this=%x]\n", this)) ; mBodyBytesReceived = 0; @@ -153,7 +152,7 @@ NS_IMETHODIMP nsHTTPCacheListener::OnStopRequest(nsIChannel *aChannel, nsISupports *aContext, nsresult aStatus, const PRUnichar* aStatusArg) { - PR_LOG(gHTTPLog, PR_LOG_DEBUG, + PR_LOG(HTTPLog, PR_LOG_DEBUG, ("nsHTTPCacheListener::OnStopRequest [this=%x]\n", this)) ; // @@ -256,13 +255,13 @@ nsHTTPServerListener::nsHTTPServerListener(nsHTTPChannel* aChannel, nsHTTPHandle if (mChunkHeaderEOF) mChunkHeaderEOF->SetData(&mChunkHeaderCtx) ; - PR_LOG(gHTTPLog, PR_LOG_ALWAYS, + PR_LOG(HTTPLog, PR_LOG_ALWAYS, ("Creating nsHTTPServerListener [this=%x].\n", this)) ; } nsHTTPServerListener::~nsHTTPServerListener() { - PR_LOG(gHTTPLog, PR_LOG_ALWAYS, + PR_LOG(HTTPLog, PR_LOG_ALWAYS, ("Deleting nsHTTPServerListener [this=%x].\n", this)) ; // These two should go away in the OnStopRequest() callback. @@ -293,7 +292,7 @@ nsHTTPServerListener::OnDataAvailable(nsIChannel* channel, nsCOMPtr bufferInStream = do_QueryInterface(i_pStream) ; - PR_LOG(gHTTPLog, PR_LOG_ALWAYS, + PR_LOG(HTTPLog, PR_LOG_ALWAYS, ("nsHTTPServerListener::OnDataAvailable [this=%x].\n" "\tstream=%x. \toffset=%d. \tlength=%d.\n", this, i_pStream, i_SourceOffset, i_Length)) ; @@ -333,7 +332,7 @@ nsHTTPServerListener::OnDataAvailable(nsIChannel* channel, i_Length -= actualBytesRead; } - PR_LOG(gHTTPLog, PR_LOG_ALWAYS, + PR_LOG(HTTPLog, PR_LOG_ALWAYS, ("\tOnDataAvailable [this=%x]. Parsing Headers\n", this)) ; // // Parse the response headers as long as there is more data and @@ -397,7 +396,7 @@ nsHTTPServerListener::OnDataAvailable(nsIChannel* channel, mResponse = nsnull; mBytesReceived = 0; - PR_LOG(gHTTPLog, PR_LOG_DEBUG, + PR_LOG(HTTPLog, PR_LOG_DEBUG, ("\tOnDataAvailable [this=%x].(100) Continue\n", this)) ; } else @@ -418,7 +417,7 @@ nsHTTPServerListener::OnDataAvailable(nsIChannel* channel, return NS_OK; - PR_LOG(gHTTPLog, PR_LOG_DEBUG, + PR_LOG(HTTPLog, PR_LOG_DEBUG, ("\tOnDataAvailable [this=%x].(200) SSL CONNECT\n", this)) ; } @@ -625,7 +624,7 @@ nsHTTPServerListener::OnDataAvailable(nsIChannel* channel, NS_IMETHODIMP nsHTTPServerListener::OnStartRequest(nsIChannel* channel, nsISupports* i_pContext) { - PR_LOG(gHTTPLog, PR_LOG_ALWAYS, + PR_LOG(HTTPLog, PR_LOG_ALWAYS, ("nsHTTPServerListener::OnStartRequest [this=%x].\n", this)) ; // Initialize header varaibles... @@ -673,7 +672,7 @@ nsHTTPServerListener::OnStopRequest(nsIChannel* channel, nsISupports* i_pContext if (mChannel) mChannel->GetStatus(&channelStatus) ; - PR_LOG(gHTTPLog, PR_LOG_ALWAYS, + PR_LOG(HTTPLog, PR_LOG_ALWAYS, ("nsHTTPServerListener::OnStopRequest [this=%x]." "\tStatus = %x, mDataReceived=%d\n", this, i_Status, mDataReceived)) ; @@ -818,7 +817,7 @@ nsHTTPServerListener::OnStopRequest(nsIChannel* channel, nsISupports* i_pContext nsresult nsHTTPServerListener::Abort() { - PR_LOG(gHTTPLog, PR_LOG_ALWAYS, + PR_LOG(HTTPLog, PR_LOG_ALWAYS, ("nsHTTPServerListener::Abort [this=%x].", this)) ; // @@ -882,7 +881,7 @@ nsresult nsHTTPServerListener::ParseStatusLine(nsIInputStream* in, nsresult rv = NS_OK; PRUint32 actualBytesRead; - PR_LOG(gHTTPLog, PR_LOG_ALWAYS, + PR_LOG(HTTPLog, PR_LOG_ALWAYS, ("nsHTTPServerListener::ParseStatusLine [this=%x].\taLength=%d\n", this, aLength)) ; @@ -920,7 +919,7 @@ nsresult nsHTTPServerListener::ParseStatusLine(nsIInputStream* in, // Wait for more data to arrive before processing the header... if (bL > 0 && mHeaderBuffer.CharAt(bL - 1) != LF) return NS_OK; - PR_LOG(gHTTPLog, PR_LOG_ALWAYS, + PR_LOG(HTTPLog, PR_LOG_ALWAYS, ("\tParseStatusLine [this=%x].\tGot Status-Line:%s\n" , this, mHeaderBuffer.GetBuffer()) ) ; @@ -941,7 +940,7 @@ nsresult nsHTTPServerListener::ParseStatusLine(nsIInputStream* in, // This is a HTTP/0.9 response... // Pretend that the headers have been consumed. // - PR_LOG(gHTTPLog, PR_LOG_ALWAYS, + PR_LOG(HTTPLog, PR_LOG_ALWAYS, ("\tParseStatusLine [this=%x]. HTTP/0.9 Server Response!" " Hold onto you seats!\n", this)) ; @@ -1013,7 +1012,7 @@ nsresult nsHTTPServerListener::ParseHTTPHeader(nsIInputStream* in, newlineOffset++; } while (PR_TRUE); - PR_LOG(gHTTPLog, PR_LOG_ALWAYS, + PR_LOG(HTTPLog, PR_LOG_ALWAYS, ("\tParseHTTPHeader [this=%x].\tGot header string:%s\n", this, mHeaderBuffer.GetBuffer()) ) ; @@ -1048,7 +1047,7 @@ nsHTTPServerListener::FinishedResponseHeaders() rv = mResponseDataListener->OnStartRequest(mChannel, mChannel->mResponseContext) ; if (NS_FAILED(rv)) { - PR_LOG(gHTTPLog, PR_LOG_ERROR,("\tOnStartRequest [this=%x]. Consumer failed!" + PR_LOG(HTTPLog, PR_LOG_ERROR,("\tOnStartRequest [this=%x]. Consumer failed!" "Status: %x\n", this, rv)) ; } } @@ -1081,7 +1080,7 @@ nsHTTPFinalListener::nsHTTPFinalListener( mBusy(PR_FALSE) , mOnStopPending(PR_FALSE) { - PR_LOG(gHTTPLog, PR_LOG_ALWAYS, + PR_LOG(HTTPLog, PR_LOG_ALWAYS, ("Creating nsHTTPFinalListener [this=%x], created=%u, deleted=%u\n", this, ++sFinalListenersCreated, sFinalListenersDeleted)) ; @@ -1097,7 +1096,7 @@ nsHTTPFinalListener::nsHTTPFinalListener( nsHTTPFinalListener::~nsHTTPFinalListener() { - PR_LOG(gHTTPLog, PR_LOG_ALWAYS, + PR_LOG(HTTPLog, PR_LOG_ALWAYS, ("Deleting nsHTTPFinalListener [this=%x], created=%u, deleted=%u\n", this, sFinalListenersCreated, ++sFinalListenersDeleted)) ; @@ -1111,7 +1110,7 @@ NS_IMETHODIMP nsHTTPFinalListener::OnStartRequest(nsIChannel *aChannel, nsISupports *aContext) { - PR_LOG(gHTTPLog, PR_LOG_DEBUG, + PR_LOG(HTTPLog, PR_LOG_DEBUG, ("nsHTTPFinalListener::OnStartRequest [this=%x]" ", mOnStartFired=%u\n", this, mOnStartFired)) ; @@ -1126,7 +1125,7 @@ NS_IMETHODIMP nsHTTPFinalListener::OnStopRequest(nsIChannel *aChannel, nsISupports *aContext, nsresult aStatus, const PRUnichar* aStatusArg) { - PR_LOG(gHTTPLog, PR_LOG_DEBUG, + PR_LOG(HTTPLog, PR_LOG_DEBUG, ("nsHTTPFinalListener::OnStopRequest [this=%x]" ", mOnStopFired=%u\n", this, mOnStopFired)) ; @@ -1171,7 +1170,7 @@ nsHTTPFinalListener::OnDataAvailable(nsIChannel *aChannel, PRUint32 aSourceOffset, PRUint32 aCount) { - PR_LOG(gHTTPLog, PR_LOG_DEBUG, + PR_LOG(HTTPLog, PR_LOG_DEBUG, ("nsHTTPFinalListener::OnDataAvailable [this=%x]\n", this)) ; @@ -1206,7 +1205,7 @@ nsHTTPFinalListener::OnDataAvailable(nsIChannel *aChannel, void nsHTTPFinalListener::FireNotifications() { - PR_LOG(gHTTPLog, PR_LOG_DEBUG, + PR_LOG(HTTPLog, PR_LOG_DEBUG, ("nsHTTPFinalListener::FireNotifications [this=%x]\n", this)) ; diff --git a/mozilla/netwerk/streamconv/converters/mozTXTToHTMLConv.cpp b/mozilla/netwerk/streamconv/converters/mozTXTToHTMLConv.cpp index 9ab1380a878..4fc654100c6 100644 --- a/mozilla/netwerk/streamconv/converters/mozTXTToHTMLConv.cpp +++ b/mozilla/netwerk/streamconv/converters/mozTXTToHTMLConv.cpp @@ -35,6 +35,11 @@ #include "mozTXTToHTMLConv.h" #include "nsIServiceManager.h" +#include "nslog.h" + +NS_IMPL_LOG(mozTXTToHTMLConvLog) +#define PRINTF NS_LOG_PRINTF(mozTXTToHTMLConvLog) +#define FLUSH NS_LOG_FLUSH(mozTXTToHTMLConvLog) static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID); @@ -1064,7 +1069,7 @@ mozTXTToHTMLConv::ScanHTML(nsString& aInString, PRUint32 whattodo, nsString &aOu } #ifdef DEBUG_BenB_Perf - printf("ScanHTML time: %d ms\n", PR_IntervalToMilliseconds(PR_IntervalNow() - parsing_start)); + PRINTF("ScanHTML time: %d ms\n", PR_IntervalToMilliseconds(PR_IntervalNow() - parsing_start)); #endif } diff --git a/mozilla/netwerk/streamconv/converters/nsFTPDirListingConv.cpp b/mozilla/netwerk/streamconv/converters/nsFTPDirListingConv.cpp index 52f995d6779..350285e2c3e 100644 --- a/mozilla/netwerk/streamconv/converters/nsFTPDirListingConv.cpp +++ b/mozilla/netwerk/streamconv/converters/nsFTPDirListingConv.cpp @@ -38,26 +38,31 @@ #include "nsDateTimeFormatCID.h" #include "nsIStreamListener.h" #include "nsCRT.h" -static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID); -static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID); -static NS_DEFINE_CID(kLocaleServiceCID, NS_LOCALESERVICE_CID); -static NS_DEFINE_CID(kDateTimeCID, NS_DATETIMEFORMAT_CID); +#include "nslog.h" -#if defined(PR_LOGGING) // // Log module for FTP dir listing stream converter logging... // // To enable logging (see prlog.h for full details): // -// set NSPR_LOG_MODULES=nsFTPDirListConv:5 +// set NSPR_LOG_MODULES=nsFTPDirListingConvLog:5 // set NSPR_LOG_FILE=nspr.log // // this enables PR_LOG_DEBUG level information and places all output in // the file nspr.log // -PRLogModuleInfo* gFTPDirListConvLog = nsnull; +#ifdef DEBUG_valeski +NS_IMPL_LOG_ENABLED(nsFTPDirListingConvLog) +#else +NS_IMPL_LOG(nsFTPDirListingConvLog) +#endif +#define PRINTF NS_LOG_PRINTF(nsFTPDirListingConvLog) +#define FLUSH NS_LOG_FLUSH(nsFTPDirListingConvLog) -#endif /* PR_LOGGING */ +static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID); +static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID); +static NS_DEFINE_CID(kLocaleServiceCID, NS_LOCALESERVICE_CID); +static NS_DEFINE_CID(kDateTimeCID, NS_DATETIMEFORMAT_CID); // nsISupports implementation NS_IMPL_THREADSAFE_ISUPPORTS3(nsFTPDirListingConv, nsIStreamConverter, nsIStreamListener, nsIStreamObserver); @@ -148,15 +153,12 @@ nsFTPDirListingConv::Convert(nsIInputStream *aFromStream, } // end body building -#ifndef DEBUG_valeski - PR_LOG(gFTPDirListConvLog, PR_LOG_DEBUG, ("::OnData() sending the following %d bytes...\n\n%s\n\n", - convertedData.Length(), convertedData.GetBuffer()) ); -#else +#ifdef NS_ENABLED_LOGGING char *unescData = convertedData.ToNewCString(); nsUnescape(unescData); - printf("::OnData() sending the following %d bytes...\n\n%s\n\n", convertedData.Length(), unescData); + PRINTF("::OnData() sending the following %d bytes...\n\n%s\n\n", convertedData.Length(), unescData); nsMemory::Free(unescData); -#endif // DEBUG_valeski +#endif // send the converted data out. nsCOMPtr inputData; @@ -236,7 +238,7 @@ nsFTPDirListingConv::AsyncConvertData(const PRUnichar *aFromType, const PRUnicha NS_RELEASE(uri); if (NS_FAILED(rv)) return rv; - PR_LOG(gFTPDirListConvLog, PR_LOG_DEBUG, + PR_LOG(nsFTPDirListingConvLog, PR_LOG_DEBUG, ("nsFTPDirListingConv::AsyncConvertData() converting FROM raw %s, TO application/http-index-format\n", fromMIMEString.GetBuffer())); return NS_OK; @@ -263,7 +265,7 @@ nsFTPDirListingConv::OnDataAvailable(nsIChannel *channel, nsISupports *ctxt, // the dir listings are ascii text, null terminate this sucker. buffer[streamLen] = '\0'; - PR_LOG(gFTPDirListConvLog, PR_LOG_DEBUG, ("nsFTPDirListingConv::OnData(channel = %x, ctxt = %x, inStr = %x, sourceOffset = %d, count = %d)\n", channel, ctxt, inStr, sourceOffset, count)); + PR_LOG(nsFTPDirListingConvLog, PR_LOG_DEBUG, ("nsFTPDirListingConv::OnData(channel = %x, ctxt = %x, inStr = %x, sourceOffset = %d, count = %d)\n", channel, ctxt, inStr, sourceOffset, count)); if (!mBuffer.IsEmpty()) { // we have data left over from a previous OnDataAvailable() call. @@ -274,12 +276,7 @@ nsFTPDirListingConv::OnDataAvailable(nsIChannel *channel, nsISupports *ctxt, mBuffer.Truncate(); } -#ifndef DEBUG_valeski - PR_LOG(gFTPDirListConvLog, PR_LOG_DEBUG, ("::OnData() received the following %d bytes...\n\n%s\n\n", streamLen, buffer) ); -#else - printf("::OnData() received the following %d bytes...\n\n%s\n\n", streamLen, buffer); -#endif // DEBUG_valeski - + PRINTF("::OnData() received the following %d bytes...\n\n%s\n\n", streamLen, buffer); if (!mSentHeading) { // build up the 300: line @@ -308,20 +305,17 @@ nsFTPDirListingConv::OnDataAvailable(nsIChannel *channel, nsISupports *ctxt, char *line = buffer; line = DigestBufferLines(line, indexFormat); -#ifndef DEBUG_valeski - PR_LOG(gFTPDirListConvLog, PR_LOG_DEBUG, ("::OnData() sending the following %d bytes...\n\n%s\n\n", - indexFormat.Length(), indexFormat.GetBuffer()) ); -#else +#ifdef NS_ENABLE_LOGGING char *unescData = indexFormat.ToNewCString(); nsUnescape(unescData); - printf("::OnData() sending the following %d bytes...\n\n%s\n\n", indexFormat.Length(), unescData); + PRINTF("::OnData() sending the following %d bytes...\n\n%s\n\n", indexFormat.Length(), unescData); nsMemory::Free(unescData); -#endif // DEBUG_valeski +#endif // if there's any data left over, buffer it. if (line && *line) { mBuffer.Append(line); - PR_LOG(gFTPDirListConvLog, PR_LOG_DEBUG, ("::OnData() buffering the following %d bytes...\n\n%s\n\n", + PR_LOG(nsFTPDirListingConvLog, PR_LOG_DEBUG, ("::OnData() buffering the following %d bytes...\n\n%s\n\n", PL_strlen(line), line) ); } @@ -401,16 +395,6 @@ nsFTPDirListingConv::Init() { rv = comMgr->CreateInstance(kDateTimeCID, nsnull, NS_GET_IID(nsIDateTimeFormat), (void**)&mDateTimeFormat); if (NS_FAILED(rv)) return rv; -#if defined(PR_LOGGING) - // - // Initialize the global PRLogModule for FTP Protocol logging - // if necessary... - // - if (nsnull == gFTPDirListConvLog) { - gFTPDirListConvLog = PR_NewLogModule("nsFTPDirListingConv"); - } -#endif /* PR_LOGGING */ - return NS_OK; } @@ -424,7 +408,7 @@ nsFTPDirListingConv::MonthNumber(const char *month) { char c1 = month[1], c2 = month[2]; PRInt8 rv = -1; - //PR_LOG(gFTPDirListConvLog, PR_LOG_DEBUG, ("nsFTPDirListingConv::MonthNumber(month = %s) ", month) ); + //PR_LOG(nsFTPDirListingConvLog, PR_LOG_DEBUG, ("nsFTPDirListingConv::MonthNumber(month = %s) ", month) ); switch (*month) { case 'f': case 'F': @@ -464,7 +448,7 @@ nsFTPDirListingConv::MonthNumber(const char *month) { rv = -1; } - //PR_LOG(gFTPDirListConvLog, PR_LOG_DEBUG, ("returning %d\n", rv) ); + //PR_LOG(nsFTPDirListingConvLog, PR_LOG_DEBUG, ("returning %d\n", rv) ); return rv; } diff --git a/mozilla/parser/htmlparser/robot/nsDebugRobot.cpp b/mozilla/parser/htmlparser/robot/nsDebugRobot.cpp index 41be60fa94d..5ddc1d7753c 100644 --- a/mozilla/parser/htmlparser/robot/nsDebugRobot.cpp +++ b/mozilla/parser/htmlparser/robot/nsDebugRobot.cpp @@ -37,6 +37,11 @@ static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID); #include "nsIComponentManager.h" #include "nsParserCIID.h" +#include "nslog.h" + +NS_IMPL_LOG(nsDebugRobotLog) +#define PRINTF NS_LOG_PRINTF(nsDebugRobotLog) +#define FLUSH NS_LOG_FLUSH(nsDebugRobotLog) static NS_DEFINE_IID(kIRobotSinkObserverIID, NS_IROBOTSINKOBSERVER_IID); @@ -260,9 +265,9 @@ extern "C" NS_EXPORT int DebugRobot( rv = uri->QueryInterface(NS_GET_IID(nsIURI), (void**)&url); NS_RELEASE(uri); if (NS_OK != rv) { - printf("invalid URL: '"); + PRINTF("invalid URL: '"); fputs(*urlName, stdout); - printf("'\n"); + PRINTF("'\n"); NS_RELEASE(myObserver); return -1; } @@ -288,7 +293,7 @@ extern "C" NS_EXPORT int DebugRobot( (void **)&parser); if (NS_OK != rv) { - printf("can't make parser\n"); + PRINTF("can't make parser\n"); NS_RELEASE(myObserver); return -1; } @@ -296,7 +301,7 @@ extern "C" NS_EXPORT int DebugRobot( nsIRobotSink* sink; rv = NS_NewRobotSink(&sink); if (NS_OK != rv) { - printf("can't make parser\n"); + PRINTF("can't make parser\n"); NS_RELEASE(myObserver); return -1; } diff --git a/mozilla/parser/htmlparser/src/CNavDTD.cpp b/mozilla/parser/htmlparser/src/CNavDTD.cpp index 28409508a84..d36312ff0ec 100644 --- a/mozilla/parser/htmlparser/src/CNavDTD.cpp +++ b/mozilla/parser/htmlparser/src/CNavDTD.cpp @@ -54,7 +54,11 @@ #include "nsVoidArray.h" #include "prmem.h" +#include "nslog.h" +NS_IMPL_LOG(CNavDTDLog) +#define PRINTF NS_LOG_PRINTF(CNavDTDLog) +#define FLUSH NS_LOG_FLUSH(CNavDTDLog) static NS_DEFINE_IID(kIHTMLContentSinkIID, NS_IHTML_CONTENT_SINK_IID); static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); @@ -474,9 +478,9 @@ nsresult CNavDTD::BuildModel(nsIParser* aParser,nsITokenizer* aTokenizer,nsIToke if(n>50) n=50; for(int i=0;iGetTokenAt(i); - printf("\nToken[%i],%p",i,theToken); + PRINTF("\nToken[%i],%p",i,theToken); } - printf("\n"); + PRINTF("\n"); #endif if(mDTDState!=NS_ERROR_HTMLPARSER_STOPPARSING) { @@ -578,11 +582,11 @@ nsresult CNavDTD::DidBuildModel(nsresult anErrorCode,PRBool aNotifySink,nsIParse if(2==gShowCRC) { if(mComputedCRC32!=mExpectedCRC32) { if(mExpectedCRC32!=0) { - printf("CRC Computed: %u Expected CRC: %u\n,",mComputedCRC32,mExpectedCRC32); + PRINTF("CRC Computed: %u Expected CRC: %u\n,",mComputedCRC32,mExpectedCRC32); result = aSink->DidBuildModel(2); } else { - printf("Computed CRC: %u.\n",mComputedCRC32); + PRINTF("Computed CRC: %u.\n",mComputedCRC32); result = aSink->DidBuildModel(3); } } @@ -642,7 +646,7 @@ nsresult CNavDTD::HandleToken(CToken* aToken,nsIParser* aParser){ --------------------------------------------------------------------------------- */ - // printf("token: %p\n",aToken); + // PRINTF("token: %p\n",aToken); if(mSkipTarget){ //handle a preexisting target... if((theTag==mSkipTarget) && (eToken_end==theType)){ diff --git a/mozilla/parser/htmlparser/src/COtherDTD.cpp b/mozilla/parser/htmlparser/src/COtherDTD.cpp index 8a5bd5cf7ef..f6e7cce65eb 100644 --- a/mozilla/parser/htmlparser/src/COtherDTD.cpp +++ b/mozilla/parser/htmlparser/src/COtherDTD.cpp @@ -50,7 +50,6 @@ #include "prmem.h" - static NS_DEFINE_IID(kIHTMLContentSinkIID, NS_IHTML_CONTENT_SINK_IID); static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); static NS_DEFINE_IID(kIDTDIID, NS_IDTD_IID); @@ -234,7 +233,7 @@ COtherDTD::~COtherDTD(){ #if 0 PRInt32 count=gNodeCount-mSharedNodes.GetSize(); if(count) { - printf("%i of %i nodes leaked!\n",count,gNodeCount); + PRINTF("%i of %i nodes leaked!\n",count,gNodeCount); } #endif #endif diff --git a/mozilla/parser/htmlparser/src/COtherElements.h b/mozilla/parser/htmlparser/src/COtherElements.h index 8f542b343a7..5998355db74 100644 --- a/mozilla/parser/htmlparser/src/COtherElements.h +++ b/mozilla/parser/htmlparser/src/COtherElements.h @@ -34,6 +34,11 @@ #define _COTHERELEMENTS_ #include "nsDTDUtils.h" +#include "nslog.h" + +NS_IMPL_LOG(COtherElementsLog) +#define PRINTF NS_LOG_PRINTF(COtherElementsLog) +#define FLUSH NS_LOG_FLUSH(COtherElementsLog) /************************************************************************ This union is a bitfield which describes the group membership @@ -2363,88 +2368,88 @@ void CElementTable::DebugDumpGroups(CElement* aTag){ const char* tag=nsHTMLTags::GetStringValue(aTag->mTag); const char* prefix=" "; - printf("\n\nTag: <%s>\n",tag); - printf(prefix); + PRINTF("\n\nTag: <%s>\n",tag); + PRINTF(prefix); if(aTag->IsContainer()) { - if(aTag->mContainsGroups.mBits.mHead) printf("head "); - if(aTag->mContainsGroups.mBits.mHeadMisc) printf("headmisc "); - if(aTag->mContainsGroups.mBits.mHeadContent) printf("headcontent "); - if(aTag->mContainsGroups.mBits.mTable) printf("table "); - if(aTag->mContainsGroups.mBits.mTextContainer) printf("text "); - if(aTag->mContainsGroups.mBits.mTopLevel) printf("toplevel "); - if(aTag->mContainsGroups.mBits.mDTDInternal) printf("internal "); + if(aTag->mContainsGroups.mBits.mHead) PRINTF("head "); + if(aTag->mContainsGroups.mBits.mHeadMisc) PRINTF("headmisc "); + if(aTag->mContainsGroups.mBits.mHeadContent) PRINTF("headcontent "); + if(aTag->mContainsGroups.mBits.mTable) PRINTF("table "); + if(aTag->mContainsGroups.mBits.mTextContainer) PRINTF("text "); + if(aTag->mContainsGroups.mBits.mTopLevel) PRINTF("toplevel "); + if(aTag->mContainsGroups.mBits.mDTDInternal) PRINTF("internal "); if(aTag->mContainsGroups.mBits.mFlowEntity) { - printf("block inline "); + PRINTF("block inline "); } else { if (aTag->mContainsGroups.mBits.mBlockEntity) { - printf("blockEntity "); + PRINTF("blockEntity "); } if (aTag->mContainsGroups.mBits.mBlock) { - printf("block "); + PRINTF("block "); } if(aTag->mContainsGroups.mBits.mInlineEntity) { - printf("inline "); + PRINTF("inline "); } else { - if(aTag->mContainsGroups.mBits.mFontStyle ) printf("fontstyle "); - if(aTag->mContainsGroups.mBits.mPhrase) printf("phrase "); - if(aTag->mContainsGroups.mBits.mSpecial) printf("special "); - if(aTag->mContainsGroups.mBits.mFormControl) printf("form "); - if(aTag->mContainsGroups.mBits.mHeading) printf("heading "); - if(aTag->mContainsGroups.mBits.mFrame) printf("frame "); - if(aTag->mContainsGroups.mBits.mList) printf("list "); - if(aTag->mContainsGroups.mBits.mPreformatted) printf("pre "); - if(aTag->mContainsGroups.mBits.mSelf) printf("self "); - if(aTag->mContainsGroups.mBits.mLeaf) printf("leaf "); - if(aTag->mContainsGroups.mBits.mWhiteSpace) printf("ws "); - if(aTag->mContainsGroups.mBits.mComment) printf("comment "); + if(aTag->mContainsGroups.mBits.mFontStyle ) PRINTF("fontstyle "); + if(aTag->mContainsGroups.mBits.mPhrase) PRINTF("phrase "); + if(aTag->mContainsGroups.mBits.mSpecial) PRINTF("special "); + if(aTag->mContainsGroups.mBits.mFormControl) PRINTF("form "); + if(aTag->mContainsGroups.mBits.mHeading) PRINTF("heading "); + if(aTag->mContainsGroups.mBits.mFrame) PRINTF("frame "); + if(aTag->mContainsGroups.mBits.mList) PRINTF("list "); + if(aTag->mContainsGroups.mBits.mPreformatted) PRINTF("pre "); + if(aTag->mContainsGroups.mBits.mSelf) PRINTF("self "); + if(aTag->mContainsGroups.mBits.mLeaf) PRINTF("leaf "); + if(aTag->mContainsGroups.mBits.mWhiteSpace) PRINTF("ws "); + if(aTag->mContainsGroups.mBits.mComment) PRINTF("comment "); } } if(aTag->mIncludeKids) { - printf("\n%s",prefix); + PRINTF("\n%s",prefix); eHTMLTags *theKid=aTag->mIncludeKids; - printf("+ "); + PRINTF("+ "); while(eHTMLTag_unknown!=*theKid){ tag=nsHTMLTags::GetCStringValue(*theKid++); - printf("%s ",tag); + PRINTF("%s ",tag); } } if(aTag->mExcludeKids) { - printf("\n%s",prefix); + PRINTF("\n%s",prefix); eHTMLTags *theKid=aTag->mExcludeKids; - printf("- "); + PRINTF("- "); while(eHTMLTag_unknown!=*theKid){ tag=nsHTMLTags::GetCStringValue(*theKid++); - printf("%s ",tag); + PRINTF("%s ",tag); } } if(!aTag->mContainsGroups.mBits.mSelf){ - printf("\n%s - self",prefix); + PRINTF("\n%s - self",prefix); } } else { - printf("empty\n"); + PRINTF("empty\n"); } } void CElementTable::DebugDumpContainment(CElement* anElement){ const char* tag=nsHTMLTags::GetStringValue(anElement->mTag); const char* prefix=" "; - printf("\n\nTag: <%s>\n",tag); - printf(prefix); + PRINTF("\n\nTag: <%s>\n",tag); + PRINTF(prefix); int count=0; int i=0; @@ -2452,11 +2457,11 @@ void CElementTable::DebugDumpContainment(CElement* anElement){ CElement* theChild=mElements[i]; if(anElement->CanContain(theChild,0)){ tag=nsHTMLTags::GetCStringValue(theChild->mTag); - printf("%s ",tag); + PRINTF("%s ",tag); count++; if(18==count) { count=0; - printf("\n%s",prefix); + PRINTF("\n%s",prefix); } } } @@ -2466,14 +2471,14 @@ void CElementTable::DebugDumpInlineElements(const char* aTitle) { PRInt32 theTagID=eHTMLTag_unknown; PRBool result=PR_FALSE; - printf("Inline Elements -- %s: \n",aTitle); + PRINTF("Inline Elements -- %s: \n",aTitle); while(theTagID<=eHTMLTag_userdefined) { CElement *theTag=GetElement((eHTMLTags)theTagID); if(theTag) { result=theTag->IsInlineElement(eHTMLTag_unknown); if(result) { const char* theName=nsHTMLTags::GetCStringValue(theTag->mTag); - printf(" %s\n",theName); + PRINTF(" %s\n",theName); } } theTagID++; @@ -2484,14 +2489,14 @@ void CElementTable::DebugDumpBlockElements(const char* aTitle) { PRInt32 theTagID=eHTMLTag_unknown; PRBool result=PR_FALSE; - printf("Block Elements -- %s: \n",aTitle); + PRINTF("Block Elements -- %s: \n",aTitle); while(theTagID<=eHTMLTag_userdefined) { CElement *theTag=GetElement((eHTMLTags)theTagID); if(theTag) { result=theTag->IsBlockElement(eHTMLTag_unknown); if(result) { const char* theName=nsHTMLTags::GetCStringValue(theTag->mTag); - printf(" %s\n",theName); + PRINTF(" %s\n",theName); } } theTagID++; @@ -2503,12 +2508,12 @@ void CElementTable::DebugDumpContainment(const char* aTitle){ DebugDumpContainment(mElements[eHTMLTag_head]); DebugDumpContainment(mElements[eHTMLTag_html]); DebugDumpContainment(mElements[eHTMLTag_table]); - printf("\n"); + PRINTF("\n"); #endif - printf("==================================================\n"); - printf("%s\n",aTitle); - printf("==================================================\n"); + PRINTF("==================================================\n"); + PRINTF("%s\n",aTitle); + PRINTF("==================================================\n"); int i=0; for(i=1;i50) n=50; for(int i=0;iGetTokenAt(i); - printf("\nToken[%i],%p",i,theToken); + PRINTF("\nToken[%i],%p",i,theToken); } - printf("\n"); + PRINTF("\n"); #endif CToken* theToken=mTokenizer->PopToken(); diff --git a/mozilla/parser/htmlparser/src/nsDTDUtils.cpp b/mozilla/parser/htmlparser/src/nsDTDUtils.cpp index 65d73a01952..b5f11feb60b 100644 --- a/mozilla/parser/htmlparser/src/nsDTDUtils.cpp +++ b/mozilla/parser/htmlparser/src/nsDTDUtils.cpp @@ -29,6 +29,11 @@ #include "nsIObserverService.h" #include "nsIServiceManager.h" +#include "nslog.h" + +NS_IMPL_LOG(nsDTDUtilsLog) +#define PRINTF NS_LOG_PRINTF(nsDTDUtilsLog) +#define FLUSH NS_LOG_FLUSH(nsDTDUtilsLog) MOZ_DECL_CTOR_COUNTER(nsEntryStack); MOZ_DECL_CTOR_COUNTER(nsDTDContext); @@ -1337,7 +1342,7 @@ CNodeRecycler::~CNodeRecycler() { #if 1 PRInt32 count=gNodeCount-mSharedNodes.GetSize(); if(count) { - printf("%i of %i nodes leaked!\n",count,gNodeCount); + PRINTF("%i of %i nodes leaked!\n",count,gNodeCount); } #endif #endif diff --git a/mozilla/parser/htmlparser/src/nsHTMLContentSinkStream.cpp b/mozilla/parser/htmlparser/src/nsHTMLContentSinkStream.cpp index 209b11fd8b8..c3052b24199 100644 --- a/mozilla/parser/htmlparser/src/nsHTMLContentSinkStream.cpp +++ b/mozilla/parser/htmlparser/src/nsHTMLContentSinkStream.cpp @@ -47,6 +47,11 @@ #include "nsFileStream.h" #include "nsNetUtil.h" // for NS_MakeAbsoluteURI +#include "nslog.h" + +NS_IMPL_LOG(nsHTMLContentSinkStreamLog) +#define PRINTF NS_LOG_PRINTF(nsHTMLContentSinkStreamLog) +#define FLUSH NS_LOG_FLUSH(nsHTMLContentSinkStreamLog) static NS_DEFINE_CID(kSaveAsCharsetCID, NS_SAVEASCHARSET_CID); static NS_DEFINE_CID(kEntityConverterCID, NS_ENTITYCONVERTER_CID); @@ -655,7 +660,7 @@ void nsHTMLContentSinkStream::AddStartTag(const nsIParserNode& aNode) #ifdef DEBUG_prettyprint if (isDirty) - printf("AddStartTag(%s): BBO=%d, BAO=%d, BBC=%d, BAC=%d\n", + PRINTF("AddStartTag(%s): BBO=%d, BAO=%d, BBC=%d, BAC=%d\n", name.ToNewCString(), BreakBeforeOpen(tag), BreakAfterOpen(tag), @@ -721,7 +726,7 @@ void nsHTMLContentSinkStream::AddEndTag(const nsIParserNode& aNode) #ifdef DEBUG_prettyprint if (isDirty) - printf("AddEndTag(%s): BBO=%d, BAO=%d, BBC=%d, BAC=%d\n", + PRINTF("AddEndTag(%s): BBO=%d, BAO=%d, BBC=%d, BAC=%d\n", aNode.GetText().ToNewCString(), BreakBeforeOpen(tag), BreakAfterOpen(tag), diff --git a/mozilla/parser/htmlparser/src/nsHTMLToTXTSinkStream.cpp b/mozilla/parser/htmlparser/src/nsHTMLToTXTSinkStream.cpp index 3ad9072040e..75a3559b890 100644 --- a/mozilla/parser/htmlparser/src/nsHTMLToTXTSinkStream.cpp +++ b/mozilla/parser/htmlparser/src/nsHTMLToTXTSinkStream.cpp @@ -52,6 +52,13 @@ #include "nsIOutputStream.h" #include "nsFileStream.h" #include "nsIPref.h" +#include "nslog.h" +#undef PRINTF +#undef FLUSH + +NS_IMPL_LOG(nsHTMLToTXTSinkStreamLog) +#define PRINTF NS_LOG_PRINTF(nsHTMLToTXTSinkStreamLog) +#define FLUSH NS_LOG_FLUSH(nsHTMLToTXTSinkStreamLog) static NS_DEFINE_CID(kCharsetConverterManagerCID, NS_ICHARSETCONVERTERMANAGER_CID); static NS_DEFINE_CID(kLWBrkCID, NS_LWBRK_CID); @@ -551,7 +558,7 @@ nsHTMLToTXTSinkStream::OpenContainer(const nsIParserNode& aNode) if (-1 != style.Find("-moz-pre-wrap", PR_TRUE, whitespace)) { #ifdef DEBUG_preformatted - printf("Set mPreFormatted based on style moz-pre-wrap\n"); + PRINTF("Set mPreFormatted based on style moz-pre-wrap\n"); #endif mPreFormatted = PR_TRUE; mCacheLine = PR_TRUE; @@ -574,7 +581,7 @@ nsHTMLToTXTSinkStream::OpenContainer(const nsIParserNode& aNode) { SetWrapColumn((PRUint32)col); #ifdef DEBUG_preformatted - printf("Set wrap column to %d based on style\n", mWrapColumn); + PRINTF("Set wrap column to %d based on style\n", mWrapColumn); #endif } } @@ -582,7 +589,7 @@ nsHTMLToTXTSinkStream::OpenContainer(const nsIParserNode& aNode) else if (-1 != style.Find("pre", PR_TRUE, whitespace)) { #ifdef DEBUG_preformatted - printf("Set mPreFormatted based on style pre\n"); + PRINTF("Set mPreFormatted based on style pre\n"); #endif mPreFormatted = PR_TRUE; mCacheLine = PR_TRUE; @@ -1396,7 +1403,7 @@ nsHTMLToTXTSinkStream::Write(const nsString& aString) { #ifdef DEBUG_wrapping char* foo = aString.ToNewCString(); - printf("Write(%s): wrap col = %d, mColPos = %d\n", foo, mWrapColumn, mColPos); + PRINTF("Write(%s): wrap col = %d, mColPos = %d\n", foo, mWrapColumn, mColPos); nsMemory::Free(foo); #endif @@ -1455,7 +1462,7 @@ nsHTMLToTXTSinkStream::Write(const nsString& aString) } #ifdef DEBUG_wrapping - printf("No wrapping: newline is %d, totLen is %d; leaving mColPos = %d\n", + PRINTF("No wrapping: newline is %d, totLen is %d; leaving mColPos = %d\n", newline, totLen, mColPos); #endif return; @@ -1475,8 +1482,8 @@ nsHTMLToTXTSinkStream::Write(const nsString& aString) nsString remaining; aString.Right(remaining, totLen - bol); foo = remaining.ToNewCString(); - // printf("Next line: bol = %d, newlinepos = %d, totLen = %d, string = '%s'\n", - // bol, nextpos, totLen, foo); + // PRINTF("Next line: bol = %d, newlinepos = %d, totLen = %d, string = '%s'\n", + // bol, nextpos, totLen, foo)); nsMemory::Free(foo); #endif @@ -1546,7 +1553,7 @@ nsHTMLToTXTSinkStream::Write(const nsString& aString) } } } - } // Continue looping over the string + }// Continue looping over the string } /** diff --git a/mozilla/parser/htmlparser/src/nsParser.cpp b/mozilla/parser/htmlparser/src/nsParser.cpp index e60264c3346..a165eeecdb2 100644 --- a/mozilla/parser/htmlparser/src/nsParser.cpp +++ b/mozilla/parser/htmlparser/src/nsParser.cpp @@ -48,6 +48,12 @@ #include "prenv.h" #include "nsParserCIID.h" #include "nsCOMPtr.h" +#include "nslog.h" + +NS_IMPL_LOG(nsParserLog) +#define PRINTF NS_LOG_PRINTF(nsParserLog) +#define FLUSH NS_LOG_FLUSH(nsParserLog) + //#define rickgdebug static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); @@ -1536,7 +1542,7 @@ nsresult nsParser::EnableParser(PRBool aState){ mParserContext->mParserEnabled=aState; if(aState) { - //printf(" Re-enable parser\n"); + //PRINTF(" Re-enable parser\n"); result=ResumeParse(); if(result!=NS_OK) @@ -1709,7 +1715,7 @@ aMimeType,PRBool aVerifyEnabled,PRBool aLastCall,nsDTDMode aMode){ pc->SetMimeType(aMimeType); mUnusedInput.Truncate(0); - //printf("Parse(string) iterate: %i",PR_FALSE); + //PRINTF("Parse(string) iterate: %i",PR_FALSE); pc->mScanner->Append(aSourceBuffer); result=ResumeParse(PR_FALSE); @@ -1869,7 +1875,7 @@ nsresult nsParser::ParseFragment(const nsAReadableString& aSourceBuffer,void* aK */ nsresult nsParser::ResumeParse(PRBool allowIteration, PRBool aIsFinalChunk) { - //printf(" Resume %i, prev-context: %p\n",allowIteration,mParserContext->mPrevContext); + //PRINTF(" Resume %i, prev-context: %p\n",allowIteration,mParserContext->mPrevContext); nsresult result=NS_OK; @@ -2311,7 +2317,7 @@ theContext->mTransferBufferSize; theNumRead, guess, guessSource)) { #ifdef DEBUG_XMLENCODING - printf("xmlencoding detect- %s\n", guess.ToNewCString()); + PRINTF("xmlencoding detect- %s\n", guess.ToNewCString()); #endif this->SetDocumentCharset(guess, guessSource); } @@ -2324,7 +2330,7 @@ theContext->mTransferBufferSize; unsigned int index=0; for(index=0;indexmTransferBuffer[index]){ - printf("\nNull found at buffer[%i] provided by netlib...\n",index); + PRINTF("\nNull found at buffer[%i] provided by netlib...\n",index); break; } } @@ -2334,7 +2340,7 @@ theContext->mTransferBufferSize; static int dump=0; if(dump) { theContext->mTransferBuffer[theNumRead]=0; - printf("\n\n-----------------------------------------------------%s\n",theContext->mTransferBuffer); + PRINTF("\n\n-----------------------------------------------------%s\n",theContext->mTransferBuffer); } #endif diff --git a/mozilla/parser/htmlparser/src/nsParserModule.cpp b/mozilla/parser/htmlparser/src/nsParserModule.cpp index 0437a40572c..a8b61416e86 100644 --- a/mozilla/parser/htmlparser/src/nsParserModule.cpp +++ b/mozilla/parser/htmlparser/src/nsParserModule.cpp @@ -45,6 +45,11 @@ #include "nsExpatTokenizer.h" #include "nsIParserService.h" #include "nsElementTable.h" +#include "nslog.h" + +NS_IMPL_LOG(nsParserModuleLog) +#define PRINTF NS_LOG_PRINTF(nsParserModuleLog) +#define FLUSH NS_LOG_FLUSH(nsParserModuleLog) static NS_DEFINE_IID(kIParserServiceIID, NS_IPARSERSERVICE_IID); @@ -393,10 +398,8 @@ nsParserModule::RegisterSelf(nsIComponentManager *aCompMgr, rv = aCompMgr->RegisterComponentSpec(*cp->mCID, cp->mDescription, nsnull, aPath, PR_TRUE, PR_TRUE); if (NS_FAILED(rv)) { -#ifdef DEBUG - printf("nsParserModule: unable to register %s component => %x\n", + PRINTF("nsParserModule: unable to register %s component => %x\n", cp->mDescription, rv); -#endif break; } cp++; @@ -414,10 +417,8 @@ nsParserModule::UnregisterSelf(nsIComponentManager *aCompMgr, while (cp < end) { nsresult rv = aCompMgr->UnregisterComponentSpec(*cp->mCID, aPath); if (NS_FAILED(rv)) { -#ifdef DEBUG - printf("nsParserModule: unable to unregister %s component => %x\n", + PRINTF("nsParserModule: unable to unregister %s component => %x\n", cp->mDescription, rv); -#endif } cp++; } diff --git a/mozilla/parser/htmlparser/src/nsViewSourceHTML.cpp b/mozilla/parser/htmlparser/src/nsViewSourceHTML.cpp index 4d40266f469..442d7ffe5f5 100644 --- a/mozilla/parser/htmlparser/src/nsViewSourceHTML.cpp +++ b/mozilla/parser/htmlparser/src/nsViewSourceHTML.cpp @@ -81,7 +81,11 @@ static NS_DEFINE_CID(kPrefCID, NS_PREF_CID); #include "plstr.h" #include "prmem.h" +#include "nslog.h" +NS_IMPL_LOG(nsViewSourceHTMLLog) +#define PRINTF NS_LOG_PRINTF(nsViewSourceHTMLLog) +#define FLUSH NS_LOG_FLUSH(nsViewSourceHTMLLog) #ifdef RAPTOR_PERF_METRICS #include "stopwatch.h" @@ -642,9 +646,9 @@ NS_IMETHODIMP CViewSourceHTML::DidBuildModel(nsresult anErrorCode,PRBool aNotify #ifdef RAPTOR_PERF_METRICS NS_STOP_STOPWATCH(vsTimer); - printf("viewsource timer: "); + PRINTF("viewsource timer: "); vsTimer.Print(); - printf("\n"); + PRINTF("\n"); #endif return result; diff --git a/mozilla/profile/pref-migrator/src/nsPrefMigration.cpp b/mozilla/profile/pref-migrator/src/nsPrefMigration.cpp index 11d04b9b6f6..44021fc2fc2 100644 --- a/mozilla/profile/pref-migrator/src/nsPrefMigration.cpp +++ b/mozilla/profile/pref-migrator/src/nsPrefMigration.cpp @@ -59,6 +59,11 @@ #include "nsIDocShellTreeOwner.h" #include "nsIWebBrowserChrome.h" #include "nsIWebBrowserChrome.h" +#include "nslog.h" + +NS_IMPL_LOG(nsPrefMigrationLog) +#define PRINTF NS_LOG_PRINTF(nsPrefMigrationLog) +#define FLUSH NS_LOG_FLUSH(nsPrefMigrationLog) #if defined(XP_MAC) && !defined(DEBUG) //lower silly optimization level which takes an age for this file. @@ -371,7 +376,7 @@ extern "C" void ProfileMigrationController(void *data) if (NS_FAILED(rv)) { migrator->mErrorCode = rv; - printf("failed to migrate properly. err=%d\n",rv); + PRINTF("failed to migrate properly. err=%d\n",rv); } } else @@ -446,9 +451,7 @@ nsPrefMigration::WindowCloseCallback() if (baseWindow) (void)baseWindow->Destroy(); } -#ifdef DEBUG - printf("end of pref migration\n"); -#endif + PRINTF("end of pref migration\n"); return NS_OK; } @@ -617,9 +620,7 @@ nsPrefMigration::ProcessPrefsCallback(const char* oldProfilePathStr, const char PRInt64 DriveID[MAX_DRIVES]; PRUint32 SpaceRequired[MAX_DRIVES]; -#if defined(NS_DEBUG) - printf("*Entered Actual Migration routine*\n"); -#endif + PRINTF("*Entered Actual Migration routine*\n"); for (int i=0; i < MAX_DRIVES; i++) { @@ -716,6 +717,9 @@ nsPrefMigration::ProcessPrefsCallback(const char* oldProfilePathStr, const char if (NS_FAILED(rv)) { rv = DetermineOldPath(oldProfilePath, OLD_MAIL_DIR_NAME, "mailDirName", oldPOPMailPath); if (NS_FAILED(rv)) return rv; + + rv = oldPOPMailPath->AppendRelativeUnixPath(OLD_MAIL_DIR_NAME); + if (NS_FAILED(rv)) return rv; rv = SetPremigratedFilePref(PREF_MAIL_DIRECTORY, oldPOPMailPath); if (NS_FAILED(rv)) return rv; @@ -1492,7 +1496,7 @@ nsPrefMigration::CopyAndRenameNewsrcFiles(nsIFileSpec * newPathSpec) if (nsStringStartsWith(fileOrDirNameStr, NEWSRC_PREFIX_IN_4x) || nsStringStartsWith(fileOrDirNameStr, SNEWSRC_PREFIX_IN_4x)) { #ifdef DEBUG_seth - printf("newsrc file == %s\n",folderName); + PRINTF("newsrc file == %s\n",folderName); #endif /* DEBUG_seth */ fileOrDirName.CopyToDir(newPath); @@ -1974,7 +1978,7 @@ nsPrefMigration::GetPremigratedFilePref(const char *pref_name, nsIFileSpec **pat char premigration_pref[MAX_PREF_LEN]; PR_snprintf(premigration_pref,MAX_PREF_LEN,"%s%s",PREMIGRATION_PREFIX,pref_name); #ifdef DEBUG_seth - printf("getting %s (into a nsFileSpec)\n", premigration_pref); + PRINTF("getting %s (into a nsFileSpec)\n", premigration_pref); #endif rv = m_prefs->GetFilePref((const char *)premigration_pref, path); return rv; @@ -1997,7 +2001,7 @@ nsPrefMigration::SetPremigratedFilePref(const char *pref_name, nsIFileSpec *path char premigration_pref[MAX_PREF_LEN]; PR_snprintf(premigration_pref,MAX_PREF_LEN,"%s%s",PREMIGRATION_PREFIX,pref_name); #ifdef DEBUG_seth - printf("setting %s (from a nsFileSpec) for later...\n", premigration_pref); + PRINTF("setting %s (from a nsFileSpec) for later...\n", premigration_pref); #endif // need to convert nsIFileSpec->nsILocalFile @@ -2162,7 +2166,7 @@ ConvertPrefToUTF8(const char *prefname, nsIPref *prefs, nsAutoString &charSet) if (!prefname || !prefs) return NS_ERROR_FAILURE; #ifdef DEBUG_UTF8_CONVERSION - printf("converting %s to UTF8\n", prefname); + PRINTF("converting %s to UTF8\n", prefname); #endif /* DEBUG_UTF8_CONVERSION */ nsXPIDLCString prefval; @@ -2180,7 +2184,7 @@ ConvertPrefToUTF8(const char *prefname, nsIPref *prefs, nsAutoString &charSet) // only set the pref if the conversion worked, and it convert to something non null if (NS_SUCCEEDED(rv) && (const char *)outval && PL_strlen((const char *)outval)) { #ifdef DEBUG_UTF8_CONVERSION - printf("converting %s to %s\n",(const char *)prefval, (const char *)outval); + PRINTF("converting %s to %s\n",(const char *)prefval, (const char *)outval); #endif /* DEBUG_UTF8_CONVERSION */ rv = prefs->SetCharPref(prefname, (const char *)outval); } @@ -2211,7 +2215,7 @@ void fontPrefEnumerationFunction(const char *name, void *data) nsCStringArray *arr; arr = (nsCStringArray *)data; #ifdef DEBUG_UTF8_CONVERSION - printf("fontPrefEnumerationFunction: %s\n", name); + PRINTF("fontPrefEnumerationFunction: %s\n", name); #endif if (charEndsWith(name,".fixed_font") || charEndsWith(name,".prop_font")) { @@ -2226,7 +2230,7 @@ void ldapPrefEnumerationFunction(const char *name, void *data) nsCStringArray *arr; arr = (nsCStringArray *)data; #ifdef DEBUG_UTF8_CONVERSION - printf("ldapPrefEnumerationFunction: %s\n", name); + PRINTF("ldapPrefEnumerationFunction: %s\n", name); #endif // we only want to convert "ldap_2.servers.*.description" diff --git a/mozilla/profile/src/nsProfile.cpp b/mozilla/profile/src/nsProfile.cpp index de9ff0a2f92..18b0fbf03b2 100644 --- a/mozilla/profile/src/nsProfile.cpp +++ b/mozilla/profile/src/nsProfile.cpp @@ -84,6 +84,12 @@ #define OLD_REGISTRY_FILE_NAME "nsreg.dat" #endif /* XP_UNIX */ +#include "nslog.h" + +NS_IMPL_LOG(nsProfileLog) +#define PRINTF NS_LOG_PRINTF(nsProfileLog) +#define FLUSH NS_LOG_FLUSH(nsProfileLog) + // hack for copying panels.rdf, localstore.rdf & mimeTypes.rdf into migrated profile dir #define PANELS_RDF_FILE "panels.rdf" #define LOCALSTORE_RDF_FILE "localstore.rdf" @@ -283,7 +289,7 @@ nsProfile::nsProfile() nsProfile::~nsProfile() { #if defined(DEBUG_profile_verbose) - printf("~nsProfile \n"); + PRINTF("~nsProfile \n"); #endif if (--gInstanceCount == 0) { @@ -353,7 +359,7 @@ nsProfile::StartupWithArgs(nsICmdLineService *cmdLineArgs) nsCString profileURLStr(""); #ifdef DEBUG_profile_verbose - printf("Profile Manager : Profile Wizard and Manager activites : Begin\n"); + PRINTF("Profile Manager : Profile Wizard and Manager activites : Begin\n"); #endif if (cmdLineArgs) @@ -371,7 +377,7 @@ nsProfile::StartupWithArgs(nsICmdLineService *cmdLineArgs) } #ifdef DEBUG_profile_verbose - printf("Profile Manager : Profile Wizard and Manager activites : End\n"); + PRINTF("Profile Manager : Profile Wizard and Manager activites : End\n"); #endif return NS_OK; @@ -539,7 +545,7 @@ nsProfile::AutoMigrate() if (NS_FAILED(rv) && !mOutofDiskSpace) { #ifdef DEBUG_profile - printf("AutoMigration failed. Let's create a default 5.0 profile.\n"); + PRINTF("AutoMigration failed. Let's create a default 5.0 profile.\n"); #endif rv = CreateDefaultProfile(); @@ -569,7 +575,7 @@ nsProfile::ProcessArgs(nsICmdLineService *cmdLineArgs, PRBool foundProfileCommandArg = PR_FALSE; #ifdef DEBUG_profile_verbose - printf("Profile Manager : Command Line Options : Begin\n"); + PRINTF("Profile Manager : Command Line Options : Begin\n"); #endif // check for command line arguments for profile manager @@ -586,7 +592,7 @@ nsProfile::ProcessArgs(nsICmdLineService *cmdLineArgs, nsAutoString currProfileName; currProfileName.AssignWithConversion(cmdResult); #ifdef DEBUG_profile - printf("ProfileName : %s\n", (const char*)cmdResult); + PRINTF("ProfileName : %s\n", (const char*)cmdResult); #endif /* DEBUG_profile */ PRBool exists; rv = ProfileExists(currProfileName.GetUnicode(), &exists); @@ -659,7 +665,7 @@ nsProfile::ProcessArgs(nsICmdLineService *cmdLineArgs, NS_ENSURE_SUCCESS(rv, rv); } #ifdef DEBUG_profile_verbose - printf("profileName & profileDir are: %s\n", (const char*)cmdResult); + PRINTF("profileName & profileDir are: %s\n", (const char*)cmdResult); #endif /* DEBUG_profile */ nsXPIDLString currProfilePath; @@ -765,7 +771,7 @@ nsProfile::ProcessArgs(nsICmdLineService *cmdLineArgs, } #ifdef DEBUG_profile_verbose - printf("Profile Manager : Command Line Options : End\n"); + PRINTF("Profile Manager : Command Line Options : End\n"); #endif return NS_OK; @@ -786,7 +792,7 @@ NS_IMETHODIMP nsProfile::GetProfileDir(const PRUnichar *profileName, nsIFile **p nsresult rv = NS_OK; #if defined(DEBUG_profile_verbose) - printf("ProfileManager : GetProfileDir\n"); + PRINTF("ProfileManager : GetProfileDir\n"); #endif ProfileStruct *aProfile; @@ -1153,14 +1159,14 @@ nsProfile::CreateNewProfile(const PRUnichar* profileName, #if defined(DEBUG_profile) { - printf("ProfileManager : CreateNewProfile\n"); + PRINTF("ProfileManager : CreateNewProfile\n"); nsCAutoString temp1; temp1.AssignWithConversion(profileName); - printf("Profile Name: %s\n", NS_STATIC_CAST(const char*, temp1)); + PRINTF("Profile Name: %s\n", NS_STATIC_CAST(const char*, temp1)); if (nativeProfileDir) { nsCAutoString temp2; temp2.AssignWithConversion(nativeProfileDir); - printf("Profile Dir: %s\n", NS_STATIC_CAST(const char*, temp2)); + PRINTF("Profile Dir: %s\n", NS_STATIC_CAST(const char*, temp2)); } } #endif @@ -1203,7 +1209,7 @@ nsProfile::CreateNewProfile(const PRUnichar* profileName, } #if defined(DEBUG_profile_verbose) - printf("before SetProfileDir\n"); + PRINTF("before SetProfileDir\n"); #endif rv = profileDir->Exists(&exists); @@ -1224,7 +1230,7 @@ nsProfile::CreateNewProfile(const PRUnichar* profileName, rv = SetProfileDir(profileName, profileDir); #if defined(DEBUG_profile_verbose) - printf("after SetProfileDir\n"); + PRINTF("after SetProfileDir\n"); #endif // Get profile defaults folder.. @@ -1277,7 +1283,7 @@ nsresult nsProfile::CreateUserDirectories(nsILocalFile *profileDir) nsresult rv = NS_OK; #if defined(DEBUG_profile_verbose) - printf("ProfileManager : CreateUserDirectories\n"); + PRINTF("ProfileManager : CreateUserDirectories\n"); #endif const char* subDirNames[] = { @@ -1314,7 +1320,7 @@ nsresult nsProfile::DeleteUserDirectories(nsILocalFile *profileDir) nsresult rv; #if defined(DEBUG_profile_verbose) - printf("ProfileManager : DeleteUserDirectories\n"); + PRINTF("ProfileManager : DeleteUserDirectories\n"); #endif PRBool exists; @@ -1340,13 +1346,13 @@ nsProfile::RenameProfile(const PRUnichar* oldName, const PRUnichar* newName) #if defined(DEBUG_profile) { - printf("ProfileManager : Renaming profile\n"); + PRINTF("ProfileManager : Renaming profile\n"); nsCAutoString temp1; temp1.AssignWithConversion(oldName); - printf("Old name: %s\n", NS_STATIC_CAST(const char*, temp1)); + PRINTF("Old name: %s\n", NS_STATIC_CAST(const char*, temp1)); nsCAutoString temp2; temp2.AssignWithConversion(newName); - printf("New name: %s\n", NS_STATIC_CAST(const char*, temp2)); + PRINTF("New name: %s\n", NS_STATIC_CAST(const char*, temp2)); } #endif @@ -1357,7 +1363,7 @@ nsProfile::RenameProfile(const PRUnichar* oldName, const PRUnichar* newName) // That profile already exists... if (exists) { #if defined(DEBUG_profile) - printf("ProfileManager : Rename Operation failed : Profile exists. Provide a different new name for profile.\n"); + PRINTF("ProfileManager : Rename Operation failed : Profile exists. Provide a different new name for profile.\n"); #endif return NS_ERROR_FAILURE; } @@ -1497,10 +1503,10 @@ NS_IMETHODIMP nsProfile::StartApprunner(const PRUnichar* profileName) #if defined(DEBUG_profile) { - printf("ProfileManager : StartApprunner\n"); + PRINTF("ProfileManager : StartApprunner\n"); nsCAutoString temp; temp.AssignWithConversion(profileName); - printf("profileName passed in: %s", NS_STATIC_CAST(const char*, temp)); + PRINTF("profileName passed in: %s", NS_STATIC_CAST(const char*, temp)); } #endif @@ -1549,7 +1555,7 @@ NS_IMETHODIMP nsProfile::MigrateProfileInfo() #if defined(XP_PC) || defined(XP_MAC) #if defined(DEBUG_profile_verbose) - printf("Entered MigrateProfileInfo.\n"); + PRINTF("Entered MigrateProfileInfo.\n"); #endif char oldRegFile[_MAX_LENGTH] = {'\0'}; @@ -1651,7 +1657,7 @@ nsProfile::MigrateProfile(const PRUnichar* profileName, PRBool showProgressAsMod nsresult rv = NS_OK; #if defined(DEBUG_profile) - printf("Inside Migrate Profile routine.\n" ); + PRINTF("Inside Migrate Profile routine.\n" ); #endif nsCOMPtr oldProfDir; @@ -1672,6 +1678,7 @@ nsProfile::MigrateProfile(const PRUnichar* profileName, PRBool showProgressAsMod rv = newProfDir->CreateUnique(suggestedName, nsIFile::DIRECTORY_TYPE, 0775); if (NS_FAILED(rv)) return rv; + // always create level indirection when migrating rv = AddLevelOfIndirection(newProfDir); if (NS_FAILED(rv)) return rv; @@ -1994,7 +2001,7 @@ NS_IMETHODIMP nsProfile::CloneProfile(const PRUnichar* newProfile) nsresult rv = NS_OK; #if defined(DEBUG_profile) - printf("ProfileManager : CloneProfile\n"); + PRINTF("ProfileManager : CloneProfile\n"); #endif nsCOMPtr currProfileDir; @@ -2025,10 +2032,10 @@ NS_IMETHODIMP nsProfile::CloneProfile(const PRUnichar* newProfile) #if defined(DEBUG_profile_verbose) { if (NS_SUCCEEDED(rv)) - printf("ProfileManager : Cloned CurrentProfile\n"); + PRINTF("ProfileManager : Cloned CurrentProfile\n"); nsCAutoString temp; temp.AssignWithConversion(newProfile); - printf("The new profile is ->%s<-\n", NS_STATIC_CAST(const char*, temp)); + PRINTF("The new profile is ->%s<-\n", NS_STATIC_CAST(const char*, temp)); } #endif diff --git a/mozilla/profile/src/nsProfileAccess.cpp b/mozilla/profile/src/nsProfileAccess.cpp index aa2b19c1acb..924e47145ef 100644 --- a/mozilla/profile/src/nsProfileAccess.cpp +++ b/mozilla/profile/src/nsProfileAccess.cpp @@ -37,6 +37,11 @@ #include "nsDirectoryServiceDefs.h" #include "nsAppDirectoryServiceDefs.h" #include "nsILocalFile.h" +#include "nslog.h" + +NS_IMPL_LOG(nsProfileAccessLog) +#define PRINTF NS_LOG_PRINTF(nsProfileAccessLog) +#define FLUSH NS_LOG_FLUSH(nsProfileAccessLog) #define NS_IMPL_IDS #include "nsICharsetConverterManager.h" @@ -1369,9 +1374,7 @@ nsProfileAccess::Get4xProfileInfo(const char *registryName) if (NS_FAILED(rv)) return rv; -#ifdef DEBUG - printf("%s exists: %d\n",profileLocation.GetBuffer(), exists); -#endif + PRINTF("%s exists: %d\n",profileLocation.GetBuffer(), exists); if (exists) { ProfileStruct* profileItem = new ProfileStruct(); if (!profileItem) @@ -1393,9 +1396,7 @@ nsProfileAccess::Get4xProfileInfo(const char *registryName) //delete profileItem; } else { -#ifdef DEBUG - printf("no 4.x profile\n"); -#endif + PRINTF("no 4.x profile\n"); } } #endif /* XP_UNIX */ diff --git a/mozilla/rdf/base/src/nsContainerEnumerator.cpp b/mozilla/rdf/base/src/nsContainerEnumerator.cpp index 2bfcd70969c..fe980faba35 100644 --- a/mozilla/rdf/base/src/nsContainerEnumerator.cpp +++ b/mozilla/rdf/base/src/nsContainerEnumerator.cpp @@ -51,6 +51,11 @@ #include "prlog.h" #include "rdf.h" #include "rdfutil.h" +#include "nslog.h" + +NS_IMPL_LOG(nsContainerEnumeratorLog) +#define PRINTF NS_LOG_PRINTF(nsContainerEnumeratorLog) +#define FLUSH NS_LOG_FLUSH(nsContainerEnumeratorLog) //////////////////////////////////////////////////////////////////////// @@ -115,7 +120,7 @@ ContainerEnumeratorImpl::~ContainerEnumeratorImpl(void) { #ifdef DEBUG_REFS --gInstanceCount; - fprintf(stdout, "%d - RDF: ContainerEnumeratorImpl\n", gInstanceCount); + PRINTF("%d - RDF: ContainerEnumeratorImpl\n", gInstanceCount); #endif NS_IF_RELEASE(mResult); diff --git a/mozilla/rdf/base/src/nsInMemoryDataSource.cpp b/mozilla/rdf/base/src/nsInMemoryDataSource.cpp index f54d987a800..567bece5130 100644 --- a/mozilla/rdf/base/src/nsInMemoryDataSource.cpp +++ b/mozilla/rdf/base/src/nsInMemoryDataSource.cpp @@ -77,6 +77,11 @@ #include "plstr.h" #include "prlog.h" #include "rdf.h" +#include "nslog.h" + +NS_IMPL_LOG(nsInMemoryDataSourceLog) +#define PRINTF NS_LOG_PRINTF(nsInMemoryDataSourceLog) +#define FLUSH NS_LOG_FLUSH(nsInMemoryDataSourceLog) #if defined(MOZ_THREADSAFE_RDF) #define NS_AUTOLOCK(_lock) nsAutoLock _autolock(_lock) @@ -84,9 +89,7 @@ #define NS_AUTOLOCK(_lock) #endif -#ifdef PR_LOGGING -static PRLogModuleInfo* gLog = nsnull; -#endif +#define gLog nsInMemoryDataSourceLog // This struct is used as the slot value in the forward and reverse // arcs hash tables. @@ -170,7 +173,7 @@ Assertion::~Assertion() MOZ_COUNT_DTOR(RDF_Assertion); #ifdef DEBUG_REFS --gInstanceCount; - fprintf(stdout, "%d - RDF: Assertion\n", gInstanceCount); + PRINTF("%d - RDF: Assertion\n", gInstanceCount); #endif NS_RELEASE(mSource); @@ -405,7 +408,7 @@ InMemoryAssertionEnumeratorImpl::~InMemoryAssertionEnumeratorImpl() { #ifdef DEBUG_REFS --gInstanceCount; - fprintf(stdout, "%d - RDF: InMemoryAssertionEnumeratorImpl\n", gInstanceCount); + PRINTF( "%d - RDF: InMemoryAssertionEnumeratorImpl\n", gInstanceCount); #endif if (mNextAssertion) @@ -560,7 +563,7 @@ InMemoryArcsEnumeratorImpl::~InMemoryArcsEnumeratorImpl() { #ifdef DEBUG_REFS --gInstanceCount; - fprintf(stdout, "%d - RDF: InMemoryArcsEnumeratorImpl\n", gInstanceCount); + PRINTF( "%d - RDF: InMemoryArcsEnumeratorImpl\n", gInstanceCount); #endif NS_RELEASE(mDataSource); @@ -731,11 +734,6 @@ InMemoryDataSource::Init() return NS_ERROR_OUT_OF_MEMORY; #endif -#ifdef PR_LOGGING - if (! gLog) - gLog = PR_NewLogModule("InMemoryDataSource"); -#endif - return NS_OK; } @@ -744,7 +742,7 @@ InMemoryDataSource::~InMemoryDataSource() { #ifdef DEBUG_REFS --gInstanceCount; - fprintf(stdout, "%d - RDF: InMemoryDataSource\n", gInstanceCount); + PRINTF("%d - RDF: InMemoryDataSource\n", gInstanceCount); #endif if (mForwardArcs) { diff --git a/mozilla/rdf/base/src/nsRDFContainer.cpp b/mozilla/rdf/base/src/nsRDFContainer.cpp index 1817aabe951..3ebac3002ed 100644 --- a/mozilla/rdf/base/src/nsRDFContainer.cpp +++ b/mozilla/rdf/base/src/nsRDFContainer.cpp @@ -60,6 +60,11 @@ #include "nsString.h" #include "nsXPIDLString.h" #include "rdf.h" +#include "nslog.h" + +NS_IMPL_LOG(nsRDFContainerLog) +#define PRINTF NS_LOG_PRINTF(nsRDFContainerLog) +#define FLUSH NS_LOG_FLUSH(nsRDFContainerLog) static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID); static NS_DEFINE_CID(kRDFContainerUtilsCID, NS_RDFCONTAINERUTILS_CID); @@ -461,7 +466,7 @@ RDFContainerImpl::~RDFContainerImpl() { #ifdef DEBUG_REFS --gInstanceCount; - fprintf(stdout, "%d - RDF: RDFContainerImpl\n", gInstanceCount); + PRINTF("%d - RDF: RDFContainerImpl\n", gInstanceCount); #endif NS_IF_RELEASE(mContainer); diff --git a/mozilla/rdf/base/src/nsRDFContainerUtils.cpp b/mozilla/rdf/base/src/nsRDFContainerUtils.cpp index fc537f8101b..818f9195a87 100644 --- a/mozilla/rdf/base/src/nsRDFContainerUtils.cpp +++ b/mozilla/rdf/base/src/nsRDFContainerUtils.cpp @@ -40,6 +40,11 @@ #include "prprf.h" #include "rdf.h" #include "rdfutil.h" +#include "nslog.h" + +NS_IMPL_LOG(nsRDFContainerUtilsLog) +#define PRINTF NS_LOG_PRINTF(nsRDFContainerUtilsLog) +#define FLUSH NS_LOG_FLUSH(nsRDFContainerUtilsLog) static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID); static const char kRDFNameSpaceURI[] = RDF_NAMESPACE_URI; @@ -373,7 +378,7 @@ RDFContainerUtilsImpl::~RDFContainerUtilsImpl() { #ifdef DEBUG_REFS --gInstanceCount; - fprintf(stdout, "%d - RDF: RDFContainerUtilsImpl\n", gInstanceCount); + PRINTF("%d - RDF: RDFContainerUtilsImpl\n", gInstanceCount); #endif if (--gRefCnt == 0) { diff --git a/mozilla/rdf/base/src/nsRDFContentSink.cpp b/mozilla/rdf/base/src/nsRDFContentSink.cpp index f29596cf826..d1956ebd693 100644 --- a/mozilla/rdf/base/src/nsRDFContentSink.cpp +++ b/mozilla/rdf/base/src/nsRDFContentSink.cpp @@ -77,6 +77,11 @@ #include "rdfutil.h" #include "nsHTMLTokens.h" // XXX so we can use nsIParserNode::GetTokenType() +#include "nslog.h" + +NS_IMPL_LOG(nsRDFContentSinkLog) +#define PRINTF NS_LOG_PRINTF(nsRDFContentSinkLog) +#define FLUSH NS_LOG_FLUSH(nsRDFContentSinkLog) //////////////////////////////////////////////////////////////////////// @@ -101,9 +106,7 @@ static NS_DEFINE_CID(kRDFInMemoryDataSourceCID, NS_RDFINMEMORYDATASOURCE_CID); //////////////////////////////////////////////////////////////////////// -#ifdef PR_LOGGING -static PRLogModuleInfo* gLog; -#endif +#define gLog nsRDFContentSinkLog //////////////////////////////////////////////////////////////////////// // Utility routines @@ -356,11 +359,6 @@ RDFContentSinkImpl::RDFContentSinkImpl() kLiAtom = NS_NewAtom("li"); kXMLNSAtom = NS_NewAtom("xmlns"); } - -#ifdef PR_LOGGING - if (! gLog) - gLog = PR_NewLogModule("nsRDFContentSink"); -#endif } @@ -368,7 +366,7 @@ RDFContentSinkImpl::~RDFContentSinkImpl() { #ifdef DEBUG_REFS --gInstanceCount; - fprintf(stdout, "%d - RDF: RDFContentSinkImpl\n", gInstanceCount); + PRINTF("%d - RDF: RDFContentSinkImpl\n", gInstanceCount); #endif NS_IF_RELEASE(mDocumentURL); diff --git a/mozilla/rdf/base/src/nsRDFService.cpp b/mozilla/rdf/base/src/nsRDFService.cpp index 73a3165aee6..82545f18764 100644 --- a/mozilla/rdf/base/src/nsRDFService.cpp +++ b/mozilla/rdf/base/src/nsRDFService.cpp @@ -65,6 +65,11 @@ #include "prprf.h" #include "prmem.h" #include "rdf.h" +#include "nslog.h" + +NS_IMPL_LOG(nsRDFServiceLog) +#define PRINTF NS_LOG_PRINTF(nsRDFServiceLog) +#define FLUSH NS_LOG_FLUSH(nsRDFServiceLog) //////////////////////////////////////////////////////////////////////// @@ -79,9 +84,7 @@ static NS_DEFINE_IID(kIRDFResourceIID, NS_IRDFRESOURCE_IID); static NS_DEFINE_IID(kIRDFNodeIID, NS_IRDFNODE_IID); static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); -#ifdef PR_LOGGING -static PRLogModuleInfo* gLog = nsnull; -#endif +#define gLog nsRDFServiceLog // Defining these will re-use the string pointer that is owned by the // resource (or literal) as the key for the hashtable. It avoids two @@ -243,7 +246,7 @@ LiteralImpl::~LiteralImpl() { #ifdef DEBUG_REFS --gInstanceCount; - fprintf(stdout, "%d - RDF: LiteralImpl\n", gInstanceCount); + PRINTF("%d - RDF: LiteralImpl\n", gInstanceCount); #endif gRDFService->UnregisterLiteral(this); @@ -348,7 +351,7 @@ DateImpl::~DateImpl() { #ifdef DEBUG_REFS --gInstanceCount; - fprintf(stdout, "%d - RDF: DateImpl\n", gInstanceCount); + PRINTF("%d - RDF: DateImpl\n", gInstanceCount); #endif } @@ -450,7 +453,7 @@ IntImpl::~IntImpl() { #ifdef DEBUG_REFS --gInstanceCount; - fprintf(stdout, "%d - RDF: IntImpl\n", gInstanceCount); + PRINTF("%d - RDF: IntImpl\n", gInstanceCount); #endif } @@ -578,11 +581,6 @@ RDFServiceImpl::Init() NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get default resource factory"); if (NS_FAILED(rv)) return rv; -#ifdef PR_LOGGING - if (! gLog) - gLog = PR_NewLogModule("nsRDFService"); -#endif - return NS_OK; } @@ -591,7 +589,7 @@ RDFServiceImpl::~RDFServiceImpl() { #ifdef DEBUG_REFS --gInstanceCount; - fprintf(stdout, "%d - RDF: RDFServiceImpl\n", gInstanceCount); + PRINTF("%d - RDF: RDFServiceImpl\n", gInstanceCount); #endif if (mNamedDataSources) { diff --git a/mozilla/rdf/brprof/server/nsBrowsingProfileReader.cpp b/mozilla/rdf/brprof/server/nsBrowsingProfileReader.cpp index afa25e0fe3c..70f6ae9692e 100644 --- a/mozilla/rdf/brprof/server/nsBrowsingProfileReader.cpp +++ b/mozilla/rdf/brprof/server/nsBrowsingProfileReader.cpp @@ -46,6 +46,11 @@ #include "plstr.h" #include "prlog.h" #include "rdf.h" +#include "nslog.h" + +NS_IMPL_LOG(nsBrowsingProfileReaderLog, 0) +#define PRINTF NS_LOG_PRINTF(nsBrowsingProfileReaderLog) +#define FLUSH NS_LOG_FLUSH(nsBrowsingProfileReaderLog) //////////////////////////////////////////////////////////////////////// @@ -503,7 +508,7 @@ int main(int argc, char **argv) if (NS_FAILED(rv)) return rv; if (! service.RegisterService(host)) { - printf("Failed to Register with %s\n", host); + PRINTF("Failed to Register with %s\n", host); return 1; } diff --git a/mozilla/rdf/chrome/src/nsChromeProtocolHandler.cpp b/mozilla/rdf/chrome/src/nsChromeProtocolHandler.cpp index 4d8b47de1dd..d41863b4bcc 100644 --- a/mozilla/rdf/chrome/src/nsChromeProtocolHandler.cpp +++ b/mozilla/rdf/chrome/src/nsChromeProtocolHandler.cpp @@ -47,6 +47,13 @@ #include "nsRDFCID.h" #include "nsXPIDLString.h" #include "prlog.h" +#include "nslog.h" + +NS_IMPL_LOG(nsChromeProtocolHandlerLog) +#define PRINTF NS_LOG_PRINTF(nsChromeProtocolHandlerLog) +#define FLUSH NS_LOG_FLUSH(nsChromeProtocolHandlerLog) + +#define gLog nsChromeProtocolHandlerLog //---------------------------------------------------------------------- @@ -105,10 +112,6 @@ protected: static void* PR_CALLBACK HandleStopLoadEvent(PLEvent* aEvent); static void PR_CALLBACK DestroyLoadEvent(PLEvent* aEvent); -#ifdef PR_LOGGING - static PRLogModuleInfo* gLog; -#endif - public: static nsresult Create(nsIURI* aURI, nsIChannel** aResult); @@ -130,10 +133,6 @@ public: NS_DECL_NSICHANNEL }; -#ifdef PR_LOGGING -PRLogModuleInfo* nsCachedChromeChannel::gLog; -#endif - NS_IMPL_ADDREF(nsCachedChromeChannel); NS_IMPL_RELEASE(nsCachedChromeChannel); NS_IMPL_QUERY_INTERFACE2(nsCachedChromeChannel, nsIRequest, nsIChannel); @@ -160,11 +159,6 @@ nsCachedChromeChannel::nsCachedChromeChannel(nsIURI* aURI) { NS_INIT_REFCNT(); -#ifdef PR_LOGGING - if (! gLog) - gLog = PR_NewLogModule("nsCachedChromeChannel"); -#endif - PR_LOG(gLog, PR_LOG_DEBUG, ("nsCachedChromeChannel[%p]: created", this)); } @@ -683,7 +677,7 @@ nsChromeProtocolHandler::NewChannel(nsIURI* aURI, //nsXPIDLCString oldSpec; //aURI->GetSpec(getter_Copies(oldSpec)); - //printf("*************************** %s\n", (const char*)oldSpec); + //PRINTF("*************************** %s", (const char*)oldSpec); nsXPIDLCString spec; rv = reg->ConvertChromeURL(chromeURI, getter_Copies(spec)); @@ -709,7 +703,7 @@ nsChromeProtocolHandler::NewChannel(nsIURI* aURI, jar = do_QueryInterface(result); } if (!res && !file && !jar) { - NS_WARNING("Remote chrome not allowed! Only file:, resource:, and jar: are valid.\n"); + NS_WARNING("Remote chrome not allowed! Only file:, resource:, and jar: are valid."); result = nsnull; return NS_ERROR_FAILURE; } diff --git a/mozilla/rdf/chrome/src/nsChromeRegistry.cpp b/mozilla/rdf/chrome/src/nsChromeRegistry.cpp index 697dc849cc6..2798b3eea6c 100644 --- a/mozilla/rdf/chrome/src/nsChromeRegistry.cpp +++ b/mozilla/rdf/chrome/src/nsChromeRegistry.cpp @@ -77,6 +77,11 @@ #include "nsInt64.h" #include "nsIDirectoryService.h" #include "nsAppDirectoryServiceDefs.h" +#include "nslog.h" + +NS_IMPL_LOG(nsChromeRegistryLog) +#define PRINTF NS_LOG_PRINTF(nsChromeRegistryLog) +#define FLUSH NS_LOG_FLUSH(nsChromeRegistryLog) static char kChromePrefix[] = "chrome://"; static char kAllPackagesName[] = "all-packages.rdf"; @@ -1718,9 +1723,7 @@ NS_IMETHODIMP nsChromeRegistry::InstallProvider(const nsCString& aProviderType, PRBool aRemove) { // XXX don't allow local chrome overrides of install chrome! -#ifdef DEBUG - printf("*** Chrome Registration of %s: Checking for contents.rdf at %s\n", (const char*)aProviderType, (const char*)aBaseURL); -#endif + PRINTF("*** Chrome Registration of %s: Checking for contents.rdf at %s\n", (const char*)aProviderType, (const char*)aBaseURL); // Load the data source found at the base URL. nsCOMPtr dataSource; @@ -2634,9 +2637,7 @@ nsChromeRegistry::ProcessNewChromeBuffer(char *aBuffer, PRInt32 aLength) if (isSelection) { nsAutoString name; name.AssignWithConversion(chromeLocation); rv = SelectSkin(name.GetUnicode(), isProfile); -#ifdef DEBUG - printf("***** Chrome Registration: Selecting skin %s as default\n", (const char*)chromeLocation); -#endif + PRINTF("***** Chrome Registration: Selecting skin %s as default\n", (const char*)chromeLocation); } else rv = InstallSkin(chromeURL, isProfile, PR_FALSE); @@ -2647,9 +2648,7 @@ nsChromeRegistry::ProcessNewChromeBuffer(char *aBuffer, PRInt32 aLength) if (isSelection) { nsAutoString name; name.AssignWithConversion(chromeLocation); rv = SelectLocale(name.GetUnicode(), isProfile); -#ifdef DEBUG - printf("***** Chrome Registration: Selecting locale %s as default\n", (const char*)chromeLocation); -#endif + PRINTF("***** Chrome Registration: Selecting locale %s as default\n", (const char*)chromeLocation); } else rv = InstallLocale(chromeURL, isProfile); diff --git a/mozilla/rdf/chrome/tools/chromereg/regchrome.cpp b/mozilla/rdf/chrome/tools/chromereg/regchrome.cpp index 8439c81fd8c..6bae9521d18 100644 --- a/mozilla/rdf/chrome/tools/chromereg/regchrome.cpp +++ b/mozilla/rdf/chrome/tools/chromereg/regchrome.cpp @@ -39,7 +39,7 @@ int main(int argc, char **argv) nsIDirectoryServiceProvider *appFileLocProvider; appFileLocProvider = new nsAppFileLocationProvider; if (!appFileLocProvider) { - NS_WARNING("failed to create directory service provider\n"); + NS_WARNING("failed to create directory service provider"); return NS_ERROR_FAILURE; } // add a reference diff --git a/mozilla/rdf/content/src/nsDlgDefaultKeys.cpp b/mozilla/rdf/content/src/nsDlgDefaultKeys.cpp index 75f19e098a6..ff41ca8cc2d 100644 --- a/mozilla/rdf/content/src/nsDlgDefaultKeys.cpp +++ b/mozilla/rdf/content/src/nsDlgDefaultKeys.cpp @@ -37,6 +37,11 @@ #include "nsIScriptGlobalObject.h" #include "nsIDlgDefaultKeys.h" #include "nsRDFCID.h" +#include "nslog.h" + +NS_IMPL_LOG(nsDlgDefaultKeysLog, 0) +#define PRINTF NS_LOG_PRINTF(nsDlgDefaultKeysLog) +#define FLUSH NS_LOG_FLUSH(nsDlgDefaultKeysLog) //////////////////////////////////////////////////////////////////////// @@ -273,7 +278,7 @@ nsresult nsDlgDefaultKeysImpl::DoKey(nsIDOMEvent* aKeyEvent, eEventType aEventTy tempChar[0] = theChar; tempChar[1] = 0; nsString tempChar2 = tempChar; - //printf("compare key [%s] \n", tempChar2.ToNewCString()); // this leaks + //PRINTF("compare key [%s] \n", tempChar2.ToNewCString()); // this leaks // NOTE - convert theChar and keyName to upper keyName.ToUpperCase(); tempChar2.ToUpperCase(); @@ -293,7 +298,7 @@ nsresult nsDlgDefaultKeysImpl::DoKey(nsIDOMEvent* aKeyEvent, eEventType aEventTy } - //printf("onkeypress [%s] \n", cmdToExecute.ToNewCString()); // this leaks + //PRINTF("onkeypress [%s] \n", cmdToExecute.ToNewCString()); // this leaks do { diff --git a/mozilla/rdf/content/src/nsRDFDOMNodeList.cpp b/mozilla/rdf/content/src/nsRDFDOMNodeList.cpp index 92be6decb0b..5a088eb402e 100644 --- a/mozilla/rdf/content/src/nsRDFDOMNodeList.cpp +++ b/mozilla/rdf/content/src/nsRDFDOMNodeList.cpp @@ -39,6 +39,11 @@ #include "nsIServiceManager.h" #include "nsISupportsArray.h" #include "nsRDFDOMNodeList.h" +#include "nslog.h" + +NS_IMPL_LOG(nsRDFDOMNodeListLog) +#define PRINTF NS_LOG_PRINTF(nsRDFDOMNodeListLog) +#define FLUSH NS_LOG_FLUSH(nsRDFDOMNodeListLog) //////////////////////////////////////////////////////////////////////// // GUID definitions @@ -65,7 +70,7 @@ nsRDFDOMNodeList::~nsRDFDOMNodeList(void) { #ifdef DEBUG_REFS --gInstanceCount; - fprintf(stdout, "%d - RDF: nsRDFDOMNodeList\n", gInstanceCount); + PRINTF("%d - RDF: nsRDFDOMNodeList\n", gInstanceCount); #endif NS_IF_RELEASE(mElements); diff --git a/mozilla/rdf/content/src/nsXULCommandDispatcher.cpp b/mozilla/rdf/content/src/nsXULCommandDispatcher.cpp index 9bc1d1ade42..7d78b162fb8 100644 --- a/mozilla/rdf/content/src/nsXULCommandDispatcher.cpp +++ b/mozilla/rdf/content/src/nsXULCommandDispatcher.cpp @@ -48,10 +48,13 @@ #include "nsXULCommandDispatcher.h" #include "prlog.h" #include "nsIDOMEventTarget.h" +#include "nslog.h" -#ifdef PR_LOGGING -static PRLogModuleInfo* gLog; -#endif +NS_IMPL_LOG(nsXULCommandDispatcherLog) +#define PRINTF NS_LOG_PRINTF(nsXULCommandDispatcherLog) +#define FLUSH NS_LOG_FLUSH(nsXULCommandDispatcherLog) + +#define gLog nsXULCommandDispatcherLog //////////////////////////////////////////////////////////////////////// @@ -60,11 +63,6 @@ nsXULCommandDispatcher::nsXULCommandDispatcher(void) mActive(PR_FALSE), mFocusInitialized(PR_FALSE), mUpdaters(nsnull) { NS_INIT_REFCNT(); - -#ifdef PR_LOGGING - if (! gLog) - gLog = PR_NewLogModule("nsXULCommandDispatcher"); -#endif } nsXULCommandDispatcher::~nsXULCommandDispatcher(void) @@ -272,7 +270,7 @@ nsXULCommandDispatcher::UpdateCommands(const nsAReadableString& aEventName) #if 0 { char* actionString = aEventName.ToNewCString(); - printf("Doing UpdateCommands(\"%s\")\n", actionString); + PRINTF("Doing UpdateCommands(\"%s\")\n", actionString); free(actionString); } #endif @@ -373,20 +371,20 @@ nsXULCommandDispatcher::Focus(nsIDOMEvent* aEvent) aEvent->GetOriginalTarget(getter_AddRefs(t)); #if 0 - printf("%d : Focus occurred on: ", this); + PRINTF("%d : Focus occurred on: ", this); nsCOMPtr domDebugElement = do_QueryInterface(t); if (domDebugElement) { - printf("A Focusable DOM Element"); + PRINTF("A Focusable DOM Element"); } nsCOMPtr domDebugDocument = do_QueryInterface(t); if (domDebugDocument) { nsCOMPtr htmlDoc = do_QueryInterface(t); if (htmlDoc) { - printf("Window with an HTML doc (happens twice)"); + PRINTF("Window with an HTML doc (happens twice)"); } - else printf("Window with a XUL doc (happens twice)"); + else PRINTF("Window with a XUL doc (happens twice)"); } - printf("\n"); + PRINTF("\n"); #endif /* DEBUG_hyatt */ nsCOMPtr domElement = do_QueryInterface(t); @@ -442,20 +440,20 @@ nsXULCommandDispatcher::Blur(nsIDOMEvent* aEvent) aEvent->GetOriginalTarget(getter_AddRefs(t)); #if 0 - printf("%d : Blur occurred on: ", this); + PRINTF("%d : Blur occurred on: ", this); nsCOMPtr domDebugElement = do_QueryInterface(t); if (domDebugElement) { - printf("A Focusable DOM Element"); + PRINTF("A Focusable DOM Element"); } nsCOMPtr domDebugDocument = do_QueryInterface(t); if (domDebugDocument) { nsCOMPtr htmlDoc = do_QueryInterface(t); if (htmlDoc) { - printf("Window with an HTML doc (happens twice)"); + PRINTF("Window with an HTML doc (happens twice)"); } - else printf("Window with a XUL doc (happens twice)"); + else PRINTF("Window with a XUL doc (happens twice)"); } - printf("\n"); + PRINTF("\n"); #endif /* DEBUG_hyatt */ nsCOMPtr domElement = do_QueryInterface(t); @@ -633,7 +631,7 @@ nsXULCommandDispatcher::SetSuppressFocus(PRBool aSuppressFocus) else if(mSuppressFocus > 0) --mSuppressFocus; - //printf("mSuppressFocus == %d\n", mSuppressFocus); + //PRINTF("mSuppressFocus == %d\n", mSuppressFocus); // we are unsuppressing after activating, so update focus-related commands // we need this to update commands in the case where an element is focussed. diff --git a/mozilla/rdf/content/src/nsXULContentUtils.cpp b/mozilla/rdf/content/src/nsXULContentUtils.cpp index dd475025806..418e05ca499 100644 --- a/mozilla/rdf/content/src/nsXULContentUtils.cpp +++ b/mozilla/rdf/content/src/nsXULContentUtils.cpp @@ -82,6 +82,11 @@ #include "nsIDateTimeFormat.h" #include "nsDateTimeFormatCID.h" #include "nsIScriptableDateFormat.h" +#include "nslog.h" + +NS_IMPL_LOG(nsXULContentUtilsLog) +#define PRINTF NS_LOG_PRINTF(nsXULContentUtilsLog) +#define FLUSH NS_LOG_FLUSH(nsXULContentUtilsLog) static NS_DEFINE_CID(kDateTimeFormatCID, NS_DATETIMEFORMAT_CID); @@ -301,7 +306,7 @@ nsXULContentUtils::~nsXULContentUtils() { #ifdef DEBUG_REFS --gInstanceCount; - fprintf(stdout, "%d - RDF: nsXULContentUtils\n", gInstanceCount); + PRINTF("%d - RDF: nsXULContentUtils\n", gInstanceCount); #endif if (--gRefCnt == 0) { diff --git a/mozilla/rdf/content/src/nsXULDocument.cpp b/mozilla/rdf/content/src/nsXULDocument.cpp index af8a20678de..47b27011ef5 100644 --- a/mozilla/rdf/content/src/nsXULDocument.cpp +++ b/mozilla/rdf/content/src/nsXULDocument.cpp @@ -128,6 +128,7 @@ #include "nsIXBLService.h" #include "nsReadableUtils.h" +NS_IMPL_LOG(nsXULDocumentLog) //---------------------------------------------------------------------- // @@ -225,8 +226,6 @@ nsIXULPrototypeCache* nsXULDocument::gXULCache; nsIScriptSecurityManager* nsXULDocument::gScriptSecurityManager; nsIPrincipal* nsXULDocument::gSystemPrincipal; -PRLogModuleInfo* nsXULDocument::gXULLog; - class nsProxyLoadStream : public nsIInputStream { private: @@ -3961,11 +3960,6 @@ static const char kXULNameSpaceURI[] = XUL_NAMESPACE_URI; if (NS_FAILED(rv)) return rv; } -#ifdef PR_LOGGING - if (! gXULLog) - gXULLog = PR_NewLogModule("nsXULDocument"); -#endif - return NS_OK; } @@ -5398,7 +5392,7 @@ nsXULDocument::OnStreamComplete(nsIStreamLoader* aLoader, { char* uriSpec; uri->GetSpec(&uriSpec); - printf("Failed to load %s\n", uriSpec ? uriSpec : ""); + PRINTF("Failed to load %s\n", uriSpec ? uriSpec : ""); nsCRT::free(uriSpec); } } @@ -6467,7 +6461,7 @@ nsXULDocument::ParserObserver::OnStopRequest(nsIChannel* aChannel, nsXPIDLCString spec; uri->GetSpec(getter_Copies(spec)); - printf("*** Failed to load overlay %s\n", (const char*) spec); + PRINTF("*** Failed to load overlay %s\n", (const char*) spec); #endif rv = mDocument->ResumeWalk(); diff --git a/mozilla/rdf/content/src/nsXULDocument.h b/mozilla/rdf/content/src/nsXULDocument.h index 7486326cf5f..08f287a2c48 100644 --- a/mozilla/rdf/content/src/nsXULDocument.h +++ b/mozilla/rdf/content/src/nsXULDocument.h @@ -69,6 +69,13 @@ #include "nsIBindingManager.h" #include "nsINodeInfo.h" #include "nsIDOMDocumentEvent.h" +#include "nslog.h" + +NS_DECL_LOG(nsXULDocumentLog) +#define PRINTF NS_LOG_PRINTF(nsXULDocumentLog) +#define FLUSH NS_LOG_FLUSH(nsXULDocumentLog) + +#define gXULLog nsXULDocumentLog class nsIAtom; class nsIElementFactory; @@ -86,7 +93,6 @@ class nsIXULPrototypeScript; #endif struct JSObject; -struct PRLogModuleInfo; /** * The XUL document class @@ -485,8 +491,6 @@ protected: static nsIScriptSecurityManager* gScriptSecurityManager; static nsIPrincipal* gSystemPrincipal; - static PRLogModuleInfo* gXULLog; - static void GetElementFactory(PRInt32 aNameSpaceID, nsIElementFactory** aResult); nsIContent* diff --git a/mozilla/rdf/content/src/nsXULPopupListener.cpp b/mozilla/rdf/content/src/nsXULPopupListener.cpp index 37c3366b4e2..8306fd92183 100644 --- a/mozilla/rdf/content/src/nsXULPopupListener.cpp +++ b/mozilla/rdf/content/src/nsXULPopupListener.cpp @@ -62,6 +62,11 @@ #include "nsIFrame.h" #include "nsIStyleContext.h" +#include "nslog.h" + +NS_IMPL_LOG(nsXULPopupListenerLog) +#define PRINTF NS_LOG_PRINTF(nsXULPopupListenerLog) +#define FLUSH NS_LOG_FLUSH(nsXULPopupListenerLog) //////////////////////////////////////////////////////////////////////// @@ -160,7 +165,7 @@ XULPopupListenerImpl::~XULPopupListenerImpl(void) #ifdef DEBUG_REFS --gInstanceCount; - fprintf(stdout, "%d - RDF: XULPopupListenerImpl\n", gInstanceCount); + PRINTF("%d - RDF: XULPopupListenerImpl\n", gInstanceCount); #endif } diff --git a/mozilla/rdf/content/src/nsXULSortService.cpp b/mozilla/rdf/content/src/nsXULSortService.cpp index c09355367f6..05a045093f1 100644 --- a/mozilla/rdf/content/src/nsXULSortService.cpp +++ b/mozilla/rdf/content/src/nsXULSortService.cpp @@ -107,6 +107,11 @@ #include "nsILocale.h" #include "nsLocaleCID.h" #include "nsILocaleService.h" +#include "nslog.h" + +NS_IMPL_LOG(nsXULSortServiceLog) +#define PRINTF NS_LOG_PRINTF(nsXULSortServiceLog) +#define FLUSH NS_LOG_FLUSH(nsXULSortServiceLog) @@ -436,7 +441,7 @@ XULSortServiceImpl::~XULSortServiceImpl(void) { #ifdef DEBUG_REFS --gInstanceCount; - fprintf(stdout, "%d - RDF: XULSortServiceImpl\n", gInstanceCount); + PRINTF("%d - RDF: XULSortServiceImpl\n", gInstanceCount); #endif --gRefCnt; diff --git a/mozilla/rdf/content/src/nsXULTreeElement.cpp b/mozilla/rdf/content/src/nsXULTreeElement.cpp index db302a46d87..de89357c34c 100644 --- a/mozilla/rdf/content/src/nsXULTreeElement.cpp +++ b/mozilla/rdf/content/src/nsXULTreeElement.cpp @@ -46,6 +46,11 @@ #include "nsLayoutCID.h" #include "nsString.h" #include "nsITreeBoxObject.h" +#include "nslog.h" + +NS_IMPL_LOG(nsXULTreeElementLog) +#define PRINTF NS_LOG_PRINTF(nsXULTreeElementLog) +#define FLUSH NS_LOG_FLUSH(nsXULTreeElementLog) static NS_DEFINE_CID(kCRangeCID, NS_RANGE_CID); static NS_DEFINE_IID(kCContentIteratorCID, NS_CONTENTITERATOR_CID); @@ -113,7 +118,7 @@ nsXULTreeElement::~nsXULTreeElement() { #ifdef DEBUG_REFS --gInstanceCount; - fprintf(stdout, "%d - RDF: nsXULTreeElement\n", gInstanceCount); + PRINTF("%d - RDF: nsXULTreeElement\n", gInstanceCount); #endif NS_IF_RELEASE(mSelectedItems); @@ -415,7 +420,7 @@ nsresult nsXULTreeElement::FireOnSelectHandler() { #ifdef DEBUG_bryner - printf("FireOnSelectHandler\n"); + PRINTF("FireOnSelectHandler\n"); #endif nsCOMPtr content = do_QueryInterface(mOuter); nsCOMPtr document; diff --git a/mozilla/rdf/datasource/src/nsFileSystemDataSource.cpp b/mozilla/rdf/datasource/src/nsFileSystemDataSource.cpp index 3c61325c181..ba229962a6e 100644 --- a/mozilla/rdf/datasource/src/nsFileSystemDataSource.cpp +++ b/mozilla/rdf/datasource/src/nsFileSystemDataSource.cpp @@ -74,6 +74,12 @@ #include #endif +#include "nslog.h" + +NS_IMPL_LOG(nsFileSystemDataSourceLog) +#define PRINTF NS_LOG_PRINTF(nsFileSystemDataSourceLog) +#define FLUSH NS_LOG_FLUSH(nsFileSystemDataSourceLog) + #if defined(XP_UNIX) || defined(XP_OS2) #define USE_NC_EXTENSION #endif @@ -322,7 +328,7 @@ FileSystemDataSource::~FileSystemDataSource (void) { #ifdef DEBUG_REFS --gInstanceCount; - fprintf(stdout, "%d - RDF: FileSystemDataSource\n", gInstanceCount); + PRINTF("%d - RDF: FileSystemDataSource\n", gInstanceCount); #endif if (--gRefCnt == 0) { diff --git a/mozilla/rdf/datasource/src/nsLocalStore.cpp b/mozilla/rdf/datasource/src/nsLocalStore.cpp index d0708daeb1c..bca58e2c0ca 100644 --- a/mozilla/rdf/datasource/src/nsLocalStore.cpp +++ b/mozilla/rdf/datasource/src/nsLocalStore.cpp @@ -41,6 +41,11 @@ #include "rdf.h" #include "nsCOMPtr.h" #include "nsAppDirectoryServiceDefs.h" +#include "nslog.h" + +NS_IMPL_LOG(nsLocalStoreLog) +#define PRINTF NS_LOG_PRINTF(nsLocalStoreLog) +#define FLUSH NS_LOG_FLUSH(nsLocalStoreLog) //////////////////////////////////////////////////////////////////////// @@ -210,7 +215,7 @@ LocalStoreImpl::~LocalStoreImpl(void) { #ifdef DEBUG_REFS --gInstanceCount; - fprintf(stdout, "%d - RDF: LocalStoreImpl\n", gInstanceCount); + PRINTF("%d - RDF: LocalStoreImpl\n", gInstanceCount); #endif } @@ -239,7 +244,7 @@ NS_NewLocalStore(nsILocalStore** aResult) if (NS_FAILED(rv)) { #ifdef DEBUG - printf("\n\nRDF: NS_NewLocalStore::Refresh() failed.\n\n"); + PRINTF("\n\nRDF: NS_NewLocalStore::Refresh() failed.\n\n"); #endif delete impl; diff --git a/mozilla/rdf/tests/domds/nsRDFDOMDataSource.cpp b/mozilla/rdf/tests/domds/nsRDFDOMDataSource.cpp index c345d61d067..1586bd96f98 100644 --- a/mozilla/rdf/tests/domds/nsRDFDOMDataSource.cpp +++ b/mozilla/rdf/tests/domds/nsRDFDOMDataSource.cpp @@ -64,6 +64,11 @@ #endif #include "prprf.h" +#include "nslog.h" + +NS_IMPL_LOG(nsRDFDOMDataSourceLog) +#define PRINTF NS_LOG_PRINTF(nsRDFDOMDataSourceLog) +#define FLUSH NS_LOG_FLUSH(nsRDFDOMDataSourceLog) #define NC_RDF_Name NC_NAMESPACE_URI "Name" #define NC_RDF_Value NC_NAMESPACE_URI "Value" @@ -148,7 +153,7 @@ nsRDFDOMDataSource::GetTarget(nsIRDFResource *aSource, nsIRDFResource *aProperty aSource->GetValue(getter_Copies(sourceval)); nsXPIDLCString propval; aProperty->GetValue(getter_Copies(propval)); - printf("GetTarget(%s, %s,..)\n", (const char*)sourceval, + PRINTF("GetTarget(%s, %s,..)\n", (const char*)sourceval, (const char*)propval); #endif @@ -265,7 +270,7 @@ nsRDFDOMDataSource::GetTargets(nsIRDFResource *aSource, nsIRDFResource *aPropert #ifdef DEBUG_alecf_ nsXPIDLCString propval; aProperty->GetValue(getter_Copies(propval)); - printf("GetTargets(%s, %s,..)\n", (const char*)sourceval, + PRINTF("GetTargets(%s, %s,..)\n", (const char*)sourceval, (const char*)propval); #endif @@ -834,7 +839,7 @@ nsRDFDOMDataSource::getTargetForKnownObject(nsISupports* object, // // doh! I don't know what the heck this is. - printf("getTargetForKnownObject: unknown Object!\n"); + PRINTF("getTargetForKnownObject: unknown Object!\n"); return NS_OK; } @@ -873,7 +878,7 @@ nsRDFDOMDataSource::getTargetsForKnownObject(nsISupports *object, // rv = createContentArcs(content, arcs); // NS_RELEASE(content); // } - printf("This is a document.\n"); + PRINTF("This is a document.\n"); createDOMNodeArcs(document, arcs); return NS_OK; } @@ -884,7 +889,7 @@ nsRDFDOMDataSource::getTargetsForKnownObject(nsISupports *object, nsIFrame* frame; rv = object->QueryInterface(kFrameIID, (void **)&frame); if (NS_SUCCEEDED(rv)) { - printf("creating arcs for frame\n"); + PRINTF("creating arcs for frame\n"); createFrameArcs(frame, arcs); } } @@ -1077,7 +1082,7 @@ nsRDFDOMDataSource::ArcLabelsOut(nsIRDFResource *aSource, nsISimpleEnumerator ** #ifdef DEBUG_alecf_ nsXPIDLCString sourceval; aSource->GetValue(getter_Copies(sourceval)); - printf("ArcLabelsOut(%s)\n", (const char*)sourceval); + PRINTF("ArcLabelsOut(%s)\n", (const char*)sourceval); #endif arcs->AppendElement(kNC_Name); @@ -1226,27 +1231,27 @@ nsRDFDOMDataSource::SetWindow(nsIDOMWindowInternal *window) { nsCOMPtr scriptGlobalObject = do_QueryInterface(window, &rv); if (NS_FAILED(rv)) { - printf("Couldn't get scriptglobalobject\n"); + PRINTF("Couldn't get scriptglobalobject\n"); return NS_OK; } nsCOMPtr docShell; scriptGlobalObject->GetDocShell(getter_AddRefs(docShell)); if (!docShell) { - printf("Couldn't get webshell\n"); + PRINTF("Couldn't get webshell\n"); return NS_OK; } nsCOMPtr pshell; rv = docShell->GetPresShell(getter_AddRefs(pshell)); if (NS_FAILED(rv)) { - printf("Couldn't get presshell\n"); + PRINTF("Couldn't get presshell\n"); return NS_OK; } pshell->GetRootFrame(&mRootFrame); if (NS_FAILED(rv)) { - printf("Couldn't get frame\n"); + PRINTF("Couldn't get frame\n"); return NS_OK; } @@ -1259,14 +1264,14 @@ nsRDFDOMDataSource::SetWindow(nsIDOMWindowInternal *window) { } #endif - printf("Got root frame: %s\n", framename.ToNewCString()); + PRINTF("Got root frame: %s\n", framename.ToNewCString()); return rv; } nsresult nsRDFDOMDataSource::SetMode(const char *mode, PRBool active) { - printf("Turning %s the %s mode\n", active ? "ON" : "OFF", + PRINTF("Turning %s the %s mode\n", active ? "ON" : "OFF", mode); nsCStringKey modeKey(mode); mModeTable.Put(&modeKey, (void *)active); diff --git a/mozilla/string/obsolete/nsString.cpp b/mozilla/string/obsolete/nsString.cpp index ff3129d4c0e..0b8540569e0 100644 --- a/mozilla/string/obsolete/nsString.cpp +++ b/mozilla/string/obsolete/nsString.cpp @@ -32,6 +32,11 @@ #include "nsDebug.h" #include "nsCRT.h" #include "nsDeque.h" +#include "nslog.h" + +NS_IMPL_LOG(nsStringLog) +#define PRINTF NS_LOG_PRINTF(nsStringLog) +#define FLUSH NS_LOG_FLUSH(nsStringLog) #ifndef RICKG_TESTBED #include "prdtoa.h" @@ -1538,7 +1543,7 @@ NS_COM int fputs(const nsCString& aString, FILE* out) void nsCString::DebugDump(void) const { if(mStr && (eOneByte==mCharSize)) { - printf("\n%s",mStr); + PRINTF("\n%s",mStr); } } diff --git a/mozilla/string/obsolete/nsString2.cpp b/mozilla/string/obsolete/nsString2.cpp index ad0611f101c..f6530cbcfe1 100644 --- a/mozilla/string/obsolete/nsString2.cpp +++ b/mozilla/string/obsolete/nsString2.cpp @@ -33,7 +33,11 @@ #include "prdtoa.h" #include "nsISizeOfHandler.h" #endif +#include "nslog.h" +NS_IMPL_LOG(nsString2Log) +#define PRINTF NS_LOG_PRINTF(nsString2Log) +#define FLUSH NS_LOG_FLUSH(nsString2Log) static const char* kPossibleNull = "Error: possible unintended null in string"; static const char* kNullPointerError = "Error: unexpected null ptr"; @@ -1753,7 +1757,7 @@ void nsString::DebugDump(void) const { } if(theBuffer) { - printf("\n%s",theBuffer); + PRINTF("\n%s",theBuffer); } } diff --git a/mozilla/uriloader/base/nsDocLoader.cpp b/mozilla/uriloader/base/nsDocLoader.cpp index 3d8bce45901..dfe234677bf 100644 --- a/mozilla/uriloader/base/nsDocLoader.cpp +++ b/mozilla/uriloader/base/nsDocLoader.cpp @@ -41,24 +41,26 @@ #include "nsIPresShell.h" #include "nsIPresContext.h" #include "nsIStringBundle.h" +#include "nslog.h" + +NS_IMPL_LOG(nsDocLoaderLog, 0) +#define PRINTF NS_LOG_PRINTF(nsDocLoaderLog) +#define FLUSH NS_LOG_FLUSH(nsDocLoaderLog) static NS_DEFINE_CID(kStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID); -#if defined(PR_LOGGING) // // Log module for nsIDocumentLoader logging... // // To enable logging (see prlog.h for full details): // -// set NSPR_LOG_MODULES=DocLoader:5 +// set NSPR_LOG_MODULES=nsDocLoaderLog:5 // set NSPR_LOG_FILE=nspr.log // // this enables PR_LOG_DEBUG level information and places all output in // the file nspr.log // -PRLogModuleInfo* gDocLoaderLog = nsnull; -#endif /* PR_LOGGING */ - +#define gDocLoaderLog nsDocLoaderLog #if defined(DEBUG) void GetURIStringFromChannel(nsIRequest *aRequest, nsXPIDLCString &aStr) @@ -102,12 +104,6 @@ nsDocLoaderImpl::nsDocLoaderImpl() { NS_INIT_REFCNT(); -#if defined(PR_LOGGING) - if (nsnull == gDocLoaderLog) { - gDocLoaderLog = PR_NewLogModule("DocLoader"); - } -#endif /* PR_LOGGING */ - mContainer = nsnull; mParent = nsnull; @@ -1449,7 +1445,7 @@ void nsDocLoaderImpl::DumpChannelInfo() PRInt32 current=0, max=0; - printf("==== DocLoader=%x\n", this); + PRINTF("==== DocLoader=%x\n", this); count = mChannelInfoList.Count(); for(i=0; imURI->GetSpec(getter_Copies(buffer)); } - printf(" [%d] current=%d max=%d [%s]\n", i, + PRINTF(" [%d] current=%d max=%d [%s]\n", i, info->mCurrentProgress, info->mMaxProgress, (const char *)buffer); #endif /* DEBUG */ @@ -1477,7 +1473,7 @@ void nsDocLoaderImpl::DumpChannelInfo() } } - printf("\nCurrent=%d Total=%d\n====\n", current, max); + PRINTF("\nCurrent=%d Total=%d\n====\n", current, max); } #endif /* 0 */ diff --git a/mozilla/uriloader/exthandler/nsExternalHelperAppService.cpp b/mozilla/uriloader/exthandler/nsExternalHelperAppService.cpp index e9a0970e3f8..dde712120a5 100644 --- a/mozilla/uriloader/exthandler/nsExternalHelperAppService.cpp +++ b/mozilla/uriloader/exthandler/nsExternalHelperAppService.cpp @@ -59,6 +59,11 @@ #include "nsILocalFileMac.h" #include "nsIInternetConfigService.h" #endif // XP_MAC +#include "nslog.h" + +NS_IMPL_LOG(nsExternalHelperAppServiceLog, 0) +#define PRINTF NS_LOG_PRINTF(nsExternalHelperAppServiceLog) +#define FLUSH NS_LOG_FLUSH(nsExternalHelperAppServiceLog) static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID); static NS_DEFINE_CID(kRDFXMLDataSourceCID, NS_RDFXMLDATASOURCE_CID); @@ -173,7 +178,7 @@ nsresult nsExternalHelperAppService::InitDataSource() PRBool loaded; rv = remoteDS->GetLoaded(&loaded); NS_ASSERTION(NS_SUCCEEDED(rv), "failed getload\n"); - printf("After refresh: datasource is %s\n", loaded ? "loaded" : "not loaded"); + PRINTF("After refresh: datasource is %s\n", loaded ? "loaded" : "not loaded"); #endif // initialize our resources if we haven't done so already... diff --git a/mozilla/uriloader/extprotocol/base/nsExternalProtocol.cpp b/mozilla/uriloader/extprotocol/base/nsExternalProtocol.cpp index 45d9d6915a4..be4ca5f734c 100644 --- a/mozilla/uriloader/extprotocol/base/nsExternalProtocol.cpp +++ b/mozilla/uriloader/extprotocol/base/nsExternalProtocol.cpp @@ -29,19 +29,8 @@ #include "nsExternalProtocol.h" #include "nsXPIDLString.h" - - -#ifdef NS_DEBUG -#define DEBUG_LOG0( x) printf( x) -#define DEBUG_LOG1( x, y) printf( x, y) -#else -#define DEBUG_LOG0( x) -#define DEBUG_LOG1( x, y) -#endif - static NS_DEFINE_CID(kStandardURLCID, NS_STANDARDURL_CID); - //////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// diff --git a/mozilla/uriloader/extprotocol/mac/nsExternalProtocolMac.cpp b/mozilla/uriloader/extprotocol/mac/nsExternalProtocolMac.cpp index 1c905cb55c9..0508c949bff 100644 --- a/mozilla/uriloader/extprotocol/mac/nsExternalProtocolMac.cpp +++ b/mozilla/uriloader/extprotocol/mac/nsExternalProtocolMac.cpp @@ -29,16 +29,6 @@ #include -#ifdef NS_DEBUG -#define DEBUG_LOG0( x) printf( x) -#define DEBUG_LOG1( x, y) printf( x, y) -#else -#define DEBUG_LOG0( x) -#define DEBUG_LOG1( x, y) -#endif - - - nsresult nsExternalProtocol::DefaultLaunch( nsIURI *pUri) { nsresult rv = NS_ERROR_FAILURE; diff --git a/mozilla/uriloader/extprotocol/unix/nsExternalProtocolUnix.cpp b/mozilla/uriloader/extprotocol/unix/nsExternalProtocolUnix.cpp index c2a234873c4..6c64980d9a1 100644 --- a/mozilla/uriloader/extprotocol/unix/nsExternalProtocolUnix.cpp +++ b/mozilla/uriloader/extprotocol/unix/nsExternalProtocolUnix.cpp @@ -28,15 +28,6 @@ #include "nsExternalProtocol.h" #include "nsXPIDLString.h" - -#ifdef NS_DEBUG -#define DEBUG_LOG0( x) printf( x) -#define DEBUG_LOG1( x, y) printf( x, y) -#else -#define DEBUG_LOG0( x) -#define DEBUG_LOG1( x, y) -#endif - #endif //////////////////////////////////////////////////////////////////////// diff --git a/mozilla/uriloader/extprotocol/win/nsExternalProtocolWin.cpp b/mozilla/uriloader/extprotocol/win/nsExternalProtocolWin.cpp index ca63de794ce..26f949574ef 100644 --- a/mozilla/uriloader/extprotocol/win/nsExternalProtocolWin.cpp +++ b/mozilla/uriloader/extprotocol/win/nsExternalProtocolWin.cpp @@ -28,15 +28,11 @@ #include "nsXPIDLString.h" #include +#include "nslog.h" -#ifdef NS_DEBUG -#define DEBUG_LOG0( x) printf( x) -#define DEBUG_LOG1( x, y) printf( x, y) -#else -#define DEBUG_LOG0( x) -#define DEBUG_LOG1( x, y) -#endif - +NS_IMPL_LOG(nsExternalProtocolWinLog, 0) +#define PRINTF NS_LOG_PRINTF(nsExternalProtocolWinLog) +#define FLUSH NS_LOG_FLUSH(nsExternalProtocolWinLog) //////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// @@ -108,7 +104,7 @@ nsresult nsExternalProtocol::DefaultLaunch( nsIURI *pUri) } LONG r = (LONG) ::ShellExecute( NULL, "open", uriStr, NULL, NULL, SW_SHOWNORMAL); if (r < 32) { - DEBUG_LOG1( "ShellExecute failed: %d\n", (int)r); + PRINTF("ShellExecute failed: %d\n", (int)r); rv = NS_ERROR_FAILURE; } else diff --git a/mozilla/view/src/nsScrollingView.cpp b/mozilla/view/src/nsScrollingView.cpp index 9821508d903..c59f3d7cd27 100644 --- a/mozilla/view/src/nsScrollingView.cpp +++ b/mozilla/view/src/nsScrollingView.cpp @@ -36,6 +36,11 @@ #include "nsIClipView.h" #include "nsISupportsArray.h" #include "nsIScrollPositionListener.h" +#include "nslog.h" + +NS_IMPL_LOG(nsScrollingViewLog) +#define PRINTF NS_LOG_PRINTF(nsScrollingViewLog) +#define FLUSH NS_LOG_FLUSH(nsScrollingViewLog) static NS_DEFINE_IID(kWidgetCID, NS_CHILD_CID); static NS_DEFINE_IID(kLookAndFeelCID, NS_LOOKANDFEEL_CID); @@ -780,7 +785,7 @@ NS_IMETHODIMP_(void) nsScrollingView::Notify(nsITimer * aTimer) event.point.x = rect.x; event.point.y = (mScrollingDelta > 0) ? (rect.height - rect.y - 1) : 135; - //printf("timer %d %d\n", event.point.x, event.point.y); + //PRINTF("timer %d %d\n", event.point.x, event.point.y); nsIViewObserver *obs; diff --git a/mozilla/view/src/nsView.cpp b/mozilla/view/src/nsView.cpp index 078526b63da..dbb0fadf257 100644 --- a/mozilla/view/src/nsView.cpp +++ b/mozilla/view/src/nsView.cpp @@ -38,6 +38,11 @@ #include "nsGfxCIID.h" #include "nsIRegion.h" #include "nsIClipView.h" +#include "nslog.h" + +NS_IMPL_LOG(nsViewLog) +#define PRINTF NS_LOG_PRINTF(nsViewLog) +#define FLUSH NS_LOG_FLUSH(nsViewLog) static NS_DEFINE_IID(kRegionCID, NS_REGION_CID); @@ -54,7 +59,7 @@ static nsEventStatus PR_CALLBACK HandleEvent(nsGUIEvent *aEvent); // nsEventStatus PR_CALLBACK HandleEvent(nsGUIEvent *aEvent) { -//printf(" %d %d %d (%d,%d) \n", aEvent->widget, aEvent->widgetSupports, +//PRINTF(" %d %d %d (%d,%d) \n", aEvent->widget, aEvent->widgetSupports, // aEvent->message, aEvent->point.x, aEvent->point.y); nsEventStatus result = nsEventStatus_eIgnore; nsIView *view = nsView::GetViewFor(aEvent->widget); @@ -224,7 +229,7 @@ NS_IMETHODIMP nsView :: Init(nsIViewManager* aManager, const nsIView *aParent, nsViewVisibility aVisibilityFlag) { - //printf(" \n callback=%d data=%d", aWidgetCreateCallback, aCallbackData); + //PRINTF(" \n callback=%d data=%d", aWidgetCreateCallback, aCallbackData); NS_PRECONDITION(nsnull != aManager, "null ptr"); if (nsnull == aManager) { return NS_ERROR_NULL_POINTER; @@ -308,7 +313,7 @@ NS_IMETHODIMP nsView :: HandleEvent(nsGUIEvent *event, PRUint32 aEventFlags, nsEventStatus* aStatus, PRBool aForceHandle, PRBool& aHandled) { NS_ENSURE_ARG_POINTER(aStatus); -//printf(" %d %d %d %d (%d,%d) \n", this, event->widget, event->widgetSupports, +//PRINTF(" %d %d %d %d (%d,%d) \n", this, event->widget, event->widgetSupports, // event->message, event->point.x, event->point.y); // Hold a refcount to the observer. The continued existence of the observer will @@ -483,7 +488,7 @@ NS_IMETHODIMP nsView :: SynchWidgetSizePosition() else if (bounds.width == width && bounds.height == bounds.height) mVFlags &= ~NS_VIEW_PUBLIC_FLAG_WIDGET_RESIZED; else { - printf("%d) SetBounds(%d,%d,%d,%d)\n", this, x, y, width, height); + PRINTF("%d) SetBounds(%d,%d,%d,%d)\n", this, x, y, width, height); mWindow->Resize(x,y,width,height, PR_TRUE); mVFlags &= ~NS_VIEW_PUBLIC_FLAG_WIDGET_RESIZED; mVFlags &= ~NS_VIEW_PUBLIC_FLAG_WIDGET_MOVED; @@ -502,7 +507,7 @@ NS_IMETHODIMP nsView :: SynchWidgetSizePosition() mWindow->GetBounds(bounds); if (bounds.width != width || bounds.height != bounds.height) { - printf("%d) Resize(%d,%d)\n", this, width, height); + PRINTF("%d) Resize(%d,%d)\n", this, width, height); mWindow->Resize(width,height, PR_TRUE); } @@ -524,7 +529,7 @@ NS_IMETHODIMP nsView :: SynchWidgetSizePosition() mWindow->GetBounds(bounds); if (bounds.x != x || bounds.y != y) { - printf("%d) Move(%d,%d)\n", this, x, y); + PRINTF("%d) Move(%d,%d)\n", this, x, y); mWindow->Move(x,y); } diff --git a/mozilla/view/src/nsViewFactory.cpp b/mozilla/view/src/nsViewFactory.cpp index ba39b43aed0..27069be4062 100644 --- a/mozilla/view/src/nsViewFactory.cpp +++ b/mozilla/view/src/nsViewFactory.cpp @@ -33,6 +33,11 @@ #include "nsScrollPortView.h" #include "nsIModule.h" +#include "nslog.h" + +NS_IMPL_LOG(nsViewFactoryLog) +#define PRINTF NS_LOG_PRINTF(nsViewFactoryLog) +#define FLUSH NS_LOG_FLUSH(nsViewFactoryLog) static NS_DEFINE_CID(kCViewManager, NS_VIEW_MANAGER_CID); static NS_DEFINE_CID(kCView, NS_VIEW_CID); @@ -262,9 +267,7 @@ nsViewModule::RegisterSelf(nsIComponentManager *aCompMgr, { nsresult rv; -#ifdef DEBUG_dp - printf("***Registering view library..."); -#endif + PRINTF("***Registering view library..."); rv = aCompMgr->RegisterComponentSpec(kCViewManager, "View Manager", "@mozilla.org/view-manager;1", @@ -281,9 +284,7 @@ nsViewModule::RegisterSelf(nsIComponentManager *aCompMgr, rv = aCompMgr->RegisterComponentSpec(kCScrollPortView, "Scroll Port View", "@mozilla.org/scroll-port-view;1", aPath, PR_TRUE, PR_TRUE); -#ifdef DEBUG_dp - printf("done.\n"); -#endif + PRINTF("done.\n"); return rv; } diff --git a/mozilla/view/src/nsViewManager.cpp b/mozilla/view/src/nsViewManager.cpp index d5618ea7fe2..2816496a4aa 100644 --- a/mozilla/view/src/nsViewManager.cpp +++ b/mozilla/view/src/nsViewManager.cpp @@ -34,6 +34,11 @@ #include "nsISupportsArray.h" #include "nsICompositeListener.h" #include "nsCOMPtr.h" +#include "nslog.h" + +NS_IMPL_LOG(nsViewManagerLog, 0) +#define PRINTF NS_LOG_PRINTF(nsViewManagerLog) +#define FLUSH NS_LOG_FLUSH(nsViewManagerLog) static NS_DEFINE_IID(kBlenderCID, NS_BLENDER_CID); static NS_DEFINE_IID(kRegionCID, NS_REGION_CID); @@ -116,7 +121,7 @@ static void vm_timer_callback(nsITimer *aTimer, void *aClosure) { nsViewManager *vm = (nsViewManager *)aClosure; - printf("ViewManager2 timer callback\n"); + PRINTF("ViewManager2 timer callback\n"); //restart the timer @@ -127,7 +132,7 @@ static void vm_timer_callback(nsITimer *aTimer, void *aClosure) vm->mFrameRate = 0; vm->SetFrameRate(fr); } - //printf("timer composite...\n"); + //PRINTF("timer composite...\n"); #ifndef XP_MAC //XXX temporary: The Mac doesn't need the timer to repaint but // obviously this is not the good method to disable the thing. @@ -654,11 +659,11 @@ NS_IMETHODIMP nsViewManager::SetWindowDimensions(nscoord width, nscoord height) if (nsnull != mRootView) mRootView->SetDimensions(width, height); -//printf("new dims: %d %d\n", width, height); +//PRINTF("new dims: %d %d\n", width, height); // Inform the presentation shell that we've been resized if (nsnull != mObserver) mObserver->ResizeReflow(mRootView, width, height); - //printf("reflow done\n"); + //PRINTF("reflow done\n"); return NS_OK; } @@ -692,7 +697,7 @@ void nsViewManager::Refresh(nsIView *aView, nsIRenderingContext *aContext, nsIRe mPainting = PR_TRUE; - //printf("refreshing region...\n"); + //PRINTF("refreshing region...\n"); //force double buffering because of non-opaque views? if (mTransCnt > 0) @@ -818,9 +823,9 @@ void nsViewManager::Refresh(nsIView *aView, nsIRenderingContext *aContext, const //force double buffering because of non-opaque views? - //printf("refreshing rect... "); + //PRINTF("refreshing rect... "); //stdout << *rect; - //printf("\n"); + //PRINTF("\n"); if (mTransCnt > 0) aUpdateFlags |= NS_VMREFRESH_DOUBLE_BUFFER; @@ -1181,8 +1186,8 @@ void nsViewManager::RenderViews(nsIView *aRootView, nsIRenderingContext& aRC, co // XXX Which color should we use for these bits? aRC.SetColor(NS_RGB(128, 128, 128)); aRC.FillRect(finalTransparentRect); - printf("XXX: Using final transparent rect, x=%d, y=%d, width=%d, height=%d\n", - finalTransparentRect.x, finalTransparentRect.y, finalTransparentRect.width, finalTransparentRect.height); + PRINTF("XXX: Using final transparent rect, x=%d, y=%d, width=%d, height=%d\n", + finalTransparentRect.x, finalTransparentRect.y, finalTransparentRect.width, finalTransparentRect.height); } // initialize various counters. These are updated in OptimizeDisplayListClipping. @@ -1778,7 +1783,7 @@ NS_IMETHODIMP nsViewManager::DispatchEvent(nsGUIEvent *aEvent, nsEventStatus *aS float p2t; mContext->GetDevUnitsToAppUnits(p2t); - //printf("resize: (pix) %d, %d\n", width, height); + //PRINTF("resize: (pix) %d, %d\n", width, height); SetWindowDimensions(NSIntPixelsToTwips(width, p2t), NSIntPixelsToTwips(height, p2t)); *aStatus = nsEventStatus_eConsumeNoDefault; @@ -1829,7 +1834,7 @@ NS_IMETHODIMP nsViewManager::DispatchEvent(nsGUIEvent *aEvent, nsEventStatus *aS // XXX rods updateFlags |= NS_VMREFRESH_DOUBLE_BUFFER; - //printf("refreshing: view: %x, %d, %d, %d, %d\n", view, damrect.x, damrect.y, damrect.width, damrect.height); + //PRINTF("refreshing: view: %x, %d, %d, %d, %d\n", view, damrect.x, damrect.y, damrect.width, damrect.height); // Refresh the view Refresh(view, ((nsPaintEvent*)aEvent)->renderingContext, &damrect, updateFlags); } @@ -1958,9 +1963,9 @@ NS_IMETHODIMP nsViewManager::GrabMouseEvents(nsIView *aView, PRBool &aResult) #ifdef DEBUG_mjudge if (aView) { - printf("capturing mouse events for view %x\n",aView); + PRINTF("capturing mouse events for view %x\n",aView); } - printf("removing mouse capture from view %x\n",mMouseGrabber); + PRINTF("removing mouse capture from view %x\n",mMouseGrabber); #endif mMouseGrabber = aView; @@ -2454,7 +2459,7 @@ void nsViewManager::GetMaxWidgetBounds(nsRect& aMaxWidgetBounds) const } } -// printf("WIDGET BOUNDS %d %d\n", aMaxWidgetBounds.width, aMaxWidgetBounds.height); +// PRINTF("WIDGET BOUNDS %d %d\n", aMaxWidgetBounds.width, aMaxWidgetBounds.height); } PRBool nsViewManager::RectFitsInside(nsRect& aRect, PRInt32 aWidth, PRInt32 aHeight) const @@ -2541,7 +2546,7 @@ void nsViewManager::CalculateDiscreteSurfaceSize(nsRect& aRequestedSize, nsRect& gLargestRequestedSize.height = PR_MAX(aRequestedSize.height, aMaxWidgetSize.height); aSurfaceSize.width = gLargestRequestedSize.width; aSurfaceSize.height = gLargestRequestedSize.height; - // printf("Expanding the largested requested size to %d %d\n", gLargestRequestedSize.width, gLargestRequestedSize.height); + // PRINTF("Expanding the largested requested size to %d %d\n", gLargestRequestedSize.width, gLargestRequestedSize.height); } } @@ -2568,7 +2573,7 @@ nsDrawingSurface nsViewManager::GetDrawingSurface(nsIRenderingContext &aContext, } nsresult rv = aContext.CreateDrawingSurface(&newBounds, 0, mDrawingSurface); - // printf("Allocating a new drawing surface %d %d\n", newBounds.width, newBounds.height); + // PRINTF("Allocating a new drawing surface %d %d\n", newBounds.width, newBounds.height); if (NS_SUCCEEDED(rv)) { mDSBounds = newBounds; aContext.SelectOffScreenDrawingSurface(mDrawingSurface); @@ -3368,7 +3373,7 @@ void nsViewManager::ShowDisplayList(PRInt32 flatlen) float t2p; mContext->GetAppUnitsToDevUnits(t2p); - printf("### display list length=%d ###\n", flatlen); + PRINTF("### display list length=%d ###\n", flatlen); for (cnt = 0; cnt < flatlen; cnt++) { nsIView *view, *parent; @@ -3386,7 +3391,7 @@ void nsViewManager::ShowDisplayList(PRInt32 flatlen) view->GetParent(parent); view->GetZIndex(zindex); rect *= t2p; - printf("%snsIView@%p [z=%d, x=%d, y=%d, w=%d, h=%d, p=%p]\n", + PRINTF("%snsIView@%p [z=%d, x=%d, y=%d, w=%d, h=%d, p=%p]\n", nest, view, zindex, rect.x, rect.y, rect.width, rect.height, parent); @@ -3394,22 +3399,22 @@ void nsViewManager::ShowDisplayList(PRInt32 flatlen) if (flags) { - printf("%s", nest); + PRINTF("%s", nest); if (flags & POP_CLIP) { - printf("POP_CLIP "); + PRINTF("POP_CLIP "); newnestcnt--; } if (flags & PUSH_CLIP) { - printf("PUSH_CLIP "); + PRINTF("PUSH_CLIP "); newnestcnt++; } if (flags & VIEW_RENDERED) - printf("VIEW_RENDERED "); + PRINTF("VIEW_RENDERED "); - printf("\n"); + PRINTF("\n"); } nest[nestcnt << 1] = ' '; @@ -3583,14 +3588,14 @@ PRBool nsViewManager::IsRectVisible(nsIView *aView, const nsRect &aRect) // Debugging code static int toggle = 0; for (int i = 0; i < toggle; i++) { - printf(" "); + PRINTF(" "); } if (toggle == 10) { toggle = 0; } else { toggle++; } - printf("***overlaps %d\n", overlaps); + PRINTF("***overlaps %d\n", overlaps); #endif return overlaps; @@ -3646,7 +3651,7 @@ nsViewManager::IsPainting(PRBool& aIsPainting) nsresult nsViewManager::ProcessWidgetChanges(nsIView* aView) { - //printf("---------Begin Sync----------\n"); + //PRINTF("---------Begin Sync----------\n"); nsresult rv = aView->SynchWidgetSizePosition(); if (NS_FAILED(rv)) return rv; @@ -3661,7 +3666,7 @@ nsViewManager::ProcessWidgetChanges(nsIView* aView) child->GetNextSibling(child); } - //printf("---------End Sync----------\n"); + //PRINTF("---------End Sync----------\n"); return NS_OK; } diff --git a/mozilla/view/src/nsViewManager2.cpp b/mozilla/view/src/nsViewManager2.cpp index 83d4817d130..58fdc5347dc 100755 --- a/mozilla/view/src/nsViewManager2.cpp +++ b/mozilla/view/src/nsViewManager2.cpp @@ -33,6 +33,11 @@ #include "nsISupportsArray.h" #include "nsICompositeListener.h" #include "nsCOMPtr.h" +#include "nslog.h" + +NS_IMPL_LOG(nsViewManager2Log) +#define PRINTF NS_LOG_PRINTF(nsViewManager2Log) +#define FLUSH NS_LOG_FLUSH(nsViewManager2Log) static NS_DEFINE_IID(kBlenderCID, NS_BLENDER_CID); static NS_DEFINE_IID(kRegionCID, NS_REGION_CID); @@ -81,7 +86,7 @@ static void vm_timer_callback(nsITimer *aTimer, void *aClosure) { nsViewManager2 *vm = (nsViewManager2 *)aClosure; - printf("ViewManager2 timer callback\n"); + PRINTF("ViewManager2 timer callback\n"); //restart the timer @@ -92,7 +97,7 @@ static void vm_timer_callback(nsITimer *aTimer, void *aClosure) vm->mFrameRate = 0; vm->SetFrameRate(fr); } - //printf("timer composite...\n"); + //PRINTF("timer composite...\n"); #ifndef XP_MAC //XXX temporary: The Mac doesn't need the timer to repaint but // obviously this is not the good method to disable the thing. @@ -442,11 +447,11 @@ NS_IMETHODIMP nsViewManager2::SetWindowDimensions(nscoord width, nscoord height) if (nsnull != mRootView) mRootView->SetDimensions(width, height); -//printf("new dims: %d %d\n", width, height); +//PRINTF("new dims: %d %d\n", width, height); // Inform the presentation shell that we've been resized if (nsnull != mObserver) mObserver->ResizeReflow(mRootView, width, height); - //printf("reflow done\n"); + //PRINTF("reflow done\n"); return NS_OK; } @@ -480,7 +485,7 @@ void nsViewManager2::Refresh(nsIView *aView, nsIRenderingContext *aContext, nsIR mPainting = PR_TRUE; - //printf("refreshing region...\n"); + //PRINTF("refreshing region...\n"); //force double buffering because of non-opaque views? if (mTransCnt > 0) @@ -606,9 +611,9 @@ void nsViewManager2::Refresh(nsIView *aView, nsIRenderingContext *aContext, cons //force double buffering because of non-opaque views? - //printf("refreshing rect... "); + //PRINTF("refreshing rect... "); //stdout << *rect; - //printf("\n"); + //PRINTF("\n"); if (mTransCnt > 0) aUpdateFlags |= NS_VMREFRESH_DOUBLE_BUFFER; @@ -1076,7 +1081,7 @@ void nsViewManager2::InvalidateChildWidgets(nsIView *aView, nsRect& aDirtyRect) mContext->GetAppUnitsToDevUnits(scale); invalidRect.ScaleRoundOut(scale); - //printf("invalidating: view %x (pix) %d, %d\n", aView, pixrect.width, pixrect.height); + //PRINTF("invalidating: view %x (pix) %d, %d\n", aView, pixrect.width, pixrect.height); widget->Invalidate(invalidRect, PR_FALSE); } } @@ -1292,7 +1297,7 @@ NS_IMETHODIMP nsViewManager2::DispatchEvent(nsGUIEvent *aEvent, nsEventStatus *a float p2t; mContext->GetDevUnitsToAppUnits(p2t); - //printf("resize: (pix) %d, %d\n", width, height); + //PRINTF("resize: (pix) %d, %d\n", width, height); SetWindowDimensions(NSIntPixelsToTwips(width, p2t), NSIntPixelsToTwips(height, p2t)); *aStatus = nsEventStatus_eConsumeNoDefault; @@ -1343,7 +1348,7 @@ NS_IMETHODIMP nsViewManager2::DispatchEvent(nsGUIEvent *aEvent, nsEventStatus *a // XXX rods updateFlags |= NS_VMREFRESH_DOUBLE_BUFFER; - //printf("refreshing: view: %x, %d, %d, %d, %d\n", view, damrect.x, damrect.y, damrect.width, damrect.height); + //PRINTF("refreshing: view: %x, %d, %d, %d, %d\n", view, damrect.x, damrect.y, damrect.width, damrect.height); // Refresh the view Refresh(view, ((nsPaintEvent*)aEvent)->renderingContext, &damrect, updateFlags); } @@ -1472,9 +1477,9 @@ NS_IMETHODIMP nsViewManager2::GrabMouseEvents(nsIView *aView, PRBool &aResult) #ifdef DEBUG_mjudge if (aView) { - printf("capturing mouse events for view %x\n",aView); + PRINTF("capturing mouse events for view %x\n",aView); } - printf("removing mouse capture from view %x\n",mMouseGrabber); + PRINTF("removing mouse capture from view %x\n",mMouseGrabber); #endif mMouseGrabber = aView; @@ -1931,7 +1936,7 @@ void nsViewManager2::GetMaxWidgetBounds(nsRect& aMaxWidgetBounds) const } } -// printf("WIDGET BOUNDS %d %d\n", aMaxWidgetBounds.width, aMaxWidgetBounds.height); +// PRINTF("WIDGET BOUNDS %d %d\n", aMaxWidgetBounds.width, aMaxWidgetBounds.height); } PRBool nsViewManager2::RectFitsInside(nsRect& aRect, PRInt32 aWidth, PRInt32 aHeight) const @@ -2018,7 +2023,7 @@ void nsViewManager2::CalculateDiscreteSurfaceSize(nsRect& aRequestedSize, nsRect gLargestRequestedSize.height = PR_MAX(aRequestedSize.height, aMaxWidgetSize.height); aSurfaceSize.width = gLargestRequestedSize.width; aSurfaceSize.height = gLargestRequestedSize.height; - // printf("Expanding the largested requested size to %d %d\n", gLargestRequestedSize.width, gLargestRequestedSize.height); + // PRINTF("Expanding the largested requested size to %d %d\n", gLargestRequestedSize.width, gLargestRequestedSize.height); } } @@ -2045,7 +2050,7 @@ nsDrawingSurface nsViewManager2::GetDrawingSurface(nsIRenderingContext &aContext } nsresult rv = aContext.CreateDrawingSurface(&newBounds, 0, mDrawingSurface); - // printf("Allocating a new drawing surface %d %d\n", newBounds.width, newBounds.height); + // PRINTF("Allocating a new drawing surface %d %d\n", newBounds.width, newBounds.height); if (NS_SUCCEEDED(rv)) { mDSBounds = newBounds; aContext.SelectOffScreenDrawingSurface(mDrawingSurface); @@ -2626,7 +2631,7 @@ void nsViewManager2::ShowDisplayList(PRInt32 flatlen) float t2p; mContext->GetAppUnitsToDevUnits(t2p); - printf("### display list length=%d ###\n", flatlen); + PRINTF("### display list length=%d ###\n", flatlen); for (cnt = 0; cnt < flatlen; cnt++) { nsIView *view, *parent; @@ -2644,7 +2649,7 @@ void nsViewManager2::ShowDisplayList(PRInt32 flatlen) view->GetParent(parent); view->GetZIndex(zindex); rect *= t2p; - printf("%snsIView@%p [z=%d, x=%d, y=%d, w=%d, h=%d, p=%p]\n", + PRINTF("%snsIView@%p [z=%d, x=%d, y=%d, w=%d, h=%d, p=%p]\n", nest, view, zindex, rect.x, rect.y, rect.width, rect.height, parent); @@ -2652,22 +2657,22 @@ void nsViewManager2::ShowDisplayList(PRInt32 flatlen) if (flags) { - printf("%s", nest); + PRINTF("%s", nest); if (flags & POP_CLIP) { - printf("POP_CLIP "); + PRINTF("POP_CLIP "); newnestcnt--; } if (flags & PUSH_CLIP) { - printf("PUSH_CLIP "); + PRINTF("PUSH_CLIP "); newnestcnt++; } if (flags & VIEW_RENDERED) - printf("VIEW_RENDERED "); + PRINTF("VIEW_RENDERED "); - printf("\n"); + PRINTF("\n"); } nest[nestcnt << 1] = ' '; @@ -2844,14 +2849,14 @@ PRBool nsViewManager2::IsRectVisible(nsIView *aView, const nsRect &aRect) // Debugging code static int toggle = 0; for (int i = 0; i < toggle; i++) { - printf(" "); + PRINTF(" "); } if (toggle == 10) { toggle = 0; } else { toggle++; } - printf("***overlaps %d\n", overlaps); + PRINTF("***overlaps %d\n", overlaps); #endif return overlaps; @@ -2909,7 +2914,7 @@ nsViewManager2::IsPainting(PRBool& aIsPainting) nsresult nsViewManager2::ProcessWidgetChanges(nsIView* aView) { - //printf("---------Begin Sync----------\n"); + //PRINTF("---------Begin Sync----------\n"); nsresult rv = aView->SynchWidgetSizePosition(); if (NS_FAILED(rv)) return rv; @@ -2924,7 +2929,7 @@ nsViewManager2::ProcessWidgetChanges(nsIView* aView) child->GetNextSibling(child); } - //printf("---------End Sync----------\n"); + //PRINTF("---------End Sync----------\n"); return NS_OK; } diff --git a/mozilla/webshell/embed/xlib/gtk/nsEmbedXlibIntoGtk.cpp b/mozilla/webshell/embed/xlib/gtk/nsEmbedXlibIntoGtk.cpp index 68f51a6a02a..13dfd49c126 100644 --- a/mozilla/webshell/embed/xlib/gtk/nsEmbedXlibIntoGtk.cpp +++ b/mozilla/webshell/embed/xlib/gtk/nsEmbedXlibIntoGtk.cpp @@ -37,6 +37,11 @@ extern "C" { #include "nsRepository.h" #include "nsIPref.h" #include "xlibrgb.h" +#include "nslog.h" + +NS_IMPL_LOG(nsEmbedXlibIntoGtkLog, 0) +#define PRINTF NS_LOG_PRINTF(nsEmbedXlibIntoGtkLog) +#define FLUSH NS_LOG_FLUSH(nsEmbedXlibIntoGtkLog) static NS_DEFINE_IID(kIEventQueueServiceIID, NS_IEVENTQUEUESERVICE_IID); @@ -64,7 +69,7 @@ static void event_processor_callback(gpointer data, gint source, GdkInputCondition condition) { - printf("event_processor_callback()\n"); + PRINTF("event_processor_callback()\n"); nsIEventQueue *eventQueue = (nsIEventQueue*)data; eventQueue->ProcessPendingEvents(); } @@ -79,12 +84,12 @@ static void WindowCreateCallback(PRUint32 aID) // attach it to a filter gdk_window_add_filter(window, test_filter, NULL); - printf("window created\n"); + PRINTF("window created\n"); } static void WindowDestroyCallback(PRUint32 aID) { - printf("window destroyed\n"); + PRINTF("window destroyed\n"); } static nsXlibEventDispatcher gsEventDispatcher = nsnull; @@ -151,7 +156,7 @@ int main(int argc, char **argv) ////////////////////////////////////////////////////////////////////// NS_SetupRegistry(); - printf("Creating event queue.\n"); + PRINTF("Creating event queue.\n"); nsIEventQueueService * eventQueueService = nsnull; nsIEventQueue * eventQueue = nsnull; @@ -223,7 +228,7 @@ int main(int argc, char **argv) (nsISupports**)&sgPrefs); if (NS_OK != rv) { - printf("failed to get prefs instance\n"); + PRINTF("failed to get prefs instance\n"); return rv; } @@ -264,7 +269,7 @@ static GdkFilterReturn test_filter (GdkXEvent *gdk_xevent, GdkEvent *event, gpointer data) { - printf("test_filter called\n"); + PRINTF("test_filter called\n"); XEvent *xevent; xevent = (XEvent *)gdk_xevent; @@ -280,7 +285,7 @@ static GdkFilterReturn test_filter (GdkXEvent *gdk_xevent, void handle_size_allocate(GtkWidget *w, GtkAllocation *alloc, gpointer p) { - printf("handling size allocate\n"); + PRINTF("handling size allocate\n"); nsIWebShell *moz_widget = (nsIWebShell *)p; nsIContentViewer *content_viewer=nsnull; nsresult rv=NS_OK; diff --git a/mozilla/webshell/embed/xlib/motif/EmbedMozilla.c b/mozilla/webshell/embed/xlib/motif/EmbedMozilla.c index 81bd8da4485..ca1f7e51d20 100644 --- a/mozilla/webshell/embed/xlib/motif/EmbedMozilla.c +++ b/mozilla/webshell/embed/xlib/motif/EmbedMozilla.c @@ -25,6 +25,11 @@ #include "EmbedMozilla.h" #include "EmbedMozillaP.h" +#include "nslog.h" + +NS_IMPL_LOG(EmbedMozillaLog, 0) +#define PRINTF NS_LOG_PRINTF(EmbedMozillaLog) +#define FLUSH NS_LOG_FLUSH(EmbedMozillaLog) static XtGeometryResult GeometryManager(Widget w, XtWidgetGeometry *request, XtWidgetGeometry *reply); @@ -175,9 +180,9 @@ CoreRealize(Widget w,XtValueMask *mask,XSetWindowAttributes* wa) { XmEmbedMozilla em = (XmEmbedMozilla) w; - printf("Realize(%s,window = %p\n", - XtName(w), - em->embed_mozilla.embed_window); + PRINTF("Realize(%s,window = %p\n", + XtName(w), + em->embed_mozilla.embed_window); em->core.window = em->embed_mozilla.embed_window; } diff --git a/mozilla/webshell/embed/xlib/motif/nsEmbedXlibIntoMotif.cpp b/mozilla/webshell/embed/xlib/motif/nsEmbedXlibIntoMotif.cpp index 2e94ec3ee6f..fd2659f3634 100644 --- a/mozilla/webshell/embed/xlib/motif/nsEmbedXlibIntoMotif.cpp +++ b/mozilla/webshell/embed/xlib/motif/nsEmbedXlibIntoMotif.cpp @@ -13,6 +13,11 @@ #include "nsRepository.h" #include "nsIPref.h" #include "xlibrgb.h" +#include "nslog.h" + +NS_IMPL_LOG(nsEmbedXlibIntoMotifLog, 0) +#define PRINTF NS_LOG_PRINTF(nsEmbedXlibIntoMotifLog) +#define FLUSH NS_LOG_FLUSH(nsEmbedXlibIntoMotifLog) static NS_DEFINE_IID(kIEventQueueServiceIID, NS_IEVENTQUEUESERVICE_IID); @@ -34,7 +39,7 @@ static void event_processor_callback(XtPointer aClosure, int * aFd, XtIntervalId * aId) { -// printf("event_processor_callback()\n"); +// PRINTF("event_processor_callback()\n"); nsIEventQueue *eventQueue = (nsIEventQueue*)aClosure; eventQueue->ProcessPendingEvents(); } @@ -56,11 +61,11 @@ static void EmbedEventHandler(Widget w, // nsXtWidget_InitNSMouseEvent(event, p, mevent, NS_MOUSE_LEFT_BUTTON_DOWN); // widgetWindow->DispatchMouseEvent(mevent); - printf("test_filter called\n"); + PRINTF("test_filter called\n"); if (nsnull != gsEventDispatcher) { - printf("dispatching native event\n"); + PRINTF("dispatching native event\n"); (*gsEventDispatcher)((nsXlibNativeEvent) xevent); } @@ -92,12 +97,12 @@ static void WindowCreateCallback(PRUint32 aID) EmbedEventHandler, NULL); -// printf("window created\n"); +// PRINTF("window created\n"); } static void WindowDestroyCallback(PRUint32 aID) { - printf("window destroyed\n"); + PRINTF("window destroyed\n"); } @@ -168,7 +173,7 @@ int main(int argc, char **argv) ////////////////////////////////////////////////////////////////////// NS_SetupRegistry(); - printf("Creating event queue.\n"); + PRINTF("Creating event queue.\n"); nsIEventQueueService * eventQueueService = nsnull; nsIEventQueue * eventQueue = nsnull; @@ -239,7 +244,7 @@ int main(int argc, char **argv) (void **) &sgPrefs); if (NS_OK != rv) { - printf("failed to get prefs instance\n"); + PRINTF("failed to get prefs instance\n"); return rv; } diff --git a/mozilla/webshell/embed/xlib/qt/MainWidget.cpp b/mozilla/webshell/embed/xlib/qt/MainWidget.cpp index 02d4450360b..674bf307dd9 100644 --- a/mozilla/webshell/embed/xlib/qt/MainWidget.cpp +++ b/mozilla/webshell/embed/xlib/qt/MainWidget.cpp @@ -23,6 +23,11 @@ #include #include "MainWidget.h" +#include "nslog.h" + +NS_IMPL_LOG(MainWidgetLog, 0) +#define PRINTF NS_LOG_PRINTF(MainWidgetLog) +#define FLUSH NS_LOG_FLUSH(MainWidgetLog) MainWidget::MainWidget() { @@ -33,13 +38,13 @@ MainWidget::MainWidget() m_edit = new QLineEdit( this ); m_progressBar = NULL; - printf("done creating MainWidget parts...\n"); + PRINTF("done creating MainWidget parts...\n"); m_load->setGeometry( 10, 10, 50, 25 ); m_quit->setGeometry( 70, 10, 50, 25 ); m_mozilla->setGeometry( 0, 40, 500, 460 ); m_edit-> setGeometry( 130, 10, width() - 140, 25 ); - printf("done setting MainWidget parts geometry...\n"); + PRINTF("done setting MainWidget parts geometry...\n"); m_mozilla->setFocusPolicy( QWidget::StrongFocus ); m_mozilla->setMouseTracking( TRUE ); @@ -79,15 +84,15 @@ void MainWidget::handleReturnPressed() /* private slot */ void MainWidget::handleURLLoadStarted() { - printf("URL Load Started...\n"); + PRINTF("URL Load Started...\n"); QApplication::setOverrideCursor( waitCursor ); if ( !m_progressBar ) { - printf("Creating Progress Bar...\n"); + PRINTF("Creating Progress Bar...\n"); m_progressBar = new QProgressBar( 100, m_mozilla ); } else - printf("Using available Progress Bar...\n"); + PRINTF("Using available Progress Bar...\n"); m_progressBar->setProgress( 0 ); m_progressBar->move( ( m_mozilla->width() - m_progressBar->width() ) / 2, @@ -99,14 +104,14 @@ void MainWidget::handleURLLoadStarted() /* private slot */ void MainWidget::handleURLLoadProgressed( const char *url, int progress, int max ) { - printf("URL Load Progressed...\n"); + PRINTF("URL Load Progressed...\n"); m_progressBar->setProgress( progress / max * 100 ); } /* private slot */ void MainWidget::handleURLLoadEnded() { - printf("URL Load Ended...\n"); + PRINTF("URL Load Ended...\n"); m_progressBar->hide(); QApplication::restoreOverrideCursor(); } diff --git a/mozilla/webshell/embed/xlib/qt/QMozillaContainer.cpp b/mozilla/webshell/embed/xlib/qt/QMozillaContainer.cpp index ada5a7be01a..42afd981b39 100644 --- a/mozilla/webshell/embed/xlib/qt/QMozillaContainer.cpp +++ b/mozilla/webshell/embed/xlib/qt/QMozillaContainer.cpp @@ -34,6 +34,11 @@ #include "xlibrgb.h" #include +#include "nslog.h" + +NS_IMPL_LOG(QMozillaContainerLog, 0) +#define PRINTF NS_LOG_PRINTF(QMozillaContainerLog) +#define FLUSH NS_LOG_FLUSH(QMozillaContainerLog) //----------------------------------------------------------------------------- static NS_DEFINE_CID(kCUnixToolkitServiceCID, NS_UNIX_TOOLKIT_SERVICE_CID); @@ -97,10 +102,10 @@ QMozillaContainer::QMozillaContainer( QWidget* parent ) : QWidget( parent, "Cont { NS_INIT_ISUPPORTS(); - printf("calling init()\n"); + PRINTF("calling init()\n"); if ( init() != 0 ) - printf("MOZILLA CONTAINER WIDGET: !!! ERROR !!! in init()\n"); - printf("done\n"); + PRINTF("MOZILLA CONTAINER WIDGET: !!! ERROR !!! in init()\n"); + PRINTF("done\n"); } QMozillaContainer::~QMozillaContainer() @@ -153,7 +158,7 @@ bool QMozillaContainer::x11Event( XEvent* xevent ) if ( changed ) { - //printf("RESIZE...%p(%d, %d)\n", w, width, height); + //PRINTF("RESIZE...%p(%d, %d)\n", w, width, height); m_WebShell->SetBounds( 0, 0, width(), height() ); changed = 0; } } @@ -208,7 +213,7 @@ void QMozillaContainer::stop() static void WindowCreateCallback( PRUint32 aID ) { // XXX Milind: - printf( "window created: %u\n", aID ); + PRINTF( "window created: %u\n", aID ); QWidget* qwidget = new QMozillaWidget( ( WId )aID ); qwidget->setMouseTracking( TRUE ); @@ -226,7 +231,7 @@ static void WindowCreateCallback( PRUint32 aID ) static void WindowDestroyCallback(PRUint32 aID) { - printf("window destroyed\n"); + PRINTF("window destroyed\n"); } @@ -275,7 +280,7 @@ int QMozillaContainer::init() ////////////////////////////////////////////////////////////////////// NS_SetupRegistry(); - printf("Creating event queue.\n"); + PRINTF("Creating event queue.\n"); nsIEventQueueService * eventQueueService = nsnull; nsIEventQueue * eventQueue = nsnull; @@ -319,11 +324,11 @@ int QMozillaContainer::init() m_WindowService->SetWindowCreateCallback(WindowCreateCallback); m_WindowService->SetWindowDestroyCallback(WindowDestroyCallback); - printf("adding xlib event queue callback...\n"); + PRINTF("adding xlib event queue callback...\n"); m_MozillaEventProcessor = new nsQtEventProcessor( eventQueue, this ); - printf("creating webshell...\n"); + PRINTF("creating webshell...\n"); rv = nsRepository::CreateInstance(kWebShellCID, nsnull, kIWebShellIID, @@ -334,7 +339,7 @@ int QMozillaContainer::init() if (!NS_SUCCEEDED(rv)) return 1; - printf("initializing webshell...\n"); + PRINTF("initializing webshell...\n"); m_WebShell->Init( ( nsNativeWidget )winId(), 0, 0, 500, 500); m_WebShell->SetContainer( this ); @@ -347,7 +352,7 @@ int QMozillaContainer::init() (void **) &m_Prefs); if (NS_OK != rv) { - printf("failed to get prefs instance\n"); + PRINTF("failed to get prefs instance\n"); return rv; } @@ -355,7 +360,7 @@ int QMozillaContainer::init() m_Prefs->ReadUserPrefs(); m_WebShell->SetPrefs(m_Prefs); - printf("showing webshell...\n"); + PRINTF("showing webshell...\n"); m_WebShell->Show(); @@ -395,7 +400,7 @@ NS_METHOD QMozillaContainer::WillLoadURL(nsIWebShell* aShell, nsLoadType aReason) { char *url = makeCString( aURL ); - printf("MOZILLA CONTAINER WIDGET: will load %s...\n", url); + PRINTF("MOZILLA CONTAINER WIDGET: will load %s...\n", url); delete url; return NS_OK; @@ -405,7 +410,7 @@ NS_METHOD QMozillaContainer::WillLoadURL(nsIWebShell* aShell, NS_METHOD QMozillaContainer::BeginLoadURL(nsIWebShell* aShell, const PRUnichar* aURL) { char *url = makeCString( aURL ); - printf("MOXILLA CONTAINER WIDGET: loading %s...\n", url); + PRINTF("MOXILLA CONTAINER WIDGET: loading %s...\n", url); delete url; emit urlLoadStarted(); @@ -433,9 +438,9 @@ NS_METHOD QMozillaContainer::EndLoadURL(nsIWebShell* aShell, char *url = makeCString( aURL ); if ( aStatus != NS_OK ) - printf("MOZILLA CONTAINER WIDGET: error loading %s...\n", url); + PRINTF("MOZILLA CONTAINER WIDGET: error loading %s...\n", url); else - printf("MOXILLA CONTAINER WIDGET: done loading %s...\n", url); + PRINTF("MOXILLA CONTAINER WIDGET: done loading %s...\n", url); delete url; diff --git a/mozilla/webshell/embed/xlib/qt/nsEmbedXlibIntoQt.cpp b/mozilla/webshell/embed/xlib/qt/nsEmbedXlibIntoQt.cpp index b2b447d9019..4477211f48c 100644 --- a/mozilla/webshell/embed/xlib/qt/nsEmbedXlibIntoQt.cpp +++ b/mozilla/webshell/embed/xlib/qt/nsEmbedXlibIntoQt.cpp @@ -23,6 +23,11 @@ #include #include "MainWidget.h" +#include "nslog.h" + +NS_IMPL_LOG(nsEmbedXlibIntoQtLog, 0) +#define PRINTF NS_LOG_PRINTF(nsEmbedXlibIntoQtLog) +#define FLUSH NS_LOG_FLUSH(nsEmbedXlibIntoQtLog) int main( int argc, char** argv ) { @@ -30,13 +35,13 @@ int main( int argc, char** argv ) MainWidget main_widget; main_widget.setGeometry( 100, 100, 500, 500 ); - printf("main(): done setting main_widget geometry\n"); + PRINTF("main(): done setting main_widget geometry\n"); QObject::connect(main_widget.getQuitWidget(), SIGNAL(clicked()), &qapp, SLOT(quit())); - printf("main(): done getting Quit widget and connecting to app quit()\n"); + PRINTF("main(): done getting Quit widget and connecting to app quit()\n"); qapp.setMainWidget( &main_widget ); - printf("main(): done setting main_widget to app\n"); + PRINTF("main(): done setting main_widget to app\n"); main_widget.show(); diff --git a/mozilla/webshell/embed/xlib/qt/nsQtEventProcessor.cpp b/mozilla/webshell/embed/xlib/qt/nsQtEventProcessor.cpp index ce42c02c04b..7fb0ed93d9c 100644 --- a/mozilla/webshell/embed/xlib/qt/nsQtEventProcessor.cpp +++ b/mozilla/webshell/embed/xlib/qt/nsQtEventProcessor.cpp @@ -23,14 +23,19 @@ #include #include "nsQtEventProcessor.h" +#include "nslog.h" + +NS_IMPL_LOG(nsQtEventProcessorLog, 0) +#define PRINTF NS_LOG_PRINTF(nsQtEventProcessorLog) +#define FLUSH NS_LOG_FLUSH(nsQtEventProcessorLog) nsQtEventProcessor::nsQtEventProcessor( nsIEventQueue* eventQueue, QObject* parent ) : QSocketNotifier( eventQueue->GetEventQueueSelectFD(), QSocketNotifier::Read, parent ), m_eventQueue( eventQueue ) { - printf("CONNETING SOCKET...\n"); + PRINTF("CONNETING SOCKET...\n"); connect(this, SIGNAL(activated(int)), SLOT(handleActivated(int))); - printf("DONE.\n"); + PRINTF("DONE.\n"); } @@ -42,7 +47,7 @@ nsQtEventProcessor::~nsQtEventProcessor( ) // private slot void nsQtEventProcessor::handleActivated( int socket ) { - printf("nsQtEventProcessor::handleActivated( %d )\n", socket); + PRINTF("nsQtEventProcessor::handleActivated( %d )\n", socket); m_eventQueue->ProcessPendingEvents( ); } diff --git a/mozilla/webshell/embed/xlib/xt/EmbedMozilla.c b/mozilla/webshell/embed/xlib/xt/EmbedMozilla.c index a3bab9d96ca..f0ec97c52ae 100644 --- a/mozilla/webshell/embed/xlib/xt/EmbedMozilla.c +++ b/mozilla/webshell/embed/xlib/xt/EmbedMozilla.c @@ -24,6 +24,11 @@ #include "EmbedMozilla.h" #include "EmbedMozillaP.h" +#include "nslog.h" + +NS_IMPL_LOG(EmbedMozillaLog, 0) +#define PRINTF NS_LOG_PRINTF(EmbedMozillaLog) +#define FLUSH NS_LOG_FLUSH(EmbedMozillaLog) static XtGeometryResult QueryGeometry( Widget w, XtWidgetGeometry *request, XtWidgetGeometry *reply ); @@ -188,9 +193,9 @@ CoreRealize(Widget w,XtValueMask *mask,XSetWindowAttributes* wa) { XtEmbedMozilla em = (XtEmbedMozilla) w; - printf("CoreRealize(%s),window = %ld\n", - XtName(w), em->embed_mozilla.embed_window); - printf("CoreRealize: parent widget = %p\n", em->core.parent ); + PRINTF("CoreRealize(%s),window = %ld\n", + XtName(w), em->embed_mozilla.embed_window); + PRINTF("CoreRealize: parent widget = %p\n", em->core.parent ); em->core.window = em->embed_mozilla.embed_window; } diff --git a/mozilla/webshell/embed/xlib/xt/nsEmbedXlibIntoXt.cpp b/mozilla/webshell/embed/xlib/xt/nsEmbedXlibIntoXt.cpp index 7e50718ea5f..41c2b90df0c 100644 --- a/mozilla/webshell/embed/xlib/xt/nsEmbedXlibIntoXt.cpp +++ b/mozilla/webshell/embed/xlib/xt/nsEmbedXlibIntoXt.cpp @@ -39,6 +39,11 @@ #include "nsRepository.h" #include "nsIPref.h" #include "xlibrgb.h" +#include "nslog.h" + +NS_IMPL_LOG(nsEmbedXlibIntoXtLog, 0) +#define PRINTF NS_LOG_PRINTF(nsEmbedXlibIntoXtLog) +#define FLUSH NS_LOG_FLUSH(nsEmbedXlibIntoXtLog) @@ -106,7 +111,7 @@ Window gTopLevelWindow = 0; static void WindowCreateCallback( PRUint32 aID ) { // XXX Milind: - printf( "window created: %u\n", aID ); + PRINTF( "window created: %u\n", aID ); Widget parentwidget = gTopLevelWidget; Widget widget = XtCreateEmbedMozilla( parentwidget, @@ -117,7 +122,7 @@ static void WindowCreateCallback( PRUint32 aID ) ); XtRealizeWidget( widget ); - printf( "widget(%p) of window(%ld)\n\n", widget, (Window)aID ); + PRINTF( "widget(%p) of window(%ld)\n\n", widget, (Window)aID ); XtAddEventHandler( widget, ( ExposureMask | ButtonPressMask | ButtonReleaseMask | @@ -133,7 +138,7 @@ static void WindowCreateCallback( PRUint32 aID ) static void WindowDestroyCallback(PRUint32 aID) { - printf("window destroyed\n"); + PRINTF("window destroyed\n"); } @@ -155,7 +160,7 @@ int main(int argc, char **argv) gDisplay = XtDisplay( gTopLevelWidget ); gScreenNumber = DefaultScreen( gDisplay ); - printf("TOP LEVEL WIDGET: %p\n", gTopLevelWidget); + PRINTF("TOP LEVEL WIDGET: %p\n", gTopLevelWidget); // init xlibrgb xlib_rgb_init( gDisplay, DefaultScreenOfDisplay( gDisplay ) ); @@ -166,13 +171,13 @@ int main(int argc, char **argv) NULL); - printf("realizing TOP LEVEL WIDGET...\n"); + PRINTF("realizing TOP LEVEL WIDGET...\n"); XtRealizeWidget( gTopLevelWidget ); - printf("done.\n"); + PRINTF("done.\n"); gTopLevelWindow = XtWindow( gTopLevelWidget ); - printf("Top Level Window = %ld\n", gTopLevelWindow); + PRINTF("Top Level Window = %ld\n", gTopLevelWindow); ////////////////////////////////////////////////////////////////////// @@ -215,7 +220,7 @@ int main(int argc, char **argv) ////////////////////////////////////////////////////////////////////// NS_SetupRegistry(); - printf("Creating event queue.\n"); + PRINTF("Creating event queue.\n"); nsIEventQueueService * eventQueueService = nsnull; nsIEventQueue * eventQueue = nsnull; @@ -288,7 +293,7 @@ int main(int argc, char **argv) (void **) &sgPrefs); if (NS_OK != rv) { - printf("failed to get prefs instance\n"); + PRINTF("failed to get prefs instance\n"); return rv; } @@ -296,7 +301,7 @@ int main(int argc, char **argv) sgPrefs->ReadUserPrefs(); sgWebShell->SetPrefs(sgPrefs); - printf("showing webshell...\n"); + PRINTF("showing webshell...\n"); sgWebShell->Show(); @@ -348,7 +353,7 @@ static void resize_callback( Widget w, if ( changed ) { - printf("RESIZE...%p(%d, %d)\n", w, width, height); + PRINTF("RESIZE...%p(%d, %d)\n", w, width, height); webshell->SetBounds( 0, 0, width, height ); changed = 0; } @@ -364,7 +369,7 @@ static void window_event_handler( Widget w, XEvent *xevent, Boolean *toContinue ) { - //printf("window_event_handler...\n"); + //PRINTF("window_event_handler...\n"); (*gsEventDispatcher)((nsXlibNativeEvent) xevent); //*toContinue = True; } @@ -374,7 +379,7 @@ static void event_processor_callback( XtPointer client_data, int *fd, XtInputId *id ) { - printf("event_processor_callback...\n"); + PRINTF("event_processor_callback...\n"); nsIEventQueue *eq = ( nsIEventQueue *)client_data; eq->ProcessPendingEvents(); diff --git a/mozilla/webshell/tests/viewer/nsWebCrawler.cpp b/mozilla/webshell/tests/viewer/nsWebCrawler.cpp index e65441db557..549a54573eb 100644 --- a/mozilla/webshell/tests/viewer/nsWebCrawler.cpp +++ b/mozilla/webshell/tests/viewer/nsWebCrawler.cpp @@ -58,6 +58,7 @@ #include "nsIContentViewerFile.h" #include "nsIDocShell.h" #include "nsIWebNavigation.h" +#undef printf static NS_DEFINE_IID(kIDocumentLoaderObserverIID, NS_IDOCUMENTLOADEROBSERVER_IID); static NS_DEFINE_IID(kIDocumentViewerIID, NS_IDOCUMENT_VIEWER_IID); diff --git a/mozilla/widget/src/beos/nsAppShell.cpp b/mozilla/widget/src/beos/nsAppShell.cpp index 45dcf72b270..1ad41505109 100644 --- a/mozilla/widget/src/beos/nsAppShell.cpp +++ b/mozilla/widget/src/beos/nsAppShell.cpp @@ -32,6 +32,11 @@ #include #include #include +#include "nslog.h" + +NS_IMPL_LOG(nsAppShellLog, 0) +#define PRINTF NS_LOG_PRINTF(nsAppShellLog) +#define FLUSH NS_LOG_FLUSH(nsAppShellLog) static int gBAppCount = 0; @@ -206,7 +211,7 @@ nsresult nsAppShell::Run() break; default : - printf("nsAppShell::Run - UNKNOWN EVENT\n"); + PRINTF("nsAppShell::Run - UNKNOWN EVENT\n"); break; } @@ -286,13 +291,13 @@ NS_METHOD nsAppShell::Spindown() NS_METHOD nsAppShell::GetNativeEvent(PRBool &aRealEvent, void *&aEvent) { aRealEvent = PR_FALSE; - printf("nsAppShell::GetNativeEvent - FIXME: not implemented\n"); + PRINTF("nsAppShell::GetNativeEvent - FIXME: not implemented\n"); return NS_OK; } NS_METHOD nsAppShell::DispatchNativeEvent(PRBool aRealEvent, void *aEvent) { - printf("nsAppShell::DispatchNativeEvent - FIXME: not implemented\n"); + PRINTF("nsAppShell::DispatchNativeEvent - FIXME: not implemented\n"); return NS_OK; } diff --git a/mozilla/widget/src/beos/nsButton.cpp b/mozilla/widget/src/beos/nsButton.cpp index 1dc8c5c0828..738eaddfb72 100644 --- a/mozilla/widget/src/beos/nsButton.cpp +++ b/mozilla/widget/src/beos/nsButton.cpp @@ -33,6 +33,11 @@ #include "nsIDeviceContext.h" #include "nsIFontMetrics.h" +#include "nslog.h" + +NS_IMPL_LOG(nsButtonLog, 0) +#define PRINTF NS_LOG_PRINTF(nsButtonLog) +#define FLUSH NS_LOG_FLUSH(nsButtonLog) static NS_DEFINE_IID(kLookAndFeelCID, NS_LOOKANDFEEL_CID); static NS_DEFINE_IID(kILookAndFeelIID, NS_ILOOKANDFEEL_IID); @@ -134,7 +139,7 @@ PRBool nsButton::OnMove(PRInt32, PRInt32) PRBool nsButton::OnPaint(nsRect &r) { - //printf("** nsButton::OnPaint **\n"); + //PRINTF("** nsButton::OnPaint **\n"); return PR_FALSE; } diff --git a/mozilla/widget/src/beos/nsClipboard.cpp b/mozilla/widget/src/beos/nsClipboard.cpp index e09bdca384d..1a5b6182f85 100644 --- a/mozilla/widget/src/beos/nsClipboard.cpp +++ b/mozilla/widget/src/beos/nsClipboard.cpp @@ -55,7 +55,7 @@ static NS_DEFINE_CID(kCClipboardCID, NS_CLIPBOARD_CID); nsClipboard::nsClipboard() : nsBaseClipboard() { #ifdef DEBUG_CLIPBOARD - printf(" nsClipboard::nsClipboard()\n"); + PRINTF((" nsClipboard::nsClipboard()\n")); #endif /* DEBUG_CLIPBOARD */ //NS_INIT_REFCNT(); @@ -74,7 +74,7 @@ nsClipboard::nsClipboard() : nsBaseClipboard() nsClipboard::~nsClipboard() { #ifdef DEBUG_CLIPBOARD - printf(" nsClipboard::~nsClipboard()\n"); + PRINTF((" nsClipboard::~nsClipboard()\n")); #endif /* DEBUG_CLIPBOARD */ // // Remove all our event handlers: @@ -124,13 +124,13 @@ void nsClipboard::SetTopLevelView(BView *v) if(v == 0 || v->Window() == 0) { #ifdef DEBUG_CLIPBOARD - printf(" nsClipboard::SetTopLevelView: widget passed in is null or has no window!\n"); + PRINTF((" nsClipboard::SetTopLevelView: widget passed in is null or has no window!\n")); #endif /* DEBUG_CLIPBOARD */ return; } #ifdef DEBUG_CLIPBOARD - printf(" nsClipboard::SetTopLevelView\n"); + PRINTF((" nsClipboard::SetTopLevelView\n")); #endif /* DEBUG_CLIPBOARD */ // // If we're changing from one widget to another @@ -146,7 +146,7 @@ void nsClipboard::SetTopLevelView(BView *v) // NS_WITH_SERVICE(nsIClipboard, clipboard, kCClipboardCID, &rv); // // if (!NS_SUCCEEDED(rv)) { -// printf("Couldn't get clipboard service!\n"); +// PRINTF(("Couldn't get clipboard service!\n")); // return; // } // @@ -197,12 +197,12 @@ NS_IMETHODIMP nsClipboard::SetNativeClipboardData(PRInt32 aWhichClipboard) mIgnoreEmptyNotification = PR_TRUE; #ifdef DEBUG_CLIPBOARD - printf(" nsClipboard::SetNativeClipboardData()\n"); + PRINTF((" nsClipboard::SetNativeClipboardData()\n")); #endif /* DEBUG_CLIPBOARD */ // make sure we have a good transferable if (nsnull == mTransferable) { - printf(" SetNativeClipboardData: no transferable!\n"); + PRINTF((" SetNativeClipboardData: no transferable!\n")); return NS_ERROR_FAILURE; } @@ -240,12 +240,12 @@ nsClipboard::GetNativeClipboardData(nsITransferable * aTransferable, PRInt32 aWh nsresult rv = NS_OK; #ifdef DEBUG_CLIPBOARD - printf(" nsClipboard::GetNativeClipboardData()\n"); + PRINTF((" nsClipboard::GetNativeClipboardData()\n")); #endif /* DEBUG_CLIPBOARD */ // make sure we have a good transferable if (nsnull == aTransferable) { - printf(" GetNativeClipboardData: Transferable is null!\n"); + PRINTF((" GetNativeClipboardData: Transferable is null!\n")); return NS_ERROR_FAILURE; } @@ -331,7 +331,7 @@ nsClipboard::GetNativeClipboardData(nsITransferable * aTransferable, PRInt32 aWh // // Set a flag saying that we're blocking waiting for the callback: // mBlocking = PR_TRUE; //#ifdef DEBUG_CLIPBOARD -// printf("Waiting for the callback\n"); +// PRINTF(("Waiting for the callback\n")); //#endif /* DEBUG_CLIPBOARD */ // // // Now we need to wait until the callback comes in ... @@ -342,7 +342,7 @@ nsClipboard::GetNativeClipboardData(nsITransferable * aTransferable, PRInt32 aWh // } // //#ifdef DEBUG_CLIPBOARD -// printf("Got the callback: '%s', %d\n", +// PRINTF(("Got the callback: '%s', %d\n", // mSelectionData.data, mSelectionData.length); //#endif /* DEBUG_CLIPBOARD */ // @@ -364,7 +364,7 @@ nsClipboard::GetNativeClipboardData(nsITransferable * aTransferable, PRInt32 aWh // mSelectionData.length = 0; return NS_OK; -} +}) // // Called when the data from a paste comes in: @@ -375,7 +375,7 @@ nsClipboard::GetNativeClipboardData(nsITransferable * aTransferable, PRInt32 aWh // gpointer aData) //{ //#ifdef DEBUG_CLIPBOARD -// printf(" nsClipboard::SelectionReceivedCB\n"); +// PRINTF((" nsClipboard::SelectionReceivedCB\n")); //#endif /* DEBUG_CLIPBOARD */ // // // ARGHH! GTK doesn't pass the arg to the callback, so we can't @@ -384,12 +384,12 @@ nsClipboard::GetNativeClipboardData(nsITransferable * aTransferable, PRInt32 aWh // NS_WITH_SERVICE(nsIClipboard, iclipboard, kCClipboardCID, &rv); // // if (NS_FAILED(rv)) { -// printf("Couldn't get clipboard service!\n"); +// PRINTF(("Couldn't get clipboard service!\n")); // return; // } // nsClipboard* clipboard = (nsClipboard*)iclipboard; // if (!clipboard) { -// printf("couldn't convert nsIClipboard to nsClipboard\n"); +// PRINTF(("couldn't convert nsIClipboard to nsClipboard\n")); // return; // } // @@ -404,8 +404,8 @@ nsClipboard::GetNativeClipboardData(nsITransferable * aTransferable, PRInt32 aWh // // if (aSelectionData->length < 0) // { -// printf("Error retrieving selection: length was %d\n", -// aSelectionData->length); +// PRINTF(("Error retrieving selection: length was %d\n", +// aSelectionData->length)); // return; // } // @@ -423,8 +423,8 @@ nsClipboard::GetNativeClipboardData(nsITransferable * aTransferable, PRInt32 aWh // return; // // default: -// printf("Can't convert type %s (%ld) to string\n", -// gdk_atom_name (aSelectionData->type), aSelectionData->type); +// PRINTF(("Can't convert type %s (%ld) to string\n", +// gdk_atom_name (aSelectionData->type), aSelectionData->type)); // return; // } //} @@ -436,7 +436,7 @@ nsClipboard::GetNativeClipboardData(nsITransferable * aTransferable, PRInt32 aWh NS_IMETHODIMP nsClipboard::ForceDataToClipboard() { #ifdef DEBUG_CLIPBOARD - printf(" nsClipboard::ForceDataToClipboard()\n"); +PRINTF((" nsClipboard::ForceDataToClipboard()\n")); #endif /* DEBUG_CLIPBOARD */ // make sure we have a good transferable @@ -458,7 +458,7 @@ NS_IMETHODIMP nsClipboard::ForceDataToClipboard() // gpointer aData) //{ //#ifdef DEBUG_CLIPBOARD -// printf(" nsClipboard::SelectionGetCB\n"); +// PRINTF((" nsClipboard::SelectionGetCB\n")); //#endif /* DEBUG_CLIPBOARD */ // // nsClipboard *clipboard = (nsClipboard *)aData; @@ -469,7 +469,7 @@ NS_IMETHODIMP nsClipboard::ForceDataToClipboard() // // // Make sure we have a transferable: // if (!clipboard->mTransferable) { -// printf("Clipboard has no transferable!\n"); +// PRINTF(("Clipboard has no transferable!\n")); // return; // } // @@ -490,7 +490,7 @@ NS_IMETHODIMP nsClipboard::ForceDataToClipboard() // dataLength); // } // else -// printf("Transferable didn't support the data flavor\n"); +// PRINTF(("Transferable didn't support the data flavor\n")); //} // // @@ -501,7 +501,7 @@ NS_IMETHODIMP nsClipboard::ForceDataToClipboard() // gpointer data) //{ //#ifdef DEBUG_CLIPBOARD -// printf(" nsClipboard::SelectionClearCB\n"); +// PRINTF((" nsClipboard::SelectionClearCB\n")); //#endif /* DEBUG_CLIPBOARD */ //} // @@ -513,7 +513,7 @@ NS_IMETHODIMP nsClipboard::ForceDataToClipboard() // gpointer aData) //{ //#ifdef DEBUG_CLIPBOARD -// printf(" nsClipboard::SelectionRequestCB\n"); +// PRINTF((" nsClipboard::SelectionRequestCB\n")); //#endif /* DEBUG_CLIPBOARD */ //} // @@ -523,6 +523,6 @@ NS_IMETHODIMP nsClipboard::ForceDataToClipboard() // gpointer aData) //{ //#ifdef DEBUG_CLIPBOARD -// printf(" nsClipboard::SelectionNotifyCB\n"); +// PRINTF((" nsClipboard::SelectionNotifyCB\n")); //#endif /* DEBUG_CLIPBOARD */ //} diff --git a/mozilla/widget/src/beos/nsComboBox.cpp b/mozilla/widget/src/beos/nsComboBox.cpp index 51943a0c475..69183adb0c5 100644 --- a/mozilla/widget/src/beos/nsComboBox.cpp +++ b/mozilla/widget/src/beos/nsComboBox.cpp @@ -33,6 +33,11 @@ #include "nsIDeviceContext.h" #include "nsIFontMetrics.h" +#include "nslog.h" + +NS_IMPL_LOG(nsComboBoxLog, 0) +#define PRINTF NS_LOG_PRINTF(nsComboBoxLog) +#define FLUSH NS_LOG_FLUSH(nsComboBoxLog) static NS_DEFINE_IID(kLookAndFeelCID, NS_LOOKANDFEEL_CID); static NS_DEFINE_IID(kILookAndFeelIID, NS_ILOOKANDFEEL_IID); @@ -82,7 +87,7 @@ PRInt32 nsComboBox::FindItem(nsString &aItem, PRInt32 aStartPos) return index; #endif - printf("nsListBox::FindItem not implemented\n"); + PRINTF("nsListBox::FindItem not implemented\n"); return -1; } @@ -294,7 +299,7 @@ NS_METHOD nsComboBox::GetBounds(nsRect &aRect) #if 0 nsWindow::GetNonClientBounds(aRect); #endif -printf("nsListBox::GetBounds not wrong\n"); // the following is just a placeholder + PRINTF("nsListBox::GetBounds not wrong\n"); // the following is just a placeholder nsWindow::GetClientBounds(aRect); return NS_OK; } diff --git a/mozilla/widget/src/beos/nsDialog.cpp b/mozilla/widget/src/beos/nsDialog.cpp index 9a8f4daa170..4a9094027c4 100644 --- a/mozilla/widget/src/beos/nsDialog.cpp +++ b/mozilla/widget/src/beos/nsDialog.cpp @@ -37,6 +37,11 @@ #include "nsStringUtil.h" #include "nsGfxCIID.h" #include "resource.h" +#include "nslog.h" + +NS_IMPL_LOG(nsDialogLog, 0) +#define PRINTF NS_LOG_PRINTF(nsDialogLog) +#define FLUSH NS_LOG_FLUSH(nsDialogLog) NS_IMPL_ADDREF(nsDialog) NS_IMPL_RELEASE(nsDialog) @@ -91,7 +96,7 @@ NS_METHOD nsDialog::SetLabel(const nsString& aText) VERIFY(::SetWindowText(mWnd, label)); NS_FREE_STR_BUF(label); #endif -printf("nsDialog::SetLabel not implemented\n"); + PRINTF("nsDialog::SetLabel not implemented\n"); return NS_OK; } @@ -110,7 +115,7 @@ NS_METHOD nsDialog::GetLabel(nsString& aBuffer) aBuffer.Append(label); NS_FREE_CHAR_BUF(label); #endif -printf("nsDialog::SetLabel not implemented\n"); + PRINTF("nsDialog::SetLabel not implemented\n"); return NS_OK; } diff --git a/mozilla/widget/src/beos/nsDragService.cpp b/mozilla/widget/src/beos/nsDragService.cpp index aab49a2d537..d7daf6319e7 100644 --- a/mozilla/widget/src/beos/nsDragService.cpp +++ b/mozilla/widget/src/beos/nsDragService.cpp @@ -26,6 +26,11 @@ #include "nsIServiceManager.h" #include "nsWidgetsCID.h" +#include "nslog.h" + +NS_IMPL_LOG(nsDragServiceLog, 0) +#define PRINTF NS_LOG_PRINTF(nsDragServiceLog) +#define FLUSH NS_LOG_FLUSH(nsDragServiceLog) static NS_DEFINE_IID(kIDragServiceIID, NS_IDRAGSERVICE_IID); static NS_DEFINE_CID(kCDragServiceCID, NS_DRAGSERVICE_CID); @@ -101,7 +106,7 @@ NS_IMETHODIMP nsDragService::GetData (nsITransferable * aTransferable, //------------------------------------------------------------------------- void nsDragService::SetTopLevelView(BView *v) { - printf(" nsDragService::SetTopLevelWidget\n"); + PRINTF(" nsDragService::SetTopLevelWidget\n"); // Don't set up any more event handlers if we're being called twice // for the same toplevel widget diff --git a/mozilla/widget/src/beos/nsDropTarget.cpp b/mozilla/widget/src/beos/nsDropTarget.cpp index d73abf9a59d..658af06f756 100644 --- a/mozilla/widget/src/beos/nsDropTarget.cpp +++ b/mozilla/widget/src/beos/nsDropTarget.cpp @@ -28,13 +28,19 @@ #include "nsIWidget.h" #include "nsWindow.h" +#include "nslog.h" + +NS_IMPL_LOG(nsDropTargetLog, 0) +#define PRINTF NS_LOG_PRINTF(nsDropTargetLog) +#define FLUSH NS_LOG_FLUSH(nsDropTargetLog) + //Don't forget to RegisterDragDrop and to //CoLockObjectExternal. //You must RevokeDragDrop before destroying this object // nsDropTarget::nsDropTarget(nsIWidget * aWindow) { - printf("nsDropTarget::nsDropTarget\n"); + PRINTF("nsDropTarget::nsDropTarget\n"); m_refs = 0; m_pWin = aWindow; NS_ADDREF(aWindow); @@ -45,7 +51,7 @@ nsDropTarget::nsDropTarget(nsIWidget * aWindow) // nsDropTarget::~nsDropTarget() { - printf("nsDropTarget::Drop\n"); + PRINTF("nsDropTarget::Drop\n"); ; } @@ -55,7 +61,7 @@ nsDropTarget::~nsDropTarget() // STDMETHODIMP nsDropTarget::QueryInterface(REFIID riid, LPVOID FAR* ppv) { - printf("nsDropTarget::QueryInterface\n"); + PRINTF("nsDropTarget::QueryInterface\n"); if (riid == IID_IUnknown) *ppv = this; else if (riid == IID_IDropTarget) @@ -78,7 +84,7 @@ STDMETHODIMP nsDropTarget::QueryInterface(REFIID riid, LPVOID FAR* ppv) // STDMETHODIMP_(ULONG) nsDropTarget::AddRef(void) { - printf("nsDropTarget::AddRef\n"); + PRINTF("nsDropTarget::AddRef\n"); return ++m_refs; } @@ -86,7 +92,7 @@ STDMETHODIMP_(ULONG) nsDropTarget::AddRef(void) // STDMETHODIMP_(ULONG) nsDropTarget::Release(void) { - printf("nsDropTarget::Release\n"); + PRINTF("nsDropTarget::Release\n"); if(--m_refs == 0){ //And now we can delete this object delete this; @@ -102,7 +108,7 @@ STDMETHODIMP_(ULONG) nsDropTarget::Release(void) // DWORD nsDropTarget::FindDragDropEffect(DWORD grfKeyState, POINTL /* pointl */) { - printf("nsDropTarget::FindDragDropEffect\n"); + PRINTF("nsDropTarget::FindDragDropEffect\n"); DWORD dwRet; // no modifier -- DROPEFFECT_MOVE or source default @@ -125,7 +131,7 @@ STDMETHODIMP nsDropTarget::DragEnter (LPDATAOBJECT pDataObj, POINTL pointl, LPDWORD pdwEffect) { - printf("nsDropTarget::DragEnter\n"); + PRINTF("nsDropTarget::DragEnter\n"); *pdwEffect = FindDragDropEffect(grfKeyState, pointl); return NOERROR; } @@ -136,7 +142,7 @@ STDMETHODIMP nsDropTarget::DragOver (DWORD grfKeyState, POINTL pointl, LPDWORD pdwEffect) { - printf("nsDropTarget::DragOver\n"); + PRINTF("nsDropTarget::DragOver\n"); *pdwEffect = FindDragDropEffect(grfKeyState, pointl); return NOERROR; } @@ -147,7 +153,7 @@ STDMETHODIMP nsDropTarget::DragOver (DWORD grfKeyState, // STDMETHODIMP nsDropTarget::DragLeave (void) { - printf("nsDropTarget::DragLeave\n"); + PRINTF("nsDropTarget::DragLeave\n"); return NOERROR; } @@ -158,8 +164,8 @@ STDMETHODIMP nsDropTarget::Drop (LPDATAOBJECT pIDataObject, POINTL pointl, LPDWORD pdwEffect) { - printf("nsDropTarget::Drop\n"); - printf("pIDataObject 0x%x\n", pIDataObject); + PRINTF("nsDropTarget::Drop\n"); + PRINTF("pIDataObject 0x%x\n", pIDataObject); pIDataObject->AddRef(); if (nsnull != m_pWin) { nsEventStatus status; @@ -176,11 +182,11 @@ STDMETHODIMP nsDropTarget::Drop (LPDATAOBJECT pIDataObject, if (pIDataObject != NULL) { IDataObject * presistStorage; - //printf("QueryInterface for persist\n"); + //PRINTF("QueryInterface for persist\n"); pIDataObject->QueryInterface(IID_IDataObject,(LPVOID *)&presistStorage); - //printf("Done QueryInterface for persist\n"); + //PRINTF("Done QueryInterface for persist\n"); if (presistStorage != NULL) { - printf("$$$$$$$$$$$$$$$ Got it!\n"); + PRINTF("$$$$$$$$$$$$$$$ Got it!\n"); FORMATETC pFE; presistStorage->QueryGetData(&pFE); @@ -188,16 +194,16 @@ STDMETHODIMP nsDropTarget::Drop (LPDATAOBJECT pIDataObject, STGMEDIUM pSTM; HRESULT st = presistStorage->GetDataHere(&pFE, &pSTM); - printf("st 0x%X\n", st); + PRINTF("st 0x%X\n", st); if (NOERROR != st) { return FALSE; } //TYMED_STORAGE, TYMED_STREAM, TYMED_HGLOBAL, or TYMED_FILE - //printf("%s\n", pSTM.lpszFileName); + //PRINTF("%s\n", pSTM.lpszFileName); { //HRESULT hr = pIDataObject->GetData(&pFE, &pSTM); - //printf("hr 0x%X\n", hr); + //PRINTF("hr 0x%X\n", hr); //if (NOERROR != hr) { // return FALSE; //} @@ -229,7 +235,7 @@ STDMETHODIMP nsDropTarget::Drop (LPDATAOBJECT pIDataObject, } else { - printf("^^^^^^^^^^^^^^^^^ Didn't!\n"); + PRINTF("^^^^^^^^^^^^^^^^^ Didn't!\n"); } } diff --git a/mozilla/widget/src/beos/nsFileWidget.cpp b/mozilla/widget/src/beos/nsFileWidget.cpp index 9d78b36c70a..96a205f58bc 100644 --- a/mozilla/widget/src/beos/nsFileWidget.cpp +++ b/mozilla/widget/src/beos/nsFileWidget.cpp @@ -26,6 +26,11 @@ #endif #include "nsFileWidget.h" +#include "nslog.h" + +NS_IMPL_LOG(nsFileWidgetLog, 0) +#define PRINTF NS_LOG_PRINTF(nsFileWidgetLog) +#define FLUSH NS_LOG_FLUSH(nsFileWidgetLog) //NS_IMPL_ISUPPORTS(nsFileWidget, NS_IFILEWIDGET_IID) NS_DEFINE_IID(kIFileWidgetIID, NS_IFILEWIDGET_IID); @@ -51,7 +56,7 @@ nsFileWidget::nsFileWidget() : nsIFileWidget() PRBool nsFileWidget::Show() { -printf("nsFileWidget::Show not implemented\n"); + PRINTF("nsFileWidget::Show not implemented\n"); #if 0 char fileBuffer[MAX_PATH+1] = ""; mDefault.ToCString(fileBuffer,MAX_PATH); diff --git a/mozilla/widget/src/beos/nsFontRetrieverService.cpp b/mozilla/widget/src/beos/nsFontRetrieverService.cpp index a733dc3f1c4..dd50ab34ef9 100644 --- a/mozilla/widget/src/beos/nsFontRetrieverService.cpp +++ b/mozilla/widget/src/beos/nsFontRetrieverService.cpp @@ -28,6 +28,11 @@ #include "nsFont.h" #include "nsVoidArray.h" #include "nsFontSizeIterator.h" +#include "nslog.h" + +NS_IMPL_LOG(nsFontRetrieverServiceLog, 0) +#define PRINTF NS_LOG_PRINTF(nsFontRetrieverServiceLog) +#define FLUSH NS_LOG_FLUSH(nsFontRetrieverServiceLog) NS_IMPL_ADDREF(nsFontRetrieverService) NS_IMPL_RELEASE(nsFontRetrieverService) @@ -189,7 +194,7 @@ static FontInfo * GetFontInfo(nsVoidArray * aFontList, char * aName) FontInfo * fontInfo = new FontInfo(); fontInfo->mName.AssignWithConversion(aName); - //printf("Adding [%s]\n", aName);fflush(stdout); + //PRINTF("Adding [%s]\n", aName);fflush(stdout); fontInfo->mIsScalable = PR_FALSE; // X fonts aren't scalable right?? fontInfo->mSizes = nsnull; aFontList->AppendElement(fontInfo); @@ -265,17 +270,17 @@ NS_IMETHODIMP nsFontRetrieverService::LoadFontList() // } // // if (fonts == NULL) { -// fprintf(stderr, "pattern \"%s\" unmatched\n", pattern); +// PRINTF("pattern \"%s\" unmatched\n", pattern); // return NS_ERROR_FAILURE; // } // //#if 0 // debug // // print out all the retrieved fonts -// printf("-----------------------------\n"); +// PRINTF("-----------------------------\n"); // for (i=0; iElementAt(aCount); mItems->RemoveElementAt(aCount); @@ -355,7 +360,7 @@ printf("nsMenu::RemoveItem - FIXME: not implemented\n"); //------------------------------------------------------------------------- NS_METHOD nsMenu::RemoveAll() { -printf("nsMenu::RemoveAll - FIXME: not implemented\n"); + PRINTF("nsMenu::RemoveAll - FIXME: not implemented\n"); #if 0 while (mItems->Count()) { mItems->RemoveElementAt(0); @@ -610,7 +615,7 @@ void nsMenu::LoadSubMenu(nsIMenu * pParentMenu, { nsString menuName; menuElement->GetAttribute(NS_ConvertASCIItoUCS2("value"), menuName); - //printf("Creating Menu [%s] \n", menuName.ToNewCString()); // this leaks + //PRINTF("Creating Menu [%s] \n", menuName.ToNewCString()); // this leaks // Create nsMenu nsIMenu * pnsMenu = nsnull; @@ -649,7 +654,7 @@ void nsMenu::LoadSubMenu(nsIMenu * pParentMenu, menuitemElement->GetNodeName(menuitemNodeType); #ifdef DEBUG_saari - printf("Type [%s] %d\n", menuitemNodeType.ToNewCString(), menuitemNodeType.Equals("menuseparator")); +PRINTF("Type [%s] %d\n", menuitemNodeType.ToNewCString(), menuitemNodeType.Equals("menuseparator")); #endif if (menuitemNodeType.Equals("menuitem")) { diff --git a/mozilla/widget/src/beos/nsMenuBar.cpp b/mozilla/widget/src/beos/nsMenuBar.cpp index aa5bd1f06c6..7dc040ac90e 100644 --- a/mozilla/widget/src/beos/nsMenuBar.cpp +++ b/mozilla/widget/src/beos/nsMenuBar.cpp @@ -35,6 +35,11 @@ #include "nsWidgetsCID.h" #include +#include "nslog.h" + +NS_IMPL_LOG(nsMenuBarLog, 0) +#define PRINTF NS_LOG_PRINTF(nsMenuBarLog) +#define FLUSH NS_LOG_FLUSH(nsMenuBarLog) static NS_DEFINE_CID(kMenuBarCID, NS_MENUBAR_CID); static NS_DEFINE_CID(kMenuCID, NS_MENU_CID); @@ -184,7 +189,7 @@ NS_METHOD nsMenuBar::RemoveMenu(const PRUint32 aPos) //------------------------------------------------------------------------- NS_METHOD nsMenuBar::RemoveAll() { -printf("nsMenuBar::RemoveAll - FIXME: not implemented\n"); + PRINTF("nsMenuBar::RemoveAll - FIXME: not implemented\n"); #if 0 while (mItems->Count()) { nsISupports * supports = (nsISupports *)mItems->ElementAt(0); diff --git a/mozilla/widget/src/beos/nsPopUpMenu.cpp b/mozilla/widget/src/beos/nsPopUpMenu.cpp index a5b43e36d51..1ecbdca6344 100644 --- a/mozilla/widget/src/beos/nsPopUpMenu.cpp +++ b/mozilla/widget/src/beos/nsPopUpMenu.cpp @@ -34,6 +34,11 @@ #include "nsIDeviceContext.h" #include "nsRect.h" #include "nsGfxCIID.h" +#include "nslog.h" + +NS_IMPL_LOG(nsPopUpMenuLog, 0) +#define PRINTF NS_LOG_PRINTF(nsPopUpMenuLog) +#define FLUSH NS_LOG_FLUSH(nsPopUpMenuLog) static NS_DEFINE_IID(kPopUpMenuIID, NS_IPOPUPMENU_IID); NS_IMPL_ISUPPORTS(nsPopUpMenu, kPopUpMenuIID) @@ -71,7 +76,7 @@ nsPopUpMenu::~nsPopUpMenu() //------------------------------------------------------------------------- NS_METHOD nsPopUpMenu::Create(nsIWidget *aParent) { -printf("nsPopUpMenu::Create - FIXME: not implemented\n"); + PRINTF("nsPopUpMenu::Create - FIXME: not implemented\n"); mParent = aParent; NS_ADDREF(mParent); @@ -204,7 +209,7 @@ NS_METHOD nsPopUpMenu::RemoveAll() //------------------------------------------------------------------------- NS_METHOD nsPopUpMenu::ShowMenu(PRInt32 aX, PRInt32 aY) { -printf("nsPopUpMenu::ShowMenu - FIXME: not implemented\n"); + PRINTF("nsPopUpMenu::ShowMenu - FIXME: not implemented\n"); #if 0 if (nsnull != mParent) { HWND pWnd = (HWND)mParent->GetNativeData(NS_NATIVE_WIDGET); diff --git a/mozilla/widget/src/beos/nsTextAreaWidget.cpp b/mozilla/widget/src/beos/nsTextAreaWidget.cpp index b86e7c43afa..e73cb6a66be 100644 --- a/mozilla/widget/src/beos/nsTextAreaWidget.cpp +++ b/mozilla/widget/src/beos/nsTextAreaWidget.cpp @@ -31,6 +31,11 @@ #include "nsIDeviceContext.h" #include "nsIFontMetrics.h" +#include "nslog.h" + +NS_IMPL_LOG(nsTextAreaWidgetLog, 0) +#define PRINTF NS_LOG_PRINTF(nsTextAreaWidgetLog) +#define FLUSH NS_LOG_FLUSH(nsTextAreaWidgetLog) static NS_DEFINE_IID(kLookAndFeelCID, NS_LOOKANDFEEL_CID); static NS_DEFINE_IID(kILookAndFeelIID, NS_ILOOKANDFEEL_IID); @@ -132,7 +137,7 @@ NS_METHOD nsTextAreaWidget::GetBounds(nsRect &aRect) #if 0 nsWindow::GetNonClientBounds(aRect); #endif -printf("nsTextAreaWidget::GetBounds not wrong\n"); // the following is just a placeholder + PRINTF("nsTextAreaWidget::GetBounds not wrong\n"); // the following is just a placeholder nsWindow::GetClientBounds(aRect); return NS_OK; } diff --git a/mozilla/widget/src/beos/nsTextHelper.cpp b/mozilla/widget/src/beos/nsTextHelper.cpp index 31999a62c66..23b0f1ecaa4 100644 --- a/mozilla/widget/src/beos/nsTextHelper.cpp +++ b/mozilla/widget/src/beos/nsTextHelper.cpp @@ -27,6 +27,11 @@ #include "nsString.h" #include "nsStringUtil.h" #include +#include "nslog.h" + +NS_IMPL_LOG(nsTextHelperLog, 0) +#define PRINTF NS_LOG_PRINTF(nsTextHelperLog) +#define FLUSH NS_LOG_FLUSH(nsTextHelperLog) NS_METHOD nsTextHelper::PreCreateWidget(nsWidgetInitData *aInitData) { @@ -109,7 +114,7 @@ NS_METHOD nsTextHelper::RemoveText() NS_METHOD nsTextHelper::SetPassword(PRBool aIsPassword) { mIsPassword = aIsPassword; -if(mIsPassword) printf("nsTextHelper::SetPassword not implemented\n"); + if(mIsPassword) PRINTF("nsTextHelper::SetPassword not implemented\n"); return NS_OK; } diff --git a/mozilla/widget/src/beos/nsTextWidget.cpp b/mozilla/widget/src/beos/nsTextWidget.cpp index fee2f501802..a00709cb02c 100644 --- a/mozilla/widget/src/beos/nsTextWidget.cpp +++ b/mozilla/widget/src/beos/nsTextWidget.cpp @@ -32,6 +32,11 @@ #include "nsIDeviceContext.h" #include "nsIFontMetrics.h" +#include "nslog.h" + +NS_IMPL_LOG(nsTextWidgetLog, 0) +#define PRINTF NS_LOG_PRINTF(nsTextWidgetLog) +#define FLUSH NS_LOG_FLUSH(nsTextWidgetLog) static NS_DEFINE_IID(kLookAndFeelCID, NS_LOOKANDFEEL_CID); static NS_DEFINE_IID(kILookAndFeelIID, NS_ILOOKANDFEEL_IID); @@ -112,7 +117,7 @@ NS_METHOD nsTextWidget::GetBounds(nsRect &aRect) #if 0 nsWindow::GetNonClientBounds(aRect); #endif -printf("nsTextWidget::GetBounds not wrong\n"); // the following is just a placeholder + PRINTF("nsTextWidget::GetBounds not wrong\n"); // the following is just a placeholder nsWindow::GetClientBounds(aRect); return NS_OK; } diff --git a/mozilla/widget/src/beos/nsToolkit.cpp b/mozilla/widget/src/beos/nsToolkit.cpp index 476a085972b..4eaac120e64 100644 --- a/mozilla/widget/src/beos/nsToolkit.cpp +++ b/mozilla/widget/src/beos/nsToolkit.cpp @@ -28,6 +28,11 @@ #include "nsGUIEvent.h" #include "nsSwitchToUIThread.h" #include "plevent.h" +#include "nslog.h" + +NS_IMPL_LOG(nsToolkitLog, 0) +#define PRINTF NS_LOG_PRINTF(nsToolkitLog) +#define FLUSH NS_LOG_FLUSH(nsToolkitLog) // // Static thread local storage index of the Toolkit @@ -128,7 +133,7 @@ void nsToolkit::RunPump(void* arg) break; default : - printf("nsToolkit::RunPump - UNKNOWN EVENT\n"); + PRINTF("nsToolkit::RunPump - UNKNOWN EVENT\n"); break; } diff --git a/mozilla/widget/src/beos/nsWidgetFactory.cpp b/mozilla/widget/src/beos/nsWidgetFactory.cpp index f27a250dc2c..459dc738f2f 100644 --- a/mozilla/widget/src/beos/nsWidgetFactory.cpp +++ b/mozilla/widget/src/beos/nsWidgetFactory.cpp @@ -49,6 +49,11 @@ #include "nsDragService.h" #include "nsSound.h" +#include "nslog.h" + +NS_IMPL_LOG(nsWidgetFactoryLog, 0) +#define PRINTF NS_LOG_PRINTF(nsWidgetFactoryLog) +#define FLUSH NS_LOG_FLUSH(nsWidgetFactoryLog) static NS_DEFINE_IID(kCWindow, NS_WINDOW_CID); static NS_DEFINE_IID(kCChild, NS_CHILD_CID); @@ -222,7 +227,7 @@ nsresult nsWidgetFactory::CreateInstance(nsISupports *aOuter, inst = (nsISupports*) (nsIDragService *) new nsDragService(); } else { - printf("nsWidgetFactory::CreateInstance(), unhandled class.\n"); + PRINTF("nsWidgetFactory::CreateInstance(), unhandled class.\n"); } if (inst == NULL) { diff --git a/mozilla/widget/src/beos/nsWindow.cpp b/mozilla/widget/src/beos/nsWindow.cpp index 713568bf671..4195bec40fa 100644 --- a/mozilla/widget/src/beos/nsWindow.cpp +++ b/mozilla/widget/src/beos/nsWindow.cpp @@ -48,6 +48,11 @@ #include "DropTar.h" #include "DropSrc.h" #endif +#include "nslog.h" + +NS_IMPL_LOG(nsWindowLog, 0) +#define PRINTF NS_LOG_PRINTF(nsWindowLog) +#define FLUSH NS_LOG_FLUSH(nsWindowLog) static NS_DEFINE_IID(kIWidgetIID, NS_IWIDGET_IID); @@ -515,7 +520,7 @@ nsresult nsWindow::StandardWindowCreate(nsIWidget *aParent, DWORD dwVer = ::OleBuildVersion(); if (FAILED(::OleInitialize(NULL))){ - printf("***** OLE has been initialized!\n"); + PRINTF("***** OLE has been initialized!\n"); } gOLEInited = TRUE; } @@ -739,7 +744,7 @@ NS_METHOD nsWindow::IsVisible(PRBool & bState) //------------------------------------------------------------------------- NS_METHOD nsWindow::ConstrainPosition(PRInt32 *aX, PRInt32 *aY) { - printf("nsWindow::ConstrainPosition - not implemented\n"); + PRINTF("nsWindow::ConstrainPosition - not implemented\n"); return NS_OK; } @@ -802,7 +807,7 @@ NS_METHOD nsWindow::Resize(PRInt32 aWidth, PRInt32 aHeight, PRBool aRepaint) havewindow = true; if(! aRepaint) - printf("nsWindow::Resize FIXME: no repaint not implemented\n"); + PRINTF("nsWindow::Resize FIXME: no repaint not implemented\n"); if(mView->Parent() || ! havewindow) mView->ResizeTo(aWidth-1, GetHeight(aHeight)-1); @@ -854,7 +859,7 @@ NS_METHOD nsWindow::Resize(PRInt32 aX, havewindow = true; if(! aRepaint) - printf("nsWindow::Resize FIXME: no repaint not implemented\n"); + PRINTF("nsWindow::Resize FIXME: no repaint not implemented\n"); if(mView->Parent() || ! havewindow) { @@ -888,7 +893,7 @@ NS_METHOD nsWindow::Resize(PRInt32 aX, //------------------------------------------------------------------------- NS_METHOD nsWindow::Enable(PRBool bState) { -printf("nsWindow::Enable - FIXME: not implemented\n"); + PRINTF("nsWindow::Enable - FIXME: not implemented\n"); return NS_OK; } @@ -1201,7 +1206,7 @@ void* nsWindow::GetNativeData(PRUint32 aDataType) //------------------------------------------------------------------------- NS_METHOD nsWindow::SetColorMap(nsColorMap *aColorMap) { -printf("nsWindow::SetColorMap - not implemented\n"); + PRINTF("nsWindow::SetColorMap - not implemented\n"); return NS_OK; } @@ -1400,7 +1405,7 @@ PRBool nsWindow::OnKey(PRUint32 aEventType, const char *bytes, int32 numBytes, P nsKeyEvent event; InitEvent(event, aEventType); -printf("nsWindow::OnKey - FIXME: keycode translation incomplete\n"); + PRINTF("nsWindow::OnKey - FIXME: keycode translation incomplete\n"); event.charCode = bytes[0]; char c = bytes[0]; @@ -1419,7 +1424,7 @@ printf("nsWindow::OnKey - FIXME: keycode translation incomplete\n"); } else { - printf("nsWindow::OnKey - FIXME: handle non ASCII chars\n"); + PRINTF("nsWindow::OnKey - FIXME: handle non ASCII chars\n"); return NS_OK; } } @@ -1592,7 +1597,7 @@ nsresult nsWindow::MenuHasBeenSelected(HMENU aNativeMenu, UINT aItemNum, UINT aF // if aNativeMenu is NULL then the menu is being deselected if (!aNativeMenu) { - printf("///////////// Menu is NULL!\n"); + PRINTF("///////////// Menu is NULL!\n"); // check to make sure something had been selected AdjustMenus(mHitMenu, nsnull, event); NS_IF_RELEASE(mHitMenu); @@ -1654,11 +1659,11 @@ nsresult nsWindow::MenuHasBeenSelected(HMENU aNativeMenu, UINT aItemNum, UINT aF // Skip if it is a menu item, otherwise, we get the menu by position if (!isMenuItem) { - printf("Getting submenu by position %d from parentMenu\n", aItemNum); + PRINTF("Getting submenu by position %d from parentMenu\n", aItemNum); nsISupports * item; parentMenu->GetItemAt((PRUint32)aItemNum, item); if (NS_OK != item->QueryInterface(kIMenuIID, (void **)&newMenu)) { - printf("Item was not a menu! What are we doing here? Return early....\n"); + PRINTF("Item was not a menu! What are we doing here? Return early....\n"); return NS_ERROR_FAILURE; } } @@ -1738,7 +1743,7 @@ nsresult nsWindow::MenuHasBeenSelected(HMENU aNativeMenu, UINT aItemNum, UINT aF NS_RELEASE(parentMenu); } else { - printf("no menu was found. This is bad.\n"); + PRINTF("no menu was found. This is bad.\n"); // XXX need to assert here! } } @@ -2035,11 +2040,11 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT } #if 0 // these are needed for now case WM_INITMENU: { - printf("WM_INITMENU\n"); + PRINTF("WM_INITMENU\n"); } break; case WM_INITMENUPOPUP: { - printf("WM_INITMENUPOPUP\n"); + PRINTF("WM_INITMENUPOPUP\n"); } break; #endif @@ -2057,7 +2062,7 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT case WM_MOUSEWHEEL: { if (firstTime) { firstTime = FALSE; - //printf("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ WM_SETTINGCHANGE\n"); + //PRINTF("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ WM_SETTINGCHANGE\n"); SystemParametersInfo (104, 0, &ulScrollLines, 0) ; //SystemParametersInfo (SPI_GETWHEELSCROLLLINES, 0, &ulScrollLines, 0) ; @@ -2068,7 +2073,7 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT iDeltaPerLine = WHEEL_DELTA / ulScrollLines ; else iDeltaPerLine = 0 ; - //printf("ulScrollLines %d iDeltaPerLine %d\n", ulScrollLines, iDeltaPerLine); + //PRINTF("ulScrollLines %d iDeltaPerLine %d\n", ulScrollLines, iDeltaPerLine); if (msg == WM_SETTINGCHANGE) { return 0; @@ -2085,13 +2090,13 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT iAccumDelta += (short) HIWORD (wParam) ; // 120 or -120 while (iAccumDelta >= iDeltaPerLine) { - //printf("iAccumDelta %d\n", iAccumDelta); + //PRINTF("iAccumDelta %d\n", iAccumDelta); SendMessage (mView, WM_VSCROLL, SB_LINEUP, (LONG)scrollbar) ; iAccumDelta -= iDeltaPerLine ; } while (iAccumDelta <= -iDeltaPerLine) { - //printf("iAccumDelta %d\n", iAccumDelta); + //PRINTF("iAccumDelta %d\n", iAccumDelta); SendMessage (mView, WM_VSCROLL, SB_LINEDOWN, (LONG)scrollbar) ; iAccumDelta += iDeltaPerLine ; } @@ -2140,7 +2145,7 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT for (UINT iFile = 0; iFile < nFiles; iFile++) { TCHAR szFileName[_MAX_PATH]; ::DragQueryFile(hDropInfo, iFile, szFileName, _MAX_PATH); - printf("szFileName [%s]\n", szFileName); + PRINTF("szFileName [%s]\n", szFileName); nsAutoString fileStr(szFileName); nsEventStatus status; nsDragDropEvent event; @@ -2392,7 +2397,7 @@ NS_METHOD nsWindow::SetMenuBar(nsIMenuBar * aMenuBar) if(mMenuBar) { // Get rid of the old menubar -printf("nsWindow::SetMenuBar - FIXME: Get rid of the old menubar!\n"); + PRINTF("nsWindow::SetMenuBar - FIXME: Get rid of the old menubar!\n"); // GtkWidget* oldMenuBar; // mMenuBar->GetNativeData((void*&) oldMenuBar); // if (oldMenuBar) { @@ -2433,7 +2438,7 @@ printf("nsWindow::SetMenuBar - FIXME: Get rid of the old menubar!\n"); NS_METHOD nsWindow::ShowMenuBar(PRBool aShow) { -printf("nsWindow::ShowMenuBar - FIXME: not implemented!\n"); + PRINTF("nsWindow::ShowMenuBar - FIXME: not implemented!\n"); // if (!mMenuBar) // // return NS_ERROR_FAILURE; // return NS_OK; diff --git a/mozilla/widget/src/gtk/nsAppShell.cpp b/mozilla/widget/src/gtk/nsAppShell.cpp index a6c39b27ad3..72a37e28478 100644 --- a/mozilla/widget/src/gtk/nsAppShell.cpp +++ b/mozilla/widget/src/gtk/nsAppShell.cpp @@ -39,6 +39,11 @@ #include "nsIPref.h" #include "glib.h" +#include "nslog.h" + +NS_IMPL_LOG(nsAppShellLog, 0) +#define PRINTF NS_LOG_PRINTF(nsAppShellLog) +#define FLUSH NS_LOG_FLUSH(nsAppShellLog) static PRBool sInitialized = PR_FALSE; static PLHashTable *sQueueHashTable = nsnull; @@ -64,7 +69,7 @@ static void our_gdk_io_destroy(gpointer data) { #ifdef DEBUG_APPSHELL - printf("our_gdk_io_destroy()\n"); + PRINTF("our_gdk_io_destroy()\n"); #endif OurGdkIOClosure* ioc = (OurGdkIOClosure*) data; if (ioc) { @@ -79,7 +84,7 @@ our_gdk_input_add (gint source, gint priority) { #ifdef DEBUG_APPSHELL - printf("our_gdk_input_add()\n"); + PRINTF("our_gdk_input_add()\n"); #endif guint result; OurGdkIOClosure *closure = g_new (OurGdkIOClosure, 1); @@ -117,7 +122,7 @@ nsAppShell::nsAppShell() { NS_INIT_REFCNT(); #ifdef DEBUG_APPSHELL - printf("nsAppShell::nsAppShell()\n"); + PRINTF("nsAppShell::nsAppShell()\n"); #endif } @@ -129,7 +134,7 @@ nsAppShell::nsAppShell() nsAppShell::~nsAppShell() { #ifdef DEBUG_APPSHELL - printf("nsAppShell::~nsAppShell()\n"); + PRINTF("nsAppShell::~nsAppShell()\n"); #endif // XXX we need to free this hashtable // PL_HashTableDestroy(sQueueHashTable); @@ -206,7 +211,7 @@ HandleColormapPrefs( void ) NS_IMETHODIMP nsAppShell::Create(int *bac, char **bav) { #ifdef DEBUG_APPSHELL - printf("nsAppShell::Create()\n"); + PRINTF("nsAppShell::Create()\n"); #endif if (sInitialized) return NS_OK; @@ -265,7 +270,7 @@ NS_IMETHODIMP nsAppShell::Spinup() nsresult rv = NS_OK; #ifdef DEBUG_APPSHELL - printf("nsAppShell::Spinup()\n"); + PRINTF("nsAppShell::Spinup()\n"); #endif // Get the event queue service @@ -308,7 +313,7 @@ NS_IMETHODIMP nsAppShell::Spinup() NS_IMETHODIMP nsAppShell::Spindown() { #ifdef DEBUG_APPSHELL - printf("nsAppShell::Spindown()\n"); + PRINTF("nsAppShell::Spindown()\n"); #endif if (mEventQueue) { ListenToEventQueue(mEventQueue, PR_FALSE); @@ -386,7 +391,7 @@ NS_IMETHODIMP nsAppShell::ListenToEventQueue(nsIEventQueue *aQueue, PRBool aListen) { #ifdef DEBUG_APPSHELL - printf("ListenToEventQueue(%p, %d) this=%p\n", aQueue, aListen, this); + PRINTF("ListenToEventQueue(%p, %d) this=%p\n", aQueue, aListen, this); #endif if (!sQueueHashTable) { sQueueHashTable = PL_NewHashTable(3, (PLHashFunction)IntHashKey, diff --git a/mozilla/widget/src/gtk/nsClipboard.cpp b/mozilla/widget/src/gtk/nsClipboard.cpp index e7d17742808..2a683cf15d8 100644 --- a/mozilla/widget/src/gtk/nsClipboard.cpp +++ b/mozilla/widget/src/gtk/nsClipboard.cpp @@ -48,6 +48,11 @@ #define NS_IMPL_IDS # include "nsIPlatformCharset.h" #undef NS_IMPL_IDS +#include "nslog.h" + +NS_IMPL_LOG(nsClipboardLog, 0) +#define PRINTF NS_LOG_PRINTF(nsClipboardLog) +#define FLUSH NS_LOG_FLUSH(nsClipboardLog) // The class statics: @@ -230,7 +235,7 @@ NS_IMETHODIMP nsClipboard::GetData(nsITransferable * aTransferable, PRInt32 aWhi if (nsnull != aTransferable) { return GetNativeClipboardData(aTransferable, aWhichClipboard); } else { - printf(" nsClipboard::GetData(), aTransferable is NULL.\n"); + PRINTF(" nsClipboard::GetData(), aTransferable is NULL.\n"); } return NS_ERROR_FAILURE; @@ -288,7 +293,7 @@ NS_IMETHODIMP nsClipboard::SetNativeClipboardData(PRInt32 aWhichClipboard) // make sure we have a good transferable if (nsnull == transferable) { - printf("nsClipboard::SetNativeClipboardData(): no transferable!\n"); + PRINTF("nsClipboard::SetNativeClipboardData(): no transferable!\n"); return NS_ERROR_FAILURE; } @@ -401,7 +406,7 @@ nsClipboard::GetNativeClipboardData(nsITransferable * aTransferable, // make sure we have a good transferable if (nsnull == aTransferable) { - printf(" GetNativeClipboardData: Transferable is null!\n"); + PRINTF(" GetNativeClipboardData: Transferable is null!\n"); return NS_ERROR_FAILURE; } @@ -551,7 +556,7 @@ nsClipboard::SelectionReceiver (GtkWidget *aWidget, status = XmbTextPropertyToTextList(GDK_DISPLAY(), &prop, &tmpData, &foo); if (foo > 1) - printf("Got multiple strings from XmbTextPropertyToTextList.. don't know how to handle this yet\n"); + PRINTF("Got multiple strings from XmbTextPropertyToTextList.. don't know how to handle this yet\n"); PRInt32 numberOfBytes = 0; @@ -602,7 +607,7 @@ nsClipboard::SelectionReceiver (GtkWidget *aWidget, PRInt32 numberTmp = numberOfBytes; rv = decoder->Convert(data, &numberTmp, unicodeData, &outUnicodeLen); if (numberTmp != numberOfBytes) - printf("didn't consume all the bytes\n"); + PRINTF("didn't consume all the bytes\n"); (unicodeData)[outUnicodeLen] = '\0'; // null terminate. Convert() doesn't do it for us } @@ -623,7 +628,7 @@ nsClipboard::SelectionReceiver (GtkWidget *aWidget, PRInt32 numberOfBytes = (PRInt32)aSD->length; #ifdef DEBUG_CLIPBOARD - printf("UTF8_STRING is %s\nlength is %i\n", aSD->data, aSD->length); + PRINTF("UTF8_STRING is %s\nlength is %i\n", aSD->data, aSD->length); #endif nsCOMPtr decoder; @@ -642,7 +647,7 @@ nsClipboard::SelectionReceiver (GtkWidget *aWidget, PRInt32 numberTmp = numberOfBytes; rv = decoder->Convert(data, &numberTmp, unicodeData, &outUnicodeLen); if (numberTmp != numberOfBytes) - printf("didn't consume all the bytes\n"); + PRINTF("didn't consume all the bytes\n"); (unicodeData)[outUnicodeLen] = '\0'; // null terminate. Convert() doesn't do it for us } @@ -859,9 +864,9 @@ void nsClipboard::SelectionGetCB(GtkWidget *widget, #ifdef DEBUG_CLIPBOARD - printf("got data from transferable\n"); - printf("clipboardData is %s\n", clipboardData); - printf("length is %d\n", dataLength); + PRINTF("got data from transferable\n"); + PRINTF("clipboardData is %s\n", clipboardData); + PRINTF("length is %d\n", dataLength); #endif if (type.Equals("STRING")) { @@ -973,7 +978,7 @@ void nsClipboard::SelectionGetCB(GtkWidget *widget, } #ifdef DEBUG_pavlov else - printf("Transferable didn't support data flavor %s (type = %d)\n", + PRINTF("Transferable didn't support data flavor %s (type = %d)\n", dataFlavor ? dataFlavor : "None", aInfo); #endif } @@ -1183,7 +1188,7 @@ PRBool nsClipboard::GetTargets(GdkAtom aSelectionAtom) void nsClipboard::SendClipPing() { #ifdef DEBUG_CLIPBOARD - printf("nsClipboard::SendClipPing()\n"); + PRINTF("nsClipboard::SendClipPing()\n"); #endif XClientMessageEvent send_event; send_event.type = ClientMessage; @@ -1246,7 +1251,7 @@ PRBool nsClipboard::FindSelectionNotifyEvent() return PR_TRUE; } else if (xevent.type == ClientMessage) { #ifdef DEBUG_CLIPBOARD - printf("got client message %i\n", i); + PRINTF("got client message %i\n", i); #endif SendClipPing(); // send out the message again } @@ -1259,14 +1264,14 @@ PRBool nsClipboard::FindSelectionNotifyEvent() SelectionNotify, &xevent)) { #ifdef DEBUG_CLIPBOARD - printf("call to XCheckTypedWindowEvent returned me a SelectionNotify event!\n"); + PRINTF("call to XCheckTypedWindowEvent returned me a SelectionNotify event!\n"); #endif send_selection_notify_to_widget(&xevent, sWidget); return PR_TRUE; } #ifdef DEBUG_CLIPBOARD - printf("can't find a SelectionNotify event, giving up\n"); + PRINTF("can't find a SelectionNotify event, giving up\n"); #endif return PR_FALSE; diff --git a/mozilla/widget/src/gtk/nsContextMenu.cpp b/mozilla/widget/src/gtk/nsContextMenu.cpp index 6b60c1a18ba..f4a7336da84 100644 --- a/mozilla/widget/src/gtk/nsContextMenu.cpp +++ b/mozilla/widget/src/gtk/nsContextMenu.cpp @@ -33,6 +33,11 @@ #include "nsGtkEventHandler.h" #include "nsCOMPtr.h" #include "nsWidgetsCID.h" +#include "nslog.h" + +NS_IMPL_LOG(nsContextMenuLog, 0) +#define PRINTF NS_LOG_PRINTF(nsContextMenuLog) +#define FLUSH NS_LOG_FLUSH(nsContextMenuLog) static NS_DEFINE_CID(kMenuCID, NS_MENU_CID); static NS_DEFINE_CID(kMenuItemCID, NS_MENUITEM_CID); @@ -623,7 +628,7 @@ void nsContextMenu::LoadSubMenu(nsIMenu *pParentMenu, { nsString menuName; menuElement->GetAttribute(nsAutoString("name"), menuName); - //printf("Creating Menu [%s] \n", menuName.ToNewCString()); // this leaks + //PRINTF("Creating Menu [%s] \n", menuName.ToNewCString()); // this leaks // Create nsMenu nsIMenu * pnsMenu = nsnull; @@ -662,7 +667,7 @@ void nsContextMenu::LoadSubMenu(nsIMenu *pParentMenu, menuitemElement->GetNodeName(menuitemNodeType); #ifdef DEBUG_saari - printf("Type [%s] %d\n", menuitemNodeType.ToNewCString(), menuitemNodeType.Equals("separator")); +PRINTF("Type [%s] %d\n", menuitemNodeType.ToNewCString(), menuitemNodeType.Equals("separator")); #endif if (menuitemNodeType.Equals("menuitem")) { diff --git a/mozilla/widget/src/gtk/nsFilePicker.cpp b/mozilla/widget/src/gtk/nsFilePicker.cpp index cc536ff1638..43c835cdddc 100644 --- a/mozilla/widget/src/gtk/nsFilePicker.cpp +++ b/mozilla/widget/src/gtk/nsFilePicker.cpp @@ -25,6 +25,11 @@ #include "nsIComponentManager.h" #include "nsFilePicker.h" #include "nsILocalFile.h" +#include "nslog.h" + +NS_IMPL_LOG(nsFilePickerLog, 0) +#define PRINTF NS_LOG_PRINTF(nsFilePickerLog) +#define FLUSH NS_LOG_FLUSH(nsFilePickerLog) NS_IMPL_ISUPPORTS1(nsFilePicker, nsIFilePicker) @@ -167,7 +172,7 @@ NS_IMETHODIMP nsFilePicker::SetFilterList(PRUint32 aNumberOfFilters, // we need *.{htm, html, xul, etc} char *foo = aTitles[i].ToNewCString(); char *filters = aFilters[i].ToNewCString(); - printf("%20s %s\n", foo, filters); + PRINTF("%20s %s\n", foo, filters); menu_item = gtk_menu_item_new_with_label(nsCAutoString(aTitles[i])); diff --git a/mozilla/widget/src/gtk/nsFileWidget.cpp b/mozilla/widget/src/gtk/nsFileWidget.cpp index 1e4024eaec5..d506a7e3db2 100644 --- a/mozilla/widget/src/gtk/nsFileWidget.cpp +++ b/mozilla/widget/src/gtk/nsFileWidget.cpp @@ -26,6 +26,11 @@ #include "nsIPlatformCharset.h" #include "nsFileWidget.h" #include "nsIToolkit.h" +#include "nslog.h" + +NS_IMPL_LOG(nsFileWidgetLog, 0) +#define PRINTF NS_LOG_PRINTF(nsFileWidgetLog) +#define FLUSH NS_LOG_FLUSH(nsFileWidgetLog) NS_IMPL_ISUPPORTS1(nsFileWidget, nsIFileWidget) @@ -110,7 +115,7 @@ static void file_cancel_clicked(GtkWidget *w, PRBool *ret) static gint file_delete_window(GtkWidget *w, gpointer data) { - printf("window closed\n"); + PRINTF("window closed\n"); gtk_main_quit(); return PR_TRUE; } @@ -157,7 +162,7 @@ PRBool nsFileWidget::Show() buff[outLength] = '\0'; gtk_file_selection_set_filename(fs, (const gchar*) buff); #if defined(debug_nhotta) - printf("debug: file name is %s\n", buff); + PRINTF("debug: file name is %s\n", buff); #endif delete [] buff; } @@ -302,7 +307,7 @@ NS_IMETHODIMP nsFileWidget::SetFilterList(PRUint32 aNumberOfFilters, // we need *.{htm, html, xul, etc} char *foo = aTitles[i].ToNewCString(); char *filters = aFilters[i].ToNewCString(); - printf("%20s %s\n", foo, filters); + PRINTF("%20s %s\n", foo, filters); menu_item = gtk_menu_item_new_with_label(nsAutoCString(aTitles[i])); diff --git a/mozilla/widget/src/gtk/nsFontRetrieverService.cpp b/mozilla/widget/src/gtk/nsFontRetrieverService.cpp index 8e7ddc30fb3..3222c23d170 100644 --- a/mozilla/widget/src/gtk/nsFontRetrieverService.cpp +++ b/mozilla/widget/src/gtk/nsFontRetrieverService.cpp @@ -31,6 +31,11 @@ #include "nsFont.h" #include "nsVoidArray.h" #include "nsFontSizeIterator.h" +#include "nslog.h" + +NS_IMPL_LOG(nsFontRetrieverServiceLog, 0) +#define PRINTF NS_LOG_PRINTF(nsFontRetrieverServiceLog) +#define FLUSH NS_LOG_FLUSH(nsFontRetrieverServiceLog) NS_IMPL_ISUPPORTS2(nsFontRetrieverService, nsIFontRetrieverService, nsIFontNameIterator) @@ -162,7 +167,7 @@ static FontInfo * GetFontInfo(nsVoidArray * aFontList, char * aName) FontInfo * fontInfo = new FontInfo(); fontInfo->mName.AssignWithConversion(aName); - //printf("Adding [%s]\n", aName);fflush(stdout); + //PRINTF("Adding [%s]\n", aName);fflush(stdout); fontInfo->mIsScalable = PR_FALSE; // X fonts aren't scalable right?? fontInfo->mSizes = nsnull; aFontList->AppendElement(fontInfo); @@ -238,17 +243,17 @@ NS_IMETHODIMP nsFontRetrieverService::LoadFontList() } if (fonts == NULL) { - fprintf(stderr, "pattern \"%s\" unmatched\n", pattern); + PRINTF("pattern \"%s\" unmatched\n", pattern); return NS_ERROR_FAILURE; } #if 0 // debug // print out all the retrieved fonts - printf("-----------------------------\n"); + PRINTF("-----------------------------\n"); for (i=0; i #include #include +#include "nslog.h" + +NS_IMPL_LOG(nsGtkEventHandlerLog, 0) +#define PRINTF NS_LOG_PRINTF(nsGtkEventHandlerLog) +#define FLUSH NS_LOG_FLUSH(nsGtkEventHandlerLog) #ifdef DEBUG_pavlov //#define DEBUG_EVENTS 1 @@ -305,7 +310,7 @@ int nsPlatformToDOMKeyCode(GdkEventKey *aGEK) return keysym - GDK_F1 + NS_VK_F1; #if defined(DEBUG_akkana) || defined(DEBUG_ftang) - printf("No match in nsPlatformToDOMKeyCode: keysym is 0x%x, string is '%s', keyval = %d\n", keysym, aGEK->string, aGEK->keyval); + PRINTF("No match in nsPlatformToDOMKeyCode: keysym is 0x%x, string is '%s', keyval = %d\n", keysym, aGEK->string, aGEK->keyval); #endif return((int)0); @@ -432,20 +437,20 @@ void InitKeyPressEvent(GdkEventKey *aGEK, } #if defined(DEBUG_akkana_not) || defined (DEBUG_ftang) - if (!aGEK->length) printf("!length, "); - printf("Key Press event: gtk string = '%s', keyval = '%c' = %d,\n", + if (!aGEK->length) PRINTF("!length, "); + PRINTF("Key Press event: gtk string = '%s', keyval = '%c' = %d,\n", aGEK->string, aGEK->keyval, aGEK->keyval); - printf(" --> keyCode = 0x%x, char code = '%c'", + PRINTF(" --> keyCode = 0x%x, char code = '%c'", anEvent.keyCode, anEvent.charCode); if (anEvent.isShift) - printf(" [shift]"); + PRINTF(" [shift]"); if (anEvent.isControl) - printf(" [ctrl]"); + PRINTF(" [ctrl]"); if (anEvent.isAlt) - printf(" [alt]"); + PRINTF(" [alt]"); if (anEvent.isMeta) - printf(" [meta]"); - printf("\n"); + PRINTF(" [meta]"); + PRINTF("\n"); #endif anEvent.time = aGEK->time; @@ -1067,13 +1072,13 @@ handle_configure_event(GtkWidget *w, GdkEventConfigure *conf, gpointer p) if ((oldBounds.x == x) && (oldBounds.y == y)) { #ifdef DEBUG_MOVE - printf("Window: No position change\n"); + PRINTF("Window: No position change\n"); #endif return PR_FALSE; } #ifdef DEBUG_MOVE - printf("Window: Move from (%d,%d) to (%d,%d)\n", oldBounds.x, + PRINTF("Window: Move from (%d,%d) to (%d,%d)\n", oldBounds.x, oldBounds.y, x, y); #endif diff --git a/mozilla/widget/src/gtk/nsGtkIMEHelper.cpp b/mozilla/widget/src/gtk/nsGtkIMEHelper.cpp index 8cd88d56ed7..ad0e9742e0f 100644 --- a/mozilla/widget/src/gtk/nsGtkIMEHelper.cpp +++ b/mozilla/widget/src/gtk/nsGtkIMEHelper.cpp @@ -33,6 +33,11 @@ #include "nsWidget.h" #include "nsWindow.h" +#include "nslog.h" + +NS_IMPL_LOG(nsGtkIMEHelperLog, 0) +#define PRINTF NS_LOG_PRINTF(nsGtkIMEHelperLog) +#define FLUSH NS_LOG_FLUSH(nsGtkIMEHelperLog) static NS_DEFINE_CID(kCharsetConverterManagerCID, NS_ICHARSETCONVERTERMANAGER_CID); @@ -332,13 +337,13 @@ nsIMEPreedit::IMSetTextRange(const PRInt32 aLen, END_OFFSET(count) = aLen; #ifdef NOISY_XIM - printf("IMSetTextRange()\n"); + PRINTF("IMSetTextRange()\n"); for (i = 0; i < *textRangeListLengthResult; i++) { - printf(" i=%d start=%d end=%d attr=%d\n", + PRINTF(" i=%d start=%d end=%d attr=%d\n", i, (*textRangeListResult)[i].mStartOffset, (*textRangeListResult)[i].mEndOffset, - (*textRangeListResult)[i].mRangeType); + (*textRangeListResult)[i].mRangeType); } #endif /* NOISY_XIM */ } @@ -560,7 +565,7 @@ nsIMEStatus::CreateNative() { } if (!mFontset) { - printf("Error : XCreateFontSet() !\n"); + PRINTF("Error : XCreateFontSet() !\n"); return; } int screen = DefaultScreen(display); diff --git a/mozilla/widget/src/gtk/nsLookAndFeel.cpp b/mozilla/widget/src/gtk/nsLookAndFeel.cpp index bdc8b807c2a..06b92888980 100644 --- a/mozilla/widget/src/gtk/nsLookAndFeel.cpp +++ b/mozilla/widget/src/gtk/nsLookAndFeel.cpp @@ -24,6 +24,11 @@ #include #include "nsXPLookAndFeel.h" +#include "nslog.h" + +NS_IMPL_LOG(nsLookAndFeelLog, 0) +#define PRINTF NS_LOG_PRINTF(nsLookAndFeelLog) +#define FLUSH NS_LOG_FLUSH(nsLookAndFeelLog) #define GDK_COLOR_TO_NS_RGB(c) \ ((nscolor) NS_RGB(c.red>>8, c.green>>8, c.blue>>8)) @@ -211,7 +216,7 @@ NS_IMETHODIMP nsLookAndFeel::GetColor(const nsColorID aID, nscolor &aColor) break; } - // printf("%i, %i, %i\n", NS_GET_R(aColor), NS_GET_B(aColor), NS_GET_G(aColor)); + // PRINTF("%i, %i, %i\n", NS_GET_R(aColor), NS_GET_B(aColor), NS_GET_G(aColor)); return res; } diff --git a/mozilla/widget/src/gtk/nsMenu.cpp b/mozilla/widget/src/gtk/nsMenu.cpp index 9bc6ac227b0..bd5f1aa6ec5 100644 --- a/mozilla/widget/src/gtk/nsMenu.cpp +++ b/mozilla/widget/src/gtk/nsMenu.cpp @@ -33,6 +33,11 @@ #include "nsGtkEventHandler.h" #include "nsCOMPtr.h" #include "nsWidgetsCID.h" +#include "nslog.h" + +NS_IMPL_LOG(nsMenuLog, 0) +#define PRINTF NS_LOG_PRINTF(nsMenuLog) +#define FLUSH NS_LOG_FLUSH(nsMenuLog) static NS_DEFINE_CID(kMenuCID, NS_MENU_CID); static NS_DEFINE_CID(kMenuItemCID, NS_MENUITEM_CID); @@ -745,7 +750,7 @@ void nsMenu::LoadSubMenu(nsIMenu * pParentMenu, { nsString menuName; menuElement->GetAttribute(nsAutoString("value"), menuName); - //printf("Creating Menu [%s] \n", menuName.ToNewCString()); // this leaks + //PRINTF("Creating Menu [%s] \n", menuName.ToNewCString()); // this leaks // Create nsMenu nsIMenu * pnsMenu = nsnull; @@ -784,7 +789,7 @@ void nsMenu::LoadSubMenu(nsIMenu * pParentMenu, menuitemElement->GetNodeName(menuitemNodeType); #ifdef DEBUG_saari - printf("Type [%s] %d\n", menuitemNodeType.ToNewCString(), menuitemNodeType.Equals("menuseparator")); +PRINTF("Type [%s] %d\n", menuitemNodeType.ToNewCString(), menuitemNodeType.Equals("menuseparator")); #endif if (menuitemNodeType.Equals("menuitem")) { diff --git a/mozilla/widget/src/gtk/nsSound.cpp b/mozilla/widget/src/gtk/nsSound.cpp index 4b77484fac8..9d5f373578a 100644 --- a/mozilla/widget/src/gtk/nsSound.cpp +++ b/mozilla/widget/src/gtk/nsSound.cpp @@ -35,6 +35,12 @@ #include #include +#include "nslog.h" + +NS_IMPL_LOG(nsSoundLog, 0) +#define PRINTF NS_LOG_PRINTF(nsSoundLog) +#define FLUSH NS_LOG_FLUSH(nsSoundLog) + /* used with esd_open_sound */ static int esdref = -1; static PRLibrary *elib = nsnull; @@ -124,7 +130,7 @@ NS_IMETHODIMP nsSound::OnStreamComplete(nsIStreamLoader *aLoader, if (uri) { char* uriSpec; uri->GetSpec(&uriSpec); - printf("Failed to load %s\n", uriSpec ? uriSpec : ""); + PRINTF("Failed to load %s\n", uriSpec ? uriSpec : ""); } } } @@ -138,7 +144,7 @@ NS_IMETHODIMP nsSound::OnStreamComplete(nsIStreamLoader *aLoader, if (strncmp(string, "RIFF", 4)) { - printf("We only support WAV files currently.\n"); + PRINTF("We only support WAV files currently.\n"); return NS_ERROR_FAILURE; } @@ -181,7 +187,7 @@ NS_IMETHODIMP nsSound::OnStreamComplete(nsIStreamLoader *aLoader, } #if 0 - printf("f: %d | c: %d | sps: %li | abps: %li | ba: %d | bps: %d | rate: %li\n", + PRINTF("f: %d | c: %d | sps: %li | abps: %li | ba: %d | bps: %d | rate: %li\n", format, channels, samples_per_sec, avg_bytes_per_sec, block_align, bits_per_sample, rate); #endif diff --git a/mozilla/widget/src/gtk/nsTextHelper.cpp b/mozilla/widget/src/gtk/nsTextHelper.cpp index f9a01b5ad70..501c9c305ba 100644 --- a/mozilla/widget/src/gtk/nsTextHelper.cpp +++ b/mozilla/widget/src/gtk/nsTextHelper.cpp @@ -25,6 +25,11 @@ #include "nsTextHelper.h" #include "nsTextWidget.h" #include "nsString.h" +#include "nslog.h" + +NS_IMPL_LOG(nsTextHelperLog, 0) +#define PRINTF NS_LOG_PRINTF(nsTextHelperLog) +#define FLUSH NS_LOG_FLUSH(nsTextHelperLog) NS_IMPL_ADDREF_INHERITED(nsTextHelper, nsWidget) NS_IMPL_RELEASE_INHERITED(nsTextHelper, nsWidget) @@ -194,7 +199,7 @@ NS_IMETHODIMP nsTextHelper::GetSelection(PRUint32 *aStartSel, PRUint32 *aEndSel) *aStartSel = (PRUint32)left; *aEndSel = (PRUint32)right; } else { - printf("nsTextHelper::GetSelection Error getting positions\n"); + PRINTF("nsTextHelper::GetSelection Error getting positions\n"); return NS_ERROR_FAILURE; } #endif diff --git a/mozilla/widget/src/gtk/nsWidget.cpp b/mozilla/widget/src/gtk/nsWidget.cpp index be620263b26..e4dc9b45b65 100644 --- a/mozilla/widget/src/gtk/nsWidget.cpp +++ b/mozilla/widget/src/gtk/nsWidget.cpp @@ -43,6 +43,11 @@ #include "nsIPref.h" #include "nsGtkIMEHelper.h" +#include "nslog.h" + +NS_IMPL_LOG(nsWidgetLog, 0) +#define PRINTF NS_LOG_PRINTF(nsWidgetLog) +#define FLUSH NS_LOG_FLUSH(nsWidgetLog) static NS_DEFINE_CID(kRegionCID, NS_REGION_CID); static NS_DEFINE_CID(kPrefServiceCID, NS_PREF_CID); @@ -322,7 +327,7 @@ nsWidget::~nsWidget() #ifdef NOISY_DESTROY IndentByDepth(stdout); - printf("nsWidget::~nsWidget:%p\n", this); + PRINTF("nsWidget::~nsWidget:%p\n", this); #endif sWidgetCount--; @@ -402,7 +407,7 @@ nsWidget::IndentByDepth(FILE* out) NS_IMETHODIMP nsWidget::Destroy(void) { - // printf("%p nsWidget::Destroy()\n", this); + // PRINTF("%p nsWidget::Destroy()\n", this); // make sure we don't call this more than once. if (mIsDestroying) return NS_OK; @@ -594,7 +599,7 @@ NS_IMETHODIMP nsWidget::Move(PRInt32 aX, PRInt32 aY) NS_IMETHODIMP nsWidget::Resize(PRInt32 aWidth, PRInt32 aHeight, PRBool aRepaint) { #ifdef DEBUG_MOVE - printf("nsWidget::Resize %s (%p) to %d %d\n", + PRINTF("nsWidget::Resize %s (%p) to %d %d\n", (const char *) debug_GetName(mWidget), this, aWidth, aHeight); @@ -663,7 +668,7 @@ PRBool nsWidget::OnResize(nsRect &aRect) PRBool nsWidget::OnMove(PRInt32 aX, PRInt32 aY) { #if 0 - printf("nsWidget::OnMove %s (%p) (%d,%d) -> (%d,%d)\n", + PRINTF("nsWidget::OnMove %s (%p) (%d,%d) -> (%d,%d)\n", (const char *) debug_GetName(mWidget), this, mBounds.x, mBounds.y, aX, aY); #endif @@ -1104,7 +1109,7 @@ NS_IMETHODIMP nsWidget::Update(void) if (!GTK_WIDGET_REALIZED(mWidget) || !GTK_WIDGET_VISIBLE(mWidget)) return NS_ERROR_FAILURE; - // printf("nsWidget::Update()\n"); + // PRINTF("nsWidget::Update()\n"); // this will Union() again, but so what? return InvalidateRegion(mUpdateArea, PR_TRUE); @@ -1520,11 +1525,11 @@ PRBool nsWidget::DispatchMouseEvent(nsMouseEvent& aEvent) // GetBounds(rect); // if (rect.Contains(event.point.x, event.point.y)) { // if (mCurrentWindow == NULL || mCurrentWindow != this) { -// printf("Mouse enter"); +// PRINTF("Mouse enter"); // mCurrentWindow = this; // } // } else { -// printf("Mouse exit"); +// PRINTF("Mouse exit"); // } } break; @@ -1543,7 +1548,7 @@ PRBool nsWidget::DispatchMouseEvent(nsMouseEvent& aEvent) break; case NS_DRAGDROP_DROP: - printf("nsWidget::DispatchMouseEvent, NS_DRAGDROP_DROP\n"); + PRINTF("nsWidget::DispatchMouseEvent, NS_DRAGDROP_DROP\n"); break; default: @@ -2113,7 +2118,7 @@ nsWidget::OnFocusOutSignal(GdkEventFocus * aGdkFocusEvent) /* virtual */ void nsWidget::OnRealize(GtkWidget *aWidget) { - printf("nsWidget::OnRealize(%p)\n",this); + PRINTF("nsWidget::OnRealize(%p)\n",this); } ////////////////////////////////////////////////////////////////////// @@ -2190,7 +2195,7 @@ nsWidget::DropEvent(GtkWidget * aWidget, { GtkLayout * layout = GTK_LAYOUT(aWidget); - printf("%4d DropEvent(this=%p,widget=%p,event_win=%p,wid_win=%p,bin_win=%p)\n", + PRINTF("%4d DropEvent(this=%p,widget=%p,event_win=%p,wid_win=%p,bin_win=%p)\n", count++, this, aWidget, @@ -2200,7 +2205,7 @@ nsWidget::DropEvent(GtkWidget * aWidget, } else { - printf("%4d DropEvent(this=%p,widget=%p,event_win=%p,wid_win=%p)\n", + PRINTF("%4d DropEvent(this=%p,widget=%p,event_win=%p,wid_win=%p)\n", count++, this, aWidget, @@ -2221,7 +2226,7 @@ nsWidget::DropEvent(GtkWidget * aWidget, if (aEventWindow != layout->bin_window) { #ifdef DEBUG_pavlov - printf("dropping event!!!!!!!\n"); + PRINTF("dropping event!!!!!!!\n"); #endif return PR_TRUE; } @@ -2308,7 +2313,7 @@ nsWidget::ButtonPressSignal(GtkWidget * aWidget, GdkEventButton * aGdkButtonEvent, gpointer aData) { - // printf("nsWidget::ButtonPressSignal(%p)\n",aData); + // PRINTF("nsWidget::ButtonPressSignal(%p)\n",aData); NS_ASSERTION( nsnull != aWidget, "widget is null"); NS_ASSERTION( nsnull != aGdkButtonEvent, "event is null"); @@ -2332,7 +2337,7 @@ nsWidget::ButtonReleaseSignal(GtkWidget * aWidget, GdkEventButton * aGdkButtonEvent, gpointer aData) { - // printf("nsWidget::ButtonReleaseSignal(%p)\n",aData); + // PRINTF("nsWidget::ButtonReleaseSignal(%p)\n",aData); NS_ASSERTION( nsnull != aWidget, "widget is null"); NS_ASSERTION( nsnull != aGdkButtonEvent, "event is null"); @@ -2371,7 +2376,7 @@ nsWidget::FocusInSignal(GtkWidget * aWidget, GdkEventFocus * aGdkFocusEvent, gpointer aData) { - // printf("nsWidget::ButtonReleaseSignal(%p)\n",aData); + // PRINTF("nsWidget::ButtonReleaseSignal(%p)\n",aData); NS_ASSERTION( nsnull != aWidget, "widget is null"); NS_ASSERTION( nsnull != aGdkFocusEvent, "event is null"); @@ -2398,7 +2403,7 @@ nsWidget::FocusOutSignal(GtkWidget * aWidget, GdkEventFocus * aGdkFocusEvent, gpointer aData) { - // printf("nsWidget::ButtonReleaseSignal(%p)\n",aData); + // PRINTF("nsWidget::ButtonReleaseSignal(%p)\n",aData); NS_ASSERTION( nsnull != aWidget, "widget is null"); NS_ASSERTION( nsnull != aGdkFocusEvent, "event is null"); @@ -2775,7 +2780,7 @@ static void setDebugWindow(void) sscanf(&text[2], "%x", &val); - printf("setting value to 0x%x\n", val); + PRINTF("setting value to 0x%x\n", val); nsWidget::debugWidget = (nsWidget *)val; g_free(text); diff --git a/mozilla/widget/src/gtk/nsWindow.cpp b/mozilla/widget/src/gtk/nsWindow.cpp index d6c60584e5b..8b68df01260 100644 --- a/mozilla/widget/src/gtk/nsWindow.cpp +++ b/mozilla/widget/src/gtk/nsWindow.cpp @@ -58,6 +58,11 @@ #include "nsIDragSessionGTK.h" #include +#include "nslog.h" + +NS_IMPL_LOG(nsWindowLog, 0) +#define PRINTF NS_LOG_PRINTF(nsWindowLog) +#define FLUSH NS_LOG_FLUSH(nsWindowLog) #ifdef NEED_USLEEP_PROTOTYPE extern "C" int usleep(unsigned int); @@ -181,7 +186,7 @@ nsWindow::~nsWindow() // make sure to unset any drag motion timers here. ResetDragMotionTimer(0, 0, 0, 0, 0); - // printf("%p nsWindow::~nsWindow\n", this); + // PRINTF("%p nsWindow::~nsWindow\n", this); // make sure that we release the grab indicator here if (sGrabWindow == this) { sIsGrabbing = PR_FALSE; @@ -843,7 +848,7 @@ void nsWindow::NativeGrab(PRBool aGrab) GDK_POINTER_MOTION_MASK), (GdkWindow*)NULL, cursor, GDK_CURRENT_TIME); #ifdef DEBUG_GRAB - printf("nsWindow::NativeGrab %p pointer_grab %d\n", this, retval); + PRINTF("nsWindow::NativeGrab %p pointer_grab %d\n", this, retval); #endif // check and set our flag if the grab failed if (retval != 0) @@ -851,7 +856,7 @@ void nsWindow::NativeGrab(PRBool aGrab) retval = gdk_keyboard_grab(mSuperWin->bin_window, PR_TRUE, GDK_CURRENT_TIME); #ifdef DEBUG_GRAB - printf("nsWindow::NativeGrab %p keyboard_grab %d\n", this, retval); + PRINTF("nsWindow::NativeGrab %p keyboard_grab %d\n", this, retval); #endif // check and set our flag if the grab failed if (retval != 0) @@ -860,7 +865,7 @@ void nsWindow::NativeGrab(PRBool aGrab) gdk_cursor_destroy(cursor); } else { #ifdef DEBUG_GRAB - printf("nsWindow::NativeGrab %p ungrab\n", this); + PRINTF("nsWindow::NativeGrab %p ungrab\n", this); #endif gdk_keyboard_ungrab(GDK_CURRENT_TIME); gdk_pointer_ungrab(GDK_CURRENT_TIME); @@ -1067,13 +1072,13 @@ NS_IMETHODIMP nsWindow::SetFocus(void) { #ifdef DEBUG_FOCUS - printf("nsWindow::SetFocus %p\n", this); + PRINTF("nsWindow::SetFocus %p\n", this); #endif /* DEBUG_FOCUS */ if (mHasFocus) { #ifdef DEBUG_FOCUS - printf("Already have focus.\n"); + PRINTF("Already have focus.\n"); #endif /* DEBUG_FOCUS */ return NS_OK; } @@ -1087,7 +1092,7 @@ nsWindow::SetFocus(void) nsWindow *mozAreaWindow = (nsWindow *)gtk_object_get_data(GTK_OBJECT(top_mozarea), "nsWindow"); mozAreaWindow->mBlockMozAreaFocusIn = PR_TRUE; #ifdef DEBUG_FOCUS - printf("mozarea grabbing focus!\n"); + PRINTF("mozarea grabbing focus!\n"); #endif gtk_widget_grab_focus(top_mozarea); // this will show the window if it's minimized and bring it to @@ -1126,7 +1131,7 @@ nsWindow::SetFocus(void) void nsWindow::DispatchSetFocusEvent(void) { #ifdef DEBUG_FOCUS - printf("nsWindow::DispatchSetFocusEvent %p\n", this); + PRINTF("nsWindow::DispatchSetFocusEvent %p\n", this); #endif /* DEBUG_FOCUS */ nsGUIEvent event; @@ -1148,7 +1153,7 @@ void nsWindow::DispatchLostFocusEvent(void) { #ifdef DEBUG_FOCUS - printf("nsWindow::DispatchLostFocusEvent %p\n", this); + PRINTF("nsWindow::DispatchLostFocusEvent %p\n", this); #endif /* DEBUG_FOCUS */ nsGUIEvent event; @@ -1171,7 +1176,7 @@ void nsWindow::DispatchLostFocusEvent(void) void nsWindow::DispatchActivateEvent(void) { #ifdef DEBUG_FOCUS - printf("nsWindow::DispatchActivateEvent %p\n", this); + PRINTF("nsWindow::DispatchActivateEvent %p\n", this); #endif if(!gJustGotDeactivate) @@ -1205,7 +1210,7 @@ void nsWindow::DispatchActivateEvent(void) void nsWindow::DispatchDeactivateEvent(void) { #ifdef DEBUG_FOCUS - printf("nsWindow::DispatchDeactivateEvent %p\n", this); + PRINTF("nsWindow::DispatchDeactivateEvent %p\n", this); #endif #ifdef USE_XIM IMEBeingActivate(PR_TRUE); @@ -1249,7 +1254,7 @@ void nsWindow::HandleMozAreaFocusIn(void) return; // otherwise, dispatch our focus events #ifdef DEBUG_FOCUS - printf("nsWindow::HandleMozAreaFocusIn %p\n", this); + PRINTF("nsWindow::HandleMozAreaFocusIn %p\n", this); #endif /* DEBUG_FOCUS */ gJustGotActivate = PR_TRUE; DispatchSetFocusEvent(); @@ -1271,7 +1276,7 @@ void nsWindow::HandleMozAreaFocusOut(void) // otherwise handle our focus out here. #ifdef DEBUG_FOCUS - printf("nsWindow::HandleMozAreaFocusOut %p\n", this); + PRINTF("nsWindow::HandleMozAreaFocusOut %p\n", this); #endif /* DEBUG_FOCUS */ // if there's a window with focus, send a focus out event for that // window. @@ -1300,7 +1305,7 @@ nsWindow::OnFocusInSignal(GdkEventFocus * aGdkFocusEvent) nsGUIEvent event; - printf("send NS_GOTFOCUS from nsWindow::OnFocusInSignal\n"); + PRINTF("send NS_GOTFOCUS from nsWindow::OnFocusInSignal\n"); event.message = NS_GOTFOCUS; event.widget = this; @@ -1597,7 +1602,7 @@ gint nsWindow::ConvertBorderStyles(nsBorderStyle bs) if (bs & eBorderStyle_maximize) w |= GDK_DECOR_MAXIMIZE; if (bs & eBorderStyle_close) - printf("we don't handle eBorderStyle_close yet... please fix me\n"); + PRINTF("we don't handle eBorderStyle_close yet... please fix me\n"); return w; } @@ -2232,7 +2237,7 @@ PRBool nsWindow::OnExpose(nsPaintEvent &event) { event.renderingContext = nsnull; - // printf("nsWindow::OnExpose\n"); + // PRINTF("nsWindow::OnExpose\n"); // expose.. we didn't get an Invalidate, so we should up the count here mUpdateArea->Union(event.rect->x, event.rect->y, event.rect->width, event.rect->height); @@ -2274,11 +2279,11 @@ PRBool nsWindow::OnDraw(nsPaintEvent &event) // NS_ADDREF(mUpdateArea); // event.region = mUpdateArea; - // printf("\n\n"); + // PRINTF("\n\n"); PRInt32 x, y, w, h; mUpdateArea->GetBoundingBox(&x,&y,&w,&h); - // printf("should be painting x = %i , y = %i , w = %i , h = %i\n", x, y, w, h); - // printf("\n\n"); + // PRINTF("should be painting x = %i , y = %i , w = %i , h = %i\n", x, y, w, h); + // PRINTF("\n\n"); event.rect->x = x; event.rect->y = y; event.rect->width = w; @@ -2286,7 +2291,7 @@ PRBool nsWindow::OnDraw(nsPaintEvent &event) if (event.rect->width == 0 || event.rect->height == 0) { - // printf("ignoring paint for 0x0\n"); + // PRINTF("ignoring paint for 0x0\n"); return NS_OK; } @@ -2481,7 +2486,7 @@ NS_IMETHODIMP nsWindow::Move(PRInt32 aX, PRInt32 aY) PRInt32 screenHeight = gdk_screen_height(); // no annoying assertions. just mention the issue. if (aX < 0 || aX >= screenWidth || aY < 0 || aY >= screenHeight) - printf("window moved to offscreen position\n"); + PRINTF("window moved to offscreen position\n"); #endif // do it the way it should be done period. @@ -2509,7 +2514,7 @@ NS_IMETHODIMP nsWindow::Resize(PRInt32 aWidth, PRInt32 aHeight, PRBool aRepaint) PRInt32 sizeWidth = aWidth; #if 0 - printf("nsWindow::Resize %s (%p) to %d %d\n", + PRINTF("nsWindow::Resize %s (%p) to %d %d\n", (const char *) debug_GetName(mWidget), this, aWidth, aHeight); @@ -2676,7 +2681,7 @@ gint handle_toplevel_focus_in(GtkWidget * aWidget, return PR_TRUE; #ifdef DEBUG_FOCUS - printf("handle_toplevel_focus_in %p\n", widget); + PRINTF("handle_toplevel_focus_in %p\n", widget); #endif /* DEBUG_FOCUS */ window = GTK_WINDOW(aWidget); @@ -2708,7 +2713,7 @@ gint handle_toplevel_focus_out(GtkWidget * aWidget, return PR_TRUE; #ifdef DEBUG_FOCUS - printf("handle_toplevel_focus_out %p\n", widget); + PRINTF("handle_toplevel_focus_out %p\n", widget); #endif // addref the widget here since we might send > 1 event to it. @@ -2751,7 +2756,7 @@ gint handle_mozarea_focus_in(GtkWidget * aWidget, return PR_TRUE; #ifdef DEBUG_FOCUS - printf("handle_mozarea_focus_in\n"); + PRINTF("handle_mozarea_focus_in\n"); #endif // make sure that we set our focus flag @@ -2767,7 +2772,7 @@ gint handle_mozarea_focus_out(GtkWidget * aWidget, gpointer aData) { #ifdef DEBUG_FOCUS - printf("handle_mozarea_focus_out\n"); + PRINTF("handle_mozarea_focus_out\n"); #endif if (!aWidget) { @@ -2994,7 +2999,7 @@ nsWindow::DrawSignal(GtkWidget * /* aWidget */, /* virtual */ gint nsWindow::OnDrawSignal(GdkRectangle * aArea) { - //printf("nsWindow::OnDrawSignal()\n"); + //PRINTF("nsWindow::OnDrawSignal()\n"); nsPaintEvent pevent; @@ -3460,7 +3465,7 @@ ChildWindow::~ChildWindow() { #ifdef NOISY_DESTROY IndentByDepth(stdout); - printf("ChildWindow::~ChildWindow:%p\n", this); + PRINTF("ChildWindow::~ChildWindow:%p\n", this); #endif } diff --git a/mozilla/widget/src/gtkxtbin/gtkxtbin.c b/mozilla/widget/src/gtkxtbin/gtkxtbin.c index 558d073b3ca..b0908671c00 100644 --- a/mozilla/widget/src/gtkxtbin/gtkxtbin.c +++ b/mozilla/widget/src/gtkxtbin/gtkxtbin.c @@ -41,6 +41,12 @@ #include #include +#include "nslog.h" + +NS_IMPL_LOG(gtkxtbinLog, 0) +#define PRINTF NS_LOG_PRINTF(gtkxtbinLog) +#define FLUSH NS_LOG_FLUSH(gtkxtbinLog) + static void gtk_xtbin_class_init (GtkXtBinClass *klass); static void gtk_xtbin_init (GtkXtBin *xtbin); static void gtk_xtbin_realize (GtkWidget *widget); @@ -189,7 +195,7 @@ gtk_xtbin_init (GtkXtBin *xtbin) int cnumber; #ifdef DEBUG_XTBIN - printf("starting up Xt stuff\n"); + PRINTF("starting up Xt stuff\n"); #endif /* * Initialize Xt stuff @@ -341,7 +347,7 @@ gtk_xtbin_realize (GtkWidget *widget) XtRealizeWidget(embeded); #ifdef DEBUG_XTBIN - printf("embeded window = %li\n", XtWindow(embeded)); + PRINTF("embeded window = %li\n", XtWindow(embeded)); #endif XtManageChild(embeded); @@ -393,7 +399,7 @@ gtk_xtbin_shutdown (GtkObject *object) GtkWidget *widget; #ifdef DEBUG_XTBIN - printf("gtk_xtbin_shutdown()\n"); + PRINTF("gtk_xtbin_shutdown()\n"); #endif /* gtk_object_destroy() will already hold a refcount on object @@ -429,7 +435,7 @@ gtk_xtbin_destroy (GtkObject *object) GtkXtBin *xtbin; #ifdef DEBUG_XTBIN - printf("gtk_xtbin_destroy()\n"); + PRINTF("gtk_xtbin_destroy()\n"); #endif g_return_if_fail (object != NULL); @@ -447,7 +453,7 @@ gtk_xtbin_destroy (GtkObject *object) XtAppContext ac; #ifdef DEBUG_XTBIN - printf("shutting down Xt stuff\n"); + PRINTF("shutting down Xt stuff\n"); #endif /* @@ -477,7 +483,7 @@ gtk_xtbin_show (GtkWidget *widget) g_return_if_fail (GTK_IS_WIDGET (widget)); #ifdef DEBUG_XTBIN - printf("gtk_xtbin_show()\n"); + PRINTF("gtk_xtbin_show()\n"); #endif if (!GTK_WIDGET_VISIBLE (widget)) diff --git a/mozilla/widget/src/mac/nsClipboard.cpp b/mozilla/widget/src/mac/nsClipboard.cpp index 90abc565bbf..7aba78ca422 100644 --- a/mozilla/widget/src/mac/nsClipboard.cpp +++ b/mozilla/widget/src/mac/nsClipboard.cpp @@ -46,6 +46,11 @@ #include "nsMemory.h" #include +#include "nslog.h" + +NS_IMPL_LOG(nsClipboardLog, 0) +#define PRINTF NS_LOG_PRINTF(nsClipboardLog) +#define FLUSH NS_LOG_FLUSH(nsClipboardLog) // @@ -126,7 +131,7 @@ nsClipboard :: SetNativeClipboardData ( PRInt32 aWhichClipboard ) errCode = mTransferable->GetTransferData ( flavorStr, getter_AddRefs(genericDataWrapper), &dataSize ); nsPrimitiveHelpers::CreateDataFromPrimitive ( flavorStr, genericDataWrapper, &data, dataSize ); #ifdef NS_DEBUG - if ( NS_FAILED(errCode) ) printf("nsClipboard:: Error getting data from transferable\n"); + if ( NS_FAILED(errCode) ) PRINTF("nsClipboard:: Error getting data from transferable\n"); #endif // stash on clipboard @@ -273,7 +278,7 @@ nsClipboard :: GetNativeClipboardData ( nsITransferable * aTransferable, PRInt32 nsPrimitiveHelpers::CreatePrimitiveForData ( flavorStr, clipboardData, dataSize, getter_AddRefs(genericDataWrapper) ); errCode = aTransferable->SetTransferData ( flavorStr, genericDataWrapper, dataSize ); #ifdef NS_DEBUG - if ( errCode != NS_OK ) printf("nsClipboard:: Error setting data into transferable\n"); + if ( errCode != NS_OK ) PRINTF("nsClipboard:: Error setting data into transferable\n"); #endif nsMemory::Free ( clipboardData ); @@ -324,7 +329,7 @@ nsClipboard :: GetDataOffClipboard ( ResType inMacFlavor, void** outData, PRInt3 // put it into the transferable #ifdef NS_DEBUG - if ( err != NS_OK ) printf("nsClipboard:: Error setting data into transferable\n"); + if ( err != NS_OK ) PRINTF("nsClipboard:: Error setting data into transferable\n"); #endif if ( outDataSize ) @@ -354,7 +359,7 @@ nsClipboard :: GetDataOffClipboard ( ResType inMacFlavor, void** outData, PRInt3 } else { #ifdef NS_DEBUG - printf("nsClipboard: Error getting data off the clipboard, #%d\n", dataSize); + PRINTF("nsClipboard: Error getting data off the clipboard, #%d\n", dataSize); #endif return NS_ERROR_FAILURE; } diff --git a/mozilla/widget/src/mac/nsContextMenu.cpp b/mozilla/widget/src/mac/nsContextMenu.cpp index 9c19971c124..67cdb14011f 100644 --- a/mozilla/widget/src/mac/nsContextMenu.cpp +++ b/mozilla/widget/src/mac/nsContextMenu.cpp @@ -39,6 +39,11 @@ #include #include #include +#include "nslog.h" + +NS_IMPL_LOG(nsContextMenuLog, 0) +#define PRINTF NS_LOG_PRINTF(nsContextMenuLog) +#define FLUSH NS_LOG_FLUSH(nsContextMenuLog) // CIDs #include "nsWidgetsCID.h" @@ -575,7 +580,7 @@ void nsContextMenu::LoadSubMenu( { nsString menuName; menuElement->GetAttribute(NS_ConvertASCIItoUCS2("value"), menuName); - //printf("Creating Menu [%s] \n", menuName.ToNewCString()); // this leaks + //PRINTF("Creating Menu [%s] \n", menuName.ToNewCString()); // this leaks // Create nsMenu nsIMenu * pnsMenu = nsnull; diff --git a/mozilla/widget/src/mac/nsDragService.cpp b/mozilla/widget/src/mac/nsDragService.cpp index 4ab32607716..e2f194d0e43 100644 --- a/mozilla/widget/src/mac/nsDragService.cpp +++ b/mozilla/widget/src/mac/nsDragService.cpp @@ -60,6 +60,11 @@ #include "nsIXULContent.h" #include "nsIDOMElement.h" +#include "nslog.h" + +NS_IMPL_LOG(nsDragServiceLog, 0) +#define PRINTF NS_LOG_PRINTF(nsDragServiceLog) +#define FLUSH NS_LOG_FLUSH(nsDragServiceLog) #if !TARGET_CARBON DragSendDataUPP nsDragService::sDragSendDataUPP = NewDragSendDataProc(DragSendDataProc); @@ -202,7 +207,7 @@ nsDragService :: InvokeDragSession (nsIDOMNode *aDOMNode, nsISupportsArray * aTr return NS_ERROR_FAILURE; mDragRef = theDragRef; #if DEBUG_DD -printf("**** created drag ref %ld\n", theDragRef); + PRINTF("**** created drag ref %ld\n", theDragRef); #endif // add the flavors from the transferables. Cache this array for the send data proc @@ -265,7 +270,7 @@ printf("**** created drag ref %ld\n", theDragRef); ::DisposeRgn ( theDragRgn ); result = ::DisposeDrag ( theDragRef ); #if DEBUG_DD -printf("**** disposing drag ref %ld\n", theDragRef); + PRINTF("**** disposing drag ref %ld\n", theDragRef); #endif NS_ASSERTION ( result == noErr, "Error disposing drag" ); mDragRef = 0L; @@ -442,7 +447,7 @@ nsDragService :: GetData ( nsITransferable * aTransferable, PRUint32 aItemIndex currentFlavor->ToString ( getter_Copies(flavorStr) ); FlavorType macOSFlavor = theMapper.MapMimeTypeToMacOSType(flavorStr, PR_FALSE); #if DEBUG_DD -printf("looking for data in type %s, mac flavor %ld\n", NS_STATIC_CAST(const char*,flavorStr), macOSFlavor); + PRINTF("looking for data in type %s, mac flavor %ld\n", NS_STATIC_CAST(const char*,flavorStr), macOSFlavor); #endif // check if it is present in the current drag item. @@ -499,7 +504,7 @@ printf("looking for data in type %s, mac flavor %ld\n", NS_STATIC_CAST(const cha // put it into the transferable. errCode = aTransferable->SetTransferData ( flavorStr, genericDataWrapper, dataSize ); #ifdef NS_DEBUG - if ( errCode != NS_OK ) printf("nsDragService:: Error setting data into transferable\n"); + if ( errCode != NS_OK ) PRINTF("nsDragService:: Error setting data into transferable\n"); #endif nsMemory::Free ( dataBuff ); @@ -749,7 +754,7 @@ nsDragService :: LookupMimeMappingsForItem ( DragReference inDragRef, ItemRefere err = ::GetFlavorData ( inDragRef, itemRef, nsMimeMapperMac::MappingFlavor(), mapperData, &mapperSize, 0 ); if ( err ) { #ifdef NS_DEBUG - printf("nsDragService: Error getting data out of drag manager for mime mapper, #%ld\n", err); + PRINTF("nsDragService: Error getting data out of drag manager for mime mapper, #%ld\n", err); #endif return nsnull; } @@ -785,7 +790,7 @@ nsDragService :: ExtractDataFromOS ( DragReference inDragRef, ItemReference inIt err = ::GetFlavorData ( inDragRef, inItemRef, inFlavor, buff, &buffSize, 0 ); if ( err ) { #ifdef NS_DEBUG - printf("nsDragService: Error getting data out of drag manager, #%ld\n", err); + PRINTF("nsDragService: Error getting data out of drag manager, #%ld\n", err); #endif retval = NS_ERROR_FAILURE; } diff --git a/mozilla/widget/src/mac/nsDynamicMDEF.cpp b/mozilla/widget/src/mac/nsDynamicMDEF.cpp index 0a6edd07339..d7ca6a2a6bb 100644 --- a/mozilla/widget/src/mac/nsDynamicMDEF.cpp +++ b/mozilla/widget/src/mac/nsDynamicMDEF.cpp @@ -31,6 +31,11 @@ #include #include #include +#include "nslog.h" + +NS_IMPL_LOG(nsDynamicMDEFLog, 0) +#define PRINTF NS_LOG_PRINTF(nsDynamicMDEFLog) +#define FLUSH NS_LOG_FLUSH(nsDynamicMDEFLog) extern nsWeakPtr gMacMenubar; extern Handle gSystemMDEFHandle; @@ -183,11 +188,11 @@ pascal void nsDynamicMDEFMain( { switch (message) { case kMenuDrawMsg: - //printf(" Draw passed in menu is = %d \n", *theMenu); - //printf(" t= %d l= %d b= %d r= %d\n", (*menuRect).top, (*menuRect).left, (*menuRect).bottom, (*menuRect).right); - //printf(" Point.v = %d Point.h = %d\n", hitPt.v, hitPt.h); - //printf(" whichItem = %d \n", *whichItem); - //printf(" theMenu.menuID = %d \n", (**theMenu).menuID); + //PRINTF(" Draw passed in menu is = %d \n", *theMenu); + //PRINTF(" t= %d l= %d b= %d r= %d\n", (*menuRect).top, (*menuRect).left, (*menuRect).bottom, (*menuRect).right); + //PRINTF(" Point.v = %d Point.h = %d\n", hitPt.v, hitPt.h); + //PRINTF(" whichItem = %d \n", *whichItem); + //PRINTF(" theMenu.menuID = %d \n", (**theMenu).menuID); nsCheckDestroy(theMenu, whichItem); break; @@ -199,11 +204,11 @@ pascal void nsDynamicMDEFMain( break; case kMenuSizeMsg: - //printf("Size passed in menu is = %d \n", *theMenu); - //printf(" t= %d l= %d b= %d r= %d \n", (*menuRect).top, (*menuRect).left, (*menuRect).bottom ,(*menuRect).right); - //printf(" Point.v = %d Point.h = %d \n", hitPt.v, hitPt.h); - //printf(" whichItem = %d \n", *whichItem); - //printf(" theMenu.menuID = %d \n", (**theMenu).menuID); + //PRINTF("Size passed in menu is = %d \n", *theMenu); + //PRINTF(" t= %d l= %d b= %d r= %d \n", (*menuRect).top, (*menuRect).left, (*menuRect).bottom ,(*menuRect).right); + //PRINTF(" Point.v = %d Point.h = %d \n", hitPt.v, hitPt.h); + //PRINTF(" whichItem = %d \n", *whichItem); + //PRINTF(" theMenu.menuID = %d \n", (**theMenu).menuID); nsCheckDestroy(theMenu, whichItem); @@ -215,8 +220,8 @@ pascal void nsDynamicMDEFMain( // nsIMenu * menu = (nsIMenu *) gPreviousMenuStack[gPreviousMenuStack.Count() - 1]; MenuHandle menuHandle = (MenuHandle) gPreviousMenuHandleStack[gPreviousMenuHandleStack.Count() - 1]; - //printf(" gPreviousMenuStack.Count() = %d \n", gPreviousMenuStack.Count()); - //printf(" gPreviousMenuHandleStack.Count() = %d \n", gPreviousMenuHandleStack.Count()); + //PRINTF(" gPreviousMenuStack.Count() = %d \n", gPreviousMenuStack.Count()); + //PRINTF(" gPreviousMenuHandleStack.Count() = %d \n", gPreviousMenuHandleStack.Count()); if( menu && menuHandle ) { @@ -224,7 +229,7 @@ pascal void nsDynamicMDEFMain( nsCOMPtr listener(do_QueryInterface(menu)); if(listener) { - //printf("MenuPop \n"); + //PRINTF("MenuPop \n"); nsMenuEvent mevent; mevent.message = NS_MENU_SELECTED; @@ -242,7 +247,7 @@ pascal void nsDynamicMDEFMain( gPreviousMenuStack.RemoveMenuAt(gPreviousMenuStack.Count() - 1); //NS_IF_RELEASE(menu); - //printf("%d items now on gPreviousMenuStack \n", gPreviousMenuStack.Count()); + //PRINTF("%d items now on gPreviousMenuStack \n", gPreviousMenuStack.Count()); gPreviousMenuHandleStack.RemoveElementAt(gPreviousMenuHandleStack.Count() - 1); } @@ -300,24 +305,24 @@ void nsDynamicChooseItem( Point hitPt, short * whichItem) { - //printf("enter DynamicChooseItem \n"); + //PRINTF("enter DynamicChooseItem \n"); nsCallSystemMDEF(kMenuChooseMsg, theMenu, menuRect, hitPt, whichItem); nsCheckDestroy(theMenu, whichItem); gCurrentMenuItem = *whichItem; - //printf("exit DynamicChooseItem \n"); + //PRINTF("exit DynamicChooseItem \n"); } //------------------------------------------------------------------------------ void nsDynamicSizeTheMenu( MenuHandle theMenu) { - //printf("enter DynamicSizeTheMenu \n"); + //PRINTF("enter DynamicSizeTheMenu \n"); nsDoMagic(theMenu); - //printf("exit DynamicSizeTheMenu \n"); + //PRINTF("exit DynamicSizeTheMenu \n"); } //------------------------------------------------------------------------------ @@ -338,7 +343,7 @@ bool nsIsHierChild(MenuHandle theMenu) //------------------------------------------------------------------------------ void nsDoMagic(MenuHandle theMenu) { - //printf("DoMagic \n"); + //PRINTF("DoMagic \n"); // ask if this is a child of the previous menu PRBool isChild = PR_FALSE; @@ -369,7 +374,7 @@ void nsDoMagic(MenuHandle theMenu) //------------------------------------------------------------------------------ void nsBuildMenu(MenuHandle theMenu, PRBool isChild) { - // printf("enter BuildMenu \n"); + // PRINTF("enter BuildMenu \n"); nsCOMPtr menubar = do_QueryReferent(gMacMenubar); if (!menubar || !theMenu) { return; @@ -405,7 +410,7 @@ void nsBuildMenu(MenuHandle theMenu, PRBool isChild) gPreviousTopLevelMenu = menu; gPreviousMenuBar = getter_AddRefs(NS_GetWeakReference(menubar)); - //printf("exit BuildMenu \n"); + //PRINTF("exit BuildMenu \n"); return; } } @@ -415,7 +420,7 @@ void nsBuildMenu(MenuHandle theMenu, PRBool isChild) // Not top level, so we can't use recursive MenuSelect // We must use the previously chosen menu item in combination // with the current menu to determine what menu needs to be constructed - //printf("gCurrentMenuItem = %d \n", gCurrentMenuItem); + //PRINTF("gCurrentMenuItem = %d \n", gCurrentMenuItem); if (gCurrentMenuItem){ if (gPreviousMenuStack.Count() > 0) { @@ -423,7 +428,7 @@ void nsBuildMenu(MenuHandle theMenu, PRBool isChild) gPreviousMenuStack.GetMenuAt(gPreviousMenuStack.Count() - 1, getter_AddRefs(prevMenu)); //nsIMenu * prevMenu = (nsIMenu *) gPreviousMenuStack[gPreviousMenuStack.Count() - 1]; - //printf("gPreviousMenuStack.Count() = %d \n", gPreviousMenuStack.Count() ); + //PRINTF("gPreviousMenuStack.Count() = %d \n", gPreviousMenuStack.Count() ); if(prevMenu) { @@ -440,7 +445,7 @@ void nsBuildMenu(MenuHandle theMenu, PRBool isChild) } } } - //printf("exit BuildMenu \n"); + //PRINTF("exit BuildMenu \n"); } //------------------------------------------------------------------------------ @@ -451,7 +456,7 @@ void nsPostBuild(nsIMenu * menu, MenuHandle theMenu, PRBool isChild) { nsPushMenu(menu); nsPushMenuHandle(theMenu); - //printf("Push: %d items in gMenuHandleStack \n", gMenuHandleStack.Count()); + //PRINTF("Push: %d items in gMenuHandleStack \n", gMenuHandleStack.Count()); } } @@ -506,8 +511,8 @@ void nsPreviousMenuStackUnwind(nsIMenu * aMenuJustBuilt, MenuHandle aMenuHandleJ { //PRBool shouldReleaseMenubar = PR_FALSE; - //printf("PreviousMenuStackUnwind called \n"); - //printf("%d items on gPreviousMenuStack \n", gPreviousMenuStack.Count()); + //PRINTF("PreviousMenuStackUnwind called \n"); + //PRINTF("%d items on gPreviousMenuStack \n", gPreviousMenuStack.Count()); while (gPreviousMenuHandleStack.Count()) { nsCOMPtr menu; // = (nsIMenu *) gPreviousMenuStack[gPreviousMenuStack.Count() - 1]; @@ -518,8 +523,8 @@ void nsPreviousMenuStackUnwind(nsIMenu * aMenuJustBuilt, MenuHandle aMenuHandleJ if (menu) { - //printf(" gPreviousMenuStack.Count() = %d \n", gPreviousMenuStack.Count()); - //printf(" gPreviousMenuHandleStack.Count() = %d \n", gPreviousMenuHandleStack.Count()); + //PRINTF(" gPreviousMenuStack.Count() = %d \n", gPreviousMenuStack.Count()); + //PRINTF(" gPreviousMenuHandleStack.Count() = %d \n", gPreviousMenuHandleStack.Count()); if( menuHandle ) { @@ -543,13 +548,13 @@ void nsPreviousMenuStackUnwind(nsIMenu * aMenuJustBuilt, MenuHandle aMenuHandleJ // NS_IF_RELEASE(menu); //shouldReleaseMenubar = PR_TRUE; - //printf("%d items now on gPreviousMenuStack \n", gPreviousMenuStack.Count()); + //PRINTF("%d items now on gPreviousMenuStack \n", gPreviousMenuStack.Count()); gPreviousMenuHandleStack.RemoveElementAt(gPreviousMenuHandleStack.Count() - 1); } } else { - //printf(" gPreviousMenuStack.Count() = %d \n", gPreviousMenuStack.Count()); - //printf(" gPreviousMenuHandleStack.Count() = %d \n", gPreviousMenuHandleStack.Count()); + //PRINTF(" gPreviousMenuStack.Count() = %d \n", gPreviousMenuStack.Count()); + //PRINTF(" gPreviousMenuHandleStack.Count() = %d \n", gPreviousMenuHandleStack.Count()); // we are the aMenuHandleJustBuilt return; @@ -571,8 +576,8 @@ void nsPreviousMenuStackUnwind(nsIMenu * aMenuJustBuilt, MenuHandle aMenuHandleJ //if ( shouldReleaseMenubar ) // gPreviousMenuBar = nsnull; - //printf(" gPreviousMenuStack.Count() = %d \n", gPreviousMenuStack.Count()); - //printf(" gPreviousMenuHandleStack.Count() = %d \n", gPreviousMenuHandleStack.Count()); + //PRINTF(" gPreviousMenuStack.Count() = %d \n", gPreviousMenuStack.Count()); + //PRINTF(" gPreviousMenuHandleStack.Count() = %d \n", gPreviousMenuHandleStack.Count()); } //------------------------------------------------------------------------------ diff --git a/mozilla/widget/src/mac/nsDynamicMDEF.h b/mozilla/widget/src/mac/nsDynamicMDEF.h index 16e7f59dedb..e4f6ff9e473 100644 --- a/mozilla/widget/src/mac/nsDynamicMDEF.h +++ b/mozilla/widget/src/mac/nsDynamicMDEF.h @@ -29,6 +29,11 @@ #include "nsIMenu.h" #include +#include "nslog.h" + +NS_IMPL_LOG(nsDynamicMDEFLog, 0) +#define PRINTF NS_LOG_PRINTF(nsDynamicMDEFLog) +#define FLUSH NS_LOG_FLUSH(nsDynamicMDEFLog) pascal void nsDynamicMDEFMain( short message, @@ -54,7 +59,7 @@ public: ~nsInstanceCounter() { - printf("%s %ld\n", mDescription, mInstanceCount); + PRINTF("%s %ld\n", mDescription, mInstanceCount); } nsInstanceCounter& operator ++() // prefix @@ -107,4 +112,4 @@ protected: -#endif nsDynamicMDEF_h__ \ No newline at end of file +#endif nsDynamicMDEF_h__ diff --git a/mozilla/widget/src/mac/nsMacEventHandler.cpp b/mozilla/widget/src/mac/nsMacEventHandler.cpp index 28e249f68a0..2fa3876510e 100644 --- a/mozilla/widget/src/mac/nsMacEventHandler.cpp +++ b/mozilla/widget/src/mac/nsMacEventHandler.cpp @@ -39,6 +39,11 @@ #ifndef RHAPSODY #include #endif +#include "nslog.h" + +NS_IMPL_LOG(nsMacEventHandlerLog, 0) +#define PRINTF NS_LOG_PRINTF(nsMacEventHandlerLog) +#define FLUSH NS_LOG_FLUSH(nsMacEventHandlerLog) //#define DEBUG_TSM extern nsIRollupListener * gRollupListener; @@ -149,7 +154,7 @@ void nsMacEventDispatchHandler::SetFocus(nsWindow *aFocusedWidget) { mActiveWidget->ResetInputState(); mActiveWidget->RemoveDeleteObserver(this); - //printf("nsMacEventDispatcher::SetFocus sends NS_LOSTFOCUS\n"); + //PRINTF("nsMacEventDispatcher::SetFocus sends NS_LOSTFOCUS\n"); DispatchGuiEvent(mActiveWidget, NS_LOSTFOCUS); } @@ -159,7 +164,7 @@ void nsMacEventDispatchHandler::SetFocus(nsWindow *aFocusedWidget) if (mActiveWidget) { mActiveWidget->AddDeleteObserver(this); - //printf("nsMacEventDispatcher::SetFocus sends NS_GOTFOCUS\n"); + //PRINTF("nsMacEventDispatcher::SetFocus sends NS_GOTFOCUS\n"); DispatchGuiEvent(mActiveWidget, NS_GOTFOCUS); } } @@ -170,16 +175,16 @@ void nsMacEventDispatchHandler::SetFocus(nsWindow *aFocusedWidget) void nsMacEventDispatchHandler::SetActivated(nsWindow *aActivatedWidget) { - //printf("nsMacEventDispatcher::SetActivated \n"); + //PRINTF("nsMacEventDispatcher::SetActivated \n"); if (aActivatedWidget == mActiveWidget) { - //printf("already the active widget. Bailing!\n"); + //PRINTF("already the active widget. Bailing!\n"); return; } if(aActivatedWidget) { if ( eWindowType_popup == aActivatedWidget->GetWindowType() ) { - //printf("nsMacEventDispatcher::SetActivated type popup, bail\n"); + //PRINTF("nsMacEventDispatcher::SetActivated type popup, bail\n"); return; } } @@ -189,7 +194,7 @@ void nsMacEventDispatchHandler::SetActivated(nsWindow *aActivatedWidget) { mActiveWidget->ResetInputState(); mActiveWidget->RemoveDeleteObserver(this); - //printf("nsMacEventDispatchHandler::SetActivated sends NS_LOSTFOCUS\n"); + //PRINTF("nsMacEventDispatchHandler::SetActivated sends NS_LOSTFOCUS\n"); DispatchGuiEvent(mActiveWidget, NS_LOSTFOCUS); } @@ -199,10 +204,10 @@ void nsMacEventDispatchHandler::SetActivated(nsWindow *aActivatedWidget) if (mActiveWidget) { mActiveWidget->AddDeleteObserver(this); - //printf("nsMacEventDispatcher::SetActivated sends NS_GOTFOCUS\n"); + //PRINTF("nsMacEventDispatcher::SetActivated sends NS_GOTFOCUS\n"); DispatchGuiEvent(mActiveWidget, NS_GOTFOCUS); - //printf("nsMacEventDispatchHandler::SetActivated sends NS_ACTIVATE\n"); + //PRINTF("nsMacEventDispatchHandler::SetActivated sends NS_ACTIVATE\n"); DispatchGuiEvent(mActiveWidget, NS_ACTIVATE); } } @@ -213,10 +218,10 @@ void nsMacEventDispatchHandler::SetActivated(nsWindow *aActivatedWidget) void nsMacEventDispatchHandler::SetDeactivated(nsWindow *aDeactivatedWidget) { - //printf("nsMacEventDispatchHandler::SetDeactivated\n"); + //PRINTF("nsMacEventDispatchHandler::SetDeactivated\n"); if(aDeactivatedWidget) { if ( eWindowType_popup == aDeactivatedWidget->GetWindowType() ) { - //printf("nsMacEventDispatchHandler::SetDeactivated type popup, bail\n"); + //PRINTF("nsMacEventDispatchHandler::SetDeactivated type popup, bail\n"); return; } } @@ -224,7 +229,7 @@ void nsMacEventDispatchHandler::SetDeactivated(nsWindow *aDeactivatedWidget) // let the old one know it lost activation if (mActiveWidget) { - //printf(" nsMacEventDispatchHandler::SetDeactivated sends NS_DEACTIVATE\n"); + //PRINTF(" nsMacEventDispatchHandler::SetDeactivated sends NS_DEACTIVATE\n"); DispatchGuiEvent(mActiveWidget, NS_DEACTIVATE); mActiveWidget->RemoveDeleteObserver(this); mActiveWidget = nsnull; @@ -311,7 +316,7 @@ nsMacEventHandler::nsMacEventHandler(nsMacWindow* aTopLevelWidget) NS_ASSERTION(err==noErr,"nsMacEventHandler::nsMacEventHandler: NewTSMDocument failed."); #ifdef DEBUG_TSM - printf("nsMacEventHandler::nsMacEventHandler: created TSMDocument[%p]\n",mTSMDocument); + PRINTF("nsMacEventHandler::nsMacEventHandler: created TSMDocument[%p]\n",mTSMDocument); #endif #endif @@ -1041,8 +1046,8 @@ PRBool nsMacEventHandler::HandleActivateEvent(EventRecord& aOSEvent) #if 0 NS_ASSERTION(err==noErr,"nsMacEventHandler::HandleActivateEvent: ActivateTSMDocument failed"); #endif - printf("nsEventHandler::HandleActivateEvent: ActivateTSMDocument[%p] %s return %d\n",mTSMDocument, - (err==noErr)?"":"ERROR", err); + PRINTF("nsEventHandler::HandleActivateEvent: ActivateTSMDocument[%p] %s return %d\n",mTSMDocument, + (err==noErr)?"":"ERROR", err); #endif @@ -1081,8 +1086,8 @@ PRBool nsMacEventHandler::HandleActivateEvent(EventRecord& aOSEvent) err = ::DeactivateTSMDocument(mTSMDocument); #ifdef DEBUG_TSM NS_ASSERTION((noErr==err)||(tsmDocNotActiveErr==err),"nsMacEventHandler::HandleActivateEvent: DeactivateTSMDocument failed"); - printf("nsEventHandler::HandleActivateEvent: DeactivateTSMDocument[%p] %s return %d\n",mTSMDocument, - (err==noErr)?"":"ERROR", err); + PRINTF("nsEventHandler::HandleActivateEvent: DeactivateTSMDocument[%p] %s return %d\n",mTSMDocument, + (err==noErr)?"":"ERROR", err); #endif // Dispatch an NS_DEACTIVATE event gEventDispatchHandler.SetDeactivated(mTopLevelWidget); @@ -1486,13 +1491,13 @@ nsresult nsMacEventHandler::HandleOffsetToPosition(long offset,Point* thePoint) { thePoint->v = mIMEPos.y; thePoint->h = mIMEPos.x; - printf("local (x,y) = (%d, %d)\n", thePoint->h, thePoint->v); + PRINTF("local (x,y) = (%d, %d)\n", thePoint->h, thePoint->v); WindowRef wind = reinterpret_cast(mTopLevelWidget->GetNativeData(NS_NATIVE_DISPLAY)); ::SetPortWindowPort(wind); Rect savePortRect; ::GetWindowPortBounds(wind, &savePortRect); ::LocalToGlobal(thePoint); - printf("global (x,y) = (%d, %d)\n", thePoint->h, thePoint->v); + PRINTF("global (x,y) = (%d, %d)\n", thePoint->h, thePoint->v); return PR_TRUE; } @@ -1507,8 +1512,8 @@ nsresult nsMacEventHandler::HandleOffsetToPosition(long offset,Point* thePoint) nsresult nsMacEventHandler::HandleUpdateInputArea(char* text,Size text_size, ScriptCode textScript,long fixedLength,TextRangeArray* textRangeList) { #ifdef DEBUG_TSM - printf("********************************************************************************\n"); - printf("nsMacEventHandler::HandleUpdateInputArea size=%d fixlen=%d\n",text_size, fixedLength); + PRINTF("********************************************************************************\n"); + PRINTF("nsMacEventHandler::HandleUpdateInputArea size=%d fixlen=%d\n",text_size, fixedLength); #endif TextToUnicodeInfo textToUnicodeInfo; TextEncoding textEncodingFromScript; @@ -1571,7 +1576,7 @@ nsresult nsMacEventHandler::HandleUpdateInputArea(char* text,Size text_size, Scr if(0 != committedLen) { #ifdef DEBUG_TSM - printf("Have commit text from 0 to %d\n",committedLen); + PRINTF("Have commit text from 0 to %d\n",committedLen); #endif //------------------------------------------------------------------------------------------------ // 1.1 send textEvent to commit the text @@ -1602,7 +1607,7 @@ nsresult nsMacEventHandler::HandleUpdateInputArea(char* text,Size text_size, Scr mIMECompositionStr->mLength = len; // for committed text, set no highlight ? (Do we need to set CaretPosition here ??? ) #ifdef DEBUG_TSM - printf("1.2====================================\n"); + PRINTF("1.2====================================\n"); #endif res = HandleTextEvent(0,nsnull); NS_ASSERTION(NS_SUCCEEDED(res),"nsMacEventHandler::UpdateInputArea: HandleTextEvent failed."); @@ -1623,7 +1628,7 @@ nsresult nsMacEventHandler::HandleUpdateInputArea(char* text,Size text_size, Scr if((-1 != fixedLength) && (text_size != fixedLength )) { #ifdef DEBUG_TSM - printf("Have new uncommited text from %d to text_size(%d)\n",committedLen,text_size); + PRINTF("Have new uncommited text from %d to text_size(%d)\n",committedLen,text_size); #endif //------------------------------------------------------------------------------------------------ // 2.1 send compositionEvent to start the comosition @@ -1658,7 +1663,7 @@ nsresult nsMacEventHandler::HandleUpdateInputArea(char* text,Size text_size, Scr #ifdef DEBUG_TSM - printf("nsMacEventHandler::HandleUpdateInputArea textRangeList is %s\n", textRangeList ? "NOT NULL" : "NULL"); + PRINTF("nsMacEventHandler::HandleUpdateInputArea textRangeList is %s\n", textRangeList ? "NOT NULL" : "NULL"); #endif nsTextRangeArray xpTextRangeArray = new nsTextRange[rangeArray->fNumOfRanges]; NS_ASSERTION(xpTextRangeArray!=NULL,"nsMacEventHandler::UpdateInputArea: xpTextRangeArray memory allocation failed."); @@ -1691,8 +1696,8 @@ nsresult nsMacEventHandler::HandleUpdateInputArea(char* text,Size text_size, Scr NS_ASSERTION( rangeArray->fRange[i].fEnd <= text_size,"illegal range"); #ifdef DEBUG_TSM - printf("nsMacEventHandler::HandleUpdateInputArea textRangeList[%d] = (%d,%d) text_size = %d\n",i, - rangeArray->fRange[i].fStart, rangeArray->fRange[i].fEnd, text_size); + PRINTF("nsMacEventHandler::HandleUpdateInputArea textRangeList[%d] = (%d,%d) text_size = %d\n",i, + rangeArray->fRange[i].fStart, rangeArray->fRange[i].fEnd, text_size); #endif // 2.2.2.2 fill sourceOffset array typedef enum { @@ -1803,9 +1808,9 @@ nsresult nsMacEventHandler::HandleUpdateInputArea(char* text,Size text_size, Scr NS_ASSERTION(xpTextRangeArray[i].mStartOffset <= len,"illegal range"); NS_ASSERTION(xpTextRangeArray[i].mEndOffset <= len,"illegal range"); #ifdef DEBUG_TSM - printf("nsMacEventHandler::HandleUpdateInputArea textRangeList[%d] => type=%d (%d,%d)\n",i, + PRINTF("nsMacEventHandler::HandleUpdateInputArea textRangeList[%d] => type=%d (%d,%d)\n",i, xpTextRangeArray[i].mRangeType, - xpTextRangeArray[i].mStartOffset, xpTextRangeArray[i].mEndOffset); + xpTextRangeArray[i].mStartOffset, xpTextRangeArray[i].mEndOffset); #endif NS_ASSERTION((NS_TEXTRANGE_CARETPOSITION!=xpTextRangeArray[i].mRangeType) || @@ -1822,7 +1827,7 @@ nsresult nsMacEventHandler::HandleUpdateInputArea(char* text,Size text_size, Scr // 2.2.4 send the text event //------------------------------------------------------------------------------------------------ #ifdef DEBUG_TSM - printf("2.2.4====================================\n"); + PRINTF("2.2.4====================================\n"); #endif res = HandleTextEvent(rangeArray->fNumOfRanges,xpTextRangeArray); @@ -1841,7 +1846,7 @@ nsresult nsMacEventHandler::HandleUpdateInputArea(char* text,Size text_size, Scr ubuf[0] = '\0'; // null terminate mIMECompositionStr->mLength = 0; #ifdef DEBUG_TSM - printf("3.====================================\n"); + PRINTF("3.====================================\n"); #endif // 3.1 send the empty text event. res = HandleTextEvent(0,nsnull); @@ -1868,7 +1873,7 @@ error: nsresult nsMacEventHandler::HandleStartComposition(void) { #ifdef DEBUG_TSM - printf("HandleStartComposition\n"); + PRINTF("HandleStartComposition\n"); #endif mIMEIsComposing = PR_TRUE; if(nsnull == mIMECompositionStr) @@ -1909,7 +1914,7 @@ nsresult nsMacEventHandler::HandleStartComposition(void) + compositionEvent.theReply.mCursorPosition.height; focusedWidget->LocalToWindowCoordinate(mIMEPos); #ifdef DEBUG_TSM - printf("HandleStartComposition reply (%d,%d)\n", mIMEPos.x , mIMEPos.y); + PRINTF("HandleStartComposition reply (%d,%d)\n", mIMEPos.x , mIMEPos.y); #endif } return res; @@ -1923,7 +1928,7 @@ nsresult nsMacEventHandler::HandleStartComposition(void) nsresult nsMacEventHandler::HandleEndComposition(void) { #ifdef DEBUG_TSM - printf("HandleEndComposition\n"); + PRINTF("HandleEndComposition\n"); #endif mIMEIsComposing = PR_FALSE; // @@ -1960,13 +1965,13 @@ nsresult nsMacEventHandler::HandleEndComposition(void) nsresult nsMacEventHandler::HandleTextEvent(PRUint32 textRangeCount, nsTextRangeArray textRangeArray) { #ifdef DEBUG_TSM - printf("HandleTextEvent\n"); + PRINTF("HandleTextEvent\n"); PRUint32 i; - printf("text event \n["); + PRINTF("text event \n["); const PRUnichar *ubuf = mIMECompositionStr->GetUnicode(); for(i=0; '\0' != *ubuf; i++) - printf("U+%04X ", *ubuf++); - printf("] len = %d\n",i); + PRINTF("U+%04X ", *ubuf++); + PRINTF("] len = %d\n",i); if(textRangeCount > 0) { for(i=0;iLocalToWindowCoordinate(mIMEPos); #ifdef DEBUG_TSM - printf("HandleTextEvent reply (%d,%d)\n", mIMEPos.x , mIMEPos.y); + PRINTF("HandleTextEvent reply (%d,%d)\n", mIMEPos.x , mIMEPos.y); #endif } return res; diff --git a/mozilla/widget/src/mac/nsMacMessagePump.cpp b/mozilla/widget/src/mac/nsMacMessagePump.cpp index a041a835ec1..c9d2ca1c753 100644 --- a/mozilla/widget/src/mac/nsMacMessagePump.cpp +++ b/mozilla/widget/src/mac/nsMacMessagePump.cpp @@ -66,6 +66,11 @@ #include "nsISocketTransportService.h" #include "nsIFileTransportService.h" +#include "nslog.h" + +NS_IMPL_LOG(nsMacMessagePumpLog, 0) +#define PRINTF NS_LOG_PRINTF(nsMacMessagePumpLog) +#define FLUSH NS_LOG_FLUSH(nsMacMessagePumpLog) #ifndef topLeft #define topLeft(r) (((Point *) &(r))[0]) @@ -291,9 +296,9 @@ PRBool nsMacMessagePump::BrowserIsBusy() if (isBusy != wasBusy) { if (isBusy) - printf("¤¤ Message pump became busy\n"); + PRINTF("¤¤ Message pump became busy\n"); else - printf("¤¤ Message pump became idle\n"); + PRINTF("¤¤ Message pump became idle\n"); wasBusy = isBusy; } diff --git a/mozilla/widget/src/mac/nsMenu.cpp b/mozilla/widget/src/mac/nsMenu.cpp index 7596664390e..71855c8437a 100644 --- a/mozilla/widget/src/mac/nsMenu.cpp +++ b/mozilla/widget/src/mac/nsMenu.cpp @@ -50,6 +50,11 @@ #include #include "nsDynamicMDEF.h" +#include "nslog.h" + +NS_IMPL_LOG(nsMenuLog, 0) +#define PRINTF NS_LOG_PRINTF(nsMenuLog) +#define FLUSH NS_LOG_FLUSH(nsMenuLog) extern MenuHandle gLevel2HierMenu; extern MenuHandle gLevel3HierMenu; @@ -167,7 +172,7 @@ nsMenu::~nsMenu() // Don't destroy the 4 Golden Hierarchical Menu if((mMacMenuID > 5) || (mMacMenuID < 2) && !mIsHelpMenu) { - //printf("WARNING: DeleteMenu called!!! \n"); + //PRINTF("WARNING: DeleteMenu called!!! \n"); ::DeleteMenu(mMacMenuID); } @@ -300,7 +305,7 @@ NS_METHOD nsMenu::SetLabel(const nsAReadableString &aText) #endif } - //printf("MacMenuID = %d", mMacMenuID); + //PRINTF("MacMenuID = %d", mMacMenuID); return NS_OK; } @@ -350,8 +355,8 @@ NS_METHOD nsMenu::AddMenuItem(nsIMenuItem * aMenuItem) nsAutoString label; aMenuItem->GetLabel(label); - //printf("%s \n", label.ToNewCString()); - //printf("%d = mMacMenuID\n", mMacMenuID); + //PRINTF("%s \n", label.ToNewCString()); + //PRINTF("%d = mMacMenuID\n", mMacMenuID); ::InsertMenuItem(mMacMenuHandle, "\p(Blank menu item", currItemIndex); MenuHelpers::SetMenuItemText(mMacMenuHandle, currItemIndex, label, mUnicodeTextRunConverter); @@ -419,7 +424,7 @@ NS_METHOD nsMenu::AddMenu(nsIMenu * aMenu) // We have to add it as a menu item and then associate it with the item nsAutoString label; aMenu->GetLabel(label); - //printf("AddMenu %s \n", label.ToNewCString()); + //PRINTF("AddMenu %s \n", label.ToNewCString()); ::InsertMenuItem(mMacMenuHandle, "\p(Blank Menu", currItemIndex); MenuHelpers::SetMenuItemText(mMacMenuHandle, currItemIndex, label, mUnicodeTextRunConverter); @@ -543,7 +548,7 @@ NS_METHOD nsMenu::RemoveMenuListener(nsIMenuListener * aMenuListener) //------------------------------------------------------------------------- nsEventStatus nsMenu::MenuItemSelected(const nsMenuEvent & aMenuEvent) { - //printf("MenuItemSelected called \n"); + //PRINTF("MenuItemSelected called \n"); nsEventStatus eventStatus = nsEventStatus_eIgnore; // Determine if this is the correct menu to handle the event @@ -718,7 +723,7 @@ nsEventStatus nsMenu::MenuItemSelected(const nsMenuEvent & aMenuEvent) //------------------------------------------------------------------------- nsEventStatus nsMenu::MenuSelected(const nsMenuEvent & aMenuEvent) { - //printf("MenuSelected called for %s \n", mLabel.ToNewCString()); + //PRINTF("MenuSelected called for %s \n", mLabel.ToNewCString()); nsEventStatus eventStatus = nsEventStatus_eIgnore; // Determine if this is the correct menu to handle the event @@ -762,7 +767,7 @@ nsEventStatus nsMenu::MenuSelected(const nsMenuEvent & aMenuEvent) mConstructed = true; } } else { - //printf("Menu already constructed \n"); + //PRINTF("Menu already constructed \n"); } eventStatus = nsEventStatus_eConsumeNoDefault; } @@ -791,7 +796,7 @@ nsEventStatus nsMenu::MenuSelected(const nsMenuEvent & aMenuEvent) //------------------------------------------------------------------------- nsEventStatus nsMenu::MenuDeselected(const nsMenuEvent & aMenuEvent) { - //printf("MenuDeselect called for %s\n", mLabel.ToNewCString()); + //PRINTF("MenuDeselect called for %s\n", mLabel.ToNewCString()); // Destroy the menu if(mConstructed) { MenuDestruct(aMenuEvent); @@ -814,7 +819,7 @@ nsEventStatus nsMenu::MenuConstruct( // reset destroy handler flag so that we'll know to fire it next time this menu goes away. mDestroyHandlerCalled = PR_FALSE; - //printf("nsMenu::MenuConstruct called for %s = %d \n", mLabel.ToNewCString(), mMacMenuHandle); + //PRINTF("nsMenu::MenuConstruct called for %s = %d \n", mLabel.ToNewCString(), mMacMenuHandle); // Begin menuitem inner loop gCurrentMenuDepth++; @@ -836,7 +841,7 @@ nsEventStatus nsMenu::MenuConstruct( { nsAutoString label; menuitemElement->GetAttribute(NS_LITERAL_STRING("value"), label); - //printf("label = %s \n", label.ToNewCString()); + //PRINTF("label = %s \n", label.ToNewCString()); // depending on the type, create a menu item, separator, or submenu nsAutoString menuitemNodeType; @@ -855,7 +860,7 @@ nsEventStatus nsMenu::MenuConstruct( gConstructingMenu = PR_FALSE; mNeedsRebuild = PR_FALSE; - //printf(" Done building, mMenuItemVoidArray.Count() = %d \n", mMenuItemVoidArray.Count()); + //PRINTF(" Done building, mMenuItemVoidArray.Count() = %d \n", mMenuItemVoidArray.Count()); gCurrentMenuDepth--; @@ -869,7 +874,7 @@ nsEventStatus nsMenu::HelpMenuConstruct( void * menuNode, void * aWebShell) { - //printf("nsMenu::MenuConstruct called for %s = %d \n", mLabel.ToNewCString(), mMacMenuHandle); + //PRINTF("nsMenu::MenuConstruct called for %s = %d \n", mLabel.ToNewCString(), mMacMenuHandle); // Begin menuitem inner loop int numHelpItems = ::CountMenuItems(mMacMenuHandle); @@ -900,7 +905,7 @@ nsEventStatus nsMenu::HelpMenuConstruct( nsAutoString label; menuitemElement->GetAttribute(NS_LITERAL_STRING("value"), label); - //printf("label = %s \n", label.ToNewCString()); + //PRINTF("label = %s \n", label.ToNewCString()); menuitemElement->GetNodeName(menuitemNodeType); if (menuitemNodeType == NS_LITERAL_STRING("menuitem")) { @@ -918,7 +923,7 @@ nsEventStatus nsMenu::HelpMenuConstruct( oldmenuitemNode->GetNextSibling(getter_AddRefs(menuitemNode)); } // end menu item innner loop - //printf(" Done building, mMenuItemVoidArray.Count() = %d \n", mMenuItemVoidArray.Count()); + //PRINTF(" Done building, mMenuItemVoidArray.Count() = %d \n", mMenuItemVoidArray.Count()); gCurrentMenuDepth--; @@ -931,7 +936,7 @@ nsEventStatus nsMenu::HelpMenuConstruct( //------------------------------------------------------------------------- nsEventStatus nsMenu::MenuDestruct(const nsMenuEvent & aMenuEvent) { - //printf("nsMenu::MenuDestruct() called for %s \n", mLabel.ToNewCString()); + //PRINTF("nsMenu::MenuDestruct() called for %s \n", mLabel.ToNewCString()); // Fire our ondestroy handler. If we're told to stop, don't destroy the menu PRBool keepProcessing = OnDestroy(); @@ -948,7 +953,7 @@ nsEventStatus nsMenu::MenuDestruct(const nsMenuEvent & aMenuEvent) if(mNeedsRebuild) { RemoveAll(); mConstructed = false; - //printf(" mMenuItemVoidArray.Count() = %d \n", mMenuItemVoidArray.Count()); + //PRINTF(" mMenuItemVoidArray.Count() = %d \n", mMenuItemVoidArray.Count()); // Close the node. mNeedsRebuild = PR_TRUE; } @@ -1105,7 +1110,7 @@ void nsMenu::LoadMenuItem( // Create nsMenuItem nsCOMPtr pnsMenuItem = do_CreateInstance ( kMenuItemCID ) ; if ( pnsMenuItem ) { - //printf("menuitem %s \n", menuitemName.ToNewCString()); + //PRINTF("menuitem %s \n", menuitemName.ToNewCString()); // Create MenuDelegate - this is the intermediator inbetween // the DOM node and the nsIMenuItem @@ -1221,7 +1226,7 @@ nsMenu::LoadSubMenu( nsIMenu * pParentMenu, nsIDOMElement * menuElement, nsIDOMN nsAutoString menuName; menuElement->GetAttribute(NS_LITERAL_STRING("value"), menuName); - //printf("Creating Menu [%s] \n", menuName.ToNewCString()); // this leaks + //PRINTF("Creating Menu [%s] \n", menuName.ToNewCString()); // this leaks // Create nsMenu nsCOMPtr pnsMenu ( do_CreateInstance(kMenuCID) ); @@ -1615,4 +1620,4 @@ nsMenu :: ContentInserted(nsIDocument *aDocument, nsIContent *aChild, PRInt32 aI return NS_OK; -} // ContentInserted \ No newline at end of file +} // ContentInserted diff --git a/mozilla/widget/src/mac/nsMenuBar.cpp b/mozilla/widget/src/mac/nsMenuBar.cpp index f6ab61f4b6b..f135002aaf5 100644 --- a/mozilla/widget/src/mac/nsMenuBar.cpp +++ b/mozilla/widget/src/mac/nsMenuBar.cpp @@ -49,6 +49,11 @@ #include #include #include "nsMacResources.h" +#include "nslog.h" + +NS_IMPL_LOG(nsMenuBarLog, 0) +#define PRINTF NS_LOG_PRINTF(nsMenuBarLog) +#define FLUSH NS_LOG_FLUSH(nsMenuBarLog) static NS_DEFINE_IID(kIStringBundleServiceIID, NS_ISTRINGBUNDLESERVICE_IID); @@ -205,7 +210,7 @@ nsMenuBar::MenuSelected(const nsMenuEvent & aMenuEvent) nsCOMPtr menuListener; //((nsISupports*)mMenuVoidArray[i-1])->QueryInterface(NS_GET_IID(nsIMenuListener), (void**)&menuListener); - //printf("gPreviousMenuStack.Count() = %d \n", gPreviousMenuStack.Count()); + //PRINTF("gPreviousMenuStack.Count() = %d ", gPreviousMenuStack.Count()); #if !TARGET_CARBON nsCOMPtr theMenu; gPreviousMenuStack.GetMenuAt(gPreviousMenuStack.Count() - 1, getter_AddRefs(theMenu)); @@ -500,7 +505,7 @@ NS_METHOD nsMenuBar::AddMenu(nsIMenu * aMenu) nsresult ret; nsCOMPtr pStringService = do_GetService(kStringBundleServiceCID, &ret); if (NS_FAILED(ret)) { - NS_WARNING("cannot get string service\n"); + NS_WARNING("cannot get string service"); return ret; } @@ -508,7 +513,7 @@ NS_METHOD nsMenuBar::AddMenu(nsIMenu * aMenu) nsCOMPtr bundle; ret = pStringService->CreateBundle("chrome://global/locale/brand.properties", nsnull, getter_AddRefs(bundle)); if (NS_FAILED(ret)) { - NS_WARNING("cannot create instance\n"); + NS_WARNING("cannot create instance"); return ret; } diff --git a/mozilla/widget/src/mac/nsTextHelper.cpp b/mozilla/widget/src/mac/nsTextHelper.cpp index ff18e960ed1..58ddf4b5330 100644 --- a/mozilla/widget/src/mac/nsTextHelper.cpp +++ b/mozilla/widget/src/mac/nsTextHelper.cpp @@ -29,6 +29,11 @@ #include "nsGUIEvent.h" #include "nsString.h" #include "nsStringUtil.h" +#include "nslog.h" + +NS_IMPL_LOG(nsTextHelperLog, 0) +#define PRINTF NS_LOG_PRINTF(nsTextHelperLog) +#define FLUSH NS_LOG_FLUSH(nsTextHelperLog) #define DBG 0 @@ -92,7 +97,7 @@ PRUint32 len; //------------------------------------------------------------------------- PRUint32 nsTextHelper::SetText(const nsString& aText) { - //printf("SetText Password %d\n", mIsPassword); + //PRINTF("SetText Password %d\n", mIsPassword); if (!mIsPassword) { NS_ALLOC_STR_BUF(buf, aText, 512); @@ -108,7 +113,7 @@ PRUint32 nsTextHelper::SetText(const nsString& aText) char * buf = new char[aText.Length()+1]; memset(buf, '*', aText.Length()); buf[aText.Length()] = 0; - //printf("SetText [%s] [%s]\n", data->mPassword.ToNewCString(), buf); + //PRINTF("SetText [%s] [%s]\n", data->mPassword.ToNewCString(), buf); //XmTextSetString(mWidget, buf); data->mIgnore = PR_FALSE; } @@ -135,7 +140,7 @@ PRUint32 nsTextHelper::InsertText(const nsString &aText, PRUint32 aStartPos, PR char * buf = new char[data->mPassword.Length()+1]; memset(buf, '*', data->mPassword.Length()); buf[data->mPassword.Length()] = 0; - //printf("SetText [%s] [%s]\n", data->mPassword.ToNewCString(), buf); + //PRINTF("SetText [%s] [%s]\n", data->mPassword.ToNewCString(), buf); //XmTextInsert(mWidget, aStartPos, buf); data->mIgnore = PR_FALSE; } @@ -187,7 +192,7 @@ void nsTextHelper::SetSelection(PRUint32 aStartSel, PRUint32 aEndSel) //XmTextPosition right = (XmTextPosition)aEndSel; //Time time; -printf("SetSel %d %d\n", left, right); + PRINTF("SetSel %d %d\n", left, right); //XmTextSetSelection(mWidget, left, right, 0); } @@ -200,11 +205,11 @@ void nsTextHelper::GetSelection(PRUint32 *aStartSel, PRUint32 *aEndSel) /* if (XmTextGetSelectionPosition(mWidget, &left, &right)) { - printf("left %d right %d\n", left, right); + PRINTF("left %d right %d\n", left, right); *aStartSel = (PRUint32)left; *aEndSel = (PRUint32)right; } else { - printf("nsTextHelper::GetSelection Error getting positions\n"); + PRINTF("nsTextHelper::GetSelection Error getting positions\n"); } */ } diff --git a/mozilla/widget/src/mac/nsWindow.cpp b/mozilla/widget/src/mac/nsWindow.cpp index e072a3410fb..e39cdde5ed9 100644 --- a/mozilla/widget/src/mac/nsWindow.cpp +++ b/mozilla/widget/src/mac/nsWindow.cpp @@ -51,6 +51,11 @@ #include "nsCarbonHelpers.h" #include "nsGfxUtils.h" +#include "nslog.h" + +NS_IMPL_LOG(nsWindowLog, 0) +#define PRINTF NS_LOG_PRINTF(nsWindowLog) +#define FLUSH NS_LOG_FLUSH(nsWindowLog) //////////////////////////////////////////////////// @@ -1361,7 +1366,7 @@ nsresult nsWindow::HandleUpdateEvent(RgnHandle regionToValidate) #if DEBUG if (measure_duration) { finish = microseconds(); - printf("update took %g microseconds.\n", double(finish - start)); + PRINTF("update took %g microseconds.\n", double(finish - start)); } #endif @@ -1748,13 +1753,13 @@ PRBool nsWindow::DispatchMouseEvent(nsMouseEvent &aEvent) { //if (mWindowPtr == NULL || mWindowPtr != this) //{ - // printf("Mouse enter"); + // PRINTF("Mouse enter"); //mCurrentWindow = this; //} } else { - // printf("Mouse exit"); + // PRINTF("Mouse exit"); } } break; diff --git a/mozilla/widget/src/motif/app_context/nsMotifAppContextServiceFactory.cpp b/mozilla/widget/src/motif/app_context/nsMotifAppContextServiceFactory.cpp index 5597c08a1a3..7b81d5b24cf 100644 --- a/mozilla/widget/src/motif/app_context/nsMotifAppContextServiceFactory.cpp +++ b/mozilla/widget/src/motif/app_context/nsMotifAppContextServiceFactory.cpp @@ -29,6 +29,11 @@ #include "nsCOMPtr.h" #include "nsMotifAppContextService.h" +#include "nslog.h" + +NS_IMPL_LOG(nsMotifAppContextServiceFactoryLog, 0) +#define PRINTF NS_LOG_PRINTF(nsMotifAppContextServiceFactoryLog) +#define FLUSH NS_LOG_FLUSH(nsMotifAppContextServiceFactoryLog) static NS_DEFINE_CID(kCMotifAppContextServiceCID, NS_MOTIF_APP_CONTEXT_SERVICE_CID); static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID); @@ -124,7 +129,7 @@ NSRegisterSelf(nsISupports* aServMgr, const char *fullpath) nsresult rv; #ifdef NS_DEBUG - printf("*** Registering MotifAppContextService\n"); + PRINTF("*** Registering MotifAppContextService\n"); #endif nsCOMPtr diff --git a/mozilla/widget/src/motif/nsAppShell.cpp b/mozilla/widget/src/motif/nsAppShell.cpp index 65ae615a203..4dfbad42e2b 100644 --- a/mozilla/widget/src/motif/nsAppShell.cpp +++ b/mozilla/widget/src/motif/nsAppShell.cpp @@ -30,6 +30,11 @@ #include "nsIMotifAppContextService.h" #include +#include "nslog.h" + +NS_IMPL_LOG(nsAppShellLog, 0) +#define PRINTF NS_LOG_PRINTF(nsAppShellLog) +#define FLUSH NS_LOG_FLUSH(nsAppShellLog) #ifdef LINUX #define DO_THE_EDITRES_THING @@ -106,11 +111,11 @@ NS_METHOD nsAppShell::Create(int* bac, char ** bav) NULL, // args 0); // num_args - printf("nsAppShell::Create() app_context = %p\n",sAppContext); + PRINTF("nsAppShell::Create() app_context = %p\n",sAppContext); xlib_rgb_init(XtDisplay(mTopLevel), XtScreen(mTopLevel)); - printf("xlib_rgb_init(display=%p,screen=%p)\n", + PRINTF("xlib_rgb_init(display=%p,screen=%p)\n", XtDisplay(mTopLevel), XtScreen(mTopLevel)); @@ -147,7 +152,7 @@ NS_METHOD nsAppShell::Run() } #ifdef DEBUG - printf("Got the event queue from the service\n"); + PRINTF("Got the event queue from the service\n"); #endif /* DEBUG */ //Get the event queue for the thread. @@ -173,7 +178,7 @@ NS_METHOD nsAppShell::Run() done: - printf("Calling XtAppAddInput() with event queue\n"); + PRINTF("Calling XtAppAddInput() with event queue\n"); XtAppAddInput(nsAppShell::GetAppContext(), EQueue->GetEventQueueSelectFD(), @@ -306,13 +311,13 @@ nsAppShell::SetAppContext(XtAppContext aAppContext) if (ac_service) { - printf("nsAppShell::SetAppContext() ac_service = %p\n",ac_service); + PRINTF("nsAppShell::SetAppContext() ac_service = %p\n",ac_service); nsresult rv2 = ac_service->SetAppContext(aAppContext); NS_ASSERTION(rv2 == NS_OK,"Cannot set the app context."); - printf("nsAppShell::SetAppContext() All is ok.\n"); + PRINTF("nsAppShell::SetAppContext() All is ok.\n"); NS_RELEASE(ac_service); } diff --git a/mozilla/widget/src/motif/nsLabel.cpp b/mozilla/widget/src/motif/nsLabel.cpp index 7ce68010756..c2adf42f92c 100644 --- a/mozilla/widget/src/motif/nsLabel.cpp +++ b/mozilla/widget/src/motif/nsLabel.cpp @@ -31,6 +31,11 @@ #include "nsXtEventHandler.h" #include +#include "nslog.h" + +NS_IMPL_LOG(nsLabelLog, 0) +#define PRINTF NS_LOG_PRINTF(nsLabelLog) +#define FLUSH NS_LOG_FLUSH(nsLabelLog) NS_IMPL_ADDREF(nsLabel) NS_IMPL_RELEASE(nsLabel) @@ -219,7 +224,7 @@ PRBool nsLabel::OnMove(PRInt32, PRInt32) PRBool nsLabel::OnPaint(nsPaintEvent &aEvent) { - //printf("** nsLabel::OnPaint **\n"); + //PRINTF("** nsLabel::OnPaint **\n"); return PR_FALSE; } diff --git a/mozilla/widget/src/motif/nsMenu.cpp b/mozilla/widget/src/motif/nsMenu.cpp index bf631a08b22..8ab36330bbb 100644 --- a/mozilla/widget/src/motif/nsMenu.cpp +++ b/mozilla/widget/src/motif/nsMenu.cpp @@ -40,6 +40,12 @@ #include #include +#include "nslog.h" + +NS_IMPL_LOG(nsMenuLog, 0) +#define PRINTF NS_LOG_PRINTF(nsMenuLog) +#define FLUSH NS_LOG_FLUSH(nsMenuLog) + static NS_DEFINE_CID(kMenuCID, NS_MENU_CID); static NS_DEFINE_CID(kMenuItemCID, NS_MENUITEM_CID); static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); @@ -125,7 +131,7 @@ Widget nsMenu::GetNativeParent() //------------------------------------------------------------------------- NS_METHOD nsMenu::Create(nsISupports * aParent, const nsString &aLabel) { - printf("nsMenu::Create called\n"); + PRINTF("nsMenu::Create called\n"); if(aParent) { nsIMenuBar * menubar = nsnull; @@ -213,7 +219,7 @@ NS_METHOD nsMenu::SetAccessKey(const nsString &aText) //------------------------------------------------------------------------- NS_METHOD nsMenu::AddItem(nsISupports * aItem) { - printf("nsMenu::AddItem called\n"); + PRINTF("nsMenu::AddItem called\n"); if(aItem) { nsIMenuItem * menuitem = nsnull; @@ -258,7 +264,7 @@ NS_METHOD nsMenu::AddMenu(nsIMenu * aMenu) //------------------------------------------------------------------------- NS_METHOD nsMenu::AddSeparator() { - printf("nsMenu::AddSeparator() called\n"); + PRINTF("nsMenu::AddSeparator() called\n"); XtVaCreateManagedWidget("__sep", xmSeparatorGadgetClass, mMenu, NULL); return NS_OK; } @@ -358,7 +364,7 @@ void nsMenu::LoadSubMenu(nsIMenu * pParentMenu, { nsString menuName; menuElement->GetAttribute(nsAutoString("value"), menuName); - //printf("Creating Menu [%s] \n", menuName.ToNewCString()); // this leaks + //PRINTF("Creating Menu [%s] \n", menuName.ToNewCString()); // this leaks // Create nsMenu nsIMenu * pnsMenu = nsnull; @@ -397,7 +403,7 @@ void nsMenu::LoadSubMenu(nsIMenu * pParentMenu, menuitemElement->GetNodeName(menuitemNodeType); #ifdef DEBUG_saari - printf("Type [%s] %d\n", menuitemNodeType.ToNewCString(), menuitemNodeType.Equals("menuseparator")); +PRINTF("Type [%s] %d\n", menuitemNodeType.ToNewCString(), menuitemNodeType.Equals("menuseparator")); #endif if (menuitemNodeType.Equals("menuitem")) { @@ -441,7 +447,7 @@ nsEventStatus nsMenu::MenuConstruct(const nsMenuEvent & aMenuEvent, void * menuNode, void * aWebShell) { - printf("nsMenu::MenuConstruct called\n"); + PRINTF("nsMenu::MenuConstruct called\n"); if(menuNode){ SetDOMNode((nsIDOMNode*)menuNode); } @@ -510,7 +516,7 @@ nsEventStatus nsMenu::MenuConstruct(const nsMenuEvent & aMenuEvent, nsEventStatus nsMenu::MenuDestruct(const nsMenuEvent & aMenuEvent) { - printf("nsMenu::MenuDestruct called\n"); + PRINTF("nsMenu::MenuDestruct called\n"); // Close the node. nsCOMPtr domElement = do_QueryInterface(mDOMNode); if (domElement) diff --git a/mozilla/widget/src/motif/nsMenuItem.cpp b/mozilla/widget/src/motif/nsMenuItem.cpp index cdab166635d..bbfccc2c12f 100644 --- a/mozilla/widget/src/motif/nsMenuItem.cpp +++ b/mozilla/widget/src/motif/nsMenuItem.cpp @@ -44,6 +44,11 @@ #include "nsIServiceManager.h" #include "nsStringUtil.h" +#include "nslog.h" + +NS_IMPL_LOG(nsMenuItemLog, 0) +#define PRINTF NS_LOG_PRINTF(nsMenuItemLog) +#define FLUSH NS_LOG_FLUSH(nsMenuItemLog) static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); @@ -224,7 +229,7 @@ nsEventStatus nsMenuItem::MenuItemSelected(const nsMenuEvent & aMenuEvent) nsEventStatus nsMenuItem::MenuSelected(const nsMenuEvent & aMenuEvent) { - printf("nsMenuItem::MenuSelected called\n"); + PRINTF("nsMenuItem::MenuSelected called\n"); if(mXULCommandListener) return mXULCommandListener->MenuSelected(aMenuEvent); @@ -233,7 +238,7 @@ nsEventStatus nsMenuItem::MenuSelected(const nsMenuEvent & aMenuEvent) nsEventStatus nsMenuItem::MenuDeselected(const nsMenuEvent & aMenuEvent) { - printf("nsMenuItem::MenuDeselected called\n"); + PRINTF("nsMenuItem::MenuDeselected called\n"); return nsEventStatus_eIgnore; } @@ -242,13 +247,13 @@ nsEventStatus nsMenuItem::MenuConstruct(const nsMenuEvent &aMenuEvent, void *menuNode, void *aWebShell) { - printf("nsMenuItem::MenuConstruct called\n"); + PRINTF("nsMenuItem::MenuConstruct called\n"); return nsEventStatus_eIgnore; } nsEventStatus nsMenuItem::MenuDestruct(const nsMenuEvent & aMenuEvent) { - printf("nsMenuItem::MenuDestruct called\n"); + PRINTF("nsMenuItem::MenuDestruct called\n"); return nsEventStatus_eIgnore; } @@ -257,7 +262,7 @@ NS_METHOD nsMenuItem::Create(nsISupports *aParent, const nsString &aLabel, PRBool aIsSeparator) { - printf("nsMenuItem::Create called\n"); + PRINTF("nsMenuItem::Create called\n"); if (nsnull == aParent) { return NS_ERROR_FAILURE; } diff --git a/mozilla/widget/src/motif/nsTextAreaWidget.cpp b/mozilla/widget/src/motif/nsTextAreaWidget.cpp index 4a7be887afb..31d861df2f8 100644 --- a/mozilla/widget/src/motif/nsTextAreaWidget.cpp +++ b/mozilla/widget/src/motif/nsTextAreaWidget.cpp @@ -24,8 +24,11 @@ #include "nsTextAreaWidget.h" #include "nsString.h" +#include "nslog.h" -#define DBG 0 +NS_IMPL_LOG(nsTextAreaWidgetLog, 0) +#define PRINTF NS_LOG_PRINTF(nsTextAreaWidgetLog) +#define FLUSH NS_LOG_FLUSH(nsTextAreaWidgetLog) NS_IMPL_ADDREF(nsTextAreaWidget) NS_IMPL_RELEASE(nsTextAreaWidget) @@ -62,7 +65,7 @@ NS_METHOD nsTextAreaWidget::Create(nsIWidget *aParent, aParent->AddChild(this); Widget parentWidget = nsnull; - if (DBG) fprintf(stderr, "aParent 0x%x\n", (unsigned int)aParent); + PRINTF("aParent 0x%x\n", (unsigned int)aParent); if (aParent) { parentWidget = (Widget) aParent->GetNativeData(NS_NATIVE_WIDGET); @@ -73,7 +76,7 @@ NS_METHOD nsTextAreaWidget::Create(nsIWidget *aParent, InitToolkit(aToolkit, aParent); InitDeviceContext(aContext, parentWidget); - if (DBG) fprintf(stderr, "Parent 0x%x\n", (unsigned int)parentWidget); + PRINTF("Parent 0x%x\n", (unsigned int)parentWidget); mWidget = ::XtVaCreateManagedWidget("button", xmTextWidgetClass, diff --git a/mozilla/widget/src/motif/nsTextHelper.cpp b/mozilla/widget/src/motif/nsTextHelper.cpp index 558e1dfb691..22424b28e0b 100644 --- a/mozilla/widget/src/motif/nsTextHelper.cpp +++ b/mozilla/widget/src/motif/nsTextHelper.cpp @@ -29,6 +29,11 @@ #include "nsStringUtil.h" #include +#include "nslog.h" + +NS_IMPL_LOG(nsTextHelperLog, 0) +#define PRINTF NS_LOG_PRINTF(nsTextHelperLog) +#define FLUSH NS_LOG_FLUSH(nsTextHelperLog) #define DBG 0 @@ -186,7 +191,7 @@ NS_METHOD nsTextHelper::GetSelection(PRUint32 *aStartSel, PRUint32 *aEndSel) *aStartSel = (PRUint32)left; *aEndSel = (PRUint32)right; } else { - printf("nsTextHelper::GetSelection Error getting positions\n"); + PRINTF("nsTextHelper::GetSelection Error getting positions\n"); return NS_ERROR_FAILURE; } return NS_OK; diff --git a/mozilla/widget/src/motif/nsTextWidget.cpp b/mozilla/widget/src/motif/nsTextWidget.cpp index 92c8609810e..f66fb3e3bed 100644 --- a/mozilla/widget/src/motif/nsTextWidget.cpp +++ b/mozilla/widget/src/motif/nsTextWidget.cpp @@ -29,8 +29,11 @@ #include "xlibrgb.h" #include "nsString.h" #include "nsXtEventHandler.h" +#include "nslog.h" -#define DBG 0 +NS_IMPL_LOG(nsTextWidgetLog, 0) +#define PRINTF NS_LOG_PRINTF(nsTextWidgetLog) +#define FLUSH NS_LOG_FLUSH(nsTextWidgetLog) extern int mIsPasswordCallBacksInstalled; @@ -71,11 +74,11 @@ NS_METHOD nsTextWidget::Create(nsIWidget *aParent, nsIToolkit *aToolkit, nsWidgetInitData *aInitData) { - printf("nsTextWidget::Create called\n"); + PRINTF("nsTextWidget::Create called\n"); aParent->AddChild(this); Widget parentWidget = nsnull; - if (DBG) fprintf(stderr, "aParent 0x%x\n", (unsigned int)aParent); + PRINTF("aParent 0x%x\n", (unsigned int)aParent); if (aParent) { parentWidget = (Widget) aParent->GetNativeData(NS_NATIVE_WIDGET); diff --git a/mozilla/widget/src/motif/nsToolkit.cpp b/mozilla/widget/src/motif/nsToolkit.cpp index fa809a40e4d..03f3313644c 100644 --- a/mozilla/widget/src/motif/nsToolkit.cpp +++ b/mozilla/widget/src/motif/nsToolkit.cpp @@ -22,6 +22,11 @@ #include "nsToolkit.h" #include +#include "nslog.h" + +NS_IMPL_LOG(nsToolkitLog, 0) +#define PRINTF NS_LOG_PRINTF(nsToolkitLog) +#define FLUSH NS_LOG_FLUSH(nsToolkitLog) //------------------------------------------------------------------------- // @@ -33,9 +38,9 @@ int nsToolkitErrorHandler (Display * mydisplay, XErrorEvent * myerr) char msg[80] ; XGetErrorText (mydisplay, myerr->error_code, msg, 80) ; - fprintf (stderr, "-------------------------------------\n"); - fprintf (stderr, "Error code %s\n", msg) ; - fprintf (stderr, "-------------------------------------\n"); + PRINTF("-------------------------------------\n"); + PRINTF("Error code %s\n", msg) ; + PRINTF("-------------------------------------\n"); //exit() ; return 0; } diff --git a/mozilla/widget/src/motif/nsWidgetFactory.cpp b/mozilla/widget/src/motif/nsWidgetFactory.cpp index 4d0a8eff2c5..4dd9b54dcdf 100644 --- a/mozilla/widget/src/motif/nsWidgetFactory.cpp +++ b/mozilla/widget/src/motif/nsWidgetFactory.cpp @@ -40,6 +40,11 @@ #include "nsComboBox.h" #include "nsLookAndFeel.h" #include "nsLabel.h" +#include "nslog.h" + +NS_IMPL_LOG(nsWidgetFactoryLog, 0) +#define PRINTF NS_LOG_PRINTF(nsWidgetFactoryLog) +#define FLUSH NS_LOG_FLUSH(nsWidgetFactoryLog) // #include "nsFontRetrieverService.h" // Drag & Drop, Clipboard @@ -223,7 +228,7 @@ nsresult nsWidgetFactory::CreateInstance(nsISupports *aOuter, } #endif else { - printf("nsWidgetFactory::CreateInstance(), unhandled class.\n"); + PRINTF("nsWidgetFactory::CreateInstance(), unhandled class.\n"); } if (inst == NULL) { diff --git a/mozilla/widget/src/motif/nsWindow.cpp b/mozilla/widget/src/motif/nsWindow.cpp index d636bf9431e..ac51c58d88c 100644 --- a/mozilla/widget/src/motif/nsWindow.cpp +++ b/mozilla/widget/src/motif/nsWindow.cpp @@ -46,6 +46,11 @@ #include "nsAppShell.h" #include "stdio.h" +#include "nslog.h" + +NS_IMPL_LOG(nsWindowLog, 0) +#define PRINTF NS_LOG_PRINTF(nsWindowLog) +#define FLUSH NS_LOG_FLUSH(nsWindowLog) static NS_DEFINE_IID(kIWidgetIID, NS_IWIDGET_IID); @@ -628,7 +633,7 @@ NS_METHOD nsWindow::Move(PRInt32 aX, PRInt32 aY) NS_METHOD nsWindow::Resize(PRInt32 aWidth, PRInt32 aHeight, PRBool aRepaint) { //#if 0 - printf("$$$$$$$$$ %s::Resize %d %d Repaint: %s\n", + PRINTF("$$$$$$$$$ %s::Resize %d %d Repaint: %s\n", gInstanceClassName, aWidth, aHeight, (aRepaint?"true":"false")); //#endif @@ -810,7 +815,7 @@ NS_METHOD nsWindow::SetFont(const nsFont &aFont) NS_RELEASE(metrics); } else { - printf("****** Error: Metrics is NULL!\n"); + PRINTF("****** Error: Metrics is NULL!\n"); return NS_ERROR_FAILURE; } @@ -1238,15 +1243,15 @@ nsWindow::DebugPrintEvent(nsGUIEvent & aEvent, static int sPrintCount=0; - printf("%4d %-26s(this=%-8p , widget=%-8p", + PRINTF("%4d %-26s(this=%-8p , widget=%-8p", sPrintCount++, (const char *) nsAutoCString(debug_GuiEventToString(&aEvent)), this, (void *) aWidget); - printf(" , x=%-3d, y=%d)",aEvent.point.x,aEvent.point.y); + PRINTF(" , x=%-3d, y=%d)",aEvent.point.x,aEvent.point.y); - printf("\n"); + PRINTF("\n"); } #endif // DEBUG ////////////////////////////////////////////////////////////////// @@ -1343,12 +1348,12 @@ PRBool nsWindow::OnPaint(nsPaintEvent &event) event.renderingContext = nsnull; #if 0 if (event.rect) { - printf("nsWindow::OnPaint(this=%p, {%i,%i,%i,%i})\n", this, + PRINTF("nsWindow::OnPaint(this=%p, {%i,%i,%i,%i})\n", this, event.rect->x, event.rect->y, - event.rect->width, event.rect->height); + event.rect->width, event.rect->height); } else { - printf("nsWindow::OnPaint(this=%p, NO RECT)\n", this); + PRINTF("nsWindow::OnPaint(this=%p, NO RECT)\n", this); } #endif static NS_DEFINE_CID(kRenderingContextCID, NS_RENDERING_CONTEXT_CID); @@ -1427,7 +1432,7 @@ PRBool nsWindow::OnScroll(nsScrollbarEvent & aEvent, PRUint32 cPos) void nsWindow::SetResizeRect(nsRect& aRect) { mResizeRect = aRect; - printf("SetResizeRect: %i %i\n",mResizeRect.width,mResizeRect.height); + PRINTF("SetResizeRect: %i %i\n",mResizeRect.width,mResizeRect.height); } void nsWindow::GetResizeRect(nsRect* aRect) @@ -1520,9 +1525,9 @@ extern "C" void nsWindow_ResizeWidget(Widget w) nsWindow *win = 0; // Get the new size for the window - printf("Zuperdee says %-8p\n",(Widget&) w); + PRINTF("Zuperdee says %-8p\n",(Widget&) w); XtVaGetValues(w, XmNuserData, &win, XmNwidth, &width, XmNheight, &height, nsnull); - printf("%i %i\n",width,height); + PRINTF("%i %i\n",width,height); // Setup the resize rectangle for the window. nsRect bounds; @@ -1582,6 +1587,6 @@ NS_METHOD nsWindow::EnableFileDrop(PRBool aEnable) NS_METHOD nsWindow::CaptureMouse(PRBool aCapture) { //XXX:Implement this. - printf("nsWindow::CaptureMouse called\n"); + PRINTF("nsWindow::CaptureMouse called\n"); return NS_OK; } diff --git a/mozilla/widget/src/motif/nsXtEventHandler.cpp b/mozilla/widget/src/motif/nsXtEventHandler.cpp index 130825f0a69..d78235c0d31 100644 --- a/mozilla/widget/src/motif/nsXtEventHandler.cpp +++ b/mozilla/widget/src/motif/nsXtEventHandler.cpp @@ -34,8 +34,11 @@ #include "nsIMenuItem.h" #include "stdio.h" +#include "nslog.h" -#define DBG 0 +NS_IMPL_LOG(nsXtEventHandlerLog, 0) +#define PRINTF NS_LOG_PRINTF(nsXtEventHandlerLog) +#define FLUSH NS_LOG_FLUSH(nsXtEventHandlerLog) struct nsKeyConverter { int vkCode; // Platform independent key code @@ -283,7 +286,7 @@ void nsXtWidget_EnterMask_EventHandler(Widget w, XtPointer p, XEvent * event, Bo //============================================================== void nsXtWidget_LeaveMask_EventHandler(Widget w, XtPointer p, XEvent * event, Boolean * b) { - if (DBG) fprintf(stderr, "***************** nsXtWidget_LeaveMask_EventHandler\n"); + PRINTF("***************** nsXtWidget_LeaveMask_EventHandler\n"); nsWindow * widgetWindow = (nsWindow *) p ; nsMouseEvent mevent; nsXtWidget_InitNSMouseEvent(event, p, mevent, NS_MOUSE_EXIT); @@ -309,7 +312,7 @@ void nsXtWidget_Toggle_ArmCallback(Widget w, XtPointer p, XtPointer call_data) XmToggleButtonCallbackStruct * cbs = (XmToggleButtonCallbackStruct*)call_data; - if (DBG) fprintf(stderr, "Callback struct 0x%x\n", cbs);fflush(stderr); + PRINTF("Callback struct 0x%x\n", cbs);fflush(stderr); checkBtn->Armed(); } @@ -430,7 +433,7 @@ void nsXtWidget_Text_Callback(Widget w, XtPointer p, XtPointer call_data) if (cbs->reason == XmCR_ACTIVATE) { char* password = data->mPassword.ToNewCString(); - printf ("Password: %s\n", password); + PRINTF ("Password: %s\n", password); delete[] password; return; } @@ -446,7 +449,7 @@ void nsXtWidget_Text_Callback(Widget w, XtPointer p, XtPointer call_data) data->mPassword.Insert(insStr, cbs->currInsert, strlen(cbs->text->ptr)); } else if (cbs->startPos == cbs->currInsert && cbs->endPos != cbs->startPos) { data->mPassword.SetLength(cbs->startPos); - printf("Setting Length [%s] at %d\n", cbs->text->ptr, cbs->currInsert); + PRINTF("Setting Length [%s] at %d\n", cbs->text->ptr, cbs->currInsert); } else if (cbs->startPos == cbs->currInsert) { /* backspace */ data->mPassword.Append(cbs->text->ptr); } diff --git a/mozilla/widget/src/os2/nsAppShell.cpp b/mozilla/widget/src/os2/nsAppShell.cpp index a3c5c268718..1fe451f6d6e 100644 --- a/mozilla/widget/src/os2/nsAppShell.cpp +++ b/mozilla/widget/src/os2/nsAppShell.cpp @@ -24,6 +24,11 @@ #include "nsHashtable.h" #include "nsIEventQueueService.h" #include "nsIServiceManager.h" +#include "nslog.h" + +NS_IMPL_LOG(nsAppShellLog, 0) +#define PRINTF NS_LOG_PRINTF(nsAppShellLog) +#define FLUSH NS_LOG_FLUSH(nsAppShellLog) NS_DEFINE_CID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID); @@ -85,7 +90,7 @@ class nsAppshellManager nsIAppShell *pShell = (nsIAppShell*) mTable->Get( &key); if( pShell != aShell) - printf( "Appshell object dying in a foreign thread\n"); + PRINTF( "Appshell object dying in a foreign thread\n"); else mTable->Remove( &key); @@ -168,7 +173,7 @@ nsresult nsAppShell::Run() else { ULONG pmerr = WinGetLastError( mHab); - printf( "WinGetMsg failed with error %x -- bailing out!\n", pmerr); + PRINTF( "WinGetMsg failed with error %x -- bailing out!\n", pmerr); break; } diff --git a/mozilla/widget/src/os2/nsCanvas.cpp b/mozilla/widget/src/os2/nsCanvas.cpp index 1bbaac23244..b5fca3d13c3 100644 --- a/mozilla/widget/src/os2/nsCanvas.cpp +++ b/mozilla/widget/src/os2/nsCanvas.cpp @@ -37,6 +37,11 @@ #include "nscanvas.h" #include "nsIDeviceContext.h" #include +#include "nslog.h" + +NS_IMPL_LOG(nsCanvasLog, 0) +#define PRINTF NS_LOG_PRINTF(nsCanvasLog) +#define FLUSH NS_LOG_FLUSH(nsCanvasLog) nsCanvas::nsCanvas() : mIsTLB(FALSE) {} @@ -79,11 +84,11 @@ void nsCanvas::RealDoCreate( HWND hwndP, nsWindow *aParent, const nsRect &aRect, aContext, aAppShell, aInitData, hwndO); } #if DEBUG_sobotka - printf("\nIn nsCanvas::RealDoCreate aParent = 0x%lx\n", &aParent); - printf(" hwndP = %lu\n", hwndP); - printf(" hwnd0 = %lu\n", hwndO); - printf(" aContext = 0x%lx\n", &aContext); - printf(" aAppShell = 0x%lx\n", &aAppShell); + PRINTF("\nIn nsCanvas::RealDoCreate aParent = 0x%lx\n", &aParent); + PRINTF(" hwndP = %lu\n", hwndP); + PRINTF(" hwnd0 = %lu\n", hwndO); + PRINTF(" aContext = 0x%lx\n", &aContext); + PRINTF(" aAppShell = 0x%lx\n", &aAppShell); #endif } diff --git a/mozilla/widget/src/os2/nsClipboard.cpp b/mozilla/widget/src/os2/nsClipboard.cpp index 4042e2cd9da..5aa8809080b 100644 --- a/mozilla/widget/src/os2/nsClipboard.cpp +++ b/mozilla/widget/src/os2/nsClipboard.cpp @@ -31,6 +31,11 @@ #include "prmem.h" #include // for UniStrlen +#include "nslog.h" + +NS_IMPL_LOG(nsClipboardLog, 0) +#define PRINTF NS_LOG_PRINTF(nsClipboardLog) +#define FLUSH NS_LOG_FLUSH(nsClipboardLog) // The relation between mozilla's mime formats and those understood by the // clipboard is a little hazy, mostly in the areas of images. @@ -130,7 +135,7 @@ PRBool nsClipboard::GetClipboardData(const char *aFlavour) nsPrimitiveHelpers::CreatePrimitiveForData(flavorStr, pData, cbData, getter_AddRefs(genericDataWrapper)); nsresult errCode = mTransferable->SetTransferData(flavorStr, genericDataWrapper, cbData); #ifdef NS_DEBUG - if (errCode != NS_OK) printf("nsClipboard:: Error setting data into transferable\n"); + if (errCode != NS_OK) PRINTF("nsClipboard:: Error setting data into transferable\n"); #endif } } @@ -153,7 +158,7 @@ void nsClipboard::SetClipboardData(const char *aFlavour) nsCOMPtr genericDataWrapper; nsresult errCode = mTransferable->GetTransferData(aFlavour, getter_AddRefs(genericDataWrapper), &cbMozData); #ifdef NS_DEBUG - if (NS_FAILED(errCode)) printf("nsClipboard:: Error getting data from transferable\n"); + if (NS_FAILED(errCode)) PRINTF("nsClipboard:: Error getting data from transferable\n"); #endif nsPrimitiveHelpers::CreateDataFromPrimitive(aFlavour, genericDataWrapper, &pMozData, cbMozData); @@ -175,7 +180,7 @@ void nsClipboard::SetClipboardData(const char *aFlavour) pRecord->pfnExport(pMozData, cbMozData, pData); if (!WinSetClipbrdData(0/*hab*/, (ULONG)pData, pRecord->ulClipboardFmt, CFI_POINTER)) - printf("ERROR: nsClipboard setting %s transfer data\n", pRecord->szMimeType); + PRINTF("ERROR: nsClipboard setting %s transfer data\n", pRecord->szMimeType); } // If the flavor is unicode, we also put it on the clipboard as CF_TEXT @@ -199,7 +204,7 @@ void nsClipboard::SetClipboardData(const char *aFlavour) pRecord->pfnExport((void*)plainTextData, plainTextLen, pData); if (!WinSetClipbrdData(0/*hab*/, (ULONG)pData, CF_TEXT, CFI_POINTER)) - printf("ERROR: nsClipboard setting CF_TEXT\n"); + PRINTF("ERROR: nsClipboard setting CF_TEXT\n"); } } PR_Free(uniBuf); diff --git a/mozilla/widget/src/os2/nsDragService.cpp b/mozilla/widget/src/os2/nsDragService.cpp index dce3a1c2504..b019b060ced 100644 --- a/mozilla/widget/src/os2/nsDragService.cpp +++ b/mozilla/widget/src/os2/nsDragService.cpp @@ -34,6 +34,11 @@ #include // for sscanf #include // realloc/free +#include "nslog.h" + +NS_IMPL_LOG(nsDragServiceLog, 0) +#define PRINTF NS_LOG_PRINTF(nsDragServiceLog) +#define FLUSH NS_LOG_FLUSH(nsDragServiceLog) // // There are three major cases to consider: @@ -202,7 +207,7 @@ nsresult nsDragService::GetData( nsITransferable *aTransferable, nsFileSpec file; if( !FindFile( pItem, file)) - printf( "Can't find dropped file\n"); + PRINTF( "Can't find dropped file\n"); else { cData = file.GetFileSize(); @@ -225,7 +230,7 @@ nsresult nsDragService::GetData( nsITransferable *aTransferable, else { const char *rmf = DecodeStrHandle( pItem->hstrRMF); - printf( "Incomprehensible DRM (%s)\n", rmf); + PRINTF( "Incomprehensible DRM (%s)\n", rmf); } if( pData && cData) @@ -240,7 +245,7 @@ nsresult nsDragService::GetData( nsITransferable *aTransferable, nsCOMPtr pFileList = do_QueryInterface(aTransferable); if( !pFileList) - printf( "kDropFilesMime requested but no filelisttransferable!\n"); + PRINTF( "kDropFilesMime requested but no filelisttransferable!\n"); else { // Need a file. @@ -273,7 +278,7 @@ nsresult nsDragService::GetData( nsITransferable *aTransferable, nsFileSpec file; if( !FindFile( pItem, file)) - printf( "Can't find dropped file\n"); + PRINTF( "Can't find dropped file\n"); else pFileSpec = new nsFileSpec(file); } @@ -286,7 +291,7 @@ nsresult nsDragService::GetData( nsITransferable *aTransferable, else { const char *rmf = DecodeStrHandle( pItem->hstrRMF); - printf( "Incomprehensible DRM -> file (%s)\n", rmf); + PRINTF( "Incomprehensible DRM -> file (%s)\n", rmf); } // Did we get one? @@ -329,8 +334,8 @@ nsresult nsDragService::IsDataFlavorSupported( nsString *aDataFlavour) const char *rf = MimeTypeToRF( buff); #ifdef DEBUG - printf( "IsDataFlavorSupported %s\n", buff); - printf( "RF for that is %s\n", rf); + PRINTF( "IsDataFlavorSupported %s\n", buff); + PRINTF( "RF for that is %s\n", rf); #endif if( rf) @@ -348,7 +353,7 @@ nsresult nsDragService::IsDataFlavorSupported( nsString *aDataFlavour) } #ifdef DEBUG - printf( "Flavor is %ssupported.\n", rc == NS_OK ? "" : "not "); + PRINTF( "Flavor is %ssupported.\n", rc == NS_OK ? "" : "not "); #endif return rc; @@ -512,7 +517,7 @@ void nsDragService::FillDragItem( PDRAGITEM aItem, nsITransferable *aTransferabl nsVoidArray *pFormats = nsnull; aTransferable->FlavorsTransferableCanExport( &pFormats); - // XXX DRM_DISCARD and DRM_PRINTFILE to come when xptoolkit decides how + // XXX DRM_DISCARD and DRM_PRINTFLEto come when xptoolkit decides how // (whether...) to handle them char rmf[200] = "(DRM_OS2FILE,DRM_MOZILLA) X (DRF_UNKNOWN"; @@ -691,7 +696,7 @@ MRESULT nsDragService::HandleMessage( ULONG msg, MPARAM mp1, MPARAM mp2) #ifdef DEBUG char *target = DecodeStrHandle( pXFer->hstrRenderToName); - printf( "Source-rendering to %s\n", target); + PRINTF( "Source-rendering to %s\n", target); nsFileSpec dest( target); #else nsFileSpec dest( DecodeStrHandle( pXFer->hstrRenderToName)); @@ -703,7 +708,7 @@ MRESULT nsDragService::HandleMessage( ULONG msg, MPARAM mp1, MPARAM mp2) NS_ASSERTION(tokens == 2, "Couldn't parse hstrSelectedRMF"); #ifdef DEBUG - printf( "%d - %s %s\n", tokens, rm, rf); + PRINTF( "%d - %s %s\n", tokens, rm, rf); #endif if( !strcmp( rm, "DRM_OS2FILE")) { @@ -738,12 +743,12 @@ MRESULT nsDragService::HandleMessage( ULONG msg, MPARAM mp1, MPARAM mp2) delete pFormats; if( i == cFormats) #ifdef DEBUG - printf( "Target asked for format %s which we can't do.\n", rf); + PRINTF( "Target asked for format %s which we can't do.\n", rf); #endif } else { - printf( "Unexpected rendering mechanism\n"); + PRINTF( "Unexpected rendering mechanism\n"); } // Tell the target we're done. @@ -813,7 +818,7 @@ MRESULT nsDragService::HandleMessage( ULONG msg, MPARAM mp1, MPARAM mp2) mDragInfo = 0; } #ifdef DEBUG - printf( "DM_ENDCONVERSATION, mDragItems = %d\n", (int)mDragItems); + PRINTF( "DM_ENDCONVERSATION, mDragItems = %d\n", (int)mDragItems); #endif return 0; } @@ -838,7 +843,7 @@ void nsDragService::DoMozillaXfer( PDRAGITEM pItem, char *szFlavour, // Yes. nsITransferable *pSource = (nsITransferable*) pItem->ulItemID; if( !pSource) - printf( "intra-process xfer fails due to null ulItemID\n"); + PRINTF( "intra-process xfer fails due to null ulItemID\n"); else { nsAutoString flavour(szFlavour); @@ -909,8 +914,8 @@ void nsDragService::DoPushedOS2FILE( PDRAGITEM pItem, const char *szRf, // But it's not all bad: not many people use source rendering; mozilla // does, but we can use DRM_MOZILLA to do that. - printf( "\n\nSorry, source-rendering of DRM_OS2FILE not working.\n"); - printf( "(see mozilla/widget/src/os2/nsDragService::DoPushedOS2FILE)\n\n"); + PRINTF( "\n\nSorry, source-rendering of DRM_OS2FILE not working.\n"); + PRINTF( "(see mozilla/widget/src/os2/nsDragService::DoPushedOS2FILE)\n\n"); } // Quick utility functions ------------------------------------------------------ @@ -957,12 +962,12 @@ static BOOL FindFile( PDRAGITEM pItem, nsFileSpec &aFileSpec) { const char *str = DecodeStrHandle( pItem->hstrContainerName); #ifdef DEBUG - printf( "Getting drag data from `%s'", str); + PRINTF( "Getting drag data from `%s'", str); #endif aFileSpec = str; str = DecodeStrHandle( pItem->hstrSourceName); #ifdef DEBUG - printf( "`%s'\n", str); + PRINTF( "`%s'\n", str); #endif aFileSpec += str; diff --git a/mozilla/widget/src/os2/nsFSTree.cpp b/mozilla/widget/src/os2/nsFSTree.cpp index aac4a844ca2..1b0ec963856 100644 --- a/mozilla/widget/src/os2/nsFSTree.cpp +++ b/mozilla/widget/src/os2/nsFSTree.cpp @@ -45,12 +45,11 @@ #define NDEBUG #include #include "nsFSTree.h" +#include "nslog.h" -#ifdef DEBUG -# define TRACE(x) printf x -#else -# define TRACE(x) -#endif +NS_IMPL_LOG(nsFSTreeLog, 0) +#define PRINTF NS_LOG_PRINTF(nsFSTreeLog) +#define FLUSH NS_LOG_FLUSH(nsFSTreeLog) // helper Dos* style functions APIRET DosQueryNumDrives( PULONG cDrives); @@ -467,7 +466,7 @@ void fsTree::SendMsg( fsDir *aDir, RQPacket::Cmd aCmd) APIRET rc = mRQQueue.Write( &packet); if( rc) - TRACE(( "ERROR: fsTree::SendMsg (RQ) rc = %d\n", (int)rc)); + PRINTF( "ERROR: fsTree::SendMsg (RQ) rc = %d\n", (int)rc); } void fsTree::SendMsg( fsDir *aDir, CBPacket::Cmd aCmd) @@ -476,7 +475,7 @@ void fsTree::SendMsg( fsDir *aDir, CBPacket::Cmd aCmd) APIRET rc = mCBQueue.Write( &packet); if( rc) - TRACE(( "ERROR: fsTree::SendMsg (CB 1) rc = %d\n", (int)rc)); + PRINTF( "ERROR: fsTree::SendMsg (CB 1) rc = %d\n", (int)rc); } void fsTree::SendMsg( fsFile *aFile, CBPacket::Cmd aCmd) @@ -485,7 +484,7 @@ void fsTree::SendMsg( fsFile *aFile, CBPacket::Cmd aCmd) APIRET rc = mCBQueue.Write( &packet); if( rc) - TRACE(( "ERROR: fsTree::SendMsg (CB 2) rc = %d\n", (int)rc)); + PRINTF( "ERROR: fsTree::SendMsg (CB 2) rc = %d\n", (int)rc); } void fsTree::SendCompleteMsg() @@ -494,7 +493,7 @@ void fsTree::SendCompleteMsg() APIRET rc = mCBQueue.Write( &packet); if( rc) - TRACE(( "ERROR: fsTree::SendMsg (CB 3) rc = %d\n", (int)rc)); + PRINTF( "ERROR: fsTree::SendMsg (CB 3) rc = %d\n", (int)rc); } // Scanner thread --------------------------------------------------------------- @@ -522,7 +521,7 @@ void fsTree::Scan() APIRET rc = mRQQueue.Read( &pkt); if( rc) { - TRACE(( "scanThread got rc %d, quitting\n", (int)rc)); + PRINTF( "scanThread got rc %d, quitting\n", (int)rc); break; } @@ -789,7 +788,7 @@ void fsTree::Notify() APIRET rc = mCBQueue.Read( &pkt); if( rc) { - TRACE(( "notifyThread got rc %d, quitting\n", (int)rc)); + PRINTF( "notifyThread got rc %d, quitting\n", (int)rc); break; } diff --git a/mozilla/widget/src/os2/nsFileDialog.cpp b/mozilla/widget/src/os2/nsFileDialog.cpp index 4a002ea4614..96a1a41aa39 100644 --- a/mozilla/widget/src/os2/nsFileDialog.cpp +++ b/mozilla/widget/src/os2/nsFileDialog.cpp @@ -25,6 +25,11 @@ #include "nsDirPicker.h" #include +#include "nslog.h" + +NS_IMPL_LOG(nsFileDialogLog, 0) +#define PRINTF NS_LOG_PRINTF(nsFileDialogLog) +#define FLUSH NS_LOG_FLUSH(nsFileDialogLog) // File dialog. // @@ -105,7 +110,7 @@ nsresult nsFileDialog::SetDisplayDirectory( const nsFileSpec &aDirectory) strcat( mFileDlg.szFullFile, buff); #ifdef DEBUG - printf( "SetDisplayDir, szFullFile = %s\n", mFileDlg.szFullFile); + PRINTF( "SetDisplayDir, szFullFile = %s\n", mFileDlg.szFullFile); #endif return NS_OK; @@ -115,7 +120,7 @@ nsresult nsFileDialog::GetDisplayDirectory( nsFileSpec &aDirectory) { char buff[CCHMAXPATH] = ""; strcpy( buff, mFileDlg.szFullFile); - printf( "mFileDlg.szFullFile = %s\n", buff); + PRINTF( "mFileDlg.szFullFile = %s\n", buff); char *lastslash = strrchr( buff, '\\'); if( lastslash && '\0' != *lastslash) diff --git a/mozilla/widget/src/os2/nsFontRetrieverService.cpp b/mozilla/widget/src/os2/nsFontRetrieverService.cpp index 6a50edc5066..78eb660d5c6 100644 --- a/mozilla/widget/src/os2/nsFontRetrieverService.cpp +++ b/mozilla/widget/src/os2/nsFontRetrieverService.cpp @@ -27,6 +27,11 @@ #include "nsFont.h" #include "nsVoidArray.h" #include "nsFontSizeIterator.h" +#include "nslog.h" + +NS_IMPL_LOG(nsFontRetrieverServiceLog, 0) +#define PRINTF NS_LOG_PRINTF(nsFontRetrieverServiceLog) +#define FLUSH NS_LOG_FLUSH(nsFontRetrieverServiceLog) NS_IMPL_ADDREF(nsFontRetrieverService) NS_IMPL_RELEASE(nsFontRetrieverService) @@ -202,7 +207,7 @@ NS_IMETHODIMP nsFontRetrieverService::LoadFontList() font->mIsScalable = PR_FALSE; font->mSizes = nsnull; #ifdef DEBUG_sobotka - printf("Added FONT %s\n", font->mName.ToNewCString()); + PRINTF("Added FONT %s\n", font->mName.ToNewCString()); #endif mFontList->AppendElement(font); diff --git a/mozilla/widget/src/os2/nsFrameWindow.cpp b/mozilla/widget/src/os2/nsFrameWindow.cpp index 3272244ad6f..9aab40e261c 100644 --- a/mozilla/widget/src/os2/nsFrameWindow.cpp +++ b/mozilla/widget/src/os2/nsFrameWindow.cpp @@ -36,6 +36,11 @@ #include "nsFrameWindow.h" #include "nsIRollupListener.h" +#include "nslog.h" + +NS_IMPL_LOG(nsFrameWindowLog, 0) +#define PRINTF NS_LOG_PRINTF(nsFrameWindowLog) +#define FLUSH NS_LOG_FLUSH(nsFrameWindowLog) static PRBool haveHiddenWindow = PR_FALSE; @@ -82,10 +87,10 @@ void nsFrameWindow::RealDoCreate( HWND hwndP, nsWindow *aParent, "Attempt to create non-top-level frame"); */ #if DEBUG_sobotka - printf("\nIn nsFrameWindow::RealDoCreate:\n"); - printf(" hwndP = %lu\n", hwndP); - printf(" aParent = 0x%lx\n", &aParent); - printf(" aRect = %ld, %ld, %ld, %ld\n", aRect.x, aRect.y, aRect.height, aRect.width); + PRINTF("\nIn nsFrameWindow::RealDoCreate:\n"); + PRINTF(" hwndP = %lu\n", hwndP); + PRINTF(" aParent = 0x%lx\n", &aParent); + PRINTF(" aRect = %ld, %ld, %ld, %ld\n", aRect.x, aRect.y, aRect.height, aRect.width); #endif // Create the frame window. diff --git a/mozilla/widget/src/os2/nsModule.cpp b/mozilla/widget/src/os2/nsModule.cpp index cb36768a7ae..022a8e741da 100644 --- a/mozilla/widget/src/os2/nsModule.cpp +++ b/mozilla/widget/src/os2/nsModule.cpp @@ -37,6 +37,11 @@ #include "resid.h" #include #include +#include "nslog.h" + +NS_IMPL_LOG(nsModuleLog, 0) +#define PRINTF NS_LOG_PRINTF(nsModuleLog) +#define FLUSH NS_LOG_FLUSH(nsModuleLog) // Module-level data & utility functions: // * unicode keycode & string conversion @@ -68,7 +73,7 @@ void nsWidgetModuleData::Init( nsIAppShell *aPrimaevalAppShell) if( rc) { - printf( "Widget failed to load resource DLL. rc = %d, cause = %s\n", + PRINTF( "Widget failed to load resource DLL. rc = %d, cause = %s\n", (int)rc, buffer); hModResources = 0; } @@ -180,7 +185,7 @@ HPOINTER nsWidgetModuleData::GetPointer( nsCursor aCursor) if( idPtr == 0) { idPtr = ID_PTR_SELECTURL; // default to hyperlink cursor? - printf( "\n*** Need to implement cursor type %d (see widget/src/os2/nsModule.cpp)\n\n", (int) aCursor); + PRINTF( "\n*** Need to implement cursor type %d (see widget/src/os2/nsModule.cpp)\n\n", (int) aCursor); } // Use an array and indices here since we have all the pointers in place? @@ -213,14 +218,14 @@ int nsWidgetModuleData::CreateUcsConverter() #ifdef DEBUG if( unirc == ULS_SUCCESS) { - printf( "Widget library created unicode converter for cp %s\n", + PRINTF( "Widget library created unicode converter for cp %s\n", ConvertFromUcs( (PRUnichar *) codepage)); } #endif } if( unirc != ULS_SUCCESS) { - printf( "Couldn't create widget unicode converter.\n"); + PRINTF( "Couldn't create widget unicode converter.\n"); } return unirc; @@ -280,7 +285,7 @@ PRUnichar *nsWidgetModuleData::ConvertToUcs( const char *szText, } else if( unirc != ULS_SUCCESS) { - printf( "UniUconvToUcs failed, rc %X\n", unirc); + PRINTF( "UniUconvToUcs failed, rc %X\n", unirc); supplantConverter = TRUE; pBuffer = ConvertToUcs( szText, pBuffer, ulSize); supplantConverter = FALSE; @@ -342,7 +347,7 @@ char *nsWidgetModuleData::ConvertFromUcs( const PRUnichar *pText, } else if( unirc != ULS_SUCCESS) { - printf( "UniUconvFromUcs failed, rc %X\n", unirc); + PRINTF( "UniUconvFromUcs failed, rc %X\n", unirc); supplantConverter = TRUE; szBuffer = ConvertFromUcs( pText, szBuffer, ulSize); supplantConverter = FALSE; diff --git a/mozilla/widget/src/os2/nsSound.cpp b/mozilla/widget/src/os2/nsSound.cpp index e95bcb5130c..e39c2afa548 100644 --- a/mozilla/widget/src/os2/nsSound.cpp +++ b/mozilla/widget/src/os2/nsSound.cpp @@ -32,6 +32,11 @@ #include "nsSound.h" #include "nsIURL.h" #include "nsNetUtil.h" +#include "nslog.h" + +NS_IMPL_LOG(nsSoundLog, 0) +#define PRINTF NS_LOG_PRINTF(nsSoundLog) +#define FLUSH NS_LOG_FLUSH(nsSoundLog) NS_IMPL_ISUPPORTS2(nsSound, nsISound, nsIStreamLoaderObserver) @@ -69,7 +74,7 @@ NS_IMETHODIMP nsSound::OnStreamComplete(nsIStreamLoader *aLoader, if (uri) { char* uriSpec; uri->GetSpec(&uriSpec); - printf("Failed to load %s\n", uriSpec ? uriSpec : ""); + PRINTF("Failed to load %s\n", uriSpec ? uriSpec : ""); } } } @@ -94,7 +99,7 @@ NS_METHOD nsSound::Play(nsIURL *aURL) #ifdef DEBUG_SOUND char *url; aURL->GetSpec(&url); - printf("%s\n", url); + PRINTF("%s\n", url); #endif nsCOMPtr loader; diff --git a/mozilla/widget/src/os2/nsWindow.cpp b/mozilla/widget/src/os2/nsWindow.cpp index 3865c93e69d..37a0c7a988c 100644 --- a/mozilla/widget/src/os2/nsWindow.cpp +++ b/mozilla/widget/src/os2/nsWindow.cpp @@ -73,6 +73,11 @@ #include #include +#include "nslog.h" + +NS_IMPL_LOG(nsWindowLog, 0) +#define PRINTF NS_LOG_PRINTF(nsWindowLog) +#define FLUSH NS_LOG_FLUSH(nsWindowLog) #ifdef DEBUG_sobotka static int WINDOWCOUNT = 0; @@ -324,7 +329,7 @@ void nsWindow::InitEvent(nsGUIEvent& event, PRUint32 aEventType, nsPoint* aPoint WinMapWindowPoints( HWND_DESKTOP, mWnd, &ptl, 1); #if 0 - printf("++++++++++nsWindow::InitEvent (!pt) mapped point = %ld, %ld\n", ptl.x, ptl.y); + PRINTF("++++++++++nsWindow::InitEvent (!pt) mapped point = %ld, %ld\n", ptl.x, ptl.y); #endif PM2NS( ptl); @@ -333,7 +338,7 @@ void nsWindow::InitEvent(nsGUIEvent& event, PRUint32 aEventType, nsPoint* aPoint event.point.y = ptl.y; #if 0 - printf("++++++++++nsWindow::InitEvent (!pt) converted point = %ld, %ld\n", ptl.x, ptl.y); + PRINTF("++++++++++nsWindow::InitEvent (!pt) converted point = %ld, %ld\n", ptl.x, ptl.y); #endif } else @@ -342,7 +347,7 @@ void nsWindow::InitEvent(nsGUIEvent& event, PRUint32 aEventType, nsPoint* aPoint event.point.y = aPoint->y; #if 0 - printf("++++++++++nsWindow::InitEvent point = %ld, %ld\n", aPoint->x, aPoint->y); + PRINTF("++++++++++nsWindow::InitEvent point = %ld, %ld\n", aPoint->x, aPoint->y); #endif } @@ -823,11 +828,11 @@ void nsWindow::RealDoCreate( HWND hwndP, NS_ASSERTION( mWnd, "Couldn't create window"); #if DEBUG_sobotka - printf("\n+++++++++++In nsWindow::RealDoCreate created 0x%lx, %d x %d\n", - mWnd, aRect.width, aRect.height); - printf("+++++++++++Location = %d x %d\n", aRect.x, aRect.y); - printf("+++++++++++Parent = 0x%lx\n", GetParentHWND()); - printf("+++++++++++WINDOWCOUNT+ = %d\n", ++WINDOWCOUNT); + PRINTF("\n+++++++++++In nsWindow::RealDoCreate created 0x%lx, %d x %d\n", + mWnd, aRect.width, aRect.height); + PRINTF("+++++++++++Location = %d x %d\n", aRect.x, aRect.y); + PRINTF("+++++++++++Parent = 0x%lx\n", GetParentHWND()); + PRINTF("+++++++++++WINDOWCOUNT+ = %d\n", ++WINDOWCOUNT); #endif // Make sure we have a device context from somewhere @@ -848,7 +853,7 @@ void nsWindow::RealDoCreate( HWND hwndP, mContext->Init( (nsNativeWidget) mWnd); #ifdef DEBUG else - printf( "Couldn't find DC instance for nsWindow\n"); + PRINTF( "Couldn't find DC instance for nsWindow\n"); #endif } WinSetPresParam( mWnd, PP_FONTNAMESIZE, @@ -956,8 +961,8 @@ NS_METHOD nsWindow::Destroy() else { #if DEBUG_sobotka - printf("\n++++++++++nsWindow::Destroy trashing 0x%lx\n\n", mHackDestroyWnd ? mHackDestroyWnd : mWnd); - printf("+++++++++++WINDOWCOUNT- = %d\n\n", --WINDOWCOUNT); + PRINTF("\n++++++++++nsWindow::Destroy trashing 0x%lx\n\n", mHackDestroyWnd ? mHackDestroyWnd : mWnd); + PRINTF("+++++++++++WINDOWCOUNT- = %d\n\n", --WINDOWCOUNT); #endif // avoid calling into other objects if we're being deleted, 'cos // they must have no references to us. @@ -1017,7 +1022,7 @@ void nsWindow::NS2PM( POINTL &ptl) { ptl.y = GetClientHeight() - ptl.y - 1; #if 0 - printf("+++++++++In NS2PM client height = %ld\n", GetClientHeight()); + PRINTF("+++++++++In NS2PM client height = %ld\n", GetClientHeight()); #endif } @@ -1187,7 +1192,7 @@ NS_METHOD nsWindow::Resize(PRInt32 aX, Update(); #if DEBUG_sobotka - printf("+++++++++++Resized 0x%lx at %ld, %ld to %ld x %ld\n\n", mWnd, ptl.x, ptl.y, w, GetHeight(h)); + PRINTF("+++++++++++Resized 0x%lx at %ld, %ld to %ld x %ld\n\n", mWnd, ptl.x, ptl.y, w, GetHeight(h)); #endif } @@ -1329,7 +1334,7 @@ NS_METHOD nsWindow::SetFont(const nsFont &aFont) BOOL rc = WinSetPresParam( mWnd, PP_FONTNAMESIZE, strlen( buffer) + 1, buffer); if( !rc) - printf( "WinSetPresParam PP_FONTNAMESIZE %s failed\n", buffer); + PRINTF( "WinSetPresParam PP_FONTNAMESIZE %s failed\n", buffer); delete [] buffer; } @@ -1535,7 +1540,7 @@ void* nsWindow::GetNativeData(PRUint32 aDataType) break; default: #ifdef DEBUG - printf( "*** Someone's added a new NS_NATIVE value...\n"); + PRINTF( "*** Someone's added a new NS_NATIVE value...\n"); #endif break; } @@ -1556,7 +1561,7 @@ void nsWindow::FreeNativeData(void * data, PRUint32 aDataType) if( mDragInside) rc = DrgReleasePS( mPS); else rc = WinReleasePS( mPS); if( !rc) - printf( "Error from {Win/Drg}ReleasePS()\n"); + PRINTF( "Error from {Win/Drg}ReleasePS()\n"); mPS = 0; } break; @@ -1570,9 +1575,7 @@ void nsWindow::FreeNativeData(void * data, PRUint32 aDataType) case NS_NATIVE_COLORMAP: break; default: -#ifdef DEBUG - printf( "*** Someone's added a new NS_NATIVE value...\n"); -#endif + PRINTF( "*** Someone's added a new NS_NATIVE value...\n"); break; } } @@ -2359,7 +2362,7 @@ PRBool nsWindow::DispatchMouseEvent( PRUint32 aEventType, MPARAM mp1, MPARAM mp2 gCurrentWindow = this; } } else { - //printf("Mouse exit"); + //PRINTF("Mouse exit"); } } break; diff --git a/mozilla/widget/src/photon/PtRawDrawContainer.cpp b/mozilla/widget/src/photon/PtRawDrawContainer.cpp index 7bcec143c64..b8742f9f4dd 100644 --- a/mozilla/widget/src/photon/PtRawDrawContainer.cpp +++ b/mozilla/widget/src/photon/PtRawDrawContainer.cpp @@ -1,7 +1,34 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + */ + /* PtRawDrawContainer.c - widget source file */ #include "PtRawDrawContainer.h" #include +#include "nslog.h" + +NS_IMPL_LOG(PtRawDrawContainerLog, 0) +#define PRINTF NS_LOG_PRINTF(PtRawDrawContainerLog) +#define FLUSH NS_LOG_FLUSH(PtRawDrawContainerLog) /* prototype declarations */ PtWidgetClass_t *CreateRawDrawContainerClass( void ); @@ -32,7 +59,7 @@ static void raw_draw_container_draw( PtWidget_t *widget, PhTile_t *damage ) if (widget == NULL) { - printf("raw_draw_container_draw NULL widget!\n"); + PRINTF("raw_draw_container_draw NULL widget!\n"); return; } diff --git a/mozilla/widget/src/photon/nsAppShell.cpp b/mozilla/widget/src/photon/nsAppShell.cpp index c092c12c80a..d18dc01e638 100644 --- a/mozilla/widget/src/photon/nsAppShell.cpp +++ b/mozilla/widget/src/photon/nsAppShell.cpp @@ -36,6 +36,11 @@ #include #include +#include "nslog.h" + +NS_IMPL_LOG(nsAppShellLog, 0) +#define PRINTF NS_LOG_PRINTF(nsAppShellLog) +#define FLUSH NS_LOG_FLUSH(nsAppShellLog) /* Global Definitions */ PRBool nsAppShell::gExitMainLoop = PR_FALSE; @@ -62,7 +67,7 @@ our_photon_input_add (int fd, event_processor_callback,data); if (err != 0) { - NS_ASSERTION(0,"nsAppShell::our_photon_input_add Error calling PtAppAddFD\n"); + NS_ASSERTION(0,"nsAppShell::our_photon_input_add Error calling PtAppAddFD"); } return (err); @@ -93,7 +98,7 @@ nsAppShell::~nsAppShell() if (err==-1) { - printf("nsAppShell::~EventQueueTokenQueue Run Error calling PtAppRemoveFd mFD=<%d> errno=<%d>\n", mFD, errno); + PRINTF("nsAppShell::~EventQueueTokenQueue Run Error calling PtAppRemoveFd mFD=<%d> errno=<%d>", mFD, errno); } mFD = -1; } @@ -121,12 +126,16 @@ NS_IMETHODIMP nsAppShell::SetDispatchListener(nsDispatchListener* aDispatchListe static int event_processor_callback(int fd, void *data, unsigned mode) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsAppShell::event_processor_callback fd=<%d> data=<%p> mode=<%d>\n", fd, data, mode)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsAppShell::event_processor_callback fd=<%d> data=<%p> mode=<%d>", fd, data, mode)); nsIEventQueue *eventQueue = (nsIEventQueue*)data; if (eventQueue) eventQueue->ProcessPendingEvents(); + nsIEventQueue *eventQueue = (nsIEventQueue*)data; + if (eventQueue) + eventQueue->ProcessPendingEvents(); + return Pt_CONTINUE; } @@ -147,7 +156,7 @@ NS_IMETHODIMP nsAppShell::Create(int *bac, char **bav) PhWidLog = PR_NewLogModule("PhWidLog"); } - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsAppShell::Create\n")); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsAppShell::Create")); int argc = bac ? *bac : 0; char **argv = bav; @@ -240,7 +249,7 @@ void MyMainLoop( void ) PtProcessEvent(); } - NS_WARNING("MyMainLoop exiting!\n"); + NS_WARNING("MyMainLoop exiting!"); } //------------------------------------------------------------------------- @@ -289,7 +298,7 @@ NS_METHOD nsAppShell::GetNativeEvent(PRBool &aRealEvent, void *&aEvent) NS_METHOD nsAppShell::DispatchNativeEvent(PRBool aRealEvent, void * aEvent) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsAppShell::DispatchNativeEvent aRealEvent=<%d> aEvent=<%p> mEventQueue=<%p>\n", aRealEvent, aEvent, mEventQueue)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsAppShell::DispatchNativeEvent aRealEvent=<%d> aEvent=<%p> mEventQueue=<%p>", aRealEvent, aEvent, mEventQueue)); if (!mEventQueue) diff --git a/mozilla/widget/src/photon/nsClipboard.cpp b/mozilla/widget/src/photon/nsClipboard.cpp index f2fbf099486..59d5ccba89c 100644 --- a/mozilla/widget/src/photon/nsClipboard.cpp +++ b/mozilla/widget/src/photon/nsClipboard.cpp @@ -38,6 +38,11 @@ #include "nsVoidArray.h" #include "nsPhWidgetLog.h" +#include "nslog.h" + +NS_IMPL_LOG(nsClipboardLog, 0) +#define PRINTF NS_LOG_PRINTF(nsClipboardLog) +#define FLUSH NS_LOG_FLUSH(nsClipboardLog) // Initialize the class statics: @@ -70,7 +75,7 @@ NS_IMETHODIMP nsClipboard::ForceDataToClipboard(PRInt32 aWhichClipboard) PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsClipboard::ForceDataToClipboard this=<%p>\n", this)); #ifdef DEBUG_CLIPBOARD - printf("nsClipboard::ForceDataToClipboard this=<%p>\n", this); + PRINTF("nsClipboard::ForceDataToClipboard this=<%p>\n", this); #endif // make sure we have a good transferable @@ -88,7 +93,7 @@ NS_IMETHODIMP nsClipboard::SetNativeClipboardData(PRInt32 aWhichClipboard) PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsClipboard::SetNativeClipboardData this=<%p>\n", this)); #ifdef DEBUG_CLIPBOARD - printf("nsClipboard::SetNativeClipboardData this=<%p>\n", this); + PRINTF("nsClipboard::SetNativeClipboardData this=<%p>\n", this); #endif nsresult res = NS_ERROR_FAILURE; @@ -96,7 +101,7 @@ NS_IMETHODIMP nsClipboard::SetNativeClipboardData(PRInt32 aWhichClipboard) // make sure we have a good transferable if (nsnull == mTransferable) { - printf("nsClipboard::SetNativeClipboardData(): no transferable!\n"); + PRINTF("nsClipboard::SetNativeClipboardData(): no transferable!\n"); return NS_ERROR_FAILURE; } @@ -148,18 +153,18 @@ NS_IMETHODIMP nsClipboard::SetNativeClipboardData(PRInt32 aWhichClipboard) PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsClipboard::SetNativeClipboardData adding %d index=<%d> type=<%s> length=%d data=<%s>\n", i, index, cliphdr[index].type, dataLen, data)); -printf("nsClipboard::setNativeClipboardData 1 data=<%s> dataLen=<%d> \n", data, dataLen ); + PRINTF("nsClipboard::setNativeClipboardData 1 data=<%s> dataLen=<%d> \n", data, dataLen ); #if defined(DEBUG) && 0 { unsigned char *ptr = data; int i=0; - printf("nsClipboard::setNativeClipboardData before: "); + PRINTF("nsClipboard::setNativeClipboardData before: "); for(i=0; i < dataLen; ptr++,i++) { - printf("%x ",*ptr); + PRINTF("%x ",*ptr); } - printf("\n"); + PRINTF("\n"); } #endif @@ -167,18 +172,18 @@ printf("nsClipboard::setNativeClipboardData 1 data=<%s> dataLen=<%d> \n", data, char *mbsbuffer = (char *) calloc(dataLen,1); /* MEMORY LEAK */ len = wcstombs (mbsbuffer, (const wchar_t*) data, dataLen); -printf("nsClipboard::setNativeClipboardData 2 mbsbuffer=<%s> dataLen=<%d> len=<%d> \n", mbsbuffer, dataLen, len ); + PRINTF("nsClipboard::setNativeClipboardData 2 mbsbuffer=<%s> dataLen=<%d> len=<%d> \n", mbsbuffer, dataLen, len ); #if defined(DEBUG) && 0 { unsigned char *ptr = mbsbuffer; int i=0; - printf("nsClipboard::setNativeClipboardData after: "); + PRINTF("nsClipboard::setNativeClipboardData after: "); for(i=0; i < len; ptr++,i++) { - printf("%x ",*ptr); + PRINTF("%x ",*ptr); } - printf("\n"); + PRINTF("\n"); } #endif @@ -221,14 +226,14 @@ nsClipboard::GetNativeClipboardData(nsITransferable * aTransferable, { PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsClipboard::GetNativeClipboardData this=<%p>\n", this)); #ifdef DEBUG_CLIPBOARD - printf("nsClipboard::GetNativeClipboardData this=<%p>\n", this); + PRINTF("nsClipboard::GetNativeClipboardData this=<%p>\n", this); #endif nsresult res = NS_ERROR_FAILURE; // make sure we have a good transferable if (nsnull == aTransferable) { - printf(" GetNativeClipboardData: Transferable is null!\n"); + PRINTF(" GetNativeClipboardData: Transferable is null!\n"); return NS_ERROR_FAILURE; } @@ -276,18 +281,18 @@ nsClipboard::GetNativeClipboardData(nsITransferable * aTransferable, data = cliphdr->data; dataLen = cliphdr->length; -printf("nsClipboard::GetNativeClipboardData 1 data=<%s> dataLen=<%d> \n", data, dataLen ); + PRINTF("nsClipboard::GetNativeClipboardData 1 data=<%s> dataLen=<%d> \n", data, dataLen ); #if defined(DEBUG) && 0 { unsigned char *ptr = data; int i=0; - printf("nsClipboard::GetNativeClipboardData before: "); + PRINTF("nsClipboard::GetNativeClipboardData before: "); for(i=0; i < dataLen; ptr++,i++) { - printf("%x ",*ptr); + PRINTF("%x ",*ptr); } - printf("\n"); + PRINTF("\n"); } #endif @@ -295,23 +300,23 @@ printf("nsClipboard::GetNativeClipboardData 1 data=<%s> dataLen=<%d> \n", data, wchar_t *wbuffer = (wchar_t *) calloc(dataLen*3, 1); /* MEMORY LEAK */ len = mbstowcs(wbuffer, (const char *) data, dataLen*3); - printf("nsClipboard::GetNativeClipboardData %s(%d)\n", data, len ); + PRINTF("nsClipboard::GetNativeClipboardData %s(%d)\n", data, len ); data = wbuffer; dataLen = len*2; -printf("nsClipboard::GetNativeClipboardData 2 data=<%s> dataLen=<%d>\n", data, dataLen ); + PRINTF("nsClipboard::GetNativeClipboardData 2 data=<%s> dataLen=<%d>\n", data, dataLen ); #if defined(DEBUG) && 0 { unsigned char *ptr = data; int i=0; - printf("nsClipboard::GetNativeClipboardData after: "); + PRINTF("nsClipboard::GetNativeClipboardData after: "); for(i=0; i < dataLen; ptr++,i++) { - printf("%x ",*ptr); + PRINTF("%x ",*ptr); } - printf("\n"); + PRINTF("\n"); } #endif @@ -332,7 +337,7 @@ printf("nsClipboard::GetNativeClipboardData 2 data=<%s> dataLen=<%d>\n", data, d aTransferable->SetTransferData(flavorStr, genericDataWrapper, dataLen); - printf("nsClipboard::GetNativeClipboardData flavorStr=<%s> length=<%d> data=<%s>\n", cliptype.type, dataLen, data ); +PRINTF("nsClipboard::GetNativeClipboardData flavorStr=<%s> length=<%d> data=<%s>\n", cliptype.type, dataLen, data ); res = NS_OK; break; } @@ -368,7 +373,7 @@ nsClipboard::HasDataMatchingFlavors(nsISupportsArray* aFlavorList, { nsXPIDLCString flavorStr; currentFlavor->ToString(getter_Copies(flavorStr)); - printf("nsClipboard::HasDataMatchingFlavors : <%s>\n", (const char *) flavorStr); + PRINTF("nsClipboard::HasDataMatchingFlavors : <%s>\n", (const char *) flavorStr); } } } @@ -386,7 +391,7 @@ nsresult nsClipboard::GetFormat(const char* aMimeStr, PhClipHeader *cliphdr ) PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsClipboard::GetFormat this=<%p> aMimeStr=<%s>\n", this, aMimeStr)); #ifdef DEBUG_CLIPBOARD - printf("nsClipboard::GetFormat this=<%p> aMimeStr=<%s>\n", this, aMimeStr); + PRINTF("nsClipboard::GetFormat this=<%p> aMimeStr=<%s>\n", this, aMimeStr); #endif diff --git a/mozilla/widget/src/photon/nsDragService.cpp b/mozilla/widget/src/photon/nsDragService.cpp index 0b5ed83b06e..5dd62003961 100644 --- a/mozilla/widget/src/photon/nsDragService.cpp +++ b/mozilla/widget/src/photon/nsDragService.cpp @@ -34,6 +34,11 @@ #include "nsWidgetsCID.h" #include "nsPhWidgetLog.h" +#include "nslog.h" + +NS_IMPL_LOG(nsDragServiceLog, 0) +#define PRINTF NS_LOG_PRINTF(nsDragServiceLog) +#define FLUSH NS_LOG_FLUSH(nsDragServiceLog) NS_IMPL_ADDREF_INHERITED(nsDragService, nsBaseDragService) NS_IMPL_RELEASE_INHERITED(nsDragService, nsBaseDragService) @@ -48,7 +53,7 @@ NS_IMPL_QUERY_INTERFACE2(nsDragService, nsIDragService, nsIDragSession) //------------------------------------------------------------------------- nsDragService::nsDragService() { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsDragService::nsDragService this=<%p>\n", this)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsDragService::nsDragService this=<%p>", this)); NS_INIT_REFCNT(); mWidget = nsnull; @@ -62,7 +67,7 @@ nsDragService::nsDragService() //------------------------------------------------------------------------- nsDragService::~nsDragService() { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsDragService::~nsDragService this=<%p>\n", this)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsDragService::~nsDragService this=<%p>", this)); if (mWidget) { @@ -75,7 +80,7 @@ nsDragService::~nsDragService() NS_IMETHODIMP nsDragService::StartDragSession() { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsDragService::StartDragSession this=<%p>\n", this)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsDragService::StartDragSession this=<%p>", this)); NS_WARNING("nsDragService::StartDragSession() - Not Supported Yet"); nsBaseDragService::StartDragSession(); @@ -85,9 +90,9 @@ NS_IMETHODIMP nsDragService::StartDragSession() NS_IMETHODIMP nsDragService::EndDragSession() { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsDragService::EndDragSession this=<%p>\n", this)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsDragService::EndDragSession this=<%p>", this)); - NS_WARNING("nsDragService::EndDragSession()\n"); + NS_WARNING("nsDragService::EndDragSession()"); nsBaseDragService::EndDragSession(); //gtk_drag_source_unset(mWidget); @@ -104,7 +109,7 @@ NS_IMETHODIMP nsDragService::InvokeDragSession (nsIDOMNode *aDOMNode, { nsBaseDragService::InvokeDragSession ( aDOMNode, aTransferableArray, aRegion, aActionType ); - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsDragService::InvokeDragSession this=<%p> aActionType=<%d>\n", this, aActionType)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsDragService::InvokeDragSession this=<%p> aActionType=<%d>", this, aActionType)); //mWidget = gtk_invisible_new(); //gtk_widget_show(mWidget); @@ -146,7 +151,7 @@ GtkTargetList *nsDragService::RegisterDragItemsAndFlavors(nsISupportsArray *inAr GtkTargetList *targetlist; targetlist = gtk_target_list_new(nsnull, numDragItems); - printf("nsDragService::RegisterDragItemsAndFlavors\n"); + PRINTF("nsDragService::RegisterDragItemsAndFlavors"); for (unsigned int i = 0; i < numDragItems; ++i) { @@ -187,7 +192,7 @@ GtkTargetList *nsDragService::RegisterDragItemsAndFlavors(nsISupportsArray *inAr PRBool nsDragService::DoConvert(GdkAtom type) { - printf("nsDragService::DoRealConvert(%li)\n {\n", type); + PRINTF("nsDragService::DoRealConvert(%li)\n {", type); int e = 0; // Set a flag saying that we're blocking waiting for the callback: mBlocking = PR_TRUE; @@ -196,7 +201,7 @@ PRBool nsDragService::DoConvert(GdkAtom type) // ask X what kind of data we can get // #ifdef DEBUG_DRAG - printf(" Doing real conversion of atom type '%s'\n", gdk_atom_name(type)); + PRINTF(" Doing real conversion of atom type '%s'", gdk_atom_name(type)); #endif gtk_selection_convert(mWidget, GDK_SELECTION_PRIMARY, @@ -206,7 +211,7 @@ PRBool nsDragService::DoConvert(GdkAtom type) // Now we need to wait until the callback comes in ... // i is in case we get a runaway (yuck). #ifdef DEBUG_DRAG - printf(" Waiting for the callback... mBlocking = %d\n", mBlocking); + PRINTF(" Waiting for the callback... mBlocking = %d", mBlocking); #endif /* DEBUG_CLIPBOARD */ for (e=0; mBlocking == PR_TRUE && e < 1000; ++e) { @@ -214,7 +219,7 @@ PRBool nsDragService::DoConvert(GdkAtom type) } #ifdef DEBUG_DRAG - printf(" }\n"); + PRINTF(" }"); #endif if (mSelectionData.length > 0) @@ -228,7 +233,7 @@ PRBool nsDragService::DoConvert(GdkAtom type) //------------------------------------------------------------------------- NS_IMETHODIMP nsDragService::GetNumDropItems (PRUint32 * aNumItems) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsDragService::GetNumDropItems this=<%p>\n", this)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsDragService::GetNumDropItems this=<%p>", this)); *aNumItems = 0; return NS_OK; @@ -237,10 +242,10 @@ NS_IMETHODIMP nsDragService::GetNumDropItems (PRUint32 * aNumItems) //------------------------------------------------------------------------- NS_IMETHODIMP nsDragService::GetData (nsITransferable * aTransferable, PRUint32 anItem) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsDragService::GetData this=<%p>\n", this)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsDragService::GetData this=<%p>", this)); #ifdef DEBUG_DRAG - printf("nsClipboard::GetNativeClipboardData()\n"); + PRINTF("nsClipboard::GetNativeClipboardData()"); #endif /* DEBUG_CLIPBOARD */ @@ -248,7 +253,7 @@ NS_IMETHODIMP nsDragService::GetData (nsITransferable * aTransferable, PRUint32 // make sure we have a good transferable if (!aTransferable) { - printf(" GetData: Transferable is null!\n"); + PRINTF(" GetData: Transferable is null!"); return NS_ERROR_FAILURE; } @@ -278,7 +283,7 @@ NS_IMETHODIMP nsDragService::GetData (nsITransferable * aTransferable, PRUint32 } #ifdef DEBUG_CLIPBOARD - printf(" Got the callback: '%s', %d\n", + PRINTF(" Got the callback: '%s', %d", mSelectionData.data, mSelectionData.length); #endif /* DEBUG_CLIPBOARD */ @@ -320,9 +325,9 @@ NS_IMETHODIMP nsDragService::GetData (nsITransferable * aTransferable, PRUint32 //------------------------------------------------------------------------- NS_IMETHODIMP nsDragService::IsDataFlavorSupported(const char *aDataFlavor, PRBool *_retval) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsDragService::IsDataFlavorSupported this=<%p>\n", this)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsDragService::IsDataFlavorSupported this=<%p>", this)); - printf("nsDragService::IsDataFlavorSupported\n"); + PRINTF("nsDragService::IsDataFlavorSupported"); if (!aDataFlavor || !_retval) return NS_ERROR_FAILURE; @@ -334,9 +339,9 @@ NS_IMETHODIMP nsDragService::IsDataFlavorSupported(const char *aDataFlavor, PRBo //------------------------------------------------------------------------- NS_IMETHODIMP nsDragService::GetCurrentSession (nsIDragSession **aSession) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsDragService::GetCurrentSession this=<%p>\n", this)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsDragService::GetCurrentSession this=<%p>", this)); - printf("nsDragService::GetCurrentSession\n"); + PRINTF("nsDragService::GetCurrentSession"); if (!aSession) return NS_ERROR_FAILURE; @@ -353,7 +358,7 @@ nsDragService::DragLeave (GtkWidget *widget, GdkDragContext *context, guint time) { - printf("leave\n"); + PRINTF("leave"); //gHaveDrag = PR_FALSE; } @@ -365,7 +370,7 @@ nsDragService::DragMotion(GtkWidget *widget, gint y, guint time) { - printf("drag motion\n"); + PRINTF("drag motion"); GtkWidget *source_widget; #if 0 @@ -375,9 +380,9 @@ nsDragService::DragMotion(GtkWidget *widget, #endif source_widget = gtk_drag_get_source_widget (context); - printf("motion, source %s\n", source_widget ? + PRINTF("motion, source %s", source_widget ? gtk_type_name (GTK_OBJECT (source_widget)->klass->type) : - "unknown"); + "unknown"); gdk_drag_status (context, context->suggested_action, time); @@ -392,7 +397,7 @@ nsDragService::DragDrop(GtkWidget *widget, gint y, guint time) { - printf("drop\n"); + PRINTF("drop"); //gHaveDrag = PR_FALSE; if (context->targets){ @@ -416,7 +421,7 @@ nsDragService::DragDataReceived (GtkWidget *widget, guint time) { if ((data->length >= 0) && (data->format == 8)) { - printf ("Received \"%s\"\n", (gchar *)data->data); + PRINTF ("Received \"%s\"", (gchar *)data->data); gtk_drag_finish (context, PR_TRUE, PR_FALSE, time); return; } @@ -444,6 +449,6 @@ nsDragService::DragDataDelete(GtkWidget *widget, GdkDragContext *context, gpointer data) { - printf ("Delete the data!\n"); + PRINTF ("Delete the data!"); } #endif diff --git a/mozilla/widget/src/photon/nsFontRetrieverService.cpp b/mozilla/widget/src/photon/nsFontRetrieverService.cpp index f48ca286515..483fbc2872c 100644 --- a/mozilla/widget/src/photon/nsFontRetrieverService.cpp +++ b/mozilla/widget/src/photon/nsFontRetrieverService.cpp @@ -33,6 +33,11 @@ #include "nsFont.h" #include "nsVoidArray.h" #include "nsFontSizeIterator.h" +#include "nslog.h" + +NS_IMPL_LOG(nsFontRetrieverServiceLog, 0) +#define PRINTF NS_LOG_PRINTF(nsFontRetrieverServiceLog) +#define FLUSH NS_LOG_FLUSH(nsFontRetrieverServiceLog) NS_IMPL_ISUPPORTS2(nsFontRetrieverService, nsIFontRetrieverService, nsIFontNameIterator) @@ -178,7 +183,7 @@ static FontInfo * GetFontInfo(nsVoidArray * aFontList, char * aName) FontInfo * fontInfo = new FontInfo(); fontInfo->mName = nsString( (const PRUnichar *) aName, strlen(aName)); - printf("nsFontRetrieverService::GetFontInfo Adding [%s]\n", aName);fflush(stdout); + PRINTF("nsFontRetrieverService::GetFontInfo Adding [%s]\n", aName);fflush(stdout); fontInfo->mIsScalable = PR_FALSE; // X fonts aren't scalable right?? fontInfo->mSizes = nsnull; aFontList->AppendElement(fontInfo); @@ -259,17 +264,17 @@ NS_IMETHODIMP nsFontRetrieverService::LoadFontList() } if (fonts == NULL) { - fprintf(stderr, "pattern \"%s\" unmatched\n", pattern); + PRINTF("pattern \"%s\" unmatched\n", pattern); return NS_ERROR_FAILURE; } #if 0 // debug // print out all the retrieved fonts - printf("-----------------------------\n"); + PRINTF("-----------------------------\n"); for (i=0; i #include "nsPhWidgetLog.h" +#include "nslog.h" + +NS_IMPL_LOG(nsLabelLog, 0) +#define PRINTF NS_LOG_PRINTF(nsLabelLog) +#define FLUSH NS_LOG_FLUSH(nsLabelLog) NS_IMPL_ADDREF_INHERITED(nsLabel, nsWidget) NS_IMPL_RELEASE_INHERITED(nsLabel, nsWidget) @@ -205,7 +210,7 @@ PRBool nsLabel::OnMove(PRInt32, PRInt32) PRBool nsLabel::OnPaint(nsPaintEvent &aEvent) { - //printf("** nsLabel::OnPaint **\n"); + //PRINTF("** nsLabel::OnPaint **\n"); return PR_FALSE; } diff --git a/mozilla/widget/src/photon/nsWidget.cpp b/mozilla/widget/src/photon/nsWidget.cpp index 04d651f32d6..8f5329f9d4a 100644 --- a/mozilla/widget/src/photon/nsWidget.cpp +++ b/mozilla/widget/src/photon/nsWidget.cpp @@ -44,6 +44,11 @@ #include "nsPhWidgetLog.h" #include +#include "nslog.h" + +NS_IMPL_LOG(nsWidgetLog, 0) +#define PRINTF NS_LOG_PRINTF(nsWidgetLog) +#define FLUSH NS_LOG_FLUSH(nsWidgetLog) static NS_DEFINE_CID(kLookAndFeelCID, NS_LOOKANDFEEL_CID); static NS_DEFINE_CID(kRegionCID, NS_REGION_CID); @@ -99,9 +104,9 @@ extern unsigned long IgnoreEvent; nsWidget::nsWidget() { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::nsWidget this=(%p)\n", this)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::nsWidget this=(%p)", this)); - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("%p C nsWidget CONSTRUCTOR LEAK_CHECK time=(%ld)\n", this, PR_IntervalNow())); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("%p C nsWidget CONSTRUCTOR LEAK_CHECK time=(%ld)", this, PR_IntervalNow())); // XXX Shouldn't this be done in nsBaseWidget? // NS_INIT_REFCNT(); @@ -149,7 +154,7 @@ nsWidget::nsWidget() nsWidget::~nsWidget() { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::~nsWidget this=(%p) mWidget=<%p>\n", this, mWidget)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::~nsWidget this=(%p) mWidget=<%p>", this, mWidget)); NS_IF_RELEASE(mUpdateArea); @@ -162,7 +167,7 @@ nsWidget::~nsWidget() NS_IF_RELEASE(sLookAndFeel); } - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("%p D nsWidget DESTRUCTOR LEAK_CHECK time=(%ld)\n", this, PR_IntervalNow())); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("%p D nsWidget DESTRUCTOR LEAK_CHECK time=(%ld)", this, PR_IntervalNow())); } @@ -175,7 +180,7 @@ NS_IMPL_ISUPPORTS_INHERITED(nsWidget, nsBaseWidget, nsIKBStateControl) NS_METHOD nsWidget::WidgetToScreen(const nsRect& aOldRect, nsRect& aNewRect) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::WidgetToScreen - Not Implemented.\n" )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::WidgetToScreen - Not Implemented." )); if (mWidget) { @@ -189,7 +194,7 @@ NS_METHOD nsWidget::WidgetToScreen(const nsRect& aOldRect, nsRect& aNewRect) NS_METHOD nsWidget::ScreenToWidget(const nsRect& aOldRect, nsRect& aNewRect) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::ScreenToWidget - Not Implemented.\n" )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::ScreenToWidget - Not Implemented." )); return NS_OK; } @@ -201,7 +206,7 @@ NS_METHOD nsWidget::ScreenToWidget(const nsRect& aOldRect, nsRect& aNewRect) NS_IMETHODIMP nsWidget::Destroy(void) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::Destroy this=<%p> mRefCnt=<%d> mWidget=<%p> mIsDestroying=<%d>\n",this,mRefCnt, mWidget, mIsDestroying)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::Destroy this=<%p> mRefCnt=<%d> mWidget=<%p> mIsDestroying=<%d>",this,mRefCnt, mWidget, mIsDestroying)); // make sure we don't call this more than once. if (mIsDestroying) @@ -232,7 +237,7 @@ NS_IMETHODIMP nsWidget::Destroy(void) /* virtual */ void nsWidget::DestroyNative(void) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::DestroyNative this=<%p> mRefCnt=<%d> mWidget=<%p>\n", this, mRefCnt, mWidget )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::DestroyNative this=<%p> mRefCnt=<%d> mWidget=<%p>", this, mRefCnt, mWidget )); if (mWidget) { @@ -249,7 +254,7 @@ void nsWidget::DestroyNative(void) void nsWidget::OnDestroy() { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::OnDestroy this=<%p> mRefCnt=<%d>\n", this, mRefCnt )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::OnDestroy this=<%p> mRefCnt=<%d>", this, mRefCnt )); mOnDestroyCalled = PR_TRUE; // release references to children, device context, toolkit + app shell @@ -263,7 +268,7 @@ void nsWidget::OnDestroy() DispatchStandardEvent(NS_DESTROY); NS_RELEASE_THIS(); #endif - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::OnDestroy Exiting this=<%p> mRefCnt=<%d>\n", this, mRefCnt )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::OnDestroy Exiting this=<%p> mRefCnt=<%d>", this, mRefCnt )); } @@ -275,7 +280,7 @@ void nsWidget::OnDestroy() nsIWidget *nsWidget::GetParent(void) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::GetParent - this=<%p> mParent=<%p> \n", this, mParent)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::GetParent - this=<%p> mParent=<%p> ", this, mParent)); nsIWidget* result = mParent; if (mParent) { @@ -298,7 +303,7 @@ nsIWidget *nsWidget::GetParent(void) NS_IMETHODIMP nsWidget::ResetInputState() { nsresult res = NS_OK; - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::ResetInputState - Not Implemented this=<%p>\n", this)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::ResetInputState - Not Implemented this=<%p>", this)); return res; } @@ -306,7 +311,7 @@ NS_IMETHODIMP nsWidget::ResetInputState() NS_IMETHODIMP nsWidget::PasswordFieldInit() { // to be implemented - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::PasswordFieldInit - Not Implemented this=<%p>\n", this)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::PasswordFieldInit - Not Implemented this=<%p>", this)); return NS_OK; } @@ -319,15 +324,15 @@ NS_IMETHODIMP nsWidget::PasswordFieldInit() NS_METHOD nsWidget::Show(PRBool bState) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::Show this=<%p> State=<%d> mRefCnt=<%d> mWidget=<%p>\n", this, bState, mRefCnt, mWidget)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::Show this=<%p> State=<%d> mRefCnt=<%d> mWidget=<%p>", this, bState, mRefCnt, mWidget)); if (!mWidget) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::Show - mWidget is NULL!\n" )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::Show - mWidget is NULL!" )); return NS_OK; // Will be null durring printing } - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::Show this=<%p> IsRealized=<%d>\n", this, PtWidgetIsRealized(mWidget) )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::Show this=<%p> IsRealized=<%d>", this, PtWidgetIsRealized(mWidget) )); /* Note: Calling PtWidgetIsRealized(mWidget) is not valid because usually the parent window has not been realized yet when we get into this code. Also @@ -346,17 +351,17 @@ the PtRealizeWidget functions */ if (err == -1) { PtWidget_t *parent = PtWidgetParent(mWidget); - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::Show Failed to Realize this=<%p> mWidget=<%p> mWidget->Parent=<%p> parent->IsRealized=<%d> \n", this, mWidget,parent, PtWidgetIsRealized(parent) )); - //printf("nsWidget::Show Failed to Realize this=<%p> mWidget=<%p> mWidget->Parent=<%p> parent->IsRealized=<%d> \n", this, mWidget,parent, PtWidgetIsRealized(parent) ); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::Show Failed to Realize this=<%p> mWidget=<%p> mWidget->Parent=<%p> parent->IsRealized=<%d> ", this, mWidget,parent, PtWidgetIsRealized(parent) )); + //PRINTF("nsWidget::Show Failed to Realize this=<%p> mWidget=<%p> mWidget->Parent=<%p> parent->IsRealized=<%d> ", this, mWidget,parent, PtWidgetIsRealized(parent) ); } if (mWidget->rid == -1) { PtRegionWidget_t *region = (PtRegionWidget_t *) mWidget; - printf("nsWidget::errno = %s\n", strerror(errno)); - printf("nsWidget PtRealizeWidget <%p> rid=<%d> parent rid <%d>\n", mWidget, mWidget->rid, region->parent); - NS_ASSERTION(0,"nsWidget::Show mWidget's rid == -1\n"); + PRINTF("nsWidget::errno = %s", strerror(errno)); + PRINTF("nsWidget PtRealizeWidget <%p> rid=<%d> parent rid <%d>", mWidget, mWidget->rid, region->parent); + NS_ASSERTION(0,"nsWidget::Show mWidget's rid == -1"); //DebugBreak(); //abort(); mShown = PR_FALSE; @@ -392,7 +397,7 @@ the PtRealizeWidget functions */ w = w1; } - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::Show _EXPOSE gLastUnrealizedRegion=<%d> gLastUnrealizedRegionsParent=<%d> \n", gLastUnrealizedRegion, gLastUnrealizedRegionsParent)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::Show _EXPOSE gLastUnrealizedRegion=<%d> gLastUnrealizedRegionsParent=<%d> ", gLastUnrealizedRegion, gLastUnrealizedRegionsParent)); } PtUnrealizeWidget(mWidget); @@ -408,21 +413,21 @@ the PtRealizeWidget functions */ NS_IMETHODIMP nsWidget::CaptureRollupEvents(nsIRollupListener * aListener, PRBool aDoCapture, PRBool aConsumeRollupEvent) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::CaptureRollupEvents() this = %p , doCapture = %i\n", this, aDoCapture)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::CaptureRollupEvents() this = %p , doCapture = %i", this, aDoCapture)); /* This got moved to nsWindow.cpp */ return NS_OK; } NS_IMETHODIMP nsWidget::SetModal(PRBool aModal) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::SetModal - Not Implemented\n")); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::SetModal - Not Implemented")); return NS_ERROR_FAILURE; } NS_METHOD nsWidget::IsVisible(PRBool &aState) { if (mWidget) - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::IsVisible this=<%p> IsRealized=<%d> mShown=<%d>\n", this, PtWidgetIsRealized(mWidget), mShown)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::IsVisible this=<%p> IsRealized=<%d> mShown=<%d>", this, PtWidgetIsRealized(mWidget), mShown)); /* Try a simpler algorthm */ aState = mShown; @@ -447,11 +452,11 @@ NS_METHOD nsWidget::ConstrainPosition(PRInt32 *aX, PRInt32 *aY) //------------------------------------------------------------------------- NS_METHOD nsWidget::Move(PRInt32 aX, PRInt32 aY) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::Move (%p) from (%ld,%ld) to (%ld,%ld)\n", this, mBounds.x, mBounds.y, aX, aY )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::Move (%p) from (%ld,%ld) to (%ld,%ld)", this, mBounds.x, mBounds.y, aX, aY )); if (( mBounds.x == aX ) && ( mBounds.y == aY )) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::Move already there.\n" )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::Move already there." )); return NS_OK; } @@ -479,12 +484,12 @@ NS_METHOD nsWidget::Move(PRInt32 aX, PRInt32 aY) err=PtSetResources( mWidget, 1, &arg ); if (err==-1) { - PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsWidget::Move ERROR in PtSetRes (%p) to (%ld,%ld)\n", this, aX, aY )); + PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsWidget::Move ERROR in PtSetRes (%p) to (%ld,%ld)", this, aX, aY )); } } else { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::Move (%p) already at (%d,%d)\n", this, pos.x, pos.y )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::Move (%p) already at (%d,%d)", this, pos.x, pos.y )); } } @@ -492,7 +497,7 @@ NS_METHOD nsWidget::Move(PRInt32 aX, PRInt32 aY) } else { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::Move - mWidget is NULL!\n" )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::Move - mWidget is NULL!" )); } return NS_OK; @@ -501,7 +506,7 @@ NS_METHOD nsWidget::Move(PRInt32 aX, PRInt32 aY) NS_METHOD nsWidget::Resize(PRInt32 aWidth, PRInt32 aHeight, PRBool aRepaint) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::Resize (%p) to <%d, %d>\n", this, aWidth, aHeight )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::Resize (%p) to <%d, %d>", this, aWidth, aHeight )); if(( mBounds.width != aWidth ) || ( mBounds.height != aHeight )) { @@ -518,7 +523,7 @@ NS_METHOD nsWidget::Resize(PRInt32 aWidth, PRInt32 aHeight, PRBool aRepaint) { /* Add the border to the size of the widget */ #if 1 - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::Resize broder size =<%d>\n", border)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::Resize broder size =<%d>", border)); PhDim_t dim = {aWidth - 2*(*border), aHeight - 2*(*border)}; #else PhDim_t dim = {0,0}; @@ -528,7 +533,7 @@ NS_METHOD nsWidget::Resize(PRInt32 aWidth, PRInt32 aHeight, PRBool aRepaint) #endif EnableDamage( mWidget, PR_FALSE ); - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::Resize (%p) actually resizing to <%d, %d>\n", this, dim.w, dim.h )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::Resize (%p) actually resizing to <%d, %d>", this, dim.w, dim.h )); PtSetArg( &arg, Pt_ARG_DIM, &dim, 0 ); PtSetResources( mWidget, 1, &arg ); @@ -545,7 +550,7 @@ NS_METHOD nsWidget::Resize(PRInt32 aWidth, PRInt32 aHeight, PRBool aRepaint) } else { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::Resize FAILED- mWidget is NULL!\n" )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::Resize FAILED- mWidget is NULL!" )); } } @@ -569,7 +574,7 @@ PRBool nsWidget::OnResize(nsRect &aRect) { PRBool result = PR_FALSE; - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::OnResize\n")); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::OnResize")); // call the event callback if (mEventCallback) @@ -602,7 +607,7 @@ PRBool nsWidget::OnResize(nsRect &aRect) //------ PRBool nsWidget::OnMove(PRInt32 aX, PRInt32 aY) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::OnMove to (%d,%d)\n", aX, aY)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::OnMove to (%d,%d)", aX, aY)); nsGUIEvent event; @@ -624,7 +629,7 @@ NS_METHOD nsWidget::Enable(PRBool bState) { if (mWidget) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::Enable this=<%p> being set to %d\n", this, bState)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::Enable this=<%p> being set to %d", this, bState)); PtArg_t arg; if( bState ) @@ -636,7 +641,7 @@ NS_METHOD nsWidget::Enable(PRBool bState) } else { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::Enable - mWidget is NULL!\n" )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::Enable - mWidget is NULL!" )); } return NS_OK; @@ -650,7 +655,7 @@ NS_METHOD nsWidget::Enable(PRBool bState) //------------------------------------------------------------------------- NS_METHOD nsWidget::SetFocus(void) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::SetFocus - mWidget=<%p>!\n", mWidget)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::SetFocus - mWidget=<%p>!", mWidget)); // call this so that any cleanup will happen that needs to... LooseFocus(); @@ -662,7 +667,7 @@ NS_METHOD nsWidget::SetFocus(void) } else { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::SetFocus - mWidget is NULL!\n" )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::SetFocus - mWidget is NULL!" )); } return NS_OK; @@ -671,7 +676,7 @@ NS_METHOD nsWidget::SetFocus(void) void nsWidget::LooseFocus(void) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::LooseFocus - this=<%p> mWidget=<%p> mHasFocus=<%d>\n", this, mWidget, mHasFocus)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::LooseFocus - this=<%p> mWidget=<%p> mHasFocus=<%d>", this, mWidget, mHasFocus)); // doesn't do anything. needed for nsWindow housekeeping, really. if (mHasFocus == PR_FALSE) { @@ -689,7 +694,7 @@ void nsWidget::LooseFocus(void) //------------------------------------------------------------------------- nsIFontMetrics *nsWidget::GetFont(void) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::GetFont - Not Implemented.\n" )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::GetFont - Not Implemented." )); NS_NOTYETIMPLEMENTED("nsWidget::GetFont"); return nsnull; } @@ -702,18 +707,18 @@ nsIFontMetrics *nsWidget::GetFont(void) //------------------------------------------------------------------------- NS_METHOD nsWidget::SetFont(const nsFont &aFont) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::SetFont\n" )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::SetFont" )); #if 1 { char *str = nsnull; str = aFont.name.ToNewCString(); if (str) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::SetFont aFont.name=<%s>\n",str)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::SetFont aFont.name=<%s>",str)); delete [] str; } - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::SetFont aFont.size=<%d>\n",aFont.size)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::SetFont aFont.size=<%d>",aFont.size)); } #endif @@ -723,7 +728,7 @@ NS_METHOD nsWidget::SetFont(const nsFont &aFont) if (mFontMetrics) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::SetFont Get a FontMetrics\n" )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::SetFont Get a FontMetrics" )); PtArg_t arg; nsFontHandle aFontHandle; @@ -731,7 +736,7 @@ NS_METHOD nsWidget::SetFont(const nsFont &aFont) nsString *aString; aString = (nsString *) aFontHandle; char *str = aString->ToNewCString(); - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::SetFont Get a FontMetrics font name=<%s>\n",str )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::SetFont Get a FontMetrics font name=<%s>",str )); PtSetArg( &arg, Pt_ARG_TEXT_FONT, str, 0 ); PtSetResources( mWidget, 1, &arg ); @@ -768,7 +773,7 @@ NS_METHOD nsWidget::SetCursor(nsCursor aCursor) { unsigned short curs = 0; - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::SetCursor to <%d> was <%d>\n", aCursor, mCursor)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::SetCursor to <%d> was <%d>", aCursor, mCursor)); // Only change cursor if it's changing if (aCursor != mCursor) { @@ -879,7 +884,7 @@ NS_METHOD nsWidget::SetCursor(nsCursor aCursor) } else { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::SetCursor - mWidget is NULL!\n" )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::SetCursor - mWidget is NULL!" )); } mCursor = aCursor; @@ -891,18 +896,18 @@ NS_METHOD nsWidget::SetCursor(nsCursor aCursor) NS_METHOD nsWidget::Invalidate(PRBool aIsSynchronous) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::Invalidate 1 this=<%p> IsSynch=<%d> mBounds=(%d,%d,%d,%d)\n", this, aIsSynchronous, + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::Invalidate 1 this=<%p> IsSynch=<%d> mBounds=(%d,%d,%d,%d)", this, aIsSynchronous, mBounds.x, mBounds.y, mBounds.width, mBounds.height)); if (!mWidget) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::Invalidate 1 - mWidget is NULL!\n" )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::Invalidate 1 - mWidget is NULL!" )); return NS_OK; // mWidget will be null during printing. } if (!PtWidgetIsRealized(mWidget)) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::Invalidate 1 - mWidget is not realized\n")); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::Invalidate 1 - mWidget is not realized")); return NS_OK; } @@ -929,7 +934,7 @@ NS_METHOD nsWidget::doPaint() PhTile_t * nativeRegion = nsnull; PtWidget_t *widget = (PtWidget_t *)GetNativeData(NS_NATIVE_WIDGET); - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::doPaint this=<%p> mWidget=<%p> widget=<%p> PtWidgetIsRealized(widget)=<%d>\n", this, mWidget, widget,PtWidgetIsRealized(widget) )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::doPaint this=<%p> mWidget=<%p> widget=<%p> PtWidgetIsRealized(widget)=<%d>", this, mWidget, widget,PtWidgetIsRealized(widget) )); if ((widget) && (PtWidgetIsRealized(widget))) { @@ -960,7 +965,7 @@ NS_METHOD nsWidget::doPaint() } else { - //printf("nsWidget::doPaint ERROR widget=<%p> PtWidgetIsRealized(widget)=<%d>\n", widget, PtWidgetIsRealized(widget)); + //PRINTF("nsWidget::doPaint ERROR widget=<%p> PtWidgetIsRealized(widget)=<%d>", widget, PtWidgetIsRealized(widget)); } return res; @@ -969,17 +974,17 @@ NS_METHOD nsWidget::doPaint() NS_METHOD nsWidget::Invalidate(const nsRect & aRect, PRBool aIsSynchronous) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::Invalidate 2 this=<%p> dmg rect=(%ld,%ld,%ld,%ld) IsSync=<%d>\n", this, aRect.x, aRect.y, aRect.width, aRect.height, aIsSynchronous)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::Invalidate 2 this=<%p> dmg rect=(%ld,%ld,%ld,%ld) IsSync=<%d>", this, aRect.x, aRect.y, aRect.width, aRect.height, aIsSynchronous)); if (!mWidget) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::Invalidate 2 - mWidget is NULL!\n" )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::Invalidate 2 - mWidget is NULL!" )); return NS_OK; // mWidget will be null during printing. } if (!PtWidgetIsRealized(mWidget)) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::Invalidate 2 - mWidget is not realized\n")); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::Invalidate 2 - mWidget is not realized")); return NS_OK; // return NS_ERROR_FAILURE; } @@ -992,13 +997,13 @@ NS_METHOD nsWidget::Invalidate(const nsRect & aRect, PRBool aIsSynchronous) if ( GetParentClippedArea(rect) == PR_TRUE ) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::Invalidate 2 before Clipped rect=(%d,%d,%d,%d) mBounds=(%d,%d)\n", rect.x, rect.y, rect.width, rect.height, mBounds.x, mBounds.y)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::Invalidate 2 before Clipped rect=(%d,%d,%d,%d) mBounds=(%d,%d)", rect.x, rect.y, rect.width, rect.height, mBounds.x, mBounds.y)); /* convert back widget coords */ rect.x -= mBounds.x; rect.y -= mBounds.y; - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::Invalidate 2 Clipped rect=(%i,%i,%i,%i)\n", rect.x, rect.y, rect.width, rect.height )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::Invalidate 2 Clipped rect=(%i,%i,%i,%i)", rect.x, rect.y, rect.width, rect.height )); mUpdateArea->Union(aRect.x, aRect.y, aRect.width, aRect.height); @@ -1020,8 +1025,8 @@ NS_METHOD nsWidget::Invalidate(const nsRect & aRect, PRBool aIsSynchronous) NS_IMETHODIMP nsWidget::InvalidateRegion(const nsIRegion *aRegion, PRBool aIsSynchronous) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::InvalidateRegion isSync=<%d>\n",aIsSynchronous)); - //printf("nsWidget::InvalidateRegion isSync=<%d> mWidget=<%p> mUpdateArea=<%p> IsRealized=<%d> \n",aIsSynchronous, mWidget, mUpdateArea, PtWidgetIsRealized(mWidget) ); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::InvalidateRegion isSync=<%d>",aIsSynchronous)); + //PRINTF("nsWidget::InvalidateRegion isSync=<%d> mWidget=<%p> mUpdateArea=<%p> IsRealized=<%d> ",aIsSynchronous, mWidget, mUpdateArea, PtWidgetIsRealized(mWidget) ); #if 1 mUpdateArea->Union(*aRegion); if (aIsSynchronous) @@ -1052,10 +1057,10 @@ NS_IMETHODIMP nsWidget::InvalidateRegion(const nsIRegion *aRegion, PRBool aIsSyn } PtWidgetArea( mWidget, &area ); // parent coords - //printf("nsWidget::InvalidateRegion mWidget=<%p> area=<%d,%d,%d,%d>\n", mWidget, area.pos.x, area.pos.y, area.size.w, area.size.h); + //PRINTF("nsWidget::InvalidateRegion mWidget=<%p> area=<%d,%d,%d,%d>", mWidget, area.pos.x, area.pos.y, area.size.w, area.size.h); if ((PtWidgetIsClass(mWidget, PtWindow)) || (PtWidgetIsClass(mWidget, PtRegion))) { - printf("nsWidget::InvalidateRegion mWidget=<%p> is a PtWindow\n"); + PRINTF("nsWidget::InvalidateRegion mWidget=<%p> is a PtWindow"); area.pos.x = area.pos.y = 0; } @@ -1064,7 +1069,7 @@ NS_IMETHODIMP nsWidget::InvalidateRegion(const nsIRegion *aRegion, PRBool aIsSyn { nsRegionRect *r = &(regionRectSet->mRects[i]); - //printf("nsWidget::InvalidateRegion r=<%d,%d,%d,%d>\n",r->x, r->y, r->width, r->height ); + //PRINTF("nsWidget::InvalidateRegion r=<%d,%d,%d,%d>",r->x, r->y, r->width, r->height ); temp_rect.SetRect(r->x, r->y, r->width, r->height); @@ -1073,7 +1078,7 @@ NS_IMETHODIMP nsWidget::InvalidateRegion(const nsIRegion *aRegion, PRBool aIsSyn extent.lr.x = extent.ul.x + temp_rect.width - 1; extent.lr.y = extent.ul.y + temp_rect.height - 1; - //printf("nsWidget::InvalidateRegion damaging widget=<%p> %d rect=<%d,%d,%d,%d>\n", mWidget, i,extent.ul.x, extent.ul.y, extent.lr.x, extent.lr.y); + //PRINTF("nsWidget::InvalidateRegion damaging widget=<%p> %d rect=<%d,%d,%d,%d>", mWidget, i,extent.ul.x, extent.ul.y, extent.lr.x, extent.lr.y); #if 0 PtDamageExtent( mWidget, &extent ); #else @@ -1109,7 +1114,7 @@ PRBool nsWidget::GetParentClippedArea( nsRect &rect ) nsRect rect2; PtWidget_t *disjoint = PtFindDisjoint( mWidget ); -PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::GetParentClippedArea Clipping widget (%p) rect: %d,%d,%d,%d disjointParent=<%p>\n", this, rect.x, rect.y, rect.width, rect.height, disjoint )); +PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::GetParentClippedArea Clipping widget (%p) rect: %d,%d,%d,%d disjointParent=<%p>", this, rect.x, rect.y, rect.width, rect.height, disjoint )); // convert passed-in rect to absolute window coords first... PtWidgetOffset( mWidget, &offset ); @@ -1117,7 +1122,7 @@ PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::GetParentClippedArea Clipping widget rect.y += offset.y; -PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::GetParentClippedArea screen coords: %d,%d,%d,%d\n", rect.x, rect.y, rect.width, rect.height )); +PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::GetParentClippedArea screen coords: %d,%d,%d,%d", rect.x, rect.y, rect.width, rect.height )); parent = PtWidgetParent( mWidget ); while( parent ) @@ -1140,7 +1145,7 @@ PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::GetParentClippedArea screen coords: % rect2.y = area->pos.y + offset.y; } -PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::GetParentClippedArea parent at: %d,%d,%d,%d\n", rect2.x, rect2.y, rect2.width, rect2.height )); +PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::GetParentClippedArea parent at: %d,%d,%d,%d", rect2.x, rect2.y, rect2.width, rect2.height )); if( ( rect.x >= ( rect2.x + rect2.width )) || // rect is out of bounds to right (( rect.x + rect.width ) <= rect2.x ) || // rect is out of bounds to left @@ -1149,7 +1154,7 @@ PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::GetParentClippedArea parent at: %d,%d { rect.width = 0; rect.height = 0; - //printf( " Out of bounds !\n" ); + //PRINTF( " Out of bounds !" ); break; } else @@ -1176,7 +1181,7 @@ PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::GetParentClippedArea parent at: %d,%d rect.height = (rect2.y + rect2.height) - rect.y; } -PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::GetParentClippedArea new widget coords: %d,%d,%d,%d\n", rect.x, rect.y, rect.width, rect.height )); +PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::GetParentClippedArea new widget coords: %d,%d,%d,%d", rect.x, rect.y, rect.width, rect.height )); } } @@ -1190,7 +1195,7 @@ PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::GetParentClippedArea new widget coord rect.x -= offset.x; rect.y -= offset.y; -PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::GetParentClippedArea final widget coords: %d,%d,%d,%d\n", rect.x, rect.y, rect.width, rect.height )); +PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::GetParentClippedArea final widget coords: %d,%d,%d,%d", rect.x, rect.y, rect.width, rect.height )); if( rect.width && rect.height ) return PR_TRUE; @@ -1202,7 +1207,7 @@ PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::GetParentClippedArea final widget coo NS_METHOD nsWidget::Update(void) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::Update this=<%p> mWidget=<%p>\n", this, mWidget)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::Update this=<%p> mWidget=<%p>", this, mWidget)); /* if the widget has been invalidated or damaged then re-draw it */ UpdateWidgetDamage(); @@ -1225,20 +1230,20 @@ void *nsWidget::GetNativeData(PRUint32 aDataType) case NS_NATIVE_PLUGIN_PORT: if( !mWidget ) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::GetNativeData(mWidget) - mWidget is NULL!\n" )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::GetNativeData(mWidget) - mWidget is NULL!" )); } return (void *)mWidget; case NS_NATIVE_DISPLAY: - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::GetNativeData(NS_NATIVE_DISPLAY) - Not Implemented.\n" )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::GetNativeData(NS_NATIVE_DISPLAY) - Not Implemented." )); return nsnull; case NS_NATIVE_GRAPHIC: - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::GetNativeData(NS_NATIVE_GRAPHIC) - Not Implemented.\n" )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::GetNativeData(NS_NATIVE_GRAPHIC) - Not Implemented." )); return nsnull; default: - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::GetNativeData() - ERROR Bad ID.\n" )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::GetNativeData() - ERROR Bad ID." )); break; } return nsnull; @@ -1251,13 +1256,13 @@ void *nsWidget::GetNativeData(PRUint32 aDataType) //------------------------------------------------------------------------- NS_METHOD nsWidget::SetColorMap(nsColorMap *aColorMap) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::SetColorMap - Not Implemented.\n" )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::SetColorMap - Not Implemented." )); return NS_OK; } NS_METHOD nsWidget::ScrollWidgets(PRInt32 aDx, PRInt32 aDy) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::ScrollWidgets - Not Implemented this=<%p> mWidget=<%p> aDx=<%d aDy=<%d>\n", + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::ScrollWidgets - Not Implemented this=<%p> mWidget=<%p> aDx=<%d aDy=<%d>", this, mWidget, aDx, aDy)); return NS_OK; @@ -1265,19 +1270,19 @@ NS_METHOD nsWidget::ScrollWidgets(PRInt32 aDx, PRInt32 aDy) NS_METHOD nsWidget::Scroll(PRInt32 aDx, PRInt32 aDy, nsRect *aClipRect) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::Scroll - Not Implemented.\n" )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::Scroll - Not Implemented." )); return NS_OK; } NS_METHOD nsWidget::BeginResizingChildren(void) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::BeginResizingChildren - Not Implemented.\n" )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::BeginResizingChildren - Not Implemented." )); return NS_OK; } NS_METHOD nsWidget::EndResizingChildren(void) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::EndResizingChildren - Not Implemented.\n" )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::EndResizingChildren - Not Implemented." )); return NS_OK; } @@ -1297,7 +1302,7 @@ NS_METHOD nsWidget::SetPreferredSize(PRInt32 aWidth, PRInt32 aHeight) NS_IMETHODIMP nsWidget::SetTitle(const nsString &aTitle) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::SetTitle - this=<%p> aTitle=<%s>\n", this, nsAutoCString(aTitle) )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::SetTitle - this=<%p> aTitle=<%s>", this, nsAutoCString(aTitle) )); //gtk_widget_set_name(mWidget, "foo"); return NS_OK; @@ -1305,14 +1310,14 @@ NS_IMETHODIMP nsWidget::SetTitle(const nsString &aTitle) NS_METHOD nsWidget::SetMenuBar(nsIMenuBar * aMenuBar) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::SetMenuBar - Not Implemented.\n" )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::SetMenuBar - Not Implemented." )); return NS_ERROR_FAILURE; } NS_METHOD nsWidget::ShowMenuBar( PRBool aShow) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::ShowMenuBar aShow=<%d>\n",aShow)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::ShowMenuBar aShow=<%d>",aShow)); return NS_ERROR_FAILURE; } @@ -1325,20 +1330,20 @@ nsresult nsWidget::CreateWidget(nsIWidget *aParent, nsWidgetInitData *aInitData, nsNativeWidget aNativeParent) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::CreateWidget this=<%p> mRefCnt=<%d> aRect=<%d,%d,%d,%d> aContext=<%p>\n", this, mRefCnt, aRect.x, aRect.y, aRect.width, aRect.height, aContext)); - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::CreateWidget this=<%p> aParent=<%p> aNativeParent=<%p> mParent=<%p>\n", this, aParent, aNativeParent, mParent)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::CreateWidget this=<%p> mRefCnt=<%d> aRect=<%d,%d,%d,%d> aContext=<%p>", this, mRefCnt, aRect.x, aRect.y, aRect.width, aRect.height, aContext)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::CreateWidget this=<%p> aParent=<%p> aNativeParent=<%p> mParent=<%p>", this, aParent, aNativeParent, mParent)); if (aParent) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::CreateWidget (%p) nsIWidget parent\n", this)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::CreateWidget (%p) nsIWidget parent", this)); } else if (aNativeParent) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::CreateWidget (%p) native parent\n",this)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::CreateWidget (%p) native parent",this)); } else if(aAppShell) { - PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsWidget::CreateWidget (%p) nsAppShell parent\n",this)); + PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsWidget::CreateWidget (%p) nsAppShell parent",this)); } PtWidget_t *parentWidget = nsnull; @@ -1346,13 +1351,13 @@ nsresult nsWidget::CreateWidget(nsIWidget *aParent, nsIWidget *baseParent = aInitData && (aInitData->mWindowType == eWindowType_dialog || aInitData->mWindowType == eWindowType_toplevel ) ? nsnull : aParent; - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::CreateWidget before BaseCreate this=<%p> mParent=<%p> baseParent=<%p>\n", this, mParent, baseParent)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::CreateWidget before BaseCreate this=<%p> mParent=<%p> baseParent=<%p>", this, mParent, baseParent)); BaseCreate(baseParent, aRect, aHandleEventFunction, aContext, aAppShell, aToolkit, aInitData); mParent = aParent; - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::CreateWidget after BaseCreate mRefCnt=<%d> mBounds=<%d,%d,%d,%d> mContext=<%p> mParent=<%p> baseParent=<%p> aParent=<%p>\n", + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::CreateWidget after BaseCreate mRefCnt=<%d> mBounds=<%d,%d,%d,%d> mContext=<%p> mParent=<%p> baseParent=<%p> aParent=<%p>", mRefCnt, mBounds.x, mBounds.y, mBounds.width, mBounds.height, mContext, mParent, baseParent, aParent)); if( aNativeParent ) @@ -1367,17 +1372,17 @@ nsresult nsWidget::CreateWidget(nsIWidget *aParent, } else { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::CreateWidget - No parent specified!\n" )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::CreateWidget - No parent specified!" )); } mBounds = aRect; - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::CreateWidget before CreateNative this=<%p> mParent=<%p> baseParent=<%p>\n", this, mParent, baseParent)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::CreateWidget before CreateNative this=<%p> mParent=<%p> baseParent=<%p>", this, mParent, baseParent)); CreateNative (parentWidget); Resize(aRect.width, aRect.height, PR_FALSE); - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::CreateWidget - bounds=(%i,%i,%i,%i) mRefCnt=<%d>\n", mBounds.x, mBounds.y, mBounds.width, mBounds.height, mRefCnt)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::CreateWidget - bounds=(%i,%i,%i,%i) mRefCnt=<%d>", mBounds.x, mBounds.y, mBounds.width, mBounds.height, mRefCnt)); if( mWidget ) { @@ -1389,7 +1394,7 @@ nsresult nsWidget::CreateWidget(nsIWidget *aParent, DispatchStandardEvent(NS_CREATE); - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::CreateWidget end mRefCnt=<%d>\n", mRefCnt)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::CreateWidget end mRefCnt=<%d>", mRefCnt)); InitCallbacks(); @@ -1437,7 +1442,7 @@ NS_METHOD nsWidget::Create(nsNativeWidget aParent, void nsWidget::ConvertToDeviceCoordinates(nscoord &aX, nscoord &aY) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::ConvertToDeviceCoordinates - Not Implemented.\n" )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::ConvertToDeviceCoordinates - Not Implemented." )); } @@ -1483,7 +1488,7 @@ PRBool nsWidget::DispatchWindowEvent(nsGUIEvent* event) PRBool ret; DispatchEvent(event, status); - //printf("nsWidget::DispatchWindowEvent status=<%d> convtered=<%d>\n", status, ConvertStatus(status) ); + //PRINTF("nsWidget::DispatchWindowEvent status=<%d> convtered=<%d>", status, ConvertStatus(status) ); ret = ConvertStatus(status); return ret; @@ -1515,7 +1520,7 @@ NS_IMETHODIMP nsWidget::DispatchEvent(nsGUIEvent *aEvent, nsEventStatus &aStatus) { #if 0 - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::DispatchEvent this=<%p> widget=<%p> eventType=<%d> message=<%d> <%s>\n", + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::DispatchEvent this=<%p> widget=<%p> eventType=<%d> message=<%d> <%s>", this, aEvent->widget, aEvent->eventStructType, aEvent->message, (const char *) nsCAutoString(GuiEventToString(aEvent)) )); #endif @@ -1552,9 +1557,9 @@ void nsWidget::InitMouseEvent(PhPointerEvent_t *aPhButtonEvent, nsMouseEvent &anEvent, PRUint32 aEventType) { - PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsWidget::InitMouseEvent \n")); + PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsWidget::InitMouseEvent ")); - //printf("nsWidget::InitMouseEvent click_count=%d\n", aPhButtonEvent->click_count); + //PRINTF("nsWidget::InitMouseEvent click_count=%d", aPhButtonEvent->click_count); anEvent.message = aEventType; anEvent.widget = aWidget; @@ -1580,7 +1585,7 @@ void nsWidget::InitMouseEvent(PhPointerEvent_t *aPhButtonEvent, //------------------------------------------------------------------------- PRBool nsWidget::DispatchMouseEvent(nsMouseEvent& aEvent) { - //printf("nsWidget::DispatchMouseEvent \n"); + //PRINTF("nsWidget::DispatchMouseEvent "); PRBool result = PR_FALSE; if (nsnull == mEventCallback && nsnull == mMouseListener) { @@ -1602,11 +1607,11 @@ PRBool nsWidget::DispatchMouseEvent(nsMouseEvent& aEvent) // GetBounds(rect); // if (rect.Contains(event.point.x, event.point.y)) { // if (mCurrentWindow == NULL || mCurrentWindow != this) { -// printf("Mouse enter"); +// PRINTF("Mouse enter"); // mCurrentWindow = this; // } // } else { -// printf("Mouse exit"); +// PRINTF("Mouse exit"); // } } break; @@ -1625,7 +1630,7 @@ PRBool nsWidget::DispatchMouseEvent(nsMouseEvent& aEvent) break; case NS_DRAGDROP_DROP: - printf("nsWidget::DispatchMouseEvent, NS_DRAGDROP_DROP\n"); + PRINTF("nsWidget::DispatchMouseEvent, NS_DRAGDROP_DROP"); break; default: @@ -1641,7 +1646,7 @@ PRBool nsWidget::DispatchMouseEvent(nsMouseEvent& aEvent) //------------------------------------------------------------------------- PRBool nsWidget::DispatchMouseEvent( PhPoint_t &aPos, PRUint32 aEvent ) { -// printf( ">>> nsWidget::DispatchMouseEvent\n" ); fflush( stdout ); +// PRINTF( ">>> nsWidget::DispatchMouseEvent" ); fflush( stdout ); PRBool result = PR_FALSE; if( nsnull == mEventCallback && nsnull == mMouseListener ) @@ -1802,7 +1807,7 @@ PRUint32 nsWidget::nsConvertKey(unsigned long keysym, PRBool *aIsChar ) const int length = sizeof(nsKeycodes) / sizeof(struct nsKeyConverter); - //printf("nsWidget::nsConvertKey - Looking for <%x> length=<%d>\n", keysym, length); + //PRINTF("nsWidget::nsConvertKey - Looking for <%x> length=<%d>", keysym, length); if (aIsChar) { @@ -1829,14 +1834,14 @@ PRUint32 nsWidget::nsConvertKey(unsigned long keysym, PRBool *aIsChar ) for (int i = 0; i < length; i++) { if (nsKeycodes[i].keysym == keysym) { - //printf("nsWidget::nsConvertKey - Converted <%x> to <%x>\n", keysym, nsKeycodes[i].vkCode); + //PRINTF("nsWidget::nsConvertKey - Converted <%x> to <%x>", keysym, nsKeycodes[i].vkCode); if (aIsChar) *aIsChar = (nsKeycodes[i].isChar); return (nsKeycodes[i].vkCode); } } - //NS_WARNING("nsWidget::nsConvertKey - Did not Find Key! - Not Implemented\n"); + //NS_WARNING("nsWidget::nsConvertKey - Did not Find Key! - Not Implemented"); return((int) 0); } @@ -1847,7 +1852,7 @@ void nsWidget::InitKeyEvent(PhKeyEvent_t *aPhKeyEvent, nsKeyEvent &anEvent, PRUint32 aEventType) { -// PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsWidget::InitKeyEvent\n")); +// PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsWidget::InitKeyEvent")); if (aPhKeyEvent != nsnull) { @@ -1871,7 +1876,7 @@ void nsWidget::InitKeyEvent(PhKeyEvent_t *aPhKeyEvent, keysym = nsConvertKey(aPhKeyEvent->key_cap, &IsChar); - //printf("nsWidget::InitKeyEvent EventType=<%d> key_cap=<%lu> converted=<%lu> IsChar=<%d>\n", aEventType, aPhKeyEvent->key_cap, keysym, IsChar); + //PRINTF("nsWidget::InitKeyEvent EventType=<%d> key_cap=<%lu> converted=<%lu> IsChar=<%d>", aEventType, aPhKeyEvent->key_cap, keysym, IsChar); anEvent.isShift = ( aPhKeyEvent->key_mods & Pk_KM_Shift ) ? PR_TRUE : PR_FALSE; anEvent.isControl = ( aPhKeyEvent->key_mods & Pk_KM_Ctrl ) ? PR_TRUE : PR_FALSE; @@ -1882,7 +1887,7 @@ void nsWidget::InitKeyEvent(PhKeyEvent_t *aPhKeyEvent, { anEvent.charCode = aPhKeyEvent->key_sym; anEvent.keyCode = 0; /* I think the spec says this should be 0 */ - //printf("nsWidget::InitKeyEvent charCode=<%d>\n", anEvent.charCode); + //PRINTF("nsWidget::InitKeyEvent charCode=<%d>", anEvent.charCode); if ((anEvent.isControl) || (anEvent.isAlt)) { @@ -1899,14 +1904,14 @@ void nsWidget::InitKeyEvent(PhKeyEvent_t *aPhKeyEvent, anEvent.keyCode = (keysym & 0x00FF); } - //printf("nsWidget::InitKeyEvent Modifiers Valid=<%d,%d,%d> Shift=<%d> Control=<%d> Alt=<%d> Meta=<%d>\n", (aPhKeyEvent->key_flags & Pk_KF_Scan_Valid), (aPhKeyEvent->key_flags & Pk_KF_Sym_Valid), (aPhKeyEvent->key_flags & Pk_KF_Cap_Valid), anEvent.isShift, anEvent.isControl, anEvent.isAlt, anEvent.isMeta); + //PRINTF("nsWidget::InitKeyEvent Modifiers Valid=<%d,%d,%d> Shift=<%d> Control=<%d> Alt=<%d> Meta=<%d>", (aPhKeyEvent->key_flags & Pk_KF_Scan_Valid), (aPhKeyEvent->key_flags & Pk_KF_Sym_Valid), (aPhKeyEvent->key_flags & Pk_KF_Cap_Valid), anEvent.isShift, anEvent.isControl, anEvent.isAlt, anEvent.isMeta); } } PRBool nsWidget::DispatchKeyEvent(PhKeyEvent_t *aPhKeyEvent) { - PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsWidget::DispatchKeyEvent Got a Key Event aPhEkyEvent->key_mods:<%x> aPhEkyEvent->key_flags:<%x> aPhEkyEvent->key_sym=<%x> aPhEkyEvent->key_caps=<%x>\n",aPhKeyEvent->key_mods, aPhKeyEvent->key_flags, aPhKeyEvent->key_sym, aPhKeyEvent->key_cap)); + PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsWidget::DispatchKeyEvent Got a Key Event aPhEkyEvent->key_mods:<%x> aPhEkyEvent->key_flags:<%x> aPhEkyEvent->key_sym=<%x> aPhEkyEvent->key_caps=<%x>",aPhKeyEvent->key_mods, aPhKeyEvent->key_flags, aPhKeyEvent->key_sym, aPhKeyEvent->key_cap)); NS_ASSERTION(aPhKeyEvent, "nsWidget::DispatchKeyEvent a NULL PhKeyEvent was passed in"); nsKeyEvent keyEvent; @@ -1914,7 +1919,7 @@ PRBool nsWidget::DispatchKeyEvent(PhKeyEvent_t *aPhKeyEvent) if ( (aPhKeyEvent->key_flags & Pk_KF_Cap_Valid) == 0) { - //printf("nsWidget::DispatchKeyEvent throwing away invalid key: Modifiers Valid=<%d,%d,%d> this=<%p>\n", + //PRINTF("nsWidget::DispatchKeyEvent throwing away invalid key: Modifiers Valid=<%d,%d,%d> this=<%p>", // (aPhKeyEvent->key_flags & Pk_KF_Scan_Valid), (aPhKeyEvent->key_flags & Pk_KF_Sym_Valid), (aPhKeyEvent->key_flags & Pk_KF_Cap_Valid), this ); return PR_TRUE; @@ -1923,7 +1928,7 @@ PRBool nsWidget::DispatchKeyEvent(PhKeyEvent_t *aPhKeyEvent) if ( PtIsFocused(mWidget) != 2) { - //printf("nsWidget::DispatchKeyEvent Not on focus leaf! PtIsFocused(mWidget)=<%d>\n", PtIsFocused(mWidget)); + //PRINTF("nsWidget::DispatchKeyEvent Not on focus leaf! PtIsFocused(mWidget)=<%d>", PtIsFocused(mWidget)); return PR_FALSE; } @@ -1935,46 +1940,46 @@ PRBool nsWidget::DispatchKeyEvent(PhKeyEvent_t *aPhKeyEvent) || ( aPhKeyEvent->key_cap == Pk_Scroll_Lock ) ) { - PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsWidget::DispatchKeyEvent Ignoring SHIFT or CONTROL keypress\n")); + PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsWidget::DispatchKeyEvent Ignoring SHIFT or CONTROL keypress")); return PR_TRUE; } nsWindow *w = (nsWindow *) this; #if 0 -printf("nsWidget::DispatchKeyEvent KeyEvent Info: this=<%p> key_flags=<%lu> key_mods=<%lu> key_sym=<%lu> key_cap=<%lu> key_scan=<%d> Focused=<%d>\n", - this, aPhKeyEvent->key_flags, aPhKeyEvent->key_mods, aPhKeyEvent->key_sym, aPhKeyEvent->key_cap, aPhKeyEvent->key_scan, PtIsFocused(mWidget)); +PRINTF("nsWidget::DispatchKeyEvent KeyEvent Info: this=<%p> key_flags=<%lu> key_mods=<%lu> key_sym=<%lu> key_cap=<%lu> key_scan=<%d> Focused=<%d>", + this, aPhKeyEvent->key_flags, aPhKeyEvent->key_mods, aPhKeyEvent->key_sym, aPhKeyEvent->key_cap, aPhKeyEvent->key_scan, PtIsFocused(mWidget)); #endif w->AddRef(); if (aPhKeyEvent->key_flags & Pk_KF_Key_Down) { - //printf("nsWidget::DispatchKeyEvent Before Key Down \n"); + //PRINTF("nsWidget::DispatchKeyEvent Before Key Down "); InitKeyEvent(aPhKeyEvent, this, keyEvent, NS_KEY_DOWN); result = w->OnKey(keyEvent); - //printf("nsWidget::DispatchKeyEvent after Key_Down event result=<%d>\n", result); + //PRINTF("nsWidget::DispatchKeyEvent after Key_Down event result=<%d>", result); - //printf("nsWidget::DispatchKeyEvent Before Key Press\n"); + //PRINTF("nsWidget::DispatchKeyEvent Before Key Press"); InitKeyEvent(aPhKeyEvent, this, keyEvent, NS_KEY_PRESS); result = w->OnKey(keyEvent); } else if (aPhKeyEvent->key_flags & Pk_KF_Key_Repeat) { - //printf("nsWidget::DispatchKeyEvent Before Key Press\n"); + //PRINTF("nsWidget::DispatchKeyEvent Before Key Press"); InitKeyEvent(aPhKeyEvent, this, keyEvent, NS_KEY_PRESS); result = w->OnKey(keyEvent); } else if (PkIsKeyDown(aPhKeyEvent->key_flags) == 0) { - //printf("nsWidget::DispatchKeyEvent Before Key Up\n"); + //PRINTF("nsWidget::DispatchKeyEvent Before Key Up"); InitKeyEvent(aPhKeyEvent, this, keyEvent, NS_KEY_UP); result = w->OnKey(keyEvent); } w->Release(); - //printf("nsWidget::DispatchKeyEvent after events result=<%d>\n", result); +//PRINTF("nsWidget::DispatchKeyEvent after events result=<%d>", result); return result; } @@ -1988,8 +1993,8 @@ printf("nsWidget::DispatchKeyEvent KeyEvent Info: this=<%p> key_flags=<%lu> key_ //------------------------------------------------------------------------- int nsWidget::RawEventHandler( PtWidget_t *widget, void *data, PtCallbackInfo_t *cbinfo ) { - //PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::RawEventHandler raweventhandler widget=<%p> this=<%p> IsFocused=<%d>\n", widget, data, PtIsFocused(widget) )); - //printf("nsWidget::RawEventHandler raweventhandler widget=<%p> this=<%p> IsFocused=<%d>\n", widget, data, PtIsFocused(widget)); + //PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::RawEventHandler raweventhandler widget=<%p> this=<%p> IsFocused=<%d>", widget, data, PtIsFocused(widget) )); +//PRINTF("nsWidget::RawEventHandler raweventhandler widget=<%p> this=<%p> IsFocused=<%d>", widget, data, PtIsFocused(widget)); // Get the window which caused the event and ask it to process the message nsWidget *someWidget = (nsWidget*) data; @@ -2015,11 +2020,11 @@ PRBool nsWidget::HandleEvent( PtCallbackInfo_t* aCbInfo ) PhEvent_t* event = aCbInfo->event; -//printf("nsWidget::HandleEvent entering this=<%p> mWidget=<%p> Event Consumed=<%d> Event=<%s>\n", +//PRINTF("nsWidget::HandleEvent entering this=<%p> mWidget=<%p> Event Consumed=<%d> Event=<%s>", // this, mWidget, (event->processing_flags & Ph_CONSUMED), (const char *) nsCAutoString(PhotonEventToString(event)) ); #if 0 -PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::HandleEvent entering this=<%p> mWidget=<%p> Event Consumed=<%d> Event=<%s>\n", +PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::HandleEvent entering this=<%p> mWidget=<%p> Event Consumed=<%d> Event=<%s>", this, mWidget, (event->processing_flags & Ph_CONSUMED), (const char *) nsCAutoString( (const PRUnichar *) PhotonEventToString(event)) )); #endif @@ -2032,7 +2037,7 @@ PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::HandleEvent entering this=<%p> mWidge if (IgnoreEvent == event->timestamp) { - //printf("nsWidget::HandleEvent Ignoring Event!\n"); + //PRINTF(("nsWidget::HandleEvent Ignoring Event!")); return PR_TRUE; } switch ( event->type ) @@ -2040,7 +2045,7 @@ PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::HandleEvent entering this=<%p> mWidge case Ph_EV_KEY: { PhKeyEvent_t* keyev = (PhKeyEvent_t*) PhGetData( event ); - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::HandleEvent keyev=<%p>\n", keyev)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::HandleEvent keyev=<%p>", keyev)); result = DispatchKeyEvent(keyev); } break; @@ -2050,43 +2055,43 @@ PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::HandleEvent entering this=<%p> mWidge PhDragEvent_t* ptrev = (PhDragEvent_t*) PhGetData( event ); nsMouseEvent theMouseEvent; - //printf("nsWidget::HandleEvent Ph_EV_DRAG subtype=<%d> flags=<%d>\n", event->subtype, ptrev->flags ); + //PRINTF(("nsWidget::HandleEvent Ph_EV_DRAG subtype=<%d> flags=<%d>", event->subtype, ptrev->flags )); switch(event->subtype) { case Ph_EV_DRAG_BOUNDARY: - //printf("nsWidget::HandleEvent Ph_EV_DRAG_BOUNDARY\n"); + //PRINTF(("nsWidget::HandleEvent Ph_EV_DRAG_BOUNDARY")); break; case Ph_EV_DRAG_COMPLETE: { nsMouseEvent theMouseEvent; PhPointerEvent_t* ptrev2 = (PhPointerEvent_t*) PhGetData( event ); - //printf("nsWidget::HandleEvent Ph_EV_DRAG_COMPLETE\n"); + //PRINTF(("nsWidget::HandleEvent Ph_EV_DRAG_COMPLETE")); ScreenToWidget( ptrev2->pos ); InitMouseEvent(ptrev2, this, theMouseEvent, NS_MOUSE_LEFT_BUTTON_UP ); result = DispatchMouseEvent(theMouseEvent); } break; case Ph_EV_DRAG_INIT: - //printf("nsWidget::HandleEvent Ph_EV_DRAG_INIT\n"); + //PRINTF(("nsWidget::HandleEvent Ph_EV_DRAG_INIT")); break; case Ph_EV_DRAG_KEY_EVENT: - //printf("nsWidget::HandleEvent Ph_EV_DRAG_KEY_EVENT\n"); + //PRINTF(("nsWidget::HandleEvent Ph_EV_DRAG_KEY_EVENT")); break; case Ph_EV_DRAG_MOTION_EVENT: { PhPointerEvent_t* ptrev2 = (PhPointerEvent_t*) PhGetData( event ); ScreenToWidget( ptrev2->pos ); - //printf("nsWidget::HandleEvent Ph_EV_DRAG_MOTION_EVENT pos=(%d,%d)\n", ptrev2->pos.x,ptrev2->pos.y ); + //PRINTF(("nsWidget::HandleEvent Ph_EV_DRAG_MOTION_EVENT pos=(%d,%d)", ptrev2->pos.x,ptrev2->pos.y )); InitMouseEvent(ptrev2, this, theMouseEvent, NS_MOUSE_MOVE ); result = DispatchMouseEvent(theMouseEvent); } break; case Ph_EV_DRAG_MOVE: - //printf("nsWidget::HandleEvent Ph_EV_DRAG_BOUNDARY\n"); + //PRINTF(("nsWidget::HandleEvent Ph_EV_DRAG_BOUNDARY")); break; case Ph_EV_DRAG_START: - //printf("nsWidget::HandleEvent Ph_EV_DRAG_START\n"); + //PRINTF(("nsWidget::HandleEvent Ph_EV_DRAG_START")); break; } } @@ -2097,7 +2102,7 @@ PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::HandleEvent entering this=<%p> mWidge PhPointerEvent_t* ptrev = (PhPointerEvent_t*) PhGetData( event ); nsMouseEvent theMouseEvent; - //printf("nsWidget::HandleEvent Ph_EV_PTR_MOTION_BUTTON\n"); + //PRINTF(("nsWidget::HandleEvent Ph_EV_PTR_MOTION_BUTTON")); #if 0 if( ptrev->buttons & Ph_BUTTON_SELECT ) // Normally the left mouse button @@ -2109,7 +2114,7 @@ PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::HandleEvent entering this=<%p> mWidge err=PhInitDrag( PtWidgetRid(mWidget), ( Ph_DRAG_KEY_MOTION | Ph_DRAG_TRACK ),&rect, &boundary, aCbInfo->event->input_group , NULL, NULL, NULL); if (err==-1) { - NS_WARNING("nsWidget::HandleEvent PhInitDrag Failed!\n"); + NS_WARNING("nsWidget::HandleEvent PhInitDrag Failed!"); result = NS_ERROR_FAILURE; } } @@ -2118,7 +2123,7 @@ PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::HandleEvent entering this=<%p> mWidge if( ptrev ) { ScreenToWidget( ptrev->pos ); - //printf("nsWidget::HandleEvent Ph_EV_PTR_MOTION_BUTTON pos=(%d,%d)\n", ptrev->pos.x,ptrev->pos.y ); + //PRINTF(("nsWidget::HandleEvent Ph_EV_PTR_MOTION_BUTTON pos=(%d,%d)", ptrev->pos.x,ptrev->pos.y )); InitMouseEvent(ptrev, this, theMouseEvent, NS_MOUSE_MOVE ); result = DispatchMouseEvent(theMouseEvent); @@ -2131,12 +2136,12 @@ PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::HandleEvent entering this=<%p> mWidge PhPointerEvent_t* ptrev = (PhPointerEvent_t*) PhGetData( event ); nsMouseEvent theMouseEvent; - //printf("nsWidget::HandleEvent Ph_EV_PTR_MOTION_NOBUTTON\n"); + //PRINTF(("nsWidget::HandleEvent Ph_EV_PTR_MOTION_NOBUTTON")); if( ptrev ) { ScreenToWidget( ptrev->pos ); - //printf("nsWidget::HandleEvent Ph_EV_PTR_MOTION_NOBUTTON pos=(%d,%d)\n", ptrev->pos.x,ptrev->pos.y ); + //PRINTF(("nsWidget::HandleEvent Ph_EV_PTR_MOTION_NOBUTTON pos=(%d,%d)", ptrev->pos.x,ptrev->pos.y )); InitMouseEvent(ptrev, this, theMouseEvent, NS_MOUSE_MOVE ); result = DispatchMouseEvent(theMouseEvent); @@ -2149,7 +2154,7 @@ PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::HandleEvent entering this=<%p> mWidge PhPointerEvent_t* ptrev = (PhPointerEvent_t*) PhGetData( event ); nsMouseEvent theMouseEvent; - //printf("nsWidget::HandleEvent Ph_EV_BUT_PRESS this=<%p>\n", this); + //PRINTF(("nsWidget::HandleEvent Ph_EV_BUT_PRESS this=<%p>", this)); if (ptrev) { @@ -2172,7 +2177,7 @@ PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::HandleEvent entering this=<%p> mWidge PhPointerEvent_t* ptrev = (PhPointerEvent_t*) PhGetData( event ); nsMouseEvent theMouseEvent; - //printf("nsWidget::HandleEvent Ph_EV_BUT_RELEASE this=<%p> event->subtype=<%d>\n", this,event->subtype); + //PRINTF(("nsWidget::HandleEvent Ph_EV_BUT_RELEASE this=<%p> event->subtype=<%d>", this,event->subtype)); if (event->subtype==Ph_EV_RELEASE_REAL || event->subtype==Ph_EV_RELEASE_PHANTOM) { @@ -2200,7 +2205,7 @@ PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::HandleEvent entering this=<%p> mWidge err=PhInitDrag( PtWidgetRid(mWidget), ( Ph_DRAG_KEY_MOTION | Ph_DRAG_TRACK ),&rect, &boundary, aCbInfo->event->input_group , NULL, NULL, NULL, NULL, NULL); if (err==-1) { - NS_WARNING("nsWidget::HandleEvent PhInitDrag Failed!\n"); + NS_WARNING("nsWidget::HandleEvent PhInitDrag Failed!"); result = NS_ERROR_FAILURE; } } @@ -2225,8 +2230,8 @@ PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::HandleEvent entering this=<%p> mWidge case Ph_EV_WM: { PhWindowEvent_t* wmev = (PhWindowEvent_t*) PhGetData( event ); - printf("nsWidget::HandleEvent Ph_EV_WM this=<%p> subtype=<%d> vent_f=<%d>\n", - this, event->subtype, wmev->event_f); + PRINTF(("nsWidget::HandleEvent Ph_EV_WM this=<%p> subtype=<%d> vent_f=<%d>", + this, event->subtype, wmev->event_f)); switch( wmev->event_f ) { @@ -2249,17 +2254,17 @@ PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::HandleEvent entering this=<%p> mWidge reg = event->emitter.rid; parreg = PtWidgetRid(mWidget); - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::HandleEvent Ph_EV_EXPOSE reg=<%d> gLastUnrealizedRegion=<%d> parreg=<%d> gLastUnrealizedRegionsParent=<%d>\n",reg, gLastUnrealizedRegion, parreg, gLastUnrealizedRegionsParent)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::HandleEvent Ph_EV_EXPOSE reg=<%d> gLastUnrealizedRegion=<%d> parreg=<%d> gLastUnrealizedRegionsParent=<%d>",reg, gLastUnrealizedRegion, parreg, gLastUnrealizedRegionsParent)); // if (parreg == gLastUnrealizedRegionsParent) if (reg == gLastUnrealizedRegion && parreg == gLastUnrealizedRegionsParent) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::HandleEvent Ph_EV_EXPOSE returning TRUE\n")); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::HandleEvent Ph_EV_EXPOSE returning TRUE")); result = PR_TRUE; } else { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::HandleEvent Ph_EV_EXPOSE returning FALSE\n")); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::HandleEvent Ph_EV_EXPOSE returning FALSE")); result = PR_FALSE; } } @@ -2302,13 +2307,13 @@ void nsWidget::InitDamageQueue() #ifdef ENABLE_DAMAGE_QUEUE_HOLDOFF int Global_Widget_Hold_Count; Global_Widget_Hold_Count = PtHold(); - PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsWidget::InitDamageQueue PtHold Global_Widget_Hold_Count=<%d> this=<%p>\n", Global_Widget_Hold_Count, this)); + PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsWidget::InitDamageQueue PtHold Global_Widget_Hold_Count=<%d> this=<%p>", Global_Widget_Hold_Count, this)); #endif } else { - PR_LOG(PhWidLog, PR_LOG_DEBUG,("*********** damage queue failed to init. ***********\n" )); + PR_LOG(PhWidLog, PR_LOG_DEBUG,("*********** damage queue failed to init. ***********" )); } } @@ -2321,7 +2326,7 @@ void nsWidget::InitDamageQueue() //--------------------------------------------------------------------------- void nsWidget::QueueWidgetDamage() { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::QueueWidgetDamage this=<%p> mDmgQueueInited=<%d>\n", this, mDmgQueueInited)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::QueueWidgetDamage this=<%p> mDmgQueueInited=<%d>", this, mDmgQueueInited)); if( !mDmgQueueInited ) InitDamageQueue(); @@ -2371,7 +2376,7 @@ void nsWidget::QueueWidgetDamage() //--------------------------------------------------------------------------- void nsWidget::UpdateWidgetDamage() { - PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsWidget::UpdateWidgetDamaged this=<%p> mWidget=<%p>\n", this, mWidget)); + PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsWidget::UpdateWidgetDamaged this=<%p> mWidget=<%p>", this, mWidget)); if (mWidget == NULL) { @@ -2389,7 +2394,7 @@ void nsWidget::UpdateWidgetDamage() if (mUpdateArea->IsEmpty()) { - PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsWidget::UpdateWidgetDamaged skipping update because mUpdateArea IsEmpty() this=<%p>\n", this)); + PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsWidget::UpdateWidgetDamaged skipping update because mUpdateArea IsEmpty() this=<%p>", this)); return; } @@ -2402,19 +2407,19 @@ void nsWidget::UpdateWidgetDamage() PtWidgetArea( mWidget, &area ); - PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsWidget::UpdateWidgetDamaged mWidget=<%p> area=<%d,%d,%d,%d>\n", mWidget, area.pos.x, area.pos.y, area.size.w, area.size.h)); + PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsWidget::UpdateWidgetDamaged mWidget=<%p> area=<%d,%d,%d,%d>", mWidget, area.pos.x, area.pos.y, area.size.w, area.size.h)); #if 1 if ((PtWidgetIsClass(mWidget, PtWindow)) || (PtWidgetIsClass(mWidget, PtRegion))) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::UpdateWidgetDamaged mWidget=<%p> is a PtWindow, set x,y=0\n", mWidget)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::UpdateWidgetDamaged mWidget=<%p> is a PtWindow, set x,y=0", mWidget)); area.pos.x = area.pos.y = 0; } #endif #if defined(ENABLE_DOPAINT) // HACK, call RawDrawFunc directly instead of Damaging the widget - printf("nsWidget::UpdateWidgetDamaged calling doPaint\n"); + PRINTF("nsWidget::UpdateWidgetDamaged calling doPaint"); doPaint(); #else if (NS_FAILED(mUpdateArea->GetRects(®ionRectSet))) @@ -2427,19 +2432,19 @@ void nsWidget::UpdateWidgetDamage() #if 0 int Global_Widget_Hold_Count; Global_Widget_Hold_Count = PtContainerHold(mWidget); - PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsWidget::UpdateWidgetDamaged PtHold Global_Widget_Hold_Count=<%d> this=<%p>\n", Global_Widget_Hold_Count, this)); + PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsWidget::UpdateWidgetDamaged PtHold Global_Widget_Hold_Count=<%d> this=<%p>", Global_Widget_Hold_Count, this)); #endif len = regionRectSet->mRectsLen; - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::UpdateWidgetDamaged %d rects to damage\n", len)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::UpdateWidgetDamaged %d rects to damage", len)); for (i=0;imRects[i]); temp_rect.SetRect(r->x, r->y, r->width, r->height); - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::UpdateWidgetDamaged %d temp_rect=(%d,%d,%d,%d)\n", i, r->x, r->y, r->width, r->height)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::UpdateWidgetDamaged %d temp_rect=(%d,%d,%d,%d)", i, r->x, r->y, r->width, r->height)); if( GetParentClippedArea(temp_rect)) { @@ -2448,13 +2453,13 @@ void nsWidget::UpdateWidgetDamage() extent.lr.x = extent.ul.x + temp_rect.width - 1; extent.lr.y = extent.ul.y + temp_rect.height - 1; - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::UpdateWidgetDamaged this=<%p> mWidget=<%p> PtDamageExtent=(%d,%d,%d,%d)\n", this, mWidget, extent.ul.x, extent.ul.y, extent.lr.x, extent.lr.y)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::UpdateWidgetDamaged this=<%p> mWidget=<%p> PtDamageExtent=(%d,%d,%d,%d)", this, mWidget, extent.ul.x, extent.ul.y, extent.lr.x, extent.lr.y)); PtDamageExtent( mWidget, &extent ); } else { - PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsWidget::UpdateWidgetDamaged SKIPPING due to GetParentClippedArea this=<%p> extent=(%d,%d,%d,%d)\n", this, extent.ul.x, extent.ul.y, extent.lr.x, extent.lr.y)); + PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsWidget::UpdateWidgetDamaged SKIPPING due to GetParentClippedArea this=<%p> extent=(%d,%d,%d,%d)", this, extent.ul.x, extent.ul.y, extent.lr.x, extent.lr.y)); } } @@ -2466,7 +2471,7 @@ void nsWidget::UpdateWidgetDamage() #if 0 Global_Widget_Hold_Count = PtContainerRelease(mWidget); - PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsWidget::UpdateWidgetDamaged PtHold/PtRelease Global_Widget_Hold_Count=<%d> this=<%p>\n", Global_Widget_Hold_Count, this)); + PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsWidget::UpdateWidgetDamaged PtHold/PtRelease Global_Widget_Hold_Count=<%d> this=<%p>", Global_Widget_Hold_Count, this)); #endif mUpdateArea->SetTo(0,0,0,0); @@ -2475,7 +2480,7 @@ void nsWidget::UpdateWidgetDamage() void nsWidget::RemoveDamagedWidget(PtWidget_t *aWidget) { - PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsWidget::RemoveDamagedWidget Photon Widget=<%p>\n", aWidget)); + PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsWidget::RemoveDamagedWidget Photon Widget=<%p>", aWidget)); if( mDmgQueueInited ) { @@ -2510,13 +2515,13 @@ void nsWidget::RemoveDamagedWidget(PtWidget_t *aWidget) /* The matching PtHold is in nsWidget::InitDamageQueue */ int Global_Widget_Hold_Count; Global_Widget_Hold_Count = PtRelease(); - PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsWidget::RemoveDamagedWidget PtHold/PtRelease Global_Widget_Hold_Count=<%d> this=<%p>\n", Global_Widget_Hold_Count, this)); + PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsWidget::RemoveDamagedWidget PtHold/PtRelease Global_Widget_Hold_Count=<%d> this=<%p>", Global_Widget_Hold_Count, this)); #endif if( mWorkProcID ) PtAppRemoveWorkProc( nsnull, mWorkProcID ); - PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsWidget::RemoveDamagedWidget finished removing last item\n")); + PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsWidget::RemoveDamagedWidget finished removing last item")); } } } @@ -2524,7 +2529,7 @@ void nsWidget::RemoveDamagedWidget(PtWidget_t *aWidget) int nsWidget::WorkProc( void *data ) { - PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsWidget::WorkProc begin\n")); + PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsWidget::WorkProc begin")); DamageQueueEntry **dq = (DamageQueueEntry **) data; @@ -2543,7 +2548,7 @@ int nsWidget::WorkProc( void *data ) if( PtWidgetIsRealized( dqe->widget )) { #if defined( ENABLE_DOPAINT) - printf("nsWidget::WorkProc calling doPaint\n"); + PRINTF("nsWidget::WorkProc calling doPaint"); dqe->inst->doPaint(); #else nsRegionRectSet *regionRectSet = nsnull; @@ -2552,22 +2557,22 @@ int nsWidget::WorkProc( void *data ) nsRect temp_rect; PtWidgetArea( dqe->widget, &area ); // parent coords - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::WorkProc damaging widget=<%p> area=<%d,%d,%d,%d>\n", dqe->widget, area.pos.x, area.pos.y, area.size.w, area.size.h)); -//printf("nsWidget::WorkProc PtWindow origin at (%d,%d) IsEmpty=<%d>\n", area.pos.x, area.pos.y, dqe->inst->mUpdateArea->IsEmpty()); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::WorkProc damaging widget=<%p> area=<%d,%d,%d,%d>", dqe->widget, area.pos.x, area.pos.y, area.size.w, area.size.h)); +//PRINTF("nsWidget::WorkProc PtWindow origin at (%d,%d) IsEmpty=<%d>", area.pos.x, area.pos.y, dqe->inst->mUpdateArea->IsEmpty()); // this was enabled... what was it doing? #if 0 /* Is forcing the damage to 0,0 really a good idea here?? */ if ((PtWidgetIsClass(dqe->widget, PtWindow)) || (PtWidgetIsClass(dqe->widget, PtRegion))) { - printf("nsWidget::WorkProc Forced PtWindow origin to 0,0\n"); + PRINTF("nsWidget::WorkProc Forced PtWindow origin to 0,0"); area.pos.x = area.pos.y = 0; } #endif if (dqe->inst->mUpdateArea->IsEmpty()) { -PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::WorkProc damaging widget=<%p> mUpdateArea empty\n")); +PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::WorkProc damaging widget=<%p> mUpdateArea empty")); extent.ul.x = 0; //area.pos.x; // convert widget coords to parent extent.ul.y = 0; //area.pos.y; @@ -2578,7 +2583,7 @@ PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::WorkProc damaging widget=<%p> mUpdate nsWidget *aWidget = GetInstance( (PtWidget_t *) dqe->widget ); aPtWidget = (PtWidget_t *)aWidget->GetNativeData(NS_NATIVE_WIDGET); PtDamageExtent( aPtWidget, &extent); - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::WorkProc damaging widget=<%p> %d PtDamageExtent=<%d,%d,%d,%d> next=<%p>\n", aPtWidget, i, extent.ul.x, extent.ul.y, extent.lr.x, extent.lr.y, dqe->next)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::WorkProc damaging widget=<%p> %d PtDamageExtent=<%d,%d,%d,%d> next=<%p>", aPtWidget, i, extent.ul.x, extent.ul.y, extent.lr.x, extent.lr.y, dqe->next)); } else { @@ -2601,7 +2606,7 @@ PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::WorkProc damaging widget=<%p> mUpdate aPtWidget = (PtWidget_t *)aWidget->GetNativeData(NS_NATIVE_WIDGET); PtDamageExtent( aPtWidget, &extent); - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::WorkProc damaging widget=<%p> %d PtDamageExtent=<%d,%d,%d,%d> next=<%p>\n", aPtWidget, i, extent.ul.x, extent.ul.y, extent.lr.x, extent.lr.y, dqe->next)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::WorkProc damaging widget=<%p> %d PtDamageExtent=<%d,%d,%d,%d> next=<%p>", aPtWidget, i, extent.ul.x, extent.ul.y, extent.lr.x, extent.lr.y, dqe->next)); } dqe->inst->mUpdateArea->FreeRects(regionRectSet); @@ -2622,12 +2627,12 @@ PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::WorkProc damaging widget=<%p> mUpdate #ifdef ENABLE_DAMAGE_QUEUE_HOLDOFF /* The matching PtHold is in nsWidget::InitDamageQueue */ Global_Widget_Hold_Count = PtRelease(); - PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsWidget::WorkProc end, PtHold/PtRelease Global_Widget_Hold_Count=<%d>\n", Global_Widget_Hold_Count)); + PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsWidget::WorkProc end, PtHold/PtRelease Global_Widget_Hold_Count=<%d>", Global_Widget_Hold_Count)); #endif #if 0 Global_Widget_Hold_Count = PtFlush(); /* this may not be necessary since after PtRelease */ - PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsWidget::WorkProc PtFlush Global_Widget_Hold_Count=<%d>\n", Global_Widget_Hold_Count)); + PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsWidget::WorkProc PtFlush Global_Widget_Hold_Count=<%d>", Global_Widget_Hold_Count)); #endif } @@ -2640,18 +2645,18 @@ int nsWidget::GotFocusCallback( PtWidget_t *widget, void *data, PtCallbackInfo_t /* if (widget->parent) - printf("nsWidget::GotFocusCallback widget->parent=<%p> PtIsFocused(widget)=<%d>\n", widget->parent, PtIsFocused(widget)); + PRINTF("nsWidget::GotFocusCallback widget->parent=<%p> PtIsFocused(widget)=<%d>", widget->parent, PtIsFocused(widget)); else - printf("nsWidget::GotFocusCallback widget->parent=<%p>\n", widget->parent); + PRINTF("nsWidget::GotFocusCallback widget->parent=<%p>", widget->parent); */ if ((!widget->parent) || (PtIsFocused(widget) != 2)) { - //printf("nsWidget::GotFocusCallback widget->parent=<%p>\n", widget->parent); + //PRINTF("nsWidget::GotFocusCallback widget->parent=<%p>", widget->parent); return Pt_CONTINUE; } - PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsWidget::GotFocusCallback pWidget=<%p>\n", pWidget)); + PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsWidget::GotFocusCallback pWidget=<%p>", pWidget)); pWidget->DispatchStandardEvent(NS_GOTFOCUS); return Pt_CONTINUE; @@ -2663,11 +2668,11 @@ int nsWidget::LostFocusCallback( PtWidget_t *widget, void *data, PtCallbackInfo_ if ((widget->parent) && (PtIsFocused(widget) != 2)) { - PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsWidget::LostFocusCallback Not on focus leaf! PtIsFocused(mWidget)=<%d>\n", PtIsFocused(widget) )); + PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsWidget::LostFocusCallback Not on focus leaf! PtIsFocused(mWidget)=<%d>", PtIsFocused(widget) )); return Pt_CONTINUE; } - PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsWidget::LostFocusCallback pWidget=<%p>\n", pWidget)); + PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsWidget::LostFocusCallback pWidget=<%p>", pWidget)); // pWidget->DispatchStandardEvent(NS_LOSTFOCUS); @@ -2678,7 +2683,7 @@ int nsWidget::DestroyedCallback( PtWidget_t *widget, void *data, PtCallbackInfo_ { nsWidget *pWidget = (nsWidget *) data; - PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsWidget::DestroyedCallback pWidget=<%p> mWidget=<%p> mIsDestroying=<%d>\n", pWidget, pWidget->mWidget, pWidget->mIsDestroying)); + PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsWidget::DestroyedCallback pWidget=<%p> mWidget=<%p> mIsDestroying=<%d>", pWidget, pWidget->mWidget, pWidget->mIsDestroying)); if (!pWidget->mIsDestroying) { pWidget->RemoveDamagedWidget(pWidget->mWidget); diff --git a/mozilla/widget/src/photon/nsWindow.cpp b/mozilla/widget/src/photon/nsWindow.cpp index 7d17b8b6779..212d05a1044 100644 --- a/mozilla/widget/src/photon/nsWindow.cpp +++ b/mozilla/widget/src/photon/nsWindow.cpp @@ -67,7 +67,7 @@ unsigned long IgnoreEvent = 0; //------------------------------------------------------------------------- nsWindow::nsWindow() { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::nsWindow (%p)\n", this )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::nsWindow (%p)", this )); //NS_INIT_REFCNT(); mClientWidget = nsnull; @@ -99,21 +99,21 @@ nsWindow::nsWindow() if (mLastDragMotionWindow == this) mLastDragMotionWindow = NULL; - PR_LOG(PhWidLog, PR_LOG_DEBUG, (" border=%X, window=%X\n", mBorderStyle, mWindowType )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, (" border=%X, window=%X", mBorderStyle, mWindowType )); } ChildWindow::ChildWindow() { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("ChildWindow::ChildWindow this=(%p)\n", this )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("ChildWindow::ChildWindow this=(%p)", this )); mBorderStyle = eBorderStyle_none; mWindowType = eWindowType_child; - PR_LOG(PhWidLog, PR_LOG_DEBUG, (" border=%X, window=%X\n", mBorderStyle, mWindowType )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, (" border=%X, window=%X", mBorderStyle, mWindowType )); } ChildWindow::~ChildWindow() { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("ChildWindow::~ChildWindow this=(%p)\n", this )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("ChildWindow::~ChildWindow this=(%p)", this )); } PRBool ChildWindow::IsChild() const @@ -128,7 +128,7 @@ PRBool ChildWindow::IsChild() const //------------------------------------------------------------------------- nsWindow::~nsWindow() { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::~nsWindow this=(%p)\n", this )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::~nsWindow this=(%p)", this )); // make sure that we release the grab indicator here if (mGrabWindow == this) { @@ -156,13 +156,13 @@ PRBool nsWindow::IsChild() const NS_IMETHODIMP nsWindow::WidgetToScreen(const nsRect& aOldRect, nsRect& aNewRect) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::WidgetToScreen this=<%p> mBounds=<%d,%d,%d,%d> aOldRect=<%d,%d>\n", this, mBounds.x, mBounds.y, mBounds.width, mBounds.height,aOldRect.x,aOldRect.y )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::WidgetToScreen this=<%p> mBounds=<%d,%d,%d,%d> aOldRect=<%d,%d>", this, mBounds.x, mBounds.y, mBounds.width, mBounds.height,aOldRect.x,aOldRect.y )); PhPoint_t p1; if (mWidget) { PtWidgetOffset(mWidget,&p1); - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::WidgetToScreen mWidget offset <%d,%d>\n", p1.x, p1.y)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::WidgetToScreen mWidget offset <%d,%d>", p1.x, p1.y)); } @@ -204,15 +204,15 @@ void nsWindow::DestroyNative(void) void nsWindow::DestroyNativeChildren(void) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::DestroyNativeChildren this=(%p)\n", this)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::DestroyNativeChildren this=(%p)", this)); for(PtWidget_t *w=PtWidgetChildFront( mWidget ); w; w=PtWidgetBrotherBehind( w )) { nsWindow *childWindow = NS_STATIC_CAST(nsWindow *, GetInstance(w) ); - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::DestroyNativeChildren this=(%p) childWindow=<%p> photon_widget=<%p>\n", this, childWindow, w)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::DestroyNativeChildren this=(%p) childWindow=<%p> photon_widget=<%p>", this, childWindow, w)); if (childWindow) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::DestroyNativeChildren \t mIsDestroying=<%d> mOnDestroyCalled=<%d> \n", childWindow->mIsDestroying, childWindow->mOnDestroyCalled)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::DestroyNativeChildren \t mIsDestroying=<%d> mOnDestroyCalled=<%d> ", childWindow->mIsDestroying, childWindow->mOnDestroyCalled)); if (!childWindow->mIsDestroying) { childWindow->Destroy(); @@ -220,12 +220,12 @@ void nsWindow::DestroyNativeChildren(void) } } -// PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::DestroyNativeChildren exiting this=(%p)\n", this)); +// PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::DestroyNativeChildren exiting this=(%p)", this)); } NS_IMETHODIMP nsWindow::Update(void) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Update this=<%p> mUpdateArea=<%p> mUpdateArea->IsEmpty()=<%d>\n", this, mUpdateArea, mUpdateArea->IsEmpty() )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Update this=<%p> mUpdateArea=<%p> mUpdateArea->IsEmpty()=<%d>", this, mUpdateArea, mUpdateArea->IsEmpty() )); #if 1 return nsWidget::Update(); @@ -236,7 +236,7 @@ NS_IMETHODIMP nsWindow::Update(void) if (mWidget == NULL) { -// printf("nsWindow::Update mWidget is NULL\n"); +// PRINTF(("nsWindow::Update mWidget is NULL")); NS_ASSERTION(0, "nsWidget::UpdateWidgetDamaged mWidget is NULL"); return; } @@ -244,7 +244,7 @@ NS_IMETHODIMP nsWindow::Update(void) if( !PtWidgetIsRealized( mWidget )) { //NS_ASSERTION(0, "nsWidget::UpdateWidgetDamaged skipping update because widget is not Realized"); -// printf("nsWindow::Update mWidget is not realized\n"); +// PRINTF(("nsWindow::Update mWidget is not realized")); return; } @@ -262,7 +262,7 @@ NS_IMETHODIMP nsWindow::Update(void) } else { - //printf("nsWindow::Update mWidget has NULL nativeRegion\n"); + //PRINTF(("nsWindow::Update mWidget has NULL nativeRegion")); } #else nsRegionRectSet *regionRectSet = nsnull; @@ -298,19 +298,23 @@ NS_IMETHODIMP nsWindow::CaptureRollupEvents(nsIRollupListener * aListener, PRBool aDoCapture, PRBool aConsumeRollupEvent) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::CaptureRollupEvents this=<%p> doCapture=<%i> aConsumeRollupEvent=<%d>\n", this, aDoCapture, aConsumeRollupEvent)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::CaptureRollupEvents this=<%p> doCapture=<%i> aConsumeRollupEvent=<%d>", this, aDoCapture, aConsumeRollupEvent)); PtWidget_t *grabWidget; grabWidget = mWidget; if (aDoCapture) { + //PRINTF(("nsWindow::CaptureRollupEvents CAPTURE widget this=<%p> gRollupScreenRegion=<%p> mMenuRegion=<%p>", this, gRollupScreenRegion, mMenuRegion)); + /* Create a pointer region */ mIsGrabbing = PR_TRUE; mGrabWindow = this; } else { + //PRINTF(("nsWindow::CaptureRollupEvents UN-CAPTURE widget this=<%p> gRollupScreenRegion=<%p> mMenuRegion=<%p>", this, gRollupScreenRegion, mMenuRegion)); + // make sure that the grab window is marked as released if (mGrabWindow == this) { @@ -341,18 +345,18 @@ NS_IMETHODIMP nsWindow::CaptureRollupEvents(nsIRollupListener * aListener, NS_IMETHODIMP nsWindow::Invalidate(PRBool aIsSynchronous) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Invalidate 1 this=<%p> IsSynch=<%d> mBounds=(%d,%d,%d,%d)\n", this, aIsSynchronous, + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Invalidate 1 this=<%p> IsSynch=<%d> mBounds=(%d,%d,%d,%d)", this, aIsSynchronous, mBounds.x, mBounds.y, mBounds.width, mBounds.height)); if (!mWidget) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Invalidate 1 - mWidget is NULL!\n" )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Invalidate 1 - mWidget is NULL!" )); return NS_OK; // mWidget will be null during printing. } if (!PtWidgetIsRealized(mWidget)) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Invalidate 1 - mWidget is not realized\n")); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Invalidate 1 - mWidget is not realized")); return NS_OK; } @@ -373,18 +377,18 @@ NS_IMETHODIMP nsWindow::Invalidate(PRBool aIsSynchronous) NS_IMETHODIMP nsWindow::Invalidate(const nsRect &aRect, PRBool aIsSynchronous) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Invalidate 2 this=<%p> IsSynch=<%d> mBounds=(%d,%d,%d,%d) aRect=(%d,%d,%d,%d)\n", this, aIsSynchronous, + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Invalidate 2 this=<%p> IsSynch=<%d> mBounds=(%d,%d,%d,%d) aRect=(%d,%d,%d,%d)", this, aIsSynchronous, mBounds.x, mBounds.y, mBounds.width, mBounds.height,aRect.x, aRect.y, aRect.width, aRect.height)); if (!mWidget) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Invalidate 2 - mWidget is NULL!\n" )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Invalidate 2 - mWidget is NULL!" )); return NS_OK; // mWidget will be null during printing. } if (!PtWidgetIsRealized(mWidget)) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Invalidate 2 - mWidget is not realized\n")); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Invalidate 2 - mWidget is not realized")); return NS_OK; } @@ -410,18 +414,18 @@ NS_IMETHODIMP nsWindow::InvalidateRegion(const nsIRegion* aRegion, PRBool aIsSyn { nsIRegion *newRegion; - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::InvalidateRegion this=<%p> IsSynch=<%d> mBounds=(%d,%d,%d,%d)\n", this, aIsSynchronous, + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::InvalidateRegion this=<%p> IsSynch=<%d> mBounds=(%d,%d,%d,%d)", this, aIsSynchronous, mBounds.x, mBounds.y, mBounds.width, mBounds.height)); if (!mWidget) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::InvalidateRegion - mWidget is NULL!\n" )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::InvalidateRegion - mWidget is NULL!" )); return NS_OK; // mWidget will be null during printing. } if (!PtWidgetIsRealized(mWidget)) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::InvalidateRegion - mWidget is not realized\n")); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::InvalidateRegion - mWidget is not realized")); return NS_OK; } @@ -439,7 +443,7 @@ NS_IMETHODIMP nsWindow::InvalidateRegion(const nsIRegion* aRegion, PRBool aIsSyn for (i=0;imRects[i]); - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::InvalidateRegion rect %d is <%d,%d,%d,%d>\n", i, r->x, r->y, r->width, r->height)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::InvalidateRegion rect %d is <%d,%d,%d,%d>", i, r->x, r->y, r->width, r->height)); } newRegion->FreeRects(regionRectSet); @@ -465,21 +469,21 @@ NS_IMETHODIMP nsWindow::InvalidateRegion(const nsIRegion* aRegion, PRBool aIsSyn NS_IMETHODIMP nsWindow::SetBackgroundColor(const nscolor &aColor) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::SetBackgroundColor this=<%p> color(RGB)=(%d,%d,%d)\n", this, NS_GET_R(aColor),NS_GET_G(aColor),NS_GET_B(aColor))); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::SetBackgroundColor this=<%p> color(RGB)=(%d,%d,%d)", this, NS_GET_R(aColor),NS_GET_G(aColor),NS_GET_B(aColor))); return nsWidget::SetBackgroundColor(aColor); } NS_IMETHODIMP nsWindow::SetFocus(void) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::SetFocus this=<%p>\n", this)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::SetFocus this=<%p>", this)); return nsWidget::SetFocus(); } NS_METHOD nsWindow::PreCreateWidget(nsWidgetInitData *aInitData) { -// PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::PreCreateWidget\n")); +// PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::PreCreateWidget")); if (nsnull != aInitData) { @@ -491,7 +495,7 @@ NS_METHOD nsWindow::PreCreateWidget(nsWidgetInitData *aInitData) // if (mWindowType==1) mClipChildren = PR_FALSE; else mClipChildren = PR_TRUE; // if (mWindowType==2) mClipSiblings = PR_TRUE; else mClipSiblings = PR_FALSE; - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::PreCreateWidget mClipChildren=<%d> mClipSiblings=<%d> mBorderStyle=<%d> mWindowType=<%d>\n", + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::PreCreateWidget mClipChildren=<%d> mClipSiblings=<%d> mBorderStyle=<%d> mWindowType=<%d>", mClipChildren, mClipSiblings, mBorderStyle, mWindowType)); return NS_OK; @@ -508,7 +512,7 @@ NS_METHOD nsWindow::PreCreateWidget(nsWidgetInitData *aInitData) //------------------------------------------------------------------------- NS_METHOD nsWindow::CreateNative(PtWidget_t *parentWidget) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::CreateNative this=(%p) - PhotonParent=<%p> IsChild=<%d> mParent=<%p>\n", this, parentWidget, IsChild(), mParent)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::CreateNative this=(%p) - PhotonParent=<%p> IsChild=<%d> mParent=<%p>", this, parentWidget, IsChild(), mParent)); PtArg_t arg[20]; int arg_count = 0; @@ -522,29 +526,29 @@ NS_METHOD nsWindow::CreateNative(PtWidget_t *parentWidget) dim.w = mBounds.width; dim.h = mBounds.height; - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::CreateNative - bounds = (%d,%d,%d,%d)\n", mBounds.x, mBounds.y, mBounds.width, mBounds.height )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::CreateNative - bounds = (%d,%d,%d,%d)", mBounds.x, mBounds.y, mBounds.width, mBounds.height )); switch( mWindowType ) { case eWindowType_popup : - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("\twindow type = popup\n" )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("\twindow type = popup" )); mIsToplevel = PR_TRUE; break; case eWindowType_toplevel : - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("\twindow type = toplevel\n" )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("\twindow type = toplevel" )); mIsToplevel = PR_TRUE; break; case eWindowType_dialog : - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("\twindow type = dialog\n" )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("\twindow type = dialog" )); mIsToplevel = PR_TRUE; break; case eWindowType_child : - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("\twindow type = child\n" )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("\twindow type = child" )); mIsToplevel = PR_FALSE; break; } - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("\tborder style = %X\n", mBorderStyle )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("\tborder style = %X", mBorderStyle )); if ( mWindowType == eWindowType_child ) { @@ -565,7 +569,7 @@ NS_METHOD nsWindow::CreateNative(PtWidget_t *parentWidget) if( mWindowType == eWindowType_popup ) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, (" Creating a pop-up (no decorations).\n" )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, (" Creating a pop-up (no decorations)." )); } else { @@ -676,6 +680,7 @@ NS_METHOD nsWindow::CreateNative(PtWidget_t *parentWidget) PtSetArg( &args[arg_count2++], Pt_ARG_AREA, &area, 0 ); PtSetArg( &args[arg_count2++], Pt_ARG_FILL_COLOR, Pg_TRANSPARENT, 0 ); PtSetArg( &args[arg_count2++], Pt_ARG_RAW_CALLBACKS, &callback, 1 ); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::CreateNative creating gRollupScreenRegion = <%p>", gRollupScreenRegion)); mMenuRegion = PtCreateWidget( PtRegion, parentWidget, arg_count2, args ); } @@ -739,7 +744,7 @@ NS_METHOD nsWindow::CreateNative(PtWidget_t *parentWidget) if( mWidget ) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::CreateNative - mWidget=%p, mClientWidget=%p\n", mWidget, mClientWidget )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::CreateNative - mWidget=%p, mClientWidget=%p", mWidget, mClientWidget )); SetInstance( mWidget, this ); @@ -820,7 +825,7 @@ NS_METHOD nsWindow::CreateNative(PtWidget_t *parentWidget) result = NS_OK; } else - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::CreateNative - FAILED TO CREATE WIDGET!\n" )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::CreateNative - FAILED TO CREATE WIDGET!" )); SetCursor( mCursor ); @@ -839,11 +844,11 @@ void *nsWindow::GetNativeData(PRUint32 aDataType) { case NS_NATIVE_WINDOW: if( !mWidget ) - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::GetNativeData( NS_NATIVE_WINDOW ) - mWidget is NULL!\n")); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::GetNativeData( NS_NATIVE_WINDOW ) - mWidget is NULL!")); return (void *)mWidget; case NS_NATIVE_WIDGET: - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::GetNativeData( NS_NATIVE_WIDGET ) - this=<%p> mWidget=<%p> mClientWidget=<%p>\n", this, mWidget, mClientWidget)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::GetNativeData( NS_NATIVE_WIDGET ) - this=<%p> mWidget=<%p> mClientWidget=<%p>", this, mWidget, mClientWidget)); if (mClientWidget) return (void *) mClientWidget; else @@ -860,7 +865,7 @@ void *nsWindow::GetNativeData(PRUint32 aDataType) //------------------------------------------------------------------------- NS_METHOD nsWindow::SetColorMap(nsColorMap *aColorMap) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::SetColorMap - Not Implemented.\n")); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::SetColorMap - Not Implemented.")); return NS_OK; } @@ -884,7 +889,7 @@ NS_METHOD nsWindow::SetColorMap(nsColorMap *aColorMap) //------------------------------------------------------------------------- NS_METHOD nsWindow::Scroll(PRInt32 aDx, PRInt32 aDy, nsRect *aClipRect) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Scroll this=<%p> mWidget=<%p> mClientWidget=<%p> aDx=<%d aDy=<%d> aClipRect=<%p>\n", + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Scroll this=<%p> mWidget=<%p> mClientWidget=<%p> aDx=<%d aDy=<%d> aClipRect=<%p>", this, mWidget, mClientWidget, aDx, aDy, aClipRect)); short count = 0; @@ -907,31 +912,31 @@ NS_METHOD nsWindow::Scroll(PRInt32 aDx, PRInt32 aDy, nsRect *aClipRect) { PtWidget_t *w; - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Scroll Children of w=<%p>\n", widget)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Scroll Children of w=<%p>", widget)); for(count=0, w=PtWidgetChildFront( widget ); w; w=PtWidgetBrotherBehind( w ),count++) { PhArea_t area; PtWidgetArea(w, &area); - PR_LOG(PhWidLog, PR_LOG_DEBUG, (" nsWindow::Scroll Child %d is <%p> at <%d,%d,%d,%d>\n", count, w, area.pos.x, area.pos.y, area.size.w, area.size.h)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, (" nsWindow::Scroll Child %d is <%p> at <%d,%d,%d,%d>", count, w, area.pos.x, area.pos.y, area.size.w, area.size.h)); nsWindow *win = (nsWindow *) GetInstance(w); if (win) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, (" Moz ptr=<%p> window_type=<%d>\n", win, win->mWindowType)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, (" Moz ptr=<%p> window_type=<%d>", win, win->mWindowType)); } } - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Scroll Brothers in front of w=<%p>\n", widget)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Scroll Brothers in front of w=<%p>", widget)); for(count=0, w=PtWidgetBrotherInFront( widget ); w; w=PtWidgetBrotherInFront(w), count++) { PhArea_t area; PtWidgetArea(w, &area); - PR_LOG(PhWidLog, PR_LOG_DEBUG, (" nsWindow::Scroll Brother %d is <%p> at <%d,%d,%d,%d>\n", count, w, area.pos.x, area.pos.y, area.size.w, area.size.h)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, (" nsWindow::Scroll Brother %d is <%p> at <%d,%d,%d,%d>", count, w, area.pos.x, area.pos.y, area.size.w, area.size.h)); nsWindow *win = (nsWindow *) GetInstance(w); if (win) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, (" Moz ptr=<%p> window_type=<%d>\n", win, win->mWindowType)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, (" Moz ptr=<%p> window_type=<%d>", win, win->mWindowType)); } } } @@ -944,7 +949,7 @@ NS_METHOD nsWindow::Scroll(PRInt32 aDx, PRInt32 aDy, nsRect *aClipRect) PhPoint_t *pos; PhPoint_t p; - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Scroll Moving children...\n" )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Scroll Moving children..." )); for( w=PtWidgetChildFront( widget ); w; w=PtWidgetBrotherBehind( w )) { PtSetArg( &arg, Pt_ARG_POS, &pos, 0 ); @@ -953,7 +958,7 @@ NS_METHOD nsWindow::Scroll(PRInt32 aDx, PRInt32 aDy, nsRect *aClipRect) p.x += aDx; p.y += aDy; - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Scroll Moving children PtWidget=<%p> to (%d,%d)\n", w, p.x, p.y)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Scroll Moving children PtWidget=<%p> to (%d,%d)", w, p.x, p.y)); PtSetArg( &arg, Pt_ARG_POS, &p, 0 ); PtSetResources( w, 1, &arg ) ; @@ -971,17 +976,17 @@ NS_METHOD nsWindow::Scroll(PRInt32 aDx, PRInt32 aDy, nsRect *aClipRect) // in front of our window - but its not needed here. if ( GetSiblingClippedRegion( &clipped_tiles, &sib_tiles ) == NS_OK ) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Scroll GetSiblingClippedRegion returned OK\n")); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Scroll GetSiblingClippedRegion returned OK")); #if defined(DEBUG) && 0 { PhTile_t *top = clipped_tiles; int index=0; - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Scroll Damage clipped_tiles Tiles List:\n")); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Scroll Damage clipped_tiles Tiles List:")); while (top) { PhRect_t rect = top->rect; - PR_LOG(PhWidLog, PR_LOG_DEBUG, (" nsWindow::Scroll tile %d rect=<%d,%d,%d,%d> next=<%p>\n", index++,rect.ul.x,rect.ul.y,rect.lr.x,rect.lr.y, top->next)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, (" nsWindow::Scroll tile %d rect=<%d,%d,%d,%d> next=<%p>", index++,rect.ul.x,rect.ul.y,rect.lr.x,rect.lr.y, top->next)); top=top->next; } } @@ -991,11 +996,11 @@ NS_METHOD nsWindow::Scroll(PRInt32 aDx, PRInt32 aDy, nsRect *aClipRect) { PhTile_t *top = sib_tiles; int index=0; - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Scroll Damage sib_tiles Tiles List:\n")); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Scroll Damage sib_tiles Tiles List:")); while (top) { PhRect_t rect = top->rect; - PR_LOG(PhWidLog, PR_LOG_DEBUG, (" nsWindow::Scroll tile %d rect=<%d,%d,%d,%d> next=<%p>\n", index++,rect.ul.x,rect.ul.y,rect.lr.x,rect.lr.y, top->next)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, (" nsWindow::Scroll tile %d rect=<%d,%d,%d,%d> next=<%p>", index++,rect.ul.x,rect.ul.y,rect.lr.x,rect.lr.y, top->next)); top=top->next; } while (top); } @@ -1036,10 +1041,10 @@ NS_METHOD nsWindow::Scroll(PRInt32 aDx, PRInt32 aDy, nsRect *aClipRect) // Blit individual tiles tile = intersection; - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Scroll Bliting tiles...\n" )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Scroll Bliting tiles..." )); while( tile ) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Scroll blit tile (%i,%i,%i,%i) offset=<%d,%d>\n", + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Scroll blit tile (%i,%i,%i,%i) offset=<%d,%d>", tile->rect.ul.x, tile->rect.ul.y, tile->rect.lr.x, tile->rect.lr.y, offset.x, offset.y)); PhBlit( rid, &tile->rect, &offset ); tile = tile->next; @@ -1060,11 +1065,11 @@ NS_METHOD nsWindow::Scroll(PRInt32 aDx, PRInt32 aDy, nsRect *aClipRect) clipped_tiles = PhClipTilings( clipped_tiles, offset_tiles, nsnull ); tile = clipped_tiles; - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Scroll Damaging tiles...\n" )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Scroll Damaging tiles..." )); while( tile ) { PtDamageExtent( widget, &(tile->rect)); - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Scroll tile (%i,%i,%i,%i)\n", tile->rect.ul.x, tile->rect.ul.y, tile->rect.lr.x, tile->rect.lr.y )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Scroll tile (%i,%i,%i,%i)", tile->rect.ul.x, tile->rect.ul.y, tile->rect.lr.x, tile->rect.lr.y )); tile = tile->next; } @@ -1075,7 +1080,7 @@ NS_METHOD nsWindow::Scroll(PRInt32 aDx, PRInt32 aDy, nsRect *aClipRect) } else { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Scroll clipped out!\n" )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Scroll clipped out!" )); } @@ -1084,7 +1089,7 @@ NS_METHOD nsWindow::Scroll(PRInt32 aDx, PRInt32 aDy, nsRect *aClipRect) NS_METHOD nsWindow::ScrollWidgets(PRInt32 aDx, PRInt32 aDy) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::ScrollWidgets - Not Implemented this=<%p> mWidget=<%p> mClientWidget=<%p> aDx=<%d aDy=<%d>\n", + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::ScrollWidgets - Not Implemented this=<%p> mWidget=<%p> mClientWidget=<%p> aDx=<%d aDy=<%d>", this, mWidget, mClientWidget, aDx, aDy)); PtWidget_t *widget = (PtWidget_t *)GetNativeData(NS_NATIVE_WIDGET); @@ -1095,7 +1100,7 @@ NS_METHOD nsWindow::ScrollWidgets(PRInt32 aDx, PRInt32 aDy) PhPoint_t *pos; PhPoint_t p; - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::ScrollWidgets Moving children...\n" )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::ScrollWidgets Moving children..." )); for( w=PtWidgetChildFront( widget ); w; w=PtWidgetBrotherBehind( w )) { PtSetArg( &arg, Pt_ARG_POS, &pos, 0 ); @@ -1104,7 +1109,7 @@ NS_METHOD nsWindow::ScrollWidgets(PRInt32 aDx, PRInt32 aDy) p.x += aDx; p.y += aDy; - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::ScrollWidgets Moving children PtWidhet=<%p> to (%d,%d)\n", w, p.x, p.y)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::ScrollWidgets Moving children PtWidhet=<%p> to (%d,%d)", w, p.x, p.y)); PtSetArg( &arg, Pt_ARG_POS, &p, 0 ); PtSetResources( w, 1, &arg ) ; @@ -1122,7 +1127,7 @@ NS_METHOD nsWindow::ScrollWidgets(PRInt32 aDx, PRInt32 aDy) NS_IMETHODIMP nsWindow::ScrollRect(nsRect &aSrcRect, PRInt32 aDx, PRInt32 aDy) { - NS_WARNING("nsWindow::ScrollRect Not Implemented\n"); + NS_WARNING("nsWindow::ScrollRect Not Implemented"); return NS_OK; } @@ -1131,7 +1136,7 @@ NS_METHOD nsWindow::SetTitle(const nsString& aTitle) nsresult res = NS_ERROR_FAILURE; char * title = aTitle.ToNewUTF8String(); - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::SetTitle this=<%p> mWidget=<%p> title=<%s>\n", this, mWidget, title)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::SetTitle this=<%p> mWidget=<%p> title=<%s>", this, mWidget, title)); if( mWidget ) { @@ -1144,14 +1149,14 @@ NS_METHOD nsWindow::SetTitle(const nsString& aTitle) } } else - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::SetTitle - mWidget is NULL!\n")); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::SetTitle - mWidget is NULL!")); if (title) nsCRT::free(title); if (res != NS_OK) { - NS_ASSERTION(0,"nsWindow::SetTitle Error Setting page Title\n"); + NS_ASSERTION(0,"nsWindow::SetTitle Error Setting page Title"); } return res; @@ -1164,20 +1169,20 @@ NS_METHOD nsWindow::SetTitle(const nsString& aTitle) **/ PRBool nsWindow::OnPaint(nsPaintEvent &event) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::OnPaint - Not Implemented.\n")); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::OnPaint - Not Implemented.")); return NS_OK; } NS_METHOD nsWindow::BeginResizingChildren(void) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::BeginResizingChildren.\n")); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::BeginResizingChildren.")); return NS_OK; } NS_METHOD nsWindow::EndResizingChildren(void) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::EndResizingChildren.\n")); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::EndResizingChildren.")); return NS_OK; } @@ -1187,13 +1192,13 @@ PRBool nsWindow::OnKey(nsKeyEvent &aEvent) { if (mEventCallback) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, (" nsWindow::OnKey - mEventCallback=<%p>\n", mEventCallback)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, (" nsWindow::OnKey - mEventCallback=<%p>", mEventCallback)); return DispatchWindowEvent(&aEvent); } else { - PR_LOG(PhWidLog, PR_LOG_DEBUG, (" nsWindow::OnKey - mEventCallback=<%p> Discarding Event!\n", mEventCallback)); - //printf("nsWindow::OnKey Discarding Event, no mEventCallback\n"); + PR_LOG(PhWidLog, PR_LOG_DEBUG, (" nsWindow::OnKey - mEventCallback=<%p> Discarding Event!", mEventCallback)); + //PRINTF(("nsWindow::OnKey Discarding Event, no mEventCallback")); } return PR_FALSE; } @@ -1201,7 +1206,7 @@ PRBool nsWindow::OnKey(nsKeyEvent &aEvent) PRBool nsWindow::DispatchFocus(nsGUIEvent &aEvent) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::DispatchFocus - Not Implemented.\n")); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::DispatchFocus - Not Implemented.")); if( mEventCallback ) { @@ -1215,7 +1220,7 @@ PRBool nsWindow::DispatchFocus(nsGUIEvent &aEvent) PRBool nsWindow::OnScroll(nsScrollbarEvent &aEvent, PRUint32 cPos) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::OnScroll - Not Implemented.\n")); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::OnScroll - Not Implemented.")); return PR_FALSE; } @@ -1224,7 +1229,7 @@ NS_IMETHODIMP nsWindow::Resize(PRInt32 aWidth, PRInt32 aHeight, PRBool aRepaint) { PRBool nNeedToShow = PR_FALSE; - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Resize this=<%p> w/h=(%i,%i) Repaint=<%i> mWindowType=<%d>\n", this, aWidth, aHeight, aRepaint, mWindowType )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Resize this=<%p> w/h=(%i,%i) Repaint=<%i> mWindowType=<%d>", this, aWidth, aHeight, aRepaint, mWindowType )); mBounds.width = aWidth; mBounds.height = aHeight; @@ -1242,7 +1247,7 @@ NS_IMETHODIMP nsWindow::Resize(PRInt32 aWidth, PRInt32 aHeight, PRBool aRepaint) mIsTooSmall = PR_TRUE; if (mShown) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Resize Forcing small toplevel window window to Hide\n")); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Resize Forcing small toplevel window window to Hide")); //Show(PR_FALSE); } } @@ -1251,7 +1256,7 @@ NS_IMETHODIMP nsWindow::Resize(PRInt32 aWidth, PRInt32 aHeight, PRBool aRepaint) aWidth = 1; aHeight = 1; mIsTooSmall = PR_TRUE; - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Resize Forcing small non-toplevel window to Hide\n")); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Resize Forcing small non-toplevel window to Hide")); //Show(PR_FALSE); } } @@ -1293,7 +1298,7 @@ NS_IMETHODIMP nsWindow::Resize(PRInt32 aWidth, PRInt32 aHeight, PRBool aRepaint) if (theClientChild) { nsWindow * pWin = (nsWindow*) GetInstance( theClientChild ); - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Resize Resizing mClientWidget->Child this=<%p> mClientWidget=<%p> ChildBack=<%p>\n", this, mClientWidget, pWin)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Resize Resizing mClientWidget->Child this=<%p> mClientWidget=<%p> ChildBack=<%p>", this, mClientWidget, pWin)); pWin->Resize(aWidth, aHeight, aRepaint); } } @@ -1307,7 +1312,7 @@ NS_IMETHODIMP nsWindow::Resize(PRInt32 aWidth, PRInt32 aHeight, PRBool aRepaint) } else { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Resize - mWidget is NULL!\n" )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Resize - mWidget is NULL!" )); } @@ -1335,7 +1340,7 @@ NS_IMETHODIMP nsWindow::Resize(PRInt32 aWidth, PRInt32 aHeight, PRBool aRepaint) if (nNeedToShow) { - //printf("nsWindow::Resize Forcing window to Show\n"); + //PRINTF(("nsWindow::Resize Forcing window to Show")); Show(PR_TRUE); } @@ -1359,7 +1364,7 @@ NS_IMETHODIMP nsWindow::Resize(PRInt32 aX, PRInt32 aY, PRInt32 aWidth, int nsWindow::WindowCloseHandler( PtWidget_t *widget, void *data, PtCallbackInfo_t *cbinfo ) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::WindowCloseHandler this=(%p)\n", data)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::WindowCloseHandler this=(%p)", data)); PhWindowEvent_t *we = (PhWindowEvent_t *) cbinfo->cbdata; nsWindow * win = (nsWindow*) data; @@ -1390,17 +1395,18 @@ int nsWindow::WindowCloseHandler( PtWidget_t *widget, void *data, PtCallbackInfo NS_METHOD nsWindow::Show(PRBool bState) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Show this=<%p> State=<%d> mRefCnt=<%d> mWidget=<%p>\n", this, bState, mRefCnt, mWidget)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Show this=<%p> State=<%d> mRefCnt=<%d> mWidget=<%p>", this, bState, mRefCnt, mWidget)); if (!mWidget) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Show - mWidget is NULL!\n" )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Show - mWidget is NULL!" )); return NS_OK; // Will be null durring printing } - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Show this=<%p> IsRealized=<%d> mIsTooSmall=<%d>\n", this, PtWidgetIsRealized( mWidget ), mIsTooSmall)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Show this=<%p> IsRealized=<%d> mIsTooSmall=<%d>", this, PtWidgetIsRealized( mWidget ), mIsTooSmall)); + //PRINTF( ("nsWindow::Show this=<%p> State=<%d> IsRealized=<%d> mIsTooSmall=<%d> gRollupScreenRegion=<%p>", this, bState, PtWidgetIsRealized( mWidget ), mIsTooSmall, gRollupScreenRegion)); #if 0 // don't show if we are too small @@ -1412,6 +1418,7 @@ NS_METHOD nsWindow::Show(PRBool bState) if (bState) { + //PRINTF(("nsWindow::Show Show WindowIsPopup=<%d> gRollupScreenRegion=<%p> mMenuRegion=<%p>", (mWindowType == eWindowType_popup), gRollupScreenRegion, mMenuRegion)); if (mWindowType == eWindowType_popup) { @@ -1432,6 +1439,7 @@ NS_METHOD nsWindow::Show(PRBool bState) } else { + //PRINTF(("nsWindow::Show Un-Show WindowIsPopup=<%d> gRollupScreenRegion=<%p> mMenuRegion=<%p>", (mWindowType == eWindowType_popup), gRollupScreenRegion, mMenuRegion)); if ( (mWindowType == eWindowType_popup)) @@ -1475,7 +1483,7 @@ void nsWindow::RawDrawFunc( PtWidget_t * pWidget, PhTile_t * damage ) PRBool aClipState; nsPaintEvent pev; - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::RawDrawFunc for mWidget=<%p> this=<%p> this->mContext=<%p> pWin->mParent=<%p> mClientWidget=<%p>\n", + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::RawDrawFunc for mWidget=<%p> this=<%p> this->mContext=<%p> pWin->mParent=<%p> mClientWidget=<%p>", pWidget, pWin, pWin->mContext, pWin->mParent, pWin->mClientWidget)); #if defined(DEBUG) && 1 @@ -1483,11 +1491,11 @@ void nsWindow::RawDrawFunc( PtWidget_t * pWidget, PhTile_t * damage ) /* Print out the Photon Damage tiles */ PhTile_t *top = damage; int index=0; - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::RawDrawFunc Damage Tiles List:\n")); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::RawDrawFunc Damage Tiles List:")); do { PhRect_t rect = top->rect; - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::RawDrawFunc photon damage %d rect=<%d,%d,%d,%d> next=<%p>\n", index++,rect.ul.x,rect.ul.y,rect.lr.x,rect.lr.y, top->next)); - //printf("nsWindow::%p RawDrawFunc photon damage %d rect=<%d,%d,%d,%d> next=<%p>\n", pWidget,index++,rect.ul.x,rect.ul.y,rect.lr.x,rect.lr.y, top->next); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::RawDrawFunc photon damage %d rect=<%d,%d,%d,%d> next=<%p>", index++,rect.ul.x,rect.ul.y,rect.lr.x,rect.lr.y, top->next)); + //PRINTF(("nsWindow::%p RawDrawFunc photon damage %d rect=<%d,%d,%d,%d> next=<%p>", pWidget,index++,rect.ul.x,rect.ul.y,rect.lr.x,rect.lr.y, top->next)); top=top->next; } while (top); } @@ -1495,7 +1503,7 @@ void nsWindow::RawDrawFunc( PtWidget_t * pWidget, PhTile_t * damage ) if ( !PtWidgetIsRealized( pWidget )) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::RawDrawFunc aborted because pWidget was not realized!\n")); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::RawDrawFunc aborted because pWidget was not realized!")); NS_ASSERTION(pWin, "nsWindow::RawDrawFunc aborted because pWidget was not realized!"); abort(); return; @@ -1503,7 +1511,7 @@ void nsWindow::RawDrawFunc( PtWidget_t * pWidget, PhTile_t * damage ) if ( !pWin ) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::RawDrawFunc aborted because instance is NULL!\n")); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::RawDrawFunc aborted because instance is NULL!")); NS_ASSERTION(pWin, "nsWindow::RawDrawFunc aborted because instance is NULL!"); return; } @@ -1511,7 +1519,7 @@ void nsWindow::RawDrawFunc( PtWidget_t * pWidget, PhTile_t * damage ) /* Why did I think this was important? */ if ( !pWin->mContext ) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::RawDrawFunc pWin->mContext is NULL!\n")); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::RawDrawFunc pWin->mContext is NULL!")); NS_ASSERTION(pWin->mContext, "nsWindow::RawDrawFunc pWin->mContext is NULL!"); return; } @@ -1520,8 +1528,8 @@ void nsWindow::RawDrawFunc( PtWidget_t * pWidget, PhTile_t * damage ) // windows in the resize queue if ( pWin->mIsResizing ) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::RawDrawFunc aborted due to hold-off!\n")); - //printf("nsWindow::RawDrawFunc aborted due to Resize holdoff\n"); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::RawDrawFunc aborted due to hold-off!")); + //PRINTF(("nsWindow::RawDrawFunc aborted due to Resize holdoff")); return; } @@ -1537,15 +1545,15 @@ void nsWindow::RawDrawFunc( PtWidget_t * pWidget, PhTile_t * damage ) PtWidgetArea( pWidget, &area ); PtWidgetOffset( pWidget, &offset ); - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::RawDrawFunc area=<%d,%d,%d,%d>\n", area.pos.x, area.pos.y, area.size.w, area.size.h)); - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::RawDrawFunc offset=<%d,%d>\n", offset.x, offset.y)); - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::RawDrawFunc mBounds=<%d,%d,%d,%d>\n", pWin->mBounds.x, pWin->mBounds.y, pWin->mBounds.width, pWin->mBounds.height)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::RawDrawFunc area=<%d,%d,%d,%d>", area.pos.x, area.pos.y, area.size.w, area.size.h)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::RawDrawFunc offset=<%d,%d>", offset.x, offset.y)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::RawDrawFunc mBounds=<%d,%d,%d,%d>", pWin->mBounds.x, pWin->mBounds.y, pWin->mBounds.width, pWin->mBounds.height)); /* Add the X,Y of area to offset to fix the throbber drawing in Viewer */ //offset.x += area.pos.x; //offset.y += area.pos.y; - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::RawDrawFunc offset+area =<%d,%d>\n", offset.x, offset.y)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::RawDrawFunc offset+area =<%d,%d>", offset.x, offset.y)); /* Build a List of Tiles that might be in front of me.... */ PhTile_t *clip_tiles=pWin->GetWindowClipping(offset); @@ -1583,7 +1591,7 @@ void nsWindow::RawDrawFunc( PtWidget_t * pWidget, PhTile_t * damage ) if (new_damage == nsnull) { /* Nothing to Draw */ - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::RawDrawFunc Nothing to Draw damage is NULL\n")); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::RawDrawFunc Nothing to Draw damage is NULL")); return; } @@ -1592,11 +1600,11 @@ void nsWindow::RawDrawFunc( PtWidget_t * pWidget, PhTile_t * damage ) /* Print out the Photon Damage tiles */ PhTile_t *top = new_damage; int index=0; - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::RawDrawFunc New Damage Tiles List <%p>:\n", new_damage)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::RawDrawFunc New Damage Tiles List <%p>:", new_damage)); while (top) { PhRect_t rect = top->rect; - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::RawDrawFunc photon damage %d rect=<%d,%d,%d,%d> next=<%p>\n", index++,rect.ul.x,rect.ul.y,rect.lr.x,rect.lr.y, top->next)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::RawDrawFunc photon damage %d rect=<%d,%d,%d,%d> next=<%p>", index++,rect.ul.x,rect.ul.y,rect.lr.x,rect.lr.y, top->next)); top=top->next; } } @@ -1609,7 +1617,7 @@ void nsWindow::RawDrawFunc( PtWidget_t * pWidget, PhTile_t * damage ) pev.renderingContext = pWin->GetRenderingContext(); if (pev.renderingContext == NULL) { - //printf("nsWindow::RawDrawFunc error getting RenderingContext\n"); + //PRINTF(("nsWindow::RawDrawFunc error getting RenderingContext")); abort(); } @@ -1629,8 +1637,8 @@ void nsWindow::RawDrawFunc( PtWidget_t * pWidget, PhTile_t * damage ) rect.lr.x = dmg->rect.lr.x; rect.lr.y = dmg->rect.lr.y; - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::RawDrawFunc damage rect = <%d,%d,%d,%d>\n", rect.ul.x,rect.ul.y,rect.lr.x,rect.lr.y)); - //printf("nsWindow::RawDrawFunc damage rect = <%d,%d,%d,%d>\n", rect.ul.x,rect.ul.y,rect.lr.x,rect.lr.y); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::RawDrawFunc damage rect = <%d,%d,%d,%d>", rect.ul.x,rect.ul.y,rect.lr.x,rect.lr.y)); + //PRINTF(("nsWindow::RawDrawFunc damage rect = <%d,%d,%d,%d>", rect.ul.x,rect.ul.y,rect.lr.x,rect.lr.y)); /* Do I need to Translate it?? If so by what? offset? offset+area?*/ rect.ul.x -= area.pos.x; @@ -1638,23 +1646,23 @@ void nsWindow::RawDrawFunc( PtWidget_t * pWidget, PhTile_t * damage ) rect.lr.x -= area.pos.x; rect.lr.y -= area.pos.y; - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::RawDrawFunc damage rect after translate = <%d,%d,%d,%d>\n", rect.ul.x,rect.ul.y,rect.lr.x,rect.lr.y)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::RawDrawFunc damage rect after translate = <%d,%d,%d,%d>", rect.ul.x,rect.ul.y,rect.lr.x,rect.lr.y)); /* If the damage tile is not within our bounds, do nothing */ if(( rect.ul.x >= area.size.w ) || ( rect.ul.y >= area.size.h ) || ( rect.lr.x < 0 ) || ( rect.lr.y < 0 )) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::RawDrawFunc damage tile is not within our bounds, do nothing\n")); - //printf("nsWindow::RawDrawFunc damage tile is not within our bounds, do nothing\n"); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::RawDrawFunc damage tile is not within our bounds, do nothing")); + //PRINTF(("nsWindow::RawDrawFunc damage tile is not within our bounds, do nothing")); } - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::RawDrawFunc clipped damage <%d,%d,%d,%d>\n", rect.ul.x,rect.ul.y,rect.lr.x,rect.lr.y)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::RawDrawFunc clipped damage <%d,%d,%d,%d>", rect.ul.x,rect.ul.y,rect.lr.x,rect.lr.y)); nsDmg.x = rect.ul.x; nsDmg.y = rect.ul.y; nsDmg.width = rect.lr.x - rect.ul.x + 1; nsDmg.height = rect.lr.y - rect.ul.y + 1; - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::RawDrawFunc nsDmg <%d,%d,%d,%d>\n", nsDmg.x, nsDmg.y, nsDmg.width, nsDmg.height)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::RawDrawFunc nsDmg <%d,%d,%d,%d>", nsDmg.x, nsDmg.y, nsDmg.width, nsDmg.height)); if ( (nsDmg.width <= 0 ) || (nsDmg.height <= 0 ) ) { @@ -1696,7 +1704,7 @@ void nsWindow::RawDrawFunc( PtWidget_t * pWidget, PhTile_t * damage ) PhFreeTiles(dmg); - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::RawDrawFunc End of RawDrawFunc\n")); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::RawDrawFunc End of RawDrawFunc")); } void nsWindow::ScreenToWidget( PhPoint_t &pt ) @@ -1705,7 +1713,7 @@ void nsWindow::ScreenToWidget( PhPoint_t &pt ) // convert it to be relative to ~this~ widgets origin short x=0,y=0; - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::ScreenToWidget 1 pt=(%d,%d)\n", pt.x, pt.y)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::ScreenToWidget 1 pt=(%d,%d)", pt.x, pt.y)); if( mWindowType == eWindowType_child ) { @@ -1719,14 +1727,14 @@ void nsWindow::ScreenToWidget( PhPoint_t &pt ) pt.x -= x; pt.y -= y; - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::ScreenToWidget 2 pt=(%d,%d)\n", pt.x, pt.y)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::ScreenToWidget 2 pt=(%d,%d)", pt.x, pt.y)); } NS_METHOD nsWindow::GetFrameSize(int *FrameLeft, int *FrameRight, int *FrameTop, int *FrameBottom) const { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::GetFrameSize \n")); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::GetFrameSize ")); if (FrameLeft) *FrameLeft = mFrameLeft; @@ -1748,7 +1756,7 @@ NS_METHOD nsWindow::GetSiblingClippedRegion( PhTile_t **btiles, PhTile_t **ctile { nsresult res = NS_ERROR_FAILURE; - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::GetSiblingClippedRegion this=<%p> btiles=<%p> ctiles=<%p> mWidget=<%p>\n", this, btiles, ctiles, mWidget)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::GetSiblingClippedRegion this=<%p> btiles=<%p> ctiles=<%p> mWidget=<%p>", this, btiles, ctiles, mWidget)); if(( btiles ) && ( ctiles )) { @@ -1760,18 +1768,18 @@ NS_METHOD nsWindow::GetSiblingClippedRegion( PhTile_t **btiles, PhTile_t **ctile PhArea_t *area; PtArg_t arg; - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::GetSiblingClippedRegion 1\n")); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::GetSiblingClippedRegion 1")); PtSetArg( &arg, Pt_ARG_AREA, &area, 0 ); if( PtGetResources( mWidget, 1, &arg ) == 0 ) { nsRect rect( area->pos.x, area->pos.x, area->size.w, area->size.h ); - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::GetSiblingClippedRegion mWidget=<%p> area=<%d,%d,%d,%d>\n", mWidget,area->pos.x, area->pos.x, area->size.w, area->size.h)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::GetSiblingClippedRegion mWidget=<%p> area=<%d,%d,%d,%d>", mWidget,area->pos.x, area->pos.x, area->size.w, area->size.h)); GetParentClippedArea( rect ); - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::GetSiblingClippedRegion after GetParentClippedArea rect=(%d,%d,%d,%d)\n", rect.x, rect.y, rect.width, rect.height)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::GetSiblingClippedRegion after GetParentClippedArea rect=(%d,%d,%d,%d)", rect.x, rect.y, rect.width, rect.height)); (*btiles)->rect.ul.x = rect.x; (*btiles)->rect.ul.y = rect.y; @@ -1789,13 +1797,13 @@ NS_METHOD nsWindow::GetSiblingClippedRegion( PhTile_t **btiles, PhTile_t **ctile PtSetArg( &arg, Pt_ARG_AREA, &area, 0 ); PtGetResources( w, 1, &arg ); - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::GetSiblingClippedRegion BrotherInFront w=<%p> area=<%d,%d,%d,%d> IsOpaque=<%d> !=Disjoint=<%d> IsRealized=<%d>\n", + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::GetSiblingClippedRegion BrotherInFront w=<%p> area=<%d,%d,%d,%d> IsOpaque=<%d> !=Disjoint=<%d> IsRealized=<%d>", w, area->pos.x, area->pos.x, area->size.w, area->size.h, (flags & Pt_OPAQUE), (w != PtFindDisjoint(w)), PtWidgetIsRealized( w ) )); /* Is the widget OPAQUE and Window is not a disjoint window */ if ((flags & Pt_OPAQUE) && (w != PtFindDisjoint(w))) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::GetWindowClipping widget w=<%p> is opaque IsRealized=<%d>\n", w, PtWidgetIsRealized(w))); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::GetWindowClipping widget w=<%p> is opaque IsRealized=<%d>", w, PtWidgetIsRealized(w))); if ( PtWidgetIsRealized( w )) { @@ -1819,7 +1827,7 @@ NS_METHOD nsWindow::GetSiblingClippedRegion( PhTile_t **btiles, PhTile_t **ctile if( *ctiles ) { // We have siblings... now clip'em - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::GetSiblingClippedRegion 5\n")); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::GetSiblingClippedRegion 5")); *btiles = PhClipTilings( *btiles, *ctiles, nsnull ); } @@ -1839,7 +1847,7 @@ NS_METHOD nsWindow::GetSiblingClippedRegion( PhTile_t **btiles, PhTile_t **ctile } } - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::GetSiblingClippedRegion the end res=<%d>\n", res)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::GetSiblingClippedRegion the end res=<%d>", res)); return res; } @@ -1858,17 +1866,17 @@ NS_METHOD nsWindow::SetWindowClipping( PhTile_t *damage, PhPoint_t &offset ) clip_tiles = last = nsnull; - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::SetWindowClipping this=<%p> damage=<%p> offset=(%d,%d) mClipChildren=<%d> mClipSiblings=<%d>\n", this, damage, offset.x, offset.y, mClipChildren, mClipSiblings)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::SetWindowClipping this=<%p> damage=<%p> offset=(%d,%d) mClipChildren=<%d> mClipSiblings=<%d>", this, damage, offset.x, offset.y, mClipChildren, mClipSiblings)); #if 0 { /* Print out the Photon Damage tiles */ PhTile_t *top = damage; int index=0; - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::SetWindowClipping 1 Damage Tiles List:\n")); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::SetWindowClipping 1 Damage Tiles List:")); do { PhRect_t rect = top->rect; - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::SetWindowClipping photon damage %d rect=<%d,%d,%d,%d> next=<%p>\n", index++,rect.ul.x,rect.ul.y,rect.lr.x,rect.lr.y, top->next)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::SetWindowClipping photon damage %d rect=<%d,%d,%d,%d> next=<%p>", index++,rect.ul.x,rect.ul.y,rect.lr.x,rect.lr.y, top->next)); top=top->next; } while (top); } @@ -1886,7 +1894,7 @@ NS_METHOD nsWindow::SetWindowClipping( PhTile_t *damage, PhPoint_t &offset ) tile->rect.lr.x = area->pos.x + area->size.w-1; tile->rect.lr.y = area->pos.y + area->size.h-1; - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::SetWindowClipping Adding Initial widget=<%d,%d,%d,%d>\n", tile->rect.ul.x, tile->rect.ul.y, tile->rect.lr.x, tile->rect.lr.y )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::SetWindowClipping Adding Initial widget=<%d,%d,%d,%d>", tile->rect.ul.x, tile->rect.ul.y, tile->rect.lr.x, tile->rect.lr.y )); tile->next = NULL; @@ -1899,11 +1907,11 @@ NS_METHOD nsWindow::SetWindowClipping( PhTile_t *damage, PhPoint_t &offset ) /* Print out the Photon Damage tiles */ PhTile_t *top = damage; int index=0; - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::SetWindowClipping 2 Damage Tiles List: top=<%p>\n", top)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::SetWindowClipping 2 Damage Tiles List: top=<%p>", top)); while(top) { PhRect_t rect = top->rect; - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::SetWindowClipping photon damage %d rect=<%d,%d,%d,%d> next=<%p>\n", index++,rect.ul.x,rect.ul.y,rect.lr.x,rect.lr.y, top->next)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::SetWindowClipping photon damage %d rect=<%d,%d,%d,%d> next=<%p>", index++,rect.ul.x,rect.ul.y,rect.lr.x,rect.lr.y, top->next)); top=top->next; }; } @@ -1915,7 +1923,7 @@ NS_METHOD nsWindow::SetWindowClipping( PhTile_t *damage, PhPoint_t &offset ) if ( mClipChildren ) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, (" clipping children...\n")); + PR_LOG(PhWidLog, PR_LOG_DEBUG, (" clipping children...")); for( w=PtWidgetChildFront( aWidget ); w; w=PtWidgetBrotherBehind( w )) { @@ -1924,11 +1932,11 @@ NS_METHOD nsWindow::SetWindowClipping( PhTile_t *damage, PhPoint_t &offset ) long flags = PtWidgetFlags(w); - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::SetWindowClipping clipping children w=<%p> area=<%d,%d,%d,%d> flags=<%ld>\n", w, area->pos.x, area->pos.y, area->size.w, area->size.h, flags)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::SetWindowClipping clipping children w=<%p> area=<%d,%d,%d,%d> flags=<%ld>", w, area->pos.x, area->pos.y, area->size.w, area->size.h, flags)); if (flags & Pt_OPAQUE) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::SetWindowClipping widget w=<%p> is opaque IsRealized=<%d>\n", w, PtWidgetIsRealized(w) )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::SetWindowClipping widget w=<%p> is opaque IsRealized=<%d>", w, PtWidgetIsRealized(w) )); if ( PtWidgetIsRealized( w )) { @@ -1950,13 +1958,13 @@ NS_METHOD nsWindow::SetWindowClipping( PhTile_t *damage, PhPoint_t &offset ) } else { - printf("Error failed to GetTile\n"); + PRINTF(("Error failed to GetTile")); abort(); } } else { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::SetWindowClipping Widget isn't realized %p\n", w)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::SetWindowClipping Widget isn't realized %p", w)); } } } @@ -1967,7 +1975,7 @@ NS_METHOD nsWindow::SetWindowClipping( PhTile_t *damage, PhPoint_t &offset ) PtWidget_t *node = aWidget; PhPoint_t origin = { 0, 0 }; - PR_LOG(PhWidLog, PR_LOG_DEBUG, (" clipping siblings...\n")); + PR_LOG(PhWidLog, PR_LOG_DEBUG, (" clipping siblings...")); while( node ) { @@ -1975,7 +1983,7 @@ NS_METHOD nsWindow::SetWindowClipping( PhTile_t *damage, PhPoint_t &offset ) PtGetResources( node, 1, &arg ); origin.x += area->pos.x; origin.y += area->pos.y; - //printf ("parent: %p: %d %d %d %d\n",node,area->pos.x,area->pos.y,area->size.w,area->size.h); + //PRINTF( ("parent: %p: %d %d %d %d",node,area->pos.x,area->pos.y,area->size.w,area->size.h)); for( w=PtWidgetBrotherInFront( node ); w; w=PtWidgetBrotherInFront( w )) { @@ -1983,7 +1991,7 @@ NS_METHOD nsWindow::SetWindowClipping( PhTile_t *damage, PhPoint_t &offset ) { PtSetArg( &arg, Pt_ARG_AREA, &area, 0 ); PtGetResources( w, 1, &arg ); - //printf ("sib: %p: %d %d %d %d\n",w,area->pos.x,area->pos.y,area->size.w,area->size.h); + //PRINTF( ("sib: %p: %d %d %d %d",w,area->pos.x,area->pos.y,area->size.w,area->size.h)); tile = PhGetTile(); if (area->size.w != 43 && area->size.h != 43) // oh god another HACK if( tile ) @@ -2009,18 +2017,18 @@ NS_METHOD nsWindow::SetWindowClipping( PhTile_t *damage, PhPoint_t &offset ) PhRect_t *rects; PhTile_t *dmg; - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::SetWindowClipping damage=<%p> damage->next=<%p> clip_tiles=<%p>\n", damage, damage->next, clip_tiles)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::SetWindowClipping damage=<%p> damage->next=<%p> clip_tiles=<%p>", damage, damage->next, clip_tiles)); #if 1 { /* Print out the Photon Damage tiles */ PhTile_t *top = damage; int index=0; - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::SetWindowClipping 3 Damage Tiles List:\n")); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::SetWindowClipping 3 Damage Tiles List:")); while(top) { PhRect_t rect = top->rect; - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::SetWindowClipping photon damage %d rect=<%d,%d,%d,%d> next=<%p>\n", index++,rect.ul.x,rect.ul.y,rect.lr.x,rect.lr.y, top->next)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::SetWindowClipping photon damage %d rect=<%d,%d,%d,%d> next=<%p>", index++,rect.ul.x,rect.ul.y,rect.lr.x,rect.lr.y, top->next)); top=top->next; } } @@ -2032,23 +2040,23 @@ NS_METHOD nsWindow::SetWindowClipping( PhTile_t *damage, PhPoint_t &offset ) else dmg = PhCopyTiles( damage ); - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::SetWindowClipping after PhCopyTiles\n")); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::SetWindowClipping after PhCopyTiles")); PhDeTranslateTiles( dmg, &offset ); - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::SetWindowClipping after PhDeTranslateTiles\n")); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::SetWindowClipping after PhDeTranslateTiles")); if( clip_tiles ) { // We have chiluns... now clip'em dmg = PhClipTilings( dmg, clip_tiles, nsnull ); - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::SetWindowClipping after PhClipTilings\n")); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::SetWindowClipping after PhClipTilings")); PhFreeTiles( clip_tiles ); } - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::SetWindowClipping after children clipping dmg=<%p>\n", dmg )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::SetWindowClipping after children clipping dmg=<%p>", dmg )); if( dmg ) { @@ -2060,7 +2068,7 @@ NS_METHOD nsWindow::SetWindowClipping( PhTile_t *damage, PhPoint_t &offset ) PhRect_t *tip = rects; for(index=0; index < rect_count; index++) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::SetWindowClipping %d rect = <%d,%d,%d,%d>\n",index, + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::SetWindowClipping %d rect = <%d,%d,%d,%d>",index, tip->ul.x, tip->ul.y, tip->lr.x, tip->lr.y)); tip++; } @@ -2069,16 +2077,16 @@ NS_METHOD nsWindow::SetWindowClipping( PhTile_t *damage, PhPoint_t &offset ) PgSetClipping( rect_count, rects ); #else - //PR_LOG(PhWidLog, PR_LOG_DEBUG, (" damage clipped to:\n")); - //printf(" damage clipped to:\n"); + //PR_LOG(PhWidLog, PR_LOG_DEBUG, (" damage clipped to:")); + //PRINTF((" damage clipped to:")); int bX=0, bY=0; int aX=32767, aY=32767; for(int i=0;i offset=<%d,%d> mClipChildren=<%d> mClipSiblings=<%d>\n", this, offset.x, offset.y, mClipChildren, mClipSiblings)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::GetWindowClipping this=<%p> offset=<%d,%d> mClipChildren=<%d> mClipSiblings=<%d>", this, offset.x, offset.y, mClipChildren, mClipSiblings)); - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::GetWindowClipping clipping children...\n")); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::GetWindowClipping clipping children...")); PtWidgetOffset(w=PtWidgetChildFront( aWidget ), &w_offset); w_offset.x -= offset.x; @@ -2134,34 +2142,34 @@ PhTile_t *nsWindow::GetWindowClipping(PhPoint_t &offset) PtSetArg( &arg, Pt_ARG_AREA, &area, 0 ); PtGetResources( w, 1, &arg ); - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::GetWindowClipping clipping children w=<%p> area=<%d,%d,%d,%d> flags=<%ld>\n", w, area->pos.x, area->pos.y, area->size.w, area->size.h, flags)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::GetWindowClipping clipping children w=<%p> area=<%d,%d,%d,%d> flags=<%ld>", w, area->pos.x, area->pos.y, area->size.w, area->size.h, flags)); PtWidgetArea(w, &w_area); PtWidgetDim(w, &w_dim); PtGetAbsPosition(w, &abs_pos_x, &abs_pos_y); - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::GetWindowClipping clipping children w=<%p> offset=<%d,%d> Abs Pos=<%d,%d> w_area=<%d,%d,%d,%d>\n", w, w_offset.x, w_offset.y, abs_pos_x, abs_pos_y, w_area.pos.x, w_area.pos.y, w_area.size.w, w_area.size.h)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::GetWindowClipping clipping children w=<%p> offset=<%d,%d> Abs Pos=<%d,%d> w_area=<%d,%d,%d,%d>", w, w_offset.x, w_offset.y, abs_pos_x, abs_pos_y, w_area.pos.x, w_area.pos.y, w_area.size.w, w_area.size.h)); #endif /* Is the widget OPAQUE and Window is not a disjoint window */ if ((flags & Pt_OPAQUE) && (w != PtFindDisjoint(w))) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::GetWindowClipping widget w=<%p> is opaque IsRealized=<%d>\n", w, PtWidgetIsRealized(w))); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::GetWindowClipping widget w=<%p> is opaque IsRealized=<%d>", w, PtWidgetIsRealized(w))); if ( PtWidgetIsRealized( w )) { #if 1 PtSetArg( &arg, Pt_ARG_AREA, &area, 0 ); PtGetResources( w, 1, &arg ); - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::GetWindowClipping clipping children w=<%p> area=<%d,%d,%d,%d> flags=<%ld>\n", w, area->pos.x, area->pos.y, area->size.w, area->size.h, flags)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::GetWindowClipping clipping children w=<%p> area=<%d,%d,%d,%d> flags=<%ld>", w, area->pos.x, area->pos.y, area->size.w, area->size.h, flags)); PtWidgetArea(w, &w_area); PtWidgetDim(w, &w_dim); PtGetAbsPosition(w, &abs_pos_x, &abs_pos_y); - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::GetWindowClipping clipping children w=<%p> offset=<%d,%d> Abs Pos=<%d,%d> w_area=<%d,%d,%d,%d>\n", w, w_offset.x, w_offset.y, abs_pos_x, abs_pos_y, w_area.pos.x, w_area.pos.y, w_area.size.w, w_area.size.h)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::GetWindowClipping clipping children w=<%p> offset=<%d,%d> Abs Pos=<%d,%d> w_area=<%d,%d,%d,%d>", w, w_offset.x, w_offset.y, abs_pos_x, abs_pos_y, w_area.pos.x, w_area.pos.y, w_area.size.w, w_area.size.h)); #endif tile = PhGetTile(); @@ -2181,13 +2189,13 @@ PhTile_t *nsWindow::GetWindowClipping(PhPoint_t &offset) } else { - printf("Error failed to GetTile\n"); + PRINTF(("Error failed to GetTile")); abort(); } } else { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::GetWindowClipping Widget isn't realized %p\n", w)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::GetWindowClipping Widget isn't realized %p", w)); } } } @@ -2198,11 +2206,11 @@ PhTile_t *nsWindow::GetWindowClipping(PhPoint_t &offset) /* Print out the Photon Damage tiles */ PhTile_t *top = clip_tiles; int index=0; - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::GetWindowClipping Child+Sibling Tiles List:\n")); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::GetWindowClipping Child+Sibling Tiles List:")); while(top) { PhRect_t rect = top->rect; - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::GetWindowClipping tiles to clip %d rect=<%d,%d,%d,%d> next=<%p>\n", index++,rect.ul.x,rect.ul.y,rect.lr.x,rect.lr.y, top->next)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::GetWindowClipping tiles to clip %d rect=<%d,%d,%d,%d> next=<%p>", index++,rect.ul.x,rect.ul.y,rect.lr.x,rect.lr.y, top->next)); top=top->next; } } @@ -2218,7 +2226,7 @@ int nsWindow::ResizeHandler( PtWidget_t *widget, void *data, PtCallbackInfo_t *c nsWindow *someWindow = (nsWindow *) GetInstance(widget); nsRect rect; - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::ResizeHandler for someWindow=<%p>\n", someWindow)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::ResizeHandler for someWindow=<%p>", someWindow)); if( someWindow && extents) // kedl { @@ -2246,11 +2254,11 @@ void nsWindow::ResizeHoldOff() return; } - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::ResizeHoldOff Entering this=<%p>\n", this )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::ResizeHoldOff Entering this=<%p>", this )); if( PR_FALSE == mResizeQueueInited ) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::ResizeHoldOff Initing Queue this=<%p>\n", this )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::ResizeHoldOff Initing Queue this=<%p>", this )); // This is to guarantee that the Invalidation work-proc is in place prior to the // Resize work-proc. @@ -2266,13 +2274,13 @@ void nsWindow::ResizeHoldOff() #if 1 int Global_Widget_Hold_Count; Global_Widget_Hold_Count = PtHold(); - PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsWindow::ResizeHoldOff PtHold Global_Widget_Hold_Count=<%d> this=<%p>\n", Global_Widget_Hold_Count, this)); + PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsWindow::ResizeHoldOff PtHold Global_Widget_Hold_Count=<%d> this=<%p>", Global_Widget_Hold_Count, this)); #endif mResizeQueueInited = PR_TRUE; } else { - printf( "*********** resize work proc failed to init. ***********\n" ); + PRINTF(( "*********** resize work proc failed to init. ***********" )); } } @@ -2287,7 +2295,7 @@ void nsWindow::ResizeHoldOff() { if( dqe->widget == mWidget ) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::ResizeHoldOff Widget already in Queue this=<%p>\n", this )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::ResizeHoldOff Widget already in Queue this=<%p>", this )); found = PR_TRUE; break; @@ -2300,7 +2308,7 @@ void nsWindow::ResizeHoldOff() dqe = new DamageQueueEntry; if( dqe ) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::ResizeHoldOff Adding widget to Queue this=<%p> dqe=<%p> dqe->inst=<%p>\n", this, dqe, this )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::ResizeHoldOff Adding widget to Queue this=<%p> dqe=<%p> dqe->inst=<%p>", this, dqe, this )); mIsResizing = PR_TRUE; dqe->widget = mWidget; @@ -2315,7 +2323,7 @@ void nsWindow::ResizeHoldOff() void nsWindow::RemoveResizeWidget() { - PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsWindow::RemoveResizeWidget (%p)\n", this)); + PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsWindow::RemoveResizeWidget (%p)", this)); if( mIsResizing ) { @@ -2336,7 +2344,7 @@ void nsWindow::RemoveResizeWidget() // NS_RELEASE( dqe->inst ); - PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsWindow::RemoveResizeWidget this=(%p) dqe=<%p>\n", this, dqe)); + PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsWindow::RemoveResizeWidget this=(%p) dqe=<%p>", this, dqe)); delete dqe; mIsResizing = PR_FALSE; @@ -2354,7 +2362,7 @@ void nsWindow::RemoveResizeWidget() #if 1 int Global_Widget_Hold_Count; Global_Widget_Hold_Count = PtRelease(); - PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsWindow::RemoveResizeWidget PtHold/PtRelease Global_Widget_Hold_Count=<%d> this=<%p>\n", Global_Widget_Hold_Count, this)); + PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsWindow::RemoveResizeWidget PtHold/PtRelease Global_Widget_Hold_Count=<%d> this=<%p>", Global_Widget_Hold_Count, this)); #endif if( mResizeProcID ) @@ -2366,7 +2374,7 @@ void nsWindow::RemoveResizeWidget() int nsWindow::ResizeWorkProc( void *data ) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::ResizeWorkProc data=<%p> mResizeQueueInited=<%d>\n", data, mResizeQueueInited )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::ResizeWorkProc data=<%p> mResizeQueueInited=<%d>", data, mResizeQueueInited )); if ( mResizeQueueInited ) { @@ -2375,7 +2383,7 @@ int nsWindow::ResizeWorkProc( void *data ) while( dqe ) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::ResizeWorkProc before Invalidate dqe=<%p> dqe->inst=<%p>\n", dqe, dqe->inst)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::ResizeWorkProc before Invalidate dqe=<%p> dqe->inst=<%p>", dqe, dqe->inst)); ((nsWindow*)dqe->inst)->mIsResizing = PR_FALSE; dqe->inst->Invalidate( PR_FALSE ); @@ -2384,7 +2392,7 @@ int nsWindow::ResizeWorkProc( void *data ) delete last_dqe; } - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::ResizeWorkProc after while loop\n")); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::ResizeWorkProc after while loop")); nsWindow::mResizeQueue = nsnull; nsWindow::mResizeQueueInited = PR_FALSE; @@ -2392,10 +2400,10 @@ int nsWindow::ResizeWorkProc( void *data ) #if 1 int Global_Widget_Hold_Count; Global_Widget_Hold_Count = PtRelease(); - PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsWindow::ResizeWorkProc PtHold/PtRelease Global_Widget_Hold_Count=<%d> this=<%p>\n", Global_Widget_Hold_Count, NULL)); + PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsWindow::ResizeWorkProc PtHold/PtRelease Global_Widget_Hold_Count=<%d> this=<%p>", Global_Widget_Hold_Count, NULL)); #endif - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::ResizeWorkProc after PtRelease\n")); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::ResizeWorkProc after PtRelease")); } @@ -2405,7 +2413,7 @@ int nsWindow::ResizeWorkProc( void *data ) NS_METHOD nsWindow::GetClientBounds( nsRect &aRect ) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::GetClientBounds (%p) aRect=(%d,%d,%d,%d)\n", this, aRect.x, aRect.y, aRect.width, aRect.height)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::GetClientBounds (%p) aRect=(%d,%d,%d,%d)", this, aRect.x, aRect.y, aRect.width, aRect.height)); aRect.x = 0; aRect.y = 0; @@ -2419,7 +2427,7 @@ NS_METHOD nsWindow::GetClientBounds( nsRect &aRect ) { int h = GetMenuBarHeight(); - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::GetClientBounds h=<%d> mFrameRight=<%d> mFrameLeft=<%d> mFrameTop=<%d> mFrameBottom=<%d>\n", + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::GetClientBounds h=<%d> mFrameRight=<%d> mFrameLeft=<%d> mFrameTop=<%d> mFrameBottom=<%d>", h, mFrameRight, mFrameLeft, mFrameTop, mFrameBottom)); @@ -2428,7 +2436,7 @@ NS_METHOD nsWindow::GetClientBounds( nsRect &aRect ) } #endif - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::GetClientBounds the end bounds=(%ld,%ld,%ld,%ld)\n", aRect.x, aRect.y, aRect.width, aRect.height )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::GetClientBounds the end bounds=(%ld,%ld,%ld,%ld)", aRect.x, aRect.y, aRect.width, aRect.height )); return NS_OK; } @@ -2440,9 +2448,9 @@ NS_METHOD nsWindow::GetClientBounds( nsRect &aRect ) //------------------------------------------------------------------------- NS_IMETHODIMP nsWindow::CaptureMouse(PRBool aCapture) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::CaptureMouse this=<%p> aCapture=<%d>\n",this, aCapture )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::CaptureMouse this=<%p> aCapture=<%d>",this, aCapture )); - NS_WARNING("nsWindow::CaptureMouse Not Implemented\n"); + NS_WARNING("nsWindow::CaptureMouse Not Implemented"); return NS_OK; } @@ -2459,7 +2467,7 @@ NS_METHOD nsWindow::ConstrainPosition(PRInt32 *aX, PRInt32 *aY) //------------------------------------------------------------------------- NS_METHOD nsWindow::Move(PRInt32 aX, PRInt32 aY) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Move this=(%p) to (%ld,%ld) mClipChildren=<%d> mClipSiblings=<%d> mBorderStyle=<%d> mWindowType=<%d> mParent=<%p>\n", + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Move this=(%p) to (%ld,%ld) mClipChildren=<%d> mClipSiblings=<%d> mBorderStyle=<%d> mWindowType=<%d> mParent=<%p>", this, aX, aY, mClipChildren, mClipSiblings, mBorderStyle, mWindowType, mParent)); PRInt32 origX, origY; @@ -2479,7 +2487,7 @@ NS_METHOD nsWindow::Move(PRInt32 aX, PRInt32 aY) PtWidgetArea(mWidget, &area); PtWidgetOffset(mWidget, &offset ); - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Move %d mWidget area=<%d,%d,%d,%d>\n", count, area.pos.x,area.pos.y,area.size.w,area.size.h)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Move %d mWidget area=<%d,%d,%d,%d>", count, area.pos.x,area.pos.y,area.size.w,area.size.h)); PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Move %d mWidget offset=<%d,%d>", count, offset.x,offset.y)); count++; top = PtWidgetParent(mWidget); @@ -2487,7 +2495,7 @@ NS_METHOD nsWindow::Move(PRInt32 aX, PRInt32 aY) { PtWidgetArea(top, &area); PtWidgetOffset(top, &offset ); - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Move %d parent area=<%d,%d,%d,%d>\n", count, area.pos.x,area.pos.y,area.size.w,area.size.h)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Move %d parent area=<%d,%d,%d,%d>", count, area.pos.x,area.pos.y,area.size.w,area.size.h)); PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Move %d parent offset=<%d,%d>", count, offset.x,offset.y)); count++; top = PtWidgetParent(top); @@ -2506,7 +2514,7 @@ NS_METHOD nsWindow::Move(PRInt32 aX, PRInt32 aY) PtWidgetArea(mWidget, &area); PtWidgetOffset(mWidget, &offset ); - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Move %d mWidget area=<%d,%d,%d,%d>\n", count, area.pos.x,area.pos.y,area.size.w,area.size.h)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Move %d mWidget area=<%d,%d,%d,%d>", count, area.pos.x,area.pos.y,area.size.w,area.size.h)); PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Move %d mWidget offset=<%d,%d>", count, offset.x,offset.y)); count++; top = PtFindDisjoint(mWidget); @@ -2514,12 +2522,12 @@ NS_METHOD nsWindow::Move(PRInt32 aX, PRInt32 aY) { PtWidgetArea(top, &area); PtWidgetOffset(top, &offset ); - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Move %d disjoint area=<%d,%d,%d,%d>\n", count, area.pos.x,area.pos.y,area.size.w,area.size.h)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Move %d disjoint area=<%d,%d,%d,%d>", count, area.pos.x,area.pos.y,area.size.w,area.size.h)); PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Move %d disjoint offset=<%d,%d>", count, offset.x,offset.y)); if (PtWidgetIsClass(top, PtWindow)) - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Move disjoint window is a PtWindow\n")); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Move disjoint window is a PtWindow")); if (PtWidgetIsClass(top, PtRegion)) - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Move disjoint window is a PtRegion\n")); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Move disjoint window is a PtRegion")); count++; last = top; PtWidget_t *tmp = PtWidgetParent(top); @@ -2558,7 +2566,7 @@ NS_METHOD nsWindow::Move(PRInt32 aX, PRInt32 aY) if (PtWidgetIsClass(disjoint, PtWindow)) { /* Stop at the first PtWindow */ - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Move disjoint window is a PtWindow exiting loop \n")); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Move disjoint window is a PtWindow exiting loop ")); break; } parent = PtWidgetParent(disjoint); @@ -2581,7 +2589,7 @@ NS_METHOD nsWindow::Move(PRInt32 aX, PRInt32 aY) aY += offset.y; } - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Move this=(%p) to (%ld,%ld) \n", this, aX, aY )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Move this=(%p) to (%ld,%ld) ", this, aX, aY )); /* Offset to the current virtual console */ if ( (mWindowType == eWindowType_dialog) @@ -2590,7 +2598,7 @@ NS_METHOD nsWindow::Move(PRInt32 aX, PRInt32 aY) { PhPoint_t offset = nsToolkit::GetConsoleOffset(); - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Move toplevel console offset=(%d,%d)\n", offset.x, offset.y)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Move toplevel console offset=(%d,%d)", offset.x, offset.y)); aX += offset.x; aY += offset.y; } @@ -2600,13 +2608,13 @@ NS_METHOD nsWindow::Move(PRInt32 aX, PRInt32 aY) { PhPoint_t offset = nsToolkit::GetConsoleOffset(); - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Move toplevel console offset=(%d,%d)\n", offset.x, offset.y)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Move toplevel console offset=(%d,%d)", offset.x, offset.y)); aX -= offset.x; aY -= offset.y; } - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Move this=(%p) after console offset to (%ld,%ld) \n", this, aX, aY )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Move this=(%p) after console offset to (%ld,%ld) ", this, aX, aY )); /* Call my base class */ nsresult res = nsWidget::Move(aX, aY); @@ -2633,8 +2641,9 @@ NS_METHOD nsWindow::Move(PRInt32 aX, PRInt32 aY) NS_METHOD nsWindow::ModalEventFilter(PRBool aRealEvent, void *aEvent, PRBool *aForWindow) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::ModalEventFilter aEvent=<%p> - Not Implemented.\n", aEvent)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::ModalEventFilter aEvent=<%p> - Not Implemented.", aEvent)); +//PRINTF( ("kedl: modal event filter %d %d %p.......................................",aRealEvent,aForWindow,aEvent)); *aForWindow = PR_TRUE; return NS_OK; } @@ -2646,15 +2655,22 @@ int nsWindow::MenuRegionCallback( PtWidget_t *widget, void *data, PtCallbackInfo nsresult result; PhEvent_t *event = cbinfo->event; - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::MenuRegionCallback this=<%p> widget=<%p> apinfo=<%p> mMenuRegion=<%p>\n", pWin, widget, data, pWin->mMenuRegion)); - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::MenuRegionCallback cbinfo->reason=<%d>\n", cbinfo->reason)); - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::MenuRegionCallback cbinfo->subtype=<%d>\n", cbinfo->reason_subtype)); - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::MenuRegionCallback cbinfo->cbdata=<%d>\n", cbinfo->cbdata)); - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::MenuRegionCallback event->type=<%d>\n", event->type)); + /* eliminate 'unreferenced' warnings */ + widget = widget, data = data, cbinfo = cbinfo; + + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::MenuRegionCallback this=<%p> widget=<%p> apinfo=<%p> mMenuRegion=<%p>", pWin, widget, data, pWin->mMenuRegion)); +// PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::MenuRegionCallback this=<%p> widget=<%p> apinfo=<%p> pWin2=<%p> EventName=<%s>", pWin, widget, data, pWin2, (const char *) nsCAutoString(PhotonEventToString(event), strlen(PhotonEventToString(event)) ) )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::MenuRegionCallback cbinfo->reason=<%d>", cbinfo->reason)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::MenuRegionCallback cbinfo->subtype=<%d>", cbinfo->reason_subtype)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::MenuRegionCallback cbinfo->cbdata=<%d>", cbinfo->cbdata)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::MenuRegionCallback event->type=<%d>", event->type)); #if 1 if (event->type == Ph_EV_BUT_PRESS) { + //PRINTF(("nsWindow::MenuRegionCallback event is Ph_EV_BUT_PRESS ")); + //PRINTF(("nsWindow::MenuRegionCallback pWin->gRollupWidget=<%p> pWin->gRollupListener=<%p>", pWin->gRollupWidget, pWin->gRollupListener)); + if (pWin->gRollupWidget && pWin->gRollupListener) { /* Close the Window */ @@ -2669,9 +2685,9 @@ int nsWindow::MenuRegionCallback( PtWidget_t *widget, void *data, PtCallbackInfo NS_METHOD nsWindow::GetAttention() { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::GetAttention this=(%p)\n", this )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::GetAttention this=(%p)", this )); - NS_WARNING("nsWindow::GetAttention Called...\n"); + NS_WARNING("nsWindow::GetAttention Called..."); if ((mWidget) && (mWidget->parent) && (!PtIsFocused(mWidget))) { @@ -2684,7 +2700,7 @@ NS_METHOD nsWindow::GetAttention() NS_IMETHODIMP nsWindow::SetModal(PRBool aModal) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::SetModal this=<%p> mWidget=<%p>\n", this, mWidget)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::SetModal this=<%p> mWidget=<%p>", this, mWidget)); nsresult res = NS_ERROR_FAILURE; if (!mWidget) @@ -2701,7 +2717,7 @@ NS_IMETHODIMP nsWindow::SetModal(PRBool aModal) // mParent->Enable(PR_FALSE); PtModalStart(); res = NS_OK; - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::SetModal after call to PtModalStart\n")); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::SetModal after call to PtModalStart")); } else { @@ -2709,7 +2725,7 @@ NS_IMETHODIMP nsWindow::SetModal(PRBool aModal) // mParent->Enable(PR_TRUE); PtModalEnd(); res = NS_OK; - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::SetModal after call to PtModalEnd\n")); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::SetModal after call to PtModalEnd")); } return res; @@ -2746,12 +2762,15 @@ int nsWindow::PopupMenuRegionCallback( PtWidget_t *widget, void *data, PtCallbac /* eliminate 'unreferenced' warnings */ widget = widget, data = data, cbinfo = cbinfo; - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::PopupMenuRegionCallback this=<%p> widget=<%p> data=<%p> mMenuRegion=<%p>\n", pWin, widget, data, pWin->mMenuRegion)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::PopupMenuRegionCallback this=<%p> widget=<%p> data=<%p> mMenuRegion=<%p>", pWin, widget, data, pWin->mMenuRegion)); - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::PMenuRegionCallback cbinfo->reason=<%d>\n", cbinfo->reason)); - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::PMenuRegionCallback cbinfo->subtype=<%d>\n", cbinfo->reason_subtype)); - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::PMenuRegionCallback cbinfo->cbdata=<%d>\n", cbinfo->cbdata)); - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::PMenuRegionCallback event->type=<%d>\n", event->type)); +// PRINTF(("nsWindow::PopupMenuRegionCallback this=<%p> widget=<%p> data=<%p> mMenuRegion=<%p> EventName=<%s>", pWin, widget, data, pWin->mMenuRegion, (const char *) nsCAutoString(PhotonEventToString(event), strlen(PhotonEventToString(event) )); +// PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::PMenuRegionCallback this=<%p> widget=<%p> data=<%p> pWin2=<%p> EventName=<%s>", pWin, widget, data, pWin2, (const char *) nsCAutoString(PhotonEventToString(event)) ))); + + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::PMenuRegionCallback cbinfo->reason=<%d>", cbinfo->reason)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::PMenuRegionCallback cbinfo->subtype=<%d>", cbinfo->reason_subtype)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::PMenuRegionCallback cbinfo->cbdata=<%d>", cbinfo->cbdata)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::PMenuRegionCallback event->type=<%d>", event->type)); return RawEventHandler(widget, data, cbinfo); } diff --git a/mozilla/widget/src/qt/nsAppShell.cpp b/mozilla/widget/src/qt/nsAppShell.cpp index b0fdd57f534..67529d8fb9b 100644 --- a/mozilla/widget/src/qt/nsAppShell.cpp +++ b/mozilla/widget/src/qt/nsAppShell.cpp @@ -31,6 +31,12 @@ #include "nsWidget.h" #include #include "X11/Xlib.h" +#include "xlibrgb.h" +#include "nslog.h" + +NS_IMPL_LOG(nsAppShellLog, 0) +#define PRINTF NS_LOG_PRINTF(nsAppShellLog) +#define FLUSH NS_LOG_FLUSH(nsAppShellLog) //------------------------------------------------------------------------- // @@ -112,7 +118,7 @@ NS_METHOD nsAppShell::Create(int *bac, char **bav) aDisplay = XOpenDisplay(NULL); if (aDisplay == NULL) { - fprintf(stderr, "%s: Cannot connect to X server\n",argv[0]); + PRINTF("%s: Cannot connect to X server\n",argv[0]); exit(1); } diff --git a/mozilla/widget/src/qt/nsDragService.cpp b/mozilla/widget/src/qt/nsDragService.cpp index 93cb59736a6..2ee504f04e7 100644 --- a/mozilla/widget/src/qt/nsDragService.cpp +++ b/mozilla/widget/src/qt/nsDragService.cpp @@ -26,6 +26,11 @@ #include "nsIServiceManager.h" #include "nsWidgetsCID.h" +#include "nslog.h" + +NS_IMPL_LOG(nsDragServiceLog, 0) +#define PRINTF NS_LOG_PRINTF(nsDragServiceLog) +#define FLUSH NS_LOG_FLUSH(nsDragServiceLog) static NS_DEFINE_IID(kIDragServiceIID, NS_IDRAGSERVICE_IID); static NS_DEFINE_CID(kCDragServiceCID, NS_DRAGSERVICE_CID); @@ -105,7 +110,7 @@ NS_IMETHODIMP nsDragService::GetData(nsITransferable * aTransferable, //------------------------------------------------------------------------- void nsDragService::SetTopLevelWidget(QWidget* w) { - printf(" nsDragService::SetTopLevelWidget\n"); + PRINTF(" nsDragService::SetTopLevelWidget\n"); // Don't set up any more event handlers if we're being called twice // for the same toplevel widget diff --git a/mozilla/widget/src/qt/nsWidget.cpp b/mozilla/widget/src/qt/nsWidget.cpp index bd34602f832..14c9ce37911 100644 --- a/mozilla/widget/src/qt/nsWidget.cpp +++ b/mozilla/widget/src/qt/nsWidget.cpp @@ -40,6 +40,11 @@ #include #include +#include "nslog.h" + +NS_IMPL_LOG(nsWidgetLog, 0) +#define PRINTF NS_LOG_PRINTF(nsWidgetLog) +#define FLUSH NS_LOG_FLUSH(nsWidgetLog) static NS_DEFINE_IID(kILookAndFeelIID, NS_ILOOKANDFEEL_IID); static NS_DEFINE_IID(kLookAndFeelCID, NS_LOOKANDFEEL_CID); @@ -1332,11 +1337,11 @@ PRBool nsWidget::DispatchMouseEvent(nsMouseEvent& aEvent) // GetBounds(rect); // if (rect.Contains(event.point.x, event.point.y)) { // if (mCurrentWindow == NULL || mCurrentWindow != this) { -// printf("Mouse enter"); +// PRINTF("Mouse enter"); // mCurrentWindow = this; // } // } else { -// printf("Mouse exit"); +// PRINTF("Mouse exit"); // } } break; diff --git a/mozilla/widget/src/qt/nsWidgetFactory.cpp b/mozilla/widget/src/qt/nsWidgetFactory.cpp index e794124c0de..f8cc7530d7d 100644 --- a/mozilla/widget/src/qt/nsWidgetFactory.cpp +++ b/mozilla/widget/src/qt/nsWidgetFactory.cpp @@ -42,6 +42,11 @@ #include "nsDragService.h" #include "nsFileSpecWithUIImpl.h" #include "nsScrollbar.h" +#include "nslog.h" + +NS_IMPL_LOG(nsWidgetFactoryLog, 0) +#define PRINTF NS_LOG_PRINTF(nsWidgetFactoryLog) +#define FLUSH NS_LOG_FLUSH(nsWidgetFactoryLog) NS_GENERIC_FACTORY_CONSTRUCTOR(nsWindow) NS_GENERIC_FACTORY_CONSTRUCTOR(ChildWindow) diff --git a/mozilla/widget/src/qt/nsWindow.cpp b/mozilla/widget/src/qt/nsWindow.cpp index 502dac09e5f..11a80ad9974 100644 --- a/mozilla/widget/src/qt/nsWindow.cpp +++ b/mozilla/widget/src/qt/nsWindow.cpp @@ -37,6 +37,11 @@ #include "stdio.h" #include #include +#include "nslog.h" + +NS_IMPL_LOG(nsWindowLog, 0) +#define PRINTF NS_LOG_PRINTF(nsWindowLog) +#define FLUSH NS_LOG_FLUSH(nsWindowLog) static bool gAppTopWindowSet = PR_FALSE; @@ -522,7 +527,7 @@ ChildWindow::~ChildWindow() { #ifdef NOISY_DESTROY IndentByDepth(stdout); - printf("ChildWindow::~ChildWindow:%p\n", this); + PRINTF("ChildWindow::~ChildWindow:%p\n", this); #endif if (mEventHandler && mParent) { ((nsWidget*)(mParent.get()))->RemoveChildEventHandler(mEventHandler); diff --git a/mozilla/widget/src/windows/nsAppShell.cpp b/mozilla/widget/src/windows/nsAppShell.cpp index 39d0045c837..3647bd31941 100644 --- a/mozilla/widget/src/windows/nsAppShell.cpp +++ b/mozilla/widget/src/windows/nsAppShell.cpp @@ -33,6 +33,11 @@ #ifdef MOZ_AIMM #include "aimm.h" #endif +#include "nslog.h" + +NS_IMPL_LOG(nsAppShellLog, 0) +#define PRINTF NS_LOG_PRINTF(nsAppShellLog) +#define FLUSH NS_LOG_FLUSH(nsAppShellLog) static NS_DEFINE_IID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID); static NS_DEFINE_CID(kTimerManagerCID, NS_TIMERMANAGER_CID); @@ -172,7 +177,7 @@ nsAppShell::GetNativeEvent(PRBool &aRealEvent, void *&aEvent) #ifdef DEBUG_danm if (msg.message != WM_TIMER) - printf("-> %d", msg.message); + PRINTF("-> %d", msg.message); #endif //#ifdef MOZ_AIMM // not need? diff --git a/mozilla/widget/src/windows/nsButton.cpp b/mozilla/widget/src/windows/nsButton.cpp index 804106821eb..1be551c506c 100644 --- a/mozilla/widget/src/windows/nsButton.cpp +++ b/mozilla/widget/src/windows/nsButton.cpp @@ -34,6 +34,11 @@ #include "nsIDeviceContext.h" #include "nsIFontMetrics.h" +#include "nslog.h" + +NS_IMPL_LOG(nsButtonLog, 0) +#define PRINTF NS_LOG_PRINTF(nsButtonLog) +#define FLUSH NS_LOG_FLUSH(nsButtonLog) static NS_DEFINE_IID(kLookAndFeelCID, NS_LOOKANDFEEL_CID); static NS_DEFINE_IID(kILookAndFeelIID, NS_ILOOKANDFEEL_IID); @@ -135,7 +140,7 @@ PRBool nsButton::OnMove(PRInt32, PRInt32) PRBool nsButton::OnPaint() { - //printf("** nsButton::OnPaint **\n"); + //PRINTF("** nsButton::OnPaint **\n"); return PR_FALSE; } diff --git a/mozilla/widget/src/windows/nsClipboard.cpp b/mozilla/widget/src/windows/nsClipboard.cpp index e774b8ab008..c3988899d28 100644 --- a/mozilla/widget/src/windows/nsClipboard.cpp +++ b/mozilla/widget/src/windows/nsClipboard.cpp @@ -49,6 +49,11 @@ #include "nsGfxCIID.h" #include "nsIImage.h" +#include "nslog.h" + +NS_IMPL_LOG(nsClipboardLog, 0) +#define PRINTF NS_LOG_PRINTF(nsClipboardLog) +#define FLUSH NS_LOG_FLUSH(nsClipboardLog) #define DEBUG_PINK 0 @@ -96,7 +101,7 @@ UINT nsClipboard::GetFormat(const char* aMimeStr) format = ::RegisterClipboardFormat(aMimeStr); #if DEBUG_PINK - printf("nsClipboard::GetFormat [%s] 0x%x\n", aMimeStr, format); + PRINTF("nsClipboard::GetFormat [%s] 0x%x\n", aMimeStr, format); #endif return format; } @@ -287,39 +292,39 @@ nsresult nsClipboard::GetNativeDataOffClipboard(nsIWidget * aWindow, UINT /*aInd static void DisplayErrCode(HRESULT hres) { if (hres == E_INVALIDARG) { - printf("E_INVALIDARG\n"); + PRINTF("E_INVALIDARG\n"); } else if (hres == E_UNEXPECTED) { - printf("E_UNEXPECTED\n"); + PRINTF("E_UNEXPECTED\n"); } else if (hres == E_OUTOFMEMORY) { - printf("E_OUTOFMEMORY\n"); + PRINTF("E_OUTOFMEMORY\n"); } else if (hres == DV_E_LINDEX ) { - printf("DV_E_LINDEX\n"); + PRINTF("DV_E_LINDEX\n"); } else if (hres == DV_E_FORMATETC) { - printf("DV_E_FORMATETC\n"); + PRINTF("DV_E_FORMATETC\n"); } else if (hres == DV_E_TYMED) { - printf("DV_E_TYMED\n"); + PRINTF("DV_E_TYMED\n"); } else if (hres == DV_E_DVASPECT) { - printf("DV_E_DVASPECT\n"); + PRINTF("DV_E_DVASPECT\n"); } else if (hres == OLE_E_NOTRUNNING) { - printf("OLE_E_NOTRUNNING\n"); + PRINTF("OLE_E_NOTRUNNING\n"); } else if (hres == STG_E_MEDIUMFULL) { - printf("STG_E_MEDIUMFULL\n"); + PRINTF("STG_E_MEDIUMFULL\n"); } else if (hres == DV_E_CLIPFORMAT) { - printf("DV_E_CLIPFORMAT\n"); + PRINTF("DV_E_CLIPFORMAT\n"); } else if (hres == S_OK) { - printf("S_OK\n"); + PRINTF("S_OK\n"); } else { - printf("****** DisplayErrCode 0x%X\n", hres); + PRINTF("****** DisplayErrCode 0x%X\n", hres); } } #endif @@ -549,7 +554,7 @@ nsresult nsClipboard::GetNativeDataOffClipboard(IDataObject * aDataObject, UINT case TYMED_GDI: { - printf("*********************** TYMED_GDI\n"); + PRINTF("*********************** TYMED_GDI\n"); } break; default: diff --git a/mozilla/widget/src/windows/nsContextMenu.cpp b/mozilla/widget/src/windows/nsContextMenu.cpp index f438c4d1e3a..d5d040f623e 100644 --- a/mozilla/widget/src/windows/nsContextMenu.cpp +++ b/mozilla/widget/src/windows/nsContextMenu.cpp @@ -43,6 +43,11 @@ #include "nsCOMPtr.h" #include "nsIMenuListener.h" #include "nsIComponentManager.h" +#include "nslog.h" + +NS_IMPL_LOG(nsContextMenuLog, 0) +#define PRINTF NS_LOG_PRINTF(nsContextMenuLog) +#define FLUSH NS_LOG_FLUSH(nsContextMenuLog) // CIDs #include "nsWidgetsCID.h" @@ -369,7 +374,7 @@ nsEventStatus nsContextMenu::MenuItemSelected(const nsMenuEvent & aMenuEvent) { #ifdef saari_debug char* menuLabel = GetACPString(mLabel); - printf("Menu Item Selected %s\n", menuLabel); + PRINTF("Menu Item Selected %s\n", menuLabel); delete[] menuLabel; #endif if (nsnull != mListener) { @@ -382,7 +387,7 @@ nsEventStatus nsContextMenu::MenuItemSelected(const nsMenuEvent & aMenuEvent) nsEventStatus nsContextMenu::MenuSelected(const nsMenuEvent & aMenuEvent) { - //printf("nsMenu::MenuSelected called\n"); + //PRINTF("nsMenu::MenuSelected called\n"); if(mConstructed){ MenuDestruct(aMenuEvent); @@ -523,7 +528,7 @@ nsIMenuItem * nsContextMenu::FindMenuItem(nsIContextMenu * aMenu, PRUint32 aId) //------------------------------------------------------------------------- nsEventStatus nsContextMenu::MenuDeselected(const nsMenuEvent & aMenuEvent) { - //printf("nsMenu::MenuDeselected called\n"); +//PRINTF("nsMenu::MenuDeselected called\n"); //MenuDestruct(aMenuEvent); //mConstructed = false; @@ -541,7 +546,7 @@ nsEventStatus nsContextMenu::MenuConstruct( void * menuNode, void * aWebShell) { - //printf("nsMenu::MenuConstruct called \n"); + //PRINTF("nsMenu::MenuConstruct called \n"); // Begin menuitem inner loop nsCOMPtr menuitemNode; ((nsIDOMNode*)mDOMNode)->GetFirstChild(getter_AddRefs(menuitemNode)); @@ -575,7 +580,7 @@ nsEventStatus nsContextMenu::MenuConstruct( //------------------------------------------------------------------------- nsEventStatus nsContextMenu::MenuDestruct(const nsMenuEvent & aMenuEvent) { - //printf("nsMenu::MenuDestruct called \n"); + //PRINTF("nsMenu::MenuDestruct called \n"); // We cannot call RemoveAll() yet because menu item selection may need it //RemoveAll(); @@ -652,7 +657,7 @@ void nsContextMenu::LoadSubMenu( { nsString menuName; menuElement->GetAttribute(nsAutoString("value"), menuName); - //printf("Creating Menu [%s] \n", menuName.ToNewCString()); // this leaks + //PRINTF("Creating Menu [%s] \n", menuName.ToNewCString()); // this leaks // Create nsMenu nsIMenu * pnsMenu = nsnull; @@ -745,7 +750,7 @@ void nsContextMenu::LoadSubMenu( { nsString menuName; menuElement->GetAttribute(nsAutoString("value"), menuName); - //printf("Creating Menu [%s] \n", menuName.ToNewCString()); // this leaks + //PRINTF("Creating Menu [%s] \n", menuName.ToNewCString()); // this leaks // Create nsMenu nsIMenu * pnsMenu = nsnull; diff --git a/mozilla/widget/src/windows/nsDataObj.cpp b/mozilla/widget/src/windows/nsDataObj.cpp index c183c2a6c68..0ac26283302 100644 --- a/mozilla/widget/src/windows/nsDataObj.cpp +++ b/mozilla/widget/src/windows/nsDataObj.cpp @@ -34,15 +34,20 @@ #include "OLE2.h" #include "URLMON.h" #include "shlobj.h" +#include "nslog.h" + +NS_IMPL_LOG(nsDataObjLog, 0) +#define PRINTF NS_LOG_PRINTF(nsDataObjLog) +#define FLUSH NS_LOG_FLUSH(nsDataObjLog) #if 0 -#define PRNTDEBUG(_x) printf(_x); -#define PRNTDEBUG2(_x1, _x2) printf(_x1, _x2); -#define PRNTDEBUG3(_x1, _x2, _x3) printf(_x1, _x2, _x3); +#define PRNTDEBUG(_x) PRINTF(_x); +#define PRNTDEBUG2(_x1, _x2) PRINTF(_x1, _x2); +#define PRNTDEBUG3(_x1, _x2, _x3) PRINTF(_x1, _x2, _x3); #else -#define PRNTDEBUG(_x) // printf(_x); -#define PRNTDEBUG2(_x1, _x2) // printf(_x1, _x2); -#define PRNTDEBUG3(_x1, _x2, _x3) // printf(_x1, _x2, _x3); +#define PRNTDEBUG(_x) // PRINTF(_x); +#define PRNTDEBUG2(_x1, _x2) // PRINTF(_x1, _x2); +#define PRNTDEBUG3(_x1, _x2, _x3) // PRINTF(_x1, _x2, _x3); #endif ULONG nsDataObj::g_cRef = 0; @@ -109,7 +114,7 @@ STDMETHODIMP nsDataObj::QueryInterface(REFIID riid, void** ppv) STDMETHODIMP_(ULONG) nsDataObj::AddRef() { ++g_cRef; - //PRNTDEBUG3("nsDataObj::AddRef >>>>>>>>>>>>>>>>>> %d on %p\n", (m_cRef+1), this); + //PRNTDEBUG3("nsDataObj::AddRef >>>>>>>>>>>>>>>>>> %d on %p", (m_cRef+1), this); return ++m_cRef; } @@ -117,7 +122,7 @@ STDMETHODIMP_(ULONG) nsDataObj::AddRef() //----------------------------------------------------- STDMETHODIMP_(ULONG) nsDataObj::Release() { - //PRNTDEBUG3("nsDataObj::Release >>>>>>>>>>>>>>>>>> %d on %p\n", (m_cRef-1), this); + //PRNTDEBUG3("nsDataObj::Release >>>>>>>>>>>>>>>>>> %d on %p", (m_cRef-1), this); if (0 < g_cRef) --g_cRef; @@ -146,9 +151,9 @@ BOOL nsDataObj::FormatsMatch(const FORMATETC& source, const FORMATETC& target) c //----------------------------------------------------- STDMETHODIMP nsDataObj::GetData(LPFORMATETC pFE, LPSTGMEDIUM pSTM) { - printf("nsDataObj::GetData2\n"); - PRNTDEBUG("nsDataObj::GetData\n"); - PRNTDEBUG3(" format: %d Text: %d\n", pFE->cfFormat, CF_TEXT); + PRINTF("nsDataObj::GetData2"); + PRNTDEBUG("nsDataObj::GetData"); + PRNTDEBUG3(" format: %d Text: %d", pFE->cfFormat, CF_TEXT); if ( !mTransferable ) return ResultFromScode(DATA_E_FORMATETC); @@ -186,7 +191,7 @@ STDMETHODIMP nsDataObj::GetData(LPFORMATETC pFE, LPSTGMEDIUM pSTM) else if ( format == fileFlavor ) return GetFileContents ( *pFE, *pSTM ); else { - PRNTDEBUG2("***** nsDataObj::GetData - Unknown format %x\n", format); + PRNTDEBUG2("***** nsDataObj::GetData - Unknown format %x", format); return GetText(df, *pFE, *pSTM); } break; @@ -204,7 +209,7 @@ STDMETHODIMP nsDataObj::GetData(LPFORMATETC pFE, LPSTGMEDIUM pSTM) //----------------------------------------------------- STDMETHODIMP nsDataObj::GetDataHere(LPFORMATETC pFE, LPSTGMEDIUM pSTM) { - PRNTDEBUG("nsDataObj::GetDataHere\n"); + PRNTDEBUG("nsDataObj::GetDataHere"); return ResultFromScode(E_FAIL); } @@ -216,7 +221,7 @@ STDMETHODIMP nsDataObj::GetDataHere(LPFORMATETC pFE, LPSTGMEDIUM pSTM) STDMETHODIMP nsDataObj::QueryGetData(LPFORMATETC pFE) { PRNTDEBUG("nsDataObj::QueryGetData "); - PRNTDEBUG3("format: %d Text: %d\n", pFE->cfFormat, CF_TEXT); + PRNTDEBUG3("format: %d Text: %d", pFE->cfFormat, CF_TEXT); PRUint32 dfInx = 0; @@ -229,7 +234,7 @@ STDMETHODIMP nsDataObj::QueryGetData(LPFORMATETC pFE) } } - PRNTDEBUG2("***** nsDataObj::QueryGetData - Unknown format %d\n", pFE->cfFormat); + PRNTDEBUG2("***** nsDataObj::QueryGetData - Unknown format %d", pFE->cfFormat); return ResultFromScode(E_FAIL); } @@ -237,7 +242,7 @@ STDMETHODIMP nsDataObj::QueryGetData(LPFORMATETC pFE) STDMETHODIMP nsDataObj::GetCanonicalFormatEtc (LPFORMATETC pFEIn, LPFORMATETC pFEOut) { - PRNTDEBUG("nsDataObj::GetCanonicalFormatEtc\n"); + PRNTDEBUG("nsDataObj::GetCanonicalFormatEtc"); return ResultFromScode(E_FAIL); } @@ -245,7 +250,7 @@ STDMETHODIMP nsDataObj::GetCanonicalFormatEtc //----------------------------------------------------- STDMETHODIMP nsDataObj::SetData(LPFORMATETC pFE, LPSTGMEDIUM pSTM, BOOL fRelease) { - PRNTDEBUG("nsDataObj::SetData\n"); + PRNTDEBUG("nsDataObj::SetData"); return ResultFromScode(E_FAIL); } @@ -254,7 +259,7 @@ STDMETHODIMP nsDataObj::SetData(LPFORMATETC pFE, LPSTGMEDIUM pSTM, BOOL fRelease //----------------------------------------------------- STDMETHODIMP nsDataObj::EnumFormatEtc(DWORD dwDir, LPENUMFORMATETC *ppEnum) { - PRNTDEBUG("nsDataObj::EnumFormatEtc\n"); + PRNTDEBUG("nsDataObj::EnumFormatEtc"); switch (dwDir) { case DATADIR_GET: { @@ -284,7 +289,7 @@ STDMETHODIMP nsDataObj::EnumFormatEtc(DWORD dwDir, LPENUMFORMATETC *ppEnum) STDMETHODIMP nsDataObj::DAdvise(LPFORMATETC pFE, DWORD dwFlags, LPADVISESINK pIAdviseSink, DWORD* pdwConn) { - PRNTDEBUG("nsDataObj::DAdvise\n"); + PRNTDEBUG("nsDataObj::DAdvise"); return ResultFromScode(E_FAIL); } @@ -292,14 +297,14 @@ STDMETHODIMP nsDataObj::DAdvise(LPFORMATETC pFE, DWORD dwFlags, //----------------------------------------------------- STDMETHODIMP nsDataObj::DUnadvise(DWORD dwConn) { - PRNTDEBUG("nsDataObj::DUnadvise\n"); + PRNTDEBUG("nsDataObj::DUnadvise"); return ResultFromScode(E_FAIL); } //----------------------------------------------------- STDMETHODIMP nsDataObj::EnumDAdvise(LPENUMSTATDATA *ppEnum) { - PRNTDEBUG("nsDataObj::EnumDAdvise\n"); + PRNTDEBUG("nsDataObj::EnumDAdvise"); return ResultFromScode(E_FAIL); } @@ -322,28 +327,28 @@ ULONG nsDataObj::GetRefCount() const //----------------------------------------------------- HRESULT nsDataObj::AddSetFormat(FORMATETC& aFE) { - PRNTDEBUG("nsDataObj::AddSetFormat\n"); + PRNTDEBUG("nsDataObj::AddSetFormat"); return ResultFromScode(S_OK); } //----------------------------------------------------- HRESULT nsDataObj::AddGetFormat(FORMATETC& aFE) { - PRNTDEBUG("nsDataObj::AddGetFormat\n"); + PRNTDEBUG("nsDataObj::AddGetFormat"); return ResultFromScode(S_OK); } //----------------------------------------------------- HRESULT nsDataObj::GetBitmap(FORMATETC&, STGMEDIUM&) { - PRNTDEBUG("nsDataObj::GetBitmap\n"); + PRNTDEBUG("nsDataObj::GetBitmap"); return ResultFromScode(E_NOTIMPL); } //----------------------------------------------------- HRESULT nsDataObj::GetDib(FORMATETC&, STGMEDIUM&) { - PRNTDEBUG("nsDataObj::GetDib\n"); + PRNTDEBUG("nsDataObj::GetDib"); return E_NOTIMPL; } @@ -363,7 +368,7 @@ nsDataObj :: GetFileDescriptor ( FORMATETC& aFE, STGMEDIUM& aSTG ) if ( IsInternetShortcut() ) res = GetFileDescriptorInternetShortcut ( aFE, aSTG ); else - NS_WARNING ( "Not yet implemented\n" ); + NS_WARNING ( "Not yet implemented" ); return res; @@ -381,7 +386,7 @@ nsDataObj :: GetFileContents ( FORMATETC& aFE, STGMEDIUM& aSTG ) if ( IsInternetShortcut() ) res = GetFileContentsInternetShortcut ( aFE, aSTG ); else - NS_WARNING ( "Not yet implemented\n" ); + NS_WARNING ( "Not yet implemented" ); return res; @@ -765,4 +770,4 @@ nsDataObj :: ExtractShortcutTitle ( nsString & outTitle ) return rv; -} // ExtractShortcutTitle \ No newline at end of file +} // ExtractShortcutTitle diff --git a/mozilla/widget/src/windows/nsDataObjCollection.cpp b/mozilla/widget/src/windows/nsDataObjCollection.cpp index cd8a8130c43..1dec1cb2324 100644 --- a/mozilla/widget/src/windows/nsDataObjCollection.cpp +++ b/mozilla/widget/src/windows/nsDataObjCollection.cpp @@ -29,15 +29,20 @@ #include "OLE2.h" #include "URLMON.h" +#include "nslog.h" + +NS_IMPL_LOG(nsDataObjCollectionLog, 0) +#define PRINTF NS_LOG_PRINTF(nsDataObjCollectionLog) +#define FLUSH NS_LOG_FLUSH(nsDataObjCollectionLog) #if 0 -#define PRNTDEBUG(_x) printf(_x); -#define PRNTDEBUG2(_x1, _x2) printf(_x1, _x2); -#define PRNTDEBUG3(_x1, _x2, _x3) printf(_x1, _x2, _x3); +#define PRNTDEBUG(_x) PRINTF(_x); +#define PRNTDEBUG2(_x1, _x2) PRINTF(_x1, _x2); +#define PRNTDEBUG3(_x1, _x2, _x3) PRINTF(_x1, _x2, _x3); #else -#define PRNTDEBUG(_x) // printf(_x); -#define PRNTDEBUG2(_x1, _x2) // printf(_x1, _x2); -#define PRNTDEBUG3(_x1, _x2, _x3) // printf(_x1, _x2, _x3); +#define PRNTDEBUG(_x) // PRINTF(_x); +#define PRNTDEBUG2(_x1, _x2) // PRINTF(_x1, _x2); +#define PRNTDEBUG3(_x1, _x2, _x3) // PRINTF(_x1, _x2, _x3); #endif ULONG nsDataObjCollection::g_cRef = 0; diff --git a/mozilla/widget/src/windows/nsFileWidget.cpp b/mozilla/widget/src/windows/nsFileWidget.cpp index b741088dfd9..8ae6772654a 100644 --- a/mozilla/widget/src/windows/nsFileWidget.cpp +++ b/mozilla/widget/src/windows/nsFileWidget.cpp @@ -35,6 +35,13 @@ #include "nsFileSpec.h" #include #include +#include "nslog.h" +#undef PRINTF +#undef FLUSH + +NS_IMPL_LOG(nsFileWidgetLog, 0) +#define PRINTF NS_LOG_PRINTF(nsFileWidgetLog) +#define FLUSH NS_LOG_FLUSH(nsFileWidgetLog) static NS_DEFINE_CID(kCharsetConverterManagerCID, NS_ICHARSETCONVERTERMANAGER_CID); @@ -339,7 +346,7 @@ nsFileDlgResults nsFileWidget::GetFolder(nsIWidget * aParent, pathStr.Assign(unichar); delete [] unichar; } - //printf("[%s]\n", path); + //PRINTF("[%s]\n", path); nsFilePath filePath(pathStr); nsFileSpec fileSpec(filePath); theFileSpec = fileSpec; diff --git a/mozilla/widget/src/windows/nsFontRetrieverService.cpp b/mozilla/widget/src/windows/nsFontRetrieverService.cpp index 74c9e21401d..17c0c333697 100644 --- a/mozilla/widget/src/windows/nsFontRetrieverService.cpp +++ b/mozilla/widget/src/windows/nsFontRetrieverService.cpp @@ -27,6 +27,11 @@ #include "nsFont.h" #include "nsVoidArray.h" #include "nsFontSizeIterator.h" +#include "nslog.h" + +NS_IMPL_LOG(nsFontRetrieverServiceLog, 0) +#define PRINTF NS_LOG_PRINTF(nsFontRetrieverServiceLog) +#define FLUSH NS_LOG_FLUSH(nsFontRetrieverServiceLog) NS_IMPL_ADDREF(nsFontRetrieverService) NS_IMPL_RELEASE(nsFontRetrieverService) @@ -181,27 +186,27 @@ static int CALLBACK MyEnumFontFamProc(ENUMLOGFONT FAR *lpelf, { FontInfo * font = (FontInfo *)lParam; - ////printf(" sizes-> %d\n", lpelf->elfLogFont.lfHeight); + ////PRINTF(" sizes-> %d\n", lpelf->elfLogFont.lfHeight); LOGFONT ourLogFont; // Local copy of the LOGFONT structure. memcpy(&ourLogFont, (const void *)&lpelf->elfLogFont, sizeof LOGFONT); // Make the copy - //printf("Size: %d", ourLogFont.lfHeight); + //PRINTF("Size: %d", ourLogFont.lfHeight); if (fontType & TRUETYPE_FONTTYPE) { - //printf("TRUETYPE_FONTTYPE;"); + //PRINTF("TRUETYPE_FONTTYPE;"); font->mIsScalable = PR_TRUE; return 1; } else if (fontType & RASTER_FONTTYPE) { - //printf("RASTER_FONTTYPE;"); + //PRINTF("RASTER_FONTTYPE;"); if (nsnull == font->mSizes ) { font->mSizes = new nsVoidArray(); } } else if (fontType & DEVICE_FONTTYPE) { - //printf("DEVICE_FONTTYPE;"); + //PRINTF("DEVICE_FONTTYPE;"); //if (nsnull == font->mSizes ) { // font->mSizes = new nsVoidArray(); //} } else { - //printf("VECTOR_FONTTYPE;"); + //PRINTF("VECTOR_FONTTYPE;"); font->mIsScalable = PR_TRUE; } @@ -211,9 +216,9 @@ static int CALLBACK MyEnumFontFamProc(ENUMLOGFONT FAR *lpelf, #if 0 if (ourLogFont.lfCharSet != ANSI_CHARSET) - //printf("FNT_NONANSI;"); + //PRINTF("FNT_NONANSI;"); else - //printf("FNT_ANSI;"); + //PRINTF("FNT_ANSI;"); // // We also need to set the family type (we use it for filtering) @@ -221,27 +226,27 @@ static int CALLBACK MyEnumFontFamProc(ENUMLOGFONT FAR *lpelf, switch (ourLogFont.lfPitchAndFamily & 0xF0) { case FF_SWISS: - //printf("FNT_SANSSERIF;"); + //PRINTF("FNT_SANSSERIF;"); break; case FF_ROMAN: - //printf("FNT_SERIF;"); + //PRINTF("FNT_SERIF;"); break; case FF_MODERN: - //printf("FNT_MODERN;"); + //PRINTF("FNT_MODERN;"); break; case FF_SCRIPT: - //printf("FNT_SCRIPT;"); + //PRINTF("FNT_SCRIPT;"); break; default: - //printf("FNT_OTHER;"); + //PRINTF("FNT_OTHER;"); break; } #endif - //printf("\n"); + //PRINTF("\n"); return 1; } @@ -262,14 +267,14 @@ static int CALLBACK EnumerateMyFonts(ENUMLOGFONTEX *lpLogFontEx, { nsVoidArray * fontList = (nsVoidArray *)lParam; - /*printf("%s [%s][%s][%s]", lpLogFontEx->elfLogFont.lfFaceName, + /*PRINTF("%s [%s][%s][%s]", lpLogFontEx->elfLogFont.lfFaceName, lpLogFontEx->elfFullName, lpLogFontEx->elfStyle, lpLogFontEx->elfScript ); */ LOGFONT ourLogFont; // Local copy of the LOGFONT structure. memcpy(&ourLogFont, (const void *)&lpLogFontEx->elfLogFont, sizeof LOGFONT); // Make the copy - //printf("Size: %d\n", ourLogFont.lfHeight); + //PRINTF("Size: %d\n", ourLogFont.lfHeight); FontInfo * font = new FontInfo(); font->mName.AssignWithConversion((char *)lpLogFontEx->elfLogFont.lfFaceName); // XXX I18N ? diff --git a/mozilla/widget/src/windows/nsLabel.cpp b/mozilla/widget/src/windows/nsLabel.cpp index 6130b157610..78c6a41a5b7 100644 --- a/mozilla/widget/src/windows/nsLabel.cpp +++ b/mozilla/widget/src/windows/nsLabel.cpp @@ -30,6 +30,11 @@ #include "nsIFontMetrics.h" #include "nsIDeviceContext.h" #include +#include "nslog.h" + +NS_IMPL_LOG(nsLabelLog, 0) +#define PRINTF NS_LOG_PRINTF(nsLabelLog) +#define FLUSH NS_LOG_FLUSH(nsLabelLog) NS_IMPL_ADDREF(nsLabel) NS_IMPL_RELEASE(nsLabel) @@ -138,7 +143,7 @@ PRBool nsLabel::OnMove(PRInt32, PRInt32) PRBool nsLabel::OnPaint() { - //printf("** nsLabel::OnPaint **\n"); + //PRINTF("** nsLabel::OnPaint **\n"); return PR_FALSE; } diff --git a/mozilla/widget/src/windows/nsMenu.cpp b/mozilla/widget/src/windows/nsMenu.cpp index 970dc82c1a8..c319f54d95d 100644 --- a/mozilla/widget/src/windows/nsMenu.cpp +++ b/mozilla/widget/src/windows/nsMenu.cpp @@ -46,6 +46,11 @@ #include "nsCOMPtr.h" #include "nsIMenuListener.h" #include "nsIComponentManager.h" +#include "nslog.h" + +NS_IMPL_LOG(nsMenuLog, 0) +#define PRINTF NS_LOG_PRINTF(nsMenuLog) +#define FLUSH NS_LOG_FLUSH(nsMenuLog) // IIDs static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); @@ -350,7 +355,7 @@ NS_METHOD nsMenu::InsertItemAt(const PRUint32 aCount, nsISupports * aMenuItem) nsCOMPtr menuItem(do_QueryInterface(aMenuItem)); if (menuItem) { menuItem->GetLabel(name); - printf("%s \n", name.ToNewCString()); + PRINTF("%s \n", name.ToNewCString()); nsIWidget * win = GetParentWidget(); PRInt32 id = ((nsWindow *)win)->GetNewCmdMenuId(); ((nsMenuItem *)((nsIMenuItem *)menuItem))->SetCmdId(id); @@ -534,7 +539,7 @@ nsEventStatus nsMenu::MenuItemSelected(const nsMenuEvent & aMenuEvent) { #ifdef saari_debug char* menuLabel = GetACPString(mLabel); - printf("Menu Item Selected %s\n", menuLabel); + PRINTF("Menu Item Selected %s\n", menuLabel); delete[] menuLabel; #endif if (nsnull != mListener) { @@ -547,7 +552,7 @@ nsEventStatus nsMenu::MenuItemSelected(const nsMenuEvent & aMenuEvent) nsEventStatus nsMenu::MenuSelected(const nsMenuEvent & aMenuEvent) { - //printf("nsMenu::MenuSelected called\n"); + //PRINTF("nsMenu::MenuSelected called\n"); if(mConstructed){ MenuDestruct(aMenuEvent); @@ -573,7 +578,7 @@ nsEventStatus nsMenu::MenuSelected(const nsMenuEvent & aMenuEvent) //------------------------------------------------------------------------- nsEventStatus nsMenu::MenuDeselected(const nsMenuEvent & aMenuEvent) { - //printf("nsMenu::MenuDeselected called\n"); + //PRINTF("nsMenu::MenuDeselected called\n"); //MenuDestruct(aMenuEvent); //mConstructed = false; @@ -591,7 +596,7 @@ nsEventStatus nsMenu::MenuConstruct( void * menuNode, void * aWebShell) { - //printf("nsMenu::MenuConstruct called \n"); + //PRINTF("nsMenu::MenuConstruct called \n"); // Begin menuitem inner loop // Open the node. @@ -649,7 +654,7 @@ nsEventStatus nsMenu::MenuConstruct( //------------------------------------------------------------------------- nsEventStatus nsMenu::MenuDestruct(const nsMenuEvent & aMenuEvent) { - //printf("nsMenu::MenuDestruct called \n"); + //PRINTF("nsMenu::MenuDestruct called \n"); // We cannot call RemoveAll() yet because menu item selection may need it //RemoveAll(); @@ -708,7 +713,7 @@ void nsMenu::LoadMenuItem( nsString cmdName; domElement->GetAttribute(cmdAtom, cmdName); - printf("%s \n", cmdName.ToNewCString()); + PRINTF("%s \n", cmdName.ToNewCString()); pnsMenuItem->SetCommand(cmdName); // DO NOT use passed in wehshell because of messed up windows dynamic loading @@ -796,7 +801,7 @@ void nsMenu::LoadSubMenu( { nsString menuName; menuElement->GetAttribute(nsAutoString("value"), menuName); - //printf("Creating Menu [%s] \n", menuName.ToNewCString()); // this leaks + //PRINTF("Creating Menu [%s] \n", menuName.ToNewCString()); // this leaks // Create nsMenu nsIMenu * pnsMenu = nsnull; diff --git a/mozilla/widget/src/windows/nsMenuBar.cpp b/mozilla/widget/src/windows/nsMenuBar.cpp index 79f784aea76..bbbded9b088 100644 --- a/mozilla/widget/src/windows/nsMenuBar.cpp +++ b/mozilla/widget/src/windows/nsMenuBar.cpp @@ -37,6 +37,11 @@ #include "nsRect.h" #include "nsGfxCIID.h" #include "nsMenu.h" +#include "nslog.h" + +NS_IMPL_LOG(nsMenuBarLog, 0) +#define PRINTF NS_LOG_PRINTF(nsMenuBarLog) +#define FLUSH NS_LOG_FLUSH(nsMenuBarLog) // IIDs static NS_DEFINE_IID(kIMenuBarIID, NS_IMENUBAR_IID); @@ -95,7 +100,7 @@ nsEventStatus nsMenuBar::MenuItemSelected(const nsMenuEvent & aMenuEvent) //------------------------------------------------------------------------- nsEventStatus nsMenuBar::MenuSelected(const nsMenuEvent & aMenuEvent) { - printf("nsMenuBar::MenuSelected \n"); + PRINTF("nsMenuBar::MenuSelected \n"); // Find which menu was selected and call MenuConstruct on it HMENU aNativeMenu = (HMENU) aMenuEvent.nativeMsg; diff --git a/mozilla/widget/src/windows/nsNativeDragSource.cpp b/mozilla/widget/src/windows/nsNativeDragSource.cpp index fdeb5fdaafc..05e424508fa 100644 --- a/mozilla/widget/src/windows/nsNativeDragSource.cpp +++ b/mozilla/widget/src/windows/nsNativeDragSource.cpp @@ -22,6 +22,11 @@ #include "nsNativeDragSource.h" #include +#include "nslog.h" + +NS_IMPL_LOG(nsNativeDragSourceLog, 0) +#define PRINTF NS_LOG_PRINTF(nsNativeDragSourceLog) +#define FLUSH NS_LOG_FLUSH(nsNativeDragSourceLog) /* @@ -72,23 +77,23 @@ STDMETHODIMP_(ULONG) nsNativeDragSource::Release(void) STDMETHODIMP nsNativeDragSource::QueryContinueDrag(BOOL fEsc, DWORD grfKeyState) { - //printf("QueryContinueDrag\n"); + //PRINTF("QueryContinueDrag\n"); if (fEsc) { - //printf("QueryContinueDrag: fEsc\n"); + //PRINTF("QueryContinueDrag: fEsc\n"); return ResultFromScode(DRAGDROP_S_CANCEL); } if (!(grfKeyState & MK_LBUTTON)) { - //printf("QueryContinueDrag: grfKeyState & MK_LBUTTON\n"); + //PRINTF("QueryContinueDrag: grfKeyState & MK_LBUTTON\n"); return ResultFromScode(DRAGDROP_S_DROP); } - //printf("QueryContinueDrag: NOERROR\n"); + //PRINTF("QueryContinueDrag: NOERROR\n"); return NOERROR; } STDMETHODIMP nsNativeDragSource::GiveFeedback(DWORD dwEffect) { - //printf("GiveFeedback\n"); + //PRINTF("GiveFeedback\n"); return ResultFromScode(DRAGDROP_S_USEDEFAULTCURSORS); } diff --git a/mozilla/widget/src/windows/nsNativeDragTarget.cpp b/mozilla/widget/src/windows/nsNativeDragTarget.cpp index 7a474a186bb..ece1470263f 100644 --- a/mozilla/widget/src/windows/nsNativeDragTarget.cpp +++ b/mozilla/widget/src/windows/nsNativeDragTarget.cpp @@ -30,6 +30,11 @@ #include "nsIWidget.h" #include "nsWindow.h" +#include "nslog.h" + +NS_IMPL_LOG(nsNativeDragTargetLog, 0) +#define PRINTF NS_LOG_PRINTF(nsNativeDragTargetLog) +#define FLUSH NS_LOG_FLUSH(nsNativeDragTargetLog) #if (_MSC_VER == 1100) #define INITGUID @@ -38,8 +43,6 @@ DEFINE_OLEGUID(IID_IDropTarget, 0x00000122L, 0, 0); DEFINE_OLEGUID(IID_IUnknown, 0x00000000L, 0, 0); #endif -#define DRAG_DEBUG 0 - /* Define Class IDs */ static NS_DEFINE_IID(kCDragServiceCID, NS_DRAGSERVICE_CID); @@ -225,7 +228,7 @@ STDMETHODIMP nsNativeDragTarget::DragEnter(LPDATAOBJECT pIDataSource, POINTL pt, DWORD* pdwEffect) { - if (DRAG_DEBUG) printf("DragEnter\n"); + PRINTF("DragEnter\n"); if (mDragService) { @@ -256,7 +259,7 @@ STDMETHODIMP nsNativeDragTarget::DragOver(DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect) { - if (DRAG_DEBUG) printf("DragOver\n"); + PRINTF("DragOver\n"); if (mDragService) { // Now process the native drag state and then dispatch the event ProcessDrag(nsnull, NS_DRAGDROP_OVER, grfKeyState, pt, pdwEffect); @@ -270,7 +273,7 @@ STDMETHODIMP nsNativeDragTarget::DragOver(DWORD grfKeyState, //----------------------------------------------------- STDMETHODIMP nsNativeDragTarget::DragLeave() { - if (DRAG_DEBUG) printf("DragLeave\n"); + PRINTF("DragLeave\n"); if (mDragService) { // dispatch the event into Gecko diff --git a/mozilla/widget/src/windows/nsSound.cpp b/mozilla/widget/src/windows/nsSound.cpp index 3ce8b749c0d..f885086ac40 100644 --- a/mozilla/widget/src/windows/nsSound.cpp +++ b/mozilla/widget/src/windows/nsSound.cpp @@ -30,6 +30,11 @@ #include "nsSound.h" #include "nsIURL.h" #include "nsNetUtil.h" +#include "nslog.h" + +NS_IMPL_LOG(nsSoundLog, 0) +#define PRINTF NS_LOG_PRINTF(nsSoundLog) +#define FLUSH NS_LOG_FLUSH(nsSoundLog) NS_IMPL_ISUPPORTS2(nsSound, nsISound, nsIStreamLoaderObserver) @@ -103,7 +108,7 @@ NS_IMETHODIMP nsSound::OnStreamComplete(nsIStreamLoader *aLoader, if (uri) { char* uriSpec; uri->GetSpec(&uriSpec); - printf("Failed to load %s\n", uriSpec ? uriSpec : ""); + PRINTF("Failed to load %s\n", uriSpec ? uriSpec : ""); } } } @@ -133,7 +138,7 @@ NS_METHOD nsSound::Play(nsIURL *aURL) #ifdef DEBUG_SOUND char *url; aURL->GetSpec(&url); - printf("%s\n", url); + PRINTF("%s\n", url); #endif nsCOMPtr loader; diff --git a/mozilla/widget/src/windows/nsWindow.cpp b/mozilla/widget/src/windows/nsWindow.cpp index a03da0a7d76..428557eeaca 100644 --- a/mozilla/widget/src/windows/nsWindow.cpp +++ b/mozilla/widget/src/windows/nsWindow.cpp @@ -71,6 +71,11 @@ #include "nsITimer.h" #include "nsITimerQueue.h" +#include "nslog.h" + +NS_IMPL_LOG(nsWindowLog, 0) +#define PRINTF NS_LOG_PRINTF(nsWindowLog) +#define FLUSH NS_LOG_FLUSH(nsWindowLog) #define kWindowPositionSlop 10 @@ -100,13 +105,13 @@ OleRegisterMgr::OleRegisterMgr() if (FAILED(::OleInitialize(NULL))) { NS_ASSERTION(0, "***** OLE has not been initialized!\n"); } else { - //printf("***** OLE has been initialized!\n"); + //PRINTF("***** OLE has been initialized!\n"); } } OleRegisterMgr::~OleRegisterMgr() { - //printf("***** OLE has been Uninitialized!\n"); + //PRINTF("***** OLE has been Uninitialized!\n"); ::OleUninitialize(); } @@ -144,7 +149,7 @@ static LONG gLastClickCount = 0; static PRBool is_vk_down(int vk) { SHORT st = GetKeyState(vk); - printf("is_vk_down vk=%x st=%x\n",vk, st); + PRINTF("is_vk_down vk=%x st=%x\n",vk, st); return (st & 0x80) ? PR_TRUE : PR_FALSE; } #define IS_VK_DOWN is_vk_down @@ -1458,7 +1463,7 @@ NS_METHOD nsWindow::Move(PRInt32 aX, PRInt32 aY) ::SystemParametersInfo(SPI_GETWORKAREA, 0, &workArea, 0); // no annoying assertions. just mention the issue. if (aX < 0 || aX >= workArea.right || aY < 0 || aY >= workArea.bottom) - printf("window moved to offscreen position\n"); + PRINTF("window moved to offscreen position\n"); } ::ReleaseDC(mWnd, dc); } @@ -2266,11 +2271,11 @@ PRBool nsWindow::DispatchKeyEvent(PRUint32 aEventType, WORD aCharCode, UINT aVir #ifdef KE_DEBUG static cnt=0; - printf("%d DispatchKE Type: %s charCode %d keyCode %d ", cnt++, + PRINTF("%d DispatchKE Type: %s charCode %d keyCode %d ", cnt++, (NS_KEY_PRESS == aEventType)?"PRESS":(aEventType == NS_KEY_UP?"Up":"Down"), event.charCode, event.keyCode); - printf("Shift: %s Control %s Alt: %s \n", (mIsShiftDown?"D":"U"), (mIsControlDown?"D":"U"), (mIsAltDown?"D":"U")); - printf("[%c][%c][%c] <== [%c][%c][%c][ space bar ][%c][%c][%c]\n", + PRINTF("Shift: %s Control %s Alt: %s \n", (mIsShiftDown?"D":"U"), (mIsControlDown?"D":"U"), (mIsAltDown?"D":"U")); + PRINTF("[%c][%c][%c] <== [%c][%c][%c][ space bar ][%c][%c][%c]\n", IS_VK_DOWN(NS_VK_SHIFT) ? 'S' : ' ', IS_VK_DOWN(NS_VK_CONTROL) ? 'C' : ' ', IS_VK_DOWN(NS_VK_ALT) ? 'A' : ' ', @@ -2281,7 +2286,7 @@ PRBool nsWindow::DispatchKeyEvent(PRUint32 aEventType, WORD aCharCode, UINT aVir IS_VK_DOWN(VK_RCONTROL) ? 'C' : ' ', IS_VK_DOWN(VK_RSHIFT) ? 'S' : ' ' - ); + ); #endif event.isShift = mIsShiftDown; @@ -2319,7 +2324,7 @@ BOOL nsWindow::OnKeyDown( UINT aVirtualKeyCode, UINT aScanCode) aVirtualKeyCode = !mIMEIsComposing?MapFromNativeToDOM(aVirtualKeyCode):aVirtualKeyCode; - //printf("In OnKeyDown ascii %d virt: %d scan: %d\n", asciiKey, aVirtualKeyCode, aScanCode); + //PRINTF("In OnKeyDown ascii %d virt: %d scan: %d\n", asciiKey, aVirtualKeyCode, aScanCode); BOOL result = DispatchKeyEvent(NS_KEY_DOWN, asciiKey, aVirtualKeyCode); @@ -2690,7 +2695,7 @@ void PrintEvent(UINT msg, PRBool aShowAllEvents, PRBool aShowMouseMoves) } if (aShowAllEvents || (!aShowAllEvents && gLastEventMsg != (long)msg)) { if (aShowMouseMoves || (!aShowMouseMoves && msg != 0x0020 && msg != 0x0200 && msg != 0x0084)) { - printf("%6d - 0x%04X %s\n", gEventCounter++, msg, gAllEvents[inx].mStr?gAllEvents[inx].mStr:"Unknown"); + PRINTF("%6d - 0x%04X %s\n", gEventCounter++, msg, gAllEvents[inx].mStr?gAllEvents[inx].mStr:"Unknown"); gLastEventMsg = msg; } } @@ -2766,7 +2771,7 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT MSG wmsg; do { - //printf("fire\n"); + //PRINTF("fire\n"); queue->FireNextReadyTimer(NS_PRIORITY_LOWEST); } while (queue->HasReadyTimers(NS_PRIORITY_LOWEST) && !::PeekMessage(&wmsg, NULL, 0, 0, PM_NOREMOVE)); @@ -2817,7 +2822,7 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT case WM_CHAR: { #ifdef KE_DEBUG - printf("%s\tchar=%c\twp=%4x\tlp=%8x\n", (msg == WM_SYSCHAR) ? "WM_SYSCHAR" : "WM_CHAR" , wParam, wParam, lParam); + PRINTF("%s\tchar=%c\twp=%4x\tlp=%8x\n", (msg == WM_SYSCHAR) ? "WM_SYSCHAR" : "WM_CHAR" , wParam, wParam, lParam); #endif mIsShiftDown = IS_VK_DOWN(NS_VK_SHIFT); @@ -2855,7 +2860,7 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT case WM_SYSKEYUP: case WM_KEYUP: #ifdef KE_DEBUG - printf("%s\t\twp=%x\tlp=%x\n", + PRINTF("%s\t\twp=%x\tlp=%x\n", (WM_KEYUP==msg)?"WM_KEYUP":"WM_SYSKEYUP" , wParam, lParam); #endif mIsShiftDown = IS_VK_DOWN(NS_VK_SHIFT); @@ -2891,7 +2896,7 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT case WM_SYSKEYDOWN: case WM_KEYDOWN: { #ifdef KE_DEBUG - printf("%s\t\twp=%4x\tlp=%8x\n", + PRINTF("%s\t\twp=%4x\tlp=%8x\n", (WM_KEYDOWN==msg)?"WM_KEYDOWN":"WM_SYSKEYDOWN" , wParam, lParam); #endif mIsShiftDown = IS_VK_DOWN(NS_VK_SHIFT); @@ -3205,7 +3210,7 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT // Realize the drawing palette int i = ::RealizePalette(hDC); - //printf("number of colors that changed=%d\n",i); + //PRINTF("number of colors that changed=%d\n",i); // we should always invalidate.. because the lookup may have changed ::InvalidateRect(mWnd, (LPRECT)NULL, TRUE); @@ -3268,7 +3273,7 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT for (UINT iFile = 0; iFile < nFiles; iFile++) { TCHAR szFileName[_MAX_PATH]; ::DragQueryFile(hDropInfo, iFile, szFileName, _MAX_PATH); - printf("szFileName [%s]\n", szFileName); + PRINTF("szFileName [%s]\n", szFileName); nsAutoString fileStr(szFileName); nsEventStatus status; nsDragDropEvent event; @@ -3368,7 +3373,7 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT } #ifdef DEBUG else - printf("WARNING: couldn't get child window for MW event\n"); + PRINTF("WARNING: couldn't get child window for MW event\n"); #endif } @@ -3842,8 +3847,8 @@ PRBool nsWindow::DispatchMouseEvent(PRUint32 aEventType, nsPoint* aPoint) mp.x = LOWORD(pos); mp.y = HIWORD(pos); - //printf("Msg: %d Last: %d Dif: %d Max %d\n", curMsgTime, gLastMsgTime, curMsgTime-gLastMsgTime, ::GetDoubleClickTime()); - //printf("Mouse %d %d\n", abs(gLastMousePoint.x - mp.x), abs(gLastMousePoint.y - mp.y)); + //PRINTF("Msg: %d Last: %d Dif: %d Max %d\n", curMsgTime, gLastMsgTime, curMsgTime-gLastMsgTime, ::GetDoubleClickTime()); + //PRINTF("Mouse %d %d\n", abs(gLastMousePoint.x - mp.x), abs(gLastMousePoint.y - mp.y)); if (((curMsgTime - gLastMsgTime) < (LONG)::GetDoubleClickTime()) && (((abs(gLastMousePoint.x - mp.x) < kDoubleClickMoveThreshold) && (abs(gLastMousePoint.y - mp.y) < kDoubleClickMoveThreshold)))) { @@ -3855,7 +3860,7 @@ PRBool nsWindow::DispatchMouseEvent(PRUint32 aEventType, nsPoint* aPoint) event.clickCount = gLastClickCount; } - //printf("Msg Time: %d Click Count: %d\n", curMsgTime, event.clickCount); + //PRINTF("Msg Time: %d Click Count: %d\n", curMsgTime, event.clickCount); gLastMsgTime = curMsgTime; #endif @@ -3998,7 +4003,7 @@ PRBool nsWindow::DispatchMouseEvent(PRUint32 aEventType, nsPoint* aPoint) gCurrentWindow = this; } } else { - //printf("Mouse exit"); + //PRINTF("Mouse exit"); } } break; @@ -4249,7 +4254,7 @@ nsWindow::HandleTextEvent(HIMC hIMEContext,PRBool aCheckAttr) candForm.ptCurrentPos.y = event.theReply.mCursorPosition.y + IME_Y_OFFSET + event.theReply.mCursorPosition.height ; - printf("Candidate window position: x=%d, y=%d\n",candForm.ptCurrentPos.x,candForm.ptCurrentPos.y); + PRINTF("Candidate window position: x=%d, y=%d\n",candForm.ptCurrentPos.x,candForm.ptCurrentPos.y); NS_IMM_SETCANDIDATEWINDOW(hIMEContext,&candForm); @@ -4280,7 +4285,7 @@ nsWindow::HandleStartComposition(HIMC hIMEContext) candForm.ptCurrentPos.y = event.theReply.mCursorPosition.y + IME_Y_OFFSET + event.theReply.mCursorPosition.height; #ifdef DEBUG_IME2 - printf("Candidate window position: x=%d, y=%d\n",candForm.ptCurrentPos.x,candForm.ptCurrentPos.y); + PRINTF("Candidate window position: x=%d, y=%d\n",candForm.ptCurrentPos.x,candForm.ptCurrentPos.y); #endif NS_IMM_SETCANDIDATEWINDOW(hIMEContext, &candForm); NS_RELEASE(event.widget); @@ -4431,7 +4436,7 @@ nsWindow::MapDBCSAtrributeArrayToUnicodeOffsets(PRUint32* textRangeListLengthRes BOOL nsWindow::OnInputLangChange(HKL aHKL, LRESULT *oRetValue) { #ifdef KE_DEBUG - printf("OnInputLanguageChange\n"); + PRINTF("OnInputLanguageChange\n"); #endif @@ -4448,7 +4453,7 @@ BOOL nsWindow::OnInputLangChange(HKL aHKL, LRESULT *oRetValue) BOOL nsWindow::OnIMEChar(BYTE aByte1, BYTE aByte2, LPARAM aKeyState) { #ifdef DEBUG_IME - printf("OnIMEChar\n"); + PRINTF("OnIMEChar\n"); #endif NS_ASSERTION(PR_TRUE, "should not got an WM_IME_CHAR"); @@ -4459,7 +4464,7 @@ BOOL nsWindow::OnIMEChar(BYTE aByte1, BYTE aByte2, LPARAM aKeyState) BOOL nsWindow::OnIMEComposition(LPARAM aGCS) { #ifdef DEBUG_IME - printf("OnIMEComposition\n"); + PRINTF("OnIMEComposition\n"); #endif NS_ASSERTION( mIMECompString, "mIMECompString is null"); NS_ASSERTION( mIMECompUnicode, "mIMECompUnicode is null"); @@ -4478,7 +4483,7 @@ BOOL nsWindow::OnIMEComposition(LPARAM aGCS) // if (aGCS & GCS_RESULTSTR) { #ifdef DEBUG_IME - fprintf(stderr,"Handling GCS_RESULTSTR\n"); + PRINTF("Handling GCS_RESULTSTR\n"); #endif if(! mIMEIsComposing) HandleStartComposition(hIMEContext); @@ -4512,7 +4517,7 @@ BOOL nsWindow::OnIMEComposition(LPARAM aGCS) mIMECompString->mLength = compStrLen; } #ifdef DEBUG_IME - fprintf(stderr,"GCS_RESULTSTR compStrLen = %d\n", compStrLen); + PRINTF("GCS_RESULTSTR compStrLen = %d\n", compStrLen); #endif result = PR_TRUE; HandleTextEvent(hIMEContext, PR_FALSE); @@ -4527,7 +4532,7 @@ BOOL nsWindow::OnIMEComposition(LPARAM aGCS) (GCS_COMPSTR | GCS_COMPATTR | GCS_COMPCLAUSE | GCS_CURSORPOS )) { #ifdef DEBUG_IME - fprintf(stderr,"Handling GCS_COMPSTR\n"); + PRINTF("Handling GCS_COMPSTR\n"); #endif if(! mIMEIsComposing) @@ -4651,7 +4656,7 @@ BOOL nsWindow::OnIMEComposition(LPARAM aGCS) mIMECompString->mLength = compStrLen; } #ifdef DEBUG_IME - fprintf(stderr,"GCS_COMPSTR compStrLen = %d\n", compStrLen); + PRINTF("GCS_COMPSTR compStrLen = %d\n", compStrLen); #endif #ifdef DEBUG for(int kk=0;kkGetTimeToNextTimeoutFunc(&sFunc); #ifdef DEBUG_ramiro - printf("Time to next timeout func is null - for now.\n"); + PRINTF("Time to next timeout func is null - for now.\n"); static int once = 1; @@ -150,7 +155,7 @@ static nsXlibTimeToNextTimeoutFunc GetTimeToNextTimeoutFunc(void) { once = 0; - printf("YES! Time to next timeout func is good.\n"); + PRINTF("YES! Time to next timeout func is good.\n"); } #endif @@ -180,7 +185,7 @@ static nsXlibProcessTimeoutsProc GetProcessTimeoutsProc(void) xlibWindowService->GetProcessTimeoutsProc(&sProc); #ifdef DEBUG_ramiro - printf("Process timeout proc is null - for now.\n"); + PRINTF("Process timeout proc is null - for now.\n"); static int once = 1; @@ -188,7 +193,7 @@ static nsXlibProcessTimeoutsProc GetProcessTimeoutsProc(void) { once = 0; - printf("YES! Process timeout proc is good.\n"); + PRINTF("YES! Process timeout proc is good.\n"); } #endif @@ -284,7 +289,7 @@ NS_METHOD nsAppShell::Create(int* argc, char ** argv) if (mDisplay == NULL) { - fprintf(stderr, "%s: Cannot connect to X server %s\n", + PRINTF("%s: Cannot connect to X server %s\n", argv[0], XDisplayName(NULL)); @@ -366,7 +371,7 @@ nsresult nsAppShell::Run() return NS_ERROR_NOT_INITIALIZED; } - printf("Getting the xlib connection number.\n"); + PRINTF("Getting the xlib connection number.\n"); xlib_fd = ConnectionNumber(mDisplay); // process events. while (DieAppShellDie == PR_FALSE) { @@ -394,7 +399,7 @@ nsresult nsAppShell::Run() FD_SET(queue_fd, &select_set); FD_SET(xlib_fd, &select_set); - //printf("cur time: %ld %ld\n", cur_time.tv_sec, cur_time.tv_usec); + //PRINTF("cur time: %ld %ld\n", cur_time.tv_sec, cur_time.tv_usec); if (CallTimeToNextTimeoutFunc(&cur_time) == 0) { cur_time_ptr = NULL; } @@ -415,7 +420,7 @@ nsresult nsAppShell::Run() DelayTime.tv_usec = 100; select_retval = select(max_fd, &select_set, NULL, NULL, &DelayTime); if (select_retval == -1) { - fprintf(stderr, "Select returned error: %s.\n", strerror(errno)); + PRINTF("Select returned error: %s.\n", strerror(errno)); return NS_ERROR_FAILURE; } @@ -981,7 +986,7 @@ nsAppShell::HandleKeyPressEvent(XEvent *event, nsWidget *aWidget) keyEvent.widget = focusWidget; keyEvent.eventStructType = NS_KEY_EVENT; - // printf("keysym = %x, keycode = %x, vk = %x\n", + // PRINTF("keysym = %x, keycode = %x, vk = %x\n", // keysym, // event->xkey.keycode, // keyEvent.keyCode); @@ -1217,10 +1222,10 @@ void nsAppShell::HandleUnmapNotifyEvent(XEvent *event, nsWidget *aWidget) void nsAppShell::HandleClientMessageEvent(XEvent *event, nsWidget *aWidget) { // check to see if it's a WM_DELETE message - printf("handling client message\n"); + PRINTF("handling client message\n"); if (nsWidget::WMProtocolsInitialized) { if ((Atom)event->xclient.data.l[0] == nsWidget::WMDeleteWindow) { - printf("got a delete window event\n"); + PRINTF("got a delete window event\n"); aWidget->OnDeleteWindow(); } } diff --git a/mozilla/widget/src/xlib/nsClipboard.cpp b/mozilla/widget/src/xlib/nsClipboard.cpp index 42089dc5c74..ceb67878b1a 100644 --- a/mozilla/widget/src/xlib/nsClipboard.cpp +++ b/mozilla/widget/src/xlib/nsClipboard.cpp @@ -49,6 +49,11 @@ #include "nsVoidArray.h" #include "xlibrgb.h" +#include "nslog.h" + +NS_IMPL_LOG(nsClipboardLog, 0) +#define PRINTF NS_LOG_PRINTF(nsClipboardLog) +#define FLUSH NS_LOG_FLUSH(nsClipboardLog) #include "nsIServiceManager.h" @@ -105,7 +110,7 @@ nsEventStatus PR_CALLBACK nsClipboard::Callback(nsGUIEvent *event) { // Check the event type if (ev->type == SelectionRequest) { if (mTransferable == nsnull) { - fprintf(stderr, "nsClipboard::Callback: null transferable\n"); + PRINTF("nsClipboard::Callback: null transferable\n"); return nsEventStatus_eIgnore; } @@ -184,7 +189,7 @@ NS_IMETHODIMP nsClipboard::SetNativeClipboardData(PRInt32 aWhichClipboard) // bomb out if we cannot get ownership. if (XSetSelectionOwner(sDisplay, XA_PRIMARY, sWindow, CurrentTime)) if (XGetSelectionOwner(sDisplay, XA_PRIMARY) != sWindow) { - fprintf(stderr, "nsClipboard::SetData: Cannot get ownership\n"); + PRINTF("nsClipboard::SetData: Cannot get ownership\n"); return NS_ERROR_FAILURE; } @@ -202,7 +207,7 @@ NS_IMETHODIMP nsClipboard::SetNativeClipboardData(PRInt32 aWhichClipboard) // make sure we have a good transferable if (nsnull == transferable) { #ifdef DEBUG_faulkner - fprintf(stderr, "nsClipboard::SetNativeClipboardData(): no transferable!\n"); + PRINTF("nsClipboard::SetNativeClipboardData(): no transferable!\n"); #endif /* DEBUG_faulkner */ return NS_ERROR_FAILURE; } @@ -238,7 +243,7 @@ NS_IMETHODIMP nsClipboard::SetData(nsITransferable *aTransferable, { if (XSetSelectionOwner(sDisplay, XA_PRIMARY, sWindow, CurrentTime)) if (XGetSelectionOwner(sDisplay, XA_PRIMARY) != sWindow) { - fprintf(stderr, "nsClipboard::SetData: Cannot get ownership\n"); + PRINTF("nsClipboard::SetData: Cannot get ownership\n"); return NS_ERROR_FAILURE; } @@ -280,7 +285,7 @@ NS_IMETHODIMP nsClipboard::GetData(nsITransferable *aTransferable, int i; if (aTransferable == nsnull) { - fprintf(stderr, "nsClipboard::GetData: NULL transferable\n"); + PRINTF("nsClipboard::GetData: NULL transferable\n"); return NS_ERROR_FAILURE; } diff --git a/mozilla/widget/src/xlib/nsDragService.cpp b/mozilla/widget/src/xlib/nsDragService.cpp index c20559d7afb..721fad291a5 100644 --- a/mozilla/widget/src/xlib/nsDragService.cpp +++ b/mozilla/widget/src/xlib/nsDragService.cpp @@ -35,6 +35,11 @@ #include #include "xlibrgb.h" +#include "nslog.h" + +NS_IMPL_LOG(nsDragServiceLog, 0) +#define PRINTF NS_LOG_PRINTF(nsDragServiceLog) +#define FLUSH NS_LOG_FLUSH(nsDragServiceLog) NS_IMPL_ADDREF_INHERITED(nsDragService, nsBaseDragService) NS_IMPL_RELEASE_INHERITED(nsDragService, nsBaseDragService) @@ -77,7 +82,7 @@ NS_IMETHODIMP nsDragService::InvokeDragSession (nsIDOMNode *aDOMNode, return NS_ERROR_FAILURE; if (numItemsToDrag > 1) { - fprintf(stderr, "nsDragService: Cannot drag more than one item!\n"); + PRINTF("nsDragService: Cannot drag more than one item!\n"); return NS_ERROR_FAILURE; } mDragging = PR_TRUE; @@ -98,14 +103,14 @@ NS_IMETHODIMP nsDragService::InvokeDragSession (nsIDOMNode *aDOMNode, CWOverrideRedirect, &wattr); attr.valuemask = 0; - fprintf(stderr, "%s\n", XpmGetErrorString( + PRINTF("%s\n", XpmGetErrorString( XpmCreatePixmapFromData(xlib_rgb_get_display(), sWindow, drag_xpm, &aPixmap, &aShapeMask, &attr)) - ); + ); wmHints.flags = StateHint; wmHints.initial_state = NormalState; XSetWMProperties(xlib_rgb_get_display(), sWindow, NULL, NULL, NULL, 0, NULL, diff --git a/mozilla/widget/src/xlib/nsSound.cpp b/mozilla/widget/src/xlib/nsSound.cpp index db7535dcbe4..7fad24a2400 100644 --- a/mozilla/widget/src/xlib/nsSound.cpp +++ b/mozilla/widget/src/xlib/nsSound.cpp @@ -34,6 +34,11 @@ #include #include +#include "nslog.h" + +NS_IMPL_LOG(nsSoundLog, 0) +#define PRINTF NS_LOG_PRINTF(nsSoundLog) +#define FLUSH NS_LOG_FLUSH(nsSoundLog) NS_IMPL_THREADSAFE_ISUPPORTS2(nsSound, nsISound, nsIStreamLoaderObserver); @@ -53,7 +58,7 @@ nsresult nsSound::Init() { #ifdef DEBUG_faulkner - fprintf(stderr, "\n////////// nsSound::Init() in xlib called //////////\n"); + PRINTF("\n////////// nsSound::Init() in xlib called //////////\n"); #endif /* DEBUG_faulkner */ return NS_OK; } @@ -65,7 +70,7 @@ NS_IMETHODIMP nsSound::OnStreamComplete(nsIStreamLoader *aLoader, const char *string) { #ifdef DEBUG_faulkner - fprintf(stderr, "\n////////// nsSound::Init() in xlib called //////////\n"); + PRINTF("\n////////// nsSound::Init() in xlib called //////////\n"); #endif /* DEBUG_faulkner */ return NS_OK; } @@ -73,7 +78,7 @@ NS_IMETHODIMP nsSound::OnStreamComplete(nsIStreamLoader *aLoader, NS_METHOD nsSound::Beep() { #ifdef DEBUG_faulkner - fprintf(stderr, "\n////////// nsSound::Beep() in xlib called //////////\n"); + PRINTF("\n////////// nsSound::Beep() in xlib called //////////\n"); #endif /* DEBUG_faulkner */ return NS_OK; } @@ -81,7 +86,7 @@ NS_METHOD nsSound::Beep() NS_METHOD nsSound::Play(nsIURL *aURL) { #ifdef DEBUG_faulkner - fprintf(stderr, "\n////////// nsSound::Play() in xlib called //////////\n"); + PRINTF("\n////////// nsSound::Play() in xlib called //////////\n"); #endif /* DEBUG_faulkner */ return NS_OK; } diff --git a/mozilla/widget/src/xlib/nsToolkit.cpp b/mozilla/widget/src/xlib/nsToolkit.cpp index 178a4798d38..a7285ede5cc 100644 --- a/mozilla/widget/src/xlib/nsToolkit.cpp +++ b/mozilla/widget/src/xlib/nsToolkit.cpp @@ -23,6 +23,11 @@ #include "nsToolkit.h" #include "nsGUIEvent.h" #include "plevent.h" +#include "nslog.h" + +NS_IMPL_LOG(nsToolkitLog, 0) +#define PRINTF NS_LOG_PRINTF(nsToolkitLog) +#define FLUSH NS_LOG_FLUSH(nsToolkitLog) // Static Thread Local Storage index of the toolkit object associated with // a given thread... @@ -69,10 +74,10 @@ NS_METHOD NS_GetCurrentToolkit(nsIToolkit* *aResult) // Create a new toolkit for this thread if (!toolkit) { - fprintf(stderr, "Creating a new nsIToolkit!\n"); + PRINTF("Creating a new nsIToolkit!\n"); } else - fprintf(stderr, "No need to create a new nsIToolkit!\n"); + PRINTF("No need to create a new nsIToolkit!\n"); } return NS_OK; diff --git a/mozilla/widget/src/xlib/nsWidget.cpp b/mozilla/widget/src/xlib/nsWidget.cpp index bf50b85fa6c..cbdb760e2f6 100644 --- a/mozilla/widget/src/xlib/nsWidget.cpp +++ b/mozilla/widget/src/xlib/nsWidget.cpp @@ -40,6 +40,11 @@ #include "nsIMenuRollup.h" #include "xlibrgb.h" +#include "nslog.h" + +NS_IMPL_LOG(nsWidgetLog, 0) +#define PRINTF NS_LOG_PRINTF(nsWidgetLog) +#define FLUSH NS_LOG_FLUSH(nsWidgetLog) static NS_DEFINE_CID(kRegionCID, NS_REGION_CID); @@ -553,7 +558,7 @@ void * nsWidget::GetNativeData(PRUint32 aDataType) return (void *)mGC; break; default: - fprintf(stderr, "nsWidget::GetNativeData(%d) called with crap value.\n", + PRINTF("nsWidget::GetNativeData(%d) called with crap value.\n", aDataType); return NULL; break; @@ -907,7 +912,7 @@ nsWidget::OnPaint(nsPaintEvent &event) if (event.rect) { - printf("%4d nsWidget::OnPaint (this=%p,name=%s,xid=%p,rect=%d,%d,%d,%d)\n", + PRINTF("%4d nsWidget::OnPaint (this=%p,name=%s,xid=%p,rect=%d,%d,%d,%d)\n", sPrintCount++, (void *) this, (const char *) nsCAutoString(mName), @@ -915,15 +920,15 @@ nsWidget::OnPaint(nsPaintEvent &event) event.rect->x, event.rect->y, event.rect->width, - event.rect->height); + event.rect->height); } else { - printf("%4d nsWidget::OnPaint (this=%p,name=%s,xid=%p,rect=none)\n", + PRINTF("%4d nsWidget::OnPaint (this=%p,name=%s,xid=%p,rect=none)\n", sPrintCount++, (void *) this, (const char *) nsCAutoString(mName), - (void *) mBaseWindow); + (void *) mBaseWindow); } #endif @@ -956,7 +961,7 @@ PRBool nsWidget::IsMouseInWindow(nsIWidget* inWidget, PRInt32 inMouseX, PRInt32 // Get the origin (top left corner) coordinate and size Window currentPopupWindow = (Window)inWidget->GetNativeData(NS_NATIVE_WINDOW); if (XGetWindowAttributes(mDisplay, currentPopupWindow, &inWindowAttributes) == 0){ - fprintf(stderr, "Failed calling XGetWindowAttributes in nsWidget::IsMouseInWindow"); + PRINTF("Failed calling XGetWindowAttributes in nsWidget::IsMouseInWindow"); return PR_FALSE; } @@ -972,21 +977,21 @@ PRBool nsWidget::IsMouseInWindow(nsIWidget* inWidget, PRInt32 inMouseX, PRInt32 if (!XTranslateCoordinates(mDisplay, mBaseWindow, rootWindow, inMouseX, inMouseY, &root_inMouse_x, &root_inMouse_y, &returnedChild)){ - fprintf(stderr, "Could not get coordinates for origin coordinates for mouseclick\n"); + PRINTF("Could not get coordinates for origin coordinates for mouseclick\n"); // should we return true or false?????? return PR_FALSE; } - //fprintf(stderr, "Here are the mouse click coordinates x:%i y%i\n", root_inMouse_x, root_inMouse_y); + //PRINTF("Here are the mouse click coordinates x:%i y%i\n", root_inMouse_x, root_inMouse_y); // Test using coordinates relative to root window if click was inside passed popup window if (root_inMouse_x > inWindowAttributes.x && root_inMouse_x < (inWindowAttributes.x + inWindowAttributes.width) && root_inMouse_y > inWindowAttributes.y && root_inMouse_y < (inWindowAttributes.y + inWindowAttributes.height)){ - //fprintf(stderr, "Mouse click INSIDE passed popup\n"); + //PRINTF("Mouse click INSIDE passed popup\n"); return PR_TRUE; } - //fprintf(stderr, "Mouse click OUTSIDE of passed popup\n"); + //PRINTF("Mouse click OUTSIDE of passed popup\n"); return PR_FALSE; } @@ -1037,7 +1042,7 @@ PRBool nsWidget::HandlePopup ( PRInt32 inMouseX, PRInt32 inMouseY ){ } if (rollup){ - //fprintf(stderr, "Calling gRollupListener->Rollup()\n"); + //PRINTF("Calling gRollupListener->Rollup()\n"); gRollupListener->Rollup(); retVal = PR_TRUE; } @@ -1060,7 +1065,7 @@ void nsWidget::OnDestroy() PRBool nsWidget::OnDeleteWindow(void) { - printf("nsWidget::OnDeleteWindow()\n"); + PRINTF("nsWidget::OnDeleteWindow()\n"); nsBaseWidget::OnDestroy(); // emit a destroy signal return DispatchDestroyEvent(); @@ -1206,15 +1211,15 @@ nsWidget::DebugPrintEvent(nsGUIEvent & aEvent, nsCAutoString eventString; eventString.AssignWithConversion(debug_GuiEventToString(&aEvent)); - printf("%4d %-26s(this=%-8p , window=%-8p", + PRINTF("%4d %-26s(this=%-8p , window=%-8p", sPrintCount++, (const char *) eventString, this, (void *) aWindow); - printf(" , x=%-3d, y=%d)",aEvent.point.x,aEvent.point.y); + PRINTF(" , x=%-3d, y=%d)",aEvent.point.x,aEvent.point.y); - printf("\n"); + PRINTF("\n"); } #endif // DEBUG ////////////////////////////////////////////////////////////////// diff --git a/mozilla/widget/src/xlib/window_service/nsXlibWindowServiceFactory.cpp b/mozilla/widget/src/xlib/window_service/nsXlibWindowServiceFactory.cpp index 486237808fd..8bdf27d5b88 100644 --- a/mozilla/widget/src/xlib/window_service/nsXlibWindowServiceFactory.cpp +++ b/mozilla/widget/src/xlib/window_service/nsXlibWindowServiceFactory.cpp @@ -30,6 +30,11 @@ #include "nsCOMPtr.h" #include "nsXlibWindowService.h" +#include "nslog.h" + +NS_IMPL_LOG(nsXlibWindowServiceFactoryLog, 0) +#define PRINTF NS_LOG_PRINTF(nsXlibWindowServiceFactoryLog) +#define FLUSH NS_LOG_FLUSH(nsXlibWindowServiceFactoryLog) static NS_DEFINE_CID(kCXlibWindowServiceCID, NS_XLIB_WINDOW_SERVICE_CID); static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID); @@ -125,7 +130,7 @@ NSRegisterSelf(nsISupports* aServMgr, const char *fullpath) nsresult rv; #ifdef NS_DEBUG - printf("*** Registering XlibWindowService\n"); + PRINTF("*** Registering XlibWindowService\n"); #endif nsCOMPtr diff --git a/mozilla/widget/src/xpwidgets/nsBaseWidget.cpp b/mozilla/widget/src/xpwidgets/nsBaseWidget.cpp index c2eb5e5c685..7ef4f092548 100644 --- a/mozilla/widget/src/xpwidgets/nsBaseWidget.cpp +++ b/mozilla/widget/src/xpwidgets/nsBaseWidget.cpp @@ -41,6 +41,13 @@ static void debug_RegisterPrefCallbacks(); static PRInt32 gNumWidgets; #endif +#include "nslog.h" +#undef fprintf + +NS_IMPL_LOG(nsBaseWidgetLog, 0) +#define PRINTF NS_LOG_PRINTF(nsBaseWidgetLog) +#define FLUSH NS_LOG_FLUSH(nsBaseWidgetLog) + // nsBaseWidget NS_IMPL_ISUPPORTS1(nsBaseWidget, nsIWidget) @@ -75,7 +82,7 @@ nsBaseWidget::nsBaseWidget() { #ifdef NOISY_WIDGET_LEAKS gNumWidgets++; - printf("WIDGETS+ = %d\n", gNumWidgets); + PRINTF("WIDGETS+ = %d\n", gNumWidgets); #endif #ifdef NS_DEBUG @@ -97,7 +104,7 @@ nsBaseWidget::~nsBaseWidget() { #ifdef NOISY_WIDGET_LEAKS gNumWidgets--; - printf("WIDGETS- = %d\n", gNumWidgets); + PRINTF("WIDGETS- = %d\n", gNumWidgets); #endif NS_IF_RELEASE(mMenuListener); diff --git a/mozilla/widget/src/xpwidgets/nsTransferable.cpp b/mozilla/widget/src/xpwidgets/nsTransferable.cpp index abe3b48d2b6..8b82ca74b37 100644 --- a/mozilla/widget/src/xpwidgets/nsTransferable.cpp +++ b/mozilla/widget/src/xpwidgets/nsTransferable.cpp @@ -47,6 +47,11 @@ Notes to self: #include "nsIInputStream.h" #include "nsSpecialSystemDirectory.h" +#include "nslog.h" + +NS_IMPL_LOG(nsTransferableLog, 0) +#define PRINTF NS_LOG_PRINTF(nsTransferableLog) +#define FLUSH NS_LOG_FLUSH(nsTransferableLog) NS_IMPL_ADDREF(nsTransferable) NS_IMPL_RELEASE(nsTransferable) @@ -97,14 +102,14 @@ DataStruct::SetData ( nsISupports* aData, PRUint32 aDataLen ) if (aDataLen > LARGE_DATASET_SIZE) { // if so, cache it to disk instead of memory if ( NS_SUCCEEDED(WriteCache(aData, aDataLen)) ) { - printf("->>>>>>>>>>>>>> Wrote Clipboard to cache file\n"); + PRINTF("->>>>>>>>>>>>>> Wrote Clipboard to cache file\n"); return; } else - printf("->>>>>>>>>>>>>> Writing Clipboard to cache file FAILED\n"); + PRINTF("->>>>>>>>>>>>>> Writing Clipboard to cache file FAILED\n"); } else { - printf("->>>>>>>>>>>>>> Write Clipboard to memory\n"); + PRINTF("->>>>>>>>>>>>>> Write Clipboard to memory\n"); } mData = aData; @@ -121,7 +126,7 @@ DataStruct::GetData ( nsISupports** aData, PRUint32 *aDataLen ) // if so, read it in and pass it back // ReadCache creates memory and copies the data into it. if ( NS_SUCCEEDED(ReadCache(aData, aDataLen)) ) { - printf("->>>>>>>>>>>>>> Read Clipboard from cache file\n"); + PRINTF("->>>>>>>>>>>>>> Read Clipboard from cache file\n"); return; } else { @@ -132,7 +137,7 @@ DataStruct::GetData ( nsISupports** aData, PRUint32 *aDataLen ) return; } } else { - printf("->>>>>>>>>>>>>> Read Clipboard from memory\n"); + PRINTF("->>>>>>>>>>>>>> Read Clipboard from memory\n"); } *aData = mData; diff --git a/mozilla/widget/src/xpwidgets/nsXPLookAndFeel.cpp b/mozilla/widget/src/xpwidgets/nsXPLookAndFeel.cpp index f0385437b5d..e7e917a56a3 100644 --- a/mozilla/widget/src/xpwidgets/nsXPLookAndFeel.cpp +++ b/mozilla/widget/src/xpwidgets/nsXPLookAndFeel.cpp @@ -22,6 +22,11 @@ #include "nsXPLookAndFeel.h" #include "nsIServiceManager.h" +#include "nslog.h" + +NS_IMPL_LOG(nsXPLookAndFeelLog, 0) +#define PRINTF NS_LOG_PRINTF(nsXPLookAndFeelLog) +#define FLUSH NS_LOG_FLUSH(nsXPLookAndFeelLog) static NS_DEFINE_IID(kILookAndFeelIID, NS_ILOOKANDFEEL_IID); static NS_DEFINE_CID(kPrefServiceCID, NS_PREF_CID); @@ -194,7 +199,7 @@ static int PR_CALLBACK intPrefChanged (const char *newpref, void *data) np->intVar = intpref; np->isSet = PR_TRUE; #ifdef DEBUG_akkana - printf("====== Changed int pref %s to %d\n", np->name, np->intVar); + PRINTF("====== Changed int pref %s to %d\n", np->name, np->intVar); #endif } } @@ -218,7 +223,7 @@ static int PR_CALLBACK floatPrefChanged (const char *newpref, void *data) np->floatVar = (float)intpref / 100.; np->isSet = PR_TRUE; #ifdef DEBUG_akkana - printf("====== Changed float pref %s to %f\n", np->name, np->floatVar); + PRINTF("====== Changed float pref %s to %f\n", np->name, np->floatVar); #endif } } @@ -246,7 +251,7 @@ static int PR_CALLBACK colorPrefChanged (const char *newpref, void *data) np->isSet = PR_TRUE; np->colorVar = (nscolor)thecolor; #ifdef DEBUG_akkana - printf("====== Changed color pref %s to 0x%lx\n", + PRINTF("====== Changed color pref %s to 0x%lx\n", np->name, (long)np->colorVar); #endif } diff --git a/mozilla/widget/timer/src/rhapsody/nsTimer.cpp b/mozilla/widget/timer/src/rhapsody/nsTimer.cpp index cb0a1229448..6992c1aea3e 100644 --- a/mozilla/widget/timer/src/rhapsody/nsTimer.cpp +++ b/mozilla/widget/timer/src/rhapsody/nsTimer.cpp @@ -25,6 +25,11 @@ #include "prlog.h" #include #include +#include "nslog.h" + +NS_IMPL_LOG(nsTimerLog, 0) +#define PRINTF NS_LOG_PRINTF(nsTimerLog) +#define FLUSH NS_LOG_FLUSH(nsTimerLog) // // Copied from the unix version, Rhapsody needs to @@ -146,7 +151,7 @@ TimerImpl::Init(nsTimerCallbackFunc aFunc, mClosure = aClosure; // mRepeat = aRepeat; - printf("TimerImpl::Init() not implemented\n"); + PRINTF("TimerImpl::Init() not implemented\n"); #ifdef RHAPSODY_NEEDS_TO_IMPLEMENT_THIS mTimerId = XtAppAddTimeOut(gAppContext, aDelay,(XtTimerCallbackProc)nsTimerExpired, this); @@ -165,7 +170,7 @@ TimerImpl::Init(nsITimerCallback *aCallback, mCallback = aCallback; // mRepeat = aRepeat; -printf("TimerImpl::Init() not implmented.\n"); + PRINTF("TimerImpl::Init() not implmented.\n"); #ifdef RHAPSODY_NEEDS_TO_IMPLEMENT_THIS mTimerId = XtAppAddTimeOut(gAppContext, aDelay, (XtTimerCallbackProc)nsTimerExpired, this); @@ -190,7 +195,7 @@ void TimerImpl::Cancel() { - printf("TimerImpl::Cancel() not implemented.\n"); + PRINTF("TimerImpl::Cancel() not implemented.\n"); #ifdef RHAPSODY_NEEDS_TO_IMPLEMENT_THIS XtRemoveTimeOut(mTimerId); diff --git a/mozilla/widget/timer/src/unix/gtk/nsTimerGtk.cpp b/mozilla/widget/timer/src/unix/gtk/nsTimerGtk.cpp index cf6c392c99e..ef65b3c9e0a 100644 --- a/mozilla/widget/timer/src/unix/gtk/nsTimerGtk.cpp +++ b/mozilla/widget/timer/src/unix/gtk/nsTimerGtk.cpp @@ -27,6 +27,11 @@ #include "nsVoidArray.h" #include "nsTimerGtk.h" #include "nsCOMPtr.h" +#include "nslog.h" + +NS_IMPL_LOG(nsTimerGtkLog, 0) +#define PRINTF NS_LOG_PRINTF(nsTimerGtkLog) +#define FLUSH NS_LOG_FLUSH(nsTimerGtkLog) static NS_DEFINE_IID(kITimerIID, NS_ITIMER_IID); @@ -174,7 +179,7 @@ PRBool TimeVal::operator<=(const struct timeval &tv) const PRBool nsTimerGtk::FireTimeout() { - // printf("%p FireTimeout() priority = %i\n", this, mPriority); + // PRINTF("%p FireTimeout() priority = %i\n", this, mPriority); // because Notify can cause 'this' to get destroyed, we need to hold a ref nsCOMPtr kungFuDeathGrip = this; @@ -213,7 +218,7 @@ PRBool nsTimerGtk::gProcessingTimer = PR_FALSE; nsTimerGtk::nsTimerGtk() { - // printf("nsTimerGtke::nsTimerGtk called for %p\n", this); + // PRINTF("nsTimerGtke::nsTimerGtk called for %p\n", this); NS_INIT_REFCNT(); mFunc = NULL; mCallback = NULL; @@ -225,7 +230,7 @@ nsTimerGtk::nsTimerGtk() nsTimerGtk::~nsTimerGtk() { -// printf("nsTimerGtk::~nsTimerGtk called for %p\n", this); +// PRINTF("nsTimerGtk::~nsTimerGtk called for %p\n", this); Cancel(); NS_IF_RELEASE(mCallback); } @@ -291,7 +296,7 @@ nsresult nsTimerGtk::Init(nsTimerCallbackFunc aFunc, PRUint32 aPriority, PRUint32 aType) { - //printf("%p nsTimerGtk::Init() mDelay = %i\n", this, aDelay); + //PRINTF("%p nsTimerGtk::Init() mDelay = %i\n", this, aDelay); mFunc = aFunc; mClosure = aClosure; mPriority = aPriority; diff --git a/mozilla/widget/timer/src/unix/motif/nsTimerMotif.cpp b/mozilla/widget/timer/src/unix/motif/nsTimerMotif.cpp index 51511d3aea7..f48d9c7b098 100644 --- a/mozilla/widget/timer/src/unix/motif/nsTimerMotif.cpp +++ b/mozilla/widget/timer/src/unix/motif/nsTimerMotif.cpp @@ -32,6 +32,11 @@ #include "nsIComponentManager.h" #include "nsIMotifAppContextService.h" +#include "nslog.h" + +NS_IMPL_LOG(nsTimerMotifLog, 0) +#define PRINTF NS_LOG_PRINTF(nsTimerMotifLog) +#define FLUSH NS_LOG_FLUSH(nsTimerMotifLog) static NS_DEFINE_IID(kITimerIID, NS_ITIMER_IID); @@ -158,7 +163,7 @@ nsTimerMotif::EnsureAppContext() if (ac_service) { - printf("nsTimerMotif::EnsureAppContext() ac_service = %p\n",ac_service); + PRINTF("nsTimerMotif::EnsureAppContext() ac_service = %p\n",ac_service); nsresult rv2 = ac_service->GetAppContext(&gsAppContext); @@ -168,7 +173,7 @@ nsTimerMotif::EnsureAppContext() NS_RELEASE(ac_service); - printf("nsTimerMotif::EnsureAppContext() gsAppContext = %p\n",gsAppContext); + PRINTF("nsTimerMotif::EnsureAppContext() gsAppContext = %p\n",gsAppContext); } } diff --git a/mozilla/widget/timer/src/unix/motif/nsTimerMotifFactory.cpp b/mozilla/widget/timer/src/unix/motif/nsTimerMotifFactory.cpp index a52648098f7..be18c7b627b 100644 --- a/mozilla/widget/timer/src/unix/motif/nsTimerMotifFactory.cpp +++ b/mozilla/widget/timer/src/unix/motif/nsTimerMotifFactory.cpp @@ -30,6 +30,11 @@ #include "nsIComponentManager.h" #include "nsIServiceManager.h" #include "nsCOMPtr.h" +#include "nslog.h" + +NS_IMPL_LOG(nsTimerMotifFactoryLog, 0) +#define PRINTF NS_LOG_PRINTF(nsTimerMotifFactoryLog) +#define FLUSH NS_LOG_FLUSH(nsTimerMotifFactoryLog) static NS_DEFINE_CID(kCTimerMotif, NS_TIMER_MOTIF_CID); static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID); @@ -133,7 +138,7 @@ NSRegisterSelf(nsISupports* aServMgr, const char *fullpath) nsresult rv; #ifdef NS_DEBUG - printf("*** Registering MOTIF timer\n"); + PRINTF("*** Registering MOTIF timer\n"); #endif nsCOMPtr diff --git a/mozilla/widget/timer/src/unix/qt/nsTimerQt.cpp b/mozilla/widget/timer/src/unix/qt/nsTimerQt.cpp index 09add708160..eafc0004abe 100644 --- a/mozilla/widget/timer/src/unix/qt/nsTimerQt.cpp +++ b/mozilla/widget/timer/src/unix/qt/nsTimerQt.cpp @@ -25,6 +25,11 @@ #include #include +#include "nslog.h" + +NS_IMPL_LOG(nsTimerQtLog, 0) +#define PRINTF NS_LOG_PRINTF(nsTimerQtLog) +#define FLUSH NS_LOG_FLUSH(nsTimerQtLog) static NS_DEFINE_IID(kITimerIID, NS_ITIMER_IID); diff --git a/mozilla/widget/timer/src/unix/qt/nsTimerQtFactory.cpp b/mozilla/widget/timer/src/unix/qt/nsTimerQtFactory.cpp index 39491d2be06..0cfcb5d7181 100644 --- a/mozilla/widget/timer/src/unix/qt/nsTimerQtFactory.cpp +++ b/mozilla/widget/timer/src/unix/qt/nsTimerQtFactory.cpp @@ -24,7 +24,6 @@ #include "nsIGenericFactory.h" #include "nsIModule.h" #include "nsCOMPtr.h" - #include "nsTimerQt.h" // {C373F981-5480-11d3-B22A-000064657374} diff --git a/mozilla/widget/timer/src/unix/xlib/nsTimerXlib.cpp b/mozilla/widget/timer/src/unix/xlib/nsTimerXlib.cpp index 9cdb6decd94..dabc43f39bb 100644 --- a/mozilla/widget/timer/src/unix/xlib/nsTimerXlib.cpp +++ b/mozilla/widget/timer/src/unix/xlib/nsTimerXlib.cpp @@ -35,6 +35,11 @@ #include "prlog.h" #include +#include "nslog.h" + +NS_IMPL_LOG(nsTimerXlibLog, 0) +#define PRINTF NS_LOG_PRINTF(nsTimerXlibLog) +#define FLUSH NS_LOG_FLUSH(nsTimerXlibLog) static NS_DEFINE_IID(kITimerIID, NS_ITIMER_IID); @@ -57,7 +62,7 @@ PRBool nsTimerXlib::gProcessingTimer = PR_FALSE; nsTimerXlib::nsTimerXlib() { #ifdef TIMER_DEBUG - fprintf(stderr, "nsTimerXlib::nsTimerXlib (%p) called.\n", this); + PRINTF("nsTimerXlib::nsTimerXlib (%p) called.\n", this); #endif NS_INIT_REFCNT(); @@ -72,7 +77,7 @@ nsTimerXlib::nsTimerXlib() nsTimerXlib::~nsTimerXlib() { #ifdef TIMER_DEBUG - fprintf(stderr, "nsTimerXlib::~nsTimerXlib (%p) called.\n", this); + PRINTF("nsTimerXlib::~nsTimerXlib (%p) called.\n", this); #endif Cancel(); @@ -112,7 +117,7 @@ nsTimerXlib::Init(PRUint32 aDelay, PRUint32 aPriority) { struct timeval Now; #ifdef TIMER_DEBUG - fprintf(stderr, "nsTimerXlib::Init (%p) called with delay %d\n", this, aDelay); + PRINTF("nsTimerXlib::Init (%p) called with delay %d\n", this, aDelay); #endif mDelay = aDelay; @@ -129,7 +134,7 @@ nsTimerXlib::Init(PRUint32 aDelay, PRUint32 aPriority) } #ifdef TIMER_DEBUG - fprintf(stderr, "fire set to %ld / %ld\n", mFireTime.tv_sec, mFireTime.tv_usec); + PRINTF("fire set to %ld / %ld\n", mFireTime.tv_sec, mFireTime.tv_usec); #endif if (!gTimeoutAdded) @@ -176,14 +181,14 @@ nsTimerXlib::Fire() nsCOMPtr kungFuDeathGrip = this; #ifdef TIMER_DEBUG - fprintf(stderr, "*** PRIORITY is %x ***\n", mPriority); + PRINTF("*** PRIORITY is %x ***\n", mPriority); #endif timeval aNow; gettimeofday(&aNow, NULL); #ifdef TIMER_DEBUG - fprintf(stderr, "nsTimerXlib::Fire (%p) called at %ld / %ld\n", + PRINTF("nsTimerXlib::Fire (%p) called at %ld / %ld\n", this, aNow.tv_sec, aNow.tv_usec); #endif @@ -238,8 +243,8 @@ nsTimerXlib::ProcessTimeouts(nsVoidArray *array) gettimeofday(&aNow, NULL); #ifdef TIMER_DEBUG - fprintf(stderr, "nsTimerXlib::ProcessTimeouts called at %ld / %ld\n", - aNow.tv_sec, aNow.tv_usec); + PRINTF("nsTimerXlib::ProcessTimeouts called at %ld / %ld\n", + aNow.tv_sec, aNow.tv_usec); #endif for (int i = count; i >=0; i--) @@ -257,7 +262,7 @@ nsTimerXlib::ProcessTimeouts(nsVoidArray *array) // Fire(...) call which may release *all* other references // to p... #ifdef TIMER_DEBUG - fprintf(stderr, "Firing timeout for (%p)\n", timer); + PRINTF("Firing timeout for (%p)\n", timer); #endif // NS_ADDREF(timer); //FIXME: Does this still apply??? TonyT @@ -338,7 +343,7 @@ int NS_TimeToNextTimeout(struct timeval *aTimer) { once = 0; - printf("NS_TimeToNextTimeout() lives!\n"); + PRINTF("NS_TimeToNextTimeout() lives!\n"); } #endif /* !MOZ_MONOLITHIC_TOOLKIT */ @@ -409,7 +414,7 @@ NS_ProcessTimeouts(Display *aDisplay) { once = 0; - printf("NS_ProcessTimeouts() lives!\n"); + PRINTF("NS_ProcessTimeouts() lives!\n"); } #endif /* !MOZ_MONOLITHIC_TOOLKIT */ @@ -423,14 +428,14 @@ NS_ProcessTimeouts(Display *aDisplay) if (XPending(aDisplay) == 0) { #ifdef TIMER_DEBUG - fprintf(stderr, "\n Handling Low Priority Stuff!!! Display is 0x%x\n", aDisplay); + PRINTF("\n Handling Low Priority Stuff!!! Display is 0x%x\n", aDisplay); #endif nsTimerXlib::ProcessTimeouts(nsTimerXlib::gLowList); nsTimerXlib::ProcessTimeouts(nsTimerXlib::gLowestList); } #ifdef TIMER_DEBUG else - fprintf(stderr, "\n Handling Event Stuff!!!", aDisplay); + PRINTF("\n Handling Event Stuff!!!", aDisplay); #endif nsTimerXlib::gProcessingTimer = PR_FALSE; diff --git a/mozilla/xpcom/base/nsConsoleService.cpp b/mozilla/xpcom/base/nsConsoleService.cpp index 1a17f7e51ff..c80f9c894df 100644 --- a/mozilla/xpcom/base/nsConsoleService.cpp +++ b/mozilla/xpcom/base/nsConsoleService.cpp @@ -32,6 +32,11 @@ #include "nsConsoleService.h" #include "nsConsoleMessage.h" +#include "nslog.h" + +NS_IMPL_LOG(nsConsoleServiceLog) +#define PRINTF NS_LOG_PRINTF(nsConsoleServiceLog) +#define FLUSH NS_LOG_FLUSH(nsConsoleServiceLog) NS_IMPL_THREADSAFE_ISUPPORTS(nsConsoleService, NS_GET_IID(nsIConsoleService)); @@ -75,10 +80,9 @@ nsConsoleService::~nsConsoleService() nsresult rv; rv = mListeners->Count(&listenerCount); if (listenerCount != 0) { - fprintf(stderr, - "WARNING - %d console error listeners still registered!\n" - "More calls to nsIConsoleService::UnregisterListener needed.\n", - listenerCount); + PRINTF("WARNING - %d console error listeners still registered!\n" + "More calls to nsIConsoleService::UnregisterListener needed.\n", + listenerCount); } } #endif diff --git a/mozilla/xpcom/base/nsDebug.cpp b/mozilla/xpcom/base/nsDebug.cpp index c3e583c0c95..c16ff4aedd2 100644 --- a/mozilla/xpcom/base/nsDebug.cpp +++ b/mozilla/xpcom/base/nsDebug.cpp @@ -86,10 +86,6 @@ #include #include #elif defined(XP_MAC) - #define TEMP_MAC_HACK - - //------------------------ - #ifdef TEMP_MAC_HACK #include #include #include @@ -101,10 +97,6 @@ #include #include - #undef PR_LOG - #undef PR_LogFlush - #define PR_LOG(module,level,args) dprintf args - #define PR_LogFlush() static void dprintf(const char *format, ...) { va_list ap; @@ -118,28 +110,31 @@ else DebugStr(buffer); } - #endif // TEMP_MAC_HACK - //------------------------ #elif defined(XP_UNIX) #include #endif -/** - * Define output so users will always see it - */ +#include "nslog.h" +#undef fprintf +#undef ERROR +#undef WARN +#undef BREAK -#if defined(XP_UNIX) || defined(_WIN32) -#define DBG_LOG(log,err,pargs) \ - InitLog(); \ - PR_LOG(log,err,pargs); \ - PR_LogFlush(); \ - printf pargs; putchar('\n'); -#else -#define DBG_LOG(log,err,pargs) \ - InitLog(); \ - PR_LOG(log,err,pargs); \ - PR_LogFlush(); -#endif +NS_IMPL_LOG_ENABLED(ASSERT) +#define ASSERT_PRINTF NS_LOG_PRINTF(ASSERT) +#define ASSERT_FLUSH NS_LOG_FLUSH(ASSERT) + +NS_IMPL_LOG_ENABLED(ABORT) +#define ABORT_PRINTF NS_LOG_PRINTF(ABORT) +#define ABORT_FLUSH NS_LOG_FLUSH(ABORT) + +NS_IMPL_LOG_ENABLED(WARN) +#define WARN_PRINTF NS_LOG_PRINTF(WARN) +#define WARN_FLUSH NS_LOG_FLUSH(WARN) + +NS_IMPL_LOG_ENABLED(BREAK) +#define BREAK_PRINTF NS_LOG_PRINTF(BREAK) +#define BREAK_FLUSH NS_LOG_FLUSH(BREAK) /* * Determine if debugger is present in windows. @@ -175,58 +170,42 @@ PRBool InDebugger() * always compiled in, in case some other module that uses it is * compiled with debugging even if this library is not. */ -static PRLogModuleInfo* gDebugLog; - -static void InitLog(void) -{ - if (0 == gDebugLog) { - gDebugLog = PR_NewLogModule("nsDebug"); - gDebugLog->level = PR_LOG_DEBUG; - } -} NS_COM void nsDebug::Assertion(const char* aStr, const char* aExpr, const char* aFile, PRIntn aLine) { - InitLog(); - char buf[1000]; PR_snprintf(buf, sizeof(buf), - "###!!! ASSERTION: %s: '%s', file %s, line %d", - aStr, aExpr, aFile, aLine); + "%s: '%s', file %s, line %d", + aStr, aExpr, aFile, aLine); - // Write out the assertion message to the debug log - PR_LOG(gDebugLog, PR_LOG_ERROR, ("%s", buf)); - PR_LogFlush(); - - // And write it out to the stdout - printf("%s\n", buf); - fflush(stdout); + ASSERT_PRINTF("%s", buf); + ASSERT_FLUSH(); #if defined(_WIN32) if(!InDebugger()) - { - char msg[1200]; - PR_snprintf(msg, sizeof(msg), - "%s\n\nClick Abort to exit the Application.\n" - "Click Retry to Debug the Application..\n" - "Click Ignore to continue running the Application.", buf); - int code = ::MessageBox(NULL, msg, "nsDebug::Assertion", - MB_ICONSTOP | MB_ABORTRETRYIGNORE); - switch(code) - { - case IDABORT: - //This should exit us - raise(SIGABRT); - //If we are ignored exit this way.. - _exit(3); - break; + { + char msg[1200]; + PR_snprintf(msg, sizeof(msg), + "%s\n\nClick Abort to exit the Application.\n" + "Click Retry to Debug the Application..\n" + "Click Ignore to continue running the Application.", buf); + int code = ::MessageBox(NULL, msg, "ASSERTION", + MB_ICONSTOP | MB_ABORTRETRYIGNORE); + switch(code) + { + case IDABORT: + //This should exit us + raise(SIGABRT); + //If we are ignored exit this way.. + _exit(3); + break; - case IDIGNORE: - return; - // Fall Through - } - } + case IDIGNORE: + return; + // Fall Through + } + } #endif #if defined(XP_OS2) @@ -235,7 +214,7 @@ NS_COM void nsDebug::Assertion(const char* aStr, const char* aExpr, "%s\n\nClick Cancel to Debug Application.\n" "Click Enter to continue running the Application.", buf); ULONG code = WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, msg, - "nsDebug::Assertion", 0, + "ASSERTION", 0, MB_ERROR | MB_ENTERCANCEL); /* It is possible that we are executing on a thread that doesn't have a @@ -253,19 +232,25 @@ NS_COM void nsDebug::Assertion(const char* aStr, const char* aExpr, } #endif +#if defined(XP_MAC) + dprintf("ASSERT: %s", buf); +#else Break(aFile, aLine); +#endif } NS_COM void nsDebug::Break(const char* aFile, PRIntn aLine) { -#ifndef TEMP_MAC_HACK - DBG_LOG(gDebugLog, PR_LOG_ERROR, - ("###!!! Break: at file %s, line %d", aFile, aLine)); -#if defined(_WIN32) + BREAK_PRINTF("at file %s, line %d", aFile, aLine); + BREAK_FLUSH(); + +#ifdef XP_MAC + dprintf("BREAK: at file %s, line %d", aFile, aLine); +#elif defined(_WIN32) #ifdef _M_IX86 - ::DebugBreak(); + ::DebugBreak(); #else /* _M_ALPHA */ - fprintf(stderr, "Break: at file %s\n",aFile, aLine); fflush(stderr); + fprintf(stderr, "BREAK: at file %s\n",aFile, aLine); fflush(stderr); #endif #elif defined(XP_UNIX) && !defined(UNIX_CRASH_ON_ASSERT) fprintf(stderr, "\07"); @@ -317,31 +302,20 @@ NS_COM void nsDebug::Break(const char* aFile, PRIntn aLine) { #ifdef UNIX_CRASH_ON_ASSERT char buf[2000]; - sprintf(buf, "Break: at file %s, line %d", aFile, aLine); + sprintf(buf, "BREAK: at file %s, line %d", aFile, aLine); DEBUGGER(buf); #endif } #else Abort(aFile, aLine); #endif -#endif // TEMP_MAC_HACK } NS_COM void nsDebug::Warning(const char* aMessage, const char* aFile, PRIntn aLine) { - InitLog(); - - char buf[1000]; - PR_snprintf(buf, sizeof(buf), - "WARNING: %s, file %s, line %d", - aMessage, aFile, aLine); - - // Write out the warning message to the debug log - PR_LOG(gDebugLog, PR_LOG_ERROR, ("%s", buf)); - - // And write it out to the stdout - printf("%s\n", buf); + WARN_PRINTF("%s, file %s, line %d", aMessage, aFile, aLine); + WARN_FLUSH(); } //**************** All Dead Code Below @@ -361,8 +335,8 @@ NS_COM PRBool nsDebug::WarnIfFalse(const char* aStr, const char* aExpr, NS_COM void nsDebug::Abort(const char* aFile, PRIntn aLine) { - DBG_LOG(gDebugLog, PR_LOG_ERROR, - ("###!!! Abort: at file %s, line %d", aFile, aLine)); + ABORT_PRINTF("at file %s, line %d", aFile, aLine); + ABORT_FLUSH(); #if defined(_WIN32) #ifdef _M_IX86 long* __p = (long*) 0x7; @@ -372,6 +346,7 @@ NS_COM void nsDebug::Abort(const char* aFile, PRIntn aLine) PR_Abort(); #endif #elif defined(XP_MAC) + dprintf("ABORT: at file %s, line %d", aFile, aLine); ExitToShell(); #elif defined(XP_UNIX) PR_Abort(); @@ -382,7 +357,7 @@ NS_COM void nsDebug::Abort(const char* aFile, PRIntn aLine) { #ifndef DEBUG_cls char buf[2000]; - sprintf(buf, "Abort: at file %s, line %d", aFile, aLine); + sprintf(buf, "ABORT: at file %s, line %d", aFile, aLine); DEBUGGER(buf); #endif } diff --git a/mozilla/xpcom/base/nsTraceRefcnt.cpp b/mozilla/xpcom/base/nsTraceRefcnt.cpp index e81978c34b6..21f16b44c0a 100644 --- a/mozilla/xpcom/base/nsTraceRefcnt.cpp +++ b/mozilla/xpcom/base/nsTraceRefcnt.cpp @@ -56,6 +56,13 @@ #include "macstdlibextras.h" #endif +#include "nslog.h" +#undef fprintf + +NS_IMPL_LOG_ENABLED(TRACE) +#define PRINTF NS_LOG_PRINTF(TRACE) +#define FLUSH NS_LOG_FLUSH(TRACE) + //////////////////////////////////////////////////////////////////////////////// NS_COM void @@ -485,8 +492,8 @@ nsTraceRefcnt::DumpStatistics(StatisticsType type, FILE* out) nsVoidArray entries; PL_HashTableEnumerateEntries(gBloatView, BloatEntry::DumpEntry, &entries); - fprintf(stdout, "nsTraceRefcnt::DumpStatistics: %d entries\n", - entries.Count()); +// PRINTF("nsTraceRefcnt::DumpStatistics: %d entries\n", +// entries.Count()); // Sort the entries alphabetically by classname. PRInt32 i, j; @@ -632,13 +639,13 @@ static PRBool InitLog(const char* envVar, const char* msg, FILE* *result) if (value) { if (nsCRT::strcmp(value, "1") == 0) { *result = stdout; - fprintf(stdout, "### %s defined -- logging %s to stdout\n", + PRINTF("%s defined -- logging %s to stdout\n", envVar, msg); return PR_TRUE; } else if (nsCRT::strcmp(value, "2") == 0) { *result = stderr; - fprintf(stdout, "### %s defined -- logging %s to stderr\n", + PRINTF("%s defined -- logging %s to stderr\n", envVar, msg); return PR_TRUE; } @@ -646,12 +653,12 @@ static PRBool InitLog(const char* envVar, const char* msg, FILE* *result) FILE *stream = ::fopen(value, "w"); if (stream != NULL) { *result = stream; - fprintf(stdout, "### %s defined -- logging %s to %s\n", + PRINTF("%s defined -- logging %s to %s\n", envVar, msg, value); return PR_TRUE; } else { - fprintf(stdout, "### %s defined -- unable to log %s to %s\n", + PRINTF("%s defined -- unable to log %s to %s\n", envVar, msg, value); return PR_FALSE; } @@ -707,7 +714,7 @@ static void InitTraceLog(void) } else { gLogToLeaky = PR_FALSE; - fprintf(stdout, "### ERROR: XPCOM_MEM_LEAKY_LOG defined, but can't locate __log_addref and __log_release symbols\n"); + PRINTF("ERROR: XPCOM_MEM_LEAKY_LOG defined, but can't locate __log_addref and __log_release symbols\n"); fflush(stdout); } } @@ -719,13 +726,13 @@ static void InitTraceLog(void) (void)InitLog("XPCOM_MEM_COMPTR_LOG", "nsCOMPtr", &gCOMPtrLog); } else { if (getenv("XPCOM_MEM_COMPTR_LOG")) { - fprintf(stdout, "### XPCOM_MEM_COMPTR_LOG defined -- but XPCOM_MEM_LOG_CLASSES is not defined\n"); + PRINTF("XPCOM_MEM_COMPTR_LOG defined -- but XPCOM_MEM_LOG_CLASSES is not defined\n"); } } #else const char* comptr_log = getenv("XPCOM_MEM_COMPTR_LOG"); if (comptr_log) { - fprintf(stdout, "### XPCOM_MEM_COMPTR_LOG defined -- but it will not work without dynamic_cast\n"); + PRINTF("XPCOM_MEM_COMPTR_LOG defined -- but it will not work without dynamic_cast\n"); } #endif @@ -738,10 +745,10 @@ static void InitTraceLog(void) PL_CompareValues, NULL, NULL); if (NS_WARN_IF_FALSE(gTypesToLog, "out of memory")) { - fprintf(stdout, "### XPCOM_MEM_LOG_CLASSES defined -- unable to log specific classes\n"); + PRINTF("XPCOM_MEM_LOG_CLASSES defined -- unable to log specific classes\n"); } else { - fprintf(stdout, "### XPCOM_MEM_LOG_CLASSES defined -- only logging these classes: "); + PRINTF("XPCOM_MEM_LOG_CLASSES defined -- only logging these classes: "); const char* cp = classes; for (;;) { char* cm = (char*) strchr(cp, ','); @@ -749,12 +756,12 @@ static void InitTraceLog(void) *cm = '\0'; } PL_HashTableAdd(gTypesToLog, nsCRT::strdup(cp), (void*)1); - fprintf(stdout, "%s ", cp); + PRINTF("%s ", cp); if (!cm) break; *cm = ','; cp = cm + 1; } - fprintf(stdout, "\n"); + PRINTF("\n"); } gSerialNumbers = PL_NewHashTable(256, @@ -775,13 +782,13 @@ static void InitTraceLog(void) NULL, NULL); if (NS_WARN_IF_FALSE(gObjectsToLog, "out of memory")) { - fprintf(stdout, "### XPCOM_MEM_LOG_OBJECTS defined -- unable to log specific objects\n"); + PRINTF("XPCOM_MEM_LOG_OBJECTS defined -- unable to log specific objects\n"); } else if (! (gRefcntsLog || gAllocLog || gCOMPtrLog)) { - fprintf(stdout, "### XPCOM_MEM_LOG_OBJECTS defined -- but none of XPCOM_MEM_(REFCNT|ALLOC|COMPTR)_LOG is defined\n"); + PRINTF("XPCOM_MEM_LOG_OBJECTS defined -- but none of XPCOM_MEM_(REFCNT|ALLOC|COMPTR)_LOG is defined\n"); } else { - fprintf(stdout, "### XPCOM_MEM_LOG_OBJECTS defined -- only logging these objects: "); + PRINTF("XPCOM_MEM_LOG_OBJECTS defined -- only logging these objects: "); const char* cp = objects; for (;;) { char* cm = (char*) strchr(cp, ','); @@ -805,13 +812,13 @@ static void InitTraceLog(void) } for(PRInt32 serialno = bottom; serialno <= top; serialno++) { PL_HashTableAdd(gObjectsToLog, (const void*)serialno, (void*)1); - fprintf(stdout, "%d ", serialno); + PRINTF("%d ", serialno); } if (!cm) break; *cm = ','; cp = cm + 1; } - fprintf(stdout, "\n"); + PRINTF("\n"); } } @@ -983,7 +990,7 @@ nsTraceRefcnt::WalkTheStack(FILE* aStream) 0, NULL ); - fprintf(aStream, "### ERROR: WalkStack: %s", lpMsgBuf); + fprintf(aStream, "ERROR: WalkStack: %s", lpMsgBuf); fflush(aStream); LocalFree( lpMsgBuf ); } @@ -1467,7 +1474,7 @@ nsTraceRefcnt::LoadLibrarySymbols(const char* aLibraryName, InitTraceLog(); if (gAllocLog || gRefcntsLog) { - fprintf(stdout, "### Loading symbols for %s\n", aLibraryName); + PRINTF("Loading symbols for %s\n", aLibraryName); fflush(stdout); HANDLE myProcess = ::GetCurrentProcess(); @@ -1503,7 +1510,7 @@ nsTraceRefcnt::LoadLibrarySymbols(const char* aLibraryName, 0, NULL ); - fprintf(stdout, "### ERROR: LoadLibrarySymbols for %s: %s\n", + PRINTF("ERROR: LoadLibrarySymbols for %s: %s\n", aLibraryName, lpMsgBuf); fflush(stdout); LocalFree( lpMsgBuf ); diff --git a/mozilla/xpcom/base/nsTraceRefcntImpl.cpp b/mozilla/xpcom/base/nsTraceRefcntImpl.cpp index e81978c34b6..21f16b44c0a 100644 --- a/mozilla/xpcom/base/nsTraceRefcntImpl.cpp +++ b/mozilla/xpcom/base/nsTraceRefcntImpl.cpp @@ -56,6 +56,13 @@ #include "macstdlibextras.h" #endif +#include "nslog.h" +#undef fprintf + +NS_IMPL_LOG_ENABLED(TRACE) +#define PRINTF NS_LOG_PRINTF(TRACE) +#define FLUSH NS_LOG_FLUSH(TRACE) + //////////////////////////////////////////////////////////////////////////////// NS_COM void @@ -485,8 +492,8 @@ nsTraceRefcnt::DumpStatistics(StatisticsType type, FILE* out) nsVoidArray entries; PL_HashTableEnumerateEntries(gBloatView, BloatEntry::DumpEntry, &entries); - fprintf(stdout, "nsTraceRefcnt::DumpStatistics: %d entries\n", - entries.Count()); +// PRINTF("nsTraceRefcnt::DumpStatistics: %d entries\n", +// entries.Count()); // Sort the entries alphabetically by classname. PRInt32 i, j; @@ -632,13 +639,13 @@ static PRBool InitLog(const char* envVar, const char* msg, FILE* *result) if (value) { if (nsCRT::strcmp(value, "1") == 0) { *result = stdout; - fprintf(stdout, "### %s defined -- logging %s to stdout\n", + PRINTF("%s defined -- logging %s to stdout\n", envVar, msg); return PR_TRUE; } else if (nsCRT::strcmp(value, "2") == 0) { *result = stderr; - fprintf(stdout, "### %s defined -- logging %s to stderr\n", + PRINTF("%s defined -- logging %s to stderr\n", envVar, msg); return PR_TRUE; } @@ -646,12 +653,12 @@ static PRBool InitLog(const char* envVar, const char* msg, FILE* *result) FILE *stream = ::fopen(value, "w"); if (stream != NULL) { *result = stream; - fprintf(stdout, "### %s defined -- logging %s to %s\n", + PRINTF("%s defined -- logging %s to %s\n", envVar, msg, value); return PR_TRUE; } else { - fprintf(stdout, "### %s defined -- unable to log %s to %s\n", + PRINTF("%s defined -- unable to log %s to %s\n", envVar, msg, value); return PR_FALSE; } @@ -707,7 +714,7 @@ static void InitTraceLog(void) } else { gLogToLeaky = PR_FALSE; - fprintf(stdout, "### ERROR: XPCOM_MEM_LEAKY_LOG defined, but can't locate __log_addref and __log_release symbols\n"); + PRINTF("ERROR: XPCOM_MEM_LEAKY_LOG defined, but can't locate __log_addref and __log_release symbols\n"); fflush(stdout); } } @@ -719,13 +726,13 @@ static void InitTraceLog(void) (void)InitLog("XPCOM_MEM_COMPTR_LOG", "nsCOMPtr", &gCOMPtrLog); } else { if (getenv("XPCOM_MEM_COMPTR_LOG")) { - fprintf(stdout, "### XPCOM_MEM_COMPTR_LOG defined -- but XPCOM_MEM_LOG_CLASSES is not defined\n"); + PRINTF("XPCOM_MEM_COMPTR_LOG defined -- but XPCOM_MEM_LOG_CLASSES is not defined\n"); } } #else const char* comptr_log = getenv("XPCOM_MEM_COMPTR_LOG"); if (comptr_log) { - fprintf(stdout, "### XPCOM_MEM_COMPTR_LOG defined -- but it will not work without dynamic_cast\n"); + PRINTF("XPCOM_MEM_COMPTR_LOG defined -- but it will not work without dynamic_cast\n"); } #endif @@ -738,10 +745,10 @@ static void InitTraceLog(void) PL_CompareValues, NULL, NULL); if (NS_WARN_IF_FALSE(gTypesToLog, "out of memory")) { - fprintf(stdout, "### XPCOM_MEM_LOG_CLASSES defined -- unable to log specific classes\n"); + PRINTF("XPCOM_MEM_LOG_CLASSES defined -- unable to log specific classes\n"); } else { - fprintf(stdout, "### XPCOM_MEM_LOG_CLASSES defined -- only logging these classes: "); + PRINTF("XPCOM_MEM_LOG_CLASSES defined -- only logging these classes: "); const char* cp = classes; for (;;) { char* cm = (char*) strchr(cp, ','); @@ -749,12 +756,12 @@ static void InitTraceLog(void) *cm = '\0'; } PL_HashTableAdd(gTypesToLog, nsCRT::strdup(cp), (void*)1); - fprintf(stdout, "%s ", cp); + PRINTF("%s ", cp); if (!cm) break; *cm = ','; cp = cm + 1; } - fprintf(stdout, "\n"); + PRINTF("\n"); } gSerialNumbers = PL_NewHashTable(256, @@ -775,13 +782,13 @@ static void InitTraceLog(void) NULL, NULL); if (NS_WARN_IF_FALSE(gObjectsToLog, "out of memory")) { - fprintf(stdout, "### XPCOM_MEM_LOG_OBJECTS defined -- unable to log specific objects\n"); + PRINTF("XPCOM_MEM_LOG_OBJECTS defined -- unable to log specific objects\n"); } else if (! (gRefcntsLog || gAllocLog || gCOMPtrLog)) { - fprintf(stdout, "### XPCOM_MEM_LOG_OBJECTS defined -- but none of XPCOM_MEM_(REFCNT|ALLOC|COMPTR)_LOG is defined\n"); + PRINTF("XPCOM_MEM_LOG_OBJECTS defined -- but none of XPCOM_MEM_(REFCNT|ALLOC|COMPTR)_LOG is defined\n"); } else { - fprintf(stdout, "### XPCOM_MEM_LOG_OBJECTS defined -- only logging these objects: "); + PRINTF("XPCOM_MEM_LOG_OBJECTS defined -- only logging these objects: "); const char* cp = objects; for (;;) { char* cm = (char*) strchr(cp, ','); @@ -805,13 +812,13 @@ static void InitTraceLog(void) } for(PRInt32 serialno = bottom; serialno <= top; serialno++) { PL_HashTableAdd(gObjectsToLog, (const void*)serialno, (void*)1); - fprintf(stdout, "%d ", serialno); + PRINTF("%d ", serialno); } if (!cm) break; *cm = ','; cp = cm + 1; } - fprintf(stdout, "\n"); + PRINTF("\n"); } } @@ -983,7 +990,7 @@ nsTraceRefcnt::WalkTheStack(FILE* aStream) 0, NULL ); - fprintf(aStream, "### ERROR: WalkStack: %s", lpMsgBuf); + fprintf(aStream, "ERROR: WalkStack: %s", lpMsgBuf); fflush(aStream); LocalFree( lpMsgBuf ); } @@ -1467,7 +1474,7 @@ nsTraceRefcnt::LoadLibrarySymbols(const char* aLibraryName, InitTraceLog(); if (gAllocLog || gRefcntsLog) { - fprintf(stdout, "### Loading symbols for %s\n", aLibraryName); + PRINTF("Loading symbols for %s\n", aLibraryName); fflush(stdout); HANDLE myProcess = ::GetCurrentProcess(); @@ -1503,7 +1510,7 @@ nsTraceRefcnt::LoadLibrarySymbols(const char* aLibraryName, 0, NULL ); - fprintf(stdout, "### ERROR: LoadLibrarySymbols for %s: %s\n", + PRINTF("ERROR: LoadLibrarySymbols for %s: %s\n", aLibraryName, lpMsgBuf); fflush(stdout); LocalFree( lpMsgBuf ); diff --git a/mozilla/xpcom/components/nsComponentManager.cpp b/mozilla/xpcom/components/nsComponentManager.cpp index 0bc9ad45fd4..29fd53d2d2c 100644 --- a/mozilla/xpcom/components/nsComponentManager.cpp +++ b/mozilla/xpcom/components/nsComponentManager.cpp @@ -83,8 +83,12 @@ // Logging of debug output #define FORCE_PR_LOG /* Allow logging in the release build */ -#include "prlog.h" -PRLogModuleInfo* nsComponentManagerLog = NULL; + +#include "nslog.h" + +NS_IMPL_LOG(nsComponentManagerLog) +#define PRINTF NS_LOG_PRINTF(nsComponentManagerLog) +#define FLUSH NS_LOG_FLUSH(nsComponentManagerLog) // Enable printing of critical errors on screen even for release builds #define PRINT_CRITICAL_ERROR_TO_SCREEN @@ -275,12 +279,8 @@ nsresult nsComponentManagerImpl::Init(void) mShuttingDown = NS_SHUTDOWN_NEVERHAPPENED; - if (nsComponentManagerLog == NULL) - { - nsComponentManagerLog = PR_NewLogModule("nsComponentManager"); - PR_LOG(nsComponentManagerLog, PR_LOG_ALWAYS, - ("xpcom-log-version : " NS_XPCOM_COMPONENT_MANAGER_VERSION_STRING)); - } + PR_LOG(nsComponentManagerLog, PR_LOG_ALWAYS, + ("xpcom-log-version : " NS_XPCOM_COMPONENT_MANAGER_VERSION_STRING)); if (mFactories == NULL) { mFactories = new nsObjectHashtable(nsnull, nsnull, // should never be copied @@ -901,7 +901,7 @@ nsresult nsComponentManagerImpl::PlatformPrePopulateRegistry() // put the {contractid, Cid} mapping into our map nsCStringKey key(contractidString); mContractIDs->Put(&key, aClass); - // printf("Populating [ %s, %s ]\n", cidString, contractidString); + // PRINTF("Populating [ %s, %s ]\n", cidString, contractidString); } (void)mRegistry->SetBufferSize( 10*1024 ); @@ -1270,7 +1270,7 @@ MakeRegistryName(const char *aDllName, const char *prefix, char **regName) *regName = registryName; #ifdef DEBUG_shaver_off - fprintf(stderr, "MakeRegistryName(%s, %s, &[%s])\n", + PRINTF("MakeRegistryName(%s, %s, &[%s])\n", aDllName, prefix, *regName); #endif @@ -1833,10 +1833,8 @@ CanUnload_enumerate(nsHashKey *key, void *aData, void *aClosure) (struct CanUnload_closure *)aClosure; if (loader == closure->native) { -#ifdef DEBUG - fprintf(stderr, "CanUnload_enumerate: skipping native\n"); -#endif - return PR_TRUE; + PRINTF("CanUnload_enumerate: skipping native\n"); + return PR_TRUE; } closure->status = loader->UnloadAll(closure->when); diff --git a/mozilla/xpcom/components/nsGenericFactory.cpp b/mozilla/xpcom/components/nsGenericFactory.cpp index 53629d55890..05afee507de 100644 --- a/mozilla/xpcom/components/nsGenericFactory.cpp +++ b/mozilla/xpcom/components/nsGenericFactory.cpp @@ -26,6 +26,12 @@ #include "nsGenericFactory.h" #include "nsCRT.h" +#include "nslog.h" + +NS_IMPL_LOG(nsGenericFactoryLog) +#define PRINTF NS_LOG_PRINTF(nsGenericFactoryLog) +#define FLUSH NS_LOG_FLUSH(nsGenericFactoryLog) + nsGenericFactory::nsGenericFactory(ConstructorProcPtr constructor) : mConstructor(constructor), mDestructor(NULL) { @@ -186,9 +192,9 @@ nsGenericModule::GetClassObject(nsIComponentManager *aCompMgr, desc++; } // not found in descriptions -#ifdef DEBUG +#ifdef NS_ENABLE_LOGGING char* cs = aClass.ToString(); - printf("+++ nsGenericModule %s: unable to create factory for %s\n", mModuleName, cs); + PRINTF("+++ nsGenericModule %s: unable to create factory for %s\n", mModuleName, cs); nsCRT::free(cs); #endif // XXX put in stop-gap so that we don't search for this one again @@ -207,9 +213,7 @@ nsGenericModule::RegisterSelf(nsIComponentManager *aCompMgr, { nsresult rv = NS_OK; -#ifdef DEBUG - printf("*** Registering %s components (all right -- a generic module!)\n", mModuleName); -#endif + PRINTF("*** Registering %s components (all right -- a generic module!)\n", mModuleName); nsModuleComponentInfo* cp = mComponents; for (PRUint32 i = 0; i < mComponentCount; i++) { @@ -217,10 +221,8 @@ nsGenericModule::RegisterSelf(nsIComponentManager *aCompMgr, cp->mContractID, aPath, PR_TRUE, PR_TRUE); if (NS_FAILED(rv)) { -#ifdef DEBUG - printf("nsGenericModule %s: unable to register %s component => %x\n", + PRINTF("nsGenericModule %s: unable to register %s component => %x\n", mModuleName?mModuleName:"(null)", cp->mDescription?cp->mDescription:"(null)", rv); -#endif break; } // Call the registration hook of the component, if any @@ -228,10 +230,8 @@ nsGenericModule::RegisterSelf(nsIComponentManager *aCompMgr, { rv = cp->mRegisterSelfProc(aCompMgr, aPath, registryLocation, componentType); if (NS_FAILED(rv)) { -#ifdef DEBUG - printf("nsGenericModule %s: Register hook for %s component returned error => %x\n", + PRINTF("nsGenericModule %s: Register hook for %s component returned error => %x\n", mModuleName?mModuleName:"(null)", cp->mDescription?cp->mDescription:"(null)", rv); -#endif break; } } @@ -246,9 +246,7 @@ nsGenericModule::UnregisterSelf(nsIComponentManager* aCompMgr, nsIFile* aPath, const char* registryLocation) { -#ifdef DEBUG - printf("*** Unregistering %s components (all right -- a generic module!)\n", mModuleName); -#endif + PRINTF("*** Unregistering %s components (all right -- a generic module!)\n", mModuleName); nsModuleComponentInfo* cp = mComponents; for (PRUint32 i = 0; i < mComponentCount; i++) { // Call the unregistration hook of the component, if any @@ -259,10 +257,8 @@ nsGenericModule::UnregisterSelf(nsIComponentManager* aCompMgr, // Unregister the component nsresult rv = aCompMgr->UnregisterComponentSpec(cp->mCID, aPath); if (NS_FAILED(rv)) { -#ifdef DEBUG - printf("nsGenericModule %s: unable to unregister %s component => %x\n", + PRINTF("nsGenericModule %s: unable to unregister %s component => %x\n", mModuleName, cp->mDescription, rv); -#endif } cp++; } diff --git a/mozilla/xpcom/components/nsNativeComponentLoader.cpp b/mozilla/xpcom/components/nsNativeComponentLoader.cpp index 561aee2ef61..8d7ab615f63 100644 --- a/mozilla/xpcom/components/nsNativeComponentLoader.cpp +++ b/mozilla/xpcom/components/nsNativeComponentLoader.cpp @@ -50,14 +50,17 @@ #include "nsILocalFileMac.h" #endif +#include "nslog.h" + +NS_IMPL_LOG(nsNativeComponentLoaderLog) +#define PRINTF NS_LOG_PRINTF(nsNativeComponentLoaderLog) +#define FLUSH NS_LOG_FLUSH(nsNativeComponentLoaderLog) + #define PRINT_CRITICAL_ERROR_TO_SCREEN 1 #define USE_REGISTRY 1 #define XPCOM_USE_NSGETFACTORY 1 -// Logging of debug output -#define FORCE_PR_LOG /* Allow logging in the release build */ -#include "prlog.h" -extern PRLogModuleInfo *nsComponentManagerLog; +#define nsComponentManagerLog nsNativeComponentLoaderLog nsNativeComponentLoader::nsNativeComponentLoader() : mRegistry(nsnull), mCompMgr(nsnull), mDllStore(nsnull) @@ -242,18 +245,12 @@ NS_IMETHODIMP nsNativeComponentLoader::AutoRegisterComponents(PRInt32 aWhen, nsIFile *aDirectory) { -#ifdef DEBUG - /* do we _really_ want to print this every time? */ - printf("nsNativeComponentLoader: autoregistering begins.\n"); -#endif + PRINTF("nsNativeComponentLoader: autoregistering begins.\n"); nsresult rv = RegisterComponentsInDir(aWhen, aDirectory); -#ifdef DEBUG - printf("nsNativeComponentLoader: autoregistering %s\n", + PRINTF("nsNativeComponentLoader: autoregistering %s\n", NS_FAILED(rv) ? "FAILED" : "succeeded"); -#endif - return rv; } @@ -594,7 +591,7 @@ nsNativeComponentLoader::DumpLoadError(nsDll *dll, // Dump to screen if needed #ifdef PRINT_CRITICAL_ERROR_TO_SCREEN - printf("**************************************************\n" + PRINTF("**************************************************\n" "nsNativeComponentLoader: %s(%s) Load FAILED with error: %s\n" "**************************************************\n", aCallerName, @@ -934,10 +931,8 @@ nsresult nsNativeComponentLoader::RegisterDeferredComponents(PRInt32 aWhen, PRBool *aRegistered) { -#ifdef DEBUG - fprintf(stderr, "nNCL: registering deferred (%d)\n", + PRINTF("nNCL: registering deferred (%d)\n", mDeferredComponents.Count()); -#endif *aRegistered = PR_FALSE; if (!mDeferredComponents.Count()) return NS_OK; @@ -955,10 +950,10 @@ nsNativeComponentLoader::RegisterDeferredComponents(PRInt32 aWhen, } if (*aRegistered) - fprintf(stderr, "nNCL: registered deferred, %d left\n", + PRINTF("nNCL: registered deferred, %d left\n", mDeferredComponents.Count()); else - fprintf(stderr, "nNCL: didn't register any components, %d left\n", + PRINTF("nNCL: didn't register any components, %d left\n", mDeferredComponents.Count()); /* are there any fatal errors? */ return NS_OK; diff --git a/mozilla/xpcom/components/nsRegistry.cpp b/mozilla/xpcom/components/nsRegistry.cpp index a510429259e..036922a52e4 100644 --- a/mozilla/xpcom/components/nsRegistry.cpp +++ b/mozilla/xpcom/components/nsRegistry.cpp @@ -44,6 +44,12 @@ #include #endif +#include "nslog.h" + +NS_IMPL_LOG(nsRegistryLog) +#define PRINTF NS_LOG_PRINTF(nsRegistryLog) +#define FLUSH NS_LOG_FLUSH(nsRegistryLog) + /* extra locking for the paranoid */ /* #define EXTRA_THREADSAFE */ #ifndef EXTRA_THREADSAFE @@ -51,9 +57,7 @@ #define PR_Unlock(x) (void)0 #endif -// Logging of debug output -#define FORCE_PR_LOG /* Allow logging in the release build */ -extern PRLogModuleInfo *nsComponentManagerLog; +#define nsComponentManagerLog nsRegistryLog PRUnichar widestrFormat[] = { PRUnichar('%'),PRUnichar('s'),PRUnichar(0)}; @@ -386,9 +390,7 @@ NS_IMETHODIMP nsRegistry::Open( const char *regFile ) { return OpenWellKnownRegistry(nsIRegistry::ApplicationRegistry); } -#ifdef DEBUG_dp - printf("nsRegistry: Opening registry %s\n", regFile); -#endif /* DEBUG_dp */ + PRINTF("nsRegistry: Opening registry %s\n", regFile); if (mCurRegID != nsIRegistry::None && mCurRegID != nsIRegistry::ApplicationCustomRegistry) { @@ -478,7 +480,7 @@ NS_IMETHODIMP nsRegistry::OpenWellKnownRegistry( nsWellKnownRegistry regid ) "%s/" NS_MOZILLA_DIR_NAME, settings); if (PR_Access(settingsMozillaDir, PR_ACCESS_EXISTS) != PR_SUCCESS) { PR_MkDir(settingsMozillaDir, NS_MOZILLA_DIR_PERMISSION); - printf("nsComponentManager: Creating Directory %s\n", settingsMozillaDir); + PRINTF("nsComponentManager: Creating Directory %s\n", settingsMozillaDir); PR_LOG(nsComponentManagerLog, PR_LOG_ALWAYS, ("nsComponentManager: Creating Directory %s", settingsMozillaDir)); } @@ -560,9 +562,7 @@ NS_IMETHODIMP nsRegistry::OpenWellKnownRegistry( nsWellKnownRegistry regid ) return NS_ERROR_REG_BADTYPE; } -#ifdef DEBUG_dp - printf("nsRegistry: Opening std registry %s\n", regFile); -#endif /* DEBUG_dp */ + PRINTF("nsRegistry: Opening std registry %s\n", regFile); PR_Lock(mregLock); err = NR_RegOpen((char*)regFile, &mReg ); @@ -1076,9 +1076,7 @@ NS_IMETHODIMP nsRegistry::RemoveSubtree( nsRegistryKey baseKey, const char *path while (NR_RegEnumSubkeys(mReg, key, &state, subkeyname, sizeof(subkeyname), REGENUM_NORMAL) == REGERR_OK) { -#ifdef DEBUG_dp - printf("...recursing into %s\n", subkeyname); -#endif /* DEBUG_dp */ + PRINTF("...recursing into %s\n", subkeyname); // Even though this is not a "Raw" API the subkeys may still, in fact, // *be* raw. Since we're recursively deleting this will work either way. // If we were guaranteed none would be raw then a depth-first enumeration @@ -1090,9 +1088,7 @@ NS_IMETHODIMP nsRegistry::RemoveSubtree( nsRegistryKey baseKey, const char *path // If success in deleting all subkeys, delete this key too if (err == REGERR_OK) { -#ifdef DEBUG_dp - printf("...deleting %s\n", path); -#endif /* DEBUG_dp */ + PRINTF("...deleting %s\n", path); PR_Lock(mregLock); err = NR_RegDeleteKey(mReg, baseKey, (char *)path); PR_Unlock(mregLock); @@ -1133,9 +1129,7 @@ NS_IMETHODIMP nsRegistry::RemoveSubtreeRaw( nsRegistryKey baseKey, const char *k subkeyname[0] = '\0'; while (NR_RegEnumSubkeys(mReg, key, &state, subkeyname, n, REGENUM_NORMAL) == REGERR_OK) { -#ifdef DEBUG_dp - printf("...recursing into %s\n", subkeyname); -#endif /* DEBUG_dp */ + PRINTF("...recursing into %s\n", subkeyname); err = RemoveSubtreeRaw(key, subkeyname); if (err != REGERR_OK) break; } @@ -1143,9 +1137,7 @@ NS_IMETHODIMP nsRegistry::RemoveSubtreeRaw( nsRegistryKey baseKey, const char *k // If success in deleting all subkeys, delete this key too if (err == REGERR_OK) { -#ifdef DEBUG_dp - printf("...deleting %s\n", keyname); -#endif /* DEBUG_dp */ + PRINTF("...deleting %s\n", keyname); PR_Lock(mregLock); err = NR_RegDeleteKeyRaw(mReg, baseKey, (char *)keyname); PR_Unlock(mregLock); diff --git a/mozilla/xpcom/components/xcDll.cpp b/mozilla/xpcom/components/xcDll.cpp index fb2a6fad14e..af3c4dbca15 100644 --- a/mozilla/xpcom/components/xcDll.cpp +++ b/mozilla/xpcom/components/xcDll.cpp @@ -40,6 +40,11 @@ #include #include #endif +#include "nslog.h" + +NS_IMPL_LOG(xcDllLog) +#define PRINTF NS_LOG_PRINTF(xcDllLog) +#define FLUSH NS_LOG_FLUSH(xcDllLog) nsDll::nsDll(const char *codeDllName, int type) : m_dllName(NULL), @@ -504,7 +509,7 @@ void nsDll::BreakAfterLoad(const char *nsprPath) { // Loading a dll that we want to break on // Put your breakpoint here - printf("...Loading module %s\n", nsprPath); + PRINTF("...Loading module %s\n", nsprPath); // Break in the debugger here. #if defined(linux) && defined(__i386) asm("int $3"); diff --git a/mozilla/xpcom/ds/bufferRoutines.h b/mozilla/xpcom/ds/bufferRoutines.h index e884adf5181..f86bbe66fbc 100644 --- a/mozilla/xpcom/ds/bufferRoutines.h +++ b/mozilla/xpcom/ds/bufferRoutines.h @@ -76,7 +76,7 @@ public: while(*s) { if(*s & 0x80) { fprintf(mFile, "[%2X]", (char)*s); - } else { + } else { fprintf(mFile, "%c", *s); } s++; @@ -99,7 +99,7 @@ public: while(*s) { if(*s & 0xFF80) { fprintf(mFile, "\\u%X", *s); - } else { + } else { fprintf(mFile, "%c", *s); } s++; diff --git a/mozilla/xpcom/ds/nsBufferManager.h b/mozilla/xpcom/ds/nsBufferManager.h index 7f42c2c28d9..d81878f7695 100644 --- a/mozilla/xpcom/ds/nsBufferManager.h +++ b/mozilla/xpcom/ds/nsBufferManager.h @@ -29,6 +29,11 @@ #include "nsStringValue.h" +#include "nslog.h" + +NS_IMPL_LOG(nsBufferManagerLog, 0) +#define PRINTF NS_LOG_PRINTF(nsBufferManagerLog) +#define FLUSH NS_LOG_FLUSH(nsBufferManagerLog) #define NS_MEMORY_ERROR 1000 @@ -57,14 +62,14 @@ public: void ReportCastUp(const char* data, const char* msg) { if(mFile) { - fprintf(mFile, "ERRORTEXT= %s\n", msg); - fprintf(mFile, "BEGINDATA\n"); + fprintf(mFile, "ERRORTEXT= %s\n", msg); + fprintf(mFile, "BEGINDATA\n"); const char* s=data; while(*s) { if(*s & 0x80) { - fprintf(mFile, "[%2X]", (char)*s); + fprintf(mFile, "[%2X]", (char)*s); } else { - fprintf(mFile, "%c", *s); + fprintf(mFile, "%c", *s); } s++; } @@ -80,14 +85,14 @@ public: void ReportCastDown(const PRUnichar* data, const char* msg) { if(mFile) { - fprintf(mFile, "ERRORTEXT=%s\n", msg); - fprintf(mFile, "BEGINDATA\n"); + fprintf(mFile, "ERRORTEXT=%s\n", msg); + fprintf(mFile, "BEGINDATA\n"); const PRUnichar* s=data; while(*s) { if(*s & 0xFF80) { - fprintf(mFile, "\\u%X", *s); + fprintf(mFile, "\\u%X", *s); } else { - fprintf(mFile, "%c", *s); + fprintf(mFile, "%c", *s); } s++; } @@ -1430,7 +1435,7 @@ void SVDebugDump(const nsStringValueImpl &aString) { while(cp &aString) { cp++; } //while *outp=0; //force a null - printf("%s",theBuffer); + PRINTF("%s",theBuffer); } diff --git a/mozilla/xpcom/ds/nsDeque.cpp b/mozilla/xpcom/ds/nsDeque.cpp index ade76770da4..824e89a45a0 100644 --- a/mozilla/xpcom/ds/nsDeque.cpp +++ b/mozilla/xpcom/ds/nsDeque.cpp @@ -24,6 +24,11 @@ #include "nsDeque.h" #include "nsCRT.h" #include +#include "nslog.h" + +NS_IMPL_LOG(nsDequeLog) +#define PRINTF NS_LOG_PRINTF(nsDequeLog) +#define FLUSH NS_LOG_FLUSH(nsDequeLog) //#define _SELFTEST_DEQUE 1 #undef _SELFTEST_DEQUE @@ -50,7 +55,7 @@ nsDeque::~nsDeque() { #if 0 char buffer[30]; - printf("Capacity: %i\n",mCapacity); + PRINTF("Capacity: %i\n",mCapacity); static int mCaps[15] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; switch(mCapacity) { diff --git a/mozilla/xpcom/ds/nsPersistentProperties.cpp b/mozilla/xpcom/ds/nsPersistentProperties.cpp index dcde7094ea3..14d601543fc 100644 --- a/mozilla/xpcom/ds/nsPersistentProperties.cpp +++ b/mozilla/xpcom/ds/nsPersistentProperties.cpp @@ -32,6 +32,11 @@ #include "nsProperties.h" #include "pratom.h" #include "nsEnumeratorUtils.h" +#include "nslog.h" + +NS_IMPL_LOG(nsPersistentPropertiesLog) +#define PRINTF NS_LOG_PRINTF(nsPersistentPropertiesLog) +#define FLUSH NS_LOG_FLUSH(nsPersistentPropertiesLog) static PLHashNumber HashKey(const PRUnichar *aString) @@ -103,9 +108,7 @@ nsPersistentProperties::Load(nsIInputStream *aIn) ret = NS_NewConverterStream(&mIn, nsnull, aIn, 0, &uesc); #endif /* XPCOM_STANDALONE */ if (ret != NS_OK) { -#ifdef NS_DEBUG - printf("NS_NewConverterStream failed\n"); -#endif + PRINTF("NS_NewConverterStream failed\n"); return NS_ERROR_FAILURE; } c = Read(); @@ -230,10 +233,10 @@ nsPersistentProperties::SetStringProperty(const nsString& aKey, nsString& aNewVa PLHashEntry *he = *hep; if (he) { // XXX should we copy the old value to aOldValue, and then remove it? -#ifdef NS_DEBUG +#ifdef NS_ENABLE_LOGGING char buf[128]; aKey.ToCString(buf, sizeof(buf)); - printf("warning: property %s already exists\n", buf); + PRINTF("warning: property %s already exists\n", buf); #endif return NS_OK; } diff --git a/mozilla/xpcom/ds/nsStatistics.cpp b/mozilla/xpcom/ds/nsStatistics.cpp index 5fdb03c4397..6d106fbbd76 100644 --- a/mozilla/xpcom/ds/nsStatistics.cpp +++ b/mozilla/xpcom/ds/nsStatistics.cpp @@ -23,6 +23,12 @@ #include "nsISupportsUtils.h" #include "nsTraceRefcnt.h" // for NS_MeanAndStdDev #include "plhash.h" +#include "nslog.h" +#undef fprintf + +NS_IMPL_LOG(nsStatisticsLog) +#define PRINTF NS_LOG_PRINTF(nsStatisticsLog) +#define FLUSH NS_LOG_FLUSH(nsStatisticsLog) inline PLHashNumber nsStatistics::HashPRInt32(const void* aKey) diff --git a/mozilla/xpcom/ds/nsString.cpp b/mozilla/xpcom/ds/nsString.cpp index ff3129d4c0e..0b8540569e0 100644 --- a/mozilla/xpcom/ds/nsString.cpp +++ b/mozilla/xpcom/ds/nsString.cpp @@ -32,6 +32,11 @@ #include "nsDebug.h" #include "nsCRT.h" #include "nsDeque.h" +#include "nslog.h" + +NS_IMPL_LOG(nsStringLog) +#define PRINTF NS_LOG_PRINTF(nsStringLog) +#define FLUSH NS_LOG_FLUSH(nsStringLog) #ifndef RICKG_TESTBED #include "prdtoa.h" @@ -1538,7 +1543,7 @@ NS_COM int fputs(const nsCString& aString, FILE* out) void nsCString::DebugDump(void) const { if(mStr && (eOneByte==mCharSize)) { - printf("\n%s",mStr); + PRINTF("\n%s",mStr); } } diff --git a/mozilla/xpcom/ds/nsString2.cpp b/mozilla/xpcom/ds/nsString2.cpp index ad0611f101c..f6530cbcfe1 100644 --- a/mozilla/xpcom/ds/nsString2.cpp +++ b/mozilla/xpcom/ds/nsString2.cpp @@ -33,7 +33,11 @@ #include "prdtoa.h" #include "nsISizeOfHandler.h" #endif +#include "nslog.h" +NS_IMPL_LOG(nsString2Log) +#define PRINTF NS_LOG_PRINTF(nsString2Log) +#define FLUSH NS_LOG_FLUSH(nsString2Log) static const char* kPossibleNull = "Error: possible unintended null in string"; static const char* kNullPointerError = "Error: unexpected null ptr"; @@ -1753,7 +1757,7 @@ void nsString::DebugDump(void) const { } if(theBuffer) { - printf("\n%s",theBuffer); + PRINTF("\n%s",theBuffer); } } diff --git a/mozilla/xpcom/ds/nsVoidBTree.cpp b/mozilla/xpcom/ds/nsVoidBTree.cpp index 22d35ce6c94..83248968ab4 100644 --- a/mozilla/xpcom/ds/nsVoidBTree.cpp +++ b/mozilla/xpcom/ds/nsVoidBTree.cpp @@ -20,6 +20,11 @@ */ #include "nsVoidBTree.h" +#include "nslog.h" + +NS_IMPL_LOG(nsVoidBTreeLog) +#define PRINTF NS_LOG_PRINTF(nsVoidBTreeLog) +#define FLUSH NS_LOG_FLUSH(nsVoidBTreeLog) #ifdef DEBUG #include @@ -726,13 +731,13 @@ void nsVoidBTree::Dump(Node* aNode, PRInt32 aIndent) { for (PRInt32 i = 0; i < aIndent; ++i) - printf(" "); + PRINTF(" "); if (aNode->GetType() == Node::eType_Data) { - printf("data(%d/%d)\n", aNode->GetCount(), aNode->GetSubTreeSize()); + PRINTF("data(%d/%d)\n", aNode->GetCount(), aNode->GetSubTreeSize()); } else { - printf("index(%d/%d)\n", aNode->GetCount(), aNode->GetSubTreeSize()); + PRINTF("index(%d/%d)\n", aNode->GetCount(), aNode->GetSubTreeSize()); for (PRInt32 j = 0; j < aNode->GetCount(); ++j) Dump(NS_REINTERPRET_CAST(Node*, aNode->GetElementAt(j)), aIndent + 1); } diff --git a/mozilla/xpcom/glue/nsDebug.cpp b/mozilla/xpcom/glue/nsDebug.cpp index c3e583c0c95..c16ff4aedd2 100644 --- a/mozilla/xpcom/glue/nsDebug.cpp +++ b/mozilla/xpcom/glue/nsDebug.cpp @@ -86,10 +86,6 @@ #include #include #elif defined(XP_MAC) - #define TEMP_MAC_HACK - - //------------------------ - #ifdef TEMP_MAC_HACK #include #include #include @@ -101,10 +97,6 @@ #include #include - #undef PR_LOG - #undef PR_LogFlush - #define PR_LOG(module,level,args) dprintf args - #define PR_LogFlush() static void dprintf(const char *format, ...) { va_list ap; @@ -118,28 +110,31 @@ else DebugStr(buffer); } - #endif // TEMP_MAC_HACK - //------------------------ #elif defined(XP_UNIX) #include #endif -/** - * Define output so users will always see it - */ +#include "nslog.h" +#undef fprintf +#undef ERROR +#undef WARN +#undef BREAK -#if defined(XP_UNIX) || defined(_WIN32) -#define DBG_LOG(log,err,pargs) \ - InitLog(); \ - PR_LOG(log,err,pargs); \ - PR_LogFlush(); \ - printf pargs; putchar('\n'); -#else -#define DBG_LOG(log,err,pargs) \ - InitLog(); \ - PR_LOG(log,err,pargs); \ - PR_LogFlush(); -#endif +NS_IMPL_LOG_ENABLED(ASSERT) +#define ASSERT_PRINTF NS_LOG_PRINTF(ASSERT) +#define ASSERT_FLUSH NS_LOG_FLUSH(ASSERT) + +NS_IMPL_LOG_ENABLED(ABORT) +#define ABORT_PRINTF NS_LOG_PRINTF(ABORT) +#define ABORT_FLUSH NS_LOG_FLUSH(ABORT) + +NS_IMPL_LOG_ENABLED(WARN) +#define WARN_PRINTF NS_LOG_PRINTF(WARN) +#define WARN_FLUSH NS_LOG_FLUSH(WARN) + +NS_IMPL_LOG_ENABLED(BREAK) +#define BREAK_PRINTF NS_LOG_PRINTF(BREAK) +#define BREAK_FLUSH NS_LOG_FLUSH(BREAK) /* * Determine if debugger is present in windows. @@ -175,58 +170,42 @@ PRBool InDebugger() * always compiled in, in case some other module that uses it is * compiled with debugging even if this library is not. */ -static PRLogModuleInfo* gDebugLog; - -static void InitLog(void) -{ - if (0 == gDebugLog) { - gDebugLog = PR_NewLogModule("nsDebug"); - gDebugLog->level = PR_LOG_DEBUG; - } -} NS_COM void nsDebug::Assertion(const char* aStr, const char* aExpr, const char* aFile, PRIntn aLine) { - InitLog(); - char buf[1000]; PR_snprintf(buf, sizeof(buf), - "###!!! ASSERTION: %s: '%s', file %s, line %d", - aStr, aExpr, aFile, aLine); + "%s: '%s', file %s, line %d", + aStr, aExpr, aFile, aLine); - // Write out the assertion message to the debug log - PR_LOG(gDebugLog, PR_LOG_ERROR, ("%s", buf)); - PR_LogFlush(); - - // And write it out to the stdout - printf("%s\n", buf); - fflush(stdout); + ASSERT_PRINTF("%s", buf); + ASSERT_FLUSH(); #if defined(_WIN32) if(!InDebugger()) - { - char msg[1200]; - PR_snprintf(msg, sizeof(msg), - "%s\n\nClick Abort to exit the Application.\n" - "Click Retry to Debug the Application..\n" - "Click Ignore to continue running the Application.", buf); - int code = ::MessageBox(NULL, msg, "nsDebug::Assertion", - MB_ICONSTOP | MB_ABORTRETRYIGNORE); - switch(code) - { - case IDABORT: - //This should exit us - raise(SIGABRT); - //If we are ignored exit this way.. - _exit(3); - break; + { + char msg[1200]; + PR_snprintf(msg, sizeof(msg), + "%s\n\nClick Abort to exit the Application.\n" + "Click Retry to Debug the Application..\n" + "Click Ignore to continue running the Application.", buf); + int code = ::MessageBox(NULL, msg, "ASSERTION", + MB_ICONSTOP | MB_ABORTRETRYIGNORE); + switch(code) + { + case IDABORT: + //This should exit us + raise(SIGABRT); + //If we are ignored exit this way.. + _exit(3); + break; - case IDIGNORE: - return; - // Fall Through - } - } + case IDIGNORE: + return; + // Fall Through + } + } #endif #if defined(XP_OS2) @@ -235,7 +214,7 @@ NS_COM void nsDebug::Assertion(const char* aStr, const char* aExpr, "%s\n\nClick Cancel to Debug Application.\n" "Click Enter to continue running the Application.", buf); ULONG code = WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, msg, - "nsDebug::Assertion", 0, + "ASSERTION", 0, MB_ERROR | MB_ENTERCANCEL); /* It is possible that we are executing on a thread that doesn't have a @@ -253,19 +232,25 @@ NS_COM void nsDebug::Assertion(const char* aStr, const char* aExpr, } #endif +#if defined(XP_MAC) + dprintf("ASSERT: %s", buf); +#else Break(aFile, aLine); +#endif } NS_COM void nsDebug::Break(const char* aFile, PRIntn aLine) { -#ifndef TEMP_MAC_HACK - DBG_LOG(gDebugLog, PR_LOG_ERROR, - ("###!!! Break: at file %s, line %d", aFile, aLine)); -#if defined(_WIN32) + BREAK_PRINTF("at file %s, line %d", aFile, aLine); + BREAK_FLUSH(); + +#ifdef XP_MAC + dprintf("BREAK: at file %s, line %d", aFile, aLine); +#elif defined(_WIN32) #ifdef _M_IX86 - ::DebugBreak(); + ::DebugBreak(); #else /* _M_ALPHA */ - fprintf(stderr, "Break: at file %s\n",aFile, aLine); fflush(stderr); + fprintf(stderr, "BREAK: at file %s\n",aFile, aLine); fflush(stderr); #endif #elif defined(XP_UNIX) && !defined(UNIX_CRASH_ON_ASSERT) fprintf(stderr, "\07"); @@ -317,31 +302,20 @@ NS_COM void nsDebug::Break(const char* aFile, PRIntn aLine) { #ifdef UNIX_CRASH_ON_ASSERT char buf[2000]; - sprintf(buf, "Break: at file %s, line %d", aFile, aLine); + sprintf(buf, "BREAK: at file %s, line %d", aFile, aLine); DEBUGGER(buf); #endif } #else Abort(aFile, aLine); #endif -#endif // TEMP_MAC_HACK } NS_COM void nsDebug::Warning(const char* aMessage, const char* aFile, PRIntn aLine) { - InitLog(); - - char buf[1000]; - PR_snprintf(buf, sizeof(buf), - "WARNING: %s, file %s, line %d", - aMessage, aFile, aLine); - - // Write out the warning message to the debug log - PR_LOG(gDebugLog, PR_LOG_ERROR, ("%s", buf)); - - // And write it out to the stdout - printf("%s\n", buf); + WARN_PRINTF("%s, file %s, line %d", aMessage, aFile, aLine); + WARN_FLUSH(); } //**************** All Dead Code Below @@ -361,8 +335,8 @@ NS_COM PRBool nsDebug::WarnIfFalse(const char* aStr, const char* aExpr, NS_COM void nsDebug::Abort(const char* aFile, PRIntn aLine) { - DBG_LOG(gDebugLog, PR_LOG_ERROR, - ("###!!! Abort: at file %s, line %d", aFile, aLine)); + ABORT_PRINTF("at file %s, line %d", aFile, aLine); + ABORT_FLUSH(); #if defined(_WIN32) #ifdef _M_IX86 long* __p = (long*) 0x7; @@ -372,6 +346,7 @@ NS_COM void nsDebug::Abort(const char* aFile, PRIntn aLine) PR_Abort(); #endif #elif defined(XP_MAC) + dprintf("ABORT: at file %s, line %d", aFile, aLine); ExitToShell(); #elif defined(XP_UNIX) PR_Abort(); @@ -382,7 +357,7 @@ NS_COM void nsDebug::Abort(const char* aFile, PRIntn aLine) { #ifndef DEBUG_cls char buf[2000]; - sprintf(buf, "Abort: at file %s, line %d", aFile, aLine); + sprintf(buf, "ABORT: at file %s, line %d", aFile, aLine); DEBUGGER(buf); #endif } diff --git a/mozilla/xpcom/glue/nsGenericFactory.cpp b/mozilla/xpcom/glue/nsGenericFactory.cpp index 53629d55890..05afee507de 100644 --- a/mozilla/xpcom/glue/nsGenericFactory.cpp +++ b/mozilla/xpcom/glue/nsGenericFactory.cpp @@ -26,6 +26,12 @@ #include "nsGenericFactory.h" #include "nsCRT.h" +#include "nslog.h" + +NS_IMPL_LOG(nsGenericFactoryLog) +#define PRINTF NS_LOG_PRINTF(nsGenericFactoryLog) +#define FLUSH NS_LOG_FLUSH(nsGenericFactoryLog) + nsGenericFactory::nsGenericFactory(ConstructorProcPtr constructor) : mConstructor(constructor), mDestructor(NULL) { @@ -186,9 +192,9 @@ nsGenericModule::GetClassObject(nsIComponentManager *aCompMgr, desc++; } // not found in descriptions -#ifdef DEBUG +#ifdef NS_ENABLE_LOGGING char* cs = aClass.ToString(); - printf("+++ nsGenericModule %s: unable to create factory for %s\n", mModuleName, cs); + PRINTF("+++ nsGenericModule %s: unable to create factory for %s\n", mModuleName, cs); nsCRT::free(cs); #endif // XXX put in stop-gap so that we don't search for this one again @@ -207,9 +213,7 @@ nsGenericModule::RegisterSelf(nsIComponentManager *aCompMgr, { nsresult rv = NS_OK; -#ifdef DEBUG - printf("*** Registering %s components (all right -- a generic module!)\n", mModuleName); -#endif + PRINTF("*** Registering %s components (all right -- a generic module!)\n", mModuleName); nsModuleComponentInfo* cp = mComponents; for (PRUint32 i = 0; i < mComponentCount; i++) { @@ -217,10 +221,8 @@ nsGenericModule::RegisterSelf(nsIComponentManager *aCompMgr, cp->mContractID, aPath, PR_TRUE, PR_TRUE); if (NS_FAILED(rv)) { -#ifdef DEBUG - printf("nsGenericModule %s: unable to register %s component => %x\n", + PRINTF("nsGenericModule %s: unable to register %s component => %x\n", mModuleName?mModuleName:"(null)", cp->mDescription?cp->mDescription:"(null)", rv); -#endif break; } // Call the registration hook of the component, if any @@ -228,10 +230,8 @@ nsGenericModule::RegisterSelf(nsIComponentManager *aCompMgr, { rv = cp->mRegisterSelfProc(aCompMgr, aPath, registryLocation, componentType); if (NS_FAILED(rv)) { -#ifdef DEBUG - printf("nsGenericModule %s: Register hook for %s component returned error => %x\n", + PRINTF("nsGenericModule %s: Register hook for %s component returned error => %x\n", mModuleName?mModuleName:"(null)", cp->mDescription?cp->mDescription:"(null)", rv); -#endif break; } } @@ -246,9 +246,7 @@ nsGenericModule::UnregisterSelf(nsIComponentManager* aCompMgr, nsIFile* aPath, const char* registryLocation) { -#ifdef DEBUG - printf("*** Unregistering %s components (all right -- a generic module!)\n", mModuleName); -#endif + PRINTF("*** Unregistering %s components (all right -- a generic module!)\n", mModuleName); nsModuleComponentInfo* cp = mComponents; for (PRUint32 i = 0; i < mComponentCount; i++) { // Call the unregistration hook of the component, if any @@ -259,10 +257,8 @@ nsGenericModule::UnregisterSelf(nsIComponentManager* aCompMgr, // Unregister the component nsresult rv = aCompMgr->UnregisterComponentSpec(cp->mCID, aPath); if (NS_FAILED(rv)) { -#ifdef DEBUG - printf("nsGenericModule %s: unable to unregister %s component => %x\n", + PRINTF("nsGenericModule %s: unable to unregister %s component => %x\n", mModuleName, cp->mDescription, rv); -#endif } cp++; } diff --git a/mozilla/xpcom/io/MANIFEST_IDL b/mozilla/xpcom/io/MANIFEST_IDL index 95874e5cc56..e142466e12a 100644 --- a/mozilla/xpcom/io/MANIFEST_IDL +++ b/mozilla/xpcom/io/MANIFEST_IDL @@ -1,7 +1,5 @@ nsIFileSpec.idl -nsIBufferInputStream.idl nsIInputStream.idl -nsIBaseStream.idl nsIOutputStream.idl nsIPipe.idl nsIFile.idl diff --git a/mozilla/xpcom/io/nsAppFileLocationProvider.cpp b/mozilla/xpcom/io/nsAppFileLocationProvider.cpp index ab7ea6bf7ab..abe6119a4a0 100755 --- a/mozilla/xpcom/io/nsAppFileLocationProvider.cpp +++ b/mozilla/xpcom/io/nsAppFileLocationProvider.cpp @@ -139,11 +139,12 @@ nsAppFileLocationProvider::nsAppFileLocationProvider() // 2. If that doesn't work, set it to be the current process directory NS_WITH_SERVICE(nsIProperties, directoryService, NS_DIRECTORY_SERVICE_CONTRACTID, &rv); - if (NS_SUCCEEDED(rv)) + if (NS_SUCCEEDED(rv)) { rv = directoryService->Get(NS_XPCOM_CURRENT_PROCESS_DIR, NS_GET_IID(nsIFile), getter_AddRefs(mMozBinDirectory)); - if (NS_FAILED(rv)) { - rv = directoryService->Get(NS_OS_CURRENT_PROCESS_DIR, NS_GET_IID(nsIFile), getter_AddRefs(mMozBinDirectory)); + if (NS_FAILED(rv)) { + rv = directoryService->Get(NS_OS_CURRENT_PROCESS_DIR, NS_GET_IID(nsIFile), getter_AddRefs(mMozBinDirectory)); + } } } diff --git a/mozilla/xpcom/io/nsDirectoryService.cpp b/mozilla/xpcom/io/nsDirectoryService.cpp index 1d2aba834d4..c87ed55389f 100644 --- a/mozilla/xpcom/io/nsDirectoryService.cpp +++ b/mozilla/xpcom/io/nsDirectoryService.cpp @@ -57,6 +57,11 @@ #endif #include "nsSpecialSystemDirectory.h" +#include "nslog.h" + +NS_IMPL_LOG(nsDirectoryServiceLog) +#define PRINTF NS_LOG_PRINTF(nsDirectoryServiceLog) +#define FLUSH NS_LOG_FLUSH(nsDirectoryServiceLog) #ifdef XP_MAC #define COMPONENT_REGISTRY_NAME "Component Registry" @@ -228,7 +233,7 @@ nsDirectoryService::GetCurrentProcessDirectory(nsILocalFile** aFile) if(firstWarning) { // Warn that MOZILLA_FIVE_HOME not set, once. - printf("Warning: MOZILLA_FIVE_HOME not set.\n"); + NS_WARNING("Warning: MOZILLA_FIVE_HOME not set.\n"); firstWarning = PR_FALSE; } diff --git a/mozilla/xpcom/io/nsFileSpecBeOS.cpp b/mozilla/xpcom/io/nsFileSpecBeOS.cpp index b24d0897314..bb7fde726ca 100644 --- a/mozilla/xpcom/io/nsFileSpecBeOS.cpp +++ b/mozilla/xpcom/io/nsFileSpecBeOS.cpp @@ -37,6 +37,11 @@ #include #include #include +#include "nslog.h" + +NS_IMPL_LOG(nsFileSpecBeOSLog, 0) +#define PRINTF NS_LOG_PRINTF(nsFileSpecBeOSLog) +#define FLUSH NS_LOG_FLUSH(nsFileSpecBeOSLog) //---------------------------------------------------------------------------------------- void nsFileSpecHelpers::Canonify(nsSimpleCharString& ioPath, PRBool inMakeDirs) @@ -462,7 +467,7 @@ PRInt64 nsFileSpec::GetDiskSpaceAvailable() const BVolume v(ref.device); #ifdef DEBUG_DISK_SPACE - printf("DiskSpaceAvailable: %d bytes\n", space); + PRINTF("DiskSpaceAvailable: %d bytes\n", space); #endif return v.FreeBytes(); } // nsFileSpec::GetDiskSpace() diff --git a/mozilla/xpcom/io/nsFileSpecUnix.cpp b/mozilla/xpcom/io/nsFileSpecUnix.cpp index 3ebb8cad7b1..7587ec62b27 100644 --- a/mozilla/xpcom/io/nsFileSpecUnix.cpp +++ b/mozilla/xpcom/io/nsFileSpecUnix.cpp @@ -32,6 +32,11 @@ #include #include "nsError.h" #include "prio.h" /* for PR_Rename */ +#include "nslog.h" + +NS_IMPL_LOG(nsFileSpecUnixLog) +#define PRINTF NS_LOG_PRINTF(nsFileSpecUnixLog) +#define FLUSH NS_LOG_FLUSH(nsFileSpecUnixLog) #if defined(_SCO_DS) #define _SVID3 /* for statvfs.h */ @@ -525,8 +530,8 @@ PRInt64 nsFileSpec::GetDiskSpaceAvailable() const return bytes; /* hope for the best as we did in cheddar */ #ifdef DEBUG_DISK_SPACE - printf("DiskSpaceAvailable: %d bytes\n", - fs_buf.f_bsize * (fs_buf.f_bavail - 1)); + PRINTF("DiskSpaceAvailable: %d bytes\n", + fs_buf.f_bsize * (fs_buf.f_bavail - 1)); #endif LL_I2L( bytes, (fs_buf.f_bsize * (fs_buf.f_bavail - 1) ) ); diff --git a/mozilla/xpcom/io/nsIFileStream.cpp b/mozilla/xpcom/io/nsIFileStream.cpp index 38ae5efda4f..a6dc2898485 100644 --- a/mozilla/xpcom/io/nsIFileStream.cpp +++ b/mozilla/xpcom/io/nsIFileStream.cpp @@ -40,6 +40,12 @@ #include #endif +#include "nslog.h" + +NS_IMPL_LOG(nsIFileStreamLog) +#define PRINTF NS_LOG_PRINTF(nsIFileStreamLog) +#define FLUSH NS_LOG_FLUSH(nsIFileStreamLog) + //======================================================================================== class FileImpl : public nsIRandomAccessStore @@ -155,7 +161,7 @@ FileImpl::FileImpl(const nsFileSpec& inFile, int nsprMode, PRIntn accessMode) mFailed = PR_TRUE; #if DEBUG char *fileName = inFile.GetLeafName(); - printf("Opening file %s failed\n", fileName); + PRINTF("Opening file %s failed\n", fileName); nsCRT::free(fileName); #endif } diff --git a/mozilla/xpcom/io/nsLocalFileOS2.h b/mozilla/xpcom/io/nsLocalFileOS2.h index c829e86e506..5e33aa91741 100644 --- a/mozilla/xpcom/io/nsLocalFileOS2.h +++ b/mozilla/xpcom/io/nsLocalFileOS2.h @@ -40,6 +40,11 @@ #include "nsILocalFile.h" #include "nsIFactory.h" #include "nsLocalFile.h" +#include "nslog.h" + +NS_IMPL_LOG(nsLocalFileOS2Log, 0) +#define PRINTF NS_LOG_PRINTF(nsLocalFileOS2Log) +#define FLUSH NS_LOG_FLUSH(nsLocalFileOS2Log) #define INCL_DOSFILEMGR #define INCL_DOSERRORS @@ -69,7 +74,7 @@ nsresultForErrno(int err) { #ifdef DEBUG if (err) - fprintf(stderr, "errno %d\n", err); + PRINTF("errno %d\n", err); #endif switch(err) { case 0: diff --git a/mozilla/xpcom/io/nsLocalFileUnix.cpp b/mozilla/xpcom/io/nsLocalFileUnix.cpp index 1b74cfa7230..e21e3550f4a 100644 --- a/mozilla/xpcom/io/nsLocalFileUnix.cpp +++ b/mozilla/xpcom/io/nsLocalFileUnix.cpp @@ -54,6 +54,10 @@ #include "nsXPIDLString.h" #include "prproces.h" +NS_IMPL_LOG(nsLocalFileUnixLog) +#define PRINTF FILE_PRINTF +#define FLUSH FILE_FLUSH + // we need these for statfs() #ifdef HAVE_SYS_STATVFS_H @@ -275,7 +279,7 @@ nsLocalFile::CreateAllAncestors(PRUint32 permissions) *slashp = buffer; #ifdef DEBUG_NSIFILE - fprintf(stderr, "nsIFile: before: %s\n", buffer); + PRINTF("nsIFile: before: %s\n", buffer); #endif while ((slashp = strchr(slashp + 1, '/'))) { @@ -297,7 +301,7 @@ nsLocalFile::CreateAllAncestors(PRUint32 permissions) /* Temporarily NUL-terminate here */ *slashp = '\0'; #ifdef DEBUG_NSIFILE - fprintf(stderr, "nsIFile: mkdir(\"%s\")\n", buffer); + PRINTF("nsIFile: mkdir(\"%s\")\n", buffer); #endif int result = mkdir(buffer, permissions); @@ -315,7 +319,7 @@ nsLocalFile::CreateAllAncestors(PRUint32 permissions) } #ifdef DEBUG_NSIFILE - fprintf(stderr, "nsIFile: after: %s\n", buffer); + PRINTF("nsIFile: after: %s\n", buffer); #endif return NS_OK; @@ -390,7 +394,7 @@ nsLocalFile::Create(PRUint32 type, PRUint32 permissions) dirperm |= S_IXOTH; #ifdef DEBUG_NSIFILE - fprintf(stderr, "nsIFile: perm = %o, dirperm = %o\n", permissions, + PRINTF("nsIFile: perm = %o, dirperm = %o\n", permissions, dirperm); #endif @@ -398,7 +402,7 @@ nsLocalFile::Create(PRUint32 type, PRUint32 permissions) return NS_ERROR_FAILURE; #ifdef DEBUG_NSIFILE - fprintf(stderr, "nsIFile: Create(\"%s\") again\n", (const char *)mPath); + PRINTF("nsIFile: Create(\"%s\") again\n", (const char *)mPath); #endif result = exclusiveCreateFunc((const char *)mPath, permissions); } @@ -626,7 +630,7 @@ nsLocalFile::CopyTo(nsIFile *newParent, const char *newName) return rv; #ifdef DEBUG_blizzard - printf("nsLocalFile::CopyTo() %s -> %s\n", (const char *)mPath, (const char *)newPathName); + PRINTF("nsLocalFile::CopyTo() %s -> %s\n", (const char *)mPath, (const char *)newPathName); #endif // actually create the file. @@ -702,7 +706,7 @@ nsLocalFile::CopyTo(nsIFile *newParent, const char *newName) } #ifdef DEBUG_blizzard - printf("read %d bytes, wrote %d bytes\n", + PRINTF("read %d bytes, wrote %d bytes\n", totalRead, totalWritten); #endif @@ -980,13 +984,13 @@ nsLocalFile::GetDiskSpaceAvailable(PRInt64 *aDiskSpaceAvailable) if (STATFS(mPath, &fs_buf) < 0) { // The call to STATFS failed. #ifdef DEBUG - printf("ERROR: GetDiskSpaceAvailable: STATFS call FAILED. \n"); + PRINTF("ERROR: GetDiskSpaceAvailable: STATFS call FAILED. \n"); #endif return NS_ERROR_FAILURE; } #ifdef DEBUG_DISK_SPACE - printf("DiskSpaceAvailable: %d bytes\n", - fs_buf.f_bsize * (fs_buf.f_bavail - 1)); + PRINTF("DiskSpaceAvailable: %d bytes\n", + fs_buf.f_bsize * (fs_buf.f_bavail - 1)); #endif // The number of Bytes free = The number of free blocks available to @@ -1008,7 +1012,7 @@ nsLocalFile::GetDiskSpaceAvailable(PRInt64 *aDiskSpaceAvailable) ** properly for these platforms yet. */ #ifdef DEBUG - printf("ERROR: GetDiskSpaceAvailable: Not implemented for plaforms without statfs.\n"); + PRINTF("ERROR: GetDiskSpaceAvailable: Not implemented for plaforms without statfs.\n"); #endif return NS_ERROR_NOT_IMPLEMENTED; diff --git a/mozilla/xpcom/io/nsLocalFileUnix.h b/mozilla/xpcom/io/nsLocalFileUnix.h index c789edf5c4c..3aac9bb059e 100644 --- a/mozilla/xpcom/io/nsLocalFileUnix.h +++ b/mozilla/xpcom/io/nsLocalFileUnix.h @@ -37,12 +37,19 @@ #include "nsILocalFile.h" #include "nsLocalFile.h" #include "nsXPIDLString.h" +#include "nslog.h" + +NS_DECL_LOG(nsLocalFileUnixLog) +#define FILE_PRINTF NS_LOG_PRINTF(nsLocalFileUnixLog) +#define FILE_FLUSH NS_LOG_FLUSH(nsLocalFileUnixLog) #define NSRESULT_FOR_RETURN(ret) (((ret) < 0) ? NSRESULT_FOR_ERRNO() : NS_OK) inline nsresult nsresultForErrno(int err) { + if (err) + FILE_PRINTF("errno %d\n", err); switch(err) { case 0: return NS_OK; @@ -97,6 +104,7 @@ protected: nsresult FillStatCache() { if (stat(mPath, &mCachedStat) == -1) { + FILE_PRINTF("stat(%s) -> %d\n", (const char *)mPath, errno); return NS_ERROR_FAILURE; } mHaveCachedStat = PR_TRUE; diff --git a/mozilla/xpcom/io/nsSpecialSystemDirectory.cpp b/mozilla/xpcom/io/nsSpecialSystemDirectory.cpp index 231a1dbbc65..252bb0933da 100644 --- a/mozilla/xpcom/io/nsSpecialSystemDirectory.cpp +++ b/mozilla/xpcom/io/nsSpecialSystemDirectory.cpp @@ -67,6 +67,11 @@ #include "nsHashtable.h" #include "prlog.h" +#include "nslog.h" + +NS_IMPL_LOG(nsSpecialSystemDirectoryLog) +#define PRINTF NS_LOG_PRINTF(nsSpecialSystemDirectoryLog) +#define FLUSH NS_LOG_FLUSH(nsSpecialSystemDirectoryLog) class SystemDirectoriesKey : public nsHashKey { public: @@ -250,7 +255,7 @@ static void GetCurrentProcessDirectory(nsFileSpec& aFileSpec) if(firstWarning) { // Warn that MOZILLA_FIVE_HOME not set, once. - printf("Warning: MOZILLA_FIVE_HOME not set.\n"); + NS_WARNING("Warning: MOZILLA_FIVE_HOME not set.\n"); firstWarning = PR_FALSE; } @@ -344,7 +349,7 @@ void nsSpecialSystemDirectory::operator = (SystemDirectories aSystemSystemDirect } #elif defined(XP_OS2) { - // printf( "*** Warning warning OS_DriveDirectory called for"); + // PRINTF( "*** Warning warning OS_DriveDirectory called for"); ULONG ulBootDrive = 0; char buffer[] = " :\\OS2\\"; @@ -352,9 +357,7 @@ void nsSpecialSystemDirectory::operator = (SystemDirectories aSystemSystemDirect &ulBootDrive, sizeof ulBootDrive); buffer[0] = 'A' - 1 + ulBootDrive; // duh, 1-based index... *this = buffer; -#ifdef DEBUG - printf( "Got OS_DriveDirectory: %s\n", buffer); -#endif + PRINTF( "Got OS_DriveDirectory: %s\n", buffer); } #elif defined(XP_MAC) { @@ -836,9 +839,7 @@ void nsSpecialSystemDirectory::operator = (SystemDirectories aSystemSystemDirect &ulBootDrive, sizeof ulBootDrive); buffer[0] = 'A' - 1 + ulBootDrive; // duh, 1-based index... *this = buffer; -#ifdef DEBUG - printf( "Got OS2_SystemDirectory: %s\n", buffer); -#endif + PRINTF( "Got OS2_SystemDirectory: %s\n", buffer); break; } @@ -850,9 +851,7 @@ void nsSpecialSystemDirectory::operator = (SystemDirectories aSystemSystemDirect &ulBootDrive, sizeof ulBootDrive); buffer[0] = 'A' - 1 + ulBootDrive; // duh, 1-based index... *this = buffer; -#ifdef DEBUG - printf( "Got OS2_OS2Directory: %s\n", buffer); -#endif + PRINTF( "Got OS2_OS2Directory: %s\n", buffer); break; } @@ -866,13 +865,11 @@ void nsSpecialSystemDirectory::operator = (SystemDirectories aSystemSystemDirect break; szPath[len] = '\\'; szPath[len + 1] = '\0'; -#ifdef DEBUG if (fSuccess) { - printf ("Got OS2_DesktopDirectory: %s\n", szPath); + PRINTF ("Got OS2_DesktopDirectory: %s\n", szPath); } else { - printf ("Failed getting OS2_DesktopDirectory: %s\n", szPath); + PRINTF ("Failed getting OS2_DesktopDirectory: %s\n", szPath); } -#endif break; } diff --git a/mozilla/xpcom/proxy/src/nsProxyEventClass.cpp b/mozilla/xpcom/proxy/src/nsProxyEventClass.cpp index 2a3cb8e0be1..5a1325b443d 100644 --- a/mozilla/xpcom/proxy/src/nsProxyEventClass.cpp +++ b/mozilla/xpcom/proxy/src/nsProxyEventClass.cpp @@ -36,6 +36,11 @@ #include "nsAutoLock.h" #include "nsIInterfaceInfoManager.h" #include "xptcall.h" +#include "nslog.h" + +NS_IMPL_LOG(nsProxyEventClassLog) +#define PRINTF NS_LOG_PRINTF(nsProxyEventClassLog) +#define FLUSH NS_LOG_FLUSH(nsProxyEventClassLog) // LIFETIME_CACHE will cache class for the entire cyle of the application. #define LIFETIME_CACHE @@ -79,7 +84,7 @@ nsProxyEventClass::GetNewOrUsedClass(REFNSIID aIID) #ifdef PROXYEVENTCLASS_DEBUG char* iidStr = aIID.ToString(); - printf("GetNewOrUsedClass %s\n", iidStr); + PRINTF("GetNewOrUsedClass %s\n", iidStr); nsCRT::free(iidStr); #endif @@ -89,7 +94,7 @@ nsProxyEventClass::GetNewOrUsedClass(REFNSIID aIID) NS_ADDREF(clazz); #ifdef PROXYEVENTCLASS_DEBUG char* iidStr = aIID.ToString(); - printf("GetNewOrUsedClass %s hit\n", iidStr); + PRINTF("GetNewOrUsedClass %s hit\n", iidStr); nsCRT::free(iidStr); #endif } @@ -168,7 +173,7 @@ nsProxyEventClass::nsProxyEventClass(REFNSIID aIID, nsIInterfaceInfo* aInfo) #endif #ifdef PROXYEVENTCLASS_DEBUG char* iidStr = aIID.ToString(); - printf("GetNewOrUsedClass %s put\n", iidStr); + PRINTF("GetNewOrUsedClass %s put\n", iidStr); nsCRT::free(iidStr); #endif } @@ -211,7 +216,7 @@ nsProxyEventClass::~nsProxyEventClass() iidToClassMap->Remove(&key); #ifdef PROXYEVENTCLASS_DEBUG char* iidStr = mIID.ToString(); - printf("GetNewOrUsedClass %s remove\n", iidStr); + PRINTF("GetNewOrUsedClass %s remove\n", iidStr); nsCRT::free(iidStr); #endif } diff --git a/mozilla/xpcom/proxy/src/nsProxyEventObject.cpp b/mozilla/xpcom/proxy/src/nsProxyEventObject.cpp index f2f45339122..4d809a186fe 100644 --- a/mozilla/xpcom/proxy/src/nsProxyEventObject.cpp +++ b/mozilla/xpcom/proxy/src/nsProxyEventObject.cpp @@ -34,6 +34,11 @@ #include "xptcall.h" #include "nsAutoLock.h" +#include "nslog.h" + +NS_IMPL_LOG(nsProxyEventObjectLog) +#define PRINTF NS_LOG_PRINTF(nsProxyEventObjectLog) +#define FLUSH NS_LOG_FLUSH(nsProxyEventObjectLog) static NS_DEFINE_IID(kProxyObject_Identity_Class_IID, NS_PROXYEVENT_IDENTITY_CLASS_IID); @@ -88,8 +93,8 @@ nsProxyEventObject::DebugDump(const char * message, PRUint32 hashKey) if (message) { - printf("\n-=-=-=-=-=-=-=-=-=-=-=-=-\n"); - printf("%s\n", message); + PRINTF("\n-=-=-=-=-=-=-=-=-=-=-=-=-\n"); + PRINTF("%s\n", message); if(strcmp(message, "Create") == 0) { @@ -101,39 +106,39 @@ nsProxyEventObject::DebugDump(const char * message, PRUint32 hashKey) outstandingProxyObjects--; } } - printf("nsProxyEventObject @ %x with mRefCnt = %d\n", this, mRefCnt); + PRINTF("nsProxyEventObject @ %x with mRefCnt = %d\n", this, mRefCnt); PRBool isRoot = mRoot == nsnull; - printf("%s wrapper around @ %x\n", isRoot ? "ROOT":"non-root\n", GetRealObject()); + PRINTF("%s wrapper around @ %x\n", isRoot ? "ROOT":"non-root\n", GetRealObject()); nsCOMPtr rootObject = do_QueryInterface(mProxyObject->mRealObject); nsCOMPtr rootQueue = do_QueryInterface(mProxyObject->mDestQueue); nsProxyEventKey key(rootObject, rootQueue, mProxyObject->mProxyType); - printf("Hashkey: %d\n", key.HashCode()); + PRINTF("Hashkey: %d\n", key.HashCode()); char* name; GetClass()->GetInterfaceInfo()->GetName(&name); - printf("interface name is %s\n", name); + PRINTF("interface name is %s\n", name); if(name) nsMemory::Free(name); char * iid = GetClass()->GetProxiedIID().ToString(); - printf("IID number is %s\n", iid); + PRINTF("IID number is %s\n", iid); delete iid; - printf("nsProxyEventClass @ %x\n", mClass); + PRINTF("nsProxyEventClass @ %x\n", mClass); if(mNext) { if(isRoot) { - printf("Additional wrappers for this object...\n"); + PRINTF("Additional wrappers for this object...\n"); } mNext->DebugDump(nsnull, 0); } - printf("[proxyobjects] %d total used in system, %d outstading\n", totalProxyObjects, outstandingProxyObjects); + PRINTF("[proxyobjects] %d total used in system, %d outstading\n", totalProxyObjects, outstandingProxyObjects); if (message) - printf("-=-=-=-=-=-=-=-=-=-=-=-=-\n"); + PRINTF("-=-=-=-=-=-=-=-=-=-=-=-=-\n"); PR_ExitMonitor(mon); } diff --git a/mozilla/xpcom/reflect/xptinfo/src/xptiInterfaceInfoManager.cpp b/mozilla/xpcom/reflect/xptinfo/src/xptiInterfaceInfoManager.cpp index 260a77a2146..f076e218c05 100644 --- a/mozilla/xpcom/reflect/xptinfo/src/xptiInterfaceInfoManager.cpp +++ b/mozilla/xpcom/reflect/xptinfo/src/xptiInterfaceInfoManager.cpp @@ -23,6 +23,11 @@ /* Implementation of xptiInterfaceInfoManager. */ #include "xptiprivate.h" +#include "nslog.h" + +NS_IMPL_LOG(xptiInterfaceInfoManagerLog) +#define PRINTF NS_LOG_PRINTF(xptiInterfaceInfoManagerLog) +#define FLUSH NS_LOG_FLUSH(xptiInterfaceInfoManagerLog) NS_IMPL_THREADSAFE_ISUPPORTS1(xptiInterfaceInfoManager, nsIInterfaceInfoManager) @@ -95,11 +100,11 @@ xptiInterfaceInfoManager::xptiInterfaceInfoManager() if(mStatsLogFile && NS_SUCCEEDED(mStatsLogFile->InitWithPath(statsFilename))) { - printf("* Logging xptinfo stats to: %s\n", statsFilename); + PRINTF("* Logging xptinfo stats to: %s\n", statsFilename); } else { - printf("* Failed to create xptinfo stats file: %s\n", statsFilename); + PRINTF("* Failed to create xptinfo stats file: %s\n", statsFilename); mStatsLogFile = nsnull; } } @@ -111,11 +116,11 @@ xptiInterfaceInfoManager::xptiInterfaceInfoManager() if(mAutoRegLogFile && NS_SUCCEEDED(mAutoRegLogFile->InitWithPath(autoRegFilename))) { - printf("* Logging xptinfo autoreg to: %s\n", autoRegFilename); + PRINTF("* Logging xptinfo autoreg to: %s\n", autoRegFilename); } else { - printf("* Failed to create xptinfo autoreg file: %s\n", autoRegFilename); + PRINTF("* Failed to create xptinfo autoreg file: %s\n", autoRegFilename); mAutoRegLogFile = nsnull; } } @@ -841,7 +846,7 @@ xptiInterfaceInfoManager::DoFullValidationMergeFromFileList(nsISupportsArray* aF name, aWorkingSet); nsMemory::Free(name); -// printf("* found %s\n", fileRecord.GetName()); +// PRINTF("* found %s\n", fileRecord.GetName()); if(xptiFileType::IsXPT(fileRecord.GetName())) @@ -1279,7 +1284,7 @@ xptiInterfaceInfoManager::DEBUG_DumpFileList(nsISupportsArray* aFileList) if(NS_FAILED(file->GetLeafName(&name))) return PR_FALSE; - printf("* found %s\n", name); + PRINTF("* found %s\n", name); nsMemory::Free(name); } return PR_TRUE; @@ -1292,7 +1297,7 @@ xptiInterfaceInfoManager::DEBUG_DumpFileListInWorkingSet(xptiWorkingSet* aWorkin { xptiFile& record = aWorkingSet->GetFileAt(i); - printf("! has %s\n", record.GetName()); + PRINTF("! has %s\n", record.GetName()); } return PR_TRUE; } @@ -1310,7 +1315,7 @@ xptiInterfaceInfoManager::DEBUG_DumpFileArray(nsILocalFile** aFileArray, if(NS_FAILED(file->GetLeafName(&name))) return PR_FALSE; - printf("found file: %s\n", name); + PRINTF("found file: %s\n", name); nsMemory::Free(name); } return PR_TRUE; diff --git a/mozilla/xpcom/reflect/xptinfo/src/xptiManifest.cpp b/mozilla/xpcom/reflect/xptinfo/src/xptiManifest.cpp index 4537c820417..e1d53c6048c 100644 --- a/mozilla/xpcom/reflect/xptinfo/src/xptiManifest.cpp +++ b/mozilla/xpcom/reflect/xptinfo/src/xptiManifest.cpp @@ -23,6 +23,11 @@ /* Implementation of xptiManifest. */ #include "xptiprivate.h" +#include "nslog.h" + +NS_IMPL_LOG(xptiManifestLog) +#define PRINTF NS_LOG_PRINTF(xptiManifestLog) +#define FLUSH NS_LOG_FLUSH(xptiManifestLog) static const char g_MainManifestFilename[] = "xpti.dat"; @@ -232,7 +237,7 @@ ReadManifestIntoMemory(xptiInterfaceInfoManager* aMgr, char* path; if(!shown && NS_SUCCEEDED(aFile->GetPath(&path)) && path) { - printf("Type Manifest File: %s\n", path); + PRINTF("Type Manifest File: %s\n", path); nsMemory::Free(path); shown = PR_TRUE; } diff --git a/mozilla/xpcom/reflect/xptinfo/src/xptiMisc.cpp b/mozilla/xpcom/reflect/xptinfo/src/xptiMisc.cpp index ee05519e109..781f2941fda 100644 --- a/mozilla/xpcom/reflect/xptinfo/src/xptiMisc.cpp +++ b/mozilla/xpcom/reflect/xptinfo/src/xptiMisc.cpp @@ -23,6 +23,11 @@ /* Implementation of misc. xpti stuff. */ #include "xptiprivate.h" +#include "nslog.h" + +NS_IMPL_LOG(xptiMiscLog) +#define PRINTF NS_LOG_PRINTF(xptiMiscLog) +#define FLUSH NS_LOG_FLUSH(xptiMiscLog) struct xptiFileTypeEntry { @@ -82,9 +87,7 @@ xptiAutoLog::xptiAutoLog(xptiInterfaceInfoManager* mgr, } else { -#ifdef DEBUG - printf("xpti failed to open log file for writing\n"); -#endif + PRINTF("xpti failed to open log file for writing\n"); } } }; diff --git a/mozilla/xpcom/string/obsolete/nsString.cpp b/mozilla/xpcom/string/obsolete/nsString.cpp index ff3129d4c0e..0b8540569e0 100644 --- a/mozilla/xpcom/string/obsolete/nsString.cpp +++ b/mozilla/xpcom/string/obsolete/nsString.cpp @@ -32,6 +32,11 @@ #include "nsDebug.h" #include "nsCRT.h" #include "nsDeque.h" +#include "nslog.h" + +NS_IMPL_LOG(nsStringLog) +#define PRINTF NS_LOG_PRINTF(nsStringLog) +#define FLUSH NS_LOG_FLUSH(nsStringLog) #ifndef RICKG_TESTBED #include "prdtoa.h" @@ -1538,7 +1543,7 @@ NS_COM int fputs(const nsCString& aString, FILE* out) void nsCString::DebugDump(void) const { if(mStr && (eOneByte==mCharSize)) { - printf("\n%s",mStr); + PRINTF("\n%s",mStr); } } diff --git a/mozilla/xpcom/string/obsolete/nsString2.cpp b/mozilla/xpcom/string/obsolete/nsString2.cpp index ad0611f101c..f6530cbcfe1 100644 --- a/mozilla/xpcom/string/obsolete/nsString2.cpp +++ b/mozilla/xpcom/string/obsolete/nsString2.cpp @@ -33,7 +33,11 @@ #include "prdtoa.h" #include "nsISizeOfHandler.h" #endif +#include "nslog.h" +NS_IMPL_LOG(nsString2Log) +#define PRINTF NS_LOG_PRINTF(nsString2Log) +#define FLUSH NS_LOG_FLUSH(nsString2Log) static const char* kPossibleNull = "Error: possible unintended null in string"; static const char* kNullPointerError = "Error: unexpected null ptr"; @@ -1753,7 +1757,7 @@ void nsString::DebugDump(void) const { } if(theBuffer) { - printf("\n%s",theBuffer); + PRINTF("\n%s",theBuffer); } } diff --git a/mozilla/xpfe/appfilelocprovider/src/nsAppFileLocationProvider.cpp b/mozilla/xpfe/appfilelocprovider/src/nsAppFileLocationProvider.cpp index 3e874519f88..fe7b4de4d6d 100755 --- a/mozilla/xpfe/appfilelocprovider/src/nsAppFileLocationProvider.cpp +++ b/mozilla/xpfe/appfilelocprovider/src/nsAppFileLocationProvider.cpp @@ -398,7 +398,7 @@ static nsresult GetCurrentProcessDirectory(nsILocalFile** aFile) if(firstWarning) { // Warn that MOZILLA_FIVE_HOME not set, once. - printf("Warning: MOZILLA_FIVE_HOME not set.\n"); + NS_WARNING("Warning: MOZILLA_FIVE_HOME not set.\n"); firstWarning = PR_FALSE; } diff --git a/mozilla/xpfe/appshell/src/nsAppShellService.cpp b/mozilla/xpfe/appshell/src/nsAppShellService.cpp index 07d22346eaa..1ae7d7844bc 100644 --- a/mozilla/xpfe/appshell/src/nsAppShellService.cpp +++ b/mozilla/xpfe/appshell/src/nsAppShellService.cpp @@ -63,6 +63,11 @@ #include "jsapi.h" #include "nsAppShellService.h" +#include "nslog.h" + +NS_IMPL_LOG(nsAppShellServiceLog) +#define PRINTF NS_LOG_PRINTF(nsAppShellServiceLog) +#define FLUSH NS_LOG_FLUSH(nsAppShellServiceLog) /* Define Class IDs */ static NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID); @@ -328,10 +333,8 @@ nsAppShellService::EnumerateComponents( EnumeratorMemberFunction function ) { } } else { // Unable to set up for subkey enumeration. - #ifdef NS_DEBUG - printf( "Unable to enumerator app shell components, %s rv=0x%08X\n", - failed, (int)rv ); - #endif + PRINTF( "Unable to enumerator app shell components, %s rv=0x%08X\n", + failed, (int)rv ); } return; @@ -350,7 +353,7 @@ nsAppShellService::InitializeComponent( const nsCID &aComponentCID ) { rv = component->Initialize( this, mCmdLineService ); #ifdef NS_DEBUG char *name = aComponentCID.ToString(); - printf( "Initialized app shell component %s, rv=0x%08X\n", + PRINTF( "Initialized app shell component %s, rv=0x%08X\n", name, (int)rv ); Recycle(name); #endif @@ -360,7 +363,7 @@ nsAppShellService::InitializeComponent( const nsCID &aComponentCID ) { // Error creating component. #ifdef NS_DEBUG char *name = aComponentCID.ToString(); - printf( "Error creating app shell component %s, rv=0x%08X\n", + PRINTF( "Error creating app shell component %s, rv=0x%08X\n", name, (int)rv ); Recycle(name); #endif @@ -381,7 +384,7 @@ nsAppShellService::ShutdownComponent( const nsCID &aComponentCID ) { rv = component->Shutdown(); #ifdef NS_DEBUG char *name = aComponentCID.ToString(); - printf( "Shut down app shell component %s, rv=0x%08X\n", + PRINTF( "Shut down app shell component %s, rv=0x%08X\n", name, (int)rv ); nsCRT::free(name); #endif @@ -392,7 +395,7 @@ nsAppShellService::ShutdownComponent( const nsCID &aComponentCID ) { // a service). #ifdef NS_DEBUG char *name = aComponentCID.ToString(); - printf( "Unable to shut down app shell component %s, rv=0x%08X\n", + PRINTF( "Unable to shut down app shell component %s, rv=0x%08X\n", name, (int)rv ); nsCRT::free(name); #endif diff --git a/mozilla/xpfe/appshell/src/nsCommandLineService.cpp b/mozilla/xpfe/appshell/src/nsCommandLineService.cpp index e39d7548af8..7b52c844830 100644 --- a/mozilla/xpfe/appshell/src/nsCommandLineService.cpp +++ b/mozilla/xpfe/appshell/src/nsCommandLineService.cpp @@ -26,6 +26,11 @@ #include "nsIComponentManager.h" #include "nsString.h" #include "plstr.h" +#include "nslog.h" + +NS_IMPL_LOG(nsCommandLineServiceLog) +#define PRINTF NS_LOG_PRINTF(nsCommandLineServiceLog) +#define FLUSH NS_LOG_FLUSH(nsCommandLineServiceLog) nsCmdLineService::nsCmdLineService() : mArgCount(0), mArgc(0), mArgv(0) @@ -136,7 +141,7 @@ nsCmdLineService::Initialize(int aArgc, char ** aArgv) #if 0 for (i=0; iPW_GECOS) return NS_ERROR_FAILURE; #ifdef DEBUG_sspitzer - printf("fullname = %s\n", pw->PW_GECOS); + PRINTF("fullname = %s\n", pw->PW_GECOS); #endif nsAutoString fullname(NS_ConvertASCIItoUCS2(pw->PW_GECOS)); @@ -84,7 +89,7 @@ nsUserInfo::GetUsername(char * *aUsername) if (!pw || !pw->pw_name) return NS_ERROR_FAILURE; #ifdef DEBUG_sspitzer - printf("username = %s\n", pw->pw_name); + PRINTF("username = %s\n", pw->pw_name); #endif *aUsername = nsCRT::strdup(pw->pw_name); diff --git a/mozilla/xpfe/appshell/src/nsWebShellWindow.cpp b/mozilla/xpfe/appshell/src/nsWebShellWindow.cpp index 44319a9fbc8..8f43bd46ed9 100644 --- a/mozilla/xpfe/appshell/src/nsWebShellWindow.cpp +++ b/mozilla/xpfe/appshell/src/nsWebShellWindow.cpp @@ -122,6 +122,11 @@ static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID); #include "nsIPopupSetFrame.h" #include "nsIWalletService.h" +#include "nslog.h" + +NS_IMPL_LOG(nsWebShellWindowLog) +#define PRINTF NS_LOG_PRINTF(nsWebShellWindowLog) +#define FLUSH NS_LOG_FLUSH(nsWebShellWindowLog) /* Define Class IDs */ static NS_DEFINE_CID(kWindowCID, NS_WINDOW_CID); @@ -449,7 +454,7 @@ nsWebShellWindow::HandleEvent(nsGUIEvent *aEvent) case NS_ACTIVATE: { #ifdef DEBUG_saari - printf("nsWebShellWindow::NS_ACTIVATE\n"); + PRINTF("nsWebShellWindow::NS_ACTIVATE\n"); #endif // Sucky platform specific code to get around event dispatch ordering #ifdef WIN32 @@ -487,7 +492,7 @@ nsWebShellWindow::HandleEvent(nsGUIEvent *aEvent) case NS_DEACTIVATE: { #ifdef DEBUG_saari - printf("nsWebShellWindow::NS_DEACTIVATE\n"); + PRINTF("nsWebShellWindow::NS_DEACTIVATE\n"); #endif void* data; @@ -522,7 +527,7 @@ nsWebShellWindow::HandleEvent(nsGUIEvent *aEvent) case NS_GOTFOCUS: { #ifdef DEBUG_saari - printf("nsWebShellWindow::GOTFOCUS\n"); + PRINTF("nsWebShellWindow::GOTFOCUS\n"); #endif void* data; aEvent->widget->GetClientData(data); @@ -760,13 +765,13 @@ NS_IMETHODIMP nsWebShellWindow::LoadMenuItem( pnsMenuItem->AddMenuListener(listener); #ifdef DEBUG_MENUSDEL - printf("Adding menu listener to [%s]\n", menuitemName.ToNewCString()); + PRINTF("Adding menu listener to [%s]\n", menuitemName.ToNewCString()); #endif } #ifdef DEBUG_MENUSDEL else { - printf("*** NOT Adding menu listener to [%s]\n", menuitemName.ToNewCString()); + PRINTF("*** NOT Adding menu listener to [%s]\n", menuitemName.ToNewCString()); } #endif NS_RELEASE(icmd); @@ -786,7 +791,7 @@ void nsWebShellWindow::LoadSubMenu( { nsString menuName; menuElement->GetAttribute(NS_ConvertASCIItoUCS2("value"), menuName); - //printf("Creating Menu [%s] \n", menuName.ToNewCString()); // this leaks + //PRINTF("Creating Menu [%s] \n", menuName.ToNewCString()); // this leaks // Create nsMenu nsIMenu * pnsMenu = nsnull; @@ -840,7 +845,7 @@ void nsWebShellWindow::LoadSubMenu( menuitemElement->GetNodeName(menuitemNodeType); #ifdef DEBUG_saari - printf("Type [%s] %d\n", menuitemNodeType.ToNewCString(), menuitemNodeType.Equals("menuseparator")); + PRINTF("Type [%s] %d\n", menuitemNodeType.ToNewCString(), menuitemNodeType.Equals("menuseparator")); #endif if (menuitemNodeType.EqualsWithConversion("menuitem")) { @@ -987,7 +992,7 @@ void nsWebShellWindow::LoadMenus(nsIDOMDocument * aDOMDoc, nsIWidget * aParentWi menuElement->GetAttribute(NS_ConvertASCIItoUCS2("value"), menuName); #ifdef DEBUG_rods - printf("Creating Menu [%s] \n", menuName.ToNewCString()); // this leaks + PRINTF("Creating Menu [%s] \n", menuName.ToNewCString()); // this leaks #endif CreateMenu(pnsMenuBar, menuNode, menuName); } @@ -1232,7 +1237,7 @@ nsWebShellWindow::OnEndDocumentLoad(nsIDocumentLoader* loader, nsIChannel* channel, nsresult aStatus) { #ifdef DEBUG_MENUSDEL - printf("OnEndDocumentLoad\n"); + PRINTF("OnEndDocumentLoad\n"); #endif /* We get notified every time a page/Frame is loaded. But we need to @@ -1339,7 +1344,7 @@ nsCOMPtr nsWebShellWindow::FindNamedDOMNode(const nsString &aName, n while (node) { nsString name; node->GetNodeName(name); - //printf("FindNamedDOMNode[%s]==[%s] %d == %d\n", aName.ToNewCString(), name.ToNewCString(), aCount+1, aEndCount); //this leaks + //PRINTF("FindNamedDOMNode[%s]==[%s] %d == %d\n", aName.ToNewCString(), name.ToNewCString(), aCount+1, aEndCount); //this leaks if (name.Equals(aName)) { aCount++; if (aCount == aEndCount) @@ -1592,7 +1597,7 @@ nsWebShellWindow::AttributeChanged(nsIDocument *aDocument, PRInt32 aHint) { #if 0 - //printf("AttributeChanged\n"); + //PRINTF("AttributeChanged\n"); PRInt32 i; for (i=0;ileft && x->right, "Left or right child missing"); -#ifdef VERBOSE - printf("Visiting node %ld with left %ld and right %ld\n", x->nodeID, x->left->nodeID, x->right->nodeID); -#endif + PRINTF("Visiting node %ld with left %ld and right %ld\n", x->nodeID, x->left->nodeID, x->right->nodeID); if (x != tree->headNode) { err = (*traverseFunc)(x->data, x->key, arg1, arg2); @@ -293,9 +293,7 @@ static int TraverseAndFree(TPatriciaTree *tree, TNode *x, NodeFreeFunction freeF err = (*freeFunc)(x->data, x->key, refCon); -#ifdef VERBOSE - printf("Freeing node %ld\n", x->nodeID); -#endif + PRINTF("Freeing node %ld\n", x->nodeID); free(x->key); free(x); @@ -467,9 +465,7 @@ int PatriciaInsert(PatriciaTreeRef treeRef, NodeReplaceFunction replaceFunc, con else p->left = t; -#ifdef VERBOSE - printf("Inserted node %ld with left %ld and right %ld\n", t->nodeID, t->left->nodeID, t->right->nodeID); -#endif + PRINTF("Inserted node %ld with left %ld and right %ld\n", t->nodeID, t->left->nodeID, t->right->nodeID); tree->numNodes ++; diff --git a/mozilla/xpfe/bootstrap/nsAppRunner.cpp b/mozilla/xpfe/bootstrap/nsAppRunner.cpp index bcd1ccda234..0ca0a08d52b 100644 --- a/mozilla/xpfe/bootstrap/nsAppRunner.cpp +++ b/mozilla/xpfe/bootstrap/nsAppRunner.cpp @@ -75,9 +75,17 @@ #include "nsTraceMalloc.h" #endif +#include "nslog.h" +#undef printf +#undef fprintf + #if defined(DEBUG_sspitzer) || defined(DEBUG_seth) -#define DEBUG_CMD_LINE +NS_IMPL_LOG(nsAppRunnerLog, nsILog::DEFAULT_ENABLED) +#else +NS_IMPL_LOG(nsAppRunnerLog) #endif +#define PRINTF NS_LOG_PRINTF(nsAppRunnerLog) +#define FLUSH NS_LOG_FLUSH(nsAppRunnerLog) // Standalone App defines #define STANDALONE_APP_PREF "profile.standalone_app.enable" @@ -224,9 +232,7 @@ PrintUsage(void) static nsresult OpenWindow( const char*urlstr, const PRUnichar *args ) { -#ifdef DEBUG_CMD_LINE - printf("OpenWindow(%s,?)\n",urlstr); -#endif /* DEBUG_CMD_LINE */ + PRINTF("OpenWindow(%s,?)\n",urlstr); nsresult rv; nsCOMPtr appShellService = do_GetService(kAppShellServiceCID, &rv); if (NS_SUCCEEDED(rv)) { @@ -262,9 +268,7 @@ static nsresult OpenWindow( const char*urlstr, const PRUnichar *args ) static nsresult OpenChromeURL( const char * urlstr, PRInt32 height = NS_SIZETOCONTENT, PRInt32 width = NS_SIZETOCONTENT ) { -#ifdef DEBUG_CMD_LINE - printf("OpenChromeURL(%s,%d,%d)\n",urlstr,height,width); -#endif /* DEBUG_CMD_LINE */ + PRINTF("OpenChromeURL(%s,%d,%d)\n",urlstr,height,width); nsCOMPtr url; nsresult rv; @@ -305,9 +309,7 @@ static void DumpArbitraryHelp() rv = catman->GetCategoryEntry(COMMAND_LINE_ARGUMENT_HANDLERS,(const char *)entryString, getter_Copies(contractidString)); if (NS_FAILED(rv) || !((const char *)contractidString)) break; -#ifdef DEBUG_CMD_LINE - printf("cmd line handler contractid = %s\n", (const char *)contractidString); -#endif /* DEBUG_CMD_LINE */ + PRINTF("cmd line handler contractid = %s\n", (const char *)contractidString); nsCOMPtr handler = do_GetService((const char *)contractidString, &rv); @@ -385,15 +387,11 @@ static nsresult LaunchApplicationWithArgs(const char *commandLineArg, nsICmdLine rv = handler->GetChromeUrlForTask(getter_Copies(chromeUrlForTask)); if (NS_FAILED(rv)) return rv; -#ifdef DEBUG_CMD_LINE - printf("XXX got this one:\t%s\n\t%s\n\n",commandLineArg,(const char *)chromeUrlForTask); -#endif /* DEBUG_CMD_LINE */ + PRINTF("XXX got this one:\t%s\n\t%s\n\n",commandLineArg,(const char *)chromeUrlForTask); rv = cmdLineArgs->GetCmdLineValue(commandLineArg, getter_Copies(cmdResult)); if (NS_FAILED(rv)) return rv; -#ifdef DEBUG_CMD_LINE - printf("%s, cmdResult = %s\n",commandLineArg,(const char *)cmdResult); -#endif /* DEBUG_CMD_LINE */ + PRINTF("%s, cmdResult = %s\n",commandLineArg,(const char *)cmdResult); PRBool handlesArgs = PR_FALSE; rv = handler->GetHandlesArgs(&handlesArgs); @@ -406,15 +404,11 @@ static nsresult LaunchApplicationWithArgs(const char *commandLineArg, nsICmdLine if (openWindowWithArgs) { nsString cmdArgs; cmdArgs.AssignWithConversion(NS_STATIC_CAST(const char *, cmdResult)); -#ifdef DEBUG_CMD_LINE - printf("opening %s with %s\n",(const char *)chromeUrlForTask,"OpenWindow"); -#endif /* DEBUG_CMD_LINE */ + PRINTF("opening %s with %s\n",(const char *)chromeUrlForTask,"OpenWindow"); rv = OpenWindow((const char *)chromeUrlForTask, cmdArgs.GetUnicode()); } else { -#ifdef DEBUG_CMD_LINE - printf("opening %s with %s\n",(const char *)cmdResult,"OpenChromeURL"); -#endif /* DEBUG_CMD_LINE */ + PRINTF("opening %s with %s\n",(const char *)cmdResult,"OpenChromeURL"); rv = OpenChromeURL((const char *)cmdResult,height, width); if (NS_FAILED(rv)) return rv; } @@ -463,16 +457,12 @@ void startupPrefEnumerationFunction(const char *prefName, void *data) StartupClosure *closure = (StartupClosure *)data; -#ifdef DEBUG_CMD_LINE - printf("getting %s\n", prefName); -#endif /* DEBUG_CMD_LINE */ + PRINTF("getting %s\n", prefName); rv = closure->prefs->GetBoolPref(prefName, &prefValue); if (NS_FAILED(rv)) return; -#ifdef DEBUG_CMD_LINE - printf("%s = %d\n", prefName, prefValue); -#endif /* DEBUG_CMD_LINE */ + PRINTF("%s = %d\n", prefName, prefValue); PRUint32 prefixLen = PL_strlen(PREF_STARTUP_PREFIX); @@ -484,9 +474,7 @@ void startupPrefEnumerationFunction(const char *prefName, void *data) nsCAutoString contractID("@mozilla.org/commandlinehandler/general-startup;1?type="); contractID += (prefName + prefixLen); -#ifdef DEBUG_CMD_LINE - printf("contractid = %s\n", (const char *)contractID); -#endif /* DEBUG_CMD_LINE */ + PRINTF("contractid = %s\n", (const char *)contractID); rv = LaunchApplication((const char *)contractID, closure->height, closure->width); } return; @@ -530,9 +518,7 @@ static nsresult HandleArbitraryStartup( nsICmdLineService* cmdLineArgs, nsIPref if ((const char*)tempString) PR_sscanf(tempString, "%d", &height); if (heedGeneralStartupPrefs) { -#ifdef DEBUG_CMD_LINE - printf("XXX iterate over all the general.startup.* prefs\n"); -#endif /* DEBUG_CMD_LINE */ + PRINTF("XXX iterate over all the general.startup.* prefs\n"); StartupClosure closure; closure.prefs = prefs; @@ -555,9 +541,7 @@ static nsresult HandleArbitraryStartup( nsICmdLineService* cmdLineArgs, nsIPref PRInt32 i = 0; for (i=1;iGetCmdLineValue( "-mail", getter_Copies(arg))) && (const char*)arg ) { // Launch composer. #if MOZ_DEBUG_DDE - printf( "Launching mail...\n" ); + PRINTF(( "Launching mail...\n" )); #endif (void)OpenWindow( "chrome://messenger/content/", "" ); } else { #if MOZ_DEBUG_DDE - printf( "Unknown request [%s]\n", (char*) request ); + PRINTF(( "Unknown request [%s]\n", (char*) request )); #endif } @@ -991,7 +991,7 @@ nsNativeAppSupportOS2::GetCmdLineArgs( LPBYTE request, nsICmdLineService **aResu (void**)aResult ); if ( NS_FAILED( rv ) || NS_FAILED( ( rv = (*aResult)->Initialize( argc, argv ) ) ) ) { #if MOZ_DEBUG_DDE - printf( "Error creating command line service = 0x%08X\n", (int)rv ); + PRINTF(( "Error creating command line service = 0x%08X\n", (int)rv )); #endif } @@ -1033,7 +1033,7 @@ nsNativeAppSupportOS2::OpenWindow( const char*urlstr, const char *args ) { } } else { #ifdef MOZ_DEBUG_DDE - printf( "GetHiddenWindowAndJSContext failed, rv=0x%08X\n", (int)rv ); + PRINTF(( "GetHiddenWindowAndJSContext failed, rv=0x%08X\n", (int)rv )); #endif } } diff --git a/mozilla/xpfe/bootstrap/nsNativeAppSupportWin.cpp b/mozilla/xpfe/bootstrap/nsNativeAppSupportWin.cpp index 82ceee6caa9..bf8ebeadaa6 100644 --- a/mozilla/xpfe/bootstrap/nsNativeAppSupportWin.cpp +++ b/mozilla/xpfe/bootstrap/nsNativeAppSupportWin.cpp @@ -37,6 +37,12 @@ #include #include #include +#include "nslog.h" +#undef fprintf + +NS_IMPL_LOG(nsNativeAppSupportWinLog) +#define PRINTF NS_LOG_PRINTF(nsNativeAppSupportWinLog) +#define FLUSH NS_LOG_FLUSH(nsNativeAppSupportWinLog) // Define this macro to 1 to get DDE debugging output. #define MOZ_DEBUG_DDE 0 @@ -109,7 +115,7 @@ struct Mutex { mState( -1 ) { mHandle = CreateMutex( 0, FALSE, mName.GetBuffer() ); #if MOZ_DEBUG_DDE - printf( "CreateMutex error = 0x%08X\n", (int)GetLastError() ); + PRINTF( "CreateMutex error = 0x%08X\n", (int)GetLastError() ); #endif } ~Mutex() { @@ -120,7 +126,7 @@ struct Mutex { BOOL rc = CloseHandle( mHandle ); #if MOZ_DEBUG_DDE if ( !rc ) { - printf( "CloseHandle error = 0x%08X\n", (int)GetLastError() ); + PRINTF( "CloseHandle error = 0x%08X\n", (int)GetLastError() ); } #endif } @@ -128,11 +134,11 @@ struct Mutex { BOOL Lock( DWORD timeout ) { if ( mHandle ) { #if MOZ_DEBUG_DDE - printf( "Waiting (%d msec) for DDE mutex...\n", (int)timeout ); + PRINTF( "Waiting (%d msec) for DDE mutex...\n", (int)timeout ); #endif mState = WaitForSingleObject( mHandle, timeout ); #if MOZ_DEBUG_DDE - printf( "...wait complete, result = 0x%08X\n", (int)mState ); + PRINTF( "...wait complete, result = 0x%08X\n", (int)mState ); #endif return mState == WAIT_OBJECT_0; } else { @@ -142,7 +148,7 @@ struct Mutex { void Unlock() { if ( mHandle && mState == WAIT_OBJECT_0 ) { #if MOZ_DEBUG_DDE - printf( "Releasing DDE mutex\n" ); + PRINTF( "Releasing DDE mutex\n" ); #endif ReleaseMutex( mHandle ); mState = -1; @@ -253,7 +259,7 @@ nsSplashScreenWin::nsSplashScreenWin() nsSplashScreenWin::~nsSplashScreenWin() { #if MOZ_DEBUG_DDE - printf( "splash screen dtor called\n" ); + PRINTF( "splash screen dtor called\n" ); #endif // Make sure dialog is gone. Hide(); @@ -577,7 +583,7 @@ nsNativeAppSupportWin::Start( PRBool *aResult ) { // Get command line to pass to server. LPTSTR cmd = GetCommandLine(); #if MOZ_DEBUG_DDE - printf( "Acting as DDE client, cmd=%s\n", cmd ); + PRINTF( "Acting as DDE client, cmd=%s\n", cmd ); #endif rc = (UINT)DdeClientTransaction( (LPBYTE)cmd, strlen( cmd ) + 1, @@ -593,14 +599,14 @@ nsNativeAppSupportWin::Start( PRBool *aResult ) { } else { // Something went wrong. Not much we can do, though... #if MOZ_DEBUG_DDE - printf( "DdeClientTransaction failed, error = 0x%08X\n", - (int)DdeGetLastError( mInstance ) ); + PRINTF( "DdeClientTransaction failed, error = 0x%08X\n", + (int)DdeGetLastError( mInstance ) ); #endif } } else { // We're going to be the server... #if MOZ_DEBUG_DDE - printf( "Setting up DDE server...\n" ); + PRINTF( "Setting up DDE server...\n" ); #endif // Next step is to register a DDE service. @@ -608,27 +614,27 @@ nsNativeAppSupportWin::Start( PRBool *aResult ) { if ( rc ) { #if MOZ_DEBUG_DDE - printf( "...DDE server started\n" ); + PRINTF( "...DDE server started\n" ); #endif // Tell app to do its thing. *aResult = PR_TRUE; rv = NS_OK; } else { #if MOZ_DEBUG_DDE - printf( "DdeNameService failed, error = 0x%08X\n", - (int)DdeGetLastError( mInstance ) ); + PRINTF( "DdeNameService failed, error = 0x%08X\n", + (int)DdeGetLastError( mInstance ) ); #endif } } } else { #if MOZ_DEBUG_DDE - printf( "DdeCreateStringHandle failed, error = 0x%08X\n", - (int)DdeGetLastError( mInstance ) ); + PRINTF( "DdeCreateStringHandle failed, error = 0x%08X\n", + (int)DdeGetLastError( mInstance ) ); #endif } } else { #if MOZ_DEBUG_DDE - printf( "DdeInitialize failed, error = 0x%08X\n", (int)rc ); + PRINTF( "DdeInitialize failed, error = 0x%08X\n", (int)rc ); #endif } @@ -759,14 +765,14 @@ nsNativeAppSupportWin::HandleDDENotification( UINT uType, // transaction t ULONG dwData2 ) { // transaction-specific data #if MOZ_DEBUG_DDE - printf( "DDE: uType =%s\n", uTypeDesc( uType ).GetBuffer() ); - printf( " uFmt =%u\n", (unsigned)uFmt ); - printf( " hconv =%08x\n", (int)hconv ); - printf( " hsz1 =%08x:%s\n", (int)hsz1, hszValue( mInstance, hsz1 ).GetBuffer() ); - printf( " hsz2 =%08x:%s\n", (int)hsz2, hszValue( mInstance, hsz2 ).GetBuffer() ); - printf( " hdata =%08x\n", (int)hdata ); - printf( " dwData1=%08x\n", (int)dwData1 ); - printf( " dwData2=%08x\n", (int)dwData2 ); + PRINTF( "DDE: uType =%s\n", uTypeDesc( uType ).GetBuffer() ); + PRINTF( " uFmt =%u\n", (unsigned)uFmt ); + PRINTF( " hconv =%08x\n", (int)hconv ); + PRINTF( " hsz1 =%08x:%s\n", (int)hsz1, hszValue( mInstance, hsz1 ).GetBuffer() ); + PRINTF( " hsz2 =%08x:%s\n", (int)hsz2, hszValue( mInstance, hsz2 ).GetBuffer() ); + PRINTF( " hdata =%08x\n", (int)hdata ); + PRINTF( " dwData1=%08x\n", (int)dwData1 ); + PRINTF( " dwData2=%08x\n", (int)dwData2 ); #endif HDDEDATA result = 0; @@ -789,7 +795,7 @@ nsNativeAppSupportWin::HandleDDENotification( UINT uType, // transaction t DWORD bytes; LPBYTE request = DdeAccessData( hdata, &bytes ); #if MOZ_DEBUG_DDE - printf( "Handling dde request: [%s]...\n", (char*)request ); + PRINTF( "Handling dde request: [%s]...\n", (char*)request ); #endif HandleRequest( request ); result = (HDDEDATA)DDE_FACK; @@ -817,7 +823,7 @@ nsNativeAppSupportWin::HandleRequest( LPBYTE request ) { (const char*)arg ) { // Launch browser. #if MOZ_DEBUG_DDE - printf( "Launching browser on url [%s]...\n", (const char*)arg ); + PRINTF( "Launching browser on url [%s]...\n", (const char*)arg ); #endif (void)OpenWindow( "chrome://navigator/content/", arg ); } @@ -825,7 +831,7 @@ nsNativeAppSupportWin::HandleRequest( LPBYTE request ) { (const char*)arg ) { // Launch chrome. #if MOZ_DEBUG_DDE - printf( "Launching chrome url [%s]...\n", (const char*)arg ); + PRINTF( "Launching chrome url [%s]...\n", (const char*)arg ); #endif (void)OpenWindow( arg, "" ); } @@ -833,19 +839,19 @@ nsNativeAppSupportWin::HandleRequest( LPBYTE request ) { (const char*)arg ) { // Launch composer. #if MOZ_DEBUG_DDE - printf( "Launching editor on url [%s]...\n", arg ); + PRINTF( "Launching editor on url [%s]...\n", arg ); #endif (void)OpenWindow( "chrome://editor/content/", arg ); } else if ( NS_SUCCEEDED( args->GetCmdLineValue( "-mail", getter_Copies(arg))) && (const char*)arg ) { // Launch composer. #if MOZ_DEBUG_DDE - printf( "Launching mail...\n" ); + PRINTF( "Launching mail...\n" ); #endif (void)OpenWindow( "chrome://messenger/content/", "" ); } else { #if MOZ_DEBUG_DDE - printf( "Unknown request [%s]\n", (char*) request ); + PRINTF( "Unknown request [%s]\n", (char*) request ); #endif } @@ -995,7 +1001,7 @@ nsNativeAppSupportWin::GetCmdLineArgs( LPBYTE request, nsICmdLineService **aResu (void**)aResult ); if ( NS_FAILED( rv ) || NS_FAILED( ( rv = (*aResult)->Initialize( argc, argv ) ) ) ) { #if MOZ_DEBUG_DDE - printf( "Error creating command line service = 0x%08X\n", (int)rv ); + PRINTF( "Error creating command line service = 0x%08X\n", (int)rv ); #endif } @@ -1037,7 +1043,7 @@ nsNativeAppSupportWin::OpenWindow( const char*urlstr, const char *args ) { } } else { #ifdef MOZ_DEBUG_DDE - printf( "GetHiddenWindowAndJSContext failed, rv=0x%08X\n", (int)rv ); + PRINTF( "GetHiddenWindowAndJSContext failed, rv=0x%08X\n", (int)rv ); #endif } } diff --git a/mozilla/xpfe/bootstrap/nsSigHandlers.cpp b/mozilla/xpfe/bootstrap/nsSigHandlers.cpp index f14c71dca9f..914d377ff00 100644 --- a/mozilla/xpfe/bootstrap/nsSigHandlers.cpp +++ b/mozilla/xpfe/bootstrap/nsSigHandlers.cpp @@ -56,6 +56,12 @@ extern "C" char * strsignal(int); #include /* for munlockall() */ #endif +#include "nslog.h" + +NS_IMPL_LOG(nsSigHandlersLog, 0) +#define PRINTF NS_LOG_PRINTF(nsSigHandlersLog) +#define FLUSH NS_LOG_FLUSH(nsSigHandlersLog) + static char _progname[1024] = "huh?"; //#ifdef DEBUG_ramiro @@ -76,16 +82,16 @@ void abnormal_exit_handler(int signum) ) { PR_CurrentThread(); - printf("prog = %s\npid = %d\nsignal = %s\n", - _progname, getpid(), strsignal(signum)); + PRINTF("prog = %s\npid = %d\nsignal = %s\n", + _progname, getpid(), strsignal(signum)); - printf("Sleeping for 5 minutes.\n"); - printf("Type 'gdb %s %d' to attatch your debugger to this thread.\n", - _progname, getpid()); + PRINTF("Sleeping for 5 minutes.\n"); + PRINTF("Type 'gdb %s %d' to attatch your debugger to this thread.\n", + _progname, getpid()); sleep(300); - printf("Done sleeping...\n"); + PRINTF("Done sleeping...\n"); } #endif @@ -101,22 +107,22 @@ ah_crap_handler(int signum) { PR_CurrentThread(); - printf("prog = %s\npid = %d\nsignal = %s\n", + PRINTF("prog = %s\npid = %d\nsignal = %s\n", _progname, getpid(), strsignal(signum)); - printf("stack logged to someplace\n"); + PRINTF("stack logged to someplace\n"); nsTraceRefcnt::WalkTheStack(stdout); - printf("Sleeping for 5 minutes.\n"); - printf("Type 'gdb %s %d' to attatch your debugger to this thread.\n", + PRINTF("Sleeping for 5 minutes.\n"); + PRINTF("Type 'gdb %s %d' to attatch your debugger to this thread.\n", _progname, getpid()); sleep(300); - printf("Done sleeping...\n"); + PRINTF("Done sleeping...\n"); } #endif // CRAWL_STACK_ON_SIGSEGV @@ -173,11 +179,11 @@ void InstallUnixSignalHandlers(const char *ProgramName) if (setrlimit(RLIMIT_NOFILE, &rl) < 0) { perror("setrlimit(RLIMIT_NOFILE)"); - fprintf(stderr, "Cannot exceed hard limit for open files"); + FPRINTF(stderr, "Cannot exceed hard limit for open files"); } #if defined(DEBUG) if (getrlimit(RLIMIT_NOFILE, &rl) == 0) - printf("File descriptors set to %d\n", rl.rlim_cur); + PRINTF("File descriptors set to %d\n", rl.rlim_cur); #endif //DEBUG } } diff --git a/mozilla/xpfe/browser/src/nsBrowserInstance.cpp b/mozilla/xpfe/browser/src/nsBrowserInstance.cpp index 399866ddd46..b88b70fddec 100644 --- a/mozilla/xpfe/browser/src/nsBrowserInstance.cpp +++ b/mozilla/xpfe/browser/src/nsBrowserInstance.cpp @@ -122,6 +122,15 @@ #include "nsINameSpaceManager.h" #include "nsFileStream.h" #include "nsIProxyObjectManager.h" +#include "nslog.h" + +NS_IMPL_LOG(nsBrowserInstanceLog) +#define PRINTF NS_LOG_PRINTF(nsBrowserInstanceLog) +#define FLUSH NS_LOG_FLUSH(nsBrowserInstanceLog) + +NS_IMPL_LOG(nsTimerLog) +#define TIMER_PRINTF NS_LOG_PRINTF(nsTimerLog) +#define TIMER_FLUSH NS_LOG_FLUSH(nsTimerLog) static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID); static NS_DEFINE_IID(kIWalletServiceIID, NS_IWALLETSERVICE_IID); @@ -133,12 +142,6 @@ static NS_DEFINE_IID(kProxyObjectManagerCID, NS_PROXYEVENT_MANAGER_CID); // Stuff to implement find/findnext #include "nsIFindComponent.h" -#ifdef DEBUG_warren -#include "prlog.h" -#if defined(DEBUG) || defined(FORCE_PR_LOG) -static PRLogModuleInfo* gTimerLog = nsnull; -#endif /* DEBUG || FORCE_PR_LOG */ -#endif // if DEBUG or MOZ_PERF_METRICS are defined, enable the PageCycler #ifdef DEBUG @@ -158,14 +161,6 @@ static NS_DEFINE_CID(kCPrefServiceCID, NS_PREF_CID); static NS_DEFINE_CID(kTimeBombCID, NS_TIMEBOMB_CID); static NS_DEFINE_CID(kWindowMediatorCID, NS_WINDOWMEDIATOR_CID); - -#ifdef DEBUG -static int APP_DEBUG = 0; // Set to 1 in debugger to turn on debugging. -#else -#define APP_DEBUG 0 -#endif - - #define PREF_HOMEPAGE_OVERRIDE_URL "startup.homepage_override_url" #define PREF_HOMEPAGE_OVERRIDE "browser.startup.homepage_override.1" #define PREF_BROWSER_STARTUP_PAGE "browser.startup.page" @@ -283,7 +278,7 @@ public: nsString data(someData); if (data.Find(mLastRequest) == 0) { char* dataStr = data.ToNewCString(); - printf("########## PageCycler loaded: %s\n", dataStr); + PRINTF("########## PageCycler loaded: %s\n", dataStr); nsCRT::free(dataStr); nsAutoString url; @@ -320,14 +315,14 @@ public: } if (NS_FAILED(rv)) { - printf("######### PageCycler couldn't asynchronously load: %s\n", + PRINTF("######### PageCycler couldn't asynchronously load: %s\n", NS_STATIC_CAST(const char*, NS_ConvertUCS2toUTF8(mLastRequest))); } } } else { char* dataStr = data.ToNewCString(); - printf("########## PageCycler possible failure for: %s\n", dataStr); + PRINTF("########## PageCycler possible failure for: %s\n", dataStr); nsCRT::free(dataStr); } return rv; @@ -341,7 +336,7 @@ public: // load the URL const PRUnichar* url = self->mLastRequest.GetUnicode(); - printf("########## PageCycler starting: %s\n", + PRINTF("########## PageCycler starting: %s\n", NS_STATIC_CAST(const char*, NS_ConvertUCS2toUTF8(url))); self->mAppCore->LoadUrl(url); @@ -418,7 +413,7 @@ void TimesUp(nsITimer *aTimer, void *aClosure) PageCycler *pCycler = (PageCycler *)aClosure; pCycler->StopTimer(); pCycler->GetLastRequest().ToCString( urlBuf, sizeof(urlBuf), 0 ); - fprintf(stderr,"########## PageCycler Timeout on URL: %s\n", urlBuf); + PRINTF("########## PageCycler Timeout on URL: %s\n", urlBuf); pCycler->Observe( pCycler, nsnull, (pCycler->GetLastRequest()).GetUnicode() ); } } @@ -724,7 +719,7 @@ nsBrowserInstance::LoadInitialPage(void) if (!cmdLineURLUsed) { NS_WITH_SERVICE(nsICmdLineService, cmdLineArgs, kCmdLineServiceCID, &rv); if (NS_FAILED(rv)) { - if (APP_DEBUG) fprintf(stderr, "Could not obtain CmdLine processing service\n"); + PRINTF("Could not obtain CmdLine processing service\n"); return NS_ERROR_FAILURE; } @@ -787,7 +782,7 @@ nsBrowserInstance::LoadInitialPage(void) if (urlstr != nsnull) { // A url was provided. Load it - if (APP_DEBUG) printf("Got Command line URL to load %s\n", urlstr); + PRINTF("Got Command line URL to load %s\n", urlstr); nsString url; url.AssignWithConversion( urlstr ); nsMemory::Free(urlstr); urlstr = nsnull; rv = LoadUrl( url.GetUnicode() ); @@ -812,7 +807,7 @@ nsBrowserInstance::LoadInitialPage(void) rv = FindNamedXULElement(mDocShell, "args", &argsElement); if (!argsElement) { // Couldn't get the "args" element from the xul file. Load a blank page - if (APP_DEBUG) printf("Couldn't find args element\n"); + PRINTF("Couldn't find args element\n"); nsAutoString url; url.AssignWithConversion("about:blank"); rv = LoadUrl( url.GetUnicode() ); return rv; @@ -826,7 +821,7 @@ nsBrowserInstance::LoadInitialPage(void) return rv; } - if (APP_DEBUG) printf("Quitting LoadInitialPage\n"); + PRINTF("Quitting LoadInitialPage\n"); return NS_OK; } @@ -837,7 +832,7 @@ nsBrowserInstance::BackButtonPopup(nsIDOMNode * aParent) GetContentAreaDocShell(getter_AddRefs(docShell)); if (!docShell) { - if (APP_DEBUG) printf("nsBrowserInstance::BackButtonPopup Couldn't get a handle to SessionHistory\n"); + PRINTF("nsBrowserInstance::BackButtonPopup Couldn't get a handle to SessionHistory\n"); return NS_ERROR_FAILURE; } @@ -849,11 +844,11 @@ nsBrowserInstance::BackButtonPopup(nsIDOMNode * aParent) if (NS_SUCCEEDED(rv) && hasChildren) { rv = ClearHistoryMenus(aParent); if (!NS_SUCCEEDED(rv)) { - if (APP_DEBUG) printf("nsBrowserInstance::BackButtonPopup ERROR While removing old history menu items\n"); + PRINTF("nsBrowserInstance::BackButtonPopup ERROR While removing old history menu items\n"); } } // hasChildren else { - if (APP_DEBUG) printf("nsBrowserInstance::BackButtonPopup Menu has no children\n"); + PRINTF("nsBrowserInstance::BackButtonPopup Menu has no children\n"); } nsCOMPtr mSHistory; @@ -886,10 +881,10 @@ nsBrowserInstance::BackButtonPopup(nsIDOMNode * aParent) shEntry->GetTitle(&title); nsAutoString histTitle(title); - if (APP_DEBUG)printf("nsBrowserInstance::BackButtonPopup URL = %s, TITLE = %s\n", (const char *) uriSpec, histTitle.ToNewCString()); + PRINTF("nsBrowserInstance::BackButtonPopup URL = %s, TITLE = %s\n", (const char *) uriSpec, histTitle.ToNewCString()); rv = CreateMenuItem(aParent, j, title); if (!NS_SUCCEEDED(rv)) { - if (APP_DEBUG) printf("nsBrowserInstance::BackButtonPopup Error while creating history mene item\n"); + PRINTF("nsBrowserInstance::BackButtonPopup Error while creating history mene item\n"); } Recycle(title); } //for @@ -905,7 +900,7 @@ nsBrowserInstance::ForwardButtonPopup(nsIDOMNode * aParent) GetContentAreaDocShell(getter_AddRefs(docShell)); if (!docShell) { - if (APP_DEBUG) printf("nsBrowserInstance::ForwardButtonPopup Couldn't get a handle to SessionHistory\n"); + PRINTF("nsBrowserInstance::ForwardButtonPopup Couldn't get a handle to SessionHistory\n"); return NS_ERROR_FAILURE; } @@ -918,11 +913,11 @@ nsBrowserInstance::ForwardButtonPopup(nsIDOMNode * aParent) // Remove all old entries rv = ClearHistoryMenus(aParent); if (!NS_SUCCEEDED(rv)) { - if (APP_DEBUG) printf("nsBrowserInstance::ForwardMenuPopup Error while clearing old history entries\n"); + PRINTF("nsBrowserInstance::ForwardMenuPopup Error while clearing old history entries\n"); } } // hasChildren else { - if (APP_DEBUG) printf("nsBrowserInstance::ForwardButtonPopup Menu has no children\n"); + PRINTF("nsBrowserInstance::ForwardButtonPopup Menu has no children\n"); } nsCOMPtr mSHistory; @@ -957,10 +952,10 @@ nsBrowserInstance::ForwardButtonPopup(nsIDOMNode * aParent) shEntry->GetTitle(&title); nsAutoString histTitle(title); - if (APP_DEBUG)printf("nsBrowserInstance::ForwardButtonPopup URL = %s, TITLE = %s\n", (const char *) uriSpec, histTitle.ToNewCString()); + PRINTF("nsBrowserInstance::ForwardButtonPopup URL = %s, TITLE = %s\n", (const char *) uriSpec, histTitle.ToNewCString()); rv = CreateMenuItem(aParent, j, title); if (!NS_SUCCEEDED(rv)) { - if (APP_DEBUG) printf("nsBrowserInstance::ForwardButtonPopup Error while creating history mene item\n"); + PRINTF("nsBrowserInstance::ForwardButtonPopup Error while creating history mene item\n"); } Recycle(title); } @@ -1177,7 +1172,7 @@ nsBrowserInstance::SetContentWindow(nsIDOMWindowInternal* aWin) sessionHistory = (do_CreateInstance(NS_SHISTORY_CONTRACTID, &rv)); mSessionHistory = sessionHistory; if (!mSessionHistory) { - if (APP_DEBUG) printf("#### Error initialising Session History ####\n"); + PRINTF("#### Error initialising Session History ####\n"); return NS_FAILED(rv) ? rv : NS_ERROR_OUT_OF_MEMORY; } } @@ -1207,8 +1202,8 @@ nsBrowserInstance::SetContentWindow(nsIDOMWindowInternal* aWin) nsCAutoString str; str.AssignWithConversion(name); - if (APP_DEBUG) { - printf("Attaching to Content WebShell [%s]\n", (const char *)str); + { + PRINTF("Attaching to Content WebShell [%s]\n", (const char *)str); } nsCOMPtr ubHistory = do_GetService(NS_URLBARHISTORY_CONTRACTID, &rv); @@ -1271,8 +1266,8 @@ nsBrowserInstance::SetWebShellWindow(nsIDOMWindowInternal* aWin) nsCAutoString str; str.AssignWithConversion(name); - if (APP_DEBUG) { - printf("Attaching to WebShellWindow[%s]\n", (const char *)str); + { + PRINTF("Attaching to WebShellWindow[%s]\n", (const char *)str); } nsCOMPtr webShell(do_QueryInterface(docShell)); @@ -1626,15 +1621,11 @@ nsBrowserInstance::OnStartDocumentLoad(nsIDocumentLoader* aLoader, nsIURI* aURL, nsAutoString urlStr; urlStr.AssignWithConversion(url); -#ifdef DEBUG_warren +#ifdef NS_ENABLE_LOGGING char* urls; aURL->GetSpec(&urls); - if (gTimerLog == nsnull) - gTimerLog = PR_NewLogModule("Timer"); mLoadStartTime = PR_IntervalNow(); - PR_LOG(gTimerLog, PR_LOG_DEBUG, - (">>>>> Starting timer for %s\n", urls)); - printf(">>>>> Starting timer for %s\n", urls); + TIMER_PRINTF(">>>>> Starting timer for %s\n", urls); nsCRT::free(urls); #endif @@ -1746,28 +1737,23 @@ nsBrowserInstance::OnEndDocumentLoad(nsIDocumentLoader* aLoader, nsIChannel* cha if ( httpChannel ) { httpChannel->GetUploadStream( getter_AddRefs( postData ) ); } - fprintf(stdout, "Document %s loaded successfully\n", (const char*)url); - fflush(stdout); + PRINTF("Document %s loaded successfully\n", (const char*)url); + FLUSH(); } else { - fprintf(stdout, "Error loading URL %s: %0x \n", + PRINTF("Error loading URL %s: %0x \n", (const char*)url, aStatus); - fflush(stdout); + FLUSH(); } this->SetPostData( postData ); } //if (!isFrame) -#ifdef DEBUG_warren +#ifdef NS_ENABLE_LOGGING char* urls; aUrl->GetSpec(&urls); - if (gTimerLog == nsnull) - gTimerLog = PR_NewLogModule("Timer"); PRIntervalTime end = PR_IntervalNow(); PRIntervalTime diff = end - mLoadStartTime; - PR_LOG(gTimerLog, PR_LOG_DEBUG, - (">>>>> Stopping timer for %s. Elapsed: %.3f\n", - urls, PR_IntervalToMilliseconds(diff) / 1000.0)); - printf(">>>>> Stopping timer for %s. Elapsed: %.3f\n", - urls, PR_IntervalToMilliseconds(diff) / 1000.0); + TIMER_PRINTF(">>>>> Stopping timer for %s. Elapsed: %.3f\n", + urls, PR_IntervalToMilliseconds(diff) / 1000.0); nsCRT::free(urls); #endif @@ -2051,13 +2037,13 @@ NS_IMETHODIMP nsBrowserInstance::CreateMenuItem( PRInt32 aIndex, const PRUnichar * aName) { - if (APP_DEBUG) printf("In CreateMenuItem\n"); + PRINTF("In CreateMenuItem\n"); nsresult rv=NS_OK; nsCOMPtr doc; rv = aParentMenu->GetOwnerDocument(getter_AddRefs(doc)); if (!NS_SUCCEEDED(rv)) { - if (APP_DEBUG) printf("nsBrowserInstance::CreateMenuItem ERROR Getting handle to the document\n"); + PRINTF("nsBrowserInstance::CreateMenuItem ERROR Getting handle to the document\n"); return NS_ERROR_FAILURE; } nsString menuitemName(aName); @@ -2067,7 +2053,7 @@ NS_IMETHODIMP nsBrowserInstance::CreateMenuItem( nsString tagName; tagName.AssignWithConversion("menuitem"); rv = doc->CreateElement(tagName, getter_AddRefs(menuItemElement)); if (!NS_SUCCEEDED(rv)) { - if (APP_DEBUG) printf("nsBrowserInstance::CreateMenuItem ERROR creating the menu item element\n"); + PRINTF("nsBrowserInstance::CreateMenuItem ERROR creating the menu item element\n"); return NS_ERROR_FAILURE; } @@ -2075,17 +2061,17 @@ NS_IMETHODIMP nsBrowserInstance::CreateMenuItem( // Set the hist attribute to true rv = menuItemElement->SetAttribute(nsString("ishist"), nsString("true")); if (!NS_SUCCEEDED(rv)) { - printf("nsBrowserAppCore::CreateMenuItem ERROR setting ishist handler\n"); + PRINTF("nsBrowserAppCore::CreateMenuItem ERROR setting ishist handler\n"); return NS_ERROR_FAILURE; } */ //Set the label for the menu item nsString menuitemlabel(aName); - if (APP_DEBUG) printf("nsBrowserInstance::CreateMenuItem Setting menu name to %s\n", menuitemlabel.ToNewCString()); + PRINTF("nsBrowserInstance::CreateMenuItem Setting menu name to %s\n", menuitemlabel.ToNewCString()); rv = menuItemElement->SetAttribute(NS_ConvertASCIItoUCS2("value"), menuitemlabel); if (!NS_SUCCEEDED(rv)) { - if (APP_DEBUG) printf("nsBrowserInstance::CreateMenuItem ERROR Setting node value for menu item ****\n"); + PRINTF("nsBrowserInstance::CreateMenuItem ERROR Setting node value for menu item ****\n"); return NS_ERROR_FAILURE; } @@ -2096,14 +2082,14 @@ NS_IMETHODIMP nsBrowserInstance::CreateMenuItem( rv = menuItemElement->SetAttribute(NS_ConvertASCIItoUCS2("index"), indexString); if (!NS_SUCCEEDED(rv)) { - if (APP_DEBUG) printf("nsBrowserAppCore::CreateMenuItem ERROR setting ishist handler\n"); + PRINTF("nsBrowserAppCore::CreateMenuItem ERROR setting ishist handler\n"); return NS_ERROR_FAILURE; } // Make a DOMNode out of it nsCOMPtr menuItemNode = do_QueryInterface(menuItemElement); if (!menuItemNode) { - if (APP_DEBUG) printf("nsBrowserInstance::CreateMenuItem ERROR converting DOMElement to DOMNode *****\n"); + PRINTF("nsBrowserInstance::CreateMenuItem ERROR converting DOMElement to DOMNode *****\n"); return NS_ERROR_FAILURE; } @@ -2113,7 +2099,7 @@ NS_IMETHODIMP nsBrowserInstance::CreateMenuItem( if (!NS_SUCCEEDED(rv)) { - if (APP_DEBUG) printf("nsBrowserInstance::CreateMenuItem ERROR appending menuitem to menu *****\n"); + PRINTF("nsBrowserInstance::CreateMenuItem ERROR appending menuitem to menu *****\n"); return NS_ERROR_FAILURE; } @@ -2133,7 +2119,7 @@ nsBrowserInstance::UpdateGoMenu(nsIDOMNode * aGoMenu) // Clear all history children under Go menu rv = ClearHistoryMenus(menuPopup); if (!NS_SUCCEEDED(rv)) { - if (APP_DEBUG) printf("nsBrowserInstance::UpdateGoMenu Error while clearing old history list\n"); + PRINTF("nsBrowserInstance::UpdateGoMenu Error while clearing old history list\n"); } nsCOMPtr mSHistory; @@ -2164,10 +2150,10 @@ nsBrowserInstance::UpdateGoMenu(nsIDOMNode * aGoMenu) shEntry->GetTitle(&title); nsAutoString histTitle(title); - if (APP_DEBUG)printf("nsBrowserInstance::UpdateGoMenu URL = %s, TITLE = %s\n", (const char *) uriSpec, histTitle.ToNewCString()); + PRINTF("nsBrowserInstance::UpdateGoMenu URL = %s, TITLE = %s\n", (const char *) uriSpec, histTitle.ToNewCString()); rv = CreateMenuItem(menuPopup, j, title); if (!NS_SUCCEEDED(rv)) { - if (APP_DEBUG) printf("nsBrowserInstance::UpdateGoMenu Error while creating history mene item\n"); + PRINTF("nsBrowserInstance::UpdateGoMenu Error while creating history mene item\n"); } Recycle(title); } @@ -2198,13 +2184,13 @@ nsBrowserInstance::ClearHistoryMenus(nsIDOMNode * aParent) nsCOMPtr child; rv = childList->Item(i, getter_AddRefs(child)); if (!NS_SUCCEEDED(rv) || !child) { - if (APP_DEBUG) printf("nsBrowserInstance::ClearHistoryPopup, Could not get child\n"); + PRINTF("nsBrowserInstance::ClearHistoryPopup, Could not get child\n"); return NS_ERROR_FAILURE; } // Get element out of the node nsCOMPtr childElement(do_QueryInterface(child)); if (!childElement) { - if (APP_DEBUG) printf("nsBrowserInstance::ClearHistorypopup Could n't get DOMElement out of DOMNode for child\n"); + PRINTF("nsBrowserInstance::ClearHistorypopup Could n't get DOMElement out of DOMNode for child\n"); return NS_ERROR_FAILURE; } @@ -2218,21 +2204,21 @@ nsBrowserInstance::ClearHistoryMenus(nsIDOMNode * aParent) rv = menu->RemoveChild(child, getter_AddRefs(ret)); if (NS_SUCCEEDED(rv)) { if (ret) { - if (APP_DEBUG) printf("nsBrowserInstance::ClearHistoryPopup Child %x removed from the popuplist \n", (unsigned int) child.get()); + PRINTF("nsBrowserInstance::ClearHistoryPopup Child %x removed from the popuplist \n", (unsigned int) child.get()); } else { - if (APP_DEBUG) printf("nsBrowserInstance::ClearHistoryPopup Child %x was not removed from popuplist\n", (unsigned int) child.get()); + PRINTF("nsBrowserInstance::ClearHistoryPopup Child %x was not removed from popuplist\n", (unsigned int) child.get()); } } // NS_SUCCEEDED(rv) else { - if (APP_DEBUG) printf("nsBrowserInstance::ClearHistoryPopup Child %x was not removed from popuplist\n", (unsigned int) child.get()); + PRINTF("nsBrowserInstance::ClearHistoryPopup Child %x was not removed from popuplist\n", (unsigned int) child.get()); return NS_ERROR_FAILURE; } } // atrrvalue == true else { - if (APP_DEBUG) printf("Couldn't get attribute values \n"); + PRINTF("Couldn't get attribute values \n"); } } //(for) } // if (childList) @@ -2285,22 +2271,22 @@ FindNamedXULElement(nsIDocShell * aShell, rv = xulDoc->GetElementById( NS_ConvertASCIItoUCS2(aId), getter_AddRefs(elem) ); if ( elem ) { - *aResult = elem; + *aResult = elem; } else { - if (APP_DEBUG) printf("GetElementByID failed, rv=0x%X\n",(int)rv); + PRINTF("GetElementByID failed, rv=0x%X\n",(int)rv); } } else { - if (APP_DEBUG) printf("Upcast to nsIDOMXULDocument failed\n"); + PRINTF("Upcast to nsIDOMXULDocument failed\n"); } } else { - if (APP_DEBUG) printf("GetDocument failed, rv=0x%X\n",(int)rv); + PRINTF("GetDocument failed, rv=0x%X\n",(int)rv); } } else { - if (APP_DEBUG) printf("Upcast to nsIDocumentViewer failed\n"); + PRINTF("Upcast to nsIDocumentViewer failed\n"); } } else { - if (APP_DEBUG) printf("GetContentViewer failed, rv=0x%X\n",(int)rv); + PRINTF("GetContentViewer failed, rv=0x%X\n",(int)rv); } return rv; } diff --git a/mozilla/xpfe/components/bookmarks/src/nsBookmarksService.cpp b/mozilla/xpfe/components/bookmarks/src/nsBookmarksService.cpp index 995c0148426..07e10253ce0 100644 --- a/mozilla/xpfe/components/bookmarks/src/nsBookmarksService.cpp +++ b/mozilla/xpfe/components/bookmarks/src/nsBookmarksService.cpp @@ -88,6 +88,11 @@ // Interfaces Needed #include "nsIDocShell.h" #include "nsIXULWindow.h" +#include "nslog.h" + +NS_IMPL_LOG(nsBookmarksServiceLog) +#define PRINTF NS_LOG_PRINTF(nsBookmarksServiceLog) +#define FLUSH NS_LOG_FLUSH(nsBookmarksServiceLog) nsIRDFResource *kNC_IEFavoritesRoot; nsIRDFResource *kNC_Bookmark; @@ -1832,8 +1837,8 @@ nsBookmarksService::ExamineBookmarkSchedule(nsIRDFResource *theBookmark, PRBool char *methodStr = notificationMethod.ToNewCString(); if (methodStr) { - printf("Start Hour: %d End Hour: %d Duration: %d mins Method: '%s'\n", - startHour, endHour, duration, methodStr); + PRINTF("Start Hour: %d End Hour: %d Duration: %d mins Method: '%s'\n", + startHour, endHour, duration, methodStr); delete [] methodStr; methodStr = nsnull; } @@ -1873,7 +1878,7 @@ nsBookmarksService::ExamineBookmarkSchedule(nsIRDFResource *theBookmark, PRBool examineFlag = PR_FALSE; #ifdef DEBUG_BOOKMARK_PING_OUTPUT - printf("Skipping URL, its too soon.\n"); + PRINTF("Skipping URL, its too soon.\n"); #endif } } @@ -1968,7 +1973,7 @@ nsBookmarksService::FireTimer(nsITimer* aTimer, void* aClosure) bookmark->GetValueConst(&url); #ifdef DEBUG_BOOKMARK_PING_OUTPUT - printf("nsBookmarksService::FireTimer - Pinging '%s'\n", url); + PRINTF("nsBookmarksService::FireTimer - Pinging '%s'\n", url); #endif nsCOMPtr uri; @@ -2000,7 +2005,7 @@ nsBookmarksService::FireTimer(nsITimer* aTimer, void* aClosure) #ifdef DEBUG_BOOKMARK_PING_OUTPUT else { - printf("nsBookmarksService::FireTimer - busy pinging.\n"); + PRINTF("nsBookmarksService::FireTimer - busy pinging.\n"); } #endif @@ -2053,7 +2058,7 @@ nsBookmarksService::OnStopRequest(nsIChannel* channel, nsISupports *ctxt, if (NS_SUCCEEDED(rv = busyResource->GetValueConst(&uri)) && (uri)) { #ifdef DEBUG_BOOKMARK_PING_OUTPUT - printf("Finished polling '%s'\n", uri); + PRINTF("Finished polling '%s'\n", uri); #endif } @@ -2124,7 +2129,7 @@ nsBookmarksService::OnStopRequest(nsIChannel* channel, nsISupports *ctxt, { #ifdef DEBUG_BOOKMARK_PING_OUTPUT const char *eTagVal = eTagValue.GetBuffer(); - printf("eTag: '%s'\n", eTagVal); + PRINTF("eTag: '%s'\n", eTagVal); #endif nsAutoString eTagStr; nsCOMPtr currentETagNode; @@ -2169,7 +2174,7 @@ nsBookmarksService::OnStopRequest(nsIChannel* channel, nsISupports *ctxt, { #ifdef DEBUG_BOOKMARK_PING_OUTPUT const char *lastModVal = lastModValue.GetBuffer(); - printf("Last-Modified: '%s'\n", lastModVal); + PRINTF("Last-Modified: '%s'\n", lastModVal); #endif nsAutoString lastModStr; nsCOMPtr currentLastModNode; @@ -2212,7 +2217,7 @@ nsBookmarksService::OnStopRequest(nsIChannel* channel, nsISupports *ctxt, { #ifdef DEBUG_BOOKMARK_PING_OUTPUT const char *contentLengthVal = contentLengthValue.GetBuffer(); - printf("Content-Length: '%s'\n", contentLengthVal); + PRINTF("Content-Length: '%s'\n", contentLengthVal); #endif nsAutoString contentLenStr; nsCOMPtr currentContentLengthNode; @@ -2278,7 +2283,7 @@ nsBookmarksService::OnStopRequest(nsIChannel* channel, nsISupports *ctxt, if (changedFlag == PR_TRUE) { #ifdef DEBUG_BOOKMARK_PING_OUTPUT - printf("URL has changed!\n\n"); + PRINTF("URL has changed!\n\n"); #endif nsAutoString schedule; @@ -2402,7 +2407,7 @@ nsBookmarksService::OnStopRequest(nsIChannel* channel, nsISupports *ctxt, if (stopCheckingFlag == PR_TRUE) { #ifdef DEBUG_BOOKMARK_PING_OUTPUT - printf("\nStop checking this URL.\n"); + PRINTF("\nStop checking this URL.\n"); #endif rv = mInner->Unassert(busyResource, kWEB_Schedule, scheduleNode); NS_ASSERTION(NS_SUCCEEDED(rv), "unable to unassert kWEB_Schedule"); @@ -2457,7 +2462,7 @@ nsBookmarksService::OnStopRequest(nsIChannel* channel, nsISupports *ctxt, #ifdef DEBUG_BOOKMARK_PING_OUTPUT else { - printf("URL has not changed status.\n\n"); + PRINTF("URL has not changed status.\n\n"); } #endif } @@ -3970,7 +3975,7 @@ nsBookmarksService::ReadFavorites() #ifdef DEBUG PRTime now; Microseconds((UnsignedWide *)&now); - printf("Start reading in IE Favorites.html\n"); + PRINTF("Start reading in IE Favorites.html\n"); #endif // look for and import any IE Favorites @@ -4002,7 +4007,7 @@ nsBookmarksService::ReadFavorites() LL_SUB(loadTime64, now2, now); PRUint32 loadTime32; LL_L2UI(loadTime32, loadTime64); - printf("Finished reading in IE Favorites.html (%u microseconds)\n", loadTime32); + PRINTF("Finished reading in IE Favorites.html (%u microseconds)\n", loadTime32); #endif return(rv); } @@ -4051,7 +4056,7 @@ nsBookmarksService::ReadBookmarks() #else now = PR_Now(); #endif - printf("Start reading in bookmarks.html\n"); + PRINTF("Start reading in bookmarks.html\n"); #endif #ifdef XP_WIN @@ -4237,7 +4242,7 @@ nsBookmarksService::ReadBookmarks() LL_SUB(loadTime64, now2, now); PRUint32 loadTime32; LL_L2UI(loadTime32, loadTime64); - printf("Finished reading in bookmarks.html (%u microseconds)\n", loadTime32); + PRINTF("Finished reading in bookmarks.html (%u microseconds)\n", loadTime32); #endif return(NS_OK); diff --git a/mozilla/xpfe/components/build/nsModule.cpp b/mozilla/xpfe/components/build/nsModule.cpp index a6d953445c9..0e5dc495bad 100644 --- a/mozilla/xpfe/components/build/nsModule.cpp +++ b/mozilla/xpfe/components/build/nsModule.cpp @@ -33,6 +33,9 @@ #include "nsUrlWidget.h" #include "nsWindowsHooks.h" #endif // Windows +#include "nslog.h" + +NS_IMPL_LOG(nsIAppShellComponentImplLog) // Factory constructors NS_GENERIC_FACTORY_CONSTRUCTOR(nsAutoCompleteItem) diff --git a/mozilla/xpfe/components/find/src/nsFindComponent.cpp b/mozilla/xpfe/components/find/src/nsFindComponent.cpp index 461d22b8a38..07f9c063bcb 100644 --- a/mozilla/xpfe/components/find/src/nsFindComponent.cpp +++ b/mozilla/xpfe/components/find/src/nsFindComponent.cpp @@ -46,12 +46,11 @@ #include "nsWidgetsCID.h" // ugh! contractID, please #include "nsFindComponent.h" +#include "nslog.h" - -#ifdef DEBUG -#define DEBUG_FIND -#endif - +NS_IMPL_LOG(nsFindComponentLog) +#define PRINTF NS_LOG_PRINTF(nsFindComponentLog) +#define FLUSH NS_LOG_FLUSH(nsFindComponentLog) nsFindComponent::Context::Context() { @@ -63,7 +62,7 @@ nsFindComponent::Context::Context() nsFindComponent::Context::~Context() { #ifdef DEBUG_law - printf( "\nnsFindComponent::Context destructor called\n\n" ); + PRINTF( "\nnsFindComponent::Context destructor called\n\n" ); #endif // Close the dialog (if there is one). if ( mFindDialog ) { @@ -774,27 +773,27 @@ static nsresult OpenDialogWithArg( nsIDOMWindowInternal *parent, } JS_PopArguments( jsContext, stackPtr ); } else { - DEBUG_PRINTF( PR_STDOUT, "%s %d: JS_PushArguments failed\n", - (char*)__FILE__, (int)__LINE__ ); + PRINTF("%s %d: JS_PushArguments failed\n", + (char*)__FILE__, (int)__LINE__ ); rv = NS_ERROR_FAILURE; } } else { - DEBUG_PRINTF( PR_STDOUT, "%s %d: GetNativeContext failed\n", - (char*)__FILE__, (int)__LINE__ ); + PRINTF("%s %d: GetNativeContext failed\n", + (char*)__FILE__, (int)__LINE__ ); rv = NS_ERROR_FAILURE; } } else { - DEBUG_PRINTF( PR_STDOUT, "%s %d: GetContext failed\n", - (char*)__FILE__, (int)__LINE__ ); + PRINTF("%s %d: GetContext failed\n", + (char*)__FILE__, (int)__LINE__ ); rv = NS_ERROR_FAILURE; } } else { - DEBUG_PRINTF( PR_STDOUT, "%s %d: QueryInterface (for nsIScriptGlobalObject) failed, rv=0x%08X\n", - (char*)__FILE__, (int)__LINE__, (int)rv ); + PRINTF("%s %d: QueryInterface (for nsIScriptGlobalObject) failed, rv=0x%08X\n", + (char*)__FILE__, (int)__LINE__, (int)rv ); } } else { - DEBUG_PRINTF( PR_STDOUT, "%s %d: OpenDialogWithArg was passed a null pointer!\n", - __FILE__, (int)__LINE__ ); + PRINTF("%s %d: OpenDialogWithArg was passed a null pointer!\n", + __FILE__, (int)__LINE__ ); rv = NS_ERROR_NULL_POINTER; } return rv; @@ -819,8 +818,8 @@ 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 ); + PRINTF("%s %d: Error getting find dialog, rv=0x%08X\n", + __FILE__, (int)__LINE__, (int)rv ); return rv; } } diff --git a/mozilla/xpfe/components/history/src/nsGlobalHistory.cpp b/mozilla/xpfe/components/history/src/nsGlobalHistory.cpp index e4e7f394b7c..16e039e8973 100644 --- a/mozilla/xpfe/components/history/src/nsGlobalHistory.cpp +++ b/mozilla/xpfe/components/history/src/nsGlobalHistory.cpp @@ -58,6 +58,15 @@ #include "nsIMdbFactoryFactory.h" #include "nsIPref.h" +#include "nslog.h" + +#ifdef DEBUG_sspitzer +NS_IMPL_LOG_ENABLED(nsGlobalHistoryLog) +#else +NS_IMPL_LOG(nsGlobalHistoryLog) +#endif +#define PRINTF NS_LOG_PRINTF(nsGlobalHistoryLog) +#define FLUSH NS_LOG_FLUSH(nsGlobalHistoryLog) PRInt32 nsGlobalHistory::gRefCnt; nsIRDFService* nsGlobalHistory::gRDFService; @@ -72,10 +81,6 @@ nsIRDFResource* nsGlobalHistory::kNC_HistoryRoot; nsIRDFResource* nsGlobalHistory::kNC_HistoryBySite; nsIRDFResource* nsGlobalHistory::kNC_HistoryByDate; -#ifdef DEBUG_sspitzer -#define DEBUG_LAST_PAGE_VISITED 1 -#endif /* DEBUG_sspitzer */ - #define BROWSER_HISTORY_LAST_PAGE_VISITED_PREF "browser.history.last_page_visited" //---------------------------------------------------------------------- @@ -678,9 +683,7 @@ nsGlobalHistory::SaveLastPageVisited(const char *aURL) rv = prefs->SetCharPref(BROWSER_HISTORY_LAST_PAGE_VISITED_PREF, aURL); -#ifdef DEBUG_LAST_PAGE_VISITED - printf("XXX saving last page visited as: %s\n", aURL); -#endif /* DEBUG_LAST_PAGE_VISITED */ + PRINTF("XXX saving last page visited as: %s\n", aURL); return rv; } @@ -701,9 +704,7 @@ nsGlobalHistory::GetLastPageVisted(char **_retval) *_retval = nsCRT::strdup((const char *)lastPageVisited); -#ifdef DEBUG_LAST_PAGE_VISITED - printf("XXX getting last page visited as: %s\n", (const char *)lastPageVisited); -#endif /* DEBUG_LAST_PAGE_VISITED */ + PRINTF("XXX getting last page visited as: %s\n", (const char *)lastPageVisited); return NS_OK; } diff --git a/mozilla/xpfe/components/public/nsIAppShellComponentImpl.h b/mozilla/xpfe/components/public/nsIAppShellComponentImpl.h index 2ea05ffafc9..09deb7bed61 100644 --- a/mozilla/xpfe/components/public/nsIAppShellComponentImpl.h +++ b/mozilla/xpfe/components/public/nsIAppShellComponentImpl.h @@ -36,6 +36,7 @@ #include "pratom.h" #include "nsCOMPtr.h" #include "prprf.h" +#include "nslog.h" /*------------------------------------------------------------------------------ | This file contains macros to assist in the implementation of application | @@ -54,12 +55,6 @@ | class implements. | ------------------------------------------------------------------------------*/ -#if defined( NS_DEBUG ) && !defined( XP_MAC ) - #define DEBUG_PRINTF PR_fprintf -#else - #define DEBUG_PRINTF (void) -#endif - #define NS_IMPL_NSGETMODULE1(_class) \ static _class *g##_class; \ extern "C" NS_EXPORT nsresult \ @@ -144,21 +139,26 @@ public: nsIAppShellService *nsAppShellComponentImpl::mAppShell = 0; \ nsICmdLineService *nsAppShellComponentImpl::mCmdLine = 0; +#define NS_IAPPSHELLCOMPONENTIMPL_PRINTF NS_LOG_PRINTF(nsIAppShellComponentImplLog) +#define NS_IAPPSHELLCOMPONENTIMPL_FLUSH NS_LOG_FLUSH(nsIAppShellComponentImplLog) + // Macros to define ctor/dtor for implementation class. // These differ in debug vs. non-debug situations. #ifdef NS_DEBUG #define NS_IMPL_IAPPSHELLCOMPONENTIMPL_CTORDTOR(className) \ +NS_DECL_LOG(nsIAppShellComponentImplLog) \ nsAppShellComponentImpl::nsAppShellComponentImpl() { \ - DEBUG_PRINTF( PR_STDOUT, #className " component created\n" ); \ + NS_IAPPSHELLCOMPONENTIMPL_PRINTF(#className " component created\n" ); \ } \ nsAppShellComponentImpl::~nsAppShellComponentImpl() { \ - DEBUG_PRINTF( PR_STDOUT, #className " component destroyed\n" ); \ + NS_IAPPSHELLCOMPONENTIMPL_PRINTF(#className " component destroyed\n" ); \ } #else #define NS_IMPL_IAPPSHELLCOMPONENTIMPL_CTORDTOR(className) #endif #define NS_IMPL_IAPPSHELLCOMPONENT( className, interfaceName, contractId, autoInit ) \ +NS_IMPL_LOG(nsIAppShellComponentImplLog) \ /* Define instance counter implementation stuff. */\ NS_DEFINE_MODULE_INSTANCE_COUNTER() \ /* Define component globals. */\ @@ -316,7 +316,7 @@ className##Module::RegisterSelf(nsIComponentManager *compMgr, \ rv = compMgr->RegisterComponentSpec( className::GetCID(), #className, \ contractId, aPath, PR_TRUE, PR_TRUE ); \ if ( NS_SUCCEEDED( rv ) ) { \ - DEBUG_PRINTF( PR_STDOUT, #className " registration successful\n" ); \ + NS_IAPPSHELLCOMPONENTIMPL_PRINTF(#className " registration successful\n" ); \ if ( autoInit ) { \ /* Add to appshell component list. */ \ nsIRegistry *registry; \ @@ -334,16 +334,16 @@ className##Module::RegisterSelf(nsIComponentManager *compMgr, \ nsRegistryKey key; \ rv = registry->AddSubtree( nsIRegistry::Common, buffer, &key ); \ if ( NS_SUCCEEDED( rv ) ) { \ - DEBUG_PRINTF( PR_STDOUT, #className " added to appshell component list\n" ); \ + NS_IAPPSHELLCOMPONENTIMPL_PRINTF(#className " added to appshell component list\n" ); \ } else { \ - DEBUG_PRINTF( PR_STDOUT, #className " not added to appshell component list, rv=0x%X\n", (int)rv ); \ + NS_IAPPSHELLCOMPONENTIMPL_PRINTF(#className " not added to appshell component list, rv=0x%X\n", (int)rv ); \ } \ } else { \ - DEBUG_PRINTF( PR_STDOUT, #className " not added to appshell component list, rv=0x%X\n", (int)rv ); \ + NS_IAPPSHELLCOMPONENTIMPL_PRINTF(#className " not added to appshell component list, rv=0x%X\n", (int)rv ); \ } \ } \ } else { \ - DEBUG_PRINTF( PR_STDOUT, #className " registration failed, RegisterComponent rv=0x%X\n", (int)rv ); \ + NS_IAPPSHELLCOMPONENTIMPL_PRINTF(#className " registration failed, RegisterComponent rv=0x%X\n", (int)rv ); \ } \ \ return rv; \ @@ -356,16 +356,16 @@ className##Module::UnregisterSelf( nsIComponentManager *compMgr, \ nsresult rv = NS_OK; \ if (NS_FAILED(rv)) \ { \ - DEBUG_PRINTF( PR_STDOUT, #className " registration failed, GetService rv=0x%X\n", (int)rv ); \ + NS_IAPPSHELLCOMPONENTIMPL_PRINTF(#className " registration failed, GetService rv=0x%X\n", (int)rv ); \ return rv; \ } \ \ /* Unregister our component. */ \ rv = compMgr->UnregisterComponentSpec( className::GetCID(), aPath); \ if ( NS_SUCCEEDED( rv ) ) { \ - DEBUG_PRINTF( PR_STDOUT, #className " unregistration successful\n" ); \ + NS_IAPPSHELLCOMPONENTIMPL_PRINTF(#className " unregistration successful\n" ); \ } else { \ - DEBUG_PRINTF( PR_STDOUT, #className " unregistration failed, UnregisterComponent rv=0x%X\n", (int)rv ); \ + NS_IAPPSHELLCOMPONENTIMPL_PRINTF(#className " unregistration failed, UnregisterComponent rv=0x%X\n", (int)rv ); \ } \ \ return rv; \ diff --git a/mozilla/xpfe/components/related/src/nsRelatedLinksHandler.cpp b/mozilla/xpfe/components/related/src/nsRelatedLinksHandler.cpp index 6f7db6cce15..894c6b45cf8 100644 --- a/mozilla/xpfe/components/related/src/nsRelatedLinksHandler.cpp +++ b/mozilla/xpfe/components/related/src/nsRelatedLinksHandler.cpp @@ -54,6 +54,11 @@ #include "nsICharsetConverterManager.h" #include "nsICharsetAlias.h" +#include "nslog.h" + +NS_IMPL_LOG(nsRelatedLinksHandlerLog) +#define PRINTF NS_LOG_PRINTF(nsRelatedLinksHandlerLog) +#define FLUSH NS_LOG_FLUSH(nsRelatedLinksHandlerLog) static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID); static NS_DEFINE_CID(kRDFInMemoryDataSourceCID, NS_RDFINMEMORYDATASOURCE_CID); @@ -289,17 +294,13 @@ RelatedLinksStreamListener::OnDataAvailable(nsIChannel* channel, nsISupports *ct if (NS_FAILED(rv = aIStream->Read(buffer, aLength, &count)) || count == 0) { -#ifdef DEBUG - printf("Related Links datasource read failure.\n"); -#endif + PRINTF("Related Links datasource read failure.\n"); delete []buffer; return(rv); } if (count != aLength) { -#ifdef DEBUG - printf("Related Links datasource read # of bytes failure.\n"); -#endif + PRINTF("Related Links datasource read # of bytes failure.\n"); delete []buffer; return(NS_ERROR_UNEXPECTED); } @@ -367,7 +368,7 @@ RelatedLinksStreamListener::OnDataAvailable(nsIChannel* channel, nsISupports *ct if (oneLiner.Length() < 1) break; #if 0 - printf("RL: '%s'\n", oneLiner.ToNewCString()); + PRINTF("RL: '%s'\n", oneLiner.ToNewCString()); #endif // yes, very primitive RDF parsing follows @@ -480,7 +481,7 @@ RelatedLinksStreamListener::OnDataAvailable(nsIChannel* channel, nsISupports *ct { #if 0 - printf("RL: '%s' - '%s'\n", title.ToNewCString(), child.ToNewCString()); + PRINTF("RL: '%s' - '%s'\n", title.ToNewCString(), child.ToNewCString()); #endif const PRUnichar *url = child.GetUnicode(); if (nsnull != url) diff --git a/mozilla/xpfe/components/sample/src/nsSampleAppShellComponent.cpp b/mozilla/xpfe/components/sample/src/nsSampleAppShellComponent.cpp index 8a181dd8c11..989a7420d69 100644 --- a/mozilla/xpfe/components/sample/src/nsSampleAppShellComponent.cpp +++ b/mozilla/xpfe/components/sample/src/nsSampleAppShellComponent.cpp @@ -97,7 +97,7 @@ private: NS_IMETHODIMP nsSampleAppShellComponent::DoDialogTests( nsISupports *parent, nsIObserver *observer ) { nsresult rv = NS_OK; - DEBUG_PRINTF( PR_STDOUT, "nsSampleAppShellComponent::DoDialogTests called\n" ); + PRINTF(("nsSampleAppShellComponent::DoDialogTests called\n" )); if ( parent && observer ) { // Open the dialog from C++. @@ -160,12 +160,12 @@ nsSampleAppShellComponent::DoDialogTests( nsISupports *parent, nsIObserver *obse } else { } } else { - DEBUG_PRINTF( PR_STDOUT, "%s %d: QueryInterface failed, rv=0x%08X\n", - __FILE__, (int)__LINE__, (int)rv ); + PRINTF(("%s %d: QueryInterface failed, rv=0x%08X\n", + __FILE__, (int)__LINE__, (int)rv )); } } else { - DEBUG_PRINTF( PR_STDOUT, "%s %d: DoDialogTests was passed a null pointer!\n", - __FILE__, (int)__LINE__ ); + PRINTF(("%s %d: DoDialogTests was passed a null pointer!\n", + __FILE__, (int)__LINE__ )); rv = NS_ERROR_NULL_POINTER; } diff --git a/mozilla/xpfe/components/search/src/nsInternetSearchService.cpp b/mozilla/xpfe/components/search/src/nsInternetSearchService.cpp index 58f6c7d10d9..86a5e2d51a8 100755 --- a/mozilla/xpfe/components/search/src/nsInternetSearchService.cpp +++ b/mozilla/xpfe/components/search/src/nsInternetSearchService.cpp @@ -72,6 +72,12 @@ #include "winbase.h" #endif +#include "nslog.h" + +NS_IMPL_LOG(nsInternetSearchServiceLog) +#define PRINTF NS_LOG_PRINTF(nsInternetSearchServiceLog) +#define FLUSH NS_LOG_FLUSH(nsInternetSearchServiceLog) + #ifdef DEBUG // #define DEBUG_SEARCH_OUTPUT 1 // #define DEBUG_SEARCH_UPDATES 1 @@ -296,9 +302,7 @@ searchModePrefCallback(const char *pref, void *aClosure) { PRInt32 searchMode=0; searchDS->prefs->GetIntPref(pref, &searchMode); -#ifdef DEBUG - printf("searchModePrefCallback: '%s' = %d\n", pref, searchMode); -#endif + PRINTF("searchModePrefCallback: '%s' = %d\n", pref, searchMode); searchDS->Assert(searchDS->kNC_LastSearchRoot, searchDS->kNC_LastSearchMode, searchDS->kTrueLiteral, PR_TRUE); } return(NS_OK); @@ -637,7 +641,7 @@ InternetSearchDataSource::FireTimer(nsITimer* aTimer, void* aClosure) search->busySchedule = TRUE; #ifdef DEBUG_SEARCH_UPDATES - printf(" InternetSearchDataSource::FireTimer - Pinging '%s'\n", (char *)updateURL); + PRINTF(" InternetSearchDataSource::FireTimer - Pinging '%s'\n", (char *)updateURL); #endif } @@ -645,7 +649,7 @@ InternetSearchDataSource::FireTimer(nsITimer* aTimer, void* aClosure) #ifdef DEBUG_SEARCH_UPDATES else { - printf(" InternetSearchDataSource::FireTimer - busy pinging.\n"); + PRINTF(" InternetSearchDataSource::FireTimer - busy pinging.\n"); } #endif @@ -1282,8 +1286,8 @@ InternetSearchDataSource::GetCategoryList() aEngineRes->GetValueConst(&catEngineURI); if (catEngineURI) { - printf("**** Stale search engine reference to '%s'\n", - catEngineURI); + PRINTF("**** Stale search engine reference to '%s'\n", + catEngineURI); } #endif nsCOMPtr staleCatEngine; @@ -2173,7 +2177,7 @@ InternetSearchDataSource::AddSearchEngine(const char *engineURL, const char *ico // can be null or empty strings, which is OK #ifdef DEBUG_SEARCH_OUTPUT - printf("AddSearchEngine: engine='%s'\n", engineURL); + PRINTF("AddSearchEngine: engine='%s'\n", engineURL); #endif nsresult rv = NS_OK; @@ -2621,8 +2625,8 @@ InternetSearchDataSource::FindInternetSearchResults(const char *url, PRBool *sea char *engineMatch = searchText.ToNewCString(); if (engineMatch) { - printf("FindInternetSearchResults: search for: '%s'\n\n", - engineMatch); + PRINTF("FindInternetSearchResults: search for: '%s'\n\n", + engineMatch); Recycle(engineMatch); engineMatch = nsnull; } @@ -2929,7 +2933,7 @@ InternetSearchDataSource::BeginSearchRequest(nsIRDFResource *source, PRBool doNe if (!baseFilename) continue; #ifdef DEBUG_SEARCH_OUTPUT - printf("Search engine to query: '%s'\n", baseFilename); + PRINTF("Search engine to query: '%s'\n", baseFilename); #endif nsCOMPtr engine; @@ -3020,7 +3024,7 @@ InternetSearchDataSource::FindData(nsIRDFResource *engine, nsIRDFLiteral **dataL return(rv); #ifdef DEBUG_SEARCH_OUTPUT - printf("InternetSearchDataSource::FindData - reading in '%s'\n", baseFilename); + PRINTF("InternetSearchDataSource::FindData - reading in '%s'\n", baseFilename); #endif nsFileSpec engineSpec(baseFilename); @@ -3329,7 +3333,7 @@ InternetSearchDataSource::validateEngine(nsIRDFResource *engine) validateEngineNow(engine); #ifdef DEBUG_SEARCH_UPDATES - printf(" Search engine '%s' marked valid as of now.\n", engineURI); + PRINTF(" Search engine '%s' marked valid as of now.\n", engineURI); #endif return(NS_OK); @@ -3352,8 +3356,8 @@ InternetSearchDataSource::validateEngine(nsIRDFResource *engine) if (durationSecs < updateCheckSecs) { #ifdef DEBUG_SEARCH_UPDATES - printf(" Search engine '%s' is valid for %d more seconds.\n", - engineURI, (updateCheckSecs-durationSecs)); + PRINTF(" Search engine '%s' is valid for %d more seconds.\n", + engineURI, (updateCheckSecs-durationSecs)); #endif return(NS_OK); } @@ -3365,15 +3369,15 @@ InternetSearchDataSource::validateEngine(nsIRDFResource *engine) mUpdateArray->AppendElement(engine); #ifdef DEBUG_SEARCH_UPDATES - printf(" Search engine '%s' is now queued to be validated via HTTP HEAD method.\n", - engineURI, durationSecs); + PRINTF(" Search engine '%s' is now queued to be validated via HTTP HEAD method.\n", + engineURI, durationSecs); #endif } else { #ifdef DEBUG_SEARCH_UPDATES - printf(" Search engine '%s' is already in queue to be validated.\n", - engineURI); + PRINTF(" Search engine '%s' is already in queue to be validated.\n", + engineURI); #endif } return(NS_OK); @@ -4276,7 +4280,7 @@ NS_IMETHODIMP InternetSearchDataSource::OnStartRequest(nsIChannel* channel, nsISupports *ctxt) { #ifdef DEBUG_SEARCH_OUTPUT - printf("InternetSearchDataSourceCallback::OnStartRequest entered.\n"); + PRINTF("InternetSearchDataSourceCallback::OnStartRequest entered.\n"); #endif return(NS_OK); } @@ -4302,7 +4306,7 @@ InternetSearchDataSource::OnDataAvailable(nsIChannel* channel, nsISupports *ctxt if (NS_FAILED(rv = aIStream->Read(buffer, aLength, &count)) || count == 0) { #ifdef DEBUG - printf("Search datasource read failure.\n"); + PRINTF("Search datasource read failure.\n"); #endif delete []buffer; return(rv); @@ -4310,7 +4314,7 @@ InternetSearchDataSource::OnDataAvailable(nsIChannel* channel, nsISupports *ctxt if (count != aLength) { #ifdef DEBUG - printf("Search datasource read # of bytes failure.\n"); + PRINTF("Search datasource read # of bytes failure.\n"); #endif delete []buffer; return(NS_ERROR_UNEXPECTED); @@ -4462,7 +4466,7 @@ InternetSearchDataSource::OnStopRequest(nsIChannel* channel, nsISupports *ctxt, if (val) { #ifdef DEBUG_SEARCH_UPDATES - printf(" Search engine='%s' Last-Modified='%s'\n", engineURI, val); + PRINTF(" Search engine='%s' Last-Modified='%s'\n", engineURI, val); #endif lastModValue = val; nsCRT::free(val); @@ -4474,7 +4478,7 @@ InternetSearchDataSource::OnStopRequest(nsIChannel* channel, nsISupports *ctxt, if (val) { #ifdef DEBUG_SEARCH_UPDATES - printf(" Search engine='%s' Content-Length='%s'\n", engineURI, val); + PRINTF(" Search engine='%s' Content-Length='%s'\n", engineURI, val); #endif contentLengthValue = val; nsCRT::free(val); @@ -4523,15 +4527,15 @@ InternetSearchDataSource::OnStopRequest(nsIChannel* channel, nsISupports *ctxt, nsAutoString dataStr(dataUni); PRInt32 dataLen=dataStr.Length(); #ifdef DEBUG_SEARCH_UPDATES - printf(" Search engine='%s' data length='%d'\n", engineURI, dataLen); + PRINTF(" Search engine='%s' data length='%d'\n", engineURI, dataLen); #endif PRInt32 contentLen=0, err=0; contentLen = contentLengthValue.ToInteger(&err); if ((!err) && (dataLen != contentLen)) { #ifdef DEBUG_SEARCH_UPDATES - printf(" Search engine '%s' data length != remote content length, so update\n", - engineURI, dataLen); + PRINTF(" Search engine '%s' data length != remote content length, so update\n", + engineURI, dataLen); #endif updateSearchEngineFile = PR_TRUE; } @@ -4546,7 +4550,7 @@ InternetSearchDataSource::OnStopRequest(nsIChannel* channel, nsISupports *ctxt, if (updateSearchEngineFile == PR_TRUE) { #ifdef DEBUG_SEARCH_UPDATES - printf(" Search engine='%s' needs updating, so fetching it\n", engineURI); + PRINTF(" Search engine='%s' needs updating, so fetching it\n", engineURI); #endif // get update URL nsCString updateURL; @@ -4589,7 +4593,7 @@ InternetSearchDataSource::OnStopRequest(nsIChannel* channel, nsISupports *ctxt, else { #ifdef DEBUG_SEARCH_UPDATES - printf(" Search engine='%s' is current and requires no updating\n", engineURI); + PRINTF(" Search engine='%s' is current and requires no updating\n", engineURI); #endif } } @@ -4680,7 +4684,7 @@ InternetSearchDataSource::webSearchFinalize(nsIChannel* channel, nsIInternetSear else { #ifdef DEBUG_SEARCH_OUTPUT - printf(" *** InternetSearchDataSourceCallback::OnStopRequest: no data.\n\n"); + PRINTF(" *** InternetSearchDataSourceCallback::OnStopRequest: no data.\n\n"); #endif } @@ -4928,7 +4932,7 @@ InternetSearchDataSource::ParseHTML(nsIURI *aURL, nsIRDFResource *mParent, nsIRD char *results = resultItem.ToNewCString(); if (results) { - printf("\n----- Search result: '%s'\n\n", results); + PRINTF("\n----- Search result: '%s'\n\n", results); nsCRT::free(results); results = nsnull; } @@ -4939,7 +4943,7 @@ InternetSearchDataSource::ParseHTML(nsIURI *aURL, nsIRDFResource *mParent, nsIRD if (hrefOffset < 0) { #ifdef DEBUG_SEARCH_OUTPUT - printf("\n***** Unable to find HREF!\n\n"); + PRINTF("\n***** Unable to find HREF!\n\n"); #endif continue; } @@ -5030,7 +5034,7 @@ InternetSearchDataSource::ParseHTML(nsIURI *aURL, nsIRDFResource *mParent, nsIRD nsAutoString site(hrefStr); #ifdef DEBUG_SEARCH_OUTPUT - printf("HREF: '%s'\n", href); + PRINTF("HREF: '%s'\n", href); #endif nsCOMPtr res; @@ -5134,7 +5138,7 @@ InternetSearchDataSource::ParseHTML(nsIURI *aURL, nsIRDFResource *mParent, nsIRD if (anchorEnd < quoteEndOffset) { #ifdef DEBUG_SEARCH_OUTPUT - printf("\n\nSearch: Unable to find ending > when computing name.\n\n"); + PRINTF("\n\nSearch: Unable to find ending > when computing name.\n\n"); #endif continue; } @@ -5142,7 +5146,7 @@ InternetSearchDataSource::ParseHTML(nsIURI *aURL, nsIRDFResource *mParent, nsIRD if (anchorStop < anchorEnd) { #ifdef DEBUG_SEARCH_OUTPUT - printf("\n\nSearch: Unable to find tag to compute name.\n\n"); + PRINTF("\n\nSearch: Unable to find tag to compute name.\n\n"); #endif continue; } diff --git a/mozilla/xpfe/components/search/src/nsLocalSearchService.cpp b/mozilla/xpfe/components/search/src/nsLocalSearchService.cpp index 536db3e8bb2..b499dae598e 100755 --- a/mozilla/xpfe/components/search/src/nsLocalSearchService.cpp +++ b/mozilla/xpfe/components/search/src/nsLocalSearchService.cpp @@ -43,6 +43,11 @@ #include "nsIRDFObserver.h" #include "nsRDFCID.h" #include "rdf.h" +#include "nslog.h" + +NS_IMPL_LOG(nsLocalSearchServiceLog) +#define PRINTF NS_LOG_PRINTF(nsLocalSearchServiceLog) +#define FLUSH NS_LOG_FLUSH(nsLocalSearchServiceLog) static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID); static NS_DEFINE_CID(kTextToSubURICID, NS_TEXTTOSUBURI_CID); @@ -278,9 +283,7 @@ LocalSearchDataSource::parseResourceIntoFindTokens(nsIRDFResource *u, findTokenP if (NS_FAILED(rv = u->GetValueConst(&uri))) return(rv); -#ifdef DEBUG - printf("Find: %s\n", (const char*) uri); -#endif + PRINTF("Find: %s\n", (const char*) uri); if (!(id = PL_strdup(uri + sizeof(kFindProtocol) - 1))) return(NS_ERROR_OUT_OF_MEMORY); diff --git a/mozilla/xpfe/components/shistory/src/nsSHistory.cpp b/mozilla/xpfe/components/shistory/src/nsSHistory.cpp index 1343b55233d..015cd30d05f 100644 --- a/mozilla/xpfe/components/shistory/src/nsSHistory.cpp +++ b/mozilla/xpfe/components/shistory/src/nsSHistory.cpp @@ -35,6 +35,11 @@ #include "nsIDocShellTreeNode.h" #include "nsIDocShellLoadInfo.h" #include "nsIServiceManager.h" +#include "nslog.h" + +NS_IMPL_LOG(nsSHistoryLog) +#define PRINTF NS_LOG_PRINTF(nsSHistoryLog) +#define FLUSH NS_LOG_FLUSH(nsSHistoryLog) //***************************************************************************** //*** nsSHistory: Object Management @@ -263,10 +268,10 @@ nsSHistory::PrintHistory() nsString titlestr(title); titleCStr = titlestr.ToNewCString(); - printf("**** SH Transaction #%d, Entry = %x\n", index, entry.get()); - printf("\t\t URL = %s\n", url); - printf("\t\t Title = %s\n", titleCStr); - printf("\t\t layout History Data = %x\n", layoutHistoryState); + PRINTF("**** SH Transaction #%d, Entry = %x\n", index, entry.get()); + PRINTF("\t\t URL = %s\n", url); + PRINTF("\t\t Title = %s\n", titleCStr); + PRINTF("\t\t layout History Data = %x\n", layoutHistoryState); Recycle(titleCStr); #endif diff --git a/mozilla/xpfe/components/startup/src/nsCommandLineService.cpp b/mozilla/xpfe/components/startup/src/nsCommandLineService.cpp index e39d7548af8..7b52c844830 100644 --- a/mozilla/xpfe/components/startup/src/nsCommandLineService.cpp +++ b/mozilla/xpfe/components/startup/src/nsCommandLineService.cpp @@ -26,6 +26,11 @@ #include "nsIComponentManager.h" #include "nsString.h" #include "plstr.h" +#include "nslog.h" + +NS_IMPL_LOG(nsCommandLineServiceLog) +#define PRINTF NS_LOG_PRINTF(nsCommandLineServiceLog) +#define FLUSH NS_LOG_FLUSH(nsCommandLineServiceLog) nsCmdLineService::nsCmdLineService() : mArgCount(0), mArgc(0), mArgv(0) @@ -136,7 +141,7 @@ nsCmdLineService::Initialize(int aArgc, char ** aArgv) #if 0 for (i=0; iPW_GECOS) return NS_ERROR_FAILURE; #ifdef DEBUG_sspitzer - printf("fullname = %s\n", pw->PW_GECOS); + PRINTF("fullname = %s\n", pw->PW_GECOS); #endif nsAutoString fullname(NS_ConvertASCIItoUCS2(pw->PW_GECOS)); @@ -84,7 +89,7 @@ nsUserInfo::GetUsername(char * *aUsername) if (!pw || !pw->pw_name) return NS_ERROR_FAILURE; #ifdef DEBUG_sspitzer - printf("username = %s\n", pw->pw_name); + PRINTF("username = %s\n", pw->pw_name); #endif *aUsername = nsCRT::strdup(pw->pw_name); diff --git a/mozilla/xpfe/components/timebomb/nsTimeBomb.cpp b/mozilla/xpfe/components/timebomb/nsTimeBomb.cpp index 2fae64ec1d9..87f7112d86b 100644 --- a/mozilla/xpfe/components/timebomb/nsTimeBomb.cpp +++ b/mozilla/xpfe/components/timebomb/nsTimeBomb.cpp @@ -35,6 +35,11 @@ //Interfaces Needed #include "nsIXULWindow.h" #include "nsIWebBrowserChrome.h" +#include "nslog.h" + +NS_IMPL_LOG(nsTimeBombLog) +#define PRINTF NS_LOG_PRINTF(nsTimeBombLog) +#define FLUSH NS_LOG_FLUSH(nsTimeBombLog) static NS_DEFINE_CID(kPrefCID, NS_PREF_CID); static NS_DEFINE_CID(kAppShellServiceCID, NS_APPSHELL_SERVICE_CID); @@ -128,9 +133,7 @@ nsTimeBomb::CheckWithUI(PRBool *expired) if (NS_SUCCEEDED(rv) && val) { -#ifdef DEBUG - printf("******** Expired version ********\n"); -#endif + PRINTF("******** Expired version ********\n"); DisplayURI("chrome://communicator/content/timebomb/expireText.xul", PR_FALSE); *expired = PR_TRUE; return NS_OK; @@ -140,9 +143,7 @@ nsTimeBomb::CheckWithUI(PRBool *expired) if (NS_SUCCEEDED(rv) && val) { -#ifdef DEBUG - printf("******** ABOUT TO EXPIRE ********\n"); -#endif + PRINTF("******** ABOUT TO EXPIRE ********\n"); DisplayURI("chrome://communicator/content/timebomb/warnText.xul", PR_FALSE); } diff --git a/mozilla/xpfe/components/ucth/src/nsUnknownContentTypeHandler.cpp b/mozilla/xpfe/components/ucth/src/nsUnknownContentTypeHandler.cpp index 3cdcf2b59f2..d23e794838f 100644 --- a/mozilla/xpfe/components/ucth/src/nsUnknownContentTypeHandler.cpp +++ b/mozilla/xpfe/components/ucth/src/nsUnknownContentTypeHandler.cpp @@ -37,6 +37,13 @@ #include "nsIExternalHelperAppService.h" #include "nsIStringBundle.h" #include "nsIFilePicker.h" +#include "nslog.h" + +NS_IMPL_LOG(nsUnknownContentTypeHandlerLog) +#define PRINTF NS_LOG_PRINTF(nsUnknownContentTypeHandlerLog) +#define FLUSH NS_LOG_FLUSH(nsUnknownContentTypeHandlerLog) + +NS_IMPL_LOG(nsIAppShellComponentImplLog) static NS_DEFINE_CID(kStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID); #define HELPERAPP_DIALOG_URL "chrome://global/locale/helperAppLauncher.properties" @@ -115,8 +122,8 @@ nsUnknownContentTypeHandler::HandleUnknownContentType( nsIChannel *aChannel, // Cancel input channel now. rv = aChannel->Cancel(NS_BINDING_ABORTED); if ( NS_FAILED( rv ) ) { - DEBUG_PRINTF( PR_STDOUT, "%s %d: Cancel failed, rv=0x%08X\n", - (char*)__FILE__, (int)__LINE__, (int)rv ); + PRINTF("%s %d: Cancel failed, rv=0x%08X\n", + (char*)__FILE__, (int)__LINE__, (int)rv ); } } @@ -149,28 +156,28 @@ nsUnknownContentTypeHandler::HandleUnknownContentType( nsIChannel *aChannel, nsCOMPtr newWindow; rv = aWindow->OpenDialog( jsContext, argv, 6, getter_AddRefs( newWindow ) ); if ( NS_FAILED( rv ) ) { - DEBUG_PRINTF( PR_STDOUT, "%s %d: OpenDialog failed, rv=0x%08X\n", - (char*)__FILE__, (int)__LINE__, (int)rv ); + PRINTF("%s %d: OpenDialog failed, rv=0x%08X\n", + (char*)__FILE__, (int)__LINE__, (int)rv ); } JS_PopArguments( jsContext, stackPtr ); } else { - DEBUG_PRINTF( PR_STDOUT, "%s %d: JS_PushArguments failed\n", - (char*)__FILE__, (int)__LINE__ ); + PRINTF("%s %d: JS_PushArguments failed\n", + (char*)__FILE__, (int)__LINE__ ); rv = NS_ERROR_FAILURE; } } else { - DEBUG_PRINTF( PR_STDOUT, "%s %d: GetNativeContext failed\n", - (char*)__FILE__, (int)__LINE__ ); + PRINTF("%s %d: GetNativeContext failed\n", + (char*)__FILE__, (int)__LINE__ ); rv = NS_ERROR_FAILURE; } } else { - DEBUG_PRINTF( PR_STDOUT, "%s %d: GetContext failed\n", - (char*)__FILE__, (int)__LINE__ ); + PRINTF("%s %d: GetContext failed\n", + (char*)__FILE__, (int)__LINE__ ); rv = NS_ERROR_FAILURE; } } else { - DEBUG_PRINTF( PR_STDOUT, "%s %d: QueryInterface (for nsIScriptGlobalObject) failed, rv=0x%08X\n", - (char*)__FILE__, (int)__LINE__, (int)rv ); + PRINTF("%s %d: QueryInterface (for nsIScriptGlobalObject) failed, rv=0x%08X\n", + (char*)__FILE__, (int)__LINE__, (int)rv ); } } else { // If no error recorded so far, set one now. @@ -524,7 +531,7 @@ className##Module::RegisterSelf(nsIComponentManager *compMgr, rv = compMgr->RegisterComponentSpec( className::GetCID(), #className, contractId, aPath, PR_TRUE, PR_TRUE ); if ( NS_SUCCEEDED( rv ) ) { - DEBUG_PRINTF( PR_STDOUT, #className " registration successfuln" ); + PRINTF(#className " registration successfuln" ); if ( autoInit ) { /* Add to appshell component list. */ nsIRegistry *registry; @@ -542,16 +549,16 @@ className##Module::RegisterSelf(nsIComponentManager *compMgr, nsRegistryKey key; rv = registry->AddSubtree( nsIRegistry::Common, buffer, &key ); if ( NS_SUCCEEDED( rv ) ) { - DEBUG_PRINTF( PR_STDOUT, #className " added to appshell component listn" ); + PRINTF(#className " added to appshell component listn" ); } else { - DEBUG_PRINTF( PR_STDOUT, #className " not added to appshell component list, rv=0x%Xn", (int)rv ); + PRINTF(#className " not added to appshell component list, rv=0x%Xn", (int)rv ); } } else { - DEBUG_PRINTF( PR_STDOUT, #className " not added to appshell component list, rv=0x%Xn", (int)rv ); + PRINTF(#className " not added to appshell component list, rv=0x%Xn", (int)rv ); } } } else { - DEBUG_PRINTF( PR_STDOUT, #className " registration failed, RegisterComponent rv=0x%Xn", (int)rv ); + PRINTF(#className " registration failed, RegisterComponent rv=0x%Xn", (int)rv ); } return rv; @@ -564,16 +571,16 @@ className##Module::UnregisterSelf( nsIComponentManager *compMgr, nsresult rv = NS_OK; if (NS_FAILED(rv)) { - DEBUG_PRINTF( PR_STDOUT, #className " registration failed, GetService rv=0x%Xn", (int)rv ); + PRINTF(#className " registration failed, GetService rv=0x%Xn", (int)rv ); return rv; } /* Unregister our component. */ rv = compMgr->UnregisterComponentSpec( className::GetCID(), aPath); if ( NS_SUCCEEDED( rv ) ) { - DEBUG_PRINTF( PR_STDOUT, #className " unregistration successfuln" ); + PRINTF(#className " unregistration successfuln" ); } else { - DEBUG_PRINTF( PR_STDOUT, #className " unregistration failed, UnregisterComponent rv=0x%Xn", (int)rv ); + PRINTF(#className " unregistration failed, UnregisterComponent rv=0x%Xn", (int)rv ); } return rv; diff --git a/mozilla/xpfe/components/urlbarhistory/src/nsUrlbarHistory.cpp b/mozilla/xpfe/components/urlbarhistory/src/nsUrlbarHistory.cpp index b0c017c7b37..59ca62f5a3d 100644 --- a/mozilla/xpfe/components/urlbarhistory/src/nsUrlbarHistory.cpp +++ b/mozilla/xpfe/components/urlbarhistory/src/nsUrlbarHistory.cpp @@ -36,6 +36,11 @@ #include "nsIRDFService.h" #include "nsIRDFContainer.h" #include "nsIRDFContainerUtils.h" +#include "nslog.h" + +NS_IMPL_LOG(nsUrlbarHistoryLog) +#define PRINTF NS_LOG_PRINTF(nsUrlbarHistoryLog) +#define FLUSH NS_LOG_FLUSH(nsUrlbarHistoryLog) static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID); @@ -86,7 +91,7 @@ nsUrlbarHistory::nsUrlbarHistory():mLength(0) res = nsServiceManager::GetService(kRDFCUtilsCID, NS_GET_IID(nsIRDFContainerUtils), (nsISupports **)&gRDFCUtils); if (gRDFService) { - //printf("$$$$ Got RDF SERVICE $$$$\n"); + //PRINTF("$$$$ Got RDF SERVICE $$$$\n"); res = gRDFService->GetDataSource("rdf:localstore", getter_AddRefs(mDataSource)); res = gRDFService->GetResource("http://home.netscape.com/NC-rdf#child", &kNC_CHILD); @@ -97,7 +102,7 @@ nsUrlbarHistory::nsUrlbarHistory():mLength(0) (nsISupports **) &gPrefs); #if DEBUG_radha if (gPrefs) - printf("***** Got the pref service *****\n"); + PRINTF("***** Got the pref service *****\n"); #endif } @@ -198,7 +203,7 @@ nsUrlbarHistory::PrintHistory() NS_ENSURE_TRUE(entry, NS_ERROR_FAILURE); char * cEntry; cEntry = entry->ToNewCString(); - printf("Entry at index %d is %s\n", i, cEntry); + PRINTF("Entry at index %d is %s\n", i, cEntry); Recycle(cEntry); } @@ -224,7 +229,7 @@ nsUrlbarHistory::OnStartLookup(const PRUnichar *uSearchString, nsIAutoCompleteRe listener->OnAutoComplete(nsnull, nsIAutoCompleteStatus::ignored); return NS_OK; } - // printf("Autocomplete is enabled\n"); + // PRINTF("Autocomplete is enabled\n"); if (uSearchString[0] == 0) { @@ -346,7 +351,7 @@ nsUrlbarHistory::SearchPreviousResults(const PRUnichar *searchStr, nsIAutoComple resultItem->GetValue(&itemValue); nsAutoString itemAutoStr(itemValue); - //printf("SearchPreviousResults::Comparing %s with %s \n", searchAutoStr.ToNewCString(), itemAutoStr.ToNewCString()); + //PRINTF("SearchPreviousResults::Comparing %s with %s \n", searchAutoStr.ToNewCString(), itemAutoStr.ToNewCString()); if (!itemValue) continue; if (nsCRT::strncasecmp(searchStr, itemValue, searchStrLen) == 0) @@ -407,7 +412,7 @@ nsUrlbarHistory::SearchCache(const PRUnichar* searchStr, nsIAutoCompleteResults* rdfAStr = (rdfValue); index = rdfAStr.Find(searchStr, PR_TRUE); match = rdfAStr.ToNewUnicode(); - //printf("SearchCache Round I-found item %s in rdf\n", rdfAStr.ToNewCString()); + //PRINTF("SearchCache Round I-found item %s in rdf\n", rdfAStr.ToNewCString()); } /* Didn't succeed in the first attempt. See if there * is any prefix in the searchString, strip off the prefix @@ -426,12 +431,12 @@ nsUrlbarHistory::SearchCache(const PRUnichar* searchStr, nsIAutoCompleteResults* } if ((resultStr.Length())) { index = rdfAStr.Find(resultStr, PR_TRUE); - //printf("SearchCache Round II, searching for %s, prefix = %s\n", resultStr.ToNewCString(), prefix.ToNewCString()); + //PRINTF("SearchCache Round II, searching for %s, prefix = %s\n", resultStr.ToNewCString(), prefix.ToNewCString()); if (match) Recycle(match); if (index == 0) { resultStr = prefix + rdfAStr; - //printf("SearchCache Round III, searching for %s\n", resultStr.ToNewCString()); + //PRINTF("SearchCache Round III, searching for %s\n", resultStr.ToNewCString()); match = resultStr.ToNewUnicode(); } else @@ -449,7 +454,7 @@ nsUrlbarHistory::SearchCache(const PRUnichar* searchStr, nsIAutoCompleteResults* rv = results->GetItems(getter_AddRefs(array)); if (NS_SUCCEEDED(rv)) { - // printf("Appending element %s to the results array\n", item->ToNewCString()); + // PRINTF("Appending element %s to the results array\n", item->ToNewCString()); array->AppendElement((nsISupports*)newItem); } } diff --git a/mozilla/xpfe/components/urlwidget/nsUrlWidget.cpp b/mozilla/xpfe/components/urlwidget/nsUrlWidget.cpp index 54d6d415c54..f325f044c53 100644 --- a/mozilla/xpfe/components/urlwidget/nsUrlWidget.cpp +++ b/mozilla/xpfe/components/urlwidget/nsUrlWidget.cpp @@ -34,6 +34,11 @@ #include "nsCOMPtr.h" #include +#include "nslog.h" + +NS_IMPL_LOG(nsUrlWidgetLog) +#define PRINTF NS_LOG_PRINTF(nsUrlWidgetLog) +#define FLUSH NS_LOG_FLUSH(nsUrlWidgetLog) // Define this macro to turn on console debug output. //#define DEBUG_URLWIDGET @@ -109,7 +114,7 @@ nsUrlWidget::SetURLToHiddenControl( char const *aURL, nsIDOMWindowInternal *pare if ((aURL != NULL) && (hEdit != NULL)) { #ifdef DEBUG_URLWIDGET - printf( "nsUrlWidget; window=0x%08X, url=[%s]\n", (int)hEdit, aURL ); + PRINTF( "nsUrlWidget; window=0x%08X, url=[%s]\n", (int)hEdit, aURL ); #endif ::SendMessage(hEdit, WM_SETTEXT, (WPARAM)0, (LPARAM)aURL); } @@ -123,13 +128,13 @@ NS_IMPL_ISUPPORTS1( nsUrlWidget, nsIUrlWidget ); nsUrlWidget::nsUrlWidget() { NS_INIT_ISUPPORTS(); #ifdef DEBUG_URLWIDGET -printf( "nsUrlWidget ctor called\n" ); + PRINTF( "nsUrlWidget ctor called\n" ); #endif } nsUrlWidget::~nsUrlWidget() { #ifdef DEBUG_URLWIDGET -printf( "nsUrlWidget dtor called\n" ); + PRINTF( "nsUrlWidget dtor called\n" ); #endif } diff --git a/mozilla/xpfe/components/winhooks/nsWindowsHooksUtil.cpp b/mozilla/xpfe/components/winhooks/nsWindowsHooksUtil.cpp index 3c06793d190..52865172d73 100644 --- a/mozilla/xpfe/components/winhooks/nsWindowsHooksUtil.cpp +++ b/mozilla/xpfe/components/winhooks/nsWindowsHooksUtil.cpp @@ -22,8 +22,12 @@ */ #include #include - #include "nsString.h" +#include "nslog.h" + +NS_IMPL_LOG(nsWindowsHooksUtilLog) +#define PRINTF NS_LOG_PRINTF(nsWindowsHooksUtilLog) +#define FLUSH NS_LOG_FLUSH(nsWindowsHooksUtilLog) // Where Mozilla stores its own registry values. const char * const mozillaKeyName = "Software\\Mozilla\\Desktop"; @@ -226,7 +230,7 @@ PRBool RegistryEntry::isAlreadySet() const { // Gives registry entry the desired setting. nsresult RegistryEntry::set() { #ifdef DEBUG_law -printf( "Setting %s=%s\n", (const char*)fullName(), (const char*)setting ); + PRINTF( "Setting %s=%s\n", (const char*)fullName(), (const char*)setting ); #endif nsresult result = NS_ERROR_FAILURE; diff --git a/mozilla/xpfe/components/xfer/src/nsStreamTransfer.cpp b/mozilla/xpfe/components/xfer/src/nsStreamTransfer.cpp index bef2acbfc52..ae270017726 100644 --- a/mozilla/xpfe/components/xfer/src/nsStreamTransfer.cpp +++ b/mozilla/xpfe/components/xfer/src/nsStreamTransfer.cpp @@ -34,6 +34,11 @@ #include "nsIStringBundle.h" #include "nsIAllocator.h" #include "nsIFileStream.h" +#include "nslog.h" + +NS_IMPL_LOG(nsStreamTransferLog) +#define PRINTF NS_LOG_PRINTF(nsStreamTransferLog) +#define FLUSH NS_LOG_FLUSH(nsStreamTransferLog) // {BEBA91C0-070F-11d3-8068-00600811A9C3} #define NS_STREAMTRANSFER_CID \ @@ -148,17 +153,17 @@ nsStreamTransfer::SelectFileAndTransferLocation( nsIChannel *aChannel, rv = p->OpenDialog( parent ); NS_RELEASE(p); if ( NS_FAILED( rv ) ) { - DEBUG_PRINTF( PR_STDOUT, "%s %d : Error opening dialog, rv=0x%08X\n", - (char *)__FILE__, (int)__LINE__, (int)rv ); + PRINTF("%s %d : Error opening dialog, rv=0x%08X\n", + (char *)__FILE__, (int)__LINE__, (int)rv ); } } else { - DEBUG_PRINTF( PR_STDOUT, "%s %d : Unable to create nsStreamXferOp\n", - (char *)__FILE__, (int)__LINE__ ); + PRINTF("%s %d : Unable to create nsStreamXferOp\n", + (char *)__FILE__, (int)__LINE__ ); rv = NS_ERROR_OUT_OF_MEMORY; } } else { if ( NS_FAILED( rv ) ) { - DEBUG_PRINTF( PR_STDOUT, "Failed to select file, rv=0x%X\n", (int)rv ); + PRINTF("Failed to select file, rv=0x%X\n", (int)rv ); } else { // User cancelled. } @@ -208,10 +213,10 @@ nsStreamTransfer::SelectFileAndTransferLocationSpec( char const *aURL, // Transfer channel to output file chosen by user. rv = this->SelectFileAndTransferLocation( channel, parent, contentType, suggestedName ); } else { - DEBUG_PRINTF( PR_STDOUT, "Failed to open URI, rv=0x%X\n", (int)rv ); + PRINTF("Failed to open URI, rv=0x%X\n", (int)rv ); } } else { - DEBUG_PRINTF( PR_STDOUT, "Failed to create URI, rv=0x%X\n", (int)rv ); + PRINTF("Failed to create URI, rv=0x%X\n", (int)rv ); } return rv; @@ -278,7 +283,7 @@ nsStreamTransfer::SelectFile( nsIDOMWindowInternal *parent, nsIFileSpec **aResul } #ifdef DEBUG_law - printf( "\nFile picker result = 0x%04X\n\n", (int)rc ); + PRINTF( "\nFile picker result = 0x%04X\n\n", (int)rc ); #endif if ( rc != nsIFilePicker::returnCancel ) { // Give result to caller. @@ -289,7 +294,7 @@ nsStreamTransfer::SelectFile( nsIDOMWindowInternal *parent, nsIFileSpec **aResul rv = NS_NewFileSpec( aResult ); if ( NS_SUCCEEDED( rv ) ) { rv = (*aResult)->SetNativePath( selectionPath ); - printf( "\nresult native path = %s\n\n", (const char *)selectionPath ); + PRINTF( "\nresult native path = %s\n\n", (const char *)selectionPath ); } } } @@ -312,7 +317,7 @@ nsStreamTransfer::SelectFile( nsIDOMWindowInternal *parent, nsIFileSpec **aResul if ( NS_SUCCEEDED( rv ) && startDir ) { prefs->SetFileXPref( "browser.download.dir", startDir); #ifdef DEBUG_law - printf( "\nbrowser.download.dir has been reset\n\n" ); + PRINTF( "\nbrowser.download.dir has been reset\n\n" ); #endif } } diff --git a/mozilla/xpfe/components/xfer/src/nsStreamXferOp.cpp b/mozilla/xpfe/components/xfer/src/nsStreamXferOp.cpp index ee9f2e36ba5..c9a5c60fb60 100644 --- a/mozilla/xpfe/components/xfer/src/nsStreamXferOp.cpp +++ b/mozilla/xpfe/components/xfer/src/nsStreamXferOp.cpp @@ -41,16 +41,15 @@ #include "nsILocalFile.h" #include "prprf.h" +#include "nslog.h" + +NS_IMPL_LOG(nsStreamXferOpLog) +#define PRINTF NS_LOG_PRINTF(nsStreamXferOpLog) +#define FLUSH NS_LOG_FLUSH(nsStreamXferOpLog) #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, nsIStreamObserver, nsIStreamTransferOperation, nsIProgressEventSink, nsIInterfaceRequestor); #else @@ -74,7 +73,7 @@ nsStreamXferOp::nsStreamXferOp( nsIChannel *source, nsIFileSpec *target ) nsStreamXferOp::~nsStreamXferOp() { // Delete dynamically allocated members (file and buffer). #ifdef DEBUG_law - DEBUG_PRINTF( PR_STDOUT, "nsStreamXferOp destructor called\n" ); + PRINTF("nsStreamXferOp destructor called\n" ); #endif } @@ -103,28 +102,28 @@ nsStreamXferOp::OpenDialog( nsIDOMWindowInternal *parent ) { nsCOMPtr newWindow; rv = parent->OpenDialog( jsContext, argv, 4, getter_AddRefs( newWindow ) ); if ( NS_FAILED( rv ) ) { - DEBUG_PRINTF( PR_STDOUT, "%s %d: nsIDOMWindowInternal::OpenDialog failed, rv=0x%08X\n", - (char*)__FILE__, (int)__LINE__, (int)rv ); + PRINTF("%s %d: nsIDOMWindowInternal::OpenDialog failed, rv=0x%08X\n", + (char*)__FILE__, (int)__LINE__, (int)rv ); } JS_PopArguments( jsContext, stackPtr ); } else { - DEBUG_PRINTF( PR_STDOUT, "%s %d: JS_PushArguments failed\n", - (char*)__FILE__, (int)__LINE__ ); + PRINTF("%s %d: JS_PushArguments failed\n", + (char*)__FILE__, (int)__LINE__ ); rv = NS_ERROR_FAILURE; } } else { - DEBUG_PRINTF( PR_STDOUT, "%s %d: GetNativeContext failed\n", - (char*)__FILE__, (int)__LINE__ ); + PRINTF("%s %d: GetNativeContext failed\n", + (char*)__FILE__, (int)__LINE__ ); rv = NS_ERROR_FAILURE; } } else { - DEBUG_PRINTF( PR_STDOUT, "%s %d: GetContext failed\n", - (char*)__FILE__, (int)__LINE__ ); + PRINTF("%s %d: GetContext failed\n", + (char*)__FILE__, (int)__LINE__ ); rv = NS_ERROR_FAILURE; } } else { - DEBUG_PRINTF( PR_STDOUT, "%s %d: QueryInterface (for nsIScriptGlobalObject) failed, rv=0x%08X\n", - (char*)__FILE__, (int)__LINE__, (int)rv ); + PRINTF("%s %d: QueryInterface (for nsIScriptGlobalObject) failed, rv=0x%08X\n", + (char*)__FILE__, (int)__LINE__, (int)rv ); } return rv; } @@ -135,8 +134,8 @@ nsStreamXferOp::OnError( int operation, nsresult errorCode ) { nsresult rv = NS_OK; #ifdef DEBUG_law - DEBUG_PRINTF( PR_STDOUT, "nsStreamXferOp::OnError; op=%d, rv=0x%08X\n", - operation, (int)errorCode ); + PRINTF("nsStreamXferOp::OnError; op=%d, rv=0x%08X\n", + operation, (int)errorCode ); #endif if ( mObserver ) { @@ -146,8 +145,8 @@ nsStreamXferOp::OnError( int operation, nsresult errorCode ) { NS_ConvertASCIItoUCS2( NS_ISTREAMTRANSFER_CONTRACTID ";onError" ).GetUnicode(), NS_ConvertASCIItoUCS2( buf ).GetUnicode() ); if ( NS_FAILED( rv ) ) { - DEBUG_PRINTF( PR_STDOUT, "%s %d: Observe failed, rv=0x%08X\n", - (char*)__FILE__, (int)__LINE__, (int)rv ); + PRINTF("%s %d: Observe failed, rv=0x%08X\n", + (char*)__FILE__, (int)__LINE__, (int)rv ); } } @@ -275,8 +274,8 @@ nsStreamXferOp::OnStartRequest(nsIChannel* channel, nsISupports* aContext) { nsresult rv = NS_OK; #ifdef DEBUG_law - DEBUG_PRINTF( PR_STDOUT, "nsStreamXferOp::OnStartRequest; channel=0x%08X, context=0x%08X\n", - (int)(void*)channel, (int)(void*)aContext ); + PRINTF("nsStreamXferOp::OnStartRequest; channel=0x%08X, context=0x%08X\n", + (int)(void*)channel, (int)(void*)aContext ); #endif #ifdef USE_ASYNC_READ @@ -385,8 +384,8 @@ nsStreamXferOp::OnProgress(nsIChannel* channel, nsISupports* aContext, NS_ConvertASCIItoUCS2( NS_ISTREAMTRANSFER_CONTRACTID ";onProgress" ).GetUnicode(), NS_ConvertASCIItoUCS2( buf ).GetUnicode() ); if ( NS_FAILED( rv ) ) { - DEBUG_PRINTF( PR_STDOUT, "%s %d: Observe failed, rv=0x%08X\n", - (char*)__FILE__, (int)__LINE__, (int)rv ); + PRINTF("%s %d: Observe failed, rv=0x%08X\n", + (char*)__FILE__, (int)__LINE__, (int)rv ); } } @@ -414,8 +413,8 @@ nsStreamXferOp::OnStatus( nsIChannel *channel, NS_ConvertASCIItoUCS2( NS_ISTREAMTRANSFER_CONTRACTID ";onStatus" ).GetUnicode(), msg.GetUnicode() ); if ( NS_FAILED( rv ) ) { - DEBUG_PRINTF( PR_STDOUT, "%s %d: Observe failed, rv=0x%08X\n", - (char*)__FILE__, (int)__LINE__, (int)rv ); + PRINTF("%s %d: Observe failed, rv=0x%08X\n", + (char*)__FILE__, (int)__LINE__, (int)rv ); } } @@ -456,8 +455,8 @@ nsStreamXferOp::OnStopRequest( nsIChannel *channel, NS_ConvertASCIItoUCS2( NS_ISTREAMTRANSFER_CONTRACTID ";onCompletion" ).GetUnicode(), msg.GetUnicode() ); if ( NS_FAILED( rv ) ) { - DEBUG_PRINTF( PR_STDOUT, "%s %d: Observe failed, rv=0x%08X\n", - (char*)__FILE__, (int)__LINE__, (int)rv ); + PRINTF("%s %d: Observe failed, rv=0x%08X\n", + (char*)__FILE__, (int)__LINE__, (int)rv ); } } diff --git a/mozilla/xpinstall/src/nsInstall.cpp b/mozilla/xpinstall/src/nsInstall.cpp index 56683b774f3..69a43887113 100644 --- a/mozilla/xpinstall/src/nsInstall.cpp +++ b/mozilla/xpinstall/src/nsInstall.cpp @@ -80,6 +80,11 @@ #include "nsILocalFile.h" #include "nsIURL.h" +#include "nslog.h" + +NS_IMPL_LOG(nsInstallLog) +#define PRINTF NS_LOG_PRINTF(nsInstallLog) +#define FLUSH NS_LOG_FLUSH(nsInstallLog) static NS_DEFINE_IID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID); static NS_DEFINE_IID(kIEventQueueServiceIID, NS_IEVENTQUEUESERVICE_IID); @@ -1219,7 +1224,7 @@ nsInstall::LoadResources(JSContext* cx, const nsString& aBaseName, jsval* aRetur char* spec = nsnull; ret = resFileURL->GetSpec(&spec); if (NS_FAILED(ret)) { - printf("cannot get url spec\n"); + PRINTF("cannot get url spec\n"); nsServiceManager::ReleaseService(kStringBundleServiceCID, service); nsCRT::free(spec); return ret; diff --git a/mozilla/xpinstall/src/nsInstallPatch.cpp b/mozilla/xpinstall/src/nsInstallPatch.cpp index b056c5edbcc..96b2b26c667 100644 --- a/mozilla/xpinstall/src/nsInstallPatch.cpp +++ b/mozilla/xpinstall/src/nsInstallPatch.cpp @@ -34,6 +34,11 @@ #include "ScheduledTasks.h" #include "plstr.h" #include "prlog.h" +#include "nslog.h" + +NS_IMPL_LOG(nsInstallPatchLog) +#define PRINTF NS_LOG_PRINTF(nsInstallPatchLog) +#define FLUSH NS_LOG_FLUSH(nsInstallPatchLog) #ifdef XP_MAC #include "PatchableAppleSingle.h" @@ -603,7 +608,7 @@ nsInstallPatch::NativePatch(nsIFile *sourceFile, nsIFile *patchFile, nsIFile **n { PRInt64 fileSize; outFileSpec->GetFileSize(&fileSize); - printf("filesize: %d\n", fileSize); + PRINTF("filesize: %d\n", fileSize); } diff --git a/mozilla/xpinstall/src/nsInstallProgressDialog.cpp b/mozilla/xpinstall/src/nsInstallProgressDialog.cpp index f956e67f678..f57a3592258 100644 --- a/mozilla/xpinstall/src/nsInstallProgressDialog.cpp +++ b/mozilla/xpinstall/src/nsInstallProgressDialog.cpp @@ -39,6 +39,13 @@ #include "nsNetUtil.h" #include "nsIURL.h" #include "nsPIXPIManagerCallbacks.h" +#include "nslog.h" +#undef PRINTF +#undef FLUSH + +NS_IMPL_LOG(nsInstallProgressDialogLog) +#define PRINTF NS_LOG_PRINTF(nsInstallProgressDialogLog) +#define FLUSH NS_LOG_FLUSH(nsInstallProgressDialogLog) static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); static NS_DEFINE_IID( kAppShellServiceCID, NS_APPSHELL_SERVICE_CID ); @@ -304,12 +311,12 @@ nsresult nsInstallProgressDialog::setDlgAttribute( const char *id, rv = elem->SetAttribute( NS_ConvertASCIItoUCS2(name), value ); if ( NS_SUCCEEDED( rv ) ) { } else { - DEBUG_PRINTF( PR_STDOUT, "%s %d: SetAttribute failed, rv=0x%X\n", - __FILE__, (int)__LINE__, (int)rv ); + PRINTF("%s %d: SetAttribute failed, rv=0x%X\n", + __FILE__, (int)__LINE__, (int)rv ); } } else { - DEBUG_PRINTF( PR_STDOUT, "%s %d: GetElementById failed, rv=0x%X\n", - __FILE__, (int)__LINE__, (int)rv ); + PRINTF("%s %d: GetElementById failed, rv=0x%X\n", + __FILE__, (int)__LINE__, (int)rv ); } } else { rv = NS_ERROR_NULL_POINTER; @@ -344,12 +351,12 @@ nsresult nsInstallProgressDialog::getDlgAttribute( const char *id, rv = elem->GetAttribute( NS_ConvertASCIItoUCS2(name), value ); if ( NS_SUCCEEDED( rv ) ) { } else { - DEBUG_PRINTF( PR_STDOUT, "%s %d: GetAttribute failed, rv=0x%X\n", - __FILE__, (int)__LINE__, (int)rv ); + PRINTF("%s %d: GetAttribute failed, rv=0x%X\n", + __FILE__, (int)__LINE__, (int)rv ); } } else { - DEBUG_PRINTF( PR_STDOUT, "%s %d: GetElementById failed, rv=0x%X\n", - __FILE__, (int)__LINE__, (int)rv ); + PRINTF("%s %d: GetElementById failed, rv=0x%X\n", + __FILE__, (int)__LINE__, (int)rv ); } } else { rv = NS_ERROR_NULL_POINTER; diff --git a/mozilla/xpinstall/src/nsJSInstall.cpp b/mozilla/xpinstall/src/nsJSInstall.cpp index 393971afafd..c707e1f766c 100644 --- a/mozilla/xpinstall/src/nsJSInstall.cpp +++ b/mozilla/xpinstall/src/nsJSInstall.cpp @@ -44,6 +44,12 @@ extern JSClass WinProfileClass; #endif #include "nsJSFileSpecObj.h" +#include "nslog.h" + +NS_IMPL_LOG(nsJSInstallLog) +#define PRINTF NS_LOG_PRINTF(nsJSInstallLog) +#define FLUSH NS_LOG_FLUSH(nsJSInstallLog) + extern JSClass FileSpecObjectClass; extern JSClass FileOpClass; @@ -1642,7 +1648,7 @@ InstallTRACE(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) char *tempStr; tempStr = b0.ToNewCString(); - printf("Install:\t%s\n", tempStr); + PRINTF("Install:\t%s\n", tempStr); Recycle(tempStr); diff --git a/mozilla/xpinstall/src/nsXPInstallManager.cpp b/mozilla/xpinstall/src/nsXPInstallManager.cpp index 30833574469..475ef705c72 100644 --- a/mozilla/xpinstall/src/nsXPInstallManager.cpp +++ b/mozilla/xpinstall/src/nsXPInstallManager.cpp @@ -59,6 +59,11 @@ #include "nsIAppShellComponentImpl.h" #include "nsICommonDialogs.h" #include "nsIScriptGlobalObject.h" +#include "nslog.h" + +NS_IMPL_LOG(nsXPInstallManagerLog) +#define PRINTF NS_LOG_PRINTF(nsXPInstallManagerLog) +#define FLUSH NS_LOG_FLUSH(nsXPInstallManagerLog) static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); static NS_DEFINE_IID(kAppShellServiceCID, NS_APPSHELL_SERVICE_CID ); @@ -800,7 +805,7 @@ nsXPInstallManager::OnDataAvailable(nsIChannel* channel, nsISupports *ctxt, if (amt == 0) break; if (NS_FAILED(err)) { - //printf("pIStream->Read Failed! %d", err); + //PRINTF("pIStream->Read Failed! %d", err); return err; } err = mItem->mOutStream->Write( buffer, amt, &writeCount);