Skip to content

Instantly share code, notes, and snippets.

@mjcarroll
Created November 15, 2012 17:06
Show Gist options
  • Select an option

  • Save mjcarroll/4079802 to your computer and use it in GitHub Desktop.

Select an option

Save mjcarroll/4079802 to your computer and use it in GitHub Desktop.
PCL lseek error
#include <iostream>
#include <pcl/io/pcd_io.h>
#include <pcl/point_types.h>
int
main (int argc, char** argv)
{
std::cout << "sizeof(off_t)" << sizeof(off_t) << std::endl;
std::cout << "sizeof(off64_t)" << sizeof(off64_t) << std::endl;
// Fails at (2^32/2 - getpagesize())/sizeof(pcl::PointXYZ)
// (2^32/2 - 4096)/12 = 178956629.33
// Passes
pcl::PointCloud<pcl::PointXYZ> cloud;
cloud.width = 178956629;
cloud.height = 1;
cloud.is_dense = false;
cloud.points.resize (cloud.width);
pcl::io::savePCDFileBinary ("test_pcd.pcd", cloud);
std::cerr << "Saved " << cloud.points.size () << " data points to test_pcd.pcd." << std::endl;
// Fails
cloud.width = 178956630;
cloud.height = 1;
cloud.is_dense = false;
cloud.points.resize (cloud.width);
pcl::io::savePCDFileBinary ("test_pcd.pcd", cloud);
std::cerr << "Saved " << cloud.points.size () << " data points to test_pcd.pcd." << std::endl;
return (0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment