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

Side by Side Diff: ppapi/tests/test_file_mapping.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
« no previous file with comments | « ppapi/tests/test_file_io.cc ('k') | ppapi/tests/test_flash_clipboard.cc » ('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 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/tests/test_file_mapping.h" 5 #include "ppapi/tests/test_file_mapping.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include <limits> 9 #include <limits>
10 #include <string> 10 #include <string>
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 } 48 }
49 49
50 int32_t WriteEntireBuffer(PP_Instance instance, 50 int32_t WriteEntireBuffer(PP_Instance instance,
51 pp::FileIO* file_io, 51 pp::FileIO* file_io,
52 int32_t offset, 52 int32_t offset,
53 const std::string& data, 53 const std::string& data,
54 CallbackType callback_type) { 54 CallbackType callback_type) {
55 TestCompletionCallback callback(instance, callback_type); 55 TestCompletionCallback callback(instance, callback_type);
56 int32_t write_offset = offset; 56 int32_t write_offset = offset;
57 const char* buf = data.c_str(); 57 const char* buf = data.c_str();
58 int32_t size = data.size(); 58 int32_t size = static_cast<int32_t>(data.size());
59 59
60 while (write_offset < offset + size) { 60 while (write_offset < offset + size) {
61 callback.WaitForResult(file_io->Write(write_offset, 61 callback.WaitForResult(file_io->Write(write_offset,
62 &buf[write_offset - offset], 62 &buf[write_offset - offset],
63 size - write_offset + offset, 63 size - write_offset + offset,
64 callback.GetCallback())); 64 callback.GetCallback()));
65 if (callback.result() < 0) 65 if (callback.result() < 0)
66 return callback.result(); 66 return callback.result();
67 if (callback.result() == 0) 67 if (callback.result() == 0)
68 return PP_ERROR_FAILED; 68 return PP_ERROR_FAILED;
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 0, 530 0,
531 &new_file_contents2, 531 &new_file_contents2,
532 callback_type())); 532 callback_type()));
533 ASSERT_EQ(expected_file_contents2, new_file_contents2); 533 ASSERT_EQ(expected_file_contents2, new_file_contents2);
534 534
535 // TODO(dmichael): Test non-zero offset 535 // TODO(dmichael): Test non-zero offset
536 536
537 PASS(); 537 PASS();
538 } 538 }
539 539
OLDNEW
« no previous file with comments | « ppapi/tests/test_file_io.cc ('k') | ppapi/tests/test_flash_clipboard.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698