warning/portability fixes.

This commit is contained in:
Campbell Barton 2010-10-30 17:16:37 +00:00
parent c69f2eaca9
commit 001259ccb6
5 changed files with 33 additions and 15 deletions

@ -36,7 +36,7 @@ struct Brush;
struct ImBuf; struct ImBuf;
struct Scene; struct Scene;
struct wmOperator; struct wmOperator;
enum CurveMappingPreset; // enum CurveMappingPreset;
/* datablock functions */ /* datablock functions */
struct Brush *add_brush(const char *name); struct Brush *add_brush(const char *name);

@ -279,8 +279,11 @@ behaviour, though it may not be the best in practice.
/*little macro so inline keyword works*/ /*little macro so inline keyword works*/
#if defined(_MSC_VER) #if defined(_MSC_VER)
#define BM_INLINE static __forceinline #define BM_INLINE static __forceinline
#else #elif defined(__GNUC__)
#define BM_INLINE static inline __attribute((always_inline)) #define BM_INLINE static inline __attribute((always_inline))
#else
#warning "MSC/GNUC defines not found, inline non-functional"
#define BM_INLINE static
#endif #endif
#define BMEMSET(mem, val, size) {unsigned int _i; char *_c = (char*) mem; for (_i=0; _i<size; _i++) *_c++ = val;} #define BMEMSET(mem, val, size) {unsigned int _i; char *_c = (char*) mem; for (_i=0; _i<size; _i++) *_c++ = val;}

@ -154,9 +154,11 @@ void BLI_mempool_free(BLI_mempool *pool, void *addr){ //doesnt protect against d
first = pool->chunks.first; first = pool->chunks.first;
BLI_remlink(&pool->chunks, first); BLI_remlink(&pool->chunks, first);
for(mpchunk = pool->chunks.first; mpchunk; mpchunk = mpchunk->next) for(mpchunk = pool->chunks.first; mpchunk; mpchunk = mpchunk->next) {
pool->use_sysmalloc ? free(mpchunk->data) : MEM_freeN(mpchunk->data); if(pool->use_sysmalloc) free(mpchunk->data);
else MEM_freeN(mpchunk->data);
}
pool->use_sysmalloc ? BLI_freelist(&(pool->chunks)) : BLI_freelistN(&(pool->chunks)); pool->use_sysmalloc ? BLI_freelist(&(pool->chunks)) : BLI_freelistN(&(pool->chunks));
BLI_addtail(&pool->chunks, first); BLI_addtail(&pool->chunks, first);
@ -175,9 +177,18 @@ void BLI_mempool_free(BLI_mempool *pool, void *addr){ //doesnt protect against d
void BLI_mempool_destroy(BLI_mempool *pool) void BLI_mempool_destroy(BLI_mempool *pool)
{ {
BLI_mempool_chunk *mpchunk=NULL; BLI_mempool_chunk *mpchunk=NULL;
for(mpchunk = pool->chunks.first; mpchunk; mpchunk = mpchunk->next) if(pool->use_sysmalloc) {
pool->use_sysmalloc ? free(mpchunk->data) : MEM_freeN(mpchunk->data); for(mpchunk = pool->chunks.first; mpchunk; mpchunk = mpchunk->next) {
free(mpchunk->data);
pool->use_sysmalloc ? BLI_freelist(&(pool->chunks)) : BLI_freelistN(&(pool->chunks)); }
pool->use_sysmalloc ? free(pool) : MEM_freeN(pool); BLI_freelist(&(pool->chunks));
free(pool);
}
else {
for(mpchunk = pool->chunks.first; mpchunk; mpchunk = mpchunk->next) {
MEM_freeN(mpchunk->data);
}
BLI_freelistN(&(pool->chunks));
MEM_freeN(pool);
}
} }

@ -1035,12 +1035,17 @@ void ED_screen_draw(wmWindow *win)
/* make this screen usable */ /* make this screen usable */
/* for file read and first use, for scaling window, area moves */ /* for file read and first use, for scaling window, area moves */
void ED_screen_refresh(wmWindowManager *wm, wmWindow *win) void ED_screen_refresh(wmWindowManager *wm, wmWindow *win)
{ {
ScrArea *sa;
rcti winrct= {0, win->sizex-1, 0, win->sizey-1};
/* exception for bg mode, we only need the screen context */ /* exception for bg mode, we only need the screen context */
if (!G.background) { if (!G.background) {
ScrArea *sa;
rcti winrct;
winrct.xmin= 0;
winrct.xmax= win->sizex-1;
winrct.ymin= 0;
winrct.ymax= win->sizey-1;
screen_test_scale(win->screen, win->sizex, win->sizey); screen_test_scale(win->screen, win->sizex, win->sizey);
if(win->screen->mainwin==0) if(win->screen->mainwin==0)

@ -1502,7 +1502,6 @@ static int sequencer_swap_inputs_exec(bContext *C, wmOperator *op)
{ {
Scene *scene= CTX_data_scene(C); Scene *scene= CTX_data_scene(C);
Sequence *seq, *last_seq = seq_active_get(scene); Sequence *seq, *last_seq = seq_active_get(scene);
char *error_msg;
if(last_seq->seq1==NULL || last_seq->seq2 == NULL) { if(last_seq->seq1==NULL || last_seq->seq2 == NULL) {
BKE_report(op->reports, RPT_ERROR, "No valid inputs to swap"); BKE_report(op->reports, RPT_ERROR, "No valid inputs to swap");