@@ -191,7 +191,7 @@ lowerstr_ctx(IspellDict *Conf, const char *src)
191
191
#define GETWCHAR (W ,L ,N ,T ) ( ((const uint8*)(W))[ ((T)==FF_PREFIX) ? (N) : ( (L) - 1 - (N) ) ] )
192
192
#define GETCHAR (A ,N ,T ) GETWCHAR( (A)->repl, (A)->replen, N, T )
193
193
194
- static char * VoidString = "" ;
194
+ static const char * VoidString = "" ;
195
195
196
196
static int
197
197
cmpspell (const void * s1 , const void * s2 )
@@ -346,11 +346,11 @@ cmpaffix(const void *s1, const void *s2)
346
346
* sflag: returns an affix flag from sflagset.
347
347
*/
348
348
static void
349
- getNextFlagFromString (IspellDict * Conf , char * * sflagset , char * sflag )
349
+ getNextFlagFromString (IspellDict * Conf , const char * * sflagset , char * sflag )
350
350
{
351
351
int32 s ;
352
- char * next ,
353
- * sbuf = * sflagset ;
352
+ char * next ;
353
+ const char * sbuf = * sflagset ;
354
354
int maxstep ;
355
355
bool stop = false;
356
356
bool met_comma = false;
@@ -453,7 +453,7 @@ getNextFlagFromString(IspellDict *Conf, char **sflagset, char *sflag)
453
453
static bool
454
454
IsAffixFlagInUse (IspellDict * Conf , int affix , const char * affixflag )
455
455
{
456
- char * flagcur ;
456
+ const char * flagcur ;
457
457
char flag [BUFSIZ ];
458
458
459
459
if (* affixflag == 0 )
@@ -1120,13 +1120,13 @@ addCompoundAffixFlagValue(IspellDict *Conf, char *s, uint32 val)
1120
1120
* flags s.
1121
1121
*/
1122
1122
static int
1123
- getCompoundAffixFlagValue (IspellDict * Conf , char * s )
1123
+ getCompoundAffixFlagValue (IspellDict * Conf , const char * s )
1124
1124
{
1125
1125
uint32 flag = 0 ;
1126
1126
CompoundAffixFlag * found ,
1127
1127
key ;
1128
1128
char sflag [BUFSIZ ];
1129
- char * flagcur ;
1129
+ const char * flagcur ;
1130
1130
1131
1131
if (Conf -> nCompoundAffixFlag == 0 )
1132
1132
return 0 ;
@@ -1155,7 +1155,7 @@ getCompoundAffixFlagValue(IspellDict *Conf, char *s)
1155
1155
* Conf->AffixData array and function returns its entry.
1156
1156
* Else function returns the s parameter.
1157
1157
*/
1158
- static char *
1158
+ static const char *
1159
1159
getAffixFlagSet (IspellDict * Conf , char * s )
1160
1160
{
1161
1161
if (Conf -> useFlagAliases && * s != '\0' )
@@ -1323,7 +1323,7 @@ NIImportOOAffixes(IspellDict *Conf, const char *filename)
1323
1323
/* Also reserve place for empty flag set */
1324
1324
naffix ++ ;
1325
1325
1326
- Conf -> AffixData = (char * * ) palloc0 (naffix * sizeof (char * ));
1326
+ Conf -> AffixData = (const char * * ) palloc0 (naffix * sizeof (char * ));
1327
1327
Conf -> lenAffixData = Conf -> nAffixData = naffix ;
1328
1328
1329
1329
/* Add empty flag set into AffixData */
@@ -1571,7 +1571,7 @@ NIImportAffixes(IspellDict *Conf, const char *filename)
1571
1571
static int
1572
1572
MergeAffix (IspellDict * Conf , int a1 , int a2 )
1573
1573
{
1574
- char * * ptr ;
1574
+ const char * * ptr ;
1575
1575
1576
1576
Assert (a1 < Conf -> nAffixData && a2 < Conf -> nAffixData );
1577
1577
@@ -1585,24 +1585,28 @@ MergeAffix(IspellDict *Conf, int a1, int a2)
1585
1585
if (Conf -> nAffixData + 1 >= Conf -> lenAffixData )
1586
1586
{
1587
1587
Conf -> lenAffixData *= 2 ;
1588
- Conf -> AffixData = (char * * ) repalloc (Conf -> AffixData ,
1589
- sizeof (char * ) * Conf -> lenAffixData );
1588
+ Conf -> AffixData = (const char * * ) repalloc (Conf -> AffixData ,
1589
+ sizeof (char * ) * Conf -> lenAffixData );
1590
1590
}
1591
1591
1592
1592
ptr = Conf -> AffixData + Conf -> nAffixData ;
1593
1593
if (Conf -> flagMode == FM_NUM )
1594
1594
{
1595
- * ptr = cpalloc (strlen (Conf -> AffixData [a1 ]) +
1596
- strlen (Conf -> AffixData [a2 ]) +
1597
- 1 /* comma */ + 1 /* \0 */ );
1598
- sprintf (* ptr , "%s,%s" , Conf -> AffixData [a1 ], Conf -> AffixData [a2 ]);
1595
+ char * p = cpalloc (strlen (Conf -> AffixData [a1 ]) +
1596
+ strlen (Conf -> AffixData [a2 ]) +
1597
+ 1 /* comma */ + 1 /* \0 */ );
1598
+
1599
+ sprintf (p , "%s,%s" , Conf -> AffixData [a1 ], Conf -> AffixData [a2 ]);
1600
+ * ptr = p ;
1599
1601
}
1600
1602
else
1601
1603
{
1602
- * ptr = cpalloc (strlen (Conf -> AffixData [a1 ]) +
1603
- strlen (Conf -> AffixData [a2 ]) +
1604
- 1 /* \0 */ );
1605
- sprintf (* ptr , "%s%s" , Conf -> AffixData [a1 ], Conf -> AffixData [a2 ]);
1604
+ char * p = cpalloc (strlen (Conf -> AffixData [a1 ]) +
1605
+ strlen (Conf -> AffixData [a2 ]) +
1606
+ 1 /* \0 */ );
1607
+
1608
+ sprintf (p , "%s%s" , Conf -> AffixData [a1 ], Conf -> AffixData [a2 ]);
1609
+ * ptr = p ;
1606
1610
}
1607
1611
ptr ++ ;
1608
1612
* ptr = NULL ;
@@ -1785,7 +1789,7 @@ NISortDictionary(IspellDict *Conf)
1785
1789
* dictionary. Replace textual flag-field of Conf->Spell entries with
1786
1790
* indexes into Conf->AffixData array.
1787
1791
*/
1788
- Conf -> AffixData = (char * * ) palloc0 (naffix * sizeof (char * ));
1792
+ Conf -> AffixData = (const char * * ) palloc0 (naffix * sizeof (const char * ));
1789
1793
1790
1794
curaffix = -1 ;
1791
1795
for (i = 0 ; i < Conf -> nspell ; i ++ )
@@ -1954,7 +1958,7 @@ mkVoidAffix(IspellDict *Conf, bool issuffix, int startsuffix)
1954
1958
* returns false.
1955
1959
*/
1956
1960
static bool
1957
- isAffixInUse (IspellDict * Conf , char * affixflag )
1961
+ isAffixInUse (IspellDict * Conf , const char * affixflag )
1958
1962
{
1959
1963
int i ;
1960
1964
@@ -2169,7 +2173,7 @@ addToResult(char **forms, char **cur, char *word)
2169
2173
}
2170
2174
2171
2175
static char * *
2172
- NormalizeSubWord (IspellDict * Conf , char * word , int flag )
2176
+ NormalizeSubWord (IspellDict * Conf , const char * word , int flag )
2173
2177
{
2174
2178
AffixNodeData * suffix = NULL ,
2175
2179
* prefix = NULL ;
@@ -2255,7 +2259,7 @@ NormalizeSubWord(IspellDict *Conf, char *word, int flag)
2255
2259
if (CheckAffix (newword , swrdlen , prefix -> aff [j ], flag , pnewword , & baselen ))
2256
2260
{
2257
2261
/* prefix success */
2258
- char * ff = (prefix -> aff [j ]-> flagflags & suffix -> aff [i ]-> flagflags & FF_CROSSPRODUCT ) ?
2262
+ const char * ff = (prefix -> aff [j ]-> flagflags & suffix -> aff [i ]-> flagflags & FF_CROSSPRODUCT ) ?
2259
2263
VoidString : prefix -> aff [j ]-> flag ;
2260
2264
2261
2265
if (FindWord (Conf , pnewword , ff , flag ))
@@ -2287,7 +2291,7 @@ typedef struct SplitVar
2287
2291
} SplitVar ;
2288
2292
2289
2293
static int
2290
- CheckCompoundAffixes (CMPDAffix * * ptr , char * word , int len , bool CheckInPlace )
2294
+ CheckCompoundAffixes (CMPDAffix * * ptr , const char * word , int len , bool CheckInPlace )
2291
2295
{
2292
2296
bool issuffix ;
2293
2297
@@ -2367,7 +2371,7 @@ AddStem(SplitVar *v, char *word)
2367
2371
}
2368
2372
2369
2373
static SplitVar *
2370
- SplitToVariants (IspellDict * Conf , SPNode * snode , SplitVar * orig , char * word , int wordlen , int startpos , int minpos )
2374
+ SplitToVariants (IspellDict * Conf , SPNode * snode , SplitVar * orig , const char * word , int wordlen , int startpos , int minpos )
2371
2375
{
2372
2376
SplitVar * var = NULL ;
2373
2377
SPNodeData * StopLow ,
@@ -2533,7 +2537,7 @@ addNorm(TSLexeme **lres, TSLexeme **lcur, char *word, int flags, uint16 NVariant
2533
2537
}
2534
2538
2535
2539
TSLexeme *
2536
- NINormalizeWord (IspellDict * Conf , char * word )
2540
+ NINormalizeWord (IspellDict * Conf , const char * word )
2537
2541
{
2538
2542
char * * res ;
2539
2543
TSLexeme * lcur = NULL ,
0 commit comments