ooo-build r12555 - in trunk: . patches/dev300



Author: jholesovsky
Date: Fri May 16 15:10:20 2008
New Revision: 12555
URL: http://svn.gnome.org/viewvc/ooo-build?rev=12555&view=rev

Log:
2008-05-16  Jan Holesovsky  <kendy suse cz>

        * patches/dev300/lockfile-dont-do-dns-lookup.diff: Don't do dns lookup
          just to write something nice to .lock file.
        * patches/dev300/lockfile-less-symbols.diff: Remove some unnecessary
          bloat.
        * patches/dev300/apply: Apply the changes.


Added:
   trunk/patches/dev300/lockfile-dont-do-dns-lookup.diff
   trunk/patches/dev300/lockfile-less-symbols.diff
Modified:
   trunk/ChangeLog
   trunk/patches/dev300/apply

Modified: trunk/patches/dev300/apply
==============================================================================
--- trunk/patches/dev300/apply	(original)
+++ trunk/patches/dev300/apply	Fri May 16 15:10:20 2008
@@ -2246,6 +2246,14 @@
 # after applying the patch, set SAL_NO_MOUSEGRABS in your env
 #vcl-disable-mouse-grab.diff
 
+# don't do dns lookup on startup
+# TODO file up-stream
+lockfile-dont-do-dns-lookup.diff, n#389257, jholesov
+# and don't expose unnecessary symbols
+# TODO file up-stream
+lockfile-less-symbols.diff, jholesov
+
+
 [ InternalMesaHeaders ]
 internal-mesa-headers-config_office.diff, fridrich
 internal-mesa-headers-slideshow.diff, fridrich

