gwenhywfar  4.6.0beta
Macros | Typedefs | Functions
Buffer Management

This file contains the definition of a GWEN_BUFFER, a dynamically resizeable text buffer. More...

Macros

#define GWEN_BUFFER_MAX_BOOKMARKS   64
 
#define GWEN_BUFFER_MODE_ABORT_ON_MEMFULL   0x0002
 
#define GWEN_BUFFER_MODE_DEFAULT
 
#define GWEN_BUFFER_MODE_DYNAMIC   0x0001
 
#define GWEN_BUFFER_MODE_READONLY   0x0020
 
#define GWEN_BUFFER_MODE_USE_SYNCIO   0x0010
 

Typedefs

typedef struct GWEN_BUFFER GWEN_BUFFER
 A dynamically resizeable text buffer. More...
 

Functions

GWENHYWFAR_API void GWEN_Buffer_AddMode (GWEN_BUFFER *bf, uint32_t mode)
 
GWENHYWFAR_API int GWEN_Buffer_AdjustUsedBytes (GWEN_BUFFER *bf)
 
GWENHYWFAR_API int GWEN_Buffer_AllocRoom (GWEN_BUFFER *bf, uint32_t size)
 
GWENHYWFAR_API int GWEN_Buffer_AppendBuffer (GWEN_BUFFER *bf, GWEN_BUFFER *sf)
 
GWENHYWFAR_API int GWEN_Buffer_AppendByte (GWEN_BUFFER *bf, char c)
 
GWENHYWFAR_API int GWEN_Buffer_AppendBytes (GWEN_BUFFER *bf, const char *buffer, uint32_t size)
 
GWENHYWFAR_API int GWEN_Buffer_AppendString (GWEN_BUFFER *bf, const char *buffer)
 
GWENHYWFAR_API void GWEN_Buffer_Attach (GWEN_BUFFER *bf)
 
GWENHYWFAR_API int GWENHYWFAR_CB GWEN_Buffer_CacheFn_Attach (void *ptr)
 
GWENHYWFAR_API int GWENHYWFAR_CB GWEN_Buffer_CacheFn_Free (void *ptr)
 
GWENHYWFAR_API int GWEN_Buffer_Crop (GWEN_BUFFER *bf, uint32_t pos, uint32_t l)
 
GWENHYWFAR_API int GWEN_Buffer_DecrementPos (GWEN_BUFFER *bf, uint32_t i)
 
GWENHYWFAR_API void GWEN_Buffer_Dump (GWEN_BUFFER *bf, unsigned int insert)
 
GWENHYWFAR_API GWEN_BUFFERGWEN_Buffer_dup (GWEN_BUFFER *bf)
 
GWENHYWFAR_API int GWEN_Buffer_FillLeftWithBytes (GWEN_BUFFER *bf, unsigned char c, uint32_t size)
 
GWENHYWFAR_API int GWEN_Buffer_FillWithBytes (GWEN_BUFFER *bf, unsigned char c, uint32_t size)
 
GWENHYWFAR_API void GWEN_Buffer_free (GWEN_BUFFER *bf)
 
GWENHYWFAR_API uint32_t GWEN_Buffer_GetBookmark (const GWEN_BUFFER *bf, unsigned int idx)
 
GWENHYWFAR_API uint32_t GWEN_Buffer_GetBytesLeft (GWEN_BUFFER *bf)
 
GWENHYWFAR_API uint32_t GWEN_Buffer_GetHardLimit (GWEN_BUFFER *bf)
 
GWENHYWFAR_API uint32_t GWEN_Buffer_GetMaxUnsegmentedWrite (GWEN_BUFFER *bf)
 
GWENHYWFAR_API uint32_t GWEN_Buffer_GetMode (GWEN_BUFFER *bf)
 
GWENHYWFAR_API uint32_t GWEN_Buffer_GetPos (const GWEN_BUFFER *bf)
 
GWENHYWFAR_API char * GWEN_Buffer_GetPosPointer (const GWEN_BUFFER *bf)
 
GWENHYWFAR_API uint32_t GWEN_Buffer_GetSize (const GWEN_BUFFER *bf)
 
GWENHYWFAR_API char * GWEN_Buffer_GetStart (const GWEN_BUFFER *bf)
 
GWENHYWFAR_API uint32_t GWEN_Buffer_GetStep (GWEN_BUFFER *bf)
 
GWENHYWFAR_API uint32_t GWEN_Buffer_GetUsedBytes (const GWEN_BUFFER *bf)
 
GWENHYWFAR_API int GWEN_Buffer_IncrementPos (GWEN_BUFFER *bf, uint32_t i)
 
GWENHYWFAR_API int GWEN_Buffer_InsertBuffer (GWEN_BUFFER *bf, GWEN_BUFFER *sf)
 
GWENHYWFAR_API int GWEN_Buffer_InsertByte (GWEN_BUFFER *bf, char c)
 
GWENHYWFAR_API int GWEN_Buffer_InsertBytes (GWEN_BUFFER *bf, const char *buffer, uint32_t size)
 
GWENHYWFAR_API int GWEN_Buffer_InsertRoom (GWEN_BUFFER *bf, uint32_t size)
 
GWENHYWFAR_API int GWEN_Buffer_InsertString (GWEN_BUFFER *bf, const char *buffer)
 
GWENHYWFAR_API GWEN_BUFFERGWEN_Buffer_new (char *buffer, uint32_t size, uint32_t used, int take_ownership)
 
GWENHYWFAR_API void GWEN_Buffer_OverwriteContent (GWEN_BUFFER *bf, int c)
 
GWENHYWFAR_API int GWEN_Buffer_PeekByte (GWEN_BUFFER *bf)
 
GWENHYWFAR_API int GWEN_Buffer_ReadByte (GWEN_BUFFER *bf)
 
GWENHYWFAR_API int GWEN_Buffer_ReadBytes (GWEN_BUFFER *bf, char *buffer, uint32_t *size)
 
GWENHYWFAR_API int GWEN_Buffer_Relinquish (GWEN_BUFFER *bf)
 
GWENHYWFAR_API int GWEN_Buffer_RemoveRoom (GWEN_BUFFER *bf, uint32_t size)
 
GWENHYWFAR_API int GWEN_Buffer_ReplaceBytes (GWEN_BUFFER *bf, uint32_t rsize, const char *buffer, uint32_t size)
 
GWENHYWFAR_API int GWEN_Buffer_ReserveBytes (GWEN_BUFFER *bf, uint32_t res)
 
GWENHYWFAR_API void GWEN_Buffer_Reset (GWEN_BUFFER *bf)
 
GWENHYWFAR_API void GWEN_Buffer_Rewind (GWEN_BUFFER *bf)
 
GWENHYWFAR_API void GWEN_Buffer_SetBookmark (GWEN_BUFFER *bf, unsigned int idx, uint32_t v)
 
GWENHYWFAR_API void GWEN_Buffer_SetHardLimit (GWEN_BUFFER *bf, uint32_t l)
 
GWENHYWFAR_API void GWEN_Buffer_SetMode (GWEN_BUFFER *bf, uint32_t mode)
 
