本文整理汇总了C++中DBG_WARN函数的典型用法代码示例。如果您正苦于以下问题:C++ DBG_WARN函数的具体用法?C++ DBG_WARN怎么用?C++ DBG_WARN使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DBG_WARN函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ssl_write_wrapper
static inline int ssl_write_wrapper(irc_session_t *session, irc_dcc_session_t *dcc, void *buf, int num, int *sslError) {
#ifdef ENABLE_SSL
int length;
*sslError = SSL_ERROR_NONE;
length = SSL_write(dcc->ssl_ctx, buf, num);
if (unlikely(length == -1)) {
int ssl_err = SSL_get_error(dcc->ssl_ctx, length);
*sslError = ssl_err;
if (ssl_err == SSL_ERROR_WANT_READ) {
DBG_WARN("SSL_ERROR_WANT_READ on ssl_write_wrapper!");
}
else if (ssl_err == SSL_ERROR_WANT_WRITE) {
DBG_WARN("SSL_ERROR_WANT_WRITE on ssl_write_wrapper!");
}
else {
DBG_ERR("fatal ssl-error on ssl_write_wrapper was %s", ERR_error_string(ssl_err, NULL));
}
}
return length;
#else
return -1;
#endif
}
示例2: assert
GWEN_MEMCACHE_ENTRY *GWEN_MemCache_CreateEntry(GWEN_MEMCACHE *mc,
uint32_t id,
void *dataPtr,
size_t dataLen)
{
GWEN_MEMCACHE_ENTRY *me;
assert(mc);
GWEN_MemCache_Lock(mc);
/* invalidate possibly existing entry in any case */
me=GWEN_MemCacheEntry_IdMap_Find(mc->idMap, id);
if (me) {
me->isValid=0;
GWEN_MemCacheEntry_IdMap_Remove(mc->idMap, id);
if (me->useCounter==0)
GWEN_MemCacheEntry_free(me);
}
/* check for limits: entry count */
if (mc->currentCacheEntries>=mc->maxCacheEntries) {
int rv;
/* release unused entries (at least 1 byte) */
rv=GWEN_MemCache__MakeRoom(mc, 1);
if (rv) {
DBG_WARN(GWEN_LOGDOMAIN, "Too many entries in use");
GWEN_MemCache_Unlock(mc);
return NULL;
}
}
/* check for limits: memory in use */
if ((mc->currentCacheMemory+dataLen)>=mc->maxCacheMemory) {
size_t diff;
int rv;
diff=(mc->currentCacheMemory+dataLen)-mc->maxCacheMemory;
/* release unused entries */
rv=GWEN_MemCache__MakeRoom(mc, diff);
if (rv) {
DBG_WARN(GWEN_LOGDOMAIN, "Too much memory in use");
GWEN_MemCache_Unlock(mc);
return NULL;
}
}
/* create new entry */
me=GWEN_MemCacheEntry_new(mc, id, dataPtr, dataLen);
assert(me);
me->useCounter++;
GWEN_MemCacheEntry_IdMap_Insert(mc->idMap, id, me);
GWEN_MemCache_Unlock(mc);
return me;
}
示例3: send_current_file_offset_to_sender
static void send_current_file_offset_to_sender (irc_session_t *session, irc_dcc_session_t *dcc) {
int sentBytes, err = 0;
// we convert out irc_dcc_size_t to uint32_t, because it's defined like that in dcc...
uint32_t confirmSizeNetworkOrder = htobe32(dcc->file_confirm_offset);
size_t offset = sizeof(confirmSizeNetworkOrder);
#ifdef ENABLE_SSL
if (dcc->ssl == 0)
sentBytes = socket_send(&dcc->sock, &confirmSizeNetworkOrder, offset);
else {
int sslError = 0;
sentBytes = ssl_write_wrapper(session, dcc, &confirmSizeNetworkOrder, offset, &sslError);
if (sslError == SSL_ERROR_WANT_READ) {
dcc->state = LIBIRC_STATE_CONNECTED;
return;
}
else if (sslError == SSL_ERROR_WANT_WRITE) {
return;
}
}
#else
sentBytes = socket_send(&dcc->sock, &confirmSizeNetworkOrder, offset);
#endif
if (unlikely(sentBytes < 0)) {
DBG_WARN("err send length < 0");
DBG_WARN("error msg: %s\n", strerror(errno));
err = LIBIRC_ERR_WRITE;
} else if (unlikely(sentBytes == 0)) {
err = LIBIRC_ERR_CLOSED;
} else {
if (unlikely(dcc->received_file_size == dcc->file_confirm_offset)) {
DBG_OK("dcc->received_file_size == dcc->file_confirm_offset");
libirc_mutex_unlock(&session->mutex_dcc);
(*dcc->cb)(session, dcc->id, 0, dcc->ctx, 0, 0);
libirc_mutex_lock(&session->mutex_dcc);
libirc_dcc_destroy_nolock(session, dcc->id);
} else {
/* Continue to receive the file */
dcc->state = LIBIRC_STATE_CONNECTED;
}
}
/*
* If error arises somewhere above, we inform the caller
* of failure, and destroy this session.
*/
if (unlikely(err)) {
libirc_mutex_unlock(&session->mutex_dcc);
(*dcc->cb)(session, dcc->id, err, dcc->ctx, 0, 0);
libirc_mutex_lock(&session->mutex_dcc);
//libirc_dcc_destroy_nolock (ircsession, dcc->id);
}
}
示例4: AB_ImExporter_ImportFile
int AB_ImExporter_ImportFile(AB_IMEXPORTER *ie,
AB_IMEXPORTER_CONTEXT *ctx,
const char *fname,
GWEN_DB_NODE *dbProfile){
GWEN_SYNCIO *sio;
int rv;
assert(ie);
assert(ctx);
assert(fname);
assert(dbProfile);
if (fname) {
sio=GWEN_SyncIo_File_new(fname, GWEN_SyncIo_File_CreationMode_OpenExisting);
GWEN_SyncIo_AddFlags(sio, GWEN_SYNCIO_FILE_FLAGS_READ);
rv=GWEN_SyncIo_Connect(sio);
if (rv<0) {
DBG_WARN(AQBANKING_LOGDOMAIN, "Failed to Connect() syncio (%d)", rv);
GWEN_SyncIo_free(sio);
return rv;
}
}
else {
sio=GWEN_SyncIo_File_fromStdin();
GWEN_SyncIo_AddFlags(sio, GWEN_SYNCIO_FLAGS_DONTCLOSE);
}
rv=AB_ImExporter_Import(ie, ctx, sio, dbProfile);
GWEN_SyncIo_Disconnect(sio);
GWEN_SyncIo_free(sio);
return rv;
}
示例5: Gtk3Gui_WGroupBox_SetCharProperty
static GWENHYWFAR_CB
int Gtk3Gui_WGroupBox_SetCharProperty(GWEN_WIDGET *w,
GWEN_DIALOG_PROPERTY prop,
int index,
const char *value,
int doSignal)
{
GtkWidget *g;
g=GTK_WIDGET(GWEN_Widget_GetImplData(w, GTK3_DIALOG_WIDGET_REAL));
assert(g);
switch (prop) {
case GWEN_DialogProperty_Title:
gtk_frame_set_label(GTK_FRAME(g), value);
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)));
return GWEN_ERROR_INVALID;
}
示例6: malloc
net_http_handle *net_http_open(char *host, char *request) {
struct net_http_handle *h = malloc(sizeof(struct net_http_handle));
h->socket = net_connect(host, 80);
if (!h->socket) {
free(h);
return NULL;
}
int len = snprintf(h->buf, BUF_SIZE,
"GET %s HTTP/1.1\r\n"
"Host: %s\r\n"
"Accept-Encoding:\r\n"
"Connection: close\r\n\r\n",
request, host);
if (len >= BUF_SIZE || net_write(h->socket, h->buf, len) < len) {
DBG_WARN("failed to send \"%s\" to %s", request, host);
net_close(h->socket);
free(h);
return NULL;
}
h->data = NULL;
h->len = 0;
h->complete = 0;
memset(&h->settings, 0, sizeof(http_parser_settings));
h->settings.on_body = on_body_cb;
h->settings.on_message_complete = on_message_complete_cb;
h->parser = malloc(sizeof(http_parser));
h->parser->data = h;
http_parser_init(h->parser, HTTP_RESPONSE);
return h;
}
示例7: libirc_dcc_process_descriptors
static void libirc_dcc_process_descriptors(irc_session_t * ircsession) {
irc_dcc_session_t * dcc;
/*
* We need to use such a complex scheme here, because on every callback
* a number of DCC sessions could be destroyed.
*/
libirc_mutex_lock(&ircsession->mutex_dcc);
for (dcc = ircsession->dcc_sessions; dcc; dcc = dcc->next) {
switch (dcc->state) {
case LIBIRC_STATE_CONNECTING:
//printf("LIBIRC_STATE_CONNECTING\n");
handleConnectingState(ircsession, dcc);
break;
case LIBIRC_STATE_CONNECTED:
//printf("LIBIRC_STATE_CONNECTED\n");
handleConnectedState(ircsession, dcc);
break;
case LIBIRC_STATE_CONFIRM_SIZE:
//printf("LIBIRC_STATE_CONFIRM_SIZE\n");
handleConfirmSizeState(ircsession, dcc);
break;
case LIBIRC_STATE_WAITING_FOR_RESUME_ACK:
break;
default:
DBG_WARN("unknown state %d at libirc_dcc_process_descriptors!", dcc->state);
break;
}
}
libirc_mutex_unlock(&ircsession->mutex_dcc);
}
示例8: LC_DriverFlags_fromDb
uint32_t LC_DriverFlags_fromDb(GWEN_DB_NODE *db, const char *name) {
const char *p;
int i;
uint32_t flags=0;
for (i=0; ; i++) {
p=GWEN_DB_GetCharValue(db, name, i, 0);
if (!p)
break;
if (strcasecmp(p, "auto")==0)
flags|=LC_DRIVER_FLAGS_AUTO;
else if (strcasecmp(p, "remote")==0)
flags|=LC_DRIVER_FLAGS_REMOTE;
else if (strcasecmp(p, "has_verify_fn")==0)
flags|=LC_DRIVER_FLAGS_HAS_VERIFY_FN;
else if (strcasecmp(p, "has_modify_fn")==0)
flags|=LC_DRIVER_FLAGS_HAS_MODIFY_FN;
else if (strcasecmp(p, "config")==0)
flags|=LC_DRIVER_FLAGS_CONFIG;
else {
DBG_WARN(0, "Unknown driver flag \"%s\"", p);
}
}
return flags;
}
示例9: AIO_OfxGroup_BUYMF_StartTag
int AIO_OfxGroup_BUYMF_StartTag(AIO_OFX_GROUP *g,
const char *tagName) {
AIO_OFX_GROUP_BUYMF *xg;
GWEN_XML_CONTEXT *ctx;
AIO_OFX_GROUP *gNew=NULL;
assert(g);
xg=GWEN_INHERIT_GETDATA(AIO_OFX_GROUP, AIO_OFX_GROUP_BUYMF, g);
assert(xg);
ctx=AIO_OfxGroup_GetXmlContext(g);
if (strcasecmp(tagName, "BUYTYPE")==0 ||
strcasecmp(tagName, "SELLTYPE")==0) {
/* TODO */
}
else if (strcasecmp(tagName, "INVBUY")==0 ||
strcasecmp(tagName, "INVSELL")==0) {
gNew=AIO_OfxGroup_INVBUY_new(tagName, g, ctx);
}
else {
DBG_WARN(AQBANKING_LOGDOMAIN,
"Ignoring tag [%s]", tagName);
free(xg->currentElement);
xg->currentElement=strdup(tagName);
}
if (gNew) {
AIO_OfxXmlCtx_SetCurrentGroup(ctx, gNew);
GWEN_XmlCtx_IncDepth(ctx);
}
return 0;
}
示例10: AH_Job_SepaStandingOrdersGet_Process
/* --------------------------------------------------------------- FUNCTION */
int AH_Job_SepaStandingOrdersGet_Process(AH_JOB *j, AB_IMEXPORTER_CONTEXT *ctx){
GWEN_DB_NODE *dbResponses;
GWEN_DB_NODE *dbCurr;
const char *responseName;
int rv;
DBG_INFO(AQHBCI_LOGDOMAIN, "Processing JobSepaStandingOrdersGet");
assert(j);
responseName=AH_Job_GetResponseName(j);
dbResponses=AH_Job_GetResponses(j);
assert(dbResponses);
/* search for "Transactions" */
dbCurr=GWEN_DB_GetFirstGroup(dbResponses);
while(dbCurr) {
rv=AH_Job_CheckEncryption(j, dbCurr);
if (rv) {
DBG_INFO(AQHBCI_LOGDOMAIN, "Compromised security (encryption)");
AH_Job_SetStatus(j, AH_JobStatusError);
return rv;
}
rv=AH_Job_CheckSignature(j, dbCurr);
if (rv) {
DBG_INFO(AQHBCI_LOGDOMAIN, "Compromised security (signature)");
AH_Job_SetStatus(j, AH_JobStatusError);
return rv;
}
if (responseName && *responseName) {
GWEN_DB_NODE *dbXA;
dbXA=GWEN_DB_GetGroup(dbCurr, GWEN_PATH_FLAGS_NAMEMUSTEXIST, "data");
if (dbXA)
dbXA=GWEN_DB_GetGroup(dbXA, GWEN_PATH_FLAGS_NAMEMUSTEXIST, responseName);
if (dbXA) {
const void *p;
unsigned int bs;
const char *fiId;
fiId=GWEN_DB_GetCharValue(dbXA, "fiId", 0, NULL);
p=GWEN_DB_GetBinValue(dbXA, "transfer", 0, 0, 0, &bs);
if (p && bs) {
rv=AH_Job_SepaStandingOrdersGet__ReadSto(j, ctx, p, bs, fiId);
if (rv<0) {
DBG_INFO(AQHBCI_LOGDOMAIN, "here (%d)", rv);
DBG_WARN(AQHBCI_LOGDOMAIN, "Error reading standing order from data, ignoring (%d)", rv);
}
}
}
}
dbCurr=GWEN_DB_GetNextGroup(dbCurr);
}
return 0;
}
示例11: Gtk3Gui_WStack_GetIntProperty
static GWENHYWFAR_CB
int Gtk3Gui_WStack_GetIntProperty(GWEN_WIDGET *w,
GWEN_DIALOG_PROPERTY prop,
int index,
int defaultValue) {
GtkWidget *g;
g=GTK_WIDGET(GWEN_Widget_GetImplData(w, GTK3_DIALOG_WIDGET_REAL));
assert(g);
switch(prop) {
case GWEN_DialogProperty_Enabled:
return (gtk_widget_get_sensitive(GTK_WIDGET(g))==TRUE)?1:0;
case GWEN_DialogProperty_Focus:
return (gtk_widget_has_focus(GTK_WIDGET(g))==TRUE)?1:0;
return 0;
case GWEN_DialogProperty_Value:
return gtk_notebook_get_current_page(GTK_NOTEBOOK(g));
default:
break;
}
DBG_WARN(GWEN_LOGDOMAIN,
"Function is not appropriate for this type of widget (%s)",
GWEN_Widget_Type_toString(GWEN_Widget_GetType(w)));
return defaultValue;
}
示例12: AIO_OfxGroup_STATUS_StartTag
int AIO_OfxGroup_STATUS_StartTag(AIO_OFX_GROUP *g,
const char *tagName)
{
AIO_OFX_GROUP_STATUS *xg;
//GWEN_XML_CONTEXT *ctx;
assert(g);
xg=GWEN_INHERIT_GETDATA(AIO_OFX_GROUP, AIO_OFX_GROUP_STATUS, g);
assert(xg);
//ctx=AIO_OfxGroup_GetXmlContext(g);
free(xg->currentElement);
xg->currentElement=NULL;
if (strcasecmp(tagName, "CODE")==0) {
xg->currentElement=strdup(tagName);
}
else if (strcasecmp(tagName, "SEVERITY")==0) {
xg->currentElement=strdup(tagName);
}
else if (strcasecmp(tagName, "MESSAGE")==0) {
xg->currentElement=strdup(tagName);
}
else {
DBG_WARN(AQBANKING_LOGDOMAIN,
"Ignoring tag [%s]", tagName);
}
return 0;
}
示例13: Gtk2Gui_WTextEdit_SetIntProperty
static GWENHYWFAR_CB
int Gtk2Gui_WTextEdit_SetIntProperty(GWEN_WIDGET *w,
GWEN_DIALOG_PROPERTY prop,
int index,
int value,
int doSignal)
{
GtkWidget *g;
g=GTK_WIDGET(GWEN_Widget_GetImplData(w, GTK2_DIALOG_WIDGET_REAL));
assert(g);
switch (prop) {
case GWEN_DialogProperty_Enabled:
gtk_widget_set_sensitive(GTK_WIDGET(g), (value==0)?FALSE:TRUE);
return 0;
case GWEN_DialogProperty_Focus:
gtk_widget_grab_focus(GTK_WIDGET(g));
return 0;
case GWEN_DialogProperty_Width:
case GWEN_DialogProperty_Height:
/* just ignore these for now */
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)));
return GWEN_ERROR_INVALID;
}
示例14: 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;
}
示例15: AIO_OfxGroup_Document_StartTag
int AIO_OfxGroup_Document_StartTag(AIO_OFX_GROUP *g, const char *tagName) {
AIO_OFX_GROUP *gNew=NULL;
GWEN_XML_CONTEXT *ctx;
assert(g);
ctx=AIO_OfxGroup_GetXmlContext(g);
if (strcasecmp(tagName, "OFX")==0)
gNew=AIO_OfxGroup_OFX_new(tagName, g, ctx);
else if (strcasecmp(tagName, "OFC")==0) {
gNew=AIO_OfxGroup_OFX_new(tagName, g, ctx);
}
else {
DBG_WARN(AQBANKING_LOGDOMAIN,
"Ignoring group [%s]", tagName);
gNew=AIO_OfxGroup_Ignore_new(tagName, g, ctx);
}
if (gNew) {
AIO_OfxXmlCtx_SetCurrentGroup(ctx, gNew);
GWEN_XmlCtx_IncDepth(ctx);
}
return 0;
}