[Pkg-wmaker-commits] [wmstickynotes] 57/81: debian/patches/fix_-Wunused-result.patch: Fix compiler warnings.
Doug Torrance
dtorrance-guest at moszumanska.debian.org
Tue Aug 25 02:33:51 UTC 2015
This is an automated email from the git hooks/post-receive script.
dtorrance-guest pushed a commit to branch master
in repository wmstickynotes.
commit c98b06465c1f08994a3a635f3c8e69e6755d06b5
Author: Doug Torrance <dtorrance at monmouthcollege.edu>
Date: Wed Jan 28 08:22:50 2015 -0600
debian/patches/fix_-Wunused-result.patch: Fix compiler warnings.
---
debian/patches/fix_-Wunused-result.patch | 29 +++++++++++++++++++++++++++++
debian/patches/series | 1 +
2 files changed, 30 insertions(+)
diff --git a/debian/patches/fix_-Wunused-result.patch b/debian/patches/fix_-Wunused-result.patch
new file mode 100644
index 0000000..99e2d28
--- /dev/null
+++ b/debian/patches/fix_-Wunused-result.patch
@@ -0,0 +1,29 @@
+Description: Fix -Wunused-result compiler warnings.
+ In particular, print warning messages if we fail to parse note files.
+Author: Doug Torrance <dtorrance at monmouthcollege.edu>
+Last-Update: 2015-01-28
+
+--- a/wmstickynotes.c
++++ b/wmstickynotes.c
+@@ -412,12 +412,18 @@
+ note->id = atoi(entry->d_name);
+ if(note->id > highest_note_id) highest_note_id = note->id;
+
+- fscanf(file, "%d,%d,%d,%d,%d,%d,",
++ if (fscanf(file, "%d,%d,%d,%d,%d,%d,",
+ &(note->x), &(note->y), &(note->width), &(note->height),
+- &reserved1, &reserved2);
++ &reserved1, &reserved2) < 6) {
++ fprintf(stderr, "Failed to parse note %s: too few values", entry->d_name);
++ continue;
++ }
+
+ /* Get color name */
+- fgets(buffer, 256, file);
++ if (fgets(buffer, 256, file) == NULL) {
++ fprintf(stderr, "Failed to parse note %s: no color", entry->d_name);
++ continue;
++ }
+ /* Replace the newline with a null char */
+ buffer[strlen(buffer) - 1] = '\0';
+
diff --git a/debian/patches/series b/debian/patches/series
index cbbdbd5..700ce64 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,2 @@
fix_icon_size.patch
+fix_-Wunused-result.patch
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-wmaker/wmstickynotes.git
More information about the Pkg-wmaker-commits
mailing list