summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2012-12-28 18:30:02 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2012-12-28 18:30:02 -0800
commitfd983a0992b285963d6f91ea1c99abfa2d269f60 (patch)
tree7b0a8d0069f14befe1e6412518862e967e89752d
parent0233239198ee89559aeb5e2d8ee5194a05b18911 (diff)
downloadsubsurface-fd983a0992b285963d6f91ea1c99abfa2d269f60.tar.gz
Don't store notes that are just one space on the Uemis
Sometimes the Uemis appears to return " " as notes instead of no notes. This patch filters this out (otherwise redownloading divecomputers can cause silly things like notes that say "(existing note) or ( )" ) Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--uemis-downloader.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/uemis-downloader.c b/uemis-downloader.c
index 90f3d2317..465437aa6 100644
--- a/uemis-downloader.c
+++ b/uemis-downloader.c
@@ -109,7 +109,9 @@ static void uemis_get_index(char *buffer, int *idx)
/* space separated */
static void uemis_add_string(char *buffer, char **text)
{
- if (!buffer || !*buffer)
+ /* do nothing if this is an empty buffer (Uemis sometimes returns a single
+ * space for empty buffers) */
+ if (!buffer || !*buffer || (*buffer == ' ' && *(buffer + 1) == '\0'))
return;
if (!*text) {
*text = strdup(buffer);