Repository navigation
fix: Optimize kernel log segment index initialization logic - #413
Merged
Merged
Conversation
max-lvs
approved these changes
Oct 10, 2025
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: LiHua000, max-lvs The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Author
|
/merge |
Contributor
|
This pr cannot be merged! (status: unstable) |
Return index 0 directly on first entry for kernel log type to avoid unnecessary file reading Read file to get total line count only after authentication, improving performance and response speed Maintain existing logic while adding special handling for first entry Log: fix bug Bug: https://pms.uniontech.com/bug-view-292033.html
LiHua000
force-pushed
the
release/eagle
branch
from
October 10, 2025 08:26
4e23b8f to
a552b35
Compare
deepin pr auto review这段代码审查如下:
改进建议: if (type == KERN) {
// 首次进入且请求下一个分段时,直接返回0而不读取文件
if (m_type2Filter[type].segementIndex == -1 && bNext) {
m_type2Filter[type].segementIndex = 0;
return 0;
}
// 确保文件路径有效
QStringList filePaths = DLDBusHandler::instance(this)->getFileInfo("kern");
if (filePaths.isEmpty()) {
return -1;
}
qint64 totalLineCount = 0;
for (const auto& file : filePaths) {
if (file.isEmpty()) {
continue;
}
totalLineCount += DLDBusHandler::instance(this)->getLineCount(file);
// 可以考虑添加行数检查,防止totalLineCount溢出
if (totalLineCount < 0) {
return -1;
}
}
// ... 后续代码
}其他建议:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Return index 0 directly on first entry for kernel log type to avoid unnecessary file reading Read file to get total line count only after authentication, improving performance and response speed Maintain existing logic while adding special handling for first entry
Log: fix bug
Bug: https://pms.uniontech.com/bug-view-292033.html