[Xfce4-commits] <orage:master> 4.8.0.4: fixed BUG 7141 orage fails to compile on !linux

Juha Kautto noreply at xfce.org
Thu Jan 20 19:28:01 CET 2011


Updating branch refs/heads/master
         to ec6d06bbc376ec15ff945ec2bc8bf492c53002cc (commit)
       from 8a6c2255335d516bd529f73d2048d01ebd7a2328 (commit)

commit ec6d06bbc376ec15ff945ec2bc8bf492c53002cc
Author: Juha Kautto <juha at xfce.org>
Date:   Thu Jan 20 20:21:57 2011 +0200

    4.8.0.4: fixed BUG 7141 orage fails to compile on !linux
    
    Still issues with non linux systems and timezone data. Fixed iso3166.tab file
    location and checked that it is fine even if it does not exist at all. Also
    made tz array bigger in BSD as we can't drop unneeded files.

 configure.in.in         |    2 +-
 src/tz_zoneinfo_read.c  |   26 +++++++++++++++++---------
 tz_convert/tz_convert.c |    2 +-
 3 files changed, 19 insertions(+), 11 deletions(-)

diff --git a/configure.in.in b/configure.in.in
index 0a61182..9a2e92d 100644
--- a/configure.in.in
+++ b/configure.in.in
@@ -9,7 +9,7 @@ dnl Written for Xfce by Juha Kautto <juha at xfce.org>
 dnl
 
 dnl Version information
-m4_define([orage_version], [4.8.0.3-git])
+m4_define([orage_version], [4.8.0.4-git])
 
 m4_define([gtk_minimum_version], [2.10.0])
 m4_define([xfce_minimum_version], [4.6.0])
diff --git a/src/tz_zoneinfo_read.c b/src/tz_zoneinfo_read.c
index 6999f92..e7ea00f 100644
--- a/src/tz_zoneinfo_read.c
+++ b/src/tz_zoneinfo_read.c
@@ -368,13 +368,13 @@ static void get_country(void)
 
     /********** then search the country **********/
     /* Need to search line, which starts with country code.
-     * Note that it is not enough to search any country coed, but it really
+     * Note that it is not enough to search any country code, but it really
      * needs to be the first two chars in the line */
     cc[0] = '\n';
     cc[1] = tz_array.cc[tz_array.count][0];
     cc[2] = tz_array.cc[tz_array.count][1];
     cc[3] = '\0';
-    if (!(str = strstr(country_buf, cc)))
+    if (!country_buf || !(str = strstr(country_buf, cc)))
         return; /* not found */
     /* country name is after the country code and a single tab */
     str += 4;
@@ -799,21 +799,24 @@ static void read_countries(void)
     struct stat country_file_stat;
 
     /****** country=iso3166.tab file ******/
+    if (country_buf) { /* we have read it already */
+        return;
+    }
+
     tz_dir = malloc(in_file_base_offset + zoneinfo_len + 1); /* '\0' */
     strncpy(tz_dir, in_file, in_file_base_offset);
     tz_dir[in_file_base_offset] = '\0'; 
+#ifdef __OpenBSD__ 
+    strcat(tz_dir, "misc/"); /* this is shorter than "zoneinfo" so it is safe */
+#else
     strcat(tz_dir, "zoneinfo/"); /* now we have the base directory */
+#endif
 
     country_file_name = malloc(strlen(tz_dir) + strlen(COUNTRY_FILE) + 1);
     strcpy(country_file_name, tz_dir);
     strcat(country_file_name, COUNTRY_FILE);
-
     free(tz_dir);
 
-    if (country_buf) {
-        free(country_file_name);
-        return;
-    }
     if (!(country_file = fopen(country_file_name, "r"))) {
         printf("read_countries: iso3166.tab file open failed (%s)\n"
                 , country_file_name);
@@ -879,7 +882,11 @@ static void read_ical_timezones(void)
 
 orage_timezone_array get_orage_timezones(int show_details, int ical)
 {
+#ifdef FTW_ACTIONRETVAL
     int tz_array_size = 1000; /* FIXME: this needs to be counted */
+#else
+    int tz_array_size = 2000; /* BSD can not skip unneeded directories */
+#endif
     /*
      icalarray *tz_array;
      icaltimezone *l_tz;
@@ -924,8 +931,9 @@ orage_timezone_array get_orage_timezones(int show_details, int ical)
             perror("nftw error in file handling");
             exit(EXIT_FAILURE);
         }
-        printf("Orage: Processed %d timezone files from (%s)\n"
-                , file_cnt, in_file);
+        if (debug > 0)
+            printf("Orage: Processed %d timezone files from (%s)\n"
+                    , file_cnt, in_file);
 
         free(in_file);
 
diff --git a/tz_convert/tz_convert.c b/tz_convert/tz_convert.c
index 85c5a92..b93bcdf 100644
--- a/tz_convert/tz_convert.c
+++ b/tz_convert/tz_convert.c
@@ -1473,12 +1473,12 @@ int file_call(const char *file_name, const struct stat *sb, int flags
     else if (flags == FTW_D) { /* this is directory */
         if (debug > 0)
             printf("\tfile_call: processing directory=(%s)\n", file_name);
+#ifdef FTW_ACTIONRETVAL
         if (only_one_level && f->level > 0) {
             if (debug > 0)
                 printf("\t\tfile_call: skipping it, not on top level\n");
             return(FTW_SKIP_SUBTREE);
         }
-#ifdef FTW_ACTIONRETVAL
         /* need to check if we have excluded directory */
         for (i = 0; (i <= excl_dir_cnt) && excl_dir[i]; i++) {
             if (strcmp(excl_dir[i],  file_name+f->base) == 0) {



More information about the Xfce4-commits mailing list