10000 refuse to compress directories by Cyan4973 · Pull Request #1212 · lz4/lz4 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

refuse to compress directories #1212

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

Merged
merged 2 commits into from
Mar 6, 2023
Merged

refuse to compress directories #1212

merged 2 commits into from
Mar 6, 2023

Conversation

Cyan4973
Copy link
Member

fix #1211, reported by @imba-tjd

@imba-tjd
Copy link
imba-tjd commented Feb 27, 2023

Why not use existing UTIL_isDirectory 🤔

programs/util.h Outdated
* A modified version of realloc().
* If UTIL_realloc() fails the original block is freed.
*/
/* supports a==NULL or b==NULL */
UTIL_STATIC int UTIL_sameString(const char* a, const char* b)
{
assert(a!=NULL && b!=NULL); /* unsupported scenario */
Copy link
Contributor

Choose a reason for hiding this comment

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

Currently, if a == NULL or b == NULL, this line rises assert.
But above comment and the following if() clause seems to support these cases.

If so, this assert should refuse only a == NULL and b == NULL case.
Therefore, expected condition may be assert(! (a == NULL && b == NULL));.
In short, assert(a != NULL || b != NULL);.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point @t-mat !
Thanks, let's fix that as you suggest.

On a related tangent, since this assert() was never triggered so far, it's questionable if this is a use case worth supporting, since it seems unused.

But anyway, this function was not the point of this PR,
I just wanted to fix the code comment which was nonsense.

@Cyan4973
Copy link
Member Author

Why not use existing UTIL_isDirectory 🤔

Good point @imba-tjd , I totally missed its existence ...

@Cyan4973 Cyan4973 merged commit 61d2265 into dev Mar 6, 2023
@Cyan4973 Cyan4973 deleted the cdir branch January 2, 2024 18:33
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.

Regression when input file is a directory
3 participants
0