summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoug Zongker <dougz@android.com>2014-02-18 18:48:19 +0100
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-02-18 18:48:19 +0100
commitf2ff0a2097cd945a612fb461741b803d2b5aca7a (patch)
tree7bc57a86cbf178d77f4790f76fa2e59d69defa7a
parentMerge "Fix a crash when going into recovery mode." (diff)
parentclean up some warnings when building recovery (diff)
downloadandroid_bootable_recovery-f2ff0a2097cd945a612fb461741b803d2b5aca7a.tar
android_bootable_recovery-f2ff0a2097cd945a612fb461741b803d2b5aca7a.tar.gz
android_bootable_recovery-f2ff0a2097cd945a612fb461741b803d2b5aca7a.tar.bz2
android_bootable_recovery-f2ff0a2097cd945a612fb461741b803d2b5aca7a.tar.lz
android_bootable_recovery-f2ff0a2097cd945a612fb461741b803d2b5aca7a.tar.xz
android_bootable_recovery-f2ff0a2097cd945a612fb461741b803d2b5aca7a.tar.zst
android_bootable_recovery-f2ff0a2097cd945a612fb461741b803d2b5aca7a.zip
Diffstat (limited to '')
-rw-r--r--Android.mk2
-rw-r--r--edify/Android.mk2
-rw-r--r--edify/expr.c2
-rw-r--r--edify/expr.h2
-rw-r--r--edify/main.c7
-rw-r--r--edify/parser.y9
-rw-r--r--recovery.cpp2
-rw-r--r--updater/Android.mk1
-rw-r--r--updater/install.c6
-rw-r--r--updater/updater.c3
10 files changed, 23 insertions, 13 deletions
diff --git a/Android.mk b/Android.mk
index 9773d5e83..c910e7db7 100644
--- a/Android.mk
+++ b/Android.mk
@@ -35,6 +35,7 @@ LOCAL_FORCE_STATIC_EXECUTABLE := true
RECOVERY_API_VERSION := 3
RECOVERY_FSTAB_VERSION := 2
LOCAL_CFLAGS += -DRECOVERY_API_VERSION=$(RECOVERY_API_VERSION)
+LOCAL_CFLAGS += -Wno-unused-parameter
LOCAL_STATIC_LIBRARIES := \
libext4_utils_static \
@@ -90,6 +91,7 @@ LOCAL_MODULE := verifier_test
LOCAL_FORCE_STATIC_EXECUTABLE := true
LOCAL_MODULE_TAGS := tests
LOCAL_CFLAGS += -DNO_RECOVERY_MOUNT
+LOCAL_CFLAGS += -Wno-unused-parameter
LOCAL_SRC_FILES := \
verifier_test.cpp \
asn1_decoder.cpp \
diff --git a/edify/Android.mk b/edify/Android.mk
index fac0ba712..61ed6fa17 100644
--- a/edify/Android.mk
+++ b/edify/Android.mk
@@ -23,6 +23,7 @@ LOCAL_SRC_FILES := \
LOCAL_CFLAGS := $(edify_cflags) -g -O0
LOCAL_MODULE := edify
LOCAL_YACCFLAGS := -v
+LOCAL_CFLAGS += -Wno-unused-parameter
include $(BUILD_HOST_EXECUTABLE)
@@ -34,6 +35,7 @@ include $(CLEAR_VARS)
LOCAL_SRC_FILES := $(edify_src_files)
LOCAL_CFLAGS := $(edify_cflags)
+LOCAL_CFLAGS += -Wno-unused-parameter
LOCAL_MODULE := libedify
include $(BUILD_STATIC_LIBRARY)
diff --git a/edify/expr.c b/edify/expr.c
index a2f1f99d7..79f6282d8 100644
--- a/edify/expr.c
+++ b/edify/expr.c
@@ -287,13 +287,11 @@ Value* LessThanIntFn(const char* name, State* state, int argc, Expr* argv[]) {
long l_int = strtol(left, &end, 10);
if (left[0] == '\0' || *end != '\0') {
- printf("[%s] is not an int\n", left);
goto done;
}
long r_int = strtol(right, &end, 10);
if (right[0] == '\0' || *end != '\0') {
- printf("[%s] is not an int\n", right);
goto done;
}
diff --git a/edify/expr.h b/edify/expr.h
index 0d8ed8f57..a9ed2f9c5 100644
--- a/edify/expr.h
+++ b/edify/expr.h
@@ -164,6 +164,8 @@ Value* StringValue(char* str);
// Free a Value object.
void FreeValue(Value* v);
+int parse_string(const char* str, Expr** root, int* error_count);
+
#ifdef __cplusplus
} // extern "C"
#endif
diff --git a/edify/main.c b/edify/main.c
index 9e6bab7ca..b3fad53b8 100644
--- a/edify/main.c
+++ b/edify/main.c
@@ -30,9 +30,7 @@ int expect(const char* expr_str, const char* expected, int* errors) {
printf(".");
- yy_scan_string(expr_str);
- int error_count = 0;
- error = yyparse(&e, &error_count);
+ int error_count = parse_string(expr_str, &e, &error_count);
if (error > 0 || error_count > 0) {
printf("error parsing \"%s\" (%d errors)\n",
expr_str, error_count);
@@ -193,8 +191,7 @@ int main(int argc, char** argv) {
Expr* root;
int error_count = 0;
- yy_scan_bytes(buffer, size);
- int error = yyparse(&root, &error_count);
+ int error = parse_string(buffer, &root, &error_count);
printf("parse returned %d; %d errors encountered\n", error, error_count);
if (error == 0 || error_count > 0) {
diff --git a/edify/parser.y b/edify/parser.y
index 3f9ade144..f8fb2d12f 100644
--- a/edify/parser.y
+++ b/edify/parser.y
@@ -29,6 +29,10 @@ extern int gColumn;
void yyerror(Expr** root, int* error_count, const char* s);
int yyparse(Expr** root, int* error_count);
+struct yy_buffer_state;
+void yy_switch_to_buffer(struct yy_buffer_state* new_buffer);
+struct yy_buffer_state* yy_scan_string(const char* yystr);
+
%}
%locations
@@ -128,3 +132,8 @@ void yyerror(Expr** root, int* error_count, const char* s) {
printf("line %d col %d: %s\n", gLine, gColumn, s);
++*error_count;
}
+
+int parse_string(const char* str, Expr** root, int* error_count) {
+ yy_switch_to_buffer(yy_scan_string(str));
+ return yyparse(root, error_count);
+}
diff --git a/recovery.cpp b/recovery.cpp
index 0a8c3b52f..db35f1e97 100644
--- a/recovery.cpp
+++ b/recovery.cpp
@@ -980,7 +980,7 @@ main(int argc, char **argv) {
load_locale_from_cache();
}
printf("locale is [%s]\n", locale);
- printf("stage is [%s]\n", stage, stage);
+ printf("stage is [%s]\n", stage);
Device* device = make_device();
ui = device->GetUI();
diff --git a/updater/Android.mk b/updater/Android.mk
index ebcfef15b..99b489029 100644
--- a/updater/Android.mk
+++ b/updater/Android.mk
@@ -20,6 +20,7 @@ LOCAL_SRC_FILES := $(updater_src_files)
ifeq ($(TARGET_USERIMAGES_USE_EXT4), true)
LOCAL_CFLAGS += -DUSE_EXT4
+LOCAL_CFLAGS += -Wno-unused-parameter
LOCAL_C_INCLUDES += system/extras/ext4_utils
LOCAL_STATIC_LIBRARIES += \
libext4_utils_static \
diff --git a/updater/install.c b/updater/install.c
index e85ba50ae..ccafad9c2 100644
--- a/updater/install.c
+++ b/updater/install.c
@@ -52,7 +52,7 @@
#endif
// Take a sha-1 digest and return it as a newly-allocated hex string.
-static char* PrintSha1(uint8_t* digest) {
+static char* PrintSha1(const uint8_t* digest) {
char* buffer = malloc(SHA_DIGEST_SIZE*2 + 1);
int i;
const char* alphabet = "0123456789abcdef";
@@ -1115,9 +1115,9 @@ Value* SysPatchFn(const char* name, State* state, int argc, Expr* argv[]) {
pos += read;
}
rewind(src);
- uint8_t* digest = SHA_final(&ctx);
+ const uint8_t* digest = SHA_final(&ctx);
- char* hexdigest = PrintSha1(digest);
+ const char* hexdigest = PrintSha1(digest);
printf(" system partition sha1 = %s\n", hexdigest);
if (memcmp(digest, target_digest, SHA_DIGEST_SIZE) == 0) {
diff --git a/updater/updater.c b/updater/updater.c
index 4e1cc9c38..b7af3e500 100644
--- a/updater/updater.c
+++ b/updater/updater.c
@@ -105,8 +105,7 @@ int main(int argc, char** argv) {
Expr* root;
int error_count = 0;
- yy_scan_string(script);
- int error = yyparse(&root, &error_count);
+ int error = parse_string(script, &root, &error_count);
if (error != 0 || error_count > 0) {
printf("%d parse errors\n", error_count);
return 6;