Use KERNELOBJECT_MAX_NAME_LENGTH for name length.

Just avoiding magic numbers, didn't know there was a constant.
This commit is contained in:
Unknown W. Brackets committed 2012-12-16 21:36:52 -08:00
1 parent 0d07013199
commit 87fcdc9080
4 files changed
+15 -15

No files matched your search

+3 -3
View File
@@ -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;