Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(244)

Unified Diff: third_party/hwcplus/src/stub.c

Issue 252583002: Make it possible to build libhardware. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@hwc2
Patch Set: clean up more lint Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« third_party/hwcplus/src/hardware.c ('K') | « third_party/hwcplus/src/hardware.c ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/hwcplus/src/stub.c
diff --git a/third_party/hwcplus/src/stub.c b/third_party/hwcplus/src/stub.c
new file mode 100644
index 0000000000000000000000000000000000000000..533dcedf007e548faccf1db3a11d5b97f0cfdc86
--- /dev/null
+++ b/third_party/hwcplus/src/stub.c
@@ -0,0 +1,56 @@
+#include "stub.h"
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <cutils/properties.h>
+
+size_t
+strlcpy(char* dst, const char* src, size_t siz) {
+ char* d = dst;
+ const char* s = src;
+ size_t n = siz;
+
+ /* Copy as many bytes as will fit */
+ if (n != 0) {
+ while (--n != 0) {
+ if ((*d++ = *s++) == '\0')
+ break;
+ }
+ }
+
+ /* Not enough room in dst, add NUL and traverse rest of src */
+ if (n == 0) {
+ if (siz != 0)
+ *d = '\0'; /* NUL-terminate dst */
+ while (*s++) {
+ }
+ }
+
+ return(s - src - 1); /* count does not include NUL */
+}
+
+int __android_log_print(int prio, const char* tag, const char* fmt, ...) {
+ char buf[999];
+ int pos = 0;
+ va_list args;
+
+ va_start(args, fmt);
+ pos += snprintf(buf+pos, sizeof(buf)-pos, "android_log %d %s: ", prio, tag);
+ pos += vsnprintf(buf+pos, sizeof(buf)-pos, fmt, args);
+ va_end(args);
+ buf[sizeof(buf)-1] = 0;
+ fprintf(stderr, "%s\n", buf);
+ return pos;
+}
+
+int property_get(const char* key, char* value, const char* default_value) {
+ printf("property_get %s\n", key);
+ const char* r = default_value;
+ if (!r)
+ r = "";
+ strncpy(value, r, PROPERTY_VALUE_MAX);
+ return strlen(r);
+}
+
« third_party/hwcplus/src/hardware.c ('K') | « third_party/hwcplus/src/hardware.c ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698