Skip to content

Commit

Permalink
修复读取内容乱码的Bug
Browse files Browse the repository at this point in the history
  • Loading branch information
limao996 committed Sep 5, 2023
1 parent 24fb1dc commit 480c605
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
[![Telegram Group](https://img.shields.io/badge/Telegram_Group-limao__lua-0099FF?logo=telegram)](https://t.me/limao_lua)

## 更新内容
- **`2.0.3`**(2023-09-05)
+ 修复读取内容乱码的Bug
- **`2.0.2`**(2023-09-04)
+ 修复 `writeBytes` 方法的异常
- **`2.0.1`**(2023-08-31)
Expand Down
10 changes: 5 additions & 5 deletions afs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -354,8 +354,8 @@ function _N:read(n)
else
local new = self.pos + n
local size = self:length()
if new > size then
n = size - self.pos
if new > size + 1 then
n = size - self.pos + 1
end
end
if n <= 0 then return "" end
Expand All @@ -375,8 +375,8 @@ function _N:readString(n)
else
local new = self.pos + n
local size = self:length()
if new > size then
n = size - self.pos
if new > size + 1 then
n = size - self.pos + 1
end
end
if n <= 0 then return "" end
Expand All @@ -392,7 +392,7 @@ end
---@return number 读取长度
function _N:readBytes(b)
self:IO(1)
self.fic.position(self.pos)
self.fic.position(self.pos - 1)
local buff = ByteBuffer.wrap(b)
local n = self.fic.read(buff)
self.pos = self.pos + n
Expand Down

0 comments on commit 480c605

Please sign in to comment.