Sets the radix indicator and returns the length of the adjusted string.
| 139 | |
| 140 | // Sets the radix indicator and returns the length of the adjusted string. |
| 141 | int adjust_prefix(int radix, int rev, bool is_neg, char* const rc) |
| 142 | { |
| 143 | int fwd = 0; |
| 144 | |
| 145 | if (is_neg) |
| 146 | rc[fwd++] = '-'; |
| 147 | |
| 148 | if (radix == 16) |
| 149 | { |
| 150 | rc[fwd++] = '0'; |
| 151 | rc[fwd++] = 'x'; |
| 152 | } |
| 153 | else if (radix > 10) |
| 154 | { |
| 155 | rc[fwd++] = '('; |
| 156 | rc[fwd++] = static_cast<char>(radix / 10) + '0'; |
| 157 | rc[fwd++] = static_cast<char>(radix % 10) + '0'; |
| 158 | rc[fwd++] = ')'; |
| 159 | } |
| 160 | |
| 161 | while (rev < DECODE_BUF_LEN) |
| 162 | rc[fwd++] = rc[++rev]; |
| 163 | |
| 164 | rc[fwd] = 0; |
| 165 | // fb_assert(fwd < DECODE_BUF_SIZE); |
| 166 | |
| 167 | return fwd; |
| 168 | } |
| 169 | |
| 170 | |
| 171 | // Prints one specific item in the array of type-safe arguments. |