minor: fix extension compile errors

This commit is contained in:
Tyler Brock 2012-06-01 13:09:47 -04:00
parent 65a1ecc42d
commit ad8a933cd4
3 changed files with 9 additions and 5 deletions

View File

@ -126,7 +126,7 @@ static void write_utf8(bson_buffer_t buffer, VALUE string, char check_null) {
rb_raise(InvalidStringEncoding, "String not valid UTF-8"); rb_raise(InvalidStringEncoding, "String not valid UTF-8");
} }
string = TO_UTF8(string); string = TO_UTF8(string);
SAFE_WRITE(buffer, RSTRING_PTR(string), RSTRING_LEN(string)); SAFE_WRITE(buffer, RSTRING_PTR(string), (int)RSTRING_LEN(string));
} }
// this sucks. but for some reason these moved around between 1.8 and 1.9 // this sucks. but for some reason these moved around between 1.8 and 1.9
@ -436,10 +436,14 @@ static int write_element(VALUE key, VALUE value, VALUE extra, int allow_id) {
break; break;
} }
if (strcmp(cls, "BSON::Timestamp") == 0) { if (strcmp(cls, "BSON::Timestamp") == 0) {
unsigned int seconds;
unsigned int increment;
write_name_and_type(buffer, key, 0x11); write_name_and_type(buffer, key, 0x11);
unsigned int seconds = NUM2UINT(
seconds = NUM2UINT(
rb_funcall(value, rb_intern("seconds"), 0)); rb_funcall(value, rb_intern("seconds"), 0));
unsigned int increment = NUM2UINT( increment = NUM2UINT(
rb_funcall(value, rb_intern("increment"), 0)); rb_funcall(value, rb_intern("increment"), 0));
SAFE_WRITE(buffer, (const char*)&increment, 4); SAFE_WRITE(buffer, (const char*)&increment, 4);

View File

@ -87,7 +87,7 @@ static unsigned char isLegalUTF8(const unsigned char* source, int length) {
return 1; return 1;
} }
result_t check_string(const unsigned char* string, const int length, result_t check_string(const unsigned char* string, const long length,
const char check_utf8, const char check_null) { const char check_utf8, const char check_null) {
int position = 0; int position = 0;
/* By default we go character by character. Will be different for checking /* By default we go character by character. Will be different for checking

View File

@ -23,7 +23,7 @@ typedef enum {
HAS_NULL HAS_NULL
} result_t; } result_t;
result_t check_string(const unsigned char* string, const int length, result_t check_string(const unsigned char* string, const long length,
const char check_utf8, const char check_null); const char check_utf8, const char check_null);
#endif #endif