чување 0fe7579ad5b53cb459aaf3156d10bf80ed7a6d49
родитељ 7e7b946c4b12c00ee10f15b8014348a2f1050113
Аутор: Страхиња Радић <contact@strahinja.org>
Датум: Sun, 8 Aug 2021 16:05:22 +0200
Fix: properly handle the case when no LF at end of file and there are #~ entries
Signed-off-by: Страхиња Радић <contact@strahinja.org>
Diffstat:
измењених датотека: 1, додавања: 10(+), брисања: 2(-)
diff --git a/po.c b/po.c
@@ -379,7 +379,11 @@ load_file(struct DrawState* dstate, long* lineno, long* col)
if (dstate->msgid_count > 1)
{
if (entry->msgid)
+ /* regular entry */
dstate->msgid_count++;
+ else if (entry->comment_lines > 0)
+ /* obsolete entry */
+ entry->obsolete = 1;
}
/* file has < PO_DETECTION_LINES */
@@ -1068,13 +1072,14 @@ update_statistics(const struct PoEntry* entries, struct DrawState* state,
struct PoEntry* entry)
{
const struct PoEntry* current = NULL;
+ int advance = 1;
state->fuzzy_count = 0;
state->obsolete_count = 0;
state->untranslated_count = 0;
current = entries;
- while (current && current != entry)
+ while (current && advance)
{
if (current->obsolete)
state->obsolete_count++;
@@ -1086,7 +1091,10 @@ update_statistics(const struct PoEntry* entries, struct DrawState* state,
if (current->flags & FL_FUZZY)
state->fuzzy_count++;
}
- current++;
+ if (current == entry)
+ advance = 0;
+ else
+ current++;
}
}