本文整理汇总了C++中i_unreached函数的典型用法代码示例。如果您正苦于以下问题:C++ i_unreached函数的具体用法?C++ i_unreached怎么用?C++ i_unreached使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了i_unreached函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: ldap_connect_next_message
static int
ldap_connect_next_message(struct ldap_connection *conn,
struct ldap_op_queue_entry *req, bool *finished_r)
{
int ret;
*finished_r = TRUE;
switch(conn->state) {
case LDAP_STATE_DISCONNECT:
/* if we should not disable SSL, and the URI is not ldaps:// */
if (!conn->set.start_tls || strstr(conn->set.uri, "ldaps://") == NULL) {
ret = ldap_start_tls(conn->conn, NULL, NULL, &(req->msgid));
if (ret != LDAP_SUCCESS) {
ldap_connection_result_failure(conn, req, ret, t_strdup_printf(
"ldap_start_tls(uri=%s) failed: %s",
conn->set.uri, ldap_err2string(ret)));
return ret;
}
conn->state = LDAP_STATE_TLS;
break;
} else {
conn->state = LDAP_STATE_AUTH;
/* we let it slide intentionally to next case */
}
case LDAP_STATE_AUTH:
ret = ldap_sasl_bind(conn->conn,
conn->set.bind_dn,
LDAP_SASL_SIMPLE,
&(conn->cred),
NULL,
NULL,
&(req->msgid));
if (ret != LDAP_SUCCESS) {
ldap_connection_result_failure(conn, req, ret, t_strdup_printf(
"ldap_sasl_bind(uri=%s, dn=%s) failed: %s",
conn->set.uri, conn->set.bind_dn, ldap_err2string(ret)));
return ret;
}
break;
case LDAP_STATE_CONNECT:
ldap_connection_result_success(conn, req);
return LDAP_SUCCESS; /* we are done here */
default:
i_unreached();
};
req->conn = conn;
*finished_r = FALSE;
return LDAP_SUCCESS;
}
开发者ID:bechtoldt,项目名称:dovecot-core,代码行数:51,代码来源:ldap-connection.c
示例2: stats_carbon_send
int
stats_carbon_send(const char *endpoint, const char *data,
void (*callback)(void *), void *cb_ctx,
struct stats_send_ctx **ctx_r)
{
const char *host;
in_port_t port;
struct ip_addr ip;
if (net_str2hostport(endpoint, CARBON_SERVER_DEFAULT_PORT,
&host, &port) < 0 ||
net_addr2ip(host, &ip) < 0) {
i_error("stats_submit: Cannot parse endpoint '%s'",
endpoint);
return -1;
}
pool_t pool = pool_alloconly_create("stats carbon send", 1024);
struct stats_send_ctx *ctx = p_new(pool,
struct stats_send_ctx, 1);
ctx->pool = pool;
ctx->str = p_strdup(ctx->pool, data);
ctx->fd = net_connect_ip(&ip, port, NULL);
if (ctx->fd < 0) {
i_error("connect(%s) failed: %m", endpoint);
stats_carbon_callback(ctx);
return -1;
}
ctx->io = io_add(ctx->fd, IO_WRITE,
stats_carbon_connected,
ctx);
/* give time for almost until next update
this is to ensure we leave a little pause between
attempts. Multiplier 800 gives us 20% window, and
ensures the number stays positive. */
ctx->to_msecs = stats_settings->carbon_interval*800;
ctx->to = timeout_add(ctx->to_msecs,
stats_carbon_timeout,
ctx);
if (net_ipport2str(&ip, port, &host) < 0)
i_unreached();
ctx->endpoint = p_strdup(ctx->pool, host);
ctx->callback = callback;
ctx->ctx = cb_ctx;
*ctx_r = ctx;
return 0;
}
开发者ID:manuelm,项目名称:dovecot,代码行数:51,代码来源:stats-carbon.c
示例3: o_stream_lzma_send_flush
static int o_stream_lzma_send_flush(struct lzma_ostream *zstream)
{
lzma_stream *zs = &zstream->strm;
unsigned int len;
bool done = FALSE;
int ret;
if (zs->avail_in != 0) {
i_assert(zstream->ostream.ostream.last_failed_errno != 0);
zstream->ostream.ostream.stream_errno =
zstream->ostream.ostream.last_failed_errno;
return -1;
}
if (zstream->flushed)
return 0;
if ((ret = o_stream_zlib_send_outbuf(zstream)) <= 0)
return ret;
i_assert(zstream->outbuf_used == 0);
do {
len = sizeof(zstream->outbuf) - zs->avail_out;
if (len != 0) {
zs->next_out = zstream->outbuf;
zs->avail_out = sizeof(zstream->outbuf);
zstream->outbuf_used = len;
if ((ret = o_stream_zlib_send_outbuf(zstream)) <= 0)
return ret;
if (done)
break;
}
ret = lzma_code(zs, LZMA_FINISH);
switch (ret) {
case LZMA_STREAM_END:
done = TRUE;
break;
case LZMA_MEM_ERROR:
i_fatal_status(FATAL_OUTOFMEM,
"lzma.write(%s): Out of memory",
o_stream_get_name(&zstream->ostream.ostream));
default:
i_unreached();
}
} while (zs->avail_out != sizeof(zstream->outbuf));
zstream->flushed = TRUE;
return 0;
}
开发者ID:jkerihuel,项目名称:dovecot,代码行数:51,代码来源:ostream-lzma.c
示例4: o_stream_bzlib_send_flush
static int o_stream_bzlib_send_flush(struct bzlib_ostream *zstream)
{
bz_stream *zs = &zstream->zs;
unsigned int len;
bool done = FALSE;
int ret;
if (zs->avail_in != 0) {
i_assert(zstream->ostream.ostream.last_failed_errno != 0);
zstream->ostream.ostream.stream_errno =
zstream->ostream.ostream.last_failed_errno;
return -1;
}
if (zstream->flushed)
return 0;
if ((ret = o_stream_flush_parent_if_needed(&zstream->ostream)) <= 0)
return ret;
if ((ret = o_stream_zlib_send_outbuf(zstream)) <= 0)
return ret;
i_assert(zstream->outbuf_used == 0);
do {
len = sizeof(zstream->outbuf) - zs->avail_out;
if (len != 0) {
zs->next_out = zstream->outbuf;
zs->avail_out = sizeof(zstream->outbuf);
zstream->outbuf_used = len;
if ((ret = o_stream_zlib_send_outbuf(zstream)) <= 0)
return ret;
if (done)
break;
}
ret = BZ2_bzCompress(zs, BZ_FINISH);
switch (ret) {
case BZ_STREAM_END:
done = TRUE;
break;
case BZ_FINISH_OK:
break;
default:
i_unreached();
}
} while (zs->avail_out != sizeof(zstream->outbuf));
zstream->flushed = TRUE;
return 0;
}
开发者ID:jwm,项目名称:dovecot-notmuch,代码行数:51,代码来源:ostream-bzlib.c
示例5: pkcs5_pbkdf
int pkcs5_pbkdf(enum pkcs5_pbkdf_mode mode, const struct hash_method *hash,
const unsigned char *password, size_t password_len,
const unsigned char *salt, size_t salt_len,
unsigned int iterations, uint32_t dk_len,
buffer_t *result)
{
if (mode == PKCS5_PBKDF1)
return pkcs5_pbkdf1(hash,password,password_len,
salt,salt_len,iterations,dk_len,result);
else if (mode == PKCS5_PBKDF2)
return pkcs5_pbkdf2(hash,password,password_len,
salt,salt_len,iterations,dk_len,result);
i_unreached();
}
开发者ID:bechtoldt,项目名称:dovecot-core,代码行数:14,代码来源:pkcs5.c
示例6: is_inbox_file
static bool
is_inbox_file(struct mailbox_list *list, const char *path, const char *fname)
{
const char *inbox_path;
if (strcasecmp(fname, "INBOX") != 0)
return FALSE;
if (mailbox_list_get_path(list, "INBOX",
MAILBOX_LIST_PATH_TYPE_MAILBOX,
&inbox_path) <= 0)
i_unreached();
return strcmp(inbox_path, path) == 0;
}
开发者ID:LTD-Beget,项目名称:dovecot,代码行数:14,代码来源:mailbox-list-fs-flags.c
示例7: key_get_prefixed
static const char *
key_get_prefixed(enum mail_attribute_type type, const char *mailbox_prefix,
const char *key)
{
switch (type) {
case MAIL_ATTRIBUTE_TYPE_PRIVATE:
return t_strconcat(DICT_PATH_PRIVATE, mailbox_prefix, "/",
key, NULL);
case MAIL_ATTRIBUTE_TYPE_SHARED:
return t_strconcat(DICT_PATH_SHARED, mailbox_prefix, "/",
key, NULL);
}
i_unreached();
}
开发者ID:jwm,项目名称:dovecot-notmuch,代码行数:14,代码来源:index-attribute.c
示例8: keywords_update_records
static int
keywords_update_records(struct mail_index_sync_map_ctx *ctx,
const struct mail_index_ext *ext,
unsigned int keyword_idx, enum modify_type type,
uint32_t uid1, uint32_t uid2)
{
struct mail_index_view *view = ctx->view;
struct mail_index_record *rec;
unsigned char *data, data_mask;
unsigned int data_offset;
uint32_t seq1, seq2;
i_assert(keyword_idx != UINT_MAX);
if (!mail_index_lookup_seq_range(view, uid1, uid2, &seq1, &seq2))
return 1;
mail_index_modseq_update_keyword(ctx->modseq_ctx, keyword_idx,
seq1, seq2);
data_offset = keyword_idx / CHAR_BIT;
data_mask = 1 << (keyword_idx % CHAR_BIT);
i_assert(data_offset < ext->record_size);
data_offset += ext->record_offset;
i_assert(data_offset >= MAIL_INDEX_RECORD_MIN_SIZE);
switch (type) {
case MODIFY_ADD:
for (; seq1 <= seq2; seq1++) {
rec = MAIL_INDEX_REC_AT_SEQ(view->map, seq1);
data = PTR_OFFSET(rec, data_offset);
*data |= data_mask;
}
break;
case MODIFY_REMOVE:
data_mask = ~data_mask;
for (; seq1 <= seq2; seq1++) {
rec = MAIL_INDEX_REC_AT_SEQ(view->map, seq1);
data = PTR_OFFSET(rec, data_offset);
*data &= data_mask;
}
break;
default:
i_unreached();
}
return 1;
}
开发者ID:manuelm,项目名称:dovecot,代码行数:49,代码来源:mail-index-sync-keywords.c
示例9: io_stream_remove_destroy_callback
void io_stream_remove_destroy_callback(struct iostream_private *stream,
void (*callback)(void *))
{
const struct iostream_destroy_callback *dcs;
unsigned int i, count;
dcs = array_get(&stream->destroy_callbacks, &count);
for (i = 0; i < count; i++) {
if (dcs[i].callback == callback) {
array_delete(&stream->destroy_callbacks, i, 1);
return;
}
}
i_unreached();
}
开发者ID:Raffprta,项目名称:core,代码行数:15,代码来源:iostream.c
示例10: imap_zlib_client_skip_line
static void imap_zlib_client_skip_line(struct client *client)
{
const unsigned char *data;
size_t data_size;
data = i_stream_get_data(client->input, &data_size);
i_assert(data_size > 0);
if (data[0] == '\n')
i_stream_skip(client->input, 1);
else if (data[0] == '\r' && data_size > 1 && data[1] == '\n')
i_stream_skip(client->input, 2);
else
i_unreached();
client->input_skip_line = FALSE;
}
开发者ID:unofficial-opensource-apple,项目名称:dovecot,代码行数:15,代码来源:imap-zlib-plugin.c
示例11: i_unreached
static bool cmd_test_imap_metadata_generate
(const struct sieve_codegen_env *cgenv, struct sieve_command *cmd)
{
/* Emit operation */
if ( sieve_command_is(cmd, cmd_test_imap_metadata_set) )
sieve_operation_emit
(cgenv->sblock, cmd->ext, &test_imap_metadata_set_operation);
else
i_unreached();
/* Generate arguments */
if ( !sieve_generate_arguments(cgenv, cmd, NULL) )
return FALSE;
return TRUE;
}
开发者ID:Dexus,项目名称:ubuntu-trusty-dovecot,代码行数:15,代码来源:cmd-test-imap-metadata.c
示例12: cmd_acl_get_right
static void cmd_acl_get_right(const struct acl_rights *rights)
{
const char *id = "";
string_t *str;
switch (rights->id_type) {
case ACL_ID_ANYONE:
id = ACL_ID_NAME_ANYONE;
break;
case ACL_ID_AUTHENTICATED:
id = ACL_ID_NAME_AUTHENTICATED;
break;
case ACL_ID_OWNER:
id = ACL_ID_NAME_OWNER;
break;
case ACL_ID_USER:
id = t_strconcat(ACL_ID_NAME_USER_PREFIX,
rights->identifier, NULL);
break;
case ACL_ID_GROUP:
id = t_strconcat(ACL_ID_NAME_GROUP_PREFIX,
rights->identifier, NULL);
break;
case ACL_ID_GROUP_OVERRIDE:
id = t_strconcat(ACL_ID_NAME_GROUP_OVERRIDE_PREFIX,
rights->identifier, NULL);
break;
case ACL_ID_TYPE_COUNT:
i_unreached();
}
doveadm_print(id);
if (rights->global)
doveadm_print("global");
else
doveadm_print("");
str = t_str_new(256);
if (rights->rights != NULL)
str_append(str, t_strarray_join(rights->rights, " "));
if (rights->neg_rights != NULL) {
if (str_len(str) > 0)
str_append_c(str, ' ');
str_append_c(str, '-');
str_append(str, t_strarray_join(rights->neg_rights, " -"));
}
doveadm_print(str_c(str));
}
开发者ID:aosm,项目名称:dovecot,代码行数:48,代码来源:doveadm-acl.c
示例13: index_mail_parse_bodystructure
static int index_mail_parse_bodystructure(struct index_mail *mail,
enum index_cache_field field)
{
struct index_mail_data *data = &mail->data;
string_t *str;
if (data->parsed_bodystructure) {
/* we have everything parsed already, but just not written to
a string */
index_mail_body_parsed_cache_bodystructure(mail, field);
} else {
if (data->save_bodystructure_header ||
!data->save_bodystructure_body) {
/* we haven't parsed the header yet */
data->save_bodystructure_header = TRUE;
data->save_bodystructure_body = TRUE;
(void)get_cached_parts(mail);
if (index_mail_parse_headers(mail, NULL) < 0)
return -1;
}
if (index_mail_parse_body(mail, field) < 0)
return -1;
}
i_assert(data->parts != NULL);
/* if we didn't want to have the body(structure) cached,
it's still not written. */
switch (field) {
case MAIL_CACHE_IMAP_BODY:
if (data->body == NULL) {
str = str_new(mail->data_pool, 128);
imap_bodystructure_write(data->parts, str, FALSE);
data->body = str_c(str);
}
break;
case MAIL_CACHE_IMAP_BODYSTRUCTURE:
if (data->bodystructure == NULL) {
str = str_new(mail->data_pool, 128);
imap_bodystructure_write(data->parts, str, TRUE);
data->bodystructure = str_c(str);
}
break;
default:
i_unreached();
}
return 0;
}
开发者ID:via,项目名称:dovecot-clouddb,代码行数:48,代码来源:index-mail.c
示例14: managesieve_parser_save_arg
static void managesieve_parser_save_arg(struct managesieve_parser *parser,
const unsigned char *data, size_t size)
{
struct managesieve_arg *arg;
arg = managesieve_arg_create(parser);
switch (parser->cur_type) {
case ARG_PARSE_ATOM:
/* simply save the string */
arg->type = MANAGESIEVE_ARG_ATOM;
arg->_data.str = p_strndup(parser->pool, data, size);
break;
case ARG_PARSE_STRING:
/* data is quoted and may contain escapes. */
i_assert(size > 0);
arg->type = MANAGESIEVE_ARG_STRING;
arg->_data.str = p_strndup(parser->pool, data+1, size-1);
/* remove the escapes */
if (parser->str_first_escape >= 0 &&
(parser->flags & MANAGESIEVE_PARSE_FLAG_NO_UNESCAPE) == 0) {
/* -1 because we skipped the '"' prefix */
str_unescape(arg->_data.str +
parser->str_first_escape-1);
}
break;
case ARG_PARSE_LITERAL_DATA:
if ((parser->flags & MANAGESIEVE_PARSE_FLAG_LITERAL_SIZE) != 0) {
/* save literal size */
arg->type = MANAGESIEVE_ARG_LITERAL_SIZE;
arg->_data.literal_size = parser->literal_size;
} else if ((parser->flags &
MANAGESIEVE_PARSE_FLAG_LITERAL_TYPE) != 0) {
arg->type = MANAGESIEVE_ARG_LITERAL;
arg->_data.str = p_strndup(parser->pool, data, size);
} else {
arg->type = MANAGESIEVE_ARG_STRING;
arg->_data.str = p_strndup(parser->pool, data, size);
}
break;
default:
i_unreached();
}
parser->cur_type = ARG_PARSE_NONE;
}
开发者ID:aosm,项目名称:dovecot,代码行数:48,代码来源:managesieve-parser.c
示例15: o_stream_zlib_send_flush
static int o_stream_zlib_send_flush(struct zlib_ostream *zstream)
{
z_stream *zs = &zstream->zs;
unsigned int len;
bool done = FALSE;
int ret;
i_assert(zs->avail_in == 0);
if (zstream->flushed)
return 0;
if (!zstream->header_sent)
o_stream_zlib_send_gz_header(zstream);
do {
len = sizeof(zstream->outbuf) - zs->avail_out;
if (len != 0) {
zs->next_out = zstream->outbuf;
zs->avail_out = sizeof(zstream->outbuf);
ret = o_stream_send(zstream->output,
zstream->outbuf, len);
if (ret != (int)len) {
zstream_copy_error(zstream);
return -1;
}
if (done)
break;
}
switch (deflate(zs, zstream->gz ? Z_FINISH : Z_SYNC_FLUSH)) {
case Z_OK:
case Z_BUF_ERROR:
break;
case Z_STREAM_END:
done = TRUE;
break;
default:
i_unreached();
}
} while (zs->avail_out != sizeof(zstream->outbuf));
if (o_stream_zlib_send_gz_trailer(zstream) < 0)
return -1;
zstream->flushed = TRUE;
return 0;
}
开发者ID:via,项目名称:dovecot-clouddb,代码行数:47,代码来源:ostream-zlib.c
示例16: dsync_brain_send_mailbox_attribute
static void dsync_brain_send_mailbox_attribute(struct dsync_brain *brain)
{
const struct dsync_mailbox_attribute *attr;
int ret;
while ((ret = dsync_mailbox_export_next_attr(brain->box_exporter, &attr)) > 0) {
if (dsync_ibc_send_mailbox_attribute(brain->ibc, attr) == 0)
return;
}
if (ret < 0) {
if (dsync_brain_export_deinit(brain) == 0)
i_unreached();
return;
}
dsync_brain_send_end_of_list(brain, DSYNC_IBC_EOL_MAILBOX_ATTRIBUTE);
brain->box_send_state = DSYNC_BOX_STATE_CHANGES;
}
开发者ID:IvanKharpalev,项目名称:core,代码行数:17,代码来源:dsync-brain-mails.c
示例17: http_url_add_authority
static void
http_url_add_authority(string_t *urlstr, const struct http_url *url)
{
/* host:port */
if (url->host_name != NULL) {
/* assume IPv6 literal if starts with '['; avoid encoding */
if (*url->host_name == '[')
str_append(urlstr, url->host_name);
else
uri_append_host_name(urlstr, url->host_name);
} else if (url->have_host_ip) {
uri_append_host_ip(urlstr, &url->host_ip);
} else
i_unreached();
if (url->have_port)
uri_append_port(urlstr, url->port);
}
开发者ID:jwm,项目名称:dovecot-notmuch,代码行数:17,代码来源:http-url.c
示例18: fetch_body
static int fetch_body(struct imap_fetch_context *ctx, struct mail *mail,
const struct imap_fetch_body_data *body)
{
const struct message_size *fetch_size;
struct istream *input;
struct message_size hdr_size, body_size;
if (body->section[0] == '\0') {
if (mail_get_stream(mail, NULL, NULL, &input) < 0 ||
mail_get_virtual_size(mail, &body_size.virtual_size) < 0 ||
mail_get_physical_size(mail, &body_size.physical_size) < 0)
return -1;
} else {
if (mail_get_stream(mail, &hdr_size,
body->section[0] == 'H' ? NULL : &body_size,
&input) < 0)
return -1;
}
ctx->cur_input = input;
i_stream_ref(ctx->cur_input);
ctx->update_partial = TRUE;
switch (body->section[0]) {
case '\0':
/* BODY[] - fetch everything */
fetch_size = &body_size;
ctx->cur_size_field = MAIL_FETCH_VIRTUAL_SIZE;
break;
case 'H':
/* BODY[HEADER] - fetch only header */
fetch_size = &hdr_size;
ctx->cur_size_field = MAIL_FETCH_MESSAGE_PARTS;
break;
case 'T':
/* BODY[TEXT] - skip header */
i_stream_skip(ctx->cur_input, hdr_size.physical_size);
fetch_size = &body_size;
ctx->cur_size_field = MAIL_FETCH_VIRTUAL_SIZE;
break;
default:
i_unreached();
}
return fetch_data(ctx, body, fetch_size);
}
开发者ID:via,项目名称:dovecot-clouddb,代码行数:46,代码来源:imap-fetch-body.c
示例19: message_parser_read_more
static int message_parser_read_more(struct message_parser_ctx *ctx,
struct message_block *block_r, bool *full_r)
{
int ret;
if (ctx->skip > 0) {
i_stream_skip(ctx->input, ctx->skip);
ctx->skip = 0;
}
*full_r = FALSE;
ret = i_stream_read_bytes(ctx->input, &block_r->data,
&block_r->size, ctx->want_count + 1);
if (ret <= 0) {
switch (ret) {
case 0:
if (!ctx->input->eof) {
i_assert(!ctx->input->blocking);
return 0;
}
break;
case -1:
i_assert(ctx->input->eof ||
ctx->input->stream_errno != 0);
ctx->eof = TRUE;
if (block_r->size != 0) {
/* EOF, but we still have some data.
return it. */
return 1;
}
return -1;
case -2:
*full_r = TRUE;
break;
default:
i_unreached();
}
}
if (!*full_r) {
/* reset number of wanted characters if we actually got them */
ctx->want_count = 1;
}
return 1;
}
开发者ID:zatsepin,项目名称:core,代码行数:45,代码来源:message-parser.c
示例20: field_has_fixed_size
static bool field_has_fixed_size(enum mail_cache_field_type type)
{
switch (type) {
case MAIL_CACHE_FIELD_FIXED_SIZE:
case MAIL_CACHE_FIELD_BITMASK:
return TRUE;
case MAIL_CACHE_FIELD_VARIABLE_SIZE:
case MAIL_CACHE_FIELD_STRING:
case MAIL_CACHE_FIELD_HEADER:
return FALSE;
case MAIL_CACHE_FIELD_COUNT:
break;
}
i_unreached();
return FALSE;
}
开发者ID:bechtoldt,项目名称:dovecot-core,代码行数:18,代码来源:mail-cache-fields.c
注:本文中的i_unreached函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论