MCPcopy Create free account
hub / github.com/Meituan-Dianping/SQLAdvisor / my_vsnprintf_ex

Function my_vsnprintf_ex

strings/my_vsnprintf.c:539–658  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

537*/
538
539size_t my_vsnprintf_ex(const CHARSET_INFO *cs, char *to, size_t n,
540 const char* fmt, va_list ap)
541{
542 char *start=to, *end=to+n-1;
543 size_t length, width;
544 uint print_type, have_longlong;
545
546 for (; *fmt ; fmt++)
547 {
548 if (*fmt != '%')
549 {
550 if (to == end) /* End of buffer */
551 break;
552 *to++= *fmt; /* Copy ordinary char */
553 continue;
554 }
555 fmt++; /* skip '%' */
556
557 length= width= 0;
558 print_type= 0;
559
560 /* Read max fill size (only used with %d and %u) */
561 if (my_isdigit(&my_charset_latin1, *fmt))
562 {
563 fmt= get_length(fmt, &length, &print_type);
564 if (*fmt == '$')
565 {
566 to= process_args(cs, to, end, (fmt+1), length, ap);
567 return (size_t) (to - start);
568 }
569 }
570 else
571 {
572 if (*fmt == '`')
573 {
574 print_type|= ESCAPED_ARG;
575 fmt++;
576 }
577 if (*fmt == '-')
578 fmt++;
579 if (*fmt == '*')
580 {
581 fmt++;
582 length= va_arg(ap, int);
583 }
584 else
585 fmt= get_length(fmt, &length, &print_type);
586 }
587
588 if (*fmt == '.')
589 {
590 fmt++;
591 if (*fmt == '*')
592 {
593 fmt++;
594 width= va_arg(ap, int);
595 }
596 else

Callers 4

my_vsnprintfFunction · 0.85
push_warning_printfFunction · 0.85
my_errorFunction · 0.85
my_printf_errorFunction · 0.85

Calls 8

get_lengthFunction · 0.85
process_argsFunction · 0.85
get_widthFunction · 0.85
process_str_argFunction · 0.85
process_bin_argFunction · 0.85
process_dbl_argFunction · 0.85
process_int_argFunction · 0.85
check_longlongFunction · 0.70

Tested by

no test coverage detected