g_scanner and third party seeks





I do I tell g_scanner, that I have lseek'd the fd?

g_scanner_sync_file_offset() does not help, because it just seeks
the readahead back.
g_scanner_input_file() does not help, because it calls g_scanner_sync_file_offset().

maybe you could add something like following function:

void
g_scanner_seek_file(GScanner *scanner, gint offset )
{
  g_return_if_fail (scanner != NULL);

  if (scanner->input_fd >= 0)
    {
      if (lseek (scanner->input_fd, offset, SEEK_SET) >= 0)
	{
	  /* we succeeded, blow our buffer's contents now */
	  scanner->text = NULL;
	  scanner->text_end = NULL;
	}
      else
	errno = 0;
    }
}

	
-- 
Robert Wilhelm



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]