From 11df0257a5de1fdd3c4d0763b1faafa823f82b9e Mon Sep 17 00:00:00 2001 From: Ahmad Khalifa Date: Sun, 9 Feb 2025 19:03:21 +0000 Subject: [PATCH 1/4] e/g/Allegro5/hello.bas: fix coredump due to version Allegro5 seg faults when it's initialised with an older version. Change the example to init with current version. Note: this is probably better to fix in the header file inc/allegro5.bi, but that may need more testing --- examples/graphics/Allegro5/hello.bas | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/graphics/Allegro5/hello.bas b/examples/graphics/Allegro5/hello.bas index 94de2a5f91..fd394f742a 100644 --- a/examples/graphics/Allegro5/hello.bas +++ b/examples/graphics/Allegro5/hello.bas @@ -6,7 +6,8 @@ var TTF_FONT = exepath() + "/../SDL/data/Vera.ttf" -al_init() +'' al_init() '' defined with v5.0.11, initialise with current version instead +al_install_system(al_get_allegro_version(), @atexit) al_init_font_addon() al_init_ttf_addon() From a460aa62426248f7a9e4fd18b0b5d5445df62311 Mon Sep 17 00:00:00 2001 From: Ahmad Khalifa Date: Sun, 9 Feb 2025 19:41:58 +0000 Subject: [PATCH 2/4] e/g/cairo: fix coredump on initialisation Cairo examples are calculating the 'stride' using the size of Integer, which is not lining up correctly and seg faults. Replace with cairo's own stride calculation. Fixes sf# 932 --- examples/graphics/cairo/cairo_elipsis.bas | 2 +- examples/graphics/cairo/cairo_output.bas | 2 +- examples/graphics/cairo/clock.bas | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/graphics/cairo/cairo_elipsis.bas b/examples/graphics/cairo/cairo_elipsis.bas index bab045edf1..b347541f4c 100644 --- a/examples/graphics/cairo/cairo_elipsis.bas +++ b/examples/graphics/cairo/cairo_elipsis.bas @@ -90,7 +90,7 @@ VAR S_W = CUINT(Pag_W) + 1, S_H = CUINT(Pag_H) + 1 SCREENRES S_W, S_H, 32 VAR c_s_t = cairo_image_surface_create_for_data( _ SCREENPTR, CAIRO_FORMAT_ARGB32, _ - S_W, S_H, S_W * LEN(INTEGER)) + S_W, S_H, cairo_format_stride_for_width(CAIRO_FORMAT_ARGB32, S_W)) VAR wi = 0.0 DO SCREENLOCK diff --git a/examples/graphics/cairo/cairo_output.bas b/examples/graphics/cairo/cairo_output.bas index f50b5dae15..dcee7d24f0 100644 --- a/examples/graphics/cairo/cairo_output.bas +++ b/examples/graphics/cairo/cairo_output.bas @@ -101,7 +101,7 @@ SUB write_screen() SCREENRES S_W, S_H, 32 VAR c_s_t = cairo_image_surface_create_for_data( _ SCREENPTR, CAIRO_FORMAT_ARGB32, _ - S_W, S_H, S_W * LEN(INTEGER)) + S_W, S_H, cairo_format_stride_for_width(CAIRO_FORMAT_ARGB32, S_W)) SCREENLOCK DoDrawing(c_s_t) SCREENUNLOCK diff --git a/examples/graphics/cairo/clock.bas b/examples/graphics/cairo/clock.bas index 1ada06ee0c..84e9c395d6 100644 --- a/examples/graphics/cairo/clock.bas +++ b/examples/graphics/cairo/clock.bas @@ -17,7 +17,7 @@ ScreenRes SCREEN_W, SCREEN_H, 32 Dim As cairo_surface_t Ptr surface = _ cairo_image_surface_create_for_data(ScreenPtr(), _ CAIRO_FORMAT_ARGB32, SCREEN_W, SCREEN_H, _ - SCREEN_W * SizeOf(Integer)) + cairo_format_stride_for_width(CAIRO_FORMAT_ARGB32, SCREEN_W)) Dim As cairo_t Ptr c = cairo_create(surface) cairo_scale(c, SCREEN_W, SCREEN_H) From 7b31c61f349e3e60cc4d2ebad0815293362df695 Mon Sep 17 00:00:00 2001 From: Ahmad Khalifa Date: Sat, 22 Feb 2025 16:02:04 +0000 Subject: [PATCH 3/4] e/n/http-get: Add missing crt header for perror() This allows it to compile on non-Win32. Additionally, sort headers alphabetically. --- examples/network/http-get.bas | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/network/http-get.bas b/examples/network/http-get.bas index 2a59032e66..ed7b4292d8 100644 --- a/examples/network/http-get.bas +++ b/examples/network/http-get.bas @@ -5,10 +5,11 @@ #ifdef __FB_WIN32__ #include once "win/winsock2.bi" #else +#include once "crt/arpa/inet.bi" #include once "crt/netdb.bi" -#include once "crt/sys/socket.bi" #include once "crt/netinet/in.bi" -#include once "crt/arpa/inet.bi" +#include once "crt/stdio.bi" +#include once "crt/sys/socket.bi" #include once "crt/unistd.bi" #endif From 8008944b7e65c21ab5d314c418f2a2c240d8ba7a Mon Sep 17 00:00:00 2001 From: Ahmad Khalifa Date: Sat, 22 Feb 2025 16:43:30 +0000 Subject: [PATCH 4/4] e/n/curl: Fix static lib build before test program - Remove inclib from header to allow it to build without looking for a dynamic library - Update makefile to build static library first before test --- examples/Makefile | 11 +++++++++-- examples/network/curl/CHttp/CHttp.bi | 3 +-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/examples/Makefile b/examples/Makefile index 579b697002..3e69c0f343 100644 --- a/examples/Makefile +++ b/examples/Makefile @@ -42,8 +42,8 @@ GUI := $(subst .bas,,$(wildcard GUI/*/*.bas GUI/*/*/*.bas)) MANUAL := $(subst .bas,,$(wildcard manual/*.bas manual/*/*.bas)) MATH := $(subst .bas,,$(wildcard math/*.bas math/*/*.bas)) MISC := $(subst .bas,,$(wildcard misc/*/*.bas)) -NETWORK := $(subst .bas,,$(wildcard network/*.bas network/*/*.bas \ - network/*/*/*.bas)) +NETWORK := $(subst .bas,,$(wildcard network/*.bas network/*/*.bas)) \ + network/curl/CHttp/libCHttp.a network/curl/CHttp/test #OPTIMIZE := $(subst .bas,,$(wildcard OptimizePureAbstractTypes/*.bas)) #REGEX := $(subst .bas,,$(wildcard regex/*/*.bas)) SOUND := $(subst .bas,,$(wildcard sound/*/*.bas)) @@ -107,6 +107,13 @@ DOS/%: DOS/%.bas endif endif +network/curl/CHttp/libCHttp.a: network/curl/CHttp/CHttp.bas \ + network/curl/CHttp/CHttpForm.bas network/curl/CHttp/CHttpStream.bas + $(FBC) -lib $^ + +network/curl/CHttp/test: network/curl/CHttp/libCHttp.a + $(FBC) -p $(dir $@) $@.bas $< + threads/timer-lib/libtimer$(DLLEXT): threads/timer-lib/timer.bas $(FBC) -dylib -mt $< diff --git a/examples/network/curl/CHttp/CHttp.bi b/examples/network/curl/CHttp/CHttp.bi index d1d19ff337..604bc1cd36 100644 --- a/examples/network/curl/CHttp/CHttp.bi +++ b/examples/network/curl/CHttp/CHttp.bi @@ -10,7 +10,6 @@ #define FALSE 0 #endif -#inclib "CHttp" #inclib "curl" type CHttp as CHttp_ @@ -44,4 +43,4 @@ private: dim as CHttpCtx ptr ctx = any end type -#endif \ No newline at end of file +#endif