diff options
author | Tom Sepez <tsepez@chromium.org> | 2017-07-19 13:19:12 -0700 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-07-19 20:59:29 +0000 |
commit | 33b42e4ab56d56ff02cd08a47c5f590875d886bf (patch) | |
tree | d168b57aa48373a3213f918471fcd1c8224d2d5d /fxjs/cfxjse_value.cpp | |
parent | d4c401194137f3f7f466f6daaa7fe3ffb4b6cd53 (diff) | |
download | pdfium-33b42e4ab56d56ff02cd08a47c5f590875d886bf.tar.xz |
Rename StringCs c_str() to unterminated_c_str().
Since there is no guarantee of termination if the StringC was
extracted from a snippet of another string. Make it more obvious
that things like
strlen(str.unterminated_c_str())
might be a bad idea.
Change-Id: I7832248ed89ebbddf5c0bcd402aac7d40ec2adc2
Reviewed-on: https://pdfium-review.googlesource.com/8170
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Diffstat (limited to 'fxjs/cfxjse_value.cpp')
-rw-r--r-- | fxjs/cfxjse_value.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/fxjs/cfxjse_value.cpp b/fxjs/cfxjse_value.cpp index fb7fe20e21..c2eaa408a4 100644 --- a/fxjs/cfxjse_value.cpp +++ b/fxjs/cfxjse_value.cpp @@ -58,7 +58,7 @@ void FXJSE_ThrowMessage(const CFX_ByteStringC& utf8Message) { CFXJSE_ScopeUtil_IsolateHandleRootContext scope(pIsolate); v8::Local<v8::String> hMessage = v8::String::NewFromUtf8( - pIsolate, utf8Message.c_str(), v8::String::kNormalString, + pIsolate, utf8Message.unterminated_c_str(), v8::String::kNormalString, utf8Message.GetLength()); v8::Local<v8::Value> hError = v8::Exception::Error(hMessage); pIsolate->ThrowException(hError); @@ -138,7 +138,7 @@ bool CFXJSE_Value::SetObjectProperty(const CFX_ByteStringC& szPropName, v8::Local<v8::Value> hPropValue = v8::Local<v8::Value>::New(m_pIsolate, lpPropValue->DirectGetValue()); return (bool)hObject.As<v8::Object>()->Set( - v8::String::NewFromUtf8(m_pIsolate, szPropName.c_str(), + v8::String::NewFromUtf8(m_pIsolate, szPropName.unterminated_c_str(), v8::String::kNormalString, szPropName.GetLength()), hPropValue); @@ -155,8 +155,8 @@ bool CFXJSE_Value::GetObjectProperty(const CFX_ByteStringC& szPropName, v8::Local<v8::Value> hPropValue = hObject.As<v8::Object>()->Get(v8::String::NewFromUtf8( - m_pIsolate, szPropName.c_str(), v8::String::kNormalString, - szPropName.GetLength())); + m_pIsolate, szPropName.unterminated_c_str(), + v8::String::kNormalString, szPropName.GetLength())); lpPropValue->ForceSetValue(hPropValue); return true; } @@ -195,7 +195,7 @@ bool CFXJSE_Value::DeleteObjectProperty(const CFX_ByteStringC& szPropName) { return false; hObject.As<v8::Object>()->Delete(v8::String::NewFromUtf8( - m_pIsolate, szPropName.c_str(), v8::String::kNormalString, + m_pIsolate, szPropName.unterminated_c_str(), v8::String::kNormalString, szPropName.GetLength())); return true; } @@ -209,7 +209,7 @@ bool CFXJSE_Value::HasObjectOwnProperty(const CFX_ByteStringC& szPropName, return false; v8::Local<v8::String> hKey = v8::String::NewFromUtf8( - m_pIsolate, szPropName.c_str(), v8::String::kNormalString, + m_pIsolate, szPropName.unterminated_c_str(), v8::String::kNormalString, szPropName.GetLength()); return hObject.As<v8::Object>()->HasRealNamedProperty(hKey) || (bUseTypeGetter && @@ -232,7 +232,7 @@ bool CFXJSE_Value::SetObjectOwnProperty(const CFX_ByteStringC& szPropName, return hObject.As<v8::Object>() ->DefineOwnProperty( m_pIsolate->GetCurrentContext(), - v8::String::NewFromUtf8(m_pIsolate, szPropName.c_str(), + v8::String::NewFromUtf8(m_pIsolate, szPropName.unterminated_c_str(), v8::String::kNormalString, szPropName.GetLength()), pValue) |