oops, forgot to add one file

This commit is contained in:
leitner
2002-08-31 00:00:11 +00:00
parent 892bc1056b
commit b7f37ce357

25
mstorage_add_bin.c Normal file
View File

@@ -0,0 +1,25 @@
#include "uint32.h"
#include "mstorage.h"
/* this is tinyldap specific. If the data contains at least one 0-byte,
* it is stored in a tinyldap specific encoding:
* char 0;
* uint32 len;
* char data[len] */
long mstorage_add_bin(mstorage_t* p,const char* s,unsigned long n) {
unsigned int i;
static char zero;
long x;
char intbuf[4];
for (i=0; i<n-1; ++i)
if (!s[i]) {
x=mstorage_add(p,&zero,1);
uint32_pack(intbuf,n);
mstorage_add(p,intbuf,4);
mstorage_add(p,s,n);
return x;
}
x=mstorage_add(p,s,n);
mstorage_add(p,&zero,1);
return x;
}