QPDF::getLinearizationOffset(QPDFObjGen const& og)
{
    QPDFXRefEntry entry = this->m->xref_table[og];
    qpdf_offset_t result = 0;
    switch (entry.getType())
    {
      case 1:
	result = entry.getOffset();
	break;

      case 2:
	// For compressed objects, return the offset of the object
	// stream that contains them.
	result = getLinearizationOffset(
            QPDFObjGen(entry.getObjStreamNumber(), 0));
	break;

      default:
	throw std::logic_error(
	    "getLinearizationOffset called for xref entry not of type 1 or 2");
	break;
    }
    return result;
}
QPDF::getLinearizationOffset(QPDFObjGen const& og)
{
    QPDFXRefEntry entry = this->m->xref_table[og];
    qpdf_offset_t result = 0;
    switch (entry.getType())
    {
      case 1:
	result = entry.getOffset();
	break;

      case 2:
	 
	 
	result = getLinearizationOffset(
            QPDFObjGen(entry.getObjStreamNumber(), 0));
	break;

      default:
	throw std::logic_error(
	    "getLinearizationOffset called for xref entry not of type 1 or 2");
	break;
    }
    return result;
}