Skip to content

GetHTML wxString progresscolor[] bug - #803

Merged
got3nks merged 3 commits into
amule-org:masterfrom
ZiTAL:master
Aug 5, 2026
Merged

GetHTML wxString progresscolor[] bug#803
got3nks merged 3 commits into
amule-org:masterfrom
ZiTAL:master

Conversation

@ZiTAL

@ZiTAL ZiTAL commented Aug 5, 2026

Copy link
Copy Markdown

Summary

Bug compiling the web server:

cmake -B build \
  -DBUILD_MONOLITHIC=OFF \
  -DBUILD_DAEMON=ON \
  -DBUILD_AMULECMD=ON \
  -DBUILD_WEBSERVER=ON \
  -DBUILD_ED2K=ON \
  -DBUILD_REMOTEGUI=OFF
cmake --build build
...
/home/projects/amule/src/webserver/src/WebServer.cpp: In member function ‘virtual wxString CDynProgressImage::GetHTML()’:
/home/projects/amule/src/webserver/src/WebServer.cpp:1264:46: error: cannot convert ‘const char*’ to ‘wxChar*’ {aka ‘wchar_t*’} in initialization
 1264 |         static wxChar *progresscolor[12] = { "transparent.gif",
      |                                              ^~~~~~~~~~~~~~~~~
      |                                              |
      |                                              const char*
/home/projects/amule/src/webserver/src/WebServer.cpp:1265:17: error: cannot convert ‘const char*’ to ‘wxChar*’ {aka ‘wchar_t*’} in initialization
 1265 |                 "black.gif",
      |                 ^~~~~~~~~~~
      |                 |
      |                 const char*
/home/projects/amule/src/webserver/src/WebServer.cpp:1266:17: error: cannot convert ‘const char*’ to ‘wxChar*’ {aka ‘wchar_t*’} in initialization
 1266 |                 "yellow.gif",
      |                 ^~~~~~~~~~~~
      |                 |
      |                 const char*
/home/projects/amule/src/webserver/src/WebServer.cpp:1267:17: error: cannot convert ‘const char*’ to ‘wxChar*’ {aka ‘wchar_t*’} in initialization
 1267 |                 "red.gif",
      |                 ^~~~~~~~~
      |                 |
      |                 const char*
/home/projects/amule/src/webserver/src/WebServer.cpp:1268:17: error: cannot convert ‘const char*’ to ‘wxChar*’ {aka ‘wchar_t*’} in initialization
 1268 |                 "blue1.gif",
      |                 ^~~~~~~~~~~
      |                 |
      |                 const char*
/home/projects/amule/src/webserver/src/WebServer.cpp:1269:17: error: cannot convert ‘const char*’ to ‘wxChar*’ {aka ‘wchar_t*’} in initialization
 1269 |                 "blue2.gif",
      |                 ^~~~~~~~~~~
      |                 |
      |                 const char*
/home/projects/amule/src/webserver/src/WebServer.cpp:1270:17: error: cannot convert ‘const char*’ to ‘wxChar*’ {aka ‘wchar_t*’} in initialization
 1270 |                 "blue3.gif",
      |                 ^~~~~~~~~~~
      |                 |
      |                 const char*
/home/projects/amule/src/webserver/src/WebServer.cpp:1271:17: error: cannot convert ‘const char*’ to ‘wxChar*’ {aka ‘wchar_t*’} in initialization
 1271 |                 "blue4.gif",
      |                 ^~~~~~~~~~~
      |                 |
      |                 const char*
/home/projects/amule/src/webserver/src/WebServer.cpp:1272:17: error: cannot convert ‘const char*’ to ‘wxChar*’ {aka ‘wchar_t*’} in initialization
 1272 |                 "blue5.gif",
      |                 ^~~~~~~~~~~
      |                 |
      |                 const char*
/home/projects/amule/src/webserver/src/WebServer.cpp:1273:17: error: cannot convert ‘const char*’ to ‘wxChar*’ {aka ‘wchar_t*’} in initialization
 1273 |                 "blue6.gif",
      |                 ^~~~~~~~~~~
      |                 |
      |                 const char*
/home/projects/amule/src/webserver/src/WebServer.cpp:1274:17: error: cannot convert ‘const char*’ to ‘wxChar*’ {aka ‘wchar_t*’} in initialization
 1274 |                 "green.gif",
      |                 ^~~~~~~~~~~
      |                 |
      |                 const char*
/home/projects/amule/src/webserver/src/WebServer.cpp:1275:17: error: cannot convert ‘const char*’ to ‘wxChar*’ {aka ‘wchar_t*’} in initialization
 1275 |                 "greenpercent.gif" };
      |                 ^~~~~~~~~~~~~~~~~~
      |                 |
      |                 const char*
