File tree 2 files changed +11
-3
lines changed
2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -28,9 +28,14 @@ namespace arduino { namespace hex {
28
28
}
29
29
30
30
bool decode (const String in, uint8_t * out, uint32_t size) {
31
+ return decode (in.c_str (), out, size);
32
+ }
33
+
34
+ bool decode (const char *in, uint8_t * out, uint32_t size) {
31
35
unsigned int byteNumber;
32
- byteNumber = chex_decode (out, size, in.begin (), in.length ());
33
- return byteNumber * 2 == in.length ();
36
+ size_t len = strlen (in);
37
+ byteNumber = chex_decode (out, size, in, len);
38
+ return byteNumber * 2 == len;
34
39
}
35
40
36
41
}} // arduino::hex
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ namespace arduino { namespace hex {
20
20
21
21
String encode (const uint8_t * in, uint32_t size);
22
22
String encodeUpper (const uint8_t * in, uint32_t size);
23
-
23
+ bool decode ( const char *in, uint8_t * out, uint32_t size);
24
24
bool decode (const String in, uint8_t * out, uint32_t size);
25
25
}} // arduino::hex
26
26
@@ -37,4 +37,7 @@ class THEXT {
37
37
return arduino::hex::decode (in, out, size);
38
38
}
39
39
40
+ static inline bool decode (const char *in, uint8_t * out, uint32_t size) {
41
+ return arduino::hex::decode (in, out, size);
42
+ }
40
43
};
You can’t perform that action at this time.
0 commit comments