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.
This commit is contained in:
Campbell Barton
2013-03-29 06:25:22 +00:00
parent ab41583bc2
commit 1777a69818
28 changed files with 78 additions and 70 deletions

View File

@@ -309,7 +309,7 @@ static inline void swapfunc(char* a, char* b, int n, int swaptype)
#define vecswap(a, b, n) if ((n) > 0) swapfunc(a, b, n, swaptype) #define vecswap(a, b, n) if ((n) > 0) swapfunc(a, b, n, swaptype)
#define CMP(t, x, y) (cmp((t), (x), (y))) #define CMP(t, x, y) (cmp((t), (x), (y)))
static inline char * med3(char *a, char *b, char *c, cmp_t *cmp, void *thunk) static inline char *med3(char *a, char *b, char *c, cmp_t *cmp, void *thunk)
{ {
return CMP(thunk, a, b) < 0 ? return CMP(thunk, a, b) < 0 ?
(CMP(thunk, b, c) < 0 ? b : (CMP(thunk, a, c) < 0 ? c : a )) (CMP(thunk, b, c) < 0 ? b : (CMP(thunk, a, c) < 0 ? c : a ))

View File

@@ -576,7 +576,7 @@ void BlenderSession::update_status_progress()
timestatus += ", " + b_rlay_name; timestatus += ", " + b_rlay_name;
timestatus += " | "; timestatus += " | ";
BLI_timestr(total_time, time_str); BLI_timestr(total_time, time_str, sizeof(time_str));
timestatus += "Elapsed: " + string(time_str) + " | "; timestatus += "Elapsed: " + string(time_str) + " | ";
if(substatus.size() > 0) if(substatus.size() > 0)

View File

@@ -30,7 +30,7 @@
* todo: clean this up ... */ * todo: clean this up ... */
extern "C" { 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_frame_calc(void *iuser, int cfra, int fieldnr);
void BKE_image_user_file_path(void *iuser, void *ima, char *path); void BKE_image_user_file_path(void *iuser, void *ima, char *path);
unsigned char *BKE_image_get_pixels_for_frame(void *image, int frame); unsigned char *BKE_image_get_pixels_for_frame(void *image, int frame);

View File

@@ -374,14 +374,14 @@ class Octree
/** /**
* Functions to patch rings in a node * Functions to patch rings in a node
*/ */
Node *patch(Node * node, int st[3], int len, PathList * rings); 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 *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 *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 *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 *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 compressRing(PathElement *& ring);
void getFacePoint(PathElement *leaf, int dir, int& x, int& y, float& p, float& q); 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 findPair(PathElement *head, int pos, int dir, PathElement *& pre1, PathElement *& pre2);
int getSide(PathElement *e, int pos, int dir); int getSide(PathElement *e, int pos, int dir);
int isEqual(PathElement *e1, PathElement *e2); int isEqual(PathElement *e1, PathElement *e2);
@@ -412,8 +412,8 @@ class Octree
/************************************************************************/ /************************************************************************/
void floodFill(); void floodFill();
void clearProcessBits(Node *node, int height); void clearProcessBits(Node *node, int height);
int floodFill(LeafNode * leaf, 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); int floodFill(Node *node, int st[3], int len, int height, int threshold);
/** /**
* Write out polygon file * Write out polygon file
@@ -421,9 +421,9 @@ class Octree
void writeOut(); void writeOut();
void countIntersection(Node *node, int height, int& nedge, int& ncell, int& nface); 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, void computeMinimizer(const LeafNode * leaf, int st[3], int len,
float rvalue[3]) const; float rvalue[3]) const;
/** /**
* Traversal functions to generate polygon model * Traversal functions to generate polygon model
* op: 0 for counting, 1 for writing OBJ, 2 for writing OFF, 3 for writing PLY * op: 0 for counting, 1 for writing OBJ, 2 for writing OFF, 3 for writing PLY

View File

@@ -34,7 +34,7 @@
#include <wchar.h> #include <wchar.h>
FILE * ufopen(const char * filename, const char * mode) FILE *ufopen(const char *filename, const char *mode)
{ {
FILE *f = NULL; FILE *f = NULL;
UTF16_ENCODE(filename); UTF16_ENCODE(filename);
@@ -120,7 +120,7 @@ int umkdir(const char *pathname)
return r ? 0 : -1; return r ? 0 : -1;
} }
char * u_alloc_getenv(const char *varname) char *u_alloc_getenv(const char *varname)
{ {
char * r = 0; char * r = 0;
wchar_t * str; wchar_t * str;

View File

@@ -23,21 +23,26 @@
* ***** END GPL LICENSE BLOCK ***** * ***** END GPL LICENSE BLOCK *****
*/ */
#ifndef __UTF_WINFUNC_H__
#define __UTF_WINFUNC_H__
#ifndef WIN32 #ifndef WIN32
# error "This file can only compile on windows" # error "This file can only compile on windows"
#endif #endif
#include <stdio.h> #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 uopen(const char *filename, int oflag, int pmode);
int uaccess(const char *filename, int mode); 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); 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 uputenv(const char *name, const char *value);
int umkdir(const char *pathname); int umkdir(const char *pathname);
#endif /* __UTF_WINFUNC_H__ */

View File

@@ -23,6 +23,9 @@
* ***** END GPL LICENSE BLOCK ***** * ***** END GPL LICENSE BLOCK *****
*/ */
#ifndef __UTFCONV_H__
#define __UTFCONV_H__
#include <wchar.h> #include <wchar.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@@ -98,3 +101,5 @@ wchar_t *alloc_utf16_from_8(const char *in8, size_t add);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif /* __UTFCONV_H__ */

View File

@@ -111,7 +111,7 @@ __declspec(dllexport) HRESULT vfGetPluginInfo(
return VF_OK; return VF_OK;
} }
static unsigned long getipaddress(const char * ipaddr) static unsigned long getipaddress(const char *ipaddr)
{ {
struct hostent *host; struct hostent *host;
unsigned long ip; unsigned long ip;

View File

@@ -235,19 +235,19 @@ struct DerivedMesh {
* from the derived mesh (this gives a pointer to the actual data, not * from the derived mesh (this gives a pointer to the actual data, not
* a copy) * a copy)
*/ */
void *(*getVertData)(DerivedMesh * dm, int index, int type); void *(*getVertData)(DerivedMesh *dm, int index, int type);
void *(*getEdgeData)(DerivedMesh * dm, int index, int type); void *(*getEdgeData)(DerivedMesh *dm, int index, int type);
void *(*getTessFaceData)(DerivedMesh * dm, int index, int type); void *(*getTessFaceData)(DerivedMesh *dm, int index, int type);
void *(*getPolyData)(DerivedMesh * dm, int index, int type); void *(*getPolyData)(DerivedMesh *dm, int index, int type);
/** Return a pointer to the entire array of vert/edge/face custom data /** Return a pointer to the entire array of vert/edge/face custom data
* from the derived mesh (this gives a pointer to the actual data, not * from the derived mesh (this gives a pointer to the actual data, not
* a copy) * a copy)
*/ */
void *(*getVertDataArray)(DerivedMesh * dm, int type); void *(*getVertDataArray)(DerivedMesh *dm, int type);
void *(*getEdgeDataArray)(DerivedMesh * dm, int type); void *(*getEdgeDataArray)(DerivedMesh *dm, int type);
void *(*getTessFaceDataArray)(DerivedMesh * dm, int type); void *(*getTessFaceDataArray)(DerivedMesh *dm, int type);
void *(*getPolyDataArray)(DerivedMesh * dm, int type); void *(*getPolyDataArray)(DerivedMesh *dm, int type);
/** Retrieves the base CustomData structures for /** Retrieves the base CustomData structures for
* verts/edges/tessfaces/loops/facdes*/ * verts/edges/tessfaces/loops/facdes*/

View File

@@ -1601,7 +1601,7 @@ static void stampdata(Scene *scene, Object *camera, StampData *stamp_data, int d
RenderStats *stats = re ? RE_GetStats(re) : NULL; RenderStats *stats = re ? RE_GetStats(re) : NULL;
if (stats && (scene->r.stamp & R_STAMP_RENDERTIME)) { if (stats && (scene->r.stamp & R_STAMP_RENDERTIME)) {
BLI_timestr(stats->lastframetime, text); BLI_timestr(stats->lastframetime, text, sizeof(text));
BLI_snprintf(stamp_data->rendertime, sizeof(stamp_data->rendertime), do_prefix ? "RenderTime %s" : "%s", text); BLI_snprintf(stamp_data->rendertime, sizeof(stamp_data->rendertime), do_prefix ? "RenderTime %s" : "%s", text);
} }

View File

@@ -150,7 +150,7 @@ __attribute__((warn_unused_result))
__attribute__((nonnull)) __attribute__((nonnull))
#endif #endif
; ;
void BLI_timestr(double _time, char *str) void BLI_timestr(double _time, char *str, size_t maxlen)
#ifdef __GNUC__ #ifdef __GNUC__
__attribute__((nonnull)) __attribute__((nonnull))
#endif #endif

View File

@@ -490,22 +490,20 @@ int BLI_natstrcmp(const char *s1, const char *s2)
return 0; return 0;
} }
void BLI_timestr(double _time, char *str) void BLI_timestr(double _time, char *str, size_t maxlen)
{ {
/* format 00:00:00.00 (hr:min:sec) string has to be 12 long */ /* format 00:00:00.00 (hr:min:sec) string has to be 12 long */
int hr = ( (int) _time) / (60 * 60); int hr = ( (int) _time) / (60 * 60);
int min = (((int) _time) / 60 ) % 60; int min = (((int) _time) / 60 ) % 60;
int sec = ( (int) (_time)) % 60; int sec = ( (int) _time) % 60;
int hun = ( (int) (_time * 100.0)) % 100; int hun = ( (int) (_time * 100.0)) % 100;
if (hr) { if (hr) {
sprintf(str, "%.2d:%.2d:%.2d.%.2d", hr, min, sec, hun); BLI_snprintf(str, maxlen, "%.2d:%.2d:%.2d.%.2d", hr, min, sec, hun);
} }
else { else {
sprintf(str, "%.2d:%.2d.%.2d", min, sec, hun); BLI_snprintf(str, maxlen, "%.2d:%.2d.%.2d", min, sec, hun);
} }
str[11] = 0;
} }
/* determine the length of a fixed-size string */ /* determine the length of a fixed-size string */

View File

@@ -602,7 +602,7 @@ size_t BLI_str_utf8_from_unicode(unsigned int c, char *outbuf)
* *
* Return value: a pointer to the found character or %NULL. * Return value: a pointer to the found character or %NULL.
**/ **/
char * BLI_str_find_prev_char_utf8(const char *str, const char *p) char *BLI_str_find_prev_char_utf8(const char *str, const char *p)
{ {
for (--p; p >= str; --p) { for (--p; p >= str; --p) {
if ((*p & 0xc0) != 0x80) { if ((*p & 0xc0) != 0x80) {

View File

@@ -148,20 +148,20 @@ public:
#endif #endif
void translate_Animations(COLLADAFW::Node * Node, void translate_Animations(COLLADAFW::Node * Node,
std::map<COLLADAFW::UniqueId, COLLADAFW::Node*>& root_map, std::map<COLLADAFW::UniqueId, COLLADAFW::Node*>& root_map,
std::multimap<COLLADAFW::UniqueId, Object*>& object_map, std::multimap<COLLADAFW::UniqueId, Object*>& object_map,
std::map<COLLADAFW::UniqueId, const COLLADAFW::Object*> FW_object_map); std::map<COLLADAFW::UniqueId, const COLLADAFW::Object*> FW_object_map);
AnimMix* get_animation_type( const COLLADAFW::Node * node, std::map<COLLADAFW::UniqueId, const COLLADAFW::Object*> FW_object_map ); AnimMix* get_animation_type( const COLLADAFW::Node * node, std::map<COLLADAFW::UniqueId, const COLLADAFW::Object*> FW_object_map );
void apply_matrix_curves(Object * ob, std::vector<FCurve*>& animcurves, COLLADAFW::Node* root, COLLADAFW::Node* node, void apply_matrix_curves(Object *ob, std::vector<FCurve*>& animcurves, COLLADAFW::Node* root, COLLADAFW::Node* node,
COLLADAFW::Transformation * tm ); COLLADAFW::Transformation * tm );
void add_bone_animation_sampled(Object * ob, std::vector<FCurve*>& animcurves, COLLADAFW::Node* root, COLLADAFW::Node* node, COLLADAFW::Transformation * tm); void add_bone_animation_sampled(Object *ob, std::vector<FCurve*>& animcurves, COLLADAFW::Node* root, COLLADAFW::Node* node, COLLADAFW::Transformation * tm);
void Assign_transform_animations(COLLADAFW::Transformation* transform, void Assign_transform_animations(COLLADAFW::Transformation* transform,
const COLLADAFW::AnimationList::AnimationBinding * binding, const COLLADAFW::AnimationList::AnimationBinding *binding,
std::vector<FCurve*>* curves, bool is_joint, char * joint_path); std::vector<FCurve*>* curves, bool is_joint, char *joint_path);
void Assign_color_animations(const COLLADAFW::UniqueId& listid, ListBase *AnimCurves, const char * anim_type); void Assign_color_animations(const COLLADAFW::UniqueId& listid, ListBase *AnimCurves, const char * anim_type);
void Assign_float_animations(const COLLADAFW::UniqueId& listid, ListBase *AnimCurves, const char * anim_type); void Assign_float_animations(const COLLADAFW::UniqueId& listid, ListBase *AnimCurves, const char * anim_type);

View File

@@ -113,7 +113,7 @@ private:
void fix_leaf_bones(); void fix_leaf_bones();
void set_pose ( Object * ob_arm, COLLADAFW::Node * root_node, const char *parentname, float parent_mat[4][4]); void set_pose( Object *ob_arm, COLLADAFW::Node *root_node, const char *parentname, float parent_mat[4][4]);
#if 0 #if 0

View File

@@ -435,7 +435,7 @@ void ExecutionGroup::printBackgroundStats(void)
fprintf(stdout, "Mem:%.2fM (%.2fM, Peak %.2fM) ", fprintf(stdout, "Mem:%.2fM (%.2fM, Peak %.2fM) ",
megs_used_memory, mmap_used_memory, megs_peak_memory); megs_used_memory, mmap_used_memory, megs_peak_memory);
BLI_timestr(execution_time, timestr); BLI_timestr(execution_time, timestr, sizeof(timestr));
printf("| Elapsed %s ", timestr); printf("| Elapsed %s ", timestr);
printf("| Tree %s, Tile %d-%d ", this->m_bTree->id.name + 2, printf("| Tree %s, Tile %d-%d ", this->m_bTree->id.name + 2,
this->m_chunksFinished, this->m_numberOfChunks); this->m_chunksFinished, this->m_numberOfChunks);

View File

@@ -407,7 +407,7 @@ typedef struct bAnimChannelType {
* with type being sizeof(ptr_data) which should be fine for runtime use... * with type being sizeof(ptr_data) which should be fine for runtime use...
* - assume that setting has been checked to be valid for current context * - assume that setting has been checked to be valid for current context
*/ */
void *(*setting_ptr)(bAnimListElem * ale, int setting, short *type); void *(*setting_ptr)(bAnimListElem *ale, int setting, short *type);
} bAnimChannelType; } bAnimChannelType;
/* ------------------------ Drawing API -------------------------- */ /* ------------------------ Drawing API -------------------------- */

View File

@@ -394,7 +394,7 @@ static int dynamicPaint_initBake(struct bContext *C, struct wmOperator *op)
/* Format time string */ /* Format time string */
char time_str[30]; char time_str[30];
double time = PIL_check_seconds_timer() - timer; double time = PIL_check_seconds_timer() - timer;
BLI_timestr(time, time_str); BLI_timestr(time, time_str, sizeof(time_str));
/* Show bake info */ /* Show bake info */
BKE_reportf(op->reports, RPT_INFO, "Bake complete! (%s)", time_str); BKE_reportf(op->reports, RPT_INFO, "Bake complete! (%s)", time_str);

View File

@@ -311,7 +311,7 @@ static void make_renderinfo_string(RenderStats *rs, Scene *scene, char *str)
spos += sprintf(spos, IFACE_("Blur %d "), rs->curblur); spos += sprintf(spos, IFACE_("Blur %d "), rs->curblur);
} }
BLI_timestr(rs->lastframetime, info_time_str); BLI_timestr(rs->lastframetime, info_time_str, sizeof(info_time_str));
spos += sprintf(spos, IFACE_("Time:%s "), info_time_str); spos += sprintf(spos, IFACE_("Time:%s "), info_time_str);
if (rs->curfsa) if (rs->curfsa)

View File

@@ -442,7 +442,7 @@ static void paint_redraw(const bContext *C, PaintOperation *pop, int final)
} }
} }
static PaintOperation * texture_paint_init(bContext *C, wmOperator *op, const wmEvent *event) static PaintOperation *texture_paint_init(bContext *C, wmOperator *op, const wmEvent *event)
{ {
Scene *scene = CTX_data_scene(C); Scene *scene = CTX_data_scene(C);
ToolSettings *settings = scene->toolsettings; ToolSettings *settings = scene->toolsettings;

View File

@@ -2671,8 +2671,8 @@ static void draw_em_measure_stats(View3D *v3d, Object *ob, BMEditMesh *em, UnitS
/* special case, this is useful to show when vertes connected to this edge via a /* special case, this is useful to show when vertes connected to this edge via a
* face are being transformed */ * face are being transformed */
BM_elem_flag_test(l_a->next->next->v, BM_ELEM_SELECT) || BM_elem_flag_test(l_a->next->next->v, BM_ELEM_SELECT) ||
BM_elem_flag_test(l_b->prev->v, BM_ELEM_SELECT) || BM_elem_flag_test(l_a->prev->v, BM_ELEM_SELECT) ||
BM_elem_flag_test(l_a->next->next->v, BM_ELEM_SELECT) || BM_elem_flag_test(l_b->next->next->v, BM_ELEM_SELECT) ||
BM_elem_flag_test(l_b->prev->v, BM_ELEM_SELECT) BM_elem_flag_test(l_b->prev->v, BM_ELEM_SELECT)
))) )))
{ {

View File

@@ -81,7 +81,7 @@ typedef struct anim_index_builder {
struct anim_index_entry *entry); struct anim_index_entry *entry);
} anim_index_builder; } anim_index_builder;
anim_index_builder * IMB_index_builder_create(const char *name); anim_index_builder *IMB_index_builder_create(const char *name);
void IMB_index_builder_add_entry( void IMB_index_builder_add_entry(
anim_index_builder * fp, anim_index_builder * fp,
int frameno, unsigned long long seek_pos, int frameno, unsigned long long seek_pos,
@@ -118,7 +118,7 @@ void IMB_free_indices(struct anim *anim);
struct anim *IMB_anim_open_proxy( struct anim *IMB_anim_open_proxy(
struct anim *anim, IMB_Proxy_Size preview_size); struct anim *anim, IMB_Proxy_Size preview_size);
struct anim_index * IMB_anim_open_index( struct anim_index *IMB_anim_open_index(
struct anim *anim, IMB_Timecode_Type tc); struct anim *anim, IMB_Timecode_Type tc);
int IMB_proxy_size_to_array_index(IMB_Proxy_Size pr_size); int IMB_proxy_size_to_array_index(IMB_Proxy_Size pr_size);

View File

@@ -171,9 +171,9 @@ public:
void setHasAlphaFlag(bool b); void setHasAlphaFlag(bool b);
void setUserVersion(int version); void setUserVersion(int version);
void mipmap(Image * img, uint f, uint m); void mipmap(Image *img, uint f, uint m);
void *readData(uint &size); void *readData(uint &size);
// void mipmap(FloatImage * img, uint f, uint m); // void mipmap(FloatImage *img, uint f, uint m);
void printInfo() const; void printInfo() const;

View File

@@ -56,9 +56,9 @@ public:
void allocate(uint w, uint h); void allocate(uint w, uint h);
#if 0 #if 0
bool load(const char * name); bool load(const char *name);
void wrap(void * data, uint w, uint h); void wrap(void *data, uint w, uint h);
void unwrap(); void unwrap();
#endif #endif

View File

@@ -80,7 +80,7 @@
} }
// Get pixel component shift and size given its mask. // Get pixel component shift and size given its mask.
inline void maskShiftAndSize(uint mask, uint * shift, uint * size) inline void maskShiftAndSize(uint mask, uint *shift, uint *size)
{ {
if (!mask) { if (!mask) {
*shift = 0; *shift = 0;

View File

@@ -57,12 +57,12 @@
(void)0 (void)0
#define DEF_GET_SET(type, arr) \ #define DEF_GET_SET(type, arr) \
void rna_Test_ ## arr ## _get(PointerRNA * ptr, type * values) \ void rna_Test_ ## arr ## _get(PointerRNA *ptr, type * values) \
{ \ { \
memcpy(values, arr, sizeof(arr)); \ memcpy(values, arr, sizeof(arr)); \
} \ } \
\ \
void rna_Test_ ## arr ## _set(PointerRNA * ptr, const type * values) \ void rna_Test_ ## arr ## _set(PointerRNA *ptr, const type * values) \
{ \ { \
memcpy(arr, values, sizeof(arr)); \ memcpy(arr, values, sizeof(arr)); \
} \ } \
@@ -73,14 +73,14 @@
{ \ { \
return arr ## _len; \ return arr ## _len; \
} \ } \
\ \
static int rna_Test_ ## arr ## _set_length(PointerRNA * ptr, int length) \ static int rna_Test_ ## arr ## _set_length(PointerRNA *ptr, int length) \
{ \ { \
if (length > max) \ if (length > max) \
return 0; \ return 0; \
\ \
arr ## _len = length; \ arr ## _len = length; \
\ \
return 1; \ return 1; \
} \ } \
(void)0 (void)0

View File

@@ -2357,12 +2357,12 @@ static int do_write_image_or_movie(Render *re, Main *bmain, Scene *scene, bMovie
render_time = re->i.lastframetime; render_time = re->i.lastframetime;
re->i.lastframetime = PIL_check_seconds_timer() - re->i.starttime; re->i.lastframetime = PIL_check_seconds_timer() - re->i.starttime;
BLI_timestr(re->i.lastframetime, name); BLI_timestr(re->i.lastframetime, name, sizeof(name));
printf(" Time: %s", name); printf(" Time: %s", name);
BLI_callback_exec(G.main, NULL, BLI_CB_EVT_RENDER_STATS); BLI_callback_exec(G.main, NULL, BLI_CB_EVT_RENDER_STATS);
BLI_timestr(re->i.lastframetime - render_time, name); BLI_timestr(re->i.lastframetime - render_time, name, sizeof(name));
printf(" (Saving: %s)\n", name); printf(" (Saving: %s)\n", name);
fputc('\n', stdout); fputc('\n', stdout);

View File

@@ -956,7 +956,7 @@ void wm_autosave_location(char *filepath)
{ {
char pidstr[32]; char pidstr[32];
#ifdef WIN32 #ifdef WIN32
char *savedir; const char *savedir;
#endif #endif
BLI_snprintf(pidstr, sizeof(pidstr), "%d.blend", abs(getpid())); BLI_snprintf(pidstr, sizeof(pidstr), "%d.blend", abs(getpid()));