gmake[2]: *** [src/webserver/src/CMakeFiles/amuleweb.dir/build.make:247: src/webserver/src/CMakeFiles/amuleweb.dir/WebServer.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:762: src/webserver/src/CMakeFiles/amuleweb.dir/all] Error 2
gmake: *** [Makefile:136: all] Error 2

Test plan

iban@garapenaeus /home/projects/amule (master)> cmake --build build
[  0%] Built target amule_metainfo
[ 18%] Built target pofiles_1
[ 23%] Built target mulecommon
[ 23%] Built target pofiles
[ 24%] Built target mulesocket
[ 25%] Built target generate_ECTagTypes.h
[ 25%] Built target generate_ECCodes.h
[ 30%] Built target ec
[ 33%] Built target amulecmd
[ 42%] Built target muleappcommon
[ 47%] Built target webcommon
[ 59%] Built target muleappcore
[ 91%] Built target amuled
[ 93%] Built target ed2k
[ 93%] Building CXX object src/webserver/src/CMakeFiles/amuleweb.dir/WebServer.cpp.o
[ 94%] Building CXX object src/webserver/src/CMakeFiles/amuleweb.dir/WebSocket.cpp.o
[ 94%] Linking CXX executable amuleweb
[100%] Built target amuleweb

@got3nks

got3nks commented Aug 5, 2026

Copy link
Copy Markdown

Thanks @ZiTAL — the report is right, and the diagnosis is useful. That code sits in the #else branch of #ifdef WITH_LIBPNG (WebServer.cpp:1151-1314), so when libpng is present a completely different GetHTML() is compiled and the array never exists. WITH_LIBPNG is set solely by whether FindPNG succeeds, and every CI job has libpng — so nothing in CI ever compiles that branch, and it has been quietly broken.

One problem with the patch as it stands: it drops "transparent.gif", so the array goes from 12 entries to 11 and every index shifts by one. color_idx is only ever 1, 2, 3 or 4-9, so:

color_idx before after
1 black yellow
2 yellow red
3 red blue1
4-9 blue1-blue6 blue2-green

Index 0 is genuinely dead code, but removing it shifts everything above it — and this compiles cleanly, so CI would go green while every progress bar rendered the wrong colour.

Fix: keep all twelve entries and change only the type:

static const wxString progresscolor[] = { wxS("transparent.gif"), wxS("black.gif"), ... };

Minor: the new block is indented one tab deeper than the surrounding code, which clang-format will flag.

One thing worth knowing before you put more work into this: amuleweb is deprecated. It still ships in 3.1.0, but it is slated for removal in a future release. The replacement is amuleapi, and it is not only a REST + SSE daemon — it bundles and serves its own web frontend (downloads, search, clients, categories, preferences, networks, with i18n), so it covers what amuleweb does rather than just exposing an API underneath it. If the web side of aMule interests you, that is where the effort will hold its value, and it is a far more pleasant thing to work on than the template engine.

@ZiTAL

ZiTAL commented Aug 5, 2026

Copy link
Copy Markdown
Author

thank you @got3nks , I think now is OK, but you can edit by your own to fix my blunders...

Element 0 was left as a bare narrow literal while the other eleven were
converted, and a stray tab before the closing brace fails the
clang-format gate.

Both are cosmetic here -- wxString has a const char* constructor and the
text is ASCII -- but a high-byte literal converted through the current
locale can come out empty on a UTF-8 POSIX system, so the array is
better off consistent.
@got3nks

got3nks commented Aug 5, 2026

Copy link
Copy Markdown

Pushed two small fixes onto your branch (heads up: your PR head is your fork's master, so the commit landed there): wxS() on the first entry for consistency with the other eleven, and a stray tab that was failing the clang-format gate.

Verified both ways with WITH_LIBPNG toggled in the generated config.h — master fails there with exactly your errors, this branch builds clean, and the libpng path still builds too. Merging once CI is green.

@ZiTAL

ZiTAL commented Aug 5, 2026

Copy link
Copy Markdown
Author

oh my god i'm fucking retarded

@got3nks
got3nks merged commit 3887cd5 into amule-org:master Aug 5, 2026
14 checks passed
@got3nks

got3nks commented Aug 5, 2026

Copy link
Copy Markdown

No worries @ZiTAL, PR is merged now. 😂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants