move decode_helpers to std/private (#16209)
This commit is contained in:
parent
af984a3db9
commit
139075e965
3 changed files with 5 additions and 7 deletions
|
|
@ -32,7 +32,7 @@
|
||||||
import strutils, os, strtabs, cookies, uri
|
import strutils, os, strtabs, cookies, uri
|
||||||
export uri.encodeUrl, uri.decodeUrl
|
export uri.encodeUrl, uri.decodeUrl
|
||||||
|
|
||||||
include includes/decode_helpers
|
import std/private/decode_helpers
|
||||||
|
|
||||||
proc addXmlChar(dest: var string, c: char) {.inline.} =
|
proc addXmlChar(dest: var string, c: char) {.inline.} =
|
||||||
case c
|
case c
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@
|
||||||
import std/private/since
|
import std/private/since
|
||||||
|
|
||||||
import strutils, parseutils, base64
|
import strutils, parseutils, base64
|
||||||
include includes/decode_helpers
|
import std/private/decode_helpers
|
||||||
|
|
||||||
|
|
||||||
type
|
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
|
case c
|
||||||
of '0'..'9': x = (x shl 4) or (ord(c) - ord('0'))
|
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)
|
||||||
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
|
else: f = true
|
||||||
|
|
||||||
proc decodePercent(s: string, i: var int): char =
|
proc decodePercent*(s: openArray[char], i: var int): char =
|
||||||
## Converts `%xx` hexadecimal to the charracter with ordinal number `xx`.
|
## Converts `%xx` hexadecimal to the character with ordinal number `xx`.
|
||||||
##
|
##
|
||||||
## If `xx` is not a valid hexadecimal value, it is left intact: only the
|
## 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
|
## leading `%` is returned as-is, and `xx` characters will be processed in the
|
||||||
Loading…
Add table
Add a link
Reference in a new issue