1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-06-30 19:12:48 -05:00

Stop using unqualified {GET,PUT}_32BIT.

Those were a reasonable abbreviation when the code almost never had to
deal with little-endian numbers, but they've crept into enough places
now (e.g. the ECC formatting) that I think I'd now prefer that every
use of the integer read/write macros was clearly marked with its
endianness.

So all uses of GET_??BIT and PUT_??BIT are now qualified. The special
versions in x11fwd.c, which used variable endianness because so does
the X11 protocol, are suffixed _X11 to make that clear, and where that
pushed line lengths over 80 characters I've taken the opportunity to
name a local variable to remind me of what that extra parameter
actually does.
This commit is contained in:
Simon Tatham
2019-02-04 07:39:03 +00:00
parent 5538091f0d
commit acc21c4c0f
17 changed files with 56 additions and 58 deletions

View File

@ -891,7 +891,7 @@ static char *answer_filemapping_message(const char *mapname)
goto cleanup;
}
msglen = GET_32BIT((unsigned char *)mapaddr);
msglen = GET_32BIT_MSB_FIRST((unsigned char *)mapaddr);
#ifdef DEBUG_IPC
debug("msg length=%08x, msg type=%02x\n",
@ -925,7 +925,7 @@ static char *answer_filemapping_message(const char *mapname)
}
/* Write in the initial length field, and we're done. */
PUT_32BIT(((unsigned char *)mapaddr), reply.len);
PUT_32BIT_MSB_FIRST(((unsigned char *)mapaddr), reply.len);
cleanup:
/* expectedsid has the lifetime of the program, so we don't free it */

View File

@ -109,7 +109,7 @@ agent_pending_query *agent_query(
*/
id = SendMessage(hwnd, WM_COPYDATA, (WPARAM) NULL, (LPARAM) &cds);
if (id > 0) {
retlen = 4 + GET_32BIT(p);
retlen = 4 + GET_32BIT_MSB_FIRST(p);
ret = snewn(retlen, unsigned char);
if (ret) {
memcpy(ret, p, retlen);