Delete function url_decode

It was used only in examples/peerconnection/server/peer_channel.cc,
for questionable utility.

Bug: webrtc:6663
Change-Id: I4047eb12f35615621dd0b34a694dead51c5fd20d
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/128869
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27279}
diff --git a/examples/peerconnection/server/peer_channel.cc b/examples/peerconnection/server/peer_channel.cc
index 1eebe65..1707176 100644
--- a/examples/peerconnection/server/peer_channel.cc
+++ b/examples/peerconnection/server/peer_channel.cc
@@ -17,7 +17,6 @@
 
 #include "examples/peerconnection/server/data_socket.h"
 #include "examples/peerconnection/server/utils.h"
-#include "rtc_base/string_encode.h"
 
 // Set to the peer id of the originator when messages are being
 // exchanged between peers, but set to the id of the receiving peer
@@ -60,7 +59,7 @@
   assert(socket);
   assert(socket->method() == DataSocket::GET);
   assert(socket->PathEquals("/sign_in"));
-  name_ = rtc::s_url_decode(socket->request_arguments());
+  name_ = socket->request_arguments();
   if (name_.empty())
     name_ = "peer_" + int2str(id_);
   else if (name_.length() > kMaxNameLength)
diff --git a/rtc_base/string_encode.cc b/rtc_base/string_encode.cc
index 45ea586..85c7a3f 100644
--- a/rtc_base/string_encode.cc
+++ b/rtc_base/string_encode.cc
@@ -22,34 +22,6 @@
 // String Encoding Utilities
 /////////////////////////////////////////////////////////////////////////////
 
-size_t url_decode(char* buffer,
-                  size_t buflen,
-                  const char* source,
-                  size_t srclen) {
-  if (nullptr == buffer)
-    return srclen + 1;
-  if (buflen <= 0)
-    return 0;
-
-  unsigned char h1, h2;
-  size_t srcpos = 0, bufpos = 0;
-  while ((srcpos < srclen) && (bufpos + 1 < buflen)) {
-    unsigned char ch = source[srcpos++];
-    if (ch == '+') {
-      buffer[bufpos++] = ' ';
-    } else if ((ch == '%') && (srcpos + 1 < srclen) &&
-               hex_decode(source[srcpos], &h1) &&
-               hex_decode(source[srcpos + 1], &h2)) {
-      buffer[bufpos++] = (h1 << 4) | h2;
-      srcpos += 2;
-    } else {
-      buffer[bufpos++] = ch;
-    }
-  }
-  buffer[bufpos] = '\0';
-  return bufpos;
-}
-
 static const char HEX[] = "0123456789abcdef";
 
 char hex_encode(unsigned char val) {
@@ -190,26 +162,6 @@
                                    source.length(), delimiter);
 }
 
-size_t transform(std::string& value,
-                 size_t maxlen,
-                 const std::string& source,
-                 Transform t) {
-  char* buffer = STACK_ARRAY(char, maxlen + 1);
-  size_t length = t(buffer, maxlen + 1, source.data(), source.length());
-  value.assign(buffer, length);
-  return length;
-}
-
-std::string s_transform(const std::string& source, Transform t) {
-  // Ask transformation function to approximate the destination size (returns
-  // upper bound)
-  size_t maxlen = t(nullptr, 0, source.data(), source.length());
-  char* buffer = STACK_ARRAY(char, maxlen);
-  size_t len = t(buffer, maxlen, source.data(), source.length());
-  std::string result(buffer, len);
-  return result;
-}
-
 size_t tokenize(const std::string& source,
                 char delimiter,
                 std::vector<std::string>* fields) {
diff --git a/rtc_base/string_encode.h b/rtc_base/string_encode.h
index d3338d9..d0f323d 100644
--- a/rtc_base/string_encode.h
+++ b/rtc_base/string_encode.h
@@ -26,12 +26,6 @@
 // String Encoding Utilities
 //////////////////////////////////////////////////////////////////////
 
-// Note: in-place decoding (buffer == source) is allowed.
-size_t url_decode(char* buffer,
-                  size_t buflen,
-                  const char* source,
-                  size_t srclen);
-
 // Convert an unsigned value from 0 to 15 to the hex character equivalent...
 char hex_encode(unsigned char val);
 // ...and vice-versa.
@@ -82,26 +76,6 @@
                                  const std::string& source,
                                  char delimiter);
 
-// Apply any suitable string transform (including the ones above) to an STL
-// string.  Stack-allocated temporary space is used for the transformation,
-// so value and source may refer to the same string.
-typedef size_t (*Transform)(char* buffer,
-                            size_t buflen,
-                            const char* source,
-                            size_t srclen);
-size_t transform(std::string& value,
-                 size_t maxlen,
-                 const std::string& source,
-                 Transform t);
-
-// Return the result of applying transform t to source.
-std::string s_transform(const std::string& source, Transform t);
-
-// Convenience wrappers.
-inline std::string s_url_decode(const std::string& source) {
-  return s_transform(source, url_decode);
-}
-
 // Joins the source vector of strings into a single string, with each
 // field in source being separated by delimiter. No trailing delimiter is added.
 std::string join(const std::vector<std::string>& source, char delimiter);
diff --git a/test/fuzzers/BUILD.gn b/test/fuzzers/BUILD.gn
index 13cfc4b..349bc15 100644
--- a/test/fuzzers/BUILD.gn
+++ b/test/fuzzers/BUILD.gn
@@ -559,15 +559,6 @@
   ]
 }
 
-webrtc_fuzzer_test("url_decode_fuzzer") {
-  sources = [
-    "url_decode_fuzzer.cc",
-  ]
-  deps = [
-    "../../rtc_base:rtc_base_approved",
-  ]
-}
-
 webrtc_fuzzer_test("field_trial_fuzzer") {
   sources = [
     "field_trial_fuzzer.cc",
diff --git a/test/fuzzers/url_decode_fuzzer.cc b/test/fuzzers/url_decode_fuzzer.cc
deleted file mode 100644
index bf2a0f3..0000000
--- a/test/fuzzers/url_decode_fuzzer.cc
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- *  Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
- *
- *  Use of this source code is governed by a BSD-style license
- *  that can be found in the LICENSE file in the root of the source
- *  tree. An additional intellectual property rights grant can be found
- *  in the file PATENTS.  All contributing project authors may
- *  be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <stddef.h>
-#include <stdint.h>
-#include <string>
-
-#include "rtc_base/string_encode.h"
-
-namespace webrtc {
-
-// Fuzz s_url_decode which is used in ice server parsing.
-void FuzzOneInput(const uint8_t* data, size_t size) {
-  std::string url(reinterpret_cast<const char*>(data), size);
-  rtc::s_url_decode(url);
-}
-
-}  // namespace webrtc