pretty-printing


git-svn-id: https://asn1c.svn.sourceforge.net/svnroot/asn1c/trunk@386 59561ff5-6e30-0410-9f3c-9617f08c8826
diff --git a/skeletons/BIT_STRING.c b/skeletons/BIT_STRING.c
index c3788d8..274dec9 100644
--- a/skeletons/BIT_STRING.c
+++ b/skeletons/BIT_STRING.c
@@ -107,11 +107,13 @@
 		p += 8;
 	}
 
-	er.encoded += p - scratch;
 	if(!xcan && (((buf - st->buf) - 1) % 8) == 0)
 		_i_ASN_TEXT_INDENT(1, ilevel);
+	er.encoded += p - scratch;
+	_ASN_CALLBACK(scratch, p - scratch);
+	p = scratch;
 
-	if(buf < end + 1) {
+	if(buf == end) {
 		int v = *buf;
 		int mbit = st->buf[0];	/* bits to skip from the right */
 		int i;
@@ -121,8 +123,7 @@
 		_ASN_CALLBACK(scratch, p - scratch);
 	}
 
-	if(!xcan && ((st->size - 1) % 8) == 0)
-		_i_ASN_TEXT_INDENT(1, ilevel - 1);
+	if(!xcan) _i_ASN_TEXT_INDENT(1, ilevel - 1);
 
 	return er;
 }