dtcm: Resolve CID 87408
[oweals/cde.git] / cde / programs / dtcm / dtcm / monthglance.c
index fd7b011e7da97d87f675e78fb525710c10f1c910..906c41d779a8474e922b850dc85f8938fa9f992e 100644 (file)
@@ -1,3 +1,25 @@
+/*
+ * CDE - Common Desktop Environment
+ *
+ * Copyright (c) 1993-2012, The Open Group. All rights reserved.
+ *
+ * These libraries and programs are free software; you can
+ * redistribute them and/or modify them under the terms of the GNU
+ * Lesser General Public License as published by the Free Software
+ * Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ * These libraries and programs are distributed in the hope that
+ * they will be useful, but WITHOUT ANY WARRANTY; without even the
+ * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU Lesser General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with these librararies and programs; if not, write
+ * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
+ * Floor, Boston, MA 02110-1301 USA
+ */
 /*******************************************************************************
 **
 **  monthglance.c
@@ -79,6 +101,9 @@ static  char sccsid[] = "@(#)monthglance.c 1.82 95/07/27 Copyr 1994 Sun Microsys
 
 #define XOS_USE_XT_LOCKING
 #define X_INCLUDE_TIME_H
+#if defined(linux)
+#undef SVR4
+#endif
 #include <X11/Xos_r.h>
 
 static void    paint_day_entries(Tick, int, int, int, int,
@@ -184,14 +209,14 @@ paint_day_entries(
                                                                w - pad_width, 
                                                                buf, pf);
                                                if (cm_strlen(buf) > maxchars)
-                                                       buf[maxchars] = NULL;
+                                                       buf[maxchars] = '\0';
                                                (void)gr_text(xc, x + pad_width,
                                                              y, pf, buf, rect);
                                        } else {
                                                maxchars = gr_nchars(w, buf, 
                                                                     pf);
                                                if (cm_strlen(buf) > maxchars)
-                                                       buf[maxchars] = NULL;
+                                                       buf[maxchars] = '\0';
                                                (void)gr_text(xc, x, y, pf, 
                                                              buf, rect);
                                        }
@@ -281,7 +306,7 @@ paint_month(Calendar *c, Tick key, XRectangle *rect)
                start = (time_t) lowerbound(day);
                stop = (time_t) last_dom(day);
                setup_range(&range_attrs, &ops, &j, start, stop, CSA_TYPE_EVENT,
-                       NULL, B_FALSE, c->general->version);
+                       0, B_FALSE, c->general->version);
                csa_list_entries(c->cal_handle, j, range_attrs, ops, &a_total, &list, NULL);
        
                free_range(&range_attrs, &ops, j);
@@ -546,7 +571,7 @@ get_time_str (Dtcm_appointment *appt, char *buf)
        _Xltimeparams   localtime_buf;
 
        _csa_iso8601_to_tick(appt->time->value->item.date_time_value, &start_tick);
-       buf[0] = NULL;
+       buf[0] = '\0';
 
         if (appt==NULL || !showtime_set(appt) || magic_time(start_tick))
                 return;
@@ -699,7 +724,7 @@ count_month_pages(Calendar *c, Tick start_date, int lines_per_box)
                 start = (time_t) lowerbound (day);
                 stop = (time_t) next_ndays(day, 1) - 1;
                setup_range(&range_attrs, &ops, &j, start, stop,
-                           CSA_TYPE_EVENT, NULL, B_FALSE,
+                           CSA_TYPE_EVENT, 0, B_FALSE,
                            c->general->version);
                csa_list_entries(c->cal_handle, j, range_attrs, ops,
                                 &a_total, &list, NULL);
@@ -779,7 +804,7 @@ print_month ( Calendar *c,
          lo_hour = (time_t)lowerbound (day);
          hi_hour = (time_t) next_ndays(day, 1) - 1;
          setup_range(&range_attrs, &ops, &j, lo_hour, hi_hour,
-                     CSA_TYPE_EVENT, NULL, B_FALSE, c->general->version);
+                     CSA_TYPE_EVENT, 0, B_FALSE, c->general->version);
          csa_list_entries(c->cal_handle, j, range_attrs,
                           ops, &a_total, &list, NULL);
          free_range(&range_attrs, &ops, j);
@@ -899,7 +924,7 @@ static void
 quick_button_cb(Widget widget, XtPointer client, XtPointer call)
 {
         Calendar *c = calendar;
-       int      dom = (int) client;
+       int      dom = (int) (intptr_t) client;
 
        c->view->olddate = c->view->date;
        c->view->date = next_ndays(first_dom(c->view->date), dom);
@@ -1034,7 +1059,7 @@ allocator(Calendar *c)
                        XmCreatePushButton(c->canvas, buf, NULL, 0);
                XtVaSetValues(m->hot_button[n], XmNlabelString, str, NULL);
                XtAddCallback(m->hot_button[n],XmNactivateCallback, 
-                       quick_button_cb, (XtPointer)n);
+                       quick_button_cb, (XtPointer) (intptr_t) n);
                XmStringFree(str);
        }
 }