rpms/openoffice.org/devel workspace.fwk132.patch, NONE, 1.1 openoffice.org.spec, 1.2098, 1.2099

Caolan McNamara caolanm at fedoraproject.org
Tue Dec 15 13:07:02 UTC 2009


Author: caolanm

Update of /cvs/pkgs/rpms/openoffice.org/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv10420/devel

Modified Files:
	openoffice.org.spec 
Added Files:
	workspace.fwk132.patch 
Log Message:
Resolves: rhbz#529648 add workspace.fwk132.patch

workspace.fwk132.patch:
 sal/osl/unx/file_misc.cxx   |   99 ++++++++++++++++++--------------------------
 sfx2/source/doc/docfile.cxx |   27 ++++++++----
 sfx2/source/doc/objstor.cxx |   14 +++++-
 3 files changed, 74 insertions(+), 66 deletions(-)

--- NEW FILE workspace.fwk132.patch ---
diff -r a4be016d908d sal/osl/unx/file_misc.cxx
--- a/sal/osl/unx/file_misc.cxx	Wed Dec 09 12:25:54 2009 +0100
+++ b/sal/osl/unx/file_misc.cxx	Tue Dec 15 12:55:26 2009 +0000
@@ -29,6 +29,7 @@
 
 #include "osl/diagnose.h"
 #include "osl/thread.h"
+#include <osl/signal.h>
 #include "rtl/alloc.h"
 
 #include "system.h"
@@ -48,6 +49,8 @@
 #include <sys/stat.h>
 #include <sys/mman.h>
 
