/usr/include/libdigidoc/DigiDocMem.h is in libdigidoc-dev 3.10.1.1208+ds1-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | #ifndef __DIGIDOC_MEM_H__
#define __DIGIDOC_MEM_H__
//==================================================
// FILE: DigiDocMem.h
// PROJECT: Digi Doc
// DESCRIPTION: Digi Doc functions for memory buffer management
// AUTHOR: Veiko Sinivee, S|E|B IT Partner Estonia
//==================================================
// Copyright (C) AS Sertifitseerimiskeskus
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
// GNU Lesser General Public Licence is available at
// http://www.gnu.org/copyleft/lesser.html
//==========< HISTORY >=============================
// 09.09.2004 Veiko Sinivee
// Creation
//==================================================
#include "DigiDocDefs.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct DigiDocMemBuf_st {
void* pMem; // functions will assign allocated memory address here
long nLen; // length of data in number of bytes
} DigiDocMemBuf;
//--------------------------------------------------
// Helper function to append data to a memory buffer
// and grow it as required.
// pBuf - address of memory buffer pointer
// data - new data to be appended
// len - length of data or -1 for zero terminated strings
//--------------------------------------------------
EXP_OPTION int ddocMemAppendData(DigiDocMemBuf* pBuf, const char* data, long len);
//--------------------------------------------------
// Helper function to assign data to a memory buffer
// and release old content if necessary
// pBuf - address of memory buffer pointer
// data - new data to be appended
// len - length of data or -1 for zero terminated strings
//--------------------------------------------------
EXP_OPTION int ddocMemAssignData(DigiDocMemBuf* pBuf, const char* data, long len);
EXP_OPTION int ddocMemAssignData2(DigiDocMemBuf* pBuf, const char* data, long len);
//--------------------------------------------------
// Helper function to set buffer length as required
// It will fill acquired mem with zeros.
// pBuf - address of memory buffer pointer
// len - new length of buffer
//--------------------------------------------------
EXP_OPTION int ddocMemSetLength(DigiDocMemBuf* pBuf, long len);
//--------------------------------------------------
// Helper function to free/cleanup memory buffer
// This does not attempt to release the buffer object
// itself but only it's contents.
// pBuf - memory buffer pointer
//--------------------------------------------------
EXP_OPTION int ddocMemBuf_free(DigiDocMemBuf* pBuf);
//--------------------------------------------------
// Helper function to assign zero terminated strings
// and release old content if necessary
// dest - destination address
// src - new data to be assigned
//--------------------------------------------------
EXP_OPTION int ddocMemAssignString(char** dest, const char* src);
//--------------------------------------------------
// Replaces a substring with another substring
// pBuf1 - memory buffer to search in
// pBuf2 - memory buffer to write converted value to
// search - search value
// replacement - replacement value
//--------------------------------------------------
EXP_OPTION int ddocMemReplaceSubstr(DigiDocMemBuf* pBuf1, DigiDocMemBuf* pBuf2,
const char* search, const char* replacment);
EXP_OPTION int ddocMemGetSubstr(DigiDocMemBuf* pBuf1, DigiDocMemBuf* pBuf2,
const char* search, const char* replacment);
EXP_OPTION char *replaceStr(char *str, char *orig, char *rep);
//--------------------------------------------------
// Compares memory buffers
// pBuf1 - memory buffer to value 1
// pBuf2 - memory buffer to value 2
// return 0 if both buffers are equal, 1 if not equal
//--------------------------------------------------
EXP_OPTION int ddocMemCompareMemBufs(DigiDocMemBuf* pBuf1, DigiDocMemBuf* pBuf2);
int ddocMemPush(DigiDocMemBuf* pBuf1, const char* tag);
const char* ddocMemPop(DigiDocMemBuf* pBuf1);
#ifdef __cplusplus
}
#endif
#endif // __DIGIDOC_MEM_H__
|