[Jppy-commit] [SCM] jppy - Python bindings and API for jpilot databases and a GTK2 GUI branch, devel-merge-calendar-and-plugin, updated. releases/0.0.48-169-g58676b3
Jon Schewe
jpschewe@mtu.net
Sun Dec 14 16:56:12 GMT 2008
The following commit has been merged in the devel-merge-calendar-and-plugin branch:
commit 26c529d5245c225cda26ebdaf68cc270c8c022a1
Author: Jon Schewe <jpschewe@mtu.net>
Date: Sun Dec 14 10:39:54 2008 -0600
Fixed segfault caused by the datebook create method calling the event wrap method.
diff --git a/pilot-link_src/blob.c b/pilot-link_src/blob.c
index 2cc9acb..a7e7ea6 100644
--- a/pilot-link_src/blob.c
+++ b/pilot-link_src/blob.c
@@ -73,12 +73,16 @@ free_Blob(Blob_t *blob)
Blob_t*
dup_Blob(const Blob_t *blob)
{
+ if(NULL == blob) {
+ return NULL;
+ }
+
Blob_t *retval = (Blob_t*)malloc(sizeof(Blob_t));
if(NULL == retval) {
errno = ENOMEM;
return NULL;
}
- strncpy(retval->type, blob->type, 4);
+ memcpy(retval->type, blob->type, 4);
retval->length = blob->length;
if(blob->length > 0) {
retval->data = (uint8_t *)malloc(blob->length);
@@ -110,7 +114,7 @@ int
unpack_Blob_p(Blob_t *blob, const unsigned char *data, const size_t position) {
size_t localPosition = position;
- strncpy(blob->type, (char *)data+localPosition, 4);
+ memcpy(blob->type, (char *)data+localPosition, 4);
localPosition += 4;
//printf("blob->type = %c %c %c %c\n", blob->type[0], blob->type[1], blob->type[2], blob->type[3]);
blob->length = get_short(data+localPosition);
diff --git a/pilot-link_src/calendar.c b/pilot-link_src/calendar.c
index 8c9899d..61a9a86 100644
--- a/pilot-link_src/calendar.c
+++ b/pilot-link_src/calendar.c
@@ -170,7 +170,7 @@ copy_CalendarEvent(const CalendarEvent_t *source, CalendarEvent_t *dest)
dest->location = NULL;
}
- /* initialize the blobs to NULL */
+ /* copy the blobs */
for (i=0; i<MAX_BLOBS; i++) {
if(source->blob[i] != NULL) {
dest->blob[i] = dup_Blob(source->blob[i]);
@@ -440,9 +440,10 @@ unpack_CalendarEvent(CalendarEvent_t *a, const pi_buffer_t *buf, calendarType ty
} else {
p2 += result;
}
+ //printf("DEBUG: record %s read in blob[%d] of size %d\n", a->description, blob_count, a->blob[blob_count]->length);
/* if it's a timezone blob store it */
- if (0 == strncmp(a->blob[blob_count]->type, BLOB_TYPE_CALENDAR_TIMEZONE_ID, 4)) {
+ if (0 == memcmp(a->blob[blob_count]->type, BLOB_TYPE_CALENDAR_TIMEZONE_ID, 4)) {
int result;
if(NULL != a->tz) {
printf("Warning: Found more than one timezone blob! Freeing the previous one and starting again\n");
diff --git a/python_module_src/jpilot.i b/python_module_src/jpilot.i
index 058c077..fa1ce47 100644
--- a/python_module_src/jpilot.i
+++ b/python_module_src/jpilot.i
@@ -687,7 +687,7 @@ int jp_pc_write(char *DB_name, buf_rec *br);
Appointment_t a;
return w_jp_read_DB((unpackerFunction *)unpack_Appointment,
- (wrapFunction *)PyPiEvent_Wrap,
+ (wrapFunction *)PyPiAppointment_Wrap,
&a,
recordtype,
BuildPyStringFromAppointment,
--
jppy - Python bindings and API for jpilot databases and a GTK2 GUI
More information about the Jppy-commit
mailing list