Back to index

lightning-sunbird  0.9+nobinonly
Defines | Functions
icaltypes.c File Reference
#include "icaltypes.h"
#include "icalerror.h"
#include "icalmemory.h"
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <assert.h>

Go to the source code of this file.

Defines

#define TEMP_MAX   1024

Functions

int icaltriggertype_is_null_trigger (struct icaltriggertype tr)
int icaltriggertype_is_bad_trigger (struct icaltriggertype tr)
struct icaltriggertype icaltriggertype_from_int (const int reltime)
struct icaltriggertype icaltriggertype_from_string (const char *str)
struct icalreqstattype icalreqstattype_from_string (const char *str)
const char * icalreqstattype_as_string (struct icalreqstattype stat)

Define Documentation

#define TEMP_MAX   1024

Definition at line 43 of file icaltypes.c.


Function Documentation

Definition at line 167 of file icaltypes.c.

{
  char *temp;

  temp = (char*)icalmemory_tmp_buffer(TEMP_MAX);

  icalerror_check_arg_rz((stat.code != ICAL_UNKNOWN_STATUS),"Status");
  
  if (stat.desc == 0){
    stat.desc = icalenum_reqstat_desc(stat.code);
  }
  
  if(stat.debug != 0){
    snprintf(temp,TEMP_MAX,"%d.%d;%s;%s", icalenum_reqstat_major(stat.code),
             icalenum_reqstat_minor(stat.code),
             stat.desc, stat.debug);
    
  } else {
    snprintf(temp,TEMP_MAX,"%d.%d;%s", icalenum_reqstat_major(stat.code),
             icalenum_reqstat_minor(stat.code),
             stat.desc);
  }

  return temp;
}

Here is the call graph for this function:

Here is the caller graph for this function:

struct icalreqstattype icalreqstattype_from_string ( const char *  str) [read]

Definition at line 117 of file icaltypes.c.

{
  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;
  
}

Here is the call graph for this function:

Here is the caller graph for this function:

struct icaltriggertype icaltriggertype_from_int ( const int  reltime) [read]

Definition at line 65 of file icaltypes.c.

{
    struct icaltriggertype tr;

    tr.time   = icaltime_null_time();
    tr.duration = icaldurationtype_from_int(reltime);

    return tr;
}

Here is the call graph for this function:

struct icaltriggertype icaltriggertype_from_string ( const char *  str) [read]

Definition at line 75 of file icaltypes.c.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 56 of file icaltypes.c.

{
    if(icaldurationtype_is_bad_duration(tr.duration)){
        return 1;
    }

    return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 46 of file icaltypes.c.

{
    if(icaltime_is_null_time(tr.time) && 
       icaldurationtype_is_null_duration(tr.duration)){
        return 1;
    }

    return 0;
}

Here is the call graph for this function: