Fix struct to remove need for c_shift().

This commit is contained in:
Kartik 2017-04-04 19:00:02 +05:30 committed by GitHub
parent 700360e0d3
commit 757c83d395

View File

@ -1,8 +1,6 @@
#include <3ds.h>
#include <stdlib.h>
#include <string.h>
#include <3ds/types.h>
#include <3ds/svc.h>
#include <3ds/synchronization.h>
#include <3ds/services/apt.h>
#include <3ds/services/cfgu.h>
@ -22,6 +20,11 @@ void errorInit(errorConf* err, errorType type, CFG_Language lang)
err->returnCode = ERROR_UNKNOWN;
}
void errorCode(errorConf* err, int error)
{
err->errorCode = error;
}
static void errorConvertToUTF16(u16* out, const char* in, size_t max)
{
if (!in || !*in)
@ -40,27 +43,9 @@ static void errorConvertToUTF16(u16* out, const char* in, size_t max)
out[units] = 0;
}
static char* c_shift(const char *text)
{
size_t len = strlen(text);
char *str = (char*)malloc(len + 2);
if (str)
{
str[0] = text[0];
strcpy(&str[1], text);
}
return str;
}
void errorCode(errorConf* err, int error)
{
err->errorCode = error;
}
void errorText(errorConf *err, const char* text)
{ char *tex = c_shift(text);
errorConvertToUTF16(err->Text, tex, 1900);
free(tex);
{
errorConvertToUTF16(err->Text, text, 1900);
}
void errorDisp(errorConf* err)