[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[freetype2] master a69320a 1/3: [bdf] Simplify comment collection or lac
From: |
Werner Lemberg |
Subject: |
[freetype2] master a69320a 1/3: [bdf] Simplify comment collection or lack thereof. |
Date: |
Fri, 24 Sep 2021 22:36:47 -0400 (EDT) |
branch: master
commit a69320a9b27ed87f87d2d28fffa04907c4752873
Author: Alexei Podtelezhnikov <apodtele@gmail.com>
Commit: Alexei Podtelezhnikov <apodtele@gmail.com>
[bdf] Simplify comment collection or lack thereof.
BDF comments are neither actually collected nor retrieved. There is
no need to be fancy with delimiters.
* src/bdf/bdflib.c (_add_bdf_comment): Delimit comments with zeros...
(bdf_load_font): ...and do not null-terminate comments additionally.
(_bdf_parse_glyphs): Check if comments are kept, which they are not.
(_bdf_parse_start): Minor clean up.
---
src/bdf/bdflib.c | 39 ++++++++++++---------------------------
1 file changed, 12 insertions(+), 27 deletions(-)
diff --git a/src/bdf/bdflib.c b/src/bdf/bdflib.c
index fa92fdf..f2ce328 100644
--- a/src/bdf/bdflib.c
+++ b/src/bdf/bdflib.c
@@ -949,7 +949,7 @@
cp = font->comments + font->comments_len;
FT_MEM_COPY( cp, comment, len );
- cp[len] = '\n';
+ cp[len] = '\0';
font->comments_len += len + 1;
@@ -1304,15 +1304,18 @@
/* Check for a comment. */
if ( _bdf_strncmp( line, "COMMENT", 7 ) == 0 )
{
- linelen -= 7;
-
- s = line + 7;
- if ( *s != 0 )
+ if ( p->opts->keep_comments )
{
- s++;
- linelen--;
+ linelen -= 7;
+
+ s = line + 7;
+ if ( *s != 0 )
+ {
+ s++;
+ linelen--;
+ }
+ error = _bdf_add_comment( p->font, s, linelen );
}
- error = _bdf_add_comment( p->font, s, linelen );
goto Exit;
}
@@ -1894,13 +1897,8 @@
s++;
linelen--;
}
-
error = _bdf_add_comment( p->font, s, linelen );
- if ( error )
- goto Exit;
- /* here font is not defined! */
}
-
goto Exit;
}
@@ -2269,20 +2267,7 @@
}
}
- if ( p->font )
- {
- /* Make sure the comments are null terminated if they exist. */
- if ( p->font->comments_len > 0 )
- {
- if ( FT_QRENEW_ARRAY( p->font->comments,
- p->font->comments_len,
- p->font->comments_len + 1 ) )
- goto Fail;
-
- p->font->comments[p->font->comments_len] = 0;
- }
- }
- else if ( !error )
+ if ( !p->font && !error )
error = FT_THROW( Invalid_File_Format );
*font = p->font;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [freetype2] master a69320a 1/3: [bdf] Simplify comment collection or lack thereof.,
Werner Lemberg <=