mirror of
https://git.openldap.org/openldap/openldap.git
synced 2024-12-15 03:01:09 +08:00
Use assert instead of private Assert macro
This commit is contained in:
parent
2c27a6abcf
commit
94d5067b22
@ -46,6 +46,7 @@
|
|||||||
|
|
||||||
#include "portable.h"
|
#include "portable.h"
|
||||||
|
|
||||||
|
#include <ac/assert.h>
|
||||||
#include <ac/stdlib.h>
|
#include <ac/stdlib.h>
|
||||||
#include <ac/ctype.h>
|
#include <ac/ctype.h>
|
||||||
#include <ac/string.h>
|
#include <ac/string.h>
|
||||||
@ -55,8 +56,6 @@
|
|||||||
|
|
||||||
#include "lutil.h"
|
#include "lutil.h"
|
||||||
|
|
||||||
#define Assert(Cond) if (!(Cond)) abort()
|
|
||||||
|
|
||||||
static const char Base64[] =
|
static const char Base64[] =
|
||||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
||||||
static const char Pad64 = '=';
|
static const char Pad64 = '=';
|
||||||
@ -146,10 +145,10 @@ lutil_b64_ntop(
|
|||||||
output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4);
|
output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4);
|
||||||
output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6);
|
output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6);
|
||||||
output[3] = input[2] & 0x3f;
|
output[3] = input[2] & 0x3f;
|
||||||
Assert(output[0] < 64);
|
assert(output[0] < 64);
|
||||||
Assert(output[1] < 64);
|
assert(output[1] < 64);
|
||||||
Assert(output[2] < 64);
|
assert(output[2] < 64);
|
||||||
Assert(output[3] < 64);
|
assert(output[3] < 64);
|
||||||
|
|
||||||
if (datalength + 4 > targsize)
|
if (datalength + 4 > targsize)
|
||||||
return (-1);
|
return (-1);
|
||||||
@ -169,9 +168,9 @@ lutil_b64_ntop(
|
|||||||
output[0] = input[0] >> 2;
|
output[0] = input[0] >> 2;
|
||||||
output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4);
|
output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4);
|
||||||
output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6);
|
output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6);
|
||||||
Assert(output[0] < 64);
|
assert(output[0] < 64);
|
||||||
Assert(output[1] < 64);
|
assert(output[1] < 64);
|
||||||
Assert(output[2] < 64);
|
assert(output[2] < 64);
|
||||||
|
|
||||||
if (datalength + 4 > targsize)
|
if (datalength + 4 > targsize)
|
||||||
return (-1);
|
return (-1);
|
||||||
|
Loading…
Reference in New Issue
Block a user