Update of /cvsroot/monetdb/sql/src/backends/monet5/merovingian
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv20372
Modified Files:
Tag: Nov2009
utils.c utils.h
Log Message:
don't change input argument, this isn't strictly necessary, and actually broke
monetdb get's output
U utils.c
Index: utils.c
===================================================================
RCS file: /cvsroot/monetdb/sql/src/backends/monet5/merovingian/utils.c,v
retrieving revision 1.13.2.1
retrieving revision 1.13.2.2
diff -u -d -r1.13.2.1 -r1.13.2.2
--- utils.c 30 Sep 2009 14:20:07 -0000 1.13.2.1
+++ utils.c 9 Oct 2009 13:24:14 -0000 1.13.2.2
@@ -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);
}
U utils.h
Index: utils.h
===================================================================
RCS file: /cvsroot/monetdb/sql/src/backends/monet5/merovingian/utils.h,v
retrieving revision 1.9.2.1
retrieving revision 1.9.2.2
diff -u -d -r1.9.2.1 -r1.9.2.2
--- utils.h 30 Sep 2009 14:20:07 -0000 1.9.2.1
+++ utils.h 9 Oct 2009 13:24:14 -0000 1.9.2.2
@@ -44,7 +44,7 @@
confkeyval *findConfKey(confkeyval *list, char *key);
char *setConfVal(confkeyval *ckv, char *val);
void secondsToString(char *buf, time_t t, int longness);
-void abbreviateString(char *ret, char *in, size_t width);
+void abbreviateString(char *ret, const char *in, size_t width);
void generateSalt(char *buf[], unsigned int len);
char *generatePassphraseFile(char *path);
------------------------------------------------------------------------------
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