diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-12-17 04:52:36 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-12-17 04:52:36 +0400 |
commit | ad96dacbc5a7cc61ccf74405927847f243a955b5 (patch) | |
tree | a2b78d3b502b99a1c7e59e8400dfd0807a896125 | |
parent | 9276fb479ed1c5b472c5d831f52913157efe9288 (diff) |
style edit only - move parenthesis onto second line of function definition (in keeping with most of blenders code)
also split some long lines in own code.
32 files changed, 471 insertions, 233 deletions
diff --git a/source/blender/avi/intern/avi.c b/source/blender/avi/intern/avi.c index a021695b7c9..c6fdd2e1adc 100644 --- a/source/blender/avi/intern/avi.c +++ b/source/blender/avi/intern/avi.c @@ -63,7 +63,8 @@ char *tcc_to_char (unsigned int tcc); /* implemetation */ -unsigned int GET_FCC (FILE *fp) { +unsigned int GET_FCC (FILE *fp) +{ unsigned char tmp[4]; tmp[0] = getc(fp); @@ -74,7 +75,8 @@ unsigned int GET_FCC (FILE *fp) { return FCC (tmp); } -unsigned int GET_TCC (FILE *fp) { +unsigned int GET_TCC (FILE *fp) +{ char tmp[5]; tmp[0] = getc(fp); @@ -85,7 +87,8 @@ unsigned int GET_TCC (FILE *fp) { return FCC (tmp); } -char *fcc_to_char (unsigned int fcc) { +char *fcc_to_char (unsigned int fcc) +{ DEBUG_FCC[0]= (fcc)&127; DEBUG_FCC[1]= (fcc>>8)&127; DEBUG_FCC[2]= (fcc>>16)&127; @@ -94,7 +97,8 @@ char *fcc_to_char (unsigned int fcc) { return DEBUG_FCC; } -char *tcc_to_char (unsigned int tcc) { +char *tcc_to_char (unsigned int tcc) +{ DEBUG_FCC[0]= (tcc)&127; DEBUG_FCC[1]= (tcc>>8)&127; DEBUG_FCC[2]= 0; @@ -103,7 +107,8 @@ char *tcc_to_char (unsigned int tcc) { return DEBUG_FCC; } -int AVI_get_stream (AviMovie *movie, int avist_type, int stream_num) { +int AVI_get_stream (AviMovie *movie, int avist_type, int stream_num) +{ int cur_stream; if (movie == NULL) @@ -121,7 +126,8 @@ int AVI_get_stream (AviMovie *movie, int avist_type, int stream_num) { return -AVI_ERROR_FOUND; } -static int fcc_get_stream (int fcc) { +static int fcc_get_stream (int fcc) +{ char fccs[4]; fccs[0] = fcc; @@ -132,7 +138,8 @@ static int fcc_get_stream (int fcc) { return 10*(fccs[0]-'0') + (fccs[1]-'0'); } -static int fcc_is_data (int fcc) { +static int fcc_is_data (int fcc) +{ char fccs[4]; fccs[0] = fcc; @@ -148,7 +155,8 @@ static int fcc_is_data (int fcc) { return 1; } -AviError AVI_print_error (AviError in_error) { +AviError AVI_print_error (AviError in_error) +{ int error; if ((int) in_error < 0) @@ -190,12 +198,14 @@ AviError AVI_print_error (AviError in_error) { return in_error; } /* -void AVI_set_debug (int mode) { +void AVI_set_debug (int mode) +{ AVI_DEBUG= mode; } */ /* -int AVI_is_avi (char *name) { +int AVI_is_avi (char *name) +{ FILE *fp; int ret; @@ -216,7 +226,8 @@ int AVI_is_avi (char *name) { } */ -int AVI_is_avi (const char *name) { +int AVI_is_avi (const char *name) +{ int temp, fcca, j; AviMovie movie= {NULL}; AviMainHeader header; @@ -407,7 +418,8 @@ int AVI_is_avi (const char *name) { } -AviError AVI_open_movie (const char *name, AviMovie *movie) { +AviError AVI_open_movie (const char *name, AviMovie *movie) +{ int temp, fcca, size, j; DEBUG_PRINT("opening movie\n"); @@ -619,7 +631,11 @@ AviError AVI_open_movie (const char *name, AviMovie *movie) { movie->entries[temp].Offset = GET_FCC (movie->fp); movie->entries[temp].Size = GET_FCC (movie->fp); - if (AVI_DEBUG) printf ("Index entry %04d: ChunkId:%s Flags:%d Offset:%d Size:%d\n", temp, fcc_to_char(movie->entries[temp].ChunkId), movie->entries[temp].Flags, movie->entries[temp].Offset, movie->entries[temp].Size); + if (AVI_DEBUG) { + printf("Index entry %04d: ChunkId:%s Flags:%d Offset:%d Size:%d\n", + temp, fcc_to_char(movie->entries[temp].ChunkId), movie->entries[temp].Flags, + movie->entries[temp].Offset, movie->entries[temp].Size); + } } /* Some AVI's have offset entries in absolute coordinates @@ -637,7 +653,8 @@ AviError AVI_open_movie (const char *name, AviMovie *movie) { return AVI_ERROR_NONE; } -void *AVI_read_frame (AviMovie *movie, AviFormat format, int frame, int stream) { +void *AVI_read_frame (AviMovie *movie, AviFormat format, int frame, int stream) +{ int cur_frame=-1, temp, i=0, rewind=1; void *buffer; @@ -681,7 +698,8 @@ void *AVI_read_frame (AviMovie *movie, AviFormat format, int frame, int stream) return buffer; } -AviError AVI_close (AviMovie *movie) { +AviError AVI_close (AviMovie *movie) +{ int i; fclose (movie->fp); @@ -703,7 +721,8 @@ AviError AVI_close (AviMovie *movie) { return AVI_ERROR_NONE; } -AviError AVI_open_compress (char *name, AviMovie *movie, int streams, ...) { +AviError AVI_open_compress (char *name, AviMovie *movie, int streams, ...) +{ va_list ap; AviList list; AviChunk chunk; @@ -892,7 +911,8 @@ AviError AVI_open_compress (char *name, AviMovie *movie, int streams, ...) { return AVI_ERROR_NONE; } -AviError AVI_write_frame (AviMovie *movie, int frame_num, ...) { +AviError AVI_write_frame (AviMovie *movie, int frame_num, ...) +{ AviList list; AviChunk chunk; AviIndexEntry *temp; @@ -999,7 +1019,8 @@ AviError AVI_write_frame (AviMovie *movie, int frame_num, ...) { return AVI_ERROR_NONE; } -AviError AVI_close_compress (AviMovie *movie) { +AviError AVI_close_compress (AviMovie *movie) +{ int temp, movi_size, i; fseek (movie->fp, 0L, SEEK_END); diff --git a/source/blender/avi/intern/codecs.c b/source/blender/avi/intern/codecs.c index 78d8d4a32b2..73af7097994 100644 --- a/source/blender/avi/intern/codecs.c +++ b/source/blender/avi/intern/codecs.c @@ -40,7 +40,8 @@ #include "mjpeg.h" #include "rgb32.h" -void *avi_format_convert (AviMovie *movie, int stream, void *buffer, AviFormat from, AviFormat to, int *size) { +void *avi_format_convert (AviMovie *movie, int stream, void *buffer, AviFormat from, AviFormat to, int *size) +{ if (from == to) return buffer; @@ -82,7 +83,8 @@ void *avi_format_convert (AviMovie *movie, int stream, void *buffer, AviFormat f return buffer; } -int avi_get_data_id (AviFormat format, int stream) { +int avi_get_data_id (AviFormat format, int stream) +{ char fcc[5]; if (avi_get_format_type (format) == FCC("vids")) @@ -95,7 +97,8 @@ int avi_get_data_id (AviFormat format, int stream) { return FCC(fcc); } -int avi_get_format_type (AviFormat format) { +int avi_get_format_type (AviFormat format) +{ switch (format) { case AVI_FORMAT_RGB24: case AVI_FORMAT_RGB32: @@ -109,7 +112,8 @@ int avi_get_format_type (AviFormat format) { } } -int avi_get_format_fcc (AviFormat format) { +int avi_get_format_fcc (AviFormat format) +{ switch (format) { case AVI_FORMAT_RGB24: case AVI_FORMAT_RGB32: @@ -125,7 +129,8 @@ int avi_get_format_fcc (AviFormat format) { } } -int avi_get_format_compression (AviFormat format) { +int avi_get_format_compression (AviFormat format) +{ switch (format) { case AVI_FORMAT_RGB24: case AVI_FORMAT_RGB32: diff --git a/source/blender/avi/intern/endian.c b/source/blender/avi/intern/endian.c index 194880605b6..29b3047eca4 100644 --- a/source/blender/avi/intern/endian.c +++ b/source/blender/avi/intern/endian.c @@ -43,7 +43,8 @@ #include "avi_intern.h" #ifdef __BIG_ENDIAN__ -static void invert (int *num) { +static void invert (int *num) +{ int new=0,i,j; for (j=0; j < 4; j++) { @@ -55,7 +56,8 @@ static void invert (int *num) { *num = new; } -static void sinvert (short int *num) { +static void sinvert (short int *num) +{ short int new=0; int i,j; @@ -68,20 +70,23 @@ static void sinvert (short int *num) { *num = new; } -static void Ichunk (AviChunk *chunk) { +static void Ichunk (AviChunk *chunk) +{ invert (&chunk->fcc); invert (&chunk->size); } #endif #ifdef __BIG_ENDIAN__ -static void Ilist (AviList *list){ +static void Ilist (AviList *list) +{ invert (&list->fcc); invert (&list->size); invert (&list->ids); } -static void Imainh (AviMainHeader *mainh) { +static void Imainh (AviMainHeader *mainh) +{ invert (&mainh->fcc); invert (&mainh->size); invert (&mainh->MicroSecPerFrame); @@ -100,7 +105,8 @@ static void Imainh (AviMainHeader *mainh) { invert (&mainh->Reserved[3]); } -static void Istreamh (AviStreamHeader *streamh) { +static void Istreamh (AviStreamHeader *streamh) +{ invert (&streamh->fcc); invert (&streamh->size); invert (&streamh->Type); @@ -122,7 +128,8 @@ static void Istreamh (AviStreamHeader *streamh) { sinvert (&streamh->bottom); } -static void Ibitmaph (AviBitmapInfoHeader *bitmaph) { +static void Ibitmaph (AviBitmapInfoHeader *bitmaph) +{ invert (&bitmaph->fcc); invert (&bitmaph->size); invert (&bitmaph->Size); @@ -138,7 +145,8 @@ static void Ibitmaph (AviBitmapInfoHeader *bitmaph) { invert (&bitmaph->ClrImportant); } -static void Imjpegu (AviMJPEGUnknown *mjpgu) { +static void Imjpegu (AviMJPEGUnknown *mjpgu) +{ invert (&mjpgu->a); invert (&mjpgu->b); invert (&mjpgu->c); @@ -148,7 +156,8 @@ static void Imjpegu (AviMJPEGUnknown *mjpgu) { invert (&mjpgu->g); } -static void Iindexe (AviIndexEntry *indexe) { +static void Iindexe (AviIndexEntry *indexe) +{ invert (&indexe->ChunkId); invert (&indexe->Flags); invert (&indexe->Offset); @@ -156,7 +165,8 @@ static void Iindexe (AviIndexEntry *indexe) { } #endif /* __BIG_ENDIAN__ */ -void awrite (AviMovie *movie, void *datain, int block, int size, FILE *fp, int type) { +void awrite (AviMovie *movie, void *datain, int block, int size, FILE *fp, int type) +{ #ifdef __BIG_ENDIAN__ void *data; diff --git a/source/blender/avi/intern/mjpeg.c b/source/blender/avi/intern/mjpeg.c index e55549bd05e..dab0b213d95 100644 --- a/source/blender/avi/intern/mjpeg.c +++ b/source/blender/avi/intern/mjpeg.c @@ -50,7 +50,8 @@ static void jpegmemsrcmgr_build (j_decompress_ptr dinfo, unsigned char *buffer, static int numbytes; -static void add_huff_table (j_decompress_ptr dinfo, JHUFF_TBL **htblptr, const UINT8 *bits, const UINT8 *val) { +static void add_huff_table (j_decompress_ptr dinfo, JHUFF_TBL **htblptr, const UINT8 *bits, const UINT8 *val) +{ if (*htblptr == NULL) *htblptr = jpeg_alloc_huff_table((j_common_ptr) dinfo); @@ -64,7 +65,8 @@ static void add_huff_table (j_decompress_ptr dinfo, JHUFF_TBL **htblptr, const U /* Set up the standard Huffman tables (cf. JPEG standard section K.3) */ /* IMPORTANT: these are only valid for 8-bit data precision! */ -static void std_huff_tables (j_decompress_ptr dinfo) { +static void std_huff_tables (j_decompress_ptr dinfo) +{ static const UINT8 bits_dc_luminance[17] = { /* 0-base */ 0, 0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0 }; @@ -142,7 +144,8 @@ static void std_huff_tables (j_decompress_ptr dinfo) { bits_ac_chrominance, val_ac_chrominance); } -static int Decode_JPEG(unsigned char *inBuffer, unsigned char *outBuffer, unsigned int width, unsigned int height, int bufsize) { +static int Decode_JPEG(unsigned char *inBuffer, unsigned char *outBuffer, unsigned int width, unsigned int height, int bufsize) +{ int rowstride; unsigned int y; struct jpeg_decompress_struct dinfo; @@ -194,7 +197,8 @@ static int Decode_JPEG(unsigned char *inBuffer, unsigned char *outBuffer, unsign return 1; } -static void Compress_JPEG(int quality, unsigned char *outbuffer, unsigned char *inBuffer, int width, int height, int bufsize) { +static void Compress_JPEG(int quality, unsigned char *outbuffer, unsigned char *inBuffer, int width, int height, int bufsize) +{ int i, rowstride; unsigned int y; struct jpeg_compress_struct cinfo; @@ -255,7 +259,8 @@ static void Compress_JPEG(int quality, unsigned char *outbuffer, unsigned char * jpeg_destroy_compress(&cinfo); } -static void interlace(unsigned char *to, unsigned char *from, int width, int height) { +static void interlace(unsigned char *to, unsigned char *from, int width, int height) +{ int i, rowstride= width*3; for (i=0; i<height; i++) { @@ -266,7 +271,8 @@ static void interlace(unsigned char *to, unsigned char *from, int width, int hei } } -static void deinterlace(int odd, unsigned char *to, unsigned char *from, int width, int height) { +static void deinterlace(int odd, unsigned char *to, unsigned char *from, int width, int height) +{ int i, rowstride= width*3; for (i=0; i<height; i++) { @@ -277,7 +283,8 @@ static void deinterlace(int odd, unsigned char *to, unsigned char *from, int wid } } -static int check_and_decode_jpeg(unsigned char *inbuf, unsigned char *outbuf, int width, int height, int bufsize) { +static int check_and_decode_jpeg(unsigned char *inbuf, unsigned char *outbuf, int width, int height, int bufsize) +{ /* JPEG's are always multiples of 16, extra is cropped out AVI's */ if ((width&0xF) || (height&0xF)) { int i, rrowstride, jrowstride; @@ -299,7 +306,8 @@ static int check_and_decode_jpeg(unsigned char *inbuf, unsigned char *outbuf, in } } -static void check_and_compress_jpeg(int quality, unsigned char *outbuf, unsigned char *inbuf, int width, int height, int bufsize) { +static void check_and_compress_jpeg(int quality, unsigned char *outbuf, unsigned char *inbuf, int width, int height, int bufsize) +{ /* JPEG's are always multiples of 16, extra is ignored in AVI's */ if ((width&0xF) || (height&0xF)) { int i, rrowstride, jrowstride; @@ -326,7 +334,8 @@ static void check_and_compress_jpeg(int quality, unsigned char *outbuf, unsigned } } -void *avi_converter_from_mjpeg (AviMovie *movie, int stream, unsigned char *buffer, int *size) { +void *avi_converter_from_mjpeg (AviMovie *movie, int stream, unsigned char *buffer, int *size) +{ int deint; unsigned char *buf; @@ -349,7 +358,8 @@ void *avi_converter_from_mjpeg (AviMovie *movie, int stream, unsigned char *buff return buf; } -void *avi_converter_to_mjpeg (AviMovie *movie, int stream, unsigned char *buffer, int *size) { +void *avi_converter_to_mjpeg (AviMovie *movie, int stream, unsigned char *buffer, int *size) +{ unsigned char *buf; int bufsize= *size; @@ -380,22 +390,26 @@ void *avi_converter_to_mjpeg (AviMovie *movie, int stream, unsigned char *buffer /* Compression from memory */ -static void jpegmemdestmgr_init_destination(j_compress_ptr cinfo) { +static void jpegmemdestmgr_init_destination(j_compress_ptr cinfo) +{ (void)cinfo; /* unused */ } -static boolean jpegmemdestmgr_empty_output_buffer(j_compress_ptr cinfo) { +static boolean jpegmemdestmgr_empty_output_buffer(j_compress_ptr cinfo) +{ (void)cinfo; /* unused */ return TRUE; } -static void jpegmemdestmgr_term_destination(j_compress_ptr cinfo) { +static void jpegmemdestmgr_term_destination(j_compress_ptr cinfo) +{ numbytes-= cinfo->dest->free_in_buffer; MEM_freeN(cinfo->dest); } -static void jpegmemdestmgr_build(j_compress_ptr cinfo, unsigned char *buffer, int bufsize) { +static void jpegmemdestmgr_build(j_compress_ptr cinfo, unsigned char *buffer, int bufsize) +{ cinfo->dest= MEM_mallocN(sizeof(*(cinfo->dest)), "avi.jpegmemdestmgr_build"); cinfo->dest->init_destination= jpegmemdestmgr_init_destination; @@ -410,11 +424,13 @@ static void jpegmemdestmgr_build(j_compress_ptr cinfo, unsigned char *buffer, in /* Decompression from memory */ -static void jpegmemsrcmgr_init_source(j_decompress_ptr dinfo) { +static void jpegmemsrcmgr_init_source(j_decompress_ptr dinfo) +{ (void)dinfo; } -static boolean jpegmemsrcmgr_fill_input_buffer(j_decompress_ptr dinfo) { +static boolean jpegmemsrcmgr_fill_input_buffer(j_decompress_ptr dinfo) +{ unsigned char *buf= (unsigned char*) dinfo->src->next_input_byte-2; /* if we get called, must have run out of data */ @@ -429,7 +445,8 @@ static boolean jpegmemsrcmgr_fill_input_buffer(j_decompress_ptr dinfo) { return TRUE; } -static void jpegmemsrcmgr_skip_input_data(j_decompress_ptr dinfo, long skipcnt) { +static void jpegmemsrcmgr_skip_input_data(j_decompress_ptr dinfo, long skipcnt) +{ if (dinfo->src->bytes_in_buffer<skipcnt) skipcnt= dinfo->src->bytes_in_buffer; @@ -437,13 +454,15 @@ static void jpegmemsrcmgr_skip_input_data(j_decompress_ptr dinfo, long skipcnt) dinfo->src->bytes_in_buffer-= skipcnt; } -static void jpegmemsrcmgr_term_source(j_decompress_ptr dinfo) { +static void jpegmemsrcmgr_term_source(j_decompress_ptr dinfo) +{ numbytes-= dinfo->src->bytes_in_buffer; MEM_freeN(dinfo->src); } -static void jpegmemsrcmgr_build(j_decompress_ptr dinfo, unsigned char *buffer, int bufsize) { +static void jpegmemsrcmgr_build(j_decompress_ptr dinfo, unsigned char *buffer, int bufsize) +{ dinfo->src= MEM_mallocN(sizeof(*(dinfo->src)), "avi.jpegmemsrcmgr_build"); dinfo->src->init_source= jpegmemsrcmgr_init_source; diff --git a/source/blender/avi/intern/options.c b/source/blender/avi/intern/options.c index bda153d0cd3..483b708bee6 100644 --- a/source/blender/avi/intern/options.c +++ b/source/blender/avi/intern/options.c @@ -43,7 +43,8 @@ /* avi_set_compress_options gets its own file... now don't WE feel important? */ -AviError AVI_set_compress_option (AviMovie *movie, int option_type, int stream, AviOption option, void *opt_data) { +AviError AVI_set_compress_option (AviMovie *movie, int option_type, int stream, AviOption option, void *opt_data) +{ int i; int useconds; diff --git a/source/blender/avi/intern/rgb32.c b/source/blender/avi/intern/rgb32.c index 4d088377c9e..e3be082cca6 100644 --- a/source/blender/avi/intern/rgb32.c +++ b/source/blender/avi/intern/rgb32.c @@ -40,7 +40,8 @@ #include "MEM_guardedalloc.h" #include "rgb32.h" -void *avi_converter_from_rgb32 (AviMovie *movie, int stream, unsigned char *buffer, int *size) { +void *avi_converter_from_rgb32 (AviMovie *movie, int stream, unsigned char *buffer, int *size) +{ int y, x, rowstridea, rowstrideb; unsigned char *buf; @@ -65,7 +66,8 @@ void *avi_converter_from_rgb32 (AviMovie *movie, int stream, unsigned char *buff return buf; } -void *avi_converter_to_rgb32 (AviMovie *movie, int stream, unsigned char *buffer, int *size) { +void *avi_converter_to_rgb32 (AviMovie *movie, int stream, unsigned char *buffer, int *size) +{ int i; unsigned char *buf; unsigned char *to, *from; diff --git a/source/blender/blenkernel/intern/boids.c b/source/blender/blenkernel/intern/boids.c index 6656d06e72e..ec2e6b3c078 100644 --- a/source/blender/blenkernel/intern/boids.c +++ b/source/blender/blenkernel/intern/boids.c @@ -1514,7 +1514,8 @@ BoidState *boid_new_state(BoidSettings *boids) return state; } -BoidState *boid_duplicate_state(BoidSettings *boids, BoidState *state) { +BoidState *boid_duplicate_state(BoidSettings *boids, BoidState *state) +{ BoidState *staten = MEM_dupallocN(state); BLI_duplicatelist(&staten->rules, &state->rules); diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c index 6efd0a2727f..c88b21e2813 100644 --- a/source/blender/blenkernel/intern/customdata.c +++ b/source/blender/blenkernel/intern/customdata.c @@ -1995,7 +1995,8 @@ void CustomData_to_bmeshpoly(CustomData *fdata, CustomData *pdata, CustomData *l CustomData_add_layer(ldata, CD_MLOOPCOL, CD_CALLOC, &(fdata->layers[i].name), 0); } } -void CustomData_from_bmeshpoly(CustomData *fdata, CustomData *pdata, CustomData *ldata, int total){ +void CustomData_from_bmeshpoly(CustomData *fdata, CustomData *pdata, CustomData *ldata, int total) +{ int i; for(i=0; i < pdata->totlayer; i++){ if(pdata->layers[i].type == CD_MTEXPOLY) @@ -2008,7 +2009,8 @@ void CustomData_from_bmeshpoly(CustomData *fdata, CustomData *pdata, CustomData } -void CustomData_bmesh_init_pool(CustomData *data, int allocsize){ +void CustomData_bmesh_init_pool(CustomData *data, int allocsize) +{ if(data->totlayer)data->pool = BLI_mempool_create(data->totsize, allocsize, allocsize, FALSE, FALSE); } diff --git a/source/blender/blenkernel/intern/ocean.c b/source/blender/blenkernel/intern/ocean.c index ae622358fd2..15ce2e377b6 100644 --- a/source/blender/blenkernel/intern/ocean.c +++ b/source/blender/blenkernel/intern/ocean.c @@ -1343,7 +1343,8 @@ typedef struct Ocean { } Ocean; -float BKE_ocean_jminus_to_foam(float UNUSED(jminus), float UNUSED(coverage)) { +float BKE_ocean_jminus_to_foam(float UNUSED(jminus), float UNUSED(coverage)) +{ return 0.0f; } diff --git a/source/blender/blenkernel/intern/suggestions.c b/source/blender/blenkernel/intern/suggestions.c index 48bc4926a85..e1e872c42b6 100644 --- a/source/blender/blenkernel/intern/suggestions.c +++ b/source/blender/blenkernel/intern/suggestions.c @@ -47,7 +47,8 @@ static SuggList suggestions = {NULL, NULL, NULL, NULL, NULL}; static char *documentation = NULL; //static int doc_lines = 0; -static int txttl_cmp(const char *first, const char *second, int len) { +static int txttl_cmp(const char *first, const char *second, int len) +{ int cmp, i; for (cmp=0, i=0; i<len; i++) { if ( (cmp= toupper(first[i])-toupper(second[i])) ) { @@ -57,7 +58,8 @@ static int txttl_cmp(const char *first, const char *second, int len) { return cmp; } -static void txttl_free_suggest(void) { +static void txttl_free_suggest(void) +{ SuggItem *item, *prev; for (item = suggestions.last; item; item=prev) { prev = item->prev; @@ -69,7 +71,8 @@ static void txttl_free_suggest(void) { suggestions.top = 0; } -static void txttl_free_docs(void) { +static void txttl_free_docs(void) +{ if (documentation) { MEM_freeN(documentation); documentation = NULL; @@ -80,23 +83,27 @@ static void txttl_free_docs(void) { /* General tool functions */ /**************************/ -void free_texttools(void) { +void free_texttools(void) +{ txttl_free_suggest(); txttl_free_docs(); } -void texttool_text_set_active(Text *text) { +void texttool_text_set_active(Text *text) +{ if (activeToolText == text) return; texttool_text_clear(); activeToolText = text; } -void texttool_text_clear(void) { +void texttool_text_clear(void) +{ free_texttools(); activeToolText = NULL; } -short texttool_text_is_active(Text *text) { +short texttool_text_is_active(Text *text) +{ return activeToolText==text ? 1 : 0; } @@ -104,7 +111,8 @@ short texttool_text_is_active(Text *text) { /* Suggestion list methods */ /***************************/ -void texttool_suggest_add(const char *name, char type) { +void texttool_suggest_add(const char *name, char type) +{ SuggItem *newitem, *item; int len, cmp; @@ -154,7 +162,8 @@ void texttool_suggest_add(const char *name, char type) { suggestions.top= 0; } -void texttool_suggest_prefix(const char *prefix) { +void texttool_suggest_prefix(const char *prefix) +{ SuggItem *match, *first, *last; int cmp, len = strlen(prefix), top = 0; @@ -194,27 +203,33 @@ void texttool_suggest_prefix(const char *prefix) { } } -void texttool_suggest_clear(void) { +void texttool_suggest_clear(void) +{ txttl_free_suggest(); } -SuggItem *texttool_suggest_first(void) { +SuggItem *texttool_suggest_first(void) +{ return suggestions.firstmatch; } -SuggItem *texttool_suggest_last(void) { +SuggItem *texttool_suggest_last(void) +{ return suggestions.lastmatch; } -void texttool_suggest_select(SuggItem *sel) { +void texttool_suggest_select(SuggItem *sel) +{ suggestions.selected = sel; } -SuggItem *texttool_suggest_selected(void) { +SuggItem *texttool_suggest_selected(void) +{ return suggestions.selected; } -int *texttool_suggest_top(void) { +int *texttool_suggest_top(void) +{ return &suggestions.top; } @@ -222,7 +237,8 @@ int *texttool_suggest_top(void) { /* Documentation methods */ /*************************/ -void texttool_docs_show(const char *docs) { +void texttool_docs_show(const char *docs) +{ int len; if (!docs) return; @@ -246,10 +262,12 @@ void texttool_docs_show(const char *docs) { documentation[len] = '\0'; } -char *texttool_docs_get(void) { +char *texttool_docs_get(void) +{ return documentation; } -void texttool_docs_clear(void) { +void texttool_docs_clear(void) +{ txttl_free_docs(); } diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c index 60cc029bf6e..7e102bc9854 100644 --- a/source/blender/blenkernel/intern/text.c +++ b/source/blender/blenkernel/intern/text.c @@ -2851,7 +2851,8 @@ void txt_add_marker(Text *text, TextLine *line, int start, int end, const unsign /* Returns the first matching marker on the specified line between two points. If the group or flags fields are non-zero the returned flag must be in the specified group and have at least the specified flags set. */ -TextMarker *txt_find_marker_region(Text *text, TextLine *line, int start, int end, int group, int flags) { +TextMarker *txt_find_marker_region(Text *text, TextLine *line, int start, int end, int group, int flags) +{ TextMarker *marker, *next; int lineno= txt_get_span(text->lines.first, line); @@ -2918,7 +2919,8 @@ short txt_clear_markers(Text *text, int group, int flags) /* Finds the marker at the specified line and cursor position with at least the specified flags set in the given group (if non-zero). */ -TextMarker *txt_find_marker(Text *text, TextLine *line, int curs, int group, int flags) { +TextMarker *txt_find_marker(Text *text, TextLine *line, int curs, int group, int flags) +{ TextMarker *marker; int lineno= txt_get_span(text->lines.first, line); @@ -2936,7 +2938,8 @@ TextMarker *txt_find_marker(Text *text, TextLine *line, int curs, int group, int /* Finds the previous marker in the same group. If no other is found, the same marker will be returned */ -TextMarker *txt_prev_marker(Text *text, TextMarker *marker) { +TextMarker *txt_prev_marker(Text *text, TextMarker *marker) +{ TextMarker *tmp= marker; while (tmp) { if (tmp->prev) tmp= tmp->prev; @@ -2949,7 +2952,8 @@ TextMarker *txt_prev_marker(Text *text, TextMarker *marker) { /* Finds the next marker in the same group. If no other is found, the same marker will be returned */ -TextMarker *txt_next_marker(Text *text, TextMarker *marker) { +TextMarker *txt_next_marker(Text *text, TextMarker *marker) +{ TextMarker *tmp= marker; while (tmp) { if (tmp->next) tmp= tmp->next; diff --git a/source/blender/blenlib/BLI_ghash.h b/source/blender/blenlib/BLI_ghash.h index 5b9db7113cb..f2a7e73e5e0 100644 --- a/source/blender/blenlib/BLI_ghash.h +++ b/source/blender/blenlib/BLI_ghash.h @@ -150,7 +150,7 @@ typedef struct GHashPair { GHashPair* BLI_ghashutil_pairalloc (const void *first, int second); unsigned int BLI_ghashutil_pairhash (const void *ptr); int BLI_ghashutil_paircmp (const void *a, const void *b); -void BLI_ghashutil_pairfree (const void *ptr); +void BLI_ghashutil_pairfree (void *ptr); #ifdef __cplusplus } diff --git a/source/blender/blenlib/intern/BLI_dynstr.c b/source/blender/blenlib/intern/BLI_dynstr.c index 5cdadce7c01..349bc3492e7 100644 --- a/source/blender/blenlib/intern/BLI_dynstr.c +++ b/source/blender/blenlib/intern/BLI_dynstr.c @@ -94,7 +94,8 @@ void BLI_dynstr_append(DynStr *ds, const char *cstr) ds->curlen+= cstrlen; } -void BLI_dynstr_nappend(DynStr *ds, const char *cstr, int len) { +void BLI_dynstr_nappend(DynStr *ds, const char *cstr, int len) +{ DynStrElem *dse= malloc(sizeof(*dse)); int cstrlen= BLI_strnlen(cstr, len); @@ -225,7 +226,8 @@ int BLI_dynstr_get_len(DynStr *ds) return ds->curlen; } -char *BLI_dynstr_get_cstring(DynStr *ds) { +char *BLI_dynstr_get_cstring(DynStr *ds) +{ char *s, *rets= MEM_mallocN(ds->curlen+1, "dynstr_cstring"); DynStrElem *dse; @@ -241,7 +243,8 @@ char *BLI_dynstr_get_cstring(DynStr *ds) { return rets; } -void BLI_dynstr_free(DynStr *ds) { +void BLI_dynstr_free(DynStr *ds) +{ DynStrElem *dse; for (dse= ds->elems; dse; ) { diff --git a/source/blender/blenlib/intern/BLI_ghash.c b/source/blender/blenlib/intern/BLI_ghash.c index 13f33f01420..9f388b68c38 100644 --- a/source/blender/blenlib/intern/BLI_ghash.c +++ b/source/blender/blenlib/intern/BLI_ghash.c @@ -56,7 +56,8 @@ static unsigned int hashsizes[]= { /***/ -GHash *BLI_ghash_new(GHashHashFP hashfp, GHashCmpFP cmpfp, const char *info) { +GHash *BLI_ghash_new(GHashHashFP hashfp, GHashCmpFP cmpfp, const char *info) +{ GHash *gh= MEM_mallocN(sizeof(*gh), info); gh->hashfp= hashfp; gh->cmpfp= cmpfp; @@ -72,11 +73,13 @@ GHash *BLI_ghash_new(GHashHashFP hashfp, GHashCmpFP cmpfp, const char *info) { return gh; } -int BLI_ghash_size(GHash *gh) { +int BLI_ghash_size(GHash *gh) +{ return gh->nentries; } -void BLI_ghash_insert(GHash *gh, void *key, void *val) { +void BLI_ghash_insert(GHash *gh, void *key, void *val) +{ unsigned int hash= gh->hashfp(key)%gh->nbuckets; Entry *e= (Entry*) BLI_mempool_alloc(gh->entrypool); @@ -109,7 +112,8 @@ void BLI_ghash_insert(GHash *gh, void *key, void *val) { } } -void *BLI_ghash_lookup(GHash *gh, const void *key) { +void *BLI_ghash_lookup(GHash *gh, const void *key) +{ if(gh) { unsigned int hash= gh->hashfp(key)%gh->nbuckets; Entry *e; @@ -151,7 +155,8 @@ int BLI_ghash_remove (GHash *gh, void *key, GHashKeyFreeFP keyfreefp, GHashValFr return 0; } -int BLI_ghash_haskey(GHash *gh, void *key) { +int BLI_ghash_haskey(GHash *gh, void *key) +{ unsigned int hash= gh->hashfp(key)%gh->nbuckets; Entry *e; @@ -162,7 +167,8 @@ int BLI_ghash_haskey(GHash *gh, void *key) { return 0; } -void BLI_ghash_free(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp) { +void BLI_ghash_free(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp) +{ int i; if (keyfreefp || valfreefp) { @@ -190,7 +196,8 @@ void BLI_ghash_free(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreef /***/ -GHashIterator *BLI_ghashIterator_new(GHash *gh) { +GHashIterator *BLI_ghashIterator_new(GHash *gh) +{ GHashIterator *ghi= MEM_mallocN(sizeof(*ghi), "ghash iterator"); ghi->gh= gh; ghi->curEntry= NULL; @@ -203,7 +210,8 @@ GHashIterator *BLI_ghashIterator_new(GHash *gh) { } return ghi; } -void BLI_ghashIterator_init(GHashIterator *ghi, GHash *gh) { +void BLI_ghashIterator_init(GHashIterator *ghi, GHash *gh) +{ ghi->gh= gh; ghi->curEntry= NULL; ghi->curBucket= -1; @@ -214,18 +222,22 @@ void BLI_ghashIterator_init(GHashIterator *ghi, GHash *gh) { ghi->curEntry= ghi->gh->buckets[ghi->curBucket]; } } -void BLI_ghashIterator_free(GHashIterator *ghi) { +void BLI_ghashIterator_free(GHashIterator *ghi) +{ MEM_freeN(ghi); } -void *BLI_ghashIterator_getKey(GHashIterator *ghi) { +void *BLI_ghashIterator_getKey(GHashIterator *ghi) +{ return ghi->curEntry?ghi->curEntry->key:NULL; } -void *BLI_ghashIterator_getValue(GHashIterator *ghi) { +void *BLI_ghashIterator_getValue(GHashIterator *ghi) +{ return ghi->curEntry?ghi->curEntry->val:NULL; } -void BLI_ghashIterator_step(GHashIterator *ghi) { +void BLI_ghashIterator_step(GHashIterator *ghi) +{ if (ghi->curEntry) { ghi->curEntry= ghi->curEntry->next; while (!ghi->curEntry) { @@ -236,23 +248,27 @@ void BLI_ghashIterator_step(GHashIterator *ghi) { } } } -int BLI_ghashIterator_isDone(GHashIterator *ghi) { +int BLI_ghashIterator_isDone(GHashIterator *ghi) +{ return !ghi->curEntry; } /***/ -unsigned int BLI_ghashutil_ptrhash(const void *key) { +unsigned int BLI_ghashutil_ptrhash(const void *key) +{ return (unsigned int)(intptr_t)key; } -int BLI_ghashutil_ptrcmp(const void *a, const void *b) { +int BLI_ghashutil_ptrcmp(const void *a, const void *b) +{ if (a==b) return 0; else return (a<b)?-1:1; } -unsigned int BLI_ghashutil_inthash(const void *ptr) { +unsigned int BLI_ghashutil_inthash(const void *ptr) +{ uintptr_t key = (uintptr_t)ptr; key += ~(key << 16); @@ -265,14 +281,16 @@ unsigned int BLI_ghashutil_inthash(const void *ptr) { return (unsigned int)(key & 0xffffffff); } -int BLI_ghashutil_intcmp(const void *a, const void *b) { +int BLI_ghashutil_intcmp(const void *a, const void *b) +{ if (a==b) return 0; else return (a<b)?-1:1; } -unsigned int BLI_ghashutil_strhash(const void *ptr) { +unsigned int BLI_ghashutil_strhash(const void *ptr) +{ const char *s= ptr; unsigned int i= 0; unsigned char c; @@ -282,24 +300,28 @@ unsigned int BLI_ghashutil_strhash(const void *ptr) { return i; } -int BLI_ghashutil_strcmp(const void *a, const void *b) { +int BLI_ghashutil_strcmp(const void *a, const void *b) +{ return strcmp(a, b); } -GHashPair *BLI_ghashutil_pairalloc(const void *first, int second) { +GHashPair *BLI_ghashutil_pairalloc(const void *first, int second) +{ GHashPair *pair = MEM_mallocN(sizeof(GHashPair), "GHashPair"); pair->first = first; pair->second = second; return pair; } -unsigned int BLI_ghashutil_pairhash(const void *ptr) { +unsigned int BLI_ghashutil_pairhash(const void *ptr) +{ const GHashPair *pair = ptr; unsigned int hash = BLI_ghashutil_ptrhash(pair->first); return hash ^ BLI_ghashutil_inthash(SET_INT_IN_POINTER(pair->second)); } -int BLI_ghashutil_paircmp(const void *a, const void *b) { +int BLI_ghashutil_paircmp(const void *a, const void *b) +{ const GHashPair *A = a; const GHashPair *B = b; @@ -309,7 +331,8 @@ int BLI_ghashutil_paircmp(const void *a, const void *b) { return cmp; } -void BLI_ghashutil_pairfree(const void *ptr) { +void BLI_ghashutil_pairfree(void *ptr) +{ MEM_freeN((void*)ptr); } diff --git a/source/blender/blenlib/intern/BLI_linklist.c b/source/blender/blenlib/intern/BLI_linklist.c index a9b8cbb6467..6300817ec03 100644 --- a/source/blender/blenlib/intern/BLI_linklist.c +++ b/source/blender/blenlib/intern/BLI_linklist.c @@ -35,7 +35,8 @@ #include "BLI_linklist.h" #include "BLI_memarena.h" -int BLI_linklist_length(LinkNode *list) { +int BLI_linklist_length(LinkNode *list) +{ if (0) { return list?(1+BLI_linklist_length(list->next)):0; } else { @@ -70,7 +71,8 @@ LinkNode *BLI_linklist_find(LinkNode *list, int index) return NULL; } -void BLI_linklist_reverse(LinkNode **listp) { +void BLI_linklist_reverse(LinkNode **listp) +{ LinkNode *rhead= NULL, *cur= *listp; while (cur) { @@ -85,7 +87,8 @@ void BLI_linklist_reverse(LinkNode **listp) { *listp= rhead; } -void BLI_linklist_prepend(LinkNode **listp, void *ptr) { +void BLI_linklist_prepend(LinkNode **listp, void *ptr) +{ LinkNode *nlink= MEM_mallocN(sizeof(*nlink), "nlink"); nlink->link= ptr; @@ -93,7 +96,8 @@ void BLI_linklist_prepend(LinkNode **listp, void *ptr) { *listp= nlink; } -void BLI_linklist_append(LinkNode **listp, void *ptr) { +void BLI_linklist_append(LinkNode **listp, void *ptr) +{ LinkNode *nlink= MEM_mallocN(sizeof(*nlink), "nlink"); LinkNode *node = *listp; @@ -110,7 +114,8 @@ void BLI_linklist_append(LinkNode **listp, void *ptr) { } } -void BLI_linklist_prepend_arena(LinkNode **listp, void *ptr, MemArena *ma) { +void BLI_linklist_prepend_arena(LinkNode **listp, void *ptr, MemArena *ma) +{ LinkNode *nlink= BLI_memarena_alloc(ma, sizeof(*nlink)); nlink->link= ptr; @@ -118,7 +123,8 @@ void BLI_linklist_prepend_arena(LinkNode **listp, void *ptr, MemArena *ma) { *listp= nlink; } -void BLI_linklist_insert_after(LinkNode **listp, void *ptr) { +void BLI_linklist_insert_after(LinkNode **listp, void *ptr) +{ LinkNode *nlink= MEM_mallocN(sizeof(*nlink), "nlink"); LinkNode *node = *listp; @@ -134,7 +140,8 @@ void BLI_linklist_insert_after(LinkNode **listp, void *ptr) { } } -void BLI_linklist_free(LinkNode *list, LinkNodeFreeFP freefunc) { +void BLI_linklist_free(LinkNode *list, LinkNodeFreeFP freefunc) +{ while (list) { LinkNode *next= list->next; @@ -146,7 +153,8 @@ void BLI_linklist_free(LinkNode *list, LinkNodeFreeFP freefunc) { } } -void BLI_linklist_apply(LinkNode *list, LinkNodeApplyFP applyfunc, void *userdata) { +void BLI_linklist_apply(LinkNode *list, LinkNodeApplyFP applyfunc, void *userdata) +{ for (; list; list= list->next) applyfunc(list->link, userdata); } diff --git a/source/blender/blenlib/intern/BLI_memarena.c b/source/blender/blenlib/intern/BLI_memarena.c index 308fc6a61e6..4debe1a4b04 100644 --- a/source/blender/blenlib/intern/BLI_memarena.c +++ b/source/blender/blenlib/intern/BLI_memarena.c @@ -48,7 +48,8 @@ struct MemArena { LinkNode *bufs; }; -MemArena *BLI_memarena_new(int bufsize, const char *name) { +MemArena *BLI_memarena_new(int bufsize, const char *name) +{ MemArena *ma= MEM_callocN(sizeof(*ma), "memarena"); ma->bufsize= bufsize; ma->align = 8; @@ -57,20 +58,24 @@ MemArena *BLI_memarena_new(int bufsize, const char *name) { return ma; } -void BLI_memarena_use_calloc(MemArena *ma) { +void BLI_memarena_use_calloc(MemArena *ma) +{ ma->use_calloc= 1; } -void BLI_memarena_use_malloc(MemArena *ma) { +void BLI_memarena_use_malloc(MemArena *ma) +{ ma->use_calloc= 0; } -void BLI_memarena_use_align(struct MemArena *ma, int align) { +void BLI_memarena_use_align(struct MemArena *ma, int align) +{ /* align should be a power of two */ ma->align = align; } -void BLI_memarena_free(MemArena *ma) { +void BLI_memarena_free(MemArena *ma) +{ BLI_linklist_free(ma->bufs, (void(*)(void*)) MEM_freeN); MEM_freeN(ma); } @@ -78,7 +83,8 @@ void BLI_memarena_free(MemArena *ma) { /* amt must be power of two */ #define PADUP(num, amt) ((num+(amt-1))&~(amt-1)) -void *BLI_memarena_alloc(MemArena *ma, int size) { +void *BLI_memarena_alloc(MemArena *ma, int size) +{ void *ptr; /* ensure proper alignment by rounding diff --git a/source/blender/blenlib/intern/edgehash.c b/source/blender/blenlib/intern/edgehash.c index 0eda3e78824..7ae68101154 100644 --- a/source/blender/blenlib/intern/edgehash.c +++ b/source/blender/blenlib/intern/edgehash.c @@ -64,7 +64,8 @@ struct EdgeHash { /***/ -EdgeHash *BLI_edgehash_new(void) { +EdgeHash *BLI_edgehash_new(void) +{ EdgeHash *eh= MEM_mallocN(sizeof(*eh), "EdgeHash"); eh->cursize= 0; eh->nentries= 0; @@ -76,7 +77,8 @@ EdgeHash *BLI_edgehash_new(void) { return eh; } -void BLI_edgehash_insert(EdgeHash *eh, int v0, int v1, void *val) { +void BLI_edgehash_insert(EdgeHash *eh, int v0, int v1, void *val) +{ unsigned int hash; Entry *e= malloc(sizeof(*e)); @@ -117,7 +119,8 @@ void BLI_edgehash_insert(EdgeHash *eh, int v0, int v1, void *val) { } } -void** BLI_edgehash_lookup_p(EdgeHash *eh, int v0, int v1) { +void** BLI_edgehash_lookup_p(EdgeHash *eh, int v0, int v1) +{ unsigned int hash; Entry *e; @@ -134,21 +137,25 @@ void** BLI_edgehash_lookup_p(EdgeHash *eh, int v0, int v1) { return NULL; } -void* BLI_edgehash_lookup(EdgeHash *eh, int v0, int v1) { +void* BLI_edgehash_lookup(EdgeHash *eh, int v0, int v1) +{ void **value_p = BLI_edgehash_lookup_p(eh,v0,v1); return value_p?*value_p:NULL; } -int BLI_edgehash_haskey(EdgeHash *eh, int v0, int v1) { +int BLI_edgehash_haskey(EdgeHash *eh, int v0, int v1) +{ return BLI_edgehash_lookup_p(eh, v0, v1)!=NULL; } -int BLI_edgehash_size(EdgeHash *eh) { +int BLI_edgehash_size(EdgeHash *eh) +{ return eh->nentries; } -void BLI_edgehash_clear(EdgeHash *eh, EdgeHashFreeFP valfreefp) { +void BLI_edgehash_clear(EdgeHash *eh, EdgeHashFreeFP valfreefp) +{ int i; for (i=0; i<eh->nbuckets; i++) { @@ -168,7 +175,8 @@ void BLI_edgehash_clear(EdgeHash *eh, EdgeHashFreeFP valfreefp) { eh->nentries= 0; } -void BLI_edgehash_free(EdgeHash *eh, EdgeHashFreeFP valfreefp) { +void BLI_edgehash_free(EdgeHash *eh, EdgeHashFreeFP valfreefp) +{ BLI_edgehash_clear(eh, valfreefp); free(eh->buckets); @@ -184,7 +192,8 @@ struct EdgeHashIterator { Entry *curEntry; }; -EdgeHashIterator *BLI_edgehashIterator_new(EdgeHash *eh) { +EdgeHashIterator *BLI_edgehashIterator_new(EdgeHash *eh) +{ EdgeHashIterator *ehi= malloc(sizeof(*ehi)); ehi->eh= eh; ehi->curEntry= NULL; @@ -197,26 +206,31 @@ EdgeHashIterator *BLI_edgehashIterator_new(EdgeHash *eh) { } return ehi; } -void BLI_edgehashIterator_free(EdgeHashIterator *ehi) { +void BLI_edgehashIterator_free(EdgeHashIterator *ehi) +{ free(ehi); } -void BLI_edgehashIterator_getKey(EdgeHashIterator *ehi, int *v0_r, int *v1_r) { +void BLI_edgehashIterator_getKey(EdgeHashIterator *ehi, int *v0_r, int *v1_r) +{ if (ehi->curEntry) { *v0_r = ehi->curEntry->v0; *v1_r = ehi->curEntry->v1; } } -void *BLI_edgehashIterator_getValue(EdgeHashIterator *ehi) { +void *BLI_edgehashIterator_getValue(EdgeHashIterator *ehi) +{ return ehi->curEntry?ehi->curEntry->val:NULL; } -void BLI_edgehashIterator_setValue(EdgeHashIterator *ehi, void *val) { +void BLI_edgehashIterator_setValue(EdgeHashIterator *ehi, void *val) +{ if(ehi->curEntry) ehi->curEntry->val= val; } -void BLI_edgehashIterator_step(EdgeHashIterator *ehi) { +void BLI_edgehashIterator_step(EdgeHashIterator *ehi) +{ if (ehi->curEntry) { ehi->curEntry= ehi->curEntry->next; while (!ehi->curEntry) { @@ -227,7 +241,8 @@ void BLI_edgehashIterator_step(EdgeHashIterator *ehi) { } } } -int BLI_edgehashIterator_isDone(EdgeHashIterator *ehi) { +int BLI_edgehashIterator_isDone(EdgeHashIterator *ehi) +{ return !ehi->curEntry; } diff --git a/source/blender/blenlib/intern/rand.c b/source/blender/blenlib/intern/rand.c index b1b7ebed18e..28dc5a696d5 100644 --- a/source/blender/blenlib/intern/rand.c +++ b/source/blender/blenlib/intern/rand.c @@ -78,11 +78,13 @@ void rng_free(RNG* rng) MEM_freeN(rng); } -void rng_seed(RNG *rng, unsigned int seed) { +void rng_seed(RNG *rng, unsigned int seed) +{ rng->X= (((r_uint64) seed)<<16) | LOWSEED; } -void rng_srandom(RNG *rng, unsigned int seed) { +void rng_srandom(RNG *rng, unsigned int seed) +{ rng_seed(rng, seed + hash[seed & 255]); seed= rng_getInt(rng); rng_seed(rng, seed + hash[seed & 255]); @@ -90,16 +92,19 @@ void rng_srandom(RNG *rng, unsigned int seed) { rng_seed(rng, seed + hash[seed & 255]); } -int rng_getInt(RNG *rng) { +int rng_getInt(RNG *rng) +{ rng->X= (MULTIPLIER*rng->X + ADDEND)&MASK; return (int) (rng->X>>17); } -double rng_getDouble(RNG *rng) { +double rng_getDouble(RNG *rng) +{ return (double) rng_getInt(rng)/0x80000000; } -float rng_getFloat(RNG *rng) { +float rng_getFloat(RNG *rng) +{ return (float) rng_getInt(rng)/0x80000000; } @@ -135,28 +140,34 @@ void rng_skip(RNG *rng, int n) static RNG theBLI_rng = {0}; /* note, this one creates periodical patterns */ -void BLI_srand(unsigned int seed) { +void BLI_srand(unsigned int seed) +{ rng_seed(&theBLI_rng, seed); } /* using hash table to create better seed */ -void BLI_srandom(unsigned int seed) { +void BLI_srandom(unsigned int seed) +{ rng_srandom(&theBLI_rng, seed); } -int BLI_rand(void) { +int BLI_rand(void) +{ return rng_getInt(&theBLI_rng); } -double BLI_drand(void) { +double BLI_drand(void) +{ return rng_getDouble(&theBLI_rng); } -float BLI_frand(void) { +float BLI_frand(void) +{ return rng_getFloat(&theBLI_rng); } -void BLI_fillrand(void *addr, int len) { +void BLI_fillrand(void *addr, int len) +{ RNG rng; unsigned char *p= addr; @@ -188,11 +199,13 @@ void BLI_thread_srandom(int thread, unsigned int seed) rng_seed(&rng_tab[thread], seed + hash[seed & 255]); } -int BLI_thread_rand(int thread) { +int BLI_thread_rand(int thread) +{ return rng_getInt(&rng_tab[thread]); } -float BLI_thread_frand(int thread) { +float BLI_thread_frand(int thread) +{ return rng_getFloat(&rng_tab[thread]); } diff --git a/source/blender/blenlib/intern/winstuff.c b/source/blender/blenlib/intern/winstuff.c index 1b5bb607386..b2002b63a22 100644 --- a/source/blender/blenlib/intern/winstuff.c +++ b/source/blender/blenlib/intern/winstuff.c @@ -49,7 +49,8 @@ /* FILE_MAX */ -int BLI_getInstallationDir( char * str ) { +int BLI_getInstallationDir( char * str ) +{ char dir[FILE_MAXDIR]; int a; @@ -73,7 +74,8 @@ void RegisterBlendExtension_Fail(HKEY root) TerminateProcess(GetCurrentProcess(),1); } -void RegisterBlendExtension(void) { +void RegisterBlendExtension(void) +{ LONG lresult; HKEY hkey = 0; HKEY root = 0; @@ -167,7 +169,8 @@ void RegisterBlendExtension(void) { TerminateProcess(GetCurrentProcess(),0); } -DIR *opendir (const char *path) { +DIR *opendir (const char *path) +{ if (GetFileAttributes(path) & FILE_ATTRIBUTE_DIRECTORY) { DIR *newd= MEM_mallocN(sizeof(DIR), "opendir"); @@ -185,7 +188,8 @@ DIR *opendir (const char *path) { } } -struct dirent *readdir(DIR *dp) { +struct dirent *readdir(DIR *dp) +{ if (dp->direntry.d_name) { MEM_freeN(dp->direntry.d_name); dp->direntry.d_name= NULL; @@ -208,7 +212,8 @@ struct dirent *readdir(DIR *dp) { } } -int closedir (DIR *dp) { +int closedir (DIR *dp) +{ if (dp->direntry.d_name) MEM_freeN(dp->direntry.d_name); if (dp->handle!=INVALID_HANDLE_VALUE) FindClose(dp->handle); @@ -217,7 +222,8 @@ int closedir (DIR *dp) { return 0; } -void get_default_root(char* root) { +void get_default_root(char* root) +{ char str[MAX_PATH+1]; /* the default drive to resolve a directory without a specified drive diff --git a/source/blender/editors/mesh/mesh_navmesh.c b/source/blender/editors/mesh/mesh_navmesh.c index 48d2c629148..973659cbb35 100644 --- a/source/blender/editors/mesh/mesh_navmesh.c +++ b/source/blender/editors/mesh/mesh_navmesh.c @@ -534,7 +534,8 @@ void MESH_OT_navmesh_face_copy(struct wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int compare(const void * a, const void * b){ +static int compare(const void * a, const void * b) +{ return ( *(int*)a - *(int*)b ); } diff --git a/source/blender/editors/physics/physics_pointcache.c b/source/blender/editors/physics/physics_pointcache.c index 0cecfa05b49..62e0e5e201d 100644 --- a/source/blender/editors/physics/physics_pointcache.c +++ b/source/blender/editors/physics/physics_pointcache.c @@ -59,7 +59,8 @@ #include "physics_intern.h" -static int cache_break_test(void *UNUSED(cbd)) { +static int cache_break_test(void *UNUSED(cbd)) +{ return G.afbreek==1; } static int ptcache_bake_all_poll(bContext *C) diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index cee7b19470b..8e6e5d08266 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -376,7 +376,8 @@ static void viewRedrawPost(bContext *C, TransInfo *t) /* ************************** TRANSFORMATIONS **************************** */ -void BIF_selectOrientation(void) { +void BIF_selectOrientation(void) +{ #if 0 // TRANSFORM_FIX_ME short val; char *str_menu = BIF_menustringTransformOrientation("Orientation"); @@ -2547,7 +2548,8 @@ void initResize(TransInfo *t) t->num.increment = t->snap[1]; } -static void headerResize(TransInfo *t, float vec[3], char *str) { +static void headerResize(TransInfo *t, float vec[3], char *str) +{ char tvec[60]; char *spos= str; if (hasNumInput(&t->num)) { @@ -2607,7 +2609,8 @@ static void TransMat3ToSize( float mat[][3], float smat[][3], float *size) } -static void ElementResize(TransInfo *t, TransData *td, float mat[3][3]) { +static void ElementResize(TransInfo *t, TransData *td, float mat[3][3]) +{ float tmat[3][3], smat[3][3], center[3]; float vec[3]; @@ -2904,7 +2907,8 @@ void initRotation(TransInfo *t) copy_v3_v3(t->axis_orig, t->axis); } -static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short around) { +static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short around) +{ float vec[3], totmat[3][3], smat[3][3]; float eul[3], fmat[3][3], quat[4]; float *center = t->center; @@ -3344,7 +3348,8 @@ void initTranslation(TransInfo *t) t->num.increment = t->snap[1]; } -static void headerTranslation(TransInfo *t, float vec[3], char *str) { +static void headerTranslation(TransInfo *t, float vec[3], char *str) +{ char *spos= str; char tvec[60]; char distvec[20]; @@ -3418,7 +3423,8 @@ static void headerTranslation(TransInfo *t, float vec[3], char *str) { (void)spos; } -static void applyTranslation(TransInfo *t, float vec[3]) { +static void applyTranslation(TransInfo *t, float vec[3]) +{ TransData *td = t->data; float tvec[3]; int i; @@ -4099,7 +4105,8 @@ void initBoneSize(TransInfo *t) t->num.increment = t->snap[1]; } -static void headerBoneSize(TransInfo *t, float vec[3], char *str) { +static void headerBoneSize(TransInfo *t, float vec[3], char *str) +{ char tvec[60]; if (hasNumInput(&t->num)) { outputNumInput(&(t->num), tvec); @@ -5302,7 +5309,8 @@ static void headerSeqSlide(TransInfo *t, float val[2], char *str) sprintf(str, "Sequence Slide: %s%s", &tvec[0], t->con.text); } -static void applySeqSlide(TransInfo *t, float val[2]) { +static void applySeqSlide(TransInfo *t, float val[2]) +{ TransData *td = t->data; int i; @@ -5826,7 +5834,8 @@ void initTimeScale(TransInfo *t) t->num.increment = t->snap[1]; } -static void headerTimeScale(TransInfo *t, char *str) { +static void headerTimeScale(TransInfo *t, char *str) +{ char tvec[60]; if (hasNumInput(&t->num)) @@ -5837,7 +5846,8 @@ static void headerTimeScale(TransInfo *t, char *str) { sprintf(str, "ScaleX: %s", &tvec[0]); } -static void applyTimeScale(TransInfo *t) { +static void applyTimeScale(TransInfo *t) +{ Scene *scene = t->scene; TransData *td = t->data; TransData2D *td2d = t->data2d; diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c index bfb96149ed3..b88e57e1861 100644 --- a/source/blender/editors/transform/transform_constraints.c +++ b/source/blender/editors/transform/transform_constraints.c @@ -138,7 +138,8 @@ void constraintNumInput(TransInfo *t, float vec[3]) } } -static void postConstraintChecks(TransInfo *t, float vec[3], float pvec[3]) { +static void postConstraintChecks(TransInfo *t, float vec[3], float pvec[3]) +{ int i = 0; mul_m3_v3(t->con.imtx, vec); @@ -209,7 +210,8 @@ static void viewAxisCorrectCenter(TransInfo *t, float t_con_center[3]) } } -static void axisProjection(TransInfo *t, float axis[3], float in[3], float out[3]) { +static void axisProjection(TransInfo *t, float axis[3], float in[3], float out[3]) +{ float norm[3], vec[3], factor, angle; float t_con_center[3]; @@ -284,7 +286,8 @@ static void axisProjection(TransInfo *t, float axis[3], float in[3], float out[3 } } -static void planeProjection(TransInfo *t, float in[3], float out[3]) { +static void planeProjection(TransInfo *t, float in[3], float out[3]) +{ float vec[3], factor, norm[3]; add_v3_v3v3(vec, in, t->con.center); @@ -547,7 +550,8 @@ static void applyObjectConstraintRot(TransInfo *t, TransData *td, float vec[3], /*--------------------- INTERNAL SETUP CALLS ------------------*/ -void setConstraint(TransInfo *t, float space[3][3], int mode, const char text[]) { +void setConstraint(TransInfo *t, float space[3][3], int mode, const char text[]) +{ strncpy(t->con.text + 1, text, 48); copy_m3_m3(t->con.mtx, space); t->con.mode = mode; @@ -562,7 +566,8 @@ void setConstraint(TransInfo *t, float space[3][3], int mode, const char text[]) t->redraw = 1; } -void setLocalConstraint(TransInfo *t, int mode, const char text[]) { +void setLocalConstraint(TransInfo *t, int mode, const char text[]) +{ if (t->flag & T_EDIT) { float obmat[3][3]; copy_m3_m4(obmat, t->scene->obedit->obmat); @@ -596,7 +601,8 @@ void setLocalConstraint(TransInfo *t, int mode, const char text[]) { ftext is a format string passed to sprintf. It will add the name of the orientation where %s is (logically). */ -void setUserConstraint(TransInfo *t, short orientation, int mode, const char ftext[]) { +void setUserConstraint(TransInfo *t, short orientation, int mode, const char ftext[]) +{ char text[40]; switch(orientation) { @@ -744,7 +750,8 @@ void drawPropCircle(const struct bContext *C, TransInfo *t) } } -static void drawObjectConstraint(TransInfo *t) { +static void drawObjectConstraint(TransInfo *t) +{ int i; TransData * td = t->data; @@ -781,13 +788,15 @@ static void drawObjectConstraint(TransInfo *t) { /*--------------------- START / STOP CONSTRAINTS ---------------------- */ -void startConstraint(TransInfo *t) { +void startConstraint(TransInfo *t) +{ t->con.mode |= CON_APPLY; *t->con.text = ' '; t->num.idx_max = MIN2(getConstraintSpaceDimension(t) - 1, t->idx_max); } -void stopConstraint(TransInfo *t) { +void stopConstraint(TransInfo *t) +{ t->con.mode &= ~(CON_APPLY|CON_SELECT); *t->con.text = '\0'; t->num.idx_max = t->idx_max; @@ -836,7 +845,8 @@ void initSelectConstraint(TransInfo *t, float mtx[3][3]) t->con.applyRot = applyAxisConstraintRot; } -void selectConstraint(TransInfo *t) { +void selectConstraint(TransInfo *t) +{ if (t->con.mode & CON_SELECT) { setNearestAxis(t); startConstraint(t); @@ -970,7 +980,8 @@ void setNearestAxis(TransInfo *t) /*-------------- HELPER FUNCTIONS ----------------*/ -char constraintModeToChar(TransInfo *t) { +char constraintModeToChar(TransInfo *t) +{ if ((t->con.mode & CON_APPLY)==0) { return '\0'; } @@ -990,7 +1001,8 @@ char constraintModeToChar(TransInfo *t) { } -int isLockConstraint(TransInfo *t) { +int isLockConstraint(TransInfo *t) +{ int mode = t->con.mode; if ( (mode & (CON_AXIS0|CON_AXIS1)) == (CON_AXIS0|CON_AXIS1)) diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index fd74458b953..4b6c3a7031b 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -118,7 +118,8 @@ static short constraints_list_needinv(TransInfo *t, ListBase *list); /* ************************** Functions *************************** */ -static void qsort_trans_data(TransInfo *t, TransData *head, TransData *tail, TransData *temp) { +static void qsort_trans_data(TransInfo *t, TransData *head, TransData *tail, TransData *temp) +{ TransData *ihead = head; TransData *itail = tail; *temp = *head; @@ -165,7 +166,8 @@ static void qsort_trans_data(TransInfo *t, TransData *head, TransData *tail, Tra } } -void sort_trans_data_dist(TransInfo *t) { +void sort_trans_data_dist(TransInfo *t) +{ TransData temp; TransData *start = t->data; int i = 1; @@ -1326,7 +1328,8 @@ static void createTransMBallVerts(TransInfo *t) /* ********************* curve/surface ********* */ -static void calc_distanceCurveVerts(TransData *head, TransData *tail) { +static void calc_distanceCurveVerts(TransData *head, TransData *tail) +{ TransData *td, *td_near = NULL; for (td = head; td<=tail; td++) { if (td->flag & TD_SELECTED) { @@ -1371,7 +1374,8 @@ static void calc_distanceCurveVerts(TransData *head, TransData *tail) { } /* Utility function for getting the handle data from bezier's */ -static TransDataCurveHandleFlags *initTransDataCurveHandles(TransData *td, struct BezTriple *bezt) { +static TransDataCurveHandleFlags *initTransDataCurveHandles(TransData *td, struct BezTriple *bezt) +{ TransDataCurveHandleFlags *hdata; td->flag |= TD_BEZTRIPLE; hdata = td->hdata = MEM_mallocN(sizeof(TransDataCurveHandleFlags), "CuHandle Data"); diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c index 442ad662813..3cb35c48f39 100644 --- a/source/blender/editors/transform/transform_orientations.c +++ b/source/blender/editors/transform/transform_orientations.c @@ -127,7 +127,8 @@ void BIF_createTransformOrientation(bContext *C, ReportList *reports, char *name } } -TransformOrientation *createObjectSpace(bContext *C, ReportList *UNUSED(reports), char *name, int overwrite) { +TransformOrientation *createObjectSpace(bContext *C, ReportList *UNUSED(reports), char *name, int overwrite) +{ Base *base = CTX_data_active_base(C); Object *ob; float mat[3][3]; @@ -150,7 +151,8 @@ TransformOrientation *createObjectSpace(bContext *C, ReportList *UNUSED(reports) return addMatrixSpace(C, mat, name, overwrite); } -TransformOrientation *createBoneSpace(bContext *C, ReportList *reports, char *name, int overwrite) { +TransformOrientation *createBoneSpace(bContext *C, ReportList *reports, char *name, int overwrite) +{ float mat[3][3]; float normal[3], plane[3]; @@ -169,7 +171,8 @@ TransformOrientation *createBoneSpace(bContext *C, ReportList *reports, char *na return addMatrixSpace(C, mat, name, overwrite); } -TransformOrientation *createMeshSpace(bContext *C, ReportList *reports, char *name, int overwrite) { +TransformOrientation *createMeshSpace(bContext *C, ReportList *reports, char *name, int overwrite) +{ float mat[3][3]; float normal[3], plane[3]; int type; @@ -267,7 +270,8 @@ int createSpaceNormalTangent(float mat[3][3], float normal[3], float tangent[3]) return 1; } -TransformOrientation* addMatrixSpace(bContext *C, float mat[3][3], char name[], int overwrite) { +TransformOrientation* addMatrixSpace(bContext *C, float mat[3][3], char name[], int overwrite) +{ ListBase *transform_spaces = &CTX_data_scene(C)->transform_spaces; TransformOrientation *ts = NULL; @@ -294,7 +298,8 @@ TransformOrientation* addMatrixSpace(bContext *C, float mat[3][3], char name[], return ts; } -void BIF_removeTransformOrientation(bContext *C, TransformOrientation *target) { +void BIF_removeTransformOrientation(bContext *C, TransformOrientation *target) +{ ListBase *transform_spaces = &CTX_data_scene(C)->transform_spaces; TransformOrientation *ts; int i; @@ -321,7 +326,8 @@ void BIF_removeTransformOrientation(bContext *C, TransformOrientation *target) { } } -void BIF_removeTransformOrientationIndex(bContext *C, int index) { +void BIF_removeTransformOrientationIndex(bContext *C, int index) +{ ListBase *transform_spaces = &CTX_data_scene(C)->transform_spaces; TransformOrientation *ts= BLI_findlink(transform_spaces, index); @@ -344,7 +350,8 @@ void BIF_removeTransformOrientationIndex(bContext *C, int index) { } } -void BIF_selectTransformOrientation(bContext *C, TransformOrientation *target) { +void BIF_selectTransformOrientation(bContext *C, TransformOrientation *target) +{ ListBase *transform_spaces = &CTX_data_scene(C)->transform_spaces; View3D *v3d = CTX_wm_view3d(C); TransformOrientation *ts; @@ -358,7 +365,8 @@ void BIF_selectTransformOrientation(bContext *C, TransformOrientation *target) { } } -void BIF_selectTransformOrientationValue(bContext *C, int orientation) { +void BIF_selectTransformOrientationValue(bContext *C, int orientation) +{ View3D *v3d = CTX_wm_view3d(C); if(v3d) /* currently using generic poll */ v3d->twmode = orientation; @@ -407,7 +415,8 @@ EnumPropertyItem *BIF_enumTransformOrientation(bContext *C) return item; } -const char * BIF_menustringTransformOrientation(const bContext *C, const char *title) { +const char * BIF_menustringTransformOrientation(const bContext *C, const char *title) +{ const char* menu = IFACE_("%t|Global%x0|Local%x1|Gimbal%x4|Normal%x2|View%x3"); ListBase *transform_spaces = &CTX_data_scene(C)->transform_spaces; TransformOrientation *ts; @@ -429,7 +438,8 @@ const char * BIF_menustringTransformOrientation(const bContext *C, const char *t return str_menu; } -int BIF_countTransformOrientation(const bContext *C) { +int BIF_countTransformOrientation(const bContext *C) +{ ListBase *transform_spaces = &CTX_data_scene(C)->transform_spaces; TransformOrientation *ts; int count = 0; @@ -441,7 +451,8 @@ int BIF_countTransformOrientation(const bContext *C) { return count; } -void applyTransformOrientation(const bContext *C, float mat[3][3], char *name) { +void applyTransformOrientation(const bContext *C, float mat[3][3], char *name) +{ TransformOrientation *ts; View3D *v3d = CTX_wm_view3d(C); int selected_index = (v3d->twmode - V3D_MANIP_CUSTOM); diff --git a/source/blender/gpu/intern/gpu_codegen.c b/source/blender/gpu/intern/gpu_codegen.c index cc4b092a071..33796b7c215 100644 --- a/source/blender/gpu/intern/gpu_codegen.c +++ b/source/blender/gpu/intern/gpu_codegen.c @@ -647,11 +647,13 @@ static char *code_generate_vertex(ListBase *nodes) return code; } -int GPU_bicubic_bump_support(void){ +int GPU_bicubic_bump_support(void) +{ return GLEW_ARB_texture_gather && GLEW_ARB_texture_query_lod && GLEW_VERSION_3_0; } -void GPU_code_generate_glsl_lib(void){ +void GPU_code_generate_glsl_lib(void) +{ DynStr *ds; /* only initialize the library once */ diff --git a/source/blender/imbuf/intern/anim_movie.c b/source/blender/imbuf/intern/anim_movie.c index 8928774dcb4..7d0c201a07c 100644 --- a/source/blender/imbuf/intern/anim_movie.c +++ b/source/blender/imbuf/intern/anim_movie.c @@ -110,7 +110,8 @@ #endif #endif -int ismovie(const char *UNUSED(filepath)) { +int ismovie(const char *UNUSED(filepath)) +{ return 0; } @@ -126,7 +127,8 @@ static void free_anim_movie(struct anim *UNUSED(anim)) { ; } # define PATHSEPERATOR '/' #endif -static int an_stringdec(const char *string, char* head, char *tail, unsigned short *numlen) { +static int an_stringdec(const char *string, char* head, char *tail, unsigned short *numlen) +{ unsigned short len,nume,nums=0; short i,found=FALSE; @@ -161,11 +163,13 @@ static int an_stringdec(const char *string, char* head, char *tail, unsigned sho } -static void an_stringenc(char *string, const char *head, const char *tail, unsigned short numlen, int pic) { +static void an_stringenc(char *string, const char *head, const char *tail, unsigned short numlen, int pic) +{ BLI_stringenc(string, head, tail, numlen, pic); } -static void free_anim_avi (struct anim *anim) { +static void free_anim_avi (struct anim *anim) +{ #if defined(_WIN32) && !defined(FREE_WINDOWS) int i; #endif @@ -206,7 +210,8 @@ static void free_anim_ffmpeg(struct anim * anim); static void free_anim_redcode(struct anim * anim); #endif -void IMB_free_anim(struct anim * anim) { +void IMB_free_anim(struct anim * anim) +{ if (anim == NULL) { printf("free anim, anim == NULL\n"); return; @@ -229,14 +234,16 @@ void IMB_free_anim(struct anim * anim) { MEM_freeN(anim); } -void IMB_close_anim(struct anim * anim) { +void IMB_close_anim(struct anim * anim) +{ if (anim == NULL) return; IMB_free_anim(anim); } -struct anim * IMB_open_anim( const char * name, int ib_flags, int streamindex) { +struct anim * IMB_open_anim( const char * name, int ib_flags, int streamindex) +{ struct anim * anim; anim = (struct anim*)MEM_callocN(sizeof(struct anim), "anim struct"); @@ -249,7 +256,8 @@ struct anim * IMB_open_anim( const char * name, int ib_flags, int streamindex) { } -static int startavi (struct anim *anim) { +static int startavi (struct anim *anim) +{ AviError avierror; #if defined(_WIN32) && !defined(FREE_WINDOWS) @@ -355,7 +363,8 @@ static int startavi (struct anim *anim) { return 0; } -static ImBuf * avi_fetchibuf (struct anim *anim, int position) { +static ImBuf * avi_fetchibuf (struct anim *anim, int position) +{ ImBuf *ibuf = NULL; int *tmp; int y; @@ -405,7 +414,8 @@ static ImBuf * avi_fetchibuf (struct anim *anim, int position) { extern void do_init_ffmpeg(void); -static int startffmpeg(struct anim * anim) { +static int startffmpeg(struct anim * anim) +{ int i, videoStream; AVCodec *pCodec; @@ -1032,7 +1042,8 @@ static ImBuf * ffmpeg_fetchibuf(struct anim * anim, int position, return anim->last_frame; } -static void free_anim_ffmpeg(struct anim * anim) { +static void free_anim_ffmpeg(struct anim * anim) +{ if (anim == NULL) return; if (anim->pCodecCtx) { @@ -1058,7 +1069,8 @@ static void free_anim_ffmpeg(struct anim * anim) { #ifdef WITH_REDCODE -static int startredcode(struct anim * anim) { +static int startredcode(struct anim * anim) +{ anim->redcodeCtx = redcode_open(anim->name); if (!anim->redcodeCtx) { return -1; @@ -1068,7 +1080,8 @@ static int startredcode(struct anim * anim) { return 0; } -static ImBuf * redcode_fetchibuf(struct anim * anim, int position) { +static ImBuf * redcode_fetchibuf(struct anim * anim, int position) +{ struct ImBuf * ibuf; struct redcode_frame * frame; struct redcode_frame_raw * raw_frame; @@ -1099,7 +1112,8 @@ static ImBuf * redcode_fetchibuf(struct anim * anim, int position) { return ibuf; } -static void free_anim_redcode(struct anim * anim) { +static void free_anim_redcode(struct anim * anim) +{ if (anim->redcodeCtx) { redcode_close(anim->redcodeCtx); anim->redcodeCtx = 0; @@ -1113,7 +1127,8 @@ static void free_anim_redcode(struct anim * anim) { /* Geen plaatje, probeer dan volgende animatie te openen */ /* gelukt, haal dan eerste plaatje van animatie */ -static struct ImBuf * anim_getnew(struct anim * anim) { +static struct ImBuf * anim_getnew(struct anim * anim) +{ struct ImBuf *ibuf = NULL; if (anim == NULL) return(NULL); @@ -1175,7 +1190,8 @@ static struct ImBuf * anim_getnew(struct anim * anim) { return(ibuf); } -struct ImBuf * IMB_anim_previewframe(struct anim * anim) { +struct ImBuf * IMB_anim_previewframe(struct anim * anim) +{ struct ImBuf * ibuf = NULL; int position = 0; @@ -1282,7 +1298,8 @@ struct ImBuf * IMB_anim_absolute(struct anim * anim, int position, /***/ -int IMB_anim_get_duration(struct anim *anim, IMB_Timecode_Type tc) { +int IMB_anim_get_duration(struct anim *anim, IMB_Timecode_Type tc) +{ struct anim_index * idx; if (tc == IMB_TC_NONE) { return anim->duration; diff --git a/source/blender/imbuf/intern/bmp.c b/source/blender/imbuf/intern/bmp.c index a9c2d72b188..77fc6bdf856 100644 --- a/source/blender/imbuf/intern/bmp.c +++ b/source/blender/imbuf/intern/bmp.c @@ -185,14 +185,16 @@ struct ImBuf *imb_bmp_decode(unsigned char *mem, size_t size, int flags) } /* Couple of helper functions for writing our data */ -static int putIntLSB(unsigned int ui,FILE *ofile) { +static int putIntLSB(unsigned int ui,FILE *ofile) +{ putc((ui>>0)&0xFF,ofile); putc((ui>>8)&0xFF,ofile); putc((ui>>16)&0xFF,ofile); return putc((ui>>24)&0xFF,ofile); } -static int putShortLSB(unsigned short us,FILE *ofile) { +static int putShortLSB(unsigned short us,FILE *ofile) +{ putc((us>>0)&0xFF,ofile); return putc((us>>8)&0xFF,ofile); } diff --git a/source/blender/imbuf/intern/jp2.c b/source/blender/imbuf/intern/jp2.c index 568dd7a9fb7..f8082c95f84 100644 --- a/source/blender/imbuf/intern/jp2.c +++ b/source/blender/imbuf/intern/jp2.c @@ -70,21 +70,24 @@ int imb_is_a_jp2(unsigned char *buf) /** sample error callback expecting a FILE* client object */ -static void error_callback(const char *msg, void *client_data) { +static void error_callback(const char *msg, void *client_data) +{ FILE *stream = (FILE*)client_data; fprintf(stream, "[ERROR] %s", msg); } /** sample warning callback expecting a FILE* client object */ -static void warning_callback(const char *msg, void *client_data) { +static void warning_callback(const char *msg, void *client_data) +{ FILE *stream = (FILE*)client_data; fprintf(stream, "[WARNING] %s", msg); } /** sample debug callback expecting no client object */ -static void info_callback(const char *msg, void *client_data) { +static void info_callback(const char *msg, void *client_data) +{ (void)client_data; fprintf(stdout, "[INFO] %s", msg); } @@ -305,7 +308,8 @@ struct ImBuf *imb_jp2_decode(unsigned char *mem, size_t size, int flags) #define COMP_48_CS 520833 /*Maximum size per color component for 2K @ 48fps*/ -static int initialise_4K_poc(opj_poc_t *POC, int numres){ +static int initialise_4K_poc(opj_poc_t *POC, int numres) +{ POC[0].tile = 1; POC[0].resno0 = 0; POC[0].compno0 = 0; @@ -323,7 +327,8 @@ static int initialise_4K_poc(opj_poc_t *POC, int numres){ return 2; } -static void cinema_parameters(opj_cparameters_t *parameters){ +static void cinema_parameters(opj_cparameters_t *parameters) +{ parameters->tile_size_on = false; parameters->cp_tdx=1; parameters->cp_tdy=1; @@ -356,7 +361,8 @@ static void cinema_parameters(opj_cparameters_t *parameters){ } -static void cinema_setup_encoder(opj_cparameters_t *parameters,opj_image_t *image, img_fol_t *img_fol){ +static void cinema_setup_encoder(opj_cparameters_t *parameters,opj_image_t *image, img_fol_t *img_fol) +{ int i; float temp_rate; @@ -442,8 +448,8 @@ static void cinema_setup_encoder(opj_cparameters_t *parameters,opj_image_t *imag } -static opj_image_t* ibuftoimage(ImBuf *ibuf, opj_cparameters_t *parameters) { - +static opj_image_t* ibuftoimage(ImBuf *ibuf, opj_cparameters_t *parameters) +{ unsigned char *rect; float *rect_float; @@ -662,8 +668,8 @@ static opj_image_t* ibuftoimage(ImBuf *ibuf, opj_cparameters_t *parameters) { /* Found write info at http://users.ece.gatech.edu/~slabaugh/personal/c/bitmapUnix.c */ -int imb_savejp2(struct ImBuf *ibuf, const char *name, int flags) { - +int imb_savejp2(struct ImBuf *ibuf, const char *name, int flags) +{ int quality = ibuf->ftype & 0xff; int bSuccess; diff --git a/source/blender/imbuf/intern/util.c b/source/blender/imbuf/intern/util.c index 872b78743be..47dad378eb7 100644 --- a/source/blender/imbuf/intern/util.c +++ b/source/blender/imbuf/intern/util.c @@ -199,12 +199,14 @@ int IMB_ispic(const char *filename) -static int isavi (const char *name) { +static int isavi (const char *name) +{ return AVI_is_avi (name); } #ifdef WITH_QUICKTIME -static int isqtime (const char *name) { +static int isqtime (const char *name) +{ return anim_is_quicktime (name); } #endif @@ -240,7 +242,8 @@ void do_init_ffmpeg(void) } } -static int isffmpeg (const char *filename) { +static int isffmpeg (const char *filename) +{ AVFormatContext *pFormatCtx; unsigned int i; int videoStream; @@ -323,7 +326,8 @@ static int isredcode(const char * filename) #endif -int imb_get_anim_type(const char * name) { +int imb_get_anim_type(const char * name) +{ int type; struct stat st; @@ -364,7 +368,8 @@ int imb_get_anim_type(const char * name) { return(0); } -int IMB_isanim(const char *filename) { +int IMB_isanim(const char *filename) +{ int type; if(U.uiflag & USER_FILTERFILEEXTS) { diff --git a/source/blender/python/mathutils/mathutils_geometry.c b/source/blender/python/mathutils/mathutils_geometry.c index c5e0d2ab95d..d3b6e2e8b29 100644 --- a/source/blender/python/mathutils/mathutils_geometry.c +++ b/source/blender/python/mathutils/mathutils_geometry.c @@ -805,7 +805,8 @@ static PyObject *M_Geometry_intersect_point_tri_2d(PyObject *UNUSED(self), PyObj PyDoc_STRVAR(M_Geometry_intersect_point_quad_2d_doc, ".. function:: intersect_point_quad_2d(pt, quad_p1, quad_p2, quad_p3, quad_p4)\n" "\n" -" Takes 5 vectors (using only the x and y coordinates): one is the point and the next 4 define the quad, only the x and y are used from the vectors. Returns 1 if the point is within the quad, otherwise 0.\n" +" Takes 5 vectors (using only the x and y coordinates): one is the point and the next 4 define the quad, \n" +" only the x and y are used from the vectors. Returns 1 if the point is within the quad, otherwise 0.\n" "\n" " :arg pt: Point\n" " :type pt: :class:`mathutils.Vector`\n" diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp index d9822d131eb..29871c2b3cd 100644 --- a/source/gameengine/Ketsji/KX_PythonInit.cpp +++ b/source/gameengine/Ketsji/KX_PythonInit.cpp @@ -1950,7 +1950,15 @@ void setupGamePython(KX_KetsjiEngine* ketsjiengine, KX_Scene* startscene, Main * initVideoTexture(); /* could be done a lot more nicely, but for now a quick way to get bge.* working */ - PyRun_SimpleString("sys = __import__('sys');mod = sys.modules['bge'] = type(sys)('bge');mod.__dict__.update({'logic':__import__('GameLogic'), 'render':__import__('Rasterizer'), 'events':__import__('GameKeys'), 'constraints':__import__('PhysicsConstraints'), 'types':__import__('GameTypes'), 'texture':__import__('VideoTexture')});"); + PyRun_SimpleString("sys = __import__('sys');" + "mod = sys.modules['bge'] = type(sys)('bge');" + "mod.__dict__.update({'logic':__import__('GameLogic'), " + "'render':__import__('Rasterizer'), " + "'events':__import__('GameKeys'), " + "'constraints':__import__('PhysicsConstraints'), " + "'types':__import__('GameTypes'), " + "'texture':__import__('VideoTexture')});" + ); } static struct PyModuleDef Rasterizer_module_def = { |