/*
-* Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved
+* Copyright (c) 2011-2016 Samsung Electronics Co., Ltd All Rights Reserved
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
#include <tts.h>
#include <dlog.h>
-#define TTS_STRDUP(src) ((src != NULL) ? strdup(src) : NULL)
+#define TTS_STRDUP(src) ((src != NULL) ? strdup(src) : NULL)
static tts_h g_tts;
static char* g_text = NULL;
return 0;
}
- fseek(fp , 0 , SEEK_END);
+ if (0 != fseek(fp , 0 , SEEK_END)) {
+ SLOG(LOG_ERROR, tts_tag(), "Fail to fseek()");
+ fclose(fp);
+ return 0;
+ }
int text_len = ftell(fp);
- if (0 >= text_len) {
+ if (0 >= text_len || 0 > text_len + 1) {
SLOG(LOG_ERROR, tts_tag(), "File has no contents");
fclose(fp);
return 0;
rewind(fp);
char* temp = NULL;
- temp = (char*)calloc(1, text_len+1);
+ temp = (char*)calloc(1, text_len + 1);
if (temp == NULL) {
- SLOG(LOG_ERROR, tts_tag(), "Fail to memory allocation");
+ SLOG(LOG_ERROR, tts_tag(), "Fail to memory allocation");
fclose(fp);
return 0;
}