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

Side by Side Diff: ppapi/shared_impl/flash_clipboard_format_registry.cc

Issue 915403003: Enable size_t to int truncation warnings in PPAPI (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium 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 #include "ppapi/shared_impl/flash_clipboard_format_registry.h" 5 #include "ppapi/shared_impl/flash_clipboard_format_registry.h"
6 6
7 #include <cctype> 7 #include <cctype>
8 8
9 namespace ppapi { 9 namespace ppapi {
10 10
(...skipping 25 matching lines...) Expand all
36 FlashClipboardFormatRegistry::FlashClipboardFormatRegistry() {} 36 FlashClipboardFormatRegistry::FlashClipboardFormatRegistry() {}
37 37
38 FlashClipboardFormatRegistry::~FlashClipboardFormatRegistry() {} 38 FlashClipboardFormatRegistry::~FlashClipboardFormatRegistry() {}
39 39
40 uint32_t FlashClipboardFormatRegistry::RegisterFormat( 40 uint32_t FlashClipboardFormatRegistry::RegisterFormat(
41 const std::string& format_name) { 41 const std::string& format_name) {
42 if (!IsValidFormatName(format_name) || 42 if (!IsValidFormatName(format_name) ||
43 custom_formats_.size() > kMaxNumFormats) { 43 custom_formats_.size() > kMaxNumFormats) {
44 return PP_FLASH_CLIPBOARD_FORMAT_INVALID; 44 return PP_FLASH_CLIPBOARD_FORMAT_INVALID;
45 } 45 }
46 uint32_t key = kFirstCustomFormat + custom_formats_.size(); 46 uint32_t key = kFirstCustomFormat +
47 static_cast<uint32_t>(custom_formats_.size());
47 custom_formats_[key] = format_name; 48 custom_formats_[key] = format_name;
48 return key; 49 return key;
49 } 50 }
50 51
51 void FlashClipboardFormatRegistry::SetRegisteredFormat( 52 void FlashClipboardFormatRegistry::SetRegisteredFormat(
52 const std::string& format_name, 53 const std::string& format_name,
53 uint32_t format) { 54 uint32_t format) {
54 custom_formats_[format] = format_name; 55 custom_formats_[format] = format_name;
55 } 56 }
56 57
(...skipping 20 matching lines...) Expand all
77 } 78 }
78 79
79 // static 80 // static
80 bool FlashClipboardFormatRegistry::IsValidPredefinedFormat(uint32_t format) { 81 bool FlashClipboardFormatRegistry::IsValidPredefinedFormat(uint32_t format) {
81 if (format == PP_FLASH_CLIPBOARD_FORMAT_INVALID) 82 if (format == PP_FLASH_CLIPBOARD_FORMAT_INVALID)
82 return false; 83 return false;
83 return format < kFirstCustomFormat; 84 return format < kFirstCustomFormat;
84 } 85 }
85 86
86 } // namespace ppapi 87 } // namespace ppapi
OLDNEW
« ppapi/proxy/url_loader_resource.cc ('K') | « ppapi/shared_impl/array_writer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698