more C89-fixes

going down to strict -ansi c89 is quite overkill (no 'inline',
and /* */-style comments).
But with these fixes, the code compiles with the stringent flags:
 -Wextra -Wold-style-definition -Wmissing-prototypes
 -Wmissing-declarations and -Wdeclaration-after-statement

Change-Id: I36222f8f505bcba3d9d1309ad98b5ccb04ec17e3
This commit is contained in:
Pascal Massimino
2011-03-25 15:04:11 -07:00
parent 0de013b3a4
commit f8db5d5d1c
20 changed files with 63 additions and 42 deletions

View File

@ -28,9 +28,11 @@ static int8_t sclip1[1020 + 1020 + 1]; // clips [-1020, 1020] to [-128, 127]
static int8_t sclip2[112 + 112 + 1]; // clips [-112, 112] to [-16, 15]
static uint8_t clip1[255 + 510 + 1]; // clips [-255,510] to [0,255]
static int tables_ok = 0;
// We declare this variable 'volatile' to prevent instruction reordering
// and make sure it's set to true _last_ (so as to be thread-safe)
static volatile int tables_ok = 0;
void VP8DspInitTables() {
void VP8DspInitTables(void) {
if (!tables_ok) {
int i;
for (i = -255; i <= 255; ++i) {
@ -685,7 +687,7 @@ void (*VP8SimpleHFilter16i)(uint8_t*, int, int) = SimpleHFilter16i;
//-----------------------------------------------------------------------------
void VP8DspInit() {
void VP8DspInit(void) {
// later we'll plug some SSE2 variant here
}

View File

@ -496,10 +496,11 @@ static VP8StatusCode IDecCheckStatus(const WebPIDecoder* const idec) {
VP8StatusCode WebPIAppend(WebPIDecoder* const idec, const uint8_t* data,
uint32_t data_size) {
VP8StatusCode status;
if (idec == NULL || data == NULL) {
return VP8_STATUS_INVALID_PARAM;
}
const VP8StatusCode status = IDecCheckStatus(idec);
status = IDecCheckStatus(idec);
if (status != VP8_STATUS_SUSPENDED) {
return status;
}
@ -516,10 +517,11 @@ VP8StatusCode WebPIAppend(WebPIDecoder* const idec, const uint8_t* data,
VP8StatusCode WebPIUpdate(WebPIDecoder* const idec, const uint8_t* data,
uint32_t data_size) {
VP8StatusCode status;
if (idec == NULL || data == NULL) {
return VP8_STATUS_INVALID_PARAM;
}
const VP8StatusCode status = IDecCheckStatus(idec);
status = IDecCheckStatus(idec);
if (status != VP8_STATUS_SUSPENDED) {
return status;
}
@ -536,7 +538,7 @@ VP8StatusCode WebPIUpdate(WebPIDecoder* const idec, const uint8_t* data,
//------------------------------------------------------------------------------
uint8_t* WebPIDecGetRGB(const WebPIDecoder* idec, int *last_y,
uint8_t* WebPIDecGetRGB(const WebPIDecoder* const idec, int *last_y,
int* width, int* height, int* stride) {
if (!idec || !idec->dec_ || idec->params_.mode != MODE_RGB ||
idec->state_ <= STATE_PARTS0) {
@ -551,9 +553,9 @@ uint8_t* WebPIDecGetRGB(const WebPIDecoder* idec, int *last_y,
return idec->params_.output;
}
uint8_t* WebPIDecGetYUV(const WebPIDecoder* idec, int *last_y, uint8_t** u,
uint8_t** v, int* width, int* height, int *stride,
int* uv_stride) {
uint8_t* WebPIDecGetYUV(const WebPIDecoder* const idec, int *last_y,
uint8_t** u, uint8_t** v, int* width, int* height,
int *stride, int* uv_stride) {
if (!idec || !idec->dec_ || idec->params_.mode != MODE_YUV ||
idec->state_ <= STATE_PARTS0) {
return NULL;

View File

@ -18,7 +18,7 @@ extern "C" {
//-----------------------------------------------------------------------------
int WebPGetDecoderVersion() {
int WebPGetDecoderVersion(void) {
return (DEC_MAJ_VERSION << 16) | (DEC_MIN_VERSION << 8) | DEC_REV_VERSION;
}
@ -39,7 +39,7 @@ int VP8InitIoInternal(VP8Io* const io, int version) {
return 1;
}
VP8Decoder* VP8New() {
VP8Decoder* VP8New(void) {
VP8Decoder* dec = (VP8Decoder*)calloc(1, sizeof(VP8Decoder));
if (dec) {
SetOk(dec);

View File

@ -289,8 +289,8 @@ extern VP8PredFunc VP8PredLuma16[NUM_B_DC_MODES];
extern VP8PredFunc VP8PredChroma8[NUM_B_DC_MODES];
extern VP8PredFunc VP8PredLuma4[NUM_BMODES];
void VP8DspInit(); // must be called before anything using the above
void VP8DspInitTables(); // needs to be called no matter what.
void VP8DspInit(void); // must be called before anything using the above
void VP8DspInitTables(void); // needs to be called no matter what.
// simple filter (only for luma)
typedef void (*VP8SimpleFilterFunc)(uint8_t* p, int stride, int thresh);

View File

@ -533,8 +533,9 @@ static uint8_t* Decode(WEBP_CSP_MODE mode, const uint8_t* data,
uint32_t data_size, int* width, int* height,
WebPDecParams* params_out) {
uint8_t* output;
WebPDecParams params = { 0 };
WebPDecParams params;
memset(&params, 0, sizeof(params));
params.mode = mode;
if (!WebPInitDecParams(data, data_size, width, height, &params)) {
return NULL;

View File

@ -23,7 +23,7 @@ uint8_t VP8kClip[YUV_RANGE_MAX - YUV_RANGE_MIN];
static int done = 0;
void VP8YUVInit() {
void VP8YUVInit(void) {
int i;
if (done) {
return;

View File

@ -57,7 +57,7 @@ inline static void VP8YuvToBgra(int y, int u, int v, uint8_t* const bgra) {
}
// Must be called before everything, to initialize the tables.
void VP8YUVInit();
void VP8YUVInit(void);
#if defined(__cplusplus) || defined(c_plusplus)
} // extern "C"