More new used instead of malloc(). Code reorganization.#76
Merged
agruzdev merged 7 commits intoagruzdev:masterfrom May 3, 2026
Merged
More new used instead of malloc(). Code reorganization.#76agruzdev merged 7 commits intoagruzdev:masterfrom
new used instead of malloc(). Code reorganization.#76agruzdev merged 7 commits intoagruzdev:masterfrom
Conversation
new used instead of malloc(). Code reorganization,new used instead of malloc(). Code reorganization.
agruzdev
reviewed
May 1, 2026
| template <> struct ToUnsignedTypeImpl<int8_t> { using type = uint8_t; }; | ||
|
|
||
| template <typename Ty_> | ||
| using ToUnsignedType = typename ToUnsignedTypeImpl<Ty_>::type; |
Owner
There was a problem hiding this comment.
А зачем вы упаковали эти шаблоны по cpp файлам? Многие из них достаточно универсальные, могут понадобится в других файлах... Чтобы быстрее компилировалось, пока не понадобилось?
Contributor
Author
There was a problem hiding this comment.
Именно! Пока нет доказательств, что они нужны где-то ещё, пускай живут в CPP, решил я.
agruzdev
reviewed
May 1, 2026
| return nullptr; | ||
| } | ||
| auto *fio = (J2KFIO_t*)malloc(sizeof(J2KFIO_t)); | ||
| auto fio{ std::make_unique<J2KFIO_t>() }; |
agruzdev
reviewed
May 1, 2026
| Open(FreeImageIO *io, fi_handle handle, FIBOOL read) { | ||
| // Allocate memory for the header structure | ||
| auto *lpIH = (ICONHEADER*)malloc(sizeof(ICONHEADER)); | ||
| std::unique_ptr<ICONHEADER, decltype(&free)> lpIH(static_cast<ICONHEADER*>(malloc(sizeof(ICONHEADER))), &free); |
Contributor
Author
There was a problem hiding this comment.
Потому что этот указатель возвращается из функции и надо тогда искать править в месте удаления.
agruzdev
reviewed
May 1, 2026
| unsigned cbStrideFrom = ((pPIFrom.cbitUnit + 7) >> 3) * width; | ||
| unsigned cbStrideTo = ((pPITo.cbitUnit + 7) >> 3) * width; | ||
| cbStride = MAX(cbStrideFrom, cbStrideTo); | ||
| cbStride = (std::max)(cbStrideFrom, cbStrideTo); |
Contributor
Author
There was a problem hiding this comment.
В недрах JXR-заголовков есть #define max(... без скобок он тут применяется и std:: оказывается синтаксической ошибкой.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.