Patch [#33196] Warning Fixes 11-16-2012
* MEM_CacheLimitier - Size type to int conversion, should be safe for now (doing my best Bill Gates 640k impression) * OpenNL CMakeLists.txt - MSVC and GCC have slightly different ways to remove definitions (DEBUG) without the compiler complaining * BLI_math inlines - The include guard name and inline option macro name should be different. Suppressed warning about not exporting any symbols from inline math library * BLI string / utf8 - Fixed some inconsistencies between declarations and definitions * nodes - node_composite_util is apparently not used unless you enable the legacy compositor, so it should not be compiled in that case. Leaving out changes to BLI_fileops for now, need to do more testing.
This commit is contained in:
parent
c407c951a0
commit
69b88cf719
|
@ -247,8 +247,10 @@ private:
|
||||||
if (!elem->can_destroy())
|
if (!elem->can_destroy())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* by default 0 means higherst priority element */
|
/* by default 0 means highest priority element */
|
||||||
int priority = -(queue.size() - i - 1);
|
/* casting a size type to int is questionable,
|
||||||
|
but unlikely to cause problems */
|
||||||
|
int priority = -((int)(queue.size()) - i - 1);
|
||||||
priority = getItemPriority(elem->get()->get_data(), priority);
|
priority = getItemPriority(elem->get()->get_data(), priority);
|
||||||
|
|
||||||
if (priority < best_match_priority || best_match_elem == NULL) {
|
if (priority < best_match_priority || best_match_elem == NULL) {
|
||||||
|
|
|
@ -28,7 +28,11 @@ remove_strict_flags()
|
||||||
|
|
||||||
# remove debug flag here since this is not a blender maintained library
|
# remove debug flag here since this is not a blender maintained library
|
||||||
# and debug gives a lot of prints on UV unwrapping. developers can enable if they need to.
|
# and debug gives a lot of prints on UV unwrapping. developers can enable if they need to.
|
||||||
add_definitions(-UDEBUG)
|
if(MSVC)
|
||||||
|
remove_definitions(-DDEBUG)
|
||||||
|
else()
|
||||||
|
add_definitions(-UDEBUG)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
# quiet compiler warnings about undefined defines
|
# quiet compiler warnings about undefined defines
|
||||||
|
|
|
@ -170,7 +170,7 @@
|
||||||
} (void)0
|
} (void)0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __BLI_MATH_INLINE_H__
|
#if BLI_MATH_DO_INLINE
|
||||||
#include "intern/math_base_inline.c"
|
#include "intern/math_base_inline.c"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -203,7 +203,7 @@ MINLINE int is_power_of_2_i(int n);
|
||||||
MINLINE int power_of_2_max_i(int n);
|
MINLINE int power_of_2_max_i(int n);
|
||||||
MINLINE int power_of_2_min_i(int n);
|
MINLINE int power_of_2_min_i(int n);
|
||||||
|
|
||||||
MINLINE float shell_angle_to_dist(float angle);
|
MINLINE float shell_angle_to_dist(const float angle);
|
||||||
|
|
||||||
#if (defined(WIN32) || defined(WIN64)) && !defined(FREE_WINDOWS)
|
#if (defined(WIN32) || defined(WIN64)) && !defined(FREE_WINDOWS)
|
||||||
extern double copysign(double x, double y);
|
extern double copysign(double x, double y);
|
||||||
|
|
|
@ -121,7 +121,7 @@ MINLINE int compare_rgb_uchar(const unsigned char a[3], const unsigned char b[3]
|
||||||
|
|
||||||
void lift_gamma_gain_to_asc_cdl(float *lift, float *gamma, float *gain, float *offset, float *slope, float *power);
|
void lift_gamma_gain_to_asc_cdl(float *lift, float *gamma, float *gain, float *offset, float *slope, float *power);
|
||||||
|
|
||||||
#ifdef __BLI_MATH_INLINE_H__
|
#if BLI_MATH_DO_INLINE
|
||||||
#include "intern/math_color_inline.c"
|
#include "intern/math_color_inline.c"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ extern "C" {
|
||||||
|
|
||||||
#include "BLI_math_inline.h"
|
#include "BLI_math_inline.h"
|
||||||
|
|
||||||
#ifdef __BLI_MATH_INLINE_H__
|
#if BLI_MATH_DO_INLINE
|
||||||
#include "intern/math_geom_inline.c"
|
#include "intern/math_geom_inline.c"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -35,9 +35,10 @@ extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* add platform/compiler checks here if it is not supported */
|
/* add platform/compiler checks here if it is not supported */
|
||||||
#define __BLI_MATH_INLINE_H__
|
/* all platforms support forcing inline so this is always enabled */
|
||||||
|
#define BLI_MATH_DO_INLINE 1
|
||||||
|
|
||||||
#ifdef __BLI_MATH_INLINE_H__
|
#if BLI_MATH_DO_INLINE
|
||||||
# ifdef _MSC_VER
|
# ifdef _MSC_VER
|
||||||
# define MINLINE static __forceinline
|
# define MINLINE static __forceinline
|
||||||
# define MALWAYS_INLINE MINLINE
|
# define MALWAYS_INLINE MINLINE
|
||||||
|
|
|
@ -36,7 +36,7 @@ extern "C" {
|
||||||
|
|
||||||
#include "BLI_math_inline.h"
|
#include "BLI_math_inline.h"
|
||||||
|
|
||||||
#ifdef __BLI_MATH_INLINE_H__
|
#if BLI_MATH_DO_INLINE
|
||||||
#include "intern/math_vector_inline.c"
|
#include "intern/math_vector_inline.c"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -174,3 +174,9 @@ if(WIN32)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
blender_add_lib(bf_blenlib "${SRC}" "${INC}" "${INC_SYS}")
|
blender_add_lib(bf_blenlib "${SRC}" "${INC}" "${INC_SYS}")
|
||||||
|
|
||||||
|
if(MSVC)
|
||||||
|
# Quiet warning about inline math library files that do not export symbols.
|
||||||
|
# (normally you'd exclude from project, but we still want to see the files in MSVC)
|
||||||
|
set_target_properties(bf_blenlib PROPERTIES STATIC_LIBRARY_FLAGS /ignore:4221)
|
||||||
|
endif()
|
||||||
|
|
|
@ -27,6 +27,8 @@
|
||||||
* \ingroup bli
|
* \ingroup bli
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef __MATH_BASE_INLINE_C__
|
||||||
|
#define __MATH_BASE_INLINE_C__
|
||||||
|
|
||||||
#include <float.h>
|
#include <float.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -35,9 +37,6 @@
|
||||||
|
|
||||||
#include "BLI_math.h"
|
#include "BLI_math.h"
|
||||||
|
|
||||||
#ifndef __MATH_BASE_INLINE_C__
|
|
||||||
#define __MATH_BASE_INLINE_C__
|
|
||||||
|
|
||||||
/* A few small defines. Keep'em local! */
|
/* A few small defines. Keep'em local! */
|
||||||
#define SMALL_NUMBER 1.e-8f
|
#define SMALL_NUMBER 1.e-8f
|
||||||
|
|
||||||
|
|
|
@ -27,11 +27,12 @@
|
||||||
* \ingroup bli
|
* \ingroup bli
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef __MATH_GEOM_INLINE_C__
|
||||||
|
#define __MATH_GEOM_INLINE_C__
|
||||||
|
|
||||||
#include "BLI_math.h"
|
#include "BLI_math.h"
|
||||||
|
|
||||||
#ifndef __MATH_GEOM_INLINE_C__
|
#include <string.h>
|
||||||
#define __MATH_GEOM_INLINE_C__
|
|
||||||
|
|
||||||
/****************************** Spherical Harmonics **************************/
|
/****************************** Spherical Harmonics **************************/
|
||||||
|
|
||||||
|
|
|
@ -27,12 +27,11 @@
|
||||||
* \ingroup bli
|
* \ingroup bli
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "BLI_math.h"
|
|
||||||
|
|
||||||
#ifndef __MATH_VECTOR_INLINE_C__
|
#ifndef __MATH_VECTOR_INLINE_C__
|
||||||
#define __MATH_VECTOR_INLINE_C__
|
#define __MATH_VECTOR_INLINE_C__
|
||||||
|
|
||||||
|
#include "BLI_math.h"
|
||||||
|
|
||||||
/********************************** Init *************************************/
|
/********************************** Init *************************************/
|
||||||
|
|
||||||
MINLINE void zero_v2(float r[2])
|
MINLINE void zero_v2(float r[2])
|
||||||
|
|
|
@ -56,7 +56,7 @@ char *BLI_strdup(const char *str)
|
||||||
return BLI_strdupn(str, strlen(str));
|
return BLI_strdupn(str, strlen(str));
|
||||||
}
|
}
|
||||||
|
|
||||||
char *BLI_strdupcat(const char *str1, const char *str2)
|
char *BLI_strdupcat(const char *__restrict str1, const char *__restrict str2)
|
||||||
{
|
{
|
||||||
size_t len;
|
size_t len;
|
||||||
char *n;
|
char *n;
|
||||||
|
@ -69,7 +69,7 @@ char *BLI_strdupcat(const char *str1, const char *str2)
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *BLI_strncpy(char *dst, const char *src, const size_t maxncpy)
|
char *BLI_strncpy(char *__restrict dst, const char *__restrict src, const size_t maxncpy)
|
||||||
{
|
{
|
||||||
size_t srclen = strlen(src);
|
size_t srclen = strlen(src);
|
||||||
size_t cpylen = (srclen > (maxncpy - 1)) ? (maxncpy - 1) : srclen;
|
size_t cpylen = (srclen > (maxncpy - 1)) ? (maxncpy - 1) : srclen;
|
||||||
|
@ -81,7 +81,7 @@ char *BLI_strncpy(char *dst, const char *src, const size_t maxncpy)
|
||||||
return dst;
|
return dst;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t BLI_vsnprintf(char *buffer, size_t count, const char *format, va_list arg)
|
size_t BLI_vsnprintf(char *__restrict buffer, size_t count, const char *__restrict format, va_list arg)
|
||||||
{
|
{
|
||||||
size_t n;
|
size_t n;
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ size_t BLI_vsnprintf(char *buffer, size_t count, const char *format, va_list arg
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t BLI_snprintf(char *buffer, size_t count, const char *format, ...)
|
size_t BLI_snprintf(char *__restrict buffer, size_t count, const char *__restrict format, ...)
|
||||||
{
|
{
|
||||||
size_t n;
|
size_t n;
|
||||||
va_list arg;
|
va_list arg;
|
||||||
|
@ -109,7 +109,7 @@ size_t BLI_snprintf(char *buffer, size_t count, const char *format, ...)
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *BLI_sprintfN(const char *format, ...)
|
char *BLI_sprintfN(const char *__restrict format, ...)
|
||||||
{
|
{
|
||||||
DynStr *ds;
|
DynStr *ds;
|
||||||
va_list arg;
|
va_list arg;
|
||||||
|
@ -133,7 +133,7 @@ char *BLI_sprintfN(const char *format, ...)
|
||||||
* TODO: support more fancy string escaping. current code is primitive
|
* TODO: support more fancy string escaping. current code is primitive
|
||||||
* this basically is an ascii version of PyUnicode_EncodeUnicodeEscape()
|
* this basically is an ascii version of PyUnicode_EncodeUnicodeEscape()
|
||||||
* which is a useful reference. */
|
* which is a useful reference. */
|
||||||
size_t BLI_strescape(char *dst, const char *src, const size_t maxncpy)
|
size_t BLI_strescape(char *__restrict dst, const char *__restrict src, const size_t maxncpy)
|
||||||
{
|
{
|
||||||
size_t len = 0;
|
size_t len = 0;
|
||||||
|
|
||||||
|
@ -186,7 +186,7 @@ escape_finish:
|
||||||
*
|
*
|
||||||
* TODO, return the offset and a length so as to avoid doing an allocation.
|
* TODO, return the offset and a length so as to avoid doing an allocation.
|
||||||
*/
|
*/
|
||||||
char *BLI_str_quoted_substrN(const char *str, const char *prefix)
|
char *BLI_str_quoted_substrN(const char *__restrict str, const char *__restrict prefix)
|
||||||
{
|
{
|
||||||
size_t prefixLen = strlen(prefix);
|
size_t prefixLen = strlen(prefix);
|
||||||
char *startMatch, *endMatch;
|
char *startMatch, *endMatch;
|
||||||
|
@ -207,7 +207,7 @@ char *BLI_str_quoted_substrN(const char *str, const char *prefix)
|
||||||
|
|
||||||
/* A rather wasteful string-replacement utility, though this shall do for now...
|
/* A rather wasteful string-replacement utility, though this shall do for now...
|
||||||
* Feel free to replace this with an even safe + nicer alternative */
|
* Feel free to replace this with an even safe + nicer alternative */
|
||||||
char *BLI_replacestr(char *str, const char *oldText, const char *newText)
|
char *BLI_replacestr(char *__restrict str, const char *__restrict oldText, const char *__restrict newText)
|
||||||
{
|
{
|
||||||
DynStr *ds = NULL;
|
DynStr *ds = NULL;
|
||||||
size_t lenOld = strlen(oldText);
|
size_t lenOld = strlen(oldText);
|
||||||
|
|
|
@ -184,7 +184,7 @@ static const size_t utf8_skip_data[256] = {
|
||||||
*dst = '\0'; \
|
*dst = '\0'; \
|
||||||
} (void)0
|
} (void)0
|
||||||
|
|
||||||
char *BLI_strncpy_utf8(char *dst, const char *src, size_t maxncpy)
|
char *BLI_strncpy_utf8(char *__restrict dst, const char *__restrict src, size_t maxncpy)
|
||||||
{
|
{
|
||||||
char *dst_r = dst;
|
char *dst_r = dst;
|
||||||
|
|
||||||
|
@ -196,7 +196,7 @@ char *BLI_strncpy_utf8(char *dst, const char *src, size_t maxncpy)
|
||||||
return dst_r;
|
return dst_r;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *BLI_strncat_utf8(char *dst, const char *src, size_t maxncpy)
|
char *BLI_strncat_utf8(char *__restrict dst, const char *__restrict src, size_t maxncpy)
|
||||||
{
|
{
|
||||||
while (*dst && maxncpy > 0) {
|
while (*dst && maxncpy > 0) {
|
||||||
dst++;
|
dst++;
|
||||||
|
@ -213,7 +213,7 @@ char *BLI_strncat_utf8(char *dst, const char *src, size_t maxncpy)
|
||||||
/* --------------------------------------------------------------------------*/
|
/* --------------------------------------------------------------------------*/
|
||||||
/* wchar_t / utf8 functions */
|
/* wchar_t / utf8 functions */
|
||||||
|
|
||||||
size_t BLI_strncpy_wchar_as_utf8(char *dst, const wchar_t *src, const size_t maxncpy)
|
size_t BLI_strncpy_wchar_as_utf8(char *__restrict dst, const wchar_t *__restrict src, const size_t maxncpy)
|
||||||
{
|
{
|
||||||
size_t len = 0;
|
size_t len = 0;
|
||||||
|
|
||||||
|
@ -289,7 +289,7 @@ size_t BLI_strnlen_utf8(const char *start, const size_t maxlen)
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t BLI_strncpy_wchar_from_utf8(wchar_t *dst_w, const char *src_c, const size_t maxncpy)
|
size_t BLI_strncpy_wchar_from_utf8(wchar_t *__restrict dst_w, const char *__restrict src_c, const size_t maxncpy)
|
||||||
{
|
{
|
||||||
int len = 0;
|
int len = 0;
|
||||||
|
|
||||||
|
@ -419,7 +419,7 @@ unsigned int BLI_str_utf8_as_unicode(const char *p)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* variant that increments the length */
|
/* variant that increments the length */
|
||||||
unsigned int BLI_str_utf8_as_unicode_and_size(const char *p, size_t *index)
|
unsigned int BLI_str_utf8_as_unicode_and_size(const char *__restrict p, size_t *__restrict index)
|
||||||
{
|
{
|
||||||
int i, mask = 0, len;
|
int i, mask = 0, len;
|
||||||
unsigned int result;
|
unsigned int result;
|
||||||
|
@ -435,7 +435,7 @@ unsigned int BLI_str_utf8_as_unicode_and_size(const char *p, size_t *index)
|
||||||
|
|
||||||
/* another variant that steps over the index,
|
/* another variant that steps over the index,
|
||||||
* note, currently this also falls back to latin1 for text drawing. */
|
* note, currently this also falls back to latin1 for text drawing. */
|
||||||
unsigned int BLI_str_utf8_as_unicode_step(const char *p, size_t *index)
|
unsigned int BLI_str_utf8_as_unicode_step(const char *__restrict p, size_t *__restrict index)
|
||||||
{
|
{
|
||||||
int i, mask = 0, len;
|
int i, mask = 0, len;
|
||||||
unsigned int result;
|
unsigned int result;
|
||||||
|
|
|
@ -123,7 +123,6 @@ set(SRC
|
||||||
composite/nodes/node_composite_pixelate.c
|
composite/nodes/node_composite_pixelate.c
|
||||||
|
|
||||||
composite/node_composite_tree.c
|
composite/node_composite_tree.c
|
||||||
composite/node_composite_util.c
|
|
||||||
|
|
||||||
shader/nodes/node_shader_camera.c
|
shader/nodes/node_shader_camera.c
|
||||||
shader/nodes/node_shader_common.c
|
shader/nodes/node_shader_common.c
|
||||||
|
@ -223,7 +222,6 @@ set(SRC
|
||||||
intern/node_common.c
|
intern/node_common.c
|
||||||
intern/node_socket.c
|
intern/node_socket.c
|
||||||
|
|
||||||
composite/node_composite_util.h
|
|
||||||
shader/node_shader_util.h
|
shader/node_shader_util.h
|
||||||
texture/node_texture_util.h
|
texture/node_texture_util.h
|
||||||
|
|
||||||
|
@ -236,6 +234,13 @@ set(SRC
|
||||||
intern/node_common.h
|
intern/node_common.h
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if(WITH_COMPOSITOR_LEGACY)
|
||||||
|
list(APPEND SRC
|
||||||
|
composite/node_composite_util.h
|
||||||
|
composite/node_composite_util.c
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(WITH_PYTHON)
|
if(WITH_PYTHON)
|
||||||
list(APPEND INC
|
list(APPEND INC
|
||||||
../python
|
../python
|
||||||
|
|
Loading…
Reference in New Issue