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

Side by Side Diff: rlz/lib/rlz_lib.cc

Issue 2041413007: Remove unused function rlz_lib::PingFinancialServer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 | « rlz/lib/rlz_lib.h ('k') | no next file » | 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 // A library to manage RLZ information for access-points shared 5 // A library to manage RLZ information for access-points shared
6 // across different client applications. 6 // across different client applications.
7 7
8 #include "rlz/lib/rlz_lib.h" 8 #include "rlz/lib/rlz_lib.h"
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 return false; 370 return false;
371 371
372 if (request_string.size() >= request_buffer_size) 372 if (request_string.size() >= request_buffer_size)
373 return false; 373 return false;
374 374
375 strncpy(request, request_string.c_str(), request_buffer_size); 375 strncpy(request, request_string.c_str(), request_buffer_size);
376 request[request_buffer_size - 1] = 0; 376 request[request_buffer_size - 1] = 0;
377 return true; 377 return true;
378 } 378 }
379 379
380 bool PingFinancialServer(Product product, const char* request, char* response,
381 size_t response_buffer_size) {
382 if (!response || response_buffer_size == 0)
383 return false;
384 response[0] = 0;
385
386 // Check if the time is right to ping.
387 if (!FinancialPing::IsPingTime(product, false))
388 return false;
389
390 // Send out the ping.
391 std::string response_string;
392 if (!FinancialPing::PingServer(request, &response_string))
393 return false;
394
395 if (response_string.size() >= response_buffer_size)
396 return false;
397
398 strncpy(response, response_string.c_str(), response_buffer_size);
399 response[response_buffer_size - 1] = 0;
400 return true;
401 }
402
403 bool IsPingResponseValid(const char* response, int* checksum_idx) { 380 bool IsPingResponseValid(const char* response, int* checksum_idx) {
404 if (!response || !response[0]) 381 if (!response || !response[0])
405 return false; 382 return false;
406 383
407 if (checksum_idx) 384 if (checksum_idx)
408 *checksum_idx = -1; 385 *checksum_idx = -1;
409 386
410 if (strlen(response) > kMaxPingResponseLength) { 387 if (strlen(response) > kMaxPingResponseLength) {
411 ASSERT_STRING("IsPingResponseValid: response is too long to parse."); 388 ASSERT_STRING("IsPingResponseValid: response is too long to parse.");
412 return false; 389 return false;
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
650 if (cgi_string.size() >= cgi_size) 627 if (cgi_string.size() >= cgi_size)
651 return false; 628 return false;
652 629
653 strncpy(cgi, cgi_string.c_str(), cgi_size); 630 strncpy(cgi, cgi_string.c_str(), cgi_size);
654 cgi[cgi_size - 1] = 0; 631 cgi[cgi_size - 1] = 0;
655 632
656 return true; 633 return true;
657 } 634 }
658 635
659 } // namespace rlz_lib 636 } // namespace rlz_lib
OLDNEW
« no previous file with comments | « rlz/lib/rlz_lib.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698