This commit is contained in:
olikraus
2025-10-10 23:26:59 +02:00
4 changed files with 21 additions and 6 deletions
+2 -1
View File
@@ -1,2 +1,3 @@
*.o *.o
*.~ *.s
*.~
+1
View File
@@ -0,0 +1 @@
bdfconv
+14 -4
View File
@@ -1,9 +1,17 @@
# works within ubuntu and min-gw (win7) environment # works within ubuntu and min-gw (win7) environment
# win7 exe uploaded on google drive # win7 exe uploaded on google drive
# requires gcc, eg. on Ubuntu "sudo apt install build-essential"
CC = gcc CC = gcc
CFLAGS = -g -Wall CFLAGS = -O4 -Wall -Werror
#CFLAGS = -O4 -Wall
# for debugging ("make clean" after switching)
#CFLAGS = -g -Wall -Werror
# more portable statically linked linux binary ("make clean" after switching)
# requires musl-gcc, eg. on Ubuntu "sudo apt install musl-dev"
#CC = x86_64-linux-musl-gcc
#LDFLAGS = -static
SRC = main.c bdf_font.c bdf_glyph.c bdf_parser.c bdf_map.c bdf_rle.c bdf_tga.c fd.c bdf_8x8.c bdf_kern.c SRC = main.c bdf_font.c bdf_glyph.c bdf_parser.c bdf_map.c bdf_rle.c bdf_tga.c fd.c bdf_8x8.c bdf_kern.c
@@ -13,11 +21,13 @@ ASM = $(SRC:.c=.s)
.c.s: .c.s:
$(CC) $(CFLAGS) -S -o $@ $< $(CC) $(CFLAGS) -S -o $@ $<
bdfconv: $(OBJ) $(ASM) bdfconv: $(OBJ)
$(CC) $(CFLAGS) $(LDFLAGS) $(OBJ) -o bdfconv $(CC) $(CFLAGS) $(LDFLAGS) $(OBJ) -o bdfconv
asm: $(ASM)
clean: clean:
-rm $(OBJ) $(ASM) bdfconv $(RM) *.o *.s bdfconv
test: bdfconv test: bdfconv
./bdfconv ./bdfconv
+4 -1
View File
@@ -313,7 +313,10 @@ int bf_MapFile(bf_t *bf, const char *map_file_name)
s = malloc(buf.st_size+1); s = malloc(buf.st_size+1);
if ( s == NULL ) if ( s == NULL )
return 0; return 0;
fread(s, buf.st_size, 1, fp); if ( fread(s, buf.st_size, 1, fp) != 1 ) {
free(s);
return 0;
}
s[buf.st_size] = '\0'; s[buf.st_size] = '\0';
fclose(fp); fclose(fp);
bf_Map(bf, s); bf_Map(bf, s);