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

Unified Diff: content/common/mac/font_loader.mm

Issue 1499423004: Remove kint32max. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@kint9
Patch Set: rebase Created 5 years 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 | « content/common/mac/font_loader.h ('k') | content/public/common/context_menu_params.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/mac/font_loader.mm
diff --git a/content/common/mac/font_loader.mm b/content/common/mac/font_loader.mm
index d829175b8a84e7bd504205d10a8a6abac09441c9..a533cf2065e81e1ab4482b8e7d5699550e752b27 100644
--- a/content/common/mac/font_loader.mm
+++ b/content/common/mac/font_loader.mm
@@ -6,6 +6,8 @@
#import <Cocoa/Cocoa.h>
+#include <limits>
+
#include "base/basictypes.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
@@ -57,7 +59,7 @@ void _CTFontManagerUnregisterFontForData(NSUInteger, int) {
namespace {
-uint32 GetFontIDForFont(const base::FilePath& font_path) {
+uint32_t GetFontIDForFont(const base::FilePath& font_path) {
// content/common can't depend on content/browser, so this cannot call
// BrowserThread::CurrentlyOn(). Check this is always called on the same
// thread.
@@ -69,14 +71,14 @@ uint32 GetFontIDForFont(const base::FilePath& font_path) {
// ATS is deprecated and CTFont doesn't seem to have a obvious fixed id for a
// font. Since this function is only called from a single thread, use a static
// map to store ids.
- typedef std::map<base::FilePath, uint32> FontIdMap;
+ typedef std::map<base::FilePath, uint32_t> FontIdMap;
CR_DEFINE_STATIC_LOCAL(FontIdMap, font_ids, ());
auto it = font_ids.find(font_path);
if (it != font_ids.end())
return it->second;
- uint32 font_id = font_ids.size() + 1;
+ uint32_t font_id = font_ids.size() + 1;
font_ids[font_path] = font_id;
return font_id;
}
@@ -120,25 +122,26 @@ void FontLoader::LoadFont(const FontDescriptor& font,
base::FilePath font_path = base::mac::NSStringToFilePath([font_url path]);
// Load file into shared memory buffer.
- int64 font_file_size_64 = -1;
+ int64_t font_file_size_64 = -1;
if (!base::GetFileSize(font_path, &font_file_size_64)) {
DLOG(ERROR) << "Couldn't get font file size for " << font_path.value();
return;
}
- if (font_file_size_64 <= 0 || font_file_size_64 >= kint32max) {
+ if (font_file_size_64 <= 0 ||
+ font_file_size_64 >= std::numeric_limits<int32_t>::max()) {
DLOG(ERROR) << "Bad size for font file " << font_path.value();
return;
}
- int32 font_file_size_32 = static_cast<int32>(font_file_size_64);
+ int32_t font_file_size_32 = static_cast<int32_t>(font_file_size_64);
if (!result->font_data.CreateAndMapAnonymous(font_file_size_32)) {
DLOG(ERROR) << "Failed to create shmem area for " << font.font_name;
return;
}
- int32 amt_read = base::ReadFile(font_path,
- reinterpret_cast<char*>(result->font_data.memory()),
+ int32_t amt_read = base::ReadFile(
+ font_path, reinterpret_cast<char*>(result->font_data.memory()),
font_file_size_32);
if (amt_read != font_file_size_32) {
DLOG(ERROR) << "Failed to read font data for " << font_path.value();
@@ -151,7 +154,7 @@ void FontLoader::LoadFont(const FontDescriptor& font,
// static
bool FontLoader::CGFontRefFromBuffer(base::SharedMemoryHandle font_data,
- uint32 font_data_size,
+ uint32_t font_data_size,
CGFontRef* out) {
*out = NULL;
« no previous file with comments | « content/common/mac/font_loader.h ('k') | content/public/common/context_menu_params.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698