Repository navigation
review #3: #4 の指摘9件への修正 #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,13 +7,17 @@ | |
| #include <SdCardFont.h> | ||
|
|
||
| #include <algorithm> | ||
| #include <atomic> | ||
| #include <cstring> | ||
|
|
||
| #include "SdCardFontCacheFormat.h" | ||
|
|
||
| namespace SdCardFontCache { | ||
| namespace { | ||
|
|
||
| // Set by invalidateUntilReboot() from the task running a firmware update, read by the render task. | ||
| std::atomic<bool> slotBeingUpdated{false}; | ||
|
|
||
| using sd_card_font_cache_format::Header; | ||
|
|
||
| constexpr size_t CHUNK_SIZE = 4096; | ||
|
|
@@ -132,6 +136,7 @@ bool sourceFits(const char* sourcePath, size_t* payloadBytes) { | |
|
|
||
| bool isValidFor(const char* sourcePath, size_t* payloadBytes) { | ||
| if (payloadBytes) *payloadBytes = 0; | ||
| if (slotBeingUpdated.load()) return false; | ||
|
|
||
| const HalOtaSlot slot = HalOtaSlot::inactive(); | ||
| Header header{}; | ||
|
|
@@ -145,7 +150,7 @@ bool isValidFor(const char* sourcePath, size_t* payloadBytes) { | |
|
|
||
| bool readAt(size_t offset, void* data, size_t length, size_t payloadBytes) { | ||
| static const HalOtaSlot slot = HalOtaSlot::inactive(); | ||
| if (payloadBytes > payloadCapacity(slot) || | ||
| if (slotBeingUpdated.load() || payloadBytes > payloadCapacity(slot) || | ||
| !sd_card_font_cache_format::containsPayloadRange(payloadBytes, offset, length)) { | ||
| return false; | ||
| } | ||
|
|
@@ -252,4 +257,6 @@ const char* resultName(Result result) { | |
| return "unknown"; | ||
| } | ||
|
|
||
| void invalidateUntilReboot() { slotBeingUpdated.store(true); } | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win 🔎 Supported by static analysis🏁 Script executed: #!/bin/bash
set -euo pipefail
# スロットの読み取り・消去の実装と更新経路を確認する。
rg -n -C 10 'HalOtaSlot::(read|erase)|class HalOtaSlot|struct HalOtaSlot' .
rg -n -C 6 'invalidateUntilReboot|esp_ota_begin|esp_partition_erase_range' lib srcRepository: osakanataro/crosspoint-reader-mod Length of output: 11212 🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '%s\n' '--- SdCardFontCache implementation ---'
sed -n '1,190p' lib/EpdFont/SdCardFontCache.cpp
printf '%s\n' '--- firmware update call sites ---'
sed -n '120,180p' src/network/OtaUpdater.cpp
sed -n '285,345p' src/network/FirmwareFlasher.cpp
printf '%s\n' '--- cache call sites ---'
rg -n -C 8 'SdCardFontCache::(readAt|isValidFor|preload)|\.readAt\(' lib src
printf '%s\n' '--- ESP-IDF/platform version references ---'
rg -n -C 3 'ESP_IDF|esp-idf|platformio|framework|IDF' platformio.ini platformio* sdkconfig* CMakeLists.txt lib src 2>/dev/null || trueRepository: osakanataro/crosspoint-reader-mod Length of output: 39513 🌐 Web query:
💡 Result: 🌐 Web query:
💡 Result: <|OPENAI|analysis 代期特码>読み取り判定と更新開始を同じ同期で保護してください。
ESP-IDF は個々の flash 操作を直列化しますが、読み取りと更新の複数操作を原子的には扱いません。 読み取りの flag 判定から 🤖 Prompt for AI Agents |
||
|
|
||
| } // namespace SdCardFontCache | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: osakanataro/crosspoint-reader-mod
Length of output: 14195
EXPECTED_VERSIONを56に合わせてください。SectionBin.versionはEXPECTED_VERSIONと比較されます。一方、Section.cppの確定済みsection.binはバージョン56を使用します。現在の48では、ファイル形式定義が実ファイルをUnsupported versionとして扱います。修正案
📝 Committable suggestion
🤖 Prompt for AI Agents