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

Side by Side Diff: fpdfsdk/javascript/PublicMethods.cpp

Issue 1977613002: Fix use of an uninitialised CFX_Widestring in AFNumber_Keystroke. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: minor clenaup Created 4 years, 7 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "fpdfsdk/javascript/PublicMethods.h" 7 #include "fpdfsdk/javascript/PublicMethods.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <vector> 10 #include <vector>
(...skipping 885 matching lines...) Expand 10 before | Expand all | Expand 10 after
896 return FALSE; 896 return FALSE;
897 897
898 if (!pEvent->m_pValue) 898 if (!pEvent->m_pValue)
899 return FALSE; 899 return FALSE;
900 900
901 CFX_WideString& val = pEvent->Value(); 901 CFX_WideString& val = pEvent->Value();
902 CFX_WideString& wstrChange = pEvent->Change(); 902 CFX_WideString& wstrChange = pEvent->Change();
903 CFX_WideString wstrValue = val; 903 CFX_WideString wstrValue = val;
904 904
905 if (pEvent->WillCommit()) { 905 if (pEvent->WillCommit()) {
906 CFX_WideString wstrValue = StrTrim(wstrValue); 906 CFX_WideString swTemp = StrTrim(wstrValue);
907 if (wstrValue.IsEmpty()) 907 if (swTemp.IsEmpty())
908 return TRUE; 908 return TRUE;
909 909
910 CFX_WideString swTemp = wstrValue;
911 swTemp.Replace(L",", L"."); 910 swTemp.Replace(L",", L".");
912 if (!IsNumber(swTemp.c_str())) { 911 if (!IsNumber(swTemp.c_str())) {
913 pEvent->Rc() = FALSE; 912 pEvent->Rc() = FALSE;
914 sError = JSGetStringFromID(pContext, IDS_STRING_JSAFNUMBER_KEYSTROKE); 913 sError = JSGetStringFromID(pContext, IDS_STRING_JSAFNUMBER_KEYSTROKE);
915 Alert(pContext, sError.c_str()); 914 Alert(pContext, sError.c_str());
916 } 915 }
917 return TRUE; // it happens after the last keystroke and before validating, 916 return TRUE; // it happens after the last keystroke and before validating,
918 } 917 }
919 918
920 CFX_WideString wstrSelected; 919 CFX_WideString wstrSelected;
(...skipping 889 matching lines...) Expand 10 before | Expand all | Expand 10 after
1810 nums.SetElement(nIndex, CJS_Value(pRuntime, sPart.c_str())); 1809 nums.SetElement(nIndex, CJS_Value(pRuntime, sPart.c_str()));
1811 } 1810 }
1812 1811
1813 if (nums.GetLength() > 0) 1812 if (nums.GetLength() > 0)
1814 vRet = nums; 1813 vRet = nums;
1815 else 1814 else
1816 vRet.SetNull(); 1815 vRet.SetNull();
1817 1816
1818 return TRUE; 1817 return TRUE;
1819 } 1818 }
OLDNEW
« 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