[Libreoffice-commits] .: 4 commits - sal/android sal/osl

Tor Lillqvist tml at kemper.freedesktop.org
Wed Jan 4 05:34:35 PST 2012


 sal/android/lo-bootstrap.c |    7 +--
 sal/osl/unx/uunxapi.cxx    |   38 +++++++++++-----
 sal/osl/unx/uunxapi.hxx    |  104 ++++++++++++++++++++++-----------------------
 3 files changed, 80 insertions(+), 69 deletions(-)

New commits:
commit 0a5821652fdc57bde39d6b0b6472fc0b4b42cb1a
Author: Tor Lillqvist <tlillqvist at suse.com>
Date:   Wed Jan 4 14:19:14 2012 +0200

    Remove bogus one column indentation

diff --git a/sal/osl/unx/uunxapi.hxx b/sal/osl/unx/uunxapi.hxx
index 44ad6a0..8e47cfc 100644
--- a/sal/osl/unx/uunxapi.hxx
+++ b/sal/osl/unx/uunxapi.hxx
@@ -26,76 +26,74 @@
  *
  ************************************************************************/
 
- #ifndef _OSL_UUNXAPI_HXX_
- #define _OSL_UUNXAPI_HXX_
+#ifndef _OSL_UUNXAPI_HXX_
+#define _OSL_UUNXAPI_HXX_
 
- #ifndef _OSL_UUNXAPI_H_
- #include "uunxapi.h"
- #endif
+#ifndef _OSL_UUNXAPI_H_
+#include "uunxapi.h"
+#endif
 
- #ifndef _RTL_USTRING_HXX_
- #include <rtl/ustring.hxx>
- #endif
+#ifndef _RTL_USTRING_HXX_
+#include <rtl/ustring.hxx>
+#endif
 
- namespace osl
- {
+namespace osl
+{
 
-     /***********************************
-      osl::access
-
-      @see access
-      **********************************/
-
-     inline int access(const rtl::OUString& ustrPath, int mode)
-      {
-         return access_u(ustrPath.pData, mode);
-       }
-
-     /***********************************
-      osl::realpath
-
-      @descr
-      The return value differs from the
-      realpath function
-
-      @returns sal_True on success else
-      sal_False
+    /***********************************
+     osl::access
 
-      @see realpath
-      **********************************/
+     @see access
+     **********************************/
 
-     inline sal_Bool realpath(
-         const rtl::OUString& ustrFileName,
-        rtl::OUString& ustrResolvedName)
+    inline int access(const rtl::OUString& ustrPath, int mode)
      {
-         return realpath_u(ustrFileName.pData, &ustrResolvedName.pData);
+        return access_u(ustrPath.pData, mode);
       }
 
+    /***********************************
+     osl::realpath
+
+     @descr
+     The return value differs from the
+     realpath function
 
-     /***********************************
-      osl::lstat
+     @returns sal_True on success else
+     sal_False
 
-      @see lstat
-      **********************************/
+     @see realpath
+     **********************************/
+
+    inline sal_Bool realpath(
+        const rtl::OUString& ustrFileName,
+       rtl::OUString& ustrResolvedName)
+    {
+        return realpath_u(ustrFileName.pData, &ustrResolvedName.pData);
+     }
 
-      inline int lstat(const rtl::OUString& ustrPath, struct stat& buf)
-      {
-           return lstat_u(ustrPath.pData, &buf);
-      }
 
     /***********************************
-          osl::mkdir
-          @see mkdir
-          **********************************/
-    inline int mkdir(const rtl::OUString& aPath, mode_t aMode)
-    {
-        return mkdir_u(aPath.pData, aMode);
-    }
+     osl::lstat
+
+     @see lstat
+     **********************************/
 
- } // end namespace osl
+     inline int lstat(const rtl::OUString& ustrPath, struct stat& buf)
+     {
+          return lstat_u(ustrPath.pData, &buf);
+     }
 
+   /***********************************
+         osl::mkdir
+         @see mkdir
+         **********************************/
+   inline int mkdir(const rtl::OUString& aPath, mode_t aMode)
+   {
+       return mkdir_u(aPath.pData, aMode);
+   }
 
- #endif /* _OSL_UUNXAPI_HXX_ */
+} // end namespace osl
 
+#endif /* _OSL_UUNXAPI_HXX_ */
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit d37157372db95ee64afdc6e74c536e28fc5bbd6e
Author: Tor Lillqvist <tlillqvist at suse.com>
Date:   Wed Jan 4 14:18:02 2012 +0200

    Handle /assets paths also in realpath_u()

