diff options
author | Ryan Prichard <rprichard@google.com> | 2018-07-09 23:51:58 -0700 |
---|---|---|
committer | Ryan Prichard <rprichard@google.com> | 2018-07-10 23:32:09 -0700 |
commit | e4fded2c484022738c2b4a37e762b24ae1d2f902 (patch) | |
tree | e1d9062ca72df5f83ae233135e4d8b4603782888 /libutils/Unicode.cpp | |
parent | 348878391a4bdaee521d969facb5a8ac5b9bef3a (diff) |
adb: fix escape_arg for multiple quotes
escape_arg reuses the same index for the source (s) and the destination
(result), so it breaks on strings containing more than one quote, e.g:
* a'b'c ==> 'a'\''b'c'
* a'bcde'f ==> 'a'\''b'\'cde'f'
Also make the function more efficient by doing fewer string copies. This
code is based on the android::base::Split code.
Use EXPECT_EQ because the tests can keep going if one fails.
Bug: none
Test: adb_test --gtest_filter=adb_utils.escape_arg
Change-Id: I6ca6e905fa53cc61b9a87276cb7116a5df7e8017
Diffstat (limited to 'libutils/Unicode.cpp')
0 files changed, 0 insertions, 0 deletions