From 2967cde4c0015ed0275f1bee70d861ee53efea96 Mon Sep 17 00:00:00 2001 From: jacob1 Date: Sat, 18 Feb 2017 10:55:31 -0500 Subject: [PATCH] fix font editor being unable to display chars > \x7F, c++ & warning fixes --- font/Makefile | 12 ++++++------ font/editor.c | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/font/Makefile b/font/Makefile index 0380bc50df..780869caa5 100644 --- a/font/Makefile +++ b/font/Makefile @@ -1,21 +1,21 @@ editor: editor.c - gcc -oeditor -DSCALE=1 -DFONTEDITOR editor.c -lSDL -lm -O3 -ffast-math -march=k8 + gcc -oeditor -DSCALE=1 -DFONTEDITOR editor.c -lSDL -lm -O3 -ffast-math -march=k8 -Wno-unused-result editor.exe: editor.c - i686-w64-mingw32-gcc -oeditor.exe -DSCALE=1 -DFONTEDITOR editor.c -lmingw32 -lm -lSDLmain -lSDL -O3 -ffast-math -march=k8 -mwindows + i686-w64-mingw32-gcc -oeditor.exe -DSCALE=1 -DFONTEDITOR editor.c -lmingw32 -lm -lSDLmain -lSDL -O3 -ffast-math -march=k8 -mwindows -Wno-unused-result packer: packer.c - gcc -opacker -DFONTEDITOR packer.c -lm -O3 -ffast-math -march=k8 + gcc -opacker -DFONTEDITOR packer.c -lm -O3 -ffast-math -march=k8 -Wno-unused-result packer.exe: packer.c - i686-w64-mingw32-gcc -opacker.exe -DFONTEDITOR packer.c -lm -O3 -ffast-math -march=k8 + i686-w64-mingw32-gcc -opacker.exe -DFONTEDITOR packer.c -lm -O3 -ffast-math -march=k8 -Wno-unused-result unpacker: unpacker.c - gcc -ounpacker -DFONTEDITOR unpacker.c -lm -O3 -ffast-math -march=k8 + gcc -ounpacker -DFONTEDITOR unpacker.c -lm -O3 -ffast-math -march=k8 -Wno-unused-result unpacker.exe: unpacker.c - i686-w64-mingw32-gcc -ounpacker.exe -DFONTEDITOR unpacker.c -lm -O3 -ffast-math -march=k8 + i686-w64-mingw32-gcc -ounpacker.exe -DFONTEDITOR unpacker.c -lm -O3 -ffast-math -march=k8 -Wno-unused-result clean: rm -f editor packer unpacker editor.exe packer.exe unpacker.exe diff --git a/font/editor.c b/font/editor.c index d9e2aaa5fc..e2aa646f3b 100644 --- a/font/editor.c +++ b/font/editor.c @@ -35,7 +35,7 @@ void blendpixel(unsigned *vid, int x, int y, int r, int g, int b, int a) vid[y*XRES+x] = (r<<16)|(g<<8)|b; } -int drawchar(unsigned *vid, int x, int y, int c, int r, int g, int b) +int drawchar(unsigned *vid, int x, int y, unsigned char c, int r, int g, int b) { int i, j; if (color[c]) @@ -50,7 +50,7 @@ int drawchar(unsigned *vid, int x, int y, int c, int r, int g, int b) return x + width[c]; } -int drawtext(unsigned *vid, int x, int y, char *s, int r, int g, int b) +int drawtext(unsigned *vid, int x, int y, const char *s, int r, int g, int b) { for (; *s; s++) x = drawchar(vid, x, y, *s, r, g, b); @@ -205,11 +205,11 @@ int sdl_poll() * MAIN PROGRAM * ***********************************************************/ -char *tag = "(c) 2008 Stanislaw Skowronek"; +const char *tag = "(c) 2008 Stanislaw Skowronek"; int main(int argc, char *argv[]) { - unsigned *vid_buf = calloc(XRES*YRES, sizeof(unsigned)); + unsigned *vid_buf = (unsigned*)calloc(XRES*YRES, sizeof(unsigned)); int x, y, b = 0, lb, c = 0xA0, i, j, dc = 0; int mode = 0; char hex[18] = "";