stdcxx-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From se...@apache.org
Subject svn commit: r290007 - in /incubator/stdcxx/trunk/tests/src: opt_diags.cpp opt_diags.h
Date Sun, 18 Sep 2005 23:23:21 GMT
Author: sebor
Date: Sun Sep 18 16:23:17 2005
New Revision: 290007

URL: http://svn.apache.org/viewcvs?rev=290007&view=rev
Log:
2005-09-18  Martin Sebor  <sebor@roguewave.com>

	* opt_diags.h: Set the svn keywords Id property.
	Increased the size of the buffer for escape sequences.
	* opt_diags.cpp: Set the svn keywords Id property.
	Initialized previously uninitialized data members.
	(_rw_setopt_diags): Checked for negative (unused) indices and avoided
	using them to dereference array elements.


Modified:
    incubator/stdcxx/trunk/tests/src/opt_diags.cpp   (contents, props changed)
    incubator/stdcxx/trunk/tests/src/opt_diags.h   (contents, props changed)

Modified: incubator/stdcxx/trunk/tests/src/opt_diags.cpp
URL: http://svn.apache.org/viewcvs/incubator/stdcxx/trunk/tests/src/opt_diags.cpp?rev=290007&r1=290006&r2=290007&view=diff
==============================================================================
--- incubator/stdcxx/trunk/tests/src/opt_diags.cpp (original)
+++ incubator/stdcxx/trunk/tests/src/opt_diags.cpp Sun Sep 18 16:23:17 2005
@@ -6,28 +6,16 @@
  *
  ************************************************************************
  *
- * Copyright (c) 1994-2005 Quovadx, Inc. All Rights Reserved.
- * 
- * This computer software  is owned by Quovadx, Inc.  and is protected by
- * U.S.  copyright laws  and other  laws and  by  international treaties.
- * This computer  software is furnished  by Quovadx, Inc., pursuant  to a
- * written license  agreement and may  be used, copied,  transmitted, and
- * stored only in accordance with the terms of such license agreement and
- * with  the inclusion  of  the above  copyright  notice.  This  computer
- * software or any other copies  thereof may not be provided or otherwise
- * made available to any other person.
- * 
- * 
- * U.S. Government Restricted Rights.
- * 
- * This computer software: (a) was developed at private expense and is in
- * all respects the proprietary information of Quovadx, Inc.; (b) was not
- * developed with  government funds;  (c) is a  trade secret  of Quovadx,
- * Inc. for all purposes of the  Freedom of Information Act; and (d) is a
- * commercial item  and thus, pursuant  to Section 12.212 of  the Federal
- * Acquisition  Regulations (FAR) and  DFAR Supplement  Section 227.7202,
- * Government's use,  duplication or disclosure of  the computer software
- * is subject to the restrictions set forth by Quovadx, Inc.
+ * Copyright (c) 1994-2005 Quovadx,  Inc., acting through its  Rogue Wave
+ * Software division. Licensed under the Apache License, Version 2.0 (the
+ * "License");  you may  not use this file except  in compliance with the
+ * License.    You    may   obtain   a   copy   of    the   License    at
+ * http://www.apache.org/licenses/LICENSE-2.0.    Unless   required    by
+ * applicable law  or agreed to  in writing,  software  distributed under
+ * the License is distributed on an "AS IS" BASIS,  WITHOUT WARRANTIES OR
+ * CONDITIONS OF  ANY KIND, either  express or implied.  See  the License
+ * for the specific language governing permissions  and limitations under
+ * the License.
  *
  **************************************************************************/
 
@@ -132,26 +120,28 @@
 
 static const esc_text_t
 _rw_vt100_colors[] = {
-    { FG_BLK, "black" },
-    { FG_RED, "red" },
-    { FG_GRN, "green" },
-    { FG_YLW, "yellow" },
-    { FG_BLU, "blue" },
-    { FG_MAG, "magenta" },
-    { FG_CYN, "cyan" },
-    { FG_WHT, "white" } 
+    // prefix suffix   code       description
+    { FG_BLK, ESC_END, "black",   "" },
+    { FG_RED, ESC_END, "red",     "" },
+    { FG_GRN, ESC_END, "green",   "" },
+    { FG_YLW, ESC_END, "yellow",  "" },
+    { FG_BLU, ESC_END, "blue",    "" },
+    { FG_MAG, ESC_END, "magenta", "" },
+    { FG_CYN, ESC_END, "cyan",    "" },
+    { FG_WHT, ESC_END, "white",   "" } 
 };
 
 
 static const esc_text_t
 _rw_vt100_attribs[] = {
-    { AT_OFF, "off" },
-    { AT_BLD, "bold" },
-    { AT_DIM, "dim" },
-    { AT_UND, "underscore" },
-    { AT_BLI, "blink" },
-    { AT_RVS, "reverse" },
-    { AT_HID, "hidden" }
+    // prefix suffix   code          description
+    { AT_OFF, ESC_END, "off",        "" },
+    { AT_BLD, ESC_END, "bold",       "" },
+    { AT_DIM, ESC_END, "dim",        "" },
+    { AT_UND, ESC_END, "underscore", "" },
+    { AT_BLI, ESC_END, "blink",      "" },
+    { AT_RVS, ESC_END, "reverse",    "" },
+    { AT_HID, ESC_END, "hidden",     "" }
 };
 
 
@@ -194,7 +184,7 @@
             "\nThe syntax of <arg> is as follows:\n"
             "<arg>        ::= <color-list>\n"
             "<color-list> ::= <color-txt> [ ,<color-list> ]\n"
-            "<color-text> ::= <sev>:[<color>][:[<color>][:[<attr>][:[<text>]]]]"
+            "<color-txt>  ::= <sev>:[<color>][:[<color>][:[<attr>][:[<text>]]]]"
             "\n<sev>        ::= 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9\n"
             "<color>      ::=   black | red | green | yellow\n"
             "                 | blue | magenta | cyan | white\n"