GWENHYWFAR_API int GWEN_Buffer_SetPos (GWEN_BUFFER *bf, uint32_t i)
 
GWENHYWFAR_API void GWEN_Buffer_SetSourceSyncIo (GWEN_BUFFER *bf, GWEN_SYNCIO *sio, int take)
 
GWENHYWFAR_API void GWEN_Buffer_SetStep (GWEN_BUFFER *bf, uint32_t step)
 
GWENHYWFAR_API void GWEN_Buffer_SubMode (GWEN_BUFFER *bf, uint32_t mode)
 

Detailed Description

This file contains the definition of a GWEN_BUFFER, a dynamically resizeable text buffer.

Macro Definition Documentation

#define GWEN_BUFFER_MAX_BOOKMARKS   64
#define GWEN_BUFFER_MODE_ABORT_ON_MEMFULL   0x0002
#define GWEN_BUFFER_MODE_DEFAULT
Value:
(\
GWEN_BUFFER_MODE_DYNAMIC | \
GWEN_BUFFER_MODE_ABORT_ON_MEMFULL\
)

Definition at line 74 of file buffer.h.

Referenced by GWEN_Buffer_new().

#define GWEN_BUFFER_MODE_DYNAMIC   0x0001
#define GWEN_BUFFER_MODE_READONLY   0x0020
#define GWEN_BUFFER_MODE_USE_SYNCIO   0x0010

Definition at line 71 of file buffer.h.

Referenced by GWEN_Buffer__FillBuffer(), GWEN_Buffer_IncrementPos(), and GWEN_Buffer_SetPos().

Typedef Documentation

typedef struct GWEN_BUFFER GWEN_BUFFER

A dynamically resizeable text buffer.

Definition at line 41 of file buffer.h.

Function Documentation

GWENHYWFAR_API void GWEN_Buffer_AddMode ( GWEN_BUFFER bf,
uint32_t  mode 
)

Adds the give mode to the current mode of the buffer (such as GWEN_BUFFER_MODE_DYNAMIC).

Definition at line 195 of file buffer.c.

Referenced by GWEN_XMLContext_ReadFromString(), and GWEN_XMLNode_fromString().

GWENHYWFAR_API int GWEN_Buffer_AdjustUsedBytes ( GWEN_BUFFER bf)
GWENHYWFAR_API int GWEN_Buffer_AllocRoom ( GWEN_BUFFER bf,
uint32_t  size 
)
GWENHYWFAR_API int GWEN_Buffer_AppendBuffer ( GWEN_BUFFER bf,
GWEN_BUFFER sf 
)

Append the content of the buffer sf at the end of the buffer bf. The size of bf will be increased accordingly. Returns zero on success or nonzero if this failed (e.g. because of out of memory error).

Definition at line 560 of file buffer.c.

References DBG_ERROR, GWEN_Buffer_AppendBytes(), GWEN_BUFFER_MODE_ABORT_ON_MEMFULL, GWEN_BUFFER_MODE_READONLY, GWEN_ERROR_PERMISSIONS, and GWEN_LOGDOMAIN.

Referenced by check2(), GWEN_Crypt_Token_PluginManager_CheckToken(), GWEN_CryptMgr_Decrypt(), GWEN_CryptMgrKeys_DecryptKey(), GWEN_Directory_FindFileInPaths(), GWEN_MsgEngine__WriteValue(), GWEN_PathManager_FindFile(), and GWEN_XMLNode_GetXPath().

GWENHYWFAR_API int GWEN_Buffer_AppendByte ( GWEN_BUFFER bf,
char  c 
)

Appends a single byte to this GWEN_BUFFER, if there is enough room. The position pointer is adjusted accordingly.

Returns
0 if ok, !=0 on error

Definition at line 391 of file buffer.c.

References DBG_DEBUG, DBG_ERROR, GWEN_Buffer_AllocRoom(), GWEN_BUFFER_MODE_ABORT_ON_MEMFULL, GWEN_BUFFER_MODE_READONLY, GWEN_ERROR_PERMISSIONS, and GWEN_LOGDOMAIN.

Referenced by _addRandomBytes(), Gtk2Gui_WListBox_GetCharProperty(), GWEN_Args__AppendTXT(), GWEN_Base64_Decode(), GWEN_Base64_Encode(), GWEN_CryptHead_toBuffer(), GWEN_CryptMgr_Encrypt(), GWEN_CryptMgr_Sign(), GWEN_Date_toStringWithTemplate(), GWEN_DB__ReadValues(), GWEN_DB_EscapeToBufferTolerant(), GWEN_DB_UnescapeToBufferTolerant(), GWEN_Directory_HandlePathElement(), GWEN_Directory_OsifyPath(), GWEN_Gui_CProgress_Log(), GWEN_LoadPluginDescrsByType(), GWEN_Logger__CreateMessage(), GWEN_Logger_Log(), GWEN_MsgEngine__ReadGroup(), GWEN_MsgEngine__ReadValue(), GWEN_MsgEngine__WriteGroup(), GWEN_MsgEngine__WriteValue(), GWEN_Padd_PaddWithAnsiX9_23ToMultipleOf(), GWEN_Padd_PaddWithIso9796_2(), GWEN_Path_AppendPathElement(), GWEN_Path_Handle(), GWEN_Path_HandleWithIdx(), GWEN_PluginManager_LoadPlugin(), GWEN_PluginManager_LoadPluginFile(), GWEN_SigHead_toBuffer(), GWEN_SigTail_toBuffer(), GWEN_SmallTresor_Encrypt(), GWEN_Tag16_DirectlyToBuffer(), GWEN_Text_DumpString2Buffer(), GWEN_Text_EscapeToBuffer(), GWEN_Text_EscapeToBufferTolerant(), GWEN_Text_EscapeToBufferTolerant2(), GWEN_Text_EscapeXmlToBuffer(), GWEN_Text_FromBcdBuffer(), GWEN_Text_FromHexBuffer(), GWEN_Text_GetWordToBuffer(), GWEN_Text_ToBcdBuffer(), GWEN_Text_ToHexBuffer(), GWEN_Text_UnescapeToBuffer(), GWEN_Text_UnescapeToBufferTolerant(), GWEN_Time__toString(), GWEN_TLV_DirectlyToBuffer(), GWEN_TLV_WriteHeader(), GWEN_XML__ReadData(), GWEN_XML__ReadTag(), GWEN_XML_AddNameSpace(), GWEN_XML_FindNameSpace(), and GWEN_XMLNode__CheckAndSetNameSpace().

GWENHYWFAR_API int GWEN_Buffer_AppendBytes ( GWEN_BUFFER bf,
const char *  buffer,
uint32_t  size 
)
GWENHYWFAR_API int GWEN_Buffer_AppendString ( GWEN_BUFFER bf,
const char *  buffer 
)

Appends a string to the buffer (without the trailing null char!) The position pointer is adjusted accordingly.

Returns
0 if ok, !=0 on error

Definition at line 1029 of file buffer.c.

References GWEN_Buffer_AppendBytes().

