Closed Bug 561464 Opened 10 years ago Closed 10 years ago

Add support for XPCOM on Android

Categories

(Core :: XPCOM, enhancement)

All
Android
enhancement
Not set

Tracking

()

RESOLVED FIXED

People

(Reporter: mwu, Assigned: mwu)

References

Details

Attachments

(1 file, 1 obsolete file)

Attached patch Add support for XPCOM on Android (obsolete) — Splinter Review
These are mostly Vlad's changes but I'll try to address any review comments as usual.
Attachment #441161 - Flags: review?(benjamin)
Comment on attachment 441161 [details] [diff] [review]
Add support for XPCOM on Android

>diff --git a/xpcom/io/nsLocalFileUnix.cpp b/xpcom/io/nsLocalFileUnix.cpp

>+#ifdef ANDROID
>+    NS_WARNING("nsLocalFile::SetFileSize not implemented on Android (could implement with ftruncate)");
>+    return NS_ERROR_NOT_IMPLEMENTED;
>+#else
> #ifdef HAVE_TRUNCATE64

Please avoid the nested ifdef by using #elif defined here.

>diff --git a/xpcom/io/nsNativeCharsetUtils.cpp b/xpcom/io/nsNativeCharsetUtils.cpp
>--- a/xpcom/io/nsNativeCharsetUtils.cpp
>+++ b/xpcom/io/nsNativeCharsetUtils.cpp
>@@ -42,6 +42,13 @@
> 
> #include "xpcom-private.h"
> 
>+#ifdef ANDROID
>+static inline int fake_mbtowc(wchar_t *, const char *, int) {
>+    return -1;
>+}
>+#define mbtowc(a,b,c)  fake_mbtowc(a,b,c)
>+#endif

I'm concerned about this: catch me on IRC?

r=me except for nsNativeCharsetUtils.cpp
Attachment #441161 - Flags: review?(benjamin) → review+
No idea what the native OS character set is -- there aren't any mount flags set, so as best I can tell things default to iso8859-1.  Can we just ignore this and fix it if it ever becomes a problem?
The main filesystem is probably all ASCII, so the problem is most likely what's set for the sdcard. On my nexus one, the sdcard is mounted with these flags:

rw,dirsync,nosuid,nodev,noexec,uid=1000,gid=1015,fmask=0702,dmask=0702,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 0

As far as I can tell, this combo (in particular, utf8) means that the kernel will try its best to give us utf8.
Review comments addressed, proper truncate impl added, and the native char conversion now assumes utf-8.
Attachment #441161 - Attachment is obsolete: true
Attachment #445788 - Flags: review?(benjamin)
Attachment #445788 - Flags: review?(benjamin) → review+
http://hg.mozilla.org/mozilla-central/rev/193499688f7e
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.