Return-Path: Delivered-To: apmail-stdcxx-dev-archive@www.apache.org Received: (qmail 38474 invoked from network); 30 May 2008 18:15:16 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 30 May 2008 18:15:16 -0000 Received: (qmail 86475 invoked by uid 500); 30 May 2008 18:15:19 -0000 Delivered-To: apmail-stdcxx-dev-archive@stdcxx.apache.org Received: (qmail 86463 invoked by uid 500); 30 May 2008 18:15:19 -0000 Mailing-List: contact dev-help@stdcxx.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@stdcxx.apache.org Delivered-To: mailing list dev@stdcxx.apache.org Received: (qmail 86452 invoked by uid 99); 30 May 2008 18:15:19 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 30 May 2008 11:15:19 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [208.30.140.160] (HELO moroha.roguewave.com) (208.30.140.160) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 30 May 2008 18:14:31 +0000 Received: from exchmail01.Blue.Roguewave.Com (exchmail01.blue.roguewave.com [10.22.129.22]) by moroha.roguewave.com (8.13.6/8.13.6) with ESMTP id m4UIEkYv026605 for ; Fri, 30 May 2008 18:14:46 GMT Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: RE: svn commit: r659253 - in /stdcxx/branches/4.2.x: examples/manual/ src/ tests/algorithms/ tests/containers/ tests/localization/ tests/numerics/ tests/regress/ tests/src/ tests/strings/ util/ X-MimeOLE: Produced By Microsoft Exchange V6.5 Date: Fri, 30 May 2008 12:14:54 -0600 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: svn commit: r659253 - in /stdcxx/branches/4.2.x: examples/manual/ src/ tests/algorithms/ tests/containers/ tests/localization/ tests/numerics/ tests/regress/ tests/src/ tests/strings/ util/ Thread-Index: Aci9EHOyTdK7i9qvRKuA/EMunqsRiAFbpPrg References: <20080522205446.F2AE02388A1F@eris.apache.org> <48372356.30408@roguewave.com> From: "Eric Lemings" To: X-Virus-Checked: Checked by ClamAV on apache.org =20 > -----Original Message----- > From: Martin Sebor [mailto:sebor@roguewave.com]=20 > Sent: Friday, May 23, 2008 2:05 PM > To: dev@stdcxx.apache.org > Subject: Re: svn commit: r659253 - in /stdcxx/branches/4.2.x:=20 > examples/manual/ src/ tests/algorithms/ tests/containers/=20 > tests/localization/ tests/numerics/ tests/regress/ tests/src/=20 > tests/strings/ util/ >=20 ... > > #if defined (_SC_CLK_TCK) > > -const float TICKS_PER_SEC =3D sysconf (_SC_CLK_TCK); > > +const float TICKS_PER_SEC =3D float (sysconf (_SC_CLK_TCK)); >=20 > (As an aside, I wonder why this is defined here when the only > place it's used is display.cpp. We should move it there.) Will do. >=20 > > #elif defined (CLK_TCK) > > const float TICKS_PER_SEC =3D CLK_TCK; > > #elif defined (CLOCKS_PER_SEC) > > @@ -521,7 +521,7 @@ > > bad_value (optname, optarg); > > =20 > > errno =3D 0; > > - defaults->timeout =3D strtol (optarg, &end, 10); > > + defaults->timeout =3D unsigned (strtol=20 > (optarg, &end, 10)); >=20 > I suggest using strtoul() here instead. strtoul() would still cause a conversion warning, wouldn't it? >=20 > > if (*end || errno) > > bad_value (optname, optarg); > > } > > @@ -573,7 +573,7 @@ > > && !memcmp (opt_exit, argv [i],=20 > sizeof opt_exit - 1)) { > > /* exit immediately with the specified status */ > > optname =3D opt_exit; > > - optarg =3D get_long_val (argv, &i, sizeof=20 > opt_exit - 1); > > + optarg =3D get_long_val (argv, &i, unsigned=20 > (sizeof opt_exit - 1)); >=20 > I suggest changing the get_long_val() signature to take size_t > as the last argument (it will also help reduce the line length > under 80 characters ;-) Depends on how the parameter is used within get_long_val(). If its converted again, that'll just move conversion warnings from one place to another. I'll have to check it out. >=20 > > if (optarg && *optarg) { > > if (!isdigit (*optarg)) > > bad_value (optname, optarg); > > @@ -581,7 +581,7 @@ > > errno =3D 0; > > const long code =3D strtol (optarg, &end, 10); > > if ('\0' =3D=3D *end && !errno) > > - exit (code); > > + exit (int (code)); >=20 > Seems this code (not necessarily the change) could do with some > error checking and reporting... I noticed the same and not only here but I limited my changes only to what the issue calls for. >=20 > > } > > } > > else if ( sizeof opt_help - 1 =3D=3D arglen > > @@ -595,7 +595,7 @@ > > && !memcmp (opt_sleep, argv [i],=20 > sizeof opt_sleep - 1)) { > > /* sleep for the specified number of seconds */=20 > > optname =3D opt_sleep; > > - optarg =3D get_long_val (argv, &i, sizeof=20 > opt_sleep - 1); > > + optarg =3D get_long_val (argv, &i, unsigned=20 > (sizeof opt_sleep - 1)); > > if (optarg && *optarg) { > > if (!isdigit (*optarg)) > > bad_value (optname, optarg); > > @@ -603,7 +603,7 @@ > > errno =3D 0; > > const long nsec =3D strtol (optarg, &end, 10); > > if ('\0' =3D=3D *end && 0 <=3D nsec && !errno) = { > > - rw_sleep (nsec); > > + rw_sleep (int (nsec)); >=20 > Same here (e.g., passing in a very large number on the command > line as a result of a scripting error). I can start filing minor issues for mo' betta range checking on program options when I find such lax usage in the future. Brad.