[med-svn] [freebayes] 02/03: fix json name clash

Fabian Klötzl kloetzl-guest at moszumanska.debian.org
Mon Sep 4 13:17:09 UTC 2017


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

kloetzl-guest pushed a commit to branch master
in repository freebayes.

commit f803fe06df2058ddc74ea108661ad69a469d4ee3
Author: Fabian Klötzl <fabian at kloetzl.info>
Date:   Mon Sep 4 14:58:52 2017 +0200

    fix json name clash
---
 debian/patches/fix_json_name_clash.patch | 85 ++++++++++++++++++++++++++++++++
 debian/patches/series                    |  1 +
 2 files changed, 86 insertions(+)

diff --git a/debian/patches/fix_json_name_clash.patch b/debian/patches/fix_json_name_clash.patch
new file mode 100644
index 0000000..4549c1d
--- /dev/null
+++ b/debian/patches/fix_json_name_clash.patch
@@ -0,0 +1,85 @@
+Author: Fabian Klötzl <fabian at kloetzl.info>
+Date: Mon, 4 Sep 2017 12:27:38 +0200
+Acked-by: Andreas Tille <tille at debian.org>
+Description: Fix a "json" name clash
+ htslib exports an enum value called `json`. That clashes with the
+ definition of a friend function. For simplicity we resolve this by
+ renaming the local function and ask htslib to prefix their symbols in
+ the future.
+
+---
+ src/Allele.cpp | 10 +++++-----
+ src/Allele.h   | 10 +++++-----
+ src/Sample.cpp |  2 +-
+ 3 files changed, 11 insertions(+), 11 deletions(-)
+
+diff --git a/src/Allele.cpp b/src/Allele.cpp
+index 2c58c79..8645704 100644
+--- a/src/Allele.cpp
++++ b/src/Allele.cpp
+@@ -332,19 +332,19 @@ string stringForAlleles(vector<Allele> &alleles) {
+     return out.str();
+ }
+ 
+-string json(vector<Allele*> &alleles) {
++string to_json(vector<Allele*> &alleles) {
+     stringstream out;
+     vector<Allele*>::iterator a = alleles.begin();
+-    out << "[" << (*a)->json(); ++a;
++    out << "[" << (*a)->to_json(); ++a;
+     for (; a != alleles.end(); ++a)
+-        out << "," << (*a)->json();
++        out << "," << (*a)->to_json();
+     out << "]";
+     return out.str();
+ }
+ 
+-string json(Allele*& allele) { return allele->json(); }
++string to_json(Allele*& allele) { return allele->to_json(); }
+ 
+-string Allele::json(void) {
++string Allele::to_json(void) {
+     stringstream out;
+     if (!genotypeAllele) {
+         out << "{\"id\":\"" << readID << "\""
+diff --git a/src/Allele.h b/src/Allele.h
+index 3f0125f..ff41c10 100644
+--- a/src/Allele.h
++++ b/src/Allele.h
+@@ -96,10 +96,10 @@ class Allele {
+     friend ostream &operator<<(ostream &out, Allele &a);
+     friend ostream &operator<<(ostream &out, Allele* &a);
+ 
+-    friend string json(vector<Allele*> &alleles, long int &position);
+-    friend string json(vector<Allele*> &alleles);
+-    friend string json(Allele &allele, long int &position);
+-    friend string json(Allele* &allele);
++    friend string to_json(vector<Allele*> &alleles, long int &position);
++    friend string to_json(vector<Allele*> &alleles);
++    friend string to_json(Allele &allele, long int &position);
++    friend string to_json(Allele* &allele);
+ 
+ public:
+ 
+@@ -262,7 +262,7 @@ public:
+                                     //  this is used to update cached data in the allele prior to presenting the allele for analysis
+                                     //  for the current base, just use allele.currentBase
+ 
+-    string json(void);
++    string to_json(void);
+     unsigned int getLengthOnReference(void);
+     int referenceLengthFromCigar(void);
+ 
+diff --git a/src/Sample.cpp b/src/Sample.cpp
+index 06207cd..a6e3886 100644
+--- a/src/Sample.cpp
++++ b/src/Sample.cpp
+@@ -264,7 +264,7 @@ string Sample::json(void) {
+         vector<Allele*>& alleles = g->second;
+         for (vector<Allele*>::iterator a = alleles.begin(); a != alleles.end(); ++a) {
+             if (!first) { out << ","; } else { first = false; }
+-            out << (*a)->json();
++            out << (*a)->to_json();
+         }
+     }
+     out << "]";
diff --git a/debian/patches/series b/debian/patches/series
index 2b2a98d..ea7ec8f 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -5,3 +5,4 @@ use_debian_packaged_libjsoncpp.patch
 fix_test.patch
 vcffirstheader.patch
 use_cpp11.patch
+fix_json_name_clash.patch

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



More information about the debian-med-commit mailing list