Skip to content

Conversation

@PeterN
Copy link
Member

@PeterN PeterN commented Dec 18, 2024

Various cleanups to C++-ify the code:

  • Samples is now a std::vector<Sample> instead of std::vector<Sample *>. Samples pointers are not stored anywhere else so there's no worry about its location changing if the vector is reallocated. This simplifies clean up as no pointers need to be deleted.
  • Sample data is now stored in a std::vector<uint8_t> instead of a raw pointer allocated with malloc(). This avoids needing to manually free() during clean up.
  • Removed typedef std::string string in favour of just using std::string everywhere, and use const std::string & when we're passing an existing string without making a copy.
  • Include cstdint, instead of defining uintX_t on Windows.

@PeterN PeterN merged commit eb51d32 into OpenTTD:master Dec 21, 2024
3 checks passed
@PeterN PeterN deleted the cpp-cleanup branch December 21, 2024 19:56
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