Use <string.h> & <3ds/exheader.h>, fix some bugs, etc.
also fix all warnings and use -Werror
This commit is contained in:
@@ -28,8 +28,8 @@ INCLUDES := include
|
||||
ARCH := -march=armv6k -mtune=mpcore -mfloat-abi=hard -mtp=soft
|
||||
DEFINES := -DARM11 -D_3DS
|
||||
|
||||
CFLAGS := -g -std=gnu11 -Wall -Wextra -O2 -mword-relocations \
|
||||
-fomit-frame-pointer -ffunction-sections -fdata-sections -fno-builtin \
|
||||
CFLAGS := -g -std=gnu11 -Wall -Wextra -Werror -O2 -mword-relocations \
|
||||
-fomit-frame-pointer -ffunction-sections -fdata-sections \
|
||||
$(ARCH) $(DEFINES)
|
||||
|
||||
CFLAGS += $(INCLUDE)
|
||||
|
||||
@@ -8,7 +8,7 @@ This is part of 3ds_sm, which is licensed under the MIT license (see LICENSE for
|
||||
#pragma once
|
||||
|
||||
#include <3ds.h>
|
||||
#include "memory.h"
|
||||
#include <string.h>
|
||||
|
||||
#define IS_PRE_7X (osGetFirmVersion() < SYSTEM_VERSION(2, 39, 4))
|
||||
#define IS_PRE_93 (osGetFirmVersion() < SYSTEM_VERSION(2, 48, 3))
|
||||
|
||||
@@ -6,7 +6,6 @@ This is part of 3ds_sm, which is licensed under the MIT license (see LICENSE for
|
||||
*/
|
||||
|
||||
#include "list.h"
|
||||
#include "memory.h"
|
||||
#include "common.h"
|
||||
|
||||
struct ListBase;
|
||||
|
||||
@@ -6,7 +6,6 @@ This is part of 3ds_sm, which is licensed under the MIT license (see LICENSE for
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
#include "memory.h"
|
||||
#include "services.h"
|
||||
#include "processes.h"
|
||||
#include "srv.h"
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
/*
|
||||
memory.c
|
||||
|
||||
(c) TuxSH, 2017
|
||||
This is part of 3ds_sm, which is licensed under the MIT license (see LICENSE for details).
|
||||
*/
|
||||
|
||||
#include "memory.h"
|
||||
|
||||
/*
|
||||
//Adpated from CakesFW
|
||||
void memcpy(void *dest, const void *src, u32 size)
|
||||
{
|
||||
u8 *destc = (u8 *)dest;
|
||||
const u8 *srcc = (const u8 *)src;
|
||||
|
||||
for(u32 i = 0; i < size; i++)
|
||||
destc[i] = srcc[i];
|
||||
}*/
|
||||
|
||||
s32 strnlen(const char *string, s32 maxlen)
|
||||
{
|
||||
s32 size;
|
||||
for(size = 0; size < maxlen && *string; string++, size++);
|
||||
|
||||
return size;
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
/*
|
||||
memory.h
|
||||
|
||||
(c) TuxSH, 2017
|
||||
This is part of 3ds_sm, which is licensed under the MIT license (see LICENSE for details).
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <3ds/types.h>
|
||||
|
||||
//void memcpy(void *dest, const void *src, u32 size);
|
||||
#define memcpy __builtin_memcpy
|
||||
#define memset __builtin_memset
|
||||
#define strncmp __builtin_strncmp
|
||||
#define strncpy __builtin_strncpy
|
||||
|
||||
s32 strnlen(const char *string, s32 maxlen);
|
||||
@@ -5,9 +5,9 @@ services.c
|
||||
This is part of 3ds_sm, which is licensed under the MIT license (see LICENSE for details).
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
#include "services.h"
|
||||
#include "processes.h"
|
||||
#include "memory.h"
|
||||
#include "list.h"
|
||||
|
||||
ServiceInfo servicesInfo[0xA0] = { 0 };
|
||||
@@ -17,7 +17,7 @@ static Result checkServiceName(const char *name, s32 nameSize)
|
||||
{
|
||||
if(nameSize <= 0 || nameSize > 8)
|
||||
return 0xD9006405;
|
||||
else if(strnlen(name, nameSize) < nameSize)
|
||||
else if(strnlen(name, nameSize) < (size_t)nameSize)
|
||||
return 0xD9006407;
|
||||
else
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user