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

Side by Side Diff: core/fxge/ge/fx_ge_text.cpp

Issue 2640143003: Update safe numerics package to get bitwise ops (Closed)
Patch Set: 0 is a perfectly fine value of zero Created 3 years, 11 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
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 <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 FX_SAFE_INT32 char_height = pGlyph->m_Bitmap.GetHeight(); 72 FX_SAFE_INT32 char_height = pGlyph->m_Bitmap.GetHeight();
73 char_height /= retinaScaleY; 73 char_height /= retinaScaleY;
74 if (!char_height.IsValid()) 74 if (!char_height.IsValid())
75 continue; 75 continue;
76 76
77 FX_SAFE_INT32 char_bottom = char_top + char_height; 77 FX_SAFE_INT32 char_bottom = char_top + char_height;
78 if (!char_bottom.IsValid()) 78 if (!char_bottom.IsValid())
79 continue; 79 continue;
80 80
81 if (bStarted) { 81 if (bStarted) {
82 rect.left = std::min(rect.left, char_left.ValueOrDie()); 82 rect.left =
83 rect.right = std::max(rect.right, char_right.ValueOrDie()); 83 std::min(rect.left, static_cast<int>(char_left.ValueOrDie<int>()));
jschuh 2017/01/23 17:05:19 Same as above. This is what CheckMax() is for.
Tom Sepez 2017/01/23 18:19:14 Done.
84 rect.top = std::min(rect.top, char_top.ValueOrDie()); 84 rect.right =
85 rect.bottom = std::max(rect.bottom, char_bottom.ValueOrDie()); 85 std::max(rect.right, static_cast<int>(char_right.ValueOrDie<int>()));
86 rect.top =
87 std::min(rect.top, static_cast<int>(char_top.ValueOrDie<int>()));
88 rect.bottom = std::max(rect.bottom,
89 static_cast<int>(char_bottom.ValueOrDie<int>()));
86 continue; 90 continue;
87 } 91 }
88 92
89 rect.left = char_left.ValueOrDie(); 93 rect.left = char_left.ValueOrDie();
90 rect.right = char_right.ValueOrDie(); 94 rect.right = char_right.ValueOrDie();
91 rect.top = char_top.ValueOrDie(); 95 rect.top = char_top.ValueOrDie();
92 rect.bottom = char_bottom.ValueOrDie(); 96 rect.bottom = char_bottom.ValueOrDie();
93 bStarted = true; 97 bStarted = true;
94 } 98 }
95 return rect; 99 return rect;
(...skipping 11 matching lines...) Expand all
107 void _CFX_UniqueKeyGen::Generate(int count, ...) { 111 void _CFX_UniqueKeyGen::Generate(int count, ...) {
108 va_list argList; 112 va_list argList;
109 va_start(argList, count); 113 va_start(argList, count);
110 for (int i = 0; i < count; i++) { 114 for (int i = 0; i < count; i++) {
111 int p = va_arg(argList, int); 115 int p = va_arg(argList, int);
112 ((uint32_t*)m_Key)[i] = p; 116 ((uint32_t*)m_Key)[i] = p;
113 } 117 }
114 va_end(argList); 118 va_end(argList);
115 m_KeyLen = count * sizeof(uint32_t); 119 m_KeyLen = count * sizeof(uint32_t);
116 } 120 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698