Skip to Content.
Sympa Menu

freetds - RE: Losing last character of TEXT fields

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "James K. Lowden" <jklowden AT schemamania.org>
  • To: "TDS Development Group" <freetds AT franklin.metalab.unc.edu>
  • Cc: LowdenJK AT bernstein.com
  • Subject: RE: Losing last character of TEXT fields
  • Date: Mon, 8 Jul 2002 20:44:54 -0400


> On your say-so, I'll revert those lines to their 1.12 arrangement. You
> fixed the problem and Brian's pretty sure the 1.13 effect was mistaken.
> I'll even reinstate your calling card for future reference.

The function I reverted was "tds_convert_text". I committed version 1.21;
see the patch below.

--jkl


@@ -107,6 +107,7 @@
return srctype;
}

+/* reverted function to 1.12 logic; 1.13 patch was mistaken. July 2002
jkl */
static TDS_INT
tds_convert_text(int srctype,TDS_CHAR *src,TDS_UINT srclen,
int desttype,TDS_CHAR *dest,TDS_UINT destlen)
@@ -115,18 +116,20 @@

switch(desttype) {
case SYBTEXT:
- case SYBCHAR:
cplen = srclen > destlen ? destlen : srclen;
memcpy(dest, src, cplen);
- dest[cplen-1] = '\0';
+ /* 2001-06-15 Deutsch changed [cplen-1] to [cplen] */
+ dest[cplen] = '\0';
return strlen(dest);
- case SYBBINARY:
+ case SYBCHAR:
cplen = srclen > destlen ? destlen : srclen;
memcpy(dest, src, cplen);
- return cplen;
+ dest[cplen]='\0';
+ return strlen(dest);
}
return 0;
}
+
static TDS_UINT
utf16len(const utf16_t* s)
{




Archive powered by MHonArc 2.6.24.

Top of Page