Skip to Content.
Sympa Menu

freetds - Re: [freetds] bcp warning and comment

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Thompson, Bill D (London)" <bill_d_thompson AT ml.com>
  • To: "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] bcp warning and comment
  • Date: Tue, 10 Mar 2009 14:44:54 -0000

Hi Freddy,

IIRC, it's just trying to test for incompatible parameter combinations:
so it's:

if ( (host_term == NULL && host_termlen > 0) ||
(host_term != NULL && host_termlen == 0)
) {

Bill.

-----Original Message-----
From: freetds-bounces AT lists.ibiblio.org
[mailto:freetds-bounces AT lists.ibiblio.org] On Behalf Of Frediano Ziglio
Sent: 10 March 2009 13:50
To: FreeTDS Development Group
Subject: [freetds] bcp warning and comment


Well... again this warning

bcp.c: In function 'bcp_colfmt':
bcp.c:445: warning: suggest parentheses around && within ||

/*
* If there's a positive terminator length, we need a valid
terminator pointer.
* If the terminator length is 0 or -1, then there's no
terminator.
*/
if (host_term == NULL && host_termlen > 0 || host_term != NULL
&& host_termlen == 0) {
dbperror(dbproc, SYBEVDPT, 0); /* "all
variable-length data must have either a length-prefix ..." */
return FAIL;
}

I removed a similar warning in dblib.c, see
http://freetds.cvs.sourceforge.net/viewvc/freetds/freetds/src/dblib/dbli
b.c?r1=1.343&r2=1.344&sortby=date
which IMHO is more readable.
Changing however following the same rules would lead to

if (host_term == NULL ? host_termlen > 0 : host_termlen == 0) {

which is not consistent to the comment. What happen for instance if
host_termlen is -2 ? Also looking at comment is seems that bahavior is
the same if host_termlen is 0 or -1 but looking at the code if is -1
dbperror is not called. Probably code should be

if (host_term == NULL && host_termlen > 0 || host_term != NULL
&& host_termlen <= 0) {

??

freddy77
_______________________________________________
FreeTDS mailing list
FreeTDS AT lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/freetds

--------------------------------------------------------------------------
This message w/attachments (message) may be privileged, confidential or
proprietary, and if you are not an intended recipient, please notify the
sender, do not use or share it and delete it. Unless specifically indicated,
this message is not an offer to sell or a solicitation of any investment
products or other financial product or service, an official confirmation of
any transaction, or an official statement of Merrill Lynch. Subject to
applicable law, Merrill Lynch may monitor, review and retain e-communications
(EC) traveling through its networks/systems. The laws of the country of each
sender/recipient may impact the handling of EC, and EC may be archived,
supervised and produced in countries other than the country in which you are
located. This message cannot be guaranteed to be secure or error-free.
References to "Merrill Lynch" are references to any company in the Merrill
Lynch & Co., Inc. group of companies, which are wholly-owned by Bank of
America Corporation. Securities and Insurance Products: * Are Not FDIC
Insured * Are Not Bank Guaranteed * May Lose Value * Are Not a Bank Deposit *
Are Not a Condition to Any Banking Service or Activity * Are Not Insured by
Any Federal Government Agency. Attachments that are part of this
E-communication may have additional important disclosures and disclaimers,
which you should read. This message is subject to terms available at the
following link: http://www.ml.com/e-communications_terms/. By messaging with
Merrill Lynch you consent to the foregoing.
--------------------------------------------------------------------------





Archive powered by MHonArc 2.6.24.

Top of Page