Skip to content

Commit c8b54b2

Browse files
committed
Merge #12351: Libraries: Use correct type ; avoid compiler warnings.
a25cb0f Use ptrdiff_t type to more precisely indicate usage and avoid compiler warnings. (murrayn) Pull request description: ptrdiff_t is a more strictly correct type, and gets rid of compiler warnings. Tree-SHA512: 39718a5cdc10e698f14185f4622a9b439728bce619bd8b3a86f2b99ed5b056cf5a8545a3e5c4bc8a6a01b845fb73510036cee5e6d2629c58df26be692a957fba
2 parents b4d8549 + a25cb0f commit c8b54b2

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/key.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,15 @@ static int ec_privkey_import_der(const secp256k1_context* ctx, unsigned char *ou
4444
if (end - privkey < 1 || !(*privkey & 0x80u)) {
4545
return 0;
4646
}
47-
size_t lenb = *privkey & ~0x80u; privkey++;
47+
ptrdiff_t lenb = *privkey & ~0x80u; privkey++;
4848
if (lenb < 1 || lenb > 2) {
4949
return 0;
5050
}
5151
if (end - privkey < lenb) {
5252
return 0;
5353
}
5454
/* sequence length */
55-
size_t len = privkey[lenb-1] | (lenb > 1 ? privkey[lenb-2] << 8 : 0u);
55+
ptrdiff_t len = privkey[lenb-1] | (lenb > 1 ? privkey[lenb-2] << 8 : 0u);
5656
privkey += lenb;
5757
if (end - privkey < len) {
5858
return 0;
@@ -66,7 +66,7 @@ static int ec_privkey_import_der(const secp256k1_context* ctx, unsigned char *ou
6666
if (end - privkey < 2 || privkey[0] != 0x04u) {
6767
return 0;
6868
}
69-
size_t oslen = privkey[1];
69+
ptrdiff_t oslen = privkey[1];
7070
privkey += 2;
7171
if (oslen > 32 || end - privkey < oslen) {
7272
return 0;

0 commit comments

Comments
 (0)