本文整理汇总了C++中icalerror_set_errno函数的典型用法代码示例。如果您正苦于以下问题:C++ icalerror_set_errno函数的具体用法?C++ icalerror_set_errno怎么用?C++ icalerror_set_errno使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了icalerror_set_errno函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: icaldirset_init
icalset* icaldirset_init(icalset* set, const char* dir, void* options_in)
{
icaldirset *dset = (icaldirset*)set;
icaldirset_options *options = options_in;
struct stat sbuf;
icalerror_check_arg_rz( (dir!=0), "dir");
icalerror_check_arg_rz( (set!=0), "set");
if (stat(dir,&sbuf) != 0){
icalerror_set_errno(ICAL_FILE_ERROR);
return 0;
}
/* dir is not the name of a direectory*/
if (!S_ISDIR(sbuf.st_mode)){
icalerror_set_errno(ICAL_USAGE_ERROR);
return 0;
}
icaldirset_lock(dir);
dset->dir = (char*)strdup(dir);
dset->options = *options;
dset->directory = pvl_newlist();
dset->directory_iterator = 0;
dset->gauge = 0;
dset->first_component = 0;
dset->cluster = 0;
return set;
}
开发者ID:SecareLupus,项目名称:Drood,代码行数:32,代码来源:icaldirset.c
示例2: icalvalue_set_datetimeperiod
void
icalvalue_set_datetimeperiod(icalvalue* impl, struct icaldatetimeperiodtype v)
{
icalerror_check_arg_rv( (impl!=0),"value");
icalerror_check_value_type(value, ICAL_DATETIMEPERIOD_VALUE);
if(!icaltime_is_null_time(v.time)){
if(!icaltime_is_valid_time(v.time)){
icalerror_set_errno(ICAL_BADARG_ERROR);
return;
}
impl->kind = ICAL_DATETIME_VALUE;
icalvalue_set_datetime(impl,v.time);
} else if (!icalperiodtype_is_null_period(v.period)) {
if(!icalperiodtype_is_valid_period(v.period)){
icalerror_set_errno(ICAL_BADARG_ERROR);
return;
}
impl->kind = ICAL_PERIOD_VALUE;
icalvalue_set_period(impl,v.period);
} else {
icalerror_set_errno(ICAL_BADARG_ERROR);
}
}
开发者ID:EdgarChen,项目名称:mozilla-cvs-history,代码行数:25,代码来源:icalderivedvalue.c
示例3: strlen
/** Loads the builtin VTIMEZONE data for the given timezone. */
static void
icaltimezone_load_builtin_timezone (icaltimezone *zone)
{
char *filename;
unsigned int filename_len;
FILE *fp;
icalparser *parser;
icalcomponent *comp, *subcomp;
/* If the location isn't set, it isn't a builtin timezone. */
if (!zone->location || !zone->location[0])
return;
filename_len = strlen (get_zone_directory()) + strlen (zone->location) + 6;
filename = (char*) malloc (filename_len);
if (!filename) {
icalerror_set_errno(ICAL_NEWFAILED_ERROR);
return;
}
snprintf (filename, filename_len, "%s/%s.ics", get_zone_directory(),
zone->location);
fp = fopen (filename, "r");
free (filename);
if (!fp) {
icalerror_set_errno(ICAL_FILE_ERROR);
return;
}
/* ##### B.# Sun, 11 Nov 2001 04:04:29 +1100
this is where the MALFORMEDDATA error is being set, after the call to 'icalparser_parse'
fprintf(stderr, "** WARNING ** %s: %d %s\n", __FILE__, __LINE__, icalerror_strerror(icalerrno));
*/
parser = icalparser_new ();
icalparser_set_gen_data (parser, fp);
comp = icalparser_parse (parser, icaltimezone_load_get_line_fn);
icalparser_free (parser);
fclose (fp);
/* Find the VTIMEZONE component inside the VCALENDAR. There should be 1. */
subcomp = icalcomponent_get_first_component (comp,
ICAL_VTIMEZONE_COMPONENT);
if (!subcomp) {
icalerror_set_errno(ICAL_PARSE_ERROR);
return;
}
icaltimezone_get_vtimezone_properties (zone, subcomp);
icalcomponent_remove_component(comp,subcomp);
icalcomponent_free(comp);
}
开发者ID:EdgarChen,项目名称:mozilla-cvs-history,代码行数:61,代码来源:icaltimezone.c
示例4: icalerror_check_arg_rz
icalspanlist *icalspanlist_from_vfreebusy(icalcomponent *comp)
{
icalcomponent *inner;
icalproperty *prop;
icalspanlist *sl;
icalerror_check_arg_rz((comp != NULL), "comp");
inner = icalcomponent_get_inner(comp);
if (!inner)
return NULL;
if ((sl = (icalspanlist *) malloc(sizeof(icalspanlist))) == 0) {
icalerror_set_errno(ICAL_NEWFAILED_ERROR);
return 0;
}
sl->spans = pvl_newlist();
/* cycle through each FREEBUSY property, adding to the spanlist */
for (prop = icalcomponent_get_first_property(inner, ICAL_FREEBUSY_PROPERTY);
prop != NULL;
prop = icalcomponent_get_next_property(inner, ICAL_FREEBUSY_PROPERTY)) {
icaltime_span *s = (icaltime_span *) malloc(sizeof(icaltime_span));
icalparameter *param;
struct icalperiodtype period;
icalparameter_fbtype fbtype;
if (s == 0) {
icalerror_set_errno(ICAL_NEWFAILED_ERROR);
icalspanlist_free(sl);
return 0;
}
param = icalproperty_get_first_parameter(prop, ICAL_FBTYPE_PARAMETER);
fbtype = (param) ? icalparameter_get_fbtype(param) : ICAL_FBTYPE_BUSY;
switch (fbtype) {
case ICAL_FBTYPE_FREE:
case ICAL_FBTYPE_NONE:
case ICAL_FBTYPE_X:
s->is_busy = 1;
break;
default:
s->is_busy = 0;
}
period = icalproperty_get_freebusy(prop);
s->start = icaltime_as_timet_with_zone(period.start, icaltimezone_get_utc_timezone());
s->end = icaltime_as_timet_with_zone(period.end, icaltimezone_get_utc_timezone());
;
pvl_insert_ordered(sl->spans, compare_span, (void *)s);
}
/** @todo calculate start/end limits.. fill in holes? **/
return sl;
}
开发者ID:BenjamenMeyer,项目名称:libical,代码行数:55,代码来源:icalspanlist.c
示例5: icalreqstattype_from_string
struct icalreqstattype icalreqstattype_from_string(const char* str)
{
const char *p1,*p2;
struct icalreqstattype stat;
short major=0, minor=0;
icalerror_check_arg((str != 0),"str");
stat.code = ICAL_UNKNOWN_STATUS;
stat.debug = 0;
stat.desc = 0;
/* Get the status numbers */
sscanf(str, "%hd.%hd",&major, &minor);
if (major <= 0 || minor < 0){
icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
return stat;
}
stat.code = icalenum_num_to_reqstat(major, minor);
if (stat.code == ICAL_UNKNOWN_STATUS){
icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
return stat;
}
p1 = strchr(str,';');
if (p1 == 0){
/* icalerror_set_errno(ICAL_BADARG_ERROR);*/
return stat;
}
/* Just ignore the second clause; it will be taken from inside the library
*/
p2 = strchr(p1+1,';');
if (p2 != 0 && *p2 != 0){
stat.debug = p2+1;
}
return stat;
}
开发者ID:MoonchildProductions,项目名称:FossaMail,代码行数:49,代码来源:icaltypes.c
示例6: icalerror_set_errno
icalgauge *icalgauge_new_from_sql(char *sql, int expand)
{
struct icalgauge_impl *impl;
int r;
if ((impl = (struct icalgauge_impl *)malloc(sizeof(struct icalgauge_impl))) == 0) {
icalerror_set_errno(ICAL_NEWFAILED_ERROR);
return 0;
}
impl->select = pvl_newlist();
impl->from = pvl_newlist();
impl->where = pvl_newlist();
impl->expand = expand;
icalss_yy_gauge = impl;
input_buffer = input_buffer_p = sql;
r = ssparse();
if (r == 0) {
return impl;
} else {
icalgauge_free(impl);
return NULL;
}
}
开发者ID:BenjamenMeyer,项目名称:libical,代码行数:27,代码来源:icalgauge.c
示例7: icalgauge_new_from_sql
icalgauge* icalgauge_new_from_sql(char* sql, int expand)
{
struct icalgauge_impl *impl;
yyscan_t yy_globals = NULL;
int r;
if ( ( impl = (struct icalgauge_impl*)
malloc(sizeof(struct icalgauge_impl))) == 0) {
icalerror_set_errno(ICAL_NEWFAILED_ERROR);
return 0;
}
impl->select = pvl_newlist();
impl->from = pvl_newlist();
impl->where = pvl_newlist();
impl->expand = expand;
sslex_init(&yy_globals);
ssset_extra(impl, yy_globals);
ss_scan_string(sql, yy_globals);
r = ssparse(yy_globals);
sslex_destroy(yy_globals);
if (r == 0) {
return impl;
}
else {
icalgauge_free(impl);
return NULL;
}
}
开发者ID:SecareLupus,项目名称:Drood,代码行数:35,代码来源:icalgauge.c
示例8: realloc
static void
icalarray_expand (icalarray *array,
int space_needed)
{
int new_space_allocated;
void *new_data;
new_space_allocated = array->space_allocated + array->increment_size;
if (space_needed > array->increment_size)
new_space_allocated += space_needed;
/*
new_data = realloc (array->data,
new_space_allocated * array->element_size);
*/
new_data = malloc(new_space_allocated * array->element_size);
memcpy(new_data,array->data,array->element_size*array->space_allocated);
free(array->data);
if (new_data) {
array->data = new_data;
array->space_allocated = new_space_allocated;
} else {
icalerror_set_errno(ICAL_ALLOCATION_ERROR);
}
}
开发者ID:xfce-mirror,项目名称:orage,代码行数:27,代码来源:icalarray.c
示例9: icalperiodtype_from_string
struct icalperiodtype icalperiodtype_from_string (const char* str)
{
struct icalperiodtype p, null_p;
char *s = icalmemory_strdup(str);
char *start, *end = s;
icalerrorstate es;
/* Errors are normally generated in the following code, so save
the error state for resoration later */
icalerrorenum e = icalerrno;
p.start = p.end = icaltime_null_time();
p.duration = icaldurationtype_from_int(0);
null_p = p;
if(s == 0) goto error;
start = s;
end = strchr(s, '/');
if(end == 0) goto error;
*end = 0;
end++;
p.start = icaltime_from_string(start);
if (icaltime_is_null_time(p.start)) goto error;
es = icalerror_get_error_state(ICAL_MALFORMEDDATA_ERROR);
icalerror_set_error_state(ICAL_MALFORMEDDATA_ERROR,ICAL_ERROR_NONFATAL);
p.end = icaltime_from_string(end);
icalerror_set_error_state(ICAL_MALFORMEDDATA_ERROR,es);
if (icaltime_is_null_time(p.end)) {
p.duration = icaldurationtype_from_string(end);
if(icaldurationtype_as_int(p.duration) == 0) goto error;
}
icalerrno = e;
icalmemory_free_buffer(s);
return p;
error:
icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
if (s)
icalmemory_free_buffer (s);
return null_p;
}
开发者ID:johnclayton,项目名称:libical-universal,代码行数:60,代码来源:icalperiod.c
示例10: icalarray_new
icalarray *icalarray_copy (icalarray *originalarray)
{
icalarray *array = icalarray_new(originalarray->element_size, originalarray->increment_size);
int chunks = originalarray->space_allocated / originalarray->increment_size;
int chunk;
if (!array)
return NULL;
array->num_elements = originalarray->num_elements;
array->space_allocated = originalarray->space_allocated;
array->chunks = malloc(chunks * sizeof (void *));
if (array->chunks) {
for (chunk = 0; chunk < chunks; chunk++) {
array->chunks[chunk] = icalarray_alloc_chunk(array);
if (array->chunks[chunk])
memcpy(array->chunks[chunk], originalarray->chunks[chunk],
array->increment_size * array->element_size);
}
} else {
icalerror_set_errno(ICAL_ALLOCATION_ERROR);
}
return array;
}
开发者ID:Distrotech,项目名称:libical,代码行数:27,代码来源:icalarray.c
示例11: icalcalendar_create
static icalerrorenum icalcalendar_create(struct icalcalendar_impl *impl)
{
char path[MAXPATHLEN];
struct stat sbuf;
int r;
icalerror_check_arg_re((impl != 0), "impl", ICAL_BADARG_ERROR);
path[0] = '\0';
strncpy(path, impl->dir, MAXPATHLEN - 1);
strncat(path, "/", MAXPATHLEN - strlen(path) - 1);
strncat(path, BOOKED_DIR, MAXPATHLEN - strlen(path) - 1);
path[MAXPATHLEN - 1] = '\0';
r = stat(path, &sbuf);
if (r != 0 && errno == ENOENT) {
if (mkdir(path, 0777) != 0) {
icalerror_set_errno(ICAL_FILE_ERROR);
return ICAL_FILE_ERROR;
}
}
return ICAL_NO_ERROR;
}
开发者ID:BenjamenMeyer,项目名称:libical,代码行数:26,代码来源:icalcalendar.c
示例12: icaltriggertype_from_string
struct icaltriggertype icaltriggertype_from_string(const char* str)
{
struct icaltriggertype tr, null_tr;
int old_ieaf = icalerror_errors_are_fatal;
tr.time= icaltime_null_time();
tr.duration = icaldurationtype_from_int(0);
null_tr = tr;
if(str == 0) goto error;
icalerror_errors_are_fatal = 0;
tr.time = icaltime_from_string(str);
icalerror_errors_are_fatal = old_ieaf;
if (icaltime_is_null_time(tr.time)){
tr.duration = icaldurationtype_from_string(str);
if(icaldurationtype_as_int(tr.duration) == 0) goto error;
}
return tr;
error:
icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
return null_tr;
}
开发者ID:Mortal,项目名称:claws,代码行数:35,代码来源:icaltypes.c
示例13: malloc
static void
icalarray_expand (icalarray *array,
int space_needed)
{
int num_chunks = array->space_allocated / array->increment_size;
int num_new_chunks;
int c;
void **new_chunks;
num_new_chunks = (space_needed + array->increment_size - 1) / array->increment_size;
if (!num_new_chunks)
num_new_chunks = 1;
new_chunks = malloc ((num_chunks + num_new_chunks) * sizeof (void *));
if (new_chunks) {
memcpy(new_chunks, array->chunks, num_chunks * sizeof (void *));
for (c = 0; c < num_new_chunks; c++)
new_chunks[c + num_chunks] = icalarray_alloc_chunk(array);
if (array->chunks)
free (array->chunks);
array->chunks = new_chunks;
array->space_allocated = array->space_allocated + num_new_chunks * array->increment_size;
} else
icalerror_set_errno(ICAL_ALLOCATION_ERROR);
}
开发者ID:Distrotech,项目名称:libical,代码行数:26,代码来源:icalarray.c
示例14: icaldirset_next_cluster
icalerrorenum icaldirset_next_cluster(icaldirset* dset)
{
char path[ICAL_PATH_MAX];
if (dset->directory_iterator == 0){
icalerror_set_errno(ICAL_INTERNAL_ERROR);
return ICAL_INTERNAL_ERROR;
}
dset->directory_iterator = pvl_next(dset->directory_iterator);
if (dset->directory_iterator == 0){
/* There are no more clusters */
if(dset->cluster != 0){
icalcluster_free(dset->cluster);
dset->cluster = 0;
}
return ICAL_NO_ERROR;
}
snprintf(path,sizeof(path),"%s/%s", dset->dir,(char*)pvl_data(dset->directory_iterator));
icalcluster_free(dset->cluster);
dset->cluster = icalfileset_produce_icalcluster(path);
return icalerrno;
}
开发者ID:SecareLupus,项目名称:Drood,代码行数:26,代码来源:icaldirset.c
示例15: icalarray_alloc_chunk
static void *
icalarray_alloc_chunk(icalarray *array)
{
void *chunk = malloc(array->element_size * array->increment_size);
if (!chunk)
icalerror_set_errno(ICAL_NEWFAILED_ERROR);
return chunk;
}
开发者ID:Distrotech,项目名称:libical,代码行数:8,代码来源:icalarray.c
示例16: icalerror_set_errno
struct icalcalendar_impl *icalcalendar_new_impl(void)
{
struct icalcalendar_impl *impl;
if ((impl = (struct icalcalendar_impl *)malloc(sizeof(struct icalcalendar_impl))) == 0) {
icalerror_set_errno(ICAL_NEWFAILED_ERROR);
return 0;
}
return impl;
}
开发者ID:BenjamenMeyer,项目名称:libical,代码行数:11,代码来源:icalcalendar.c
示例17: icalmemory_resize_buffer
void* icalmemory_resize_buffer(void* buf, size_t size)
{
void *b = realloc(buf, size);
if( b == 0){
icalerror_set_errno(ICAL_NEWFAILED_ERROR);
return 0;
}
return b;
}
开发者ID:EdgarChen,项目名称:mozilla-cvs-history,代码行数:11,代码来源:icalmemory.c
示例18: icalcomponent_vanew
static icalcomponent *icalmessage_new_reply_base(icalcomponent *c,
const char *user, const char *msg)
{
icalproperty *attendee;
char tmp[45];
icalcomponent *reply =
icalcomponent_vanew(
ICAL_VCALENDAR_COMPONENT, icalproperty_new_method(ICAL_METHOD_REPLY),
icalcomponent_vanew(
ICAL_VEVENT_COMPONENT,
icalproperty_new_dtstamp(icaltime_from_timet_with_zone(time(0), 0, NULL)),
0),
0);
icalcomponent *inner = icalmessage_get_inner(reply);
icalerror_check_arg_rz(c, "c");
icalmessage_copy_properties(reply, c, ICAL_UID_PROPERTY);
icalmessage_copy_properties(reply, c, ICAL_ORGANIZER_PROPERTY);
icalmessage_copy_properties(reply, c, ICAL_RECURRENCEID_PROPERTY);
icalmessage_copy_properties(reply, c, ICAL_SUMMARY_PROPERTY);
icalmessage_copy_properties(reply, c, ICAL_SEQUENCE_PROPERTY);
icalcomponent_set_dtstamp(reply, icaltime_from_timet_with_zone(time(0), 0, NULL));
if (msg != 0) {
icalcomponent_add_property(inner, icalproperty_new_comment(msg));
}
/* Copy this user's attendee property */
attendee = icalmessage_find_attendee(c, user);
if (attendee == 0) {
icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
icalcomponent_free(reply);
return 0;
}
icalcomponent_add_property(inner, icalproperty_new_clone(attendee));
/* Add PRODID and VERSION */
icalcomponent_add_property(reply, icalproperty_new_version("2.0"));
snprintf(tmp, sizeof(tmp), "-//SoftwareStudio//NONSGML %s %s //EN", ICAL_PACKAGE, ICAL_VERSION);
icalcomponent_add_property(reply, icalproperty_new_prodid(tmp));
return reply;
}
开发者ID:cyrusimap,项目名称:libical,代码行数:53,代码来源:icalmessage.c
示例19: icalbdbset_count_components
int icalbdbset_count_components(icalset *set, icalcomponent_kind kind)
{
icalbdbset *bset;
if (set == 0) {
icalerror_set_errno(ICAL_BADARG_ERROR);
return -1;
}
bset = (icalbdbset *) set;
return icalcomponent_count_components(bset->cluster, kind);
}
开发者ID:BenjamenMeyer,项目名称:libical,代码行数:12,代码来源:icalbdbset.c
示例20: icaltriggertype_from_string
struct icaltriggertype icaltriggertype_from_string(const char* str)
{
struct icaltriggertype tr, null_tr;
icalerrorstate es = ICAL_ERROR_DEFAULT;
icalerrorenum e;
tr.time= icaltime_null_time();
tr.duration = icaldurationtype_from_int(0);
null_tr = tr;
/* Suppress errors so a failure in icaltime_from_string() does not cause an abort */
es = icalerror_get_error_state(ICAL_MALFORMEDDATA_ERROR);
if(str == 0) goto error;
icalerror_set_error_state(ICAL_MALFORMEDDATA_ERROR,ICAL_ERROR_NONFATAL);
e = icalerrno;
icalerror_set_errno(ICAL_NO_ERROR);
tr.time = icaltime_from_string(str);
if (icaltime_is_null_time(tr.time)){
tr.duration = icaldurationtype_from_string(str);
if (icaldurationtype_is_bad_duration(tr.duration)) goto error;
}
icalerror_set_error_state(ICAL_MALFORMEDDATA_ERROR,es);
icalerror_set_errno(e);
return tr;
error:
icalerror_set_error_state(ICAL_MALFORMEDDATA_ERROR,es);
icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
return tr;
}
开发者ID:MoonchildProductions,项目名称:FossaMail,代码行数:40,代码来源:icaltypes.c
注:本文中的icalerror_set_errno函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论