Loading media/libmediametrics/include/media/MediaMetricsItem.h +4 −5 Original line number Original line Diff line number Diff line Loading @@ -499,16 +499,15 @@ protected: template <> // static template <> // static status_t extract(std::string *val, const char **bufferpptr, const char *bufferptrmax) { status_t extract(std::string *val, const char **bufferpptr, const char *bufferptrmax) { const char *ptr = *bufferpptr; const char *ptr = *bufferpptr; while (*ptr != 0) { do { if (ptr >= bufferptrmax) { if (ptr >= bufferptrmax) { ALOGE("%s: buffer exceeded", __func__); ALOGE("%s: buffer exceeded", __func__); return BAD_VALUE; return BAD_VALUE; } } ++ptr; } while (*ptr++ != 0); } // ptr is terminator+1, == bufferptrmax if we finished entire buffer const size_t size = (ptr - *bufferpptr) + 1; *val = *bufferpptr; *val = *bufferpptr; *bufferpptr += size; *bufferpptr = ptr; return NO_ERROR; return NO_ERROR; } } template <> // static template <> // static Loading Loading
media/libmediametrics/include/media/MediaMetricsItem.h +4 −5 Original line number Original line Diff line number Diff line Loading @@ -499,16 +499,15 @@ protected: template <> // static template <> // static status_t extract(std::string *val, const char **bufferpptr, const char *bufferptrmax) { status_t extract(std::string *val, const char **bufferpptr, const char *bufferptrmax) { const char *ptr = *bufferpptr; const char *ptr = *bufferpptr; while (*ptr != 0) { do { if (ptr >= bufferptrmax) { if (ptr >= bufferptrmax) { ALOGE("%s: buffer exceeded", __func__); ALOGE("%s: buffer exceeded", __func__); return BAD_VALUE; return BAD_VALUE; } } ++ptr; } while (*ptr++ != 0); } // ptr is terminator+1, == bufferptrmax if we finished entire buffer const size_t size = (ptr - *bufferpptr) + 1; *val = *bufferpptr; *val = *bufferpptr; *bufferpptr += size; *bufferpptr = ptr; return NO_ERROR; return NO_ERROR; } } template <> // static template <> // static Loading