本文整理汇总了C++中PERR函数的典型用法代码示例。如果您正苦于以下问题:C++ PERR函数的具体用法?C++ PERR怎么用?C++ PERR使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PERR函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: qof_date_format_set
void qof_date_format_set(QofDateFormat df)
{
if (df >= DATE_FORMAT_FIRST && df <= DATE_FORMAT_LAST)
{
prevQofDateFormat = dateFormat;
dateFormat = df;
}
else
{
/* hack alert - Use a neutral default. */
PERR("non-existent date format set attempted. Setting ISO default");
prevQofDateFormat = dateFormat;
dateFormat = QOF_DATE_FORMAT_ISO;
}
return;
}
示例2: qof_commit_edit
gboolean qof_commit_edit (QofInstance *inst)
{
QofInstancePrivate *priv;
if (!inst) return FALSE;
priv = GET_PRIVATE(inst);
priv->editlevel--;
if (0 < priv->editlevel) return FALSE;
if (0 > priv->editlevel)
{
PERR ("unbalanced call - resetting (was %d)", priv->editlevel);
priv->editlevel = 0;
}
return TRUE;
}
示例3: if
template<> void
GncDbiProviderImpl<DbType::DBI_SQLITE>::append_col_def(std::string& ddl,
const GncSqlColumnInfo& info)
{
const char* type_name = nullptr;
if (info.m_type == BCT_INT)
{
type_name = "integer";
}
else if (info.m_type == BCT_INT64)
{
type_name = "bigint";
}
else if (info.m_type == BCT_DOUBLE)
{
type_name = "float8";
}
else if (info.m_type == BCT_STRING || info.m_type == BCT_DATE
|| info.m_type == BCT_DATETIME)
{
type_name = "text";
}
else
{
PERR ("Unknown column type: %d\n", info.m_type);
type_name = "";
}
ddl += (info.m_name + " " + type_name);
if (info.m_size != 0)
{
ddl += "(" + std::to_string(info.m_size) + ")";
}
if (info.m_primary_key)
{
ddl += " PRIMARY KEY";
}
if (info.m_autoinc)
{
ddl += " AUTOINCREMENT";
}
if (info.m_not_null)
{
ddl += " NOT NULL";
}
}
示例4: wl_pointer_req
s8 wl_pointer_req(struct client *c,s32 pointer_slot,struct msg *m)
{
s8 r;
switch(m->req_op){
case WL_POINTER_SET_CURSOR:
r=set_cursor(c,pointer_slot,m);
break;
case WL_POINTER_CLOSE:
LOG_WIRE("client(%d):pointer::close pointer_id=%u\n",c->so,m->req[0]);
r=pointer_close(c,pointer_slot);
break;
default:
PERR("client(%d):fatal:pointer unknown opcode %u\n",c->so,m->req_op);
r=LWL_ERR;
};
return r;
}
示例5: set_options
static void
set_options(dbi_conn conn, const PairVec& options)
{
for (auto option : options)
{
auto opt = option.first.c_str();
auto val = option.second.c_str();
auto result = dbi_conn_set_option(conn, opt, val);
if (result < 0)
{
const char *msg = nullptr;
int err = dbi_conn_error(conn, &msg);
PERR("Error setting %s option to %s: %s", opt, val, msg);
throw std::runtime_error(msg);
}
}
}
示例6: gnc_ui_file_access_response_cb
void
gnc_ui_file_access_response_cb(GtkDialog *dialog, gint response, GtkDialog *unused)
{
FileAccessWindow* faw;
gchar* url;
g_return_if_fail( dialog != NULL );
faw = g_object_get_data( G_OBJECT(dialog), "FileAccessWindow" );
g_return_if_fail( faw != NULL );
switch ( response )
{
case GTK_RESPONSE_HELP:
gnc_gnome_help( HF_HELP, HL_GLOBPREFS );
break;
case GTK_RESPONSE_OK:
url = geturl( faw );
if ( url == NULL )
{
return;
}
if ( faw->type == FILE_ACCESS_OPEN )
{
gnc_file_open_file( url );
}
else if ( faw->type == FILE_ACCESS_SAVE_AS )
{
gnc_file_do_save_as( url );
}
break;
case GTK_RESPONSE_CANCEL:
break;
default:
PERR( "Invalid response" );
break;
}
if ( response != GTK_RESPONSE_HELP )
{
gtk_widget_destroy( GTK_WIDGET(dialog) );
}
}
示例7: g_str_has_suffix
template<> void
error_handler<DbType::DBI_PGSQL> (dbi_conn conn, void* user_data)
{
GncDbiBackend<DbType::DBI_PGSQL>* dbi_be =
static_cast<decltype(dbi_be)>(user_data);
const char* msg;
(void)dbi_conn_error (conn, &msg);
if (g_str_has_prefix (msg, "FATAL: database") &&
g_str_has_suffix (msg, "does not exist\n"))
{
PINFO ("DBI error: %s\n", msg);
dbi_be->set_exists(false);
}
else if (g_strrstr (msg,
"server closed the connection unexpectedly")) // Connection lost
{
if (!dbi_be->connected())
{
PWARN ("DBI Error: Connection lost, connection pointer invalid");
return;
}
PINFO ("DBI error: %s - Reconnecting...\n", msg);
dbi_be->set_dbi_error (ERR_BACKEND_CONN_LOST, 1, true);
dbi_be->retry_connection(msg);
}
else if (g_str_has_prefix (msg, "connection pointer is NULL") ||
g_str_has_prefix (msg, "could not connect to server")) // No connection
{
if (!dbi_be->connected())
qof_backend_set_error(reinterpret_cast<QofBackend*>(dbi_be),
ERR_BACKEND_CANT_CONNECT);
else
{
dbi_be->set_dbi_error(ERR_BACKEND_CANT_CONNECT, 1, true);
dbi_be->retry_connection (msg);
}
}
else
{
PERR ("DBI error: %s\n", msg);
if (dbi_be->connected())
dbi_be->set_dbi_error (ERR_BACKEND_MISC, 0, false);
}
}
示例8: htc_fingerprint_init
static int __init htc_fingerprint_init(void)
{
int ret;
ret = register_chrdev(0, DEVICE_NAME, &htc_fingerprint_fops);
if (ret < 0) {
PERR("register module fail");
return ret;
}
htc_fingerprint_major = ret;
htc_fingerprint_class = class_create(THIS_MODULE, "htc_fingerprint");
device_create(htc_fingerprint_class, NULL, MKDEV(htc_fingerprint_major, 0), NULL, DEVICE_NAME);
PDEBUG("register module ok");
return 0;
}
示例9: wl_shm_pool_buffer_req
s8 wl_shm_pool_buffer_req(struct client *c,s32 shm_pool_buffer_slot,
struct msg *m)
{
s8 r;
switch(m->req_op){
case WL_BUFFER_DESTROY:
LOG_WIRE("client(%d):shm_pool_buffer::destroy shm_pool_buffer_id=%u\n",
c->so,m->req[0]);
r=shm_pool_buffer_destroy(c,shm_pool_buffer_slot);
break;
default:
PERR("client(%d):fatal:shm_pool_buffer unknown opcode %u\n",c->so,
m->req_op);
r=LWL_ERR;
};
return r;
}
示例10: ntohs
bool CTun::injectIp6Packet(IpPacket::IPv6* p_poPacket)
{
/* ipv6 payload + ipv6 header itself */
ssize_t packetLen = ntohs(p_poPacket->m_u16_PayloadLength) + offsetof(IpPacket::IPv6, m_oIP_Payload);
if (packetLen > MAX_IP_PACKET_SIZE)
{
NLOG_WARN("CTun::injectIp6Packet, packetLen(%d) > MAX_PACKET_SIZE(%d)", packetLen, MAX_IP_PACKET_SIZE );
return false;
}
Ip6PseudoHdr oPHdr(p_poPacket);
// pseudoheader checksum
uint16_t checksum = IpPacket::Checksum((uint8_t*)&oPHdr, sizeof oPHdr);
switch(p_poPacket->m_u8_NextHeader)
{
case IPPROTO_ICMPV6:
p_poPacket->m_oICMP_Payload.m_u16_Checksum = 0;
/* substract the ipv6 header size from the whole packet length */
p_poPacket->m_oICMP_Payload.m_u16_Checksum = htons(IpPacket::Checksum((const uint8_t*)&p_poPacket->m_oICMP_Payload,
packetLen - offsetof(IpPacket::IPv6, m_oIP_Payload), checksum));
break;
case IPPROTO_UDP:
p_poPacket->m_oUDP_Payload.m_u16_Checksum = 0;
/* substract the ipv6 header size from the whole packet length */
checksum = IpPacket::Checksum((const uint8_t*)&p_poPacket->m_oUDP_Payload
, packetLen - offsetof(IpPacket::IPv6, m_oIP_Payload), checksum);
if(!checksum){
p_poPacket->m_oUDP_Payload.m_u16_Checksum = 0xFFFF;
}else{
p_poPacket->m_oUDP_Payload.m_u16_Checksum = htons(checksum);
}
break;
default:
NLOG_ERR("CTun::injectIp6Packet: unsupported IP next header %d, discarding packet", p_poPacket->m_u8_NextHeader);
return false;
}
ssize_t bw = write(m_nTunHandle, p_poPacket, packetLen);
if(bw < packetLen)
{
PERR("CTun::injectIp6Packet, write "TUN_INTERFACE);
return false;
}
NLOG_DBG("injectIp6Packet, if:%s, sz:%d, data[%s%s]", m_szTunName, bw,
GET_HEX_LIMITED(&p_poPacket, (size_t)bw, m_uHexLimit))
return true;
}
示例11: gnc_register_gui_component_internal
static ComponentInfo *
gnc_register_gui_component_internal (const char * component_class)
{
ComponentInfo *ci;
gint component_id;
g_return_val_if_fail (component_class, NULL);
/* look for a free handler id */
component_id = next_component_id;
/* design warning: if we ever get 2^32-1 components,
this loop is infinite. Instead of fixing it, we'll just
complain when (if) we get half way there (probably never).
*/
while (find_component (component_id))
if (++component_id == NO_COMPONENT)
component_id++;
if (component_id < 0)
PERR("Amazing! Half way to running out of component_ids.");
/* found one, add the handler */
ci = g_new0 (ComponentInfo, 1);
ci->watch_info.event_masks = g_hash_table_new (g_str_hash, g_str_equal);
ci->watch_info.entity_events = guid_hash_table_new ();
ci->component_class = g_strdup (component_class);
ci->component_id = component_id;
ci->session = NULL;
components = g_list_prepend (components, ci);
/* update id for next registration */
next_component_id = component_id + 1;
#if CM_DEBUG
fprintf (stderr, "Register component %d in class %s\n",
component_id, component_class ? component_class : "(null)");
dump_components ();
#endif
return ci;
}
示例12: set_cursor
static s8 set_cursor(struct client *c,s32 pointer_slot,struct msg *m)
{
s8 r;
if(m->req_dws<6){
PERR("client(%d):fatal:pointer::set_cursor missing data\n",c->so);
r=LWL_ERR;goto exit;
}
LOG_WIRE("client(%d):pointer::set_cursor serial=%u surface_id=%u"
" hotspot_x=%d hotspot_y=%d\n",c->so,m->req[2],m->req[3],
(s32)m->req[4],(s32)m->req[5]);
r=pointer_set_cusor(c,pointer_slot,m->req[2],m->req[3],(s32)m->req[4],
( s32)m->req[5]);
exit:
return r;
}
示例13: socket
bool CTun::BringUpIp6(in6_addr& p_IP, unsigned p_uMtu)
{
m_nTunSocket = socket(AF_INET6, SOCK_DGRAM, 0);
ioctl(m_nTunSocket, SIOGIFINDEX, &ifr);
struct in6_ifreq ifr6;
ifr6.ifr6_ifindex = ifr.ifr_ifindex;
ifr6.ifr6_prefixlen = 64;
ifr6.ifr6_addr = p_IP;
if (ioctl(m_nTunSocket, SIOCSIFADDR, &ifr6) < 0)
{
PERR("SIOCSIFADDR: "TUN_INTERFACE", %s", m_szTunName);
return false;
}
return bringUp(p_uMtu);;
}
示例14: gnc_gnome_locate_pixmap
char *
gnc_gnome_locate_pixmap (const char *name)
{
char *fullname;
g_return_val_if_fail (name != NULL, NULL);
fullname = gnome_program_locate_file (gnucash_program,
GNOME_FILE_DOMAIN_APP_PIXMAP,
name, TRUE, NULL);
if (fullname == NULL)
{
PERR ("Could not locate pixmap/pixbuf file %s", name);
return NULL;
}
return fullname;
}
示例15: xml
void QGenodeClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode)
{
if (!data || !data->hasText() || !supportsMode(mode))
return;
QString text = data->text();
QByteArray utf8text = text.toUtf8();
if (!_clipboard_reporter)
return;
try {
Genode::Reporter::Xml_generator xml(*_clipboard_reporter, [&] () {
xml.append_sanitized(utf8text.constData(), utf8text.size()); });
} catch (...) {
PERR("could not write clipboard data");
}
}