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