[Libreoffice-commits] core.git: include/sal sal/osl sal/qa sal/rtl sal/test
Rohan Kumar
rohankanojia420 at gmail.com
Thu Mar 3 17:00:48 UTC 2016
include/sal/log-areas.dox | 4 +++
sal/osl/unx/profile.cxx | 4 +--
sal/osl/unx/socket.cxx | 10 ++++----
sal/osl/w32/socket.cxx | 12 ++++------
sal/qa/osl/process/osl_process.cxx | 24 ++++++++++-----------
sal/qa/rtl/doublelock/rtl_doublelocking.cxx | 15 +++----------
sal/rtl/bootstrap.cxx | 32 ++++------------------------
sal/test/testbootstrap.cxx | 17 +++++---------
8 files changed, 43 insertions(+), 75 deletions(-)
New commits:
commit f59136a2ed1e3eb01cc5b62c5a7da07c34cbdfae
Author: Rohan Kumar <rohankanojia420 at gmail.com>
Date: Wed Mar 2 01:28:58 2016 +0530
tdf#91794 remove OSL_DEBUG_LEVEL > 1 conditionals
Change-Id: If329cf8257684e7bd2936641b8f14ec3e9b9f733
Reviewed-on: https://gerrit.libreoffice.org/22647
Reviewed-by: Eike Rathke <erack at redhat.com>
Tested-by: Eike Rathke <erack at redhat.com>
diff --git a/include/sal/log-areas.dox b/include/sal/log-areas.dox
index d2de637..d4a020a 100644
--- a/include/sal/log-areas.dox
+++ b/include/sal/log-areas.dox
@@ -30,6 +30,10 @@ certain functionality.
@li @c sal.rtl - SAL RTL library
@li @c sal.rtl.xub - SAL RTL warnings related to possible String->OUString conversion issues.
@li @c sal.textenc - the textencoding SAL library
+ at li @c sal.w32
+ at li @c sal.test
+ at li @c sal.process
+ at li @c sal.doublelock
@section basctl
diff --git a/sal/osl/unx/profile.cxx b/sal/osl/unx/profile.cxx
index 8cad965..9cbab6b 100644
--- a/sal/osl/unx/profile.cxx
+++ b/sal/osl/unx/profile.cxx
@@ -320,7 +320,7 @@ sal_Bool SAL_CALL osl_flushProfile(oslProfile Profile)
static bool writeProfileImpl(osl_TFile* pFile)
{
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
unsigned int nLen=0;
#endif
@@ -329,7 +329,7 @@ static bool writeProfileImpl(osl_TFile* pFile)
return false;
}
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
nLen=strlen(pFile->m_pWriteBuf);
SAL_WARN_IF(nLen != (pFile->m_nWriteBufLen - pFile->m_nWriteBufFree), "sal.osl", "nLen != (pFile->m_nWriteBufLen - pFile->m_nWriteBufFree)");
#endif
diff --git a/sal/osl/unx/socket.cxx b/sal/osl/unx/socket.cxx
index 190e7c3..1065c79 100644
--- a/sal/osl/unx/socket.cxx
+++ b/sal/osl/unx/socket.cxx
@@ -429,7 +429,7 @@ oslSocketResult SAL_CALL osl_psz_getDottedInetAddrOfSocketAddr (
void SAL_CALL osl_psz_getLastSocketErrorDescription (
oslSocket Socket, sal_Char* pBuffer, sal_uInt32 BufferSize);
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
static sal_uInt32 g_nSocketImpl = 0;
static sal_uInt32 g_nSocketAddr = 0;
@@ -451,7 +451,7 @@ oslSocket __osl_createSocketImpl(int Socket)
pSocket->m_bIsAccepting = false;
#endif
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
g_nSocketImpl ++;
#endif
return pSocket;
@@ -461,7 +461,7 @@ void __osl_destroySocketImpl(oslSocket Socket)
{
if ( Socket != nullptr)
free(Socket);
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
g_nSocketImpl --;
#endif
}
@@ -469,7 +469,7 @@ void __osl_destroySocketImpl(oslSocket Socket)
static oslSocketAddr __osl_createSocketAddr()
{
oslSocketAddr pAddr = static_cast<oslSocketAddr>(rtl_allocateZeroMemory( sizeof( struct oslSocketAddrImpl )));
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
g_nSocketAddr ++;
#endif
return pAddr;
@@ -509,7 +509,7 @@ static oslSocketAddr __osl_createSocketAddrFromSystem( struct sockaddr *pSystemS
static void __osl_destroySocketAddr( oslSocketAddr addr )
{
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
g_nSocketAddr --;
#endif
rtl_freeMemory( addr );
diff --git a/sal/osl/w32/socket.cxx b/sal/osl/w32/socket.cxx
index 927da21..e3aad35 100644
--- a/sal/osl/w32/socket.cxx
+++ b/sal/osl/w32/socket.cxx
@@ -406,16 +406,14 @@ static sal_Bool __osl_attemptSocketDialupImpl()
/*****************************************************************************/
static sal_uInt32 g_nSocketImpl = 0;
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
static sal_uInt32 g_nSocketAddr = 0;
struct LeakWarning
{
~LeakWarning()
{
- if( g_nSocketImpl )
- OSL_TRACE( "sal_socket: %d socket instances leak" , g_nSocketImpl );
- if( g_nSocketAddr )
- OSL_TRACE( "sal_socket: %d socket address instances leak" , g_nSocketAddr );
+ SAL_WARN_IF( g_nSocketImpl, "sal.w32", "sal_socket: " << g_nSocketImpl << " socket instances leak" );
+ SAL_WARN_IF( g_nSocketAddr, "sal.w32", "sal_socket: " << g_nSocketAddr << " socket address instances leak" );
}
};
LeakWarning socketWarning;
@@ -455,7 +453,7 @@ static oslSocketAddr __osl_createSocketAddr( )
{
oslSocketAddr pAddr = (oslSocketAddr) rtl_allocateZeroMemory( sizeof( struct oslSocketAddrImpl ));
pAddr->m_nRefCount = 1;
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
g_nSocketAddr ++;
#endif
return pAddr;
@@ -493,7 +491,7 @@ static oslSocketAddr __osl_createSocketAddrFromSystem( struct sockaddr *pSystemS
static void __osl_destroySocketAddr( oslSocketAddr addr )
{
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
g_nSocketAddr --;
#endif
rtl_freeMemory( addr );
diff --git a/sal/qa/osl/process/osl_process.cxx b/sal/qa/osl/process/osl_process.cxx
index 280e873..036be4b 100644
--- a/sal/qa/osl/process/osl_process.cxx
+++ b/sal/qa/osl/process/osl_process.cxx
@@ -276,9 +276,9 @@ public:
string_container_t parent_env;
read_parent_environment(&parent_env);
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
for (string_container_t::const_iterator iter = parent_env.begin(), end = parent_env.end(); iter != end; ++iter)
- std::cerr << "initially parent env: " << *iter << std::endl;
+ SAL_INFO("sal.process", "initially parent env: " << *iter);
#endif
//remove the environment variables that we have changed
@@ -287,9 +287,9 @@ public:
std::remove_if(parent_env.begin(), parent_env.end(), exclude(different_env_vars)),
parent_env.end());
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
for (string_container_t::const_iterator iter = parent_env.begin(), end = parent_env.end(); iter != end; ++iter)
- std::cerr << "stripped parent env: " << *iter << std::endl;
+ SAL_INFO("sal.process", "stripped parent env: " << *iter);
#endif
//read the child environment and exclude the variables that
@@ -297,9 +297,9 @@ public:
string_container_t child_env;
read_child_environment(&child_env);
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
for (string_container_t::const_iterator iter = child_env.begin(), end = child_env.end(); iter != end; ++iter)
- std::cerr << "initial child env: " << *iter << std::endl;
+ SAL_INFO("sal.process", "initial child env: " << *iter);
#endif
//partition the child environment into the variables that
//are different to the parent environment (they come first)
@@ -311,22 +311,22 @@ public:
string_container_t different_child_env_vars(child_env.begin(), iter_logical_end);
child_env.erase(child_env.begin(), iter_logical_end);
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
for (string_container_t::const_iterator iter = child_env.begin(), end = child_env.end(); iter != end; ++iter)
- std::cerr << "stripped child env: " << *iter << std::endl;
+ SAL_INFO("sal.process", "stripped child env: " << *iter);
#endif
bool common_env_size_equals = (parent_env.size() == child_env.size());
bool common_env_content_equals = std::equal(child_env.begin(), child_env.end(), parent_env.begin());
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
for (string_container_t::const_iterator iter = different_env_vars.begin(), end = different_env_vars.end(); iter != end; ++iter)
- std::cerr << "different should be: " << *iter << std::endl;
+ SAL_INFO("sal.process", "different should be: " << *iter);
#endif
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
for (string_container_t::const_iterator iter = different_child_env_vars.begin(), end = different_child_env_vars.end(); iter != end; ++iter)
- std::cerr << "different are: " << *iter << std::endl;
+ SAL_INFO("sal.process", "different are: " << *iter);
#endif
bool different_env_size_equals = (different_child_env_vars.size() == different_env_vars.size());
diff --git a/sal/qa/rtl/doublelock/rtl_doublelocking.cxx b/sal/qa/rtl/doublelock/rtl_doublelocking.cxx
index faf2ebe..8678ee0 100644
--- a/sal/qa/rtl/doublelock/rtl_doublelocking.cxx
+++ b/sal/qa/rtl/doublelock/rtl_doublelocking.cxx
@@ -190,23 +190,16 @@ namespace rtl_DoubleLocking
sal_Int32 nValueOK2 = 0;
nValueOK2 = p2Thread->getOK();
-#if OSL_DEBUG_LEVEL > 2
- printf("Value in Thread #1 is %" SAL_PRIdINT32 "\n", nValueOK);
- printf("Value in Thread #2 is %" SAL_PRIdINT32 "\n", nValueOK2);
-#else
- (void)nValueOK2;
-#endif
-
+ SAL_INFO("sal.doublelock", "Value in Thread #1 is " << nValueOK);
+ SAL_INFO("sal.doublelock", "Value in Thread #2 is " << nValueOK2);
sal_Int32 nValueFails = 0;
nValueFails = pThread->getFails();
sal_Int32 nValueFails2 = 0;
nValueFails2 = p2Thread->getFails();
-#if OSL_DEBUG_LEVEL > 2
- printf("Fails in Thread #1 is %" SAL_PRIdINT32 "\n", nValueFails);
- printf("Fails in Thread #2 is %" SAL_PRIdINT32 "\n", nValueFails2);
-#endif
+ SAL_INFO("sal.doublelock", "Fails in Thread #1 is " << nValueFails);
+ SAL_INFO("sal.doublelock", "Fails in Thead #2 is " << nValueFails2);
delete pThread;
delete p2Thread;
diff --git a/sal/rtl/bootstrap.cxx b/sal/rtl/bootstrap.cxx
index 16af289..7b4150d 100644
--- a/sal/rtl/bootstrap.cxx
+++ b/sal/rtl/bootstrap.cxx
@@ -348,12 +348,7 @@ Bootstrap_Impl::Bootstrap_Impl( OUString const & rIniName )
rtl_bootstrap_args_open( base_ini.pData ) );
}
}
-
-#if OSL_DEBUG_LEVEL > 1
- OString sFile = OUStringToOString(_iniName, RTL_TEXTENCODING_ASCII_US);
- OSL_TRACE("Bootstrap_Impl(): sFile=%s", sFile.getStr());
-#endif /* OSL_DEBUG_LEVEL > 1 */
-
+ SAL_INFO("sal.rtl", "Bootstrap_Impl(): sFile=" << _iniName);
oslFileHandle handle;
if (!_iniName.isEmpty() &&
osl_File_E_None == osl_openFile(_iniName.pData, &handle, osl_File_OpenFlag_Read))
@@ -372,26 +367,17 @@ Bootstrap_Impl::Bootstrap_Impl( OUString const & rIniName )
nameValue.sValue = OStringToOUString(
line.copy(nIndex+1).trim(), RTL_TEXTENCODING_UTF8 );
-#if OSL_DEBUG_LEVEL > 1
- OString name_tmp = OUStringToOString(nameValue.sName, RTL_TEXTENCODING_ASCII_US);
- OString value_tmp = OUStringToOString(nameValue.sValue, RTL_TEXTENCODING_UTF8);
- OSL_TRACE(
- "pushing: name=%s value=%s",
- name_tmp.getStr(), value_tmp.getStr() );
-#endif /* OSL_DEBUG_LEVEL > 1 */
+ SAL_INFO("sal.rtl", "pushing: name=" << nameValue.sName << " value= " << nameValue.sValue);
_nameValueList.push_back(nameValue);
}
}
osl_closeFile(handle);
}
-#if OSL_DEBUG_LEVEL > 1
else
{
- OString file_tmp = OUStringToOString(_iniName, RTL_TEXTENCODING_ASCII_US);
- OSL_TRACE( "couldn't open file: %s", file_tmp.getStr() );
+ SAL_WARN( "sal.rtl", "couldn't open file: " << _iniName );
}
-#endif /* OSL_DEBUG_LEVEL > 1 */
}
Bootstrap_Impl::~Bootstrap_Impl()
@@ -693,10 +679,8 @@ void SAL_CALL rtl_bootstrap_args_close (
{
::std::size_t nLeaking = 8; // only hold up to 8 files statically
-#if OSL_DEBUG_LEVEL == 1 // nonpro
+#if OSL_DEBUG_LEVEL > 0 // debug
nLeaking = 0;
-#elif OSL_DEBUG_LEVEL > 1 // debug
- nLeaking = 1;
#endif /* OSL_DEBUG_LEVEL */
if (p_bootstrap_map->size() > nLeaking)
@@ -792,13 +776,7 @@ void SAL_CALL rtl_bootstrap_set (
}
}
-#if OSL_DEBUG_LEVEL > 1
- OString cstr_name( OUStringToOString( name, RTL_TEXTENCODING_ASCII_US ) );
- OString cstr_value( OUStringToOString( value, RTL_TEXTENCODING_ASCII_US ) );
- OSL_TRACE(
- "bootstrap.cxx: explicitly setting: name=%s value=%s\n",
- cstr_name.getStr(), cstr_value.getStr() );
-#endif /* OSL_DEBUG_LEVEL > 1 */
+ SAL_INFO("sal.rtl", "explicitly getting: name=" << name << " value= " <<value);
r_rtl_bootstrap_set_list.push_back( rtl_bootstrap_NameValue( name, value ) );
}
diff --git a/sal/test/testbootstrap.cxx b/sal/test/testbootstrap.cxx
index 3919bcc..cef9e87 100644
--- a/sal/test/testbootstrap.cxx
+++ b/sal/test/testbootstrap.cxx
@@ -32,16 +32,17 @@ int main( int argc, char *argv[] )
sal_Int32 nCount = rtl_getAppCommandArgCount();
-#if OSL_DEBUG_LEVEL > 1
- fprintf( stdout, "rtl-commandargs (%d) real args:%i ", nCount, argc);
+#if OSL_DEBUG_LEVEL > 0
+ OUStringBuffer debugBuff;
+ debugBuff.append("rtl-commandargs (").append(nCount).append(")real args: ").append(argc);
for( sal_Int32 i = 0 ; i < nCount ; i ++ )
{
OUString data;
rtl_getAppCommandArg( i , &(data.pData) );
OString o = OUStringToOString( data, RTL_TEXTENCODING_ASCII_US );
- fprintf( stdout, " %s", o.getStr() );
+ debugBuff.append(" ").append(o);
}
- fprintf( stdout, "\n" );
+ SAL_INFO("sal.test", debugBuff.toString());
#endif
if( nCount == 0 )
@@ -53,13 +54,7 @@ int main( int argc, char *argv[] )
OUString iniName;
Bootstrap::get(OUString("iniName"), iniName, OUString());
-#if OSL_DEBUG_LEVEL > 1
- if(iniName.getLength())
- {
- OString tmp_iniName = OUStringToOString(iniName, RTL_TEXTENCODING_ASCII_US);
- fprintf(stderr, "using ini: %s\n", tmp_iniName.getStr());
- }
-#endif
+ SAL_INFO_IF(!iniName.isEmpty(), "sal.test", "using ini: " << iniName);
Bootstrap bootstrap(iniName);
More information about the Libreoffice-commits
mailing list