mirror of
https://github.com/ceres-solver/ceres-solver.git
synced 2026-08-29 08:34:37 +08:00
Enforce the read call returns correct value
fix compilation error on Ubuntu 12.0
In file included from /usr/include/fcntl.h:252:0,
from /home/ajg23/src/ceres-solver/examples/libmv_bundle_adjuster.cc:91:
/home/ajg23/src/ceres-solver/examples/libmv_bundle_adjuster.cc: In member function ‘T {anonymous}::EndianAwareFileReader::Read() const [with T = unsigned char]’:
/home/ajg23/src/ceres-solver/examples/libmv_bundle_adjuster.cc:300:5: error: ignoring return value of ‘ssize_t read(int, void*, size_t)’, declared with attribute warn_unused_result [-Werror=unused-result]
Change-Id: Ib23ca19778761bbfe0d77bcf32a2181ce6db1a12
This commit is contained in:
@@ -297,7 +297,7 @@ class EndianAwareFileReader {
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
T Read(void) const {
|
T Read(void) const {
|
||||||
T value;
|
T value;
|
||||||
read(file_descriptor_, &value, sizeof(value));
|
CHECK_GT(read(file_descriptor_, &value, sizeof(value)), 0);
|
||||||
// Switch endian type if file contains data in different type
|
// Switch endian type if file contains data in different type
|
||||||
// that current machine.
|
// that current machine.
|
||||||
if (file_endian_type_ != host_endian_type_) {
|
if (file_endian_type_ != host_endian_type_) {
|
||||||
|
|||||||
Reference in New Issue
Block a user