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 SaveVCard(
const char *FileName, GSM_Backup *backup)
30 file = fopen(FileName,
"wb");
34 while (backup->PhonePhonebook[i]!=NULL) {
42 sprintf(Buffer,
"%c%c",13,10);
48 while (backup->SIMPhonebook[i]!=NULL) {
56 sprintf(Buffer,
"%c%c",13,10);
68 GSM_Error LoadVCard(
const char *FileName, GSM_Backup *backup)
73 int numPbk = 0, numSIM = 0;
88 if (numSIM < GSM_BACKUP_MAX_SIMPHONEBOOK) {
90 if (backup->SIMPhonebook[numSIM] == NULL) {
94 backup->SIMPhonebook[numSIM + 1] = NULL;
96 dbgprintf(NULL,
"Increase GSM_BACKUP_MAX_SIMPHONEBOOK\n");
101 if (backup->SIMPhonebook[numSIM]->Location == 0) {
102 backup->SIMPhonebook[numSIM]->Location = numSIM + 1;
106 if (numPbk < GSM_BACKUP_MAX_PHONEPHONEBOOK) {
108 if (backup->PhonePhonebook[numPbk] == NULL) {
112 backup->PhonePhonebook[numPbk + 1] = NULL;
114 dbgprintf(NULL,
"Increase GSM_BACKUP_MAX_PHONEPHONEBOOK\n");
119 if (backup->PhonePhonebook[numPbk]->Location == 0) {
120 backup->PhonePhonebook[numPbk]->Location = numPbk + 1;
122 backup->PhonePhonebook[numPbk]->MemoryType =
MEM_ME;
GSM_Error GSM_EncodeVCARD(GSM_Debug_Info *di, char *Buffer, const size_t buff_len, size_t *Length, GSM_MemoryEntry *pbk, const gboolean header, const GSM_VCardVersion Version)
GSM_MemoryType MemoryType
#define chk_fwrite(data, size, count, file)
GSM_Error GSM_DecodeVCARD(GSM_Debug_Info *di, char *Buffer, size_t *Pos, GSM_MemoryEntry *Pbk, GSM_VCardVersion Version)
GSM_Error GSM_ReadFile(const char *FileName, GSM_File *File)