Find C++ source files that need a suspiciously high amount of const_cast, then see if some of them are due to poor design that can be improved (by e.g. making relevant member functions const, making relevant member variables mutable, making relevant variables pointer to non-const). (You can use something like > git grep --word-regexp --count const_cast | sort --numeric-sort --key=2 --field-separator=: to get the high-scorers of const_cast usage.)
Migrating Whiteboard tags to Keywords: (easyHack, difficultyBeginner, skillCpp, topicCleanup)
Takeshi Abe committed a patch related to this issue. It has been pushed to "master": http://cgit.freedesktop.org/libreoffice/core/commit/?id=4ae319ae462f3f094452046e392c8c15446736ae tdf#90341 Clean up excessive const_cast'ing It will be available in 5.2.0. The patch should be included in the daily builds available at http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: http://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
JanI is default CC for Easy Hacks (Add Jan; remove LibreOffice Dev List from CC) [NinjaEdit]
Please be aware, that this easyhack is considered an important but large scale cosmetic change as described in https://wiki.documentfoundation.org/Development/LargeScaleChanges It was in decided by the ESC to close this kind of easyhacks, and send them directly as mail, to new contributors. https://lists.freedesktop.org/archives/libreoffice/2016-August/074920.html Please do not submit patches with many files !! This easyhacks should/will be opened, when we have a window to do largescale changes.
Changing status: NEEDINFO -> NEW Adding keyword 'needsDevEval' [ninjaedit]
Hi Stephan. I tried fix this issue but jenkins says something went wrong. This is my patch : https://gerrit.libreoffice.org/c/core/+/93472 And this is error: "error "binding value of type "const DbGridControl" to reference to type "DbGridControl" drops "const" qualifier" triggered in included file /home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_clang_dbgutil_64/svx/source/inc/gridcell.hxx:136:46" 1)I can remove this const keyword gridcell.hxx:136 DbGridControl& GetParent() const {return m_rParent;} 2)Or i can ignore changes that i made before and only I can change this function. std::unique_ptr<DbGridColumn> DbGridControl::CreateColumn(sal_uInt16 nId) const { return std::unique_ptr<DbGridColumn>(new DbGridColumn(nId, *const_cast<DbGridControl*>(this))); } with this std::unique_ptr<DbGridColumn> DbGridControl::CreateColumn(sal_uInt16 nId) { return std::unique_ptr<DbGridColumn>(new DbGridColumn(nId, *this)); } But i'm confused. What the logic in here? One of these ways is right? İf right. Which and why? I am really curious? Can you help me?
(In reply to mesutcfc from comment #6) > This is my patch : https://gerrit.libreoffice.org/c/core/+/93472 lets continue the discussion at <https://gerrit.libreoffice.org/c/core/+/93472/1#message-2d85da9e66f43cbdd85e8fd4ff56a9645ce9c3f0>
Mesut Çifci committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/7b152167a4e4c3eaac95aee8f282873681c90092 tdf90341 Clean up excessive const_cast'ing It will be available in 7.0.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.
VaibhavMalik4187 committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/d1207a5f3a573dbe39a7874931ce373e5c88628d tdf#90341 Clean Up Excessive const_cast'ing 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.
Hi, I have contributed to few easy hacks and after that I am working on this hack. I have found a file source/font/font.cxx and there are const_casts done in a couple of functions, I also have a way to check my changes in the locally built version of libreoffice by running make, but I am confused how can I know whether these const_casts are important or not without having to build? Any help would be really appreciated. Thanks!
(In reply to Harshita Nag from comment #10) > I also have a way to check my changes in the locally built version of > libreoffice by running make, but I am confused how can I know whether these > const_casts are important or not without having to build? I don't understand the above. The idea here is to come up with some working change (which thus succeeds `make`) that avoids some const_cast(s). But anyway, probably easier to follow up on any questions you still have if you turn your work into a Gerrit change and add me as a reviewer there.
Hello all, This is my second easy hack that I'm doing for LibreOffice. I've tried to do a couple of code submissions for this easy hack but unfortunately, they're failing in the build test. You can view them at: https://gerrit.libreoffice.org/c/core/+/144374 Unfortunately, I'm not at all familiar with the OUString class in LibreOffice and am new to open-source development as a whole. Please tell me what the errors mean really that are coming up in the failed build tests and what can I do to solve them. Also, is there any documentation for the code that is written for these code files so that beginners can figure out what they are supposed to do? Are there any mentors or someone who can help guide me to solve this easy hack?
sahil committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/bf81be2641e8c66d78374289497b117fe3dfb024 tdf#90341 Clean up excessive const_cast'ing 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.
Adam Seskunas committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/07059f3336f0daea15c0574a67bd99986eccedd3 tdf#90341 Clean up excessive const_cast'ing 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.
Usman Akinyemi committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/ad6f39b19c8853c1e8f71a32f88d4656029e4005 tdf#90341 Clean up excessive const_cast'ing It will be available in 25.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.