[evolution/gnome-3-26] Bug 788675 - [iCalendar import] Leave validation of iCalendar streams to libecal



commit a47b538ca0100684adc661f778e2757498a2c9bf
Author: Tim Ruffing <tim timruffing de>
Date:   Mon Oct 9 19:18:11 2017 +0200

    Bug 788675 - [iCalendar import] Leave validation of iCalendar streams to libecal
    
    This removes a redundant superficial check if the file is a valid
    iCalendar. A better check is already performed in libecal.
    Also, this change simplifies control flow.

 src/calendar/importers/icalendar-importer.c |   10 +++-------
 1 files changed, 3 insertions(+), 7 deletions(-)
---
diff --git a/src/calendar/importers/icalendar-importer.c b/src/calendar/importers/icalendar-importer.c
index f96fade..980c141 100644
--- a/src/calendar/importers/icalendar-importer.c
+++ b/src/calendar/importers/icalendar-importer.c
@@ -546,17 +546,13 @@ ical_supported (EImport *ei,
                return FALSE;
 
        if (g_file_get_contents (filename, &contents, NULL, NULL)) {
-               icalcomponent *icalcomp = NULL;
+               icalcomponent *icalcomp;
 
-               if (g_ascii_strncasecmp (contents, "BEGIN:", 6) == 0)
-                       icalcomp = e_cal_util_parse_ics_string (contents);
+               icalcomp = e_cal_util_parse_ics_string (contents);
                g_free (contents);
 
                if (icalcomp) {
-                       if (is_icalcomp_usable (icalcomp))
-                               ret = TRUE;
-                       else
-                               ret = FALSE;
+                       ret = is_icalcomp_usable (icalcomp);
                        icalcomponent_free (icalcomp);
                }
        }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]