[automerger] Add some error/overflow checks in codebook handling am: 6eb63e1192 am: bc4bde3bee am: 632704bab3 am: 9cea7b942e am: 57035e3928
am: 6d0e814689

Change-Id: Iacbe4d702264830d6780786fe72c4ae120a0ccf0
diff --git a/Android.bp b/Android.bp
new file mode 100644
index 0000000..e9e3f98
--- /dev/null
+++ b/Android.bp
@@ -0,0 +1,61 @@
+cc_library_shared {
+    name: "libvorbisidec",
+
+    srcs: [
+        "Tremolo/bitwise.c",
+        "Tremolo/codebook.c",
+        "Tremolo/dsp.c",
+        "Tremolo/floor0.c",
+        "Tremolo/floor1.c",
+        "Tremolo/floor_lookup.c",
+        "Tremolo/framing.c",
+        "Tremolo/mapping0.c",
+        "Tremolo/mdct.c",
+        "Tremolo/misc.c",
+        "Tremolo/res012.c",
+        "Tremolo/treminfo.c",
+        "Tremolo/vorbisfile.c",
+    ],
+
+    arch: {
+        arm: {
+            srcs: [
+                "Tremolo/bitwiseARM.s",
+                "Tremolo/dpen.s",
+                "Tremolo/floor1ARM.s",
+                "Tremolo/mdctARM.s",
+            ],
+            cflags: ["-D_ARM_ASSEM_"],
+            // Assembly code in asm_arm.h does not compile with Clang.
+            clang_asflags: ["-no-integrated-as"],
+
+            instruction_set: "arm",
+        },
+        arm64: {
+            cflags: ["-DONLY_C"],
+        },
+        mips: {
+            cflags: ["-DONLY_C"],
+        },
+        mips64: {
+            cflags: ["-DONLY_C"],
+        },
+        x86: {
+            cflags: ["-DONLY_C"],
+        },
+        x86_64: {
+            cflags: ["-DONLY_C"],
+        },
+    },
+
+    cflags: [
+        "-O2",
+        "-D_GNU_SOURCE",
+        "-funsigned-char",
+    ],
+
+    local_include_dirs: ["Tremolo"],
+    export_include_dirs: ["."],
+
+    shared_libs: ["liblog"],
+}
diff --git a/Android.mk b/Android.mk
deleted file mode 100644
index 6bc8514..0000000
--- a/Android.mk
+++ /dev/null
@@ -1,46 +0,0 @@
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES = \
-	Tremolo/bitwise.c \
-	Tremolo/codebook.c \
-	Tremolo/dsp.c \
-	Tremolo/floor0.c \
-	Tremolo/floor1.c \
-	Tremolo/floor_lookup.c \
-	Tremolo/framing.c \
-	Tremolo/mapping0.c \
-	Tremolo/mdct.c \
-	Tremolo/misc.c \
-	Tremolo/res012.c \
-	Tremolo/treminfo.c \
-	Tremolo/vorbisfile.c
-
-LOCAL_SRC_FILES_arm += \
-	Tremolo/bitwiseARM.s \
-	Tremolo/dpen.s \
-	Tremolo/floor1ARM.s \
-	Tremolo/mdctARM.s
-LOCAL_CFLAGS_arm += \
-    -D_ARM_ASSEM_
-# Assembly code in asm_arm.h does not compile with Clang.
-LOCAL_CLANG_ASFLAGS_arm += \
-    -no-integrated-as
-LOCAL_CFLAGS_arm64 += -DONLY_C
-LOCAL_CFLAGS_mips += -DONLY_C
-LOCAL_CFLAGS_mips64 += -DONLY_C
-LOCAL_CFLAGS_x86 += -DONLY_C
-LOCAL_CFLAGS_x86_64 += -DONLY_C
-
-LOCAL_CFLAGS += -O2 -D_GNU_SOURCE -funsigned-char
-
-LOCAL_C_INCLUDES:= \
-	$(LOCAL_PATH)/Tremolo
-
-LOCAL_SHARED_LIBRARIES := liblog
-
-LOCAL_ARM_MODE := arm
-
-LOCAL_MODULE := libvorbisidec
-
-include $(BUILD_SHARED_LIBRARY)