From 6e69c396983498a6ff78a33928ad5fec98c8513f Mon Sep 17 00:00:00 2001 From: Eskil Heyn Olsen Date: Tue, 30 Nov 1999 00:26:02 +0000 Subject: Fixed compare bug. Also neated up some of the if's in set_status. * calendar-conduit.c (compare): Fixed compare bug. Also neated up some of the if's in set_status. svn path=/trunk/; revision=1444 --- calendar/ChangeLog | 5 +++++ calendar/calendar-conduit.c | 24 +++++++++++++----------- calendar/conduits/calendar/calendar-conduit.c | 24 +++++++++++++----------- calendar/gui/calendar-conduit.c | 24 +++++++++++++----------- 4 files changed, 44 insertions(+), 33 deletions(-) diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 1ef22b9ebb..8b4bc937ab 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,8 @@ +1999-11-30 Eskil Heyn Olsen + + * calendar-conduit.c (compare): Fixed compare bug. Also neated up + some of the if's in set_status. + 1999-11-22 Russell Steinthal * Merged todo list coloring patch from stable diff --git a/calendar/calendar-conduit.c b/calendar/calendar-conduit.c index e8157e7826..5b8aaee40f 100644 --- a/calendar/calendar-conduit.c +++ b/calendar/calendar-conduit.c @@ -43,13 +43,14 @@ GnomePilotConduit * conduit_get_gpilot_conduit (guint32); void conduit_destroy_gpilot_conduit (GnomePilotConduit*); void local_record_from_icalobject(GCalLocalRecord *local,iCalObject *obj); -#define CONDUIT_VERSION "0.8.5" +#define CONDUIT_VERSION "0.8.6" #ifdef G_LOG_DOMAIN #undef G_LOG_DOMAIN #endif #define G_LOG_DOMAIN "gcalconduit" #define DEBUG_CALCONDUIT +/* #undef DEBUG_CALCONDUIT */ #ifdef DEBUG_CALCONDUIT #define show_exception(e) g_warning ("Exception: %s\n", CORBA_exception_id (e)) @@ -819,7 +820,7 @@ set_status (GnomePilotConduitStandardAbs *conduit, gint status, GCalConduitContext *ctxt) { - LOG ("entering set_status"); + LOG ("entering set_status(status=%d)",status); g_return_val_if_fail(local!=NULL,-1); @@ -839,14 +840,15 @@ set_status (GnomePilotConduitStandardAbs *conduit, break; } - if ( status != GnomePilotRecordDeleted) + if ( status == GnomePilotRecordDeleted) { + GNOME_Calendar_Repository_delete_object(ctxt->calendar,local->ical->uid,&(ctxt->ev)); + } else { GNOME_Calendar_Repository_update_pilot_id(ctxt->calendar, local->ical->uid, local->local.ID, local->ical->pilot_status, &(ctxt->ev)); - else - GNOME_Calendar_Repository_delete_object(ctxt->calendar,local->ical->uid,&(ctxt->ev)); + } if (ctxt->ev._major == CORBA_USER_EXCEPTION){ LOG ("Object did not exist"); @@ -1079,6 +1081,7 @@ compare (GnomePilotConduitStandardAbs *conduit, /* used by the quick compare */ PilotRecord *remoteOfLocal; int err; + int retval; /* used by the tedious compare */ struct Appointment a; @@ -1092,20 +1095,19 @@ compare (GnomePilotConduitStandardAbs *conduit, err = transmit(conduit,local,&remoteOfLocal,ctxt); if (err != 0) return err; + retval = 0; if (remote->length == remoteOfLocal->length) { - if (memcmp(remoteOfLocal,remote,remote->length)!=0) { + if (memcmp(remoteOfLocal->record,remote->record,remote->length)!=0) { g_message("compare failed on contents"); - free_transmit(conduit,local,&remoteOfLocal,ctxt); - return 1; + retval = 1; } } else { g_message("compare failed on length"); - free_transmit(conduit,local,&remoteOfLocal,ctxt); - return 1; + retval = 1; } free_transmit(conduit,local,&remoteOfLocal,ctxt); - return 0; + return retval; #else /** FIXME: All the { LOG("yadayada"); return 1; } bloat is for debug purposes. diff --git a/calendar/conduits/calendar/calendar-conduit.c b/calendar/conduits/calendar/calendar-conduit.c index e8157e7826..5b8aaee40f 100644 --- a/calendar/conduits/calendar/calendar-conduit.c +++ b/calendar/conduits/calendar/calendar-conduit.c @@ -43,13 +43,14 @@ GnomePilotConduit * conduit_get_gpilot_conduit (guint32); void conduit_destroy_gpilot_conduit (GnomePilotConduit*); void local_record_from_icalobject(GCalLocalRecord *local,iCalObject *obj); -#define CONDUIT_VERSION "0.8.5" +#define CONDUIT_VERSION "0.8.6" #ifdef G_LOG_DOMAIN #undef G_LOG_DOMAIN #endif #define G_LOG_DOMAIN "gcalconduit" #define DEBUG_CALCONDUIT +/* #undef DEBUG_CALCONDUIT */ #ifdef DEBUG_CALCONDUIT #define show_exception(e) g_warning ("Exception: %s\n", CORBA_exception_id (e)) @@ -819,7 +820,7 @@ set_status (GnomePilotConduitStandardAbs *conduit, gint status, GCalConduitContext *ctxt) { - LOG ("entering set_status"); + LOG ("entering set_status(status=%d)",status); g_return_val_if_fail(local!=NULL,-1); @@ -839,14 +840,15 @@ set_status (GnomePilotConduitStandardAbs *conduit, break; } - if ( status != GnomePilotRecordDeleted) + if ( status == GnomePilotRecordDeleted) { + GNOME_Calendar_Repository_delete_object(ctxt->calendar,local->ical->uid,&(ctxt->ev)); + } else { GNOME_Calendar_Repository_update_pilot_id(ctxt->calendar, local->ical->uid, local->local.ID, local->ical->pilot_status, &(ctxt->ev)); - else - GNOME_Calendar_Repository_delete_object(ctxt->calendar,local->ical->uid,&(ctxt->ev)); + } if (ctxt->ev._major == CORBA_USER_EXCEPTION){ LOG ("Object did not exist"); @@ -1079,6 +1081,7 @@ compare (GnomePilotConduitStandardAbs *conduit, /* used by the quick compare */ PilotRecord *remoteOfLocal; int err; + int retval; /* used by the tedious compare */ struct Appointment a; @@ -1092,20 +1095,19 @@ compare (GnomePilotConduitStandardAbs *conduit, err = transmit(conduit,local,&remoteOfLocal,ctxt); if (err != 0) return err; + retval = 0; if (remote->length == remoteOfLocal->length) { - if (memcmp(remoteOfLocal,remote,remote->length)!=0) { + if (memcmp(remoteOfLocal->record,remote->record,remote->length)!=0) { g_message("compare failed on contents"); - free_transmit(conduit,local,&remoteOfLocal,ctxt); - return 1; + retval = 1; } } else { g_message("compare failed on length"); - free_transmit(conduit,local,&remoteOfLocal,ctxt); - return 1; + retval = 1; } free_transmit(conduit,local,&remoteOfLocal,ctxt); - return 0; + return retval; #else /** FIXME: All the { LOG("yadayada"); return 1; } bloat is for debug purposes. diff --git a/calendar/gui/calendar-conduit.c b/calendar/gui/calendar-conduit.c index e8157e7826..5b8aaee40f 100644 --- a/calendar/gui/calendar-conduit.c +++ b/calendar/gui/calendar-conduit.c @@ -43,13 +43,14 @@ GnomePilotConduit * conduit_get_gpilot_conduit (guint32); void conduit_destroy_gpilot_conduit (GnomePilotConduit*); void local_record_from_icalobject(GCalLocalRecord *local,iCalObject *obj); -#define CONDUIT_VERSION "0.8.5" +#define CONDUIT_VERSION "0.8.6" #ifdef G_LOG_DOMAIN #undef G_LOG_DOMAIN #endif #define G_LOG_DOMAIN "gcalconduit" #define DEBUG_CALCONDUIT +/* #undef DEBUG_CALCONDUIT */ #ifdef DEBUG_CALCONDUIT #define show_exception(e) g_warning ("Exception: %s\n", CORBA_exception_id (e)) @@ -819,7 +820,7 @@ set_status (GnomePilotConduitStandardAbs *conduit, gint status, GCalConduitContext *ctxt) { - LOG ("entering set_status"); + LOG ("entering set_status(status=%d)",status); g_return_val_if_fail(local!=NULL,-1); @@ -839,14 +840,15 @@ set_status (GnomePilotConduitStandardAbs *conduit, break; } - if ( status != GnomePilotRecordDeleted) + if ( status == GnomePilotRecordDeleted) { + GNOME_Calendar_Repository_delete_object(ctxt->calendar,local->ical->uid,&(ctxt->ev)); + } else { GNOME_Calendar_Repository_update_pilot_id(ctxt->calendar, local->ical->uid, local->local.ID, local->ical->pilot_status, &(ctxt->ev)); - else - GNOME_Calendar_Repository_delete_object(ctxt->calendar,local->ical->uid,&(ctxt->ev)); + } if (ctxt->ev._major == CORBA_USER_EXCEPTION){ LOG ("Object did not exist"); @@ -1079,6 +1081,7 @@ compare (GnomePilotConduitStandardAbs *conduit, /* used by the quick compare */ PilotRecord *remoteOfLocal; int err; + int retval; /* used by the tedious compare */ struct Appointment a; @@ -1092,20 +1095,19 @@ compare (GnomePilotConduitStandardAbs *conduit, err = transmit(conduit,local,&remoteOfLocal,ctxt); if (err != 0) return err; + retval = 0; if (remote->length == remoteOfLocal->length) { - if (memcmp(remoteOfLocal,remote,remote->length)!=0) { + if (memcmp(remoteOfLocal->record,remote->record,remote->length)!=0) { g_message("compare failed on contents"); - free_transmit(conduit,local,&remoteOfLocal,ctxt); - return 1; + retval = 1; } } else { g_message("compare failed on length"); - free_transmit(conduit,local,&remoteOfLocal,ctxt); - return 1; + retval = 1; } free_transmit(conduit,local,&remoteOfLocal,ctxt); - return 0; + return retval; #else /** FIXME: All the { LOG("yadayada"); return 1; } bloat is for debug purposes. -- cgit v1.2.3