Code cleanup: fix some vs2012 compiler warnings

This commit is contained in:
Brecht Van Lommel 2013-06-21 12:33:19 +00:00
parent d6f38e4e01
commit 2df82a2a2b
14 changed files with 53 additions and 45 deletions

@ -401,8 +401,14 @@ macro(TEST_SSE_SUPPORT
set(${_sse_flags} "-msse")
set(${_sse2_flags} "-msse2")
elseif(MSVC)
set(${_sse_flags} "/arch:SSE")
set(${_sse2_flags} "/arch:SSE2")
# x86_64 has this auto enabled
if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
set(${_sse_flags} "")
set(${_sse2_flags} "")
else()
set(${_sse_flags} "/arch:SSE")
set(${_sse2_flags} "/arch:SSE2")
endif()
elseif(CMAKE_C_COMPILER_ID MATCHES "Intel")
set(${_sse_flags} "") # icc defaults to -msse
set(${_sse2_flags} "-msse2")

@ -113,8 +113,8 @@ const char *bl_locale_pgettext(const char *msgctxt, const char *msgid)
return r;
return msgid;
}
catch(std::exception const &e) {
catch(std::exception const &) {
// std::cout << "bl_locale_pgettext(" << msgctxt << ", " << msgid << "): " << e.what() << " \n";
return msgid;
}
}
}

