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

Side by Side Diff: ppapi/proxy/pdf_resource.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: ppapi_unittests win x64 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/proxy/pdf_resource.h" 5 #include "ppapi/proxy/pdf_resource.h"
6 6
7 #include <stdlib.h> 7 #include <stdlib.h>
8 #include <string.h> 8 #include <string.h>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 ucol_setStrength(collator, strength); 82 ucol_setStrength(collator, strength);
83 usearch_reset(searcher); 83 usearch_reset(searcher);
84 } 84 }
85 85
86 status = U_ZERO_ERROR; 86 status = U_ZERO_ERROR;
87 int match_start = usearch_first(searcher, &status); 87 int match_start = usearch_first(searcher, &status);
88 DCHECK(status == U_ZERO_ERROR); 88 DCHECK(status == U_ZERO_ERROR);
89 89
90 std::vector<PP_PrivateFindResult> pp_results; 90 std::vector<PP_PrivateFindResult> pp_results;
91 while (match_start != USEARCH_DONE) { 91 while (match_start != USEARCH_DONE) {
92 size_t matched_length = usearch_getMatchedLength(searcher); 92 int32_t matched_length = usearch_getMatchedLength(searcher);
93 PP_PrivateFindResult result; 93 PP_PrivateFindResult result;
94 result.start_index = match_start; 94 result.start_index = match_start;
95 result.length = matched_length; 95 result.length = matched_length;
96 pp_results.push_back(result); 96 pp_results.push_back(result);
97 match_start = usearch_next(searcher, &status); 97 match_start = usearch_next(searcher, &status);
98 DCHECK(status == U_ZERO_ERROR); 98 DCHECK(status == U_ZERO_ERROR);
99 } 99 }
100 100
101 *count = pp_results.size(); 101 *count = static_cast<uint32_t>(pp_results.size());
102 if (*count) { 102 if (*count) {
103 *results = reinterpret_cast<PP_PrivateFindResult*>(malloc( 103 *results = reinterpret_cast<PP_PrivateFindResult*>(malloc(
104 *count * sizeof(PP_PrivateFindResult))); 104 *count * sizeof(PP_PrivateFindResult)));
105 memcpy(*results, &pp_results[0], *count * sizeof(PP_PrivateFindResult)); 105 memcpy(*results, &pp_results[0], *count * sizeof(PP_PrivateFindResult));
106 } else { 106 } else {
107 *results = NULL; 107 *results = NULL;
108 } 108 }
109 109
110 usearch_close(searcher); 110 usearch_close(searcher);
111 } 111 }
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 void PDFResource::GetV8ExternalSnapshotData(const char** natives_data_out, 209 void PDFResource::GetV8ExternalSnapshotData(const char** natives_data_out,
210 int* natives_size_out, 210 int* natives_size_out,
211 const char** snapshot_data_out, 211 const char** snapshot_data_out,
212 int* snapshot_size_out) { 212 int* snapshot_size_out) {
213 gin::IsolateHolder::GetV8ExternalSnapshotData(natives_data_out, 213 gin::IsolateHolder::GetV8ExternalSnapshotData(natives_data_out,
214 natives_size_out, snapshot_data_out, snapshot_size_out); 214 natives_size_out, snapshot_data_out, snapshot_size_out);
215 } 215 }
216 216
217 } // namespace proxy 217 } // namespace proxy
218 } // namespace ppapi 218 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/flash_clipboard_resource.cc ('k') | ppapi/proxy/platform_verification_private_resource.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698