- added some debug code for network protocol

This commit is contained in:
Mark Vejvoda 2012-11-03 04:00:06 +00:00
parent d0b2f14513
commit 79037e9381

View File

@ -266,6 +266,8 @@ unsigned int pack(unsigned char *buf, const char *format, ...) {
size += 1; size += 1;
c = (signed char)va_arg(ap, int); // promoted c = (signed char)va_arg(ap, int); // promoted
*buf++ = c; *buf++ = c;
printf("pack int8 = %d [%X] c = %d [%X] \n",*(buf-1),*(buf-1),c,c);
break; break;
case 'C': // 8-bit unsigned case 'C': // 8-bit unsigned
@ -424,7 +426,7 @@ unsigned int unpack(unsigned char *buf, const char *format, ...) {
*c = *buf++; *c = *buf++;
size += 1; size += 1;
printf("unpack int8 = %d [%X] c = %d [%X] c2 = %d [%X]\n",*(buf-1),*(buf-1),*c,(-1 - (unsigned char)(0xffu - *(buf-1)))); printf("unpack int8 = %d [%X] c = %d [%X] c2 = %d [%X]\n",*(buf-1),*(buf-1),*c,*c, (-1 - (unsigned char)(0xffu - *(buf-1))),(-1 - (unsigned char)(0xffu - *(buf-1))));
break; break;
case 'C': // 8-bit unsigned case 'C': // 8-bit unsigned