8 #include "../../misc/coding/coding.h" 9 #include "../../debug.h" 10 #include "../gsmlogo.h" 11 #include "../gsmmisc.h" 14 #ifdef GSM_ENABLE_BACKUP 19 #define chk_fwrite(data, size, count, file) \ 20 if (fwrite(data, size, count, file) != count) goto fail; 22 GSM_Error SaveVCalendar(
const char *FileName, GSM_Backup *backup)
26 unsigned char Buffer[1000];
30 file = fopen(FileName,
"wb");
33 Length=sprintf(Buffer,
"BEGIN:VCALENDAR%c%c",13,10);
34 Length+=sprintf(Buffer+Length,
"VERSION:1.0%c%c",13,10);
38 while (backup->Calendar[i]!=NULL) {
39 sprintf(Buffer,
"%c%c",13,10);
51 while (backup->ToDo[i]!=NULL) {
52 sprintf(Buffer,
"%c%c",13,10);
64 Length=sprintf(Buffer,
"%c%cEND:VCALENDAR%c%c",13,10,13,10);
80 int numCal = 0, numToDo = 0;
97 if (backup->Calendar[numCal] == NULL) {
101 backup->Calendar[numCal + 1] = NULL;
103 dbgprintf(NULL,
"Increase GSM_MAXCALENDARTODONOTES\n");
108 backup->Calendar[numCal]->Location = numCal + 1;
114 if (backup->ToDo[numToDo] == NULL) {
118 backup->ToDo[numToDo + 1] = NULL;
120 dbgprintf(NULL,
"Increase GSM_MAXCALENDARTODONOTES\n");
125 backup->ToDo[numToDo]->Location = numToDo + 1;
135 GSM_Error LoadVCalendar(
const char *FileName, GSM_Backup *backup)
GSM_Error GSM_EncodeVCALENDAR(char *Buffer, const size_t buff_len, size_t *Length, GSM_CalendarEntry *note, const gboolean header, const GSM_VCalendarVersion Version)
#define chk_fwrite(data, size, count, file)
GSM_Error GSM_EncodeVTODO(char *Buffer, const size_t buff_len, size_t *Length, const GSM_ToDoEntry *note, const gboolean header, const GSM_VToDoVersion Version)
#define GSM_MAXCALENDARTODONOTES
GSM_Error GSM_DecodeVCALENDAR_VTODO(GSM_Debug_Info *di, char *Buffer, size_t *Pos, GSM_CalendarEntry *Calendar, GSM_ToDoEntry *ToDo, GSM_VCalendarVersion CalVer, GSM_VToDoVersion ToDoVer)
GSM_Error GSM_ReadFile(const char *FileName, GSM_File *File)