From 1e55acc1983fd7db15483f2746be0b87ccce8cd7 Mon Sep 17 00:00:00 2001 From: picomeg <megordon5@gmail.com> Date: Tue, 26 Apr 2022 16:44:12 +0100 Subject: [PATCH] code formatting improvements, remove unnecessary casts --- pdf.c | 78 +++++++++++++++++++++++++++++------------------------------ 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/pdf.c b/pdf.c index 3307ace..4b317a0 100644 --- a/pdf.c +++ b/pdf.c @@ -1606,9 +1606,9 @@ act_tnumb(const HParseResult *p, void *u) double value; if (p->ast->token_type == TT_SINT) - value = (double)p->ast->sint; + value = p->ast->sint; else - value = H_CAST_DOUBLE(p->ast); + value = H_CAST_DOUBLE(p->ast); return H_MAKE_DOUBLE(value); } @@ -5029,24 +5029,24 @@ void parse_pagenode ( HParsedToken * token; token = H_INDEX_TOKEN(item, 0); if (token->token_type == TT_SINT) - llx = (double)token->sint; + llx = token->sint; else - llx = H_CAST_DOUBLE(token); + llx = H_CAST_DOUBLE(token); token = H_INDEX_TOKEN(item, 1); if (token->token_type == TT_SINT) - lly = (double)token->sint; + lly = token->sint; else - lly = H_CAST_DOUBLE(token); + lly = H_CAST_DOUBLE(token); token = H_INDEX_TOKEN(item, 2); if (token->token_type == TT_SINT) - urx = (double)token->sint; + urx = token->sint; else - urx = H_CAST_DOUBLE(token); + urx = H_CAST_DOUBLE(token); token = H_INDEX_TOKEN(item, 3); if (token->token_type == TT_SINT) - ury = (double)token->sint; + ury = token->sint; else - ury = H_CAST_DOUBLE(token); + ury = H_CAST_DOUBLE(token); myNode->mediaBox.tx = fabs(llx - urx); myNode->mediaBox.ty = fabs(lly - ury); @@ -5213,8 +5213,8 @@ parse_pagetree( } else { myNode->pgRsrc = NULL; - myNode->mediaBox.tx = 0.0; - myNode->mediaBox.ty = 0.0; + myNode->mediaBox.tx = 0; + myNode->mediaBox.ty = 0; } myNode->offset = 0; @@ -5271,33 +5271,33 @@ parse_pagetree( // page tree node may have resources and media box that are inheritable item = dictentry(myDict, "MediaBox"); // inheritable if not NULL if (item) { - item = resolve(aux, item); - if (item->token_type == TT_SEQUENCE) { - double llx, lly, urx, ury; // typical but can be any diagonal - HParsedToken * token; - token = H_INDEX_TOKEN(item, 0); - if (token->token_type == TT_SINT) - llx = (double)token->sint; - else - llx = H_CAST_DOUBLE(token); - token = H_INDEX_TOKEN(item, 1); - if (token->token_type == TT_SINT) - lly = (double)token->sint; - else - lly = H_CAST_DOUBLE(token); - token = H_INDEX_TOKEN(item, 2); - if (token->token_type == TT_SINT) - urx = (double)token->sint; - else - urx = H_CAST_DOUBLE(token); - token = H_INDEX_TOKEN(item, 3); - if (token->token_type == TT_SINT) - ury = (double)token->sint; - else - ury = H_CAST_DOUBLE(token); - myNode->mediaBox.tx = fabs(llx - urx); - myNode->mediaBox.ty = fabs(lly - ury); - } + item = resolve(aux, item); + if (item->token_type == TT_SEQUENCE) { + double llx, lly, urx, ury; // typical but can be any diagonal + HParsedToken * token; + token = H_INDEX_TOKEN(item, 0); + if (token->token_type == TT_SINT) + llx = token->sint; + else + llx = H_CAST_DOUBLE(token); + token = H_INDEX_TOKEN(item, 1); + if (token->token_type == TT_SINT) + lly = token->sint; + else + lly = H_CAST_DOUBLE(token); + token = H_INDEX_TOKEN(item, 2); + if (token->token_type == TT_SINT) + urx = token->sint; + else + urx = H_CAST_DOUBLE(token); + token = H_INDEX_TOKEN(item, 3); + if (token->token_type == TT_SINT) + ury = token->sint; + else + ury = H_CAST_DOUBLE(token); + myNode->mediaBox.tx = fabs(llx - urx); + myNode->mediaBox.ty = fabs(lly - ury); + } } const HParsedToken *rsrcDictT = NULL; -- GitLab