1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
From: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
Date: Wed, 8 Oct 2025 10:49:44 -0400
Subject: Avoid returning enum in boolean context
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Without this fix, we see:
```
…/src/lib/enc_material.cpp: In member function ‘virtual bool pgp::X25519EncMaterial::parse(pgp_packet_body_t&)’:
…/src/lib/enc_material.cpp:154:20: warning: enum constant in boolean context [-Wint-in-bool-context]
154 | return RNP_ERROR_BAD_FORMAT;
| ^~~~~~~~~~~~~~~~~~~~
make[3]: Leaving directory '…/build'
```
Forwarded: https://github.com/rnpgp/rnp/pull/2364
---
src/lib/enc_material.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/lib/enc_material.cpp b/src/lib/enc_material.cpp
index 3e8250a..6e12b72 100644
--- a/src/lib/enc_material.cpp
+++ b/src/lib/enc_material.cpp
@@ -151,7 +151,7 @@ X25519EncMaterial::parse(pgp_packet_body_t &pkt) noexcept
uint8_t bt = 0;
if (!pkt.get(bt)) {
RNP_LOG("failed to get salg");
- return RNP_ERROR_BAD_FORMAT;
+ return false;
}
sess_len--;
salg = (pgp_symm_alg_t) bt;
|