Referenced by check2(), COCOA_Gui_GetFileName(), Dlg_Test1_new(), Dlg_Test2_new(), QT4_Gui::getFileName(), FOX16_Gui::getFileName(), GTK2_Gui_GetFileName(), Gtk2Gui_GetRawText(), Gtk2Gui_WListBox_GetCharProperty(), GWEN_Args_UsageTXT(), GWEN_Base64_Encode(), GWEN_ConfigMgr_ModuleInit(), GWEN_Crypt_Token__CreatePasswordName(), GWEN_Crypt_Token_ModuleInit(), GWEN_Crypt_Token_PluginManager_CheckToken(), GWEN_Date_toStringWithTemplate(), GWEN_DBIO_ModuleInit(), GWEN_Dialog_AddMediaPathsFromPathManager(), GWEN_Directory_FindFileInPaths(), GWEN_Directory_FindPathForFile(), GWEN_Directory_GetAbsoluteFolderPath(), GWEN_Directory_GetDirEntries(), GWEN_Directory_GetFileEntries(), GWEN_Directory_GetFileEntriesWithType(), GWEN_Directory_GetMatchingFilesRecursively(), GWEN_Directory_HandlePathElement(), GWEN_DlgProgress_AddLogText(), GWEN_Gui_CProgress_Log(), GWEN_Gui_GetRawText(), GWEN_LoadPluginDescrsByType(), GWEN_Logger__CreateMessage(), GWEN_MDigest__HashFileTree(), GWEN_MDigest_CheckFileTree(), GWEN_MsgEngine__GetInline(), GWEN_MsgEngine__ReadGroup(), GWEN_PasswordStore_EncryptWriteFile(), GWEN_PasswordStore_ReadDecryptFile(), GWEN_Path_AppendPathElement(), GWEN_PathManager_AddRelPath(), GWEN_PathManager_FindFile(), GWEN_PathManager_GetMatchingFilesRecursively(), GWEN_PluginManager_LoadPlugin(), GWEN_PluginManager_LoadPluginFile(), GWEN_ProgressData_AddLogText(), GWEN_SyncIo_Http_WriteCommand(), GWEN_SyncIo_Http_WriteHeader(), GWEN_SyncIo_Http_WriteStatus(), GWEN_SyncIo_Tls_GetPeerCert(), GWEN_Text_DoubleToBuffer(), GWEN_Text_DumpString2Buffer(), GWEN_Text_EscapeXmlToBuffer(), GWEN_Time__toString(), GWEN_Url_toCommandString(), GWEN_Url_toString(), GWEN_XML__ReadTag(), GWEN_XML_AddNameSpace(), GWEN_XML_FindNameSpace(), GWEN_XMLNode__CheckAndSetNameSpace(), and GWEN_XMLNode_GetXPath().

GWENHYWFAR_API void GWEN_Buffer_Attach ( GWEN_BUFFER bf)

Increases the internal reference counter. It is decreased by GWEN_Buffer_free().

Definition at line 76 of file buffer.c.

Referenced by GWEN_Buffer_CacheFn_Attach().

GWENHYWFAR_API int GWENHYWFAR_CB GWEN_Buffer_CacheFn_Attach ( void *  ptr)

This is a callback function to be used by GWEN_MULTICACHE (and only for that). It internally calls GWEN_Buffer_Attach().

Definition at line 1129 of file buffer.c.

References GWEN_Buffer_Attach().

GWENHYWFAR_API int GWENHYWFAR_CB GWEN_Buffer_CacheFn_Free ( void *  ptr)

This is a callback function to be used by GWEN_MULTICACHE (and only for that). It internally calls GWEN_Buffer_free().

Definition at line 1136 of file buffer.c.

References GWEN_Buffer_free().

GWENHYWFAR_API int GWEN_Buffer_Crop ( GWEN_BUFFER bf,
uint32_t  pos,
uint32_t  l 
)
GWENHYWFAR_API int GWEN_Buffer_DecrementPos ( GWEN_BUFFER bf,
uint32_t  i 
)

Move the position pointer backward by the given number i.

Definition at line 545 of file buffer.c.

References DBG_ERROR, GWEN_ERROR_BUFFER_OVERFLOW, and GWEN_LOGDOMAIN.

Referenced by GWEN_MsgEngine__ReadValue().

GWENHYWFAR_API void GWEN_Buffer_Dump ( GWEN_BUFFER bf,
unsigned int  insert 
)

Print the current content of buffer bf into the file f.

Definition at line 632 of file buffer.c.

References GWEN_BUFFER_MAX_BOOKMARKS, GWEN_BUFFER_MODE_ABORT_ON_MEMFULL, GWEN_BUFFER_MODE_DYNAMIC, GWEN_BUFFER_MODE_READONLY, and GWEN_Text_DumpString().

Referenced by check1(), check2(), and GWEN_DB_ReadFromFastBuffer().

GWENHYWFAR_API GWEN_BUFFER* GWEN_Buffer_dup ( GWEN_BUFFER bf)

Create a new copy as a duplicate of the buffer bf.

Definition at line 102 of file buffer.c.

References GWEN_BUFFER_MAX_BOOKMARKS, GWEN_Memory_malloc(), and GWEN_NEW_OBJECT.

Referenced by GWEN_Crypt_Token_PluginManager_CheckToken().

GWENHYWFAR_API int GWEN_Buffer_FillLeftWithBytes ( GWEN_BUFFER bf,
unsigned char  c,
uint32_t  size 
)
GWENHYWFAR_API int GWEN_Buffer_FillWithBytes ( GWEN_BUFFER bf,
unsigned char  c,
uint32_t  size 
)
GWENHYWFAR_API void GWEN_Buffer_free ( GWEN_BUFFER bf)

Frees the given buffer.

If the internal storage was allocated for this new buffer, then it will freed here. If the internal storage is used from a different buffer, then it will only be freed if the argument take_ownership of GWEN_Buffer_new() was nonzero.

Definition at line 83 of file buffer.c.

References GWEN_FREE_OBJECT, GWEN_Memory_dealloc(), and GWEN_SyncIo_free().

