Commit 31cbc7e0 authored by Jehan's avatar Jehan

plug-ins: clean all warnings on metadata plug-in.

I made the various static arrays in headers declared as extern and
defined in a separate implementation file, with additional size constant
when necessary (since G_N_ELEMENTS() cannot be used on partially
defined arrays).

Note that this is better than the original implementation, yet I am not
saying this is ideal either. I am not fond of such code organization and
think a better one could be done. But it would require to dive deeper
into this plug-in and I don't want to right now, nor have the time.

At least now it stopped shouting all these warnings!
parent 024a919c
......@@ -34,6 +34,7 @@ metadata_editor_SOURCES = \
metadata-impexp.c \
metadata-impexp.h \
metadata-misc.h \
metadata-tags.c \
metadata-tags.h \
metadata-xml.c \
metadata-xml.h
......
......@@ -1526,7 +1526,7 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata,
gchar *value;
gint i;
gint32 numele = G_N_ELEMENTS (default_metadata_tags);
gint32 numele = n_default_metadata_tags;
/* Setup Buttons */
button_widget = builder_get_widget (builder, "add_licensor_button");
......@@ -3091,11 +3091,11 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata,
counter = count_tags (metadata, LICENSOR_HEADER,
licensor,
G_N_ELEMENTS (licensor));
n_licensor);
get_tags (metadata, LICENSOR_HEADER,
licensor,
G_N_ELEMENTS (licensor), counter);
n_licensor, counter);
phonestore = gtk_list_store_new (1, G_TYPE_STRING);
gtk_list_store_append (phonestore, &phoneiter);
......@@ -3363,11 +3363,11 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata,
counter = count_tags (metadata, COPYRIGHTOWNER_HEADER,
copyrightowner,
G_N_ELEMENTS (copyrightowner));
n_copyrightowner);
get_tags (metadata, COPYRIGHTOWNER_HEADER,
copyrightowner,
G_N_ELEMENTS (copyrightowner), counter);
n_copyrightowner, counter);
treemodel = gtk_tree_view_get_model (GTK_TREE_VIEW (widget));
liststore = GTK_LIST_STORE (treemodel);
......@@ -3455,11 +3455,11 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata,
counter = count_tags (metadata, IMAGECREATOR_HEADER,
imagecreator,
G_N_ELEMENTS (imagecreator));
n_imagecreator);
get_tags (metadata, IMAGECREATOR_HEADER,
imagecreator,
G_N_ELEMENTS (imagecreator), counter);
n_imagecreator, counter);
treemodel = gtk_tree_view_get_model (GTK_TREE_VIEW (widget));
liststore = GTK_LIST_STORE (treemodel);
......@@ -3547,11 +3547,11 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata,
counter = count_tags (metadata, ARTWORKOROBJECT_HEADER,
artworkorobject,
G_N_ELEMENTS (artworkorobject));
n_artworkorobject);
get_tags (metadata, ARTWORKOROBJECT_HEADER,
artworkorobject,
G_N_ELEMENTS (artworkorobject), counter);
n_artworkorobject, counter);
treemodel = gtk_tree_view_get_model (GTK_TREE_VIEW (widget));
liststore = GTK_LIST_STORE (treemodel);
......@@ -3750,11 +3750,11 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata,
counter = count_tags (metadata, REGISTRYID_HEADER,
registryid,
G_N_ELEMENTS (registryid));
n_registryid);
get_tags (metadata, REGISTRYID_HEADER,
registryid,
G_N_ELEMENTS (registryid), counter);
n_registryid, counter);
treemodel = gtk_tree_view_get_model (GTK_TREE_VIEW (widget));
liststore = GTK_LIST_STORE (treemodel);
......@@ -3842,11 +3842,11 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata,
counter = count_tags (metadata, LOCATIONSHOWN_HEADER,
locationshown,
G_N_ELEMENTS (locationshown));
n_locationshown);
get_tags (metadata, LOCATIONSHOWN_HEADER,
locationshown,
G_N_ELEMENTS (locationshown), counter);
n_locationshown, counter);
treemodel = gtk_tree_view_get_model (GTK_TREE_VIEW (widget));
liststore = GTK_LIST_STORE (treemodel);
......@@ -4518,7 +4518,7 @@ metadata_editor_write_callback (GtkWidget *dialog,
{
gint item;
for (item = 0; item < G_N_ELEMENTS (locationshown); item++)
for (item = 0; item < n_locationshown; item++)
{
g_snprintf (tag, sizeof (tag), "%s[%d]%s",
LOCATIONSHOWN_HEADER, row, locationshown[item]);
......@@ -4620,7 +4620,7 @@ metadata_editor_write_callback (GtkWidget *dialog,
{
gint item;
for (item = 0; item < G_N_ELEMENTS (artworkorobject); item++)
for (item = 0; item < n_artworkorobject; item++)
{
g_snprintf (tag, sizeof (tag), "%s[%d]%s",
ARTWORKOROBJECT_HEADER, row, artworkorobject[item]);
......@@ -4724,7 +4724,7 @@ metadata_editor_write_callback (GtkWidget *dialog,
{
gint item;
for (item = 0; item < G_N_ELEMENTS (registryid); item++)
for (item = 0; item < n_registryid; item++)
{
g_snprintf (tag, sizeof (tag), "%s[%d]%s",
REGISTRYID_HEADER, row, registryid[item]);
......@@ -4788,7 +4788,7 @@ metadata_editor_write_callback (GtkWidget *dialog,
{
gint item;
for (item = 0; item < G_N_ELEMENTS (imagecreator); item++)
for (item = 0; item < n_imagecreator; item++)
{
g_snprintf (tag, sizeof (tag), "%s[%d]%s",
IMAGECREATOR_HEADER, row, imagecreator[item]);
......@@ -4852,7 +4852,7 @@ metadata_editor_write_callback (GtkWidget *dialog,
{
gint item;
for (item = 0; item < G_N_ELEMENTS (copyrightowner); item++)
for (item = 0; item < n_copyrightowner; item++)
{
g_snprintf (tag, sizeof (tag), "%s[%d]%s",
COPYRIGHTOWNER_HEADER, row, copyrightowner[item]);
......@@ -4916,7 +4916,7 @@ metadata_editor_write_callback (GtkWidget *dialog,
{
gint item;
for (item = 0; item < G_N_ELEMENTS (licensor); item++)
for (item = 0; item < n_licensor; item++)
{
g_snprintf (tag, sizeof (tag), "%s[%d]%s",
LICENSOR_HEADER, row, licensor[item]);
......@@ -5123,7 +5123,7 @@ metadata_editor_write_callback (GtkWidget *dialog,
}
}
max_elements = G_N_ELEMENTS (default_metadata_tags);
max_elements = n_default_metadata_tags;
for (i = 0; i < max_elements; i++)
{
......
......@@ -119,7 +119,7 @@ export_file_metadata (metadata_editor *args)
"<gimp-metadata>\n", NULL);
/* HANDLE IPTC */
for (i = 0; i < G_N_ELEMENTS (equivalent_metadata_tags); i++)
for (i = 0; i < n_equivalent_metadata_tags; i++)
{
int index = equivalent_metadata_tags[i].other_tag_index;
xmldata = g_strconcat (xmldata, "\t<iptc-tag>\n", NULL);
......@@ -165,7 +165,7 @@ export_file_metadata (metadata_editor *args)
}
/* HANDLE XMP */
for (i = 0; i < G_N_ELEMENTS (default_metadata_tags); i++)
for (i = 0; i < n_default_metadata_tags; i++)
{
xmldata = g_strconcat (xmldata, "\t<xmp-tag>\n", NULL);
xmldata = g_strconcat (xmldata, "\t\t<tag-name>", NULL);
......
This diff is collapsed.
This diff is collapsed.
......@@ -236,7 +236,7 @@ set_tag_ui (metadata_editor *args,
COL_LICENSOR_EMAIL, list_tag_data[row][7],
COL_LICENSOR_WEB, list_tag_data[row][8],
-1);
for (item = 1; item < G_N_ELEMENTS (licensor) + 1; item++)
for (item = 1; item < n_licensor + 1; item++)
{
if (list_tag_data[row][item])
{
......@@ -273,7 +273,7 @@ set_tag_ui (metadata_editor *args,
COL_IMG_CR8_NAME, list_tag_data[row][1],
COL_IMG_CR8_ID, list_tag_data[row][2],
-1);
for (item = 1; item < G_N_ELEMENTS (imagecreator) + 1; item++)
for (item = 1; item < n_imagecreator + 1; item++)
{
if (list_tag_data[row][item])
{
......@@ -308,7 +308,7 @@ set_tag_ui (metadata_editor *args,
COL_AOO_SRC_INV_ID, list_tag_data[row][5],
COL_AOO_CR_NOT, list_tag_data[row][6],
-1);
for (item = 1; item < G_N_ELEMENTS (artworkorobject) + 1; item++)
for (item = 1; item < n_artworkorobject + 1; item++)
{
if (list_tag_data[row][item])
{
......@@ -343,7 +343,7 @@ set_tag_ui (metadata_editor *args,
COL_REGSITRY_ORG_ID, list_tag_data[row][1],
COL_REGSITRY_ITEM_ID, list_tag_data[row][2],
-1);
for (item = 1; item < G_N_ELEMENTS (registryid) + 1; item++)
for (item = 1; item < n_registryid + 1; item++)
{
if (list_tag_data[row][item])
{
......@@ -376,7 +376,7 @@ set_tag_ui (metadata_editor *args,
COL_CR_OWNER_NAME, list_tag_data[row][1],
COL_CR_OWNER_ID, list_tag_data[row][2],
-1);
for (item = 1; item < G_N_ELEMENTS (copyrightowner) + 1; item++)
for (item = 1; item < n_copyrightowner + 1; item++)
{
if (list_tag_data[row][item])
{
......@@ -412,7 +412,7 @@ set_tag_ui (metadata_editor *args,
COL_LOC_SHO_CNTRY_ISO, list_tag_data[row][5],
COL_LOC_SHO_CNTRY_WRLD_REG, list_tag_data[row][6],
-1);
for (item = 1; item < G_N_ELEMENTS (locationshown) + 1; item++)
for (item = 1; item < n_locationshown + 1; item++)
{
if (list_tag_data[row][item])
{
......@@ -892,7 +892,7 @@ xml_parser_end_element (GMarkupParseContext *context,
if (str_tag_name && str_tag_value)
{
/* make sure to only allow supported tags */
for (i = 0; i < G_N_ELEMENTS (equivalent_metadata_tags); i++)
for (i = 0; i < n_equivalent_metadata_tags; i++)
{
if (strcmp(equivalent_metadata_tags[i].tag, str_tag_name) == 0)
{
......@@ -918,7 +918,7 @@ xml_parser_end_element (GMarkupParseContext *context,
if (str_tag_name && str_tag_value)
{
/* make sure to only allow supported tags */
for (i = 0; i < G_N_ELEMENTS (default_metadata_tags); i++)
for (i = 0; i < n_default_metadata_tags; i++)
{
if (strcmp(default_metadata_tags[i].tag, str_tag_name) == 0)
{
......@@ -941,7 +941,7 @@ xml_parser_end_element (GMarkupParseContext *context,
if (row_count > 0)
{
/* make sure to only allow supported tags */
for (i = 0; i < G_N_ELEMENTS (default_metadata_tags); i++)
for (i = 0; i < n_default_metadata_tags; i++)
{
if (strcmp(default_metadata_tags[i].tag, str_tag_name) == 0)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment