GFXprim
2D bitmap graphics library with emphasis on speed and correctness
Loading...
Searching...
No Matches
Enumerations | Functions
gp_seek.h File Reference

Seek contants and transformations. More...

#include <sys/types.h>
#include <stddef.h>

Go to the source code of this file.

Enumerations

enum  gp_seek_whence
 Seek constants. More...
 

Functions

static int gp_seek_off (ssize_t off, enum gp_seek_whence whence, size_t *cur_pos, size_t max_pos)
 Computes position for a seek like parameters.
 

Detailed Description

Seek contants and transformations.

Definition in file gp_seek.h.

Enumeration Type Documentation

◆ gp_seek_whence

Seek constants.

Values are 1:1 with constants passed to lseek()

Definition at line 24 of file gp_seek.h.

Function Documentation

◆ gp_seek_off()

static int gp_seek_off ( ssize_t  off,
enum gp_seek_whence  whence,
size_t *  cur_pos,
size_t  max_pos 
)
inlinestatic

Computes position for a seek like parameters.

Parameters
whenceA whence for offset.
offAn offeset to seek to.
cur_posPointer to a current postion, set to new offset upon successful exit.
max_posMaximal reachable offset.
Returns
A zero if new offset is between 0 and max_pos, -1 if new offset is smaller than zero and 1 if it's greater than max_pos.

Definition at line 41 of file gp_seek.h.