Referenced by _decode(), _encode(), CocoaGui_WPushButton_Setup(), Dlg_Test1_new(), Dlg_Test2_new(), FOX16_GuiDialog::getIcon(), FOX16_HtmlCtx::getImage(), Gtk2Gui_WLabel_SetCharProperty(), Gtk2Gui_WLabel_Setup(), Gtk2Gui_WListBox_GetCharProperty(), Gtk2Gui_WPushButton_Setup(), Gtk2Gui_WTextBrowser_SetCharProperty(), Gtk2Gui_WTextBrowser_Setup(), GWEN_Buffer_CacheFn_Free(), GWEN_ConfigMgr_ModuleInit(), GWEN_Crypt_Token_GetPin(), GWEN_Crypt_Token_ModuleInit(), GWEN_Crypt_Token_PluginManager_CheckToken(), GWEN_Crypt_Token_SetPinStatus(), GWEN_Crypt_TokenFile__Decipher(), GWEN_Crypt_TokenFile__Encipher(), GWEN_Crypt_TokenFile__Sign(), GWEN_Crypt_TokenFile__Verify(), GWEN_CryptMgr_Decode(), GWEN_CryptMgr_Decrypt(), GWEN_CryptMgr_Encode(), GWEN_CryptMgr_Encrypt(), GWEN_CryptMgr_Sign(), GWEN_CryptMgrKeys_DecryptKey(), GWEN_CryptMgrKeys_EncryptKey(), GWEN_CryptMgrKeys_SignData(), GWEN_CryptMgrKeys_VerifyData(), GWEN_Date_fromTime(), GWEN_DB__ReadValues(), GWEN_DB_ReadFromFastBuffer(), GWEN_DB_WriteGroupToIoLayer(), GWEN_DBIO_ModuleInit(), GWEN_Dialog_AddMediaPathsFromPathManager(), GWEN_Directory_FindFileInPaths(), GWEN_Directory_FindPathForFile(), GWEN_Directory_GetFileEntries(), GWEN_Directory_GetMatchingFilesRecursively(), GWEN_Directory_GetPath(), GWEN_Directory_HandlePathElement(), GWEN_DlgInput_new(), GWEN_DlgMessage_new(), GWEN_DlgProgress_AddLogText(), GWEN_DlgProgress_FreeData(), GWEN_DlgProgress_new(), GWEN_DlgShowBox_new(), GWEN_Gui_CGui_CheckCert(), GWEN_Gui_CGui_InputBox(), GWEN_Gui_CGui_MessageBox(), GWEN_Gui_CGui_ShowBox(), GWEN_Gui_CheckCertBuiltIn(), GWEN_Gui_CProgress_free(), GWEN_Gui_CProgress_Log(), GWEN_Gui_Internal_GetPassword(), GWEN_Gui_Internal_SetPasswordStatus(), GWEN_LoadPluginDescrsByType(), GWEN_Logger__Log(), GWEN_Logger_Log(), GWEN_MDigest__HashFileTree(), GWEN_MDigest_CheckFileTree(), GWEN_MsgEngine__ReadGroup(), GWEN_MsgEngine__WriteElement(), GWEN_PasswordStore__GetPassword(), GWEN_PasswordStore__SetPassword(), GWEN_PasswordStore_EncryptWriteFile(), GWEN_PasswordStore_ReadDecryptFile(), GWEN_PasswordStore_ReadFile(), GWEN_PasswordStore_WriteFile(), GWEN_Path_Handle(), GWEN_Path_HandleWithIdx(), GWEN_PathManager_AddPath(), GWEN_PathManager_AddRelPath(), GWEN_PathManager_FindFile(), GWEN_PathManager_GetMatchingFilesRecursively(), GWEN_PluginManager_LoadPlugin(), GWEN_PluginManager_LoadPluginFile(), GWEN_ProgressData_free(), GWEN_Sar_AddAndDigestFileLink(), GWEN_Sar_AddAndDigestFileReg(), GWEN_Sar_AddFile(), GWEN_Sar_ExtractAndDigestFileDir(), GWEN_Sar_ExtractAndDigestFileLink(), GWEN_Sar_ExtractAndDigestFileReg(), GWEN_Sar_FileHeaderToTlv(), GWEN_Sar_ScanFile(), GWEN_Sar_Sign(), GWEN_Sar_Verify(), GWEN_SigHead_toBuffer(), GWEN_SmallTresor_Decrypt(), GWEN_SmallTresor_Encrypt(), GWEN_SyncIo_Buffered_ReadLinesToStringList(), GWEN_SyncIo_Http_Read(), GWEN_SyncIo_Http_ReadChunk(), GWEN_SyncIo_Http_ReadChunkSize(), GWEN_SyncIo_Http_ReadCommand(), GWEN_SyncIo_Http_ReadHeader(), GWEN_SyncIo_Http_ReadStatus(), GWEN_SyncIo_Http_WriteCommand(), GWEN_SyncIo_Http_WriteHeader(), GWEN_SyncIo_Http_WriteStatus(), GWEN_SyncIo_Memory_FreeData(), GWEN_SyncIo_Tls_GetPeerCert(), GWEN_SyncIo_Tls_Prepare(), GWEN_Text_LogString(), GWEN_Url_fromCommandString(), GWEN_Url_fromString(), GWEN_XML__ReadData(), GWEN_XML__ReadTag(), GWEN_XML_AddNameSpace(), GWEN_XML_FindNameSpace(), GWEN_XML_ReadFromFastBuffer(), GWEN_XMLContext_ReadFromString(), GWEN_XmlCtxStore_AddAttr(), GWEN_XmlCtxStore_AddData(), GWEN_XMLNode__CheckAndSetNameSpace(), GWEN_XMLNode__CheckNameSpaceDecls1(), GWEN_XMLNode_fromString(), GWEN_XMLNode_GetXPath(), and HtmlGroup_Box_AddData().

GWENHYWFAR_API uint32_t GWEN_Buffer_GetBookmark ( const GWEN_BUFFER bf,
unsigned int  idx 
)

Returns the given bookmark

Definition at line 615 of file buffer.c.

References GWEN_BUFFER_MAX_BOOKMARKS.

GWENHYWFAR_API uint32_t GWEN_Buffer_GetBytesLeft ( GWEN_BUFFER bf)
GWENHYWFAR_API uint32_t GWEN_Buffer_GetHardLimit ( GWEN_BUFFER bf)

Returns the hard limit. This is the maximum size of a GWEN_BUFFER in dynamic mode.

Definition at line 208 of file buffer.c.

GWENHYWFAR_API uint32_t GWEN_Buffer_GetMaxUnsegmentedWrite ( GWEN_BUFFER bf)
GWENHYWFAR_API uint32_t GWEN_Buffer_GetMode ( GWEN_BUFFER bf)

Returns the current mode of the buffer (such as GWEN_BUFFER_MODE_DYNAMIC).

Definition at line 182 of file buffer.c.

GWENHYWFAR_API uint32_t GWEN_Buffer_GetPos ( const GWEN_BUFFER bf)
GWENHYWFAR_API char* GWEN_Buffer_GetPosPointer ( const GWEN_BUFFER bf)
GWENHYWFAR_API uint32_t GWEN_Buffer_GetSize ( const GWEN_BUFFER bf)

Returns the size of the buffer (i.e. the number of bytes allocated).

Definition at line 230 of file buffer.c.

References GWEN_BUFFER_MODE_DYNAMIC.

GWENHYWFAR_API char* GWEN_Buffer_GetStart ( const GWEN_BUFFER bf)

Returns the start of the buffer. You can use the function GWEN_Buffer_GetPos to navigate within the buffer.

Definition at line 223 of file buffer.c.

