Fix handling of short types in FFI bridge

As reported in external bug 15349, we were being a bit sloppy in
our handling of sub-32-bit types, assuming they could be treated
as 32 bit values.

Bug 4080070

Change-Id: I3d2e014342d7ff4e1544e37666680eb05aba37e6
diff --git a/vm/arch/generic/Call.c b/vm/arch/generic/Call.c
index a39b761..ae74415 100644
--- a/vm/arch/generic/Call.c
+++ b/vm/arch/generic/Call.c
@@ -13,6 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 /*
  * This uses the FFI (Foreign Function Interface) library to abstract away
  * the system-dependent stuff.  The FFI code is slower than a custom
@@ -29,12 +30,20 @@
 {
     switch (sigType) {
     case 'V': return &ffi_type_void;
+    case 'Z': return &ffi_type_uint8;
+    case 'B': return &ffi_type_sint8;
+    case 'C': return &ffi_type_uint16;
+    case 'S': return &ffi_type_sint16;
+    case 'I': return &ffi_type_sint32;
     case 'F': return &ffi_type_float;
-    case 'D': return &ffi_type_double;
     case 'J': return &ffi_type_sint64;
+    case 'D': return &ffi_type_double;
     case '[':
     case 'L': return &ffi_type_pointer;
-    default:  return &ffi_type_uint32;
+    default:
+        LOGE("bad ffitype 0x%02x\n", sigType);
+        dvmAbort();
+        return NULL;
     }
 }
 
@@ -63,7 +72,6 @@
     ffi_type* types[kMaxArgs];
     void* values[kMaxArgs];
     ffi_type* retType;
-    const char* sig;
     char sigByte;
     int srcArg, dstArg;