mirror of https://github.com/ArduPilot/ardupilot
AP_Common: fix initialization of ExpandingString so that it can be used on the stack
zero out passed in buffers for ExpandingString
This commit is contained in:
parent
8c2f686bfa
commit
0c6ea4790d
|
@ -25,6 +25,13 @@ extern const AP_HAL::HAL& hal;
|
||||||
|
|
||||||
#define EXPAND_INCREMENT 512
|
#define EXPAND_INCREMENT 512
|
||||||
|
|
||||||
|
ExpandingString::ExpandingString(char* s, uint32_t total_len) : buf(0)
|
||||||
|
{
|
||||||
|
set_buffer(s, total_len, 0);
|
||||||
|
memset(buf, 0, buflen);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
expand the string buffer
|
expand the string buffer
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -24,6 +24,8 @@
|
||||||
|
|
||||||
class ExpandingString {
|
class ExpandingString {
|
||||||
public:
|
public:
|
||||||
|
ExpandingString() : buf(0), buflen(0), used(0), allocation_failed(false), external_buffer(false) {}
|
||||||
|
ExpandingString(char* s, uint32_t total_len);
|
||||||
|
|
||||||
const char *get_string(void) const {
|
const char *get_string(void) const {
|
||||||
return buf;
|
return buf;
|
||||||
|
|
Loading…
Reference in New Issue