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
This commit is contained in:
warren%netscape.com
2000-10-27 22:43:51 +00:00
parent e7c9040b5e
commit c6b67eceeb
757 changed files with 10724 additions and 8223 deletions

View File

@@ -37,6 +37,12 @@
#include <stdio.h>
#include <io.h>
#include <fcntl.h>
#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
}
}