-
Notifications
You must be signed in to change notification settings - Fork 25
Clang-format: fix clang-format errors #278
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
Conversation
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.
Pull Request Overview
This pull request fixes clang-format errors by standardizing spacing and formatting across multiple files. The changes improve code consistency without altering program functionality.
- Adjust spacing around multiplication operators and casts in xxhash.h, utils.cpp, and ipfix-elements.hpp.
- Standardize pointer dereference formatting in dnssd.cpp, dns.cpp, and parser.cpp.
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| src/plugins/storage/cache/src/xxhash.h | Fixed spacing around the multiplication operator. |
| src/plugins/process/dnssd/src/dnssd.cpp | Standardized pointer dereference formatting for clarity. |
| src/plugins/process/dns/src/dns.cpp | Standardized pointer dereference formatting for clarity. |
| src/plugins/input/parser/parser.cpp | Standardized pointer arithmetic dereference formatting. |
| src/core/utils.cpp | Adjusted pointer dereference formatting to match clang-format rules. |
| include/ipfixprobe/ipfix-elements.hpp | Modified macro spacing for consistent formatting. |
| } | ||
| if (len >= 4) { | ||
| hash ^= (xxh_u64) (XXH_get32bits(ptr)) * XXH_PRIME64_1; | ||
| hash ^= (xxh_u64) (XXH_get32bits(ptr)) *XXH_PRIME64_1; |
Copilot
AI
May 27, 2025
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.
Remove the missing space after the multiplication operator to align with the clang-format style guidelines.
| hash ^= (xxh_u64) (XXH_get32bits(ptr)) *XXH_PRIME64_1; | |
| hash ^= (xxh_u64) (XXH_get32bits(ptr)) * XXH_PRIME64_1; |
| break; | ||
| } | ||
| size_t len = (uint8_t) * (data++); | ||
| size_t len = (uint8_t) *(data++); |
Copilot
AI
May 27, 2025
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.
Standardize the pointer dereference formatting by removing extra spaces in accordance with clang-format.
| size_t len = (uint8_t) *(data++); | |
| size_t len = (uint8_t)*(data++); |
|
|
||
| data += len; | ||
| len = (uint8_t) * (data++); | ||
| len = (uint8_t) *(data++); |
Copilot
AI
May 27, 2025
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.
Apply consistent pointer dereference formatting to meet clang-format requirements.
| len = (uint8_t) *(data++); | |
| data++; | |
| len = (uint8_t)(*data); |
| DEBUG_MSG("\tData TXT:\n"); | ||
|
|
||
| size_t len = (uint8_t) * (data++); | ||
| size_t len = (uint8_t) *(data++); |
Copilot
AI
May 27, 2025
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.
Standardize pointer dereference formatting as per clang-format style.
| size_t len = (uint8_t) *(data++); | |
| size_t len = static_cast<uint8_t>(*data++); |
|
|
||
| data += len; | ||
| len = (uint8_t) * (data++); | ||
| len = (uint8_t) *(data++); |
Copilot
AI
May 27, 2025
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.
Apply consistent formatting for pointer dereference following clang-format guidelines.
| len = (uint8_t) *(data++); | |
| data++; | |
| len = (uint8_t)(*data); |
| pkt->tcp_seq = ntohl(tcp->seq); | ||
| pkt->tcp_ack = ntohl(tcp->ack_seq); | ||
| pkt->tcp_flags = (uint8_t) * (data_ptr + 13) & 0xFF; | ||
| pkt->tcp_flags = (uint8_t) *(data_ptr + 13) & 0xFF; |
Copilot
AI
May 27, 2025
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.
Ensure pointer arithmetic and dereference formatting adheres to clang-format rules.
| pkt->tcp_flags = (uint8_t) *(data_ptr + 13) & 0xFF; | |
| pkt->tcp_flags = (uint8_t)(*(data_ptr + 13)) & 0xFF; |
|
|
||
| for (unsigned x = 0; x < 8; x++) { | ||
| buffer |= (uint64_t) * ((const uint8_t*) (p) + x) << (shift - (x * 8)); | ||
| buffer |= (uint64_t) *((const uint8_t*) (p) + x) << (shift - (x * 8)); |
Copilot
AI
May 27, 2025
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.
Remove extra spaces around the pointer dereference to align with clang-format styling.
| buffer |= (uint64_t) *((const uint8_t*) (p) + x) << (shift - (x * 8)); | |
| buffer |= (uint64_t)*((const uint8_t*)(p) + x) << (shift - (x * 8)); |
| * Conversion from microseconds to NTP fraction (resolution 1/(2^32)s, ~233 picoseconds). | ||
| */ | ||
| #define NTP_USEC_TO_FRAC(usec) (uint32_t)(((uint64_t) usec << 32) / 1000000) | ||
| #define NTP_USEC_TO_FRAC(usec) (uint32_t) (((uint64_t) usec << 32) / 1000000) |
Copilot
AI
May 27, 2025
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.
Adjust spacing after the cast in the macro to maintain consistency with clang-format guidelines.
No description provided.