summaryrefslogtreecommitdiff
path: root/xmlreader/source
diff options
context:
space:
mode:
authorTor Lillqvist <tlillqvist@suse.com>2011-12-21 13:51:50 +0200
committerTor Lillqvist <tlillqvist@suse.com>2011-12-21 14:08:48 +0200
commite3ab0fd9016bc24c5a0eb0807f171d5025c3bb79 (patch)
treefe87e3d60bf522d0ccc469becacbb0191e129d75 /xmlreader/source
parenteeecf625351238f90c61c82b403bd65e35d7833e (diff)
osl_unmapFile can't work for files bundled inside the .apk on Android
On Android, when an app is installed, arbitrary files bundled in the app won't be unpacked into actual separate files in the file system. They will exist only as archive entries in the .apk file (which is a zip archive). The SDK tooling puts such files under the /assets folder in the .apk. The LibreOffice bootstrapping code for Android maps the .apk file into memory. osl_openFile() knows about the /assets special case, and uses a separate abstraction for such memory-mapped files. Obviously, when producing an .apk, one needs to make sure these bundled files are not compressed, if one wants to be able to use them directly from the memory-mapped .apk file. We do that in our test and sample Android projects. When mapping such files under /assets , just return a pointer to the file's location inside the mapped .apk archive. We can't use the old osl_unmapFile() on such mapped files, as that would unexpectedly unmap fairly arbitrary pages of the .apk mapping, wreaking havoc on later use of the same pages. So, introduce a new osl_unmapMappedFile() function that takes also the oslFileHandle originally passed to osl_mapFile(). Use this instead in the few places where the code actually called osl_unmapFile(). Make sure osl_mapFile() is nonexistent on Android.
Diffstat (limited to 'xmlreader/source')
-rw-r--r--xmlreader/source/xmlreader.cxx4
1 files changed, 2 insertions, 2 deletions
diff --git a/xmlreader/source/xmlreader.cxx b/xmlreader/source/xmlreader.cxx
index 0801c8137474..05782eeb70dd 100644
--- a/xmlreader/source/xmlreader.cxx
+++ b/xmlreader/source/xmlreader.cxx
@@ -115,11 +115,11 @@ XmlReader::XmlReader(rtl::OUString const & fileUrl)
}
XmlReader::~XmlReader() {
- oslFileError e = osl_unmapFile(fileAddress_, fileSize_);
+ oslFileError e = osl_unmapMappedFile(fileHandle_, fileAddress_, fileSize_);
if (e != osl_File_E_None) {
SAL_WARN(
"xmlreader",
- "osl_unmapFile of \"" << fileUrl_ << "\" failed with " << +e);
+ "osl_unmapMappedFile of \"" << fileUrl_ << "\" failed with " << +e);
}
e = osl_closeFile(fileHandle_);
if (e != osl_File_E_None) {