- int prec = 0;
- char ch;
-
- for (bool done = false; !done; percent++) {
- switch (ch = percent[0]) {
- /* type of types or other */
- case 'l': // longer
- type++;
- break;
-
- case 'h': // shorter
- type--;
- break;
-
- case 'z':
- type = OST_SIZE;
- break;
-
- case 'j':
- type = OST_INTMAX;
- break;
-
- case 't':
- type = OST_PTRDIFF;
- break;
-
- case '.': // precision
- if ((percent[1]) == '*') {
- prec = va_arg(args, int);
- _os_log_encode_arg(&prec, sizeof(prec), OS_LOG_BUFFER_VALUE_TYPE_COUNT, false, context);
- percent++;
- continue;
- } else {
- // we have to read the precision and do the right thing
- const char *fmt = percent + 1;
- prec = 0;
- while (isdigit(ch = *fmt++)) {
- prec = 10 * prec + (ch - '0');
- }
-
- if (prec > 1024) {
- prec = 1024;
- }
-
- _os_log_encode_arg(&prec, sizeof(prec), OS_LOG_BUFFER_VALUE_TYPE_COUNT, false, context);
- }
- break;
-
- case '-': // left-align
- case '+': // force sign
- case ' ': // prefix non-negative with space
- case '#': // alternate
- case '\'': // group by thousands
- break;
-
- /* fixed types */
- case 'd': // integer
- case 'i': // integer
- case 'o': // octal
- case 'u': // unsigned
- case 'x': // hex
- case 'X': // upper-hex
- switch (type) {
- case OST_CHAR:
- value.type.ch = va_arg(args, int);
- _os_log_encode_arg(&value.type.ch, sizeof(value.type.ch), OS_LOG_BUFFER_VALUE_TYPE_SCALAR, false, context);
- break;
-
- case OST_SHORT:
- value.type.s = va_arg(args, int);
- _os_log_encode_arg(&value.type.s, sizeof(value.type.s), OS_LOG_BUFFER_VALUE_TYPE_SCALAR, false, context);
- break;
-
- case OST_INT:
- value.type.i = va_arg(args, int);
- _os_log_encode_arg(&value.type.i, sizeof(value.type.i), OS_LOG_BUFFER_VALUE_TYPE_SCALAR, false, context);
- break;
-
- case OST_LONG:
- value.type.l = va_arg(args, long);
- _os_log_encode_arg(&value.type.l, sizeof(value.type.l), OS_LOG_BUFFER_VALUE_TYPE_SCALAR, false, context);
- break;
-
- case OST_LONGLONG:
- value.type.ll = va_arg(args, long long);
- _os_log_encode_arg(&value.type.ll, sizeof(value.type.ll), OS_LOG_BUFFER_VALUE_TYPE_SCALAR, false, context);
- break;
-
- case OST_SIZE:
- value.type.z = va_arg(args, size_t);
- _os_log_encode_arg(&value.type.z, sizeof(value.type.z), OS_LOG_BUFFER_VALUE_TYPE_SCALAR, false, context);
- break;
-
- case OST_INTMAX:
- value.type.im = va_arg(args, intmax_t);
- _os_log_encode_arg(&value.type.im, sizeof(value.type.im), OS_LOG_BUFFER_VALUE_TYPE_SCALAR, false, context);
- break;
-
- case OST_PTRDIFF:
- value.type.pd = va_arg(args, ptrdiff_t);
- _os_log_encode_arg(&value.type.pd, sizeof(value.type.pd), OS_LOG_BUFFER_VALUE_TYPE_SCALAR, false, context);
- break;
-
- default:
- return false;
- }
- done = true;
- break;
-
+ int prec = 0;
+ char ch;
+
+ for (bool done = false; !done; percent++) {
+ switch (ch = percent[0]) {
+ /* type of types or other */
+ case 'l': // longer
+ type++;
+ break;
+
+ case 'h': // shorter
+ type--;
+ break;
+
+ case 'z':
+ type = OST_SIZE;
+ break;
+
+ case 'j':
+ type = OST_INTMAX;
+ break;
+
+ case 't':
+ type = OST_PTRDIFF;
+ break;
+
+ case '.': // precision
+ if ((percent[1]) == '*') {
+ prec = va_arg(args, int);
+ _os_log_encode_arg(&prec, sizeof(prec), OS_LOG_BUFFER_VALUE_TYPE_COUNT, false, context);
+ percent++;
+ continue;
+ } else {
+ // we have to read the precision and do the right thing
+ const char *fmt = percent + 1;
+ prec = 0;
+ while (isdigit(ch = *fmt++)) {
+ prec = 10 * prec + (ch - '0');
+ }
+
+ if (prec > 1024) {
+ prec = 1024;
+ }
+
+ _os_log_encode_arg(&prec, sizeof(prec), OS_LOG_BUFFER_VALUE_TYPE_COUNT, false, context);
+ }
+ break;
+
+ case '-': // left-align
+ case '+': // force sign
+ case ' ': // prefix non-negative with space
+ case '#': // alternate
+ case '\'': // group by thousands
+ break;
+
+ /* fixed types */
+ case 'd': // integer
+ case 'i': // integer
+ case 'o': // octal
+ case 'u': // unsigned
+ case 'x': // hex
+ case 'X': // upper-hex
+ switch (type) {
+ case OST_CHAR:
+ value.type.ch = va_arg(args, int);
+ _os_log_encode_arg(&value.type.ch, sizeof(value.type.ch), OS_LOG_BUFFER_VALUE_TYPE_SCALAR, false, context);
+ break;
+
+ case OST_SHORT:
+ value.type.s = va_arg(args, int);
+ _os_log_encode_arg(&value.type.s, sizeof(value.type.s), OS_LOG_BUFFER_VALUE_TYPE_SCALAR, false, context);
+ break;
+
+ case OST_INT:
+ value.type.i = va_arg(args, int);
+ _os_log_encode_arg(&value.type.i, sizeof(value.type.i), OS_LOG_BUFFER_VALUE_TYPE_SCALAR, false, context);
+ break;
+
+ case OST_LONG:
+ value.type.l = va_arg(args, long);
+ _os_log_encode_arg(&value.type.l, sizeof(value.type.l), OS_LOG_BUFFER_VALUE_TYPE_SCALAR, false, context);
+ break;
+
+ case OST_LONGLONG:
+ value.type.ll = va_arg(args, long long);
+ _os_log_encode_arg(&value.type.ll, sizeof(value.type.ll), OS_LOG_BUFFER_VALUE_TYPE_SCALAR, false, context);
+ break;
+
+ case OST_SIZE:
+ value.type.z = va_arg(args, size_t);
+ _os_log_encode_arg(&value.type.z, sizeof(value.type.z), OS_LOG_BUFFER_VALUE_TYPE_SCALAR, false, context);
+ break;
+
+ case OST_INTMAX:
+ value.type.im = va_arg(args, intmax_t);
+ _os_log_encode_arg(&value.type.im, sizeof(value.type.im), OS_LOG_BUFFER_VALUE_TYPE_SCALAR, false, context);
+ break;
+
+ case OST_PTRDIFF:
+ value.type.pd = va_arg(args, ptrdiff_t);
+ _os_log_encode_arg(&value.type.pd, sizeof(value.type.pd), OS_LOG_BUFFER_VALUE_TYPE_SCALAR, false, context);
+ break;
+
+ default:
+ return false;
+ }
+ done = true;
+ break;
+