ext/kcar/kcar.c in kcar-0.1.2 vs ext/kcar/kcar.c in kcar-0.2.0
- old
+ new
@@ -175,13 +175,13 @@
const char *buffer, const char *p)
{
VALUE f, v;
VALUE hclass;
const char *fptr = PTR_TO(start.field);
- long flen = hp->s.field_len;
+ size_t flen = hp->s.field_len;
const char *vptr;
- long vlen;
+ size_t vlen;
HP_FL_SET(hp, HASHEADER);
/* Rack does not like Status headers, so we never send them */
if (CSTR_CASE_EQ(fptr, flen, "status")) {
@@ -191,12 +191,12 @@
vptr = PTR_TO(mark);
vlen = LEN(mark, p);
VALIDATE_MAX_LENGTH(vlen, FIELD_VALUE);
VALIDATE_MAX_LENGTH(flen, FIELD_NAME);
- f = rb_str_new(fptr, flen);
- v = rb_str_new(vptr, vlen);
+ f = rb_str_new(fptr, (long)flen);
+ v = rb_str_new(vptr, (long)vlen);
/* needs more tests for error-checking here */
/*
* TODO:
* some of these tests might be too strict for real-world HTTP servers,
@@ -1370,12 +1370,10 @@
*/
static VALUE headers(VALUE self, VALUE hdr, VALUE data)
{
struct http_parser *hp = data_get(self);
- rb_str_update(data);
-
http_parser_execute(hp, hdr, RSTRING_PTR(data), RSTRING_LEN(data));
VALIDATE_MAX_LENGTH(hp->offset, HEADER);
if (hp->cs == http_parser_first_final ||
hp->cs == http_parser_en_ChunkedBody) {
@@ -1470,10 +1468,9 @@
{
struct http_parser *hp = data_get(self);
char *dptr;
long dlen;
- rb_str_update(data);
dptr = RSTRING_PTR(data);
dlen = RSTRING_LEN(data);
StringValue(buf);
rb_str_resize(buf, dlen); /* we can never copy more than dlen bytes */