Audacious  $Id:Doxyfile42802007-03-2104:39:00Znenolod$
Functions
vfs_common.c File Reference

Common code for various VFS-stream related operations. More...

#include <glib.h>
#include <glib/gprintf.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "vfs.h"

Go to the source code of this file.

Functions

EXPORT int vfs_fputc (int c, VFSFile *stream)
 Writes a character to a stream. More...
 
EXPORT char * vfs_fgets (char *s, int n, VFSFile *stream)
 Reads a string of characters from a stream, ending in newline or EOF. More...
 
EXPORT int vfs_fputs (const char *s, VFSFile *stream)
 Writes a string to a VFS stream. More...
 
EXPORT int vfs_vfprintf (VFSFile *stream, char const *format, va_list args)
 Writes a formatted string to a VFS stream via a va_list of args. More...
 
EXPORT int vfs_fprintf (VFSFile *stream, char const *format,...)
 Writes a formatted string to a VFS stream. More...
 
EXPORT void vfs_file_get_contents (const char *filename, void **buf, int64_t *size)
 Gets contents of the file into a buffer. More...
 
EXPORT bool_t vfs_fget_le16 (uint16_t *value, VFSFile *stream)
 Reads an unsigned 16-bit Little Endian value from the stream into native endian format. More...
 
EXPORT bool_t vfs_fget_le32 (uint32_t *value, VFSFile *stream)
 Reads an unsigned 32-bit Little Endian value from the stream into native endian format. More...
 
EXPORT bool_t vfs_fget_le64 (uint64_t *value, VFSFile *stream)
 Reads an unsigned 64-bit Little Endian value from the stream into native endian format. More...
 
EXPORT bool_t vfs_fget_be16 (uint16_t *value, VFSFile *stream)
 Reads an unsigned 16-bit Big Endian value from the stream into native endian format. More...
 
EXPORT bool_t vfs_fget_be32 (uint32_t *value, VFSFile *stream)
 Reads an unsigned 32-bit Big Endian value from the stream into native endian format. More...
 
EXPORT bool_t vfs_fget_be64 (uint64_t *value, VFSFile *stream)
 Reads an unsigned 64-bit Big Endian value from the stream into native endian format. More...
 
EXPORT bool_t vfs_fput_le16 (uint16_t value, VFSFile *stream)
 Writes an unsigned 16-bit native endian value into the stream as a Little Endian value. More...
 
EXPORT bool_t vfs_fput_le32 (uint32_t value, VFSFile *stream)
 Writes an unsigned 32-bit native endian value into the stream as a Big Endian value. More...
 
EXPORT bool_t vfs_fput_le64 (uint64_t value, VFSFile *stream)
 Writes an unsigned 64-bit native endian value into the stream as a Big Endian value. More...
 
EXPORT bool_t vfs_fput_be16 (uint16_t value, VFSFile *stream)
 Writes an unsigned 16-bit native endian value into the stream as a Big Endian value. More...
 
EXPORT bool_t vfs_fput_be32 (uint32_t value, VFSFile *stream)
 Writes an unsigned 32-bit native endian value into the stream as a Big Endian value. More...
 
EXPORT bool_t vfs_fput_be64 (uint64_t value, VFSFile *stream)
 Writes an unsigned 64-bit native endian value into the stream as a Big Endian value. More...
 

Detailed Description

Common code for various VFS-stream related operations.

Routines for string reading and writing and functions for reading and writing endianess-dependant integer values.

Definition in file vfs_common.c.

Function Documentation

EXPORT bool_t vfs_fget_be16 ( uint16_t *  value,
VFSFile stream 
)

Reads an unsigned 16-bit Big Endian value from the stream into native endian format.

Parameters
valuePointer to the variable to read the value into.
streamA VFSFile object representing the stream.
Returns
TRUE if read was succesful, FALSE if there was an error.

Definition at line 255 of file vfs_common.c.

EXPORT bool_t vfs_fget_be32 ( uint32_t *  value,
VFSFile stream 
)

Reads an unsigned 32-bit Big Endian value from the stream into native endian format.

Parameters
valuePointer to the variable to read the value into.
streamA VFSFile object representing the stream.
Returns
TRUE if read was succesful, FALSE if there was an error.

Definition at line 271 of file vfs_common.c.

EXPORT bool_t vfs_fget_be64 ( uint64_t *  value,
VFSFile stream 
)

Reads an unsigned 64-bit Big Endian value from the stream into native endian format.

Parameters
valuePointer to the variable to read the value into.
streamA VFSFile object representing the stream.
Returns
TRUE if read was succesful, FALSE if there was an error.

Definition at line 287 of file vfs_common.c.

EXPORT bool_t vfs_fget_le16 ( uint16_t *  value,
VFSFile stream 
)

Reads an unsigned 16-bit Little Endian value from the stream into native endian format.

Parameters
valuePointer to the variable to read the value into.
streamA VFSFile object representing the stream.
Returns
TRUE if read was succesful, FALSE if there was an error.

Definition at line 206 of file vfs_common.c.

EXPORT bool_t vfs_fget_le32 ( uint32_t *  value,
VFSFile stream 
)

