From de27c6e8f75c00cf5f28fdd5d6f8f1acc740320d Mon Sep 17 00:00:00 2001 From: Bibiko Date: Thu, 5 May 2011 16:33:16 +0000 Subject: =?UTF-8?q?=E2=80=A2=20improve=20BIT=20field=20type=20support=20-?= =?UTF-8?q?=20caught=20some=20more=20exceptional=20cases=20-=20re-factored?= =?UTF-8?q?=20byte=20to=20bit=20conversion=20(really=20do=20not=20know=20w?= =?UTF-8?q?hy=20the=20old=20code=20wasn't=20working=20anymore);=20this=20s?= =?UTF-8?q?hould=20fix=20i1042=20-=20disabled=20unisgned/zerofill=20check?= =?UTF-8?q?=20boxes=20in=20Structure=20for=20BIT=20-=20insert=20correct=20?= =?UTF-8?q?default=20BIT=20field=20default=20value=20if=20any=20after=20ad?= =?UTF-8?q?ding=20a=20new=20row=20--=20this=20works=20for=205.5=20but=20fo?= =?UTF-8?q?r=20MySQL=205.0.x=20it=20seems=20that=20providing=20a=20default?= =?UTF-8?q?=20value=20is=20a=20MySQL=20bug=20(further=20checks=20are=20nee?= =?UTF-8?q?ded)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Frameworks/MCPKit/MCPFoundationKit/MCPStreamingResult.m | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'Frameworks') diff --git a/Frameworks/MCPKit/MCPFoundationKit/MCPStreamingResult.m b/Frameworks/MCPKit/MCPFoundationKit/MCPStreamingResult.m index ec4aa44b..bdb271fe 100644 --- a/Frameworks/MCPKit/MCPFoundationKit/MCPStreamingResult.m +++ b/Frameworks/MCPKit/MCPFoundationKit/MCPStreamingResult.m @@ -430,12 +430,22 @@ void _bytes2bin(Byte *n, NSUInteger nbytes, NSUInteger len, char *buf); void _bytes2bin(Byte *n, NSUInteger nbytes, NSUInteger len, char *buf) { + // NSUInteger i = 0; + // nbytes--; + // while (++i <= len) + // buf[len - i] = ( (n[nbytes - (i >> 3)] >> (i & 0x7)) & 1 ) ? '1' : '0'; + // + // buf[len] = '\0'; + // ↑ why does this code not working anymore? + NSUInteger i = 0; nbytes--; - while (++i <= len) - buf[len - i] = ( (n[nbytes - (i >> 3)] >> (i & 0x7)) & 1 ) ? '1' : '0'; + len--; + while (i <= len) + buf[len - i++] = ( (n[nbytes - (i >> 3)] >> (i & 0x7)) & 1 ) ? '1' : '0'; + + buf[len+1] = '\0'; - buf[len] = '\0'; } /** -- cgit v1.2.3