/* Display the names and sizes of all chunks in the PNG file.  */
void displayChunkNames(const std::vector< unsigned char > &buffer)
/* Display the names and sizes of all chunks in the PNG file.  */
void displayChunkNames(const std::vector< unsigned char > &buffer)
{
    char type[5];
    lodepng_chunk_type(type, chunk);
    if(std::string(type).size() != 4) {
      std::cout << "this is probably not a PNG" << std::endl;
      return;
    }
    if(last_type != type) {
      std::cout << std::endl;
      std::cout << " " << type << ": ";
    }
    last_type = type;
    std::cout << lodepng_chunk_length(chunk) << ", ";
    chunk = lodepng_chunk_next_const(chunk, end);
  }
  std::cout << std::endl;
}