FreeRDP
ini.c File Reference
#include <winpr/config.h>
#include <winpr/assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <winpr/wtypes.h>
#include <winpr/crt.h>
#include <winpr/file.h>
#include <winpr/ini.h>

Functions

static BOOL IniFile_Load_NextLine (wIniFile *ini, char *str)
 
static BOOL IniFile_BufferResize (wIniFile *ini, size_t size)
 
static BOOL IniFile_Load_String (wIniFile *ini, const char *iniString)
 
static void IniFile_Close_File (FILE *fp)
 
static FILE * IniFile_Open_File (wIniFile *ini, const char *filename)
 
static BOOL IniFile_Load_File (wIniFile *ini, const char *filename)
 
static BOOL IniFile_Load_HasNextLine (wIniFile *ini)
 
static char * IniFile_Load_GetNextLine (wIniFile *ini)
 
static void IniFile_Key_Free (wIniFileKey *key)
 
static wIniFileKey * IniFile_Key_New (const char *name, const char *value)
 
static void IniFile_Section_Free (wIniFileSection *section)
 
static BOOL IniFile_SectionKeysResize (wIniFileSection *section, size_t count)
 
static wIniFileSection * IniFile_Section_New (const char *name)
 
static wIniFileSection * IniFile_GetSection (wIniFile *ini, const char *name)
 
static BOOL IniFile_SectionResize (wIniFile *ini, size_t count)
 
static wIniFileSection * IniFile_AddToSection (wIniFile *ini, const char *name)
 
static wIniFileKey * IniFile_GetKey (wIniFileSection *section, const char *name)
 
static wIniFileKey * IniFile_AddKey (wIniFileSection *section, const char *name, const char *value)
 
static int IniFile_Load (wIniFile *ini)
 
static BOOL IniFile_SetFilename (wIniFile *ini, const char *name)
 
int IniFile_ReadBuffer (wIniFile *ini, const char *buffer)
 read an ini file from a buffer More...
 
int IniFile_ReadFile (wIniFile *ini, const char *filename)
 read an ini file from a file More...
 
char ** IniFile_GetSectionNames (wIniFile *ini, size_t *count)
 Get the number and names of sections in the ini instance. More...
 
char ** IniFile_GetSectionKeyNames (wIniFile *ini, const char *section, size_t *count)
 Get the number and names of keys of a section in the ini instance. More...
 
const char * IniFile_GetKeyValueString (wIniFile *ini, const char *section, const char *key)
 Get an ini [section/key] value of type string. More...
 
int IniFile_GetKeyValueInt (wIniFile *ini, const char *section, const char *key)
 Get an ini [section/key] value of type int. More...
 
int IniFile_SetKeyValueString (wIniFile *ini, const char *section, const char *key, const char *value)
 Set an ini [section/key] value of type string. More...
 
int IniFile_SetKeyValueInt (wIniFile *ini, const char *section, const char *key, int value)
 Set an ini [section/key] value of type int. More...
 
char * IniFile_WriteBuffer (wIniFile *ini)
 write an ini instance to a buffer More...
 
int IniFile_WriteFile (wIniFile *ini, const char *filename)
 write an ini instance to a file More...
 
void IniFile_Free (wIniFile *ini)
 Free a ini instance. More...
 
wIniFile * IniFile_New (void)
 Create a new ini instance. More...
 
wIniFile * IniFile_Clone (const wIniFile *ini)
 Clone a ini instance. More...
 

Function Documentation

◆ IniFile_AddKey()

