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

Side by Side Diff: third_party/sudden_motion_sensor/sudden_motion_sensor_mac.cc

Issue 10383207: Fix new -Wnull-conversion violations detected by a newer clang. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « printing/pdf_metafile_skia.cc ('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 // This file is based on the SMSLib library. 5 // This file is based on the SMSLib library.
6 // 6 //
7 // SMSLib Sudden Motion Sensor Access Library 7 // SMSLib Sudden Motion Sensor Access Library
8 // Copyright (c) 2010 Suitable Systems 8 // Copyright (c) 2010 Suitable Systems
9 // All rights reserved. 9 // All rights reserved.
10 // 10 //
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 } 282 }
283 283
284 // Probe the local hardware looking for a supported sensor device 284 // Probe the local hardware looking for a supported sensor device
285 // and initialize an I/O connection to it. 285 // and initialize an I/O connection to it.
286 bool SuddenMotionSensor::Init() { 286 bool SuddenMotionSensor::Init() {
287 // Request model name from the kernel. 287 // Request model name from the kernel.
288 char local_model[32]; // size from SMSLib 288 char local_model[32]; // size from SMSLib
289 size_t local_model_size = sizeof(local_model); 289 size_t local_model_size = sizeof(local_model);
290 int params[2] = { CTL_HW, HW_MODEL }; 290 int params[2] = { CTL_HW, HW_MODEL };
291 if (sysctl(params, 2, local_model, &local_model_size, NULL, 0) != 0) 291 if (sysctl(params, 2, local_model, &local_model_size, NULL, 0) != 0)
292 return NULL; 292 return false;
293 293
294 const SensorDescriptor* sensor_candidate = NULL; 294 const SensorDescriptor* sensor_candidate = NULL;
295 295
296 // Look for the current model in the supported sensor list. 296 // Look for the current model in the supported sensor list.
297 base::mac::ScopedCFTypeRef<CFDataRef> board_id_data; 297 base::mac::ScopedCFTypeRef<CFDataRef> board_id_data;
298 const int kNumSensors = arraysize(kSupportedSensors); 298 const int kNumSensors = arraysize(kSupportedSensors);
299 299
300 for (int i = 0; i < kNumSensors; ++i) { 300 for (int i = 0; i < kNumSensors; ++i) {
301 // Check if the supported sensor model name is a prefix 301 // Check if the supported sensor model name is a prefix
302 // of the local hardware model (empty names are accepted). 302 // of the local hardware model (empty names are accepted).
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 if (value & 0x00800000) 391 if (value & 0x00800000)
392 return value | 0xff000000; 392 return value | 0xff000000;
393 break; 393 break;
394 394
395 default: 395 default:
396 LOG(FATAL) << "Invalid integer size for sign extension: " << size; 396 LOG(FATAL) << "Invalid integer size for sign extension: " << size;
397 } 397 }
398 398
399 return value; 399 return value;
400 } 400 }
OLDNEW
« no previous file with comments | « printing/pdf_metafile_skia.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698