Cleanup: various non-functional changes for C++
This commit is contained in:
@@ -436,7 +436,7 @@ void ANIM_armature_bonecoll_active_name_set(bArmature *armature, const char *nam
|
||||
ANIM_armature_bonecoll_active_set(armature, bcoll);
|
||||
}
|
||||
|
||||
void ANIM_armature_bonecoll_active_runtime_refresh(struct bArmature *armature)
|
||||
void ANIM_armature_bonecoll_active_runtime_refresh(bArmature *armature)
|
||||
{
|
||||
const std::string_view active_name = armature->active_collection_name;
|
||||
if (active_name.empty()) {
|
||||
@@ -1058,8 +1058,8 @@ static bool bcoll_list_contains(const ListBase /*BoneCollectionRef*/ *collection
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ANIM_armature_bonecoll_contains_active_bone(const struct bArmature *armature,
|
||||
const struct BoneCollection *bcoll)
|
||||
bool ANIM_armature_bonecoll_contains_active_bone(const bArmature *armature,
|
||||
const BoneCollection *bcoll)
|
||||
{
|
||||
if (armature->edbo) {
|
||||
if (!armature->act_edbone) {
|
||||
|
||||
@@ -4170,7 +4170,7 @@ static void node_replace_undefined_types(bNode *node)
|
||||
/* This type name is arbitrary, it just has to be unique enough to not match a future node
|
||||
* idname. Includes the old type identifier for debugging purposes. */
|
||||
const std::string old_idname = node->idname;
|
||||
BLI_snprintf(node->idname, sizeof(node->idname), "Undefined[%s]", old_idname.c_str());
|
||||
SNPRINTF(node->idname, "Undefined[%s]", old_idname.c_str());
|
||||
node->typeinfo = &NodeTypeUndefined;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
* (not its implementation).
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <cstring>
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
@@ -34,13 +34,13 @@ uint BLI_ghashutil_ptrhash(const void *key)
|
||||
{
|
||||
/* Based Python3.7's pointer hashing function. */
|
||||
|
||||
size_t y = (size_t)key;
|
||||
size_t y = size_t(key);
|
||||
/* bottom 3 or 4 bits are likely to be 0; rotate y by 4 to avoid
|
||||
* excessive hash collisions for dictionaries and sets */
|
||||
|
||||
/* NOTE: Unlike Python `sizeof(uint)` is used instead of `sizeof(void *)`,
|
||||
* Otherwise casting to 'uint' ignores the upper bits on 64bit platforms. */
|
||||
return (uint)(y >> 4) | ((uint)y << (sizeof(uint[8]) - 4));
|
||||
return uint(y >> 4) | (uint(y) << (sizeof(uint[8]) - 4));
|
||||
}
|
||||
#endif
|
||||
bool BLI_ghashutil_ptrcmp(const void *a, const void *b)
|
||||
@@ -85,7 +85,7 @@ uint BLI_ghashutil_uinthash(uint key)
|
||||
|
||||
uint BLI_ghashutil_inthash_p(const void *ptr)
|
||||
{
|
||||
uintptr_t key = (uintptr_t)ptr;
|
||||
uintptr_t key = uintptr_t(ptr);
|
||||
|
||||
key += ~(key << 16);
|
||||
key ^= (key >> 5);
|
||||
@@ -94,12 +94,12 @@ uint BLI_ghashutil_inthash_p(const void *ptr)
|
||||
key += ~(key << 9);
|
||||
key ^= (key >> 17);
|
||||
|
||||
return (uint)(key & 0xffffffff);
|
||||
return uint(key & 0xffffffff);
|
||||
}
|
||||
|
||||
uint BLI_ghashutil_inthash_p_murmur(const void *ptr)
|
||||
{
|
||||
uintptr_t key = (uintptr_t)ptr;
|
||||
uintptr_t key = uintptr_t(ptr);
|
||||
|
||||
return BLI_hash_mm2((const uchar *)&key, sizeof(key), 0);
|
||||
}
|
||||
@@ -125,7 +125,7 @@ uint BLI_ghashutil_strhash_n(const char *key, size_t n)
|
||||
uint h = 5381;
|
||||
|
||||
for (p = (const signed char *)key; n-- && *p != '\0'; p++) {
|
||||
h = (uint)((h << 5) + h) + (uint)*p;
|
||||
h = uint((h << 5) + h) + uint(*p);
|
||||
}
|
||||
|
||||
return h;
|
||||
@@ -136,7 +136,7 @@ uint BLI_ghashutil_strhash_p(const void *ptr)
|
||||
uint h = 5381;
|
||||
|
||||
for (p = static_cast<const signed char *>(ptr); *p != '\0'; p++) {
|
||||
h = (uint)((h << 5) + h) + (uint)*p;
|
||||
h = uint((h << 5) + h) + uint(*p);
|
||||
}
|
||||
|
||||
return h;
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
*/
|
||||
|
||||
#include <algorithm>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
|
||||
@@ -10,9 +10,9 @@
|
||||
* according to the definition of MD5 in RFC 1321 from April 1992.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "BLI_hash_md5.hh" /* own include */
|
||||
@@ -78,7 +78,7 @@ struct md5_ctx {
|
||||
|
||||
/* This array contains the bytes used to pad the buffer to the next 64-byte boundary.
|
||||
* (RFC 1321, 3.1: Step 1) */
|
||||
static const unsigned char fillbuf[64] = {0x80, 0 /* , 0, 0, ... */};
|
||||
static const uchar fillbuf[64] = {0x80, 0 /* , 0, 0, ... */};
|
||||
|
||||
/**
|
||||
* Initialize structure containing state of computation.
|
||||
@@ -383,12 +383,12 @@ void *BLI_hash_md5_buffer(const char *buffer, size_t len, void *resblock)
|
||||
char *BLI_hash_md5_to_hexdigest(const void *resblock, char r_hex_digest[33])
|
||||
{
|
||||
static const char hex_map[17] = "0123456789abcdef";
|
||||
const unsigned char *p;
|
||||
const uchar *p;
|
||||
char *q;
|
||||
short len;
|
||||
|
||||
for (q = r_hex_digest, p = (const unsigned char *)resblock, len = 0; len < 16; p++, len++) {
|
||||
const unsigned char c = *p;
|
||||
for (q = r_hex_digest, p = (const uchar *)resblock, len = 0; len < 16; p++, len++) {
|
||||
const uchar c = *p;
|
||||
*q++ = hex_map[c >> 4];
|
||||
*q++ = hex_map[c & 15];
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
static void mm2a_mix_tail(BLI_HashMurmur2A *mm2, const uchar **data, size_t *len)
|
||||
{
|
||||
while (*len && ((*len < 4) || mm2->count)) {
|
||||
mm2->tail |= (uint32_t)(**data) << (mm2->count * 8);
|
||||
mm2->tail |= uint32_t(**data) << (mm2->count * 8);
|
||||
|
||||
mm2->count++;
|
||||
(*len)--;
|
||||
@@ -69,7 +69,7 @@ void BLI_hash_mm2a_init(BLI_HashMurmur2A *mm2, uint32_t seed)
|
||||
|
||||
void BLI_hash_mm2a_add(BLI_HashMurmur2A *mm2, const uchar *data, size_t len)
|
||||
{
|
||||
mm2->size += (uint32_t)len;
|
||||
mm2->size += uint32_t(len);
|
||||
|
||||
mm2a_mix_tail(mm2, &data, &len);
|
||||
|
||||
|
||||
@@ -1034,7 +1034,7 @@ void sin_cos_from_fraction(int numerator, int denominator, float *r_sin, float *
|
||||
|
||||
BLI_assert(-denominator / 4 <= numerator); /* Numerator may be negative. */
|
||||
BLI_assert(numerator <= denominator / 4);
|
||||
BLI_assert(cos_sign == -1.0f || cos_sign == 1.0f);
|
||||
BLI_assert(ELEM(cos_sign, -1.0f, 1.0f));
|
||||
|
||||
const float angle = (float)(2.0 * M_PI) * ((float)numerator / (float)denominator);
|
||||
*r_sin = sinf(angle);
|
||||
|
||||
@@ -13,7 +13,7 @@ using namespace blender::math;
|
||||
static constexpr float float_tolerance = 0.00005f;
|
||||
static constexpr int image_width = 3;
|
||||
static constexpr int image_height = 3;
|
||||
static constexpr unsigned char image_char[image_height][image_width][4] = {
|
||||
static constexpr uchar image_char[image_height][image_width][4] = {
|
||||
{{255, 254, 217, 216}, {230, 230, 230, 230}, {240, 160, 90, 20}},
|
||||
{{0, 1, 2, 3}, {62, 72, 82, 92}, {126, 127, 128, 129}},
|
||||
{{1, 2, 3, 4}, {73, 108, 153, 251}, {128, 129, 130, 131}},
|
||||
|
||||
@@ -2882,7 +2882,7 @@ void blo_do_versions_400(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
/* Keep point/spot light soft falloff for files created before 4.0. */
|
||||
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 400, 0)) {
|
||||
LISTBASE_FOREACH (Light *, light, &bmain->lights) {
|
||||
if (light->type == LA_LOCAL || light->type == LA_SPOT) {
|
||||
if (ELEM(light->type, LA_LOCAL, LA_SPOT)) {
|
||||
light->mode |= LA_USE_SOFT_FALLOFF;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
#ifndef NDEBUG
|
||||
|
||||
# include <stdio.h>
|
||||
# include <cstdio>
|
||||
|
||||
# include "MEM_guardedalloc.h"
|
||||
|
||||
|
||||
@@ -1642,7 +1642,7 @@ finally:
|
||||
/* Sanity check: ensure we don't have connecting edges before splicing begins. */
|
||||
# ifndef NDEBUG
|
||||
{
|
||||
struct TempVertPair *tvp = temp_vert_pairs.list;
|
||||
TempVertPair *tvp = temp_vert_pairs.list;
|
||||
do {
|
||||
/* We must _never_ create connections here
|
||||
* (in case the islands can't have a connection at all). */
|
||||
|
||||
@@ -840,7 +840,7 @@ void DEG_id_tag_update_ex(Main *bmain, ID *id, uint flags)
|
||||
deg::id_tag_update(bmain, id, flags, deg::DEG_UPDATE_SOURCE_USER_EDIT);
|
||||
}
|
||||
|
||||
void DEG_id_tag_update_for_side_effect_request(Depsgraph *depsgraph, ID *id, unsigned int flags)
|
||||
void DEG_id_tag_update_for_side_effect_request(Depsgraph *depsgraph, ID *id, uint flags)
|
||||
{
|
||||
BLI_assert(depsgraph != nullptr);
|
||||
BLI_assert(id != nullptr);
|
||||
|
||||
@@ -189,13 +189,13 @@ void EEVEE_shadows_draw_cubemap(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata,
|
||||
for (int j = 0; j < 6; j++) {
|
||||
/* Optimization: Only render the needed faces. */
|
||||
/* Skip all but -Z face. */
|
||||
if ((evli->light_type == LA_SPOT || evli->light_type == LAMPTYPE_SPOT_DISK) && j != 5 &&
|
||||
if ((ELEM(evli->light_type, LA_SPOT, LAMPTYPE_SPOT_DISK)) && j != 5 &&
|
||||
spot_angle_fit_single_face(evli))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
/* Skip +Z face. */
|
||||
if (!(evli->light_type == LA_LOCAL || evli->light_type == LAMPTYPE_OMNI_DISK) && j == 4) {
|
||||
if (!(ELEM(evli->light_type, LA_LOCAL, LAMPTYPE_OMNI_DISK)) && j == 4) {
|
||||
continue;
|
||||
}
|
||||
/* TODO(fclem): some cube sides can be invisible in the main views. Cull them. */
|
||||
|
||||
@@ -556,7 +556,7 @@ static void draw_histogram(ARegion *region,
|
||||
|
||||
/* Label. */
|
||||
char buf[10];
|
||||
BLI_snprintf(buf, sizeof(buf), "%.2f", val);
|
||||
SNPRINTF(buf, "%.2f", val);
|
||||
size_t buf_len = strlen(buf);
|
||||
|
||||
float text_width, text_height;
|
||||
|
||||
@@ -1311,7 +1311,7 @@ void export_deform_verts(const Mesh *mesh,
|
||||
continue;
|
||||
}
|
||||
|
||||
int def_nr = static_cast<int>(vert.dw[j].def_nr);
|
||||
int def_nr = int(vert.dw[j].def_nr);
|
||||
|
||||
if (def_nr >= joint_index.size()) {
|
||||
BLI_assert_unreachable();
|
||||
|
||||
Reference in New Issue
Block a user