Skip to content
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

app-layer: fix -Wshorten-64-to-32 warnings v18.1 #9875

Closed

Conversation

catenacyber
Copy link
Contributor

[Link to redmine ticket:
https://redmine.openinfosecfoundation.org/issues/6186

Describe changes:

  • fix -Wshorten-64-to-32 warnings for some files
LIBHTP_BRANCH=pr/399

OISF/libhtp#399

First commit of #9840

There must be some stuff to review more carefully

Ticket: OISF#6186

Warnings about downcast from 64 to 32 bits
Copy link
Member

@victorjulien victorjulien left a comment

Choose a reason for hiding this comment

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

util-time, streaming buffer, common diffs don't belong in a "app-layer" commit. Please split those out

Copy link

codecov bot commented Nov 23, 2023

Codecov Report

Merging #9875 (d88e537) into master (41c0526) will decrease coverage by 0.01%.
The diff coverage is 84.48%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #9875      +/-   ##
==========================================
- Coverage   82.45%   82.45%   -0.01%     
==========================================
  Files         973      973              
  Lines      273063   273106      +43     
==========================================
+ Hits       225155   225190      +35     
- Misses      47908    47916       +8     
Flag Coverage Δ
fuzzcorpus 64.37% <84.48%> (+0.01%) ⬆️
suricata-verify 61.07% <81.03%> (-0.01%) ⬇️
unittests 62.91% <39.65%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

@catenacyber
Copy link
Contributor Author

util-time, streaming buffer, common diffs don't belong in a "app-layer" commit. Please split those out

But these changes are needed to get rid of the warnings for app-layer :

  • suricata-common.h needed cf use of SCReturnUInt(BIT_U32(alproto)); in app-layer-detect-proto.c
  • util-streaming-buffer.c: needed cf redefinition of BIT_U32 to be a u32
  • util-time.h : needed cf
app-layer-htp.c:853:52: warning: implicit conversion loses integer precision: 'uint64_t' (aka 'unsigned long long') to '__darwin_suseconds_t' (aka 'int') [-Wshorten-64-to-32]
  853 |     struct timeval tv = { SCTIME_SECS(f->startts), SCTIME_USECS(f->startts) };
      |                         ~                          ^~~~~~~~~~~~~~~~~~~~~~~~
./util-time.h:56:35: note: expanded from macro 'SCTIME_USECS'
   56 | #define SCTIME_USECS(t)          ((uint64_t)(t).usecs)

Would you like a first commit with these generic changes, and another one with only app-layer files in the same PR ?

@catenacyber catenacyber marked this pull request as draft November 23, 2023 14:21
@catenacyber
Copy link
Contributor Author

Replaced by #9878

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

Successfully merging this pull request may close these issues.

2 participants