Skip to content

Commit

Permalink
The ctr.news library should now be bug-free !
Browse files Browse the repository at this point in the history
Untested, but checked 3 times with citra, and everything matches the doc.
Warning: there is no check of any kind, so don't put weird stuff as arguments.
  • Loading branch information
firew0lf committed Dec 24, 2015
1 parent bebfa8b commit fe89482
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions source/news.c
Expand Up @@ -10,6 +10,7 @@ The `news` module.
#include <lua.h>
#include <lauxlib.h>

#include <stdlib.h>
#include <string.h>

/***
Expand All @@ -23,7 +24,7 @@ static int news_init(lua_State *L) {
}

/***
Send a notification to the user. WIP, do not use !!!
Send a notification to the user. Should work now.
@function notification
@tparam string title title of the notification
@tparam[opt=nil] string message message of the notification, or nil for no message
Expand All @@ -40,8 +41,8 @@ static int news_notification(lua_State *L) {
if (lua_isboolean(L, 4))
jpeg = lua_toboolean(L, 4);

const u16* cTitle = 0;
const u16* cMessage = 0;
const u16* cTitle = malloc(strlen(title)*sizeof(u16));
const u16* cMessage = malloc(strlen(message)*sizeof(u16));
u32 titleLength, messageLength;

titleLength = (u32) utf8_to_utf16((uint16_t*)cTitle, (uint8_t*)title, strlen(title));
Expand Down

1 comment on commit fe89482

@Ihamfp
Copy link
Member

@Ihamfp Ihamfp commented on fe89482 Dec 24, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't test with an image, but avoid that.

Please sign in to comment.