You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is minor but if using a modern C++ approach I think a smart pointer is considered best practice. Raw pointers should be used only when performance/memory management are critical.
If only one pointer for ImageBuffer is needed, std::unique_ptr would work.
#include
int _max_row(unique_ptr imageBuffer, long count)
{
if (imageBuffer->imgwidth > 0) {
return std::min(imageBuffer->imgheight, (int) std::floor(count / imageBuffer->imgwidth));
} else {
return 0;
}
}
Regarding the buffer overflow problem--if the program uses std::vector, std::array or other dynamically sized containers similar to a python list maybe this issue can be avoided. Raw arrays is probably one of the major reasons the world moved away from C.
The text was updated successfully, but these errors were encountered:
From #22 (review)
From #22 (comment)
The text was updated successfully, but these errors were encountered: