Skip to Content.
Sympa Menu

freetds - RE: buglets in the bcp code

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Castellano, Nicholas" <Nicholas_Castellano AT acml.com>
  • To: "'TDS Development Group'" <freetds AT franklin.metalab.unc.edu>
  • Subject: RE: buglets in the bcp code
  • Date: Wed, 25 Sep 2002 12:11:02 -0400


The first loop is iterating over the columns from the server, while the
second loop is iterating over the columns in the host file.

I think what's needed is a check like this in the second loop, after hostcol
is assigned:

if ((hostcol->tab_colnum < 1) || (hostcol->tab_colnum >
dbproc->bcp_colcount)) {
continue;
}

Cheers,
--nick

-----Original Message-----
From: bounce-freetds-145195 AT franklin.oit.unc.edu
[mailto:bounce-freetds-145195 AT franklin.oit.unc.edu]
Sent: Sunday, September 22, 2002 1:46 AM
To: TDS Development Group
Subject: [freetds] buglets in the bcp code


So now that 0.60[.1] is out the door, I've started taking a look at the log
of building CVS HEAD with -Wall turned on. I've already committed a number
of straightforward fixes for uninitialized variables, missing #includes, and
unused variables; in fact, everything's straightforward except for
src/dblib/bcp.c.

The attached patch addresses a number of warnings related to uninitialized
variables. Innocuous in and of itself, but unlike elsewhere, I haven't been
able to work out at first glance why these functions are structured the way
they are. There's an initial for loop, within which the pointers in
question are modified with each iteration; and then below there's a second
for loop, where only the final value is used? Given that no one's hit the
initialization bug yet, it seems the code does a good job of making sure the
top loop is processed at least once, but the program flow seemed odd enough
to me that I figured it might be better if someone had a look at this code
before I made the compiler warnings go away.

Cheers,
Steve Langasek
postmodern programmer


The information contained in this transmission may contain privileged and
confidential information and is intended only for the use of the person(s)
named above. If you are not the intended recipient, or an employee or agent
responsible for delivering this message to the intended recipient, any
review, dissemination, distribution or duplication of this communication is
strictly prohibited. If you are not the intended recipient, please contact
the sender immediately by reply e-mail and destroy all copies of the
original message. Please note that for certain accounts we do not accept
orders and/or instructions by e-mail, and for those accounts we will not be
responsible for carrying out such orders and/or instructions. Kindly refrain
from sending orders or instructions by e-mail unless you have confirmed that
we accept such communications for your account. Please also note that to
satisfy regulatory requirements we review the outgoing and incoming e-mail
correspondence of staff members serving certain functions.






Archive powered by MHonArc 2.6.24.

Top of Page