From 6ce99a0d2808b73913150ef6812d06f6a50a4eeb Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Mon, 30 Sep 2024 21:29:28 +0300
Subject: [PATCH] update after latest SDL3 changes
---
src/rtfactn.c | 220 ++++++++++++++++++++++++-------------------------
src/rtfreadr.c | 8 +-
src/rtftype.h | 5 --
3 files changed, 114 insertions(+), 119 deletions(-)
diff --git a/src/rtfactn.c b/src/rtfactn.c
index 87c1e31..b36e051 100644
--- a/src/rtfactn.c
+++ b/src/rtfactn.c
@@ -54,111 +54,111 @@ PROP rgprop[ipropMax] =
SYM rgsymRtf[] =
{
/* keyword, dflt, fPassDflt, kwd, idx */
- {"fonttbl", 0, fFalse, kwdDest, idestFontTable},
- {"fnil", fnil, fTrue, kwdProp, ipropFontFamily},
- {"froman", froman, fTrue, kwdProp, ipropFontFamily},
- {"fswiss", fswiss, fTrue, kwdProp, ipropFontFamily},
- {"fmodern", fmodern, fTrue, kwdProp, ipropFontFamily},
- {"fscript", fscript, fTrue, kwdProp, ipropFontFamily},
- {"fdecor", fdecor, fTrue, kwdProp, ipropFontFamily},
- {"ftech", ftech, fTrue, kwdProp, ipropFontFamily},
- {"fbidi", fbidi, fTrue, kwdProp, ipropFontFamily},
- {"fcharset", 0, fFalse, kwdProp, ipropFontCharset},
- {"colortbl", 0, fFalse, kwdDest, idestColorTable},
- {"red", 0, fFalse, kwdProp, ipropColorRed},
- {"green", 0, fFalse, kwdProp, ipropColorGreen},
- {"blue", 0, fFalse, kwdProp, ipropColorBlue},
- {"info", 0, fFalse, kwdDest, idestInfo},
- {"title", 0, fFalse, kwdDest, idestTitle},
- {"subject", 0, fFalse, kwdDest, idestSubject},
- {"author", 0, fFalse, kwdDest, idestAuthor},
- {"f", 0, fFalse, kwdProp, ipropFont},
- {"fs", 24, fFalse, kwdProp, ipropFontSize},
- {"cb", 1, fFalse, kwdProp, ipropBgColor},
- {"cf", 1, fFalse, kwdProp, ipropFgColor},
- {"b", 1, fFalse, kwdProp, ipropBold},
- {"ul", 1, fFalse, kwdProp, ipropUnderline},
- {"ulnone", 0, fTrue, kwdProp, ipropUnderline},
- {"i", 1, fFalse, kwdProp, ipropItalic},
- {"li", 0, fFalse, kwdProp, ipropLeftInd},
- {"ri", 0, fFalse, kwdProp, ipropRightInd},
- {"fi", 0, fFalse, kwdProp, ipropFirstInd},
- {"cols", 1, fFalse, kwdProp, ipropCols},
- {"sbknone", sbkNon, fTrue, kwdProp, ipropSbk},
- {"sbkcol", sbkCol, fTrue, kwdProp, ipropSbk},
- {"sbkeven", sbkEvn, fTrue, kwdProp, ipropSbk},
- {"sbkodd", sbkOdd, fTrue, kwdProp, ipropSbk},
- {"sbkpage", sbkPg, fTrue, kwdProp, ipropSbk},
- {"pgnx", 0, fFalse, kwdProp, ipropPgnX},
- {"pgny", 0, fFalse, kwdProp, ipropPgnY},
- {"pgndec", pgDec, fTrue, kwdProp, ipropPgnFormat},
- {"pgnucrm", pgURom, fTrue, kwdProp, ipropPgnFormat},
- {"pgnlcrm", pgLRom, fTrue, kwdProp, ipropPgnFormat},
- {"pgnucltr", pgULtr, fTrue, kwdProp, ipropPgnFormat},
- {"pgnlcltr", pgLLtr, fTrue, kwdProp, ipropPgnFormat},
- {"qc", justC, fTrue, kwdProp, ipropJust},
- {"ql", justL, fTrue, kwdProp, ipropJust},
- {"qr", justR, fTrue, kwdProp, ipropJust},
- {"qj", justF, fTrue, kwdProp, ipropJust},
- {"paperw", 12240, fFalse, kwdProp, ipropXaPage},
- {"paperh", 15480, fFalse, kwdProp, ipropYaPage},
- {"margl", 1800, fFalse, kwdProp, ipropXaLeft},
- {"margr", 1800, fFalse, kwdProp, ipropXaRight},
- {"margt", 1440, fFalse, kwdProp, ipropYaTop},
- {"margb", 1440, fFalse, kwdProp, ipropYaBottom},
- {"pgnstart", 1, fTrue, kwdProp, ipropPgnStart},
- {"facingp", 1, fTrue, kwdProp, ipropFacingp},
- {"landscape", 1, fTrue, kwdProp, ipropLandscape},
- {"line", 0, fFalse, kwdChar, '\n'},
- {"par", 0, fFalse, kwdChar, '\n'},
- {"\0x0a", 0, fFalse, kwdChar, '\n'},
- {"\r", 0, fFalse, kwdChar, '\n'},
- {"\0x0d", 0, fFalse, kwdChar, '\n'},
- {"\n", 0, fFalse, kwdChar, '\n'},
- {"tab", 0, fFalse, kwdChar, '\t'},
- {"ldblquote", 0, fFalse, kwdChar, '"'},
- {"rdblquote", 0, fFalse, kwdChar, '"'},
- {"bin", 0, fFalse, kwdSpec, ipfnBin},
- {"*", 0, fFalse, kwdSpec, ipfnSkipDest},
- {"'", 0, fFalse, kwdSpec, ipfnHex},
- {"bkmkend", 0, fFalse, kwdDest, idestSkip},
- {"bkmkstart", 0, fFalse, kwdDest, idestSkip},
- {"buptim", 0, fFalse, kwdDest, idestSkip},
- {"colortbl", 0, fFalse, kwdDest, idestSkip},
- {"comment", 0, fFalse, kwdDest, idestSkip},
- {"creatim", 0, fFalse, kwdDest, idestSkip},
- {"doccomm", 0, fFalse, kwdDest, idestSkip},
- {"fonttbl", 0, fFalse, kwdDest, idestSkip},
- {"footer", 0, fFalse, kwdDest, idestSkip},
- {"footerf", 0, fFalse, kwdDest, idestSkip},
- {"footerl", 0, fFalse, kwdDest, idestSkip},
- {"footerr", 0, fFalse, kwdDest, idestSkip},
- {"footnote", 0, fFalse, kwdDest, idestSkip},
- {"ftncn", 0, fFalse, kwdDest, idestSkip},
- {"ftnsep", 0, fFalse, kwdDest, idestSkip},
- {"ftnsepc", 0, fFalse, kwdDest, idestSkip},
- {"header", 0, fFalse, kwdDest, idestSkip},
- {"headerf", 0, fFalse, kwdDest, idestSkip},
- {"headerl", 0, fFalse, kwdDest, idestSkip},
- {"headerr", 0, fFalse, kwdDest, idestSkip},
- {"info", 0, fFalse, kwdDest, idestSkip},
- {"keywords", 0, fFalse, kwdDest, idestSkip},
- {"operator", 0, fFalse, kwdDest, idestSkip},
- {"pict", 0, fFalse, kwdDest, idestSkip},
- {"printim", 0, fFalse, kwdDest, idestSkip},
- {"private1", 0, fFalse, kwdDest, idestSkip},
- {"revtim", 0, fFalse, kwdDest, idestSkip},
- {"rxe", 0, fFalse, kwdDest, idestSkip},
- {"stylesheet", 0, fFalse, kwdDest, idestSkip},
- {"tc", 0, fFalse, kwdDest, idestSkip},
- {"txe", 0, fFalse, kwdDest, idestSkip},
- {"xe", 0, fFalse, kwdDest, idestSkip},
- {"{", 0, fFalse, kwdChar, '{'},
- {"}", 0, fFalse, kwdChar, '}'},
- {"\\", 0, fFalse, kwdChar, '\\'},
- {"pard", 0, fFalse, kwdProp, ipropPard},
- {"plain", 0, fFalse, kwdProp, ipropPlain},
- {"sectd", 0, fFalse, kwdProp, ipropSectd}
+ {"fonttbl", 0, false, kwdDest, idestFontTable},
+ {"fnil", fnil, true, kwdProp, ipropFontFamily},
+ {"froman", froman, true, kwdProp, ipropFontFamily},
+ {"fswiss", fswiss, true, kwdProp, ipropFontFamily},
+ {"fmodern", fmodern, true, kwdProp, ipropFontFamily},
+ {"fscript", fscript, true, kwdProp, ipropFontFamily},
+ {"fdecor", fdecor, true, kwdProp, ipropFontFamily},
+ {"ftech", ftech, true, kwdProp, ipropFontFamily},
+ {"fbidi", fbidi, true, kwdProp, ipropFontFamily},
+ {"fcharset", 0, false, kwdProp, ipropFontCharset},
+ {"colortbl", 0, false, kwdDest, idestColorTable},
+ {"red", 0, false, kwdProp, ipropColorRed},
+ {"green", 0, false, kwdProp, ipropColorGreen},
+ {"blue", 0, false, kwdProp, ipropColorBlue},
+ {"info", 0, false, kwdDest, idestInfo},
+ {"title", 0, false, kwdDest, idestTitle},
+ {"subject", 0, false, kwdDest, idestSubject},
+ {"author", 0, false, kwdDest, idestAuthor},
+ {"f", 0, false, kwdProp, ipropFont},
+ {"fs", 24, false, kwdProp, ipropFontSize},
+ {"cb", 1, false, kwdProp, ipropBgColor},
+ {"cf", 1, false, kwdProp, ipropFgColor},
+ {"b", 1, false, kwdProp, ipropBold},
+ {"ul", 1, false, kwdProp, ipropUnderline},
+ {"ulnone", 0, true, kwdProp, ipropUnderline},
+ {"i", 1, false, kwdProp, ipropItalic},
+ {"li", 0, false, kwdProp, ipropLeftInd},
+ {"ri", 0, false, kwdProp, ipropRightInd},
+ {"fi", 0, false, kwdProp, ipropFirstInd},
+ {"cols", 1, false, kwdProp, ipropCols},
+ {"sbknone", sbkNon, true, kwdProp, ipropSbk},
+ {"sbkcol", sbkCol, true, kwdProp, ipropSbk},
+ {"sbkeven", sbkEvn, true, kwdProp, ipropSbk},
+ {"sbkodd", sbkOdd, true, kwdProp, ipropSbk},
+ {"sbkpage", sbkPg, true, kwdProp, ipropSbk},
+ {"pgnx", 0, false, kwdProp, ipropPgnX},
+ {"pgny", 0, false, kwdProp, ipropPgnY},
+ {"pgndec", pgDec, true, kwdProp, ipropPgnFormat},
+ {"pgnucrm", pgURom, true, kwdProp, ipropPgnFormat},
+ {"pgnlcrm", pgLRom, true, kwdProp, ipropPgnFormat},
+ {"pgnucltr", pgULtr, true, kwdProp, ipropPgnFormat},
+ {"pgnlcltr", pgLLtr, true, kwdProp, ipropPgnFormat},
+ {"qc", justC, true, kwdProp, ipropJust},
+ {"ql", justL, true, kwdProp, ipropJust},
+ {"qr", justR, true, kwdProp, ipropJust},
+ {"qj", justF, true, kwdProp, ipropJust},
+ {"paperw", 12240, false, kwdProp, ipropXaPage},
+ {"paperh", 15480, false, kwdProp, ipropYaPage},
+ {"margl", 1800, false, kwdProp, ipropXaLeft},
+ {"margr", 1800, false, kwdProp, ipropXaRight},
+ {"margt", 1440, false, kwdProp, ipropYaTop},
+ {"margb", 1440, false, kwdProp, ipropYaBottom},
+ {"pgnstart", 1, true, kwdProp, ipropPgnStart},
+ {"facingp", 1, true, kwdProp, ipropFacingp},
+ {"landscape", 1, true, kwdProp, ipropLandscape},
+ {"line", 0, false, kwdChar, '\n'},
+ {"par", 0, false, kwdChar, '\n'},
+ {"\0x0a", 0, false, kwdChar, '\n'},
+ {"\r", 0, false, kwdChar, '\n'},
+ {"\0x0d", 0, false, kwdChar, '\n'},
+ {"\n", 0, false, kwdChar, '\n'},
+ {"tab", 0, false, kwdChar, '\t'},
+ {"ldblquote", 0, false, kwdChar, '"'},
+ {"rdblquote", 0, false, kwdChar, '"'},
+ {"bin", 0, false, kwdSpec, ipfnBin},
+ {"*", 0, false, kwdSpec, ipfnSkipDest},
+ {"'", 0, false, kwdSpec, ipfnHex},
+ {"bkmkend", 0, false, kwdDest, idestSkip},
+ {"bkmkstart", 0, false, kwdDest, idestSkip},
+ {"buptim", 0, false, kwdDest, idestSkip},
+ {"colortbl", 0, false, kwdDest, idestSkip},
+ {"comment", 0, false, kwdDest, idestSkip},
+ {"creatim", 0, false, kwdDest, idestSkip},
+ {"doccomm", 0, false, kwdDest, idestSkip},
+ {"fonttbl", 0, false, kwdDest, idestSkip},
+ {"footer", 0, false, kwdDest, idestSkip},
+ {"footerf", 0, false, kwdDest, idestSkip},
+ {"footerl", 0, false, kwdDest, idestSkip},
+ {"footerr", 0, false, kwdDest, idestSkip},
+ {"footnote", 0, false, kwdDest, idestSkip},
+ {"ftncn", 0, false, kwdDest, idestSkip},
+ {"ftnsep", 0, false, kwdDest, idestSkip},
+ {"ftnsepc", 0, false, kwdDest, idestSkip},
+ {"header", 0, false, kwdDest, idestSkip},
+ {"headerf", 0, false, kwdDest, idestSkip},
+ {"headerl", 0, false, kwdDest, idestSkip},
+ {"headerr", 0, false, kwdDest, idestSkip},
+ {"info", 0, false, kwdDest, idestSkip},
+ {"keywords", 0, false, kwdDest, idestSkip},
+ {"operator", 0, false, kwdDest, idestSkip},
+ {"pict", 0, false, kwdDest, idestSkip},
+ {"printim", 0, false, kwdDest, idestSkip},
+ {"private1", 0, false, kwdDest, idestSkip},
+ {"revtim", 0, false, kwdDest, idestSkip},
+ {"rxe", 0, false, kwdDest, idestSkip},
+ {"stylesheet", 0, false, kwdDest, idestSkip},
+ {"tc", 0, false, kwdDest, idestSkip},
+ {"txe", 0, false, kwdDest, idestSkip},
+ {"xe", 0, false, kwdDest, idestSkip},
+ {"{", 0, false, kwdChar, '{'},
+ {"}", 0, false, kwdChar, '}'},
+ {"\\", 0, false, kwdChar, '\\'},
+ {"pard", 0, false, kwdProp, ipropPard},
+ {"plain", 0, false, kwdProp, ipropPlain},
+ {"sectd", 0, false, kwdProp, ipropSectd}
};
int isymMax = sizeof(rgsymRtf) / sizeof(SYM);
@@ -257,9 +257,9 @@ int ecParseSpecialProperty(RTF_Context *ctx, IPROP iprop, int val)
* Inputs:
* szKeyword: The RTF control to evaluate.
* param: The parameter of the RTF control.
- * fParam: fTrue if the control had a parameter; (that is, if param
+ * fParam: true if the control had a parameter; (that is, if param
* is valid)
- * fFalse if it did not.
+ * false if it did not.
*/
int ecTranslateKeyword(RTF_Context *ctx, char *szKeyword, int param,
bool fParam)
@@ -278,12 +278,12 @@ int ecTranslateKeyword(RTF_Context *ctx, char *szKeyword, int param,
if (ctx->fSkipDestIfUnk) /* if this is a new destination */
ctx->rds = rdsSkip; /* skip the destination */
/* else just discard it */
- ctx->fSkipDestIfUnk = fFalse;
+ ctx->fSkipDestIfUnk = false;
return ecOK;
}
/* found it! use kwd and idx to determine what to do with it. */
- ctx->fSkipDestIfUnk = fFalse;
+ ctx->fSkipDestIfUnk = false;
switch (rgsymRtf[isym].kwd)
{
case kwdProp:
@@ -400,7 +400,7 @@ int ecParseSpecialKeyword(RTF_Context *ctx, IPFN ipfn)
ctx->cbBin = ctx->lParam;
break;
case ipfnSkipDest:
- ctx->fSkipDestIfUnk = fTrue;
+ ctx->fSkipDestIfUnk = true;
break;
case ipfnHex:
ctx->ris = risHex;
diff --git a/src/rtfreadr.c b/src/rtfreadr.c
index 6ce84cf..82c29ae 100644
--- a/src/rtfreadr.c
+++ b/src/rtfreadr.c
@@ -566,8 +566,8 @@ int ecPopRtfState(RTF_Context *ctx)
int ecParseRtfKeyword(RTF_Context *ctx)
{
int ch;
- bool fParam = fFalse;
- bool fNeg = fFalse;
+ bool fParam = false;
+ bool fNeg = false;
int param = 0;
char *pch;
char szKeyword[30];
@@ -592,13 +592,13 @@ int ecParseRtfKeyword(RTF_Context *ctx)
*pch = '\0';
if (ch == '-')
{
- fNeg = fTrue;
+ fNeg = true;
if (ecRtfGetChar(ctx, &ch) != ecOK)
return ecEndOfFile;
}
if (SDL_isdigit(ch))
{
- fParam = fTrue; /* a digit after the control means we have a parameter */
+ fParam = true; /* a digit after the control means we have a parameter */
for (pch = szParameter; SDL_isdigit(ch);)
{
*pch++ = (char) ch;
diff --git a/src/rtftype.h b/src/rtftype.h
index 094dbe9..be0362f 100644
--- a/src/rtftype.h
+++ b/src/rtftype.h
@@ -6,11 +6,6 @@
#ifndef _RTFTYPE_H
#define _RTFTYPE_H
-#include <stdbool.h>
-
-#define fTrue true
-#define fFalse false
-
typedef struct char_prop
{
int fFontCharset;