-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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
[addons][vfs] cleanup, "C" interface fix, documentation rework #17527
Conversation
KodiToAddonFuncTable_VFSEntry toAddon; | ||
AddonProps_VFSEntry* props; | ||
AddonToKodiFuncTable_VFSEntry* toKodi; | ||
KodiToAddonFuncTable_VFSEntry* toAddon; |
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.
what about std::unique ptrs?
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.
We can not use a C++ std::unique
in a "C" ABI, thats one of the main reason of this request.
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.
oh yea, didn't look at the location of this file.
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.
NP, thanks a lot for review!
xbmc/network/GUIDialogNetworkSetup.h
Outdated
@@ -24,6 +24,7 @@ class CGUIDialogNetworkSetup : public CGUIDialogSettingsManualBase | |||
int defaultPort; //!< Default port to use for protocol | |||
std::string type; //!< URL type for protocol | |||
int label; //!< String ID to use as label in dialog | |||
std::string addonId; //!< Addon identifier, leaved empty if inside Kodi |
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.
It's not evident to me, where is this used?
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.
Currently vfs addons are forced to take Kodi's own string id's (e.g. at vfs.sftp
https://github.com/xbmc/vfs.sftp/blob/Leia/vfs.sftp/addon.xml.in#L21) and the std::pair<int, int>
in settings this could not be identified.
This is then taken here https://github.com/xbmc/xbmc/pull/17527/files#diff-8211fa801621c92df9bf6515d2d45b8aR200 to give to replaced pair
with TranslatableIntegerSettingOption
his addon id.
EDIT: Without is the "My special secure VFS addon" not possible to give on GUI
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.
thanks for the explanation
Two comments, otherwise looks good |
This was before given to Kodi to have on his calls to addon. That basically not match a "C" ABI where the use of "C++" parts within "C" not allowed! With this it becomes given via "void*" to Kodi and with a "static_cast" changed back to required class on addon.
Added to separate "C" and "C++" part and further to allow a "C" only in future.
On this commit becomes them replaced to use independent enum and structures, to pass related data between Kodi and Addon. This prevents conflicts when using "C" and ensures a secure ABI interface. In addition, it is much safer in the event that the Kodi changes what in its headers. This can easily occur because previously it was not directly visible that IFileTypes.h was also used on addons. Only currently still used on libXBMC_addon.h and removed on PVR rework.
This done to prevent API backward problems if something becomes replaced e.g. on props or to kodi calls.
This changes the interface to pure "C" and no "C++" dependencies in it.
With this change the whole VFS documentation becomes reworked and to have usable on doxygen. There are much parts added to understand his usage.
If nothing against then I bring it in tommorow and then update of the addons. jenkins build this please |
[addons][vfs] cleanup, "C" interface fix, documentation rework
[addons][vfs] cleanup, "C" interface fix, documentation rework
[addons][vfs] cleanup, "C" interface fix, documentation rework
[addons][vfs] cleanup, "C" interface fix, documentation rework
[addons][vfs] cleanup, "C" interface fix, documentation rework
[addons][vfs] cleanup, "C" interface fix, documentation rework
[addons][vfs] cleanup, "C" interface fix, documentation rework
[addons][vfs] cleanup, "C" interface fix, documentation rework
[addons][vfs] cleanup, "C" interface fix, documentation rework
[addons][vfs] cleanup, "C" interface fix, documentation rework
[addons][vfs] cleanup, "C" interface fix, documentation rework
Description
This request revises the VFS addon interface. The changes in the addon itself are rather minor, since only the
CVFSEntry::IoControl
has been revised on the addon to avoid the Kodi-side header "IFileTypes.h" (this only corresponded to C++).This API change now translates the Kodi site to its own for addon, which makes this "C" ABI compatible and more importantly, safer in the event of changes to IFileTypes.h, which could inadvertently cause problems with addons.
Another API change is that the individual structures are now in their own arrays, so it is safer if a callback function or property is added. However, this does not require any code changes to addon and is fixed with a new creation.
The commit "[settings] allow TranslatableIntegerSettingOption to get string from" allows the addon itself a string ID to its network drive connection that can be created in Kodi's settings. This is independent and will still be moved in a own request.
There are also some clang code cleanups in it.
In addition, everything between Kodi and addon is now in pure "C".
Here is the new documention view available: http://alwinesch.github.io/group__cpp__kodi__addon__vfs.html
Motivation and Context
Related to #17514 and to become the documentation in future available for everything 😁
How Has This Been Tested?
Tested now on few addons, need to test more and comes next days, also is the API not so big that it becomes critical.
Screenshots (if appropriate):
Types of change
Checklist: