mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-16 07:50:28 +02:00
Use KERNELOBJECT_MAX_NAME_LENGTH for name length.
Just avoiding magic numbers, didn't know there was a constant.
This commit is contained in:
1 parent
0d07013199
commit
87fcdc9080
4 files changed
+15
-15
No files matched your search
@@ -30,7 +30,7 @@ void __KernelEventFlagTimeout(u64 userdata, int cycleslate);
|
||||
struct NativeEventFlag
|
||||
{
|
||||
u32 size;
|
||||
char name[32];
|
||||
char name[KERNELOBJECT_MAX_NAME_LENGTH + 1];
|
||||
u32 attr;
|
||||
u32 initPattern;
|
||||
u32 currentPattern;
|
||||
@@ -188,8 +188,8 @@ int sceKernelCreateEventFlag(const char *name, u32 flag_attr, u32 flag_initPatte
|
||||
SceUID id = kernelObjects.Create(e);
|
||||
|
||||
e->nef.size = sizeof(NativeEventFlag);
|
||||
strncpy(e->nef.name, name, 31);
|
||||
e->nef.name[31] = 0;
|
||||
strncpy(e->nef.name, name, KERNELOBJECT_MAX_NAME_LENGTH);
|
||||
e->nef.name[KERNELOBJECT_MAX_NAME_LENGTH] = 0;
|
||||
e->nef.attr = flag_attr;
|
||||
e->nef.initPattern = flag_initPattern;
|
||||
e->nef.currentPattern = e->nef.initPattern;
|
||||
|
||||
@@ -34,7 +34,7 @@ int mbxWaitTimer = 0;
|
||||
struct NativeMbx
|
||||
{
|
||||
SceSize size;
|
||||
char name[32];
|
||||
char name[KERNELOBJECT_MAX_NAME_LENGTH + 1];
|
||||
SceUInt attr;
|
||||
int numWaitThreads;
|
||||
int numMessages;
|
||||
@@ -184,8 +184,8 @@ SceUID sceKernelCreateMbx(const char *name, u32 attr, u32 optAddr)
|
||||
SceUID id = kernelObjects.Create(m);
|
||||
|
||||
m->nmb.size = sizeof(NativeMbx);
|
||||
strncpy(m->nmb.name, name, 31);
|
||||
m->nmb.name[31] = 0;
|
||||
strncpy(m->nmb.name, name, KERNELOBJECT_MAX_NAME_LENGTH);
|
||||
m->nmb.name[KERNELOBJECT_MAX_NAME_LENGTH] = 0;
|
||||
m->nmb.attr = attr;
|
||||
m->nmb.numWaitThreads = 0;
|
||||
m->nmb.numMessages = 0;
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
struct NativeMutex
|
||||
{
|
||||
SceSize size;
|
||||
char name[32];
|
||||
char name[KERNELOBJECT_MAX_NAME_LENGTH + 1];
|
||||
SceUInt attr;
|
||||
|
||||
int lockLevel;
|
||||
@@ -70,7 +70,7 @@ struct Mutex : public KernelObject
|
||||
struct NativeLwMutex
|
||||
{
|
||||
SceSize size;
|
||||
char name[32];
|
||||
char name[KERNELOBJECT_MAX_NAME_LENGTH + 1];
|
||||
SceUInt attr;
|
||||
SceUInt workareaPtr;
|
||||
};
|
||||
@@ -207,8 +207,8 @@ int sceKernelCreateMutex(const char *name, u32 attr, int initialCount, u32 optio
|
||||
SceUID id = kernelObjects.Create(mutex);
|
||||
|
||||
mutex->nm.size = sizeof(mutex);
|
||||
strncpy(mutex->nm.name, name, 31);
|
||||
mutex->nm.name[31] = 0;
|
||||
strncpy(mutex->nm.name, name, KERNELOBJECT_MAX_NAME_LENGTH);
|
||||
mutex->nm.name[KERNELOBJECT_MAX_NAME_LENGTH] = 0;
|
||||
mutex->nm.attr = attr;
|
||||
if (initialCount == 0)
|
||||
{
|
||||
@@ -522,8 +522,8 @@ int sceKernelCreateLwMutex(u32 workareaPtr, const char *name, u32 attr, int init
|
||||
LwMutex *mutex = new LwMutex();
|
||||
SceUID id = kernelObjects.Create(mutex);
|
||||
mutex->nm.size = sizeof(mutex);
|
||||
strncpy(mutex->nm.name, name, 31);
|
||||
mutex->nm.name[31] = 0;
|
||||
strncpy(mutex->nm.name, name, KERNELOBJECT_MAX_NAME_LENGTH);
|
||||
mutex->nm.name[KERNELOBJECT_MAX_NAME_LENGTH] = 0;
|
||||
mutex->nm.attr = attr;
|
||||
mutex->nm.workareaPtr = workareaPtr;
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ struct NativeSemaphore
|
||||
/** Size of the ::SceKernelSemaInfo structure. */
|
||||
SceSize size;
|
||||
/** NUL-terminated name of the semaphore. */
|
||||
char name[32];
|
||||
char name[KERNELOBJECT_MAX_NAME_LENGTH + 1];
|
||||
/** Attributes. */
|
||||
SceUInt attr;
|
||||
/** The initial count the semaphore was created with. */
|
||||
@@ -191,8 +191,8 @@ int sceKernelCreateSema(const char* name, u32 attr, int initVal, int maxVal, u32
|
||||
SceUID id = kernelObjects.Create(s);
|
||||
|
||||
s->ns.size = sizeof(NativeSemaphore);
|
||||
strncpy(s->ns.name, name, 31);
|
||||
s->ns.name[31] = 0;
|
||||
strncpy(s->ns.name, name, KERNELOBJECT_MAX_NAME_LENGTH);
|
||||
s->ns.name[KERNELOBJECT_MAX_NAME_LENGTH] = 0;
|
||||
s->ns.attr = attr;
|
||||
s->ns.initCount = initVal;
|
||||
s->ns.currentCount = s->ns.initCount;
|
||||
|
||||
Reference in new issue
Block a user