static inline int pf_output_format_W( pf_output *out, const wchar_t* str, int len, pf_flags *flags ) { int r = 0; if( len < 0 ) len = wcslen( str ); if (flags->Precision && flags->Precision < len) len = flags->Precision; r = pf_fill( out, len, flags, 1 ); if( r>=0 ) r = pf_output_stringW( out, str, len ); if( r>=0 ) r = pf_fill( out, len, flags, 0 ); return r; }
static inline int pf_output_format_W( pf_output *out, LPCWSTR str, int len, pf_flags *flags ) { int r = 0; if( len < 0 ) len = strlenW( str ); if (flags->Precision >= 0 && flags->Precision < len) len = flags->Precision; r = pf_fill( out, len, flags, 1 ); if( r>=0 ) r = pf_output_stringW( out, str, len ); if( r>=0 ) r = pf_fill( out, len, flags, 0 ); return r; }
/********************************************************************* * pf_vsnprintf (INTERNAL) * * implements both A and W vsnprintf functions */ static int pf_vsnprintf( pf_output *out, const wchar_t* format, va_list valist ) { int r; const wchar_t* q; const wchar_t* p = format; pf_flags flags; while (*p) { q = wcschr( p, '%' ); /* there's no % characters left, output the rest of the string */ if( !q ) { r = pf_output_stringW(out, p, -1); if( r<0 ) return r; p += r; continue; } /* there's characters before the %, output them */ if( q != p ) { r = pf_output_stringW(out, p, q - p); if( r<0 ) return r; p = q; } /* we must be at a % now, skip over it */ assert( *p == '%' ); p++; /* output a single % character */ if( *p == '%' ) { r = pf_output_stringW(out, p++, 1); if( r<0 ) return r; continue; } /* parse the flags */ memset( &flags, 0, sizeof flags ); while (*p) { if( *p == '+' || *p == ' ' ) flags.Sign = '+'; else if( *p == '-' ) flags.LeftAlign = *p; else if( *p == '0' ) flags.PadZero = *p; else if( *p == '#' ) flags.Alternate = *p; else break; p++; } /* deal with the field width specifier */ flags.FieldLength = 0; if( *p == '*' ) { flags.FieldLength = va_arg( valist, int ); p++; } else while( isdigit(*p) )