In basic/source/runtime/methods.cxx, there are lots of SbRtl_* functions, that implement various Basic functions and procedures. They typically have an argument check, and do the actual work in 'else' branch of the check. This easyhack is to flatten those functions to increase readability, by returning from the failed check. For example: void SbRtl_Tan(StarBASIC *, SbxArray & rPar, bool) { if (rPar.Count() < 2) { StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT ); } else { SbxVariableRef pArg = rPar.Get(1); rPar.Get(0)->PutDouble(tan(pArg->GetDouble())); } } This function may be re-written as void SbRtl_Tan(StarBASIC *, SbxArray & rPar, bool) { if (rPar.Count() < 2) return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT ); SbxVariableRef pArg = rPar.Get(1); rPar.Get(0)->PutDouble(tan(pArg->GetDouble())); }
Reset as NEW; Multi-Hack!
Ramreiso Kashung committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/bcaf13205052a64373599245ae0b1020b04b1385 tdf#147132: Flatten Basic function implementations It will be available in 7.4.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
offtkp committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/6bc187b2eb6b9520c942f232b1abcb4fb29bfa04 tdf#147132 Flatten Basic function implementations It will be available in 7.4.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Roman Kuznetsov committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/43458f83f29067752cfb3df2ccfe0eeb940f4b71 tdf#147132 Flatten Basic function implementation It will be available in 7.4.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Roman Kuznetsov committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/66fe1fa945a161b2f617ab3576ddef23d84148f8 tdf#147132 Flatten Basic function It will be available in 7.4.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Roman Kuznetsov committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/f30af7b3516d783d717745b63134499ea0d049fc tdf#147132 Flatten Basic function It will be available in 7.4.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Roman Kuznetsov committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/c2bf1ff91fab4574dd27808a2e4391c7a4b99d20 tdf#147132 Flatten a Basic function It will be available in 7.5.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Re-evaluating the EasyHack in 2022 This enhancement is still relevant. One may search for this statement to find instances of the proposed change in basic/source/runtime/methods.cxx: StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT ); The result of this search should be checked to makes sure that there is no other expression after the matching else. There are somehow similar conditions: if ( ... ) { StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT ); return; } which can also be converted to a shorter form: if ( ... ) return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
Arnaud VERSINI committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/6b3e66cd7a355061bf1dec76bbc4f389b6b60f2d tdf147132 basic : flaten some functions It will be available in 7.5.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Eike Rathke committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/e06198e1544f33419be4ce303458da8b5160bc1a Resolves: tdf#152917 Add ConvertFromUrl() put result back, tdf#147132 follow-up It will be available in 7.6.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Eike Rathke committed a patch related to this issue. It has been pushed to "libreoffice-7-5": https://git.libreoffice.org/core/commit/fd5a4de7c39dc43b9668e77046622894cdd2051a Resolves: tdf#152917 Add ConvertFromUrl() put result back, tdf#147132 follow-up It will be available in 7.5.0.2. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Radhey Parekh committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/d0700f45c510385a95a181f646d6bb99d085fcaa tdf#147132 Flatten Basic function implementations It will be available in 7.6.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Sunny: please don't assign this to yourself as this is a multi-dev hack.
Sorry, somehow I missed the multi-hack tag. Thanks for reminding me!
Hi Hossein and Mike Can you please review my change, gerrit: https://gerrit.libreoffice.org/c/core/+/148519 It's been some time since it's open.
adityasingh22 committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/a49019618be881520a454550454c3f2d078d17fa tdf#147132: Simplify usage of StarBASIC::Error() It will be available in 7.6.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
sahil committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/a00cf4bc779b1da85423371fec43f8638c77e423 tdf#147132 Flatten Basic function implementations It will be available in 24.2.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
OmkarAcharekar committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/95df8cda94007e7e5b316a02176bed76259c21c4 tdf#147132 Flatten Basic function implementations It will be available in 24.2.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Aron Budea committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/c4c017d1b8fe30d1ef452782eef71371282deb37 tdf#147132 tdf#154285 Flatten and check param count of IsMissing fn It will be available in 24.2.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Aron Budea committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/8318337c3e30075acc72fa8c9d5051c33319fdf5 tdf#147132 tdf#154285 basic: Flatten and check param count of Is* fns It will be available in 24.8.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
U-Aarons_Laptop\Aaron committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/26c30fd77bf31ad8c14da1413aaa61fa8aa45206 tdf#147132: Flatten Basic function implementations It will be available in 24.8.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
AmandaQuaresmaCoutinho committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/bb89fe7ab67c1476b6cf250f236bd5b643a77c6e tdf#147132 Flatten Basic function implementations It will be available in 24.8.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Tuukka Orava committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/f3d0a184c4da57907a1fcf1ed784340be7d974d6 tdf#147132 Flatten Basic function implementations It will be available in 24.8.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.