Skip to Content.
Sympa Menu

freetds - Re: [PATCH] msg_number to TDS_UINT

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Chris Eleveld <ihermit2 AT yahoo.com>
  • To: TDS Development Group <freetds AT franklin.oit.unc.edu>
  • Subject: Re: [PATCH] msg_number to TDS_UINT
  • Date: Sat, 26 Jan 2002 10:41:44 -0800 (PST)



If we change it to UINT or INT we haev to verify there
are no swaps on it at on a Big Endian system like mine
we'll swap the wrong 2 bytes. I believe we've already
taken care of this one though.

I must admit not knowing the deep rustligns of tds I
don't know if there is some unspoken rule that all
negative message number should be suppresed or not.
on the wire it certianly appears to be 4 bytes. The
values apssed through DB-Lib appear to be 4 byte
signed integers as well. So I'm inclined to vote for
a signed 4 byte integer myself and maybe a warning to
the log in addition to suppresing the message since
it's likely a sign of a possible endian bug.

other oppinions?

--- Steve Langasek <vorlon AT netexpress.net> wrote:
> On Sat, Jan 26, 2002 at 10:10:42AM -0000, Dave
> Brotherstone wrote:
> > As discussed, a diff (I hope it's the right format
> - shout if it's not) of
> > the couple of changes to make the msg_number a
> TDS_UINT under dblib.
>
> > Tested with SQL2000 and PHP/Apache.
>
> My concern is that this is being done specifically
> *because* of the line
> in dblib/dbutil.c:
>
> if( tds->msg_info->msg_number > 0 )
>
> If you change msg_number to be a uint, then this
> comparison will always
> be false. But either this comparison was put here
> for a good reason, in
> which case making the variable a uint is wrong; or
> it wasn't, in which
> case the comparison should simply be eliminated.
>
> If it's just a question of the storage size being
> too small, then it
> should be changed to a TDS_INT, not a TDS_UINT.
>
> Steve Langasek
> postmodern programmer
>
> > Index: include/tds.h.in
> >
>
===================================================================
> > RCS file:
> /cvsroot/freetds/freetds/include/tds.h.in,v
> > retrieving revision 1.9
> > diff -u -r1.9 tds.h.in
> > --- include/tds.h.in 2001/12/03 00:06:14 1.9
> > +++ include/tds.h.in 2002/01/26 09:58:01
> > @@ -476,7 +476,7 @@
> > typedef struct tds_msg_info {
> > TDS_SMALLINT priv_msg_type;
> > TDS_SMALLINT line_number;
> > - TDS_SMALLINT msg_number;
> > + TDS_UINT msg_number;
> > TDS_SMALLINT msg_state;
> > TDS_SMALLINT msg_level;
> > TDS_CHAR *server;
> > Index: src/dblib/dbutil.c
> >
>
===================================================================
> > RCS file:
> /cvsroot/freetds/freetds/src/dblib/dbutil.c,v
> > retrieving revision 1.5
> > diff -u -r1.5 dbutil.c
> > --- src/dblib/dbutil.c 2001/11/14 04:52:33 1.5
> > +++ src/dblib/dbutil.c 2002/01/26 09:58:01
> > @@ -29,7 +29,7 @@
> >
> >
> > extern int
>
(*g_dblib_msg_handler)(DBPROCESS*,TDS_SMALLINT,TDS_SMALLINT,TDS_SMALLINT,TDS_CHAR*,TDS_CHAR*,TDS_CHAR*);
> > -extern int
>
(*g_dblib_err_handler)(DBPROCESS*,TDS_SMALLINT,TDS_SMALLINT,TDS_SMALLINT,TDS_CHAR*,TDS_CHAR*);
> > +extern int
>
(*g_dblib_err_handler)(DBPROCESS*,TDS_SMALLINT,TDS_UINT,TDS_SMALLINT,TDS_CHAR*,TDS_CHAR*);
> >
> > /* The next 2 functions will be the reciever for
> the info and error messages
> > * that come from the TDS layer. The address of
> this function is passed to
> >
> >
>
> Content-Description: footer
> > ---
> > You are currently subscribed to freetds as:
> [vorlon AT netexpress.net]
> > To unsubscribe, forward this message to
> $subst('Email.Unsub')
>
>

> ATTACHMENT part 2 application/pgp-signature
> ---
> You are currently subscribed to freetds as:
> [ihermit2 AT yahoo.com]
> To unsubscribe, forward this message to
> $subst('Email.Unsub')
>


__________________________________________________
Do You Yahoo!?
Great stuff seeking new owners in Yahoo! Auctions!
http://auctions.yahoo.com




Archive powered by MHonArc 2.6.24.

Top of Page