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

@ -770,7 +770,7 @@ static void pageant_conn_receive(Plug *plug, int urgent, char *data, int len)
pc->lenbuf[pc->got++] = c;
}
pc->len = GET_32BIT(pc->lenbuf);
pc->len = GET_32BIT_MSB_FIRST(pc->lenbuf);
pc->got = 0;
pc->real_packet = (pc->len < AGENT_MAX_MSGLEN-4);
@ -796,7 +796,7 @@ static void pageant_conn_receive(Plug *plug, int urgent, char *data, int len)
pc->logfn ? pageant_conn_log : NULL);
}
PUT_32BIT(reply->s, reply->len - 4);
PUT_32BIT_MSB_FIRST(reply->s, reply->len - 4);
sk_write(pc->connsock, reply->s, reply->len);
strbuf_free(reply);
@ -1056,7 +1056,7 @@ int pageant_add_keyfile(Filename *filename, const char *passphrase,
strbuf_free(blob);
return PAGEANT_ACTION_FAILURE;
}
PUT_32BIT(blob->s, blob->len - 4);
PUT_32BIT_MSB_FIRST(blob->s, blob->len - 4);
keylist = pageant_get_keylist2(&keylistlen);
}
if (keylist) {
@ -1066,7 +1066,7 @@ int pageant_add_keyfile(Filename *filename, const char *passphrase,
strbuf_free(blob);
return PAGEANT_ACTION_FAILURE;
}
nkeys = toint(GET_32BIT(keylist));
nkeys = toint(GET_32BIT_MSB_FIRST(keylist));
if (nkeys < 0) {
*retstr = dupstr("Received broken key list from agent");
sfree(keylist);
@ -1103,7 +1103,7 @@ int pageant_add_keyfile(Filename *filename, const char *passphrase,
strbuf_free(blob);
return PAGEANT_ACTION_FAILURE;
}
n = GET_32BIT(p);
n = GET_32BIT_MSB_FIRST(p);
p += 4;
keylistlen -= 4;
@ -1125,7 +1125,7 @@ int pageant_add_keyfile(Filename *filename, const char *passphrase,
strbuf_free(blob);
return PAGEANT_ACTION_FAILURE;
}
n = GET_32BIT(p);
n = GET_32BIT_MSB_FIRST(p);
p += 4;
keylistlen -= 4;