Commit 56823973 authored by Ondřej Kuzník's avatar Ondřej Kuzník
Browse files

ITS#8345 Remove LDIF_KLUDGE and defer defaults to _wrap()

parent 455dd54b
...@@ -33,7 +33,7 @@ LDAP_BEGIN_DECL ...@@ -33,7 +33,7 @@ LDAP_BEGIN_DECL
/* This is NOT a bogus extern declaration (unlike ldap_debug) */ /* This is NOT a bogus extern declaration (unlike ldap_debug) */
LDAP_LDIF_V (int) ldif_debug; LDAP_LDIF_V (int) ldif_debug;
#define LDIF_LINE_WIDTH 76 /* default maximum length of LDIF lines */ #define LDIF_LINE_WIDTH 78 /* default maximum length of LDIF lines */
#define LDIF_LINE_WIDTH_MAX ((ber_len_t)-1) /* maximum length of LDIF lines */ #define LDIF_LINE_WIDTH_MAX ((ber_len_t)-1) /* maximum length of LDIF lines */
#define LDIF_LINE_WIDTH_WRAP(wrap) ((wrap) == 0 ? LDIF_LINE_WIDTH : (wrap)) #define LDIF_LINE_WIDTH_WRAP(wrap) ((wrap) == 0 ? LDIF_LINE_WIDTH : (wrap))
...@@ -50,9 +50,7 @@ LDAP_LDIF_V (int) ldif_debug; ...@@ -50,9 +50,7 @@ LDAP_LDIF_V (int) ldif_debug;
* first newline + base64 value + continued lines. Each continued line * first newline + base64 value + continued lines. Each continued line
* needs room for a newline and a leading space character. * needs room for a newline and a leading space character.
*/ */
#define LDIF_SIZE_NEEDED(nlen,vlen) \ #define LDIF_SIZE_NEEDED(nlen,vlen) LDIF_SIZE_NEEDED_WRAP(nlen, vlen, 0)
((nlen) + 4 + LDIF_BASE64_LEN(vlen) \
+ ((LDIF_BASE64_LEN(vlen) + (nlen) + 3) / (LDIF_LINE_WIDTH-1) * 2 ))
#define LDIF_SIZE_NEEDED_WRAP(nlen,vlen,wrap) \ #define LDIF_SIZE_NEEDED_WRAP(nlen,vlen,wrap) \
((nlen) + 4 + LDIF_BASE64_LEN(vlen) \ ((nlen) + 4 + LDIF_BASE64_LEN(vlen) \
......
...@@ -432,9 +432,6 @@ ldif_must_b64_encode( LDAP_CONST char *s ) ...@@ -432,9 +432,6 @@ ldif_must_b64_encode( LDAP_CONST char *s )
return 0; return 0;
} }
/* compatibility with U-Mich off by two bug */
#define LDIF_KLUDGE 2
/* NOTE: only preserved for binary compatibility */ /* NOTE: only preserved for binary compatibility */
void void
ldif_sput( ldif_sput(
...@@ -444,7 +441,7 @@ ldif_sput( ...@@ -444,7 +441,7 @@ ldif_sput(
LDAP_CONST char *val, LDAP_CONST char *val,
ber_len_t vlen ) ber_len_t vlen )
{ {
ldif_sput_wrap( out, type, name, val, vlen, LDIF_LINE_WIDTH+LDIF_KLUDGE ); ldif_sput_wrap( out, type, name, val, vlen, 0 );
} }
void void
...@@ -468,7 +465,7 @@ ldif_sput_wrap( ...@@ -468,7 +465,7 @@ ldif_sput_wrap(
ber_len_t i; ber_len_t i;
if ( !wrap ) if ( !wrap )
wrap = LDIF_LINE_WIDTH+LDIF_KLUDGE; wrap = LDIF_LINE_WIDTH;
/* prefix */ /* prefix */
switch( type ) { switch( type ) {
...@@ -664,7 +661,7 @@ ldif_put( ...@@ -664,7 +661,7 @@ ldif_put(
LDAP_CONST char *val, LDAP_CONST char *val,
ber_len_t vlen ) ber_len_t vlen )
{ {
return ldif_put_wrap( type, name, val, vlen, LDIF_LINE_WIDTH ); return ldif_put_wrap( type, name, val, vlen, 0 );
} }
char * char *
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment