/* Returns: Number of bytes skipped, or -1 on error  */
gssize g_input_stream_skip(GInputStream *stream, gsize count, GCancellable *cancellable, GError **error)
/* Returns: Number of bytes skipped, or -1 on error  */
gssize g_input_stream_skip(GInputStream *stream, gsize count, GCancellable *cancellable, GError **error)
{
  GInputStreamClass *class;
  gssize res;
  g_return_val_if_fail (G_IS_INPUT_STREAM (stream), -1);
  if (count == 0)
    return 0;
  if (((gssize) count) < 0)
    {
      g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT,
		   _("Too large count value passed to %s"), G_STRFUNC);
      return -1;
    }
  class = G_INPUT_STREAM_GET_CLASS (stream);
  if (!g_input_stream_set_pending (stream, error))
    return -1;
  if (cancellable)
    g_cancellable_push_current (cancellable);
  res = class->skip (stream, count, cancellable, error);
  if (cancellable)
    g_cancellable_pop_current (cancellable);
  g_input_stream_clear_pending (stream);
  return res;
}