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

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: 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 } 84 }
85 #else // drop the support for desktop linux for now 85 #else // drop the support for desktop linux for now
86 DLOG(WARNING) << "LibGps is only supported on ChromeOS"; 86 DLOG(WARNING) << "LibGps is only supported on ChromeOS";
87 return false; 87 return false;
88 #endif 88 #endif
89
90 is_open_ = true;
91 return true;
joth 2012/06/08 20:39:00 this is still needed for the OS_CHROMEOS case (it
kmadhusu 2012/06/08 20:47:32 oops.. missed that path.. Fixed now.
92 } 89 }
93 void LibGps::Stop() { 90 void LibGps::Stop() {
94 if (is_open_) 91 if (is_open_)
95 gps_close_(gps_data_.get()); 92 gps_close_(gps_data_.get());
96 is_open_ = false; 93 is_open_ = false;
97 } 94 }
98 95
99 bool LibGps::Read(content::Geoposition* position) { 96 bool LibGps::Read(content::Geoposition* position) {
100 DCHECK(position); 97 DCHECK(position);
101 position->error_code = content::Geoposition::ERROR_CODE_POSITION_UNAVAILABLE; 98 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)) 163 if (!isnan(gps_data_->fix.epv))
167 position->altitude_accuracy = gps_data_->fix.epv; 164 position->altitude_accuracy = gps_data_->fix.epv;
168 } 165 }
169 166
170 if (!isnan(gps_data_->fix.track)) 167 if (!isnan(gps_data_->fix.track))
171 position->heading = gps_data_->fix.track; 168 position->heading = gps_data_->fix.track;
172 if (!isnan(gps_data_->fix.speed)) 169 if (!isnan(gps_data_->fix.speed))
173 position->speed = gps_data_->fix.speed; 170 position->speed = gps_data_->fix.speed;
174 return true; 171 return true;
175 } 172 }
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