Referenced by _decode(), _encode(), check1(), check2(), COCOA_Gui_GetFileName(), Dlg_Test1_new(), Dlg_Test2_new(), QT4_Gui::getFileName(), FOX16_Gui::getFileName(), FOX16_GuiDialog::getIcon(), FOX16_HtmlCtx::getImage(), GTK2_Gui_GetFileName(), Gtk2Gui_WLabel_SetCharProperty(), Gtk2Gui_WLabel_Setup(), Gtk2Gui_WListBox_GetCharProperty(), Gtk2Gui_WPushButton_Setup(), Gtk2Gui_WTextBrowser_SetCharProperty(), Gtk2Gui_WTextBrowser_Setup(), GWEN_ConfigMgr_ModuleInit(), GWEN_Crypt_Token_GetPin(), GWEN_Crypt_Token_ModuleInit(), GWEN_Crypt_Token_PluginManager_CheckToken(), GWEN_Crypt_Token_SetPinStatus(), GWEN_Crypt_TokenFile__Decipher(), GWEN_Crypt_TokenFile__Encipher(), GWEN_Crypt_TokenFile__Sign(), GWEN_Crypt_TokenFile__Verify(), GWEN_CryptHead_toBuffer(), GWEN_CryptMgr_Decode(), GWEN_CryptMgr_Decrypt(), GWEN_CryptMgr_Encode(), GWEN_CryptMgr_Encrypt(), GWEN_CryptMgr_Sign(), GWEN_CryptMgrKeys_EncryptKey(), GWEN_CryptMgrKeys_SignData(), GWEN_CryptMgrKeys_VerifyData(), GWEN_Date_fromTime(), GWEN_DB__ReadValues(), GWEN_DB_ReadFromFastBuffer(), GWEN_DB_WriteGroupToIoLayer(), GWEN_DBIO_ModuleInit(), GWEN_Dialog_AddMediaPathsFromPathManager(), GWEN_Directory_FindFileInPaths(), GWEN_Directory_FindPathForFile(), GWEN_Directory_GetDirEntries(), GWEN_Directory_GetFileEntries(), GWEN_Directory_GetFileEntriesWithType(), GWEN_Directory_GetMatchingFilesRecursively(), GWEN_Directory_GetPath(), GWEN_Directory_HandlePathElement(), GWEN_DlgInput_new(), GWEN_DlgMessage_new(), GWEN_DlgProgress_AddLogText(), GWEN_DlgProgress_new(), GWEN_DlgShowBox_new(), GWEN_Gui_CGui_CheckCert(), GWEN_Gui_CGui_InputBox(), GWEN_Gui_CGui_MessageBox(), GWEN_Gui_CGui_ShowBox(), GWEN_Gui_CheckCertBuiltIn(), GWEN_Gui_CProgress_GetLogBuf(), GWEN_Gui_CProgress_Log(), GWEN_Gui_Internal_GetPassword(), GWEN_Gui_Internal_GetSyncIo(), GWEN_Gui_Internal_SetPasswordStatus(), GWEN_LoadPluginDescrsByType(), GWEN_Logger__Log(), GWEN_Logger_Log(), GWEN_MDigest__HashFileTree(), GWEN_MDigest_CheckFileTree(), GWEN_MsgEngine__ReadGroup(), GWEN_MsgEngine__ReadValue(), GWEN_MsgEngine__WriteElement(), GWEN_MsgEngine_ReadMessage(), GWEN_Padd__UnpaddWithPkcs1Bt1Or2(), GWEN_Padd_PaddWithISO9796(), GWEN_Padd_PaddWithIso9796_2(), GWEN_Padd_PaddWithPkcs1Bt1(), GWEN_Padd_PaddWithPkcs1Bt2(), GWEN_Padd_UnpaddWithAnsiX9_23FromMultipleOf(), GWEN_Padd_UnpaddWithIso9796_2(), GWEN_PasswordStore__GetPassword(), GWEN_PasswordStore__SetPassword(), GWEN_PasswordStore_EncryptWriteFile(), GWEN_PasswordStore_ReadDecryptFile(), GWEN_PasswordStore_ReadFile(), GWEN_PasswordStore_WriteFile(), GWEN_Path_Handle(), GWEN_Path_HandleWithIdx(), GWEN_PathManager_AddPath(), GWEN_PathManager_AddRelPath(), GWEN_PathManager_FindFile(), GWEN_PathManager_GetMatchingFilesRecursively(), GWEN_PluginManager_LoadPlugin(), GWEN_PluginManager_LoadPluginFile(), GWEN_ProgressData_GetLogText(), GWEN_Sar_AddAndDigestFileLink(), GWEN_Sar_AddAndDigestFileReg(), GWEN_Sar_AddFile(), GWEN_Sar_ExtractAndDigestFileDir(), GWEN_Sar_ExtractAndDigestFileLink(), GWEN_Sar_ExtractAndDigestFileReg(), GWEN_Sar_FileHeaderToTlv(), GWEN_Sar_ScanFile(), GWEN_Sar_Sign(), GWEN_Sar_Verify(), GWEN_SigHead_toBuffer(), GWEN_SigTail_toBuffer(), GWEN_SmallTresor_Decrypt(), GWEN_SmallTresor_Encrypt(), GWEN_SyncIo_Buffered_ReadLinesToStringList(), GWEN_SyncIo_Http_ReadChunkSize(), GWEN_SyncIo_Http_ReadCommand(), GWEN_SyncIo_Http_ReadHeader(), GWEN_SyncIo_Http_ReadStatus(), GWEN_SyncIo_Http_WriteCommand(), GWEN_SyncIo_Http_WriteHeader(), GWEN_SyncIo_Http_WriteStatus(), GWEN_SyncIo_Tls_GetPeerCert(), GWEN_SyncIo_Tls_Prepare(), GWEN_Text_CondenseBuffer(), GWEN_Text_LogString(), GWEN_Url_fromCommandString(), GWEN_Url_fromString(), GWEN_XML__ReadData(), GWEN_XML__ReadTag(), GWEN_XML_AddNameSpace(), GWEN_XML_FindNameSpace(), GWEN_XmlCtxStore_AddAttr(), GWEN_XmlCtxStore_AddData(), GWEN_XMLNode__CheckAndSetNameSpace(), GWEN_XMLNode__CheckNameSpaceDecls1(), GWEN_XMLNode_GetXPath(), HtmlCtx_SanitizeData(), and HtmlGroup_Box_AddData().

GWENHYWFAR_API uint32_t GWEN_Buffer_GetStep ( GWEN_BUFFER bf)

In dynamic mode, whenever there is new data to allocate then this value specifies how much data to allocate in addition. The allocated data in total for this buffer will be aligned to this value.

Definition at line 751 of file buffer.c.

GWENHYWFAR_API uint32_t GWEN_Buffer_GetUsedBytes ( const GWEN_BUFFER bf)

Definition at line 266 of file buffer.c.

