diff options
| author | ModMaker101 <119018978+ModMaker101@users.noreply.github.com> | 2026-03-08 19:08:36 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-08 18:08:36 -0500 |
| commit | 28614b922fb77149a54da1a87bebfbc98736f296 (patch) | |
| tree | 7f828ba86a4ee18d0a80d29de64f6199a5412512 /Minecraft.Client/PSVita/PSVitaExtras/user_new.cpp | |
| parent | 88798b501d0cf6287b6f87acb2592676e3cec58d (diff) | |
Modernize project codebase (#906)
* Fixed boats falling and a TP glitch #266
* Replaced every C-style cast with C++ ones
* Replaced every C-style cast with C++ ones
* Fixed boats falling and a TP glitch #266
* Updated NULL to nullptr and fixing some type issues
* Modernized and fixed a few bugs
- Replaced most instances of `NULL` with `nullptr`.
- Replaced most `shared_ptr(new ...)` with `make_shared`.
- Removed the `nullptr` macro as it was interfering with the actual nullptr keyword in some instances.
* Fixing more conflicts
* Replace int loops with size_t and start work on overrides
* Add safety checks and fix a issue with vector going OOR
Diffstat (limited to 'Minecraft.Client/PSVita/PSVitaExtras/user_new.cpp')
| -rw-r--r-- | Minecraft.Client/PSVita/PSVitaExtras/user_new.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/Minecraft.Client/PSVita/PSVitaExtras/user_new.cpp b/Minecraft.Client/PSVita/PSVitaExtras/user_new.cpp index 1f71f6d2..b9cc4850 100644 --- a/Minecraft.Client/PSVita/PSVitaExtras/user_new.cpp +++ b/Minecraft.Client/PSVita/PSVitaExtras/user_new.cpp @@ -28,13 +28,13 @@ void *user_new(std::size_t size) throw(std::bad_alloc) if (size == 0) size = 1; - while ((ptr = (void *)std::malloc(size)) == NULL) { + while ((ptr = (void *)std::malloc(size)) == nullptr) { /**E Obtain new_handler */ /**J new_handler を取得する */ std::new_handler handler = std::_get_new_handler(); - /**E When new_handler is a NULL pointer, bad_alloc is send. If not, new_handler is called. */ - /**J new_handler が NULL ポインタの場合、bad_alloc を送出する、そうでない場合、new_handler を呼び出す */ + /**E When new_handler is a nullptr pointer, bad_alloc is send. If not, new_handler is called. */ + /**J new_handler が nullptr ポインタの場合、bad_alloc を送出する、そうでない場合、new_handler を呼び出す */ if (!handler) throw std::bad_alloc(); else @@ -56,22 +56,22 @@ void *user_new(std::size_t size, const std::nothrow_t& x) throw() if (size == 0) size = 1; - while ((ptr = (void *)std::malloc(size)) == NULL) { + while ((ptr = (void *)std::malloc(size)) == nullptr) { /**E Obtain new_handler */ /**J new_handler を取得する */ std::new_handler handler = std::_get_new_handler(); - /**E When new_handler is a NULL pointer, NULL is returned. */ - /**J new_handler が NULL ポインタの場合、NULL を返す */ + /**E When new_handler is a nullptr pointer, nullptr is returned. */ + /**J new_handler が nullptr ポインタの場合、nullptr を返す */ if (!handler) - return NULL; + return nullptr; - /**E Call new_handler. If new_handler sends bad_alloc, NULL is returned. */ - /**J new_handler を呼び出す、new_handler が bad_alloc を送出した場合、NULL を返す */ + /**E Call new_handler. If new_handler sends bad_alloc, nullptr is returned. */ + /**J new_handler を呼び出す、new_handler が bad_alloc を送出した場合、nullptr を返す */ try { (*handler)(); } catch (std::bad_alloc) { - return NULL; + return nullptr; } } return ptr; @@ -98,9 +98,9 @@ void *user_new_array(std::size_t size, const std::nothrow_t& x) throw() void user_delete(void *ptr) throw() { // SCE_DBG_LOG_TRACE("Called operator delete(%p)", ptr); - /**E In the case of the NULL pointer, no action will be taken. */ - /**J NULL ポインタの場合、何も行わない */ - if (ptr != NULL) + /**E In the case of the nullptr pointer, no action will be taken. */ + /**J nullptr ポインタの場合、何も行わない */ + if (ptr != nullptr) std::free(ptr); } |
