Skip to content

Conversation

@SiskaPavel
Copy link
Collaborator

No description provided.

@SiskaPavel SiskaPavel requested a review from Copilot May 27, 2025 11:32
Copy link

Copilot AI left a 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;
Copy link

Copilot AI May 27, 2025

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.

Suggested change
hash ^= (xxh_u64) (XXH_get32bits(ptr)) *XXH_PRIME64_1;
hash ^= (xxh_u64) (XXH_get32bits(ptr)) * XXH_PRIME64_1;

Copilot uses AI. Check for mistakes.
break;
}
size_t len = (uint8_t) * (data++);
size_t len = (uint8_t) *(data++);
Copy link

Copilot AI May 27, 2025

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.

Suggested change
size_t len = (uint8_t) *(data++);
size_t len = (uint8_t)*(data++);

Copilot uses AI. Check for mistakes.

data += len;
len = (uint8_t) * (data++);
len = (uint8_t) *(data++);
Copy link

Copilot AI May 27, 2025

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.

Suggested change
len = (uint8_t) *(data++);
data++;
len = (uint8_t)(*data);

Copilot uses AI. Check for mistakes.
DEBUG_MSG("\tData TXT:\n");

size_t len = (uint8_t) * (data++);
size_t len = (uint8_t) *(data++);
Copy link

Copilot AI May 27, 2025

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.

Suggested change
size_t len = (uint8_t) *(data++);
size_t len = static_cast<uint8_t>(*data++);

Copilot uses AI. Check for mistakes.

data += len;
len = (uint8_t) * (data++);
len = (uint8_t) *(data++);
Copy link

Copilot AI May 27, 2025

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.

Suggested change
len = (uint8_t) *(data++);
data++;
len = (uint8_t)(*data);

Copilot uses AI. Check for mistakes.
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;
Copy link

Copilot AI May 27, 2025

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.

Suggested change
pkt->tcp_flags = (uint8_t) *(data_ptr + 13) & 0xFF;
pkt->tcp_flags = (uint8_t)(*(data_ptr + 13)) & 0xFF;

Copilot uses AI. Check for mistakes.

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));
Copy link

Copilot AI May 27, 2025

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.

Suggested change
buffer |= (uint64_t) *((const uint8_t*) (p) + x) << (shift - (x * 8));
buffer |= (uint64_t)*((const uint8_t*)(p) + x) << (shift - (x * 8));

Copilot uses AI. Check for mistakes.
* 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)
Copy link

Copilot AI May 27, 2025

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.

Copilot uses AI. Check for mistakes.
@SiskaPavel SiskaPavel merged commit fb94150 into master May 27, 2025
7 checks passed
@SiskaPavel SiskaPavel deleted the clang-format-fix branch May 27, 2025 11:34
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.

3 participants