freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
- From: Brian Bruns <camber AT umcc.ais.org>
- To: freetds AT franklin.oit.unc.edu
- Subject: Re: [Fwd: tds_unget_byte] (fwd)
- Date: Wed, 27 Jan 1999 20:36:52 -0500 (EST)
Kevin,
Here is the dropped byte problem that I found, hopefully it is the same
one you are seeing. This is in reference to the submitted patch. And I do
believe it made it into CVS.
Brian
---------- Forwarded message ----------
Date: Wed, 30 Dec 1998 20:57:57 -0500 (EST)
From: Brian Bruns <camber AT umcc.ais.org>
To: Gregg Jensen <greggj AT savvis.net>
Cc: tetherow AT nol.nol.org
Subject: Re: [Fwd: tds_unget_byte]
Hi Gregg, I found the problem.
It's in read.c; I noted it down aways in this message. This stuff is
working on linux, so I will check it in. I compiled SQSH and threw
every query I could think of at it.
Cheers,
Brian
On Wed, 30 Dec 1998, Gregg Jensen wrote:
> > read.c Documented most of the functions and my changes.
> > tds_get_smallint uses the if def setup that has passed
> > around in various formats.
> > tds_get_n does direct copies from in_buf to dest
> > (unless dest==NULL) and handles breaks across packet
> > boundaries.
> > tds_read_packet now handles variable packet sizes and
> > insures that all bytes are read for the packet (actually
> > had a problem where MSSQL said it was sending a 512 byte
> > packet and it sent a 412 followed by the next 100 bytes
> > across the stream, ie they didn't write all 512 at once)
> >
[snip]
> > diff -c -b -r freetds/src/tds/read.c freetds.local/src/tds/read.c
> > *** freetds/src/tds/read.c Fri Nov 20 22:30:55 1998
> > --- freetds.local/src/tds/read.c Tue Dec 22 15:59:29 1998
> > ***************
[old code snipped to keep it short]
> > ! /*
> > ! ** Get N bytes from the buffer and return them in the already allocated
> > space
> > ! ** given to us. We ASSUME that the person calling this function has
> > done the
> > ! ** bounds checking for us since they know how many bytes they want here.
> > ! ** dest of NULL means we just want to eat the bytes.
> > (tetherow AT nol.org)
> > !
> > *******************************************************************************/
> > ! char *tds_get_n(TDSSOCKET *tds, void *dest, int need) {
> > ! int pos, have;
> >
> > ! pos = 0;
> >
> > ! have=(tds->in_len-tds->in_pos);
> > ! while (need>have) {
> > ! /* We need more than is in the buffer, copy what is there
> > */
> > ! if (dest!=NULL) {
> > ! memcpy(dest+pos, tds->in_buf+tds->in_pos, have);
> > ! }
> > ! pos+=have;
> > ! need-=have;
> > ! tds_read_packet(tds);
> > ! have=tds->in_len;
> > ! }
> > ! if (need>0) {
> > ! /* get the remainder if there is any */
> > ! if (dest!=NULL) {
> > ! memcpy(dest, tds->in_buf+tds->in_pos, need);
/* should be */
memcpy(dest+pos, tds->in_buf+tds->in_pos, need);
> > ! }
> > ! tds->in_pos+=need;
> > ! }
> > ! return(dest);
> > }
-
Re: [Fwd: tds_unget_byte] (fwd),
Brian Bruns, 01/27/1999
- <Possible follow-up(s)>
- Re: [Fwd: tds_unget_byte] (fwd), Kevin, 01/28/1999
Archive powered by MHonArc 2.6.24.