summaryrefslogtreecommitdiff
path: root/strings
diff options
context:
space:
mode:
authorAlexander Nozdrin <alik@sun.com>2009-11-12 15:13:43 +0300
committerAlexander Nozdrin <alik@sun.com>2009-11-12 15:13:43 +0300
commite29ea6c2f8f0f5346bb3e78552745863799b0c16 (patch)
treeebdadd4792f0cd077f82a32327e45f9a63033f36 /strings
parent4347bbe3d168e17d87bfb492a5c433866fc19dc6 (diff)
parentad6883c4f2df12fe054d996e3ed32669248bfb08 (diff)
downloadmariadb-git-e29ea6c2f8f0f5346bb3e78552745863799b0c16.tar.gz
Auto-merge from mysql-next-mr.
Diffstat (limited to 'strings')
-rw-r--r--strings/ctype-uca.c3
-rw-r--r--strings/my_vsnprintf.c62
2 files changed, 14 insertions, 51 deletions
diff --git a/strings/ctype-uca.c b/strings/ctype-uca.c
index ee4d052b3b3..56f3ddccae4 100644
--- a/strings/ctype-uca.c
+++ b/strings/ctype-uca.c
@@ -7897,6 +7897,9 @@ static my_bool create_tailoring(CHARSET_INFO *cs, void *(*alloc)(size_t))
return 1;
}
+ if (!cs->caseinfo)
+ cs->caseinfo= my_unicase_default;
+
if (!(newweights= (uint16**) (*alloc)(256*sizeof(uint16*))))
return 1;
bzero(newweights, 256*sizeof(uint16*));
diff --git a/strings/my_vsnprintf.c b/strings/my_vsnprintf.c
index 3362559972a..ad8e7c8c776 100644
--- a/strings/my_vsnprintf.c
+++ b/strings/my_vsnprintf.c
@@ -260,6 +260,14 @@ static char *process_int_arg(char *to, char *end, size_t length,
{
size_t diff= (length- res_length);
bfill(to, diff, (print_type & PREZERO_ARG) ? '0' : ' ');
+ if (arg_type == 'p' && print_type & PREZERO_ARG)
+ {
+ if (diff > 1)
+ to[1]= 'x';
+ else
+ store_start[0]= 'x';
+ store_start[1]= '0';
+ }
to+= diff;
}
bmove(to, store_start, res_length);
@@ -323,6 +331,7 @@ start:
/* Get print width */
if (*fmt == '*')
{
+ fmt++;
fmt= get_width(fmt, &print_arr[idx].width);
print_arr[idx].width--;
DBUG_ASSERT(*fmt == '$' && print_arr[idx].width < MAX_ARGS);
@@ -472,6 +481,8 @@ start:
/**
Produces output string according to a format string
+ See the detailed documentation around my_snprintf_service_st
+
@param cs string charset
@param to buffer where processed string will be place
@param n size of buffer
@@ -621,54 +632,3 @@ size_t my_snprintf(char* to, size_t n, const char* fmt, ...)
return result;
}
-#ifdef MAIN
-#define OVERRUN_SENTRY 250
-static void my_printf(const char * fmt, ...)
-{
- char buf[33];
- int n;
- va_list ar;
- va_start(ar, fmt);
- buf[sizeof(buf)-1]=OVERRUN_SENTRY;
- n = my_vsnprintf(buf, sizeof(buf)-1,fmt, ar);
- printf(buf);
- printf("n=%d, strlen=%d\n", n, strlen(buf));
- if ((uchar) buf[sizeof(buf)-1] != OVERRUN_SENTRY)
- {
- fprintf(stderr, "Buffer overrun\n");
- abort();
- }
- va_end(ar);
-}
-
-
-int main()
-{
-
- my_printf("Hello\n");
- my_printf("Hello int, %d\n", 1);
- my_printf("Hello string '%s'\n", "I am a string");
- my_printf("Hello hack hack hack hack hack hack hack %d\n", 1);
- my_printf("Hello %d hack %d\n", 1, 4);
- my_printf("Hello %d hack hack hack hack hack %d\n", 1, 4);
- my_printf("Hello '%s' hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh\n", "hack");
- my_printf("Hello hhhhhhhhhhhhhh %d sssssssssssssss\n", 1);
- my_printf("Hello %u\n", 1);
- my_printf("Hex: %lx '%6lx'\n", 32, 65);
- my_printf("conn %ld to: '%-.64s' user: '%-.32s' host:\
- `%-.64s' (%-.64s)", 1, 0,0,0,0);
-
- my_printf("Hello string %`s\n", "I am a string");
- my_printf("Hello %05s\n", "TEST");
- my_printf("My %1$`-.1s test\n", "QQQQ");
- my_printf("My %1$s test done %2$s\n", "DDDD", "AAAA");
- my_printf("My %1$s test %2$s, %1$-.3s\n", "DDDD", "CCCC");
- my_printf("My %1$`-.4b test\n", "QQQQ");
- my_printf("My %1$c test\n", 'X');
- my_printf("My `%010d` test1 %4x test2 %4X\n", 10, 10, 10);
- my_printf("My `%1$010d` test1 %2$4x test2 %2$4x\n", 10, 10);
- my_printf("My %1$*02$d test\n", 10, 5);
- my_printf("My %1$`s test %2$s, %1$`-.3s\n", "DDDD", "CCCC");
- return 0;
-}
-#endif