mirror of
https://github.com/vale981/libblobpack
synced 2025-03-05 09:51:42 -05:00
fix compilation errors under openwrt
This commit is contained in:
parent
8931018c36
commit
09a8707f2f
4 changed files with 22 additions and 18 deletions
12
Makefile
12
Makefile
|
@ -4,7 +4,7 @@ HEADERS:=$(wildcard *.h)
|
||||||
OBJECTS:=$(patsubst %.c,%.o,$(SOURCE))
|
OBJECTS:=$(patsubst %.c,%.o,$(SOURCE))
|
||||||
LDFLAGS+=
|
LDFLAGS+=
|
||||||
CFLAGS+=-g -Werror -Wall -Wno-unused-function -std=gnu99 -fPIC
|
CFLAGS+=-g -Werror -Wall -Wno-unused-function -std=gnu99 -fPIC
|
||||||
INSTALL_PREFIX:=/usr
|
prefix:=$(DESTDIR)/usr/
|
||||||
|
|
||||||
STATIC_LIB:=lib$(PACKAGE_NAME).a
|
STATIC_LIB:=lib$(PACKAGE_NAME).a
|
||||||
SHARED_LIB:=lib$(PACKAGE_NAME).so
|
SHARED_LIB:=lib$(PACKAGE_NAME).so
|
||||||
|
@ -31,11 +31,11 @@ random-test: tests/random.c libblobpack.a
|
||||||
$(CC) $(CFLAGS) -I. -o $@ $^ -L. -lblobpack -ljson-c -lm
|
$(CC) $(CFLAGS) -I. -o $@ $^ -L. -lblobpack -ljson-c -lm
|
||||||
|
|
||||||
install:
|
install:
|
||||||
mkdir -p $(INSTALL_PREFIX)/lib/
|
mkdir -p $(prefix)/lib/
|
||||||
mkdir -p $(INSTALL_PREFIX)/include/$(PACKAGE_NAME)
|
mkdir -p $(prefix)/include/$(PACKAGE_NAME)
|
||||||
cp -Rp $(STATIC_LIB) $(INSTALL_PREFIX)/lib/
|
cp -Rp $(STATIC_LIB) $(prefix)/lib/
|
||||||
cp -Rp $(SHARED_LIB) $(INSTALL_PREFIX)/lib/
|
cp -Rp $(SHARED_LIB) $(prefix)/lib/
|
||||||
cp -Rp $(PUBLIC_HEADERS) $(INSTALL_PREFIX)/include/$(PACKAGE_NAME)
|
cp -Rp $(PUBLIC_HEADERS) $(prefix)/include/$(PACKAGE_NAME)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f *.o *.a *.so *-example *-test
|
rm -f *.o *.a *.so *-example *-test
|
||||||
|
|
4
blob.c
4
blob.c
|
@ -240,6 +240,10 @@ struct blob_field *blob_put_double(struct blob *buf, double value){
|
||||||
return blob_put(buf, BLOB_FIELD_FLOAT64, &val, sizeof(val));
|
return blob_put(buf, BLOB_FIELD_FLOAT64, &val, sizeof(val));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct blob_field *blob_put_real(struct blob *buf, double value){
|
||||||
|
return blob_put_double(buf, value);
|
||||||
|
}
|
||||||
|
|
||||||
struct blob_field *blob_put_attr(struct blob *buf, struct blob_field *attr){
|
struct blob_field *blob_put_attr(struct blob *buf, struct blob_field *attr){
|
||||||
if(!attr) return NULL;
|
if(!attr) return NULL;
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ int main(int argc, char **argv){
|
||||||
|
|
||||||
printf("raw len: %u\n", (uint32_t)blob_size(&b));
|
printf("raw len: %u\n", (uint32_t)blob_size(&b));
|
||||||
blob_init(&buf, data, 256);
|
blob_init(&buf, data, 256);
|
||||||
struct blob_field *out[FIELD_MAX];
|
struct blob_field *out[FIELD_MAX] = {0};
|
||||||
/*
|
/*
|
||||||
if(-1 == blob_parse(&buf, policy, FIELD_MAX, out)){
|
if(-1 == blob_parse(&buf, policy, FIELD_MAX, out)){
|
||||||
printf("Error parsing blob!\n");
|
printf("Error parsing blob!\n");
|
||||||
|
|
22
ujsondec.c
22
ujsondec.c
|
@ -66,7 +66,7 @@ struct DecoderState
|
||||||
JSONObjectDecoder *dec;
|
JSONObjectDecoder *dec;
|
||||||
};
|
};
|
||||||
|
|
||||||
JSOBJ FASTCALL_MSVC decode_any( struct DecoderState *ds) FASTCALL_ATTR;
|
JSOBJ decode_any( struct DecoderState *ds);
|
||||||
typedef JSOBJ (*PFN_DECODER)( struct DecoderState *ds);
|
typedef JSOBJ (*PFN_DECODER)( struct DecoderState *ds);
|
||||||
|
|
||||||
static JSOBJ SetError( struct DecoderState *ds, int offset, const char *message)
|
static JSOBJ SetError( struct DecoderState *ds, int offset, const char *message)
|
||||||
|
@ -82,7 +82,7 @@ double createDouble(double intNeg, double intValue, double frcValue, int frcDeci
|
||||||
return (intValue + (frcValue * g_pow10[frcDecimalCount])) * intNeg;
|
return (intValue + (frcValue * g_pow10[frcDecimalCount])) * intNeg;
|
||||||
}
|
}
|
||||||
|
|
||||||
JSOBJ FASTCALL_MSVC decodePreciseFloat(struct DecoderState *ds)
|
JSOBJ decodePreciseFloat(struct DecoderState *ds)
|
||||||
{
|
{
|
||||||
char *end;
|
char *end;
|
||||||
double value;
|
double value;
|
||||||
|
@ -99,7 +99,7 @@ JSOBJ FASTCALL_MSVC decodePreciseFloat(struct DecoderState *ds)
|
||||||
return ds->dec->newDouble(ds->prv, value);
|
return ds->dec->newDouble(ds->prv, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
JSOBJ FASTCALL_MSVC decode_numeric (struct DecoderState *ds)
|
JSOBJ decode_numeric (struct DecoderState *ds)
|
||||||
{
|
{
|
||||||
int intNeg = 1;
|
int intNeg = 1;
|
||||||
int mantSize = 0;
|
int mantSize = 0;
|
||||||
|
@ -309,7 +309,7 @@ BREAK_EXP_LOOP:
|
||||||
return ds->dec->newDouble (ds->prv, createDouble( (double) intNeg, (double) intValue , frcValue, decimalCount) * pow(10.0, expValue * expNeg));
|
return ds->dec->newDouble (ds->prv, createDouble( (double) intNeg, (double) intValue , frcValue, decimalCount) * pow(10.0, expValue * expNeg));
|
||||||
}
|
}
|
||||||
|
|
||||||
JSOBJ FASTCALL_MSVC decode_true ( struct DecoderState *ds)
|
JSOBJ decode_true ( struct DecoderState *ds)
|
||||||
{
|
{
|
||||||
char *offset = ds->start;
|
char *offset = ds->start;
|
||||||
offset ++;
|
offset ++;
|
||||||
|
@ -329,7 +329,7 @@ SETERROR:
|
||||||
return SetError(ds, -1, "Unexpected character found when decoding 'true'");
|
return SetError(ds, -1, "Unexpected character found when decoding 'true'");
|
||||||
}
|
}
|
||||||
|
|
||||||
JSOBJ FASTCALL_MSVC decode_false ( struct DecoderState *ds)
|
JSOBJ decode_false ( struct DecoderState *ds)
|
||||||
{
|
{
|
||||||
char *offset = ds->start;
|
char *offset = ds->start;
|
||||||
offset ++;
|
offset ++;
|
||||||
|
@ -351,7 +351,7 @@ SETERROR:
|
||||||
return SetError(ds, -1, "Unexpected character found when decoding 'false'");
|
return SetError(ds, -1, "Unexpected character found when decoding 'false'");
|
||||||
}
|
}
|
||||||
|
|
||||||
JSOBJ FASTCALL_MSVC decode_null ( struct DecoderState *ds)
|
JSOBJ decode_null ( struct DecoderState *ds)
|
||||||
{
|
{
|
||||||
char *offset = ds->start;
|
char *offset = ds->start;
|
||||||
offset ++;
|
offset ++;
|
||||||
|
@ -371,7 +371,7 @@ SETERROR:
|
||||||
return SetError(ds, -1, "Unexpected character found when decoding 'null'");
|
return SetError(ds, -1, "Unexpected character found when decoding 'null'");
|
||||||
}
|
}
|
||||||
|
|
||||||
void FASTCALL_MSVC SkipWhitespace(struct DecoderState *ds)
|
void SkipWhitespace(struct DecoderState *ds)
|
||||||
{
|
{
|
||||||
char *offset = ds->start;
|
char *offset = ds->start;
|
||||||
|
|
||||||
|
@ -422,7 +422,7 @@ static const JSUINT8 g_decoderLookup[256] =
|
||||||
/* 0xf0 */ 4, 4, 4, 4, 4, 4, 4, 4, DS_UTFLENERROR, DS_UTFLENERROR, DS_UTFLENERROR, DS_UTFLENERROR, DS_UTFLENERROR, DS_UTFLENERROR, DS_UTFLENERROR, DS_UTFLENERROR,
|
/* 0xf0 */ 4, 4, 4, 4, 4, 4, 4, 4, DS_UTFLENERROR, DS_UTFLENERROR, DS_UTFLENERROR, DS_UTFLENERROR, DS_UTFLENERROR, DS_UTFLENERROR, DS_UTFLENERROR, DS_UTFLENERROR,
|
||||||
};
|
};
|
||||||
|
|
||||||
JSOBJ FASTCALL_MSVC decode_string ( struct DecoderState *ds)
|
JSOBJ decode_string ( struct DecoderState *ds)
|
||||||
{
|
{
|
||||||
JSUTF16 sur[2] = { 0 };
|
JSUTF16 sur[2] = { 0 };
|
||||||
int iSur = 0;
|
int iSur = 0;
|
||||||
|
@ -672,7 +672,7 @@ JSOBJ FASTCALL_MSVC decode_string ( struct DecoderState *ds)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
JSOBJ FASTCALL_MSVC decode_array(struct DecoderState *ds)
|
JSOBJ decode_array(struct DecoderState *ds)
|
||||||
{
|
{
|
||||||
JSOBJ itemValue;
|
JSOBJ itemValue;
|
||||||
JSOBJ newObj;
|
JSOBJ newObj;
|
||||||
|
@ -735,7 +735,7 @@ JSOBJ FASTCALL_MSVC decode_array(struct DecoderState *ds)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
JSOBJ FASTCALL_MSVC decode_object( struct DecoderState *ds)
|
JSOBJ decode_object( struct DecoderState *ds)
|
||||||
{
|
{
|
||||||
JSOBJ itemName;
|
JSOBJ itemName;
|
||||||
JSOBJ itemValue;
|
JSOBJ itemValue;
|
||||||
|
@ -820,7 +820,7 @@ JSOBJ FASTCALL_MSVC decode_object( struct DecoderState *ds)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
JSOBJ FASTCALL_MSVC decode_any(struct DecoderState *ds)
|
JSOBJ decode_any(struct DecoderState *ds)
|
||||||
{
|
{
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue