Re: [Iup-users] About using IUP.Text:action in Lua

2018-01-16 Thread Pete Lomax via Iup-users
Hi there Hernan,
You might want to visit https://bitbucket.org/petelomax/phix/src and then click 
on demo, rosetta, 7guis

Although written in a different language, all 7 entries are completed.

The temperature converter is named Converter.exw, and I used the valuechanged 
callback to achieve the desired effect.

Regards,
Pete


On Wed, 17/1/18, Hernan Cano  wrote:

 Subject: [Iup-users] About using IUP.Text:action in Lua
 To: "IUP discussion list." 
 Date: Wednesday, 17 January, 2018, 5:06
 
 Hi,
 Antonio and friends.In
 the attached file, I show an example of a form in Lua
 language using the IUP gui.The
 needing is that with every key pressed in the first textbox
 some calculations be made and the result must be shown in
 the second textbox.The
 problem that I found is that it the answer is showed
 lately... this means...A
 digit is pressed... but the result is not shown.A
 second digit is pressed the result that is shown is as
 if in first textbox was only the first digit.A
 third digit is pressed the result that is shown is as if
 in first textbox were the first two digits.And
 so on.Can
 You say me where is my inconsistency with the code?My
 goal is to develop the seven GUIs proposed in 7GUIs: 
https://github.com/eugenkiss/7guisBut
 I need to resolve some points as this.Thanks..HERNAN.
 --
 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
 
 -Inline Attachment Follows-
 
 
 -Inline Attachment Follows-
 
 

--
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] IupLoadAnimation loads only first frame of GIF?

2018-01-16 Thread Mihail Ivanchev

Hello IUP,

I noticed that IupLoadAnimation loads only the 1st frame of a GIF file 
containing several. Here is how I use it:


appDlg.loadingAnimSmall = IupLoadAnimation("loading-small.gif");
appDlg.canvas.loadingAnim = IupAnimatedLabel(appDlg.loadingAnimSmall);
IupAppend(IupGetParent(appDlg.canvas.handle), appDlg.canvas.loadingAnim);
IupSetAttribute(appDlg.canvas.loadingAnim, "START", "YES");

printf("%d\n", IupGetInt(appDlg.canvas.loadingAnim, "FRAMECOUNT"));
printf("%d\n", IupGetInt(appDlg.canvas.loadingAnim, "FRAMETIME"));

The frame count's reported to be 1, the frame time is correctly 
inferred. Is this expected?


Thanks!



--
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] About using IUP.Text:action in Lua

2018-01-16 Thread Hernan Cano
Hi, Antonio and friends.

In the attached file, I show an example of a form in Lua language using the
IUP gui.

The needing is that with every key pressed in the first textbox some
calculations be made and the result must be shown in the second textbox.

The problem that I found is that it the answer is showed lately... this
means...

A digit is pressed... but the result is not shown.

A second digit is pressed the result that is shown is as if in first
textbox was only the first digit.

A third digit is pressed the result that is shown is as if in first
textbox were the first two digits.

And so on.

Can You say me where is my inconsistency with the code?

My goal is to develop the seven GUIs proposed in 7GUIs:
https://github.com/eugenkiss/7guis

But I need to resolve some points as this.

Thanks..

*HERNAN*.


