gnuastro-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnuastro-commits] master 36f3378: Revert "Call manually the cropping fu


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master 36f3378: Revert "Call manually the cropping functions in imgcrop"
Date: Fri, 5 Aug 2016 22:43:59 +0000 (UTC)

branch: master
commit 36f3378db9a19ba50167e75cf88df8cb06239f5a
Author: Mosè Giordano <address@hidden>
Commit: Mosè Giordano <address@hidden>

    Revert "Call manually the cropping functions in imgcrop"
    
    This reverts commit 2beb1973b77c9a3902da386a28bc668e129159a9 as the
    workaround introduced with it is not needed anymore, because the bug has
    been fixed with commit
    
       * cb9f299 (2016-08-03)  Fix buffer overrun in src/imgcrop/imgcrop.c
    
    See bugs #45380 and #46241 for reference.
---
 src/imgcrop/imgcrop.c |   18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/imgcrop/imgcrop.c b/src/imgcrop/imgcrop.c
index 0efbedd..849ed75 100644
--- a/src/imgcrop/imgcrop.c
+++ b/src/imgcrop/imgcrop.c
@@ -273,8 +273,14 @@ imgcrop(struct imgcropparams *p)
   struct cropparams *crp;
   size_t i, *indexs, thrdcols;
   size_t nt=p->cp.numthreads, nb;
+  void *(*modefunction)(void *)=NULL;
 
-  if(!p->imgmode && !p->wcsmode)
+  /* Set the function to run: */
+  if(p->imgmode)
+    modefunction=&imgmodecrop;
+  else if(p->wcsmode)
+    modefunction=&wcsmodecrop;
+  else
     error(EXIT_FAILURE, 0, "a bug! Somehow in imgcrop (imgcrop.c), "
           "neither the imgmode is on or the wcsmode! Please contact us "
           "so we can fix it, thanks");
@@ -307,10 +313,7 @@ imgcrop(struct imgcropparams *p)
     {
       crp[0].p=p;
       crp[0].indexs=indexs;
-      if(p->imgmode)
-        imgmodecrop(&crp[0]);
-      else if(p->wcsmode)
-        wcsmodecrop(&crp[0]);
+      modefunction(&crp[0]);
     }
   else
     {
@@ -330,10 +333,7 @@ imgcrop(struct imgcropparams *p)
             crp[i].b=&b;
             crp[i].outlen=crp[0].outlen;
             crp[i].indexs=&indexs[i*thrdcols];
-            if(p->imgmode)
-              err=pthread_create(&t, &attr, imgmodecrop, &crp[i]);
-            else if(p->wcsmode)
-              err=pthread_create(&t, &attr, wcsmodecrop, &crp[i]);
+            err=pthread_create(&t, &attr, modefunction, &crp[i]);
             if(err)
               error(EXIT_FAILURE, 0, "can't create thread %lu", i);
           }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]