From 01af504ba9b0b79fd0205d5dd81ddac2c1e0c1fd Mon Sep 17 00:00:00 2001 From: David Tardon Date: Tue, 11 Oct 2011 06:15:37 +0200 Subject: WaE: ISO C90 forbids mixed declarations and code --- sal/osl/unx/diagnose.c | 2 +- sal/osl/unx/process.c | 4 ++-- sal/osl/unx/security.c | 3 ++- sal/osl/unx/socket.c | 7 +++++-- sal/osl/unx/tempfile.c | 3 +-- 5 files changed, 11 insertions(+), 8 deletions(-) (limited to 'sal') diff --git a/sal/osl/unx/diagnose.c b/sal/osl/unx/diagnose.c index ae847b6d02e0..ae5e625d1bc2 100644 --- a/sal/osl/unx/diagnose.c +++ b/sal/osl/unx/diagnose.c @@ -222,6 +222,7 @@ sal_Bool SAL_CALL osl_assertFailedLine ( // after reporting the assertion, abort if told so by SAL_DIAGNOSE_ABORT, but *not* if // assertions are routed to some external instance char const * env = getenv( "SAL_DIAGNOSE_ABORT" ); + char const * envBacktrace = getenv( "SAL_DIAGNOSE_BACKTRACE" ); sal_Bool const doAbort = ( ( env != NULL ) && ( *env != '\0' ) && ( f == NULL ) ); /* If there's a callback for detailed messages, use it */ @@ -256,7 +257,6 @@ sal_Bool SAL_CALL osl_assertFailedLine ( OSL_DIAGNOSE_OUTPUTMESSAGE(f, szMessage); /* should we output backtrace? */ - char const * envBacktrace = getenv( "SAL_DIAGNOSE_BACKTRACE" ); if( envBacktrace != NULL && *envBacktrace != '\0' ) osl_diagnose_backtrace_Impl(f); diff --git a/sal/osl/unx/process.c b/sal/osl/unx/process.c index 097c237467fe..22c6adb72e27 100644 --- a/sal/osl/unx/process.c +++ b/sal/osl/unx/process.c @@ -1229,10 +1229,10 @@ sal_Bool osl_getProcStatus(pid_t pid, struct osl_procStat* procstat) { int fd = 0; char name[PATH_MAX + 1]; - snprintf(name, sizeof(name), "/proc/%u/status", pid); - sal_Bool bRet = sal_False; + snprintf(name, sizeof(name), "/proc/%u/status", pid); + if ((fd = open(name,O_RDONLY)) >=0 ) { char* tmp=0; diff --git a/sal/osl/unx/security.c b/sal/osl/unx/security.c index 2d4586817e61..598850658e90 100644 --- a/sal/osl/unx/security.c +++ b/sal/osl/unx/security.c @@ -374,10 +374,11 @@ static sal_Bool SAL_CALL osl_psz_getConfigDir(oslSecurity Security, sal_Char* ps if ((pStr == NULL) || (strlen(pStr) == 0) || (access(pStr, 0) != 0)) { + size_t n = 0; // a default equal to $HOME/.config should be used. if (!osl_psz_getHomeDir(Security, pszDirectory, nMax)) return sal_False; - size_t n = strlen(pszDirectory); + n = strlen(pszDirectory); if (n + sizeof(DOT_CONFIG) < nMax) { strncpy(pszDirectory+n, DOT_CONFIG, sizeof(DOT_CONFIG)); diff --git a/sal/osl/unx/socket.c b/sal/osl/unx/socket.c index bd114d5cb71f..b60fb2dbf40b 100644 --- a/sal/osl/unx/socket.c +++ b/sal/osl/unx/socket.c @@ -594,10 +594,13 @@ sal_Bool SAL_CALL osl_isEqualSocketAddr ( oslSocketAddr Addr1, oslSocketAddr Addr2) { + struct sockaddr* pAddr1 = NULL; + struct sockaddr* pAddr2 = NULL; + OSL_ASSERT(Addr1); OSL_ASSERT(Addr2); - struct sockaddr* pAddr1= &(Addr1->m_sockaddr); - struct sockaddr* pAddr2= &(Addr2->m_sockaddr); + pAddr1 = &(Addr1->m_sockaddr); + pAddr2 = &(Addr2->m_sockaddr); OSL_ASSERT(pAddr1); OSL_ASSERT(pAddr2); diff --git a/sal/osl/unx/tempfile.c b/sal/osl/unx/tempfile.c index 3b55bdac2694..7e888bbd4812 100644 --- a/sal/osl/unx/tempfile.c +++ b/sal/osl/unx/tempfile.c @@ -54,6 +54,7 @@ oslFileError SAL_CALL osl_getTempDirURL( rtl_uString** pustrTempDir ) oslFileError error; /* described in environ(7) */ const char *pValue = getenv( "TMPDIR" ); + rtl_uString *ustrTempPath = NULL; if ( !pValue ) pValue = getenv( "TEMP" ); @@ -64,8 +65,6 @@ oslFileError SAL_CALL osl_getTempDirURL( rtl_uString** pustrTempDir ) if ( !pValue ) pValue = "/tmp"; - rtl_uString *ustrTempPath = NULL; - rtl_string2UString( &ustrTempPath, pValue, strlen( pValue ), osl_getThreadTextEncoding(), OSTRING_TO_OUSTRING_CVTFLAGS ); OSL_ASSERT(ustrTempPath != NULL); error = osl_getFileURLFromSystemPath( ustrTempPath, pustrTempDir ); -- cgit