Skip to content
This repository was archived by the owner on May 18, 2021. It is now read-only.

Commit 2f48508

Browse files
authored
Merge pull request #11 from henrygab/build_warnings
Fix two build warnings
2 parents c36ecda + f6d309c commit 2f48508

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Adafruit_USBD_Device.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ uint8_t const * tud_descriptor_configuration_cb(uint8_t index)
212212

213213
constexpr static inline bool isInvalidUtf8Octet(uint8_t t) {
214214
// see bullets in https://tools.ietf.org/html/rfc3629#section-1
215-
return (t == 0xc0) || (t == 0xC1) || ((t >= 0xF5) && (t <= 0xFF));
215+
return (t == 0xc0) || (t == 0xC1) || (t >= 0xF5);
216216
}
217217

218218
//
@@ -248,7 +248,7 @@ static int8_t utf8Codepoint(const uint8_t *utf8, uint32_t *codepointp)
248248
const uint32_t CODEPOINT_HIGHEST_SURROGATE_HALF = 0xDFFF;
249249

250250
*codepointp = 0xFFFD; // always initialize output to known value ... 0xFFFD (REPLACEMENT CHARACTER) seems the natural choice
251-
int codepoint;
251+
uint32_t codepoint;
252252
int len;
253253

254254
// The upper bits define both the length of additional bytes for the multi-byte encoding,
@@ -290,7 +290,7 @@ static int8_t utf8Codepoint(const uint8_t *utf8, uint32_t *codepointp)
290290
}
291291

292292
// explicit validation to prevent overlong encodings
293-
if ( (len == 1) && ((codepoint < 0x000000) || (codepoint > 0x00007F))) {
293+
if ( (len == 1) && (codepoint > 0x00007F)) {
294294
return -1;
295295
} else if ((len == 2) && ((codepoint < 0x000080) || (codepoint > 0x0007FF))) {
296296
return -1;

0 commit comments

Comments
 (0)