From b36f185426be3ac0bfb942fa4a52528a8d70a61a Mon Sep 17 00:00:00 2001
From: Přemysl Eric Janouch
Date: Tue, 2 Nov 2021 16:57:18 +0100
Subject: Fix various macOS-related/found issues
Even though this software isn't very useful on that system either,
due to its lack of PRIMARY.
---
src/sdtui.c | 2 --
src/stardict.c | 14 +++++++-------
2 files changed, 7 insertions(+), 9 deletions(-)
(limited to 'src')
diff --git a/src/sdtui.c b/src/sdtui.c
index c9b88e6..8de59b2 100644
--- a/src/sdtui.c
+++ b/src/sdtui.c
@@ -37,9 +37,7 @@
#include // input
#include // output
#include
-#ifndef TIOCGWINSZ
#include
-#endif // ! TIOCGWINSZ
#include "config.h"
#include "stardict.h"
diff --git a/src/stardict.c b/src/stardict.c
index 8b55f99..cdd11a1 100644
--- a/src/stardict.c
+++ b/src/stardict.c
@@ -309,26 +309,24 @@ load_ifo (StardictInfo *sti, const gchar *path, GError **error)
goto error;
}
- ret_val = TRUE;
-
- // FIXME check for zeros, don't assume that 0 means for "not set"
+ // FIXME check for zeros, don't assume that 0 means "not set"
if (!sti->book_name || !*sti->book_name)
{
g_set_error (error, STARDICT_ERROR, STARDICT_ERROR_INVALID_DATA,
"%s: %s", path, _("no book name specified"));
- ret_val = FALSE;
+ goto error;
}
if (!sti->word_count)
{
g_set_error (error, STARDICT_ERROR, STARDICT_ERROR_INVALID_DATA,
"%s: %s", path, _("word count not specified"));
- ret_val = FALSE;
+ goto error;
}
if (!sti->idx_filesize)
{
g_set_error (error, STARDICT_ERROR, STARDICT_ERROR_INVALID_DATA,
"%s: %s", path, _("index file size not specified"));
- ret_val = FALSE;
+ goto error;
}
if (!sti->idx_offset_bits)
@@ -338,9 +336,11 @@ load_ifo (StardictInfo *sti, const gchar *path, GError **error)
g_set_error (error, STARDICT_ERROR, STARDICT_ERROR_INVALID_DATA,
"%s: %s: %lu", path, _("invalid index offset bits"),
sti->idx_offset_bits);
- ret_val = FALSE;
+ goto error;
}
+ ret_val = TRUE;
+
error:
if (!ret_val)
{
--
cgit v1.2.3-70-g09d2