copy replaced by substr
This commit is contained in:
parent
c9aac521a0
commit
c7b3d828be
3 changed files with 6 additions and 6 deletions
|
|
@ -56,7 +56,7 @@ proc parseStatus(r: TRedis): TRedisStatus =
|
||||||
if line[0] != '+':
|
if line[0] != '+':
|
||||||
raiseInvalidReply('+', line[0])
|
raiseInvalidReply('+', line[0])
|
||||||
|
|
||||||
return line.copy(1, line.len-3) # Strip '+' and \c\L.
|
return line.substr(1, line.len-3) # Strip '+' and \c\L.
|
||||||
|
|
||||||
proc parseInteger(r: TRedis): TRedisInteger =
|
proc parseInteger(r: TRedis): TRedisInteger =
|
||||||
var line = r.socket.recv()
|
var line = r.socket.recv()
|
||||||
|
|
@ -92,7 +92,7 @@ proc parseBulk(r: TRedis, allowMBNil = False): TRedisString =
|
||||||
if line[0] != '$':
|
if line[0] != '$':
|
||||||
raiseInvalidReply('$', line[0])
|
raiseInvalidReply('$', line[0])
|
||||||
|
|
||||||
var numBytes = parseInt(line.copy(1))
|
var numBytes = parseInt(line.substr(1))
|
||||||
if numBytes == -1:
|
if numBytes == -1:
|
||||||
return RedisNil
|
return RedisNil
|
||||||
|
|
||||||
|
|
@ -107,7 +107,7 @@ proc parseMultiBulk(r: TRedis): TRedisList =
|
||||||
if line[0] != '*':
|
if line[0] != '*':
|
||||||
raiseInvalidReply('*', line[0])
|
raiseInvalidReply('*', line[0])
|
||||||
|
|
||||||
var numElems = parseInt(line.copy(1))
|
var numElems = parseInt(line.substr(1))
|
||||||
if numElems == -1: return nil
|
if numElems == -1: return nil
|
||||||
result = @[]
|
result = @[]
|
||||||
for i in 1..numElems:
|
for i in 1..numElems:
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# Nimrod's Runtime Library
|
# Nimrod's Runtime Library
|
||||||
# (c) Copyright 2010 Andreas Rumpf
|
# (c) Copyright 2011 Andreas Rumpf
|
||||||
#
|
#
|
||||||
# See the file "copying.txt", included in this
|
# See the file "copying.txt", included in this
|
||||||
# distribution, for details about the copyright.
|
# distribution, for details about the copyright.
|
||||||
|
|
@ -39,7 +39,7 @@ proc scgiError*(msg: string) {.noreturn.} =
|
||||||
proc parseWord(inp: string, outp: var string, start: int): int =
|
proc parseWord(inp: string, outp: var string, start: int): int =
|
||||||
result = start
|
result = start
|
||||||
while inp[result] != '\0': inc(result)
|
while inp[result] != '\0': inc(result)
|
||||||
outp = copy(inp, start, result-1)
|
outp = substr(inp, start, result-1)
|
||||||
|
|
||||||
proc parseHeaders(s: string, L: int): PStringTable =
|
proc parseHeaders(s: string, L: int): PStringTable =
|
||||||
result = newStringTable()
|
result = newStringTable()
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# Nimrod's Runtime Library
|
# Nimrod's Runtime Library
|
||||||
# (c) Copyright 2010 Andreas Rumpf
|
# (c) Copyright 2011 Andreas Rumpf
|
||||||
#
|
#
|
||||||
# See the file "copying.txt", included in this
|
# See the file "copying.txt", included in this
|
||||||
# distribution, for details about the copyright.
|
# distribution, for details about the copyright.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue