chore: regulate tabs

This commit is contained in:
yosh 2024-02-26 21:27:48 -05:00
parent ce8b864293
commit a9f7e9d447
1 changed files with 15 additions and 15 deletions

View File

@ -25,11 +25,11 @@ die(char *format, ...) {
void void
json_string_stdin(int32_t *doc_size) json_string_stdin(int32_t *doc_size)
{ {
int c; int c;
putchar('"'); putchar('"');
for (c = getchar(); c != 0x00 && c != EOF; c = getchar()) { for (c = getchar(); c != 0x00 && c != EOF; c = getchar()) {
*doc_size -= 1; *doc_size -= 1;
switch (c) { switch (c) {
case '"': case '"':
fputs("\\\"", stdout); fputs("\\\"", stdout);
break; break;
@ -60,7 +60,7 @@ json_string_stdin(int32_t *doc_size)
continue; continue;
} }
putchar(c); putchar(c);
} }
} }
putchar('"'); putchar('"');
*doc_size -= 1; *doc_size -= 1;
@ -125,15 +125,15 @@ print_bson(uint8_t is_array)
size -= 8; size -= 8;
break; break;
case 0x02: case 0x0D: case 0x0E: // string, javascript code, symbol case 0x02: case 0x0D: case 0x0E: // string, javascript code, symbol
fread(&DATA_BUFFER, 4, 1, stdin); fread(&DATA_BUFFER, 4, 1, stdin);
size -= 4; size -= 4;
json_string_stdin(&size); json_string_stdin(&size);
break; break;
case 0x03: // document case 0x03: // document
size -= print_bson(0); size -= print_bson(0);
break; break;
case 0x04: // array case 0x04: // array
size -= print_bson(1); size -= print_bson(1);
break; break;
case 0x05: // binary case 0x05: // binary
fread(&DATA_BUFFER, 4, 1, stdin); fread(&DATA_BUFFER, 4, 1, stdin);
@ -227,8 +227,8 @@ print_bson(uint8_t is_array)
case 0xFF: case 0x7F: // min/max type idc about these case 0xFF: case 0x7F: // min/max type idc about these
fputs("null", stdout); fputs("null", stdout);
break; break;
default: default:
die("bson2json: error: unknown byte for item type. this is most likely the result of some other data bug.\n"); die("bson2json: error: unknown byte for item type. this is most likely the result of some other data bug.\n");
} }
if (size > 1) { if (size > 1) {
putchar(','); putchar(',');