[totem] Explicitly add NULL to end of generated lists
- From: Sebastian Polsterl <sebp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [totem] Explicitly add NULL to end of generated lists
- Date: Mon, 6 Feb 2012 17:45:28 +0000 (UTC)
commit 331346d651e0cb9ff0464232f2f1c7aded94b606
Author: Sebastian PÃlsterl <sebp k-d-w org>
Date: Sun Feb 5 13:36:25 2012 +0100
Explicitly add NULL to end of generated lists
Don't use G_N_ELEMENTS for NULL terminated arrays
https://bugzilla.gnome.org/show_bug.cgi?id=662919
data/mime-type-include.sh | 4 ++++
data/uri-scheme-include.sh | 1 +
src/totem-audio-preview.c | 2 +-
src/totem-properties-main.c | 2 +-
src/totem-uri.c | 6 +++---
5 files changed, 10 insertions(+), 5 deletions(-)
---
diff --git a/data/mime-type-include.sh b/data/mime-type-include.sh
index e03c2a1..f1fc104 100755
--- a/data/mime-type-include.sh
+++ b/data/mime-type-include.sh
@@ -17,6 +17,7 @@ if [ x"$1" = "x--nautilus" ] ; then
echo_mime;
done
+ echo "NULL"
echo "};"
exit 0
@@ -31,6 +32,7 @@ for i in $MIMETYPES ; do
echo_mime;
done
+echo "NULL"
echo "};"
get_audio_mimetypes $1;
@@ -40,6 +42,7 @@ for i in $MIMETYPES ; do
echo_mime;
done
+echo "NULL"
echo "};"
get_video_mimetypes $1;
@@ -49,5 +52,6 @@ for i in $MIMETYPES ; do
echo_mime;
done
+echo "NULL"
echo "};"
diff --git a/data/uri-scheme-include.sh b/data/uri-scheme-include.sh
index 645b139..6902a3a 100755
--- a/data/uri-scheme-include.sh
+++ b/data/uri-scheme-include.sh
@@ -15,4 +15,5 @@ for i in $SCHEMES ; do
echo_mime;
done
+echo "NULL"
echo "};"
diff --git a/src/totem-audio-preview.c b/src/totem-audio-preview.c
index 722d67e..6d5e98c 100644
--- a/src/totem-audio-preview.c
+++ b/src/totem-audio-preview.c
@@ -50,7 +50,7 @@ print_mimetypes (void)
{
guint i;
- for (i =0; i < G_N_ELEMENTS (audio_mime_types); i++) {
+ for (i =0; audio_mime_types[i] != NULL; i++) {
g_print ("%s\n", audio_mime_types[i]);
}
}
diff --git a/src/totem-properties-main.c b/src/totem-properties-main.c
index 560484f..c73535a 100644
--- a/src/totem-properties-main.c
+++ b/src/totem-properties-main.c
@@ -95,7 +95,7 @@ totem_properties_get_pages (NautilusPropertyPageProvider *provider,
file = files->data;
/* only add the properties page to these mime types */
- for (i = 0; i < G_N_ELEMENTS (mime_types); i++)
+ for (i = 0; mime_types[i] != NULL; i++)
{
if (nautilus_file_info_is_mime_type (file, mime_types[i]))
{
diff --git a/src/totem-uri.c b/src/totem-uri.c
index e484ff7..2c93b52 100644
--- a/src/totem-uri.c
+++ b/src/totem-uri.c
@@ -509,7 +509,7 @@ totem_setup_file_filters (void)
filter_supported = gtk_file_filter_new ();
gtk_file_filter_set_name (filter_supported, _("Supported files"));
- for (i = 0; i < G_N_ELEMENTS (mime_types); i++) {
+ for (i = 0; mime_types[i] != NULL; i++) {
gtk_file_filter_add_mime_type (filter_supported, mime_types[i]);
}
@@ -521,7 +521,7 @@ totem_setup_file_filters (void)
/* Audio files */
filter_audio = gtk_file_filter_new ();
gtk_file_filter_set_name (filter_audio, _("Audio files"));
- for (i = 0; i < G_N_ELEMENTS (audio_mime_types); i++) {
+ for (i = 0; audio_mime_types[i] != NULL; i++) {
gtk_file_filter_add_mime_type (filter_audio, audio_mime_types[i]);
}
g_object_ref_sink (filter_audio);
@@ -529,7 +529,7 @@ totem_setup_file_filters (void)
/* Video files */
filter_video = gtk_file_filter_new ();
gtk_file_filter_set_name (filter_video, _("Video files"));
- for (i = 0; i < G_N_ELEMENTS (video_mime_types); i++) {
+ for (i = 0; video_mime_types[i] != NULL; i++) {
gtk_file_filter_add_mime_type (filter_video, video_mime_types[i]);
}
gtk_file_filter_add_mime_type (filter_video, "application/x-cd-image");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]