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 ZReadAscii function. | |
| 3 | * | |
| 4 | * Created by: Robert French | |
| 5 | * | |
| 6 | * Copyright (c) 1987, 1990 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 | |
|
36256
a437550a9308
Remove -Wno-sign-compare and backport fixes from default.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
36029
diff
changeset
|
13 | #define Z_cnvt_xtoi(c) ((temp=(c)-'0'),(temp<10)?(int)temp:((temp-='A'-'9'-1),(temp<16)?(int)temp:-1)) |
| 2086 | 14 | |
|
40166
811f82db29dd
zephyr: Modernize K&R function prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
36257
diff
changeset
|
15 | Code_t |
|
811f82db29dd
zephyr: Modernize K&R function prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
36257
diff
changeset
|
16 | ZReadAscii(char *ptr, int len, unsigned char *field, int num) |
| 2086 | 17 | { |
| 18 | int i; | |
| 19 | unsigned int hexbyte; | |
| 20 | register int c1, c2; | |
| 21 | register unsigned int temp; | |
| 22 | ||
| 23 | for (i=0;i<num;i++) { | |
| 24 | if (*ptr == ' ') { | |
| 25 | ptr++; | |
| 26 | if (--len < 0) | |
| 27 | return ZERR_BADFIELD; | |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
28 | } |
| 2086 | 29 | if (ptr[0] == '0' && ptr[1] == 'x') { |
| 30 | ptr += 2; | |
| 31 | len -= 2; | |
| 32 | if (len < 0) | |
| 33 | return ZERR_BADFIELD; | |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
15435
diff
changeset
|
34 | } |
| 2086 | 35 | c1 = Z_cnvt_xtoi(ptr[0]); |
| 36 | if (c1 < 0) | |
| 37 | return ZERR_BADFIELD; | |
| 38 | c2 = Z_cnvt_xtoi(ptr[1]); | |
| 39 | if (c2 < 0) | |
| 40 | return ZERR_BADFIELD; | |
| 41 | hexbyte = (c1 << 4) | c2; | |
| 42 | field[i] = hexbyte; | |
| 43 | ptr += 2; | |
| 44 | len -= 2; | |
| 45 | if (len < 0) | |
| 46 | return ZERR_BADFIELD; | |
| 47 | } | |
| 48 | ||
| 49 | return *ptr ? ZERR_BADFIELD : ZERR_NONE; | |
| 50 | } | |
| 51 | ||
|
40166
811f82db29dd
zephyr: Modernize K&R function prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
36257
diff
changeset
|
52 | Code_t |
|
811f82db29dd
zephyr: Modernize K&R function prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
36257
diff
changeset
|
53 | ZReadAscii32(char *ptr, int len, unsigned long *value_ptr) |
| 2086 | 54 | { |
| 55 | unsigned char buf[4]; | |
|
35993
bd0a2508b477
Fix some other coverity warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
31294
diff
changeset
|
56 | unsigned long value = 0; |
| 2086 | 57 | Code_t retval; |
| 58 | ||
| 59 | retval = ZReadAscii(ptr, len, buf, 4); | |
| 60 | if (retval != ZERR_NONE) | |
| 61 | return retval; | |
|
36029
cd7db320cf5c
Fix coverity regression warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35993
diff
changeset
|
62 | value |= (unsigned long)buf[0] << 24; |
|
35993
bd0a2508b477
Fix some other coverity warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
31294
diff
changeset
|
63 | value |= buf[1] << 16; |
|
bd0a2508b477
Fix some other coverity warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
31294
diff
changeset
|
64 | value |= buf[2] << 8; |
|
bd0a2508b477
Fix some other coverity warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
31294
diff
changeset
|
65 | value |= buf[3]; |
|
bd0a2508b477
Fix some other coverity warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
31294
diff
changeset
|
66 | *value_ptr = value; |
| 2086 | 67 | return ZERR_NONE; |
| 68 | } | |
| 69 | ||
|
40166
811f82db29dd
zephyr: Modernize K&R function prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
36257
diff
changeset
|
70 | Code_t |
|
811f82db29dd
zephyr: Modernize K&R function prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
36257
diff
changeset
|
71 | ZReadAscii16(char *ptr, int len, unsigned short *value_ptr) |
| 2086 | 72 | { |
| 73 | unsigned char buf[2]; | |
| 74 | Code_t retval; | |
| 75 | ||
| 76 | retval = ZReadAscii(ptr, len, buf, 2); | |
| 77 | if (retval != ZERR_NONE) | |
| 78 | return retval; | |
| 79 | *value_ptr = (buf[0] << 8) | buf[1]; | |
| 80 | return ZERR_NONE; | |
| 81 | } | |
| 82 |