[med-svn] [phyml] 02/02: Avoid initialisation an array with a scalar value

Andreas Tille tille at debian.org
Wed Aug 17 14:27:07 UTC 2016


This is an automated email from the git hooks/post-receive script.

tille pushed a commit to branch master
in repository phyml.

commit ca7dd1ad9ae245a4b87c38da717479b742a43f31
Author: Andreas Tille <tille at debian.org>
Date:   Wed Aug 17 16:10:25 2016 +0200

    Avoid initialisation an array with a scalar value
---
 debian/changelog                                   |  4 +++-
 .../fix_wrong_initialisation_of_array.patch        | 25 ++++++++++++++++++++++
 debian/patches/series                              |  1 +
 3 files changed, 29 insertions(+), 1 deletion(-)

diff --git a/debian/changelog b/debian/changelog
index f07a7ad..5fb64c5 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,4 +1,4 @@
-phyml (3:3.2.20160530+dfsg-1) unstable; urgency=medium
+phyml (3:3.2.20160530+dfsg-1) UNRELEASED; urgency=medium
 
   * Team upload
 
@@ -10,6 +10,8 @@ phyml (3:3.2.20160530+dfsg-1) unstable; urgency=medium
   * Add missing Depends: openmpi-bin
   * Use compression options in d/watch
   * Fix missing declaration
+  * Avoid initialisation an array with a scalar value (Thanks for the hint
+    to James Cowgill <jcowgill at debian.org>)
 
  -- Canberk Koç <canberkkoc at gmail.com>  Wed, 20 Jul 2016 03:01:14 +0300
 
diff --git a/debian/patches/fix_wrong_initialisation_of_array.patch b/debian/patches/fix_wrong_initialisation_of_array.patch
new file mode 100644
index 0000000..ab60a2e
--- /dev/null
+++ b/debian/patches/fix_wrong_initialisation_of_array.patch
@@ -0,0 +1,25 @@
+Author: Andreas Tille <tille at debian.org>
+Last-Update: Wed, 17 Aug 2016 15:30:32 +0200
+Description: avoid initialisation an array with a scalar value
+ Quoting James Cowgill <jcowgill at debian.org> on debian-mentors list:
+ .
+ You can't initialize an array with a scalar value (double[] != double).
+ Also, using an array of fixed size 1 is a code smell (why use an array
+ at all?)
+ .
+ The quick fix here is probably to wrap the values in curly braces to
+ form a correct array initializer.
+
+--- a/src/lk.c
++++ b/src/lk.c
+@@ -2446,8 +2446,8 @@ void Update_PMat_At_Given_Edge(t_edge *b
+       
+       //
+       len = MAX(0.0, b_fcus->l->v) * tree->mod->br_len_mult->v;
+-      int p_matrices[1]     = b_fcus->Pij_rr_idx;
+-      double branch_lens[1] = len;
++      int p_matrices[1]     = { b_fcus->Pij_rr_idx } ;
++      double branch_lens[1] = { len };
+       int ret = beagleUpdateTransitionMatrices(tree->b_inst,0,p_matrices,NULL,NULL,branch_lens,1);
+       if(ret<0)
+         {
diff --git a/debian/patches/series b/debian/patches/series
index 09ccda1..7b2f775 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -2,3 +2,4 @@ sse_only_if_supported.patch
 no-stdc++.patch
 no-configure-ac-date
 fix_declaration_of_temp.patch
+fix_wrong_initialisation_of_array.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/phyml.git



More information about the debian-med-commit mailing list