Referenced by _decode(), _encode(), check1(), check2(), COCOA_Gui_GetFileName(), QT4_Gui::getFileName(), FOX16_Gui::getFileName(), GTK2_Gui_GetFileName(), GWEN_Crypt_TokenFile__Decipher(), GWEN_Crypt_TokenFile__Encipher(), GWEN_Crypt_TokenFile__Sign(), GWEN_Crypt_TokenFile__Verify(), GWEN_CryptMgr_Decode(), GWEN_CryptMgr_Decrypt(), GWEN_CryptMgr_Encode(), GWEN_CryptMgr_Encrypt(), GWEN_CryptMgr_Sign(), GWEN_CryptMgrKeys_EncryptKey(), GWEN_CryptMgrKeys_SignData(), GWEN_CryptMgrKeys_VerifyData(), GWEN_DB__ReadValues(), GWEN_DB_ReadFromFastBuffer(), GWEN_DB_WriteGroupToIoLayer(), GWEN_Directory_HandlePathElement(), GWEN_DlgProgress_AddLogText(), GWEN_LoadPluginDescrsByType(), GWEN_Logger__Log(), GWEN_MsgEngine__ReadGroup(), GWEN_MsgEngine__ReadValue(), GWEN_MsgEngine__WriteElement(), GWEN_MsgEngine__WriteValue(), GWEN_MsgEngine_ReadMessage(), GWEN_MsgEngine_SkipSegment(), GWEN_Padd__UnpaddWithPkcs1Bt1Or2(), GWEN_Padd_ApplyPaddAlgo(), GWEN_Padd_PaddWithAnsiX9_23ToMultipleOf(), GWEN_Padd_PaddWithISO9796(), GWEN_Padd_PaddWithIso9796_2(), GWEN_Padd_PaddWithPkcs1Bt1(), GWEN_Padd_PaddWithPkcs1Bt2(), GWEN_Padd_UnpaddWithAnsiX9_23FromMultipleOf(), GWEN_Padd_UnpaddWithIso9796_2(), GWEN_PasswordStore_EncryptWriteFile(), GWEN_PasswordStore_ReadDecryptFile(), GWEN_PasswordStore_ReadFile(), GWEN_PasswordStore_WriteFile(), GWEN_Sar_AddAndDigestFileLink(), GWEN_Sar_AddAndDigestFileReg(), GWEN_Sar_AddFile(), GWEN_Sar_ExtractAndDigestFileDir(), GWEN_Sar_ExtractAndDigestFileLink(), GWEN_Sar_ExtractAndDigestFileReg(), GWEN_Sar_FileHeaderToTlv(), GWEN_Sar_Sign(), GWEN_Sar_Verify(), GWEN_SmallTresor_Decrypt(), GWEN_SmallTresor_Encrypt(), GWEN_SyncIo_Buffered_ReadLineToBuffer(), GWEN_SyncIo_Http_ReadLine(), GWEN_SyncIo_Http_RecvBody(), GWEN_SyncIo_Http_WriteCommand(), GWEN_SyncIo_Http_WriteHeader(), GWEN_SyncIo_Http_WriteStatus(), GWEN_SyncIo_Tls_GetPeerCert(), GWEN_SyncIo_Tls_Prepare(), GWEN_Text_CondenseBuffer(), GWEN_Url_fromCommandString(), GWEN_Url_fromString(), GWEN_XML__ReadData(), GWEN_XML__ReadTag(), GWEN_XmlCtxStore_AddData(), HtmlCtx_SanitizeData(), and HtmlGroup_Box_AddData().

GWENHYWFAR_API int GWEN_Buffer_IncrementPos ( GWEN_BUFFER bf,
uint32_t  i 
)
GWENHYWFAR_API int GWEN_Buffer_InsertBuffer ( GWEN_BUFFER bf,
GWEN_BUFFER sf 
)

Insert the content of the buffer sf into the buffer bf at the position of its current position pointer. The size of bf will be increased accordingly. Returns zero on success or nonzero if this failed (e.g. because of out of memory error).

Definition at line 983 of file buffer.c.

References GWEN_Buffer_InsertBytes().

GWENHYWFAR_API int GWEN_Buffer_InsertByte ( GWEN_BUFFER bf,
char  c 
)

Inserts a byte at the current position. If the current position is 0 and there is reserved space at the beginning of the buffer then that space will be used. Otherwise the data at the current position will be moved out of the way and the new byte inserted. The position pointer will not be altered, but after calling this function at that position there is the begin of the newly inserted byte. All pointers obtained from this module (e.g. via GWEN_Buffer_GetStart) become invalid ! This function updates the bookmarks accordingly.

Definition at line 959 of file buffer.c.

References DBG_ERROR, DBG_INFO, GWEN_Buffer_InsertRoom(), GWEN_BUFFER_MODE_ABORT_ON_MEMFULL, GWEN_BUFFER_MODE_READONLY, GWEN_ERROR_PERMISSIONS, and GWEN_LOGDOMAIN.

Referenced by GWEN_XMLNode_GetXPath().

GWENHYWFAR_API int GWEN_Buffer_InsertBytes ( GWEN_BUFFER bf,
const char *  buffer,
uint32_t  size 
)

Inserts multiple bytes at the current position. If the current position is 0 and there is reserved space at the beginning of the buffer then that space will be used. Otherwise the data at the current position will be moved out of the way and the new bytes inserted. The position pointer will not be altered, but all pointers obtained from this module (e.g. via GWEN_Buffer_GetStart) become invalid !

Definition at line 932 of file buffer.c.

References DBG_ERROR, DBG_INFO, GWEN_Buffer_InsertRoom(), GWEN_BUFFER_MODE_ABORT_ON_MEMFULL, GWEN_BUFFER_MODE_READONLY, GWEN_ERROR_PERMISSIONS, and GWEN_LOGDOMAIN.

Referenced by GWEN_Buffer_InsertBuffer(), GWEN_Buffer_InsertString(), and GWEN_Sar_AddFile().

GWENHYWFAR_API int GWEN_Buffer_InsertRoom ( GWEN_BUFFER bf,
uint32_t  size 
)

This function makes room for the given number of bytes at the current buffer position. It moves any existing data at the current position out of the way. The position pointer will not be altered, but after calling this function at that position there is the begin of the newly inserted room. All pointers obtained from this module (e.g. via GWEN_Buffer_GetStart) become invalid ! This function updates the bookmarks accordingly.

Definition at line 779 of file buffer.c.

References DBG_DEBUG, DBG_ERROR, GWEN_Buffer_AdjustBookmarks(), GWEN_Buffer_AllocRoom(), GWEN_BUFFER_MODE_ABORT_ON_MEMFULL, GWEN_BUFFER_MODE_READONLY, GWEN_ERROR_BUFFER_OVERFLOW, GWEN_ERROR_PERMISSIONS, and GWEN_LOGDOMAIN.

Referenced by GWEN_Buffer_FillLeftWithBytes(), GWEN_Buffer_InsertByte(), GWEN_Buffer_InsertBytes(), GWEN_Buffer_ReplaceBytes(), GWEN_Padd_PaddWithIso9796_2(), GWEN_Padd_PaddWithPkcs1Bt1(), and GWEN_Padd_PaddWithPkcs1Bt2().

GWENHYWFAR_API int GWEN_Buffer_InsertString ( GWEN_BUFFER bf,
const char *  buffer 
)

Inserts the given string at the current position (without the trailing null byte) The position pointer will not be altered, but after calling this function at that position there is the begin of the newly inserted string. All pointers obtained from this module (e.g. via GWEN_Buffer_GetStart) become invalid ! This function updates the bookmarks accordingly.

Definition at line 1038 of file buffer.c.

References GWEN_Buffer_InsertBytes().

Referenced by GWEN_XMLNode_GetXPath().

GWENHYWFAR_API GWEN_BUFFER* GWEN_Buffer_new ( char *  buffer,
uint32_t  size,
uint32_t  used,
int  take_ownership 
)

