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

Side by Side Diff: chrome/browser/local_discovery/service_discovery_client_mac.mm

Issue 1550593002: Switch to standard integer types in chrome/browser/, part 2 of 4. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 "chrome/browser/local_discovery/service_discovery_client_mac.h" 5 #include "chrome/browser/local_discovery/service_discovery_client_mac.h"
6 6
7 #import <arpa/inet.h> 7 #import <arpa/inet.h>
8 #import <Foundation/Foundation.h> 8 #import <Foundation/Foundation.h>
9 #import <net/if_dl.h> 9 #import <net/if_dl.h>
10 #include <stddef.h>
11 #include <stdint.h>
10 12
11 #include "base/debug/dump_without_crashing.h" 13 #include "base/debug/dump_without_crashing.h"
12 #include "base/memory/singleton.h" 14 #include "base/memory/singleton.h"
13 #include "base/metrics/histogram.h" 15 #include "base/metrics/histogram.h"
14 #include "base/single_thread_task_runner.h" 16 #include "base/single_thread_task_runner.h"
15 #include "base/thread_task_runner_handle.h" 17 #include "base/thread_task_runner_handle.h"
16 #include "base/threading/thread.h" 18 #include "base/threading/thread.h"
17 #include "net/base/ip_address_number.h" 19 #include "net/base/ip_address_number.h"
18 #include "net/base/ip_endpoint.h" 20 #include "net/base/ip_endpoint.h"
19 21
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 void ParseTxtRecord(NSData* record, std::vector<std::string>* output) { 95 void ParseTxtRecord(NSData* record, std::vector<std::string>* output) {
94 if (record == nil || [record length] <= 1) 96 if (record == nil || [record length] <= 1)
95 return; 97 return;
96 98
97 VLOG(1) << "ParseTxtRecord: " << [record length]; 99 VLOG(1) << "ParseTxtRecord: " << [record length];
98 100
99 const char* record_bytes = reinterpret_cast<const char*>([record bytes]); 101 const char* record_bytes = reinterpret_cast<const char*>([record bytes]);
100 const char* const record_end = record_bytes + [record length]; 102 const char* const record_end = record_bytes + [record length];
101 // TODO(justinlin): More strict bounds checking. 103 // TODO(justinlin): More strict bounds checking.
102 while (record_bytes < record_end) { 104 while (record_bytes < record_end) {
103 uint8 size = *record_bytes++; 105 uint8_t size = *record_bytes++;
104 if (size <= 0) 106 if (size <= 0)
105 continue; 107 continue;
106 108
107 if (record_bytes + size <= record_end) { 109 if (record_bytes + size <= record_end) {
108 VLOG(1) << "TxtRecord: " 110 VLOG(1) << "TxtRecord: "
109 << std::string(record_bytes, static_cast<size_t>(size)); 111 << std::string(record_bytes, static_cast<size_t>(size));
110 output->push_back( 112 output->push_back(
111 [[[NSString alloc] initWithBytes:record_bytes 113 [[[NSString alloc] initWithBytes:record_bytes
112 length:size 114 length:size
113 encoding:NSUTF8StringEncoding] UTF8String]); 115 encoding:NSUTF8StringEncoding] UTF8String]);
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 container_->OnResolveUpdate(local_discovery::ServiceResolver::STATUS_SUCCESS); 483 container_->OnResolveUpdate(local_discovery::ServiceResolver::STATUS_SUCCESS);
482 } 484 }
483 485
484 - (void)netService:(NSNetService *)sender 486 - (void)netService:(NSNetService *)sender
485 didNotResolve:(NSDictionary *)errorDict { 487 didNotResolve:(NSDictionary *)errorDict {
486 container_->OnResolveUpdate( 488 container_->OnResolveUpdate(
487 local_discovery::ServiceResolver::STATUS_REQUEST_TIMEOUT); 489 local_discovery::ServiceResolver::STATUS_REQUEST_TIMEOUT);
488 } 490 }
489 491
490 @end 492 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698