mirror of
https://github.com/daveallie/crosspoint-reader.git
synced 2026-02-05 15:17:37 +03:00
clang format
This commit is contained in:
parent
023cca1118
commit
5ef4a919ca
@ -433,8 +433,10 @@ bool CalibreWirelessActivity::readJsonMessage(std::string& message) {
|
|||||||
const char* lengthKey = "\"length\"";
|
const char* lengthKey = "\"length\"";
|
||||||
for (size_t i = bracketPos; i < recvBuffer.size() && i < bracketPos + 2000; i++) {
|
for (size_t i = bracketPos; i < recvBuffer.size() && i < bracketPos + 2000; i++) {
|
||||||
char c = recvBuffer[i];
|
char c = recvBuffer[i];
|
||||||
if (c == '{' || c == '[') depth++;
|
if (c == '{' || c == '[')
|
||||||
else if (c == '}' || c == ']') depth--;
|
depth++;
|
||||||
|
else if (c == '}' || c == ']')
|
||||||
|
depth--;
|
||||||
else if (depth == 2 && c == '"' && i + 8 <= recvBuffer.size()) {
|
else if (depth == 2 && c == '"' && i + 8 <= recvBuffer.size()) {
|
||||||
bool match = true;
|
bool match = true;
|
||||||
for (size_t j = 0; j < 8 && match; j++) {
|
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++) {
|
for (size_t i = 0; i < data.size(); i++) {
|
||||||
char c = data[i];
|
char c = data[i];
|
||||||
if (c == '{' || c == '[') depth++;
|
if (c == '{' || c == '[')
|
||||||
else if (c == '}' || c == ']') depth--;
|
depth++;
|
||||||
|
else if (c == '}' || c == ']')
|
||||||
|
depth--;
|
||||||
else if (depth == 1 && c == '"' && i + 8 <= data.size()) {
|
else if (depth == 1 && c == '"' && i + 8 <= data.size()) {
|
||||||
bool match = true;
|
bool match = true;
|
||||||
for (size_t j = 0; j < 8 && match; j++) {
|
for (size_t j = 0; j < 8 && match; j++) {
|
||||||
|
|||||||
@ -19,15 +19,7 @@
|
|||||||
* https://github.com/kovidgoyal/calibre/blob/master/src/calibre/devices/smart_device_app/driver.py
|
* https://github.com/kovidgoyal/calibre/blob/master/src/calibre/devices/smart_device_app/driver.py
|
||||||
*/
|
*/
|
||||||
class CalibreWirelessActivity final : public Activity {
|
class CalibreWirelessActivity final : public Activity {
|
||||||
enum class WirelessState {
|
enum class WirelessState { DISCOVERING, CONNECTING, WAITING, RECEIVING, COMPLETE, DISCONNECTED, ERROR };
|
||||||
DISCOVERING,
|
|
||||||
CONNECTING,
|
|
||||||
WAITING,
|
|
||||||
RECEIVING,
|
|
||||||
COMPLETE,
|
|
||||||
DISCONNECTED,
|
|
||||||
ERROR
|
|
||||||
};
|
|
||||||
|
|
||||||
enum OpCode : uint8_t {
|
enum OpCode : uint8_t {
|
||||||
OK = 0,
|
OK = 0,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user