Update of /cvsroot/monetdb/sql/src/backends/monet5/merovingian
In directory 
23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv920/src/backends/monet5/merovingian

Modified Files:
        utils.c 
Log Message:
propagated changes of Friday Oct 09 2009
from the Nov2009 branch to the development trunk

  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2009/10/09 - mr-meltdown: src/backends/monet5/merovingian/utils.c,1.13.2.2
  don't change input argument, this isn't strictly necessary, and actually 
broke monetdb get's output
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Index: utils.c
===================================================================
RCS file: /cvsroot/monetdb/sql/src/backends/monet5/merovingian/utils.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- utils.c     1 Oct 2009 14:25:20 -0000       1.14
+++ utils.c     9 Oct 2009 15:42:49 -0000       1.15
@@ -252,20 +252,21 @@
 /**
  * Fills the array pointed to by ret, with the string from in,
  * abbreviating it when it is longer than width chars long.
- * This function possibly modifies its input argument in.  The array
- * pointed to by ret must be at least of size width + 1.
+ * The array pointed to by ret must be at least of size width + 1.
  */
 inline void
-abbreviateString(char *ret, char *in, size_t width)
+abbreviateString(char *ret, const char *in, size_t width)
 {
        size_t len;
+       size_t off;
 
        if ((len = strlen(in)) > width) {
                /* position abbreviation dots in the middle (Mac style, iso
                 * Windos style) */
-               in[(width / 2) - 2] = '\0';
-               snprintf(ret, width + 1, "%s...%s",
-                               in, in + len - (width - ((width / 2) - 2) - 3));
+               memcpy(ret, in, (width / 2) - 3);
+               memcpy(ret + (width / 2) - 2, "...", 3);
+               off = len - (width - ((width / 2) - 2) - 3);
+               memcpy(ret + (width / 2) + 1, in + off, (len - off) + 1);
        } else {
                sprintf(ret, "%s", in);
        }


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Monetdb-sql-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-sql-checkins

Reply via email to