From 9198f5b9bd5cbb1554d4c9773003826752053a37 Mon Sep 17 00:00:00 2001 From: Anders Schack-Mulligen Date: Wed, 26 Sep 2018 15:47:21 +0200 Subject: [PATCH] CPP/CSharp/Java/Javascript: Use concat in XMLParent.allCharactersString(). --- cpp/ql/src/semmle/code/cpp/XML.qll | 8 ++++---- csharp/ql/src/semmle/code/csharp/XML.qll | 8 ++++---- java/ql/src/semmle/code/xml/XML.qll | 8 ++++---- javascript/ql/src/semmle/javascript/XML.qll | 8 ++++---- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/cpp/ql/src/semmle/code/cpp/XML.qll b/cpp/ql/src/semmle/code/cpp/XML.qll index e1cb3abaa92..36a333da03b 100644 --- a/cpp/ql/src/semmle/code/cpp/XML.qll +++ b/cpp/ql/src/semmle/code/cpp/XML.qll @@ -67,9 +67,12 @@ class XMLParent extends @xmlparent { } /** + * DEPRECATED: Internal. + * * Append the character sequences of this XML parent from left to right, separated by a space, * up to a specified (zero-based) index. */ + deprecated string charsSetUpTo(int n) { (n = 0 and xmlChars(_,result,this,0,_,_)) or (n > 0 and exists(string chars | xmlChars(_,chars,this,n,_,_) | @@ -78,10 +81,7 @@ class XMLParent extends @xmlparent { /** Append all the character sequences of this XML parent from left to right, separated by a space. */ string allCharactersString() { - exists(int n | n = this.getNumberOfCharacterSets() | - (n = 0 and result = "") or - (n > 0 and result = this.charsSetUpTo(n-1)) - ) + result = concat(string chars, int pos | xmlChars(_, chars, this, pos, _, _) | chars, " " order by pos) } /** Gets the text value contained in this XML parent. */ diff --git a/csharp/ql/src/semmle/code/csharp/XML.qll b/csharp/ql/src/semmle/code/csharp/XML.qll index 1d320626483..8e434aa7866 100644 --- a/csharp/ql/src/semmle/code/csharp/XML.qll +++ b/csharp/ql/src/semmle/code/csharp/XML.qll @@ -79,9 +79,12 @@ class XMLParent extends @xmlparent { } /** + * DEPRECATED: Internal. + * * Append the character sequences of this XML parent from left to right, separated by a space, * up to a specified (zero-based) index. */ + deprecated string charsSetUpTo(int n) { (n = 0 and xmlChars(_,result,this,0,_,_)) or (n > 0 and exists(string chars | xmlChars(_,chars,this,n,_,_) | @@ -90,10 +93,7 @@ class XMLParent extends @xmlparent { /** Append all the character sequences of this XML parent from left to right, separated by a space. */ string allCharactersString() { - exists(int n | n = this.getNumberOfCharacterSets() | - (n = 0 and result = "") or - (n > 0 and result = this.charsSetUpTo(n-1)) - ) + result = concat(string chars, int pos | xmlChars(_, chars, this, pos, _, _) | chars, " " order by pos) } /** Gets the text value contained in this XML parent. */ diff --git a/java/ql/src/semmle/code/xml/XML.qll b/java/ql/src/semmle/code/xml/XML.qll index 07fe3efa879..5c49be9d14c 100755 --- a/java/ql/src/semmle/code/xml/XML.qll +++ b/java/ql/src/semmle/code/xml/XML.qll @@ -70,9 +70,12 @@ class XMLParent extends @xmlparent { } /** + * DEPRECATED: Internal. + * * Append the character sequences of this XML parent from left to right, separated by a space, * up to a specified (zero-based) index. */ + deprecated string charsSetUpTo(int n) { n = 0 and xmlChars(_,result,this,0,_,_) or @@ -84,10 +87,7 @@ class XMLParent extends @xmlparent { /** Append all the character sequences of this XML parent from left to right, separated by a space. */ string allCharactersString() { - exists(int n | n = this.getNumberOfCharacterSets() | - (n = 0 and result = "") or - (n > 0 and result = this.charsSetUpTo(n-1)) - ) + result = concat(string chars, int pos | xmlChars(_, chars, this, pos, _, _) | chars, " " order by pos) } /** Gets the text value contained in this XML parent. */ diff --git a/javascript/ql/src/semmle/javascript/XML.qll b/javascript/ql/src/semmle/javascript/XML.qll index 76c43c0503f..bc7e8f2aaa2 100755 --- a/javascript/ql/src/semmle/javascript/XML.qll +++ b/javascript/ql/src/semmle/javascript/XML.qll @@ -70,9 +70,12 @@ class XMLParent extends @xmlparent { } /** + * DEPRECATED: Internal. + * * Append the character sequences of this XML parent from left to right, separated by a space, * up to a specified (zero-based) index. */ + deprecated string charsSetUpTo(int n) { (n = 0 and xmlChars(_,result,this,0,_,_)) or (n > 0 and exists(string chars | xmlChars(_,chars,this,n,_,_) | @@ -81,10 +84,7 @@ class XMLParent extends @xmlparent { /** Append all the character sequences of this XML parent from left to right, separated by a space. */ string allCharactersString() { - exists(int n | n = this.getNumberOfCharacterSets() | - (n = 0 and result = "") or - (n > 0 and result = this.charsSetUpTo(n-1)) - ) + result = concat(string chars, int pos | xmlChars(_, chars, this, pos, _, _) | chars, " " order by pos) } /** Gets the text value contained in this XML parent. */