Added: trunk/patches/dev300/lockfile-dont-do-dns-lookup.diff
==============================================================================
--- (empty file)
+++ trunk/patches/dev300/lockfile-dont-do-dns-lookup.diff	Fri May 16 15:10:20 2008
@@ -0,0 +1,105 @@
+diff --git desktop/source/app/lockfile.cxx desktop/source/app/lockfile.cxx
+index b1bba75..a026115 100644
+--- desktop/source/app/lockfile.cxx
++++ desktop/source/app/lockfile.cxx
+@@ -36,6 +36,8 @@
+ #include <tools/prewin.h>
+ #include <windows.h>
+ #include <tools/postwin.h>
++#else
++#include <unistd.h>
+ #endif
+ #include <sal/types.h>
+ #include <osl/file.hxx>
+@@ -53,6 +55,37 @@ using namespace ::rtl;
+ using namespace ::utl;
+ 
+ 
++static rtl::OString impl_getHostname()
++{
++    rtl::OString aHost;
++#ifdef WNT
++    /*
++       prevent windows from connecting to the net to get it's own
++       hostname by using the netbios name
++       */
++    sal_Int32 sz = MAX_COMPUTERNAME_LENGTH + 1;
++    char* szHost = new char[sz];
++    if (GetComputerName(szHost, (LPDWORD)&sz))
++        aHost = OString(szHost);
++    else
++        aHost = OString("UNKNOWN");
++    delete[] szHost;
++#else
++    /* Don't do dns lookup on Linux either */
++    sal_Char pHostName[1024];
++
++    if ( gethostname( pHostName, sizeof( pHostName ) - 1 ) == 0 )
++    {
++        pHostName[sizeof( pHostName ) - 1] = '\0';
++        aHost = OString( pHostName );
++    }
++    else
++        aHost = OString("UNKNOWN");
++#endif
++
++    return aHost;
++}
++
+ namespace desktop {
+ 
+ 	// initialize static members...
+@@ -158,25 +191,9 @@ namespace desktop {
+         
+ 		ByteString aHost  = aConfig.ReadKey( Hostkey() );
+ 		ByteString aUser  = aConfig.ReadKey( Userkey() );
++
+ 		// lockfile from same host?
+-		ByteString myHost;
+-#ifdef WNT
+-        /*
+-          prevent windows from connecting to the net to get it's own
+-          hostname by using the netbios name
+-        */
+-        sal_Int32 sz = MAX_COMPUTERNAME_LENGTH + 1;
+-        char* szHost = new char[sz];
+-        if (GetComputerName(szHost, (LPDWORD)&sz))
+-            myHost = OString(szHost);
+-        else
+-            myHost = OString("UNKNOWN");
+-        delete[] szHost;
+-#else
+-		oslSocketResult sRes;
+-        myHost  = OUStringToOString(
+-			SocketAddr::getLocalHostname( &sRes ), RTL_TEXTENCODING_ASCII_US );
+-#endif
++		ByteString myHost( impl_getHostname() );
+ 		if (aHost == myHost) {
+ 			// lockfile by same UID
+ 			OUString myUserName;
+@@ -196,24 +213,7 @@ namespace desktop {
+ 		aConfig.SetGroup(Group());
+ 
+ 		// get information
+-        ByteString aHost;
+-#ifdef WNT
+-        /*
+-          prevent windows from connecting to the net to get it's own
+-          hostname by using the netbios name
+-        */
+-        sal_Int32 sz = MAX_COMPUTERNAME_LENGTH + 1;
+-        char* szHost = new char[sz];
+-        if (GetComputerName(szHost, (LPDWORD)&sz))
+-            aHost = OString(szHost);
+-        else
+-            aHost = OString("UNKNOWN");
+-        delete[] szHost;
+-#else
+-		oslSocketResult sRes;
+-		aHost  = OUStringToOString(
+-			SocketAddr::getLocalHostname( &sRes ), RTL_TEXTENCODING_ASCII_US );
+-#endif
++		ByteString aHost( impl_getHostname() );
+ 		OUString aUserName;
+ 		Security aSecurity;
+ 		aSecurity.getUserName( aUserName );

Added: trunk/patches/dev300/lockfile-less-symbols.diff
==============================================================================
--- (empty file)
+++ trunk/patches/dev300/lockfile-less-symbols.diff	Fri May 16 15:10:20 2008
@@ -0,0 +1,139 @@
+diff --git desktop/source/app/lockfile.cxx desktop/source/app/lockfile.cxx
+index a026115..058d66a 100644
+--- desktop/source/app/lockfile.cxx
++++ desktop/source/app/lockfile.cxx
+@@ -88,24 +88,6 @@ static rtl::OString impl_getHostname()
+ 
+ namespace desktop {
+ 
+-	// initialize static members...
+-	// lock suffix
+-	const OUString Lockfile::Suffix()
+-	    { return OUString::createFromAscii( "/.lock" ); }
+-	// values for datafile
+-	const ByteString Lockfile::Group()
+-        { return ByteString( "Lockdata" ); }
+-	const ByteString Lockfile::Userkey()
+-        { return ByteString( "User" ); }
+-	const ByteString Lockfile::Hostkey()
+-        { return ByteString( "Host" ); }
+-	const ByteString Lockfile::Stampkey()
+-        { return ByteString( "Stamp" ); }
+-	const ByteString Lockfile::Timekey()
+-        { return ByteString( "Time" ); }
+-	const ByteString Lockfile::IPCkey()
+-        { return ByteString( "IPCServer" ); }
+-
+ 	Lockfile::Lockfile( bool bIPCserver )
+     :m_bIPCserver(bIPCserver)
+ 	,m_bRemove(sal_False)
+@@ -114,7 +96,7 @@ namespace desktop {
+ 		// build the file-url to use for the lock
+ 		OUString aUserPath;
+ 		Bootstrap::locateUserInstallation( aUserPath );
+-		m_aLockname = aUserPath + Suffix();
++		m_aLockname = aUserPath + LOCKFILE_SUFFIX;
+ 
+ 		// generate ID
+ 		const int nIdBytes = 16;
+@@ -184,13 +166,13 @@ namespace desktop {
+ 		// to assume that it is a stale lockfile which can be overwritten
+ 		String aLockname = m_aLockname;
+ 		Config aConfig(aLockname);
+-		aConfig.SetGroup(Group());
+-		ByteString aIPCserver  = aConfig.ReadKey( IPCkey() );
++		aConfig.SetGroup(LOCKFILE_GROUP);
++		ByteString aIPCserver  = aConfig.ReadKey( LOCKFILE_IPCKEY );
+         if (! aIPCserver.EqualsIgnoreCaseAscii( "true" ))
+             return false;
+         
+-		ByteString aHost  = aConfig.ReadKey( Hostkey() );
+-		ByteString aUser  = aConfig.ReadKey( Userkey() );
++		ByteString aHost  = aConfig.ReadKey( LOCKFILE_HOSTKEY );
++		ByteString aUser  = aConfig.ReadKey( LOCKFILE_USERKEY );
+ 
+ 		// lockfile from same host?
+ 		ByteString myHost( impl_getHostname() );
+@@ -210,7 +192,7 @@ namespace desktop {
+ 	{
+ 		String aLockname = m_aLockname;
+ 		Config aConfig(aLockname);
+-		aConfig.SetGroup(Group());
++		aConfig.SetGroup(LOCKFILE_GROUP);
+ 
+ 		// get information
+ 		ByteString aHost( impl_getHostname() );
+@@ -222,12 +204,12 @@ namespace desktop {
+ 		ByteString aStamp = OUStringToOString( m_aId, RTL_TEXTENCODING_ASCII_US );
+ 
+ 		// write information
+-		aConfig.WriteKey( Userkey(),  aUser );
+-		aConfig.WriteKey( Hostkey(),  aHost );
+-		aConfig.WriteKey( Stampkey(), aStamp );
+-		aConfig.WriteKey( Timekey(),  aTime );
++		aConfig.WriteKey( LOCKFILE_USERKEY,  aUser );
++		aConfig.WriteKey( LOCKFILE_HOSTKEY,  aHost );
++		aConfig.WriteKey( LOCKFILE_STAMPKEY, aStamp );
++		aConfig.WriteKey( LOCKFILE_TIMEKEY,  aTime );
+ 		aConfig.WriteKey(
+-            IPCkey(),
++            LOCKFILE_IPCKEY,
+             m_bIPCserver ? ByteString("true") : ByteString("false") );
+ 		aConfig.Flush( );
+ 	}
+diff --git desktop/source/app/lockfile.hxx desktop/source/app/lockfile.hxx
+index dca72d7..8194b48 100644
+--- desktop/source/app/lockfile.hxx
++++ desktop/source/app/lockfile.hxx
+@@ -48,6 +48,14 @@
+ 
+ class ByteString;
+ 
++#define LOCKFILE_SUFFIX   rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/.lock" ) )
++#define LOCKFILE_GROUP    ByteString( "Lockdata" )
++#define LOCKFILE_USERKEY  ByteString( "User" )
++#define LOCKFILE_HOSTKEY  ByteString( "Host" )
++#define LOCKFILE_STAMPKEY ByteString( "Stamp" )
++#define LOCKFILE_TIMEKEY  ByteString( "Time" )
++#define LOCKFILE_IPCKEY   ByteString( "IPCServer" )
++
+ namespace desktop {
+ 
+ 	class Lockfile;
+@@ -74,15 +82,6 @@ namespace desktop {
+ 		~Lockfile(void);
+ 
+ 	private:
+-		// data in lockfile
+-		static const ByteString Group();
+-		static const ByteString Userkey();
+-		static const ByteString Hostkey();
+-		static const ByteString Stampkey();
+-		static const ByteString Timekey();
+-		static const ByteString IPCkey();
+-		// lockfilename
+-		static const rtl::OUString Suffix();
+ 		bool m_bIPCserver;
+ 		// full qualified name (file://-url) of the lockfile
+ 		rtl::OUString m_aLockname;
+diff --git desktop/source/app/lockfile2.cxx desktop/source/app/lockfile2.cxx
+index f03271f..ce9cc1e 100644
+--- desktop/source/app/lockfile2.cxx
++++ desktop/source/app/lockfile2.cxx
+@@ -45,11 +45,11 @@ bool Lockfile_execWarning( Lockfile * that )
+     // read information from lock
+     String aLockname = that->m_aLockname;
+     Config aConfig(aLockname);
+-    aConfig.SetGroup(that->Group());
+-    ByteString aHost  = aConfig.ReadKey( that->Hostkey() );
+-    ByteString aUser  = aConfig.ReadKey( that->Userkey() );
+-    ByteString aStamp = aConfig.ReadKey( that->Stampkey() );
+-    ByteString aTime  = aConfig.ReadKey( that->Timekey() );
++    aConfig.SetGroup( LOCKFILE_GROUP );
++    ByteString aHost  = aConfig.ReadKey( LOCKFILE_HOSTKEY );
++    ByteString aUser  = aConfig.ReadKey( LOCKFILE_USERKEY );
++    ByteString aStamp = aConfig.ReadKey( LOCKFILE_STAMPKEY );
++    ByteString aTime  = aConfig.ReadKey( LOCKFILE_TIMEKEY );
+     
+     // display warning and return response
+     QueryBox aBox( NULL, DesktopResId( QBX_USERDATALOCKED ) );



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]