fix compilation errors under openwrt

This commit is contained in:
Martin Schröder 2016-01-14 15:13:19 +01:00
parent 8931018c36
commit 09a8707f2f
4 changed files with 22 additions and 18 deletions

View file

@ -4,7 +4,7 @@ HEADERS:=$(wildcard *.h)
OBJECTS:=$(patsubst %.c,%.o,$(SOURCE))
LDFLAGS+=
CFLAGS+=-g -Werror -Wall -Wno-unused-function -std=gnu99 -fPIC
INSTALL_PREFIX:=/usr
prefix:=$(DESTDIR)/usr/
STATIC_LIB:=lib$(PACKAGE_NAME).a
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
install:
mkdir -p $(INSTALL_PREFIX)/lib/
mkdir -p $(INSTALL_PREFIX)/include/$(PACKAGE_NAME)
cp -Rp $(STATIC_LIB) $(INSTALL_PREFIX)/lib/
cp -Rp $(SHARED_LIB) $(INSTALL_PREFIX)/lib/
cp -Rp $(PUBLIC_HEADERS) $(INSTALL_PREFIX)/include/$(PACKAGE_NAME)
mkdir -p $(prefix)/lib/
mkdir -p $(prefix)/include/$(PACKAGE_NAME)
cp -Rp $(STATIC_LIB) $(prefix)/lib/
cp -Rp $(SHARED_LIB) $(prefix)/lib/
cp -Rp $(PUBLIC_HEADERS) $(prefix)/include/$(PACKAGE_NAME)
clean:
rm -f *.o *.a *.so *-example *-test

4
blob.c
View file

@ -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));
}
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){
if(!attr) return NULL;

View file

@ -32,7 +32,7 @@ int main(int argc, char **argv){
printf("raw len: %u\n", (uint32_t)blob_size(&b));
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)){
printf("Error parsing blob!\n");

View file

@ -66,7 +66,7 @@ struct DecoderState
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);
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;
}
JSOBJ FASTCALL_MSVC decodePreciseFloat(struct DecoderState *ds)
JSOBJ decodePreciseFloat(struct DecoderState *ds)
{
char *end;
double value;
@ -99,7 +99,7 @@ JSOBJ FASTCALL_MSVC decodePreciseFloat(struct DecoderState *ds)
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 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));
}
JSOBJ FASTCALL_MSVC decode_true ( struct DecoderState *ds)
JSOBJ decode_true ( struct DecoderState *ds)
{
char *offset = ds->start;
offset ++;
@ -329,7 +329,7 @@ SETERROR:
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;
offset ++;
@ -351,7 +351,7 @@ SETERROR:
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;
offset ++;
@ -371,7 +371,7 @@ SETERROR:
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;
@ -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,
};
JSOBJ FASTCALL_MSVC decode_string ( struct DecoderState *ds)
JSOBJ decode_string ( struct DecoderState *ds)
{
JSUTF16 sur[2] = { 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 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 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 (;;)
{