Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(430)

Unified Diff: fpdfsdk/src/javascript/app.cpp

Issue 498773004: Fix confusion between length in bytes and length in characters in app::response(). (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Tabify. Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/src/javascript/app.cpp
diff --git a/fpdfsdk/src/javascript/app.cpp b/fpdfsdk/src/javascript/app.cpp
index c9a9ef7017a97c4f76620f19ea2b781bcf398fd2..1c4da08ccb782ff685d4b7b7323fdaad7231a25f 100644
--- a/fpdfsdk/src/javascript/app.cpp
+++ b/fpdfsdk/src/javascript/app.cpp
@@ -1045,49 +1045,39 @@ FX_BOOL app::response(OBJ_METHOD_PARAMS)
{
JSObject pObj = (JSObject )params[0];
v8::Handle<v8::Value> pValue = JS_GetObjectElement(isolate,pObj,L"cQuestion");
- swQuestion = CJS_Value(isolate,pValue,GET_VALUE_TYPE(pValue)).operator CFX_WideString();
+ swQuestion = CJS_Value(isolate,pValue,GET_VALUE_TYPE(pValue)).operator CFX_WideString();
pValue = JS_GetObjectElement(isolate,pObj,L"cTitle");
- swTitle = CJS_Value(isolate,pValue,GET_VALUE_TYPE(pValue)).operator CFX_WideString();
+ swTitle = CJS_Value(isolate,pValue,GET_VALUE_TYPE(pValue)).operator CFX_WideString();
pValue = JS_GetObjectElement(isolate,pObj,L"cDefault");
- swDefault = CJS_Value(isolate,pValue,GET_VALUE_TYPE(pValue)).operator CFX_WideString();
+ swDefault = CJS_Value(isolate,pValue,GET_VALUE_TYPE(pValue)).operator CFX_WideString();
pValue = JS_GetObjectElement(isolate,pObj,L"cLabel");
- swLabel = CJS_Value(isolate,pValue,GET_VALUE_TYPE(pValue)).operator CFX_WideString();
+ swLabel = CJS_Value(isolate,pValue,GET_VALUE_TYPE(pValue)).operator CFX_WideString();
pValue = JS_GetObjectElement(isolate,pObj,L"bPassword");
- bPassWord = (bool)CJS_Value(isolate,pValue,GET_VALUE_TYPE(pValue));
+ bPassWord = (bool)CJS_Value(isolate,pValue,GET_VALUE_TYPE(pValue));
}
else
{
switch(iLength)
{
- case 1:
- swQuestion = params[0];
- break;
- case 2:
- swQuestion = params[0];
- swTitle = params[1];
- break;
+ case 5:
+ swLabel = params[4];
+ // FALLTHROUGH
+ case 4:
+ bPassWord = params[3];
+ // FALLTHROUGH
case 3:
- swQuestion = params[0];
- swTitle = params[1];
swDefault = params[2];
- break;
- case 4:
- swQuestion = params[0];
+ // FALLTHROUGH
+ case 2:
swTitle = params[1];
- swDefault = params[2];
- bPassWord = params[3];
- break;
- case 5:
+ // FALLTHROUGH
+ case 1:
swQuestion = params[0];
- swTitle = params[1];
- swDefault = params[2];
- bPassWord = params[3];
- swLabel = params[4];
- break;
+ // FALLTHROUGH
default:
break;
}
@@ -1115,7 +1105,7 @@ FX_BOOL app::response(OBJ_METHOD_PARAMS)
if (nLengthBytes > MAX_INPUT_BYTES)
nLengthBytes = MAX_INPUT_BYTES;
- vRet = CFX_WideString::FromUTF16LE((unsigned short*)pBuff, nLengthBytes);
+ vRet = CFX_WideString::FromUTF16LE((unsigned short*)pBuff, nLengthBytes / sizeof(unsigned short));
delete[] pBuff;
return TRUE;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698