Skip to content

Commit

Permalink
fix core on bigendian machine
Browse files Browse the repository at this point in the history
  • Loading branch information
freddy77 committed Jul 25, 2005
1 parent cce95d1 commit 56498fd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
3 changes: 3 additions & 0 deletions ChangeLog
@@ -1,3 +1,6 @@
Mon Jul 25 10:45:47 CET 2005 Frediano Ziglio <freddy77@angelfire.com>
* src/tds/query.c: fix for bigendian machine

Fri Jul 22 13:38:26 CET 2005 Frediano Ziglio <freddy77@angelfire.com>
* src/tds/convert.c: fix possible core calling strftime

Expand Down
7 changes: 3 additions & 4 deletions src/tds/query.c
Expand Up @@ -41,7 +41,7 @@

#include <assert.h>

static char software_version[] = "$Id: query.c,v 1.144 2004-10-14 18:26:53 freddy77 Exp $";
static char software_version[] = "$Id: query.c,v 1.144.2.1 2005-07-25 08:46:02 freddy77 Exp $";
static void *no_unused_var_warn[] = { software_version, no_unused_var_warn };

static void tds_put_params(TDSSOCKET * tds, TDSPARAMINFO * info, int flags);
Expand Down Expand Up @@ -1100,7 +1100,6 @@ tds_put_data(TDSSOCKET * tds, TDSCOLUMN * curcol, unsigned char *current_row, in

switch (curcol->column_varint_size) {
case 4: /* It's a BLOB... */
blob = (TDSBLOB *) & (current_row[curcol->column_offset]);
/* mssql require only size */
tds_put_int(tds, colsize);
break;
Expand Down Expand Up @@ -1134,7 +1133,7 @@ tds_put_data(TDSSOCKET * tds, TDSCOLUMN * curcol, unsigned char *current_row, in
#ifdef WORDS_BIGENDIAN
unsigned char buf[64];

if (tds->emul_little_endian && colsize < 64) {
if (tds->emul_little_endian && !converted && colsize < 64) {
tdsdump_log(TDS_DBG_INFO1, "swapping coltype %d\n",
tds_get_conversion_type(curcol->column_type, colsize));
memcpy(buf, s, colsize);
Expand Down Expand Up @@ -1191,7 +1190,7 @@ tds_put_data(TDSSOCKET * tds, TDSCOLUMN * curcol, unsigned char *current_row, in
#ifdef WORDS_BIGENDIAN
unsigned char buf[64];

if (tds->emul_little_endian && !is_numeric_type(curcol->column_type) && colsize < 64) {
if (tds->emul_little_endian && colsize < 64) {
tdsdump_log(TDS_DBG_INFO1, "swapping coltype %d\n",
tds_get_conversion_type(curcol->column_type, colsize));
memcpy(buf, src, colsize);
Expand Down

0 comments on commit 56498fd

Please sign in to comment.