Creates a new GWEN_BUFFER, which is a dynamically resizeable text buffer.

Parameters
bufferIf non-NULL, then this buffer will be used as actual storage space. Otherwise a new buffer will be allocated (with size bytes)
sizeIf buffer was non-NULL, then this argument must specifiy the size of that buffer. If buffer was NULL, then this argument specifies the number of bytes that will be allocated.
usedNumber of bytes of the buffer actually used. This is interesting when reading from a buffer.
take_ownershipIf buffer was non-NULL and this argument is nonzero, then the new GWEN_BUFFER object takes over the ownership of the given buffer so that it will be freed on GWEN_Buffer_free(). If this argument is zero, the given buffer will not be freed. If buffer was NULL, this argument has no effect.

Definition at line 38 of file buffer.c.

References GWEN_BUFFER_MODE_DEFAULT, GWEN_Memory_malloc(), and GWEN_NEW_OBJECT.

Referenced by _decode(), _encode(), check1(), check2(), CocoaGui_WPushButton_Setup(), Dlg_Test1_new(), Dlg_Test2_new(), FOX16_GuiDialog::getIcon(), FOX16_HtmlCtx::getImage(), Gtk2Gui_WLabel_SetCharProperty(), Gtk2Gui_WLabel_Setup(), Gtk2Gui_WListBox_GetCharProperty(), Gtk2Gui_WPushButton_Setup(), Gtk2Gui_WTextBrowser_SetCharProperty(), Gtk2Gui_WTextBrowser_Setup(), GWEN_ConfigMgr_ModuleInit(), GWEN_Crypt_Token_GetPin(), GWEN_Crypt_Token_ModuleInit(), GWEN_Crypt_Token_SetPinStatus(), GWEN_Crypt_TokenFile__Decipher(), GWEN_Crypt_TokenFile__Encipher(), GWEN_Crypt_TokenFile__Sign(), GWEN_Crypt_TokenFile__Verify(), GWEN_CryptMgr_Decode(), GWEN_CryptMgr_Decrypt(), GWEN_CryptMgr_Encode(), GWEN_CryptMgr_Encrypt(), GWEN_CryptMgr_Sign(), GWEN_CryptMgrKeys_DecryptKey(), GWEN_CryptMgrKeys_EncryptKey(), GWEN_CryptMgrKeys_SignData(), GWEN_CryptMgrKeys_VerifyData(), GWEN_Date_fromTime(), GWEN_DB__ReadValues(), GWEN_DB_ReadFromFastBuffer(), GWEN_DB_WriteGroupToIoLayer(), GWEN_DBIO_ModuleInit(), GWEN_Dialog_AddMediaPathsFromPathManager(), GWEN_Directory_FindFileInPaths(), GWEN_Directory_FindPathForFile(), GWEN_Directory_GetDirEntries(), GWEN_Directory_GetFileEntries(), GWEN_Directory_GetFileEntriesWithType(), GWEN_Directory_GetMatchingFilesRecursively(), GWEN_Directory_GetPath(), GWEN_Directory_HandlePathElement(), GWEN_DlgInput_new(), GWEN_DlgMessage_new(), GWEN_DlgProgress_AddLogText(), GWEN_DlgProgress_new(), GWEN_DlgShowBox_new(), GWEN_Gui_CGui_CheckCert(), GWEN_Gui_CGui_InputBox(), GWEN_Gui_CGui_MessageBox(), GWEN_Gui_CGui_ShowBox(), GWEN_Gui_CheckCertBuiltIn(), GWEN_Gui_CProgress_Log(), GWEN_Gui_CProgress_new(), GWEN_Gui_Internal_GetPassword(), GWEN_Gui_Internal_GetSyncIo(), GWEN_Gui_Internal_SetPasswordStatus(), GWEN_LoadPluginDescrsByType(), GWEN_Logger__Log(), GWEN_Logger_Log(), GWEN_MDigest__HashFileTree(), GWEN_MDigest_CheckFileTree(), GWEN_MsgEngine__ReadGroup(), GWEN_MsgEngine__WriteElement(), GWEN_PasswordStore__GetPassword(), GWEN_PasswordStore__SetPassword(), GWEN_PasswordStore_EncryptWriteFile(), GWEN_PasswordStore_ReadDecryptFile(), GWEN_PasswordStore_ReadFile(), GWEN_PasswordStore_WriteFile(), GWEN_Path_Handle(), GWEN_Path_HandleWithIdx(), GWEN_PathManager_AddPath(), GWEN_PathManager_AddRelPath(), GWEN_PathManager_FindFile(), GWEN_PathManager_GetMatchingFilesRecursively(), GWEN_PluginManager_LoadPlugin(), GWEN_PluginManager_LoadPluginFile(), GWEN_ProgressData_new(), GWEN_Sar_AddAndDigestFileLink(), GWEN_Sar_AddAndDigestFileReg(), GWEN_Sar_AddFile(), GWEN_Sar_ExtractAndDigestFileDir(), GWEN_Sar_ExtractAndDigestFileLink(), GWEN_Sar_ExtractAndDigestFileReg(), GWEN_Sar_FileHeaderToTlv(), GWEN_Sar_ScanFile(), GWEN_Sar_Sign(), GWEN_Sar_Verify(), GWEN_SigHead_toBuffer(), GWEN_SmallTresor_Decrypt(), GWEN_SmallTresor_Encrypt(), GWEN_SyncIo_Buffered_ReadLinesToStringList(), GWEN_SyncIo_Http_Read(), GWEN_SyncIo_Http_ReadChunk(), GWEN_SyncIo_Http_ReadChunkSize(), GWEN_SyncIo_Http_ReadCommand(), GWEN_SyncIo_Http_ReadHeader(), GWEN_SyncIo_Http_ReadStatus(), GWEN_SyncIo_Http_WriteCommand(), GWEN_SyncIo_Http_WriteHeader(), GWEN_SyncIo_Http_WriteStatus(), GWEN_SyncIo_Memory_fromBuffer(), GWEN_SyncIo_Memory_new(), GWEN_SyncIo_Tls_GetPeerCert(), GWEN_SyncIo_Tls_Prepare(), GWEN_Text_LogString(), GWEN_Url_fromCommandString(), GWEN_Url_fromString(), GWEN_XML__ReadData(), GWEN_XML__ReadTag(), GWEN_XML_AddNameSpace(), GWEN_XML_FindNameSpace(), GWEN_XML_ReadFromFastBuffer(), GWEN_XMLContext_ReadFromString(), GWEN_XmlCtxStore_AddAttr(), GWEN_XmlCtxStore_AddData(), GWEN_XMLNode__CheckAndSetNameSpace(), GWEN_XMLNode__CheckNameSpaceDecls1(), GWEN_XMLNode_fromString(), GWEN_XMLNode_GetXPath(), and HtmlGroup_Box_AddData().

GWENHYWFAR_API void GWEN_Buffer_OverwriteContent ( GWEN_BUFFER bf,
int  c 
)
GWENHYWFAR_API int GWEN_Buffer_PeekByte ( GWEN_BUFFER bf)

