Permalink
Browse files

Cast malloc

  • Loading branch information...
1 parent d3e45f5 commit 1c1e2b6631afedbf2a79edfaef017eabd92f0853 @joshuaclayton committed Mar 23, 2011
Showing with 4 additions and 4 deletions.
  1. +1 −1 ext/faststep/bson_ruby_conversion.c
  2. +2 −2 ext/faststep/connection.c
  3. +1 −1 ext/faststep/db.c
@@ -2,7 +2,7 @@
#include "faststep_defines.h"
bson* create_bson_from_ruby_hash(const VALUE hash) {
- bson* document = bson_malloc(sizeof(bson));
+ bson* document = (bson*)bson_malloc(sizeof(bson));
if(NIL_P(hash)) {
bson_empty(document);
@@ -31,7 +31,7 @@ static VALUE faststep_connection_init(VALUE self, const VALUE host, const VALUE
}
static VALUE faststep_connection_new(VALUE class, const VALUE host, const VALUE port) {
- mongo_connection* conn = bson_malloc(sizeof(mongo_connection));
+ mongo_connection* conn = (mongo_connection*)bson_malloc(sizeof(mongo_connection));
VALUE tdata = Data_Wrap_Struct(class, NULL, mongo_destroy, conn);
@@ -45,7 +45,7 @@ static VALUE faststep_connection_new(VALUE class, const VALUE host, const VALUE
}
static VALUE faststep_connection_connect(VALUE self) {
- mongo_connection_options* options = bson_malloc(sizeof(mongo_connection_options));
+ mongo_connection_options* options = (mongo_connection_options*)bson_malloc(sizeof(mongo_connection_options));
strcpy(options->host, RSTRING_PTR(rb_iv_get(self, "@host")));
options->port = NUM2INT(rb_iv_get(self, "@port"));
View
@@ -36,7 +36,7 @@ static VALUE faststep_db_drop(VALUE self) {
static VALUE faststep_db_command(VALUE self, VALUE command) {
mongo_connection* conn = GetFaststepConnection(rb_iv_get(self, "@connection"));
- bson* result = bson_malloc(sizeof(bson));
+ bson* result = (bson*)bson_malloc(sizeof(bson));
bson_init(result, "", 1);
bson* bson_command = create_bson_from_ruby_hash(command);

0 comments on commit 1c1e2b6

Please sign in to comment.