summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWayne Meissner <wmeissner@gmail.com>2009-12-05 20:05:58 +1000
committerWayne Meissner <wmeissner@gmail.com>2009-12-05 20:05:58 +1000
commit44b39edf2813c40df1d35672ef3f6ac0d9fc214b (patch)
tree4e2bffa0ba6d06bc9d8b72dcdb9dd5ac40fbd4b4
parent2383bb405a791ee3d0107d19d8ea32b919e20f58 (diff)
downloadffi-44b39edf2813c40df1d35672ef3f6ac0d9fc214b.tar.gz
Fixup compilation problems with ruby trunk on linux
-rw-r--r--ext/ffi_c/AbstractMemory.c2
-rw-r--r--ext/ffi_c/Struct.c2
-rw-r--r--ext/ffi_c/StructLayout.c2
3 files changed, 3 insertions, 3 deletions
diff --git a/ext/ffi_c/AbstractMemory.c b/ext/ffi_c/AbstractMemory.c
index 088cba6..50a3bad 100644
--- a/ext/ffi_c/AbstractMemory.c
+++ b/ext/ffi_c/AbstractMemory.c
@@ -228,7 +228,7 @@ memory_get_array_of_string(int argc, VALUE* argv, VALUE self)
} else {
checkBounds(ptr, off, sizeof (char*));
- for ( ; off < ptr->size - sizeof (void *); off += sizeof (void *)) {
+ for ( ; off < ptr->size - (long) sizeof (void *); off += (long) sizeof (void *)) {
const char* strptr = *(const char**) (ptr->address + off);
if (strptr == NULL) {
break;
diff --git a/ext/ffi_c/Struct.c b/ext/ffi_c/Struct.c
index 6a6d066..a656f57 100644
--- a/ext/ffi_c/Struct.c
+++ b/ext/ffi_c/Struct.c
@@ -745,7 +745,7 @@ inline_array_to_ptr(VALUE self)
Data_Get_Struct(rbPointer, AbstractMemory, ptr);
// Restrict the size of the pointer so ops like ptr.get_string(0) are bounds checked
- ptr->size = MIN(ptr->size, array->field->type->ffiType->size);
+ ptr->size = MIN(ptr->size, (long) array->field->type->ffiType->size);
return rbPointer;
}
diff --git a/ext/ffi_c/StructLayout.c b/ext/ffi_c/StructLayout.c
index 5af9bd9..85b444f 100644
--- a/ext/ffi_c/StructLayout.c
+++ b/ext/ffi_c/StructLayout.c
@@ -337,7 +337,7 @@ struct_layout_initialize(VALUE self, VALUE field_names, VALUE fields, VALUE size
layout->base.ffiType->alignment = 1;
ltype = layout->base.ffiType;
- for (i = 0; i < layout->fieldCount; ++i) {
+ for (i = 0; i < (int) layout->fieldCount; ++i) {
VALUE rbName = rb_ary_entry(field_names, i);
VALUE rbField = rb_hash_aref(fields, rbName);
StructField* field;