@ -66,7 +66,7 @@ static void free_locales(void)
MEM_freeN((void *)locales_menu[idx].description); /* Also frees locales's relevant value! */
}
MEM_freeN(locales);
MEM_freeN((void *)locales);
locales = NULL;
}
if (locales_menu) {

@ -3110,7 +3110,7 @@ void accumulate_vertex_normals(float n1[3], float n2[3], float n3[3],
/* Add weighted face normal component into normals of the face vertices.
* Caller must pass pre-allocated vdiffs of nverts length. */
void accumulate_vertex_normals_poly(float **vertnos, const float polyno[3],
const float **vertcos, float vdiffs[][3], int nverts)
const float **vertcos, float vdiffs[][3], const int nverts)
{
int i;

@ -556,7 +556,7 @@ void BLI_timestr(double _time, char *str, size_t maxlen)
}
/* determine the length of a fixed-size string */
size_t BLI_strnlen(const char *s, size_t maxlen)
size_t BLI_strnlen(const char *s, const size_t maxlen)
{
size_t len;

@ -41,7 +41,7 @@
#define WIN32_SKIP_HKEY_PROTECTION // need to use HKEY
#include "BLI_winstuff.h"
#include "BLI_utildefines.h"z
#include "BLI_utildefines.h"
#include "BLI_path_util.h"
#include "BLI_string.h"

@ -84,8 +84,8 @@
#include "uvedit_intern.h"
static void uv_select_all_perform(Scene *scene, Image *ima, BMEditMesh *em, int action);
static void uv_select_flush_from_tag_face(SpaceImage *sima, Scene *scene, Object *obedit, bool select);
static void uv_select_flush_from_tag_loop(SpaceImage *sima, Scene *scene, Object *obedit, bool select);
static void uv_select_flush_from_tag_face(SpaceImage *sima, Scene *scene, Object *obedit, const bool select);
static void uv_select_flush_from_tag_loop(SpaceImage *sima, Scene *scene, Object *obedit, const bool select);
/************************* state testing ************************/
@ -2694,7 +2694,7 @@ static void uv_select_flush_from_tag_face(SpaceImage *sima, Scene *scene, Object
*
* \note! This function is very similar to #uv_select_flush_from_tag_loop, be sure to update both upon changing.
*/
static void uv_select_flush_from_tag_loop(SpaceImage *sima, Scene *scene, Object *obedit, bool select)
static void uv_select_flush_from_tag_loop(SpaceImage *sima, Scene *scene, Object *obedit, const bool select)
{
/* Selecting UV Loops with some modes requires us to change
* the selection in other faces (depending on the sticky mode).

@ -248,24 +248,24 @@ typedef struct ImBuf {
/* dds */
#ifdef WITH_DDS
#ifndef MAKEFOURCC
#define MAKEFOURCC(ch0, ch1, ch2, ch3)\
#ifndef DDS_MAKEFOURCC
#define DDS_MAKEFOURCC(ch0, ch1, ch2, ch3)\
((unsigned long)(unsigned char)(ch0) | \
((unsigned long)(unsigned char)(ch1) << 8) | \
((unsigned long)(unsigned char)(ch2) << 16) | \
((unsigned long)(unsigned char)(ch3) << 24))
#endif /* MAKEFOURCC */
#endif /* DDS_MAKEFOURCC */
/*
* FOURCC codes for DX compressed-texture pixel formats
*/
#define FOURCC_DDS (MAKEFOURCC('D','D','S',' '))
#define FOURCC_DXT1 (MAKEFOURCC('D','X','T','1'))
#define FOURCC_DXT2 (MAKEFOURCC('D','X','T','2'))
#define FOURCC_DXT3 (MAKEFOURCC('D','X','T','3'))
#define FOURCC_DXT4 (MAKEFOURCC('D','X','T','4'))
#define FOURCC_DXT5 (MAKEFOURCC('D','X','T','5'))
#define FOURCC_DDS (DDS_MAKEFOURCC('D','D','S',' '))
#define FOURCC_DXT1 (DDS_MAKEFOURCC('D','X','T','1'))
#define FOURCC_DXT2 (DDS_MAKEFOURCC('D','X','T','2'))
#define FOURCC_DXT3 (DDS_MAKEFOURCC('D','X','T','3'))
#define FOURCC_DXT4 (DDS_MAKEFOURCC('D','X','T','4'))
#define FOURCC_DXT5 (DDS_MAKEFOURCC('D','X','T','5'))
#endif /* DDS */
extern const char *imb_ext_image[];

@ -65,28 +65,28 @@
/*** declarations ***/
#if !defined(MAKEFOURCC)
# define MAKEFOURCC(ch0, ch1, ch2, ch3) \
#if !defined(DDS_MAKEFOURCC)
# define DDS_MAKEFOURCC(ch0, ch1, ch2, ch3) \
(uint(uint8(ch0)) | (uint(uint8(ch1)) << 8) | \
(uint(uint8(ch2)) << 16) | (uint(uint8(ch3)) << 24 ))
#endif
static const uint FOURCC_NVTT = MAKEFOURCC('N', 'V', 'T', 'T');
static const uint FOURCC_DDS = MAKEFOURCC('D', 'D', 'S', ' ');
static const uint FOURCC_DXT1 = MAKEFOURCC('D', 'X', 'T', '1');
static const uint FOURCC_DXT2 = MAKEFOURCC('D', 'X', 'T', '2');
static const uint FOURCC_DXT3 = MAKEFOURCC('D', 'X', 'T', '3');
static const uint FOURCC_DXT4 = MAKEFOURCC('D', 'X', 'T', '4');
static const uint FOURCC_DXT5 = MAKEFOURCC('D', 'X', 'T', '5');
static const uint FOURCC_RXGB = MAKEFOURCC('R', 'X', 'G', 'B');
static const uint FOURCC_ATI1 = MAKEFOURCC('A', 'T', 'I', '1');
static const uint FOURCC_ATI2 = MAKEFOURCC('A', 'T', 'I', '2');
static const uint FOURCC_NVTT = DDS_MAKEFOURCC('N', 'V', 'T', 'T');
static const uint FOURCC_DDS = DDS_MAKEFOURCC('D', 'D', 'S', ' ');
static const uint FOURCC_DXT1 = DDS_MAKEFOURCC('D', 'X', 'T', '1');
static const uint FOURCC_DXT2 = DDS_MAKEFOURCC('D', 'X', 'T', '2');
static const uint FOURCC_DXT3 = DDS_MAKEFOURCC('D', 'X', 'T', '3');
static const uint FOURCC_DXT4 = DDS_MAKEFOURCC('D', 'X', 'T', '4');
static const uint FOURCC_DXT5 = DDS_MAKEFOURCC('D', 'X', 'T', '5');
static const uint FOURCC_RXGB = DDS_MAKEFOURCC('R', 'X', 'G', 'B');
static const uint FOURCC_ATI1 = DDS_MAKEFOURCC('A', 'T', 'I', '1');
static const uint FOURCC_ATI2 = DDS_MAKEFOURCC('A', 'T', 'I', '2');
static const uint FOURCC_A2XY = MAKEFOURCC('A', '2', 'X', 'Y');
static const uint FOURCC_A2XY = DDS_MAKEFOURCC('A', '2', 'X', 'Y');
static const uint FOURCC_DX10 = MAKEFOURCC('D', 'X', '1', '0');
static const uint FOURCC_DX10 = DDS_MAKEFOURCC('D', 'X', '1', '0');
static const uint FOURCC_UVER = MAKEFOURCC('U', 'V', 'E', 'R');
static const uint FOURCC_UVER = DDS_MAKEFOURCC('U', 'V', 'E', 'R');
// 32 bit RGB formats.
static const uint D3DFMT_R8G8B8 = 20;
@ -672,7 +672,7 @@ void DDSHeader::setFourCC(uint8 c0, uint8 c1, uint8 c2, uint8 c3)
{
// set fourcc pixel format.
this->pf.flags = DDPF_FOURCC;
this->pf.fourcc = MAKEFOURCC(c0, c1, c2, c3);
this->pf.fourcc = DDS_MAKEFOURCC(c0, c1, c2, c3);
this->pf.bitcount = 0;
this->pf.rmask = 0;
@ -696,7 +696,7 @@ void DDSHeader::setFormatCode(uint32 code)
void DDSHeader::setSwizzleCode(uint8 c0, uint8 c1, uint8 c2, uint8 c3)
{
this->pf.bitcount = MAKEFOURCC(c0, c1, c2, c3);
this->pf.bitcount = DDS_MAKEFOURCC(c0, c1, c2, c3);
}

@ -640,7 +640,7 @@ void IMB_exrtile_begin_write(void *handle, const char *filename, int mipmap, int
data->ofile_stream = new OFileStream(filename);
data->tofile = new TiledOutputFile(*(data->ofile_stream), header);
}
catch (const std::exception &exc) {
catch (const std::exception &) {
delete data->tofile;
delete data->ofile_stream;
@ -660,7 +660,7 @@ int IMB_exr_begin_read(void *handle, const char *filename, int *width, int *heig
data->ifile_stream = new IFileStream(filename);
data->ifile = new InputFile(*(data->ifile_stream));
}
catch (const std::exception &exc) {
catch (const std::exception &) {
delete data->ifile;
delete data->ifile_stream;

@ -268,7 +268,7 @@ void make_sample_tables(Render *re)
SampleTables *st;
float flweight[32];
float weight[32], totw, val, *fpx1, *fpx2, *fpy1, *fpy2, *m3, *m4;
int i, j, a;
int i, j, a, centmasksize;
/* optimization tables, only once */
if (firsttime) {
@ -303,7 +303,8 @@ void make_sample_tables(Render *re)
if (a & 128) st->cmask[a]++;
}
st->centmask = MEM_mallocN((1 << re->osa), "Initfilt3");
centmasksize = (1 << re->osa);
st->centmask = MEM_mallocN(centmasksize, "Initfilt3");
for (a = 0; a < 16; a++) {
st->centLut[a] = -0.45f + ((float)a) / 16.0f;
@ -425,7 +426,7 @@ void make_sample_tables(Render *re)
}
}
for (a = (1 << re->osa) - 1; a > 0; a--) {
for (a = centmasksize - 1; a > 0; a--) {
val = st->cmask[a & 255] + st->cmask[a >> 8];
i = 8 + (15.9f * (fpy1[a & 255] + fpy2[a >> 8]) / val);
CLAMP(i, 0, 15);

@ -224,7 +224,7 @@ static int read_voxeldata_header(FILE *fp, struct VoxelData *vd)
return 1;
}
static void init_frame_smoke(VoxelData *vd, float cfra)
static void init_frame_smoke(VoxelData *vd, int cfra)
{
#ifdef WITH_SMOKE
Object *ob;

@ -792,7 +792,7 @@ const char *WM_key_event_string(short type)
return "";
}
int WM_keymap_item_to_string(wmKeyMapItem *kmi, char *str, int len)
int WM_keymap_item_to_string(wmKeyMapItem *kmi, char *str, const int len)
{
char buf[128];

@ -584,7 +584,6 @@ void VideoFFmpeg::openCam (char *file, short camIdx)
AVInputFormat *inputFormat;
AVDictionary *formatParams = NULL;
char filename[28], rateStr[20];
char *p;
#ifdef WIN32
// video capture on windows only through Video For Windows driver
@ -608,6 +607,8 @@ void VideoFFmpeg::openCam (char *file, short camIdx)
// /dev/ieee1394/1:ntsc
// dv1394:secam
// v4l:pal
char *p;
if (file && strstr(file, "1394") != NULL)
{
// the user specifies a driver, check if it is v4l or d41394