fix trace to be var args

git-svn-id: svn://10.0.0.236/trunk@4545 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
timm 1998-06-25 23:46:39 +00:00
parent cff1eb4400
commit 9ca001f79e
2 changed files with 20 additions and 5 deletions

View File

@ -197,6 +197,6 @@ void SizeofRASNT40(); // ini WinNT RAS sizes
#endif // WIN32
void SizeofRAS(); // init Win95 & Win3.1 RAS sizes
void trace( const char* traceStatement );
void trace( const char* traceStatement, ... );
#endif // _INC_PLUGIN_H_

View File

@ -27,7 +27,7 @@
#include <npapi.h>
#include "plugin.h"
#include <stdarg.h>
// resource include
#ifdef WIN32 // **************************** WIN32 *****************************
@ -70,6 +70,8 @@ extern void DialerHangup();
// keep a global execution environment
JRIEnv* env;
const BOOL gEnableTrace = TRUE;
// Keeps track of OS version, either win95, winNT, or win16
#ifdef WIN32
int platformOS;
@ -627,8 +629,16 @@ native_netscape_npasw_SetupPlugin_SECURE_0005fCheckEnvironment(JRIEnv* env,
return (TRUE);
}
void trace( const char* traceStatement )
void trace( const char* traceStatement, ... )
{
static char buffer[ 10000 ];
int len = 0;
va_list stack;
if ( !gEnableTrace )
return;
if ( !env )
return;
@ -636,8 +646,13 @@ void trace( const char* traceStatement )
if ( !self )
return;
java_lang_String* traceString = JRI_NewStringPlatform( env, traceStatement,
strlen( traceStatement), NULL, 0 );
va_start( stack, traceStatement );
(void)vsprintf( buffer, traceStatement, stack );
va_end( stack );
len = strlen( buffer );
java_lang_String* traceString = JRI_NewStringPlatform( env, buffer,
len, NULL, 0 );
netscape_npasw_SetupPlugin_debug( env, self, traceString );
}