clang format

This commit is contained in:
Justin Mitchell 2026-01-15 10:36:44 -05:00
parent 023cca1118
commit 5ef4a919ca
2 changed files with 9 additions and 13 deletions

View File

@ -433,8 +433,10 @@ bool CalibreWirelessActivity::readJsonMessage(std::string& message) {
const char* lengthKey = "\"length\"";
for (size_t i = bracketPos; i < recvBuffer.size() && i < bracketPos + 2000; i++) {
char c = recvBuffer[i];
if (c == '{' || c == '[') depth++;
else if (c == '}' || c == ']') depth--;
if (c == '{' || c == '[')
depth++;
else if (c == '}' || c == ']')
depth--;
else if (depth == 2 && c == '"' && i + 8 <= recvBuffer.size()) {
bool match = true;
for (size_t j = 0; j < 8 && match; j++) {
@ -674,8 +676,10 @@ void CalibreWirelessActivity::handleSendBook(const std::string& data) {
for (size_t i = 0; i < data.size(); i++) {
char c = data[i];
if (c == '{' || c == '[') depth++;
else if (c == '}' || c == ']') depth--;
if (c == '{' || c == '[')
depth++;
else if (c == '}' || c == ']')
depth--;
else if (depth == 1 && c == '"' && i + 8 <= data.size()) {
bool match = true;
for (size_t j = 0; j < 8 && match; j++) {

View File

@ -19,15 +19,7 @@
* https://github.com/kovidgoyal/calibre/blob/master/src/calibre/devices/smart_device_app/driver.py
*/
class CalibreWirelessActivity final : public Activity {
enum class WirelessState {
DISCOVERING,
CONNECTING,
WAITING,
RECEIVING,
COMPLETE,
DISCONNECTED,
ERROR
};
enum class WirelessState { DISCOVERING, CONNECTING, WAITING, RECEIVING, COMPLETE, DISCONNECTED, ERROR };
enum OpCode : uint8_t {
OK = 0,