diff options
author | Vladimir Glazunov <vg@openoffice.org> | 2009-12-10 18:31:30 +0100 |
---|---|---|
committer | Vladimir Glazunov <vg@openoffice.org> | 2009-12-10 18:31:30 +0100 |
commit | 2ee1464936d571b6796dcd3336135a8283d56269 (patch) | |
tree | 77798f7572efd624c467693861039957ad004945 /extensions | |
parent | 6faf78102859e7ddc05c762e1aebc47c784e2aa5 (diff) | |
parent | 2a00316c1cfb9fee87ed6b49b9e4565642f4be2b (diff) |
CWS-TOOLING: integrate CWS vcl107
Diffstat (limited to 'extensions')
-rw-r--r-- | extensions/source/nsplugin/source/so_env.cxx | 3 | ||||
-rw-r--r-- | extensions/source/plugin/unx/unxmgr.cxx | 20 |
2 files changed, 14 insertions, 9 deletions
diff --git a/extensions/source/nsplugin/source/so_env.cxx b/extensions/source/nsplugin/source/so_env.cxx index df23100e3859..92bcab19bd59 100644 --- a/extensions/source/nsplugin/source/so_env.cxx +++ b/extensions/source/nsplugin/source/so_env.cxx @@ -310,7 +310,8 @@ char* NSP_getProductName() char *pEnd = 0; while(!feof(fp)) { - fgets( line, sizeof(line), fp ); + if (fgets( line, sizeof(line), fp ) == NULL) + continue; if (NULL == (pStart = strstr( line, "ProductKey=" ))) continue; pStart += strlen("ProductKey="); diff --git a/extensions/source/plugin/unx/unxmgr.cxx b/extensions/source/plugin/unx/unxmgr.cxx index 1f1d291daf8d..bce8cd76a7ac 100644 --- a/extensions/source/plugin/unx/unxmgr.cxx +++ b/extensions/source/plugin/unx/unxmgr.cxx @@ -175,6 +175,12 @@ static bool CheckPlugin( const ByteString& rPath, list< PluginDescription* >& rD return nDescriptions > 0; } +union maxDirent +{ + char aBuffer[ sizeof( struct dirent ) + _PC_NAME_MAX +1 ]; + struct dirent asDirent; +}; + static void CheckPluginRegistryFiles( const rtl::OString& rPath, list< PluginDescription* >& rDescriptions ) { rtl::OStringBuffer aPath( 1024 ); @@ -200,14 +206,13 @@ static void CheckPluginRegistryFiles( const rtl::OString& rPath, list< PluginDes } // check subdirectories - long aBuffer[ sizeof( struct dirent ) + _PC_NAME_MAX +1 ]; - DIR* pDIR = opendir( rPath.getStr() ); struct dirent* pDirEnt = NULL; struct stat aStat; - while( pDIR && ! readdir_r( pDIR, (struct dirent*)aBuffer, &pDirEnt ) && pDirEnt ) + maxDirent u; + while( pDIR && ! readdir_r( pDIR, &u.asDirent, &pDirEnt ) && pDirEnt ) { - char* pBaseName = ((struct dirent*)aBuffer)->d_name; + char* pBaseName = u.asDirent.d_name; if( rtl_str_compare( ".", pBaseName ) && rtl_str_compare( "..", pBaseName ) ) { rtl::OStringBuffer aBuf( 1024 ); @@ -262,9 +267,8 @@ Sequence<PluginDescription> XPluginManager_Impl::impl_getPluginDescriptions() th aSearchPath += ByteString( String( rPaths.getConstArray()[i] ), aEncoding ); } - - long aBuffer[ sizeof( struct dirent ) + _PC_NAME_MAX +1 ]; int nPaths = aSearchPath.GetTokenCount( ':' ); + maxDirent u; for( i = 0; i < nPaths; i++ ) { ByteString aPath( aSearchPath.GetToken( i, ':' ) ); @@ -272,9 +276,9 @@ Sequence<PluginDescription> XPluginManager_Impl::impl_getPluginDescriptions() th { DIR* pDIR = opendir( aPath.GetBuffer() ); struct dirent* pDirEnt = NULL; - while( pDIR && ! readdir_r( pDIR, (struct dirent*)aBuffer, &pDirEnt ) && pDirEnt ) + while( pDIR && ! readdir_r( pDIR, &u.asDirent, &pDirEnt ) && pDirEnt ) { - char* pBaseName = ((struct dirent*)aBuffer)->d_name; + char* pBaseName = u.asDirent.d_name; if( pBaseName[0] != '.' || pBaseName[1] != '.' || pBaseName[2] != 0 ) |