LCOV - code coverage report
Current view: top level - src/common - url.cpp (source / functions) Hit Total Coverage
Test: fuzz_coverage.info Lines: 11 11 100.0 %
Date: 2023-10-05 15:40:34 Functions: 1 1 100.0 %
Branches: 6 10 60.0 %

           Branch data     Line data    Source code
       1                 :            : // Copyright (c) 2015-2022 The Bitcoin Core developers
       2                 :            : // Distributed under the MIT software license, see the accompanying
       3                 :            : // file COPYING or http://www.opensource.org/licenses/mit-license.php.
       4                 :            : 
       5                 :            : #include <common/url.h>
       6                 :            : 
       7                 :            : #include <event2/http.h>
       8                 :            : 
       9                 :            : #include <cstdlib>
      10                 :            : #include <string>
      11                 :            : 
      12                 :        336 : std::string urlDecode(const std::string &urlEncoded) {
      13                 :        336 :     std::string res;
      14         [ +  + ]:        336 :     if (!urlEncoded.empty()) {
      15         [ +  - ]:        326 :         char *decoded = evhttp_uridecode(urlEncoded.c_str(), false, nullptr);
      16         [ -  + ]:        326 :         if (decoded) {
      17         [ -  + ]:        326 :             res = std::string(decoded);
      18                 :        326 :             free(decoded);
      19                 :        326 :         }
      20                 :        326 :     }
      21                 :        336 :     return res;
      22         [ +  - ]:        336 : }

Generated by: LCOV version 1.14