[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] vcard export fix (resent)
From: |
Florian Lohoff |
Subject: |
[PATCH] vcard export fix (resent) |
Date: |
Tue, 29 Apr 2003 11:43:11 +0200 |
User-agent: |
Mutt/1.3.28i |
Hi,
in gnokii 5.0rc4 is still the bug that writing vcard dumps an
uninitialized buffer into the output file:
common/vcard.c
[...]
37 API int gn_phonebook2vcard(FILE * f, gn_phonebook_entry *entry, char
*addon)
38 {
39 char buf2[1024];
40 int i;
41
42 fprintf(f, "BEGIN:VCARD\n");
43 fprintf(f, "VERSION:3.0\n");
44 fprintf(f, "FN:%s\n", entry->name);
45 fprintf(f, "TEL;VOICE:%s\n", entry->number);
46
47 fprintf(f, "X_GSM_STORE_AT:%s\n", buf2);
^^^^^^^^^^^
48 fprintf(f, "X_GSM_CALLERGROUP:%d\n", entry->caller_group);
49 fprintf(f, "%s", addon);
My fix has been this even removing some duplicate output of X_GSM_STORE_AT ....
Index: gnokii/gnokii.c
===================================================================
RCS file: /cvsroot/gnokii/gnokii/gnokii/gnokii.c,v
retrieving revision 1.343
diff -u -r1.343 gnokii.c
--- gnokii/gnokii.c 6 Mar 2003 21:58:00 -0000 1.343
+++ gnokii/gnokii.c 22 Apr 2003 15:39:59 -0000
@@ -3003,9 +3003,9 @@
if (entry.memory_type == GN_MT_MC ||
entry.memory_type == GN_MT_DC || entry.memory_type == GN_MT_RC)
fprintf(stdout, "%02u.%02u.%04u
%02u:%02u:%02u\n", entry.date.day, entry.date.month, entry.date.year,
entry.date.hour, entry.date.minute, entry.date.second);
} else if (vcard) {
- char buf[10240];
- sprintf(buf, "X_GSM_STORE_AT:%s%d\n",
memory_type_string, entry.location);
- gn_phonebook2vcard(stdout, &entry, buf);
+ char location[32];
+ sprintf(location, "%s%d", memory_type_string,
entry.location);
+ gn_phonebook2vcard(stdout, &entry, location);
} else {
fprintf(stdout, _("%d. Name: %s\nNumber:
%s\nGroup id: %d\n"), entry.location, entry.name, entry.number,
entry.caller_group);
for (i = 0; i < entry.subentries_count; i++) {
Index: xgnokii/xgnokii_contacts.c
===================================================================
RCS file: /cvsroot/gnokii/gnokii/xgnokii/xgnokii_contacts.c,v
retrieving revision 1.50
diff -u -r1.50 xgnokii_contacts.c
--- xgnokii/xgnokii_contacts.c 26 Feb 2003 00:15:53 -0000 1.50
+++ xgnokii/xgnokii_contacts.c 22 Apr 2003 15:40:00 -0000
@@ -2610,7 +2610,7 @@
static void ExportVCARD(FILE * f)
{
- gchar buf2[1024];
+ gchar location[32];
register gint i;
PhonebookEntry *pbEntry;
@@ -2621,14 +2621,11 @@
continue;
if (pbEntry->entry.memory_type == GN_MT_ME)
- sprintf(buf2, "X_GSM_STORE_AT:ME%d\n", i + 1);
+ sprintf(location, "ME%d", i + 1);
else
- sprintf(buf2, "X_GSM_STORE_AT:SM%d\n", i -
memoryStatus.MaxME + 1);
+ sprintf(location, "SM%d", i - memoryStatus.MaxME + 1);
- fprintf(f, "X_GSM_STORE_AT:%s\n", buf2);
- fprintf(f, "X_GSM_CALLERGROUP:%d\n",
pbEntry->entry.caller_group);
-
- gn_phonebook2vcard(f, &pbEntry->entry, buf2);
+ gn_phonebook2vcard(f, &pbEntry->entry, location);
}
fclose(f);
Index: common/vcard.c
===================================================================
RCS file: /cvsroot/gnokii/gnokii/common/vcard.c,v
retrieving revision 1.7
diff -u -r1.7 vcard.c
--- common/vcard.c 6 Mar 2003 21:23:59 -0000 1.7
+++ common/vcard.c 22 Apr 2003 15:40:00 -0000
@@ -34,19 +34,16 @@
#include "compat.h"
#include "gnokii.h"
-API int gn_phonebook2vcard(FILE * f, gn_phonebook_entry *entry, char *addon)
+API int gn_phonebook2vcard(FILE * f, gn_phonebook_entry *entry, char *location)
{
- char buf2[1024];
int i;
fprintf(f, "BEGIN:VCARD\n");
fprintf(f, "VERSION:3.0\n");
fprintf(f, "FN:%s\n", entry->name);
fprintf(f, "TEL;VOICE:%s\n", entry->number);
-
- fprintf(f, "X_GSM_STORE_AT:%s\n", buf2);
+ fprintf(f, "X_GSM_STORE_AT:%s\n", location);
fprintf(f, "X_GSM_CALLERGROUP:%d\n", entry->caller_group);
- fprintf(f, "%s", addon);
/* Add ext. pbk info if required */
for (i = 0; i < entry->subentries_count; i++) {
Flo
--
Florian Lohoff address@hidden +49-5201-669912
Heisenberg may have been here.
pgp1uD_IfIHyc.pgp
Description: PGP signature
- [PATCH] vcard export fix (resent),
Florian Lohoff <=