From 32be51dc66ae0e791970c8b7326afa16d60aa267 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 21 Dec 2015 13:00:06 +1100 Subject: Cleanup: warnings (msvc) Part of patch D1670 by @LazyDodo --- intern/locale/boost_locale_wrapper.cpp | 2 ++ source/blender/blenkernel/intern/image.c | 2 +- source/blender/blenkernel/intern/mesh_evaluate.c | 4 ++-- source/blender/blenkernel/intern/particle.c | 2 +- source/blender/blenkernel/intern/particle_distribute.c | 4 ++-- source/blender/blenkernel/intern/scene.c | 2 +- source/blender/blenlib/BLI_timecode.h | 2 +- source/blender/blenlib/intern/buffer.c | 2 +- source/blender/blenlib/intern/dynlib.c | 3 ++- source/blender/blenlib/intern/sort.c | 4 ++++ source/blender/blenlib/intern/string.c | 2 +- source/blender/blenlib/intern/time.c | 3 ++- source/blender/editors/armature/editarmature_retarget.c | 4 ++-- source/blender/editors/armature/meshlaplacian.c | 2 +- source/blender/editors/curve/curve_intern.h | 2 +- source/blender/editors/include/ED_transform.h | 4 ++-- source/blender/editors/mask/mask_draw.c | 2 +- source/blender/editors/sculpt_paint/paint_image_proj.c | 2 +- source/blender/editors/space_clip/clip_editor.c | 2 +- source/blender/editors/space_clip/clip_ops.c | 2 +- source/blender/editors/space_file/filelist.c | 4 ++-- source/blender/imbuf/intern/imageprocess.c | 2 +- source/blender/render/intern/source/volume_precache.c | 2 +- 23 files changed, 34 insertions(+), 26 deletions(-) diff --git a/intern/locale/boost_locale_wrapper.cpp b/intern/locale/boost_locale_wrapper.cpp index 5eb2f7fe9d9..0707c0dd3e3 100644 --- a/intern/locale/boost_locale_wrapper.cpp +++ b/intern/locale/boost_locale_wrapper.cpp @@ -114,10 +114,12 @@ const char *bl_locale_pgettext(const char *msgctxt, const char *msgid) } catch(std::bad_cast const &e) { /* if std::has_facet(l) == false, LC_ALL = "C" case */ // std::cout << "bl_locale_pgettext(" << msgid << "): " << e.what() << " \n"; + (void)e; return msgid; } catch(std::exception const &e) { // std::cout << "bl_locale_pgettext(" << msgctxt << ", " << msgid << "): " << e.what() << " \n"; + (void)e; return msgid; } } diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index 6ff30134210..21d8f8dde67 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -2092,7 +2092,7 @@ void BKE_render_result_stamp_info(Scene *scene, Object *camera, struct RenderRes void BKE_stamp_info_callback(void *data, struct StampData *stamp_data, StampCallback callback, bool noskip) { - if (!callback || !stamp_data) { + if ((callback == NULL) || (stamp_data == NULL)) { return; } diff --git a/source/blender/blenkernel/intern/mesh_evaluate.c b/source/blender/blenkernel/intern/mesh_evaluate.c index a65ac5151a8..7aad5ad1890 100644 --- a/source/blender/blenkernel/intern/mesh_evaluate.c +++ b/source/blender/blenkernel/intern/mesh_evaluate.c @@ -937,7 +937,7 @@ static void loop_split_worker_do( } } -static void loop_split_worker(TaskPool *UNUSED(pool), void *taskdata, int UNUSED(threadid)) +static void loop_split_worker(TaskPool * __restrict UNUSED(pool), void *taskdata, int UNUSED(threadid)) { LoopSplitTaskDataCommon *common_data = taskdata; LoopSplitTaskData *data_buff; @@ -1116,7 +1116,7 @@ static void loop_split_generator_do(LoopSplitTaskDataCommon *common_data, const #endif } -static void loop_split_generator(TaskPool *UNUSED(pool), void *taskdata, int UNUSED(threadid)) +static void loop_split_generator(TaskPool * __restrict UNUSED(pool), void *taskdata, int UNUSED(threadid)) { LoopSplitTaskDataCommon *common_data = taskdata; diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index 4429f4b4282..b3be5676607 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -2327,7 +2327,7 @@ static void psys_thread_create_path(ParticleTask *task, struct ChildParticle *cp child_keys->segments = -1; } -static void exec_child_path_cache(TaskPool *UNUSED(pool), void *taskdata, int UNUSED(threadid)) +static void exec_child_path_cache(TaskPool * __restrict UNUSED(pool), void *taskdata, int UNUSED(threadid)) { ParticleTask *task = taskdata; ParticleThreadContext *ctx = task->ctx; diff --git a/source/blender/blenkernel/intern/particle_distribute.c b/source/blender/blenkernel/intern/particle_distribute.c index 0c7d85967f3..9523ece5f73 100644 --- a/source/blender/blenkernel/intern/particle_distribute.c +++ b/source/blender/blenkernel/intern/particle_distribute.c @@ -660,7 +660,7 @@ static void distribute_children_exec(ParticleTask *thread, ChildParticle *cpa, i BLI_rng_skip(thread->rng, rng_skip_tot); } -static void exec_distribute_parent(TaskPool *UNUSED(pool), void *taskdata, int UNUSED(threadid)) +static void exec_distribute_parent(TaskPool * __restrict UNUSED(pool), void *taskdata, int UNUSED(threadid)) { ParticleTask *task = taskdata; ParticleSystem *psys= task->ctx->sim.psys; @@ -686,7 +686,7 @@ static void exec_distribute_parent(TaskPool *UNUSED(pool), void *taskdata, int U } } -static void exec_distribute_child(TaskPool *UNUSED(pool), void *taskdata, int UNUSED(threadid)) +static void exec_distribute_child(TaskPool * __restrict UNUSED(pool), void *taskdata, int UNUSED(threadid)) { ParticleTask *task = taskdata; ParticleSystem *psys = task->ctx->sim.psys; diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 504c1166019..73d211f5c44 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -1472,7 +1472,7 @@ static void scene_update_all_bases(EvaluationContext *eval_ctx, Scene *scene, Sc } } -static void scene_update_object_func(TaskPool *pool, void *taskdata, int threadid) +static void scene_update_object_func(TaskPool * __restrict pool, void *taskdata, int threadid) { /* Disable print for now in favor of summary statistics at the end of update. */ #define PRINT if (false) printf diff --git a/source/blender/blenlib/BLI_timecode.h b/source/blender/blenlib/BLI_timecode.h index 235d928b460..a45613c6b1e 100644 --- a/source/blender/blenlib/BLI_timecode.h +++ b/source/blender/blenlib/BLI_timecode.h @@ -39,7 +39,7 @@ size_t BLI_timecode_string_from_time( ATTR_NONNULL(); size_t BLI_timecode_string_from_time_simple( - char *str, size_t maxlen, const double time_seconds) + char *str, const size_t maxlen, const double time_seconds) ATTR_NONNULL(); size_t BLI_timecode_string_from_time_seconds( diff --git a/source/blender/blenlib/intern/buffer.c b/source/blender/blenlib/intern/buffer.c index 24b2228c884..525b18333af 100644 --- a/source/blender/blenlib/intern/buffer.c +++ b/source/blender/blenlib/intern/buffer.c @@ -107,7 +107,7 @@ void BLI_buffer_resize(BLI_Buffer *buffer, const size_t new_count) * - Ignored (malloc'd) * - Cleared (when BLI_BUFFER_USE_CALLOC is set) */ -void BLI_buffer_reinit(BLI_Buffer *buffer, size_t new_count) +void BLI_buffer_reinit(BLI_Buffer *buffer, const size_t new_count) { if (UNLIKELY(new_count > buffer->alloc_count)) { if ((buffer->flag & BLI_BUFFER_USE_STATIC) == 0) { diff --git a/source/blender/blenlib/intern/dynlib.c b/source/blender/blenlib/intern/dynlib.c index e916b01e859..b47c2ee60a6 100644 --- a/source/blender/blenlib/intern/dynlib.c +++ b/source/blender/blenlib/intern/dynlib.c @@ -42,8 +42,9 @@ struct DynamicLibrary { }; #ifdef WIN32 - +#ifndef _WIN32_WINNT #define _WIN32_WINNT 0x501 /* Windows XP or newer */ +#endif #define WIN32_LEAN_AND_MEAN #include #include "utf_winfunc.h" diff --git a/source/blender/blenlib/intern/sort.c b/source/blender/blenlib/intern/sort.c index c5922feb0ed..190c874e1b5 100644 --- a/source/blender/blenlib/intern/sort.c +++ b/source/blender/blenlib/intern/sort.c @@ -40,6 +40,10 @@ #include "BLI_sort.h" +#ifdef min /* for msvc */ +# undef min +#endif + /* note: modified to use glibc arg order for callback */ /* **** qsort based on FreeBSD source (libkern\qsort.c) **** */ BLI_INLINE char *med3(char *, char *, char *, BLI_sort_cmp_t, void *); diff --git a/source/blender/blenlib/intern/string.c b/source/blender/blenlib/intern/string.c index e93d2b7507a..efc89ff6a15 100644 --- a/source/blender/blenlib/intern/string.c +++ b/source/blender/blenlib/intern/string.c @@ -841,7 +841,7 @@ bool BLI_strn_endswith(const char *__restrict str, const char *__restrict end, s * \param end The string we look for at the end. * \return If str ends with end. */ -bool BLI_str_endswith(const char *__restrict str, const char *end) +bool BLI_str_endswith(const char *__restrict str, const char * __restrict end) { const size_t slength = strlen(str); return BLI_strn_endswith(str, end, slength); diff --git a/source/blender/blenlib/intern/time.c b/source/blender/blenlib/intern/time.c index a0fb78cd193..3cf3221bd08 100644 --- a/source/blender/blenlib/intern/time.c +++ b/source/blender/blenlib/intern/time.c @@ -33,8 +33,9 @@ #include "PIL_time.h" #ifdef WIN32 - +#ifndef _WIN32_WINNT #define _WIN32_WINNT 0x501 /* Windows XP or newer */ +#endif #define WIN32_LEAN_AND_MEAN #include diff --git a/source/blender/editors/armature/editarmature_retarget.c b/source/blender/editors/armature/editarmature_retarget.c index 2235f9f92cc..7c09ad49f35 100644 --- a/source/blender/editors/armature/editarmature_retarget.c +++ b/source/blender/editors/armature/editarmature_retarget.c @@ -82,7 +82,7 @@ static RigGraph *GLOBAL_RIGG = NULL; /*******************************************************************************************************/ -void exec_retargetArctoArc(TaskPool *pool, void *taskdata, int threadid); +void exec_retargetArctoArc(TaskPool * __restrict pool, void *taskdata, int threadid); static void RIG_calculateEdgeAngles(RigEdge *edge_first, RigEdge *edge_second); float rollBoneByQuat(EditBone *bone, float old_up_axis[3], float qrot[4]); @@ -2143,7 +2143,7 @@ static void retargetArctoArc(bContext *C, RigGraph *rigg, RigArc *iarc, RigNode BLI_task_pool_push(rigg->task_pool, exec_retargetArctoArc, p, true, TASK_PRIORITY_HIGH); } -void exec_retargetArctoArc(TaskPool *UNUSED(pool), void *taskdata, int UNUSED(threadid)) +void exec_retargetArctoArc(TaskPool * __restrict UNUSED(pool), void *taskdata, int UNUSED(threadid)) { RetargetParam *p = (RetargetParam *)taskdata; RigGraph *rigg = p->rigg; diff --git a/source/blender/editors/armature/meshlaplacian.c b/source/blender/editors/armature/meshlaplacian.c index ce87ffb3494..549b60c2ece 100644 --- a/source/blender/editors/armature/meshlaplacian.c +++ b/source/blender/editors/armature/meshlaplacian.c @@ -576,7 +576,7 @@ static void heat_laplacian_create(LaplacianSystem *sys) static void heat_system_free(LaplacianSystem *sys) { BLI_bvhtree_free(sys->heat.bvhtree); - MEM_freeN(sys->heat.vltree); + MEM_freeN((void *)sys->heat.vltree); MEM_freeN((void *)sys->heat.mlooptri); MEM_freeN(sys->heat.mindist); diff --git a/source/blender/editors/curve/curve_intern.h b/source/blender/editors/curve/curve_intern.h index 29904bf2344..ce7487f5a90 100644 --- a/source/blender/editors/curve/curve_intern.h +++ b/source/blender/editors/curve/curve_intern.h @@ -134,7 +134,7 @@ bool ED_curve_pick_vert( /* helper functions */ void ed_editnurb_translate_flag(struct ListBase *editnurb, short flag, const float vec[3]); -bool ed_editnurb_extrude_flag(struct EditNurb *editnurb, short flag); +bool ed_editnurb_extrude_flag(struct EditNurb *editnurb, const short flag); bool ed_editnurb_spin(float viewmat[4][4], struct Object *obedit, const float axis[3], const float cent[3]); /* editcurve_select.c */ diff --git a/source/blender/editors/include/ED_transform.h b/source/blender/editors/include/ED_transform.h index 19bfb94e130..73f7cd2ba7c 100644 --- a/source/blender/editors/include/ED_transform.h +++ b/source/blender/editors/include/ED_transform.h @@ -196,13 +196,13 @@ bool snapObjectsContext( /* taks args for all settings */ bool snapObjectsEx( struct Scene *scene, struct View3D *v3d, struct ARegion *ar, struct Base *base_act, struct Object *obedit, - const float mval[2], SnapSelect snap_select, short snap_mode, + const float mval[2], SnapSelect snap_select, const short snap_mode, float *ray_depth, /* return args */ float r_loc[3], float r_no[3], float *r_dist_px); bool snapObjectsRayEx( struct Scene *scene, struct View3D *v3d, struct ARegion *ar, struct Base *base_act, struct Object *obedit, - const float mval[2], SnapSelect snap_select, short snap_mode, + const float mval[2], SnapSelect snap_select, const short snap_mode, const float ray_start[3], const float ray_normal[3], float *ray_depth, /* return args */ float r_loc[3], float r_no[3], float *r_dist_px, int *r_index, diff --git a/source/blender/editors/mask/mask_draw.c b/source/blender/editors/mask/mask_draw.c index 2efa9e211c9..727c2d8adc8 100644 --- a/source/blender/editors/mask/mask_draw.c +++ b/source/blender/editors/mask/mask_draw.c @@ -669,7 +669,7 @@ typedef struct ThreadedMaskRasterizeData { int num_scanlines; } ThreadedMaskRasterizeData; -static void mask_rasterize_func(TaskPool *pool, void *taskdata, int UNUSED(threadid)) +static void mask_rasterize_func(TaskPool * __restrict pool, void *taskdata, int UNUSED(threadid)) { ThreadedMaskRasterizeState *state = (ThreadedMaskRasterizeState *) BLI_task_pool_userdata(pool); ThreadedMaskRasterizeData *data = (ThreadedMaskRasterizeData *) taskdata; diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c index 2685581a81d..4e85d89ab4b 100644 --- a/source/blender/editors/sculpt_paint/paint_image_proj.c +++ b/source/blender/editors/sculpt_paint/paint_image_proj.c @@ -3638,7 +3638,7 @@ static void project_paint_build_proj_ima( projIma->partRedrawRect = BLI_memarena_alloc(arena, sizeof(ImagePaintPartialRedraw) * PROJ_BOUNDBOX_SQUARED); memset(projIma->partRedrawRect, 0, sizeof(ImagePaintPartialRedraw) * PROJ_BOUNDBOX_SQUARED); projIma->undoRect = (volatile void **) BLI_memarena_alloc(arena, size); - memset(projIma->undoRect, 0, size); + memset((void *)projIma->undoRect, 0, size); projIma->maskRect = BLI_memarena_alloc(arena, size); memset(projIma->maskRect, 0, size); projIma->valid = BLI_memarena_alloc(arena, size); diff --git a/source/blender/editors/space_clip/clip_editor.c b/source/blender/editors/space_clip/clip_editor.c index dbedfaa1de4..1ff656243d6 100644 --- a/source/blender/editors/space_clip/clip_editor.c +++ b/source/blender/editors/space_clip/clip_editor.c @@ -779,7 +779,7 @@ static unsigned char *prefetch_thread_next_frame( return mem; } -static void prefetch_task_func(TaskPool *pool, void *task_data, int UNUSED(threadid)) +static void prefetch_task_func(TaskPool * __restrict pool, void *task_data, int UNUSED(threadid)) { PrefetchQueue *queue = (PrefetchQueue *)BLI_task_pool_userdata(pool); MovieClip *clip = (MovieClip *)task_data; diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c index 7a66599655f..980657fc1cb 100644 --- a/source/blender/editors/space_clip/clip_ops.c +++ b/source/blender/editors/space_clip/clip_ops.c @@ -1180,7 +1180,7 @@ static unsigned char *proxy_thread_next_frame(ProxyQueue *queue, MovieClip *clip return mem; } -static void proxy_task_func(TaskPool *pool, void *task_data, int UNUSED(threadid)) +static void proxy_task_func(TaskPool * __restrict pool, void *task_data, int UNUSED(threadid)) { ProxyThread *data = (ProxyThread *)task_data; ProxyQueue *queue = (ProxyQueue *)BLI_task_pool_userdata(pool); diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c index 85d92d07222..98eed5bdc7d 100644 --- a/source/blender/editors/space_file/filelist.c +++ b/source/blender/editors/space_file/filelist.c @@ -1058,7 +1058,7 @@ static void filelist_intern_free(FileListIntern *filelist_intern) MEM_SAFE_FREE(filelist_intern->filtered); } -static void filelist_cache_preview_runf(TaskPool *pool, void *taskdata, int UNUSED(threadid)) +static void filelist_cache_preview_runf(TaskPool *__restrict pool, void *taskdata, int UNUSED(threadid)) { FileListEntryCache *cache = BLI_task_pool_userdata(pool); FileListEntryPreview *preview = taskdata; @@ -1094,7 +1094,7 @@ static void filelist_cache_preview_runf(TaskPool *pool, void *taskdata, int UNUS // printf("%s: End (%d)...\n", __func__, threadid); } -static void filelist_cache_preview_freef(TaskPool *UNUSED(pool), void *taskdata, int UNUSED(threadid)) +static void filelist_cache_preview_freef(TaskPool * __restrict UNUSED(pool), void *taskdata, int UNUSED(threadid)) { FileListEntryPreview *preview = taskdata; diff --git a/source/blender/imbuf/intern/imageprocess.c b/source/blender/imbuf/intern/imageprocess.c index d44f0dc86f4..9e4bb957f66 100644 --- a/source/blender/imbuf/intern/imageprocess.c +++ b/source/blender/imbuf/intern/imageprocess.c @@ -324,7 +324,7 @@ void nearest_interpolation(ImBuf *in, ImBuf *out, float x, float y, int xout, in /*********************** Threaded image processing *************************/ -static void processor_apply_func(TaskPool *pool, void *taskdata, int UNUSED(threadid)) +static void processor_apply_func(TaskPool * __restrict pool, void *taskdata, int UNUSED(threadid)) { void (*do_thread) (void *) = (void (*) (void *)) BLI_task_pool_userdata(pool); do_thread(taskdata); diff --git a/source/blender/render/intern/source/volume_precache.c b/source/blender/render/intern/source/volume_precache.c index 6f09e9c5f53..5377d0eba00 100644 --- a/source/blender/render/intern/source/volume_precache.c +++ b/source/blender/render/intern/source/volume_precache.c @@ -512,7 +512,7 @@ typedef struct VolPrecacheState { int totparts; } VolPrecacheState; -static void vol_precache_part(TaskPool *pool, void *taskdata, int UNUSED(threadid)) +static void vol_precache_part(TaskPool * __restrict pool, void *taskdata, int UNUSED(threadid)) { VolPrecacheState *state = (VolPrecacheState *)BLI_task_pool_userdata(pool); VolPrecachePart *pa = (VolPrecachePart *)taskdata; -- cgit v1.2.3