本文整理汇总了C++中GWEN_Buffer_GetStart函数的典型用法代码示例。如果您正苦于以下问题:C++ GWEN_Buffer_GetStart函数的具体用法?C++ GWEN_Buffer_GetStart怎么用?C++ GWEN_Buffer_GetStart使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GWEN_Buffer_GetStart函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: GWEN_Buffer_AppendString
GWEN_DIALOG *Dlg_Test1_new() {
GWEN_DIALOG *dlg;
int rv;
const char *s;
GWEN_BUFFER *tbuf;
tbuf=GWEN_Buffer_new(0, 256, 0, 1);
s=getenv("DIALOG_DIR");
if (s && *s)
GWEN_Buffer_AppendString(tbuf, s);
else
GWEN_Buffer_AppendString(tbuf, MEDIAPATH);
dlg=GWEN_Dialog_new("dlg_test");
GWEN_Dialog_SetSignalHandler(dlg, _gwenGuiSignalHandler);
GWEN_Dialog_AddMediaPath(dlg, GWEN_Buffer_GetStart(tbuf));
/* read dialog from dialog description file */
GWEN_Buffer_AppendString(tbuf, GWEN_DIR_SEPARATOR_S "dlg_test.dlg");
rv=GWEN_Dialog_ReadXmlFile(dlg, GWEN_Buffer_GetStart(tbuf));
GWEN_Buffer_free(tbuf);
if (rv<0) {
DBG_INFO(GWEN_LOGDOMAIN, "here (%d).", rv);
GWEN_Dialog_free(dlg);
return NULL;
}
/* done */
return dlg;
}
开发者ID:Zauberstuhl,项目名称:gwenhywfar,代码行数:29,代码来源:dlg_test.c
示例2: GWEN_Directory_FindPathForFile
int GWEN_Directory_FindPathForFile(const GWEN_STRINGLIST *paths,
const char *filePath,
GWEN_BUFFER *fbuf) {
GWEN_STRINGLISTENTRY *se;
se=GWEN_StringList_FirstEntry(paths);
while(se) {
GWEN_BUFFER *tbuf;
FILE *f;
tbuf=GWEN_Buffer_new(0, 256, 0, 1);
GWEN_Buffer_AppendString(tbuf, GWEN_StringListEntry_Data(se));
GWEN_Buffer_AppendString(tbuf, DIRSEP);
GWEN_Buffer_AppendString(tbuf, filePath);
DBG_VERBOUS(GWEN_LOGDOMAIN, "Trying \"%s\"",
GWEN_Buffer_GetStart(tbuf));
f=fopen(GWEN_Buffer_GetStart(tbuf), "r");
if (f) {
fclose(f);
DBG_INFO(GWEN_LOGDOMAIN,
"File \"%s\" found in folder \"%s\"",
filePath,
GWEN_StringListEntry_Data(se));
GWEN_Buffer_AppendString(fbuf, GWEN_StringListEntry_Data(se));
GWEN_Buffer_free(tbuf);
return 0;
}
GWEN_Buffer_free(tbuf);
se=GWEN_StringListEntry_Next(se);
}
DBG_INFO(GWEN_LOGDOMAIN, "File \"%s\" not found", filePath);
return GWEN_ERROR_NOT_FOUND;
}
开发者ID:aqbanking,项目名称:gwenhywfar,代码行数:35,代码来源:directory_all.c
示例3: GWEN_Gui_CProgress_Log
int GWEN_Gui_CProgress_Log(GWEN_GUI_CPROGRESS *cp,
GWEN_UNUSED GWEN_LOGGER_LEVEL level,
const char *text)
{
assert(cp);
assert(text);
if (!(GWEN_Gui_GetFlags(cp->gui) & GWEN_GUI_FLAGS_NONINTERACTIVE)) {
GWEN_BUFFER *tbuf;
const char *t;
tbuf=GWEN_Buffer_new(0, 256, 0, 1);
GWEN_Gui_GetRawText(cp->gui, text, tbuf);
t=GWEN_Buffer_GetStart(tbuf);
if (t[GWEN_Buffer_GetUsedBytes(tbuf)-1]!='\n') {
GWEN_Buffer_AppendByte(tbuf, '\n');
/* Just in case the buffer has been reallocated */
t=GWEN_Buffer_GetStart(tbuf);
}
GWEN_Gui_StdPrintf(cp->gui, stderr, "%s", t);
GWEN_Buffer_AppendString(cp->logBuf, t);
GWEN_Buffer_free(tbuf);
tbuf=0;
if (cp->aborted)
return GWEN_ERROR_USER_ABORTED;
}
return 0;
}
开发者ID:cstim,项目名称:gwenhywfar,代码行数:29,代码来源:cprogress.c
示例4: GWEN_Buffer_AppendString
GWEN_TIME *AB_ImExporter_DateFromString(const char *p, const char *tmpl,
int inUtc) {
GWEN_TIME *ti;
if (strchr(tmpl, 'h')==0) {
GWEN_BUFFER *dbuf;
GWEN_BUFFER *tbuf;
dbuf=GWEN_Buffer_new(0, 32, 0, 1);
GWEN_Buffer_AppendString(dbuf, p);
GWEN_Buffer_AppendString(dbuf, "-12:00");
tbuf=GWEN_Buffer_new(0, 32, 0, 1);
GWEN_Buffer_AppendString(tbuf, tmpl);
GWEN_Buffer_AppendString(tbuf, "-hh:mm");
ti=GWEN_Time_fromUtcString(GWEN_Buffer_GetStart(dbuf),
GWEN_Buffer_GetStart(tbuf));
GWEN_Buffer_free(tbuf);
GWEN_Buffer_free(dbuf);
}
else {
if (inUtc)
ti=GWEN_Time_fromUtcString(p, tmpl);
else
ti=GWEN_Time_fromString(p, tmpl);
}
return ti;
}
开发者ID:Zauberstuhl,项目名称:aqbanking,代码行数:29,代码来源:imexporter.c
示例5: AB_Value_toHbciString
void AB_Value_toHbciString(const AB_VALUE *v, GWEN_BUFFER *buf) {
GWEN_BUFFER *tbuf;
char *p;
int l;
tbuf=GWEN_Buffer_new(0, 32, 0, 1);
AB_Value_toHumanReadableString2(v, tbuf, 2, 0);
/* convert decimal komma */
p=GWEN_Buffer_GetStart(tbuf);
while(*p) {
if (*p=='.') {
*p=',';
break;
}
p++;
}
/* remove trailing zeroes */
p=GWEN_Buffer_GetStart(tbuf);
l=strlen(GWEN_Buffer_GetStart(tbuf));
if (l>0 && strchr(p, ',')!=NULL) {
l--;
while(l>0 && p[l]=='0') {
p[l]=0;
l--;
}
}
GWEN_Buffer_AppendString(buf, GWEN_Buffer_GetStart(tbuf));
GWEN_Buffer_free(tbuf);
}
开发者ID:Zauberstuhl,项目名称:aqbanking,代码行数:32,代码来源:value.c
示例6: GWEN_PathManager_FindFile
int GWEN_PathManager_FindFile(const char *destLib,
const char *pathName,
const char *fileName,
GWEN_BUFFER *fbuf) {
GWEN_DB_NODE *dbT;
assert(gwen__paths);
dbT=GWEN_DB_GetGroup(gwen__paths, GWEN_PATH_FLAGS_NAMEMUSTEXIST,
destLib);
if (dbT) {
dbT=GWEN_DB_GetGroup(dbT, GWEN_PATH_FLAGS_NAMEMUSTEXIST,
pathName);
if (dbT) {
int i;
const char *s;
GWEN_DB_NODE *dbN;
GWEN_BUFFER *tbuf;
tbuf=GWEN_Buffer_new(0, 256, 0, 1);
/* check all paths */
dbN=GWEN_DB_FindFirstGroup(dbT, "pair");
while(dbN) {
for (i=0; ; i++) {
s=GWEN_DB_GetCharValue(dbN, "path", i, 0);
if (!s)
break;
else {
FILE *f;
GWEN_Buffer_AppendString(tbuf, s);
GWEN_Buffer_AppendString(tbuf, GWEN_DIR_SEPARATOR_S);
GWEN_Buffer_AppendString(tbuf, fileName);
DBG_DEBUG(GWEN_LOGDOMAIN, "Trying \"%s\"",
GWEN_Buffer_GetStart(tbuf));
f=fopen(GWEN_Buffer_GetStart(tbuf), "r");
if (f) {
fclose(f);
DBG_DEBUG(GWEN_LOGDOMAIN,
"File \"%s\" found in folder \"%s\"",
fileName,
s);
GWEN_Buffer_AppendBuffer(fbuf, tbuf);
GWEN_Buffer_free(tbuf);
return 0;
}
GWEN_Buffer_Reset(tbuf);
}
}
dbN=GWEN_DB_FindNextGroup(dbN, "pair");
}
GWEN_Buffer_free(tbuf);
}
}
DBG_INFO(GWEN_LOGDOMAIN, "File \"%s\" not found", fileName);
return GWEN_ERROR_NOT_FOUND;
}
开发者ID:Zauberstuhl,项目名称:gwenhywfar,代码行数:59,代码来源:pathmanager.c
示例7: LC_EgkCard_ReadRawPd
LC_CLIENT_RESULT LC_EgkCard_ReadRawPd(LC_CARD *card, GWEN_BUFFER *buf){
LC_EGKCARD *egk;
LC_CLIENT_RESULT res;
GWEN_BUFFER *lbuf;
int size;
const unsigned char *p;
assert(card);
egk=GWEN_INHERIT_GETDATA(LC_CARD, LC_EGKCARD, card);
assert(egk);
res=LC_Card_SelectEf(card, "EF_PD");
if (res!=LC_Client_ResultOk)
return res;
lbuf=GWEN_Buffer_new(0, 2, 0, 1);
res=LC_Card_IsoReadBinary(card, 0, 0, 2, lbuf);
if (res!=LC_Client_ResultOk) {
GWEN_Buffer_free(lbuf);
return res;
}
if (GWEN_Buffer_GetUsedBytes(lbuf)<2) {
DBG_ERROR(LC_LOGDOMAIN, "Invalid response size (%d)",
GWEN_Buffer_GetUsedBytes(lbuf));
GWEN_Buffer_free(lbuf);
return LC_Client_ResultDataError;
}
p=(const unsigned char*)GWEN_Buffer_GetStart(lbuf);
assert(p);
size=(*(p++))<<8;
size+=*p;
if (size<2) {
DBG_ERROR(LC_LOGDOMAIN, "Invalid size spec in data (%d)", size);
GWEN_Buffer_free(lbuf);
return LC_Client_ResultDataError;
}
size-=2;
GWEN_Buffer_Reset(lbuf);
if (size) {
res=LC_Card_ReadBinary(card, 2, size, lbuf);
if (res!=LC_Client_ResultOk) {
DBG_INFO(LC_LOGDOMAIN, "here (%d)", res);
GWEN_Buffer_free(lbuf);
return res;
}
}
res=LC_EgkCard_Unzip(GWEN_Buffer_GetStart(lbuf),
GWEN_Buffer_GetUsedBytes(lbuf),
buf);
GWEN_Buffer_free(lbuf);
return res;
}
开发者ID:aqbanking,项目名称:libchipcard,代码行数:58,代码来源:egkcard.c
示例8: _dumpBal
static
void _dumpBal(const AB_BALANCE *bal,
const GWEN_TIME *ti,
FILE *fd) {
if (bal) {
const GWEN_TIME *bti;
const AB_VALUE *val;
bti=AB_Balance_GetTime(bal);
if (bti==0)
bti=ti;
if (bti) {
GWEN_BUFFER *tbuf;
tbuf=GWEN_Buffer_new(0, 24, 0, 1);
GWEN_Time_toString(bti, "DD.MM.YYYY\thh:mm", tbuf);
fprintf(fd, "%s\t", GWEN_Buffer_GetStart(tbuf));
GWEN_Buffer_free(tbuf);
}
else {
fprintf(fd, "\t\t");
}
val=AB_Balance_GetValue(bal);
if (val) {
AB_VALUE *vNew;
GWEN_BUFFER *vbuf;
const char *cur;
vNew=AB_Value_dup(val);
AB_Value_SetCurrency(vNew, NULL);
vbuf=GWEN_Buffer_new(0, 32, 0, 1);
AB_Value_toHumanReadableString(vNew, vbuf, 2);
fprintf(fd, "%s\t", GWEN_Buffer_GetStart(vbuf));
GWEN_Buffer_free(vbuf);
AB_Value_free(vNew);
cur=AB_Value_GetCurrency(val);
if (cur)
fprintf(fd, "%s\t", cur);
else
fprintf(fd, "\t");
}
else {
fprintf(fd, "\t\t");
}
}
else {
fprintf(fd, "\t\t\t\t");
}
}
开发者ID:Zauberstuhl,项目名称:aqbanking,代码行数:51,代码来源:listbal.c
示例9: GWEN_PathManager_GetMatchingFilesRecursively
int GWEN_PathManager_GetMatchingFilesRecursively(const char *destLib,
const char *pathName,
const char *subFolderName,
GWEN_STRINGLIST *sl,
const char *mask) {
GWEN_DB_NODE *dbT;
assert(gwen__paths);
dbT=GWEN_DB_GetGroup(gwen__paths, GWEN_PATH_FLAGS_NAMEMUSTEXIST,
destLib);
if (dbT) {
dbT=GWEN_DB_GetGroup(dbT, GWEN_PATH_FLAGS_NAMEMUSTEXIST,
pathName);
if (dbT) {
int i;
const char *s;
GWEN_DB_NODE *dbN;
GWEN_BUFFER *tbuf;
tbuf=GWEN_Buffer_new(0, 256, 0, 1);
/* check all paths */
dbN=GWEN_DB_FindFirstGroup(dbT, "pair");
while(dbN) {
for (i=0; ; i++) {
s=GWEN_DB_GetCharValue(dbN, "path", i, 0);
if (!s)
break;
else {
GWEN_Buffer_AppendString(tbuf, s);
if (subFolderName && *subFolderName) {
GWEN_Buffer_AppendString(tbuf, GWEN_DIR_SEPARATOR_S);
GWEN_Buffer_AppendString(tbuf, subFolderName);
}
DBG_DEBUG(GWEN_LOGDOMAIN, "Trying \"%s\"",
GWEN_Buffer_GetStart(tbuf));
GWEN_Directory_GetMatchingFilesRecursively(GWEN_Buffer_GetStart(tbuf), sl, mask);
GWEN_Buffer_Reset(tbuf);
}
}
dbN=GWEN_DB_FindNextGroup(dbN, "pair");
}
GWEN_Buffer_free(tbuf);
}
}
return 0;
}
开发者ID:Zauberstuhl,项目名称:gwenhywfar,代码行数:50,代码来源:pathmanager.c
示例10: AIO_OfxGroup_STATUS_AddData
int AIO_OfxGroup_STATUS_AddData(AIO_OFX_GROUP *g, const char *data)
{
AIO_OFX_GROUP_STATUS *xg;
assert(g);
xg=GWEN_INHERIT_GETDATA(AIO_OFX_GROUP, AIO_OFX_GROUP_STATUS, g);
assert(xg);
if (xg->currentElement) {
GWEN_BUFFER *buf;
int rv;
const char *s;
buf=GWEN_Buffer_new(0, strlen(data), 0, 1);
rv=AIO_OfxXmlCtx_SanitizeData(AIO_OfxGroup_GetXmlContext(g), data, buf);
if (rv<0) {
DBG_INFO(AQBANKING_LOGDOMAIN, "here (%d)", rv);
GWEN_Buffer_free(buf);
return rv;
}
s=GWEN_Buffer_GetStart(buf);
if (*s) {
DBG_INFO(AQBANKING_LOGDOMAIN,
"AddData: %s=[%s]", xg->currentElement, s);
if (strcasecmp(xg->currentElement, "CODE")==0) {
if (1!=sscanf(s, "%d", &xg->code)) {
DBG_ERROR(AQBANKING_LOGDOMAIN,
"Bad data for element [%s]",
xg->currentElement);
GWEN_Buffer_free(buf);
return GWEN_ERROR_BAD_DATA;
}
}
else if (strcasecmp(xg->currentElement, "SEVERITY")==0) {
free(xg->severity);
xg->severity=strdup(GWEN_Buffer_GetStart(buf));
}
else {
DBG_INFO(AQBANKING_LOGDOMAIN,
"Ignoring data for unknown element [%s]",
xg->currentElement);
}
}
GWEN_Buffer_free(buf);
}
return 0;
}
开发者ID:cstim,项目名称:aqbanking,代码行数:48,代码来源:g_status.c
示例11: GWEN_Padd_UnpaddWithIso9796_2
int GWEN_Padd_UnpaddWithIso9796_2(GWEN_BUFFER *buf) {
uint32_t l;
uint32_t realSize;
const uint8_t *p;
l=GWEN_Buffer_GetUsedBytes(buf);
if (l<11) {
DBG_ERROR(GWEN_LOGDOMAIN, "Buffer contains too few bytes");
return GWEN_ERROR_INVALID;
}
p=(const uint8_t*)GWEN_Buffer_GetStart(buf);
if (*p!=0x60) {
DBG_ERROR(GWEN_LOGDOMAIN, "First byte is not a 0x60");
return GWEN_ERROR_BAD_DATA;
}
p++;
l=0;
while(*p==0x00) {
l++;
p++;
}
if (*p!=0x01) {
/*DBG_ERROR(GWEN_LOGDOMAIN, "First byte after padding is not a 0x01");*/
return GWEN_ERROR_BAD_DATA;
}
realSize=GWEN_Buffer_GetUsedBytes(buf)-11-l;
GWEN_Buffer_Crop(buf, 10+l, realSize);
return 0;
}
开发者ID:Zauberstuhl,项目名称:gwenhywfar,代码行数:32,代码来源:padd.c
示例12: Gtk3Gui_WLabel_SetCharProperty
static GWENHYWFAR_CB
int Gtk3Gui_WLabel_SetCharProperty(GWEN_WIDGET *w,
GWEN_DIALOG_PROPERTY prop,
int index,
const char *value,
int doSignal) {
GtkLabel *g;
GWEN_BUFFER *tbuf;
g=GTK_LABEL(GWEN_Widget_GetImplData(w, GTK3_DIALOG_WIDGET_REAL));
assert(g);
tbuf=GWEN_Buffer_new(0, 128, 0, 1);
if (value && *value)
Gtk3Gui_GetRawText(value, tbuf);
switch(prop) {
case GWEN_DialogProperty_Title:
gtk_label_set_text(g, GWEN_Buffer_GetStart(tbuf));
GWEN_Buffer_free(tbuf);
return 0;
default:
break;
}
DBG_WARN(GWEN_LOGDOMAIN,
"Function is not appropriate for this type of widget (%s)",
GWEN_Widget_Type_toString(GWEN_Widget_GetType(w)));
GWEN_Buffer_free(tbuf);
return GWEN_ERROR_INVALID;
}
开发者ID:Gnucash,项目名称:gnucash,代码行数:31,代码来源:w_label.c
示例13: Gtk3Gui_WLabel_Setup
static int Gtk3Gui_WLabel_Setup(GWEN_WIDGET *w) {
GtkWidget *g;
const char *s;
GWEN_WIDGET *wParent;
GWEN_BUFFER *tbuf;
wParent=GWEN_Widget_Tree_GetParent(w);
s=GWEN_Widget_GetText(w, 0);
tbuf=GWEN_Buffer_new(0, 128, 0, 1);
if (s && *s)
Gtk3Gui_GetRawText(s, tbuf);
g=gtk_label_new(GWEN_Buffer_GetStart(tbuf));
GWEN_Buffer_free(tbuf);
GWEN_Widget_SetImplData(w, GTK3_DIALOG_WIDGET_REAL, (void*) g);
GWEN_Widget_SetImplData(w, GTK3_DIALOG_WIDGET_CONTENT, (void*) g);
GWEN_Widget_SetSetIntPropertyFn(w, Gtk3Gui_WLabel_SetIntProperty);
GWEN_Widget_SetGetIntPropertyFn(w, Gtk3Gui_WLabel_GetIntProperty);
GWEN_Widget_SetSetCharPropertyFn(w, Gtk3Gui_WLabel_SetCharProperty);
GWEN_Widget_SetGetCharPropertyFn(w, Gtk3Gui_WLabel_GetCharProperty);
if (wParent)
GWEN_Widget_AddChildGuiWidget(wParent, w);
return 0;
}
开发者ID:Gnucash,项目名称:gnucash,代码行数:28,代码来源:w_label.c
示例14: AB_Banking_GetSharedDataDir
int AB_Banking_GetSharedDataDir(const AB_BANKING *ab,
const char *name,
GWEN_BUFFER *buf){
assert(ab);
if (ab->dataDir) {
GWEN_Buffer_AppendString(buf, ab->dataDir);
GWEN_Buffer_AppendString(buf, DIRSEP "shared" DIRSEP);
if (GWEN_Text_EscapeToBufferTolerant(name, buf)) {
DBG_ERROR(AQBANKING_LOGDOMAIN,
"Bad share name, aborting.");
abort();
}
else {
char *s;
s=GWEN_Buffer_GetStart(buf);
while(*s) {
*s=tolower(*s);
s++;
}
}
return 0;
}
else {
DBG_ERROR(AQBANKING_LOGDOMAIN, "No data dir (not init?)");
return GWEN_ERROR_GENERIC;
}
}
开发者ID:Zauberstuhl,项目名称:aqbanking,代码行数:28,代码来源:banking_cfg.c
示例15: LC_EgkCard_ReadInsuranceData
LC_CLIENT_RESULT LC_EgkCard_ReadInsuranceData(LC_CARD *card,
LC_HI_INSURANCE_DATA **pData) {
GWEN_BUFFER *dbuf;
LC_CLIENT_RESULT res;
dbuf=GWEN_Buffer_new(0, 256, 0, 1);
res=LC_EgkCard_ReadVd(card, dbuf);
if (res!=LC_Client_ResultOk) {
DBG_INFO(LC_LOGDOMAIN, "here (%d)", res);
GWEN_Buffer_free(dbuf);
return res;
}
else {
GWEN_XMLNODE *root;
root=GWEN_XMLNode_fromString(GWEN_Buffer_GetStart(dbuf),
GWEN_Buffer_GetUsedBytes(dbuf),
GWEN_XML_FLAGS_HANDLE_HEADERS |
GWEN_XML_FLAGS_HANDLE_NAMESPACES);
if (root==NULL) {
DBG_INFO(LC_LOGDOMAIN, "Invalid XML string");
GWEN_Buffer_free(dbuf);
return LC_Client_ResultDataError;
}
GWEN_Buffer_free(dbuf);
GWEN_XMLNode_StripNamespaces(root);
res=LC_EgkCard_ParseInsuranceData(root, pData);
GWEN_XMLNode_free(root);
return res;
}
}
开发者ID:aqbanking,项目名称:libchipcard,代码行数:33,代码来源:egkcard.c
示例16: assert
const char *AB_ImExporterContext_GetLog(const AB_IMEXPORTER_CONTEXT *iec) {
assert(iec);
if (GWEN_Buffer_GetUsedBytes(iec->logs))
return GWEN_Buffer_GetStart(iec->logs);
else
return NULL;
}
开发者ID:Zauberstuhl,项目名称:aqbanking,代码行数:7,代码来源:imexporter.c
示例17: GWEN_Padd_PaddWithPkcs1Bt1
int GWEN_Padd_PaddWithPkcs1Bt1(GWEN_BUFFER *buf, int dstSize) {
unsigned int diff;
char *p;
if ((unsigned int)dstSize<GWEN_Buffer_GetUsedBytes(buf)) {
DBG_ERROR(GWEN_LOGDOMAIN, "Buffer contains too much data");
return GWEN_ERROR_INVALID;
}
diff=dstSize-GWEN_Buffer_GetUsedBytes(buf);
if (diff<11) {
/* honour minimum padding length for BT 1 of 8 bytes, plus the
* leading and the trailing zero and the block type identifier */
DBG_ERROR(GWEN_LOGDOMAIN,
"Buffer contains too many bytes (diff is <11)");
return GWEN_ERROR_INVALID;
}
/* reset position to 0 */
GWEN_Buffer_Rewind(buf);
if (GWEN_Buffer_InsertRoom(buf, diff)) {
DBG_ERROR(GWEN_LOGDOMAIN, "Could not insert room for %d bytes", diff);
return GWEN_ERROR_GENERIC;
}
p=GWEN_Buffer_GetStart(buf);
*(p++)=0x00;
*(p++)=0x01; /* block type 01 */
if (diff>3) {
memset(p, 0xff, diff-3);
p+=diff-3;
}
*(p++)=0x00;
return 0;
}
开发者ID:Zauberstuhl,项目名称:gwenhywfar,代码行数:35,代码来源:padd.c
示例18: GWEN_CryptMgr_Decode
int GWEN_CryptMgr_Decode(GWEN_CRYPTMGR *cm, const uint8_t *pData, uint32_t lData, GWEN_BUFFER *dbuf) {
GWEN_BUFFER *tbuf;
int rv;
tbuf=GWEN_Buffer_new(0, lData, 0, 1);
/* decrypt encrypted object */
DBG_INFO(GWEN_LOGDOMAIN, "Decrypting data");
rv=GWEN_CryptMgr_Decrypt(cm, pData, lData, tbuf);
if (rv<0) {
DBG_INFO(GWEN_LOGDOMAIN, "here (%d)", rv);
GWEN_Buffer_free(tbuf);
return rv;
}
/* verify signature, copy signed data to dbuf in the process */
DBG_INFO(GWEN_LOGDOMAIN, "Verifying data");
rv=GWEN_CryptMgr_Verify(cm,
(const uint8_t*)GWEN_Buffer_GetStart(tbuf),
GWEN_Buffer_GetUsedBytes(tbuf),
dbuf);
GWEN_Buffer_free(tbuf);
if (rv<0) {
DBG_INFO(GWEN_LOGDOMAIN, "here (%d)", rv);
return rv;
}
return 0;
}
开发者ID:Zauberstuhl,项目名称:gwenhywfar,代码行数:29,代码来源:cryptmgr.c
示例19: EB_Msg_WriteSignature
int EB_Msg_WriteSignature(EB_MSG *m, const unsigned char *hash, int hsize) {
int rv;
GWEN_BUFFER *hbuf;
assert(m);
assert(m->usage);
if (hsize!=128) {
DBG_ERROR(AQEBICS_LOGDOMAIN,
"Bad signature size (expected 128, was %d)",
hsize);
return -1;
}
hbuf=GWEN_Buffer_new(0, 256, 0, 1);
rv=GWEN_Base64_Encode(hash, (uint32_t) hsize, hbuf, 0);
if (rv) {
DBG_ERROR(AQEBICS_LOGDOMAIN,
"Could not base64-encode signature (%d)", rv);
GWEN_Buffer_free(hbuf);
return -1;
}
EB_Xml_SetCharValue(xmlDocGetRootElement(m->doc),
"AuthSignature/"
"ds:SignatureValue",
GWEN_Buffer_GetStart(hbuf));
GWEN_Buffer_free(hbuf);
return 0;
}
开发者ID:Zauberstuhl,项目名称:aqbanking,代码行数:30,代码来源:msg.c
示例20: AH_NewKeyFileDialog_HandleActivatedIniLetter
static int AH_NewKeyFileDialog_HandleActivatedIniLetter(GWEN_DIALOG *dlg) {
AH_NEWKEYFILE_DIALOG *xdlg;
int rv;
GWEN_BUFFER *tbuf;
assert(dlg);
xdlg=GWEN_INHERIT_GETDATA(GWEN_DIALOG, AH_NEWKEYFILE_DIALOG, dlg);
assert(xdlg);
tbuf=GWEN_Buffer_new(0, 1024, 0, 1);
/* add HTML version of the INI letter */
GWEN_Buffer_AppendString(tbuf, "<html>");
rv=AH_Provider_GetIniLetterHtml(AB_User_GetProvider(xdlg->user),
xdlg->user,
0,
0,
tbuf,
1);
if (rv<0) {
DBG_INFO(AQHBCI_LOGDOMAIN, "here (%d)", rv);
// TODO: show error message
AB_Banking_ClearCryptTokenList(xdlg->banking);
GWEN_Buffer_free(tbuf);
return GWEN_DialogEvent_ResultHandled;
}
GWEN_Buffer_AppendString(tbuf, "</html>");
/* add ASCII version of the INI letter for frontends which don't support HTML */
rv=AH_Provider_GetIniLetterTxt(AB_User_GetProvider(xdlg->user),
xdlg->user,
0,
0,
tbuf,
0);
if (rv<0) {
DBG_INFO(AQHBCI_LOGDOMAIN, "here (%d)", rv);
// TODO: show error message
AB_Banking_ClearCryptTokenList(xdlg->banking);
GWEN_Buffer_free(tbuf);
return GWEN_DialogEvent_ResultHandled;
}
rv=GWEN_Gui_Print(I18N("INI Letter"),
"HBCI-INILETTER",
I18N("INI Letter for HBCI"),
GWEN_Buffer_GetStart(tbuf),
0);
if (rv<0) {
DBG_INFO(AQHBCI_LOGDOMAIN, "here (%d)", rv);
// TODO: show error message
GWEN_Buffer_free(tbuf);
return GWEN_DialogEvent_ResultHandled;
}
GWEN_Buffer_free(tbuf);
return GWEN_DialogEvent_ResultHandled;
}
开发者ID:Zauberstuhl,项目名称:aqbanking,代码行数:60,代码来源:dlg_newkeyfile.c
注:本文中的GWEN_Buffer_GetStart函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论