aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Pöschel <github@basicmaster.de>2016-06-26 15:43:13 +0200
committerStefan Pöschel <github@basicmaster.de>2016-06-26 15:43:13 +0200
commitfc9c14cc9d0c504702f4d524dcf5bc852153be64 (patch)
treeb254289eb7d2f76b8d489361bbe951e3448683d1
parent31c8fca44d11d44b70d90721c27a77ec5a83faa1 (diff)
downloadfdk-aac-dabplus-fc9c14cc9d0c504702f4d524dcf5bc852153be64.tar.gz
fdk-aac-dabplus-fc9c14cc9d0c504702f4d524dcf5bc852153be64.tar.bz2
fdk-aac-dabplus-fc9c14cc9d0c504702f4d524dcf5bc852153be64.zip
MOT encoder: enable/fix all/extra warnings
-rw-r--r--Makefile.am2
-rw-r--r--src/mot-encoder.cpp21
2 files changed, 13 insertions, 10 deletions
diff --git a/Makefile.am b/Makefile.am
index fe45bf9..629ee12 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -124,7 +124,7 @@ dabplus_enc_SOURCES = src/dabplus-enc.cpp \
src/utf8/core.h \
src/common.h
-mot_encoder_CXXFLAGS = $(GITVERSION_FLAGS) @MAGICKWAND_CFLAGS@ -Icontrib
+mot_encoder_CXXFLAGS = $(GITVERSION_FLAGS) @MAGICKWAND_CFLAGS@ -Icontrib -Wall -Wextra
mot_encoder_LDADD = @MAGICKWAND_LDADD@
mot_encoder_SOURCES = src/mot-encoder.cpp \
contrib/lib_crc.h \
diff --git a/src/mot-encoder.cpp b/src/mot-encoder.cpp
index 03bdfa6..7737230 100644
--- a/src/mot-encoder.cpp
+++ b/src/mot-encoder.cpp
@@ -565,7 +565,9 @@ void PADPacketizer::WriteAllPADs(int output_fd) {
break;
}
- ssize_t dummy = write(output_fd, &(*pad)[0], pad->size());
+ if (write(output_fd, &(*pad)[0], pad->size()) != (signed) pad->size())
+ fprintf(stderr, "mot-encoder Error: Could not write PAD\n");
+
delete pad;
}
}
@@ -688,7 +690,7 @@ pad_t* PADPacketizer::FlushPAD() {
if (subfields_size > 0) {
if (used_cis > 0) {
// X-PAD: CIs
- for (int i = 0; i < used_cis; i++)
+ for (size_t i = 0; i < used_cis; i++)
pad[--pad_offset] = (short_xpad ? 0 : ci_len_index[i]) << 5 | ci_type[i];
// X-PAD: end marker (if needed)
@@ -774,7 +776,7 @@ void usage(char* name)
#define optional_argument 2
int main(int argc, char *argv[])
{
- int len, ret;
+ int ret;
struct dirent *pDirent;
DIR *pDir = NULL;
int padlen = 58;
@@ -1062,8 +1064,6 @@ size_t resizeImage(MagickWand* m_wand, unsigned char** blob, std::string& fname)
size_t height = MagickGetImageHeight(m_wand);
size_t width = MagickGetImageWidth(m_wand);
- PixelWand *p_wand = NULL;
-
while (height > 240 || width > 320) {
if (height/240.0 > width/320.0) {
width = width * 240.0 / height;
@@ -1112,7 +1112,7 @@ size_t resizeImage(MagickWand* m_wand, unsigned char** blob, std::string& fname)
int encodeFile(int output_fd, std::string& fname, int fidx, bool raw_slides)
{
int ret = 0;
- int fd=0, nseg, lastseglen, i, last, curseglen;
+ int nseg, lastseglen, i, last, curseglen;
#if HAVE_MAGICKWAND
MagickWand *m_wand = NULL;
MagickBooleanType err;
@@ -1263,12 +1263,15 @@ int encodeFile(int output_fd, std::string& fname, int fidx, bool raw_slides)
// allocate memory to contain the whole file:
blob = (unsigned char*)malloc(sizeof(char) * blobsize);
if (blob == NULL) {
- fprintf(stderr, "mot-encoder Error: Memory allocation error \n");
+ fprintf(stderr, "mot-encoder Error: Memory allocation error\n");
goto encodefile_out;
}
// copy the file into the buffer:
- size_t dummy = fread(blob, 1, blobsize, pFile);
+ if (fread(blob, blobsize, 1, pFile) != blobsize) {
+ fprintf(stderr, "mot-encoder Error: Could not read file\n");
+ goto encodefile_out;
+ }
size_t last_dot = fname.rfind(".");
@@ -1683,7 +1686,7 @@ int dls_count(const std::string& text) {
}
-DATA_GROUP* dls_get(const std::string& text, uint8_t charset, unsigned int seg_index) {
+DATA_GROUP* dls_get(const std::string& text, uint8_t charset, int seg_index) {
bool first_seg = seg_index == 0;
bool last_seg = seg_index == dls_count(text) - 1;