+#include <algorithm>
+
 /************************************************************************
  *   ToDo
  *
@@ -1002,7 +1005,6 @@
     int SourceFileFD=0;
     int DestFileFD=0;
     int nRet=0;
-    void* pSourceFile=0;
 
     SourceFileFD=open(pszSourceFileName,O_RDONLY);
     if ( SourceFileFD < 0 )
@@ -1010,9 +1012,8 @@
         nRet=errno;
         return nRet;
     }
-    
+ 
     DestFileFD=open(pszDestFileName, O_WRONLY | O_CREAT, mode);
-		
     if ( DestFileFD < 0 )
     {
         nRet=errno;
@@ -1020,65 +1021,49 @@
         return nRet;
     }
 
-	/* HACK: because memory mapping fails on various 
-	   platforms if the size of the source file is  0 byte */
-	if (0 == nSourceSize)
-	{						
-		close(SourceFileFD);
-		close(DestFileFD);
-		return 0;
-	}
-	
-    /* FIXME doCopy: fall back code for systems not having mmap */
-    /* mmap file -- open dest file -- write once -- fsync it */
-    pSourceFile=mmap(0,nSourceSize,PROT_READ,MAP_PRIVATE,SourceFileFD,0);
-	
-    if ( pSourceFile == MAP_FAILED )
-    {	
-        /* it's important to set nRet before the hack
-           otherwise errno may be changed by lstat */
-        nRet = errno;
+    if (0 == nSourceSize)
+    {						
         close(SourceFileFD);
         close(DestFileFD);
-        
-        return nRet;
+        return 0;
     }
 
-    nRet = write(DestFileFD,pSourceFile,nSourceSize);
-        
-    /* #112584# if 'write' could not write the requested number of bytes
-             we have to fail of course; because it's not exactly specified if 'write'
-            sets errno if less than requested byte could be written we set nRet
-           explicitly to ENOSPC */
-    if ((nRet < 0) || (nRet != sal::static_int_cast< int >(nSourceSize)))
-    {				
-        if (nRet < 0)
+    size_t nWritten = 0;
+    size_t nRemains = nSourceSize;
+   
+    if ( nRemains )
+    {	
+        char pBuffer[32000];
+        size_t nRead = 0;
+
+        do
+        {
+            nRead = 0;
+            nWritten = 0;
+
+            size_t nToRead = std::min( (size_t)32000, nRemains );
+            nRead = read( SourceFileFD, pBuffer, nToRead );
+            if ( (size_t)-1 != nRead )
+                nWritten = write( DestFileFD, pBuffer, nRead );
+
+            if ( (size_t)-1 != nWritten )
+                nRemains -= nWritten;
+        }
+        while( nRemains && (size_t)-1 != nRead && nRead == nWritten );
+    }
+
+    if ( nRemains )
+    {
+        if ( errno )
             nRet = errno;
-        else 
+        else
             nRet = ENOSPC;
-        
-        close(SourceFileFD);
-        close(DestFileFD);
-        munmap((char*)pSourceFile,nSourceSize);
-        return nRet;
     }
-    
-    nRet = munmap((char*)pSourceFile,nSourceSize);
-    if ( nRet < 0 )
-    {				
-        nRet=errno;
-        close(SourceFileFD);
-        close(DestFileFD);
-        return nRet;
-    }
-    
-    close(SourceFileFD);
-    
-    // Removed call to 'fsync' again (#112584#) and instead 
-    // evaluate the return value of 'close' in order to detect 
-    // and report ENOSPC and other erronous conditions on close    
-    if (close(DestFileFD) == -1)
-        return errno;
-    else
-        return 0;
+
+    close( SourceFileFD );
+    if ( close( DestFileFD ) == -1 && nRet == 0 )
+        nRet = errno;
+
+    return nRet;
 }
+
diff -r a4be016d908d sfx2/source/doc/docfile.cxx
--- a/sfx2/source/doc/docfile.cxx	Wed Dec 09 12:25:54 2009 +0100
+++ b/sfx2/source/doc/docfile.cxx	Tue Dec 15 12:55:26 2009 +0000
@@ -3433,13 +3433,14 @@
 
     if ( !( nStorOpenMode & STREAM_TRUNC ) )
     {
+        sal_Bool bTransferSuccess = sal_False;
+
         if ( GetContent().is()
           && ::utl::LocalFileHelper::IsLocalFile( GetURLObject().GetMainURL( INetURLObject::NO_DECODE ) )
           && ::utl::UCBContentHelper::IsDocument( GetURLObject().GetMainURL( INetURLObject::NO_DECODE ) ) )
         {
             // if there is already such a document, we should copy it
             // if it is a file system use OS copy process
-            sal_Bool bTransferSuccess = sal_False;
             try
             {
                 uno::Reference< ::com::sun::star::ucb::XCommandEnvironment > xComEnv;
@@ -3460,16 +3461,14 @@
             catch( uno::Exception& )
             {}
 
-            if ( !bTransferSuccess )
+            if ( bTransferSuccess )
             {
-                SetError( ERRCODE_IO_CANTWRITE, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
-                return;
+                CloseOutStream();
+                CloseInStream();
             }
-
-            CloseOutStream();
-            CloseInStream();
         }
-        else if ( pInStream )
+
+        if ( !bTransferSuccess && pInStream )
         {
             // the case when there is no URL-access available or this is a remote protocoll
             // but there is an input stream
@@ -3489,13 +3488,25 @@
                     pOutStream->Write( pBuf, nRead );
                 }
 
+                bTransferSuccess = sal_True;
                 delete[] pBuf;
                 CloseInStream();
             }
             CloseOutStream_Impl();
         }
         else
+        {
+            // Quite strange design, but currently it is expected that in this case no transfer happens
+            // TODO/LATER: get rid of this inconsistent part of the call design
+            bTransferSuccess = sal_True;
             CloseInStream();
+        }
+
+        if ( !bTransferSuccess )
+        {
+            SetError( ERRCODE_IO_CANTWRITE, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
+            return;
+        }
     }
 
     CloseStorage();
diff -r a4be016d908d sfx2/source/doc/objstor.cxx
--- a/sfx2/source/doc/objstor.cxx	Wed Dec 09 12:25:54 2009 +0100
+++ b/sfx2/source/doc/objstor.cxx	Tue Dec 15 12:55:26 2009 +0000
@@ -1872,7 +1872,19 @@
 		{
 			uno::Reference< embed::XOptimizedStorage > xOptStorage( xStorage, uno::UNO_QUERY_THROW );
 			::rtl::OUString aBackupURL = rTargetMedium.GetBackup_Impl();
-			if ( aBackupURL.getLength() )
+			if ( !aBackupURL.getLength() )
+            {
+                // the backup could not be created, try to disconnect the storage and close the source SfxMedium
+                // in this case the optimization is not possible, connect storage to a temporary file
+                rTargetMedium.ResetError();
+                xOptStorage->writeAndAttachToStream( uno::Reference< io::XStream >() );
+				rSrcMedium.CanDisposeStorage_Impl( sal_False );
+                rSrcMedium.Close();
+
+                // now try to create the backup
+                rTargetMedium.GetBackup_Impl();
+            }
+            else
 			{
 				// the following call will only compare stream sizes
 				// TODO/LATER: this is a very risky part, since if the URL contents are different from the storage


Index: openoffice.org.spec
===================================================================
RCS file: /cvs/pkgs/rpms/openoffice.org/devel/openoffice.org.spec,v
retrieving revision 1.2098
retrieving revision 1.2099
diff -u -p -r1.2098 -r1.2099
--- openoffice.org.spec	9 Dec 2009 12:40:34 -0000	1.2098
+++ openoffice.org.spec	15 Dec 2009 13:07:02 -0000	1.2099
@@ -1,6 +1,6 @@
 %define oootag OOO320
 %define ooomilestone 7
-%define rh_rpm_release 2
+%define rh_rpm_release 3
 
 # rhbz#465664 jar-repacking breaks help by reordering META-INF/MANIFEST.MF
 %define __jar_repack %{nil}
@@ -133,6 +133,7 @@ Patch55: openoffice.org-3.3.0.ooo102645.
 Patch56: workspace.vcl108.patch
 Patch57: workspace.pythonssldedux.patch
 Patch58: openoffice.org-3.2.0.ooo106502.svx.fixspelltimer.patch
+Patch59: workspace.fwk132.patch
 
 %define python_py_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(0)")
 %define instdir %{_libdir}
@@ -1660,6 +1661,7 @@ cat %{PATCH10} >> svtools/source/dialogs
 %patch56 -p0 -b .workspace.vcl108.patch
 %patch57 -p1 -b .workspace.pythonssldedux.patch
 %patch58 -p1 -b .ooo106502.svx.fixspelltimer.patch
+%patch59 -p1 -b .workspace.fwk132.patch
 
 %build
 echo build start time is `date`, diskspace: `df -h . | tail -n 1`
@@ -4162,6 +4164,9 @@ fi
 %endif
 
 %changelog
+* Tue Dec 15 2009 Caolán McNamara <caolanm at redhat.com> - 1:3.2.0-7.3
+- Resolves: rhbz#529648 add workspace.fwk132.patch
+
 * Wed Dec 09 2009 Caolán McNamara <caolanm at redhat.com> - 1:3.2.0-7.2
 - Resolves: rhbz#544124 add openoffice.org-3.2.0.ooo106502.svx.fixspelltimer.patch
 - Resolves: rhbz#544218 add openoffice.org-3.2.0.ooo107552.vcl.sft.patch




More information about the fedora-extras-commits mailing list