Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix compiler warning (gcc -Wconversion) #8

Merged
merged 1 commit into from
Sep 19, 2023

Conversation

jeroendoggen
Copy link
Contributor

warning: conversion from 'size_t' {aka 'long unsigned int'} to 'int' may change value [-Wconversion]
146 | if (new_parts[i].numeric()) last_numeric_index = i;

Theoretically, it was possible to crash the application when a negative 'last_numeric_index' was set. (when 'new_parts.size() > INT32_MAX')

Also avoids accessing the vector with a signed value using the [] operator.

warning: conversion from 'size_t' {aka 'long unsigned int'} to 'int' may change value [-Wconversion]
  146 |  if (new_parts[i].numeric()) last_numeric_index = i;

Theoretically, it was possible to crash the application when a negative 'last_numeric_index' was set. (when 'new_parts.size() > INT32_MAX')

Also avoids accessing the vector with a signed value using the [] operator.
@codecov-commenter
Copy link

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (3e37bf1) 99.02% compared to head (1437303) 99.02%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main       #8   +/-   ##
=======================================
  Coverage   99.02%   99.02%           
=======================================
  Files           5        5           
  Lines         512      515    +3     
=======================================
+ Hits          507      510    +3     
  Misses          5        5           
Files Changed Coverage Δ
include/semver/semver.hpp 97.26% <100.00%> (+0.04%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@z4kn4fein
Copy link
Owner

Thank you for the contribution!

@z4kn4fein z4kn4fein merged commit 4222121 into z4kn4fein:main Sep 19, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants