Cleanup: use 'const' where possible, remove redundant check

This commit is contained in:
Campbell Barton
2024-03-09 16:37:40 +11:00
parent 21371baac2
commit 74d9fb60ba
4 changed files with 6 additions and 8 deletions
+1 -1
View File
@@ -5543,7 +5543,7 @@ static CLG_LogRef LOG_WL_SEAT = {"ghost.wl.handle.seat"};
static bool gwl_seat_capability_pointer_multitouch_check(const GWL_Seat *seat, const bool fallback)
{
zwp_pointer_gestures_v1 *pointer_gestures = seat->system->wp_pointer_gestures_get();
const zwp_pointer_gestures_v1 *pointer_gestures = seat->system->wp_pointer_gestures_get();
if (pointer_gestures == nullptr) {
return fallback;
}
+1 -1
View File
@@ -1341,7 +1341,7 @@ static void libdecor_frame_handle_configure(libdecor_frame *frame,
/* These values are cleared after use & will practically always be zero.
* Read them because it's possible multiple configure calls run before they can be handled.
*/
GWL_LibDecor_Window &decor = *win->libdecor;
const GWL_LibDecor_Window &decor = *win->libdecor;
size_next[0] = decor.pending.size[0];
size_next[1] = decor.pending.size[1];
}
+1 -1
View File
@@ -39,7 +39,7 @@ void IMB_metadata_free(IDProperty *metadata);
* \param len: length of value buffer allocated by user.
* \return 1 (true) if metadata is present and value for the key found, 0 (false) otherwise.
*/
bool IMB_metadata_get_field(IDProperty *metadata,
bool IMB_metadata_get_field(const IDProperty *metadata,
const char *key,
char *value,
size_t value_maxncpy);
+3 -5
View File
@@ -40,18 +40,16 @@ void IMB_metadata_free(IDProperty *metadata)
IDP_FreeProperty(metadata);
}
bool IMB_metadata_get_field(IDProperty *metadata,
bool IMB_metadata_get_field(const IDProperty *metadata,
const char *key,
char *value,
const size_t value_maxncpy)
{
IDProperty *prop;
if (metadata == nullptr) {
return false;
}
prop = IDP_GetPropertyFromGroup(metadata, key);
IDProperty *prop = IDP_GetPropertyFromGroup(metadata, key);
if (prop && prop->type == IDP_STRING) {
BLI_strncpy(value, IDP_String(prop), value_maxncpy);
@@ -82,7 +80,7 @@ void IMB_metadata_set_field(IDProperty *metadata, const char *key, const char *v
if (prop) {
IDP_AssignString(prop, value);
}
else if (prop == nullptr) {
else {
prop = IDP_NewString(value, key);
IDP_AddToGroup(metadata, prop);
}