Mon, 22 Aug 2022 21:40:04 -0500
Inline pidgin_make_scrollable
We need to change it for GTK4, and there are few enough that it can be inlined. Eventually, that code might be a `.ui` anyway.
Testing Done:
Compile only.
Reviewed at https://reviews.imfreedom.org/r/1615/
| 2086 | 1 | /* This file is part of the Project Athena Zephyr Notification System. |
| 2 | * It contains source for the ZMakeAscii function. | |
| 3 | * | |
| 4 | * Created by: Robert French | |
| 5 | * | |
| 6 | * Copyright (c) 1987 by the Massachusetts Institute of Technology. | |
| 7 | * For copying and distribution information, see the file | |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
8 | * "mit-copyright.h". |
| 2086 | 9 | */ |
| 10 | ||
|
8792
b0645c9dc276
[gaim-migrate @ 9554]
Christian Hammond <chipx86@chipx86.com>
parents:
2086
diff
changeset
|
11 | #include "internal.h" |
| 2086 | 12 | |
| 13 | static char *itox_chars = "0123456789ABCDEF"; | |
| 14 | ||
|
40166
811f82db29dd
zephyr: Modernize K&R function prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31294
diff
changeset
|
15 | Code_t |
|
811f82db29dd
zephyr: Modernize K&R function prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31294
diff
changeset
|
16 | ZMakeAscii(register char *ptr, int len, unsigned char *field, int num) |
| 2086 | 17 | { |
| 18 | int i; | |
| 19 | ||
| 20 | for (i=0;i<num;i++) { | |
| 21 | /* we need to add "0x" if we are between 4 byte pieces */ | |
| 22 | if ((i & 3) == 0) { | |
| 23 | if (len < (i?4:3)) | |
| 24 | return ZERR_FIELDLEN; | |
| 25 | /* except at the beginning, put a space in before the "0x" */ | |
| 26 | if (i) { | |
| 27 | *ptr++ = ' '; | |
| 28 | len--; | |
| 29 | } | |
| 30 | *ptr++ = '0'; | |
| 31 | *ptr++ = 'x'; | |
| 32 | len -= 2; | |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
33 | } |
| 2086 | 34 | if (len < 3) |
| 35 | return ZERR_FIELDLEN; | |
| 36 | *ptr++ = itox_chars[(int) (field[i] >> 4)]; | |
| 37 | *ptr++ = itox_chars[(int) (field[i] & 0xf)]; | |
| 38 | len -= 2; | |
| 39 | } | |
| 40 | ||
| 41 | *ptr = '\0'; | |
| 42 | return ZERR_NONE; | |
| 43 | } | |
| 44 | ||
|
40166
811f82db29dd
zephyr: Modernize K&R function prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31294
diff
changeset
|
45 | Code_t |
|
811f82db29dd
zephyr: Modernize K&R function prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31294
diff
changeset
|
46 | ZMakeAscii32(register char *ptr, int len, unsigned long value) |
| 2086 | 47 | { |
| 48 | if (len < 11) | |
| 49 | return ZERR_FIELDLEN; | |
| 50 | *ptr++ = '0'; | |
| 51 | *ptr++ = 'x'; | |
| 52 | *ptr++ = itox_chars[(value >> 28) & 0xf]; | |
| 53 | *ptr++ = itox_chars[(value >> 24) & 0xf]; | |
| 54 | *ptr++ = itox_chars[(value >> 20) & 0xf]; | |
| 55 | *ptr++ = itox_chars[(value >> 16) & 0xf]; | |
| 56 | *ptr++ = itox_chars[(value >> 12) & 0xf]; | |
| 57 | *ptr++ = itox_chars[(value >> 8) & 0xf]; | |
| 58 | *ptr++ = itox_chars[(value >> 4) & 0xf]; | |
| 59 | *ptr++ = itox_chars[(value >> 0) & 0xf]; | |
| 60 | *ptr = 0; | |
| 61 | return ZERR_NONE; | |
| 62 | } | |
| 63 | ||
|
40166
811f82db29dd
zephyr: Modernize K&R function prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31294
diff
changeset
|
64 | Code_t |
|
811f82db29dd
zephyr: Modernize K&R function prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
31294
diff
changeset
|
65 | ZMakeAscii16(register char *ptr, int len, unsigned int value) |
| 2086 | 66 | { |
| 67 | if (len < 7) | |
| 68 | return ZERR_FIELDLEN; | |
| 69 | *ptr++ = '0'; | |
| 70 | *ptr++ = 'x'; | |
| 71 | *ptr++ = itox_chars[(value >> 12) & 0xf]; | |
| 72 | *ptr++ = itox_chars[(value >> 8) & 0xf]; | |
| 73 | *ptr++ = itox_chars[(value >> 4) & 0xf]; | |
| 74 | *ptr++ = itox_chars[(value >> 0) & 0xf]; | |
| 75 | *ptr = 0; | |
| 76 | return ZERR_NONE; | |
| 77 | } | |
| 78 |