Code cleanup: comments and warnings

This commit is contained in:
Campbell Barton 2014-02-01 00:51:53 +11:00
parent eeefbbcc78
commit 34a0532584
8 changed files with 56 additions and 54 deletions

@ -216,8 +216,6 @@ void CustomData_free_elem(struct CustomData *data, int index, int count);
* should be source->subElems * source->subElems in size) * should be source->subElems * source->subElems in size)
* count gives the number of source elements to interpolate from * count gives the number of source elements to interpolate from
* dest_index gives the dest element to write the interpolated value to * dest_index gives the dest element to write the interpolated value to
*
* returns 1 on success, 0 on failure
*/ */
void CustomData_interp(const struct CustomData *source, struct CustomData *dest, void CustomData_interp(const struct CustomData *source, struct CustomData *dest,
int *src_indices, float *weights, float *sub_weights, int *src_indices, float *weights, float *sub_weights,

@ -78,8 +78,8 @@ void dynamicPaint_freeBrush(struct DynamicPaintModifierData *pmd);
void dynamicPaint_freeSurfaceData(struct DynamicPaintSurface *surface); void dynamicPaint_freeSurfaceData(struct DynamicPaintSurface *surface);
void dynamicPaint_cacheUpdateFrames(struct DynamicPaintSurface *surface); void dynamicPaint_cacheUpdateFrames(struct DynamicPaintSurface *surface);
int dynamicPaint_surfaceHasColorPreview(struct DynamicPaintSurface *surface); bool dynamicPaint_surfaceHasColorPreview(struct DynamicPaintSurface *surface);
int dynamicPaint_outputLayerExists(struct DynamicPaintSurface *surface, struct Object *ob, int output); bool dynamicPaint_outputLayerExists(struct DynamicPaintSurface *surface, struct Object *ob, int output);
void dynamicPaintSurface_updateType(struct DynamicPaintSurface *surface); void dynamicPaintSurface_updateType(struct DynamicPaintSurface *surface);
void dynamicPaintSurface_setUniqueName(struct DynamicPaintSurface *surface, const char *basename); void dynamicPaintSurface_setUniqueName(struct DynamicPaintSurface *surface, const char *basename);
void dynamicPaint_resetPreview(struct DynamicPaintCanvasSettings *canvas); void dynamicPaint_resetPreview(struct DynamicPaintCanvasSettings *canvas);

@ -259,7 +259,7 @@ static int dynamicPaint_surfaceNumOfPoints(DynamicPaintSurface *surface)
} }
/* checks whether surface's format/type has realtime preview */ /* checks whether surface's format/type has realtime preview */
int dynamicPaint_surfaceHasColorPreview(DynamicPaintSurface *surface) bool dynamicPaint_surfaceHasColorPreview(DynamicPaintSurface *surface)
{ {
if (surface->format == MOD_DPAINT_SURFACE_F_IMAGESEQ) { if (surface->format == MOD_DPAINT_SURFACE_F_IMAGESEQ) {
return 0; return 0;
@ -321,7 +321,7 @@ static void dynamicPaint_setPreview(DynamicPaintSurface *t_surface)
} }
} }
int dynamicPaint_outputLayerExists(struct DynamicPaintSurface *surface, Object *ob, int output) bool dynamicPaint_outputLayerExists(struct DynamicPaintSurface *surface, Object *ob, int output)
{ {
char *name; char *name;

@ -117,7 +117,7 @@ bool BLI_testextensie_array(const char *str, const char **ext_array) ATTR_NONNUL
bool BLI_testextensie_glob(const char *str, const char *ext_fnmatch) ATTR_NONNULL() ATTR_WARN_UNUSED_RESULT; bool BLI_testextensie_glob(const char *str, const char *ext_fnmatch) ATTR_NONNULL() ATTR_WARN_UNUSED_RESULT;
bool BLI_replace_extension(char *path, size_t maxlen, const char *ext) ATTR_NONNULL(); bool BLI_replace_extension(char *path, size_t maxlen, const char *ext) ATTR_NONNULL();
bool BLI_ensure_extension(char *path, size_t maxlen, const char *ext) ATTR_NONNULL(); bool BLI_ensure_extension(char *path, size_t maxlen, const char *ext) ATTR_NONNULL();
bool BLI_ensure_filename(char *filepath, size_t maxlen, const char *filename) ATTR_NONNULL() ATTR_WARN_UNUSED_RESULT; bool BLI_ensure_filename(char *filepath, size_t maxlen, const char *filename) ATTR_NONNULL();
void BLI_uniquename(struct ListBase *list, void *vlink, const char *defname, char delim, int name_offs, int len); void BLI_uniquename(struct ListBase *list, void *vlink, const char *defname, char delim, int name_offs, int len);
bool BLI_uniquename_cb(bool (*unique_check)(void *arg, const char *name), bool BLI_uniquename_cb(bool (*unique_check)(void *arg, const char *name),
void *arg, const char *defname, char delim, char *name, int name_len); void *arg, const char *defname, char delim, char *name, int name_len);
@ -157,14 +157,14 @@ bool BLI_parent_dir(char *path) ATTR_NONNULL();
* \a framenum The framenumber to replace the frame code with. * \a framenum The framenumber to replace the frame code with.
* \retval Returns true if the path was relative (started with "//"). * \retval Returns true if the path was relative (started with "//").
*/ */
bool BLI_path_abs(char *path, const char *basepath); bool BLI_path_abs(char *path, const char *basepath) ATTR_NONNULL();
bool BLI_path_frame(char *path, int frame, int digits); bool BLI_path_frame(char *path, int frame, int digits) ATTR_NONNULL();
bool BLI_path_frame_range(char *path, int sta, int end, int digits); bool BLI_path_frame_range(char *path, int sta, int end, int digits) ATTR_NONNULL();
bool BLI_path_frame_check_chars(const char *path); bool BLI_path_frame_check_chars(const char *path) ATTR_NONNULL();
bool BLI_path_cwd(char *path); bool BLI_path_cwd(char *path) ATTR_NONNULL();
void BLI_path_rel(char *file, const char *relfile); void BLI_path_rel(char *file, const char *relfile) ATTR_NONNULL();
bool BLI_path_is_rel(const char *path); bool BLI_path_is_rel(const char *path) ATTR_NONNULL() ATTR_WARN_UNUSED_RESULT;
/* path string comparisons: case-insensitive for Windows, case-sensitive otherwise */ /* path string comparisons: case-insensitive for Windows, case-sensitive otherwise */
#if defined(WIN32) #if defined(WIN32)

@ -83,7 +83,9 @@ typedef struct BlendFileData {
* indicating the cause of the failure. * indicating the cause of the failure.
* \return The data of the file. * \return The data of the file.
*/ */
BlendFileData *BLO_read_from_file(const char *filepath, struct ReportList *reports); BlendFileData *BLO_read_from_file(
const char *filepath,
struct ReportList *reports);
/** /**
* Open a blender file from memory. The function * Open a blender file from memory. The function
@ -96,13 +98,17 @@ BlendFileData *BLO_read_from_file(const char *filepath, struct ReportList *repor
* indicating the cause of the failure. * indicating the cause of the failure.
* \return The data of the file. * \return The data of the file.
*/ */
BlendFileData *BLO_read_from_memory(const void *mem, int memsize, struct ReportList *reports); BlendFileData *BLO_read_from_memory(
const void *mem, int memsize,
struct ReportList *reports);
/** /**
* oldmain is old main, from which we will keep libraries, images, .. * oldmain is old main, from which we will keep libraries, images, ..
* file name is current file, only for retrieving library data */ * file name is current file, only for retrieving library data */
BlendFileData *BLO_read_from_memfile(struct Main *oldmain, const char *filename, struct MemFile *memfile, struct ReportList *reports); BlendFileData *BLO_read_from_memfile(
struct Main *oldmain, const char *filename, struct MemFile *memfile,
struct ReportList *reports);
/** /**
* Free's a BlendFileData structure and _all_ the * Free's a BlendFileData structure and _all_ the
@ -121,8 +127,8 @@ BLO_blendfiledata_free(BlendFileData *bfd);
* \param reports Report errors in opening the file (can be NULL). * \param reports Report errors in opening the file (can be NULL).
* \return A handle on success, or NULL on failure. * \return A handle on success, or NULL on failure.
*/ */
BlendHandle * BlendHandle *BLO_blendhandle_from_file(
BLO_blendhandle_from_file(const char *filepath, const char *filepath,
struct ReportList *reports); struct ReportList *reports);
/** /**
@ -133,9 +139,8 @@ BLO_blendhandle_from_file(const char *filepath,
* \return A handle on success, or NULL on failure. * \return A handle on success, or NULL on failure.
*/ */
BlendHandle * BlendHandle *BLO_blendhandle_from_memory(
BLO_blendhandle_from_memory(const void *mem, const void *mem, int memsize);
int memsize);
/** /**
* Gets the names of all the datablocks in a file * Gets the names of all the datablocks in a file
@ -148,10 +153,9 @@ BLO_blendhandle_from_memory(const void *mem,
* \return A BLI_linklist of strings. The string links * \return A BLI_linklist of strings. The string links
* should be freed with malloc. * should be freed with malloc.
*/ */
struct LinkNode * struct LinkNode *BLO_blendhandle_get_datablock_names(
BLO_blendhandle_get_datablock_names(BlendHandle *bh, BlendHandle *bh,
int ofblocktype, int ofblocktype, int *tot_names);
int *tot_names);
/** /**
* Gets the previews of all the datablocks in a file * Gets the previews of all the datablocks in a file
@ -164,10 +168,9 @@ BLO_blendhandle_get_datablock_names(BlendHandle *bh,
* \return A BLI_linklist of PreviewImage. The PreviewImage links * \return A BLI_linklist of PreviewImage. The PreviewImage links
* should be freed with malloc. * should be freed with malloc.
*/ */
struct LinkNode * struct LinkNode *BLO_blendhandle_get_previews(
BLO_blendhandle_get_previews(BlendHandle *bh, BlendHandle *bh,
int ofblocktype, int ofblocktype, int *tot_prev);
int *tot_prev);
/** /**
* Gets the names of all the datablock groups in a * Gets the names of all the datablock groups in a
@ -178,8 +181,7 @@ BLO_blendhandle_get_previews(BlendHandle *bh,
* \return A BLI_linklist of strings. The string links * \return A BLI_linklist of strings. The string links
* should be freed with malloc. * should be freed with malloc.
*/ */
struct LinkNode * struct LinkNode *BLO_blendhandle_get_linkable_groups(BlendHandle *bh);
BLO_blendhandle_get_linkable_groups(BlendHandle *bh);
/** /**
* Close and free a blendhandle. The handle * Close and free a blendhandle. The handle
@ -192,7 +194,7 @@ BLO_blendhandle_close(BlendHandle *bh);
/***/ /***/
#define GROUP_MAX 32 #define BLO_GROUP_MAX 32
bool BLO_has_bfile_extension(const char *str); bool BLO_has_bfile_extension(const char *str);
@ -211,7 +213,9 @@ bool BLO_is_a_library(const char *path, char *dir, char *group);
* \param filepath Used for relative linking, copied to the lib->name * \param filepath Used for relative linking, copied to the lib->name
* \return the library Main, to be passed to BLO_library_append_named_part as mainl. * \return the library Main, to be passed to BLO_library_append_named_part as mainl.
*/ */
struct Main *BLO_library_append_begin(struct Main *mainvar, BlendHandle **bh, const char *filepath); struct Main *BLO_library_append_begin(
struct Main *mainvar, BlendHandle **bh,
const char *filepath);
/** /**
@ -223,7 +227,9 @@ struct Main *BLO_library_append_begin(struct Main *mainvar, BlendHandle **bh, co
* \param idcode The kind of datablock to link. * \param idcode The kind of datablock to link.
* \return the appended ID when found. * \return the appended ID when found.
*/ */
struct ID *BLO_library_append_named_part(struct Main *mainl, BlendHandle **bh, const char *idname, const int idcode); struct ID *BLO_library_append_named_part(
struct Main *mainl, BlendHandle **bh,
const char *idname, const int idcode);
/** /**
* Link/Append a named datablock from an external blend file. * Link/Append a named datablock from an external blend file.
@ -237,7 +243,9 @@ struct ID *BLO_library_append_named_part(struct Main *mainl, BlendHandle **bh, c
* \param flag Options for linking, used for instancing. * \param flag Options for linking, used for instancing.
* \return the appended ID when found. * \return the appended ID when found.
*/ */
struct ID *BLO_library_append_named_part_ex(const struct bContext *C, struct Main *mainl, BlendHandle **bh, const char *idname, const int idcode, const short flag); struct ID *BLO_library_append_named_part_ex(
const struct bContext *C, struct Main *mainl, BlendHandle **bh,
const char *idname, const int idcode, const short flag);
void BLO_library_append_end(const struct bContext *C, struct Main *mainl, BlendHandle **bh, int idcode, short flag); void BLO_library_append_end(const struct bContext *C, struct Main *mainl, BlendHandle **bh, int idcode, short flag);
@ -274,5 +282,4 @@ void BLO_update_defaults_startup_blend(struct Main *mainvar);
} }
#endif #endif
#endif #endif /* __BLO_READFILE_H__ */

@ -1192,7 +1192,7 @@ bool BLO_is_a_library(const char *path, char *dir, char *group)
/* now we know that we are in a blend file and it is safe to /* now we know that we are in a blend file and it is safe to
* assume that gp actually points to a group */ * assume that gp actually points to a group */
if (strcmp("Screen", gp) != 0) if (strcmp("Screen", gp) != 0)
BLI_strncpy(group, gp, GROUP_MAX); BLI_strncpy(group, gp, BLO_GROUP_MAX);
} }
return 1; return 1;
} }

