- state->putchar_func(state->ctx, '\n');
- state->putchar_func(state->ctx, '=');
- state->putchar_func(state->ctx, encode64(state->crc24 >> 18));
- state->putchar_func(state->ctx, encode64((state->crc24 >> 12) & 0x3F));
- state->putchar_func(state->ctx, encode64((state->crc24 >> 6) & 0x3F));
- state->putchar_func(state->ctx, encode64(state->crc24 & 0x3F));
- state->putchar_func(state->ctx, '\n');
+ if ((state->count % ARMOR_WIDTH) != 0) {
+ state->putchar_func(state->ctx, 1, (unsigned char *) "\n");
+ }
+ state->putchar_func(state->ctx, 1, (unsigned char *) "=");
+ c = encode64(state->crc24 >> 18);
+ state->putchar_func(state->ctx, 1, &c);
+ c = encode64((state->crc24 >> 12) & 0x3F);
+ state->putchar_func(state->ctx, 1, &c);
+ c = encode64((state->crc24 >> 6) & 0x3F);
+ state->putchar_func(state->ctx, 1, &c);
+ c = encode64(state->crc24 & 0x3F);
+ state->putchar_func(state->ctx, 1, &c);
+ state->putchar_func(state->ctx, 1, (unsigned char *) "\n");