Fix build warnings

Signed-off-by: Mahyar Koshkouei <deltabeard@users.noreply.github.com>
This commit is contained in:
Mahyar Koshkouei
2017-02-15 15:28:07 +00:00
parent bd03f3c4c0
commit 825db2f713
12 changed files with 33 additions and 25 deletions

View File

@@ -51,7 +51,7 @@ EXTRA_OUTPUT_FILES :=
LIBRARY_DIRS := $(DEVKITPRO)/libctru $(DEVKITPRO)/portlibs/armv6k LIBRARY_DIRS := $(DEVKITPRO)/libctru $(DEVKITPRO)/portlibs/armv6k
LIBRARIES := mpg123 opusfile opus ogg ctru m LIBRARIES := mpg123 opusfile opus ogg ctru m
BUILD_FLAGS := BUILD_FLAGS := -Wall -Wextra
RUN_FLAGS := RUN_FLAGS :=
VERSION_PARTS := $(subst ., ,$(shell git describe --tags --abbrev=0)) VERSION_PARTS := $(subst ., ,$(shell git describe --tags --abbrev=0))

View File

@@ -1,9 +1,6 @@
#include <errno.h> #include <errno.h>
#include <stdio.h> #include <stdio.h>
/* Channel to play music on */
#define CHANNEL 0x08
/* Adds extra debugging text */ /* Adds extra debugging text */
//#define DEBUG //#define DEBUG
@@ -14,13 +11,3 @@
#define delete(ptr) \ #define delete(ptr) \
free((void*) ptr); ptr = NULL free((void*) ptr); ptr = NULL
struct decoder_fn
{
int (* init)(const char* file);
uint32_t (* rate)(void);
uint8_t (* channels)(void);
int buffSize;
uint64_t (* decode)(void*);
void (* exit)(void);
};

View File

@@ -3,11 +3,11 @@
#define DR_FLAC_IMPLEMENTATION #define DR_FLAC_IMPLEMENTATION
#include <./dr_libs/dr_flac.h> #include <./dr_libs/dr_flac.h>
#include "all.h"
#include "flac.h" #include "flac.h"
#include "playback.h"
static drflac* pFlac; static drflac* pFlac;
static const int buffSize = 16 * 1024; static const size_t buffSize = 16 * 1024;
/** /**
* Set decoder parameters for flac. * Set decoder parameters for flac.

View File

@@ -1,3 +1,5 @@
#include "playback.h"
/** /**
* Set decoder parameters for flac. * Set decoder parameters for flac.
* *

View File

@@ -4,10 +4,10 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "all.h"
#include "mp3.h" #include "mp3.h"
#include "playback.h"
static int* buffSize; static size_t* buffSize;
static mpg123_handle *mh = NULL; static mpg123_handle *mh = NULL;
static uint32_t rate; static uint32_t rate;
static uint8_t channels; static uint8_t channels;

View File

@@ -1,3 +1,5 @@
#include "playback.h"
/** /**
* Set decoder parameters for MP3. * Set decoder parameters for MP3.
* *

View File

@@ -2,12 +2,12 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "all.h"
#include "opus.h" #include "opus.h"
#include "playback.h"
static OggOpusFile* opusFile; static OggOpusFile* opusFile;
static const OpusHead* opusHead; static const OpusHead* opusHead;
static const int buffSize = 32 * 1024; static const size_t buffSize = 32 * 1024;
/** /**
* Set decoder parameters for Opus. * Set decoder parameters for Opus.

View File

@@ -1,4 +1,5 @@
#include <opus/opusfile.h> #include <opus/opusfile.h>
#include "playback.h"
void setOpus(struct decoder_fn* decoder); void setOpus(struct decoder_fn* decoder);

View File

@@ -1,4 +1,5 @@
#include <3ds.h> #include <3ds.h>
#include <stdbool.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@@ -49,7 +50,7 @@ bool isPlaying(void)
static int getFileType(const char *file) static int getFileType(const char *file)
{ {
FILE* ftest = fopen(file, "rb"); FILE* ftest = fopen(file, "rb");
int fileSig = 0; uint32_t fileSig;
enum file_types file_type = FILE_TYPE_ERROR; enum file_types file_type = FILE_TYPE_ERROR;
/* Failure opening file */ /* Failure opening file */
@@ -83,7 +84,7 @@ static int getFileType(const char *file)
break; break;
// "OggS" // "OggS"
case 0x5367674f: case 0x5367674F:
if(isOpus(file) == 0) if(isOpus(file) == 0)
file_type = FILE_TYPE_OPUS; file_type = FILE_TYPE_OPUS;
else else
@@ -161,7 +162,7 @@ void playFile(void* infoIn)
goto err; goto err;
} }
if(R_FAILED(ndspInit())) if(ndspInit() < 0)
{ {
errno = NDSP_INIT_FAIL; errno = NDSP_INIT_FAIL;
goto err; goto err;

View File

@@ -1,6 +1,9 @@
#ifndef ctrmus_playback_h #ifndef ctrmus_playback_h
#define ctrmus_playback_h #define ctrmus_playback_h
/* Channel to play music on */
#define CHANNEL 0x08
enum file_types enum file_types
{ {
FILE_TYPE_ERROR = -1, FILE_TYPE_ERROR = -1,
@@ -11,6 +14,16 @@ enum file_types
FILE_TYPE_MP3 FILE_TYPE_MP3
}; };
struct decoder_fn
{
int (* init)(const char* file);
uint32_t (* rate)(void);
uint8_t (* channels)(void);
size_t buffSize;
uint64_t (* decode)(void*);
void (* exit)(void);
};
struct playbackInfo_t struct playbackInfo_t
{ {
char* file; char* file;

View File

@@ -3,10 +3,10 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "all.h"
#include "wav.h" #include "wav.h"
#include "playback.h"
static const int buffSize = 16 * 1024; static const size_t buffSize = 16 * 1024;
static FILE* pWav = NULL; static FILE* pWav = NULL;
static char header[45]; static char header[45];
static uint8_t channels; static uint8_t channels;

View File

@@ -1,3 +1,5 @@
#include "playback.h"
/** /**
* Set decoder parameters for WAV. * Set decoder parameters for WAV.
* *