Beispiel #1
0
mms_off_t mmsx_seek (mms_io_t *io, mmsx_t *mmsx, mms_off_t offset, int origin)
{
  if(mmsx->connection)
    return mms_seek(io, mmsx->connection, offset, origin);
  else
    return mmsh_seek(io, mmsx->connection_h, offset, origin);
}
Beispiel #2
0
static int mms_vfs_fseek_impl (VFSFile * file, int64_t offset, int whence)
{
    MMSHandle * h = vfs_get_handle (file);

    if (whence == SEEK_CUR)
    {
        if (h->mms)
            offset += mms_get_current_pos (h->mms);
        else
            offset += mmsh_get_current_pos (h->mmsh);
    }
    else if (whence == SEEK_END)
    {
        if (h->mms)
            offset += mms_get_length (h->mms);
        else
            offset += mmsh_get_length (h->mmsh);
    }

    int64_t ret;

    if (h->mms)
        ret = mms_seek (NULL, h->mms, offset, SEEK_SET);
    else
        ret = mmsh_seek (NULL, h->mmsh, offset, SEEK_SET);

    if (ret < 0 || ret != offset)
    {
        fprintf (stderr, "mms: Seek failed.\n");
        return -1;
    }

    return 0;
}