ext/curb_postfield.c in curb-0.7.8 vs ext/curb_postfield.c in curb-0.7.9
- old
+ new
@@ -107,11 +107,11 @@
rb_raise(eCurlErrInvalidPostField, "Cannot post file upload field with no data");
}
} else {
// is a content field
if (rbcpf->content_proc != Qnil) {
- rbcpf->buffer_str = rb_funcall(rbcpf->content_proc, idCall, self);
+ rbcpf->buffer_str = rb_funcall(rbcpf->content_proc, idCall, 1, self);
if (rbcpf->content_type == Qnil) {
result = curl_formadd(first, last, CURLFORM_PTRNAME, StringValuePtr(rbcpf->name),
CURLFORM_PTRCONTENTS, StringValuePtr(rbcpf->buffer_str),
CURLFORM_CONTENTSLENGTH, RSTRING_LEN(rbcpf->buffer_str),
@@ -207,11 +207,11 @@
* during the perform. The block should return a ruby string with the field
* data.
*/
static VALUE ruby_curl_postfield_new_content(int argc, VALUE *argv, VALUE klass) {
ruby_curl_postfield *rbcpf = ALLOC(ruby_curl_postfield);
-
+
// wierdness - we actually require two args, unless a block is provided, but
// we have to work that out below.
rb_scan_args(argc, argv, "12&", &rbcpf->name, &rbcpf->content, &rbcpf->content_type, &rbcpf->content_proc);
// special handling if theres a block, second arg is actually content_type
@@ -441,11 +441,11 @@
}
if (name == Qnil) {
rb_raise(eCurlErrInvalidPostField, "Cannot convert unnamed field to string %s:%d, make sure your field name responds_to :to_s", __FILE__, __LINE__);
}
- char *tmpchrs = curl_escape(StringValuePtr(name), RSTRING_LEN(name));
+ char *tmpchrs = curl_escape(StringValuePtr(name), (int)RSTRING_LEN(name));
if (!tmpchrs) {
rb_raise(eCurlErrInvalidPostField, "Failed to url-encode name `%s'", tmpchrs);
} else {
VALUE tmpcontent = Qnil;
@@ -470,10 +470,10 @@
else {
rb_raise(rb_eRuntimeError, "postfield(%s) is not a string and does not respond_to to_s", RSTRING_PTR(escd_name) );
}
}
//fprintf(stderr, "encoding content: %ld - %s\n", RSTRING_LEN(tmpcontent), RSTRING_PTR(tmpcontent) );
- tmpchrs = curl_escape(RSTRING_PTR(tmpcontent), RSTRING_LEN(tmpcontent));
+ tmpchrs = curl_escape(RSTRING_PTR(tmpcontent), (int)RSTRING_LEN(tmpcontent));
if (!tmpchrs) {
rb_raise(eCurlErrInvalidPostField, "Failed to url-encode content `%s'", tmpchrs);
} else {
VALUE escd_content = rb_str_new2(tmpchrs);
curl_free(tmpchrs);