Returns the byte from the current position without changing the position pointer. So multiple calls to this function will result in returning the same character.

Returns
-1 on error, read char otherwise (in low byte)

Definition at line 470 of file buffer.c.

References DBG_INFO, GWEN_Buffer__FillBuffer(), and GWEN_LOGDOMAIN.

Referenced by GWEN_MsgEngine__ReadGroup().

GWENHYWFAR_API int GWEN_Buffer_ReadByte ( GWEN_BUFFER bf)

Returns the byte from the current position. The position pointer is adjusted accordingly.

Returns
-1 on error, read char otherwise (in low byte)

Definition at line 488 of file buffer.c.

References DBG_INFO, GWEN_Buffer__FillBuffer(), and GWEN_LOGDOMAIN.

Referenced by GWEN_MsgEngine__ReadValue(), GWEN_MsgEngine__WriteValue(), GWEN_MsgEngine_SkipSegment(), and GWEN_Text_EscapeToBufferTolerant2().

GWENHYWFAR_API int GWEN_Buffer_ReadBytes ( GWEN_BUFFER bf,
char *  buffer,
uint32_t *  size 
)

Returns the bytes from the current position. The position pointer is adjusted accordingly.

Returns
-1 on error, 0 if ok

Definition at line 711 of file buffer.c.

References DBG_DEBUG, DBG_VERBOUS, GWEN_Buffer__FillBuffer(), and GWEN_LOGDOMAIN.

GWENHYWFAR_API int GWEN_Buffer_Relinquish ( GWEN_BUFFER bf)

This function relinquishes ownership of the internal buffer if possible. It returns an error if this object does not own the buffer (it can't give you what it doesn't possess) or if the internal pointer to the memory allocated does not match the internal pointer to the current start of the buffer (this can be the case when GWEN_Buffer_ReserveBytes() of GWEN_Buffer_Crop() have been called).

Definition at line 139 of file buffer.c.

References GWEN_ERROR_INVALID.

GWENHYWFAR_API int GWEN_Buffer_RemoveRoom ( GWEN_BUFFER bf,
uint32_t  size 
)

This function removes the given number of bytes at the current buffer position. It moves any existing bytes behind the area to be removed to the current position. The position pointer will not be altered, but after calling this function at that position there is the begin of the data behind the removed area. All pointers obtained from this module (e.g. via GWEN_Buffer_GetStart) become invalid ! This function updates the bookmarks accordingly.

Definition at line 845 of file buffer.c.

References DBG_ERROR, GWEN_Buffer_AdjustBookmarks(), GWEN_BUFFER_MODE_ABORT_ON_MEMFULL, GWEN_BUFFER_MODE_READONLY, GWEN_ERROR_INVALID, GWEN_ERROR_PERMISSIONS, and GWEN_LOGDOMAIN.

Referenced by GWEN_Buffer_ReplaceBytes().

GWENHYWFAR_API int GWEN_Buffer_ReplaceBytes ( GWEN_BUFFER bf,
uint32_t  rsize,
const char *  buffer,
uint32_t  size 
)

This function remplaces the given number of bytes at the current buffer position with some new bytes. If the number of bytes to be replaced does not equal the number of replacement bytes then the buffer is resized accordingly (e.g. shrunk or extended). The position pointer will not be altered. All pointers obtained from this module (e.g. via GWEN_Buffer_GetStart) become invalid ! This function updates the bookmarks accordingly.

Definition at line 891 of file buffer.c.

References DBG_ERROR, GWEN_Buffer_InsertRoom(), GWEN_BUFFER_MODE_ABORT_ON_MEMFULL, GWEN_BUFFER_MODE_READONLY, GWEN_Buffer_RemoveRoom(), GWEN_ERROR_PERMISSIONS, and GWEN_LOGDOMAIN.

GWENHYWFAR_API int GWEN_Buffer_ReserveBytes ( GWEN_BUFFER bf,
uint32_t  res 
)

Reserves the given amount of bytes at the beginning of the buffer. Please note that this most likely results in a shift of the current position inside the buffer, so after this call all pointers obtained from this module (e.g. via GWEN_Buffer_GetStart) are invalid ! You can use this function to save some memory copy actions when inserting bytes at the beginning of the buffer.

Definition at line 152 of file buffer.c.

References GWEN_Buffer_AllocRoom().

Referenced by GWEN_Sar_AddFile(), and GWEN_XMLNode_GetXPath().

GWENHYWFAR_API void GWEN_Buffer_Reset ( GWEN_BUFFER bf)
GWENHYWFAR_API void GWEN_Buffer_Rewind ( GWEN_BUFFER bf)
GWENHYWFAR_API void GWEN_Buffer_SetBookmark ( GWEN_BUFFER bf,
unsigned int  idx,
uint32_t  v 
)

Set a bookmark. These bookmarks are not used by the GWEN_BUFFER functions, but may be usefull for an application.

Definition at line 623 of file buffer.c.

References GWEN_BUFFER_MAX_BOOKMARKS.

GWENHYWFAR_API void GWEN_Buffer_SetHardLimit ( GWEN_BUFFER bf,
uint32_t  l 
)

Changes the hard limit. This is the maximum size of a GWEN_BUFFER in dynamic mode.

Definition at line 215 of file buffer.c.

GWENHYWFAR_API void GWEN_Buffer_SetMode ( GWEN_BUFFER bf,
uint32_t  mode 
)

Changes the current mode of the buffer (such as GWEN_BUFFER_MODE_DYNAMIC).

Definition at line 189 of file buffer.c.

GWENHYWFAR_API int GWEN_Buffer_SetPos ( GWEN_BUFFER bf,
uint32_t  i 
)
GWENHYWFAR_API void GWEN_Buffer_SetSourceSyncIo ( GWEN_BUFFER bf,
GWEN_SYNCIO sio,
int  take 
)

Sets the syncio to be used as a source. This io layer is used when a byte is to be returned while the buffer is empty (or the end of the buffer is reached). In such a case the missing bytes are read from this io layer if the mode contains GWEN_BUFFER_MODE_USE_SYNCIO.

Definition at line 1047 of file buffer.c.

References GWEN_SyncIo_free().

GWENHYWFAR_API void GWEN_Buffer_SetStep ( GWEN_BUFFER bf,
uint32_t  step 
)

In dynamic mode, whenever there is new data to allocate then this value specifies how much data to allocate in addition. The allocated data in total for this buffer will be aligned to this value. 1024 is a reasonable value. This value NEEDS to be aligned 2^n (i.e. only ONE bit must be set !)

Definition at line 758 of file buffer.c.

Referenced by GWEN_MsgEngine__WriteElement(), GWEN_Path_Handle(), and GWEN_Path_HandleWithIdx().

GWENHYWFAR_API void GWEN_Buffer_SubMode ( GWEN_BUFFER bf,
uint32_t  mode 
)

Removes the give mode from the current mode of the buffer (such as GWEN_BUFFER_MODE_DYNAMIC).

Definition at line 201 of file buffer.c.

Referenced by GWEN_XMLContext_ReadFromString(), and GWEN_XMLNode_fromString().