summaryrefslogtreecommitdiffstats
path: root/android/prefix.h
diff options
context:
space:
mode:
authorPatrick Scott <phanna@android.com>2010-02-17 13:45:37 -0500
committerPatrick Scott <phanna@android.com>2010-02-17 13:45:37 -0500
commitd9f0c9bcce7092bf92cab485981630bd74307831 (patch)
tree33066e08afc2412c3bb28e62e90063ade3768b93 /android/prefix.h
parentc397f4b9d798bed94d7c234c177b4a8cf3f87f71 (diff)
downloadexternal_chromium-d9f0c9bcce7092bf92cab485981630bd74307831.zip
external_chromium-d9f0c9bcce7092bf92cab485981630bd74307831.tar.gz
external_chromium-d9f0c9bcce7092bf92cab485981630bd74307831.tar.bz2
Get most of the chromium sources to compile by using a prefix header and some
fake headers. Added modp_b64 and some testing headers. Removed a lot of files from Android.mk since they refer to libraries we don't have. Still needs a lot of work...
Diffstat (limited to 'android/prefix.h')
-rw-r--r--android/prefix.h57
1 files changed, 57 insertions, 0 deletions
diff --git a/android/prefix.h b/android/prefix.h
new file mode 100644
index 0000000..88a28ed
--- /dev/null
+++ b/android/prefix.h
@@ -0,0 +1,57 @@
+#ifndef ANDROID_CHROMIUM_PREFIX_H
+#define ANDROID_CHROMIUM_PREFIX_H
+
+// C++ specific changes
+#ifdef __cplusplus
+// chromium refers to stl functions without std::
+#include <algorithm>
+using std::find;
+using std::reverse;
+using std::search;
+
+// Our pwrite has buf declared void*.
+ssize_t pwrite(int fd, const void *buf, size_t count, off_t offset) {
+ return pwrite(fd, const_cast<void*>(buf), count, offset);
+}
+
+// Called by command_line.cc to shorten the process name. Not needed for
+// network stack.
+inline int prctl(int option, ...) { return 0; }
+
+namespace std {
+// our new does not trigger oom
+inline void set_new_handler(void (*p)()) {}
+}
+
+// Chromium expects size_t to be a signed int on linux but Android defines it
+// as unsigned.
+inline size_t abs(size_t x) { return x; }
+#endif
+
+// Needed by base_paths.cc for close() function.
+#include <unistd.h>
+// Need to define assert before logging.h undefines it.
+#include <assert.h>
+// logging.cc needs pthread_mutex_t
+#include <pthread.h>
+// needed for isalpha
+#include <ctype.h>
+// needed for sockaddr_in
+#include <netinet/in.h>
+
+// Implemented in bionic but not exposed.
+extern char* mkdtemp(char* path);
+extern time_t timegm(struct tm* const tmp);
+
+// This will probably need a real implementation.
+#define F_ULOCK 0
+#define F_LOCK 1
+inline int lockf(int fd, int cmd, off_t len) { return -1; }
+
+// We have posix monotonic clocks but don't define this...
+#define _POSIX_MONOTONIC_CLOCK 1
+
+// Disable langinfo in icu
+#define U_GAVE_NL_LANGINFO_CODESET 0
+
+#endif