diff options
author | David Blaikie <dblaikie@gmail.com> | 2012-07-25 18:04:24 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2012-07-25 18:04:24 +0000 |
commit | 9f14ed1c60a1f6e8ab434a85d2ba9d82bc125cf4 (patch) | |
tree | 9474a931b07e179880bfd5f339aec9b301cc966a /lib/Support | |
parent | e3094283e38d9e6f6a4a7a14a3a5d0f2af67d5d5 (diff) | |
download | external_llvm-9f14ed1c60a1f6e8ab434a85d2ba9d82bc125cf4.zip external_llvm-9f14ed1c60a1f6e8ab434a85d2ba9d82bc125cf4.tar.gz external_llvm-9f14ed1c60a1f6e8ab434a85d2ba9d82bc125cf4.tar.bz2 |
Don't add null characters to the end of the APFloat string buffer.
Report/patch inspiration by Olaf Krzikalla.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160744 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support')
-rw-r--r-- | lib/Support/APFloat.cpp | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/lib/Support/APFloat.cpp b/lib/Support/APFloat.cpp index 409d4fb..9f5ca3e 100644 --- a/lib/Support/APFloat.cpp +++ b/lib/Support/APFloat.cpp @@ -3278,16 +3278,8 @@ APFloat::APFloat(double d) : exponent2(0), sign2(0) { } namespace { - static void append(SmallVectorImpl<char> &Buffer, - unsigned N, const char *Str) { - unsigned Start = Buffer.size(); - Buffer.set_size(Start + N); - memcpy(&Buffer[Start], Str, N); - } - - template <unsigned N> - void append(SmallVectorImpl<char> &Buffer, const char (&Str)[N]) { - append(Buffer, N, Str); + void append(SmallVectorImpl<char> &Buffer, StringRef Str) { + Buffer.append(Str.begin(), Str.end()); } /// Removes data from the given significand until it is no more |