wldap32: Added a wrapper for ber_printf.

This commit is contained in:
Alexandre Julliard 2006-04-18 20:40:40 +02:00
parent e048a204c1
commit 7a1fb2ecb4
2 changed files with 81 additions and 4 deletions

View File

@ -24,6 +24,9 @@
#include "windef.h"
#include "winbase.h"
#include "winldap.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(wldap32);
#ifndef LBER_ERROR
# define LBER_ERROR (~0U)
@ -166,13 +169,87 @@ ULONG WLDAP32_ber_skip_tag( BerElement *berelement, ULONG *len )
}
#ifndef HAVE_LDAP
INT ber_printf( BerElement *berelement, PCHAR fmt, ... )
/***********************************************************************
* ber_printf (WLDAP32.@)
*/
INT WLDAP32_ber_printf( BerElement *berelement, PCHAR fmt, ... )
{
#ifdef HAVE_LDAP
va_list list;
int ret = 0;
char new_fmt[2];
new_fmt[1] = 0;
va_start( list, fmt );
while (*fmt)
{
new_fmt[0] = *fmt++;
switch(new_fmt[0])
{
case 'b':
case 'e':
case 'i':
{
int i = va_arg( list, int );
ret = ber_printf( berelement, new_fmt, i );
break;
}
case 'o':
case 's':
{
char *str = va_arg( list, char * );
ret = ber_printf( berelement, new_fmt, str );
break;
}
case 't':
{
unsigned int tag = va_arg( list, unsigned int );
ret = ber_printf( berelement, new_fmt, tag );
break;
}
case 'v':
{
char **array = va_arg( list, char ** );
ret = ber_printf( berelement, new_fmt, array );
break;
}
case 'V':
{
struct berval **array = va_arg( list, struct berval ** );
ret = ber_printf( berelement, new_fmt, array );
break;
}
case 'X':
{
char *str = va_arg( list, char * );
int len = va_arg( list, int );
ret = ber_printf( berelement, "B" /* 'X' is deprecated */, str, len );
break;
}
case 'n':
case '{':
case '}':
case '[':
case ']':
ret = ber_printf( berelement, new_fmt );
break;
default:
FIXME( "Unknown format '%c'\n", new_fmt[0] );
ret = -1;
break;
}
if (ret == -1) break;
}
va_end( list );
return ret;
#else
return LBER_ERROR;
#endif
}
#ifndef HAVE_LDAP
INT ber_scanf( BerElement *berelement, PCHAR fmt, ... )
{
return LBER_ERROR;

View File

@ -225,7 +225,7 @@
307 cdecl ber_first_element(ptr ptr ptr) WLDAP32_ber_first_element
308 cdecl ber_next_element(ptr ptr ptr) WLDAP32_ber_next_element
309 cdecl ber_flatten(ptr ptr) WLDAP32_ber_flatten
310 varargs ber_printf(ptr str)
310 varargs ber_printf(ptr str) WLDAP32_ber_printf
311 varargs ber_scanf(ptr str)
312 cdecl ldap_conn_from_msg(ptr ptr)
313 cdecl ldap_sasl_bindW(ptr wstr wstr ptr ptr ptr ptr)