Skip to content

wip: bulk add 'll' to printf log tags#64

Draft
jwoglom wants to merge 3 commits into
loopandlearn:mainfrom
jwoglom:claude/eloquent-lovelace-yYdF8
Draft

wip: bulk add 'll' to printf log tags#64
jwoglom wants to merge 3 commits into
loopandlearn:mainfrom
jwoglom:claude/eloquent-lovelace-yYdF8

Conversation

@jwoglom
Copy link
Copy Markdown
Collaborator

@jwoglom jwoglom commented May 28, 2026

Bulk migrate log and other printf formatted strings in OmnipodKit.

  • signed int arg -> %lld (preserves width/positional: %02d -> %02lld, %1$03d -> %1$03lld)
  • unsigned int arg -> %llu
  • hex -> %llx / %llX (preserves width: %08X -> %08llX)
  • %g for Double -> %@ with the existing .twoDecimals extension

claude added 2 commits May 28, 2026 05:03
Xcode 26.5 flags 'Format specifies int but argument has Int (Int64)'
on String(format:) and OSLog log.* calls that pass Swift integer
values to %d/%i/%u/%x/%X/%o. Swift's Int/UInt are 64-bit on Apple
64-bit platforms and Swift's CVarArg conformance widens smaller
integers to a 64-bit word when bridged through varargs, so the
canonical fix is to add the 'll' length modifier.

Pattern applied:
- signed int arg -> %lld (preserves width/positional: %02d -> %02lld,
  %1$03d -> %1$03lld)
- unsigned int arg -> %llu
- hex -> %llx / %llX (preserves width: %08X -> %08llX)
- %g for Double -> %@ with the existing .twoDecimals extension

%02hhx in Common/Data.swift (byte-encoding loop) is left as-is - the
'hh' modifier is correct there.

Also fixes two pre-existing typos discovered during the sweep:
- ErosPodComms.swift line 104 was missing the '%' on the first format
  string ('08X' -> '%08llX').
- DeactivatePodViewModel.swift line 148 had a duplicate %2$ positional
  index; the third arg now correctly uses %3$@.

Required before bumping Xcode for the browser build.
The previous patch swept String(format:) and bare-percent OSLog format
specifiers but missed sites using the OSLog visibility modifier syntax
(%{public}d / %{public}x / %{public}02x), which Clang's os_log format
checking still validates against the underlying d/x/X/u length.

Same canonical fix as the prior commit: add the 'll' length modifier
where the argument is a Swift Int/UInt/UInt32 widened to 64 bits via
CVarArg. .count, msgSeq/nonceSeq/messageNumber, maxWriteValueLength,
toUInt32() addresses, queue depths, attempts, services counts, etc.

Files touched:
- BleMessageTransport.swift (transport phase logging)
- BlePodComms.swift (O5 AID command logging, MTU polling)
- BluetoothManager.swift (advertisement scan)
- O5KeyExchange.swift (key derivation/nonce diagnostics)
- O5LTKExchanger.swift (full SPS0/SPS1/SPS2.1/SPS2 pairing log)
- PeripheralManager(+OmnipodKit).swift (BLE raw write/read,
  packet split/join, waitForCommand)
- Session/SessionEstablisher.swift (EAP-AKA secondary path)
- Common/OSLog.swift (the fallback fault path itself)

Note: BluetoothManager.swift line 411 has a pre-existing typo
('%{public}' with no format letter) that is unrelated to the 64-bit
issue and left untouched.
@marionbarker
Copy link
Copy Markdown
Contributor

Test

Configuration

I built this branch onto a Trio instance.

I trigger a pod fault using the front-end for the rPi DASH that was currently running. The display is now properly formatted.

omnipodkit-pr-64-integer-format

Copy link
Copy Markdown
Contributor

@marionbarker marionbarker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR needs to have the Localization/Localizable.xcstrings updated.

There are 2 parts to this. Once you build with Xcode, the English version are all updated automatically.

However, all the Translations have the old format. This should be adjusted as well.

@marionbarker marionbarker requested a review from bastiaanv May 29, 2026 14:28
@bastiaanv
Copy link
Copy Markdown
Collaborator

@jwoglom I cannot commit to your repo, so could you replace your xcstring with this one?

Localizable.xcstrings.zip

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@jwoglom
Copy link
Copy Markdown
Collaborator Author

jwoglom commented May 29, 2026

Thanks @bastiaanv , updated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants