Cleanup: use function style casts
This commit is contained in:
@@ -363,7 +363,7 @@ void *MEM_guarded_dupallocN(const void *vmemh)
|
||||
}
|
||||
else {
|
||||
newp = MEM_guarded_mallocN_aligned(
|
||||
memh->len, (size_t)memh->alignment, name, AllocationType::ALLOC_FREE);
|
||||
memh->len, size_t(memh->alignment), name, AllocationType::ALLOC_FREE);
|
||||
}
|
||||
|
||||
if (newp == nullptr)
|
||||
|
||||
@@ -859,7 +859,7 @@ void BLI_ghash_clear(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfree
|
||||
|
||||
void BLI_ghash_free(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp)
|
||||
{
|
||||
BLI_assert((int)gh->nentries == BLI_mempool_len(gh->entrypool));
|
||||
BLI_assert(int(gh->nentries) == BLI_mempool_len(gh->entrypool));
|
||||
if (keyfreefp || valfreefp) {
|
||||
ghash_free_cb(gh, keyfreefp, valfreefp);
|
||||
}
|
||||
|
||||
@@ -483,14 +483,13 @@ static void bvhtree_info(BVHTree *tree)
|
||||
tree->branch_num + tree->leaf_num,
|
||||
tree->branch_num,
|
||||
tree->leaf_num);
|
||||
printf(
|
||||
"Memory per node = %ubytes\n",
|
||||
(uint)(sizeof(BVHNode) + sizeof(BVHNode *) * tree->tree_type + sizeof(float) * tree->axis));
|
||||
printf("BV memory = %ubytes\n", (uint)MEM_allocN_len(tree->nodebv));
|
||||
printf("Memory per node = %ubytes\n",
|
||||
uint(sizeof(BVHNode) + sizeof(BVHNode *) * tree->tree_type + sizeof(float) * tree->axis));
|
||||
printf("BV memory = %ubytes\n", uint(MEM_allocN_len(tree->nodebv)));
|
||||
|
||||
printf("Total memory = %ubytes\n",
|
||||
(uint)(sizeof(BVHTree) + MEM_allocN_len(tree->nodes) + MEM_allocN_len(tree->nodearray) +
|
||||
MEM_allocN_len(tree->nodechild) + MEM_allocN_len(tree->nodebv)));
|
||||
uint(sizeof(BVHTree) + MEM_allocN_len(tree->nodes) + MEM_allocN_len(tree->nodearray) +
|
||||
MEM_allocN_len(tree->nodechild) + MEM_allocN_len(tree->nodebv)));
|
||||
|
||||
bvhtree_print_tree(tree, tree->nodes[tree->leaf_num], 0);
|
||||
}
|
||||
|
||||
@@ -354,8 +354,8 @@ BLI_mempool *BLI_mempool_create(uint esize, uint elem_num, uint pchunk, uint fla
|
||||
/* Ensure this is a power of 2, minus the rounding by element size. */
|
||||
#if defined(USE_CHUNK_POW2) && !defined(NDEBUG)
|
||||
{
|
||||
uint final_size = (uint)MEM_SIZE_OVERHEAD + (uint)sizeof(BLI_mempool_chunk) + pool->csize;
|
||||
BLI_assert(((uint)power_of_2_max_u(final_size) - final_size) < pool->esize);
|
||||
uint final_size = uint(MEM_SIZE_OVERHEAD) + uint(sizeof(BLI_mempool_chunk)) + pool->csize;
|
||||
BLI_assert((uint(power_of_2_max_u(final_size)) - final_size) < pool->esize);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -424,7 +424,7 @@ void BLI_polyfill_beautify(const float (*coords)[2],
|
||||
|
||||
/* Now perform iterative rotations. */
|
||||
#if 0
|
||||
eheap_table = BLI_memarena_alloc(arena, sizeof(HeapNode *) * (size_t)edges_len);
|
||||
eheap_table = BLI_memarena_alloc(arena, sizeof(HeapNode *) * size_t(edges_len));
|
||||
#else
|
||||
/* We can re-use this since its big enough. */
|
||||
eheap_table = (HeapNode **)order_edges;
|
||||
|
||||
@@ -49,7 +49,7 @@ struct ScanFillIsect {
|
||||
# define EFLAG_CLEAR(eed, val) \
|
||||
{ \
|
||||
CHECK_TYPE(eed, ScanFillEdge *); \
|
||||
(eed)->user_flag = (eed)->user_flag & ~(uint)val; \
|
||||
(eed)->user_flag = (eed)->user_flag & ~uint(val); \
|
||||
} \
|
||||
(void)0
|
||||
#endif
|
||||
@@ -64,7 +64,7 @@ struct ScanFillIsect {
|
||||
# define VFLAG_CLEAR(eve, val) \
|
||||
{ \
|
||||
CHECK_TYPE(eve, ScanFillVert *); \
|
||||
(eve)->user_flags = (eve)->user_flag & ~(uint)val; \
|
||||
(eve)->user_flags = (eve)->user_flag & ~uint(val); \
|
||||
} \
|
||||
(void)0
|
||||
#endif
|
||||
|
||||
@@ -250,7 +250,7 @@ char *BLI_sprintfN_with_buffer(
|
||||
va_start(args, format);
|
||||
retval = vsnprintf(result, size, format, args);
|
||||
va_end(args);
|
||||
BLI_assert((size_t)(retval + 1) == size);
|
||||
BLI_assert(size_t(retval + 1) == size);
|
||||
UNUSED_VARS_NDEBUG(retval);
|
||||
return result;
|
||||
}
|
||||
@@ -283,7 +283,7 @@ char *BLI_vsprintfN_with_buffer(char *fixed_buf,
|
||||
const size_t size = size_t(retval) + 1;
|
||||
char *result = MEM_malloc_arrayN<char>(size, __func__);
|
||||
retval = vsnprintf(result, size, format, args);
|
||||
BLI_assert((size_t)(retval + 1) == size);
|
||||
BLI_assert(size_t(retval + 1) == size);
|
||||
UNUSED_VARS_NDEBUG(retval);
|
||||
return result;
|
||||
}
|
||||
@@ -508,7 +508,7 @@ char *BLI_str_quoted_substrN(const char *__restrict str, const char *__restrict
|
||||
if (!BLI_str_quoted_substr_range(str, prefix, &start_match_ofs, &end_match_ofs)) {
|
||||
return nullptr;
|
||||
}
|
||||
const size_t escaped_len = (size_t)(end_match_ofs - start_match_ofs);
|
||||
const size_t escaped_len = size_t(end_match_ofs - start_match_ofs);
|
||||
char *result = MEM_malloc_arrayN<char>(escaped_len + 1, __func__);
|
||||
const size_t unescaped_len = BLI_str_unescape(result, str + start_match_ofs, escaped_len);
|
||||
if (unescaped_len != escaped_len) {
|
||||
|
||||
@@ -27,7 +27,7 @@ double BLI_time_now_seconds()
|
||||
if (hasperfcounter == -1) {
|
||||
__int64 ifreq;
|
||||
hasperfcounter = QueryPerformanceFrequency((LARGE_INTEGER *)&ifreq);
|
||||
perffreq = (double)ifreq;
|
||||
perffreq = double(ifreq);
|
||||
}
|
||||
|
||||
if (hasperfcounter) {
|
||||
|
||||
@@ -861,7 +861,7 @@ bool transform_convert_sequencer_clamp(const TransInfo *t, float r_val[2])
|
||||
|
||||
/* Unconditional channel, retiming key, and handle clamping. Should never be ignored. */
|
||||
if (BLI_rcti_clamp_pt_v(&ts->offset_clamp, val)) {
|
||||
r_val[0] = static_cast<float>(val[0]);
|
||||
r_val[0] = float(val[0]);
|
||||
r_val[1] = float(val[1]);
|
||||
clamped = true;
|
||||
}
|
||||
|
||||
@@ -544,7 +544,7 @@ static bool snap_calc_timeline(TransInfo *t, const TransSeqSnapData *snap_data)
|
||||
return false;
|
||||
}
|
||||
|
||||
float2 best_offset(static_cast<float>(best_target_frame - best_source_frame), 0.0f);
|
||||
float2 best_offset(float(best_target_frame - best_source_frame), 0.0f);
|
||||
if (transform_convert_sequencer_clamp(t, best_offset)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1245,7 +1245,7 @@ static StructRNA *rna_AssetShelf_register(Main *bmain,
|
||||
RPT_ERROR,
|
||||
"Registering asset shelf class: '%s' is too long, maximum length is %d",
|
||||
identifier,
|
||||
(int)sizeof(shelf_type->idname));
|
||||
int(sizeof(shelf_type->idname)));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ static StructRNA *rna_USDHook_register(Main *bmain,
|
||||
"%s '%s' is too long, maximum length is %d",
|
||||
error_prefix,
|
||||
identifier,
|
||||
(int)sizeof(dummy_hook.idname));
|
||||
int(sizeof(dummy_hook.idname)));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -845,7 +845,7 @@ static int rna_NDOFMotionEventData_progress_get(PointerRNA *ptr)
|
||||
{
|
||||
# ifdef WITH_INPUT_NDOF
|
||||
const wmNDOFMotionData &ndof = *static_cast<const wmNDOFMotionData *>(ptr->data);
|
||||
return static_cast<int>(ndof.progress);
|
||||
return int(ndof.progress);
|
||||
# else
|
||||
UNUSED_VARS(ptr);
|
||||
return 0;
|
||||
|
||||
@@ -534,8 +534,8 @@ void RE_engine_update_memory_stats(RenderEngine *engine, float mem_used, float m
|
||||
Render *re = engine->re;
|
||||
|
||||
if (re) {
|
||||
re->i.mem_used = (int)ceilf(mem_used);
|
||||
re->i.mem_peak = (int)ceilf(mem_peak);
|
||||
re->i.mem_used = int(ceilf(mem_used));
|
||||
re->i.mem_peak = int(ceilf(mem_peak));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user