Cleanup: use const variables & arguments, remove unused assignments

This commit is contained in:
Campbell Barton
2023-12-10 21:18:25 +11:00
parent 0e64c959be
commit ffc84da541
12 changed files with 34 additions and 26 deletions
+2 -2
View File
@@ -667,7 +667,7 @@ static bool checkLayerSupport(const vector<VkLayerProperties> &layers_available,
return false;
}
static void enableLayer(vector<VkLayerProperties> &layers_available,
static void enableLayer(const vector<VkLayerProperties> &layers_available,
vector<const char *> &layers_enabled,
const VkLayer layer,
const bool display_warning)
@@ -789,7 +789,7 @@ static bool selectSurfaceFormat(const VkPhysicalDevice physical_device,
vector<VkSurfaceFormatKHR> formats(format_count);
vkGetPhysicalDeviceSurfaceFormatsKHR(physical_device, surface, &format_count, formats.data());
for (VkSurfaceFormatKHR &format : formats) {
for (const VkSurfaceFormatKHR &format : formats) {
if (surfaceFormatSupported(format)) {
r_surfaceFormat = format;
return true;
+1 -1
View File
@@ -80,7 +80,7 @@ class GHOST_ContextVK : public GHOST_Context {
#endif
int contextMajorVersion,
int contextMinorVersion,
int m_debug);
int debug);
/**
* Destructor.
+7 -3
View File
@@ -8101,8 +8101,12 @@ GHOST_TimerManager *GHOST_SystemWayland::ghost_timer_manager()
#ifdef WITH_INPUT_IME
void GHOST_SystemWayland::ime_begin(
GHOST_WindowWayland *win, int32_t x, int32_t y, int32_t w, int32_t h, bool completed) const
void GHOST_SystemWayland::ime_begin(const GHOST_WindowWayland *win,
int32_t x,
int32_t y,
int32_t w,
int32_t h,
bool completed) const
{
GWL_Seat *seat = gwl_display_seat_active_get(display_);
if (UNLIKELY(!seat)) {
@@ -8168,7 +8172,7 @@ void GHOST_SystemWayland::ime_begin(
}
}
void GHOST_SystemWayland::ime_end(GHOST_WindowWayland * /*window*/) const
void GHOST_SystemWayland::ime_end(const GHOST_WindowWayland * /*window*/) const
{
GWL_Seat *seat = gwl_display_seat_active_get(display_);
if (UNLIKELY(!seat)) {
+7 -3
View File
@@ -238,9 +238,13 @@ class GHOST_SystemWayland : public GHOST_System {
struct wl_shm *wl_shm_get() const;
void ime_begin(
GHOST_WindowWayland *win, int32_t x, int32_t y, int32_t w, int32_t h, bool completed) const;
void ime_end(GHOST_WindowWayland *win) const;
void ime_begin(const GHOST_WindowWayland *win,
int32_t x,
int32_t y,
int32_t w,
int32_t h,
bool completed) const;
void ime_end(const GHOST_WindowWayland *win) const;
static const char *xdg_app_id_get();
+1 -1
View File
@@ -205,7 +205,7 @@ class GHOST_SystemX11 : public GHOST_System {
* passing in the time-stamp from X to input to get the event
* time-stamp with an offset applied to make it compatible with `getMilliSeconds`.
*/
uint64_t ms_from_input_time(const Time timestamp_as_uint) const;
uint64_t ms_from_input_time(const Time timestamp) const;
/** Helped function for get data from the clipboard. */
void getClipboard_xcout(const XEvent *evt,
+3 -3
View File
@@ -169,10 +169,10 @@ void GHOST_XrContext::printInstanceInfo()
void GHOST_XrContext::printAvailableAPILayersAndExtensionsInfo()
{
puts("Available OpenXR API-layers/extensions:");
for (XrApiLayerProperties &layer_info : m_oxr->layers) {
for (const XrApiLayerProperties &layer_info : m_oxr->layers) {
printf("Layer: %s\n", layer_info.layerName);
}
for (XrExtensionProperties &ext_info : m_oxr->extensions) {
for (const XrExtensionProperties &ext_info : m_oxr->extensions) {
printf("Extension: %s\n", ext_info.extensionName);
}
}
@@ -329,7 +329,7 @@ void GHOST_XrContext::initApiLayers()
/* Actually get the layers. */
CHECK_XR(xrEnumerateApiLayerProperties(layer_count, &layer_count, m_oxr->layers.data()),
"Failed to query OpenXR runtime information. Do you have an active runtime set up?");
for (XrApiLayerProperties &layer : m_oxr->layers) {
for (const XrApiLayerProperties &layer : m_oxr->layers) {
/* Each layer may have own extensions. */
initExtensionsEx(m_oxr->extensions, layer.layerName);
}
+2 -2
View File
@@ -474,8 +474,8 @@ static void ghost_xr_draw_view_info_from_view(const XrView &view, GHOST_XrDrawVi
void GHOST_XrSession::drawView(GHOST_XrSwapchain &swapchain,
XrCompositionLayerProjectionView &r_proj_layer_view,
XrSpaceLocation &view_location,
XrView &view,
const XrSpaceLocation &view_location,
const XrView &view,
uint32_t view_idx,
void *draw_customdata)
{
+2 -2
View File
@@ -109,8 +109,8 @@ class GHOST_XrSession {
std::vector<XrCompositionLayerProjectionView> &r_proj_layer_views, void *draw_customdata);
void drawView(GHOST_XrSwapchain &swapchain,
XrCompositionLayerProjectionView &r_proj_layer_view,
XrSpaceLocation &view_location,
XrView &view,
const XrSpaceLocation &view_location,
const XrView &view,
uint32_t view_idx,
void *draw_customdata);
void beginFrameDrawing();
+1 -1
View File
@@ -75,7 +75,7 @@ void imm_draw_circle_fill_aspect_2d(
*/
void imm_draw_circle_wire_3d(uint pos, float x, float y, float radius, int nsegments);
void imm_draw_circle_wire_aspect_3d(
uint shdr_pos, float x, float y, float radius_x, float radius_y, int nsegments);
uint pos, float x, float y, float radius_x, float radius_y, int nsegments);
void imm_draw_circle_dashed_3d(uint pos, float x, float y, float radius, int nsegments);
void imm_draw_circle_fill_3d(uint pos, float x, float y, float radius, int nsegments);
void imm_draw_circle_fill_aspect_3d(
@@ -44,7 +44,7 @@ FileWriter::FileWriter(const char *filepath, bool ascii) : tris_num_(0), ascii_(
fmt::print(file_, "solid \n");
}
else {
char header[BINARY_HEADER_SIZE] = {};
const char header[BINARY_HEADER_SIZE] = {};
fwrite(header, 1, BINARY_HEADER_SIZE, file_);
/* Write placeholder for number of triangles, so that it can be updated later (after all
* triangles have been written). */
@@ -237,7 +237,7 @@ void RNA_api_bone(StructRNA *srna)
RNA_def_property_multi_array(parm, 2, rna_matrix_dimsize_4x4);
RNA_def_property_ui_text(
parm, "", "The custom rest matrix of the parent bone (Bone.matrix_local)");
parm = RNA_def_boolean(func, "invert", false, "", "Convert from Pose to Local space");
RNA_def_boolean(func, "invert", false, "", "Convert from Pose to Local space");
/* Conversions between Matrix and Axis + Roll representations. */
func = RNA_def_function(srna, "MatrixFromAxisRoll", "rna_Bone_MatrixFromAxisRoll");
@@ -250,12 +250,12 @@ void RNA_api_mesh(StructRNA *srna)
"Compute tangents and bitangent signs, to be used together with the split normals "
"to get a complete tangent space for normal mapping "
"(split normals are also computed if not yet present)");
parm = RNA_def_string(func,
"uvmap",
nullptr,
MAX_CUSTOMDATA_LAYER_NAME_NO_PREFIX,
"",
"Name of the UV map to use for tangent space computation");
RNA_def_string(func,
"uvmap",
nullptr,
MAX_CUSTOMDATA_LAYER_NAME_NO_PREFIX,
"",
"Name of the UV map to use for tangent space computation");
func = RNA_def_function(srna, "free_tangents", "rna_Mesh_free_tangents");
RNA_def_function_ui_description(func, "Free tangents");