Temperatura.lua
Description: Binary data
--
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 210578 (#1 of 1): Dereference null return value (NULL_RETURNS)

2018-01-16 Thread Ranier VF
Hi,
Issue found by Coverity Scan.
CID 210578 (#1 of 1): Dereference null return value (NULL_RETURNS)

--- a\srccontrols\matrix\iupmat_getset.cTue Sep 19 12:43:20 2017
+++ b\srccontrols\matrix\iupmat_getset.cTue Jan 16 23:52:24 2018
@@ -138,7 +138,14 @@
   {
 /* only called in callback mode */
 sIFnii value_cb = (sIFnii)IupGetCallback(ih, "VALUE_CB");
-value = value_cb(ih, lin, col);
+
+if (value_cb)
+{
+   value = value_cb(ih, lin, col);
+} else
+{
+   value = NULL;
+}
   }
   else
 value = ih->data->cells[lin][col].value;

Best.
Ranier

iupmat_getset.patch
Description: iupmat_getset.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 210583 (#1 of 1): Division or modulo by zero (DIVIDE_BY_ZERO)

2018-01-16 Thread Ranier VF
Hi,
Issue found by Coverity Scan.
CID 210583 (#1 of 1): Division or modulo by zero (DIVIDE_BY_ZERO)
. divide_by_zero: In expression time_delay / frame_time, division by expression 
frame_time which may be zero has undefined behavior.

--- a\src\iup_expander.cMon Sep 04 15:31:16 2017
+++ b\src\iup_expander.cTue Jan 16 23:46:10 2018
@@ -385,7 +385,12 @@
   int num_frames = iupAttribGetInt(ih, "NUMFRAMES");
   int time_delay = iupAttribGetInt(ih_timer, "ELAPSEDTIME");
   int height;
-  int current_frame = time_delay / frame_time;
+  int current_frame = 0;
+
+  if (frame_time != 0)
+  {
+ current_frame = time_delay / frame_time;
+  } 
 
   if (closing)
 height = (final_height*(num_frames - current_frame)) / num_frames;

Best.
Ranier

iup_expander.patch
Description: iup_expander.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 210616 (#1 of 1): Missing varargs init or cleanup (VARARGS)

2018-01-16 Thread Ranier VF
Hi,
Issue found by Coverity Scan.
CID 210616 (#1 of 1): Missing varargs init or cleanup (VARARGS)

--- a\src\iup_scanf.c   Sun Jul 26 03:10:04 2015
+++ b\src\iup_scanf.c   Tue Jan 16 23:38:37 2018
@@ -175,9 +175,9 @@
 }
 ++fields_out_count;
   }
-  va_end(va);
 
 cleanup:
+  va_end(va);
   if (s1) free(s1);
   if (title) free(title);
   if (width) free(width);

Best.
Ranier.

iup_scanf.patch
Description: iup_scanf.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 210621 (#1 of 1): Copy-paste error (COPY_PASTE_ERROR)

2018-01-16 Thread Ranier VF
Hi,
Issue found by Coverity Scan.
CID 210621 (#1 of 1): Copy-paste error (COPY_PASTE_ERROR)
copy_paste_error: max_w in max_w > geometry.min_height looks like a copy-paste 
error.

--- a\src\gtk\iupgtk_dialog.c   Wed Oct 11 19:38:34 2017
+++ b\src\gtk\iupgtk_dialog.c   Tue Jan 16 23:33:23 2018
@@ -1091,7 +1091,7 @@
 geometry.max_width = max_w-decorwidth;
 
   geometry.max_height = 65535;
-  if (max_h > decorheight && max_w > geometry.min_height)
+  if (max_h > decorheight && max_h > geometry.min_height)
 geometry.max_height = max_h-decorheight;
 
   /* must set both at the same time, or GTK will assume its default */

Best.
Ranier

iup_dialog.patch
Description: iup_dialog.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 210623 (#1 of 1): Explicit null dereferenced (FORWARD_NULL)

2018-01-16 Thread Ranier VF
Hi,
Issue found by Coverity Scan.
CID 210623 (#1 of 1): Explicit null dereferenced (FORWARD_NULL)
9. var_deref_op: Dereferencing null pointer next.

File: iup_maskmatch.c
Function: iMaskMatchCaptureResult

code:
  next = NULL;

  while (capture != NULL)
  {
if (capture->type == IMASK_CAPT_OPEN)
{
  ImaskCapt *cap = capture->next_one;

  capture->next_one = next;
  next = capture;
  capture = cap;
}
else
{
  if (capture->pos >= next->pos)
(*vars->function)((char)capture->which_one, next->pos, capture->pos, 
vars->text, vars->user);

  next = next->next_one;
  capture = capture->next_one;
}
  }

Need rethink this function, if capture->type != IMASK_CAPT_OPEN and
next is 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
https://lists.sourceforge.net/lists/listinfo/iup-users


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

2018-01-16 Thread Ranier VF
Hi,
Issue found by Coverity Scan.
CID 210638 (#1 of 1): Explicit null dereferenced (FORWARD_NULL)

--- a\srcglcontrols\iup_gldraw.cThu Aug 04 14:58:16 2016
+++ b\srcglcontrols\iup_gldraw.cTue Jan 16 23:17:34 2018
@@ -571,7 +570,7 @@
 glTranslated(0.0, (double)-lineheight, 0.0);
 
 curstr = nextstr;
-  } while (*nextstr);
+  } while (nextstr && *nextstr);
 
   glPopMatrix();
 }

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


Re: [Iup-users] CID 210680 (#2 of 2): Missing break in switch (MISSING_BREAK)

2018-01-16 Thread Antonio Scuri
  Fixed and committed to SVN.

Best,
Scuri


2018-01-16 23:07 GMT-02:00 Ranier VF :

> Hi,
> Issue found by Coverity Scan.
> CID 210680 (#2 of 2): Missing break in switch (MISSING_BREAK)
>
> --- a\srcim\iup_im.cThu Feb 02 20:46:26 2017
> +++ b\srcim\iup_im.cTue Jan 16 23:07:47 2018
> @@ -35,6 +35,7 @@
>  {
>  case IM_ERR_NONE:
>msg = NULL;
> +  break;
>  case IM_ERR_OPEN:
>msg = "Error Opening Image File.";
>break;
> @@ -63,6 +64,7 @@
>  {
>  case IM_ERR_NONE:
>msg = NULL;
> +  break;
>  case IM_ERR_OPEN:
>msg = "Erro Abrindo Arquivo de Imagem.";
>break;
>
> 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
>
>
--
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 210680 (#2 of 2): Missing break in switch (MISSING_BREAK)

2018-01-16 Thread Ranier VF
Hi,
Issue found by Coverity Scan.
CID 210680 (#2 of 2): Missing break in switch (MISSING_BREAK)

--- a\srcim\iup_im.cThu Feb 02 20:46:26 2017
+++ b\srcim\iup_im.cTue Jan 16 23:07:47 2018
@@ -35,6 +35,7 @@
 {
 case IM_ERR_NONE:
   msg = NULL;
+  break;
 case IM_ERR_OPEN:
   msg = "Error Opening Image File.";
   break;
@@ -63,6 +64,7 @@
 {
 case IM_ERR_NONE:
   msg = NULL;
+  break;
 case IM_ERR_OPEN:
   msg = "Erro Abrindo Arquivo de Imagem.";
   break;

Best.
Ranier

iup_im.patch
Description: iup_im.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 210513 (#1 of 1): Uninitialized scalar variable (UNINIT)

2018-01-16 Thread Ranier VF
Hi,
Issue found by Coverity Scan.
CID 210513 (#1 of 1): Uninitialized scalar variable (UNINIT)

--- a\src\iup_draw.cTue May 16 16:22:56 2017
+++ b\src\iup_draw.cTue Jan 16 22:59:52 2018
@@ -561,8 +561,7 @@
 
 void iupFlatDrawArrow(IdrawCanvas* dc, int x, int y, int size, const char* 
color, const char* bgcolor, int active, int dir)
 {
-  int points[6];
-
+  int points[6] = {0};
   int off1 = iupRound((double)size * 0.13);
   int off2 = iupRound((double)size * 0.87);
   int half = size / 2;

Best.
Ranier

iup_draw.patch
Description: iup_draw.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 210518 (#2 of 2): Resource leak (RESOURCE_LEAK)

2018-01-16 Thread Antonio Scuri
 Already fixed this one... along with another report on the same file.

2018-01-16 22:56 GMT-02:00 Ranier VF :

> Hi,
> Issue found by Coverity Scan.
> CID 210518 (#2 of 2): Resource leak (RESOURCE_LEAK)
> 9. leaked_storage: Variable nm going out of scope leaks the storage it
> points to.
>
> file: iup_ledparse.c
> function: iParseExp
> line: 110
>  IPARSE_RETURN_IF_ERRO(iparse_error);
>
> 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
>
--
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 210518 (#2 of 2): Resource leak (RESOURCE_LEAK)

2018-01-16 Thread Ranier VF
Hi,
Issue found by Coverity Scan.
CID 210518 (#2 of 2): Resource leak (RESOURCE_LEAK)
9. leaked_storage: Variable nm going out of scope leaks the storage it points 
to.

file: iup_ledparse.c
function: iParseExp
line: 110
 IPARSE_RETURN_IF_ERRO(iparse_error);

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 210613 (#2 of 2): Uninitialized scalar variable (UNINIT)

2018-01-16 Thread Ranier VF
Hi,
CID 210613 (#2 of 2): Uninitialized scalar variable (UNINIT)

--- a\srcglcontrols\iup_gldraw.cThu Aug 04 14:58:16 2016
+++ b\srcglcontrols\iup_gldraw.cTue Jan 16 22:41:14 2018
@@ -327,8 +327,7 @@
 
 void iupGLDrawArrow(Ihandle *ih, int x, int y, int size, const char* color, 
int active, int dir)
 {
-  int points[6];
-
+  int points[6] = {0};
   int off1 = iupRound((double)size * 0.13);
   int off2   = iupRound((double)size * 0.87);
   int half = size / 2;

Best.
Ranier

iup_gldraw.patch
Description: iup_gldraw.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 210635 (#1 of 1): Uninitialized scalar variable (UNINIT)

2018-01-16 Thread Ranier VF
Hi,
Ihandle* ih_names[MAX_NAMES] = {NULL};
Has the same effect that call function memset and is more fast.

Accessing pointer var uninitialized are ever insecure and bug prone.
Best.
Ranier.

De: Antonio Scuri 
Enviado: quarta-feira, 17 de janeiro de 2018 00:39
Para: IUP discussion list.
Assunto: Re: [Iup-users] CID 210635 (#1 of 1): Uninitialized scalar variable 
(UNINIT)

  This is the same case as the previous e-mail. The logic access the array only 
at the current count, which starts at 0. I don't think there is a problem 
there, but the memset of the previous e-mail was harmless. So I repeat it for 
coehrence.

  memset(ih_names, 0, MAX_NAMES * sizeof(Ihandle*));

 Fixed and committed to SVN.

Best,
Scuri


2018-01-16 22:31 GMT-02:00 Ranier VF 
mailto:ranier_...@hotmail.com>>:
Hi,
Issue found by Coverity Scan.
CID 210635 (#1 of 1): Uninitialized scalar variable (UNINIT)

--- a\srcview\iup_view.cFri Sep 29 14:05:12 2017
+++ b\srcview\iup_view.cTue Jan 16 22:29:20 2018
@@ -656,7 +656,7 @@
 {
   char *names[MAX_NAMES];
   Ihandle* ih;
-  Ihandle* ih_names[MAX_NAMES];
+  Ihandle* ih_names[MAX_NAMES] = {NULL};
   Ihandle* list = (Ihandle*)IupGetAttribute(self, "mainList");
   int i, j=0, num_names = IupGetAllNames(names, MAX_NAMES);
   for (i = 0; i < num_names; i++)

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



--
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] Floating-point weirdness: Possible bug around CD's RGB_to_HSB code.

2018-01-16 Thread sur-behoffski

G'day,

Thanks for the added initialisation of hue, in response to a compiler
warning that the variable might be used before being initialised.
This initialisation was added as r739 to CD, to the file
cd/src/drv/cddxf.c, line 1662.

As I mentioned previously, I always break out in a sweat when
floating-point (nominally double-precision, in this case) entities
are subject to an equality check.  This happens in the altered
function (RGB_to_HSB) in a number of places, especially in the
paragraph:

  if (*sat != 0)/* hue from 0 to 359 */
  {
if (red   == maximum) *hue = (green - blue)/delta;
if (green == maximum) *hue = 2 + (blue - red)/delta;
if (blue  == maximum) *hue = 4 + (red - green)/delta;
*hue *= 60;
if (*hue < 0) *hue += 360;
  }

While digging around various places regarding floating-point
equality in general (I was focussing on the internal 80-bit
double-extended format versus the 64-bit double format), I found a
surprise, or, more precisely, a "disappointment" in the GCC
documentation (info gcc):

Section 13.6 Disappointments and Misunderstandings
==

[...]

  * On 68000 and x86 systems, for instance, you can get paradoxical
results if you test the precise values of floating point numbers.
For example, you can find that a floating point value which is not
a NaN is not equal to itself.  This results from the fact that the
floating point registers hold a few more bits of precision than
fit in a `double' in memory.  Compiled code moves values between
memory and floating point registers at its convenience, and moving
them into memory truncates them.

You can partially avoid this problem by using the `-ffloat-store'
option (*note Optimize Options::).

[...]

So, when dealing with optimized floating-point code, it's possible
to have code that seems absurd, such as (for "float x;" and/or
"double x;"; perhaps also other floating-point formats):

x = PARADOXICAL_VALUE;
if (x == x)
 printf("%s\n", "equal");
else
 printf("%s\n", "not equal?!");

and the output would be "not equal?!\n".  (This is a very, very,
slimmed-down example; where optimization is enabled, the compiler
might be able to trace code flow here, although I don't know if
the presence of floating-point almost immediately cuts off some
analysis opportunities.)

-

For the function in question, the colour parameters are:

 unsigned char r, unsigned char g, unsigned char b

and are immediately converted to the double variables:

 double red   = r / 255.0;
 double green = g / 255.0;
 double blue  = b / 255.0;

If r/g/b were converted to signed-integer variables (at least
16-bit), then some of the contentious equality-test cases could
operate on the integer variables, bypassing the floating-point
uncertainty.

The function could be reworked so that the majority of operations
use signed integer variables derived from the r/g/b parameters,
and defer double-precision conversions until as late as possible.

cheers,

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


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

2018-01-16 Thread Antonio Scuri
  Actually there was the same issue in line 143.

  Fixed and committed to SVN.

Best,
Scuri


2018-01-16 22:36 GMT-02:00 Ranier VF :

> Hi,
> Issue found by Coverity Scan.
> CID 210622 (#1 of 1): Resource leak (RESOURCE_LEAK)
>
> --- a\src\iup_config.c  Thu Oct 05 12:41:46 2017
> +++ b\src\iup_config.c  Tue Jan 16 22:36:04 2018
> @@ -137,7 +137,10 @@
>
>  int line_len = iupLineFileReadLine(line_file);
>  if (line_len == -1)
> +{
> +  iupLineFileClose(line_file);
>return -2;
> +}
>
>  line_buffer = iupLineFileGetBuffer(line_file);
>
> 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
>
>
--
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 210635 (#1 of 1): Uninitialized scalar variable (UNINIT)

2018-01-16 Thread Antonio Scuri
  This is the same case as the previous e-mail. The logic access the array
only at the current count, which starts at 0. I don't think there is a
problem there, but the memset of the previous e-mail was harmless. So I
repeat it for coehrence.

  memset(ih_names, 0, MAX_NAMES * sizeof(Ihandle*));

 Fixed and committed to SVN.

Best,
Scuri


2018-01-16 22:31 GMT-02:00 Ranier VF :

> Hi,
> Issue found by Coverity Scan.
> CID 210635 (#1 of 1): Uninitialized scalar variable (UNINIT)
>
> --- a\srcview\iup_view.cFri Sep 29 14:05:12 2017
> +++ b\srcview\iup_view.cTue Jan 16 22:29:20 2018
> @@ -656,7 +656,7 @@
>  {
>char *names[MAX_NAMES];
>Ihandle* ih;
> -  Ihandle* ih_names[MAX_NAMES];
> +  Ihandle* ih_names[MAX_NAMES] = {NULL};
>Ihandle* list = (Ihandle*)IupGetAttribute(self, "mainList");
>int i, j=0, num_names = IupGetAllNames(names, MAX_NAMES);
>for (i = 0; i < num_names; i++)
>
> 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
>
>
--
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 210622 (#1 of 1): Resource leak (RESOURCE_LEAK)

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

--- a\src\iup_config.c  Thu Oct 05 12:41:46 2017
+++ b\src\iup_config.c  Tue Jan 16 22:36:04 2018
@@ -137,7 +137,10 @@
 
 int line_len = iupLineFileReadLine(line_file);
 if (line_len == -1)
+{
+  iupLineFileClose(line_file);
   return -2;
+}
 
 line_buffer = iupLineFileGetBuffer(line_file);
 
Best.
Ranier.

iup_config.patch
Description: iup_config.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 210656 (#1 of 1): Uninitialized pointer read (UNINIT)

2018-01-16 Thread Antonio Scuri
  Fixed and committed to SVN.

Best,
Scuri


2018-01-16 22:23 GMT-02:00 Ranier VF :

> Hi,
> Issue found by Coverity Scan.
> CID 210656 (#1 of 1): Uninitialized pointer read (UNINIT)
>
> --- a\src\iup_names.c   Mon Oct 05 17:15:42 2015
> +++ b\src\iup_names.c   Tue Jan 16 22:20:35 2018
> @@ -64,6 +64,7 @@
>  return;
>
>ih_array = (Ihandle**)malloc(count * sizeof(Ihandle*));
> +  memset(ih_array, 0, count * sizeof(Ihandle*));
>
>/* store the handles before updating so we can remove elements in the
> loop */
>name = iupTableFirst(inames_strtable);
>
> 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
>
>
--
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 210635 (#1 of 1): Uninitialized scalar variable (UNINIT)

2018-01-16 Thread Ranier VF
Hi,
Issue found by Coverity Scan.
CID 210635 (#1 of 1): Uninitialized scalar variable (UNINIT)

--- a\srcview\iup_view.cFri Sep 29 14:05:12 2017
+++ b\srcview\iup_view.cTue Jan 16 22:29:20 2018
@@ -656,7 +656,7 @@
 {
   char *names[MAX_NAMES];
   Ihandle* ih;
-  Ihandle* ih_names[MAX_NAMES];
+  Ihandle* ih_names[MAX_NAMES] = {NULL};
   Ihandle* list = (Ihandle*)IupGetAttribute(self, "mainList");
   int i, j=0, num_names = IupGetAllNames(names, MAX_NAMES); 
   for (i = 0; i < num_names; i++)

Best.
Ranier

iup_view.patch
Description: iup_view.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 210656 (#1 of 1): Uninitialized pointer read (UNINIT)

2018-01-16 Thread Ranier VF
Hi,
Issue found by Coverity Scan.
CID 210656 (#1 of 1): Uninitialized pointer read (UNINIT)

--- a\src\iup_names.c   Mon Oct 05 17:15:42 2015
+++ b\src\iup_names.c   Tue Jan 16 22:20:35 2018
@@ -64,6 +64,7 @@
 return;
 
   ih_array = (Ihandle**)malloc(count * sizeof(Ihandle*));
+  memset(ih_array, 0, count * sizeof(Ihandle*));
 
   /* store the handles before updating so we can remove elements in the loop */
   name = iupTableFirst(inames_strtable);

Best.
Ranier

iup_names.patch
Description: iup_names.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 210642 (#3 of 3): Dereference after null check (FORWARD_NULL)

2018-01-16 Thread Antonio Scuri
  Fixed and committed to SVN.

Best,
Scuri


2018-01-16 15:35 GMT-02:00 Ranier VF :

> Hi,
> Multiplie issues found by Coverity Scan.
> CID 210642 (#3 of 3): Dereference after null check (FORWARD_NULL)
> file: iup_font.c
> Function:iupGetFontInfo
>
> Vars: size, is_bold, is_italic, is_underline, is_strikeout, typeface, can
> be
> NULL according with code:
>
>   if (size) *size = 0;
>   if (is_bold) *is_bold = 0;
>   if (is_italic) *is_italic = 0;
>   if (is_underline) *is_underline = 0;
>   if (is_strikeout) *is_strikeout = 0;
>   if (typeface) *typeface = 0;
>
> but, such vars are dereferenced these functions:
> iupFontParseWin
> iupFontParseX
> iupFontParsePango
>
> 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
>
--
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 210685 (#1 of 1): Explicit null dereferenced (FORWARD_NULL)

2018-01-16 Thread Antonio Scuri
  That's correct. value can be NULL

Best,
Scuri


2018-01-16 15:53 GMT-02:00 Ranier VF :

> Hi,
> Sorry by mistake.
> Function affected is iAttribParse
> Line: 1408
>
>  IupStoreAttribute(ih, name, value);
>
> Best.
> Ranier
> 
> De: Ranier VF 
> Enviado: terça-feira, 16 de janeiro de 2018 17:49
> Para: IUP discussion list.
> Assunto: [Iup-users] CID 210685 (#1 of 1): Explicit null dereferenced
> (FORWARD_NULL)
>
> Hi,
> Issue found by Coveriy Scan.
> CID 210685 (#1 of 1): Explicit null dereferenced (FORWARD_NULL)
>
> file: iup_attrib.c
> function: IupStoreAttribute
> line: 584
>
> 7. var_deref_model: Passing null pointer value to IupStoreAttribute, which
> dereferences it.
>
> Function IupStoreGlobal dereference var "value", in call function sscanf
> in function iGlobalSet.
>
> Possible solution?
> Add check in function IupStoreAttribute.
>
>   if (!ih && name != NULL && value != NULL)
>   {
> IupStoreGlobal(name, value);
> return;
>   }
>
> 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
>
> 
> --
> 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] CID 210688 (#1 of 1): Dereference after null check (FORWARD_NULL)

2018-01-16 Thread Antonio Scuri
  That's correct. The color is set even if the value is NULL. The default
value will be set internally.

Best,
Scuri


2018-01-16 15:25 GMT-02:00 Ranier VF :

> Hi,
> Isse found by Coverity Scan.
> CID 210688 (#1 of 1): Dereference after null check (FORWARD_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
> 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 210631 (#1 of 1): Argument cannot be negative (NEGATIVE_RETURNS)

2018-01-16 Thread Antonio Scuri
 Fixed and committed to SVN.

Best,
Scuri

2018-01-16 15:04 GMT-02:00 Ranier VF :

> Hi,
> Actual version of iMatrixExSetPasteFileAttrib, still have a big waste of
> resources and processing.
>
> If iupStrToIntInt != 2, is ok, all steps to read file are lost.
> Maybe, this is better?
>
> --- a\srcmatrixex\iupmatex_clipboard.c  Tue Jan 16 14:58:55 2018
> +++ b\srcmatrixex\iupmatex_clipboard.c  Tue Jan 16 15:00:25 2018
> @@ -702,13 +702,6 @@
>char* data, *paste_at;
>int lin = 0, col = 0;
>
> -  data = iMatrixReadFile(value);
> -  if (!data)
> -  {
> -iupAttribSet(ih, "LASTERROR", "IUP_ERRORFILEOPEN");
> -return 0;
> -  }
> -
>paste_at = iupAttribGet(ih, "PASTEFILEAT");
>if (paste_at)
>{
> @@ -718,10 +711,16 @@
>  {
>if (iupStrToIntInt(paste_at, &lin, &col, ':') != 2)
>{
> -free(data);
>  return 0;
>}
>  }
> +  }
> +
> +  data = iMatrixReadFile(value);
> +  if (!data)
> +  {
> +iupAttribSet(ih, "LASTERROR", "IUP_ERRORFILEOPEN");
> +return 0;
>}
>
>iMatrixExPasteData(ih, data, lin, col, "PASTEFILE");
>
> Best,
> Ranier.
> 
> De: Antonio Scuri 
> Enviado: terça-feira, 16 de janeiro de 2018 13:01
> Para: IUP discussion list.
> Assunto: Re: [Iup-users] CID 210631 (#1 of 1): Argument cannot be negative
> (NEGATIVE_RETURNS)
>
>   Fixed and committed to SVN. I decided to split the code in two functions.
>
> Best,
> Scuri
>
>
> 2018-01-13 19:07 GMT-02:00 Ranier VF  ranier_...@hotmail.com>>:
> Hi,
> Multiple issues found by Coverity Scan.
> CID 210684: Ignoring number of bytes read (CHECKED_RETURN)
> CID 210631 (#1 of 1): Argument cannot be negative (NEGATIVE_RETURNS)
>
> 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
>
>
>
> 
> --
> 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] CID 210685 (#1 of 1): Explicit null dereferenced (FORWARD_NULL)

2018-01-16 Thread Ranier VF
Hi,
Sorry by mistake.
Function affected is iAttribParse
Line: 1408

 IupStoreAttribute(ih, name, value);

Best.
Ranier

De: Ranier VF 
Enviado: terça-feira, 16 de janeiro de 2018 17:49
Para: IUP discussion list.
Assunto: [Iup-users] CID 210685 (#1 of 1): Explicit null dereferenced 
(FORWARD_NULL)

Hi,
Issue found by Coveriy Scan.
CID 210685 (#1 of 1): Explicit null dereferenced (FORWARD_NULL)

file: iup_attrib.c
function: IupStoreAttribute
line: 584

7. var_deref_model: Passing null pointer value to IupStoreAttribute, which 
dereferences it.

Function IupStoreGlobal dereference var "value", in call function sscanf
in function iGlobalSet.

Possible solution?
Add check in function IupStoreAttribute.

  if (!ih && name != NULL && value != NULL)
  {
IupStoreGlobal(name, value);
return;
  }

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

--
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 210685 (#1 of 1): Explicit null dereferenced (FORWARD_NULL)

2018-01-16 Thread Ranier VF
Hi,
Issue found by Coveriy Scan.
CID 210685 (#1 of 1): Explicit null dereferenced (FORWARD_NULL)

file: iup_attrib.c
function: IupStoreAttribute
line: 584

7. var_deref_model: Passing null pointer value to IupStoreAttribute, which 
dereferences it. 

Function IupStoreGlobal dereference var "value", in call function sscanf
in function iGlobalSet.

Possible solution?
Add check in function IupStoreAttribute.

  if (!ih && name != NULL && value != NULL)
  {
IupStoreGlobal(name, value);
return;
  }

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 210642 (#3 of 3): Dereference after null check (FORWARD_NULL)

2018-01-16 Thread Ranier VF
Hi,
Multiplie issues found by Coverity Scan.
CID 210642 (#3 of 3): Dereference after null check (FORWARD_NULL)
file: iup_font.c
Function:iupGetFontInfo

Vars: size, is_bold, is_italic, is_underline, is_strikeout, typeface, can be
NULL according with code:

  if (size) *size = 0;
  if (is_bold) *is_bold = 0;
  if (is_italic) *is_italic = 0; 
  if (is_underline) *is_underline = 0;
  if (is_strikeout) *is_strikeout = 0;
  if (typeface) *typeface = 0;

but, such vars are dereferenced these functions:
iupFontParseWin
iupFontParseX
iupFontParsePango

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 210688 (#1 of 1): Dereference after null check (FORWARD_NULL)

2018-01-16 Thread Ranier VF
Hi,
Isse found by Coverity Scan.
CID 210688 (#1 of 1): Dereference after null check (FORWARD_NULL)

Best.
Ranier

iup_layoutdlg.patch
Description: iup_layoutdlg.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 210631 (#1 of 1): Argument cannot be negative (NEGATIVE_RETURNS)

2018-01-16 Thread Ranier VF
Hi,
Actual version of iMatrixExSetPasteFileAttrib, still have a big waste of 
resources and processing.

If iupStrToIntInt != 2, is ok, all steps to read file are lost.
Maybe, this is better?

--- a\srcmatrixex\iupmatex_clipboard.c  Tue Jan 16 14:58:55 2018
+++ b\srcmatrixex\iupmatex_clipboard.c  Tue Jan 16 15:00:25 2018
@@ -702,13 +702,6 @@
   char* data, *paste_at;
   int lin = 0, col = 0;
 
-  data = iMatrixReadFile(value);
-  if (!data)
-  {
-iupAttribSet(ih, "LASTERROR", "IUP_ERRORFILEOPEN");
-return 0;
-  }
-
   paste_at = iupAttribGet(ih, "PASTEFILEAT");
   if (paste_at)
   {
@@ -718,10 +711,16 @@
 {
   if (iupStrToIntInt(paste_at, &lin, &col, ':') != 2)
   {
-free(data);
 return 0;
   }
 }
+  }
+
+  data = iMatrixReadFile(value);
+  if (!data)
+  {
+iupAttribSet(ih, "LASTERROR", "IUP_ERRORFILEOPEN");
+return 0;
   }
 
   iMatrixExPasteData(ih, data, lin, col, "PASTEFILE");

Best,
Ranier.

De: Antonio Scuri 
Enviado: terça-feira, 16 de janeiro de 2018 13:01
Para: IUP discussion list.
Assunto: Re: [Iup-users] CID 210631 (#1 of 1): Argument cannot be negative 
(NEGATIVE_RETURNS)

  Fixed and committed to SVN. I decided to split the code in two functions.

Best,
Scuri


2018-01-13 19:07 GMT-02:00 Ranier VF 
mailto:ranier_...@hotmail.com>>:
Hi,
Multiple issues found by Coverity Scan.
CID 210684: Ignoring number of bytes read (CHECKED_RETURN)
CID 210631 (#1 of 1): Argument cannot be negative (NEGATIVE_RETURNS)

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




iupmatex_clipboard.patch
Description: iupmatex_clipboard.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 210631 (#1 of 1): Argument cannot be negative (NEGATIVE_RETURNS)

2018-01-16 Thread Antonio Scuri
  Fixed and committed to SVN. I decided to split the code in two functions.

Best,
Scuri


2018-01-13 19:07 GMT-02:00 Ranier VF :

> Hi,
> Multiple issues found by Coverity Scan.
> CID 210684: Ignoring number of bytes read (CHECKED_RETURN)
> CID 210631 (#1 of 1): Argument cannot be negative (NEGATIVE_RETURNS)
>
> 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
>
>
--
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 210626 (#1 of 1): Resource leak (RESOURCE_LEAK)

2018-01-16 Thread Antonio Scuri
  Fixed and committed to SVN.

Best,
Scuri


2018-01-12 17:35 GMT-02:00 Ranier VF :

> Hi,
> Issue found by Coverity Scan.
>
> CID 210626 (#1 of 1): Resource leak (RESOURCE_LEAK)
> file:   iup_ledparse.c
> function: iParseFunction
>
> 6. leaked_storage: Variable attr going out of scope leaks the storage it
> points to.
> line 259: IPARSE_RETURN_IF_ERRO(iupLexMatch(IUPLEX_TK_BEGP));
>
> Complex logic, need more study.
>
> 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
>
--
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