Kaydet (Commit) 54981ce9 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Adapt some logs and assertions

...cf. previous 2ad716f4 "Revert 'pyuno: set up
fake command line in getComponentContext().'"

Change-Id: Ia77132465ada17a5839f9d4f9ccaf20f8b113075
üst 2ad716f4
...@@ -164,7 +164,9 @@ sal_uInt32 SAL_CALL osl_getCommandArgCount (void) ...@@ -164,7 +164,9 @@ sal_uInt32 SAL_CALL osl_getCommandArgCount (void)
sal_uInt32 result = 0; sal_uInt32 result = 0;
pthread_mutex_lock (&(g_command_args.m_mutex)); pthread_mutex_lock (&(g_command_args.m_mutex));
SAL_WARN_IF (g_command_args.m_nCount == 0, "sal.osl", "osl_setCommandArgs() not called before calling osl_getCommandArgCount()"); SAL_INFO_IF(
g_command_args.m_nCount == 0, "sal.osl",
"osl_getCommandArgCount w/o prior call to osl_setCommandArgs");
if (g_command_args.m_nCount > 0) if (g_command_args.m_nCount > 0)
result = g_command_args.m_nCount - 1; result = g_command_args.m_nCount - 1;
pthread_mutex_unlock (&(g_command_args.m_mutex)); pthread_mutex_unlock (&(g_command_args.m_mutex));
...@@ -180,7 +182,7 @@ oslProcessError SAL_CALL osl_getCommandArg (sal_uInt32 nArg, rtl_uString ** strC ...@@ -180,7 +182,7 @@ oslProcessError SAL_CALL osl_getCommandArg (sal_uInt32 nArg, rtl_uString ** strC
oslProcessError result = osl_Process_E_NotFound; oslProcessError result = osl_Process_E_NotFound;
pthread_mutex_lock (&(g_command_args.m_mutex)); pthread_mutex_lock (&(g_command_args.m_mutex));
OSL_ASSERT(g_command_args.m_nCount > 0); assert(g_command_args.m_nCount > 0);
if (g_command_args.m_nCount > (nArg + 1)) if (g_command_args.m_nCount > (nArg + 1))
{ {
rtl_uString_assign (strCommandArg, g_command_args.m_ppArgs[nArg + 1]); rtl_uString_assign (strCommandArg, g_command_args.m_ppArgs[nArg + 1]);
...@@ -204,7 +206,7 @@ int SAL_CALL osl_areCommandArgsSet (void) ...@@ -204,7 +206,7 @@ int SAL_CALL osl_areCommandArgsSet (void)
**************************************/ **************************************/
void SAL_CALL osl_setCommandArgs (int argc, char ** argv) void SAL_CALL osl_setCommandArgs (int argc, char ** argv)
{ {
OSL_ASSERT(argc > 0); assert(argc > 0);
pthread_mutex_lock (&(g_command_args.m_mutex)); pthread_mutex_lock (&(g_command_args.m_mutex));
assert (g_command_args.m_nCount == 0); assert (g_command_args.m_nCount == 0);
if (g_command_args.m_nCount == 0) if (g_command_args.m_nCount == 0)
......
...@@ -28,11 +28,14 @@ ...@@ -28,11 +28,14 @@
#pragma warning(pop) #pragma warning(pop)
#endif #endif
#include <cassert>
#include <osl/diagnose.h> #include <osl/diagnose.h>
#include <osl/security.h> #include <osl/security.h>
#include <osl/nlsupport.h> #include <osl/nlsupport.h>
#include <osl/mutex.h> #include <osl/mutex.h>
#include <osl/thread.h> #include <osl/thread.h>
#include <sal/log.hxx>
#include "getexecutablefile.hxx" #include "getexecutablefile.hxx"
#include "procimpl.h" #include "procimpl.h"
...@@ -268,7 +271,7 @@ static rtl_uString ** osl_createCommandArgs_Impl (int argc, char **) ...@@ -268,7 +271,7 @@ static rtl_uString ** osl_createCommandArgs_Impl (int argc, char **)
int i; int i;
int nArgs; int nArgs;
LPWSTR *wargv = CommandLineToArgvW( GetCommandLineW(), &nArgs ); LPWSTR *wargv = CommandLineToArgvW( GetCommandLineW(), &nArgs );
OSL_ASSERT( nArgs == argc ); assert( nArgs == argc );
for (i = 0; i < nArgs; i++) for (i = 0; i < nArgs; i++)
{ {
/* Convert to unicode */ /* Convert to unicode */
...@@ -334,11 +337,9 @@ sal_uInt32 SAL_CALL osl_getCommandArgCount(void) ...@@ -334,11 +337,9 @@ sal_uInt32 SAL_CALL osl_getCommandArgCount(void)
sal_uInt32 result = 0; sal_uInt32 result = 0;
osl_acquireMutex (*osl_getGlobalMutex()); osl_acquireMutex (*osl_getGlobalMutex());
if (g_command_args.m_nCount == 0) { SAL_INFO_IF(
OSL_TRACE( g_command_args.m_nCount == 0, "sal.osl",
OSL_LOG_PREFIX
"osl_getCommandArgCount w/o prior call to osl_setCommandArgs"); "osl_getCommandArgCount w/o prior call to osl_setCommandArgs");
}
if (g_command_args.m_nCount > 0) if (g_command_args.m_nCount > 0)
{ {
/* We're not counting argv[0] here. */ /* We're not counting argv[0] here. */
...@@ -356,7 +357,7 @@ oslProcessError SAL_CALL osl_getCommandArg( sal_uInt32 nArg, rtl_uString **strCo ...@@ -356,7 +357,7 @@ oslProcessError SAL_CALL osl_getCommandArg( sal_uInt32 nArg, rtl_uString **strCo
oslProcessError result = osl_Process_E_NotFound; oslProcessError result = osl_Process_E_NotFound;
osl_acquireMutex (*osl_getGlobalMutex()); osl_acquireMutex (*osl_getGlobalMutex());
OSL_ASSERT(g_command_args.m_nCount > 0); assert(g_command_args.m_nCount > 0);
if (g_command_args.m_nCount > (nArg + 1)) if (g_command_args.m_nCount > (nArg + 1))
{ {
/* We're not counting argv[0] here. */ /* We're not counting argv[0] here. */
...@@ -381,7 +382,7 @@ int SAL_CALL osl_areCommandArgsSet(void) ...@@ -381,7 +382,7 @@ int SAL_CALL osl_areCommandArgsSet(void)
void SAL_CALL osl_setCommandArgs (int argc, char ** argv) void SAL_CALL osl_setCommandArgs (int argc, char ** argv)
{ {
OSL_ASSERT(argc > 0); assert(argc > 0);
osl_acquireMutex (*osl_getGlobalMutex()); osl_acquireMutex (*osl_getGlobalMutex());
if (g_command_args.m_nCount == 0) if (g_command_args.m_nCount == 0)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment