Re: [Iup-users] IUP trunk=iup_dlglist.c (dereferencing a potential null pointer)

2019-11-04 Thread Ranier VF
Hi,
"I am also looking for an IUP build that works with MSVC 2017.  In my case I
really need a 32-bit build (although I'm also interested in a 64-bit build).
If you work out how to build under MSBC 2017 (64 bit, or 32, but ideally
both), please let me know how you did it.  I spent some time on this a few
months back and gave up when I ran out of time.  Thank you."
Sorry, but I still have trouble with msvc 2017.

Working compilation only with Mingw64.

Best regards,
Ranier Vilela


De: Simon Orde 
Enviado: segunda-feira, 4 de novembro de 2019 18:18
Para: 'IUP discussion list.'
Assunto: Re: [Iup-users] IUP trunk=iup_dlglist.c (dereferencing a potential 
null pointer)

Hi Ranier

I am also looking for an IUP build that works with MSVC 2017.  In my case I
really need a 32-bit build (although I'm also interested in a 64-bit build).
If you work out how to build under MSBC 2017 (64 bit, or 32, but ideally
both), please let me know how you did it.  I spent some time on this a few
months back and gave up when I ran out of time.  Thank you.

Antonio, I know you're bringing out a build of IUP binaries - any idea when
that will be?

All the best

Simon


-Original Message-
From: Ranier VF [mailto:ranier_...@hotmail.com]
Sent: 04 November 2019 4:52 PM
To: IUP discussion list.
Subject: [Iup-users] IUP trunk=iup_dlglist.c (dereferencing a potential null
pointer)

Hi,
Dereferencing a potential null pointer (ih_array), lines 122, 116.

--- \dll\iup\a\src\iup_dlglist.cThu Jul 25 16:27:06 2019
+++ iup_dlglist.c   Mon Nov 04 13:47:53 2019
@@ -115,7 +115,7 @@
   int i = 0, count;
   Ihandle** ih_array = (Ihandle**)malloc(idlg_count * sizeof(Ihandle*));
   Idiallst *list;
-  for (list = idlglist; list; list = list->next)
+  for (list = idlglist; list && i < idlg_count; list = list->next)
   {
 if (iupObjectCheck(list->ih))
 {

Thanks.
Ranier Vilela



___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


[Iup-users] IUP trunk=iup_dlglist.c (dereferencing a potential null pointer)

2019-11-04 Thread Ranier VF
Hi, 
Dereferencing a potential null pointer (ih_array), lines 122, 116.

--- \dll\iup\a\src\iup_dlglist.cThu Jul 25 16:27:06 2019
+++ iup_dlglist.c   Mon Nov 04 13:47:53 2019
@@ -115,7 +115,7 @@
   int i = 0, count;
   Ihandle** ih_array = (Ihandle**)malloc(idlg_count * sizeof(Ihandle*));
   Idiallst *list;
-  for (list = idlglist; list; list = list->next)
+  for (list = idlglist; list && i < idlg_count; list = list->next)
   {
 if (iupObjectCheck(list->ih))
 {

Thanks.
Ranier Vilela

iup_dlglist.patch
Description: iup_dlglist.patch
___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


[Iup-users] IUP trunk=iup_attrib.c (dererencing a potential null pointer)

2019-11-04 Thread Ranier VF
Hi,
Dererencing a potential null pointer at line 294.

--- \dll\iup\a\src\iup_attrib.c Thu Oct 03 21:48:51 2019
+++ iup_attrib.cMon Nov 04 13:51:57 2019
@@ -287,12 +287,12 @@
 
   /* store the names before updating so we can add or remove attributes during 
the update */
   name = iupTableFirst(ih->attrib);
-  while (name)
+  while (name && i < count)
   {
 if (!iupATTRIB_ISINTERNAL(name))
 {
   name_array[i] = name;
-  i++;
+  ++i;
 }
 
 name = iupTableNext(ih->attrib);

Thanks.
Ranier Vilela

iup_atrrib.patch
Description: iup_atrrib.patch
___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


Re: [Iup-users] IUP Compilation with msvc 2017

2019-11-04 Thread Ranier VF
Hi Scuri,
"  From a past experience, it is not the iup_array.c that is not being found. 
It a visual c++ dependency. That's why I suggested the shortcut also."
Thanks solved with Ming64, your right.

Thank you.
Ranier Vilela


De: Antonio Scuri 
Enviado: segunda-feira, 4 de novembro de 2019 15:35
Para: IUP discussion list.
Assunto: Re: [Iup-users] IUP Compilation with msvc 2017

  Hi,

  From a past experience, it is not the iup_array.c that is not being found. It 
a visual c++ dependency. That's why I suggested the shortcut also.

  One good test is to to copy that command line, and manually run it in a 
regular prompt.

Best,
Scuri


Em seg, 4 de nov de 2019 12:28, Ranier VF 
mailto:ranier_...@hotmail.com>> escreveu:
Hi Scuri,
"Or the shortcut "Developer Command Prompt for VS 2017"."
Yes this, this is being done.
But the compilation still stop at iup_array.c

Thanks.
Ranier Vilela


De: Antonio Scuri mailto:antonio.sc...@gmail.com>>
Enviado: segunda-feira, 4 de novembro de 2019 15:09
Para: IUP discussion list.
Assunto: Re: [Iup-users] IUP Compilation with msvc 2017

  Hi,

  The folders are not being created because the GNU mkdir must be installed. 
The cmd internal mkdir will not work. For now, our build system is based on 
GNU, so we need GNU compatible tools. We are considering moving to CMake in a 
near future.

  But now you will need to download MSYS too. See:

http://www.msys2.org/

  Also when building for Visual C++ in the command line you will need to run 
vcvars*.bat or VsDevCmd.bat before. Or the shortcut "Developer Command Prompt 
for VS 2017".

Best,
Scuri


Em seg., 4 de nov. de 2019 às 10:31, Ranier VF 
mailto:ranier_...@hotmail.com><mailto:ranier_...@hotmail.com<mailto:ranier_...@hotmail.com>>>
 escreveu:
Hi,
Some progress, after creating manually all obj and lib.

E:\dll\iup\iup>win-make --debug
GNU Make 4.1
Built for i686-w64-mingw32
Copyright (C) 1988-2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Reading makefiles...
Updating goal targets
 File 'do_all' does not exist.
   File 'iup' does not exist.
  Must remake target 'iup'.
GNU Make 4.1
Built for i686-w64-mingw32
Copyright (C) 1988-2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Reading makefiles...
Updating goal targets
 File 'iup' does not exist.
Must remake target 'iup'.
GNU Make 4.1
Built for i686-w64-mingw32
Copyright (C) 1988-2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Reading makefiles...
Updating goal targets
 File 'build' does not exist.
   File 'tecmake' does not exist.
 File 'print-start' does not exist.
Must remake target 'print-start'.
''; echo 'Tecmake: Starting [ iup:dll15 ]'
Successfully remade target file 'print-start'.
 File 'system-check' does not exist.
Must remake target 'system-check'.
Successfully remade target file 'system-check'.
 File 'directories' does not exist.
Must remake target 'directories'.
Successfully remade target file 'directories'.
 File 'dynamic-lib' does not exist.
   File '../lib/dll15/iup.dll' does not exist.
 File '../obj/dll15/iup_array.obj' does not exist.
Must remake target '../obj/dll15/iup_array.obj'.
''; echo Tecmake: compiling iup_array.c ...
c:/progra~2/micros~2/2017/community/bin/Hostx86/x86/cl -nologo  -c -Fo../obj/dll
15/ -W3 -EHsc -MD -O2 -GL -I../include -I. -Iwin/wdl -Iwin -I../etc -Ic:/progra~
2/wi3cf2~1/10/include/10.0.17134.0/ucrt -Ic:/progra~2/wi3cf2~1/10/include/10.0.1
7134.0/shared -Ic:/progra~2/wi3cf2~1/10/include/10.0.17134.0/um -Ic:/progra~2/mi
cros~2/2017/community/include  -DCOBJMACROS -D_UNICODE -DUSE_NEW_DRAW -D_WIN32_W
INNT=0x0501 -D_WIN32_IE=0x600 -DWINVER=0x0501 -DNOTREEVIEW -DUNICODE -DIUP_DLL -
DTEC_UNAME=dll15 -DTEC_SYSNAME=Win32 -DTEC_LITTLEENDIAN -DTEC_32 -DWIN32 -DMSVC1
5 -D_CRT_SECURE_NO_DEPRECATE -D_CPP_NARROW_INLINES_DEFINED -DNDEBUG iup_array.c
process_begin: CreateProcess(NULL, c:/progra~2/micros~2/2017/community/bin/Hostx
86/x86/cl -nologo -c -Fo../obj/dll15/ -W3 -EHsc -MD -O2 -GL -I../include -I. -Iw
in/wdl -Iwin -

Re: [Iup-users] IUP Compilation with msvc 2017

2019-11-04 Thread Ranier VF
Hi Scuri,
With --trace enabled

E:\dll\iup\iup>win-make --trace
makefile:9: target 'iup' does not exist
win-make --no-print-directory -C ./src/ iup
makefile:12: target 'iup' does not exist
win-make --no-print-directory -f ../tecmakewin.mak TEC_UNAME=dll15
../tecmakewin.mak:244: target 'print-start' does not exist
echo ''; echo 'Tecmake: Starting [ iup:dll15 ]'
''; echo 'Tecmake: Starting [ iup:dll15 ]'
../tecmakewin.mak:1706: update target '../obj/dll15/iup_array.obj' due to: iup_a
rray.c
echo ''; echo Tecmake: compiling iup_array.c ...
''; echo Tecmake: compiling iup_array.c ...
c:/progra~2/micros~2/2017/community/bin/Hostx86/x86/cl -nologo  -c -Fo../obj/dll
15/ -W3 -EHsc -MD -O2 -GL -I../include -I. -Iwin/wdl -Iwin -I../etc -Ic:/progra~
2/wi3cf2~1/10/include/10.0.17134.0/ucrt -Ic:/progra~2/wi3cf2~1/10/include/10.0.1
7134.0/shared -Ic:/progra~2/wi3cf2~1/10/include/10.0.17134.0/um -Ic:/progra~2/mi
cros~2/2017/community/include  -DCOBJMACROS -D_UNICODE -DUSE_NEW_DRAW -D_WIN32_W
INNT=0x0501 -D_WIN32_IE=0x600 -DWINVER=0x0501 -DNOTREEVIEW -DUNICODE -DIUP_DLL -
DTEC_UNAME=dll15 -DTEC_SYSNAME=Win32 -DTEC_LITTLEENDIAN -DTEC_32 -DWIN32 -DMSVC1
5 -D_CRT_SECURE_NO_DEPRECATE -D_CPP_NARROW_INLINES_DEFINED -DNDEBUG iup_array.c
process_begin: CreateProcess(NULL, c:/progra~2/micros~2/2017/community/bin/Hostx
86/x86/cl -nologo -c -Fo../obj/dll15/ -W3 -EHsc -MD -O2 -GL -I../include -I. -Iw
in/wdl -Iwin -I../etc -Ic:/progra~2/wi3cf2~1/10/include/10.0.17134.0/ucrt -Ic:/p
rogra~2/wi3cf2~1/10/include/10.0.17134.0/shared -Ic:/progra~2/wi3cf2~1/10/includ
e/10.0.17134.0/um -Ic:/progra~2/micros~2/2017/community/include -DCOBJMACROS -D_
UNICODE -DUSE_NEW_DRAW -D_WIN32_WINNT=0x0501 -D_WIN32_IE=0x600 -DWINVER=0x0501 -
DNOTREEVIEW -DUNICODE -DIUP_DLL -DTEC_UNAME=dll15 -DTEC_SYSNAME=Win32 -DTEC_LITT
LEENDIAN -DTEC_32 -DWIN32 -DMSVC15 -D_CRT_SECURE_NO_DEPRECATE -D_CPP_NARROW_INLI
NES_DEFINED -DNDEBUG iup_array.c, ...) failed.
make (e=2): O sistema nÒo pode encontrar o arquivo especificado.
../tecmakewin.mak:1706: recipe for target '../obj/dll15/iup_array.obj' failed
win-make[2]: *** [../obj/dll15/iup_array.obj] Error 2
makefile:12: recipe for target 'iup' failed
win-make[1]: *** [iup] Error 2
makefile:9: recipe for target 'iup' failed
win-make: *** [iup] Error 2

E:\dll\iup\iup>


De: Ranier VF 
Enviado: segunda-feira, 4 de novembro de 2019 15:28
Para: IUP discussion list.
Assunto: Re: [Iup-users] IUP Compilation with msvc 2017

Hi Scuri,
"Or the shortcut "Developer Command Prompt for VS 2017"."
Yes this, this is being done.
But the compilation still stop at iup_array.c

Thanks.
Ranier Vilela


De: Antonio Scuri 
Enviado: segunda-feira, 4 de novembro de 2019 15:09
Para: IUP discussion list.
Assunto: Re: [Iup-users] IUP Compilation with msvc 2017

  Hi,

  The folders are not being created because the GNU mkdir must be installed. 
The cmd internal mkdir will not work. For now, our build system is based on 
GNU, so we need GNU compatible tools. We are considering moving to CMake in a 
near future.

  But now you will need to download MSYS too. See:

http://www.msys2.org/

  Also when building for Visual C++ in the command line you will need to run 
vcvars*.bat or VsDevCmd.bat before. Or the shortcut "Developer Command Prompt 
for VS 2017".

Best,
Scuri


Em seg., 4 de nov. de 2019 às 10:31, Ranier VF 
mailto:ranier_...@hotmail.com>> escreveu:
Hi,
Some progress, after creating manually all obj and lib.

E:\dll\iup\iup>win-make --debug
GNU Make 4.1
Built for i686-w64-mingw32
Copyright (C) 1988-2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Reading makefiles...
Updating goal targets
 File 'do_all' does not exist.
   File 'iup' does not exist.
  Must remake target 'iup'.
GNU Make 4.1
Built for i686-w64-mingw32
Copyright (C) 1988-2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Reading makefiles...
Updating goal targets
 File 'iup' does not exist.
Must remake target 'iup'.
GNU Make 4.1
Built for i686-w64-mingw32
Copyright (C) 1988-2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Reading makefiles...
Updating goal targets
 File 'build' does not exist.
  

Re: [Iup-users] IUP Compilation with msvc 2017

2019-11-04 Thread Ranier VF
Hi Scuri,
"Or the shortcut "Developer Command Prompt for VS 2017"."
Yes this, this is being done.
But the compilation still stop at iup_array.c

Thanks.
Ranier Vilela


De: Antonio Scuri 
Enviado: segunda-feira, 4 de novembro de 2019 15:09
Para: IUP discussion list.
Assunto: Re: [Iup-users] IUP Compilation with msvc 2017

  Hi,

  The folders are not being created because the GNU mkdir must be installed. 
The cmd internal mkdir will not work. For now, our build system is based on 
GNU, so we need GNU compatible tools. We are considering moving to CMake in a 
near future.

  But now you will need to download MSYS too. See:

http://www.msys2.org/

  Also when building for Visual C++ in the command line you will need to run 
vcvars*.bat or VsDevCmd.bat before. Or the shortcut "Developer Command Prompt 
for VS 2017".

Best,
Scuri


Em seg., 4 de nov. de 2019 às 10:31, Ranier VF 
mailto:ranier_...@hotmail.com>> escreveu:
Hi,
Some progress, after creating manually all obj and lib.

E:\dll\iup\iup>win-make --debug
GNU Make 4.1
Built for i686-w64-mingw32
Copyright (C) 1988-2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Reading makefiles...
Updating goal targets
 File 'do_all' does not exist.
   File 'iup' does not exist.
  Must remake target 'iup'.
GNU Make 4.1
Built for i686-w64-mingw32
Copyright (C) 1988-2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Reading makefiles...
Updating goal targets
 File 'iup' does not exist.
Must remake target 'iup'.
GNU Make 4.1
Built for i686-w64-mingw32
Copyright (C) 1988-2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Reading makefiles...
Updating goal targets
 File 'build' does not exist.
   File 'tecmake' does not exist.
 File 'print-start' does not exist.
Must remake target 'print-start'.
''; echo 'Tecmake: Starting [ iup:dll15 ]'
Successfully remade target file 'print-start'.
 File 'system-check' does not exist.
Must remake target 'system-check'.
Successfully remade target file 'system-check'.
 File 'directories' does not exist.
Must remake target 'directories'.
Successfully remade target file 'directories'.
 File 'dynamic-lib' does not exist.
   File '../lib/dll15/iup.dll' does not exist.
 File '../obj/dll15/iup_array.obj' does not exist.
Must remake target '../obj/dll15/iup_array.obj'.
''; echo Tecmake: compiling iup_array.c ...
c:/progra~2/micros~2/2017/community/bin/Hostx86/x86/cl -nologo  -c -Fo../obj/dll
15/ -W3 -EHsc -MD -O2 -GL -I../include -I. -Iwin/wdl -Iwin -I../etc -Ic:/progra~
2/wi3cf2~1/10/include/10.0.17134.0/ucrt -Ic:/progra~2/wi3cf2~1/10/include/10.0.1
7134.0/shared -Ic:/progra~2/wi3cf2~1/10/include/10.0.17134.0/um -Ic:/progra~2/mi
cros~2/2017/community/include  -DCOBJMACROS -D_UNICODE -DUSE_NEW_DRAW -D_WIN32_W
INNT=0x0501 -D_WIN32_IE=0x600 -DWINVER=0x0501 -DNOTREEVIEW -DUNICODE -DIUP_DLL -
DTEC_UNAME=dll15 -DTEC_SYSNAME=Win32 -DTEC_LITTLEENDIAN -DTEC_32 -DWIN32 -DMSVC1
5 -D_CRT_SECURE_NO_DEPRECATE -D_CPP_NARROW_INLINES_DEFINED -DNDEBUG iup_array.c
process_begin: CreateProcess(NULL, c:/progra~2/micros~2/2017/community/bin/Hostx
86/x86/cl -nologo -c -Fo../obj/dll15/ -W3 -EHsc -MD -O2 -GL -I../include -I. -Iw
in/wdl -Iwin -I../etc -Ic:/progra~2/wi3cf2~1/10/include/10.0.17134.0/ucrt -Ic:/p
rogra~2/wi3cf2~1/10/include/10.0.17134.0/shared -Ic:/progra~2/wi3cf2~1/10/includ
e/10.0.17134.0/um -Ic:/progra~2/micros~2/2017/community/include -DCOBJMACROS -D_
UNICODE -DUSE_NEW_DRAW -D_WIN32_WINNT=0x0501 -D_WIN32_IE=0x600 -DWINVER=0x0501 -
DNOTREEVIEW -DUNICODE -DIUP_DLL -DTEC_UNAME=dll15 -DTEC_SYSNAME=Win32 -DTEC_LITT
LEENDIAN -DTEC_32 -DWIN32 -DMSVC15 -D_CRT_SECURE_NO_DEPRECATE -D_CPP_NARROW_INLI
NES_DEFINED -DNDEBUG iup_array.c, ...) failed.
make (e=2): O sistema nÒo pode encontrar o arquivo especificado.
../tecmakewin.mak:1706: recipe for target '../obj/dll15/iup_array.obj' failed
win-make[2]: *** [../obj/dll15/iup_array.obj] Error 2
makefile:12: recipe for target 'iup' failed
win-make[1]: *** [iup] Error 2
makefile:9: recipe for target 'iup' failed
win-make: *** [iup] Error 2

File iup_array.

Re: [Iup-users] IUP Compilation with msvc 2017

2019-11-04 Thread Ranier VF
Hi, 
Some progress, after creating manually all obj and lib.

E:\dll\iup\iup>win-make --debug
GNU Make 4.1
Built for i686-w64-mingw32
Copyright (C) 1988-2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Reading makefiles...
Updating goal targets
 File 'do_all' does not exist.
   File 'iup' does not exist.
  Must remake target 'iup'.
GNU Make 4.1
Built for i686-w64-mingw32
Copyright (C) 1988-2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Reading makefiles...
Updating goal targets
 File 'iup' does not exist.
Must remake target 'iup'.
GNU Make 4.1
Built for i686-w64-mingw32
Copyright (C) 1988-2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Reading makefiles...
Updating goal targets
 File 'build' does not exist.
   File 'tecmake' does not exist.
 File 'print-start' does not exist.
Must remake target 'print-start'.
''; echo 'Tecmake: Starting [ iup:dll15 ]'
Successfully remade target file 'print-start'.
 File 'system-check' does not exist.
Must remake target 'system-check'.
Successfully remade target file 'system-check'.
 File 'directories' does not exist.
Must remake target 'directories'.
Successfully remade target file 'directories'.
 File 'dynamic-lib' does not exist.
   File '../lib/dll15/iup.dll' does not exist.
 File '../obj/dll15/iup_array.obj' does not exist.
Must remake target '../obj/dll15/iup_array.obj'.
''; echo Tecmake: compiling iup_array.c ...
c:/progra~2/micros~2/2017/community/bin/Hostx86/x86/cl -nologo  -c -Fo../obj/dll
15/ -W3 -EHsc -MD -O2 -GL -I../include -I. -Iwin/wdl -Iwin -I../etc -Ic:/progra~
2/wi3cf2~1/10/include/10.0.17134.0/ucrt -Ic:/progra~2/wi3cf2~1/10/include/10.0.1
7134.0/shared -Ic:/progra~2/wi3cf2~1/10/include/10.0.17134.0/um -Ic:/progra~2/mi
cros~2/2017/community/include  -DCOBJMACROS -D_UNICODE -DUSE_NEW_DRAW -D_WIN32_W
INNT=0x0501 -D_WIN32_IE=0x600 -DWINVER=0x0501 -DNOTREEVIEW -DUNICODE -DIUP_DLL -
DTEC_UNAME=dll15 -DTEC_SYSNAME=Win32 -DTEC_LITTLEENDIAN -DTEC_32 -DWIN32 -DMSVC1
5 -D_CRT_SECURE_NO_DEPRECATE -D_CPP_NARROW_INLINES_DEFINED -DNDEBUG iup_array.c
process_begin: CreateProcess(NULL, c:/progra~2/micros~2/2017/community/bin/Hostx
86/x86/cl -nologo -c -Fo../obj/dll15/ -W3 -EHsc -MD -O2 -GL -I../include -I. -Iw
in/wdl -Iwin -I../etc -Ic:/progra~2/wi3cf2~1/10/include/10.0.17134.0/ucrt -Ic:/p
rogra~2/wi3cf2~1/10/include/10.0.17134.0/shared -Ic:/progra~2/wi3cf2~1/10/includ
e/10.0.17134.0/um -Ic:/progra~2/micros~2/2017/community/include -DCOBJMACROS -D_
UNICODE -DUSE_NEW_DRAW -D_WIN32_WINNT=0x0501 -D_WIN32_IE=0x600 -DWINVER=0x0501 -
DNOTREEVIEW -DUNICODE -DIUP_DLL -DTEC_UNAME=dll15 -DTEC_SYSNAME=Win32 -DTEC_LITT
LEENDIAN -DTEC_32 -DWIN32 -DMSVC15 -D_CRT_SECURE_NO_DEPRECATE -D_CPP_NARROW_INLI
NES_DEFINED -DNDEBUG iup_array.c, ...) failed.
make (e=2): O sistema nÒo pode encontrar o arquivo especificado.
../tecmakewin.mak:1706: recipe for target '../obj/dll15/iup_array.obj' failed
win-make[2]: *** [../obj/dll15/iup_array.obj] Error 2
makefile:12: recipe for target 'iup' failed
win-make[1]: *** [iup] Error 2
makefile:9: recipe for target 'iup' failed
win-make: *** [iup] Error 2

File iup_array.c is under src directory, but makefile do not fill the src dir, 
why?
Thanks.
Ranier Vilela

De: Ranier VF 
Enviado: segunda-feira, 4 de novembro de 2019 12:59
Para: IUP discussion list.
Assunto: Re: [Iup-users] IUP Compilation with msvc 2017

Hi,
trying with debug enabled.

E:\dll\iup\iup>make --debug
GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for i386-pc-mingw32
Reading makefiles...
Updating goal targets
 File `do_all' does not exist.
   File `iup' does not exist.
  Must remake target `iup'.
GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for i386-pc-ming

Re: [Iup-users] IUP Compilation with msvc 2017

2019-11-04 Thread Ranier VF
Hi, 
trying with debug enabled.

E:\dll\iup\iup>make --debug
GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for i386-pc-mingw32
Reading makefiles...
Updating goal targets
 File `do_all' does not exist.
   File `iup' does not exist.
  Must remake target `iup'.
GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for i386-pc-mingw32
Reading makefiles...
Updating goal targets
 File `iup' does not exist.
Must remake target `iup'.
GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for i386-pc-mingw32
Reading makefiles...
Updating goal targets
 File `build' does not exist.
   File `tecmake' does not exist.
 File `print-start' does not exist.
Must remake target `print-start'.
''; echo 'Tecmake: Starting [ iup:dll15 ]'
Successfully remade target file `print-start'.
 File `system-check' does not exist.
Must remake target `system-check'.
Successfully remade target file `system-check'.
 File `directories' does not exist.
   File `../obj/dll15' does not exist.
  Must remake target `../obj/dll15'.
if [ ! -d ../obj/dll15 ] ; then mkdir -p ../obj/dll15 ; fi
! foi inesperado neste momento.
make[2]: *** [../obj/dll15] Error 255
make[1]: *** [iup] Error 2
make: *** [iup] Error 2

E:\dll\iup\iup>


De: Ranier VF 
Enviado: segunda-feira, 4 de novembro de 2019 11:22
Para: IUP discussion list.
Assunto: [Iup-users] IUP Compilation with msvc 2017

Hi Scuri,
Windows 64 bits
msvc 2017

set TEC_UNAME=dll15
set VC15=c:/progra~2/micros~2/2017/community/vc
set NO_DEPEND=Yes

''; echo 'Tecmake: Starting [ iup:dll15 ]'
if [ ! -d ../obj/dll15 ] ; then mkdir -p ../obj/dll15 ; fi
! foi inesperado neste momento.
../tecmakewin.mak:1662: recipe for target '../obj/dll15' failed
win-make[2]: *** [../obj/dll15] Error 255
makefile:12: recipe for target 'iup' failed
win-make[1]: *** [iup] Error 2
makefile:9: recipe for target 'iup' failed
win-make: *** [iup] Error 2

I will start from beginning.
mkdir -p does not work on windows shell, the parameter -p is invalid.
Meantime, creating manually ../obj/dll15 the expression
"if [ ! -d ../obj/dll15 ]" also fails!

Can you take a look?
Thanks.
Ranier Vilela

___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


[Iup-users] IUP Compilation with msvc 2017

2019-11-04 Thread Ranier VF
Hi Scuri,
Windows 64 bits
msvc 2017

set TEC_UNAME=dll15
set VC15=c:/progra~2/micros~2/2017/community/vc
set NO_DEPEND=Yes

''; echo 'Tecmake: Starting [ iup:dll15 ]'
if [ ! -d ../obj/dll15 ] ; then mkdir -p ../obj/dll15 ; fi
! foi inesperado neste momento.
../tecmakewin.mak:1662: recipe for target '../obj/dll15' failed
win-make[2]: *** [../obj/dll15] Error 255
makefile:12: recipe for target 'iup' failed
win-make[1]: *** [iup] Error 2
makefile:9: recipe for target 'iup' failed
win-make: *** [iup] Error 2

I will start from beginning.
mkdir -p does not work on windows shell, the parameter -p is invalid.
Meantime, creating manually ../obj/dll15 the expression
"if [ ! -d ../obj/dll15 ]" also fails!

Can you take a look?
Thanks.
Ranier Vilela

___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


Re: [Iup-users] IUP Library with Mingw64

2019-11-01 Thread Ranier VF
Hi Scuri,
Can be for the msvc 2017 compiler (64 bits)

Thanks.
Ranier Vilela


De: Ranier VF 
Enviado: sexta-feira, 1 de novembro de 2019 18:02
Para: IUP discussion list.
Assunto: Re: [Iup-users] IUP Library with Mingw64

Hi,
Windows 7 64 bits

gcc (GCC) 8.3.0
c:\mingw64
c:\mingw64\bin
c:\mingw64\include
c:\mingw64\libexec
c:\mingw64\mingw [x86_64-w64-mingw32]
c:\mingw64\share
c:\mingw64\x86_64-w64-mingw32

Thanks.
Ranier Vilela

De: Antonio Scuri 
Enviado: sexta-feira, 1 de novembro de 2019 17:50
Para: IUP discussion list.
Assunto: Re: [Iup-users] IUP Library with Mingw64

Hi,

That depends on the problems. I could describe hundreds of correctly set vars 
and still don't solve the problem.

In the folder "iup\html\examples\C" there are two mingw*.txt that can also help 
you.

The first thing to check if the mingw version is the same (or nearest) as the 
one I use to build the pre-compiled binaries.

Best,
Scuri


Em sex, 1 de nov de 2019 às 13:17, Ranier VF 
mailto:ranier_...@hotmail.com>> escreveu:
Hi Scuri,
I'm having problems with compilation IUP with Mingw64.
How to make IUP library with Mingw64 with Windows 7 env?
Can you show the correctly setup vars?

Thank you.
Ranier Vilela

___
Iup-users mailing list
Iup-users@lists.sourceforge.net<mailto:Iup-users@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/iup-users


___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


Re: [Iup-users] IUP Library with Mingw64

2019-11-01 Thread Ranier VF
Hi,
Windows 7 64 bits

gcc (GCC) 8.3.0
c:\mingw64
c:\mingw64\bin
c:\mingw64\include
c:\mingw64\libexec
c:\mingw64\mingw [x86_64-w64-mingw32]
c:\mingw64\share
c:\mingw64\x86_64-w64-mingw32

Thanks.
Ranier Vilela

De: Antonio Scuri 
Enviado: sexta-feira, 1 de novembro de 2019 17:50
Para: IUP discussion list.
Assunto: Re: [Iup-users] IUP Library with Mingw64

Hi,

That depends on the problems. I could describe hundreds of correctly set vars 
and still don't solve the problem.

In the folder "iup\html\examples\C" there are two mingw*.txt that can also help 
you.

The first thing to check if the mingw version is the same (or nearest) as the 
one I use to build the pre-compiled binaries.

Best,
Scuri


Em sex, 1 de nov de 2019 às 13:17, Ranier VF 
mailto:ranier_...@hotmail.com>> escreveu:
Hi Scuri,
I'm having problems with compilation IUP with Mingw64.
How to make IUP library with Mingw64 with Windows 7 env?
Can you show the correctly setup vars?

Thank you.
Ranier Vilela

___
Iup-users mailing list
Iup-users@lists.sourceforge.net<mailto:Iup-users@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/iup-users


___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


[Iup-users] IUP Library with Mingw64

2019-11-01 Thread Ranier VF
Hi Scuri, 
I'm having problems with compilation IUP with Mingw64.
How to make IUP library with Mingw64 with Windows 7 env?
Can you show the correctly setup vars?

Thank you.
Ranier Vilela

___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


Re: [Iup-users] Warnings Report (Part 1 of a multi-part response)

2019-06-08 Thread Ranier VF
Hi,
Valuable message.
For my part, what I have to say is, use all resources to deal with bugs
in C development, because is easy make new bugs and hard to find us.

With respect "misleading indentation", I follow K&R here, example:
if {
a = 1;
} else {
a = 2;
}
The explicit use { } is much better than emplicit, despite being more verbose.
Its clear to all, where blocks start and finish, much easier find mistakes.

With respect -Wall -Werror, Nginx uses. Any warning raise compiler error.
The problem with -Werror, is const directive. I use extensively in my own C 
code,
to get more performance, and "const" generate a lot warnings, that can be,
safely ignored, so for now I do not use.

With respect 3rd party IUP libraries, Coverity Scan reports 190 warnings,
with serious bugs, like Memory Corrupt, Resource Leak. It would be a great,
direct users these libraries, help to fixing, once the IUP team do not have 
time.
If someone request, I can post here some report.

Finally, my message is use all resources, to fix a bug, before, your user
find it.

Best regards,
Ranier Vilela


De: sur-behoffski 
Enviado: sábado, 8 de junho de 2019 05:28
Para: IUP discussion list.
Assunto: Re: [Iup-users] Warnings Report (Part 1 of a multi-part response)

On 6/7/19 11:48 PM, Antonio Scuri wrote:
>Hi All,
>
>Here are some comments about the warnings report:
>
> - The report sent by Sur has 4000 lines. I just spent a long time taking a
> good look again at it. My opinion does not change.
> [...]

Thank you for your effort.  IUP is a beast, compared to CD, and, to a lesser
extent IM, in terms of the warnings produced.  IM fares badly because, again,
it has a lot of third-party libraries that have were incorporated a long time
ago, and the GCC folks have steadily worked in improving code flow analysis,
and increasing the types, number and accuracy of warnings, over the time
since the initial incorporation.

One of the most verbose warnings is the "misleading indentation" warning for
the various types of control constructs.  This warning was added as a result
of a serious security hole in Apple's OS, CVE-20140-1266, a.k.a. "goto fail":

 David A Wheeler: "The Apple goto fail vulnerability: lessons learned"

 https://dwheeler.com/essays/apple-goto-fail.html

CVE-2014-1266 (https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2014-1266)
states:

 The SSLVerifySignedServerKeyExchange function in
 libsecurity_ssl/lib/sslKeyExchange.c in the Secure Transport feature
 in the Data Security component in Apple iOS 6.x before 6.1.6 and 7.x
 before 7.0.6, Apple TV 6.x before 6.0.2, and Apple OS X 10.9.x before
 10.9.2 does not check the signature in a TLS Server Key Exchange
 message, which allows man-in-the-middle attackers to spoof SSL
 servers by (1) using an arbitrary private key for the signing step
 or (2) omitting the signing step.

David Wheeler provides a snippet from  SSLVerifySignedServerKeyExchange:

 if ((err = SSLHashSHA1.update(&hashCtx, &signedParams)) != 0)
 goto fail;
 goto fail;
 ... other checks ...
 fail:
   ... buffer frees (cleanups) ...
   return err;

The misleading indentation here let in a serious security vulnerability
into production releases across a range of products.  As suggested in Wheeler's
paper, the "misleading indentation" warning was added as a direct response
to this defect.

Many projects have adopted a zero-tolerance approach to warnings, where,
notably as in this case, if the warning had been implemented prior to the
work on this code, it would have pointed out the defective second
"goto fail;" statement.  The compiler community reacted quickly, and added
the "misleading indentation" diagnostic.

Coding standards for many projects, especially safety-critical or very
high-value missions, have adopted a sophisticated nearly-zero-tolerance
to warnings, as follows:

 - If the compiler writers chose to implement a warning because of a
   reaction to a real-world bug, then the warning is, by default,
   seen as a defect unless the developer can make a compelling case,
   in a code review, why both of the following is true:
 (a) The compiler is erroneous in its analysis; and
 (b) It is too hard for the developer to rework the code
 to avoid the warning -- perhaps the code can be changed
 to appease one compiler, only to have a second compiler
 (or perhaps another analysis tool) complain about the
 change.
 - If the warning is deemed to be truly spurious, then the warning
   is suppressed via a "triage" step, before the final warning
   report is issued.

> - As pointed the warnings in third party libraries will be ignored. I think
> Sur could exclude 

Re: [Iup-users] [3 of 3] Warning messages created by "parse-build.lua" for IUP -r5188, r5207 and -r5228

2019-06-07 Thread Ranier VF
Hi,
Very powerful report, but, unfortunately this being ignored.
Most is in 3rd party libraries and IUP team already showed
that there is nothing to do.
Would be better, direct users this 3rd libraries, forward this reports
to own mainteners, future versions can have this fixed and
incorpored again in IUP base code.

Best regards,
Ranier Vilela

De: sur-behoffski 
Enviado: sexta-feira, 7 de junho de 2019 10:09
Para: IUP discussion list.
Assunto: [Iup-users] [3 of 3] Warning messages created by "parse-build.lua" for 
IUP -r5188, r5207 and -r5228

Full warning output from parse-build for each of the IUP revisions
r5188, r5207 and r5228 is attached.

cheers,

s-b etc.



___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


Re: [Iup-users] IUP code priorities?! People care!!!

2019-06-07 Thread Ranier VF
Hi, thank you.
Apologies to everyone if was rude.
I am a C developer, and I love C, because is most powerful language
in my opinion.  In my own code, I try do write the best C code possible, 
following the masters K&R (The Bests).
So when I see the C being underused, I get frustrated.

Examples:
iupAttribGet(ih, "_IUPBUT_INSIDE_ACTION"), this is a lot inefficient,
when a simple static variable, solve and is very, very faster.

another is:
if iupStrEqualNoCase(value1, "ARIGHT")

In my own C code, never would use iupStrEqualNoCase.
There a 255 characters in char var, I prefer:
if (value1 == IUP_ARIGHT'), when value1 is simple char and
IUP_ARIGHT is 'A' constant.

This is simple examples, but IUP has a lots this.

I know this is my personal opinion, and IUP has historical reasons
to be like this. But I also know, that IUP has great potential to become, 
Worlds first class, and run faster and secure, but by the way it's going to 
take a long time...

Best regards,
Ranier Vilela

De: sur-behoffski 
Enviado: sexta-feira, 7 de junho de 2019 01:59
Para: IUP discussion list.
Assunto: [Iup-users] IUP code priorities?! People care!!!

G'day Ranier,

Please do NOT get discouraged by the apparent lack of enthusiasm for
non-functionality improvements to the code.

I am 1000% on your side:  Look back at all the warnings summaries I've
posted to the list over the years, and at one point, we got CD down to
merely 5 warnings.

In my opinion, Antonio has shown himself to be risk-averse in changing
the code, but there must be a strong drive to add new features, coming
from a direction that does not show itself on the list.  As bugs in
these new features are found, they are fixed very promptly and always
in a way respectful of, and open to, the list.

Again, in my opinion, Antonio is doing a fantastic job given the place
he's working from.

There is quite a lot of third-party libraries incorporated in the code
base:  In many cases, a current (at the time) stable version has been
configured for, and then copied in verbatim, into the codebase.
Sometimes this is because the libraries are not uniformly available
across all platforms, so this incorporation sidesteps that
potentially major maintenance nightmare.

A notable recent example of a library being optionally pulled back out
from the codebase is zlib:  The codebase still has the version
snapshot from its time, but the build switches have been changed to
prefer using an external library where possible.

So, one way forward would be to continue taking incorporated
libraries and separating them back out, where possible.

You've probably seen my "warnings summary" output recently.  I'll
post it again later today, to show how progress is being made.

[I regret not doing more sooner, but various factors have worked
against me... still, progress is being made.]

I'll try to post later today (Australian time), with an updated
warnings list.  I'll also post the Lua script I use to parse the
GCC compiler output.

More later; in the meantime, your input has been fantastic, and I am
very grateful for what you've done.

cheers,

sur-behoffski (Brenton Hoff)
programmer, Grouse Software


___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


Re: [Iup-users] Performance optimize in function winButtonWmCommand.

2019-06-06 Thread Ranier VF
Hi,
Ok, this is a little test.
Very well, wich we can confirm, that priority of IUP team is not
improve iup code, but, only add new features.
So why spend time and energy, if no one has interest...

Thank you.
Best regards,
Ranier Vilela

De: Ranier VF 
Enviado: quarta-feira, 5 de junho de 2019 14:06
Para: IUP discussion list.
Assunto: [Iup-users] Performance optimize in function winButtonWmCommand.

Hi,
Here some performance optimize in function winButtonWmCommand.
The "_IUPBUT_INSIDE_ACTION" is not used anywhere else and can
changed by much faster C resource.

--- \dll\iup\a\src\win\iupwin_button.c  Mon Jun 03 20:25:39 2019
+++ iupwin_button.c Wed Jun 05 10:58:31 2019
@@ -660,21 +660,17 @@
  so we added a test here also */
   if (iupAttribGetBoolean(ih, "CANFOCUS"))
   {
+static int inside_action = 0;
 Icallback cb = IupGetCallback(ih, "ACTION");
 if (cb)
 {
   /* to avoid double calls when pressing enter and a dialog is 
displayed */
-  if (!iupAttribGet(ih, "_IUPBUT_INSIDE_ACTION"))
+  if (!inside_action)
   {
-int ret;
-iupAttribSet(ih, "_IUPBUT_INSIDE_ACTION", "1");
-
-ret = cb(ih);
-if (ret == IUP_CLOSE)
+inside_action = 1;
+if (cb(ih) == IUP_CLOSE)
   IupExitLoop();
-
-if (ret!=IUP_IGNORE && iupObjectCheck(ih))
-  iupAttribSet(ih, "_IUPBUT_INSIDE_ACTION", NULL);
+inside_action = 0;
   }
 }
   }

Best regards,
Ranier Vilela


___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


[Iup-users] Performance optimize in function winButtonWmCommand.

2019-06-05 Thread Ranier VF
Hi,
Here some performance optimize in function winButtonWmCommand.
The "_IUPBUT_INSIDE_ACTION" is not used anywhere else and can
changed by much faster C resource.

--- \dll\iup\a\src\win\iupwin_button.c  Mon Jun 03 20:25:39 2019
+++ iupwin_button.c Wed Jun 05 10:58:31 2019
@@ -660,21 +660,17 @@
  so we added a test here also */
   if (iupAttribGetBoolean(ih, "CANFOCUS"))
   {
+static int inside_action = 0;
 Icallback cb = IupGetCallback(ih, "ACTION");
 if (cb)
 {
   /* to avoid double calls when pressing enter and a dialog is 
displayed */
-  if (!iupAttribGet(ih, "_IUPBUT_INSIDE_ACTION"))  
+  if (!inside_action)  
   {
-int ret;
-iupAttribSet(ih, "_IUPBUT_INSIDE_ACTION", "1");
-
-ret = cb(ih);
-if (ret == IUP_CLOSE)
+inside_action = 1;
+if (cb(ih) == IUP_CLOSE)
   IupExitLoop();
-
-if (ret!=IUP_IGNORE && iupObjectCheck(ih))
-  iupAttribSet(ih, "_IUPBUT_INSIDE_ACTION", NULL);
+inside_action = 0;
   }
 }
   }

Best regards,
Ranier Vilela

iupwin_button.c.patch
Description: iupwin_button.c.patch
___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


[Iup-users] Warnings coming from msvc compiler

2019-06-04 Thread Ranier VF
Hi,
Here some warnings coming from msvc compiler:

c:\dll\iup\iup\srcmglplot\src\pde.cpp(221) : warning C4701: potentially 
uninitialized local variable 'ham' used
c:\dll\iup\iup\srcmglplot\src\prim.cpp(403) : warning C4701: potentially 
uninitialized local variable 'n2' used
c:\dll\iup\iup\srcmglplot\src\canvas.cpp(436) : warning C4701: potentially 
uninitialized local variable 'res' used
c:\dll\iup\iup\srcmglplot\src\canvas.cpp(925) : warning C4706: assignment 
within conditional expression
c:\dll\iup\iup\srcmglplot\src\parser.cpp(839) : warning C4701: potentially 
uninitialized local variable 'cond' used
c:\dll\iup\iup\srcmglplot\src\parser.cpp(862) : warning C4701: potentially 
uninitialized local variable 'cond' used
scintilla/lexers/LexLed.cxx(43) : warning C4505: 'LongDelimCheck' : 
unreferenced local function has been removed
tOleHandler.cpp(251) : warning C4101: 'szl' : unreferenced local variable
tOleHandler.cpp(364) : warning C4189: 'dwMode' : local variable is initialized 
but not referenced
tOleHandler.cpp(363) : warning C4189: 'hr' : local variable is initialized but 
not referenced
tOleHandler.cpp(911) : warning C4101: 'fEvents' : unreferenced local variable
tOleInPlaceFrame.cpp(313) : warning C4101: 'hr' : unreferenced local variable
tOleInPlaceSite.cpp(263) : warning C4101: 'msg' : unreferenced local variable
tOleInPlaceSite.cpp(389) : warning C4101: 'rcl' : unreferenced local variable
c:\dll\iup\iup\srcole\tOleControlSite.h(37) : warning C4265: 'tOleControlSite' 
: class has virtual functions, but destructor is not virtual
 instances of this class may not be destructed correctly
c:\dll\iup\iup\srcole\tDispatch.h(38) : warning C4265: 'tDispatch' : class has 
virtual functions, but destructor is not virtual
 instances of this class may not be destructed correctly

Best regards,
Ranier Vilela

___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


Re: [Iup-users] CID 210668 (#1 of 1): Explicit null dereferenced (FORWARD_NULL)

2019-06-04 Thread Ranier VF
Hi,
I would not be so sure.
If value_len is exactly the size: 2

 if (data[0] == '\"' && data[value_len - 1] == '\"')
{
  data++;
  value_len -= 2;
  len -= 2;
}
So, when value_len -= 2; is executed, what is the final size?
value_len is zero and "if (*value_max_size < value_len)" fail!

Best regards,
Ranier Vilela

De: Antonio Scuri 
Enviado: terça-feira, 4 de junho de 2019 11:29
Para: IUP discussion list.
Assunto: Re: [Iup-users] CID 210668 (#1 of 1): Explicit null dereferenced 
(FORWARD_NULL)

  If you analyze the calling function that should never fail.



Em ter, 4 de jun de 2019 às 08:24, Ranier VF 
mailto:ranier_...@hotmail.com>> escreveu:
Hi,
And what happens if  "if (*value_max_size < value_len)" fail and
realloc is not called?

Best regards,
Ranier Vilela


De: Antonio Scuri mailto:antonio.sc...@gmail.com>>
Enviado: terça-feira, 4 de junho de 2019 11:09
Para: IUP discussion list.
Assunto: Re: [Iup-users] CID 210668 (#1 of 1): Explicit null dereferenced 
(FORWARD_NULL)

  The realloc function does the malloc job. And it will only increase the size 
of the value pointer when necessary.

Best,
Scuri


Em seg, 3 de jun de 2019 às 22:29, Ranier VF 
mailto:ranier_...@hotmail.com><mailto:ranier_...@hotmail.com<mailto:ranier_...@hotmail.com>>>
 escreveu:
Hi,
Sorry but can't undestand the logic.
iupmatex_clipboard.c
line 505, call function:

value = iMatrixExStrCopyData(value, &value_max_size, data, value_len);

iMatrixExStrCopyData, call memcpy with value without malloc?

static char* iMatrixExStrCopyData(char* value, int *value_max_size, const char* 
data, int value_len)
{
  if (*value_max_size < value_len)  /* if fail, memcpy destroy memory pointer */
  {
*value_max_size = value_len+10;
value = realloc(value, *value_max_size);
  }
  memcpy(value, data, value_len);
  value[value_len] = 0;
  return value;
}

Best regards,
Ranier Vilela

___
Iup-users mailing list
Iup-users@lists.sourceforge.net<mailto:Iup-users@lists.sourceforge.net><mailto:Iup-users@lists.sourceforge.net<mailto:Iup-users@lists.sourceforge.net>>
https://lists.sourceforge.net/lists/listinfo/iup-users


___
Iup-users mailing list
Iup-users@lists.sourceforge.net<mailto:Iup-users@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/iup-users


___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


Re: [Iup-users] CID 341226 (#1 of 1): COM bad conversion to BSTR (COM.BSTR.CONV)

2019-06-04 Thread Ranier VF
Hi,
BSTR are not WCHAR compatible.
See at:
https://www.codeguru.com/cpp/cpp/string/conversions/article.php/c5639/Guide-to-BSTR-and-C-String-Conversions.htm
"C strings are arrays of characters terminated by a NULL character. Visual 
Basic strings differ in that the length of the string precede the characters in 
the string. So, a VB string knows its own length. In addition, all VB strings 
are Unicode (16 bits per character)."

BSTR contain the length of the string. WCHAR [0] position can be anything,
If code subsequent read the length with WCHAR string, the result is
impredictable.
The Coverity report this as Memory Corruption, level High.

I agree with Coverity, the code is unsafe and violate the rules use of functions
calls what await BSTR valid variables.

Best regards,
Ranier Vilela


De: Antonio Scuri 
Enviado: terça-feira, 4 de junho de 2019 11:15
Para: IUP discussion list.
Assunto: Re: [Iup-users] CID 341226 (#1 of 1): COM bad conversion to BSTR 
(COM.BSTR.CONV)

  We use BSTR as the same definition of WCHAR, that's why we can do what we do. 
In a more generic code that should work with BSTR variations then we should be 
more careful. But that's not the case.

Best,
Scuri


Em seg, 3 de jun de 2019 às 23:05, Ranier VF 
mailto:ranier_...@hotmail.com>> escreveu:
Hi,
Several fixes for the iupwin_webbrowser.cpp

--- \dll\iup\a\srcweb\iupwin_webbrowser.cpp Wed Apr 03 14:12:26 2019
+++ iupwin_webbrowser.cpp   Mon Jun 03 23:00:50 2019
@@ -206,12 +206,14 @@
   pweb->get_Document(&lpDispatch);
   if (!lpDispatch)
   {
+const BSTR pBstr = SysAllocString("about:blank");
 iupAttribSet(ih, "_IUPWEB_FAILED", NULL);

-pweb->Navigate(L"about:blank", NULL, NULL, NULL, NULL);
+pweb->Navigate(pBstr, NULL, NULL, NULL, NULL);
 IupFlush();

 pweb->get_Document(&lpDispatch);
+SysFreeString(pBstr);
   }

   IPersistStreamInit* pPersistStreamInit = NULL;
@@ -405,15 +407,15 @@
 {
   if (value)
   {
-char* element_id = iupAttribGet(ih, "ELEMENT_ID");
+const char* element_id = iupAttribGet(ih, "ELEMENT_ID");
 if (element_id)
 {
-  IHTMLElement* pElem = winWebBrowserFindElement(ih, element_id);
+  const IHTMLElement* pElem = winWebBrowserFindElement(ih, element_id);
   if (pElem)
   {
-WCHAR* wvalue = iupwinStrChar2Wide(value);
-pElem->put_innerText(wvalue);
-free(wvalue);
+const BSTR pBvalue = SysAllocString(szWCharString);
+pElem->put_innerText(pBvalue);
+SysFreeString(pBvalue);
 pElem->Release();
   }
 }
@@ -423,50 +425,49 @@

 static char* winWebBrowserGetInnerTextAttrib(Ihandle* ih)
 {
-  char* element_id = iupAttribGet(ih, "ELEMENT_ID");
+  const char* element_id = iupAttribGet(ih, "ELEMENT_ID");
+  const* value = NULL;
   if (element_id)
   {
-IHTMLElement* pElem = winWebBrowserFindElement(ih, element_id);
+const IHTMLElement* pElem = winWebBrowserFindElement(ih, element_id);
 if (pElem)
 {
-  WCHAR* wvalue = NULL;
-  if (!FAILED(pElem->get_innerText(&wvalue)))
+  BSTR pBvalue = NULL;
+  if (!FAILED(pElem->get_innerText(&pBvalue)))
   {
-char* str = iupwinStrWide2Char(wvalue);
-char* value = iupStrReturnStr(str);
-SysFreeString(wvalue);
+const char* str = iupwinStrWide2Char(pBvalue);
+const char* value = iupStrReturnStr(str);
 free(str);
-pElem->Release();
-return value;
+SysFreeString(pBvalue);
   }
   pElem->Release();
 }
   }

-  return NULL;
+  return value;
 }

 static int winWebBrowserSetAttributeAttrib(Ihandle* ih, const char* value)
 {
   if (value)
   {
-char* element_id = iupAttribGet(ih, "ELEMENT_ID");
-char* attribute_name = iupAttribGet(ih, "ATTRIBUTE_NAME");
+const char* element_id = iupAttribGet(ih, "ELEMENT_ID");
+const char* attribute_name = iupAttribGet(ih, "ATTRIBUTE_NAME");
 if (element_id && attribute_name)
 {
   IHTMLElement* pElem = winWebBrowserFindElement(ih, element_id);
   if (pElem)
   {
-WCHAR* wname = iupwinStrChar2Wide(attribute_name);
-WCHAR* wvalue = iupwinStrChar2Wide(value);
+const BSTR pBname = SysAllocString(attribute_name);
+const WCHAR* wvalue = iupwinStrChar2Wide(value);

 VARIANT var;
 VariantBStr(&var, wvalue);

-pElem->setAttribute(wname, var, 1);  // case sensitive search
+pElem->setAttribute(pBname, var, 1);  // case sensitive search

 free(wvalue);
-free(wname);
+SysFreeString(pBname);
 pElem->Release();
   }
 }
@@ -476,31 +477,29 @@

 static char* winWebBrowserGetAttributeAttrib(Ihandle* ih)
 {
-  char* element_id = iupAttribGet(ih, "ELEMEN

Re: [Iup-users] CID 210668 (#1 of 1): Explicit null dereferenced (FORWARD_NULL)

2019-06-04 Thread Ranier VF
Hi,
And what happens if  "if (*value_max_size < value_len)" fail and
realloc is not called?

Best regards,
Ranier Vilela


De: Antonio Scuri 
Enviado: terça-feira, 4 de junho de 2019 11:09
Para: IUP discussion list.
Assunto: Re: [Iup-users] CID 210668 (#1 of 1): Explicit null dereferenced 
(FORWARD_NULL)

  The realloc function does the malloc job. And it will only increase the size 
of the value pointer when necessary.

Best,
Scuri


Em seg, 3 de jun de 2019 às 22:29, Ranier VF 
mailto:ranier_...@hotmail.com>> escreveu:
Hi,
Sorry but can't undestand the logic.
iupmatex_clipboard.c
line 505, call function:

value = iMatrixExStrCopyData(value, &value_max_size, data, value_len);

iMatrixExStrCopyData, call memcpy with value without malloc?

static char* iMatrixExStrCopyData(char* value, int *value_max_size, const char* 
data, int value_len)
{
  if (*value_max_size < value_len)  /* if fail, memcpy destroy memory pointer */
  {
*value_max_size = value_len+10;
value = realloc(value, *value_max_size);
  }
  memcpy(value, data, value_len);
  value[value_len] = 0;
  return value;
}

Best regards,
Ranier Vilela

___
Iup-users mailing list
Iup-users@lists.sourceforge.net<mailto:Iup-users@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/iup-users


___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


[Iup-users] CID 341226 (#1 of 1): COM bad conversion to BSTR (COM.BSTR.CONV)

2019-06-03 Thread Ranier VF
Hi,
Several fixes for the iupwin_webbrowser.cpp

--- \dll\iup\a\srcweb\iupwin_webbrowser.cpp Wed Apr 03 14:12:26 2019
+++ iupwin_webbrowser.cpp   Mon Jun 03 23:00:50 2019
@@ -206,12 +206,14 @@
   pweb->get_Document(&lpDispatch);
   if (!lpDispatch)
   {
+const BSTR pBstr = SysAllocString("about:blank");
 iupAttribSet(ih, "_IUPWEB_FAILED", NULL);
 
-pweb->Navigate(L"about:blank", NULL, NULL, NULL, NULL);
+pweb->Navigate(pBstr, NULL, NULL, NULL, NULL);
 IupFlush();
 
 pweb->get_Document(&lpDispatch);
+SysFreeString(pBstr);
   }
 
   IPersistStreamInit* pPersistStreamInit = NULL;
@@ -405,15 +407,15 @@
 {
   if (value)
   {
-char* element_id = iupAttribGet(ih, "ELEMENT_ID");
+const char* element_id = iupAttribGet(ih, "ELEMENT_ID");
 if (element_id)
 {
-  IHTMLElement* pElem = winWebBrowserFindElement(ih, element_id);
+  const IHTMLElement* pElem = winWebBrowserFindElement(ih, element_id);
   if (pElem)
   {
-WCHAR* wvalue = iupwinStrChar2Wide(value);
-pElem->put_innerText(wvalue);
-free(wvalue);
+const BSTR pBvalue = SysAllocString(szWCharString);
+pElem->put_innerText(pBvalue);
+SysFreeString(pBvalue);
 pElem->Release();
   }
 }
@@ -423,50 +425,49 @@
 
 static char* winWebBrowserGetInnerTextAttrib(Ihandle* ih)
 {
-  char* element_id = iupAttribGet(ih, "ELEMENT_ID");
+  const char* element_id = iupAttribGet(ih, "ELEMENT_ID");
+  const* value = NULL;
   if (element_id)
   {
-IHTMLElement* pElem = winWebBrowserFindElement(ih, element_id);
+const IHTMLElement* pElem = winWebBrowserFindElement(ih, element_id);
 if (pElem)
 {
-  WCHAR* wvalue = NULL;
-  if (!FAILED(pElem->get_innerText(&wvalue)))
+  BSTR pBvalue = NULL;
+  if (!FAILED(pElem->get_innerText(&pBvalue)))
   {
-char* str = iupwinStrWide2Char(wvalue);
-char* value = iupStrReturnStr(str);
-SysFreeString(wvalue);
+const char* str = iupwinStrWide2Char(pBvalue);
+const char* value = iupStrReturnStr(str);
 free(str);
-pElem->Release();
-return value;
+SysFreeString(pBvalue);
   }
   pElem->Release();
 }
   }
 
-  return NULL;
+  return value;
 }
 
 static int winWebBrowserSetAttributeAttrib(Ihandle* ih, const char* value)
 {
   if (value)
   {
-char* element_id = iupAttribGet(ih, "ELEMENT_ID");
-char* attribute_name = iupAttribGet(ih, "ATTRIBUTE_NAME");
+const char* element_id = iupAttribGet(ih, "ELEMENT_ID");
+const char* attribute_name = iupAttribGet(ih, "ATTRIBUTE_NAME");
 if (element_id && attribute_name)
 {
   IHTMLElement* pElem = winWebBrowserFindElement(ih, element_id);
   if (pElem)
   {
-WCHAR* wname = iupwinStrChar2Wide(attribute_name);
-WCHAR* wvalue = iupwinStrChar2Wide(value);
+const BSTR pBname = SysAllocString(attribute_name);
+const WCHAR* wvalue = iupwinStrChar2Wide(value);
 
 VARIANT var;
 VariantBStr(&var, wvalue);
 
-pElem->setAttribute(wname, var, 1);  // case sensitive search
+pElem->setAttribute(pBname, var, 1);  // case sensitive search
 
 free(wvalue);
-free(wname);
+SysFreeString(pBname);
 pElem->Release();
   }
 }
@@ -476,31 +477,29 @@
 
 static char* winWebBrowserGetAttributeAttrib(Ihandle* ih)
 {
-  char* element_id = iupAttribGet(ih, "ELEMENT_ID");
-  char* attribute_name = iupAttribGet(ih, "ATTRIBUTE_NAME");
+  const char* element_id = iupAttribGet(ih, "ELEMENT_ID");
+  const char* attribute_name = iupAttribGet(ih, "ATTRIBUTE_NAME");
+  const char *value = NULL;
   if (element_id && attribute_name)
   {
-IHTMLElement* pElem = winWebBrowserFindElement(ih, element_id);
+const IHTMLElement* pElem = winWebBrowserFindElement(ih, element_id);
 if (pElem)
 {
-  WCHAR* wname = iupwinStrChar2Wide(attribute_name);
+  const BSTR pBname = SysAllocString(attribute_name);
   VARIANT var;
   VariantInit(&var);
-  if (!FAILED(pElem->getAttribute(wname, 1, &var)) && var.bstrVal)  // 
case sensitive search
+  if (!FAILED(pElem->getAttribute(pBname, 1, &var)) && var.bstrVal)  // 
case sensitive search
   {
-char* str = iupwinStrWide2Char(var.bstrVal);
-char* value = iupStrReturnStr(str);
+const char* str = iupwinStrWide2Char(var.bstrVal);
+value = iupStrReturnStr(str);
 free(str);
-free(wname);
-pElem->Release();
-return value;
   }
-  free(wname);
+  SysFreeString(pBname);
   pElem->Release();
 }
   }
 
-  return NULL;
+  return value;
 }
 
 static int winWebBrowserSetBackForwardAttrib(Ihandle* ih, const char* value)
@@ -578,7 +577,7 @@
   if (value)
   {
 IWebBrowser2 *pweb = (IWebBrowser2*)iupAttribGet(ih, "_IUPWEB_BROWSER");
-WCHAR* wvalue = iupwinStrChar2Wide(value);
+const BSTR pBvalue = SysAllocString(value);
 
 V

[Iup-users] CID 210668 (#1 of 1): Explicit null dereferenced (FORWARD_NULL)

2019-06-03 Thread Ranier VF
Hi,
Sorry but can't undestand the logic.
iupmatex_clipboard.c
line 505, call function:

value = iMatrixExStrCopyData(value, &value_max_size, data, value_len);

iMatrixExStrCopyData, call memcpy with value without malloc?

static char* iMatrixExStrCopyData(char* value, int *value_max_size, const char* 
data, int value_len)
{
  if (*value_max_size < value_len)  /* if fail, memcpy destroy memory pointer */
  {
*value_max_size = value_len+10;
value = realloc(value, *value_max_size);
  }
  memcpy(value, data, value_len);
  value[value_len] = 0;
  return value;
}

Best regards,
Ranier Vilela

___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


Re: [Iup-users] Ignore function return

2019-06-03 Thread Ranier VF
Thank you Scuri.
Best regards,
Ranier Vilela


De: Antonio Scuri 
Enviado: segunda-feira, 3 de junho de 2019 23:26
Para: IUP discussion list.
Assunto: Re: [Iup-users] Ignore function return

  Ok. That I can do.

  Just committed to the SVN.

Best,
Scuri


Em seg, 3 de jun de 2019 às 19:17, Ranier VF 
mailto:ranier_...@hotmail.com>> escreveu:
Hi Scuri,
Thank you for the commits.
However I have some comment about the commit 5211:
https://sourceforge.net/p/iup/iup/5211/

While comments like /* ignore return value */ is great for
programmers, for the Coverity and GCC do not mean anything.
The correct way to silence warnings coming is:
(void) iupwinButtonUp(ih, msg, wp, lp); /* ignore return value */

The are some warnings left in last Coverity report, if really safe
ignore function return please add cast (void), to silence them.

Best regards,
Ranier Vilela

___
Iup-users mailing list
Iup-users@lists.sourceforge.net<mailto:Iup-users@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/iup-users


___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


[Iup-users] Ignore function return

2019-06-03 Thread Ranier VF
Hi Scuri,
Thank you for the commits.
However I have some comment about the commit 5211:
https://sourceforge.net/p/iup/iup/5211/

While comments like /* ignore return value */ is great for 
programmers, for the Coverity and GCC do not mean anything.
The correct way to silence warnings coming is:
(void) iupwinButtonUp(ih, msg, wp, lp); /* ignore return value */

The are some warnings left in last Coverity report, if really safe
ignore function return please add cast (void), to silence them.

Best regards,
Ranier Vilela

___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


Re: [Iup-users] CID 341015 (#1 of 1): Division or modulo by zero (DIVIDE_BY_ZERO)

2019-05-29 Thread Ranier VF
Hi,
Divide by zero with integer, the behaviour is undefined.
Good luck to catch such errors.

Best regards,
Ranier Vilela


De: Antonio Scuri 
Enviado: terça-feira, 28 de maio de 2019 21:09
Para: IUP discussion list.
Assunto: Re: [Iup-users] CID 341015 (#1 of 1): Division or modulo by zero 
(DIVIDE_BY_ZERO)

   If that function is called with max ==0 then it is a much more serious error 
than a divide by zero, and we would mascarade the error by adding such code.

Best,
Scuri


Em sáb, 25 de mai de 2019 às 08:54, Ranier VF 
mailto:ranier_...@hotmail.com>> escreveu:
Hi,
Fix iup_flatscrollbar.c:
--- ..\..\a\src\iup_flatscrollbar.c Mon Jan 28 18:13:06 2019
+++ iup_flatscrollbar.c Sat May 25 08:53:03 2019
@@ -138,14 +138,19 @@
 static void iFlatScrollBarCalcHandler(int size, int arrow_size, int max, int 
d, int sb_size, int pos, int* pos1, int* pos2)
 {
   int pos_p;
-  int range_p = size - 1 - 2 * arrow_size;
-
-  int d_p = (d * range_p) / max;
-  if (d_p < sb_size) d_p = sb_size;
+  int d_p = 0;
+  const int range_p = size - 1 - 2 * arrow_size;

+  if (max != 0)
+  {
+ d_p = (d * range_p) / max;
+  }
+  if (d_p < sb_size)
+  {
+ d_p = sb_size;
+  }
   pos_p = (pos * (range_p - d_p)) / (max - d);
   pos_p += arrow_size;
-
   *pos1 = pos_p;
   *pos2 = pos_p + d_p;
 }

Best regards,
Ranier Vilela___
Iup-users mailing list
Iup-users@lists.sourceforge.net<mailto:Iup-users@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/iup-users


___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


[Iup-users] iup_attrib.c Prevent resource leak: CID 210676 Coverity

2019-05-28 Thread Ranier VF
Hi,
This patch try fixes :

1.  Coverity and GCC report about absence break into switch or implicit 
fallthrough:
https://stackoverflow.com/questions/45129741/gcc-7-wimplicit-fallthrough-warnings-and-portable-way-to-clear-them
https://en.wiktionary.org/wiki/fall-through
https://github.com/Microsoft/TypeScript/issues/393

2. /* prevent resource leak: CID 210676 Coverity */
http://www.cplusplus.com/reference/cstdlib/free/
If ptr is a null pointer, the function does nothing.
free call with NULL var, is nop call.

Best regards,
Ranier Vilela


static void iAttribParse(Ihandle *ih, const char* str)
{
  char* env_buffer[256];
  const char* name=NULL;
  const char* value=NULL;
  char state = 'a';   /* get attribute */
  int end = 0;

  env_str = str;
  for (;;)
  {
switch (iAttribToken(env_buffer))
{
case IUPLEX_TK_END:   /* same as IUPLEX_TK_COMMA */
  end = 1;
  /* fallthrough */
case IUPLEX_TK_COMMA:
  if (name)
  {
IupStoreAttribute(ih, name, value);
free(name);
  }
  if (end)
return;
  name = value = NULL;
  state = 'a';
  break;

case IUPLEX_TK_SET:
  state = 'v';/* get value */
  break;

case IUPLEX_TK_NAME:
  if (state == 'a')
  {
free(name); /* prevent resource leak: CID 210676 Coverity */
name = iupStrDup(env_buffer);
  }
  else
value = env_buffer;
  break;
}
  }
}


who talks a lot does less either.

iup_attrib.c.patch
Description: iup_attrib.c.patch
___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


Re: [Iup-users] CID 210676 (#1 of 1): Resource leak (RESOURCE_LEAK)

2019-05-27 Thread Ranier VF
Hi Scuri,
Acccording to Coverity this is a real bug:

static void iAttribParse(Ihandle *ih, const char* str)
1463{
1464  char env_buffer[256];
1465  char* name=NULL;
1466  char* value=NULL;
1467  char state = 'a';   /* get attribute */
1468  int end = 0;
1469
1470  env_str = str;
1471
1. Condition true, taking true branch.
7. Condition true, taking true branch.
15. Condition true, taking true branch.
1472  for (;;)
1473  {
2. Switch case value 8.
8. Switch case value 5.
16. Switch case value 5.
1474switch (iAttribToken(env_buffer))
1475{
CID 210525: Missing break in switch (MISSING_BREAK) [select issue]
1476case IUPLEX_TK_END:   /* same as IUPLEX_TK_COMMA */
1477  end = 1;
1478case IUPLEX_TK_COMMA:
3. Condition name, taking false branch.
1479  if (name)
1480  {
CID 210685: Explicit null dereferenced (FORWARD_NULL) [select issue]
1481IupStoreAttribute(ih, name, value);
1482free(name);
1483  }
4. Condition end, taking false branch.
1484  if (end)
1485return;
1486  name = value = NULL;
1487  state = 'a';
5. Breaking from switch.
1488  break;
1489
1490case IUPLEX_TK_SET:
1491  state = 'v';/* get value */
1492  break;
1493
1494case IUPLEX_TK_NAME:
9. Condition state == 97, taking true branch.
17. Condition state == 97, taking true branch.
1495  if (state == 'a')
10. alloc_fn: Storage is returned from allocation function iupStrDup. [show 
details]
11. var_assign: Assigning: name = storage returned from 
iupStrDup(env_buffer).
12. Falling through to end of if statement.
CID 210676 (#1 of 1): Resource leak (RESOURCE_LEAK)18. overwrite_var: 
Overwriting name in name = iupStrDup(env_buffer) leaks the storage that name 
points to.
1496name = iupStrDup(env_buffer);
1497  else
1498value = env_buffer;
13. Breaking from switch.
1499  break;
1500}
6. Jumping back to the beginning of the loop.
14. Jumping back to the beginning of the loop.
1501  }
1502}

Following the "conditions", that can actually occur, var name leaks pointer.
IHMO I really believe fix this.

Best regards,
Ranier Vilela

De: Antonio Scuri 
Enviado: domingo, 26 de maio de 2019 22:08
Para: IUP discussion list.
Assunto: Re: [Iup-users] CID 210676 (#1 of 1): Resource leak (RESOURCE_LEAK)

The code you added is an unreachable code. The "for" never ends normally, only 
in the return.

Em sáb, 25 de mai de 2019 às 08:28, Ranier VF 
mailto:ranier_...@hotmail.com>> escreveu:
Hi,
Fix RESOURCE_LEAK at iup_attrib.c

--- ..\..\a\src\iup_attrib.cSat Jan 26 16:02:13 2019
+++ iup_attrib.cSat May 25 08:25:17 2019
@@ -1499,6 +1499,11 @@
   break;
 }
   }
+  if (name)
+  {
+ IupStoreAttribute(ih, name, value);
+ free(name);
+  }
 }

 Ihandle* IupSetAttributes(Ihandle *ih, const char* str)

Best regards.
Ranier Vilela___
Iup-users mailing list
Iup-users@lists.sourceforge.net<mailto:Iup-users@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/iup-users


___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


[Iup-users] IUP 3_27: msvc 2010 compiler warnings

2019-05-25 Thread Ranier VF
Hi,
msvc 2010 compiler warnings:

iupPlotDraw.cpp(322) : warning C4061: enumerator 'IUP_PLOT_XY' in switch of 
enum 'iupPlotLegendPosition' is not explicitly handled by a case label
c:\dll\iup\iup\srcplot\iupPlot.h(21) : see declaration of 
'iupPlotLegendPosition'
iupPlotDraw.cpp(322) : warning C4061: enumerator 'IUP_PLOT_TOPRIGHT' in switch 
of enum 'iupPlotLegendPosition' is not explicitly handled by a case label
c:\dll\iup\iup\srcplot\iupPlot.h(21) : see declaration of 
'iupPlotLegendPosition'
iupPlotDraw.cpp(465) : warning C4061: enumerator 'IUP_PLOT_XY' in switch of 
enum 'iupPlotLegendPosition' is not explicitly handled by a case label
c:\dll\iup\iup\srcplot\iupPlot.h(21) : see declaration of 
'iupPlotLegendPosition'
iupPlotDraw.cpp(465) : warning C4061: enumerator 'IUP_PLOT_TOPRIGHT' in switch 
of enum 'iupPlotLegendPosition' is not explicitly handled by a case label
c:\dll\iup\iup\srcplot\iupPlot.h(21) : see declaration of 
'iupPlotLegendPosition'


iupPlotData.cpp(123) : warning C4061: enumerator 'IUP_PLOT_ERRORBAR' in switch 
of enum 'iupPlotMode' is not explicitly handled by a case label
c:\dll\iup\iup\srcplot\iupPlot.h(20) : see declaration of 'iupPlotMode'
iupPlotData.cpp(123) : warning C4061: enumerator 'IUP_PLOT_STEP' in switch of 
enum 'iupPlotMode' is not explicitly handled by a case label
c:\dll\iup\iup\srcplot\iupPlot.h(20) : see declaration of 'iupPlotMode'
iupPlotData.cpp(123) : warning C4061: enumerator 'IUP_PLOT_MARKSTEM' in switch 
of enum 'iupPlotMode' is not explicitly handled by a case label
c:\dll\iup\iup\srcplot\iupPlot.h(20) : see declaration of 'iupPlotMode'
iupPlotData.cpp(123) : warning C4061: enumerator 'IUP_PLOT_STEM' in switch of 
enum 'iupPlotMode' is not explicitly handled by a case label
c:\dll\iup\iup\srcplot\iupPlot.h(20) : see declaration of 'iupPlotMode'
iupPlotData.cpp(123) : warning C4061: enumerator 'IUP_PLOT_AREA' in switch of 
enum 'iupPlotMode' is not explicitly handled by a case label
c:\dll\iup\iup\srcplot\iupPlot.h(20) : see declaration of 'iupPlotMode'
iupPlotData.cpp(123) : warning C4061: enumerator 'IUP_PLOT_MARKLINE' in switch 
of enum 'iupPlotMode' is not explicitly handled by a case label
c:\dll\iup\iup\srcplot\iupPlot.h(20) : see declaration of 'iupPlotMode'
iupPlotData.cpp(123) : warning C4061: enumerator 'IUP_PLOT_MARK' in switch of 
enum 'iupPlotMode' is not explicitly handled by a case label
c:\dll\iup\iup\srcplot\iupPlot.h(20) : see declaration of 'iupPlotMode'
iupPlotData.cpp(123) : warning C4061: enumerator 'IUP_PLOT_LINE' in switch of 
enum 'iupPlotMode' is not explicitly handled by a case label
c:\dll\iup\iup\srcplot\iupPlot.h(20) : see declaration of 'iupPlotMode'
iupPlotData.cpp(1557) : warning C4061: enumerator 'IUP_PLOT_NONE' in switch of 
enum 'iupPlotSliceLabel' is not explicitly handled by a case label
c:\dll\iup\iup\srcplot\iupPlot.h(22) : see declaration of 
'iupPlotSliceLabel'

Best regards,
Ranier Vilela

___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


Re: [Iup-users] NOT_WORKING is not defined in Windows port

2019-05-25 Thread Ranier VF
Hi Scuri,
Thanks. There are more issues in Coverity report, let me in, if you need help.
Best regards,
Ranier Vilela


De: Antonio Scuri 
Enviado: sábado, 25 de maio de 2019 14:28
Para: IUP discussion list.
Assunto: Re: [Iup-users] NOT_WORKING is not defined in Windows port

  NOT_WORKING  isolates a code that is not working... It is there as a reminder.

Best,
Scuri


Em sáb, 25 de mai de 2019 às 11:16, Ranier VF 
mailto:ranier_...@hotmail.com>> escreveu:
Hi,
When compiling iup_calendar.c in windows port, var NOT_WORKING is
not defined;
What is the correct definition?

Best regards,
Ranier Vilela

___
Iup-users mailing list
Iup-users@lists.sourceforge.net<mailto:Iup-users@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/iup-users


___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


[Iup-users] NOT_WORKING is not defined in Windows port

2019-05-25 Thread Ranier VF
Hi,
When compiling iup_calendar.c in windows port, var NOT_WORKING is
not defined;
What is the correct definition?

Best regards,
Ranier Vilela

___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


[Iup-users] Multiple fixes

2019-05-25 Thread Ranier VF
Hi,
Multiple fixes in iupwin_newfiledlg.c:

--- ..\..\a\srcfiledlg\iupwin_newfiledlg.cppFri Sep 14 17:33:33 2018
+++ iupwin_newfiledlg.cpp   Sat May 25 10:43:31 2019
@@ -334,48 +334,25 @@
   COMDLG_FILTERSPEC* filters = 
(COMDLG_FILTERSPEC*)malloc((buffSize)*sizeof(COMDLG_FILTERSPEC));
 
   /* replace symbols "|" by terminator "\0" */
-
-  while (*name)
+  if (name && *name)
   {
-char *filter;
-filter = name;
-while (*filter)
-{
-  if (*filter == '|')
-  {
-*filter = 0;
-filters[i].pszName = iupwinStrToSystem(name);
-break;
-  }
-  filter++;
-}
-
-if (!filter)
-  break;
-
-name = ++filter;
-
-while (*filter)
+char *filter = name;
+while (filter && *filter)
 {
   if (*filter == '|')
   {
-*filter = 0;
-filters[i].pszSpec = iupwinStrToSystem(name);
-break;
+ *filter = '\0';
+ filters[i].pszName = iupwinStrToSystem(name);
   }
-  filter++;
+  ++filter;
+  ++i;
+  if (i == 50)
+ break;
 }
-
 if (!filter)
-  break;
-
-i++;
+   break;
 name = ++filter;
-
-if (i == 50)
-  break;
   }
-
   *size = i;
   return filters;
 }
@@ -646,8 +623,8 @@
 si = winNewFileDlgParseName(wdir);
 if (si)
   hr = pfd->SetFolder(si);
-free(directory);
   }
+  free(directory);
 
   value = iupAttribGet(ih, "TITLE");
   if (value)
@@ -695,13 +672,8 @@
 dir_len = 0;
 
   iupAttribSetStrId(ih, "MULTIVALUE", 1, filename + dir_len);
-
   iupAttribSetStr(ih, "VALUE", filename);  /* here value is not 
separated by '|' */
-
   iupAttribSetInt(ih, "MULTIVALUECOUNT", 2);
-  free(dir);
-  CoTaskMemFree(pszFilePath);
-
   if (winIsFile(pszFilePath))  /* check if file exists */
   {
 iupAttribSet(ih, "FILEEXIST", "YES");
@@ -712,6 +684,8 @@
 iupAttribSet(ih, "FILEEXIST", "NO");
 iupAttribSet(ih, "STATUS", "1");
   }
+  free(dir);
+  CoTaskMemFree(pszFilePath);
 }
 else
   iupAttribSet(ih, "STATUS", "-1");
@@ -719,7 +693,7 @@
 psiResult->Release();
   }
 }
-else
+else if (opfd != NULL)
 {
   IShellItemArray *psiaResult;
 
@@ -798,8 +772,8 @@
   char *fname = iupStrFileGetTitle(filename);
   sprintf(nameid, "MULTIVALUE%d", i + 1);
   iupAttribSetStrf(ih, nameid, "%s%s", dir, fname);
-
   iupAttribSetStrf(ih, "VALUE", "%s%s|", value, 
iupAttribGetId(ih, "MULTIVALUE", i + 1));
+  free(fname);
 }
 else
 {

Best regards,
Ranier Vilela

iupwin_newfiledlg.cpp.patch
Description: iupwin_newfiledlg.cpp.patch
___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


[Iup-users] CID 210694 (#1 of 1): Unchecked return value (CHECKED_RETURN)

2019-05-25 Thread Ranier VF
Hi,
Should be return?
Or is better check return value?

--- \dll\iup\a\srccontrols\matrix\iupmat_key.c  Mon Dec 11 14:52:46 2017
+++ iupmat_key.cSat May 25 10:26:47 2019
@@ -173,7 +173,7 @@
 
 case K_CR:
   if (!ih->data->edit_hide_onfocus && ih->data->editing)
-iupMatrixEditConfirm(ih);
+return iupMatrixEditConfirm(ih);
   else
   {
 if (iupMatrixEditShow(ih))

Best regards,
Ranier Vilela

iupmat_key.c.patch
Description: iupmat_key.c.patch
___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


[Iup-users] CID 259162 (#1 of 1): Array compared against 0 (NO_EFFECT)

2019-05-25 Thread Ranier VF
Hi,
--- \dll\iup\a\src\win\iupwindows_info.cThu Apr 19 08:22:24 2018
+++ iupwindows_info.c   Sat May 25 10:21:08 2019
@@ -87,7 +87,7 @@
   sprintf(str, "%d.%d.%d", (int)osvi.dwMajorVersion, (int)osvi.dwMinorVersion, 
(int)osvi.dwBuildNumber);
 
   /* Display service pack (if any). */
-  if (osvi.szCSDVersion && osvi.szCSDVersion[0]!=0)
+  if (osvi.szCSDVersion[0]!='\0')
   {
 strcat(str, " ");
 strcat(str, osvi.szCSDVersion);

Best regards,
Ranier Vilela

iupwindows_info.c.patch
Description: iupwindows_info.c.patch
___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


[Iup-users] CID 259158 (#1 of 1): Missing break in switch (MISSING_BREAK)

2019-05-25 Thread Ranier VF
Hi,
--- \dll\iup\a\src\win\iupwin_toggle.c  Mon Aug 20 06:57:56 2018
+++ iupwin_toggle.c Sat May 25 10:17:01 2019
@@ -578,6 +578,7 @@
   case BN_DOUBLECLICKED:
 if (iupAttribGetBoolean(ih, "IGNOREDOUBLECLICK"))
   return 0;
+/* FALLTHROUGH */
   case BN_CLICKED:
 {
   Ihandle *radio;

Best regards,
Ranier Vilela

iupwin_toggle.c.patch
Description: iupwin_toggle.c.patch
___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


[Iup-users] CID 341010 (#1 of 1): 'Constant' variable guards dead code (DEADCODE)

2019-05-25 Thread Ranier VF
Hi,
--- \dll\iup\a\src\win\iupwin_label.c   Tue Nov 27 17:25:24 2018
+++ iupwin_label.c  Sat May 25 10:09:27 2019
@@ -44,7 +44,7 @@
   int xpad = ih->data->horiz_padding, 
   ypad = ih->data->vert_padding;
   int x, y, width, height, bpp;
-  HBITMAP hBitmap, hMask = NULL;
+  HBITMAP hBitmap;
   char *name;
   int make_inactive = 0;
 
@@ -85,9 +85,6 @@
   y += ypad;
 
   iupwinDrawBitmap(hDC, hBitmap, x, y, width, height, width, height, bpp);
-
-  if (hMask)
-DeleteObject(hMask);
 }
 
 static void winLabelDrawText(Ihandle* ih, HDC hDC, int rect_width, int 
rect_height, UINT itemState)

Best regards,
Ranier Vilela

iupwin_label.c.patch
Description: iupwin_label.c.patch
___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


[Iup-users] CID 210510 (#2 of 2): Unused value (UNUSED_VALUE)

2019-05-25 Thread Ranier VF
Hi,
iup_str.c:
  mm('®')= 96;  mm('°')= 97; mm('µ')= 98; mm('¶')= 99; mm('…')=100; 
mm('†')=101; mm('‡')=102; mm('•')=103;  mm('•')=104; mm('‰')=105; mm('0')=106; 
mm('¼')=107; mm('½')=108; mm('¾')=109; mm('1')=110; mm('¹')=111; 

mm('•')=103;  mm('•')=104; /* value_overwrite: Overwriting previous write to 
map_nocase[162] with value 104. */

Best regards,
Ranier Vilela

___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


[Iup-users] CID 341020 (#1 of 1): Resource leak (RESOURCE_LEAK)

2019-05-25 Thread Ranier VF
Hi,
--- \dll\iup\a\src\iup_globalsdlg.c Tue Apr 23 18:07:31 2019
+++ iup_globalsdlg.cSat May 25 09:56:52 2019
@@ -216,9 +216,8 @@
   IupSetAttributeId(list2, "", i + 1, attr_names[i]);
   IupSetIntId(list2, "_IUP_READONLY", i + 1, 0);
 }
-
-free(attr_names);
   }
+  free(attr_names);
 
   total_count = iGlobalGetRegisteredAttributes(NULL, 0);
   qsort(attribs, total_count, sizeof(iRegisteredGlobal), compare_names);
@@ -239,16 +238,18 @@
   attr_names = (char **)malloc(total_count * sizeof(char *));
   attr_count = iupGetFunctions(attr_names, total_count);
   for (i = 0; i < attr_count; i++)
+  {
 IupSetAttributeId(list3, "", i + 1, attr_names[i]);
-
+  }
   free(attr_names);
 
   total_count = IupGetAllNames(NULL, 0);
   attr_names = (char **)malloc(total_count * sizeof(char *));
   attr_count = IupGetAllNames(attr_names, total_count);
   for (i = 0; i < attr_count; i++)
+  {
 IupSetAttributeId(list4, "", i + 1, attr_names[i]);
-
+  }
   free(attr_names);
 }
 
Best regards,
Ranier Vilela

iup_globalsdlg.c.patch
Description: iup_globalsdlg.c.patch
___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


[Iup-users] CID 259157 (#2 of 2): Division or modulo by zero (DIVIDE_BY_ZERO)

2019-05-25 Thread Ranier VF
Hi,
--- \dll\iup\a\src\iup_expander.c   Mon Oct 29 14:53:02 2018
+++ iup_expander.c  Sat May 25 09:49:19 2019
@@ -384,9 +384,10 @@
   int frame_time = iupAttribGetInt(ih, "FRAMETIME");
   int num_frames = iupAttribGetInt(ih, "NUMFRAMES");
   int time_delay = iupAttribGetInt(animate_timer, "ELAPSEDTIME");
-  int height;
   int current_frame = frame_time != 0 ? time_delay / frame_time : 0;  /* 
safety check */
+  int height;
 
+  num_frames = num_frames != 0 ? num_frames : 1;  /* safety check */
   if (closing)
 height = (final_height*(num_frames - current_frame)) / num_frames;
   else

Best regards,
Ranier Vilela

iup_expander.c.patch
Description: iup_expander.c.patch
___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


[Iup-users] CID 259217 (#1 of 1): Dereference null return value (NULL_RETURNS)4. dereference: Dereferencing a null pointer cbDragDataSize.

2019-05-25 Thread Ranier VF
Hi,
Fix iupwin_dragdrop.c:
--- \dll\iup\a\src\win\iupwin_dragdrop.cWed Apr 24 17:12:36 2019
+++ iupwin_dragdrop.c   Sat May 25 09:34:29 2019
@@ -391,7 +391,7 @@
 {
   IFns cbDragDataSize;
   IFnsVi cbDragData;
-  int size;
+  int size = 0;
   void *pData;
   TCHAR type[256];
 
@@ -405,7 +405,8 @@
   winGetClipboardFormatName(pFormatEtc->cfFormat, type, 256);
 
   cbDragDataSize = (IFns)IupGetCallback(pThis->ih, "DRAGDATASIZE_CB");
-  size = cbDragDataSize(pThis->ih, iupwinStrFromSystem(type));
+  if (cbDragDataSize)
+ size = cbDragDataSize(pThis->ih, iupwinStrFromSystem(type));
   if (size <= 0)
 return STG_E_MEDIUMFULL;
 
Best regards,
Ranier Vilela

iupwin_dragdrop.c.patch
Description: iupwin_dragdrop.c.patch
___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


[Iup-users] CID 341005 (#1 of 1): Explicit null dereferenced (FORWARD_NULL)

2019-05-25 Thread Ranier VF
Hi,
--- ..\..\a\srcfiledlg\iupwin_newfiledlg.cppFri Sep 14 17:33:33 2018
+++ iupwin_newfiledlg.cpp   Sat May 25 09:09:00 2019
@@ -719,7 +719,7 @@
 psiResult->Release();
   }
 }
-else
+else if (opfd != NULL)
 {
   IShellItemArray *psiaResult;
 
Best regards,
Ranier Vilela

iupwin_newfiledlg.cpp.patch
Description: iupwin_newfiledlg.cpp.patch
___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


[Iup-users] CID 341015 (#1 of 1): Division or modulo by zero (DIVIDE_BY_ZERO)

2019-05-25 Thread Ranier VF
Hi,
Fix iup_flatscrollbar.c:
--- ..\..\a\src\iup_flatscrollbar.c Mon Jan 28 18:13:06 2019
+++ iup_flatscrollbar.c Sat May 25 08:53:03 2019
@@ -138,14 +138,19 @@
 static void iFlatScrollBarCalcHandler(int size, int arrow_size, int max, int 
d, int sb_size, int pos, int* pos1, int* pos2)
 {
   int pos_p;
-  int range_p = size - 1 - 2 * arrow_size;
-
-  int d_p = (d * range_p) / max;
-  if (d_p < sb_size) d_p = sb_size;
+  int d_p = 0;
+  const int range_p = size - 1 - 2 * arrow_size;
 
+  if (max != 0)
+  {
+ d_p = (d * range_p) / max;
+  }
+  if (d_p < sb_size)
+  {
+ d_p = sb_size;
+  }
   pos_p = (pos * (range_p - d_p)) / (max - d);
   pos_p += arrow_size;
-
   *pos1 = pos_p;
   *pos2 = pos_p + d_p;
 }

Best regards,
Ranier Vilela

iup_flatscrolball.c.patch
Description: iup_flatscrolball.c.patch
___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


[Iup-users] CID 341016 (#1 of 1): Dereference after null check (FORWARD_NULL)

2019-05-25 Thread Ranier VF
Hi,
Fix iup_globalattrib.c:
--- ..\..\a\src\iup_globalattrib.c  Tue Apr 23 14:33:33 2019
+++ iup_globalattrib.c  Sat May 25 08:42:08 2019
@@ -133,7 +133,7 @@
   iupdrvWarpPointer(x, y);
 return;
   }
-  if (iupStrEqual(name, "MOUSEBUTTON"))
+  if (value != NULL && iupStrEqual(name, "MOUSEBUTTON"))
   {
 int x, y, status;
 char bt; 

if (sscanf(value, "%dx%d %c %d", &x, &y, &bt, &status) == 4)
value can be NULL here.

Best Regards,
Ranier Vilela


iup_glbalattrib.c.patch
Description: iup_glbalattrib.c.patch
___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


[Iup-users] CID 210676 (#1 of 1): Resource leak (RESOURCE_LEAK)

2019-05-25 Thread Ranier VF
Hi,
Fix RESOURCE_LEAK at iup_attrib.c

--- ..\..\a\src\iup_attrib.cSat Jan 26 16:02:13 2019
+++ iup_attrib.cSat May 25 08:25:17 2019
@@ -1499,6 +1499,11 @@
   break;
 }
   }
+  if (name)
+  {
+ IupStoreAttribute(ih, name, value);
+ free(name);
+  }
 }
 
 Ihandle* IupSetAttributes(Ihandle *ih, const char* str)

Best regards.
Ranier Vilela

iup_attrib.c.patch
Description: iup_attrib.c.patch
___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


[Iup-users] ENC: New Defects reported by Coverity Scan for IUP - Portable User Interface

2019-05-25 Thread Ranier VF
Hi,
This a new report by Coverity about IUP 3.27 Windows port.
Best regards,
Ranier Vilela

De: scan-ad...@coverity.com 
Enviado: sábado, 25 de maio de 2019 03:02
Para: ranier_...@hotmail.com
Assunto: New Defects reported by Coverity Scan for IUP - Portable User Interface

Hi,

Please find the latest report on new defect(s) introduced to IUP - Portable 
User Interface found with Coverity Scan.

24 new defect(s) introduced to IUP - Portable User Interface found with 
Coverity Scan.
37 defect(s), reported by Coverity Scan earlier, were marked fixed in the 
recent build analyzed by Coverity Scan.

New defect(s) Reported-by: Coverity Scan
Showing 20 of 24 defect(s)


** CID 341021:  Parse warnings  (PARSE_ERROR)
/include/atlbase.h: 73 in ()



*** CID 341021:  Parse warnings  (PARSE_ERROR)
/include/atlbase.h: 73 in ()
67  #error ATL requires C++ compilation (use a .cpp suffix)
68 #endif
69 #ifndef ATL_NO_LEAN_AND_MEAN
70 #define ATL_NO_LEAN_AND_MEAN
71 #endif
72
>>> CID 341021:  Parse warnings  (PARSE_ERROR)
>>> cannot open source file "atldef.h"
73 #include 
74
75 #ifndef _WINSOCKAPI_
76 #include 
77 #endif
78

** CID 341020:  Resource leaks  (RESOURCE_LEAK)
/src/iup_globalsdlg.c: 239 in iGlobalsUpdate()



*** CID 341020:  Resource leaks  (RESOURCE_LEAK)
/src/iup_globalsdlg.c: 239 in iGlobalsUpdate()
233 IupSetAttributeId(list1, "", j + 1, attribs[i].name);
234 IupSetIntId(list1, "_IUP_READONLY", j + 1, attribs[i].readonly);
235 j++;
236   }
237
238   total_count = iupGetFunctions(NULL, 0);
>>> CID 341020:  Resource leaks  (RESOURCE_LEAK)
>>> Overwriting "attr_names" in "attr_names = (signed char 
>>> **)malloc(total_count * 4U)" leaks the storage that "attr_names" points to.
239   attr_names = (char **)malloc(total_count * sizeof(char *));
240   attr_count = iupGetFunctions(attr_names, total_count);
241   for (i = 0; i < attr_count; i++)
242 IupSetAttributeId(list3, "", i + 1, attr_names[i]);
243
244   free(attr_names);

** CID 341019:  Error handling issues  (CHECKED_RETURN)
/src/win/iupwin_label.c: 301 in winLabelMsgProc()



*** CID 341019:  Error handling issues  (CHECKED_RETURN)
/src/win/iupwin_label.c: 301 in winLabelMsgProc()
295 }
296   case WM_XBUTTONUP:
297   case WM_LBUTTONUP:
298   case WM_MBUTTONUP:
299   case WM_RBUTTONUP:
300 {
>>> CID 341019:  Error handling issues  (CHECKED_RETURN)
>>> Calling "iupwinButtonUp" without checking return value (as is done 
>>> elsewhere 8 out of 10 times).
301   iupwinButtonUp(ih, msg, wp, lp);
302   break;
303 }
304   case WM_MOUSEMOVE:
305   {
306 if (iupwinMouseMove(ih, msg, wp, lp))

** CID 341018:  Resource leaks  (RESOURCE_LEAK)
/srcfiledlg/iupwin_newfiledlg.cpp: 852 in winNewFileDlgPopup(Ihandle_ *, int, 
int)()



*** CID 341018:  Resource leaks  (RESOURCE_LEAK)
/srcfiledlg/iupwin_newfiledlg.cpp: 852 in winNewFileDlgPopup(Ihandle_ *, int, 
int)()
846
847   if (opfd)
848 opfd->Release();
849   if (spfd)
850 spfd->Release();
851
>>> CID 341018:  Resource leaks  (RESOURCE_LEAK)
>>> Variable "directory" going out of scope leaks the storage it points to.
852   return IUP_NOERROR;
853 }
854
855 extern "C" {
856 /* the only exported function,
857once called it will replace regular IupFileDlg */

** CID 341017:  Security best practices violations  (STRING_OVERFLOW)
/src/win/iupwin_image_wdl.c: 383 in iupwinWdlImageGetImage()



*** CID 341017:  Security best practices violations  (STRING_OVERFLOW)
/src/win/iupwin_image_wdl.c: 383 in iupwinWdlImageGetImage()
377   if (make_inactive)
378 strcat(cache_name, "_INACTIVE");
379
380   if (iupAttribGet(ih, "_IUP_BGCOLOR_DEPEND") && bgcolor)
381   {
382 strcat(cache_name, "(");
>>> CID 341017:  Security best practices violations  (STRING_OVERFLOW)
>>> You might overrun the 100-character fixed-size string "cache_name" by 
>>> copying "bgcolor" without checking the length.
383 strcat(cache_name, bgcolor);
384 strcat(cache_name, ")");
385 bg_concat = 1;
386   }
387
388   /* Check for an already created native image */

** CID 341016:  Null pointer dereferences  (FORWARD_NULL)


___

[Iup-users] IUP 3.27: iupObjectCheck raise segmentation fault

2019-05-24 Thread Ranier VF
Hi,
I'm around with a IUP bug. Below show the callstack:
 may be wrong.
1288cfb0 0111 006a iup!iupObjectCheck+0x8
1288cfb0 0111 006a iup!iupdrvImageDestroy+0x2dbf
000303de 0111 006a iup!iupwinBaseMsgProc+0x61f
03df3160 000303de 0111 USER32!GetDC+0x6d
 03df3160 000303de USER32!GetDC+0x14f
005fc5a8 025f8a60 006a USER32!GetParent+0x16c
000303de 0111 006a USER32!SendMessageW+0x49
025fc658  025fc658 USER32!CreateMDIWindowA+0x1bd
074f4fc4 0001  USER32!DeregisterShellHookWindow+0x6312
025fc658 0202  USER32!IsDlgButtonChecked+0x109a
00a1036e 0202  USER32!IsDlgButtonChecked+0x437
7e3751d1 00a1036e 0202 USER32!GetDC+0x6d
 7e3751d1 00a1036e USER32!GetDC+0x14f
7e3751d1 00a1036e 0202 USER32!IsWindowUnicode+0xa1
7e3751d1 00a1036e 0202 USER32!CallWindowProcW+0x1b
00a1036e 0202  iup!iupwinBaseMsgProc+0x657
03df3160 00a1036e 0202 USER32!GetDC+0x6d
 03df3160 00a1036e USER32!GetDC+0x14f
0012fe1c  7e36929b USER32!GetWindowLongW+0x127
0012fe1c 0127f6ee 0127f742 USER32!DispatchMessageW+0xf
7c929f95 050f6f68 003943a0 iup!IupMainLoop+0xa6
0001 050f0fd0 05098f68 accman!main(int argc = , char 
** argv = )+0x200 (FPO: [Non-Fpo]) (CONV: cdecl) 
[c:\usr\src\accman\app.c @ 182]
0012fff0 7c817067 0127f6ee accman!__tmainCRTStartup(void)+0x1bf (FPO: 
[Non-Fpo]) (CONV: cdecl) [f:\dd\vctools\crt_bld\self_x86\crt\src\crtexe.c @ 555]
0127f6ee 0127f742 7ffd5000 accman!mainCRTStartup(void)+0xf (FPO: [Non-Fpo]) 
(CONV: cdecl) [f:\dd\vctools\crt_bld\self_x86\crt\src\crtexe.c @ 371]
00480b70  78746341 KERNEL32!RegisterWaitForInputIdle+0x49

iupObjectCheck raise segmentation fault with access violation.
Unfortunately, dont have iup lib with full debug symbols.

Best regards,
Ranier Vilela

___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


Re: [Iup-users] IUP 3.27

2019-05-02 Thread Ranier VF
Hi Scuri,
Thank you for the release.
Tested and works fine!

Best regards,
Ranier Vilela

De: Antonio Scuri 
Enviado: terça-feira, 30 de abril de 2019 20:19
Para: IUP discussion list.
Assunto: [Iup-users] IUP 3.27

Hi All,

   We just released IUP version 3.27.

   We would like to highlight some of the new features:

  *   New: TABTYPE attribute for IupFlatTabs. Now tabs can be at top, bottom, 
left or right around its children.
  *   New: ORIENTATION attribute for IupGauge.
  *   New: MERGEVIEW, PADDING, AXS_*POSITION and AXS_*REVERSETICKSLABEL 
attributes for IupPlot. To be able to merge two different plots aligning their 
axis, and choose which side of the axis goes labels and ticks.
  *   New: FLOATING attribute support for IupTabs and IupFlatTabs.
  *   New: CHILDSIZEALL attribute for IupZbox, IupTabs and IupFlatTabs. To 
allow the layout to be affected only by the visible child.
  *   New: IupFlatList control that behaves as a IupList with DROPDOWN=NO and 
EDITBOX=NO, but with more control over its parameters.
  *   New: IupGlobalsDialog pre-defined dialog to manage global attributes, 
functions and names. Can be shown from IupLayoutDialog menu.
  *   Changed: the IupDraw function are now using GDI again in Windows. 
Direct2D was very slow for drawing controls with integer coordinates in dialogs 
with complex layout. To compensate the lost of antialiasing and alpha in GDI, 
we added a hack to use GDI+.

   You can find the complete list of changes and files for download at:

http://www.tecgraf.puc-rio.br/iup/
http://iup.sourceforge.net/

Best Regards,
Antonio Scuri



___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


Re: [Iup-users] IUP-3.26 IupMatrix regression?

2019-01-17 Thread Ranier VF
Hi Scuri,
Thank you.
There is a chance of a new build of IUP-3.26?

Best regards,
Ranier Vilela

De: Antonio Scuri 
Enviado: quarta-feira, 16 de janeiro de 2019 15:42
Para: IUP discussion list.
Assunto: Re: [Iup-users] IUP-3.26 IupMatrix regression?

   It was one fix that exposed another bug.

  Just fixed this other bug and committed to SVN.

Best,
Scuri


Em ter, 15 de jan de 2019 às 14:43, Ranier VF 
mailto:ranier_...@hotmail.com>> escreveu:
Hi,
Maybe this is expected behavior or be a regression.

txt_medium_size = 14;
IupSetInt(mat_items, "FONTSIZE", txt_medium_size);

IupMatrix with IUP-3.26, all fonts are small.
IupMatrix with IUP-3.25, all fonts are big.

IUP-3.26, IupMatrix ignores FONTSIZE attribute or fontsize=14,
is really small and IUP-3.25 was wrong?

Best regards,
Ranier Vilela

___
Iup-users mailing list
Iup-users@lists.sourceforge.net<mailto:Iup-users@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/iup-users


___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


[Iup-users] IUP-3.26 IupMatrix regression?

2019-01-15 Thread Ranier VF
Hi,
Maybe this is expected behavior or be a regression.

txt_medium_size = 14;
IupSetInt(mat_items, "FONTSIZE", txt_medium_size);

IupMatrix with IUP-3.26, all fonts are small.
IupMatrix with IUP-3.25, all fonts are big.

IUP-3.26, IupMatrix ignores FONTSIZE attribute or fontsize=14, 
is really small and IUP-3.25 was wrong?

Best regards,
Ranier Vilela

___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


Re: [Iup-users] Dropdown plus editbox -- how best to get value

2019-01-14 Thread Ranier VF
Hi,
I'm using callback VALUECHANGED_CB with list control, to populate
another list control, when user selects one item. Inside function, I use
VALUE attribute to know what item was selected.
But, my list controls don´t allow edition, or, EDITBOX=NO.

If this can help you, I use too AttributeHandle to link one list control 
with another list control, in C:
Ihandle * ih = IupGetAttributeHandle(list, "list_city_uid");

ih will be populated according user selection.

Best regards,
Ranier Vilela


De: helen.wri...@atiras.com 
Enviado: segunda-feira, 14 de janeiro de 2019 12:55
Para: iup-users@lists.sourceforge.net
Assunto: [Iup-users] Dropdown plus editbox -- how best to get value

I have a list control (Place) with both dropdown and editbox true. The user can 
either select an existing value or enter a new one.  Using IUP 3.5 with Lua 
under windows.

If they select an existing value, I need to populate a second list control 
(Address) – also dropdown and editbox – with the known addresses for the 
selected Place.

If they enter a new Place via the editbox, I need to eliminate duplicate spaces 
and check if it is still a new Place. If it’s not new, I need to select the 
‘duplicate’ Place (the one they should have selected) and populate the Address 
list; if it is new, I need to update a lookup table and clear the Address list.

I’m trying to determine the best call backs to use to implement this.

Should I be using Action to detect is an existing item is selected? If I’m 
reading the documentation correctly, because it’s an editbox, Place.VALUE won’t 
tell me what the selected item is if it’s an existing item, but the text and 
parameters for the Action callback will?

Or Valuechanged? Again, Place.VALUE won’t help for an existing item.

Or should I be using a combination – if Action fires, then an existing item has 
been selected (does it fire if a new item is added?); and if Valuechanged 
fires, it’s a new item? Or might they both fire, in which case what would be 
the order.

And if so, how do I define two callbacks within this (parameterised) structure:

function MakeList(options)
   local l = iup.list{}
if options.callback ~= nil then
local callback = options.callback
local ebox = (options.editbox or "NO") == "YES"
if ebox then
l = iup.list{valuechanged_cb = function(self) callback() end}
else
l =iup.list{killfocus_cb = function(self) callback() end }
end
end
l.editbox = options.editbox or "NO"
   l.dropdown=options.dropdown or "YES"
   return l
end








___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


Re: [Iup-users] Iup LuaJIT change windows style

2018-11-25 Thread Ranier VF
Hi,
Maybe this can help you.
https://docs.microsoft.com/en-us/windows/desktop/controls/cookbook-overview

Best regards.
Ranier

De: Johann Philippe via Iup-users 
Enviado: domingo, 25 de novembro de 2018 17:59
Para: Antonio Scuri
Cc: Johann Philippe; IUP discussion list.
Assunto: Re: [Iup-users] Iup LuaJIT change windows style

I'll check that.
Thanks for all !
Johann

Le dimanche 25 novembre 2018 à 17:21:50 UTC+1, Antonio Scuri 
 a écrit :


  Yes, it is something in the Windows configuration.

  I older Windows you could use a classic theme so all application will have 
the classic look without the visual styles. In Windows 10, the classic look 
option is not there, but maybe other parameter on the Control Panel does that. 
I have no idea.

Best,
Scuri


Em dom, 25 de nov de 2018 às 14:16, Johann Philippe 
mailto:johannphili...@yahoo.fr>> escreveu:
It seems to be the same in the Iup test app. May it be the Windows 10 config ?
Le dimanche 25 novembre 2018 à 16:59:28 UTC+1, Antonio Scuri 
mailto:antonio.sc...@gmail.com>> a écrit :


  That's weird because the application should work with or without the Manifest 
only the appearance of the common controls . What's not working?

  Regarding the default file, probably TEC_64 is not defined and has the same 
effect as commenting the manifest include, because the 32 bit manifest will not 
work for a 64 bit executable.

  Regarding the visual styles, the regular IUP test applications (pre-compiled 
available for download) the visual styles are OK?

Best,
Scuri


Em dom, 25 de nov de 2018 às 13:48, Johann Philippe 
mailto:johannphili...@yahoo.fr>> escreveu:
In fact, the manifest is useful. I use the iup64.manifest. i removed some of 
the last lines in the .rc file so that remain only  :
1 24 iup64.manifest
And if i comment this, the application doesn't work. If i keep this line, the 
application still works, but still using classic visual style.


Le dimanche 25 novembre 2018 à 16:15:03 UTC+1, Antonio Scuri 
mailto:antonio.sc...@gmail.com>> a écrit :


  Hi,

  Check if you are using the correct manifest file for 32 or 64 bits.

  You can take a look at LuaBinaries distribution source files. There manifests 
for both. The IUP source package also contains sample manifests.

Best,
Scuri


Em dom, 25 de nov de 2018 às 12:44, Johann Philippe 
mailto:johannphili...@yahoo.fr>> escreveu:
Some precisions : i'm compiling some Lua code with the lua C api, using iup 
precompiled.

Le dimanche 25 novembre 2018 à 15:41:33 UTC+1, Johann Philippe 
mailto:johannphili...@yahoo.fr>> a écrit :


I'm compiling the application with gcc. So i did pre-compile the iup.rc to an 
object file .o, and compiled my project like this :
gcc myapp.c myrc.o -I... -L... -o myapp.exe
The rc seems to work well since the application icon "tecgraf" is used. But the 
windows style isn't changed. So i'm wondering if the manifest is really working 
here ?



Le samedi 6 octobre 2018 à 13:41:16 UTC+2, Antonio Scuri 
mailto:antonio.sc...@gmail.com>> a écrit :


  Yes, when you build the application.

  Add a Windows RC file to the project. See the IUP documentation in System / 
Drivers / Win32.

Best,
Scuri


Em sáb, 6 de out de 2018 08:30, Johann Philippe 
mailto:johannphili...@yahoo.fr>> escreveu:
Thank for the answer.
To be sur I understand well - the manifest is not used when I compile the IUP 
source, but it's used when i build an application from my IUP program ?
What should i write then to make it work with Windows w/ style  instead of 
classic style ?

Thanks in advance
Johann

Le jeudi 4 octobre 2018 à 13:08:34 UTC+2, Antonio Scuri 
mailto:antonio.sc...@gmail.com>> a écrit :


  Hi,

  The style is changed by using a Manifest when building the executable. You 
can find a Manifest file for that purpose in the iup/etc folder.

Best,
Scuri


Em qui, 4 de out de 2018 06:15, Johann Philippe via Iup-users 
mailto:iup-users@lists.sourceforge.net>> 
escreveu:
Dear all,

I'm using LuaJIT 2.0.3 (Terra project) and the IUP precompiled binaries, and 
i'd like to know if it is possible to change the windows style ? Or is it only 
possible at build time ?
Default is windows classic.

Regards
Johann Philippe
___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


[Iup-users] IupDatePick ignores solemnly READONLY=YES attribute.

2018-08-26 Thread Ranier VF
Hi,
IUP 3.25
IupDatePick ignores solemnly READONLY=YES attribute.

Best regards,

Ranier Vilela.
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


[Iup-users] Help the user (IupGetParam behavior)

2018-07-25 Thread Ranier VF
Hi Scuri,

IupGetParam("Test", NULL, 0, "Number: %i\n", &number);

Always show the dialog with 0 filled, this disrupts usability.
Aways user must be delete 0 to digit correct number.

Is possible change behavior IupGetParam to start with empty value?

Best regards,
Ranier Vilela
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


[Iup-users] [SOLVED] Re: IUP crash with release app (msvc 2010)

2018-07-23 Thread Ranier VF
Hi,
Solved finally, heap corrupted.
Howto prevent:

ASSERT(strlen(buf) < sizeof(buf);

Best regards,
Ranier Vilela

De: Ranier VF 
Enviado: segunda-feira, 23 de julho de 2018 17:06
Para: IUP discussion list.
Assunto: [Iup-users] IUP crash with release app (msvc 2010)

Hi,
I have dealing with a insidius bug in my app. If somebody can help, I thank you 
so much.
This line:
 IupSetStrAttributeId2(mat, "", nrows, 0, item_code);

run normally with DEBUG version (msvc 2010), but with RELEASE version, crash!

This exception may be expected and handled.
eax=00174325 ebx=016252e8 ecx=6c75462e edx= esi=01f65220 edi=6c75462e
eip=10001fd0 esp=0012f500 ebp=00174355 iopl=0 nv up ei pl nz na pe nc
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs= efl=00010206
iup!IupStoreAttributeId2+0x20:
10001fd0 803f49  cmp byte ptr [edi],49h ds:0023:6c75462e=??

Why?
iup library is the same (release version 3.25) for both DEBUG and RELEASE app.

How debug a release version with msvc 2010?

I breaking IUP library, somewhere, but I do not know how.

Thanks.
Ranier Vilela

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


[Iup-users] IUP crash with release app (msvc 2010)

2018-07-23 Thread Ranier VF
Hi,
I have dealing with a insidius bug in my app. If somebody can help, I thank you 
so much.
This line: 
 IupSetStrAttributeId2(mat, "", nrows, 0, item_code);

run normally with DEBUG version (msvc 2010), but with RELEASE version, crash!

This exception may be expected and handled.
eax=00174325 ebx=016252e8 ecx=6c75462e edx= esi=01f65220 edi=6c75462e
eip=10001fd0 esp=0012f500 ebp=00174355 iopl=0 nv up ei pl nz na pe nc
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs= efl=00010206
iup!IupStoreAttributeId2+0x20:
10001fd0 803f49  cmp byte ptr [edi],49h ds:0023:6c75462e=??

Why?
iup library is the same (release version 3.25) for both DEBUG and RELEASE app.

How debug a release version with msvc 2010?

I breaking IUP library, somewhere, but I do not know how.

Thanks.
Ranier Vilela

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


Re: [Iup-users] Use utf-8 source encoding rather than ISO8859-1

2018-07-19 Thread Ranier VF
Hi,
Thanks for a clear explanation and simple solution for the problem.

Best regards,
Ranier Vilela

De: Theron 
Enviado: quarta-feira, 18 de julho de 2018 21:03
Para: iup-users@lists.sourceforge.net
Assunto: Re: [Iup-users] Use utf-8 source encoding rather than ISO8859-1

Returning to the original issue of string encoding in source:

This needn't be a Windows/non-Windows problem, or UTF-8 vs. -16, or any other 
conflict over platform and standard compatibility.

I encountered the string encoding problem just last month when I worked on 
porting IUP to a system using the Clang compiler; the following is more of a 
summary of the problem and its workaround than anything which hasn't already 
been discovered or acknowledged in this thread:

The intent in iup_str.c and iup_strmessage.c appears to be that the exact byte 
or byte string between quotes be copied into the constant string data compiled 
into the library: the compiler should not try to reinterpret the byte sequences 
in any way; this is the job of IUP, the OS, and/or third-party libraries at 
run-time.

However, not all compilers expect to use character and string literals in this 
way.  The lowest common denominator of various ways a compiler may try to 
interpret the string may be reasonably assumed to be ASCII, therefore any bytes 
in range 128-255 should be represented using escapes rather than pasted 
directly in the source.

So although Cloud Wu suggested converting source encoding "from ISO8859-1 to 
UTF-8", the intent is to restrict source itself to ASCII (no UTF-8!), while 
preserving the raw byte strings the source intends to represent in whichever 
ISO8859-1/UTF-8/UTF-16 encoding is already used.

If done correctly, this would not change the compiled library in any way.

The remaining issue, of course, is this:

On 07/18/18 07:06, 云风 Cloud Wu wrote:
Antonio Scuri 
mailto:antonio.sc...@gmail.com>>于2018年7月18日周三 下午6:15写道:
  Although being harmless, it turns maintenance of these strings more 
difficult. I wouldn't like that.

For iupmatex_units.c , I agree it turns maintenance more difficult. I suggest 
using a macro to improve it.


A potentially cleaner solution is to maintain a single master file of string 
constants, encoded in whatever encoding is preferred for editing, and to 
generate the relevant parts of iup*_str*, iup*_units*, etc. programmatically.

In porting IUP to FreeBSD, where Clang compiler is default and preferred, I 
used small conversion programs to convert the string literals as needed.  These 
are attached.  Once compiled, the conversion utilities read source from stdin 
and write adjusted source to stdout.

Should the IUP project insist on continuing to release iup_str.c and 
iup_strmessage.c with the existing mixed-encoding literals, these conversion 
utilities would need to become part of the routine procedure for the maintainer 
of the FreeBSD port to import upstream changes.  (This also applies to a port 
of IUP to MacOS, another system where Clang is default.  More on this later...) 
 Instead of maintaining this conversion scheme independently, it seems sensible 
to try to integrate this with the master IUP project.  In the interest of 
making IUP more portable across diverse platforms, I would be happy to help 
with this.

Theron
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


[Iup-users] IUP 3.25 Release

2018-06-03 Thread Ranier VF
Hi Scuri,

Great news, thank you for the new release IUP 3.25.
Most GDI USAGE ERRORS, is gone, remain 2 only.

Error #6: GDI USAGE ERROR: free mismatch for DC 0x9d01119f: use ReleaseDC only 
for GetDC and DeleteDC only for CreateDC
Error #7: GDI USAGE ERROR: free mismatch for DC 0x44010fcd: use ReleaseDC only 
for GetDC and DeleteDC only for CreateDC

I believe iup.dll!iupdrvDrawKillCanvas, is responsible.

Anyway, many thanks for the hard work.

Regards,
Ranier Vilela
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


Re: [Iup-users] Formal proposal for a "postMessage" API to send messages to run on the UI thread

2018-04-19 Thread Ranier VF
Hi,

"Please ignore anyone who says "I don't need it so you can't have it" -  but, 
obviously, it has to be a
solution that causes them no pain when/if it does go in, and your proposal 
sounds just like that to me."

I do not know if it was addressed to me. But I will answer anyway.
I not agaist IupPostMessage. Ok.

I against windows only implementation proposal, which adds,
unnecessary extra bagage to slow platform!
IUP have a lots features like windows only, GTK only.

Everything I request is use a PostMessage function in windows implementation.
Which requires use IUP function IupSetAttributeHandle to work.
Using PostMessage it is not necessary touch windows event loop and
add filters hooks inside IUP Windows Driver.

Anyway, Eric proposal add one skilled filter IWIN_POSTMESSAGE_ID.
Now if anybody wants add more filters?
Easily we will soon have array of filters inside windows loop.

Best regards,
Ranier Vilela

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


Re: [Iup-users] Formal proposal for a "postMessage" API to send messages to run on the UI thread

2018-04-19 Thread Ranier VF
Hi,
"IUP should not be the solution to every problem. It would be like
incorporating a cross-platform C-runtime into IUP when that is the wrong
approach. IUP is great as it is and for specialized problems it will never be
able to beat a mature third party app, and right now my favorite app for the
kinds of issues you are discussing is ØMQ (http://zeromq.org),  but I'm sure
there are other apps out there that will do just fine."

I think that IUP can be used in threads apps too. But.
Without add framework, and extra bagage for this.
Update GUI outside main thread, is very danger and can crash easily app.

Gold rule, don't update GUI outside main thread!
Use callbacks for this. Windows have a PostMessage function, that solves
correctly this problem.

IupPostMessage is welcome, but, whithout change behavior to non-threaded
apps.

Best Regards,
Ranier Vilela
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


Re: [Iup-users] Formal proposal for a "postMessage" API to send messages to run on the UI thread

2018-04-19 Thread Ranier VF
Hi,

"This proposal is a tiny patch to IUP, one that nobody except the
implementors will notice. It does not break current behavior or create
any trade offs. But it solves real problems deal with the fact that
the real world uses threads, even inside the native platforms. If you
don't have this problem, then it doesn't matter because this change
won't affect you."

I can not agree. 99% percent of GUI app are non-threaded.
Your patch, change this behavior add one function call to every
message received by event loop, unnecessary, to non-threaded apps.

Best regards,
Ranier Vilela

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


Re: [Iup-users] Formal proposal for a "postMessage" API to send messages to run on the UI thread

2018-04-19 Thread Ranier VF
Hi,

"I think we're in agreement here. The idea of "IupPostMessage",
inspired from Windows PostMessage solves this problem elegantly. The
implementation specific ways to pull this off on each platform are
hidden from the user perspective."

Great.

"From my "Idea 2" proposal, what I'm suggesting is the IUP API should
be able to take *any* Ihandle*.
// All I want to do is change my button's ACTIVE state.
IupPostMessage(my_iup_button, 42, audio_data);"

Use IUP style and tools.
IupSetAttributeHandle(my_iup_button, "the_dialog", the_dialog);
Now you have a native handler (windows handler) inside your
button widget and easy use PostMessage to solve GUI update without
add any cost and more unnecessary functions calls

"This is more natural in how people may want to use it. I want to
change the button. From an objective standpoint, if I just want to
change the button, it makes no sense to think about a dialog.
So I think it is less reasonable to demand that I do:
// All I want to do is change my button's ACTIVE state. Why am
I passing a dialog?
IupPostMessage(some_dialog, 42, audio_data);
And then in the callback, figure out how to get my_iup_button."

Again, IUP have a style for this.

"I don't think this is a legitimate or fair argument. Unless you can
demonstrate in a real world context where this one call will have a
measurable performance impact, the cost of this one instruction is a
rounding error. (There's quite a bit of other stuff you would want to
focus on first in the IUP codebase if you were worried about this
minutia of performance.) Remember, we're talking about Windows where
they've optimized the heck out of this low-level stuff and everybody
is on powerful CPUs with branch-prediction and tons of cache. We're
not talking about 6502's here."

IUP have a lot slow algorithms: array dynamic implementation is very 
inefficient,
hash string too. Add more inefficiencies do not help.
Kiss please. Less is more.

"I think we agree again."
Good to know.

"I merely argue that PostThreadMessage is a better, more general, and
more correct solution than PostMessage. If PostMessage can be made to
work and address the shortcomings I believe it has, then I would
happily give it my blessing.
Ultimately, this is an implementation issue. It's only constraint is
what we want the public API to be able to handle. Nobody in the end is
going to know the difference if we do it right."

Again, Raymond Chen, explain: "The correct solution was illustrated last time."
https://blogs.msdn.microsoft.com/oldnewthing/20050427-10/?p=35763
PostTheardMessage is the complicated and wrong way to solve this.

"Again, I think that is a very unfair accusation to level against me.
I have presented a working prototype, a specification of the feature,
and a general implementation plan."

I'm sorry, but technical arguments is welcome, bogus arguments not.

"As part of the Windows specific implementation, I include explanation
of why I think PostThreadMessage is better than PostMessage: because
it allows us to construct a general API that takes any widget,
allowing the user focus on any widget instead of a just a dialog.
If I misunderstand how PostMessage works, and it can be used for
arbitrary controls (e.g. the button and not just dialogs), then I will
happily cede to that point. That is the thing I hope somebody will
address, but so far, nobody has corrected that specific point."
Again, using IUP style and tools.
Add reference  to your controls and you have all necessary to make the work.

Best regards,
Ranier Vilela

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


Re: [Iup-users] Formal proposal for a "postMessage" API to send messages to run on the UI thread

2018-04-18 Thread Ranier VF
Hi,
I strong believe thar PostMessage solves the request:  "update gui, outside 
main thread" 
Native handles, like Windows Handle, is hidden from the user perspective.
Therefore using in Windows driver and not using in GTK, IOS and Android 
drivers, will not disturb users.
In your example, You use a button widget, but can receive and process all 
messages is the Window Handler inside "Ihandle the_dialog."
In this way, add one field to store native handler, in user_data structure
and use only with Windows Functions API formal proposal.

Users do not will ask if IUP_PostMessage is implemented in different ways
in Windows, GTK, IOS or Android. Running...

Touching Windows Event Loop will add one branch and one function call,
in every message received by app, slowing down more and more.

Summing up:
All drivers are free to implement in your own way, and from the users 
perspective,
no matter how it was solved.
Using Native Handler (windows), inside API, hidden from the user, works.
PostMessage solves the problem, without add any cost and slowing event loop.

Attempts to confuse the discussion, with evasive allegations, as users doubts, 
they do not help!

Best regards,
Ranier Vilela

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


Re: [Iup-users] Formal proposal for a "postMessage" API to send messages to run on the UI thread

2018-04-18 Thread Ranier VF
Hi,
I strong believe thar PostMessage solves the request:  "update gui, outside 
main thread" 
Native handles, like Windows Handle, is hidden from the user perspective.
Therefore using in Windows driver and not using in GTK, IOS and Android 
drivers, will not disturb users.
In your example, You use a button widget, but can receive and process all 
messages is the Window Handler inside "Ihandle the_dialog."
In this way, add one field to store native handler, in user_data structure
and use only with Windows Functions API formal proposal.

Users do not will ask if IUP_PostMessage is implemented in different ways
in Windows, GTK, IOS or Android. Running...

Touching Windows Event Loop will add one branch and one function call,
in every message received by app, slowing down more and more.

Summing up:
All drivers are free to implement in your own way, and from the users 
perspective,
no matter how it was solved.
Using Native Handler (windows), inside API, hidden from the user, works.
PostMessage solves the problem, without add any cost and slowing event loop.

Attempts to confuse the discussion, with evasive allegations, as users doubts, 
they do not help!

Best regards,
Ranier Vilela

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


Re: [Iup-users] Formal proposal for a "postMessage" API to send messages to run on the UI thread

2018-04-18 Thread Ranier VF
Hi, 
Obviously I'm not saying to Call PostMessage Windows function, 
in other platforms.
So I understood, only have problem is Windows Loop Event (IUP),
and the autor what do you cite, say clearly that PostThreadMessage
is wrong way to solve this (update GUI in another thread).

Best,
Ranier Vilela

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


Re: [Iup-users] Formal proposal for a "postMessage" API to send messages to run on the UI thread

2018-04-18 Thread Ranier VF
Hi,

"But in when using IUP, we can't just reasonably call Window's
PostMessage because it is not cross-platform. It won't work on any
other platform except Windows.
This whole proposal is on how to make something like PostMessage
cross-platform."

It's OK, but in your app example, I dont see any about event loop in
GTK, Apple or Android. Only reference about Windows Event Loop.

Can you show why other events loops, do not work like PostMessage
windows API.
or
better saying, touch IUP Event Loop in (GTK, Apple and Android)?

Best regards,
Ranier Vilela
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


Re: [Iup-users] Formal proposal for a "postMessage" API to send messages to run on the UI thread

2018-04-18 Thread Ranier VF
Hi,

"This is a proposal to introduce a way to post and run events on the
main UI thread."

Just my two cents too.

All this is related with GUI update, in another thread, other the main thread.
Then other types updates, should not interfere with IUP.

IUP Dialog have a WID (windows HWND). Why not use PostMessage and
leave Windows do work?
BOOL WINAPI PostMessage(
  _In_opt_ HWND   hWnd,
  _In_ UINT   Msg,
  _In_ WPARAM wParam,
  _In_ LPARAM lParam
);

Best,
Ranier Vilela

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


Re: [Iup-users] Formal proposal for a "postMessage" API to send messages to run on the UI thread

2018-04-18 Thread Ranier VF
Hi,

"This is a proposal to introduce a way to post and run events on the
main UI thread."

Just my two cents too.

All this is related with GUI update, in another thread, other the main thread.
Then other types updates, should not interfere with IUP.

IUP Dialog have a WID (windows HWND). Why not use PostMessage and
leave Windows do work?
BOOL WINAPI PostMessage(
  _In_opt_ HWND   hWnd,
  _In_ UINT   Msg,
  _In_ WPARAM wParam,
  _In_ LPARAM lParam
);

Best,
Ranier Vilela


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


Re: [Iup-users] IupFlatTabs issue?

2018-03-07 Thread Ranier VF
Hi,
Why not GTK 3.22.28, the latest gtk?
Support multiple versions is very expensive.

Notice Firefox will drop gtk2!

Best regards,
Ranier Vilela


De: 許永寬 
Enviado: quarta-feira, 7 de março de 2018 13:02
Para: IUP discussion list.
Assunto: Re: [Iup-users] IupFlatTabs issue?

It's:
GTK Version=3.18.9
GTK Dev Version=3.18.9


2018-03-07 20:14 GMT+08:00 Antonio Scuri 
mailto:antonio.sc...@gmail.com>>:
  Hi,

  Thanks for the feedback.

  You have installed both GTKs, but I need to know which GTK that IUP is using. 
You can do this, after IupOpen:

printf("GTK Version=%s", IupGetGlobal("GTKVERSION"));
printf("GTK Dev Version=%s", IupGetGlobal("GTKDEVVERSION"));

  They should be equal.

Best,
Scuri

2018-03-07 9:07 GMT-03:00 許永寬 
mailto:nagahiro@gmail.com>>:
Dear Scuri:

The picture about the issue:
https://i.imgur.com/JPtF0Rj.png

Top one is the GTK version
Bottom-L is use IupTabs, the selection and V-scrollbar is show correctly
Bottom-R is use IupFlatTabs, the selection become same color as background and 
the V-scrollbar is disappear( but can work)

2018-03-07 7:19 GMT+08:00 Antonio Scuri 
mailto:antonio.sc...@gmail.com>>:
  Ok.

  You had a similar issue in October last year, right?

  Can you check what is the GTK version on your system?

  And send screenshots of the problem with IupTabs and IupFlatTabs?

Thanks,
Scuri


2018-03-06 14:47 GMT-03:00 許永寬 
mailto:nagahiro@gmail.com>>:
Sorry, I'm test on Linux mint 18.3 Cinnamon 64bit, I also compile same code on 
Win7, it is OK no problem~

2018-03-07 1:45 GMT+08:00 許永寬 
mailto:nagahiro@gmail.com>>:
Dear Scuri:

I test below at IUP3.23 / 3.24, the selection of IupText is the same as 
background color( can't see ), but it's OK if using IupTabs

D Language:
void main()
{
if( IupOpen( null, null ) == IUP_ERROR )
{
Stdout( "IUP open error!!!" ).newline;
return;
}

Ihandle* mainDlg = IupDialog( null );
IupSetHandle( "MAIN_DIALOG", mainDlg );
IupSetAttributes( mainDlg, "SHRINK=YES,SIZE=300x200,TITLE=TEST" );


Ihandle* text0 = IupText( null );
IupSetAttributes( text0, "EXPAND=YES,MULTILINE=YES=YES,WORDWRAP=YES" );

Ihandle* text1 = IupText( null );
IupSetAttributes( text1, "EXPAND=YES,MULTILINE=YES=YES,WORDWRAP=YES" );

//Ihandle* tabs = IupTabs( text0, text1, null );
Ihandle* tabs = IupFlatTabs( text0, text1, null );
IupSetAttributeId( tabs, "TABTITLE", 0, "TEST0" );
IupSetAttributeId( tabs, "TABTITLE", 1, "TEST1" );

IupAppend( mainDlg, tabs );

// Shows dialog
IupShow( mainDlg );


//IUP main Loop
IupMainLoop();
IupClose();
}


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users



--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users



--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users



--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


Re: [Iup-users] Confused by $(BIN2C); using Subversion repo...

2018-03-01 Thread Ranier VF
Hi,
If I understood, sur-behoffski, wants to know, howto
pass parameter "-p" from tecmake to make.

Best.
Ranier Vilela

De: Antonio Scuri 
Enviado: quinta-feira, 1 de março de 2018 13:51
Para: IUP discussion list.
Assunto: Re: [Iup-users] Confused by $(BIN2C); using Subversion repo...

  Hi,

  I don't know why make is not behaving as you expect. I never used it in that 
way.

  Regarding bin2c, I didn't understand what you are trying to change. bin2c.lua 
is included in IUP source code.

Best,
Scuri



Em 1 de mar de 2018 9:42 AM, "sur-behoffski" 
mailto:sur_behoff...@grouse.com.au>> escreveu:
G'day Scuri,

Things seemed to be falling to place a week ago, with the prospect of
being able to build both IM and CD seamlessly on both Linux Mint and
Gentoo GNU/Linux.  I haven't looked seriously at IUP yet.

However, since then (I do have some snapshots of the entire rig but
haven't fully backtracked yet), I just can't get a variant of a sane
BIN2C expansion going.

I'm closely tracking the Subversion repositories, in preference to
the release tarballs.

[Sidenote 1: It's not impossible that previously, I was focussing on
 CD, but am having difficulty since I've switched my focus
 back to IM.]

[Sidenote 2: I note that iup r4692 seems to be in-flight at the
 moment... trying to update the repo results in
 incomplete/missing files.]

So, some simple questions:

I'm using GNU Make 4.1 on the LinuxMint system, and 4.2.1 on the
Gentoo system.  I've tried using "make -p" to find out how variables
and  rules end up being set (I'm reasonably familiar with simple
makefiles, going back quite a while).  However, this doesn't seem to
work; my best guess is that there's some trickery between invoking a
lower-level Makefile which pulls in tecmake.mak at a second level.

There are a whole raft of other things, that showed promise of being
able to tweak the environment without radical surgery, but changing
these did not seem to affect any of the problem areas.

I even tried "make CUSTOM_BIN2C='/usr/bin/lua bin2c.lua'", and adding
code to tecmake.mak to trigger if CUSTOM_BIN2C was defined, but no
luck; while the makefile behaviour did change, it did not do what I
wanted:

ifdef CUSTOM_BIN2C
override BIN2C := $(CUSTOM_BIN2C)
endif

Can you help shed any light on this, and/or give any hints on how
to co-ordinate the operation of a hierarchy of makefiles (such as
whether the "-p" option might need to be explicitly named in order
to be handed over between makefiles; my reading of the documentation
suggests that the flag should be handed over automatically.)

thanks,

sur-behoffski
programmer, Grouse Software

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


Re: [Iup-users] IUP 3.24 RESOURCE_LEAK (iupwin_menu.c)

2018-02-28 Thread Ranier VF
Hi,
Thank you Scuri. Glad to know.

Best regards,
Ranier Vilela

De: Antonio Scuri 
Enviado: terça-feira, 20 de fevereiro de 2018 21:53
Para: IUP discussion list.
Assunto: Re: [Iup-users] IUP 3.24 RESOURCE_LEAK (iupwin_menu.c)

  Hi,

  Just fixed and committed to SVN. Does not solves the problem for cursors and 
icons. But it does for images, which is more important because we now draw 
those images manually when using IupDrawImage in IupFlat controls.

  Although the system documentation in GTK and Windows say that it is ok not to 
release those resources. When the application is closed they will be 
automatically deleted by the system.

Best,
Scuri


2018-02-20 9:54 GMT-03:00 Ranier VF 
mailto:ranier_...@hotmail.com>>:
Hi,
In relation this bug, some consideration?

Best regards,
Ranier Vilela
____
De: Ranier VF mailto:ranier_...@hotmail.com>>
Enviado: segunda-feira, 29 de janeiro de 2018 12:01
Para: IUP discussion list.
Assunto: Re: [Iup-users] IUP 3.24 RESOURCE_LEAK (iupwin_menu.c)

Hi,
Check this patch, if is ok?

--- a\src\iup_image.c   Mon Jan 29 09:17:08 2018
+++ b\src\iup_image.c   Mon Jan 29 09:58:56 2018
@@ -613,11 +613,11 @@

 void* iupImageGetImage(const char* name, Ihandle* ih_parent, int make_inactive)
 {
-  char cache_name[100] = "_IUPIMAGE_IMAGE";
+  char cache_name[128] = "_IUPIMAGE_IMAGE";
+  const char* native_name = NULL;
   char* bgcolor;
   void* handle;
   Ihandle *ih;
-  int bg_concat = 0;

   if (!name)
 return NULL;
@@ -625,65 +625,46 @@
   ih = iImageGetImageFromName(name);
   if (!ih)
   {
-const char* native_name = NULL;
-
-/* Check in the system resources. */
-handle = iupdrvImageLoad(name, IUPIMAGE_IMAGE);
-if (handle)
-  return handle;
-
 /* Check in the stock images. */
 iImageStockGet(name, &ih, &native_name);
-if (native_name)
-{
-  handle = iupdrvImageLoad(native_name, IUPIMAGE_IMAGE);
-  if (handle)
-return handle;
-}
-
 if (!ih)
   return NULL;
   }
-
   handle = iupAttribGet(ih, "_IUPSTOCK_LOAD_HANDLE");
   if (handle)
+  {
 return handle;
-
-  bgcolor = iupAttribGet(ih, "BGCOLOR");
-  if (ih_parent && !bgcolor)
-bgcolor = IupGetAttribute(ih_parent, "BGCOLOR"); /* Use IupGetAttribute to 
use inheritance and native implementation */
+  }

   if (make_inactive)
 strcat(cache_name, "_INACTIVE");

+  bgcolor = iupAttribGet(ih, "BGCOLOR");
+  if (ih_parent && !bgcolor)
+bgcolor = IupGetAttribute(ih_parent, "BGCOLOR"); /* Use IupGetAttribute to 
use inheritance and native implementation */
   if (iupAttribGet(ih, "_IUP_BGCOLOR_DEPEND") && bgcolor)
   {
 strcat(cache_name, "(");
 strcat(cache_name, bgcolor);
 strcat(cache_name, ")");
-bg_concat = 1;
   }
-
+
   /* Check for an already created native image */
   handle = (void*)iupAttribGet(ih, cache_name);
   if (handle)
 return handle;

-  if (ih_parent && iupAttribGetStr(ih_parent, "FLAT_ALPHA"))
-iupAttribSet(ih, "FLAT_ALPHA", "1");
-
-  /* Creates the native image */
-  handle = iupdrvImageCreateImage(ih, bgcolor, make_inactive);
-
-  if (ih_parent && iupAttribGetStr(ih_parent, "FLAT_ALPHA"))
-iupAttribSet(ih, "FLAT_ALPHA", NULL);
-
-  if (iupAttribGet(ih, "_IUP_BGCOLOR_DEPEND") && bgcolor && !bg_concat)  /* 
_IUP_BGCOLOR_DEPEND could be set during creation */
+  /* Check in the system resources. */
+  handle = iupdrvImageLoad(name, IUPIMAGE_IMAGE);
+  if (!handle && native_name)
   {
-strcat(cache_name, "(");
-strcat(cache_name, bgcolor);
-strcat(cache_name, ")");
+ handle = iupdrvImageLoad(native_name, IUPIMAGE_IMAGE);
+ if (!handle)
+return NULL;
   }
+
+  if (ih_parent && iupAttribGetStr(ih_parent, "FLAT_ALPHA"))
+iupAttribSet(ih_image, "FLAT_ALPHA", NULL);

   /* save the native image in the cache */
   iupAttribSet(ih, cache_name, (char*)handle);

Best,
Ranier Vilela

De: Ranier VF mailto:ranier_...@hotmail.com>>
Enviado: segunda-feira, 29 de janeiro de 2018 11:11
Para: IUP discussion list.
Assunto: Re: [Iup-users] IUP 3.24 RESOURCE_LEAK (iupwin_menu.c)

Hi,
Really the patch submitted is not correct, but, the problem persists.
iupwin_menu leaks the image handler.

in (iup_image.c), function: iupImageGetImage

if function iImageGetImageFromName fail, is executed this:

handle = iupdrvImageLoad(name, IUPIMAGE_IMAGE);
if (handle)
  return handle;

iupdrvImageLoad dot not store handle in the cache, in this way,
iupwin_menu.c still leaks.

Best regards,
Ranier Vilela


De: Antonio Scuri mailto:antonio.sc...@

Re: [Iup-users] winiup tree bug: Message from an item already deleted

2018-02-22 Thread Ranier VF
Hi Scuri,
"Anyway, I think we may test for a valid item there, but I don't think that 
every call to GETITEM should be tested and simply return doing nothing."
If documentation says that GETITEM can fail, required is, test return.
If GETITEM fail, in some situations, return doing nothing, can be better 
alternative.
Or do default action, if GETITEM fail.

Best regards,
Ranier Vilela


De: Antonio Scuri 
Enviado: quinta-feira, 22 de fevereiro de 2018 16:55
Para: IUP discussion list.
Assunto: Re: [Iup-users] winiup tree bug: Message from an item already deleted

  Hi,

  I run the sample here in debug, and with the release version, but the problem 
did not appeared. I understand you are rebuilding the tree during a double 
click. This is what you are doing in your program too or just a test? I 
wouldn't recommend that.

  Anyway, I think we may test for a valid item there, but I don't think that 
every call to GETITEM should be tested and simply return doing nothing.

  Is there a way that I can force the sample in a situation that the problem 
would be more likely to occur?

  Which IUP version are you using?

Best,
Scuri


2018-02-10 22:58 GMT-02:00 Ranier VF 
mailto:ranier_...@hotmail.com>>:
Hi,
Clearly documents says TVM_GETITEM message can fail.
https://msdn.microsoft.com/en-us/library/windows/desktop/bb773596(v=vs.85).aspx

Iupwin_tree.c there are lot calls to TVM_GETITEM message, without check
result.

Check if this works?

--- a\src\win\iupwin_tree.c Sat Feb 10 21:58:52 2018
+++ b\src\win\iupwin_tree.c Sat Feb 10 22:56:21 2018
@@ -199,14 +199,16 @@

   if (hPrevItem)
   {
-int kindPrev;
+int kindPrev = ITREE_BRANCH;
 TVITEM tviPrevItem;

 /* get the KIND attribute of reference node */
 tviPrevItem.hItem = hPrevItem;
 tviPrevItem.mask = TVIF_PARAM|TVIF_CHILDREN;
 SendMessage(ih->handle, TVM_GETITEM, 0, (LPARAM)(LPTVITEM)&tviPrevItem);
-kindPrev = ((winTreeItemData*)tviPrevItem.lParam)->kind;
+if (tviPrevItem.lParam) {
+   kindPrev = ((winTreeItemData*)tviPrevItem.lParam)->kind;
+}

 /* Define the parent and the position to the new node inside
the list, using the KIND attribute of reference node */
@@ -264,29 +266,41 @@
 static int winTreeIsItemExpanded(Ihandle* ih, HTREEITEM hItem)
 {
   TVITEM item;
+
   item.hItem = hItem;
   item.mask = TVIF_HANDLE | TVIF_STATE;
   SendMessage(ih->handle, TVM_GETITEM, 0, (LPARAM)(LPTVITEM)&item);
-  return (item.state & TVIS_EXPANDED) != 0;
+  if (item.lParam)
+  {
+ return (item.state & TVIS_EXPANDED) != 0;
+  }
+  else
+  {
+ return 0;
+  }
 }

 static int winTreeIsBranch(Ihandle* ih, HTREEITEM hItem)
 {
   TVITEM item;
-  winTreeItemData* itemData;
+  int kind = ITREE_BRANCH;

   item.mask = TVIF_HANDLE | TVIF_PARAM;
   item.hItem = hItem;
   SendMessage(ih->handle, TVM_GETITEM, 0, (LPARAM)(LPTVITEM)&item);
-  itemData = (winTreeItemData*)item.lParam;
+  if (item.lParam)
+  {
+winTreeItemData* itemData = (winTreeItemData*)item.lParam;

-  return (itemData->kind == ITREE_BRANCH);
+kind = itemData->kind;
+  }
+
+  return (kind == ITREE_BRANCH);
 }

 static void winTreeExpandItem(Ihandle* ih, HTREEITEM hItem, int expand)
 {
   TVITEM item;
-  winTreeItemData* itemData;

   iupAttribSet(ih, "_IUPTREE_IGNORE_BRANCH_CB", "1");
   /* it only works if the branch has children */
@@ -297,15 +311,21 @@
   item.hItem = hItem;
   item.mask = TVIF_HANDLE|TVIF_PARAM;
   SendMessage(ih->handle, TVM_GETITEM, 0, (LPARAM)(LPTVITEM)&item);
-  itemData = (winTreeItemData*)item.lParam;
-
-  if (expand)
-item.iSelectedImage = item.iImage = (itemData->image_expanded!=-1)? 
itemData->image_expanded: (int)ih->data->def_image_expanded;
-  else
-item.iSelectedImage = item.iImage = (itemData->image!=-1)? 
itemData->image: (int)ih->data->def_image_collapsed;
+  if (item.lParam)
+  {
+ winTreeItemData* itemData;

-  item.hItem = hItem;
-  item.mask = TVIF_HANDLE | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
+ itemData = (winTreeItemData*)item.lParam;
+ if (expand)
+item.iSelectedImage = item.iImage = (itemData->image_expanded!=-1)? 
itemData->image_expanded: (int)ih->data->def_image_expanded;
+ else
+item.iSelectedImage = item.iImage = (itemData->image!=-1)? 
itemData->image: (int)ih->data->def_image_collapsed;
+ item.mask = TVIF_HANDLE | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
+  }
+  else
+  {
+ item.mask = TVIF_HANDLE;;
+  }
   SendMessage(ih->handle, TVM_SETITEM, 0, (LPARAM)(LPTVITEM)&item);
 }

@@ -493,13 +513,17 @@
   HTREEITEM new_hItem;
   TVITEM item;
   TVINSERTSTRUCT tvins;
-  TCHAR title[255];
+  TCHAR title[256];

   item.hItem = hItem;
   item.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_IMAGE | TVIF_SELECTEDIMAGE | 
TVIF_TEXT | TVIF_STATE | TVIF_PARAM;
   item.pszText = title;

Re: [Iup-users] iupDlgListDestroyAll optimized version

2018-02-20 Thread Ranier VF
Hi,
Take a look in this version:

--- a\src\iup_dlglist.c Tue Feb 13 10:05:14 2018
+++ b\src\iup_dlglist.c Tue Feb 20 09:48:43 2018
@@ -112,24 +112,14 @@
 
 void iupDlgListDestroyAll(void)
 {
-  int i = 0, count;
-  Ihandle** ih_array = (Ihandle**)malloc(idlg_count * sizeof(Ihandle*));
   Idiallst *list;
-  for (list = idlglist; list; list = list->next)
-  {
-if (iupObjectCheck(list->ih))
-{
-  ih_array[i] = list->ih;
-  i++;
-}
-  }
+  Idiallst *next;
 
-  count = i;
-  for (i = 0; i < count; i++)
+  list = idlglist;
+  while(list)
   {
-if (iupObjectCheck(ih_array[i]))
-  IupDestroy(ih_array[i]);   /* this will also destroy the list */
+ next = list->next;  /* Save next item, IupDestroy may can free 
list->next */
+ IupDestroy(list->ih);   /* iupObjectCheck is called in IupDestroy */
+ list = next;
   }
-
-  free(ih_array);
 }

list->next is preseved in case IupDestroy invalidate.

Best regards,
Ranier Vilela

De: Antonio Scuri 
Enviado: segunda-feira, 19 de fevereiro de 2018 19:37
Para: IUP discussion list.
Assunto: Re: [Iup-users] iupDlgListDestroyAll optimized version

  Yes, because when a dialog is destroyed the idlglist list is updated, so 
list->next will be invalid.

Best,
Scuri


2018-02-13 11:13 GMT-02:00 Ranier VF 
mailto:ranier_...@hotmail.com>>:
Hi,
Is there really any special reason, for what
iupDlgListDestroyAll do not be like that?

--- a\src\iup_dlglist.c Tue Feb 13 11:05:14 2018
+++ b\src\iup_dlglist.c Tue Feb 13 11:11:25 2018
@@ -112,24 +112,9 @@

 void iupDlgListDestroyAll(void)
 {
-  int i = 0, count;
-  Ihandle** ih_array = (Ihandle**)malloc(idlg_count * sizeof(Ihandle*));
   Idiallst *list;
   for (list = idlglist; list; list = list->next)
   {
-if (iupObjectCheck(list->ih))
-{
-  ih_array[i] = list->ih;
-  i++;
-}
+ IupDestroy(list->ih);   /* iupObjectCheck is called in IupDestroy */
   }
-
-  count = i;
-  for (i = 0; i < count; i++)
-  {
-if (iupObjectCheck(ih_array[i]))
-  IupDestroy(ih_array[i]);   /* this will also destroy the list */
-  }
-
-  free(ih_array);
 }

Best regards,
Ranier Vilela
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Iup-users mailing list
Iup-users@lists.sourceforge.net<mailto:Iup-users@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/iup-users


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


Re: [Iup-users] IUP 3.24 RESOURCE_LEAK (iupwin_menu.c)

2018-02-20 Thread Ranier VF
Hi,
In relation this bug, some consideration?

Best regards,
Ranier Vilela

De: Ranier VF 
Enviado: segunda-feira, 29 de janeiro de 2018 12:01
Para: IUP discussion list.
Assunto: Re: [Iup-users] IUP 3.24 RESOURCE_LEAK (iupwin_menu.c)

Hi,
Check this patch, if is ok?

--- a\src\iup_image.c   Mon Jan 29 09:17:08 2018
+++ b\src\iup_image.c   Mon Jan 29 09:58:56 2018
@@ -613,11 +613,11 @@

 void* iupImageGetImage(const char* name, Ihandle* ih_parent, int make_inactive)
 {
-  char cache_name[100] = "_IUPIMAGE_IMAGE";
+  char cache_name[128] = "_IUPIMAGE_IMAGE";
+  const char* native_name = NULL;
   char* bgcolor;
   void* handle;
   Ihandle *ih;
-  int bg_concat = 0;

   if (!name)
 return NULL;
@@ -625,65 +625,46 @@
   ih = iImageGetImageFromName(name);
   if (!ih)
   {
-const char* native_name = NULL;
-
-/* Check in the system resources. */
-handle = iupdrvImageLoad(name, IUPIMAGE_IMAGE);
-if (handle)
-  return handle;
-
 /* Check in the stock images. */
 iImageStockGet(name, &ih, &native_name);
-if (native_name)
-{
-  handle = iupdrvImageLoad(native_name, IUPIMAGE_IMAGE);
-  if (handle)
-return handle;
-}
-
 if (!ih)
   return NULL;
   }
-
   handle = iupAttribGet(ih, "_IUPSTOCK_LOAD_HANDLE");
   if (handle)
+  {
 return handle;
-
-  bgcolor = iupAttribGet(ih, "BGCOLOR");
-  if (ih_parent && !bgcolor)
-bgcolor = IupGetAttribute(ih_parent, "BGCOLOR"); /* Use IupGetAttribute to 
use inheritance and native implementation */
+  }

   if (make_inactive)
 strcat(cache_name, "_INACTIVE");

+  bgcolor = iupAttribGet(ih, "BGCOLOR");
+  if (ih_parent && !bgcolor)
+bgcolor = IupGetAttribute(ih_parent, "BGCOLOR"); /* Use IupGetAttribute to 
use inheritance and native implementation */
   if (iupAttribGet(ih, "_IUP_BGCOLOR_DEPEND") && bgcolor)
   {
 strcat(cache_name, "(");
 strcat(cache_name, bgcolor);
 strcat(cache_name, ")");
-bg_concat = 1;
   }
-
+
   /* Check for an already created native image */
   handle = (void*)iupAttribGet(ih, cache_name);
   if (handle)
 return handle;

-  if (ih_parent && iupAttribGetStr(ih_parent, "FLAT_ALPHA"))
-iupAttribSet(ih, "FLAT_ALPHA", "1");
-
-  /* Creates the native image */
-  handle = iupdrvImageCreateImage(ih, bgcolor, make_inactive);
-
-  if (ih_parent && iupAttribGetStr(ih_parent, "FLAT_ALPHA"))
-iupAttribSet(ih, "FLAT_ALPHA", NULL);
-
-  if (iupAttribGet(ih, "_IUP_BGCOLOR_DEPEND") && bgcolor && !bg_concat)  /* 
_IUP_BGCOLOR_DEPEND could be set during creation */
+  /* Check in the system resources. */
+  handle = iupdrvImageLoad(name, IUPIMAGE_IMAGE);
+  if (!handle && native_name)
   {
-strcat(cache_name, "(");
-strcat(cache_name, bgcolor);
-strcat(cache_name, ")");
+ handle = iupdrvImageLoad(native_name, IUPIMAGE_IMAGE);
+ if (!handle)
+return NULL;
   }
+
+  if (ih_parent && iupAttribGetStr(ih_parent, "FLAT_ALPHA"))
+iupAttribSet(ih_image, "FLAT_ALPHA", NULL);

   /* save the native image in the cache */
   iupAttribSet(ih, cache_name, (char*)handle);

Best,
Ranier Vilela

De: Ranier VF 
Enviado: segunda-feira, 29 de janeiro de 2018 11:11
Para: IUP discussion list.
Assunto: Re: [Iup-users] IUP 3.24 RESOURCE_LEAK (iupwin_menu.c)

Hi,
Really the patch submitted is not correct, but, the problem persists.
iupwin_menu leaks the image handler.

in (iup_image.c), function: iupImageGetImage

if function iImageGetImageFromName fail, is executed this:

handle = iupdrvImageLoad(name, IUPIMAGE_IMAGE);
if (handle)
  return handle;

iupdrvImageLoad dot not store handle in the cache, in this way,
iupwin_menu.c still leaks.

Best regards,
Ranier Vilela


De: Antonio Scuri 
Enviado: sexta-feira, 26 de janeiro de 2018 19:44
Para: IUP discussion list.
Assunto: Re: [Iup-users] IUP 3.24 RESOURCE_LEAK (iupwin_menu.c)

  Those DeleteObject(hBitmap*) can not be called. They are stored in a cache 
inside the IupImage, they will be released later when the image is destroyed.

Best,
Scuri


2018-01-24 22:30 GMT-02:00 Ranier VF 
mailto:ranier_...@hotmail.com>>:
Hi,
Issue found by Coverity Scan.
CID 259189 (#1-2 of 2): Resource leak (RESOURCE_LEAK)

--- a\src\win\iupwin_menu.c Mon Dec 11 14:52:42 2017
+++ b\src\win\iupwin_menu.c Wed Jan 24 22:26:33 2018
@@ -431,9 +431,13 @@
 hBitmapChecked = hBitmapUnchecked;

   SetMenuItemBitmaps((HMENU)ih->handle, (UINT)ih->serial, MF_BYCOMMAND, 
hBitmapUnchecked, hBitmapChecked);
-
   winMenuUpdateBar(ih);

+  if (impress)
+  {
+ DeleteObject(hBitmapChecked);
+  }
+
   ret

[Iup-users] iupDlgListDestroyAll optimized version

2018-02-13 Thread Ranier VF
Hi,
Is there really any special reason, for what
iupDlgListDestroyAll do not be like that?

--- a\src\iup_dlglist.c Tue Feb 13 11:05:14 2018
+++ b\src\iup_dlglist.c Tue Feb 13 11:11:25 2018
@@ -112,24 +112,9 @@
 
 void iupDlgListDestroyAll(void)
 {
-  int i = 0, count;
-  Ihandle** ih_array = (Ihandle**)malloc(idlg_count * sizeof(Ihandle*));
   Idiallst *list;
   for (list = idlglist; list; list = list->next)
   {
-if (iupObjectCheck(list->ih))
-{
-  ih_array[i] = list->ih;
-  i++;
-}
+ IupDestroy(list->ih);   /* iupObjectCheck is called in IupDestroy */
   }
-
-  count = i;
-  for (i = 0; i < count; i++)
-  {
-if (iupObjectCheck(ih_array[i]))
-  IupDestroy(ih_array[i]);   /* this will also destroy the list */
-  }
-
-  free(ih_array);
 }

Best regards,
Ranier Vilela
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


Re: [Iup-users] winiup tree bug: Message from an item already deleted

2018-02-10 Thread Ranier VF
Hi,
Clearly documents says TVM_GETITEM message can fail.
https://msdn.microsoft.com/en-us/library/windows/desktop/bb773596(v=vs.85).aspx

Iupwin_tree.c there are lot calls to TVM_GETITEM message, without check
result.

Check if this works?

--- a\src\win\iupwin_tree.c Sat Feb 10 21:58:52 2018
+++ b\src\win\iupwin_tree.c Sat Feb 10 22:56:21 2018
@@ -199,14 +199,16 @@
 
   if (hPrevItem)
   {
-int kindPrev;
+int kindPrev = ITREE_BRANCH;
 TVITEM tviPrevItem;
 
 /* get the KIND attribute of reference node */ 
 tviPrevItem.hItem = hPrevItem;
 tviPrevItem.mask = TVIF_PARAM|TVIF_CHILDREN; 
 SendMessage(ih->handle, TVM_GETITEM, 0, (LPARAM)(LPTVITEM)&tviPrevItem);
-kindPrev = ((winTreeItemData*)tviPrevItem.lParam)->kind;
+if (tviPrevItem.lParam) {
+   kindPrev = ((winTreeItemData*)tviPrevItem.lParam)->kind;
+}
 
 /* Define the parent and the position to the new node inside
the list, using the KIND attribute of reference node */
@@ -264,29 +266,41 @@
 static int winTreeIsItemExpanded(Ihandle* ih, HTREEITEM hItem)
 {
   TVITEM item;
+
   item.hItem = hItem;
   item.mask = TVIF_HANDLE | TVIF_STATE;
   SendMessage(ih->handle, TVM_GETITEM, 0, (LPARAM)(LPTVITEM)&item);
-  return (item.state & TVIS_EXPANDED) != 0;
+  if (item.lParam)
+  {
+ return (item.state & TVIS_EXPANDED) != 0;
+  } 
+  else
+  {
+ return 0;
+  }
 }
 
 static int winTreeIsBranch(Ihandle* ih, HTREEITEM hItem)
 {
   TVITEM item;
-  winTreeItemData* itemData;
+  int kind = ITREE_BRANCH;
 
   item.mask = TVIF_HANDLE | TVIF_PARAM;
   item.hItem = hItem;
   SendMessage(ih->handle, TVM_GETITEM, 0, (LPARAM)(LPTVITEM)&item);
-  itemData = (winTreeItemData*)item.lParam;
+  if (item.lParam)
+  {
+winTreeItemData* itemData = (winTreeItemData*)item.lParam;
 
-  return (itemData->kind == ITREE_BRANCH);
+kind = itemData->kind;
+  }
+
+  return (kind == ITREE_BRANCH);
 }
 
 static void winTreeExpandItem(Ihandle* ih, HTREEITEM hItem, int expand)
 {
   TVITEM item;
-  winTreeItemData* itemData;
 
   iupAttribSet(ih, "_IUPTREE_IGNORE_BRANCH_CB", "1");
   /* it only works if the branch has children */
@@ -297,15 +311,21 @@
   item.hItem = hItem;
   item.mask = TVIF_HANDLE|TVIF_PARAM;
   SendMessage(ih->handle, TVM_GETITEM, 0, (LPARAM)(LPTVITEM)&item);
-  itemData = (winTreeItemData*)item.lParam;
-
-  if (expand)
-item.iSelectedImage = item.iImage = (itemData->image_expanded!=-1)? 
itemData->image_expanded: (int)ih->data->def_image_expanded;
-  else
-item.iSelectedImage = item.iImage = (itemData->image!=-1)? 
itemData->image: (int)ih->data->def_image_collapsed;
+  if (item.lParam)
+  {
+ winTreeItemData* itemData;
 
-  item.hItem = hItem;
-  item.mask = TVIF_HANDLE | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
+ itemData = (winTreeItemData*)item.lParam;
+ if (expand)
+item.iSelectedImage = item.iImage = (itemData->image_expanded!=-1)? 
itemData->image_expanded: (int)ih->data->def_image_expanded;
+ else
+item.iSelectedImage = item.iImage = (itemData->image!=-1)? 
itemData->image: (int)ih->data->def_image_collapsed;
+ item.mask = TVIF_HANDLE | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
+  }
+  else 
+  {
+ item.mask = TVIF_HANDLE;;
+  }
   SendMessage(ih->handle, TVM_SETITEM, 0, (LPARAM)(LPTVITEM)&item);
 }
 
@@ -493,13 +513,17 @@
   HTREEITEM new_hItem;
   TVITEM item; 
   TVINSERTSTRUCT tvins;
-  TCHAR title[255];
+  TCHAR title[256];
 
   item.hItem = hItem;
   item.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_IMAGE | TVIF_SELECTEDIMAGE | 
TVIF_TEXT | TVIF_STATE | TVIF_PARAM;
   item.pszText = title;
-  item.cchTextMax = 255;
+  item.cchTextMax = sizeof(title) - 1;
   SendMessage(ih->handle, TVM_GETITEM, 0, (LPARAM)(LPTVITEM)&item);
+  if (!item.lParam)
+  {
+ return NULL;
+  }
 
   if (is_copy) /* during a copy the itemdata reference is not reused */
   {
@@ -551,19 +575,23 @@
   TVITEM item;
   winTreeItemData* itemDataDst;
   int id_new, count, id_src, id_dst;
+  int old_count;
 
-  int old_count = ih->data->node_count;
+  /* Get DST node attributes */
+  item.hItem = hItemDst;
+  item.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_STATE;
+  SendMessage(ih->handle, TVM_GETITEM, 0, (LPARAM)(LPTVITEM)&item);
+  if (!item.lParam)
+  {
+ return NULL;
+  }
 
+  old_count = ih->data->node_count;
   id_src = iupTreeFindNodeId(ih, hItemSrc);
   id_dst = iupTreeFindNodeId(ih, hItemDst);
   id_new = id_dst+1; /* contains the position for a copy operation */
 
-  /* Get DST node attributes */
-  item.hItem = hItemDst;
-  item.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_STATE;
-  SendMessage(ih->handle, TVM_GETITEM, 0, (LPARAM)(LPTVITEM)&item);
   itemDataDst = (winTreeItemData*)item.lParam;
-
   if (itemDataDst->kind == ITREE_BRANCH && (item.state & TVIS_EXPANDED))
   {
 /* copy as first child of expanded branch */
@@ -574,8 +602,7 @@
   {
 if (itemDataDst->kind == ITREE_BRANCH)
 {
-  int child_count = iupdrvTreeTotalChildCount(ih, h

Re: [Iup-users] Getting closer to my IM/CD/IUP code goals... {IM, CD} on both {Gentoo, Linux Mint 18.3}

2018-01-30 Thread Ranier VF
Hi
Nice work.
Improvemnts in build iup, are always good.

Best,
Ranier Vilela

De: sur-behoffski 
Enviado: terça-feira, 30 de janeiro de 2018 12:32
Para: IUP discussion list.
Assunto: [Iup-users] Getting closer to my IM/CD/IUP code goals... {IM, CD} on 
both {Gentoo, Linux Mint 18.3}

G'day,

A report of progress I've made recently; I'd be tempted to release some items
soon, but believe that some polish, especially in the ldoc area, is highly
needed.

I've now come up with ways to easily and fairly painlessly manipulate
Tecgraf packages, using a Lua script that is informed by a package database:

  * "repofetch": Use "svn update" to keep my repository up-to-date;
  " "releasefetch": Obtain the Sources/Examples/Docs tarballs/.pdfs
 of one or more specified project;
  * "nuke": Nuke any one, or perhaps all, project files in a work tree;
  * "unpack": Unpack a tarball based on the latest-known Subversion 
repository;
  * "patch": Apply patches to the unpacked tree of a project;
  * "build": Change into the package's "src" subdirectory, and execute:

 LUA_SUFFIX= LUA_INC=/usr/include/5.1/ LUA_BIN=/usr/bin LC_ALL=C 
make

  * "gather": Create designated runfiles/dynamic-loading .so files, and put
 them in to a "play" support area ("base/1/support"; the "1" is
 historical).  The user can then play with scripts that exploit the
 IM/CD/IUP toolkit in "base/1/play".  A script file, "play-lua-tec",
references this support directory extensively, so that a tentative
 build/gather set, perhaps trialling different combinations of patches,
can be tried without a system install (and without requiring any
 system privileges).

[The biggest pain that I know of, at the moment, is that each time changes are
committed to the repository, is that I have to manually create a tarball, and
modify the main script to tell the "unpack" command the new repository number,
because it composes a repository-tarball filename for the "unpack" command.]

Here's the bash script of "play-lua-tec":

 #!/bin/bash

 # Use subdirectory ../support to keep IM/CD/IUP runtime support files
 # hidden from the play area.  However, also prepend the same patterns
 # for the play directory, so the user can preempt and/or add objects
 # during operation.
 LD_LIBRARY_PATH=".:../support:$LD_LIBRARY_PATH" lua \
 -e 'package.cpath = 
"../support/?.so;../support/lib?.so;../support/lib?51.so;" .. package.cpath' \
 -e 'package.cpath = "./?.so;./lib?.so;./lib?51.so;" .. 
package.cpath' \
 -l 'luarocks.loader' \
 $* \
 -i

So, for example, the small Lua script that creates a simple PDF (cdpdf.lua)
is shown below, and the last line shows how easy it is to run with the
infrastructure that I'm building up:


 $ cat cdpdf.lua
 require"cdlua"
 require"cdluapdf"

 canvas = cd.CreateCanvas(cd.PDF, "test.pdf")
 canvas:Foreground (cd.RED)
 canvas:Box (10, 55, 10, 55)
 canvas:Foreground(cd.EncodeColor(255, 32, 140))
 canvas:Line(0, 0, 300, 100)
 canvas:Kill()

 $ ./play-lua-tec cdpdf.lua

--

So, in summary, it's a huge step forward for me to be able to build CD on
two significantly different GNU/Linux systems such as Gentoo and Linux Mint.
At present, there are compilation errors when building IUP, but I'm working
on this area.

--

There's one more script in the toolkit, which has casual associations to
the Tecgraf makefile/tekmake output format, which looks to find and collate
diagnostics from the compiler, and by collecting, collating and summarising
them in a concise fashion, provide a valuable report to the user.  The key
idea behind this is that a compiler diagnostic may be warning of a real
underlying bug, and so it is preferable to demand, and maintain, a
zero-diagnostics policy, for all available compilers:  If there are several
dozen non-buggy diagnostics that are currently tolerated in the code, and one
change is made which introduces a real bug, along with a warning diagnostic,
the implication of the change may be hidden (i.e. the value of the diagnostic
may be significantly diluted).

My script to parse the Makefile output is "parse-build.lua", and, as with
other components of my rig, I'll try to clean it up and document it more
neatly over the next few weeks, hoping to release it sometime in the next
month or so.  [Some diagnostics relate to out-of-date third-party packages,
and it's hard, sometimes including potential license issues, to easily
integrate the latest version into the code, so I'll try to co-ordinate any
changes with affected parties.]

cheers,

sur-behoffski (Brenton Hoff)
programmer, Grouse Software

--
Check out the vibrant tech communit

Re: [Iup-users] IUP 3.24 RESOURCE_LEAK (iupwin_menu.c)

2018-01-29 Thread Ranier VF
Hi,
Check this patch, if is ok?

--- a\src\iup_image.c   Mon Jan 29 09:17:08 2018
+++ b\src\iup_image.c   Mon Jan 29 09:58:56 2018
@@ -613,11 +613,11 @@
 
 void* iupImageGetImage(const char* name, Ihandle* ih_parent, int make_inactive)
 {
-  char cache_name[100] = "_IUPIMAGE_IMAGE";
+  char cache_name[128] = "_IUPIMAGE_IMAGE";
+  const char* native_name = NULL;
   char* bgcolor;
   void* handle;
   Ihandle *ih;
-  int bg_concat = 0;
 
   if (!name)
 return NULL;
@@ -625,65 +625,46 @@
   ih = iImageGetImageFromName(name);
   if (!ih)
   {
-const char* native_name = NULL;
-
-/* Check in the system resources. */
-handle = iupdrvImageLoad(name, IUPIMAGE_IMAGE);
-if (handle) 
-  return handle;
-
 /* Check in the stock images. */
 iImageStockGet(name, &ih, &native_name);
-if (native_name) 
-{
-  handle = iupdrvImageLoad(native_name, IUPIMAGE_IMAGE);
-  if (handle) 
-return handle;
-}
-
 if (!ih)
   return NULL;
   }
-
   handle = iupAttribGet(ih, "_IUPSTOCK_LOAD_HANDLE");
   if (handle)
+  {
 return handle;
-
-  bgcolor = iupAttribGet(ih, "BGCOLOR");
-  if (ih_parent && !bgcolor)
-bgcolor = IupGetAttribute(ih_parent, "BGCOLOR"); /* Use IupGetAttribute to 
use inheritance and native implementation */
+  }
 
   if (make_inactive)
 strcat(cache_name, "_INACTIVE");
 
+  bgcolor = iupAttribGet(ih, "BGCOLOR");
+  if (ih_parent && !bgcolor)
+bgcolor = IupGetAttribute(ih_parent, "BGCOLOR"); /* Use IupGetAttribute to 
use inheritance and native implementation */
   if (iupAttribGet(ih, "_IUP_BGCOLOR_DEPEND") && bgcolor)
   {
 strcat(cache_name, "(");
 strcat(cache_name, bgcolor);
 strcat(cache_name, ")");
-bg_concat = 1;
   }
-  
+
   /* Check for an already created native image */
   handle = (void*)iupAttribGet(ih, cache_name);
   if (handle)
 return handle;
 
-  if (ih_parent && iupAttribGetStr(ih_parent, "FLAT_ALPHA"))
-iupAttribSet(ih, "FLAT_ALPHA", "1");
-
-  /* Creates the native image */
-  handle = iupdrvImageCreateImage(ih, bgcolor, make_inactive);
-
-  if (ih_parent && iupAttribGetStr(ih_parent, "FLAT_ALPHA"))
-iupAttribSet(ih, "FLAT_ALPHA", NULL);
-
-  if (iupAttribGet(ih, "_IUP_BGCOLOR_DEPEND") && bgcolor && !bg_concat)  /* 
_IUP_BGCOLOR_DEPEND could be set during creation */
+  /* Check in the system resources. */
+  handle = iupdrvImageLoad(name, IUPIMAGE_IMAGE);
+  if (!handle && native_name)
   {
-strcat(cache_name, "(");
-strcat(cache_name, bgcolor);
-strcat(cache_name, ")");
+ handle = iupdrvImageLoad(native_name, IUPIMAGE_IMAGE);
+ if (!handle)
+return NULL;
   }
+
+  if (ih_parent && iupAttribGetStr(ih_parent, "FLAT_ALPHA"))
+iupAttribSet(ih_image, "FLAT_ALPHA", NULL);
 
   /* save the native image in the cache */
   iupAttribSet(ih, cache_name, (char*)handle);

Best,
Ranier Vilela

De: Ranier VF 
Enviado: segunda-feira, 29 de janeiro de 2018 11:11
Para: IUP discussion list.
Assunto: Re: [Iup-users] IUP 3.24 RESOURCE_LEAK (iupwin_menu.c)

Hi,
Really the patch submitted is not correct, but, the problem persists.
iupwin_menu leaks the image handler.

in (iup_image.c), function: iupImageGetImage

if function iImageGetImageFromName fail, is executed this:

handle = iupdrvImageLoad(name, IUPIMAGE_IMAGE);
if (handle)
  return handle;

iupdrvImageLoad dot not store handle in the cache, in this way,
iupwin_menu.c still leaks.

Best regards,
Ranier Vilela


De: Antonio Scuri 
Enviado: sexta-feira, 26 de janeiro de 2018 19:44
Para: IUP discussion list.
Assunto: Re: [Iup-users] IUP 3.24 RESOURCE_LEAK (iupwin_menu.c)

  Those DeleteObject(hBitmap*) can not be called. They are stored in a cache 
inside the IupImage, they will be released later when the image is destroyed.

Best,
Scuri


2018-01-24 22:30 GMT-02:00 Ranier VF 
mailto:ranier_...@hotmail.com>>:
Hi,
Issue found by Coverity Scan.
CID 259189 (#1-2 of 2): Resource leak (RESOURCE_LEAK)

--- a\src\win\iupwin_menu.c Mon Dec 11 14:52:42 2017
+++ b\src\win\iupwin_menu.c Wed Jan 24 22:26:33 2018
@@ -431,9 +431,13 @@
 hBitmapChecked = hBitmapUnchecked;

   SetMenuItemBitmaps((HMENU)ih->handle, (UINT)ih->serial, MF_BYCOMMAND, 
hBitmapUnchecked, hBitmapChecked);
-
   winMenuUpdateBar(ih);

+  if (impress)
+  {
+ DeleteObject(hBitmapChecked);
+  }
+
   return 1;
 }

@@ -450,8 +454,13 @@
 hBitmapChecked = hBitmapUnchecked;

   SetMenuItemBitmaps((HMENU)ih->handle, (UINT)ih->serial, MF_BYCOMMAND, 
hBitmapUnchecked, hBitmapChecked);
-
   winMenuUpdateBar(ih);
+
+  if (value)
+  {
+De

Re: [Iup-users] IUP 3.24 RESOURCE_LEAK (iupwin_menu.c)

2018-01-29 Thread Ranier VF
Hi,
Really the patch submitted is not correct, but, the problem persists.
iupwin_menu leaks the image handler.

in (iup_image.c), function: iupImageGetImage

if function iImageGetImageFromName fail, is executed this:

handle = iupdrvImageLoad(name, IUPIMAGE_IMAGE);
if (handle) 
  return handle;

iupdrvImageLoad dot not store handle in the cache, in this way,
iupwin_menu.c still leaks.

Best regards,
Ranier Vilela


De: Antonio Scuri 
Enviado: sexta-feira, 26 de janeiro de 2018 19:44
Para: IUP discussion list.
Assunto: Re: [Iup-users] IUP 3.24 RESOURCE_LEAK (iupwin_menu.c)

  Those DeleteObject(hBitmap*) can not be called. They are stored in a cache 
inside the IupImage, they will be released later when the image is destroyed.

Best,
Scuri


2018-01-24 22:30 GMT-02:00 Ranier VF 
mailto:ranier_...@hotmail.com>>:
Hi,
Issue found by Coverity Scan.
CID 259189 (#1-2 of 2): Resource leak (RESOURCE_LEAK)

--- a\src\win\iupwin_menu.c Mon Dec 11 14:52:42 2017
+++ b\src\win\iupwin_menu.c Wed Jan 24 22:26:33 2018
@@ -431,9 +431,13 @@
 hBitmapChecked = hBitmapUnchecked;

   SetMenuItemBitmaps((HMENU)ih->handle, (UINT)ih->serial, MF_BYCOMMAND, 
hBitmapUnchecked, hBitmapChecked);
-
   winMenuUpdateBar(ih);

+  if (impress)
+  {
+ DeleteObject(hBitmapChecked);
+  }
+
   return 1;
 }

@@ -450,8 +454,13 @@
 hBitmapChecked = hBitmapUnchecked;

   SetMenuItemBitmaps((HMENU)ih->handle, (UINT)ih->serial, MF_BYCOMMAND, 
hBitmapUnchecked, hBitmapChecked);
-
   winMenuUpdateBar(ih);
+
+  if (value)
+  {
+DeleteObject(hBitmapChecked);
+  }
+  DeleteObject(hBitmapunChecked);

   return 1;
 }

Best.
Ranier Vilela
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Iup-users mailing list
Iup-users@lists.sourceforge.net<mailto:Iup-users@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/iup-users



--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


[Iup-users] IUP 3.24 NULL RETURNS (iupwin_tabs.c)

2018-01-24 Thread Ranier VF
Hi,
Issue found by Coverity Scan.
CID 259207 (#1 of 1): Dereference null return value (NULL_RETURNS)
4. dereference: Dereferencing a null pointer ih.

--- a\src\win\iupwin_tabs.c Mon Dec 11 14:52:42 2017
+++ b\src\win\iupwin_tabs.c Wed Jan 24 23:11:36 2018
@@ -436,11 +436,15 @@
   {
   case WM_ERASEBKGND:
 {
-  RECT rect;
-  HDC hDC = (HDC)wp;
   Ihandle* ih = iupwinHandleGet(hWnd);
-  GetClientRect(ih->handle, &rect); 
-  winTabsDrawPageBackground(ih, hDC, &rect);
+  if (ih)
+  {
+ RECT rect;
+ HDC hDC = (HDC)wp;
+
+ GetClientRect(ih->handle, &rect); 
+ winTabsDrawPageBackground(ih, hDC, &rect);
+  }
 
   /* return non zero value */
   return 1;

Best,
Ranier Vilela

iupwin_tabs.patch
Description: iupwin_tabs.patch
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


Re: [Iup-users] IUP 3.24 RESOURCE_LEAK (iupwin_menu.c)

2018-01-24 Thread Ranier VF
More Issues.
CID 259175 (#1 of 1): Dereference null return value (NULL_RETURNS)
4. dereference: Dereferencing a null pointer dlg.

--- a\src\win\iupwin_menu.c Mon Dec 11 14:52:42 2017
+++ b\src\win\iupwin_menu.c Wed Jan 24 23:07:09 2018
@@ -209,7 +209,7 @@
   {
 /* search for a valid handle */
 Ihandle* dlg = iupDlgListFirst();
-do 
+while(dlg)
 {
   if (dlg->handle)
   {
@@ -220,7 +220,7 @@
   break;
   }
   dlg = iupDlgListNext();
-} while (dlg);
+}
   }


De: Ranier VF 
Enviado: quinta-feira, 25 de janeiro de 2018 00:30
Para: IUP discussion list.
Assunto: IUP 3.24 RESOURCE_LEAK (iupwin_menu.c)

Hi,
Issue found by Coverity Scan.
CID 259189 (#1-2 of 2): Resource leak (RESOURCE_LEAK)

--- a\src\win\iupwin_menu.c Mon Dec 11 14:52:42 2017
+++ b\src\win\iupwin_menu.c Wed Jan 24 22:26:33 2018
@@ -431,9 +431,13 @@
 hBitmapChecked = hBitmapUnchecked;

   SetMenuItemBitmaps((HMENU)ih->handle, (UINT)ih->serial, MF_BYCOMMAND, 
hBitmapUnchecked, hBitmapChecked);
-
   winMenuUpdateBar(ih);

+  if (impress)
+  {
+ DeleteObject(hBitmapChecked);
+  }
+
   return 1;
 }

@@ -450,8 +454,13 @@
 hBitmapChecked = hBitmapUnchecked;

   SetMenuItemBitmaps((HMENU)ih->handle, (UINT)ih->serial, MF_BYCOMMAND, 
hBitmapUnchecked, hBitmapChecked);
-
   winMenuUpdateBar(ih);
+
+  if (value)
+  {
+DeleteObject(hBitmapChecked);
+  }
+  DeleteObject(hBitmapunChecked);

   return 1;
 }

Best.
Ranier Vilela


iupwin_menu.patch
Description: iupwin_menu.patch
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


[Iup-users] IUP 3.24 DEADCODE (iupwin_loop.c)

2018-01-24 Thread Ranier VF
Hi,
Issue found by Coverity Scan.
CID 259174 (#1 of 1): Logically dead code (DEADCODE)

--- a\src\win\iupwin_loop.c Mon Dec 11 14:52:42 2017
+++ b\src\win\iupwin_loop.c Wed Jan 24 23:04:34 2018
@@ -113,7 +113,6 @@
 }
   } while (ret);
 
-  win_main_loop--;
   return IUP_NOERROR;
 }
 
Best,
Ranier Vilela

iupwin_loop.patch
Description: iupwin_loop.patch
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


Re: [Iup-users] IUP 3.24 RESOURCE LEAK (iupwin_list.c)

2018-01-24 Thread Ranier VF
More Issues.

--- a\src\win\iupwin_list.c Mon Dec 11 14:52:42 2017
+++ b\src\win\iupwin_list.c Wed Jan 24 23:01:01 2018
@@ -962,12 +962,14 @@
 
 static int winListSetImageAttrib(Ihandle* ih, int id, const char* value)
 {
-  HBITMAP hBitmap = iupImageGetImage(value, ih, 0);
+  HBITMAP hBitmap;
   int pos = iupListGetPosAttrib(ih, id);
 
   if (!ih->data->show_image || pos < 0)
+  {
 return 0;
-
+  }
+  hBitmap = iupImageGetImage(value, ih, 0);
   winListSetItemData(ih, pos, NULL, hBitmap);
 
   iupdrvRedrawNow(ih);
@@ -1637,6 +1639,7 @@
   *result = 0;
   return 1;
 }
+break;
   case WM_SETFOCUS:
   case WM_KILLFOCUS:
   case WM_MOUSELEAVE:


De: Ranier VF 
Enviado: quinta-feira, 25 de janeiro de 2018 00:35
Para: IUP discussion list.
Assunto: [Iup-users] IUP 3.24 RESOURCE LEAK (iupwin_list.c)

Hi,
Issue found by Coverity Scan.
CID 259212 (#1 of 1): Resource leak (RESOURCE_LEAK)
4. leaked_handle: Handle variable hBitmap going out of scope leaks the handle.

--- a\src\win\iupwin_list.c Mon Dec 11 14:52:42 2017
+++ b\src\win\iupwin_list.c Wed Jan 24 22:35:04 2018
@@ -962,12 +962,14 @@

 static int winListSetImageAttrib(Ihandle* ih, int id, const char* value)
 {
-  HBITMAP hBitmap = iupImageGetImage(value, ih, 0);
+  HBITMAP hBitmap;
   int pos = iupListGetPosAttrib(ih, id);

   if (!ih->data->show_image || pos < 0)
+  {
 return 0;
-
+  }
+  hBitmap = iupImageGetImage(value, ih, 0);
   winListSetItemData(ih, pos, NULL, hBitmap);

   iupdrvRedrawNow(ih);

Best.
Ranier Vilela
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


iupwin_list.patch
Description: iupwin_list.patch
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


[Iup-users] IUP 3.24 NULL RETURNS (iupwin_filedlg.c)

2018-01-24 Thread Ranier VF
Hi,
Issue found by Coverity Scan.
CID 259200 (#4 of 4): Dereference null return value (NULL_RETURNS)
dereference: Dereferencing a null pointer cb.

--- a\src\win\iupwin_filedlg.c  Mon Dec 11 14:52:42 2017
+++ b\src\win\iupwin_filedlg.c  Wed Jan 24 22:56:29 2018
@@ -548,7 +548,10 @@
   Ihandle* ih = (Ihandle*)GetWindowLongPtr(hWnd, DWLP_USER);
   /* callback here always exists */
   IFnss cb = (IFnss)IupGetCallback(ih, "FILE_CB");
-  cb(ih, NULL, "FINISH");
+  if (cb)
+  {
+cb(ih, NULL, "FINISH");
+  }
   break;
 }
   case WM_XBUTTONDBLCLK:

Best,
Ranier Vilela

iupwin_filedlg.patch
Description: iupwin_filedlg.patch
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


[Iup-users] IUP 3.24 DEADCODE AND NULL RETURNS (iupwin_dragdrop.c)

2018-01-24 Thread Ranier VF
Hi,
Issues found by Coverity Scan.
CID 259204 (#1 of 1): Logically dead code (DEADCODE)
CID 259217 (#2 of 2): Dereference null return value (NULL_RETURNS)

--- a\src\win\iupwin_dragdrop.c Mon Dec 11 14:52:42 2017
+++ b\src\win\iupwin_dragdrop.c Wed Jan 24 22:52:48 2018
@@ -418,7 +418,10 @@
 
   /* fill data */
   cbDragData = (IFnsVi)IupGetCallback(pThis->ih, "DRAGDATA_CB");
-  cbDragData(pThis->ih, iupwinStrFromSystem(type), pData, size);
+  if (cbDragData)
+  {
+cbDragData(pThis->ih, iupwinStrFromSystem(type), pData, size);
+  }
 
   GlobalUnlock(pStgMedium->hGlobal);
 
@@ -794,8 +797,6 @@
 lstrcpy(name, TEXT("BITMAP"));
   else if (cf == CF_METAFILEPICT)
 lstrcpy(name, TEXT("METAFILEPICT"));
-  else if (cf == CF_TIFF)
-lstrcpy(name, TEXT("TIFF"));
   else if (cf == CF_TIFF)
 lstrcpy(name, TEXT("TIFF"));
   else if (cf == CF_DIB)

Best,
Ranier Vilela

iupwin_dragdrop.patch
Description: iupwin_dragdrop.patch
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


[Iup-users] IUP 3.24 MISSING BREAK (iupwin_canvas.c)

2018-01-24 Thread Ranier VF
Hi,
Issue found by Coverity Scan.
CID 259179 (#1 of 1): Missing break in switch (MISSING_BREAK)
unterminated_case: The case for value 276U is not terminated by a 'break' 
statement.

--- a\src\win\iupwin_canvas.c   Tue Jan 16 20:23:32 2018
+++ b\src\win\iupwin_canvas.c   Wed Jan 24 22:40:51 2018
@@ -579,6 +579,7 @@
   *result = 0;
   return 1;
 }
+break;
   case WM_HSCROLL:
 /* only process the scrollbar if not a MDI client AND a standard scrollbar 
*/
 if (!iupAttribGetBoolean(ih, "MDICLIENT") && lp == 0)
@@ -587,6 +588,7 @@
   *result = 0;
   return 1;
 }
+break;
   case WM_SETFOCUS:
 if (!iupAttribGetBoolean(ih, "CANFOCUS"))
 {

Best,
Ranier Vilela

iupwin_canvas.patch
Description: iupwin_canvas.patch
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


[Iup-users] IUP 3.24 RESOURCE LEAK (iupwin_list.c)

2018-01-24 Thread Ranier VF
Hi,
Issue found by Coverity Scan.
CID 259212 (#1 of 1): Resource leak (RESOURCE_LEAK)
4. leaked_handle: Handle variable hBitmap going out of scope leaks the handle.

--- a\src\win\iupwin_list.c Mon Dec 11 14:52:42 2017
+++ b\src\win\iupwin_list.c Wed Jan 24 22:35:04 2018
@@ -962,12 +962,14 @@
 
 static int winListSetImageAttrib(Ihandle* ih, int id, const char* value)
 {
-  HBITMAP hBitmap = iupImageGetImage(value, ih, 0);
+  HBITMAP hBitmap;
   int pos = iupListGetPosAttrib(ih, id);
 
   if (!ih->data->show_image || pos < 0)
+  {
 return 0;
-
+  }
+  hBitmap = iupImageGetImage(value, ih, 0);
   winListSetItemData(ih, pos, NULL, hBitmap);
 
   iupdrvRedrawNow(ih);

Best.
Ranier Vilela
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


[Iup-users] IUP 3.24 RESOURCE_LEAK (iupwin_menu.c)

2018-01-24 Thread Ranier VF
Hi,
Issue found by Coverity Scan.
CID 259189 (#1-2 of 2): Resource leak (RESOURCE_LEAK)

--- a\src\win\iupwin_menu.c Mon Dec 11 14:52:42 2017
+++ b\src\win\iupwin_menu.c Wed Jan 24 22:26:33 2018
@@ -431,9 +431,13 @@
 hBitmapChecked = hBitmapUnchecked;
 
   SetMenuItemBitmaps((HMENU)ih->handle, (UINT)ih->serial, MF_BYCOMMAND, 
hBitmapUnchecked, hBitmapChecked);
-
   winMenuUpdateBar(ih);
 
+  if (impress)
+  {
+ DeleteObject(hBitmapChecked);
+  }
+
   return 1;
 }
 
@@ -450,8 +454,13 @@
 hBitmapChecked = hBitmapUnchecked;
 
   SetMenuItemBitmaps((HMENU)ih->handle, (UINT)ih->serial, MF_BYCOMMAND, 
hBitmapUnchecked, hBitmapChecked);
-
   winMenuUpdateBar(ih);
+
+  if (value)
+  {
+DeleteObject(hBitmapChecked);
+  }
+  DeleteObject(hBitmapunChecked);
 
   return 1;
 }

Best.
Ranier Vilela

iupwin_menu.patch
Description: iupwin_menu.patch
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


[Iup-users] Issues with tecmakewin.mak

2018-01-24 Thread Ranier VF
Hi Scuri,
I'm compiling IM, CD and IUP in Windows env.
I have found issues with tecmakewin.mak

1) the files .wdep in IM and CD, are created with size of 5 and content "" or
are not being created.
solution: copy content file im.wdep with size of 1 byte to replace 
im_process.wdep,
for example.So, compilation goes.

2) Directories in IM, CD and IUP are no being created.
Wrong cmd and path: mkdir -p ../obj/im_process, for example
solution create manually: mkdir obj\im_process

3) With IUP
Stop compilation with file iupcd.wdep error.
File with size 1 byte, same content as im.wdep, compilation stop!

Can you guide me, to resolve? I'm not an expert in makefiles.

Best,
Ranier Vilela
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


Re: [Iup-users] IUP 3.24

2018-01-23 Thread Ranier VF
Hi,
Thank you, by note, it will be easier to prove my colaboration with IUP.

Best.
Ranier Vilela

De: Antonio Scuri 
Enviado: terça-feira, 23 de janeiro de 2018 12:24
Para: IUP discussion list.
Assunto: Re: [Iup-users] IUP 3.24

  Hi Ranier,

  I just added an item in History about Coverity Scan. And a note in people 
that contributed to the library.

  Releasing a IUP version is a very delicate process that I usually push my 
concentration to avoid mistakes that affects all our users.

Best,
Scuri


2018-01-23 9:57 GMT-02:00 Ranier VF 
mailto:ranier_...@hotmail.com>>:
Hi,
Very disappointing!
In world Open Source, the least that is expected is recognition.
No mention of my name and none mention about bugs fixeds in IUP.
When asked, some time ago, Scuri say contribute with code.
Coverity Team asked me, proof of colaboration to release report.
They found nothing in IUP site, and will still not find.

Code with performance and safely, it's an art, that I learn every day.

Thank you Scuri, for nothing.

Ranier Vilela

De: Antonio Scuri mailto:antonio.sc...@gmail.com>>
Enviado: terça-feira, 23 de janeiro de 2018 03:15
Para: IUP discussion list.
Assunto: [Iup-users] IUP 3.24

Hi All,

   We just released IUP version 3.24.

   We would like to highlight some of the new features:

  *   New: Find All and Find Results tab for IupScintillaDlg. Option for 
searching in Project Files even if they are not open.
  *   New: NOSCROLLASTITLE attribute for IupMatrix. NOSCROLL columns and lines 
can now behave and look as title cells.
  *   New: EOL, EOLMODE attributes and options for FIXEOL attribute in 
IupScintilla. Support for different end of lines in IupScintillaDlg.
  *   Changed: IupColorBrowser, IupColorbar, IupGauge and IupDial migrated from 
the IupControls library to the main library using IupDraw, they do not depend 
on the CD library anymore. The natives IupColorDlg were removed and now only 
the IupColorBrowser based dialog remains.
  *   Changed: [IMPORTANT INCOMPATIBILITY]  The separate library for 
IupMatrixEx was merged with the IupControls library. The IupMatrixExOpen and 
IupMatrixExInit functions were removed.

  You can find the complete list of changes and files for download at:

http://www.tecgraf.puc-rio.br/iup/
http://iup.sourceforge.net/

Best Regards,
Antonio Scuri


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Iup-users mailing list
Iup-users@lists.sourceforge.net<mailto:Iup-users@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/iup-users


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


Re: [Iup-users] IUP 3.24

2018-01-23 Thread Ranier VF
Hi,
Very disappointing!
In world Open Source, the least that is expected is recognition.
No mention of my name and none mention about bugs fixeds in IUP.
When asked, some time ago, Scuri say contribute with code.
Coverity Team asked me, proof of colaboration to release report.
They found nothing in IUP site, and will still not find.

Code with performance and safely, it's an art, that I learn every day.

Thank you Scuri, for nothing.

Ranier Vilela

De: Antonio Scuri 
Enviado: terça-feira, 23 de janeiro de 2018 03:15
Para: IUP discussion list.
Assunto: [Iup-users] IUP 3.24

Hi All,

   We just released IUP version 3.24.

   We would like to highlight some of the new features:

  *   New: Find All and Find Results tab for IupScintillaDlg. Option for 
searching in Project Files even if they are not open.
  *   New: NOSCROLLASTITLE attribute for IupMatrix. NOSCROLL columns and lines 
can now behave and look as title cells.
  *   New: EOL, EOLMODE attributes and options for FIXEOL attribute in 
IupScintilla. Support for different end of lines in IupScintillaDlg.
  *   Changed: IupColorBrowser, IupColorbar, IupGauge and IupDial migrated from 
the IupControls library to the main library using IupDraw, they do not depend 
on the CD library anymore. The natives IupColorDlg were removed and now only 
the IupColorBrowser based dialog remains.
  *   Changed: [IMPORTANT INCOMPATIBILITY]  The separate library for 
IupMatrixEx was merged with the IupControls library. The IupMatrixExOpen and 
IupMatrixExInit functions were removed.

  You can find the complete list of changes and files for download at:

http://www.tecgraf.puc-rio.br/iup/
http://iup.sourceforge.net/

Best Regards,
Antonio Scuri


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


[Iup-users] Changes in iup_scintilladlg.c

2018-01-21 Thread Ranier VF
Hi Scuri,
IMHO the version of changeTabsToSpaces, can be better.
What do you think of this version?

--- a\srcscintilla\iup_scintilladlg.c   Sun Jan 21 22:40:55 2018
+++ b\srcscintilla\iup_scintilladlg.c   Sun Jan 21 22:43:36 2018
@@ -308,13 +308,13 @@
   continue;
 
 IupTextConvertPosToLinCol(multitext, i, &lin, &col);
+IupSetStrf(multitext, "DELETERANGE", "%d,%d", i, 1);
 
 if (tabSize == 0)
-  spacesToNextTab = 0;
-else
-  spacesToNextTab = tabSize - (col + 1) % tabSize + 1;
-
-IupSetStrf(multitext, "DELETERANGE", "%d,%d", i, 1);
+{
+   continue;
+}
+spacesToNextTab = tabSize - (col + 1) % tabSize + 1;
 
 for (j = 0; j < spacesToNextTab; j++)
   IupSetAttributeId(multitext, "INSERT", i + j, " ");

This line IupTextConvertPosToLinCol(multitext, i, &lin, &col);
really affects multitext?

Best.
Ranier Vilela

iup_scintilladlg.patch
Description: iup_scintilladlg.patch
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


Re: [Iup-users] CID 210590 (#1 of 1): Infinite loop (INFINITE_LOOP)

2018-01-21 Thread Ranier VF
Hi Scuri,
You're welcome.

Best.
Ranier Vilela

De: Antonio Scuri 
Enviado: sábado, 20 de janeiro de 2018 16:19
Para: IUP discussion list.
Assunto: Re: [Iup-users] CID 210590 (#1 of 1): Infinite loop (INFINITE_LOOP)

  The third report was a serious bug... Thanks.

  Fixed and committed to SVN.

Best,
Scuri


2018-01-19 16:20 GMT-02:00 Ranier VF 
mailto:ranier_...@hotmail.com>>:
Hi,
Multiple issues found by Coverity Scan.

CID 210502 (#1 of 1): Division or modulo by zero (DIVIDE_BY_ZERO)
CID 210590 (#1 of 1): Infinite loop (INFINITE_LOOP)
CID 210665 (#1 of 1): Division or modulo by zero (DIVIDE_BY_ZERO)

--- a\srcscintilla\iup_scintilladlg.c   Fri Jan 19 16:00:51 2018
+++ b\srcscintilla\iup_scintilladlg.c   Fri Jan 19 16:17:11 2018
@@ -299,6 +299,11 @@
   int tabSize = IupGetInt(multitext, "TABSIZE");
   int lin, col, i, j;

+  if (tabSize == 0)
+  {
+ return;
+  }
+
   for (i = count - 1; i >= 0; i--)
   {
 int spacesToNextTab;
@@ -325,6 +330,11 @@
   int tabSize = IupGetInt(multitext, "TABSIZE");
   int lin, col, i;

+  if (tabSize == 0)
+  {
+ return;
+  }
+
   for (i = count - 1; i >= 0; i--)
   {
 int nSpaces, tabStop;
@@ -591,7 +601,7 @@
   int i;

   /* clear everything before saving */
-  for (i = 1; i <= count; count++)
+  for (i = 1; i <= count; i++)
 IupConfigSetVariableStrId(projectConfig, "ProjectFiles", "File", i, NULL);
   IupConfigSetVariableStr(projectConfig, "ProjectFiles", "Count", NULL);

Best.
Ranier
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Iup-users mailing list
Iup-users@lists.sourceforge.net<mailto:Iup-users@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/iup-users



--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


[Iup-users] CID 210590 (#1 of 1): Infinite loop (INFINITE_LOOP)

2018-01-19 Thread Ranier VF
Hi,
Multiple issues found by Coverity Scan.

CID 210502 (#1 of 1): Division or modulo by zero (DIVIDE_BY_ZERO)
CID 210590 (#1 of 1): Infinite loop (INFINITE_LOOP)
CID 210665 (#1 of 1): Division or modulo by zero (DIVIDE_BY_ZERO)

--- a\srcscintilla\iup_scintilladlg.c   Fri Jan 19 16:00:51 2018
+++ b\srcscintilla\iup_scintilladlg.c   Fri Jan 19 16:17:11 2018
@@ -299,6 +299,11 @@
   int tabSize = IupGetInt(multitext, "TABSIZE");
   int lin, col, i, j;
 
+  if (tabSize == 0) 
+  {
+ return;
+  }
+
   for (i = count - 1; i >= 0; i--)
   {
 int spacesToNextTab;
@@ -325,6 +330,11 @@
   int tabSize = IupGetInt(multitext, "TABSIZE");
   int lin, col, i;
 
+  if (tabSize == 0)
+  {
+ return;
+  }
+
   for (i = count - 1; i >= 0; i--)
   {
 int nSpaces, tabStop;
@@ -591,7 +601,7 @@
   int i;
 
   /* clear everything before saving */
-  for (i = 1; i <= count; count++)
+  for (i = 1; i <= count; i++)
 IupConfigSetVariableStrId(projectConfig, "ProjectFiles", "File", i, NULL);
   IupConfigSetVariableStr(projectConfig, "ProjectFiles", "Count", NULL);
 
Best.
Ranier

iup_scintilladlg.patch
Description: iup_scintilladlg.patch
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


[Iup-users] CID 210500 (#1 of 1): Incorrect sizeof expression (BAD_SIZEOF)

2018-01-19 Thread Ranier VF
Hi,
Issue found by Coverity Scan.
CID 210500 (#1 of 1): Incorrect sizeof expression (BAD_SIZEOF)
bad_sizeof: Taking the size of parameter list is suspicious because although it 
is declared as an array, it is actually a pointer. Sizeof will return the size 
of a pointer, which may not be intended.

file: iup_scintilladlg.c
function: getListIndex
line: 1872
int i, count = sizeof(list);

Best.
Ranier.
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


[Iup-users] CID 210522 (#1 of 1): Unused value (UNUSED_VALUE)

2018-01-19 Thread Ranier VF
Hi,
Issue found by Coverity Scan.
CID 210522 (#1 of 1): Unused value (UNUSED_VALUE)
assigned_value: Assigning value from temp to state here, but that stored value 
is overwritten before it can be used

file: iup_maskmatch.c
line: 482
  state = temp;

Best.
Ranier

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


[Iup-users] CID 210632 (#1 of 1): Logically dead code (DEADCODE)

2018-01-19 Thread Ranier VF
Hi,
Issue found by Coverity Scan.
CID 210632 (#1 of 1): Logically dead code (DEADCODE)
array_null: Comparing an array to null is not useful: ilex.name, since the test 
will always evaluate as true.

--- a\src\iup_ledlex.c  Sun Jul 26 03:10:06 2015
+++ b\src\iup_ledlex.c  Fri Jan 19 15:20:27 2018
@@ -150,10 +150,7 @@
 
 char* iupLexGetName(void)
 {
-  if (ilex.name)
-return iupStrDup(ilex.name);
-  else
-return NULL;
+  return iupStrDup(ilex.name);
 }
 
 char* iupLexName(void)

Best.
Ranier

iup_ledlex.patch
Description: iup_ledlex.patch
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


Re: [Iup-users] CID 210573 (#1 of 1): Dereference after null check (FORWARD_NULL)

2018-01-19 Thread Ranier VF
Hi,
Well can be rarely but.

If afunc->system_default is NOT NULL and afunc->default_value is NULL,
and afunc->call_global_default IS NOT NULL:

if ((!iupStrEqualNoCase(afunc->default_value, afunc->system_default)) ||

take false branch,  and

(afunc->call_global_default && 
iupGlobalDefaultColorChanged(afunc->default_value)))

take true branch,

iupGlobalDefaultColorChange is called with afunc->default_value=NULL.

int iupGlobalDefaultColorChanged(const char *name)
51{
52  char str[50] = "_IUP_USER_DEFAULT_";
  1. deref_parm_in_call: Function strcat dereferences name.
53  strcat(str, name)

Result segmentation fault, rare, but possible.

Best.
Ranier

De: Antonio Scuri 
Enviado: sexta-feira, 19 de janeiro de 2018 10:54
Para: IUP discussion list.
Assunto: Re: [Iup-users] CID 210573 (#1 of 1): Dereference after null check 
(FORWARD_NULL)

  The first if tests for:

(afunc->default_value || afunc->system_default) &&

  So default_value can be NULL if system_default is not. Or they are equal and 
NOT NULL.

  The second if tests for:

if ((!iupStrEqualNoCase(afunc->default_value, afunc->system_default)) ||

  If they are not equal OR

  then they are equal and not NULL at:

  (afunc->call_global_default && 
iupGlobalDefaultColorChanged(afunc->default_value)))

  There is no need for " && afunc->default_value"

Best,
Scuri


2018-01-19 0:06 GMT-02:00 Ranier VF 
mailto:ranier_...@hotmail.com>>:
Hi,
Issue found by Coverity Scan.
CID 210573 (#1 of 1): Dereference after null check (FORWARD_NULL)
var_deref_model: Passing null pointer afunc->default_value to 
iupGlobalDefaultColorChanged, which dereferences it.

--- a\src\iup_classattrib.c Fri Oct 14 13:48:50 2016
+++ b\src\iup_classattrib.c Fri Jan 19 00:01:03 2018
@@ -990,7 +990,8 @@
 !(afunc->flags & IUPAF_HAS_ID))
 {
   if ((!iupStrEqualNoCase(afunc->default_value, afunc->system_default)) ||
-  (afunc->call_global_default && 
iupGlobalDefaultColorChanged(afunc->default_value)))
+  (afunc->call_global_default && afunc->default_value &&
+   iupGlobalDefaultColorChanged(afunc->default_value)))
   {
 if ((!ih->handle && (afunc->flags & IUPAF_NOT_MAPPED)) ||
 (ih->handle && !(afunc->flags & IUPAF_NOT_MAPPED)))

Best.
Ranier
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Iup-users mailing list
Iup-users@lists.sourceforge.net<mailto:Iup-users@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/iup-users



--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


Re: [Iup-users] CID 210649 (#2-4 of 4): Division or modulo by zero (DIVIDE_BY_ZERO)

2018-01-19 Thread Ranier VF
Hi,
line 391:sb_range = sb_ymax - sb_ymin;
line 393:posy = ((start_pos - sb_ymin) * range) / sb_range;

and

line 425:   sb_range = sb_xmax - sb_xmin;
line 427:   posx = ((start_pos - sb_xmin) * range) / sb_range;

If sb_ymax=sb_ymin then or sb_xmax=sb_xmin, sb_range == 0!
How exaclty this division by zero is not executed?

Best.
Ranier.


De: Antonio Scuri 
Enviado: sexta-feira, 19 de janeiro de 2018 11:22
Para: IUP discussion list.
Assunto: Re: [Iup-users] CID 210649 (#2-4 of 4): Division or modulo by zero 
(DIVIDE_BY_ZERO)

  If sb_range=0 then sb_ymax=sb_ymin then the scrollbar is not shown, then this 
code is not called.

Best,
Scuri


2018-01-19 0:29 GMT-02:00 Ranier VF 
mailto:ranier_...@hotmail.com>>:
Hi,
Issue found by Coverity Scan.
CID 210649 (#2-4 of 4): Division or modulo by zero (DIVIDE_BY_ZERO)
divide_by_zero: In expression (start_pos - sb_ymin) * range / sb_range, 
division by expression sb_range which may be zero has undefined behavior.

--- a\srcglcontrols\iup_glscrollbars.c  Wed Apr 05 16:52:32 2017
+++ b\srcglcontrols\iup_glscrollbars.c  Fri Jan 19 00:28:01 2018
@@ -390,7 +390,12 @@
 range = ymax - ymin - 2 * sb_size;
 sb_range = sb_ymax - sb_ymin;

-posy = ((start_pos - sb_ymin) * range) / sb_range;
+if (sb_range != 0)
+{
+  posy = ((start_pos - sb_ymin) * range) / sb_range;
+} else {
+  posy = 0;
+}
 posy += ymin + sb_size;

 posy += diff_y;

Best.
Ranier.
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Iup-users mailing list
Iup-users@lists.sourceforge.net<mailto:Iup-users@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/iup-users


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


[Iup-users] CID 210519 (#1 of 1): Logically dead code (DEADCODE)

2018-01-18 Thread Ranier VF
Hi,
Issue found by Coverity Scan.
CID 210519 (#1 of 1): Logically dead code (DEADCODE)
dead_error_line: Execution cannot reach this statement: 
iupArrayDestroy(inNames);

--- a\srcmglplot\iup_mglplot.cppMon Oct 17 16:08:46 2016
+++ b\srcmglplot\iup_mglplot.cppFri Jan 19 00:36:40 2018
@@ -4038,10 +4038,9 @@
 
   if (inName)
   {
-Iarray* inNames = NULL;
+Iarray* inNames;
 if (sample_index == 0)
 {
-  if (inNames) iupArrayDestroy(inNames);
   inNames =  iupArrayCreate(10, sizeof(char*));
   iupAttribSet(ih, "_IUP_MGLPLOT_NAMES", (char*)inNames);
 }

Best.
Ranier

iup_mglplot.patch
Description: iup_mglplot.patch
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


[Iup-users] CID 210649 (#2-4 of 4): Division or modulo by zero (DIVIDE_BY_ZERO)

2018-01-18 Thread Ranier VF
Hi,
Issue found by Coverity Scan.
CID 210649 (#2-4 of 4): Division or modulo by zero (DIVIDE_BY_ZERO)
divide_by_zero: In expression (start_pos - sb_ymin) * range / sb_range, 
division by expression sb_range which may be zero has undefined behavior.

--- a\srcglcontrols\iup_glscrollbars.c  Wed Apr 05 16:52:32 2017
+++ b\srcglcontrols\iup_glscrollbars.c  Fri Jan 19 00:28:01 2018
@@ -390,7 +390,12 @@
 range = ymax - ymin - 2 * sb_size;
 sb_range = sb_ymax - sb_ymin;
 
-posy = ((start_pos - sb_ymin) * range) / sb_range;
+if (sb_range != 0)
+{
+  posy = ((start_pos - sb_ymin) * range) / sb_range;
+} else {
+  posy = 0;
+}
 posy += ymin + sb_size;
 
 posy += diff_y;

Best.
Ranier.
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


  1   2   3   >