maxmods / bah.mod

A collection of BlitzMax modules by Brucey
25 stars 17 forks source link

Bah.Serial.mod Problems with BlitzMax NG #102

Open MidimasterSoft opened 1 year ago

MidimasterSoft commented 1 year ago

On Syntaxbomb a user reports heavy problems with the combination of current version of BlitzMax NG ( BlitzMax_win32_x64_mingw_0.136.3.51 ) with Bah.Serial.mod.

A test on 2 years old BlitzMax NG (BBC 0.129 BMK 3.45 Win32-x64 GCC 8.1.0) gave no such messages.

Here is a thread in syntaxbomb with detailed informations and discussion: https://www.syntaxbomb.com/blitz2d-blitzplus-blitz3d/serial-io-com-ports/

Compiler Log:


[ 16%] Compiling:glue.cpp
[ 16%] Compiling:list_win32.cpp
[ 80%] Compiling:regex.bmx.debug.win32.x86.c
[ 80%] Compiling:regex.bmx.debug.win32.x86.c
D:/BlitzMax/mod/Bah.mod/serial.mod/list_win32.cpp: In function 'void bmx_serial_listports(BBObject*)':
D:/BlitzMax/mod/Bah.mod/serial.mod/list_win32.cpp:86:80: error: invalid conversion from 'char*' to 'const unsigned char*' [-fpermissive]
  86 |                                        bbProductName = bbStringFromUTF8String((char*)buffer);
      |                                                                                ^~~~~~~~~~~~~
      |                                                                                |
      |                                                                                char*
In file included from D:/BlitzMax/mod/brl.mod/blitz.mod/blitz.h:37,
                from D:/BlitzMax/mod/Bah.mod/serial.mod/list_win32.cpp:41:
D:/BlitzMax/mod/brl.mod/blitz.mod/blitz_string.h:129:55: note:  initializing argument 1 of 'BBString* bbStringFromUTF8String(const unsigned char*)'
  129 | BBString*bbStringFromUTF8String( const unsigned char *p );
      |                                  ~~~~~~~~~~~~~~~~~~~~~^
D:/BlitzMax/mod/Bah.mod/serial.mod/list_win32.cpp:94:81: error: invalid conversion from 'char*' to 'const unsigned char*' [-fpermissive]
  94 |                                        bbPhysicalName = bbStringFromUTF8String((char*)buffer);
.... and man more lines like this... ```
GWRon commented 1 year ago

As I've written there (at syntaxbomb) the solution is to update the cast as 2 yrs ago the bbStringFromUTF8String-function was adjusted.

bbProductName = bbStringFromUTF8String((char)buffer); -> bbProductName = bbStringFromUTF8String((unsigned char)buffer);

bbPhysicalName = bbStringFromUTF8String((char)buffer); -> bbPhysicalName = bbStringFromUTF8String((unsigned char)buffer);

...

woollybah commented 1 year ago

See here : https://github.com/bmx-ng/io.mod

woollybah commented 1 year ago

We'll archive this module soon, I expect.