-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
415a9d3
commit 0d2bc12
Showing
5 changed files
with
137 additions
and
7 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#pragma once | ||
|
||
#ifndef SEAD_PRIM_SAFE_STRING_H_ | ||
#include <sead/prim/seadSafeString.h> | ||
#endif | ||
#include <string.h> | ||
|
||
namespace sead { | ||
|
||
template <typename T> | ||
inline s32 BufferedSafeStringBase<T>::copy(const SafeStringBase<T>& src, s32 copyLength) | ||
{ | ||
T* dst = getMutableStringTop_(); | ||
const T* csrc = src.cstr(); | ||
if (dst == csrc) | ||
return 0; | ||
|
||
if (copyLength < 0) | ||
copyLength = src.calcLength(); | ||
|
||
if (copyLength >= mBufferSize) { | ||
SEAD_ASSERT_MSG(false, "Buffer overflow. (Buffer Size: %d, Copy Size: %d)", mBufferSize, | ||
copyLength); | ||
copyLength = mBufferSize - 1; | ||
} | ||
|
||
memcpy(dst, csrc, copyLength * sizeof(T)); | ||
dst[copyLength] = SafeStringBase<T>::cNullChar; | ||
|
||
return copyLength; | ||
} | ||
|
||
template <typename T> | ||
inline s32 SafeStringBase<T>::calcLength() const | ||
{ | ||
SEAD_ASSERT(mStringTop); | ||
assureTerminationImpl_(); | ||
s32 length = 0; | ||
|
||
for (;;) { | ||
if (length > cMaximumLength || mStringTop[length] == cNullChar) | ||
break; | ||
|
||
length++; | ||
} | ||
|
||
if (length > cMaximumLength) { | ||
SEAD_ASSERT_MSG(false, "too long string"); | ||
return 0; | ||
} | ||
|
||
return length; | ||
} | ||
|
||
} // namespace sead |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
_ZN2al9tryGetArgEPfRKNS_9ByamlIterEPKc = 0x00250dc4; | ||
|
||
_ZN2al10tryGetArg0EPiRKNS_13ActorInitInfoE = 0x002794f8; | ||
_ZN2al10tryGetArg0EPfRKNS_13ActorInitInfoE = 0x0027d238; | ||
_ZN2al10tryGetArg1EPfRKNS_13ActorInitInfoE = 0x0027089c; | ||
_ZN2al10tryGetArg2EPfRKNS_13ActorInitInfoE = 0x002794e4; |