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

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

Issue 1287703002: Fix some sign comparison warnings. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@xfa
Patch Set: Created 5 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 unified diff | Download patch
« no previous file with comments | « fpdfsdk/src/javascript/Document.cpp ('k') | fpdfsdk/src/javascript/util.cpp » ('j') | 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 "../../include/javascript/JavaScript.h" 7 #include "../../include/javascript/JavaScript.h"
8 #include "../../include/javascript/IJavaScript.h" 8 #include "../../include/javascript/IJavaScript.h"
9 #include "../../include/javascript/JS_Define.h" 9 #include "../../include/javascript/JS_Define.h"
10 #include "../../include/javascript/JS_Object.h" 10 #include "../../include/javascript/JS_Object.h"
(...skipping 1117 matching lines...) Expand 10 before | Expand all | Expand 10 after
1128 } 1128 }
1129 return TRUE; // it happens after the last keystroke and before validating, 1129 return TRUE; // it happens after the last keystroke and before validating,
1130 } 1130 }
1131 1131
1132 std::wstring w_strValue2 = w_strValue.c_str(); 1132 std::wstring w_strValue2 = w_strValue.c_str();
1133 std::wstring w_strChange2 = w_strChange.c_str(); 1133 std::wstring w_strChange2 = w_strChange.c_str();
1134 std::wstring w_strSelected; 1134 std::wstring w_strSelected;
1135 if (-1 != pEvent->SelStart()) 1135 if (-1 != pEvent->SelStart())
1136 w_strSelected = w_strValue2.substr(pEvent->SelStart(), 1136 w_strSelected = w_strValue2.substr(pEvent->SelStart(),
1137 (pEvent->SelEnd() - pEvent->SelStart())); 1137 (pEvent->SelEnd() - pEvent->SelStart()));
1138 FX_BOOL bHasSign = 1138 bool bHasSign = (w_strValue2.find('-') != std::wstring::npos) &&
1139 (w_strValue2.find('-') != -1) && (w_strSelected.find('-') == -1); 1139 (w_strSelected.find('-') == std::wstring::npos);
1140 if (bHasSign) { 1140 if (bHasSign) {
1141 // can't insert "change" in front to sign postion. 1141 // can't insert "change" in front to sign postion.
1142 if (pEvent->SelStart() == 0) { 1142 if (pEvent->SelStart() == 0) {
1143 FX_BOOL& bRc = pEvent->Rc(); 1143 FX_BOOL& bRc = pEvent->Rc();
1144 bRc = FALSE; 1144 bRc = FALSE;
1145 return TRUE; 1145 return TRUE;
1146 } 1146 }
1147 } 1147 }
1148 1148
1149 char cSep = L'.'; 1149 char cSep = L'.';
1150 1150
1151 switch (iSepStyle) { 1151 switch (iSepStyle) {
1152 case 0: 1152 case 0:
1153 case 1: 1153 case 1:
1154 cSep = L'.'; 1154 cSep = L'.';
1155 break; 1155 break;
1156 case 2: 1156 case 2:
1157 case 3: 1157 case 3:
1158 cSep = L','; 1158 cSep = L',';
1159 break; 1159 break;
1160 } 1160 }
1161 1161
1162 FX_BOOL bHasSep = (w_strValue2.find(cSep) != -1); 1162 bool bHasSep = (w_strValue2.find(cSep) != std::wstring::npos);
1163 for (std::wstring::iterator it = w_strChange2.begin(); 1163 for (std::wstring::iterator it = w_strChange2.begin();
1164 it != w_strChange2.end(); it++) { 1164 it != w_strChange2.end(); it++) {
1165 if (*it == cSep) { 1165 if (*it == cSep) {
1166 if (bHasSep) { 1166 if (bHasSep) {
1167 FX_BOOL& bRc = pEvent->Rc(); 1167 FX_BOOL& bRc = pEvent->Rc();
1168 bRc = FALSE; 1168 bRc = FALSE;
1169 return TRUE; 1169 return TRUE;
1170 } 1170 }
1171 bHasSep = TRUE; 1171 bHasSep = TRUE;
1172 continue; 1172 continue;
(...skipping 961 matching lines...) Expand 10 before | Expand all | Expand 10 after
2134 nums.SetElement(nIndex, CJS_Value(isolate, sPart.c_str())); 2134 nums.SetElement(nIndex, CJS_Value(isolate, sPart.c_str()));
2135 } 2135 }
2136 2136
2137 if (nums.GetLength() > 0) 2137 if (nums.GetLength() > 0)
2138 vRet = nums; 2138 vRet = nums;
2139 else 2139 else
2140 vRet.SetNull(); 2140 vRet.SetNull();
2141 2141
2142 return TRUE; 2142 return TRUE;
2143 } 2143 }
OLDNEW
« no previous file with comments | « fpdfsdk/src/javascript/Document.cpp ('k') | fpdfsdk/src/javascript/util.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698