File tree Expand file tree Collapse file tree 1 file changed +7
-11
lines changed
Expand file tree Collapse file tree 1 file changed +7
-11
lines changed Original file line number Diff line number Diff line change @@ -656,9 +656,8 @@ file_with_bom (GFile *file)
656656 FILE * testfile ;
657657 gchar c ;
658658 int i ;
659- gchar * bom ;
659+ gchar bom [ 3 ] ;
660660 gchar * file_path ;
661- gboolean has_bom ;
662661
663662 file_path = g_file_get_path (file );
664663
@@ -672,27 +671,24 @@ file_with_bom (GFile *file)
672671 return FALSE;
673672 }
674673
675- bom = "" ;
676-
677674 for (i = 0 ; i < 3 ; i ++ )
678675 {
679676 c = fgetc (testfile );
680677
681678 if (c == EOF )
682679 break ;
683680 else
684- bom = g_strdup_printf ( "%s%c" , bom , c ) ;
681+ bom [ i ] = c ;
685682 }
686683
687684 fclose (testfile );
688685
689- if (g_strcmp0 (bom , "\357\273\277" ) == 0 )
690- has_bom = TRUE;
686+ if ((bom [0 ] == '\357' ) &&
687+ (bom [1 ] == '\273' ) &&
688+ (bom [2 ] == '\277' ))
689+ return TRUE;
691690 else
692- has_bom = FALSE;
693-
694- g_free (bom );
695- return has_bom ;
691+ return FALSE;
696692}
697693
698694static void
You can’t perform that action at this time.
0 commit comments