```
refactor(database): 调整数据库初始化函数参数传递方式 将 Init 函数参数从全局变量改为通过 NewDatabase 函数参数传入, 使初始化逻辑更清晰、可控。同时优化代码格式,去除多余空行, 提升代码可读性。 ```
This commit is contained in:
@@ -118,12 +118,12 @@ func PKCS7UnPadding(origData []byte, blocksize int) []byte {
|
||||
if blocksize <= 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
// 检查原始数据是否为空
|
||||
if origData == nil || len(origData) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
// 检查数据长度是否为块大小的整数倍
|
||||
if len(origData)%blocksize != 0 {
|
||||
return nil
|
||||
@@ -137,7 +137,7 @@ func PKCS7UnPadding(origData []byte, blocksize int) []byte {
|
||||
if length-unpadding <= 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
// 返回去除填充后的数据
|
||||
return origData[:(length - unpadding)]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user