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

Side by Side Diff: content/browser/geolocation/libgps_wrapper_linux.cc

Issue 10542081: Coverity: Restructure logically dead code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed review comments. Created 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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 #include "content/browser/geolocation/libgps_wrapper_linux.h" 5 #include "content/browser/geolocation/libgps_wrapper_linux.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 #include <dlfcn.h> 8 #include <dlfcn.h>
9 #include <errno.h> 9 #include <errno.h>
10 10
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 bool LibGps::Start() { 74 bool LibGps::Start() {
75 if (is_open_) 75 if (is_open_)
76 return true; 76 return true;
77 77
78 #if defined(OS_CHROMEOS) 78 #if defined(OS_CHROMEOS)
79 errno = 0; 79 errno = 0;
80 if (gps_open_(GPSD_SHARED_MEMORY, 0, gps_data_.get()) != 0) { 80 if (gps_open_(GPSD_SHARED_MEMORY, 0, gps_data_.get()) != 0) {
81 // See gps.h NL_NOxxx for definition of gps_open() error numbers. 81 // See gps.h NL_NOxxx for definition of gps_open() error numbers.
82 DLOG(WARNING) << "gps_open() failed " << errno; 82 DLOG(WARNING) << "gps_open() failed " << errno;
83 return false; 83 return false;
84 } else {
85 is_open_ = true;
86 return true;
84 } 87 }
85 #else // drop the support for desktop linux for now 88 #else // drop the support for desktop linux for now
86 DLOG(WARNING) << "LibGps is only supported on ChromeOS"; 89 DLOG(WARNING) << "LibGps is only supported on ChromeOS";
87 return false; 90 return false;
88 #endif 91 #endif
89
90 is_open_ = true;
91 return true;
92 } 92 }
93 void LibGps::Stop() { 93 void LibGps::Stop() {
94 if (is_open_) 94 if (is_open_)
95 gps_close_(gps_data_.get()); 95 gps_close_(gps_data_.get());
96 is_open_ = false; 96 is_open_ = false;
97 } 97 }
98 98
99 bool LibGps::Read(content::Geoposition* position) { 99 bool LibGps::Read(content::Geoposition* position) {
100 DCHECK(position); 100 DCHECK(position);
101 position->error_code = content::Geoposition::ERROR_CODE_POSITION_UNAVAILABLE; 101 position->error_code = content::Geoposition::ERROR_CODE_POSITION_UNAVAILABLE;
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 if (!isnan(gps_data_->fix.epv)) 166 if (!isnan(gps_data_->fix.epv))
167 position->altitude_accuracy = gps_data_->fix.epv; 167 position->altitude_accuracy = gps_data_->fix.epv;
168 } 168 }
169 169
170 if (!isnan(gps_data_->fix.track)) 170 if (!isnan(gps_data_->fix.track))
171 position->heading = gps_data_->fix.track; 171 position->heading = gps_data_->fix.track;
172 if (!isnan(gps_data_->fix.speed)) 172 if (!isnan(gps_data_->fix.speed))
173 position->speed = gps_data_->fix.speed; 173 position->speed = gps_data_->fix.speed;
174 return true; 174 return true;
175 } 175 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698