mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
py3: Ensure read_string_from_net always returns bytes
This commit is contained in:
parent
41b3705925
commit
fc5fb1ddf6
@ -578,7 +578,7 @@ class SMART_DEVICE_APP(DeviceConfig, DevicePlugin):
|
|||||||
# Things get trashed if we don't make a copy of the data.
|
# Things get trashed if we don't make a copy of the data.
|
||||||
v = self._read_binary_from_net(2)
|
v = self._read_binary_from_net(2)
|
||||||
if len(v) == 0:
|
if len(v) == 0:
|
||||||
return '' # documentation says the socket is broken permanently.
|
return b'' # documentation says the socket is broken permanently.
|
||||||
data += v
|
data += v
|
||||||
total_len = int(data[:dex])
|
total_len = int(data[:dex])
|
||||||
data = data[dex:]
|
data = data[dex:]
|
||||||
@ -586,7 +586,7 @@ class SMART_DEVICE_APP(DeviceConfig, DevicePlugin):
|
|||||||
while pos < total_len:
|
while pos < total_len:
|
||||||
v = self._read_binary_from_net(total_len - pos)
|
v = self._read_binary_from_net(total_len - pos)
|
||||||
if len(v) == 0:
|
if len(v) == 0:
|
||||||
return '' # documentation says the socket is broken permanently.
|
return b'' # documentation says the socket is broken permanently.
|
||||||
data += v
|
data += v
|
||||||
pos += len(v)
|
pos += len(v)
|
||||||
return data
|
return data
|
||||||
|
Loading…
x
Reference in New Issue
Block a user