本文整理汇总了C++中GWEN_Buffer_free函数的典型用法代码示例。如果您正苦于以下问题:C++ GWEN_Buffer_free函数的具体用法?C++ GWEN_Buffer_free怎么用?C++ GWEN_Buffer_free使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GWEN_Buffer_free函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AH_User_SetPinStatus
int AH_User_SetPinStatus(AB_USER *u,
const char *pin,
GWEN_GUI_PASSWORD_STATUS status){
GWEN_BUFFER *nbuf;
int rv;
nbuf=GWEN_Buffer_new(0, 256 ,0 ,1);
AH_User_MkPinName(u, nbuf);
rv=GWEN_Gui_SetPasswordStatus(GWEN_Buffer_GetStart(nbuf),
pin,
status,
0);
GWEN_Buffer_free(nbuf);
return rv;
}
示例2: assert
AB_PROVIDER *AB_Provider_new(AB_BANKING *ab, const char *name){
AB_PROVIDER *pro;
GWEN_BUFFER *nbuf;
assert(ab);
assert(name);
nbuf=GWEN_Buffer_new(0, 256, 0, 1);
if (GWEN_Text_EscapeToBufferTolerant(name, nbuf)) {
DBG_ERROR(AQBANKING_LOGDOMAIN,
"Bad backend name, aborting.");
GWEN_Buffer_free(nbuf);
abort();
}
else {
char *s;
s=GWEN_Buffer_GetStart(nbuf);
while(*s) {
*s=tolower(*s);
s++;
}
}
GWEN_NEW_OBJECT(AB_PROVIDER, pro);
pro->usage=1;
GWEN_INHERIT_INIT(AB_PROVIDER, pro);
GWEN_LIST_INIT(AB_PROVIDER, pro);
pro->banking=ab;
pro->name=strdup(name);
pro->escName=strdup(GWEN_Buffer_GetStart(nbuf));
GWEN_Buffer_free(nbuf);
return pro;
}
示例3: AIO_OfxXmlCtx_SanitizeData
int AIO_OfxXmlCtx_SanitizeData(GWEN_XML_CONTEXT *ctx,
const char *data,
GWEN_BUFFER *buf) {
AIO_OFX_XMLCTX *xctx;
assert(ctx);
xctx=GWEN_INHERIT_GETDATA(GWEN_XML_CONTEXT, AIO_OFX_XMLCTX, ctx);
assert(xctx);
if (xctx->charset) {
GWEN_BUFFER *tbuf;
int rv;
tbuf=GWEN_Buffer_new(0, 256, 0, 1);
rv=AIO_OfxXmlCtx_CleanupData(ctx, data, tbuf);
if (rv<0) {
DBG_INFO(AQBANKING_LOGDOMAIN, "here (%d)", rv);
GWEN_Buffer_free(tbuf);
return rv;
}
rv=GWEN_Text_ConvertCharset(xctx->charset, "UTF-8",
GWEN_Buffer_GetStart(tbuf),
GWEN_Buffer_GetUsedBytes(tbuf),
buf);
if (rv<0) {
DBG_INFO(AQBANKING_LOGDOMAIN, "here (%d)", rv);
GWEN_Buffer_free(tbuf);
return rv;
}
GWEN_Buffer_free(tbuf);
return 0;
}
else
return AIO_OfxXmlCtx_CleanupData(ctx, data, buf);
}
示例4: GWEN_Logger_Log
int GWEN_Logger_Log(const char *logDomain,
GWEN_LOGGER_LEVEL priority, const char *s) {
if (!GWEN_Gui_LogHook(logDomain, priority, s)) {
const char *p;
int rv;
unsigned int i;
GWEN_BUFFER *mbuf;
GWEN_LOGGER *lg;
lg=GWEN_LoggerDomain_GetLogger(logDomain);
assert(lg);
if (!lg->enabled)
return 1;
if (priority>lg->logLevel)
/* priority too low, don't log */
return 0;
/* temporarily disable logging to avoid endless loops */
lg->enabled=0;
/* copy buffer, exchange all newlines by 0 */
mbuf=GWEN_Buffer_new(0, strlen(s)+1, 0, 1);
for (i=0; i<strlen(s)+1; i++) {
if (s[i]=='\n') {
GWEN_Buffer_AppendByte(mbuf, 0);
}
else
GWEN_Buffer_AppendByte(mbuf, s[i]);
}
/* now log each line */
rv=0;
p=GWEN_Buffer_GetStart(mbuf);
while (*p) {
rv|=GWEN_Logger__Log(lg, priority, p);
while(*p)
p++;
p++;
}
GWEN_Buffer_free(mbuf);
/* reenable logging */
lg->enabled=1;
return rv;
}
else
return 0;
}
示例5: GWEN_XML_AddNameSpace
int GWEN_XML_AddNameSpace(GWEN_STRINGLIST2 *sl,
const char *prefix,
const char *name) {
GWEN_BUFFER *nbuf;
int rv;
nbuf=GWEN_Buffer_new(0, 32, 0, 1);
if (prefix)
GWEN_Buffer_AppendString(nbuf, prefix);
GWEN_Buffer_AppendByte(nbuf, ':');
GWEN_Buffer_AppendString(nbuf, name);
rv=GWEN_StringList2_AppendString(sl, GWEN_Buffer_GetStart(nbuf), 0,
GWEN_StringList2_IntertMode_NoDouble);
GWEN_Buffer_free(nbuf);
return rv;
}
示例6: AB_Value_Dump
void AB_Value_Dump(const AB_VALUE *v, FILE *f, unsigned int indent) {
unsigned int i;
for (i=0; i<indent; i++)
fprintf(f, " ");
fprintf(f, "Value: ");
if (v) {
GWEN_BUFFER *nbuf;
nbuf=GWEN_Buffer_new(0, 128, 0, 1);
AB_Value_toHumanReadableString(v, nbuf, 2);
gmp_fprintf(f, "%Qi (%s)\n", v->value, GWEN_Buffer_GetStart(nbuf));
GWEN_Buffer_free(nbuf);
}
else
fprintf(f, "[none]\n");
}
示例7: GWEN_Directory_GetFileEntries
int GWEN_Directory_GetFileEntries(const char *folder, GWEN_STRINGLIST *sl,
const char *mask) {
GWEN_DIRECTORY *d;
int rv;
char buffer[256];
GWEN_BUFFER *pbuf;
uint32_t pos;
d=GWEN_Directory_new();
rv=GWEN_Directory_Open(d, folder);
if (rv<0) {
DBG_INFO(GWEN_LOGDOMAIN, "here (%d)", rv);
GWEN_Directory_free(d);
return rv;
}
pbuf=GWEN_Buffer_new(0, 256, 0, 1);
GWEN_Buffer_AppendString(pbuf, folder);
GWEN_Buffer_AppendString(pbuf, GWEN_DIR_SEPARATOR_S);
pos=GWEN_Buffer_GetPos(pbuf);
while(0==GWEN_Directory_Read(d, buffer, sizeof(buffer))) {
if (strcmp(buffer, ".")!=0 &&
strcmp(buffer, "..")!=0 &&
(mask==NULL ||
GWEN_Text_ComparePattern(buffer+1, mask, 0)!=-1)) {
struct stat st;
GWEN_Buffer_AppendString(pbuf, buffer);
if (stat(GWEN_Buffer_GetStart(pbuf), &st)==0) {
if (S_ISREG(st.st_mode))
GWEN_StringList_AppendString(sl, buffer, 0, 1);
}
GWEN_Buffer_Crop(pbuf, 0, pos);
}
}
GWEN_Buffer_free(pbuf);
GWEN_Directory_Close(d);
GWEN_Directory_free(d);
return 0;
}
示例8: AHB_DTAUS__AddWord
int AHB_DTAUS__AddWord(GWEN_BUFFER *dst,
unsigned int size,
const char *s) {
unsigned int i;
unsigned int ssize;
GWEN_BUFFER *nbuf;
assert(dst);
assert(size);
assert(s);
DBG_DEBUG(AQBANKING_LOGDOMAIN, "Adding word: %s", s);
nbuf=GWEN_Buffer_new(0, size, 0, 1);
AB_ImExporter_Utf8ToDta(s, -1, nbuf);
s=GWEN_Buffer_GetStart(nbuf);
ssize=strlen(s);
if (ssize>size) {
/* Error out here because e.g. truncated accountid will lead to failed jobs. */
DBG_ERROR(AQBANKING_LOGDOMAIN, "Word \"%s\" too long: Has length %d but must not be longer than %d characters",
s, ssize, size);
return -1;
}
for (i=0; i<size; i++) {
char c;
if (i>=ssize)
c=0;
else
c=s[i];
if (c)
GWEN_Buffer_AppendByte(dst, c);
else
GWEN_Buffer_AppendByte(dst, ' ');
} /* for */
GWEN_Buffer_free(nbuf);
return 0;
}
示例9: assert
GWEN_DB_NODE *AH_User_GetUpdForAccountIdAndSuffix(const AB_USER *u,
const char *sAccountNumber,
const char *sAccountSuffix) {
AH_USER *ue;
GWEN_DB_NODE *db;
GWEN_BUFFER *tbuf;
assert(u);
ue=GWEN_INHERIT_GETDATA(AB_USER, AH_USER, u);
assert(ue);
db=AH_User_GetUpd(u);
if (db==NULL) {
DBG_INFO(AQHBCI_LOGDOMAIN, "No upd");
return NULL;
}
tbuf=GWEN_Buffer_new(0, 64, 0, 1);
GWEN_Buffer_AppendString(tbuf, sAccountNumber);
GWEN_Buffer_AppendString(tbuf, "-");
/* take into account the "Unterkontomerkmal", don't rely solely on account id */
if (sAccountSuffix && *sAccountSuffix)
GWEN_Buffer_AppendString(tbuf, sAccountSuffix);
else
GWEN_Buffer_AppendString(tbuf, "none");
DBG_INFO(AQHBCI_LOGDOMAIN, "Checking upd for account \"%s\"", GWEN_Buffer_GetStart(tbuf));
db=GWEN_DB_GetGroup(db,
GWEN_PATH_FLAGS_NAMEMUSTEXIST,
GWEN_Buffer_GetStart(tbuf));
GWEN_Buffer_free(tbuf);
if (db==NULL) {
DBG_INFO(AQHBCI_LOGDOMAIN, "Falling back to old storage of UPD for account \"%s\"", sAccountNumber);
db=AH_User_GetUpd(u);
db=GWEN_DB_GetGroup(db,
GWEN_PATH_FLAGS_NAMEMUSTEXIST,
sAccountNumber);
}
return db;
}
示例10: AH_NewKeyFileDialog_HandleActivatedFileButton
int AH_NewKeyFileDialog_HandleActivatedFileButton(GWEN_DIALOG *dlg) {
AH_NEWKEYFILE_DIALOG *xdlg;
int rv;
const char *s;
GWEN_BUFFER *pathBuffer;
assert(dlg);
xdlg=GWEN_INHERIT_GETDATA(GWEN_DIALOG, AH_NEWKEYFILE_DIALOG, dlg);
assert(xdlg);
pathBuffer=GWEN_Buffer_new(0, 256, 0, 1);
s=GWEN_Dialog_GetCharProperty(dlg, "wiz_filename_edit", GWEN_DialogProperty_Value, 0, NULL);
if (s && *s)
GWEN_Buffer_AppendString(pathBuffer, s);
rv=GWEN_Gui_GetFileName(I18N("Create Keyfile"),
GWEN_Gui_FileNameType_SaveFileName,
0,
I18N("All Files (*)\tOHBCI Files (*ohbci;*.medium)"),
pathBuffer,
GWEN_Dialog_GetGuiId(dlg));
if (rv==0) {
GWEN_Dialog_SetCharProperty(dlg,
"wiz_filename_edit",
GWEN_DialogProperty_Value,
0,
GWEN_Buffer_GetStart(pathBuffer),
0);
rv=AH_NewKeyFileDialog_GetFilePageData(dlg);
if (rv<0)
GWEN_Dialog_SetIntProperty(dlg, "wiz_next_button", GWEN_DialogProperty_Enabled, 0, 0, 0);
else
GWEN_Dialog_SetIntProperty(dlg, "wiz_next_button", GWEN_DialogProperty_Enabled, 0, 1, 0);
}
else {
DBG_NOTICE(AQHBCI_LOGDOMAIN, "here (%d)", rv);
}
GWEN_Buffer_free(pathBuffer);
return GWEN_DialogEvent_ResultHandled;
}
示例11: GWEN_Crypt_Token_ModuleInit
int GWEN_Crypt_Token_ModuleInit(void)
{
GWEN_PLUGIN_MANAGER *pm;
int err;
GWEN_STRINGLIST *sl;
pm=GWEN_PluginManager_new(GWEN_CRYPT_TOKEN_PLUGIN_TYPENAME, GWEN_PM_LIBNAME);
err=GWEN_PluginManager_Register(pm);
if (err) {
DBG_ERROR(GWEN_LOGDOMAIN, "Could not register CryptToken plugin manager");
return err;
}
/* create plugin paths */
sl=GWEN_PathManager_GetPaths(GWEN_PM_LIBNAME, GWEN_PM_PLUGINDIR);
if (sl) {
GWEN_STRINGLISTENTRY *se;
GWEN_BUFFER *pbuf;
pbuf=GWEN_Buffer_new(0, 256, 0, 1);
se=GWEN_StringList_FirstEntry(sl);
while (se) {
GWEN_Buffer_AppendString(pbuf, GWEN_StringListEntry_Data(se));
GWEN_Buffer_AppendString(pbuf, DIRSEP GWEN_CRYPT_TOKEN_FOLDER);
DBG_INFO(GWEN_LOGDOMAIN, "Adding plugin path [%s]",
GWEN_Buffer_GetStart(pbuf));
GWEN_PluginManager_AddPath(pm, GWEN_PM_LIBNAME,
GWEN_Buffer_GetStart(pbuf));
GWEN_Buffer_Reset(pbuf);
se=GWEN_StringListEntry_Next(se);
}
GWEN_Buffer_free(pbuf);
GWEN_StringList_free(sl);
}
return 0;
}
示例12: GWEN_PathManager_AddPath
int GWEN_PathManager_AddPath(const char *callingLib,
const char *destLib,
const char *pathName,
const char *pathValue) {
GWEN_DB_NODE *dbT;
GWEN_BUFFER *buf;
assert(destLib);
assert(pathName);
assert(pathValue);
assert(gwen__paths);
dbT=GWEN_DB_GetGroup(gwen__paths, GWEN_PATH_FLAGS_NAMEMUSTEXIST,
destLib);
if (!dbT)
return GWEN_ERROR_NOT_FOUND;
dbT=GWEN_DB_GetGroup(dbT, GWEN_PATH_FLAGS_NAMEMUSTEXIST,
pathName);
if (!dbT)
return GWEN_ERROR_NOT_FOUND;
dbT=GWEN_DB_GetGroup(dbT, GWEN_PATH_FLAGS_CREATE_GROUP,
"pair");
assert(dbT);
if (callingLib) {
GWEN_DB_SetCharValue(dbT, GWEN_DB_FLAGS_DEFAULT,
"lib", callingLib);
}
buf=GWEN_Buffer_new(0, 256, 0, 1);
GWEN_Directory_OsifyPath(pathValue, buf, 1);
GWEN_DB_SetCharValue(dbT, GWEN_DB_FLAGS_DEFAULT,
"path",
GWEN_Buffer_GetStart(buf));
GWEN_Buffer_free(buf);
return 0;
}
示例13: LC_DDVCard_Open
LC_CLIENT_RESULT CHIPCARD_CB LC_DDVCard_Open(LC_CARD *card){
LC_CLIENT_RESULT res;
LC_DDVCARD *ddv;
DBG_INFO(LC_LOGDOMAIN, "Opening card as DDV card");
assert(card);
ddv=GWEN_INHERIT_GETDATA(LC_CARD, LC_DDVCARD, card);
assert(ddv);
ddv->ddvType=-1;
GWEN_DB_Group_free(ddv->db_ef_id_1);
ddv->db_ef_id_1=0;
GWEN_Buffer_free(ddv->bin_ef_id_1);
ddv->bin_ef_id_1=0;
if (strcasecmp(LC_Card_GetCardType(card), "PROCESSOR")!=0) {
DBG_ERROR(LC_LOGDOMAIN, "Not a processor card (%s)",
LC_Card_GetCardType(card));
return LC_Client_ResultNotSupported;
}
res=ddv->openFn(card);
if (res!=LC_Client_ResultOk) {
DBG_INFO(LC_LOGDOMAIN, "here");
return res;
}
res=LC_DDVCard_Reopen(card);
if (res!=LC_Client_ResultOk) {
DBG_INFO(LC_LOGDOMAIN, "here");
ddv->closeFn(card);
return res;
}
return LC_Client_ResultOk;
}
示例14: GWEN_DBIO__XmlDb_ReadDataTags
void GWEN_DBIO__XmlDb_ReadDataTags(GWEN_XMLNODE *node, GWEN_BUFFER *buf) {
GWEN_XMLNODE *ndata;
GWEN_BUFFER *tbuf;
int rv;
tbuf=GWEN_Buffer_new(0, 256, 0, 1);
ndata=GWEN_XMLNode_GetFirstData(node);
while(ndata) {
const char *s;
s=GWEN_XMLNode_GetData(ndata);
if (s) {
if (GWEN_Buffer_GetUsedBytes(tbuf))
GWEN_Buffer_AppendByte(tbuf, ' ');
GWEN_Buffer_AppendString(tbuf, s);
}
ndata=GWEN_XMLNode_GetNextData(node);
}
rv=GWEN_Text_UnescapeXmlToBuffer(GWEN_Buffer_GetStart(tbuf), buf);
if (rv<0) {
DBG_INFO(GWEN_LOGDOMAIN, "here (%d)", rv);
}
GWEN_Buffer_free(tbuf);
}
示例15: addToList
static int addToList(const char *fname, int recursive, GWEN_STRINGLIST *sl) {
struct stat st;
int rv;
/* stat file to be added */
#if _BSD_SOURCE || _XOPEN_SOURCE >= 500 || _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED
rv=lstat(fname, &st);
#else
rv=stat(fname, &st);
#endif
if (rv) {
DBG_ERROR(GSA_LOGDOMAIN, "stat(%s): %d (%s)",
fname, errno, strerror(errno));
fprintf(stderr, "Ignoring file \"%s\"\n", fname);
}
else {
/* always append this entry */
GWEN_StringList_AppendString(sl, fname, 0, 1);
if (recursive && S_ISDIR(st.st_mode)) {
GWEN_STRINGLIST *sll;
GWEN_STRINGLISTENTRY *se;
GWEN_DIRECTORY *d;
int rv;
char buffer[256];
GWEN_BUFFER *tbuf;
uint32_t pos;
/* add entries */
sll=GWEN_StringList_new();
d=GWEN_Directory_new();
rv=GWEN_Directory_Open(d, fname);
if (rv<0) {
DBG_INFO(GWEN_LOGDOMAIN, "here (%d)", rv);
GWEN_Directory_free(d);
GWEN_StringList_free(sll);
return rv;
}
while(0==GWEN_Directory_Read(d, buffer, sizeof(buffer))) {
if (strcmp(buffer, ".")!=0 &&
strcmp(buffer, "..")!=0)
GWEN_StringList_AppendString(sll, buffer, 0, 1);
}
GWEN_Directory_Close(d);
GWEN_Directory_free(d);
/* recurse */
tbuf=GWEN_Buffer_new(0, 256, 0, 1);
GWEN_Buffer_AppendString(tbuf, fname);
GWEN_Buffer_AppendString(tbuf, GWEN_DIR_SEPARATOR_S);
pos=GWEN_Buffer_GetPos(tbuf);
se=GWEN_StringList_FirstEntry(sll);
while(se) {
const char *s;
s=GWEN_StringListEntry_Data(se);
if (s && *s) {
GWEN_Buffer_AppendString(tbuf, s);
rv=addToList(GWEN_Buffer_GetStart(tbuf), recursive, sl);
if (rv<0) {
DBG_INFO(GWEN_LOGDOMAIN, "here (%d)", rv);
GWEN_Buffer_free(tbuf);
GWEN_StringList_free(sll);
return rv;
}
}
GWEN_Buffer_Crop(tbuf, 0, pos);
se=GWEN_StringListEntry_Next(se);
} /* while se */
GWEN_Buffer_free(tbuf);
GWEN_StringList_free(sll);
} /* if dir and recursive */
} /* if stat was ok */
return 0;
}