Cleanup: various non-functional C++ changes
This commit is contained in:
@@ -97,7 +97,7 @@ static void memcount_raise(const char *name)
|
||||
/* --------------------------------------------------------------------- */
|
||||
/* all memory chunks are put in linked lists */
|
||||
typedef struct localLink {
|
||||
struct localLink *next, *prev;
|
||||
localLink *next, *prev;
|
||||
} localLink;
|
||||
|
||||
typedef struct localListBase {
|
||||
@@ -108,7 +108,7 @@ typedef struct localListBase {
|
||||
typedef struct MemHead {
|
||||
int tag1;
|
||||
size_t len;
|
||||
struct MemHead *next, *prev;
|
||||
MemHead *next, *prev;
|
||||
const char *name;
|
||||
const char *nextname;
|
||||
int tag2;
|
||||
@@ -159,7 +159,7 @@ static const char *check_memlist(MemHead *memh);
|
||||
#ifdef __BIG_ENDIAN__
|
||||
# define MAKE_ID(a, b, c, d) ((int)(a) << 24 | (int)(b) << 16 | (c) << 8 | (d))
|
||||
#else
|
||||
# define MAKE_ID(a, b, c, d) ((int)(d) << 24 | (int)(c) << 16 | (b) << 8 | (a))
|
||||
# define MAKE_ID(a, b, c, d) (int(d) << 24 | int(c) << 16 | (b) << 8 | (a))
|
||||
#endif
|
||||
|
||||
#define MEMTAG1 MAKE_ID('M', 'E', 'M', 'O')
|
||||
@@ -280,7 +280,7 @@ void *MEM_guarded_dupallocN(const void *vmemh)
|
||||
newp = MEM_guarded_mallocN(memh->len, "dupli_alloc");
|
||||
}
|
||||
else {
|
||||
newp = MEM_guarded_mallocN_aligned(memh->len, (size_t)memh->alignment, "dupli_alloc");
|
||||
newp = MEM_guarded_mallocN_aligned(memh->len, size_t(memh->alignment), "dupli_alloc");
|
||||
}
|
||||
|
||||
if (newp == nullptr) {
|
||||
@@ -331,7 +331,7 @@ void *MEM_guarded_reallocN_id(void *vmemh, size_t len, const char *str)
|
||||
newp = MEM_guarded_mallocN(len, memh->name);
|
||||
}
|
||||
else {
|
||||
newp = MEM_guarded_mallocN_aligned(len, (size_t)memh->alignment, memh->name);
|
||||
newp = MEM_guarded_mallocN_aligned(len, size_t(memh->alignment), memh->name);
|
||||
}
|
||||
|
||||
if (newp) {
|
||||
@@ -366,7 +366,7 @@ void *MEM_guarded_recallocN_id(void *vmemh, size_t len, const char *str)
|
||||
newp = MEM_guarded_mallocN(len, memh->name);
|
||||
}
|
||||
else {
|
||||
newp = MEM_guarded_mallocN_aligned(len, (size_t)memh->alignment, memh->name);
|
||||
newp = MEM_guarded_mallocN_aligned(len, size_t(memh->alignment), memh->name);
|
||||
}
|
||||
|
||||
if (newp) {
|
||||
@@ -548,7 +548,7 @@ void *MEM_guarded_mallocN_aligned(size_t len, size_t alignment, const char *str)
|
||||
memh = (MemHead *)((char *)memh + extra_padding);
|
||||
|
||||
make_memhead_header(memh, len, str);
|
||||
memh->alignment = (short)alignment;
|
||||
memh->alignment = short(alignment);
|
||||
if (LIKELY(len)) {
|
||||
if (UNLIKELY(malloc_debug_memset)) {
|
||||
memset(memh + 1, 255, len);
|
||||
@@ -728,15 +728,15 @@ void MEM_guarded_printmemlist_stats()
|
||||
qsort(printblock, totpb, sizeof(MemPrintBlock), compare_len);
|
||||
}
|
||||
|
||||
printf("\ntotal memory len: %.3f MB\n", (double)mem_in_use / (double)(1024 * 1024));
|
||||
printf("peak memory len: %.3f MB\n", (double)peak_mem / (double)(1024 * 1024));
|
||||
printf("slop memory len: %.3f MB\n", (double)mem_in_use_slop / (double)(1024 * 1024));
|
||||
printf("\ntotal memory len: %.3f MB\n", double(mem_in_use) / double(1024 * 1024));
|
||||
printf("peak memory len: %.3f MB\n", double(peak_mem) / double(1024 * 1024));
|
||||
printf("slop memory len: %.3f MB\n", double(mem_in_use_slop) / double(1024 * 1024));
|
||||
printf(" ITEMS TOTAL-MiB AVERAGE-KiB TYPE\n");
|
||||
for (a = 0, pb = printblock; a < totpb; a++, pb++) {
|
||||
printf("%6d (%8.3f %8.3f) %s\n",
|
||||
pb->items,
|
||||
(double)pb->len / (double)(1024 * 1024),
|
||||
(double)pb->len / 1024.0 / (double)pb->items,
|
||||
double(pb->len) / double(1024 * 1024),
|
||||
double(pb->len) / 1024.0 / double(pb->items),
|
||||
pb->name);
|
||||
}
|
||||
|
||||
@@ -913,13 +913,13 @@ void MEM_guarded_freeN(void *vmemh)
|
||||
}
|
||||
|
||||
if (sizeof(intptr_t) == 8) {
|
||||
if (((intptr_t)memh) & 0x7) {
|
||||
if (intptr_t(memh) & 0x7) {
|
||||
MemorY_ErroR("free", "attempt to free illegal pointer");
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (((intptr_t)memh) & 0x3) {
|
||||
if (intptr_t(memh) & 0x3) {
|
||||
MemorY_ErroR("free", "attempt to free illegal pointer");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -53,8 +53,8 @@ enum {
|
||||
#define MEMHEAD_FROM_PTR(ptr) (((MemHead *)ptr) - 1)
|
||||
#define PTR_FROM_MEMHEAD(memhead) (memhead + 1)
|
||||
#define MEMHEAD_ALIGNED_FROM_PTR(ptr) (((MemHeadAligned *)ptr) - 1)
|
||||
#define MEMHEAD_IS_ALIGNED(memhead) ((memhead)->len & (size_t)MEMHEAD_ALIGN_FLAG)
|
||||
#define MEMHEAD_LEN(memhead) ((memhead)->len & ~((size_t)(MEMHEAD_ALIGN_FLAG)))
|
||||
#define MEMHEAD_IS_ALIGNED(memhead) ((memhead)->len & size_t(MEMHEAD_ALIGN_FLAG))
|
||||
#define MEMHEAD_LEN(memhead) ((memhead)->len & ~size_t(MEMHEAD_ALIGN_FLAG))
|
||||
|
||||
#ifdef __GNUC__
|
||||
__attribute__((format(printf, 1, 2)))
|
||||
@@ -124,7 +124,7 @@ void *MEM_lockfree_dupallocN(const void *vmemh)
|
||||
if (UNLIKELY(MEMHEAD_IS_ALIGNED(memh))) {
|
||||
const MemHeadAligned *memh_aligned = MEMHEAD_ALIGNED_FROM_PTR(vmemh);
|
||||
newp = MEM_lockfree_mallocN_aligned(
|
||||
prev_size, (size_t)memh_aligned->alignment, "dupli_malloc");
|
||||
prev_size, size_t(memh_aligned->alignment), "dupli_malloc");
|
||||
}
|
||||
else {
|
||||
newp = MEM_lockfree_mallocN(prev_size, "dupli_malloc");
|
||||
@@ -147,7 +147,7 @@ void *MEM_lockfree_reallocN_id(void *vmemh, size_t len, const char *str)
|
||||
}
|
||||
else {
|
||||
const MemHeadAligned *memh_aligned = MEMHEAD_ALIGNED_FROM_PTR(vmemh);
|
||||
newp = MEM_lockfree_mallocN_aligned(len, (size_t)memh_aligned->alignment, "realloc");
|
||||
newp = MEM_lockfree_mallocN_aligned(len, size_t(memh_aligned->alignment), "realloc");
|
||||
}
|
||||
|
||||
if (newp) {
|
||||
@@ -183,7 +183,7 @@ void *MEM_lockfree_recallocN_id(void *vmemh, size_t len, const char *str)
|
||||
}
|
||||
else {
|
||||
const MemHeadAligned *memh_aligned = MEMHEAD_ALIGNED_FROM_PTR(vmemh);
|
||||
newp = MEM_lockfree_mallocN_aligned(len, (size_t)memh_aligned->alignment, "recalloc");
|
||||
newp = MEM_lockfree_mallocN_aligned(len, size_t(memh_aligned->alignment), "recalloc");
|
||||
}
|
||||
|
||||
if (newp) {
|
||||
@@ -358,8 +358,8 @@ void *MEM_lockfree_mallocN_aligned(size_t len, size_t alignment, const char *str
|
||||
#endif /* WITH_MEM_VALGRIND */
|
||||
}
|
||||
|
||||
memh->len = len | (size_t)MEMHEAD_ALIGN_FLAG;
|
||||
memh->alignment = (short)alignment;
|
||||
memh->len = len | size_t(MEMHEAD_ALIGN_FLAG);
|
||||
memh->alignment = short(alignment);
|
||||
memory_usage_block_alloc(len);
|
||||
|
||||
return PTR_FROM_MEMHEAD(memh);
|
||||
@@ -385,8 +385,8 @@ void MEM_lockfree_callbackmemlist(void (*func)(void *))
|
||||
|
||||
void MEM_lockfree_printmemlist_stats()
|
||||
{
|
||||
printf("\ntotal memory len: %.3f MB\n", (double)memory_usage_current() / (double)(1024 * 1024));
|
||||
printf("peak memory len: %.3f MB\n", (double)memory_usage_peak() / (double)(1024 * 1024));
|
||||
printf("\ntotal memory len: %.3f MB\n", double(memory_usage_current()) / double(1024 * 1024));
|
||||
printf("peak memory len: %.3f MB\n", double(memory_usage_peak()) / double(1024 * 1024));
|
||||
printf(
|
||||
"\nFor more detailed per-block statistics run Blender with memory debugging command line "
|
||||
"argument.\n");
|
||||
@@ -419,7 +419,7 @@ size_t MEM_lockfree_get_memory_in_use()
|
||||
|
||||
uint MEM_lockfree_get_memory_blocks_in_use()
|
||||
{
|
||||
return (uint)memory_usage_block_num();
|
||||
return uint(memory_usage_block_num());
|
||||
}
|
||||
|
||||
/* dummy */
|
||||
|
||||
@@ -514,7 +514,7 @@ void BKE_collection_free_data(Collection *collection)
|
||||
collection_free_data(&collection->id);
|
||||
}
|
||||
|
||||
void BKE_collection_exporter_free_data(struct CollectionExport *data)
|
||||
void BKE_collection_exporter_free_data(CollectionExport *data)
|
||||
{
|
||||
if (data->export_properties) {
|
||||
IDP_FreeProperty(data->export_properties);
|
||||
|
||||
@@ -154,10 +154,10 @@ void TintOperation::execute_tint(const bContext &C, const InputSample &extension
|
||||
strength = math::clamp(strength, 0.0f, 1.0f);
|
||||
fill_strength = math::clamp(fill_strength, 0.0f, 1.0f);
|
||||
|
||||
const bool tint_strokes = ((brush->gpencil_settings->vertex_mode == GPPAINT_MODE_STROKE) ||
|
||||
(brush->gpencil_settings->vertex_mode == GPPAINT_MODE_BOTH));
|
||||
const bool tint_fills = ((brush->gpencil_settings->vertex_mode == GPPAINT_MODE_FILL) ||
|
||||
(brush->gpencil_settings->vertex_mode == GPPAINT_MODE_BOTH));
|
||||
const bool tint_strokes = ELEM(
|
||||
brush->gpencil_settings->vertex_mode, GPPAINT_MODE_STROKE, GPPAINT_MODE_BOTH);
|
||||
const bool tint_fills = ELEM(
|
||||
brush->gpencil_settings->vertex_mode, GPPAINT_MODE_FILL, GPPAINT_MODE_BOTH);
|
||||
|
||||
GreasePencil &grease_pencil = *static_cast<GreasePencil *>(obact->data);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user