Fix conversions #120873

Closed
Giang-Chaebol wants to merge 1 commits from Giang-Chaebol/blender:giang/FixConversions into blender-v4.1-release

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
Contributor

This pull request fixes the following errors when following this instruction:

blender/source/blender/blenfont/intern/blf_font.cc:1518:44: error: conversion from ‘int’ to ‘short int’ may change value [-Werror=conversion]
 1518 |     metrics->descender = metrics->ascender - metrics->units_per_EM;
blender/source/blender/blenfont/intern/blf_glyph.cc:306:64: error: conversion from ‘int’ to ‘uchar’ {aka ‘unsigned char’} may change value [-Werror=conversion]
  306 |         g->bitmap[i] = blf_glyph_gamma(glyph->bitmap.buffer[i] * scale);
blender/blenkernel/intern/bvhutils.cc:962:82: error: invalid const_cast from type ‘BMLoop* (*)[3]’ to type ‘const BMLoop* (*)[3]’
  962 |   const BMLoop *(*corner_tris)[3] = const_cast<const BMLoop *(*)[3]>(em->looptris);
blender/source/blender/blenkernel/intern/editmesh_bvh.cc:312:73: error: invalid const_cast from type ‘BMLoop* (*)[3]’ to type ‘const BMLoop* (*)[3]’
  312 |   bmcb_data.looptris = const_cast<const BMLoop *(*)[3]>(bmtree->looptris);
      |                                                                         ^
blender/source/blender/blenkernel/intern/editmesh_bvh.cc:377:74: error: invalid const_cast from type ‘BMLoop* (*)[3]’ to type ‘const BMLoop* (*)[3]’
  377 |   bmcb_data->looptris = const_cast<const BMLoop *(*)[3]>(bmtree->looptris);
      |                                                                          ^
blender/source/blender/blenkernel/intern/editmesh_bvh.cc:440:73: error: invalid const_cast from type ‘BMLoop* (*)[3]’ to type ‘const BMLoop* (*)[3]’
  440 |   bmcb_data.looptris = const_cast<const BMLoop *(*)[3]>(bmtree->looptris);
      |                                                                         ^
blender/source/blender/blenkernel/intern/editmesh_bvh.cc:499:73: error: invalid const_cast from type ‘BMLoop* (*)[3]’ to type ‘const BMLoop* (*)[3]’
  499 |   bmcb_data.looptris = const_cast<const BMLoop *(*)[3]>(bmtree->looptris);
blender/blenkernel/intern/editmesh_tangent.cc:289:79: error: invalid const_cast from type ‘BMLoop* (*)[3]’ to type ‘const BMLoop* (*)[3]’
  289 |         mesh2tangent->looptris = const_cast<const BMLoop *(*)[3]>(em->looptris);
blender-git/blender/source/blender/blenlib/intern/index_mask.cc:444:60: error: conversion from ‘int’ to ‘int16_t’ {aka ‘short int’} may change value [-Werror=conversion]
  444 |     const int16_t gap_first = indices[size_before_gap - 1] + 1;
blender/source/blender/editors/space_view3d/view3d_navigate_walk.cc:1228:23: error: conversion from ‘int’ to ‘short int’ may change value [-Werror=conversion]
 1228 |             direction += 1;
      |             ~~~~~~~~~~^~~~
blender/source/blender/editors/space_view3d/view3d_navigate_walk.cc:1232:23: error: conversion from ‘int’ to ‘short int’ may change value [-Werror=conversion]
 1232 |             direction -= 1;
      |             ~~~~~~~~~~^~~~
blender/source/blender/editors/space_view3d/view3d_navigate_walk.cc:1252:23: error: conversion from ‘int’ to ‘short int’ may change value [-Werror=conversion]
 1252 |             direction += 1;
      |             ~~~~~~~~~~^~~~
blender/source/blender/editors/space_view3d/view3d_navigate_walk.cc:1256:23: error: conversion from ‘int’ to ‘short int’ may change value [-Werror=conversion]
 1256 |             direction -= 1;
      |             ~~~~~~~~~~^~~~
