experimental support for base64 encoded binary data
This commit is contained in:
24
bstr_diff2.c
Normal file
24
bstr_diff2.c
Normal file
@@ -0,0 +1,24 @@
|
||||
#include "str.h"
|
||||
#include "uint32.h"
|
||||
#include "bstr.h"
|
||||
|
||||
int bstr_diff2(const char* a,const char* b,unsigned int blen) {
|
||||
const char* A,* B;
|
||||
int j;
|
||||
/* like str_diff, just for bstrs */
|
||||
if (*a) A=a+strlen(a); else { A=a+5+uint32_read(a+1); a+=5; }
|
||||
B=b+blen;
|
||||
for (;;) {
|
||||
if (a==A) {
|
||||
if (b==B)
|
||||
return 0;
|
||||
else
|
||||
return -1;
|
||||
} else
|
||||
if (b==B)
|
||||
return 1;
|
||||
if ((j=(*a-*b))) break;
|
||||
++a; ++b;
|
||||
}
|
||||
return j;
|
||||
}
|
||||
Reference in New Issue
Block a user