diff --git a/sal/osl/unx/uunxapi.cxx b/sal/osl/unx/uunxapi.cxx
index 61fac80..86e86e2 100644
--- a/sal/osl/unx/uunxapi.cxx
+++ b/sal/osl/unx/uunxapi.cxx
@@ -113,6 +113,20 @@
  {
 #ifndef MACOSX // not MACOSX
     rtl::OString fn = OUStringToOString(pustrFileName);
+#ifdef ANDROID
+    if (strncmp(fn.getStr(), "/assets", sizeof("/assets")-1) == 0 &&
+        (fn.getStr()[sizeof("/assets")-1] == '\0' ||
+         fn.getStr()[sizeof("/assets")-1] == '/'))
+    {
+        if (access_u(pustrFileName, F_OK) == -1)
+            return sal_False;
+
+        rtl_uString silly(*pustrFileName);
+        rtl_uString_assign(ppustrResolvedName, &silly);
+
+        return sal_True;
+    }
+#endif
 #else
     rtl::OString fn = macxp_resolveAliasAndConvert(pustrFileName);
 #endif
commit 36ce37def3c7dde751098649763479ca21321a9a
Author: Tor Lillqvist <tlillqvist at suse.com>
Date:   Wed Jan 4 14:15:43 2012 +0200

    Fix the monkey patching to work for an arbitrary offset
    
    We used to patch in a simple "b" instruction with a relative offset
    that has to fit in 24(+2) bits. Which was not enough in practice.
    
    Now patch in a "ldr pc, [pc, #-4]" instead which loads PC from the
    next word; in ARM code PC cotains the address of the executing
    instruction + 8), and put the full address of the replacement code
    into the next word.

diff --git a/sal/android/lo-bootstrap.c b/sal/android/lo-bootstrap.c
index 7fc171b..4800545 100644
--- a/sal/android/lo-bootstrap.c
+++ b/sal/android/lo-bootstrap.c
@@ -1241,10 +1241,9 @@ patch(const char *symbol,
         return;
     }
 
-    /* Poke a "b replacement_code" into it instead */
-    *((unsigned *) code) =
-        (0xEA000000  |
-         ((((int) replacement_code - ((int) code + 8)) / 4) & 0x00FFFFFF));
+    /* Poke in a jump to replacement_code instead */
+    ((unsigned *) code)[0] = 0xe51ff004; /* ldr pc, [pc, #-4] */
+    ((unsigned *) code)[1] = (unsigned) replacement_code;
 }
 
 static void
commit d4b0e98d50916e9a0a2810bb0484bdeb76214254
Author: Tor Lillqvist <tlillqvist at suse.com>
Date:   Wed Jan 4 09:06:16 2012 +0200

    Probably using a local rtl::OString is better

diff --git a/sal/osl/unx/uunxapi.cxx b/sal/osl/unx/uunxapi.cxx
index 3c2067b..61fac80 100644
--- a/sal/osl/unx/uunxapi.cxx
+++ b/sal/osl/unx/uunxapi.cxx
@@ -84,14 +84,14 @@
  int access_u(const rtl_uString* pustrPath, int mode)
  {
 #ifndef MACOSX // not MACOSX
-    const char *path = OUStringToOString(pustrPath).getStr();
+    rtl::OString fn = OUStringToOString(pustrPath);
 #ifdef ANDROID
-    if (strncmp(path, "/assets", sizeof("/assets")-1) == 0 &&
-        (path[sizeof("/assets")-1] == '\0' ||
-         path[sizeof("/assets")-1] == '/'))
+    if (strncmp(fn.getStr(), "/assets", sizeof("/assets")-1) == 0 &&
+        (fn.getStr()[sizeof("/assets")-1] == '\0' ||
+         fn.getStr()[sizeof("/assets")-1] == '/'))
     {
         struct stat stat;
-        if (lo_apk_lstat(path, &stat) == -1)
+        if (lo_apk_lstat(fn.getStr(), &stat) == -1)
             return -1;
         if (mode & W_OK)
         {
@@ -101,7 +101,7 @@
         return 0;
     }
 #endif
-    return access(path, mode);
+    return access(fn.getStr(), mode);
 #else
     return access(macxp_resolveAliasAndConvert(pustrPath).getStr(), mode);
 #endif
@@ -135,14 +135,14 @@
   int lstat_u(const rtl_uString* pustrPath, struct stat* buf)
  {
 #ifndef MACOSX  // not MACOSX
-    const char *path = OUStringToOString(pustrPath).getStr();
+    rtl::OString fn = OUStringToOString(pustrPath);
 #ifdef ANDROID
-    if (strncmp(path, "/assets", sizeof("/assets")-1) == 0 &&
-        (path[sizeof("/assets")-1] == '\0' ||
-         path[sizeof("/assets")-1] == '/'))
-        return lo_apk_lstat(path, buf);
+    if (strncmp(fn.getStr(), "/assets", sizeof("/assets")-1) == 0 &&
+        (fn.getStr()[sizeof("/assets")-1] == '\0' ||
+         fn.getStr()[sizeof("/assets")-1] == '/'))
+        return lo_apk_lstat(fn.getStr(), buf);
 #endif
-    return lstat(path, buf);
+    return lstat(fn.getStr(), buf);
 #else
     return lstat(macxp_resolveAliasAndConvert(pustrPath).getStr(), buf);
 #endif


More information about the Libreoffice-commits mailing list