summary refs log tree commit diff stats
path: root/lib/pure/includes
diff options
context:
space:
mode:
authorflywind <43030857+xflywind@users.noreply.github.com>2020-12-03 02:30:55 +0800
committerGitHub <noreply@github.com>2020-12-02 10:30:55 -0800
commit139075e96565f4b7436e8d2368f85f11852aa668 (patch)
treec56f45dbd336bf23cc8539ffe7ef9c50aad4253b /lib/pure/includes
parentaf984a3db969d28961a9e765190c091c9aa30880 (diff)
downloadNim-139075e96565f4b7436e8d2368f85f11852aa668.tar.gz
move decode_helpers to std/private (#16209)
Diffstat (limited to 'lib/pure/includes')
-rw-r--r--lib/pure/includes/decode_helpers.nim24
1 files changed, 0 insertions, 24 deletions
diff --git a/lib/pure/includes/decode_helpers.nim b/lib/pure/includes/decode_helpers.nim
deleted file mode 100644
index 74fe37d07..000000000
--- a/lib/pure/includes/decode_helpers.nim
+++ /dev/null
@@ -1,24 +0,0 @@
-# Include file that implements 'decodePercent' and friends. Do not import it!
-
-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`.
-  ##
-  ## 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
-  ## next step (e.g. in `uri.decodeUrl`) as regular characters.
-  result = '%'
-  if i+2 < s.len:
-    var x = 0
-    var failed = false
-    handleHexChar(s[i+1], x, failed)
-    handleHexChar(s[i+2], x, failed)
-    if not failed:
-      result = chr(x)
-      inc(i, 2)