@@ -253,7 +243,7 @@
         else {
             // digit expected
             fprintf (stderr, "%s:%d: digit expected at position %d: %s\n",
-                 __FILE__, __LINE__, int (parg - argv [0]), argv [0]);
+                     __FILE__, __LINE__, int (parg - argv [0]), argv [0]);
 
             ret = 1;
             break;
@@ -265,7 +255,7 @@
         else {
             // colon expected
             fprintf (stderr, "%s:%d: colon expected at position %d: %s\n",
-                 __FILE__, __LINE__, int (parg - argv [0]), argv [0]);
+                     __FILE__, __LINE__, int (parg - argv [0]), argv [0]);
 
             ret = 1;
             break;
@@ -279,7 +269,7 @@
         if (fgcol < 0 || 8 < fgcol) {
             // invalid color
             fprintf (stderr, "%s:%d: unknown color at position %d: %s\n",
-                 __FILE__, __LINE__, int (parg - argv [0]), argv [0]);
+                     __FILE__, __LINE__, int (parg - argv [0]), argv [0]);
 
             ret = 1;
             break;
@@ -336,7 +326,7 @@
                                  __FILE__, __LINE__, int (parg - argv [0]),
                                  argv [0]);
 
-                        len = sizeof diag_msgs [sev].code;
+                        len = strlen (diag_msgs [sev].code);
                     }
 
                     memcpy (diag_code, parg, len);
@@ -347,10 +337,10 @@
 
         strcpy (diag_msgs [sev].esc_pfx, ESC "[");
 
-        if (fgcol < 8)
+        if (-1 < fgcol && fgcol < 8)
             strcat (diag_msgs [sev].esc_pfx, _rw_vt100_colors [fgcol].esc_pfx);
 
-        if (bgcol < 8) {
+        if (-1 < bgcol && bgcol < 8) {
             strcat (diag_msgs [sev].esc_pfx, _rw_vt100_colors [bgcol].esc_pfx);
 
             const size_t bgdiginx = strlen (diag_msgs [sev].esc_pfx) - 3;
@@ -359,7 +349,7 @@
             diag_msgs [sev].esc_pfx [bgdiginx] = '4';
         }
 
-        if (attr < 8)
+        if (-1 < attr && attr < 8)
             strcat (diag_msgs [sev].esc_pfx, _rw_vt100_attribs [attr].esc_pfx);
 
         if (diag_msgs [sev].esc_pfx [2]) {

Propchange: incubator/stdcxx/trunk/tests/src/opt_diags.cpp
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: incubator/stdcxx/trunk/tests/src/opt_diags.h
URL: http://svn.apache.org/viewcvs/incubator/stdcxx/trunk/tests/src/opt_diags.h?rev=290007&r1=290006&r2=290007&view=diff
==============================================================================
--- incubator/stdcxx/trunk/tests/src/opt_diags.h (original)
+++ incubator/stdcxx/trunk/tests/src/opt_diags.h Sun Sep 18 16:23:17 2005
@@ -6,28 +6,16 @@
  *
  ************************************************************************
  *
- * Copyright (c) 1994-2005 Quovadx, Inc. All Rights Reserved.
- * 
- * This computer software  is owned by Quovadx, Inc.  and is protected by
- * U.S.  copyright laws  and other  laws and  by  international treaties.
- * This computer  software is furnished  by Quovadx, Inc., pursuant  to a
- * written license  agreement and may  be used, copied,  transmitted, and
- * stored only in accordance with the terms of such license agreement and
- * with  the inclusion  of  the above  copyright  notice.  This  computer
- * software or any other copies  thereof may not be provided or otherwise
- * made available to any other person.
- * 
- * 
- * U.S. Government Restricted Rights.
- * 
- * This computer software: (a) was developed at private expense and is in
- * all respects the proprietary information of Quovadx, Inc.; (b) was not
- * developed with  government funds;  (c) is a  trade secret  of Quovadx,
- * Inc. for all purposes of the  Freedom of Information Act; and (d) is a
- * commercial item  and thus, pursuant  to Section 12.212 of  the Federal
- * Acquisition  Regulations (FAR) and  DFAR Supplement  Section 227.7202,
- * Government's use,  duplication or disclosure of  the computer software
- * is subject to the restrictions set forth by Quovadx, Inc.
+ * Copyright (c) 1994-2005 Quovadx,  Inc., acting through its  Rogue Wave
+ * Software division. Licensed under the Apache License, Version 2.0 (the
+ * "License");  you may  not use this file except  in compliance with the
+ * License.    You    may   obtain   a   copy   of    the   License    at
+ * http://www.apache.org/licenses/LICENSE-2.0.    Unless   required    by
+ * applicable law  or agreed to  in writing,  software  distributed under
+ * the License is distributed on an "AS IS" BASIS,  WITHOUT WARRANTIES OR
+ * CONDITIONS OF  ANY KIND, either  express or implied.  See  the License
+ * for the specific language governing permissions  and limitations under
+ * the License.
  *
  **************************************************************************/
 
@@ -56,10 +44,10 @@
 
 struct esc_text_t
 {
-    char esc_pfx [16];   // escape prefix
-    char esc_sfx [16];   // escape suffix
+    char esc_pfx [40];   // escape prefix
+    char esc_sfx [40];   // escape suffix
     char code    [16];   // short code
-    char desc    [40];   // verbose description
+    char desc    [80];   // verbose description
 };
 
 

Propchange: incubator/stdcxx/trunk/tests/src/opt_diags.h
------------------------------------------------------------------------------
    svn:keywords = Id



Mime
View raw message