mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2024-12-29 13:56:00 +01:00
Mark functions as const
This commit is contained in:
parent
531ee53b1a
commit
324d88100d
4 changed files with 20 additions and 20 deletions
|
@ -144,7 +144,7 @@ zathura_document_open(zathura_t* zathura, const char* path, const char* uri,
|
||||||
file = NULL;
|
file = NULL;
|
||||||
|
|
||||||
/* open document */
|
/* open document */
|
||||||
zathura_plugin_functions_t* functions = zathura_plugin_get_functions(plugin);
|
const zathura_plugin_functions_t* functions = zathura_plugin_get_functions(plugin);
|
||||||
if (functions->document_open == NULL) {
|
if (functions->document_open == NULL) {
|
||||||
girara_error("plugin has no open function\n");
|
girara_error("plugin has no open function\n");
|
||||||
goto error_free;
|
goto error_free;
|
||||||
|
@ -221,7 +221,7 @@ zathura_document_free(zathura_document_t* document)
|
||||||
|
|
||||||
/* free document */
|
/* free document */
|
||||||
zathura_error_t error = ZATHURA_ERROR_OK;
|
zathura_error_t error = ZATHURA_ERROR_OK;
|
||||||
zathura_plugin_functions_t* functions = zathura_plugin_get_functions(document->plugin);
|
const zathura_plugin_functions_t* functions = zathura_plugin_get_functions(document->plugin);
|
||||||
if (functions->document_free == NULL) {
|
if (functions->document_free == NULL) {
|
||||||
error = ZATHURA_ERROR_NOT_IMPLEMENTED;
|
error = ZATHURA_ERROR_NOT_IMPLEMENTED;
|
||||||
} else {
|
} else {
|
||||||
|
@ -619,7 +619,7 @@ zathura_document_save_as(zathura_document_t* document, const char* path)
|
||||||
return ZATHURA_ERROR_UNKNOWN;
|
return ZATHURA_ERROR_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
zathura_plugin_functions_t* functions = zathura_plugin_get_functions(document->plugin);
|
const zathura_plugin_functions_t* functions = zathura_plugin_get_functions(document->plugin);
|
||||||
if (functions->document_save_as == NULL) {
|
if (functions->document_save_as == NULL) {
|
||||||
return ZATHURA_ERROR_NOT_IMPLEMENTED;
|
return ZATHURA_ERROR_NOT_IMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
@ -635,7 +635,7 @@ zathura_document_index_generate(zathura_document_t* document, zathura_error_t* e
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
zathura_plugin_functions_t* functions = zathura_plugin_get_functions(document->plugin);
|
const zathura_plugin_functions_t* functions = zathura_plugin_get_functions(document->plugin);
|
||||||
if (functions->document_index_generate == NULL) {
|
if (functions->document_index_generate == NULL) {
|
||||||
check_set_error(error, ZATHURA_ERROR_NOT_IMPLEMENTED);
|
check_set_error(error, ZATHURA_ERROR_NOT_IMPLEMENTED);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -652,7 +652,7 @@ zathura_document_attachments_get(zathura_document_t* document, zathura_error_t*
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
zathura_plugin_functions_t* functions = zathura_plugin_get_functions(document->plugin);
|
const zathura_plugin_functions_t* functions = zathura_plugin_get_functions(document->plugin);
|
||||||
if (functions->document_attachments_get == NULL) {
|
if (functions->document_attachments_get == NULL) {
|
||||||
check_set_error(error, ZATHURA_ERROR_NOT_IMPLEMENTED);
|
check_set_error(error, ZATHURA_ERROR_NOT_IMPLEMENTED);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -668,7 +668,7 @@ zathura_document_attachment_save(zathura_document_t* document, const char* attac
|
||||||
return ZATHURA_ERROR_INVALID_ARGUMENTS;
|
return ZATHURA_ERROR_INVALID_ARGUMENTS;
|
||||||
}
|
}
|
||||||
|
|
||||||
zathura_plugin_functions_t* functions = zathura_plugin_get_functions(document->plugin);
|
const zathura_plugin_functions_t* functions = zathura_plugin_get_functions(document->plugin);
|
||||||
if (functions->document_attachment_save == NULL) {
|
if (functions->document_attachment_save == NULL) {
|
||||||
return ZATHURA_ERROR_NOT_IMPLEMENTED;
|
return ZATHURA_ERROR_NOT_IMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
@ -684,7 +684,7 @@ zathura_document_get_information(zathura_document_t* document, zathura_error_t*
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
zathura_plugin_functions_t* functions = zathura_plugin_get_functions(document->plugin);
|
const zathura_plugin_functions_t* functions = zathura_plugin_get_functions(document->plugin);
|
||||||
if (functions->document_get_information == NULL) {
|
if (functions->document_get_information == NULL) {
|
||||||
check_set_error(error, ZATHURA_ERROR_NOT_IMPLEMENTED);
|
check_set_error(error, ZATHURA_ERROR_NOT_IMPLEMENTED);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -45,7 +45,7 @@ zathura_page_new(zathura_document_t* document, unsigned int index, zathura_error
|
||||||
|
|
||||||
/* init plugin */
|
/* init plugin */
|
||||||
zathura_plugin_t* plugin = zathura_document_get_plugin(document);
|
zathura_plugin_t* plugin = zathura_document_get_plugin(document);
|
||||||
zathura_plugin_functions_t* functions = zathura_plugin_get_functions(plugin);
|
const zathura_plugin_functions_t* functions = zathura_plugin_get_functions(plugin);
|
||||||
|
|
||||||
if (functions->page_init == NULL) {
|
if (functions->page_init == NULL) {
|
||||||
if (error != NULL) {
|
if (error != NULL) {
|
||||||
|
@ -88,7 +88,7 @@ zathura_page_free(zathura_page_t* page)
|
||||||
}
|
}
|
||||||
|
|
||||||
zathura_plugin_t* plugin = zathura_document_get_plugin(page->document);
|
zathura_plugin_t* plugin = zathura_document_get_plugin(page->document);
|
||||||
zathura_plugin_functions_t* functions = zathura_plugin_get_functions(plugin);
|
const zathura_plugin_functions_t* functions = zathura_plugin_get_functions(plugin);
|
||||||
if (functions->page_clear == NULL) {
|
if (functions->page_clear == NULL) {
|
||||||
return ZATHURA_ERROR_NOT_IMPLEMENTED;
|
return ZATHURA_ERROR_NOT_IMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
@ -211,7 +211,7 @@ zathura_page_search_text(zathura_page_t* page, const char* text, zathura_error_t
|
||||||
}
|
}
|
||||||
|
|
||||||
zathura_plugin_t* plugin = zathura_document_get_plugin(page->document);
|
zathura_plugin_t* plugin = zathura_document_get_plugin(page->document);
|
||||||
zathura_plugin_functions_t* functions = zathura_plugin_get_functions(plugin);
|
const zathura_plugin_functions_t* functions = zathura_plugin_get_functions(plugin);
|
||||||
if (functions->page_search_text == NULL) {
|
if (functions->page_search_text == NULL) {
|
||||||
if (error != NULL) {
|
if (error != NULL) {
|
||||||
*error = ZATHURA_ERROR_NOT_IMPLEMENTED;
|
*error = ZATHURA_ERROR_NOT_IMPLEMENTED;
|
||||||
|
@ -233,7 +233,7 @@ zathura_page_links_get(zathura_page_t* page, zathura_error_t* error)
|
||||||
}
|
}
|
||||||
|
|
||||||
zathura_plugin_t* plugin = zathura_document_get_plugin(page->document);
|
zathura_plugin_t* plugin = zathura_document_get_plugin(page->document);
|
||||||
zathura_plugin_functions_t* functions = zathura_plugin_get_functions(plugin);
|
const zathura_plugin_functions_t* functions = zathura_plugin_get_functions(plugin);
|
||||||
if (functions->page_links_get == NULL) {
|
if (functions->page_links_get == NULL) {
|
||||||
if (error != NULL) {
|
if (error != NULL) {
|
||||||
*error = ZATHURA_ERROR_NOT_IMPLEMENTED;
|
*error = ZATHURA_ERROR_NOT_IMPLEMENTED;
|
||||||
|
@ -261,7 +261,7 @@ zathura_page_form_fields_get(zathura_page_t* page, zathura_error_t* error)
|
||||||
}
|
}
|
||||||
|
|
||||||
zathura_plugin_t* plugin = zathura_document_get_plugin(page->document);
|
zathura_plugin_t* plugin = zathura_document_get_plugin(page->document);
|
||||||
zathura_plugin_functions_t* functions = zathura_plugin_get_functions(plugin);
|
const zathura_plugin_functions_t* functions = zathura_plugin_get_functions(plugin);
|
||||||
if (functions->page_form_fields_get == NULL) {
|
if (functions->page_form_fields_get == NULL) {
|
||||||
if (error != NULL) {
|
if (error != NULL) {
|
||||||
*error = ZATHURA_ERROR_NOT_IMPLEMENTED;
|
*error = ZATHURA_ERROR_NOT_IMPLEMENTED;
|
||||||
|
@ -289,7 +289,7 @@ zathura_page_images_get(zathura_page_t* page, zathura_error_t* error)
|
||||||
}
|
}
|
||||||
|
|
||||||
zathura_plugin_t* plugin = zathura_document_get_plugin(page->document);
|
zathura_plugin_t* plugin = zathura_document_get_plugin(page->document);
|
||||||
zathura_plugin_functions_t* functions = zathura_plugin_get_functions(plugin);
|
const zathura_plugin_functions_t* functions = zathura_plugin_get_functions(plugin);
|
||||||
if (functions->page_images_get == NULL) {
|
if (functions->page_images_get == NULL) {
|
||||||
if (error != NULL) {
|
if (error != NULL) {
|
||||||
*error = ZATHURA_ERROR_NOT_IMPLEMENTED;
|
*error = ZATHURA_ERROR_NOT_IMPLEMENTED;
|
||||||
|
@ -311,7 +311,7 @@ zathura_page_image_get_cairo(zathura_page_t* page, zathura_image_t* image, zathu
|
||||||
}
|
}
|
||||||
|
|
||||||
zathura_plugin_t* plugin = zathura_document_get_plugin(page->document);
|
zathura_plugin_t* plugin = zathura_document_get_plugin(page->document);
|
||||||
zathura_plugin_functions_t* functions = zathura_plugin_get_functions(plugin);
|
const zathura_plugin_functions_t* functions = zathura_plugin_get_functions(plugin);
|
||||||
if (functions->page_image_get_cairo == NULL) {
|
if (functions->page_image_get_cairo == NULL) {
|
||||||
if (error != NULL) {
|
if (error != NULL) {
|
||||||
*error = ZATHURA_ERROR_NOT_IMPLEMENTED;
|
*error = ZATHURA_ERROR_NOT_IMPLEMENTED;
|
||||||
|
@ -333,7 +333,7 @@ zathura_page_get_text(zathura_page_t* page, zathura_rectangle_t rectangle, zathu
|
||||||
}
|
}
|
||||||
|
|
||||||
zathura_plugin_t* plugin = zathura_document_get_plugin(page->document);
|
zathura_plugin_t* plugin = zathura_document_get_plugin(page->document);
|
||||||
zathura_plugin_functions_t* functions = zathura_plugin_get_functions(plugin);
|
const zathura_plugin_functions_t* functions = zathura_plugin_get_functions(plugin);
|
||||||
if (functions->page_get_text == NULL) {
|
if (functions->page_get_text == NULL) {
|
||||||
if (error) {
|
if (error) {
|
||||||
*error = ZATHURA_ERROR_NOT_IMPLEMENTED;
|
*error = ZATHURA_ERROR_NOT_IMPLEMENTED;
|
||||||
|
@ -352,7 +352,7 @@ zathura_page_render(zathura_page_t* page, cairo_t* cairo, bool printing)
|
||||||
}
|
}
|
||||||
|
|
||||||
zathura_plugin_t* plugin = zathura_document_get_plugin(page->document);
|
zathura_plugin_t* plugin = zathura_document_get_plugin(page->document);
|
||||||
zathura_plugin_functions_t* functions = zathura_plugin_get_functions(plugin);
|
const zathura_plugin_functions_t* functions = zathura_plugin_get_functions(plugin);
|
||||||
if (functions->page_render_cairo == NULL) {
|
if (functions->page_render_cairo == NULL) {
|
||||||
return ZATHURA_ERROR_NOT_IMPLEMENTED;
|
return ZATHURA_ERROR_NOT_IMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
@ -371,7 +371,7 @@ zathura_page_get_label(zathura_page_t* page, zathura_error_t* error)
|
||||||
}
|
}
|
||||||
|
|
||||||
zathura_plugin_t* plugin = zathura_document_get_plugin(page->document);
|
zathura_plugin_t* plugin = zathura_document_get_plugin(page->document);
|
||||||
zathura_plugin_functions_t* functions = zathura_plugin_get_functions(plugin);
|
const zathura_plugin_functions_t* functions = zathura_plugin_get_functions(plugin);
|
||||||
if (functions->page_get_label == NULL) {
|
if (functions->page_get_label == NULL) {
|
||||||
if (error) {
|
if (error) {
|
||||||
*error = ZATHURA_ERROR_NOT_IMPLEMENTED;
|
*error = ZATHURA_ERROR_NOT_IMPLEMENTED;
|
||||||
|
|
|
@ -343,11 +343,11 @@ plugin_add_mimetype(zathura_plugin_t* plugin, const char* mime_type)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
zathura_plugin_functions_t*
|
const zathura_plugin_functions_t*
|
||||||
zathura_plugin_get_functions(zathura_plugin_t* plugin)
|
zathura_plugin_get_functions(zathura_plugin_t* plugin)
|
||||||
{
|
{
|
||||||
if (plugin != NULL) {
|
if (plugin != NULL) {
|
||||||
return &(plugin->functions);
|
return &plugin->functions;
|
||||||
} else {
|
} else {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,7 @@ girara_list_t* zathura_plugin_manager_get_plugins(zathura_plugin_manager_t* plug
|
||||||
* @param plugin The plugin
|
* @param plugin The plugin
|
||||||
* @return The plugin functions
|
* @return The plugin functions
|
||||||
*/
|
*/
|
||||||
zathura_plugin_functions_t* zathura_plugin_get_functions(zathura_plugin_t* plugin);
|
const zathura_plugin_functions_t* zathura_plugin_get_functions(zathura_plugin_t* plugin);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the name of the plugin
|
* Returns the name of the plugin
|
||||||
|
|
Loading…
Reference in a new issue