dtmail: resolve 'deference before null check' errors related to if(!NULL) checks...
[oweals/cde.git] / cde / programs / dtmail / dtmailpr / utils.C
index b52606c2651c4d87fd21f1bf52a9290169d1528c..9ce88c081032897249b4070d7ce5da2cb824d5f4 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
+ */
 /* $XConsortium: utils.C /main/4 1996/04/21 19:44:10 drk $ */
 
 /*
@@ -100,7 +122,7 @@ formatHeader (DtMailHeaderLine &info, enum DmxHeaderType htype)
        {
                case MSGLIST:
                        sprintf (fbuf,
-                       "%-18.18s %-16.16s %4ld/%-5s %-.25s",
+                       "%-18.18s %-16.16s %4d/%-5s %-.25s",
                                dispname (header [DMXFROM]),
                                header [DMXDATE],
                                atoi (header [DMXCLENGTH]) / 40,
@@ -168,16 +190,16 @@ dispname(const char *hdr)
 
        if (hdr == 0)
                return 0;
-       if (((cp = strchr(hdr, '<')) != 0) && (cp > hdr)) {
+       if (((cp = const_cast <char *> (strchr(hdr, '<'))) != 0) && (cp > hdr)) {
                *cp = 0;
-               if ((*hdr == '"') && ((cp = strrchr(++hdr, '"')) != 0))
+               if ((*hdr == '"') && ((cp = const_cast <char *> (strrchr(++hdr, '"'))) != 0))
                        *cp = 0;
                return (char *)hdr;
-       } else if ((cp = strchr(hdr, '(')) != 0) {
+       } else if ((cp = const_cast <char *> (strchr(hdr, '('))) != 0) {
                hdr = ++cp;
-               if ((cp = strchr(hdr, '+')) != 0)
+               if ((cp = const_cast <char *> (strchr(hdr, '+'))) != 0)
                        *cp = 0;
-               if ((cp = strrchr(hdr, ')')) != 0)
+               if ((cp = const_cast <char *> (strrchr(hdr, ')'))) != 0)
                        *cp = 0;
                return (char *)hdr;
        }