libDtSearch: Coverity 86579
[oweals/cde.git] / cde / lib / DtTerm / Term / TermParse.c
index b92418be20a319a4ac5cd52846047d331aa9cd4c..594b3c62a4519c26c84f8c937d8d23d4e895ab2b 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 libraries and programs; if not, write
+ * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
+ * Floor, Boston, MA 02110-1301 USA
+ */
 #ifndef        lint
 #ifdef VERBOSE_REV_INFO
 static char rcs_id[] = "$TOG: TermParse.c /main/3 1999/10/15 12:25:13 mgreess $";
@@ -14,6 +36,8 @@ static char rcs_id[] = "$TOG: TermParse.c /main/3 1999/10/15 12:25:13 mgreess $"
  * (c) Copyright 1996 Hitachi.                                         *
  */
 
+#include <wctype.h>
+
 #include "TermHeader.h"
 #include "TermPrimDebug.h"
 #include "TermPrimP.h"
@@ -28,6 +52,8 @@ static char rcs_id[] = "$TOG: TermParse.c /main/3 1999/10/15 12:25:13 mgreess $"
 #include "TermFunctionKey.h"
 #include "TermParseTableP.h"
 #include "TermBufferP.h"
+#include "TermPrimUtil.h"
+#include "TermPrimParseTable.h"
 
 #if defined (__hpux)
 /*
@@ -35,11 +61,10 @@ static char rcs_id[] = "$TOG: TermParse.c /main/3 1999/10/15 12:25:13 mgreess $"
  */
 #undef MAXINT
 #endif
-#include  <values.h>        
-
-#if defined(USL) || defined(__uxp__)
-#include <ctype.h>
-#include <wctype.h>
+#if defined(CSRG_BASED)
+#define MAXSHORT SHRT_MAX
+#else
+#include  <values.h>
 #endif
 
 /*****************************************************************************/
@@ -248,7 +273,7 @@ _DtTermPModeSet(Widget w)   /*  DECSET CSI?ph */
           /* case 2:  can't return from vt52 mode */
           case 3: /* Column (132) */
                    if ( vtw->vt.c132 )  {  /* xterm allow 132 mode */
-                     (void) _DtTermFuncClearBuffer(w, NULL, fromParser);
+                     (void) _DtTermFuncClearBuffer(w, 0, fromParser);
                      vtw->term.tpd->cursorRow = TOPROW(vtw) ;
                      vtw->term.tpd->cursorColumn = FIRSTCOLUMN(vtw) ;
                      vtw->term.tpd->scrollLockTopRow = TOPROW(vtw);
@@ -336,7 +361,7 @@ _DtTermPModeReset(Widget w)   /* DECRST CSI?pl */
           /* case 2:   ** set vt52 mode */
           case 3: /* Column (80) */
                   if (vtw->vt.c132)  {   /* allow 132 mode */
-                    (void) _DtTermFuncClearBuffer(w, NULL, fromParser);
+                    (void) _DtTermFuncClearBuffer(w, 0, fromParser);
                     vtw->term.tpd->cursorRow = TOPROW(vtw) ;
                     vtw->term.tpd->cursorColumn = FIRSTCOLUMN(vtw) ;
                     vtw->term.tpd->scrollLockTopRow = TOPROW(vtw);
@@ -2171,7 +2196,7 @@ _DtTermParseSunMisc  /*  Misc sun esc seqs  */
        s = XtMalloc(strlen(icon) + strlen(fmt) + 1);
       else 
        s = buf;
-      sprintf(s,fmt);
+      sprintf(s, "%s", fmt);
       sendEscSequence(w,s) ;
       if (s != buf) XtFree(s);
       break ;
@@ -2182,7 +2207,7 @@ _DtTermParseSunMisc  /*  Misc sun esc seqs  */
        s = XtMalloc(strlen(icon) + strlen(fmt) + 1);
       else 
        s = buf;
-      sprintf(s,fmt);
+      sprintf(s, "%s", fmt);
       sendEscSequence(w,s) ;
       if (s != buf) XtFree(s);
       break ;