@ -81,9 +81,6 @@
#include "filelist.h" #include "filelist.h"
/* max length of library group name within filesel */
#define GROUP_MAX 32
struct FileList; struct FileList;
typedef struct FileImage { typedef struct FileImage {
@ -344,7 +341,7 @@ static bool is_filtered_file(struct direntry *file, const char *UNUSED(dir), uns
static bool is_filtered_lib(struct direntry *file, const char *dir, unsigned int filter, short hide_dot) static bool is_filtered_lib(struct direntry *file, const char *dir, unsigned int filter, short hide_dot)
{ {
bool is_filtered = false; bool is_filtered = false;
char tdir[FILE_MAX], tgroup[GROUP_MAX]; char tdir[FILE_MAX], tgroup[BLO_GROUP_MAX];
if (BLO_is_a_library(dir, tdir, tgroup)) { if (BLO_is_a_library(dir, tdir, tgroup)) {
is_filtered = !is_hidden_file(file->relname, hide_dot); is_filtered = !is_hidden_file(file->relname, hide_dot);
} }
@ -1055,7 +1052,7 @@ void filelist_from_library(struct FileList *filelist)
struct ImBuf *ima; struct ImBuf *ima;
int ok, i, nprevs, nnames, idcode; int ok, i, nprevs, nnames, idcode;
char filename[FILE_MAX]; char filename[FILE_MAX];
char dir[FILE_MAX], group[GROUP_MAX]; char dir[FILE_MAX], group[BLO_GROUP_MAX];
/* name test */ /* name test */
ok = filelist_islibrary(filelist, dir, group); ok = filelist_islibrary(filelist, dir, group);

@ -2400,7 +2400,7 @@ static int wm_link_append_exec(bContext *C, wmOperator *op)
Main *mainl = NULL; Main *mainl = NULL;
BlendHandle *bh; BlendHandle *bh;
PropertyRNA *prop; PropertyRNA *prop;
char name[FILE_MAX], dir[FILE_MAX], libname[FILE_MAX], group[GROUP_MAX]; char name[FILE_MAX], dir[FILE_MAX], libname[FILE_MAX], group[BLO_GROUP_MAX];
int idcode, totfiles = 0; int idcode, totfiles = 0;
short flag; short flag;