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

Side by Side Diff: ppapi/tests/test_tcp_socket_private.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_tcp_socket.cc ('k') | ppapi/tests/test_udp_socket.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_tcp_socket_private.h" 5 #include "ppapi/tests/test_tcp_socket_private.h"
6 6
7 #include <stdlib.h> 7 #include <stdlib.h>
8 8
9 #include <new> 9 #include <new>
10 10
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 } 239 }
240 return PP_ERROR_FAILED; 240 return PP_ERROR_FAILED;
241 } 241 }
242 242
243 int32_t TestTCPSocketPrivate::WriteStringToSocket(pp::TCPSocketPrivate* socket, 243 int32_t TestTCPSocketPrivate::WriteStringToSocket(pp::TCPSocketPrivate* socket,
244 const std::string& s) { 244 const std::string& s) {
245 const char* buffer = s.data(); 245 const char* buffer = s.data();
246 size_t written = 0; 246 size_t written = 0;
247 while (written < s.size()) { 247 while (written < s.size()) {
248 TestCompletionCallback cb(instance_->pp_instance(), callback_type()); 248 TestCompletionCallback cb(instance_->pp_instance(), callback_type());
249 int32_t rv = socket->Write(buffer + written, s.size() - written, 249 int32_t rv = socket->Write(buffer + written,
250 static_cast<int32_t>(s.size() - written),
250 cb.GetCallback()); 251 cb.GetCallback());
251 if (callback_type() == PP_REQUIRED && rv != PP_OK_COMPLETIONPENDING) 252 if (callback_type() == PP_REQUIRED && rv != PP_OK_COMPLETIONPENDING)
252 return PP_ERROR_FAILED; 253 return PP_ERROR_FAILED;
253 cb.WaitForResult(rv); 254 cb.WaitForResult(rv);
254 if (cb.result() < 0) 255 if (cb.result() < 0)
255 return cb.result(); 256 return cb.result();
256 if (cb.result() == 0) 257 if (cb.result() == 0)
257 return PP_ERROR_FAILED; 258 return PP_ERROR_FAILED;
258 written += cb.result(); 259 written += cb.result();
259 } 260 }
260 if (written != s.size()) 261 if (written != s.size())
261 return PP_ERROR_FAILED; 262 return PP_ERROR_FAILED;
262 return PP_OK; 263 return PP_OK;
263 } 264 }
OLDNEW
« no previous file with comments | « ppapi/tests/test_tcp_socket.cc ('k') | ppapi/tests/test_udp_socket.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698