Reads an unsigned 32-bit Little Endian value from the stream into native endian format.

Parameters
valuePointer to the variable to read the value into.
streamA VFSFile object representing the stream.
Returns
TRUE if read was succesful, FALSE if there was an error.

Definition at line 222 of file vfs_common.c.

EXPORT bool_t vfs_fget_le64 ( uint64_t *  value,
VFSFile stream 
)

Reads an unsigned 64-bit Little Endian value from the stream into native endian format.

Parameters
valuePointer to the variable to read the value into.
streamA VFSFile object representing the stream.
Returns
TRUE if read was succesful, FALSE if there was an error.

Definition at line 238 of file vfs_common.c.

EXPORT char* vfs_fgets ( char *  s,
int  n,
VFSFile stream 
)

Reads a string of characters from a stream, ending in newline or EOF.

Parameters
sA buffer to put the string in.
nThe amount of characters to read.
streamA VFSFile object representing the stream.
Returns
The string on success, or NULL.

Definition at line 63 of file vfs_common.c.

EXPORT void vfs_file_get_contents ( const char *  filename,
void **  buf,
int64_t *  size 
)

Gets contents of the file into a buffer.

Buffer of filesize bytes is allocated by this function as necessary.

Parameters
filenameURI of the file to read in.
bufPointer to a pointer variable of buffer.
sizePointer to gsize variable that will hold the amount of read data e.g. filesize.

Definition at line 149 of file vfs_common.c.

Referenced by art_get_data_real(), and vfs_async_file_get_contents_worker().

EXPORT int vfs_fprintf ( VFSFile stream,
char const *  format,
  ... 
)

Writes a formatted string to a VFS stream.

Parameters
streamA VFSFile object representing the stream.
formatA printf-style format string.
...Optional list of arguments.
Returns
The amount of bytes written.

Definition at line 128 of file vfs_common.c.

EXPORT bool_t vfs_fput_be16 ( uint16_t  value,
VFSFile stream 
)

Writes an unsigned 16-bit native endian value into the stream as a Big Endian value.

Parameters
valueValue to write into the stream.
streamA VFSFile object representing the stream.
Returns
TRUE if read was succesful, FALSE if there was an error.

Definition at line 346 of file vfs_common.c.

EXPORT bool_t vfs_fput_be32 ( uint32_t  value,
VFSFile stream 
)

Writes an unsigned 32-bit native endian value into the stream as a Big Endian value.

Parameters
valueValue to write into the stream.
streamA VFSFile object representing the stream.
Returns
TRUE if read was succesful, FALSE if there was an error.

Definition at line 360 of file vfs_common.c.

EXPORT bool_t vfs_fput_be64 ( uint64_t  value,
VFSFile stream 
)

Writes an unsigned 64-bit native endian value into the stream as a Big Endian value.

Parameters
valueValue to write into the stream.
streamA VFSFile object representing the stream.
Returns
TRUE if read was succesful, FALSE if there was an error.

Definition at line 374 of file vfs_common.c.

EXPORT bool_t vfs_fput_le16 ( uint16_t  value,
VFSFile stream 
)

Writes an unsigned 16-bit native endian value into the stream as a Little Endian value.

Parameters
valueValue to write into the stream.
streamA VFSFile object representing the stream.
Returns
TRUE if read was succesful, FALSE if there was an error.

Definition at line 304 of file vfs_common.c.

EXPORT bool_t vfs_fput_le32 ( uint32_t  value,
VFSFile stream 
)

Writes an unsigned 32-bit native endian value into the stream as a Big Endian value.

Parameters
valueValue to write into the stream.
streamA VFSFile object representing the stream.
Returns
TRUE if read was succesful, FALSE if there was an error.

Definition at line 318 of file vfs_common.c.

EXPORT bool_t vfs_fput_le64 ( uint64_t  value,
VFSFile stream 
)

Writes an unsigned 64-bit native endian value into the stream as a Big Endian value.

Parameters
valueValue to write into the stream.
streamA VFSFile object representing the stream.
Returns
TRUE if read was succesful, FALSE if there was an error.

Definition at line 332 of file vfs_common.c.

EXPORT int vfs_fputc ( int  c,
VFSFile stream 
)

Writes a character to a stream.

Parameters
cA character to write to the stream.
streamA VFSFile object representing the stream.
Returns
The character on success, or EOF.

Definition at line 44 of file vfs_common.c.

EXPORT int vfs_fputs ( const char *  s,
VFSFile stream 
)

Writes a string to a VFS stream.

Parameters
sA string to write to the stream.
streamA VFSFile object representing the stream.
Returns
The amount of bytes written.

Definition at line 95 of file vfs_common.c.

Referenced by vfs_vfprintf().

EXPORT int vfs_vfprintf ( VFSFile stream,
char const *  format,
va_list  args 
)

Writes a formatted string to a VFS stream via a va_list of args.

Parameters
streamA VFSFile object representing the stream.
formatA printf-style format string.
argsA va_list of args to use.
Returns
value The amount of bytes written.

Definition at line 110 of file vfs_common.c.

Referenced by vfs_fprintf().