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 <antonio.sc...@gmail.com>
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<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<mailto:Iup-users@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/iup-users


Attachment: 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

Reply via email to