-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
StringUtils: remove legacy fmt::sprintf usage #19796
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you plan on replacing all calls to StringUtils::Format()
with direct calls to fmt::format()
? IMO that would make it more clear that you can't use sprintf()
style syntax anymore and you would also benefit from other libfmt
features like named arguments etc.
Obviously we would need a temporary workaround for those cases where the EnumToInt()
hack applies.
I've thought about this, I'm not sure yet though if we should just add a try/catch block here to catch any invalid formatting or not.
I'll take a look to see when libfmt started supporting enums and see if we can bump/drop the workaround. |
I'm not really sure why the tests are failing here. I quick look over doesn't reveal anything obvious. |
@lrusak: The problem is located here: https://github.com/xbmc/xbmc/blob/master/xbmc/utils/HttpRangeUtils.cpp#L25. Your regex missed this formatting pattern (because it's not very obvious). Changing that line to use I also found https://github.com/xbmc/xbmc/blob/master/xbmc/events/BaseEvent.cpp#L106 by grepping for |
055bea3
to
6d31448
Compare
@Montellese thanks for the hints! |
Should we merge this as is? I think the next step would be to remove |
For me this is good to go. |
how would we catch exceptions caused by malformed strings of any kind when |
@lrusak this is causing some issues, most notably the 'recently added movies' / 'recently added episodes' disappeared from Estuary's home screen. Also the file naming of screenshots is broken.. before: after: |
Line 716 in 68bf07e
Would be where the screenshot stuff is going wrong. Filecache stuff looks like it'll be affected as well |
related errors from the log
|
Beware that all SQL queries must use |
Needless to say that the music smart playlists are also broken by this change too. |
This cleans ups the
StringUtils::Format
method now that all the format strings are updated to the new style.Removing the sprintf method makes it so that old sprintf formatting won't work anymore! Be aware!