@@ -34,15 +34,15 @@ namespace {
34
34
// 'output_file'.
35
35
void WriteBinaryPcdHeader (const bool has_color, const bool has_intensities,
36
36
const int64 num_points, FileWriter* const file_writer) {
37
- std::string color_header_field = !has_color ? " " : " rgb" ;
38
- std::string color_header_type = !has_color ? " " : " U" ;
39
- std::string color_header_size = !has_color ? " " : " 4" ;
40
- std::string color_header_count = !has_color ? " " : " 1" ;
37
+ const std::string color_header_field = !has_color ? " " : " rgb" ;
38
+ const std::string color_header_type = !has_color ? " " : " U" ;
39
+ const std::string color_header_size = !has_color ? " " : " 4" ;
40
+ const std::string color_header_count = !has_color ? " " : " 1" ;
41
41
42
- std::string intensity_header_field = !has_intensities ? " " : " intensity" ;
43
- std::string intensity_header_type = !has_intensities ? " " : " F" ;
44
- std::string intensity_header_size = !has_intensities ? " " : " 4" ;
45
- std::string intensity_header_count = !has_intensities ? " " : " 1" ;
42
+ const std::string intensity_header_field = !has_intensities ? " " : " intensity" ;
43
+ const std::string intensity_header_type = !has_intensities ? " " : " F" ;
44
+ const std::string intensity_header_size = !has_intensities ? " " : " 4" ;
45
+ const std::string intensity_header_count = !has_intensities ? " " : " 1" ;
46
46
47
47
std::ostringstream stream;
48
48
stream << " # generated by Cartographer\n "
@@ -71,9 +71,10 @@ void WriteBinaryPcdPointCoordinate(const Eigen::Vector3f& point,
71
71
}
72
72
73
73
void WriteBinaryPcdIntensity (const float intensity,
74
- FileWriter* const file_writer) {
75
- CHECK (file_writer->Write (reinterpret_cast <const char *>(&intensity),
76
- sizeof (float )));
74
+ FileWriter* const file_writer) {
75
+ char buffer[4 ];
76
+ memcpy (buffer, &intensity, sizeof (float ));
77
+ CHECK (file_writer->Write (buffer, 4 ));
77
78
}
78
79
79
80
void WriteBinaryPcdPointColor (const Uint8Color& color,
0 commit comments