[Libreoffice-commits] .: 4 commits - configure.in sal/android sal/inc sal/osl
Tor Lillqvist
tml at kemper.freedesktop.org
Tue Jan 24 11:36:02 PST 2012
configure.in | 3 ++-
sal/android/lo-bootstrap.c | 25 +++++++++++++++++++++++--
sal/inc/osl/detail/file.h | 5 +++++
sal/osl/unx/file.cxx | 5 ++++-
sal/osl/unx/file_misc.cxx | 34 +++++++++++++++++++++++-----------
5 files changed, 57 insertions(+), 15 deletions(-)
New commits:
commit 5488d34bbf79a83942221f0f3bf94bec09db05a2
Author: Tor Lillqvist <tlillqvist at suse.com>
Date: Tue Jan 24 21:06:54 2012 +0200
Put a local.properties in android/qa/desktop, too
diff --git a/configure.in b/configure.in
index ac986f6..9a348e3 100644
--- a/configure.in
+++ b/configure.in
@@ -2961,6 +2961,7 @@ if test "$cross_compiling" = "yes"; then
bin/repo-list.in \
build_env.in \
android/qa/sc/local.properties.in \
+ android/qa/desktop/local.properties.in \
config.guess \
config_host.mk.in \
configure \
@@ -10485,7 +10486,7 @@ else
echo > set_soenv.last
fi
-AC_CONFIG_FILES([config_host.mk ooo.lst set_soenv bin/repo-list build_env android/qa/sc/local.properties])
+AC_CONFIG_FILES([config_host.mk ooo.lst set_soenv bin/repo-list build_env android/qa/sc/local.properties android/qa/desktop/local.properties])
AC_OUTPUT
# touch the config timestamp file set_soenv.stamp
commit 52681e4405b303028340bfb63ddb6c14eb17caa2
Author: Tor Lillqvist <tlillqvist at suse.com>
Date: Tue Jan 24 20:51:02 2012 +0200
Use own own <osl/file.h> API to read the source in osl_copyFile()
It seems that we call osl_copyFile() to copy from /assets on Android
in some cases.
diff --git a/sal/inc/osl/detail/file.h b/sal/inc/osl/detail/file.h
index 8e2c910..f9798da 100644
--- a/sal/inc/osl/detail/file.h
+++ b/sal/inc/osl/detail/file.h
@@ -49,6 +49,11 @@ extern "C" {
#define osl_File_OpenFlag_Trunc 0x00000010L
#define osl_File_OpenFlag_NoExcl 0x00000020L
+SAL_DLLPUBLIC oslFileError SAL_CALL osl_openFilePath(
+ const char *cpFilePath,
+ oslFileHandle* pHandle,
+ sal_uInt32 uFlags );
+
/* Get the OS specific "handle" of an open file. */
SAL_DLLPUBLIC oslFileError SAL_CALL osl_getFileOSHandle(
oslFileHandle Handle,
diff --git a/sal/osl/unx/file.cxx b/sal/osl/unx/file.cxx
index aa6cc26..63e9775 100644
--- a/sal/osl/unx/file.cxx
+++ b/sal/osl/unx/file.cxx
@@ -892,7 +892,7 @@ SAL_CALL osl_openMemoryAsFile( void *address, size_t size, oslFileHandle *pHandl
#define OPEN_CREATE_FLAGS ( O_CREAT | O_RDWR )
#endif
-static oslFileError
+oslFileError
SAL_CALL osl_openFilePath( const char *cpFilePath, oslFileHandle* pHandle, sal_uInt32 uFlags )
{
oslFileError eRet;
@@ -908,7 +908,10 @@ SAL_CALL osl_openFilePath( const char *cpFilePath, oslFileHandle* pHandle, sal_u
size_t size;
address = lo_apkentry(cpFilePath, &size);
if (address == NULL)
+ {
+ errno = ENOENT;
return osl_File_E_NOENT;
+ }
return osl_openMemoryAsFile(address, size, pHandle);
}
#endif
diff --git a/sal/osl/unx/file_misc.cxx b/sal/osl/unx/file_misc.cxx
index 52e73cb..260b711 100644
--- a/sal/osl/unx/file_misc.cxx
+++ b/sal/osl/unx/file_misc.cxx
@@ -27,6 +27,7 @@
************************************************************************/
#include "osl/file.hxx"
+#include "osl/detail/file.h"
#include "osl/diagnose.h"
#include "osl/thread.h"
@@ -833,7 +834,7 @@ static oslFileError osl_psz_copyFile( const sal_Char* pszPath, const sal_Char* p
int DestFileExists=1;
/* mfe: does the source file really exists? */
- nRet = lstat(pszPath,&aFileStat);
+ nRet = lstat_c(pszPath,&aFileStat);
if ( nRet < 0 )
{
@@ -1050,13 +1051,23 @@ static int oslDoCopyLink(const sal_Char* pszSourceFileName, const sal_Char* pszD
static int oslDoCopyFile(const sal_Char* pszSourceFileName, const sal_Char* pszDestFileName, size_t nSourceSize, mode_t mode)
{
- int SourceFileFD=0;
+ oslFileHandle SourceFileFH=0;
int DestFileFD=0;
int nRet=0;
- SourceFileFD=open(pszSourceFileName,O_RDONLY);
- if ( SourceFileFD < 0 )
+#ifdef ANDROID
+ volatile int beenhere = 0;
+ if (!beenhere) {
+ beenhere++;
+ fprintf(stderr, "Sleeping NOW, start ndk-gdb!\n");
+ ::sleep(20);
+ }
+#endif
+ if (osl_openFilePath(pszSourceFileName,
+ &SourceFileFH,
+ osl_File_OpenFlag_Read|osl_File_OpenFlag_NoLock|osl_File_OpenFlag_NoExcl) != osl_File_E_None)
{
+ // Let's hope errno is still set relevantly after osl_openFilePath...
nRet=errno;
return nRet;
}
@@ -1066,7 +1077,7 @@ static int oslDoCopyFile(const sal_Char* pszSourceFileName, const sal_Char* pszD
if ( DestFileFD < 0 )
{
nRet=errno;
- close(SourceFileFD);
+ osl_closeFile(SourceFileFH);
return nRet;
}
@@ -1080,15 +1091,17 @@ static int oslDoCopyFile(const sal_Char* pszSourceFileName, const sal_Char* pszD
do
{
size_t nToRead = std::min( sizeof(pBuffer), nRemains );
- sal_Bool succeeded = safeRead( SourceFileFD, pBuffer, nToRead );
- if ( !succeeded )
+ sal_uInt64 nRead;
+ sal_Bool succeeded;
+ if ( osl_readFile( SourceFileFH, pBuffer, nToRead, &nRead ) != osl_File_E_None || nRead > nToRead || nRead == 0 )
break;
- succeeded = safeWrite( DestFileFD, pBuffer, nToRead );
+ succeeded = safeWrite( DestFileFD, pBuffer, nRead );
if ( !succeeded )
break;
- nRemains -= nToRead;
+ // We know nRead <= nToRead, so it must fit in a size_t
+ nRemains -= (size_t) nRead;
}
while( nRemains );
}
@@ -1101,7 +1114,7 @@ static int oslDoCopyFile(const sal_Char* pszSourceFileName, const sal_Char* pszD
nRet = ENOSPC;
}
- close( SourceFileFD );
+ osl_closeFile( SourceFileFH );
if ( close( DestFileFD ) == -1 && nRet == 0 )
nRet = errno;
commit e580fd501b67b9e0a56a712ffb24ec3c244a135b
Author: Tor Lillqvist <tlillqvist at suse.com>
Date: Tue Jan 24 19:41:04 2012 +0200
Fill in more struct stat fields in lo_apk_lstat()
Set uid and gid to that of the process, atime to current time, mtime
and ctime to the modification timestamp of the archive entry.
diff --git a/sal/android/lo-bootstrap.c b/sal/android/lo-bootstrap.c
index aaf8237..d28c8e9 100644
--- a/sal/android/lo-bootstrap.c
+++ b/sal/android/lo-bootstrap.c
@@ -1076,9 +1076,15 @@ new_stat(const char *path,
int mode,
int fake_ino)
{
+ struct tm tm;
+
memset(statp, 0, sizeof(*statp));
statp->st_mode = mode | S_IRUSR | S_IRGRP | S_IROTH;
statp->st_nlink = 1;
+
+ statp->st_uid = getuid();
+ statp->st_gid = getgid();
+
if (entry != NULL)
statp->st_size = entry->uncompressed_size;
else
@@ -1088,11 +1094,26 @@ new_stat(const char *path,
statp->st_blocks = 0;
else
statp->st_blocks = (statp->st_size - 1) / statp->st_blksize + 1;
- /* Leave timestamps at zero for now? */
+
+ statp->st_atime = time(NULL);
+
+ memset(&tm, 0, sizeof(tm));
+ tm.tm_sec = (letoh16(entry->lastmod_time) & 0x1F) * 2;
+ tm.tm_min = (letoh16(entry->lastmod_time) >> 5) & 0x3F;
+ tm.tm_hour = (letoh16(entry->lastmod_time) >> 11) & 0x1F;
+ tm.tm_mday = letoh16(entry->lastmod_date) & 0x1F;
+ tm.tm_mon = ((letoh16(entry->lastmod_date) >> 5) & 0x0F) - 1;
+ tm.tm_year = ((letoh16(entry->lastmod_date) >> 9) & 0x7F) + 80;
+
+ statp->st_mtime = mktime(&tm);
+ statp->st_ctime = statp->st_mtime;
+
statp->st_ino = fake_ino;
(void) path;
- /* LOGI("lo_apk_lstat(%s) = { st_mode=%o, st_size=%lld, st_ino=%lld }", path, statp->st_mode, statp->st_size, statp->st_ino); */
+ /* LOGI("lo_apk_lstat(%s) = { mode=%o, size=%lld, ino=%lld mtime=%.24s }",
+ path, statp->st_mode, statp->st_size, statp->st_ino,
+ ctime((const time_t *) &statp->st_mtime)); */
return 0;
}
commit 2175e21fb94ecb9a266b656c0efa9f7197072006
Author: Tor Lillqvist <tlillqvist at suse.com>
Date: Tue Jan 24 16:44:28 2012 +0200
Bin incorrect claim in comment
diff --git a/sal/osl/unx/file_misc.cxx b/sal/osl/unx/file_misc.cxx
index 06bb72b..52e73cb 100644
--- a/sal/osl/unx/file_misc.cxx
+++ b/sal/osl/unx/file_misc.cxx
@@ -914,7 +914,6 @@ static oslFileError oslDoCopy(const sal_Char* pszSourceFileName, const sal_Char*
/* Quick fix for #106048, the whole copy file function seems
to be erroneous anyway and needs to be rewritten.
- Besides osl_copyFile is currently not used from OO/SO code.
*/
memset(pszTmpDestFile, 0, size_tmp_dest_buff);
More information about the Libreoffice-commits
mailing list