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

Side by Side Diff: ppapi/tests/test_flash_file.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_flash_clipboard.cc ('k') | ppapi/tests/test_host_resolver.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 (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/tests/test_flash_file.h" 5 #include "ppapi/tests/test_flash_file.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "ppapi/c/pp_file_info.h" 10 #include "ppapi/c/pp_file_info.h"
(...skipping 18 matching lines...) Expand all
29 #if defined(PPAPI_OS_WIN) 29 #if defined(PPAPI_OS_WIN)
30 CloseHandle(file_handle); 30 CloseHandle(file_handle);
31 #else 31 #else
32 close(file_handle); 32 close(file_handle);
33 #endif 33 #endif
34 } 34 }
35 35
36 bool WriteFile(PP_FileHandle file_handle, const std::string& contents) { 36 bool WriteFile(PP_FileHandle file_handle, const std::string& contents) {
37 #if defined(PPAPI_OS_WIN) 37 #if defined(PPAPI_OS_WIN)
38 DWORD bytes_written = 0; 38 DWORD bytes_written = 0;
39 BOOL result = ::WriteFile(file_handle, contents.c_str(), contents.size(), 39 BOOL result = ::WriteFile(file_handle, contents.c_str(),
40 static_cast<DWORD>(contents.size()),
40 &bytes_written, NULL); 41 &bytes_written, NULL);
41 return result && bytes_written == static_cast<DWORD>(contents.size()); 42 return result && bytes_written == static_cast<DWORD>(contents.size());
42 #else 43 #else
43 ssize_t bytes_written = 0; 44 ssize_t bytes_written = 0;
44 do { 45 do {
45 bytes_written = write(file_handle, contents.c_str(), contents.size()); 46 bytes_written = write(file_handle, contents.c_str(), contents.size());
46 } while (bytes_written == -1 && errno == EINTR); 47 } while (bytes_written == -1 && errno == EINTR);
47 return bytes_written == static_cast<ssize_t>(contents.size()); 48 return bytes_written == static_cast<ssize_t>(contents.size());
48 #endif 49 #endif
49 } 50 }
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 } 326 }
326 327
327 std::string TestFlashFile::GetItemCountUnderModuleLocalRoot( 328 std::string TestFlashFile::GetItemCountUnderModuleLocalRoot(
328 size_t* item_count) { 329 size_t* item_count) {
329 std::vector<FileModuleLocal::DirEntry> contents; 330 std::vector<FileModuleLocal::DirEntry> contents;
330 ASSERT_TRUE( 331 ASSERT_TRUE(
331 FileModuleLocal::GetDirContents(instance_, std::string(), &contents)); 332 FileModuleLocal::GetDirContents(instance_, std::string(), &contents));
332 *item_count = contents.size(); 333 *item_count = contents.size();
333 PASS(); 334 PASS();
334 } 335 }
OLDNEW
« no previous file with comments | « ppapi/tests/test_flash_clipboard.cc ('k') | ppapi/tests/test_host_resolver.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698