mirror of
https://github.com/nim-lang/Nim.git
synced 2026-07-18 15:01:24 +00:00
move decode_helpers to std/private (#16209)
This commit is contained in:
@@ -32,7 +32,7 @@
|
||||
import strutils, os, strtabs, cookies, uri
|
||||
export uri.encodeUrl, uri.decodeUrl
|
||||
|
||||
include includes/decode_helpers
|
||||
import std/private/decode_helpers
|
||||
|
||||
proc addXmlChar(dest: var string, c: char) {.inline.} =
|
||||
case c
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
import std/private/since
|
||||
|
||||
import strutils, parseutils, base64
|
||||
include includes/decode_helpers
|
||||
import std/private/decode_helpers
|
||||
|
||||
|
||||
type
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
# Include file that implements 'decodePercent' and friends. Do not import it!
|
||||
|
||||
proc handleHexChar(c: char, x: var int, f: var bool) {.inline.} =
|
||||
proc handleHexChar*(c: char, x: var int, f: var bool) {.inline.} =
|
||||
case c
|
||||
of '0'..'9': x = (x shl 4) or (ord(c) - ord('0'))
|
||||
of 'a'..'f': x = (x shl 4) or (ord(c) - ord('a') + 10)
|
||||
of 'A'..'F': x = (x shl 4) or (ord(c) - ord('A') + 10)
|
||||
else: f = true
|
||||
|
||||
proc decodePercent(s: string, i: var int): char =
|
||||
## Converts `%xx` hexadecimal to the charracter with ordinal number `xx`.
|
||||
proc decodePercent*(s: openArray[char], i: var int): char =
|
||||
## Converts `%xx` hexadecimal to the character with ordinal number `xx`.
|
||||
##
|
||||
## If `xx` is not a valid hexadecimal value, it is left intact: only the
|
||||
## leading `%` is returned as-is, and `xx` characters will be processed in the
|
||||
Reference in New Issue
Block a user