Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libtizplatform: add 'tiz_buffer_seek', 'tiz_buffer_offset' and 'tiz_buffer_overwrite_mode' apis #264

Closed
juanrubio opened this issue Oct 21, 2016 · 0 comments

Comments

Projects
None yet
1 participant
@juanrubio
Copy link
Collaborator

commented Oct 21, 2016

/* The possibilities for the third argument to 'tiz_buffer_seek'.
   These values should not be changed.  */
#define TIZ_BUFFER_SEEK_SET 0 /** Seek from beginning of buffer.  */
#define TIZ_BUFFER_SEEK_CUR 1 /** Seek from current position.  */
#define TIZ_BUFFER_SEEK_END 2 /** Seek from end of data.  */

/* The possibilities for the third argument to 'tiz_buffer_overwrite_mode'.
   These values should not be changed.  */
#define TIZ_BUFFER_OVERWRITE_ON_PUSH \
  0 /** During push operations, data behind the current position marker gets
        lost. This is the default mode of operation. */
#define TIZ_BUFFER_OVERWRITE_NEVER \
  1 /** Data behind the current position marker is not lost. */

/**
 * @brief Retrieve the current position marker.
 *
 * @ingroup tizbuffer
 * @param ap_buf The  buffer handle.
 * @return The offset in bytes that marks the current position in the buffer.
 */
int
tiz_buffer_offset (const tiz_buffer_t * ap_buf);

/**
 * Set a new overwrite mode.
 *
 * @ingroup tizbuffer
 * @param ap_buf The dynamic buffer handle.
 * @param a_overwrite_mode TIZ_BUFFER_OVERWRITE_ON_PUSH (default) or
 * TIZ_BUFFER_OVERWRITE_NEVER.
 * @return The old overwrite mode, or -1 on error.
 */
int
tiz_buffer_overwrite_mode (tiz_buffer_t * ap_buf, const int a_overwrite_mode);


/**
 * @brief Re-position the buffer marker.
 *
 * The new position, measured in bytes, is obtained by adding offset bytes to
 * the position specified by whence. If whence is set to TIZ_BUFFER_SEEK_SET,
 * TIZ_BUFFER_SEEK_CUR, or TIZ_BUFFER_SEEK_END, the offset is relative to the
 * start of the buffer, the current position indicator, or end-of-data marker,
 * respectively.
 *
 * @ingroup tizbuffer
 * @param ap_buf The dynamic buffer handle.
 * @param a_offset The new position is obtained by adding a_offset bytes to the
 * position specified by a_whence.
 * @param a_whence TIZ_BUFFER_SEEK_SET, TIZ_BUFFER_SEEK_CUR, or
 * TIZ_BUFFER_SEEK_END.
 * @return 0 on success, -1 on error (e.g. the whence argument was not
 * TIZ_BUFFER_SEEK_SET, TIZ_BUFFER_SEEK_END, or TIZ_BUFFER_SEEK_CUR.  Or the
 * resulting buffer offset would be negative).
 */
int
tiz_buffer_seek (tiz_buffer_t * ap_buf, const long a_offset,
                 const int a_whence);

@juanrubio juanrubio added this to the v0.6.0 milestone Oct 21, 2016

@juanrubio juanrubio self-assigned this Oct 21, 2016

@juanrubio juanrubio changed the title libtizplatform: added 'tiz_buffer_seek', 'tiz_buffer_offset' and 'tiz_buffer_overwrite_mode' apis libtizplatform: add 'tiz_buffer_seek', 'tiz_buffer_offset' and 'tiz_buffer_overwrite_mode' apis Oct 21, 2016

@juanrubio juanrubio closed this in 15312eb Oct 21, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.