diff options
author | Andreas Huber <andih@google.com> | 2010-01-05 12:20:46 -0800 |
---|---|---|
committer | Andreas Huber <andih@google.com> | 2010-01-05 13:39:04 -0800 |
commit | 23d7a43fb32482e2573b7f203fd9dd5a8349b329 (patch) | |
tree | 6902a77678707fddec811fbd964c2045baa885c0 /media/libstagefright/string.cpp | |
parent | fcac3378879ab151d786f1ce89da2f032ba3ea97 (diff) | |
download | frameworks_av-23d7a43fb32482e2573b7f203fd9dd5a8349b329.zip frameworks_av-23d7a43fb32482e2573b7f203fd9dd5a8349b329.tar.gz frameworks_av-23d7a43fb32482e2573b7f203fd9dd5a8349b329.tar.bz2 |
Quick and dirty implementation to follow http redirects in stagefright.
Diffstat (limited to 'media/libstagefright/string.cpp')
-rw-r--r-- | media/libstagefright/string.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/media/libstagefright/string.cpp b/media/libstagefright/string.cpp index bd6204b..8b2c36c 100644 --- a/media/libstagefright/string.cpp +++ b/media/libstagefright/string.cpp @@ -16,6 +16,8 @@ #include "include/stagefright_string.h" +#include <media/stagefright/MediaDebug.h> + namespace android { // static @@ -28,8 +30,15 @@ string::string(const char *s, size_t length) : mString(s, length) { } -string::string(const string &from, size_type start, size_type length) - : mString(from.c_str() + start, length) { +string::string(const string &from, size_type start, size_type length) { + CHECK(start <= from.size()); + if (length == npos) { + length = from.size() - start; + } else { + CHECK(start + length <= from.size()); + } + + mString.setTo(from.c_str() + start, length); } string::string(const char *s) |