Closed mitchcurtis closed 4 years ago
Thank you for this. Those seem like easy fixes. I'll do something about it ASAP, but I don't know if it would be before the weekend.
I just pushed a version that fixed the compiler warnings you listed. I don't have access to a macOS development environment, but I reproduced the warnings just fine on GCC on my dev machine
I also added -Wextra
to the CFLAGS
in the makefile so that these kinds of warnings don't happen in the future.
There are still some warnings related to variable 'h' might be clobbered by 'longjmp'
that I will fix later, so I won't close this ticket yet.
I just tried out the new bmp.c on macOS, but got an error:
20:17:20: Running steps for project slate... compiling bmp.c [lib] compiling bmp.c [test-app] /usr/bin/gcc -O2 -Wall -Wextra -target x86_64-apple-macosx10.7-macho -F/Users/mitch/dev/qt5-slate-fw/qtbase/lib -F/Users/mitch/dev/qt5-slate-fw/qtbase/lib -F/Users/mitch/dev/qt5-slate-fw/qtbase/lib -F/Users/mitch/dev/qt5-slate-fw/qtbase/lib -F/Users/mitch/dev/qt5-slate-fw/qtbase/lib -F/Users/mitch/dev/qt5-slate-fw/qtbase/lib -F/Users/mitch/dev/qt5-slate-fw/qtbase/lib -F/Users/mitch/dev/qt5-slate-fw/qtbase/lib -pipe -fvisibility=default -fPIC -DNDEBUG -DQT_DEPRECATED_WARNINGS -DQT_CORE_LIB -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_QML_LIB -DQT_QMLTEST_LIB -DQT_TESTLIB_LIB -DQT_WIDGETS_LIB -DQT_QUICK_LIB -I/Users/mitch/dev/slate/app -I/Users/mitch/dev/slate/tests/shared -I/Users/mitch/dev/slate/lib/3rdparty -I/Users/mitch/dev/qt5-slate-fw/qtbase/include -I/Users/mitch/dev/qt5-slate-fw/qtbase/include/QtCore -I/Users/mitch/dev/qt5-slate/qtbase/mkspecs/macx-clang -I/Users/mitch/dev/slate-qt5_slate_fw-Release/Release/test-app.99bdad93/qt.headers -I/Users/mitch/dev/qt5-slate-fw/qtbase/include/QtCore/5.13.1 -I/Users/mitch/dev/qt5-slate-fw/qtbase/include/QtCore/5.13.1/QtCore -I/Users/mitch/dev/qt5-slate-fw/qtbase/include/QtGui -I/Users/mitch/dev/qt5-slate-fw/qtbase/include/QtNetwork -I/Users/mitch/dev/qt5-slate-fw/qtbase/include/QtQml -I/Users/mitch/dev/qt5-slate-fw/qtbase/include/QtQml/5.13.1 -I/Users/mitch/dev/qt5-slate-fw/qtbase/include/QtQml/5.13.1/QtQml -I/Users/mitch/dev/qt5-slate-fw/qtbase/include/QtQuickTest -I/Users/mitch/dev/qt5-slate-fw/qtbase/include/QtTest -I/Users/mitch/dev/qt5-slate-fw/qtbase/include/QtWidgets -I/Users/mitch/dev/qt5-slate-fw/qtbase/include/QtQuick -I/Users/mitch/dev/slate/lib -o /Users/mitch/dev/slate-qt5_slate_fw-Release/Release/test-app.99bdad93/7562038ad4e26393/bmp.c.o -c /Users/mitch/dev/slate/lib/3rdparty/bitmap/bmp.c /Users/mitch/dev/slate/lib/3rdparty/bitmap/bmp.c:69:20: error: static declaration of 'bm_last_error' follows non-static declaration static const char bm_last_error = "no error"; ^ /Users/mitch/dev/slate/lib/3rdparty/bitmap/bmp.h:68:20: note: previous declaration is here extern const char bm_last_error; ^ 1 error generated.
Thanks for fixing these by the way! :D
Hi @mitchcurtis,
You need to get the latest version of bmp.h
as well.
Among the recent changes, I changed the variable bm_last_error
to be static within bmp.c
and only expose it througn a new function bm_get_error()
to make my API cleaner.
It seems you have a previous version of bmp.h
where bm_last_error
is still being exposed in the header.
Ah, sorry! I was looking at that one commit but I guess I missed some!
I found some other warnings, but I dunno if this is how you want them fixed:
diff --git a/lib/3rdparty/bitmap/misc/gif.c b/lib/3rdparty/bitmap/misc/gif.c
index 12ce389..ea44588 100644
--- a/lib/3rdparty/bitmap/misc/gif.c
+++ b/lib/3rdparty/bitmap/misc/gif.c
@@ -120,7 +120,7 @@ static GIF *gif_load_fp(FILE *fp) {
GIF_FILE file;
/* From the packed fields in the logical screen descriptor */
- int gct, col_res, sort_flag, sgct;
+ size_t gct, col_res, sort_flag, sgct;
float aspect_ratio;
struct gif_triplet *palette = NULL;
@@ -203,7 +203,7 @@ static GIF *gif_load_fp(FILE *fp) {
output(stdout, "Global Color Table: %d entries\n", sgct);
if(gif_verbose > 1) {
- int i;
+ size_t i;
for(i = 0; i < sgct; i++) {
output(stdout, " %3d: %02X %02X %02X\n", i, palette[i].r, palette[i].g, palette[i].b);
}
@@ -325,7 +325,7 @@ static int gif_read_image(FILE *fp, GIF_FILE *file, struct gif_triplet *ct, int
GIF_ID gif_id;
/* Packed fields in the Image Descriptor */
- int lct, intl, sort, slct;
+ size_t lct, intl, sort, slct;
memset(&gce, 0, sizeof gce);
@@ -368,7 +368,7 @@ static int gif_read_image(FILE *fp, GIF_FILE *file, struct gif_triplet *ct, int
output(stdout, "Local Color Table: %d entries\n", slct);
if(gif_verbose > 1) {
- int i;
+ size_t i;
for(i = 0; i < slct; i++) {
output(stdout, " %3d: %02X %02X %02X\n", i, ct[i].r, ct[i].g, ct[i].b);
}
@@ -832,7 +832,7 @@ static int gif_save_fp(GIF *g, FILE *f) {
GIF_FILE file;
GIF_GCE gce;
GIF_ID gif_id;
- int nc, sgct, bg;
+ unsigned int nc, sgct, bg;
struct gif_triplet gct[256];
unsigned char code_size = 0x08;
Bitmap *b = g->n > 0 ? g->frames[0].image : NULL;
@@ -971,7 +971,7 @@ static int gif_save_fp(GIF *g, FILE *f) {
int x, y, p = 0;
for(y = 0; y < b->h; y++) {
for(x = 0; x < b->w; x++) {
- int i;
+ unsigned int i;
int c = bm_get(b, x, y);
i = bsrch_palette_lookup(gct, c, 0, nc - 1);
/* At this point in time, the color MUST be in the palette */
I can submit it as a pull request if you want?
Hi @mitchcurtis , Yes, please submit a pull request. Thanks
When building as part of a C++ project on macOS:
Compiler version: