Skip to Content.
Sympa Menu

freetds - Tiny patch to cleanup FreeTDS dump output

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: <lbayuk AT mindspring.com>
  • To: freetds AT franklin.oit.unc.edu
  • Subject: Tiny patch to cleanup FreeTDS dump output
  • Date: Sat, 7 Sep 2002 20:32:34 -0400 (EDT)


This patch fixes 2 little uglinesses in the TDS dump log buffer dump
output routine, tdsdump_dump_buf():
1. The extra space was after the 9th hex byte, and should be after the
8th byte which is the halfway point.
2. The vertical bar before the ASCII part was pushed left 1 column for
lines with 8 or fewer bytes on them.

(OK, so it isn't a big thing, but it bothered me. And look: it makes
the code shorter by 3 lines! Please consider applying it.)

--- src/tds/util.c~ 2002-08-08 22:55:49.000000000 -0400
+++ src/tds/util.c 2002-09-07 14:33:51.000000000 -0400
@@ -238,19 +238,16 @@
/*
* print each byte in hex
*/
- for(j=i; j<length && (j-i)<bytesPerLine; j++)
+ for(j=0; j<bytesPerLine; j++)
{
- fprintf(dumpfile, "%02x ", data[j]);
- if (j-i == bytesPerLine/2) fprintf(dumpfile, " ");
+ if (j == bytesPerLine/2) fprintf(dumpfile, " ");
+ if (j+i >= length) fprintf(dumpfile, " ");
+ else fprintf(dumpfile, "%02x ", data[i+j]);
}

/*
* skip over to the ascii dump column
*/
- for(; 0!=(j % bytesPerLine); j++)
- {
- fprintf(dumpfile, " ");
- }
fprintf(dumpfile, " |");

/*



  • Tiny patch to cleanup FreeTDS dump output, lbayuk, 09/07/2002

Archive powered by MHonArc 2.6.24.

Top of Page