summaryrefslogtreecommitdiffstats
path: root/apps/plugins/imageviewer/imageviewer.h
diff options
context:
space:
mode:
authorAidan MacDonald <amachronic@protonmail.com>2023-03-14 12:19:48 +0000
committerAidan MacDonald <amachronic@protonmail.com>2023-03-21 16:23:54 -0400
commitd40a598970b04bfe3a867a5e12debc45c149b46b (patch)
tree26e974f910f7d3047adfbc536d8e10c2d973b7e9 /apps/plugins/imageviewer/imageviewer.h
parent2fb2364686e5470437f0ee3d214662d51067eb90 (diff)
downloadrockbox-d40a598970.tar.gz
rockbox-d40a598970.zip
plugins: Simplify plugin/codec API versioning
Replace the minimum version bound with a check on the size of the API struct. The version only needs to be incremented for ABI breaking changes. Additions to the API won't need to touch the version number, resulting in fewer merge conflicts. Change-Id: I916a04a7bf5890dcf5d615ce30087643165f8e1f
Diffstat (limited to 'apps/plugins/imageviewer/imageviewer.h')
-rw-r--r--apps/plugins/imageviewer/imageviewer.h14
1 files changed, 10 insertions, 4 deletions
diff --git a/apps/plugins/imageviewer/imageviewer.h b/apps/plugins/imageviewer/imageviewer.h
index 19b5db15bb..ac15df5960 100644
--- a/apps/plugins/imageviewer/imageviewer.h
+++ b/apps/plugins/imageviewer/imageviewer.h
@@ -136,14 +136,17 @@ struct image_decoder {
int x, int y, int width, int height);
};
-#define IMGDEC_API_VERSION (PLUGIN_API_VERSION << 4 | 0)
+#define IMGDEC_API_VERSION 1
/* image decoder header */
struct imgdec_header {
struct lc_header lc_hdr; /* must be the first */
const struct image_decoder *decoder;
const struct plugin_api **api;
+ unsigned short plugin_api_version;
+ size_t plugin_api_size;
const struct imgdec_api **img_api;
+ size_t img_api_size;
};
#ifdef IMGDEC
@@ -157,15 +160,18 @@ extern const struct image_decoder image_decoder;
const struct imgdec_header __header \
__attribute__ ((section (".header")))= { \
{ PLUGIN_MAGIC, TARGET_ID, IMGDEC_API_VERSION, \
- plugin_start_addr, plugin_end_addr }, &image_decoder, &rb, &iv };
+ plugin_start_addr, plugin_end_addr, }, &image_decoder, \
+ &rb, PLUGIN_API_VERSION, sizeof(struct plugin_api), \
+ &iv, sizeof(struct imgdec_api) };
#else /* PLATFORM_HOSTED */
#define IMGDEC_HEADER \
const struct plugin_api *rb DATA_ATTR; \
const struct imgdec_api *iv DATA_ATTR; \
const struct imgdec_header __header \
__attribute__((visibility("default"))) = { \
- { PLUGIN_MAGIC, TARGET_ID, IMGDEC_API_VERSION, \
- NULL, NULL }, &image_decoder, &rb, &iv };
+ { PLUGIN_MAGIC, TARGET_ID, IMGDEC_API_VERSION, NULL, NULL }, \
+ &image_decoder, &rb, PLUGIN_API_VERSION, sizeof(struct plugin_api), \
+ &iv, sizeof(struct imgdec_api), };
#endif /* CONFIG_PLATFORM */
#endif