diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-03-29 10:25:22 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-03-29 10:25:22 +0400 |
commit | 1777a69818610d4ed8a93f661a45219d97e7f6c5 (patch) | |
tree | bbfb0b35629e94ffd727f4a8b98fbf6cbebdaa36 /intern | |
parent | ab41583bc2be591c0af921b243158e43a94505d7 (diff) |
misc minor edits.
- pass string size to BLI_timestr() to avoid possible buffer overrun.
- quiet warning for mingw.
- include guards for windows utf conversion funcs.
- fix for mistage in edge-angle-selection check.
- some style cleanup.
Diffstat (limited to 'intern')
-rw-r--r-- | intern/cycles/blender/blender_session.cpp | 2 | ||||
-rw-r--r-- | intern/cycles/blender/blender_util.h | 2 | ||||
-rw-r--r-- | intern/dualcon/intern/octree.h | 20 | ||||
-rw-r--r-- | intern/utfconv/utf_winfunc.c | 4 | ||||
-rw-r--r-- | intern/utfconv/utf_winfunc.h | 13 | ||||
-rw-r--r-- | intern/utfconv/utfconv.h | 5 |
6 files changed, 28 insertions, 18 deletions
diff --git a/intern/cycles/blender/blender_session.cpp b/intern/cycles/blender/blender_session.cpp index d10fb99450d..acda90f0b83 100644 --- a/intern/cycles/blender/blender_session.cpp +++ b/intern/cycles/blender/blender_session.cpp @@ -576,7 +576,7 @@ void BlenderSession::update_status_progress() timestatus += ", " + b_rlay_name; timestatus += " | "; - BLI_timestr(total_time, time_str); + BLI_timestr(total_time, time_str, sizeof(time_str)); timestatus += "Elapsed: " + string(time_str) + " | "; if(substatus.size() > 0) diff --git a/intern/cycles/blender/blender_util.h b/intern/cycles/blender/blender_util.h index bd4852d08e1..747008fc7c4 100644 --- a/intern/cycles/blender/blender_util.h +++ b/intern/cycles/blender/blender_util.h @@ -30,7 +30,7 @@ * todo: clean this up ... */ extern "C" { -void BLI_timestr(double _time, char *str); +void BLI_timestr(double _time, char *str, size_t maxlen); void BKE_image_user_frame_calc(void *iuser, int cfra, int fieldnr); void BKE_image_user_file_path(void *iuser, void *ima, char *path); unsigned char *BKE_image_get_pixels_for_frame(void *image, int frame); diff --git a/intern/dualcon/intern/octree.h b/intern/dualcon/intern/octree.h index 6cbdc9fb3d8..544048249de 100644 --- a/intern/dualcon/intern/octree.h +++ b/intern/dualcon/intern/octree.h @@ -374,14 +374,14 @@ class Octree /** * Functions to patch rings in a node */ - Node *patch(Node * node, int st[3], int len, PathList * rings); - Node *patchSplit(Node * node, int st[3], int len, PathList * rings, int dir, PathList * &nrings1, PathList * &nrings2); - Node *patchSplitSingle(Node * node, int st[3], int len, PathElement * head, int dir, PathList * &nrings1, PathList * &nrings2); - Node *connectFace(Node * node, int st[3], int len, int dir, PathElement * f1, PathElement * f2); - Node *locateCell(InternalNode * node, int st[3], int len, int ori[3], int dir, int side, Node * &rleaf, int rst[3], int& rlen); + Node *patch(Node *node, int st[3], int len, PathList * rings); + Node *patchSplit(Node *node, int st[3], int len, PathList * rings, int dir, PathList * &nrings1, PathList * &nrings2); + Node *patchSplitSingle(Node *node, int st[3], int len, PathElement *head, int dir, PathList * &nrings1, PathList * &nrings2); + Node *connectFace(Node *node, int st[3], int len, int dir, PathElement * f1, PathElement * f2); + Node *locateCell(InternalNode *node, int st[3], int len, int ori[3], int dir, int side, Node * &rleaf, int rst[3], int& rlen); void compressRing(PathElement *& ring); void getFacePoint(PathElement *leaf, int dir, int& x, int& y, float& p, float& q); - LeafNode *patchAdjacent(InternalNode * node, int len, int st1[3], LeafNode * leaf1, int st2[3], LeafNode * leaf2, int walkdir, int inc, int dir, int side, float alpha); + LeafNode *patchAdjacent(InternalNode *node, int len, int st1[3], LeafNode * leaf1, int st2[3], LeafNode * leaf2, int walkdir, int inc, int dir, int side, float alpha); int findPair(PathElement *head, int pos, int dir, PathElement *& pre1, PathElement *& pre2); int getSide(PathElement *e, int pos, int dir); int isEqual(PathElement *e1, PathElement *e2); @@ -412,8 +412,8 @@ class Octree /************************************************************************/ void floodFill(); void clearProcessBits(Node *node, int height); - int floodFill(LeafNode * leaf, int st[3], int len, int height, int threshold); - int floodFill(Node * node, int st[3], int len, int height, int threshold); + int floodFill(LeafNode *leaf, int st[3], int len, int height, int threshold); + int floodFill(Node *node, int st[3], int len, int height, int threshold); /** * Write out polygon file @@ -421,9 +421,9 @@ class Octree void writeOut(); void countIntersection(Node *node, int height, int& nedge, int& ncell, int& nface); - void generateMinimizer(Node * node, int st[3], int len, int height, int& offset); + void generateMinimizer(Node *node, int st[3], int len, int height, int& offset); void computeMinimizer(const LeafNode * leaf, int st[3], int len, - float rvalue[3]) const; + float rvalue[3]) const; /** * Traversal functions to generate polygon model * op: 0 for counting, 1 for writing OBJ, 2 for writing OFF, 3 for writing PLY diff --git a/intern/utfconv/utf_winfunc.c b/intern/utfconv/utf_winfunc.c index 9f3e96b47fe..2ae261b44a8 100644 --- a/intern/utfconv/utf_winfunc.c +++ b/intern/utfconv/utf_winfunc.c @@ -34,7 +34,7 @@ #include <wchar.h> -FILE * ufopen(const char * filename, const char * mode) +FILE *ufopen(const char *filename, const char *mode) { FILE *f = NULL; UTF16_ENCODE(filename); @@ -120,7 +120,7 @@ int umkdir(const char *pathname) return r ? 0 : -1; } -char * u_alloc_getenv(const char *varname) +char *u_alloc_getenv(const char *varname) { char * r = 0; wchar_t * str; diff --git a/intern/utfconv/utf_winfunc.h b/intern/utfconv/utf_winfunc.h index e23a5dd5797..8dd77275dcb 100644 --- a/intern/utfconv/utf_winfunc.h +++ b/intern/utfconv/utf_winfunc.h @@ -23,21 +23,26 @@ * ***** END GPL LICENSE BLOCK ***** */ +#ifndef __UTF_WINFUNC_H__ +#define __UTF_WINFUNC_H__ + #ifndef WIN32 # error "This file can only compile on windows" #endif #include <stdio.h> -FILE * ufopen(const char * filename, const char * mode); +FILE *ufopen(const char * filename, const char * mode); int uopen(const char *filename, int oflag, int pmode); int uaccess(const char *filename, int mode); -int urename(const char *oldname, const char *newname ); +int urename(const char *oldname, const char *newname); -char * u_alloc_getenv(const char *varname); +char *u_alloc_getenv(const char *varname); void u_free_getenv(char *val); -int uput_getenv(const char *varname, char * value, size_t buffsize); +int uput_getenv(const char *varname, char *value, size_t buffsize); int uputenv(const char *name, const char *value); int umkdir(const char *pathname); + +#endif /* __UTF_WINFUNC_H__ */ diff --git a/intern/utfconv/utfconv.h b/intern/utfconv/utfconv.h index 22710bfdb37..f00f4aeef27 100644 --- a/intern/utfconv/utfconv.h +++ b/intern/utfconv/utfconv.h @@ -23,6 +23,9 @@ * ***** END GPL LICENSE BLOCK ***** */ +#ifndef __UTFCONV_H__ +#define __UTFCONV_H__ + #include <wchar.h> #include <stdio.h> #include <stdlib.h> @@ -98,3 +101,5 @@ wchar_t *alloc_utf16_from_8(const char *in8, size_t add); #ifdef __cplusplus } #endif + +#endif /* __UTFCONV_H__ */ |