Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 09490e0

Browse files
authored
Merge pull request #11485 from dahlbaek/fix/null/cast
BLD: Use null character instead of recasting NULL to char
2 parents 18613be + ce0c2a2 commit 09490e0

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

extern/ttconv/pprdrv_tt.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ void Read_name(struct TTFONT *font)
245245
{
246246
font->Copyright = (char*)calloc(sizeof(char),length+1);
247247
strncpy(font->Copyright,(const char*)strings+offset,length);
248-
font->Copyright[length]=(char)NULL;
248+
font->Copyright[length]='\0';
249249
replace_newlines_with_spaces(font->Copyright);
250250

251251
#ifdef DEBUG_TRUETYPE
@@ -261,7 +261,7 @@ void Read_name(struct TTFONT *font)
261261
free(font->FamilyName);
262262
font->FamilyName = (char*)calloc(sizeof(char),length+1);
263263
strncpy(font->FamilyName,(const char*)strings+offset,length);
264-
font->FamilyName[length]=(char)NULL;
264+
font->FamilyName[length]='\0';
265265
replace_newlines_with_spaces(font->FamilyName);
266266

267267
#ifdef DEBUG_TRUETYPE
@@ -277,7 +277,7 @@ void Read_name(struct TTFONT *font)
277277
free(font->Style);
278278
font->Style = (char*)calloc(sizeof(char),length+1);
279279
strncpy(font->Style,(const char*)strings+offset,length);
280-
font->Style[length]=(char)NULL;
280+
font->Style[length]='\0';
281281
replace_newlines_with_spaces(font->Style);
282282

283283
#ifdef DEBUG_TRUETYPE
@@ -293,7 +293,7 @@ void Read_name(struct TTFONT *font)
293293
free(font->FullName);
294294
font->FullName = (char*)calloc(sizeof(char),length+1);
295295
strncpy(font->FullName,(const char*)strings+offset,length);
296-
font->FullName[length]=(char)NULL;
296+
font->FullName[length]='\0';
297297
replace_newlines_with_spaces(font->FullName);
298298

299299
#ifdef DEBUG_TRUETYPE
@@ -309,7 +309,7 @@ void Read_name(struct TTFONT *font)
309309
free(font->Version);
310310
font->Version = (char*)calloc(sizeof(char),length+1);
311311
strncpy(font->Version,(const char*)strings+offset,length);
312-
font->Version[length]=(char)NULL;
312+
font->Version[length]='\0';
313313
replace_newlines_with_spaces(font->Version);
314314

315315
#ifdef DEBUG_TRUETYPE
@@ -325,7 +325,7 @@ void Read_name(struct TTFONT *font)
325325
free(font->PostName);
326326
font->PostName = (char*)calloc(sizeof(char),length+1);
327327
strncpy(font->PostName,(const char*)strings+offset,length);
328-
font->PostName[length]=(char)NULL;
328+
font->PostName[length]='\0';
329329
replace_newlines_with_spaces(font->PostName);
330330

331331
#ifdef DEBUG_TRUETYPE
@@ -340,7 +340,7 @@ void Read_name(struct TTFONT *font)
340340
free(font->PostName);
341341
font->PostName = (char*)calloc(sizeof(char),length+1);
342342
utf16be_to_ascii(font->PostName, (char *)strings+offset, length);
343-
font->PostName[length/2]=(char)NULL;
343+
font->PostName[length/2]='\0';
344344
replace_newlines_with_spaces(font->PostName);
345345

346346
#ifdef DEBUG_TRUETYPE
@@ -355,7 +355,7 @@ void Read_name(struct TTFONT *font)
355355
{
356356
font->Trademark = (char*)calloc(sizeof(char),length+1);
357357
strncpy(font->Trademark,(const char*)strings+offset,length);
358-
font->Trademark[length]=(char)NULL;
358+
font->Trademark[length]='\0';
359359
replace_newlines_with_spaces(font->Trademark);
360360

361361
#ifdef DEBUG_TRUETYPE
@@ -1041,7 +1041,7 @@ const char *ttfont_CharStrings_getname(struct TTFONT *font, int charindex)
10411041
}
10421042

10431043
strncpy(temp,ptr,len); /* Copy the pascal string into */
1044-
temp[len]=(char)NULL; /* a buffer and make it ASCIIz. */
1044+
temp[len]='\0'; /* a buffer and make it ASCIIz. */
10451045

10461046
return temp;
10471047
}

0 commit comments

Comments
 (0)