Cleanup: use braces (follow own style guide)

This commit is contained in:
Campbell Barton
2025-06-11 09:05:26 +00:00
parent afd778ec01
commit 07121d44ae
31 changed files with 172 additions and 106 deletions

View File

@@ -397,8 +397,9 @@ class BlenderCameraParamQuery : public OSLCameraParamQuery {
bool get_float(ustring name, vector<float> &data) override
{
PropertyRNA *prop = get_prop(name);
if (!prop)
if (!prop) {
return false;
}
if (RNA_property_array_check(prop)) {
data.resize(RNA_property_array_length(&custom_props, prop));
RNA_property_float_get_array(&custom_props, prop, data.data());
@@ -413,9 +414,9 @@ class BlenderCameraParamQuery : public OSLCameraParamQuery {
bool get_int(ustring name, vector<int> &data) override
{
PropertyRNA *prop = get_prop(name);
if (!prop)
if (!prop) {
return false;
}
int array_len = 0;
if (RNA_property_array_check(prop)) {
array_len = RNA_property_array_length(&custom_props, prop);
@@ -449,8 +450,9 @@ class BlenderCameraParamQuery : public OSLCameraParamQuery {
bool get_string(ustring name, string &data) override
{
PropertyRNA *prop = get_prop(name);
if (!prop)
if (!prop) {
return false;
}
data = RNA_property_string_get(&custom_props, prop);
return true;
}

View File

@@ -28,8 +28,9 @@ static OptixResult optixUtilDenoiserSplitImage(const OptixImage2D &input,
unsigned int tileHeight,
std::vector<OptixUtilDenoiserImageTile> &tiles)
{
if (tileWidth == 0 || tileHeight == 0)
if (tileWidth == 0 || tileHeight == 0) {
return OPTIX_ERROR_INVALID_VALUE;
}
unsigned int inPixelStride = optixUtilGetPixelStride(input);
unsigned int outPixelStride = optixUtilGetPixelStride(output);
@@ -99,8 +100,9 @@ static OptixResult optixUtilDenoiserInvokeTiled(OptixDenoiser denoiser,
unsigned int tileWidth,
unsigned int tileHeight)
{
if (!guideLayer || !layers)
if (!guideLayer || !layers) {
return OPTIX_ERROR_INVALID_VALUE;
}
std::vector<std::vector<OptixUtilDenoiserImageTile>> tiles(numLayers);
std::vector<std::vector<OptixUtilDenoiserImageTile>> prevTiles(numLayers);
@@ -166,21 +168,22 @@ static OptixResult optixUtilDenoiserInvokeTiled(OptixDenoiser denoiser,
OptixDenoiserLayer layer = {};
layer.input = (tiles[l])[t].input;
layer.output = (tiles[l])[t].output;
if (layers[l].previousOutput.data)
if (layers[l].previousOutput.data) {
layer.previousOutput = (prevTiles[l])[t].input;
}
tlayers.push_back(layer);
}
OptixDenoiserGuideLayer gl = {};
if (guideLayer->albedo.data)
if (guideLayer->albedo.data) {
gl.albedo = albedoTiles[t].input;
if (guideLayer->normal.data)
}
if (guideLayer->normal.data) {
gl.normal = normalTiles[t].input;
if (guideLayer->flow.data)
}
if (guideLayer->flow.data) {
gl.flow = flowTiles[t].input;
}
if (const OptixResult res = optixDenoiserInvoke(denoiser,
stream,
params,

View File

@@ -34,8 +34,9 @@ void gpu_parallel_active_index_array_impl(const uint num_states,
# ifdef WITH_ONEAPI_SYCL_HOST_TASK
int write_index = 0;
for (int state_index = 0; state_index < num_states; state_index++) {
if (is_active_op(state_index))
if (is_active_op(state_index)) {
indices[write_index++] = state_index;
}
}
*num_indices = write_index;
return;

View File

@@ -872,8 +872,9 @@ void Camera::set_osl_camera(Scene *scene,
}
else {
hash = scene->osl_manager->shader_test_loaded(bytecode_hash);
if (!hash)
if (!hash) {
hash = scene->osl_manager->shader_load_bytecode(bytecode_hash, bytecode);
}
}
bool changed = false;
@@ -903,22 +904,25 @@ void Camera::set_osl_camera(Scene *scene,
int vec_size = (int)param->type.aggregate;
if (param->type.basetype == TypeDesc::INT) {
vector<int> data;
if (!params.get_int(param->name, data) || data.size() != vec_size)
if (!params.get_int(param->name, data) || data.size() != vec_size) {
continue;
}
raw_data.resize(sizeof(int) * vec_size);
memcpy(raw_data.data(), data.data(), sizeof(int) * vec_size);
}
else if (param->type.basetype == TypeDesc::FLOAT) {
vector<float> data;
if (!params.get_float(param->name, data) || data.size() != vec_size)
if (!params.get_float(param->name, data) || data.size() != vec_size) {
continue;
}
raw_data.resize(sizeof(float) * vec_size);
memcpy(raw_data.data(), data.data(), sizeof(float) * vec_size);
}
else if (param->type.basetype == TypeDesc::STRING) {
string data;
if (!params.get_string(param->name, data))
if (!params.get_string(param->name, data)) {
continue;
}
raw_data.resize(data.length() + 1);
memcpy(raw_data.data(), data.c_str(), data.length() + 1);
}
@@ -941,8 +945,9 @@ void Camera::set_osl_camera(Scene *scene,
/* Remove unused parameters. */
for (auto it = script_params.begin(); it != script_params.end();) {
if (used_params.count(it->first))
if (used_params.count(it->first)) {
it++;
}
else {
it = script_params.erase(it);
changed = true;

View File

@@ -151,9 +151,9 @@ void OSLManager::device_update_post(Device *device,
{
/* Create the camera shader. */
if (need_update() && !scene->camera->script_name.empty()) {
if (progress.get_cancel())
if (progress.get_cancel()) {
return;
}
foreach_osl_device(device, [this, scene](Device *sub_device, OSLGlobals *og) {
OSL::ShadingSystem *ss = get_shading_system(sub_device);

View File

@@ -4688,8 +4688,9 @@ void ParticleInfoNode::attributes(Shader *shader, AttributeRequestSet *attribute
attributes->add(ATTR_STD_PARTICLE);
}
#if 0 /* not yet supported */
if (!output("Rotation")->links.empty())
if (!output("Rotation")->links.empty()) {
attributes->add(ATTR_STD_PARTICLE);
}
#endif
if (!output("Size")->links.empty()) {
attributes->add(ATTR_STD_PARTICLE);

View File

@@ -553,10 +553,12 @@ ccl_device float compatible_powf(const float x, const float y)
/* GPU pow doesn't accept negative x, do manual checks here */
if (x < 0.0f) {
if (fmodf(-y, 2.0f) == 0.0f)
if (fmodf(-y, 2.0f) == 0.0f) {
return powf(-x, y);
else
}
else {
return -powf(-x, y);
}
}
else if (x == 0.0f)
return 0.0f;

View File

@@ -89,9 +89,11 @@ static void transform_decompose(DecomposedTransform *decomp, const Transform *tf
Transform Rnext;
Transform Rit = transform_transposed_inverse(R);
for (int i = 0; i < 3; i++)
for (int j = 0; j < 4; j++)
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 4; j++) {
Rnext[i][j] = 0.5f * (R[i][j] + Rit[i][j]);
}
}
norm = 0.0f;
for (int i = 0; i < 3; i++) {
@@ -104,8 +106,9 @@ static void transform_decompose(DecomposedTransform *decomp, const Transform *tf
iteration++;
} while (iteration < 100 && norm > 1e-4f);
if (transform_negative_scale(R))
if (transform_negative_scale(R)) {
R = R * transform_scale(-1.0f, -1.0f, -1.0f);
}
decomp->x = transform_to_quat(R);

View File

@@ -349,8 +349,9 @@ void Octree::addTriangle(Triangle *trian, int triind)
#if 0
static void print_depth(int height, int maxDepth)
{
for (int i = 0; i < maxDepth - height; i++)
for (int i = 0; i < maxDepth - height; i++) {
printf(" ");
}
}
#endif

View File

@@ -165,11 +165,13 @@ GHOST_TSuccess GHOST_ContextGLX::initializeDrawingContext()
}
#ifdef WITH_GLEW_ES
if (!GLXEW_EXT_create_context_es_profile && profileBitES && m_contextMajorVersion == 1)
if (!GLXEW_EXT_create_context_es_profile && profileBitES && m_contextMajorVersion == 1) {
fprintf(stderr, "Warning! OpenGL ES profile not available.\n");
}
if (!GLXEW_EXT_create_context_es2_profile && profileBitES && m_contextMajorVersion == 2)
if (!GLXEW_EXT_create_context_es2_profile && profileBitES && m_contextMajorVersion == 2) {
fprintf(stderr, "Warning! OpenGL ES2 profile not available.\n");
}
#endif
int profileMask = 0;
@@ -182,8 +184,9 @@ GHOST_TSuccess GHOST_ContextGLX::initializeDrawingContext()
}
#ifdef WITH_GLEW_ES
if (GLXEW_EXT_create_context_es_profile && profileBitES)
if (GLXEW_EXT_create_context_es_profile && profileBitES) {
profileMask |= profileBitES;
}
#endif
if (profileMask != m_contextProfileMask) {

View File

@@ -57,8 +57,9 @@ GHOST_ContextWGL::GHOST_ContextWGL(bool stereoVisual,
GHOST_ContextWGL::~GHOST_ContextWGL()
{
if (m_hGLRC != nullptr) {
if (m_hGLRC == ::wglGetCurrentContext())
if (m_hGLRC == ::wglGetCurrentContext()) {
WIN32_CHK(::wglMakeCurrent(nullptr, nullptr));
}
if (m_hGLRC != s_sharedHGLRC || s_sharedCount == 1) {
assert(s_sharedCount > 0);
@@ -422,12 +423,14 @@ struct DummyContextWGL {
{
WIN32_CHK(::wglMakeCurrent(prevHDC, prevHGLRC));
if (dummyHGLRC != nullptr)
if (dummyHGLRC != nullptr) {
WIN32_CHK(::wglDeleteContext(dummyHGLRC));
}
if (dummyHWND != nullptr) {
if (dummyHDC != nullptr)
if (dummyHDC != nullptr) {
WIN32_CHK(::ReleaseDC(dummyHWND, dummyHDC));
}
WIN32_CHK(::DestroyWindow(dummyHWND));
}
@@ -488,8 +491,9 @@ static void reportContextString(const char *name, const char *dummy, const char
{
fprintf(stderr, "%s: %s\n", name, context);
if (dummy && strcmp(dummy, context) != 0)
if (dummy && strcmp(dummy, context) != 0) {
fprintf(stderr, "Warning! Dummy %s: %s\n", name, dummy);
}
}
#endif
@@ -514,8 +518,9 @@ GHOST_TSuccess GHOST_ContextWGL::initializeDrawingContext()
iPixelFormat = choose_pixel_format_arb(m_stereoVisual, needAlpha);
}
if (iPixelFormat == 0)
if (iPixelFormat == 0) {
iPixelFormat = choose_pixel_format_legacy(m_hDC, dummy.preferredPFD);
}
if (iPixelFormat == 0) {
goto error;

View File

@@ -309,12 +309,14 @@ void GHOST_ImeWin32::GetCaret(HIMC imm_context, LPARAM lparam, ImeComposition *c
if (attribute_data) {
::ImmGetCompositionStringW(imm_context, GCS_COMPATTR, attribute_data, attribute_size);
for (target_start = 0; target_start < attribute_size; ++target_start) {
if (IsTargetAttribute(attribute_data[target_start]))
if (IsTargetAttribute(attribute_data[target_start])) {
break;
}
}
for (target_end = target_start; target_end < attribute_size; ++target_end) {
if (!IsTargetAttribute(attribute_data[target_end]))
if (!IsTargetAttribute(attribute_data[target_end])) {
break;
}
}
if (target_start == attribute_size) {
/**
@@ -417,8 +419,9 @@ void GHOST_ImeWin32::EndIME(HWND window_handle)
* For this case, we have to complete the ongoing composition and
* clean up the resources attached to this object BEFORE DISABLING THE IME.
*/
if (!is_enable)
if (!is_enable) {
return;
}
is_enable = false;
CleanupComposition(window_handle);
::ImmAssociateContextEx(window_handle, nullptr, 0);
@@ -427,8 +430,9 @@ void GHOST_ImeWin32::EndIME(HWND window_handle)
void GHOST_ImeWin32::BeginIME(HWND window_handle, const GHOST_Rect &caret_rect, bool complete)
{
if (is_enable && complete)
if (is_enable && complete) {
return;
}
is_enable = true;
/**
* Load the default IME context.
@@ -466,10 +470,12 @@ void GHOST_ImeWin32::BeginIME(HWND window_handle, const GHOST_Rect &caret_rect,
static void convert_utf16_to_utf8_len(std::wstring s, int &len)
{
if (len >= 0 && len <= s.size())
if (len >= 0 && len <= s.size()) {
len = count_utf_8_from_16(s.substr(0, len).c_str()) - 1;
else
}
else {
len = -1;
}
}
static size_t updateUtf8Buf(ImeComposition &info)

View File

@@ -1012,8 +1012,9 @@ bool GHOST_SystemCocoa::processEvents(bool /*waitForEvent*/)
}
else {
timeOut = (double)(next - getMilliSeconds())/1000.0;
if (timeOut < 0.0)
if (timeOut < 0.0) {
timeOut = 0.0;
}
}
::ReceiveNextEvent(0, nullptr, timeOut, false, &event);

View File

@@ -510,15 +510,17 @@ void GHOST_SystemSDL::processEvent(SDL_Event *sdl_event)
#if 0
if (window->getCursorGrabMode() != GHOST_kGrabDisable &&
window->getCursorGrabMode() != GHOST_kGrabNormal) {
window->getCursorGrabMode() != GHOST_kGrabNormal)
{
int32_t x_new = x_root;
int32_t y_new = y_root;
int32_t x_accum, y_accum;
GHOST_Rect bounds;
/* fallback to window bounds */
if (window->getCursorGrabBounds(bounds) == GHOST_kFailure)
if (window->getCursorGrabBounds(bounds) == GHOST_kFailure) {
window->getClientBounds(bounds);
}
/* Could also clamp to screen bounds wrap with a window outside the view will
* fail at the moment. Use offset of 8 in case the window is at screen bounds. */
@@ -527,7 +529,7 @@ void GHOST_SystemSDL::processEvent(SDL_Event *sdl_event)
/* Can't use #setCursorPosition because the mouse may have no focus! */
if (x_new != x_root || y_new != y_root) {
if (1 /* `xme.time > m_last_warp` */ ) {
if (1 /* `xme.time > m_last_warp` */) {
/* when wrapping we don't need to add an event because the
* #setCursorPosition call will cause a new event after */
SDL_WarpMouseInWindow(sdl_win, x_new - x_win, y_new - y_win); /* wrap */
@@ -539,12 +541,8 @@ void GHOST_SystemSDL::processEvent(SDL_Event *sdl_event)
SDL_WarpMouseInWindow(sdl_win, x_new - x_win, y_new - y_win);
}
g_event = new GHOST_EventCursor(event_ms,
GHOST_kEventCursorMove,
window,
x_new,
y_new,
GHOST_TABLET_DATA_NONE);
g_event = new GHOST_EventCursor(
event_ms, GHOST_kEventCursorMove, window, x_new, y_new, GHOST_TABLET_DATA_NONE);
}
else {
g_event = new GHOST_EventCursor(event_ms,

View File

@@ -643,17 +643,20 @@ int main(int /*argc*/, char ** /*argv*/)
"SOFTWARE\\NVIDIA Corporation\\Global\\Stereo3D\\StereoEnable",
KEY_ALL_ACCESS);
if (lresult == ERROR_SUCCESS)
if (lresult == ERROR_SUCCESS) {
printf("Successfully opened key\n");
}
# if 0
lresult = regkey.QueryValue(&keyValue, "StereoEnable");
if (lresult == ERROR_SUCCESS)
if (lresult == ERROR_SUCCESS) {
printf("Successfully queried key\n");
}
# endif
lresult = regkey.SetValue(
HKEY_LOCAL_MACHINE, "SOFTWARE\\NVIDIA Corporation\\Global\\Stereo3D\\StereoEnable", "1");
if (lresult == ERROR_SUCCESS)
if (lresult == ERROR_SUCCESS) {
printf("Successfully set value for key\n");
}
regkey.Close();
if (lresult == ERROR_SUCCESS) {
printf("Successfully closed key\n");

View File

@@ -561,8 +561,9 @@ void *MEM_guarded_mallocN(size_t len, const char *str)
}
#ifdef DEBUG_MEMCOUNTER
if (_mallocn_count == DEBUG_MEMCOUNTER_ERROR_VAL)
if (_mallocn_count == DEBUG_MEMCOUNTER_ERROR_VAL) {
memcount_raise(__func__);
}
memh->_count = _mallocn_count++;
#endif
return (++memh);
@@ -651,8 +652,9 @@ void *MEM_guarded_mallocN_aligned(size_t len,
}
#ifdef DEBUG_MEMCOUNTER
if (_mallocn_count == DEBUG_MEMCOUNTER_ERROR_VAL)
if (_mallocn_count == DEBUG_MEMCOUNTER_ERROR_VAL) {
memcount_raise(__func__);
}
memh->_count = _mallocn_count++;
#endif
return (++memh);
@@ -675,8 +677,9 @@ void *MEM_guarded_callocN(size_t len, const char *str)
if (memh) {
make_memhead_header(memh, len, str, AllocationType::ALLOC_FREE);
#ifdef DEBUG_MEMCOUNTER
if (_mallocn_count == DEBUG_MEMCOUNTER_ERROR_VAL)
if (_mallocn_count == DEBUG_MEMCOUNTER_ERROR_VAL) {
memcount_raise(__func__);
}
memh->_count = _mallocn_count++;
#endif
return (++memh);
@@ -1000,8 +1003,9 @@ short MEM_guarded_testN(void *vmemh)
mem_lock_thread();
membl = membase->first;
if (membl)
if (membl) {
membl = MEMNEXT(membl);
}
while (membl) {
if (vmemh == membl + 1) {
@@ -1126,10 +1130,12 @@ static void addtail(volatile localListBase *listbase, void *vlink)
/* for a generic API error checks here is fine but
* the limited use here they will never be nullptr */
#if 0
if (link == nullptr)
if (link == nullptr) {
return;
if (listbase == nullptr)
}
if (listbase == nullptr) {
return;
}
#endif
link->next = nullptr;
@@ -1151,10 +1157,12 @@ static void remlink(volatile localListBase *listbase, void *vlink)
/* for a generic API error checks here is fine but
* the limited use here they will never be nullptr */
#if 0
if (link == nullptr)
if (link == nullptr) {
return;
if (listbase == nullptr)
}
if (listbase == nullptr) {
return;
}
#endif
if (link->next) {
@@ -1190,8 +1198,9 @@ static void rem_memblock(MemHead *memh)
atomic_sub_and_fetch_z(&mem_in_use, memh->len);
#ifdef DEBUG_MEMDUPLINAME
if (memh->need_free_name)
if (memh->need_free_name) {
free((char *)memh->name);
}
#endif
if (UNLIKELY(malloc_debug_memset && memh->len)) {

View File

@@ -194,8 +194,9 @@ void IK_QCenterOfMassTask::ComputeJacobian(IK_QJacobian &jacobian)
m_distance = d_pos.norm();
#if 0
if (m_distance > m_clamp_length)
if (m_distance > m_clamp_length) {
d_pos = (m_clamp_length / m_distance) * d_pos;
}
#endif
jacobian.SetBetas(m_id, m_size, m_weight * d_pos);

View File

@@ -407,8 +407,9 @@ static void IK_SolverAddCenterOfMass(IK_Solver *solver,
float goal[3],
float weight)
{
if (solver == nullptr || root == nullptr)
if (solver == nullptr || root == nullptr) {
return;
}
IK_QSolver *qsolver = (IK_QSolver *)solver;
IK_QSegment *qroot = (IK_QSegment *)root;

View File

@@ -115,8 +115,9 @@ bool Scene::addObject(const std::string &name,
const std::string &baseFrame)
{
// finalize the object before adding
if (!object->finalize())
if (!object->finalize()) {
return false;
}
// Check if Object is controlled or uncontrolled.
if (object->getType() == Object::Controlled) {
int baseFrameIndex = base->addEndEffector(baseFrame);
@@ -188,12 +189,14 @@ bool Scene::addConstraintSet(const std::string &name,
// Check if objects exist:
ObjectMap::iterator object1_it = objects.find(object1);
ObjectMap::iterator object2_it = objects.find(object2);
if (object1_it == objects.end() || object2_it == objects.end())
if (object1_it == objects.end() || object2_it == objects.end()) {
return false;
}
int ee1_index = object1_it->second->object->addEndEffector(ee1);
int ee2_index = object2_it->second->object->addEndEffector(ee2);
if (ee1_index < 0 || ee2_index < 0)
if (ee1_index < 0 || ee2_index < 0) {
return false;
}
std::pair<ConstraintMap::iterator, bool> result = constraints.insert(ConstraintMap::value_type(
name,
new ConstraintSet_struct(task,
@@ -203,8 +206,9 @@ bool Scene::addConstraintSet(const std::string &name,
ee2_index,
Range(m_ncTotal, task->getNrOfConstraints()),
Range(6 * m_nsets, 6))));
if (!result.second)
if (!result.second) {
return false;
}
m_ncTotal += task->getNrOfConstraints();
m_nsets += 1;
return true;
@@ -234,8 +238,9 @@ bool Scene::initialize()
{
// prepare all matrices:
if (m_ncTotal == 0 || m_nqTotal == 0 || m_nsets == 0)
if (m_ncTotal == 0 || m_nqTotal == 0 || m_nsets == 0) {
return false;
}
m_A = e_zero_matrix(m_ncTotal, m_nqTotal);
if (m_nuTotal > 0) {
@@ -284,10 +289,12 @@ bool Scene::initialize()
project(m_Cf, cs->constraintrange, cs->featurerange) = cs->task->getCf();
}
if (m_solver != NULL)
if (m_solver != NULL) {
m_solver->init(m_nqTotal, m_ncTotal, m_ytask);
else
}
else {
return false;
}
return result;
}
@@ -315,8 +322,9 @@ bool Scene::update(double timestamp,
bool interpolate)
{
// we must have valid timestep and timestamp
if (timestamp < KDL::epsilon || timestep < 0.0)
if (timestamp < KDL::epsilon || timestep < 0.0) {
return false;
}
Timestamp ts;
ts.realTimestamp = timestamp;
// initially we start with the full timestep to allow velocity estimation over the full interval
@@ -332,8 +340,9 @@ bool Scene::update(double timestamp,
ts.update = 1;
ts.numstep = (numsubstep & 0xFF);
bool autosubstep = (numsubstep == 0) ? true : false;
if (numsubstep < 1)
if (numsubstep < 1) {
numsubstep = 1;
}
double timesubstep = timestep / numsubstep;
double timeleft = timestep;

View File

@@ -14,8 +14,9 @@ namespace blender::opensubdiv {
GPUPatchTable *GPUPatchTable::Create(PatchTable const *far_patch_table, void * /*deviceContext*/)
{
GPUPatchTable *instance = new GPUPatchTable();
if (instance->allocate(far_patch_table))
if (instance->allocate(far_patch_table)) {
return instance;
}
delete instance;
return nullptr;
}

View File

@@ -259,9 +259,11 @@ int conv_utf_8_to_16(const char *in8, wchar_t *out16, size_t size16)
#if 0
static int is_ascii(const char *in8)
{
for (; *in8; in8++)
if (0x80 & *in8)
for (; *in8; in8++) {
if (0x80 & *in8) {
return 0;
}
}
return 1;
}
@@ -270,9 +272,9 @@ static void utf_8_cut_end(char *inout8, size_t maxcutpoint)
{
char *cur = inout8 + maxcutpoint;
char cc;
if (!inout8)
if (!inout8) {
return;
}
cc = *cur;
}
#endif

View File

@@ -193,8 +193,9 @@ bool BLI_windows_register_blend_extension(const bool all_users)
GetModuleFileName(0, blender_path, sizeof(blender_path));
/* Prevent overflow when we add -launcher to the executable name. */
if (strlen(blender_path) > (sizeof(blender_path) - 10))
if (strlen(blender_path) > (sizeof(blender_path) - 10)) {
return false;
}
/* Replace the actual app name with the wrapper. */
blender_app = strstr(blender_path, "blender.exe");

View File

@@ -61,13 +61,13 @@ PatchHandle bogus_patch_handle()
int transformUVToQuadQuadrant(float median, inout float u, inout float v)
{
int uHalf = (u >= median) ? 1 : 0;
if (uHalf != 0)
if (uHalf != 0) {
u -= median;
}
int vHalf = (v >= median) ? 1 : 0;
if (vHalf != 0)
if (vHalf != 0) {
v -= median;
}
return (vHalf << 1) | uHalf;
}

View File

@@ -2920,8 +2920,9 @@ static wmOperatorStatus animchannels_delete_exec(bContext *C, wmOperator * /*op*
* the same loop. */
if (ac.datatype != ANIMCONT_DRIVERS) {
/* Keep deleting container-like channels until there are no more to delete. */
while (animchannels_delete_containers(C, &ac))
;
while (animchannels_delete_containers(C, &ac)) {
/* Pass. */
}
}
/* filter data */

View File

@@ -1245,8 +1245,9 @@ static void shader_preview_render(ShaderPreview *sp, ID *id, int split, int firs
#if 0
if (idtype == ID_TE) {
Tex *tex = (Tex *)id;
if (tex->use_nodes && tex->nodetree)
if (tex->use_nodes && tex->nodetree) {
ntreeEndExecTree(tex->nodetree);
}
}
#endif
}

View File

@@ -182,18 +182,18 @@ bool node_tex_tile_lookup(inout float3 co, sampler2DArray ima, sampler1DArray ma
{
float2 tile_pos = floor(co.xy);
if (tile_pos.x < 0 || tile_pos.y < 0 || tile_pos.x >= 10)
if (tile_pos.x < 0 || tile_pos.y < 0 || tile_pos.x >= 10) {
return false;
}
float tile = 10 * tile_pos.y + tile_pos.x;
if (tile >= textureSize(map, 0).x)
if (tile >= textureSize(map, 0).x) {
return false;
}
/* Fetch tile information. */
float tile_layer = texelFetch(map, int2(tile, 0), 0).x;
if (tile_layer < 0)
if (tile_layer < 0) {
return false;
}
float4 tile_info = texelFetch(map, int2(tile, 1), 0);
co = float3(((co.xy - tile_pos) * tile_info.zw) + tile_info.xy, tile_layer);

View File

@@ -4484,11 +4484,12 @@ static void rna_NodeCryptomatte_image_set(PointerRNA *ptr,
bNode *node = ptr->data_as<bNode>();
if (node->custom1 == CMP_NODE_CRYPTOMATTE_SOURCE_IMAGE) {
if (node->id)
if (node->id) {
id_us_min(node->id);
if (value.data)
}
if (value.data) {
id_us_plus(static_cast<ID *>(value.data));
}
node->id = static_cast<ID *>(value.data);
}
}

View File

@@ -992,8 +992,9 @@ static void rna_PartSettings_start_set(PointerRNA *ptr, float value)
}
# if 0
if (settings->type == PART_REACTOR && value < 1.0)
if (settings->type == PART_REACTOR && value < 1.0) {
value = 1.0;
}
else
# endif
if (value < MINAFRAMEF) {

View File

@@ -850,9 +850,9 @@ BLI_INLINE int lineart_line_isec_2d_ignore_line2pos(const double a1[2],
k1 = (a2[1] - a1[1]) / x_diff;
k2 = (b2[1] - b1[1]) / x_diff2;
if ((k1 == k2))
if ((k1 == k2)) {
return 0;
}
x = (a1[1] - b1[1] - k1 * a1[0] + k2 * b1[0]) / (k2 - k1);
ratio = (x - a1[0]) / x_diff;
@@ -861,9 +861,9 @@ BLI_INLINE int lineart_line_isec_2d_ignore_line2pos(const double a1[2],
}
}
if (ratio <= 0 || ratio >= 1)
if (ratio <= 0 || ratio >= 1) {
return 0;
}
return 1;
#endif
}

View File

@@ -1112,12 +1112,15 @@ static void build_permutation_table(ushort permutation[],
* every entry must appear exactly once
*/
# if 0
for (i = 0; i < number_of_rays; i++)
for (i = 0; i < number_of_rays; i++) {
temp_permutation[i] = 0;
for (i = 0; i < number_of_rays; i++)
}
for (i = 0; i < number_of_rays; i++) {
++temp_permutation[permutation[i]];
for (i = 0; i < number_of_rays; i++)
}
for (i = 0; i < number_of_rays; i++) {
BLI_assert(temp_permutation[i] == 1);
}
# endif
}

View File

@@ -12,8 +12,9 @@ BOOL LaunchedFromSteam()
{
HANDLE hSnapShot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
BOOL isSteam = FALSE;
if (!hSnapShot)
if (!hSnapShot) {
return (FALSE);
}
PROCESSENTRY32 process_entry;
process_entry.dwSize = sizeof(PROCESSENTRY32);