Bug #1273 ยป pack.patch
pack.c (working copy) | ||
---|---|---|
char c;
|
||
from = NEXTFROM;
|
||
c = num2i32(from);
|
||
c = (char)num2i32(from);
|
||
rb_str_buf_cat(res, &c, sizeof(char));
|
||
}
|
||
break;
|
||
... | ... | |
short s;
|
||
from = NEXTFROM;
|
||
s = num2i32(from);
|
||
s = (short)num2i32(from);
|
||
rb_str_buf_cat(res, OFF16(&s), NATINT_LEN(short,2));
|
||
}
|
||
break;
|
||
... | ... | |
unsigned short s;
|
||
from = NEXTFROM;
|
||
s = num2i32(from);
|
||
s = (unsigned short)num2i32(from);
|
||
s = NATINT_HTONS(s);
|
||
rb_str_buf_cat(res, OFF16(&s), NATINT_LEN(short,2));
|
||
}
|
||
... | ... | |
unsigned short s;
|
||
from = NEXTFROM;
|
||
s = num2i32(from);
|
||
s = (unsigned short)num2i32(from);
|
||
s = NATINT_HTOVS(s);
|
||
rb_str_buf_cat(res, OFF16(&s), NATINT_LEN(short,2));
|
||
}
|
||
... | ... | |
float f;
|
||
from = NEXTFROM;
|
||
f = RFLOAT_VALUE(rb_to_float(from));
|
||
f = (float)RFLOAT_VALUE(rb_to_float(from));
|
||
rb_str_buf_cat(res, (char*)&f, sizeof(float));
|
||
}
|
||
break;
|
||
... | ... | |
FLOAT_CONVWITH(ftmp);
|
||
from = NEXTFROM;
|
||
f = RFLOAT_VALUE(rb_to_float(from));
|
||
f = (float)RFLOAT_VALUE(rb_to_float(from));
|
||
f = HTOVF(f,ftmp);
|
||
rb_str_buf_cat(res, (char*)&f, sizeof(float));
|
||
}
|
||
... | ... | |
FLOAT_CONVWITH(ftmp);
|
||
from = NEXTFROM;
|
||
f = RFLOAT_VALUE(rb_to_float(from));
|
||
f = (float)RFLOAT_VALUE(rb_to_float(from));
|
||
f = HTONF(f,ftmp);
|
||
rb_str_buf_cat(res, (char*)&f, sizeof(float));
|
||
}
|
||
... | ... | |
int padding;
|
||
if (type == 'u') {
|
||
buff[i++] = len + ' ';
|
||
buff[i++] = (char)len + ' ';
|
||
padding = '`';
|
||
}
|
||
else {
|
||
... | ... | |
#define PACK_LENGTH_ADJUST_SIZE(sz) do { \
|
||
tmp = 0; \
|
||
if (len > (send-s)/sz) { \
|
||
if (len > (long)((send-s)/sz)) { \
|
||
if (!star) { \
|
||
tmp = len-(send-s)/sz; \
|
||
} \
|
||
... | ... | |
d = (*s++ - ' ') & 077;
|
||
else
|
||
d = 0;
|
||
hunk[0] = a << 2 | b >> 4;
|
||
hunk[1] = b << 4 | c >> 2;
|
||
hunk[2] = c << 6 | d;
|
||
hunk[0] = (char)(a << 2 | b >> 4);
|
||
hunk[1] = (char)(b << 4 | c >> 2);
|
||
hunk[2] = (char)(c << 6 | d);
|
||
memcpy(ptr, hunk, mlen);
|
||
ptr += mlen;
|
||
len -= mlen;
|
||
... | ... | |
break;
|
||
case 'p':
|
||
if (len > (send - s) / sizeof(char *))
|
||
if (len > (long)((send - s) / sizeof(char *)))
|
||
len = (send - s) / sizeof(char *);
|
||
while (len-- > 0) {
|
||
if (send - s < sizeof(char *))
|