blender/source/blender/editors/space_view3d/view3d_navigate_walk.cc:1274:25: error: conversion from ‘int’ to ‘short int’ may change value [-Werror=conversion]
 1274 |               direction -= 1;
      |               ~~~~~~~~~~^~~~
blender/source/blender/editors/space_view3d/view3d_navigate_walk.cc:1278:25: error: conversion from ‘int’ to ‘short int’ may change value [-Werror=conversion]
 1278 |               direction += 1;
      |               ~~~~~~~~~~^~~~
blender/source/blender/editors/space_view3d/view3d_navigate_walk.cc:1290:25: error: conversion from ‘int’ to ‘short int’ may change value [-Werror=conversion]
 1290 |               direction -= 1;
      |               ~~~~~~~~~~^~~~
blender/source/blender/editors/space_view3d/view3d_navigate_walk.cc:1294:25: error: conversion from ‘int’ to ‘short int’ may change value [-Werror=conversion]
 1294 |               direction += 1;
This pull request fixes the following errors when following [this](https://developer.blender.org/docs/handbook/building_blender/linux/#update-and-build) instruction: ``` blender/source/blender/blenfont/intern/blf_font.cc:1518:44: error: conversion from ‘int’ to ‘short int’ may change value [-Werror=conversion] 1518 | metrics->descender = metrics->ascender - metrics->units_per_EM; ``` ``` blender/source/blender/blenfont/intern/blf_glyph.cc:306:64: error: conversion from ‘int’ to ‘uchar’ {aka ‘unsigned char’} may change value [-Werror=conversion] 306 | g->bitmap[i] = blf_glyph_gamma(glyph->bitmap.buffer[i] * scale); ``` ``` blender/blenkernel/intern/bvhutils.cc:962:82: error: invalid const_cast from type ‘BMLoop* (*)[3]’ to type ‘const BMLoop* (*)[3]’ 962 | const BMLoop *(*corner_tris)[3] = const_cast<const BMLoop *(*)[3]>(em->looptris); ``` ``` blender/source/blender/blenkernel/intern/editmesh_bvh.cc:312:73: error: invalid const_cast from type ‘BMLoop* (*)[3]’ to type ‘const BMLoop* (*)[3]’ 312 | bmcb_data.looptris = const_cast<const BMLoop *(*)[3]>(bmtree->looptris); | ^ blender/source/blender/blenkernel/intern/editmesh_bvh.cc:377:74: error: invalid const_cast from type ‘BMLoop* (*)[3]’ to type ‘const BMLoop* (*)[3]’ 377 | bmcb_data->looptris = const_cast<const BMLoop *(*)[3]>(bmtree->looptris); | ^ blender/source/blender/blenkernel/intern/editmesh_bvh.cc:440:73: error: invalid const_cast from type ‘BMLoop* (*)[3]’ to type ‘const BMLoop* (*)[3]’ 440 | bmcb_data.looptris = const_cast<const BMLoop *(*)[3]>(bmtree->looptris); | ^ blender/source/blender/blenkernel/intern/editmesh_bvh.cc:499:73: error: invalid const_cast from type ‘BMLoop* (*)[3]’ to type ‘const BMLoop* (*)[3]’ 499 | bmcb_data.looptris = const_cast<const BMLoop *(*)[3]>(bmtree->looptris); ``` ``` blender/blenkernel/intern/editmesh_tangent.cc:289:79: error: invalid const_cast from type ‘BMLoop* (*)[3]’ to type ‘const BMLoop* (*)[3]’ 289 | mesh2tangent->looptris = const_cast<const BMLoop *(*)[3]>(em->looptris); ``` ``` blender-git/blender/source/blender/blenlib/intern/index_mask.cc:444:60: error: conversion from ‘int’ to ‘int16_t’ {aka ‘short int’} may change value [-Werror=conversion] 444 | const int16_t gap_first = indices[size_before_gap - 1] + 1; ``` ``` blender/source/blender/editors/space_view3d/view3d_navigate_walk.cc:1228:23: error: conversion from ‘int’ to ‘short int’ may change value [-Werror=conversion] 1228 | direction += 1; | ~~~~~~~~~~^~~~ blender/source/blender/editors/space_view3d/view3d_navigate_walk.cc:1232:23: error: conversion from ‘int’ to ‘short int’ may change value [-Werror=conversion] 1232 | direction -= 1; | ~~~~~~~~~~^~~~ blender/source/blender/editors/space_view3d/view3d_navigate_walk.cc:1252:23: error: conversion from ‘int’ to ‘short int’ may change value [-Werror=conversion] 1252 | direction += 1; | ~~~~~~~~~~^~~~ blender/source/blender/editors/space_view3d/view3d_navigate_walk.cc:1256:23: error: conversion from ‘int’ to ‘short int’ may change value [-Werror=conversion] 1256 | direction -= 1; | ~~~~~~~~~~^~~~ blender/source/blender/editors/space_view3d/view3d_navigate_walk.cc:1274:25: error: conversion from ‘int’ to ‘short int’ may change value [-Werror=conversion] 1274 | direction -= 1; | ~~~~~~~~~~^~~~ blender/source/blender/editors/space_view3d/view3d_navigate_walk.cc:1278:25: error: conversion from ‘int’ to ‘short int’ may change value [-Werror=conversion] 1278 | direction += 1; | ~~~~~~~~~~^~~~ blender/source/blender/editors/space_view3d/view3d_navigate_walk.cc:1290:25: error: conversion from ‘int’ to ‘short int’ may change value [-Werror=conversion] 1290 | direction -= 1; | ~~~~~~~~~~^~~~ blender/source/blender/editors/space_view3d/view3d_navigate_walk.cc:1294:25: error: conversion from ‘int’ to ‘short int’ may change value [-Werror=conversion] 1294 | direction += 1; ```
Giang-Chaebol added 1 commit 2024-04-21 13:13:10 +02:00

Thanks for doing this. Please, send separate change of each file as separate Pull Request, make sure: You fallow code style guideline, Add all neccessery info into PR, And write description for each of PRs

Thanks for doing this. Please, send separate change of each file as separate Pull Request, make sure: [You fallow code style guideline](https://developer.blender.org/docs/handbook/guidelines/c_cpp/), [Add all neccessery info into PR](https://developer.blender.org/docs/handbook/contributing/review_playbook/), [And write description for each of PRs](https://developer.blender.org/docs/handbook/guidelines/commit_messages/)
Author
Contributor

I seperated it into 7 Pull Requests:
#120877
#120879
#120880
#120881
#120882
#120883
#120884

I seperated it into 7 Pull Requests: https://projects.blender.org/blender/blender/pulls/120877 https://projects.blender.org/blender/blender/pulls/120879 https://projects.blender.org/blender/blender/pulls/120880 https://projects.blender.org/blender/blender/pulls/120881 https://projects.blender.org/blender/blender/pulls/120882 https://projects.blender.org/blender/blender/pulls/120883 https://projects.blender.org/blender/blender/pulls/120884
Giang-Chaebol closed this pull request 2024-04-21 15:32:01 +02:00

@mod_moder I don't think it was good advice to split this PR up, it just causes more work for no benefit that I can see.

@mod_moder I don't think it was good advice to split this PR up, it just causes more work for no benefit that I can see.

Note that these pull requests need to be targeted at main, we are not planning any more 4.1 releases. And even if we were, it would still need to be merged into main and then backported to 4.1.

If these are build fixes for a new compiler version, we may need to backport these to 3.3 and 3.6 as well. In which case a single commit would be simpler as well.

Note that these pull requests need to be targeted at main, we are not planning any more 4.1 releases. And even if we were, it would still need to be merged into main and then backported to 4.1. If these are build fixes for a new compiler version, we may need to backport these to 3.3 and 3.6 as well. In which case a single commit would be simpler as well.
Author
Contributor

Please be consistent, should I target these PRs at main? If so, do I need to split the PR into changes of each file?

Please be consistent, should I target these PRs at main? If so, do I need to split the PR into changes of each file?

Sorry for the confusion. At this point I think you can just keep the new PRs that you already created. But the target branch in them should be changed to main.

Sorry for the confusion. At this point I think you can just keep the new PRs that you already created. But the target branch in them should be changed to `main`.

Pull request closed

Sign in to join this conversation.
No reviewers
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#120873
No description provided.