summaryrefslogtreecommitdiffstats
path: root/xpcom/io
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2020-02-22 19:03:00 -0500
committerwolfbeast <mcwerewolf@wolfbeast.com>2020-04-14 12:51:25 +0200
commitda15aa0fdf5ec769a0973a00d84f9fa090de0b60 (patch)
treec6f5b8197eac51be855aecdae3b5d97207cdf97e /xpcom/io
parent867737dd4b650494404a90b8b99ea959f74462ca (diff)
downloadUXP-da15aa0fdf5ec769a0973a00d84f9fa090de0b60.tar
UXP-da15aa0fdf5ec769a0973a00d84f9fa090de0b60.tar.gz
UXP-da15aa0fdf5ec769a0973a00d84f9fa090de0b60.tar.lz
UXP-da15aa0fdf5ec769a0973a00d84f9fa090de0b60.tar.xz
UXP-da15aa0fdf5ec769a0973a00d84f9fa090de0b60.zip
Issue #1053 - Remove android support from XPCOM
Diffstat (limited to 'xpcom/io')
-rw-r--r--xpcom/io/SpecialSystemDirectory.cpp5
-rw-r--r--xpcom/io/nsLocalFileUnix.cpp56
-rw-r--r--xpcom/io/nsNativeCharsetUtils.cpp4
-rw-r--r--xpcom/io/nsNativeCharsetUtils.h4
4 files changed, 5 insertions, 64 deletions
diff --git a/xpcom/io/SpecialSystemDirectory.cpp b/xpcom/io/SpecialSystemDirectory.cpp
index 158431088..c174b4ac7 100644
--- a/xpcom/io/SpecialSystemDirectory.cpp
+++ b/xpcom/io/SpecialSystemDirectory.cpp
@@ -187,13 +187,8 @@ GetRegWindowsAppDataFolder(bool aLocal, nsIFile** aFile)
static nsresult
GetUnixHomeDir(nsIFile** aFile)
{
-#if defined(ANDROID)
- // XXX no home dir on android; maybe we should return the sdcard if present?
- return NS_ERROR_FAILURE;
-#else
return NS_NewNativeLocalFile(nsDependentCString(PR_GetEnv("HOME")),
true, aFile);
-#endif
}
/*
diff --git a/xpcom/io/nsLocalFileUnix.cpp b/xpcom/io/nsLocalFileUnix.cpp
index 06706235d..48f2786a7 100644
--- a/xpcom/io/nsLocalFileUnix.cpp
+++ b/xpcom/io/nsLocalFileUnix.cpp
@@ -62,12 +62,6 @@
static nsresult MacErrorMapper(OSErr inErr);
#endif
-#ifdef MOZ_WIDGET_ANDROID
-#include "GeneratedJNIWrappers.h"
-#include "nsIMIMEService.h"
-#include <linux/magic.h>
-#endif
-
#ifdef MOZ_ENABLE_CONTENTACTION
#include <contentaction/contentaction.h>
#endif
@@ -1064,12 +1058,6 @@ nsLocalFile::Remove(bool aRecursive)
}
rv = file->Remove(aRecursive);
-#ifdef ANDROID
- // See bug 580434 - Bionic gives us just deleted files
- if (rv == NS_ERROR_FILE_TARGET_DOES_NOT_EXIST) {
- continue;
- }
-#endif
if (NS_FAILED(rv)) {
return rv;
}
@@ -1193,19 +1181,7 @@ nsLocalFile::SetPermissions(uint32_t aPermissions)
if (chmod(mPath.get(), aPermissions) >= 0) {
return NS_OK;
}
-#if defined(ANDROID) && defined(STATFS)
- // For the time being, this is restricted for use by Android, but we
- // will figure out what to do for all platforms in bug 638503
- struct STATFS sfs;
- if (STATFS(mPath.get(), &sfs) < 0) {
- return NSRESULT_FOR_ERRNO();
- }
- // if this is a FAT file system we can't set file permissions
- if (sfs.f_type == MSDOS_SUPER_MAGIC) {
- return NS_OK;
- }
-#endif
return NSRESULT_FOR_ERRNO();
}
@@ -1237,20 +1213,7 @@ nsLocalFile::SetFileSize(int64_t aFileSize)
{
CHECK_mPath();
-#if defined(ANDROID)
- /* no truncate on bionic */
- int fd = open(mPath.get(), O_WRONLY);
- if (fd == -1) {
- return NSRESULT_FOR_ERRNO();
- }
-
- int ret = ftruncate(fd, (off_t)aFileSize);
- close(fd);
-
- if (ret == -1) {
- return NSRESULT_FOR_ERRNO();
- }
-#elif defined(HAVE_TRUNCATE64)
+#if defined(HAVE_TRUNCATE64)
if (truncate64(mPath.get(), (off64_t)aFileSize) == -1) {
return NSRESULT_FOR_ERRNO();
}
@@ -2013,23 +1976,6 @@ nsLocalFile::Launch()
}
return NS_ERROR_FAILURE;
-#elif defined(MOZ_WIDGET_ANDROID)
- // Try to get a mimetype, if this fails just use the file uri alone
- nsresult rv;
- nsAutoCString type;
- nsCOMPtr<nsIMIMEService> mimeService(do_GetService("@mozilla.org/mime;1", &rv));
- if (NS_SUCCEEDED(rv)) {
- rv = mimeService->GetTypeFromFile(this, type);
- }
-
- nsAutoCString fileUri = NS_LITERAL_CSTRING("file://") + mPath;
- return java::GeckoAppShell::OpenUriExternal(
- NS_ConvertUTF8toUTF16(fileUri),
- NS_ConvertUTF8toUTF16(type),
- EmptyString(),
- EmptyString(),
- EmptyString(),
- EmptyString()) ? NS_OK : NS_ERROR_FAILURE;
#elif defined(MOZ_WIDGET_COCOA)
CFURLRef url;
if (NS_SUCCEEDED(GetCFURL(&url))) {
diff --git a/xpcom/io/nsNativeCharsetUtils.cpp b/xpcom/io/nsNativeCharsetUtils.cpp
index e53307af5..fcc208264 100644
--- a/xpcom/io/nsNativeCharsetUtils.cpp
+++ b/xpcom/io/nsNativeCharsetUtils.cpp
@@ -7,9 +7,9 @@
#include "xpcom-private.h"
//-----------------------------------------------------------------------------
-// XP_MACOSX or ANDROID
+// XP_MACOSX
//-----------------------------------------------------------------------------
-#if defined(XP_MACOSX) || defined(ANDROID)
+#if defined(XP_MACOSX)
#include "nsAString.h"
#include "nsReadableUtils.h"
diff --git a/xpcom/io/nsNativeCharsetUtils.h b/xpcom/io/nsNativeCharsetUtils.h
index 5c1e670d5..c3053a7df 100644
--- a/xpcom/io/nsNativeCharsetUtils.h
+++ b/xpcom/io/nsNativeCharsetUtils.h
@@ -39,13 +39,13 @@ nsresult NS_CopyUnicodeToNative(const nsAString& aInput, nsACString& aOutput);
* a real function. On Mac OS X it's always UTF-8 while on Windows
* and other platforms (e.g. OS2), it's never UTF-8.
*/
-#if defined(XP_UNIX) && !defined(XP_MACOSX) && !defined(ANDROID)
+#if defined(XP_UNIX) && !defined(XP_MACOSX)
bool NS_IsNativeUTF8();
#else
inline bool
NS_IsNativeUTF8()
{
-#if defined(XP_MACOSX) || defined(ANDROID)
+#if defined(XP_MACOSX)
return true;
#else
return false;