+
+/* Throw away one byte of a (possibly) multi-byte char C, updating
+ address and buffer to suit. */
+
+static void
+unget_part_char (long c, file_ptr *address, int *magiccount, char **magic)
+{
+ static char tmp[4];
+
+ if (encoding_bytes > 1)
+ {
+ *address -= encoding_bytes - 1;
+
+ if (*magiccount == 0)
+ {
+ /* If no magic buffer exists, use temp buffer. */
+ switch (encoding)
+ {
+ default:
+ break;
+ case 'b':
+ tmp[0] = c & 0xff;
+ *magiccount = 1;
+ break;
+ case 'l':
+ tmp[0] = (c >> 8) & 0xff;
+ *magiccount = 1;
+ break;
+ case 'B':
+ tmp[0] = (c >> 16) & 0xff;
+ tmp[1] = (c >> 8) & 0xff;
+ tmp[2] = c & 0xff;
+ *magiccount = 3;
+ break;
+ case 'L':
+ tmp[0] = (c >> 8) & 0xff;
+ tmp[1] = (c >> 16) & 0xff;
+ tmp[2] = (c >> 24) & 0xff;
+ *magiccount = 3;
+ break;
+ }
+ *magic = tmp;
+ }
+ else
+ {
+ /* If magic buffer exists, rewind. */
+ *magic -= encoding_bytes - 1;
+ *magiccount += encoding_bytes - 1;
+ }
+ }
+}