diff options
author | unknown <monty@narttu.mysql.fi> | 2003-11-03 22:48:03 +0200 |
---|---|---|
committer | unknown <monty@narttu.mysql.fi> | 2003-11-03 22:48:03 +0200 |
commit | 30c97ed1755b50f14f294108d93bd37d2094010c (patch) | |
tree | 68c6948d4fbd18bb59fa1aeafdce4a07a41b835f /strings | |
parent | 78ee8de22df90d4c0d21887c67e0d0e51b210727 (diff) | |
parent | 4cb95b8dfdcd511d9e3f0a164747a5181686d2c7 (diff) | |
download | mariadb-git-30c97ed1755b50f14f294108d93bd37d2094010c.tar.gz |
Merge
BitKeeper/etc/ignore:
auto-union
include/m_ctype.h:
Auto merged
mysql-test/mysql-test-run.sh:
Auto merged
mysql-test/r/func_compress.result:
Auto merged
mysql-test/t/date_formats.test:
Auto merged
sql/field.cc:
Auto merged
sql/field.h:
Auto merged
sql/item.cc:
Auto merged
sql/item.h:
Auto merged
sql/item_create.cc:
Auto merged
sql/item_func.cc:
Auto merged
sql/item_func.h:
Auto merged
sql/item_strfunc.h:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/set_var.cc:
Auto merged
sql/set_var.h:
Auto merged
sql/sql_base.cc:
Auto merged
sql/sql_class.cc:
Auto merged
sql/sql_class.h:
Auto merged
sql/sql_lex.cc:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/sql_prepare.cc:
Auto merged
sql/sql_table.cc:
Auto merged
sql/sql_yacc.yy:
Auto merged
strings/ctype-bin.c:
Auto merged
include/mysqld_error.h:
Merge error messages
mysql-test/r/date_formats.result:
merge
sql/derror.cc:
Fixed wront return value
sql/item_timefunc.cc:
merge
sql/item_timefunc.h:
merge
sql/mysqld.cc:
merge
sql/share/czech/errmsg.txt:
Merge error messages
sql/share/danish/errmsg.txt:
Merge error messages
sql/share/dutch/errmsg.txt:
Merge error messages
sql/share/english/errmsg.txt:
Merge error messages
sql/share/estonian/errmsg.txt:
Merge error messages
sql/share/french/errmsg.txt:
Merge error messages
sql/share/german/errmsg.txt:
Merge error messages
sql/share/greek/errmsg.txt:
Merge error messages
sql/share/hungarian/errmsg.txt:
Merge error messages
sql/share/italian/errmsg.txt:
Merge error messages
sql/share/japanese/errmsg.txt:
Merge error messages
sql/share/korean/errmsg.txt:
Merge error messages
sql/share/norwegian-ny/errmsg.txt:
Merge error messages
sql/share/norwegian/errmsg.txt:
Merge error messages
sql/share/polish/errmsg.txt:
Merge error messages
sql/share/portuguese/errmsg.txt:
Merge error messages
sql/share/romanian/errmsg.txt:
Merge error messages
sql/share/russian/errmsg.txt:
Merge error messages
sql/share/serbian/errmsg.txt:
Merge error messages
sql/share/slovak/errmsg.txt:
Merge error messages
sql/share/spanish/errmsg.txt:
Merge error messages
sql/share/swedish/errmsg.txt:
Merge error messages
sql/share/ukrainian/errmsg.txt:
Merge error messages
Diffstat (limited to 'strings')
-rw-r--r-- | strings/Makefile.am | 7 | ||||
-rw-r--r-- | strings/ctype-bin.c | 12 | ||||
-rw-r--r-- | strings/my_vsnprintf.c | 24 |
3 files changed, 25 insertions, 18 deletions
diff --git a/strings/Makefile.am b/strings/Makefile.am index 7b2fdcccc55..61219c8abb9 100644 --- a/strings/Makefile.am +++ b/strings/Makefile.am @@ -21,20 +21,20 @@ pkglib_LIBRARIES = libmystrings.a # Exact one of ASSEMBLER_X if ASSEMBLER_x86 -ASRCS = strings-x86.s longlong2str-x86.s +ASRCS = strings-x86.s longlong2str-x86.s my_strtoll10-x86.s CSRCS = bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c atof.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-czech.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c ctype-extra.c else if ASSEMBLER_sparc32 # These file MUST all be on the same line!! Otherwise automake # generats a very broken makefile ASRCS = bmove_upp-sparc.s strappend-sparc.s strend-sparc.s strinstr-sparc.s strmake-sparc.s strmov-sparc.s strnmov-sparc.s strstr-sparc.s -CSRCS = strcont.c strfill.c strcend.c is_prefix.c longlong2str.c bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c atof.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c strxmov.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-czech.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c ctype-extra.c +CSRCS = strcont.c strfill.c strcend.c is_prefix.c longlong2str.c bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c atof.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c strxmov.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-czech.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c ctype-extra.c my_strtoll10.c else #no assembler ASRCS = # These file MUST all be on the same line!! Otherwise automake # generats a very broken makefile -CSRCS = strxmov.c bmove_upp.c strappend.c strcont.c strend.c strfill.c strcend.c is_prefix.c strstr.c strinstr.c strmake.c strnmov.c strmov.c longlong2str.c bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c atof.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-czech.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c ctype-extra.c +CSRCS = strxmov.c bmove_upp.c strappend.c strcont.c strend.c strfill.c strcend.c is_prefix.c strstr.c strinstr.c strmake.c strnmov.c strmov.c longlong2str.c bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c atof.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-czech.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-ucs2.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c ctype-extra.c my_strtoll10.c endif endif @@ -47,6 +47,7 @@ EXTRA_DIST = ctype-big5.c ctype-czech.c ctype-euc_kr.c ctype-win1250ch.c \ ctype-ucs2.c ctype-tis620.c ctype-ujis.c \ xml.c strto.c strings-x86.s \ longlong2str.c longlong2str-x86.s \ + my_strtoll10.c my_strtoll10-x86.s \ strxmov.c bmove_upp.c strappend.c strcont.c strend.c \ strfill.c strcend.c is_prefix.c strstr.c strinstr.c \ strmake.c strnmov.c strmov.c strnlen.c \ diff --git a/strings/ctype-bin.c b/strings/ctype-bin.c index 5a785552b45..6f28c43b2c6 100644 --- a/strings/ctype-bin.c +++ b/strings/ctype-bin.c @@ -35,12 +35,12 @@ static uchar ctype_bin[]= 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 16, 16, 16, 16, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 72, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 16, 1, 1, 1, 1, 1, 1, 1, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 16, 2, 2, 2, 2, 2, 2, 2, 2 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; diff --git a/strings/my_vsnprintf.c b/strings/my_vsnprintf.c index deb9448857e..4fd288d257e 100644 --- a/strings/my_vsnprintf.c +++ b/strings/my_vsnprintf.c @@ -95,26 +95,32 @@ int my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap) else if (*fmt == 'd' || *fmt == 'u') /* Integer parameter */ { register int iarg; - char *to_start= to; - if ((uint) (end-to) < max(16,length)) - break; + uint res_length, to_length; + char *store_start= to, *store_end; + char buff[16]; + + if ((to_length= (uint) (end-to)) < 16 || length) + store_start= buff; iarg = va_arg(ap, int); if (*fmt == 'd') - to=int10_to_str((long) iarg,to, -10); + store_end= int10_to_str((long) iarg, store_start, -10); else - to=int10_to_str((long) (uint) iarg,to,10); + store_end= int10_to_str((long) (uint) iarg, store_start, 10); + if ((res_length= (uint) (store_end - store_start)) > to_length) + break; /* num doesn't fit in output */ /* If %#d syntax was used, we have to pre-zero/pre-space the string */ - if (length) + if (store_start == buff) { - uint res_length= (uint) (to - to_start); + length= min(length, to_length); if (res_length < length) { uint diff= (length- res_length); - bmove_upp(to+diff, to, res_length); - bfill(to-res_length, diff, pre_zero ? '0' : ' '); + bfill(to, diff, pre_zero ? '0' : ' '); to+= diff; } + bmove(to, store_start, res_length); } + to+= res_length; continue; } /* We come here on '%%', unknown code or too long parameter */ |