Repository navigation
frontend: state the conversions the app target now reports (#2625) - #2909
Conversation
2f57a0d to
1e86332
Compare
|
Status note: this is a draft on purpose and stays red until the class is complete. The RED commit Progress is recorded on #2625. Current replay of the frontend-ON C++ tree: 305 findings in 60 files Please leave it out of the merge queue until the replay is 0 and the notes here say so. |
|
Progress: replay is at 196 findings (178 unique) in 84 translation units, down from 458 at the start of the class. Clean now:
Every site states the conversion that was already happening; no arithmetic What is left is the two big files: |
…s enabled (#2625) #2625 ratchets the conversion pins one target at a time. The frontend's C++ sources are the ones PR CI never compiles with the groups on (that lane is master-push only), so they are replayed from a frontend-ON configure: the frontend-ON C++ replay reports 48 diagnostics in seven files. The fixes land in the next commit.
Partial: the 48 diagnostics in the `frontend.*` unity units that compile without the generated `ui_*.h`. The target-wide ratchet cannot build until the other 746 diagnostics in 63 files are fixed too, so this commit is not pushed on its own.
…#2625) Partial: 112 of the frontend's 786 diagnostics. The WHIP layer count and the slider tick geometry are float/unsigned arithmetic done at the call sites; the layer count is cast once after the <= 1 guard that makes it positive, and the tick geometry stays float through to QRectF instead of round-tripping through int for QPainter::fillRect. Both units compile clean (fsyntax-only, no errors): frontend.utility+.hpp.cpp and frontend.components+.hpp.cpp. The target-wide ratchet still cannot build until the remaining 674 diagnostics in 61 files are fixed.
…2625) Second slice of the frontend C++ class: the conversion the app target reports are stated at their call sites instead of relying on the global pins. - SimpleOutput: `config_get_int`/`config_get_uint` results are cast once where they enter the `int` bitrate/retry/row fields. - RemuxQueueModel: the QAbstractItemModel row API takes `int`; queue lengths are cast at the `beginInsertRows`/`beginRemoveRows`/`dataChanged` calls. - xsplit: the `indexOf`/`lastIndexOf` positions become `qsizetype`, so `-1` still fits and no narrowing is needed. - obs-spinbox: the suffix/prefix cursor indices are `qsizetype`, compared with the `int` cursor position and cast only at the `setCursorPosition` calls. - VolumeMeter: `convertToInt` takes a `qreal` (the levels are `qreal`), the nanosecond deltas convert once to `double`, and the tick geometry keeps its `float` arithmetic. - OBSBasicTransform: the flip widths are `float`, stated where the crop maths enters them. - Rect: `safeConvertToDouble` clamps in the value's own type; every integer type is already below the `double` limits. - properties-view/double-slider: the `lround` result and the decimals count are cast where they enter the `int` API. Replay of the frontend-ON C++ tree: 458 -> 388 findings.
Multiview mixes `uint32_t`/`size_t` geometry with the `float` layout fields and the `int` viewport API. Every seam is now stated where it happens: - `labelOffset` multiplies its `uint32_t` width in `float` before narrowing back. - the region lambda truncates the float layout position once, into `int`, which is what `startRegion` takes (the values that reach it were already truncated by the old `int(...)` C-cast). - the scene cell index (`size_t`) converts once per cell position, and the label width/height read from `obs_source_get_*` converts where it meets the `float` scale factors. - the `minX`/`maxX` layout maths keeps `int` and states the single float step. Replay of the frontend-ON C++ tree: 388 -> 305 findings; `Multiview.cpp.hpp` is clean.
The scene/source tree grids, the volume and adv-audio callbacks, the OAuth login parser, the interaction dialog and the remux progress bar each mix a Qt `qsizetype`/`qreal` with an `int` the call takes, or a libobs `int64_t` with an `int`. Every seat is now stated at the conversion that was already happening: - `SceneTree`'s grid maths converts the `int` cell extent and column count to `float` once per expression (the `ceil` was already float-valued), and the resulting float row index truncates once into `int`. - `SourceTree`/`SourceTreeModel` state the `qsizetype` row/count/index conversions where Qt's API hands them to an `int` parameter, including the `beginInsertRows` range; the empty-source label keeps the `QPoint` overload it was already reaching and truncates the `qreal` position explicitly. - `MediaControls` keeps the media time in the `int64_t` the libobs API uses instead of narrowing it, and its slide counter states the `calldata_int` narrowing. - `OBSAdvAudioCtrl`, `VolumeControl`, `AbsoluteSlider`, `FlowLayout`, `OBSPreviewScalingComboBox`, `SourceTreeItem`, `OBSApp`, `OAuthLogin`, `OBSBasicInteraction`, `OBSBasicProperties` and `OBSRemux` state the single narrowing each site performs; no arithmetic changes shape, so the values the implicit conversions produced are unchanged. Replay of the frontend-ON C++ tree: 305 -> 249 findings; `frontend/components`, `frontend/dialogs` and `frontend/OBSApp.cpp.hpp` are clean.
`AdvancedOutput` reads every output setting with `config_get_int`, which is `int64_t`, into `int` members: the track indices, rescale filters, bitrates, GOP size, retry/delay settings and the Replay Buffer bounds now state that narrowing at the read. The rest are the same single-conversion sites: - `ImporterModel`, `MissingFilesModel` and `audio-encoders` state a `qsizetype`/`uint64_t` where a Qt row or `uint32_t` is taken; the importer's `beginInsertRows` range truncates once. - the classic importer's colour maths adds an out-of-`int` offset, so the sum is stated back into `int` exactly where it was implicitly narrowed. - `platform-x11` multiplies the `uint32_t` label height in `double` before narrowing to the `float` the function returns (the multiply keeps its operand type, so the value is unchanged), and states the `WId` into the `uint32_t` window id. - the auto-config pages keep the `long double` estimates and fps values but state the `double`/`long`/`int` seats Qt's `QString::number` and the bitrate estimates take. Replay of the frontend-ON C++ tree: 249 -> 196 findings (178 unique); only `frontend/widgets` and `frontend/settings` are left.
The app target reports these as conversions because the config getters return the wide int64/uint64 types: - OBSBasicSettings: resolution, bitrate, track, delay and replay-buffer fields cast where `config_get_int`/`config_get_uint` enters the `int` or `uint32_t` field; the two `round()` results and the replay-buffer `setMaximum` calls state their narrowing too. - OBSBasicSettings_A11y: `preset` is an `int`, the colour components are `uint32_t`; the `a11y_color_to_int` helper returns `long long`, cast at the assignments. - OBSBasicSettings_Appearance / _Stream: font scale, density, simulcast layer count and multitrack-video limits cast at the `int` boundary. - OBSHotkeyWidget: `std::distance` returns `long`; cast where it feeds the `int` edit index.
The preview canvas mixes `int` offsets, `qreal`/`double` Qt geometry and `float` libobs vectors: - preview-scroll maths cast where `previewX`/`previewY` feed the `float` mouse/scale calculations, and the fixed-scale scroll deltas are `int`. - snap edges are `float`; the `QRectF` edge/centre accessors are `qreal`, so the ternaries and `tryEdgeSnapForOffset` arguments state the cast. - crop bounds cast where the `int` crop rectangle meets the `vec2`; the literal factors become `f` so the maths stays `float`. - rotation handle and angle arithmetic stay `float`; `scalingLevel` and the font size state the `round()`/`int64_t` narrowing. - scrollbar page steps are `int`; viewport/size `vec3_set` calls cast the `uint32_t` video dimensions.
The remaining application-level slices: - OBSBasic: `dpi` is `float`, the scaled preview size is `uint32_t`, and the adapter/sample-rate/FPS-type fields are `uint32_t`; the item count is `qsizetype` and casts where it becomes the `int` row count. - OBSBasic_Docks: dock list sizes and `indexOf` results are `qsizetype`, cast where they enter `int` loop counters/indices. - OBSBasic_Projectors / _SceneCollections / _SceneItems / _Transitions: `obs_data_get_int` returns `int64_t`; the local `int` fields state the narrowing, and the screen pixel size casts the rounded geometry once. - OBSBasicStats: `QString::number` takes `double` while the stats maths is `long double`; the row index casts the `qsizetype` label count. - OBSBasic_StudioMode: the `programX`/`programY` offsets are `int`, so they take the `int` edge constant directly. - OBSBasic_Updater: the stored version is `uint32_t`.
83f7ab7 to
745299e
Compare
|
Rebased onto The previous head failed with 185 remaining diagnostics in 16 files (
Every site takes a behaviour-preserving
|
#2625) The Qt Frontend lane's second pass reported 13 sites in this file: - CloseFloat's default epsilon is a float parameter, so the literal is 0.01f rather than a double narrowed at every inlined call site. - the two preview-coordinate helpers take qreal-scaled int positions into a vec2, so the QPoint accessors state the cast. - the scroll-bar page steps divide an int pixel size by a float scale, so the pixel size states the cast before the division.
a09be1e to
75ef533
Compare
…sion pins (obs-rust#2938) (obs-rust#2944) * test(frontend): one conversion opt-in block per target (obs-rust#2938) The app target's conversion groups are opted into by naming them in target_compile_options. obs-rust#2909 added a second block beside the existing sign-conversion opt-in with all three groups, while 63 frontend files were still unconverted, so the app lanes stopped on the first of them. The test fails on that shape: two blocks, and a set that is not the one group the target has ratcheted. It passes with the second block removed. RED: AssertionError: 2 != 1 (two opt-in blocks); the flag set is ['-Wconversion', '-Wfloat-conversion', '-Wsign-conversion'] instead of ['-Wsign-conversion']. * build(frontend): keep the unconverted app target on the global conversion pins (obs-rust#2938) obs-rust#2909 named all three conversion groups on `obs-studio` while 63 of its files were still unconverted, so `Build 🧱 / Ubuntu 🐧 (OBS-Studio-Rust)`, `Build 🧱 / Flatpak 📦` and both macOS app lanes stopped on the first of them. PR CI does not build the app, so the PR was green and master went red. This removes that second block. The target opts into `-Wsign-conversion` alone again — the group it had already converted — and `-Wconversion` / `-Wfloat-conversion` stay on the global pins until their files are converted. No behavior change: the removed flags only turned warnings into errors. GREEN: the new `ci/test_frontend_conversion_optins.py` passes (2 tests), and gersemi -c reports the file formatted.
…-rust#2938) (obs-rust#2940) Master's app lanes stop in the frontend C++ compile now that obs-rust#2909 turned on -Wconversion/-Wsign-conversion for the obs-studio target: ExtraBrowsersModel.cpp.hpp:20,33,108,246 'qsizetype' to 'int' may change value qt-host-{macos,posix,windows}.cpp.hpp 'int' to 'uint32_t' in translate_modifiers `items.size()`/`count()` is `qsizetype`, and `translate_modifiers()` returns `uint32_t` while its accumulator was `int`; both are stated at the call site, with no flag change.
Refs #2625. Frontend C++ class of the conversion ratchet: the app target opts into
-Wconversion/-Wsign-conversion/-Wfloat-conversion, and every conversion itreports is stated at its call site.
0e4e71f0aadds the target-level opt-in infrontend/CMakeLists.txt; thefrontend-ON C++ replay reports the diagnostics the pins were hiding.
WHIPSimulcastEncoders.hpp(layer count castonce after the
<= 1guard, loop indexuint32_t),VolumeSlider.cpp.hpp(tickgeometry stays
floattoQRectF), and the first seven files.Draft while the rest of the frontend files are fixed; the target-wide pin can only be
deleted once the last file's conversions are stated.