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

fix mkshort unique #1168

Merged
merged 5 commits into from
Sep 1, 2023
Merged

fix mkshort unique #1168

merged 5 commits into from
Sep 1, 2023

Conversation

tsteven4
Copy link
Collaborator

  1. we were off by one when deciding if we could just concatenate
    the generated suffix to the name, failing to use the last available
    character.
  2. when attempting to copy the generated suffix to a presumably
    shortened name, and the generated suffix was longer than the name,
    the target of the copy was outside the name buffer. In the common
    case that the rank of size_t was greater than the rank of int, the
    target was well beyond the end of name, not before as one would expect
    with signed arithmetic.

With the new algorithm when the target length is insufficient to
fit both the name and the suffix we will only truncate the name as
required to fit the truncated name and the complete suffix in the
target length(as opposed to the original length of the name).
We fatal if this is not possible.

Add a test case to exercise the make unique code.
@robertlipe please verify that the generated references mkshort6.csv, mkshort5.csv, mkshort4.csv have generated names as desired.

1. we were off by one when deciding if we could just concatentate
the generated suffix to the name, failing to use the last available
character.
2. when attempting to copy the generated suffix to a presumably
shortened name, and the generated suffix was longer than the name,
the target of the copy was outside the name buffer.  In the common
case that the rank of size_t was greater than the rank of int, the
target was well beyond the end of name, not before as one would expect
with signed arithmetic.

With the new algorithm when the target length is insufficient to
fit both the name and the suffix we will only truncate the name as
required to fit the truncated name and the complete suffix in the
target length(as opposed to the original length of the name).
We fatal if this is not possible.

Add a test case to exercise the make unique code.
@GPSBabelDeveloper
Copy link
Collaborator

GPSBabelDeveloper commented Aug 31, 2023 via email

@tsteven4 tsteven4 merged commit d8b5e67 into GPSBabel:master Sep 1, 2023
19 of 20 checks passed
@tsteven4 tsteven4 deleted the mkshort1 branch September 1, 2023 17:00
robertlipe pushed a commit that referenced this pull request Aug 12, 2024
* fix mkshort unique.

1. we were off by one when deciding if we could just concatentate
the generated suffix to the name, failing to use the last available
character.
2. when attempting to copy the generated suffix to a presumably
shortened name, and the generated suffix was longer than the name,
the target of the copy was outside the name buffer.  In the common
case that the rank of size_t was greater than the rank of int, the
target was well beyond the end of name, not before as one would expect
with signed arithmetic.

With the new algorithm when the target length is insufficient to
fit both the name and the suffix we will only truncate the name as
required to fit the truncated name and the complete suffix in the
target length(as opposed to the original length of the name).
We fatal if this is not possible.

Add a test case to exercise the make unique code.

* fix reference mode.

* add notes for future enhancements

* fix testcase cut and paste booboo

* refactor mkshort input from char* to QByteArray.
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.

2 participants