static wIniFileKey* IniFile_AddKey ( wIniFileSection *  section,
const char *  name,
const char *  value 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ IniFile_AddToSection()

static wIniFileSection* IniFile_AddToSection ( wIniFile *  ini,
const char *  name 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ IniFile_BufferResize()

static BOOL IniFile_BufferResize ( wIniFile *  ini,
size_t  size 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ IniFile_Clone()

wIniFile* IniFile_Clone ( const wIniFile *  ini)

Clone a ini instance.

Parameters
iniThe instance to free, may be NULL
Returns
the cloned instance or NULL in case of ini was NULL or failure
Here is the call graph for this function:
Here is the caller graph for this function:

◆ IniFile_Close_File()

static void IniFile_Close_File ( FILE *  fp)
static
Here is the caller graph for this function:

◆ IniFile_Free()

void IniFile_Free ( wIniFile *  ini)

Free a ini instance.

Parameters
iniThe instance to free, may be NULL
Here is the call graph for this function:
Here is the caller graph for this function:

◆ IniFile_GetKey()

static wIniFileKey* IniFile_GetKey ( wIniFileSection *  section,
const char *  name 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ IniFile_GetKeyValueInt()

int IniFile_GetKeyValueInt ( wIniFile *  ini,
const char *  section,
const char *  key 
)

Get an ini [section/key] value of type int.

Parameters
iniThe instance to use, must not be NULL
sectionThe name of the section as '\0' terminated string.
keyThe name of the key as '\0' terminated string.
Returns
The value of the [section/key]
Here is the call graph for this function:
Here is the caller graph for this function:

◆ IniFile_GetKeyValueString()

const char* IniFile_GetKeyValueString ( wIniFile *  ini,
const char *  section,
const char *  key 
)

Get an ini [section/key] value of type string.

Parameters
iniThe instance to use, must not be NULL
sectionThe name of the section as '\0' terminated string.
keyThe name of the key as '\0' terminated string.
Returns
The value of the [section/key] as '\0' terminated string or NULL
Here is the call graph for this function:
Here is the caller graph for this function:

◆ IniFile_GetSection()

static wIniFileSection* IniFile_GetSection ( wIniFile *  ini,
const char *  name 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ IniFile_GetSectionKeyNames()

char** IniFile_GetSectionKeyNames ( wIniFile *  ini,
const char *  section,
size_t *  count 
)

Get the number and names of keys of a section in the ini instance.

Parameters
iniThe instance to use, must not be NULL
sectionThe name of the section as '\0' terminated string.
countA buffer that will contain the number of sections
Returns
A newly allocated array of strings (size count). Use free after use
Here is the call graph for this function:
Here is the caller graph for this function:

◆ IniFile_GetSectionNames()

char** IniFile_GetSectionNames ( wIniFile *  ini,
size_t *  count 
)

Get the number and names of sections in the ini instance.

Parameters
iniThe instance to use, must not be NULL
countA buffer that will contain the number of sections
Returns
A newly allocated array of strings (size count). Use free after use
Here is the caller graph for this function:

◆ IniFile_Key_Free()

static void IniFile_Key_Free ( wIniFileKey *  key)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ IniFile_Key_New()

static wIniFileKey* IniFile_Key_New ( const char *  name,
const char *  value 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ IniFile_Load()

static int IniFile_Load ( wIniFile *  ini)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ IniFile_Load_File()

static BOOL IniFile_Load_File ( wIniFile *  ini,
const char *  filename 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ IniFile_Load_GetNextLine()

static char* IniFile_Load_GetNextLine ( wIniFile *  ini)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ IniFile_Load_HasNextLine()

static BOOL IniFile_Load_HasNextLine ( wIniFile *  ini)
static
Here is the caller graph for this function:

◆ IniFile_Load_NextLine()

static BOOL IniFile_Load_NextLine ( wIniFile *  ini,
char *  str 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ IniFile_Load_String()

static BOOL IniFile_Load_String ( wIniFile *  ini,
const char *  iniString 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ IniFile_New()

wIniFile* IniFile_New ( void  )

Create a new ini instance.

Returns
The newly allocated instance or NULL if failed.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ IniFile_Open_File()

static FILE* IniFile_Open_File ( wIniFile *  ini,
const char *  filename 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ IniFile_ReadBuffer()

int IniFile_ReadBuffer ( wIniFile *  ini,
const char *  buffer 
)

read an ini file from a buffer

Parameters
iniThe instance to use, must not be NULL
bufferThe buffer to read from, must be a '\0' terminated string.
Returns
> 0 for success, < 0 for failure
Here is the call graph for this function:
Here is the caller graph for this function:

◆ IniFile_ReadFile()

int IniFile_ReadFile ( wIniFile *  ini,
const char *  filename 
)

read an ini file from a file

Parameters
iniThe instance to use, must not be NULL
filenameThe name of the file to read from, must be a '\0' terminated string.
Returns
> 0 for success, < 0 for failure
Here is the call graph for this function:
Here is the caller graph for this function:

◆ IniFile_Section_Free()

static void IniFile_Section_Free ( wIniFileSection *  section)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ IniFile_Section_New()

static wIniFileSection* IniFile_Section_New ( const char *  name)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ IniFile_SectionKeysResize()

static BOOL IniFile_SectionKeysResize ( wIniFileSection *  section,
size_t  count 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ IniFile_SectionResize()

static BOOL IniFile_SectionResize ( wIniFile *  ini,
size_t  count 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ IniFile_SetFilename()

static BOOL IniFile_SetFilename ( wIniFile *  ini,
const char *  name 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ IniFile_SetKeyValueInt()

int IniFile_SetKeyValueInt ( wIniFile *  ini,
const char *  section,
const char *  key,
int  value 
)

Set an ini [section/key] value of type int.

Parameters
iniThe instance to use, must not be NULL
sectionThe name of the section as '\0' terminated string.
keyThe name of the key as '\0' terminated string.
valueThe value of the [section/key]
Returns
> 0 for success, < 0 for failure
Here is the call graph for this function:
Here is the caller graph for this function:

◆ IniFile_SetKeyValueString()

int IniFile_SetKeyValueString ( wIniFile *  ini,
const char *  section,
const char *  key,
const char *  value 
)

Set an ini [section/key] value of type string.

Parameters
iniThe instance to use, must not be NULL
sectionThe name of the section as '\0' terminated string.
keyThe name of the key as '\0' terminated string.
valueThe value of the [section/key] as '\0' terminated string.
Returns
> 0 for success, < 0 for failure
Here is the call graph for this function:
Here is the caller graph for this function:

◆ IniFile_WriteBuffer()

char* IniFile_WriteBuffer ( wIniFile *  ini)

write an ini instance to a buffer

Parameters
iniThe instance to use, must not be NULL
Returns
A newly allocated string, use free after use. NULL in case of failure
Here is the caller graph for this function:

◆ IniFile_WriteFile()

int IniFile_WriteFile ( wIniFile *  ini,
const char *  filename 
)

write an ini instance to a file

Parameters
iniThe instance to use, must not be NULL
filenameThe name of the file as '\0' terminated string.
Returns
> 0 for success, < 0 for failure
Here is the call graph for this function:
Here is the caller graph for this function: