Change-Id: I923c1cea45956fad4f985d843b91e0f1b5f81de1
Signed-off-by: Daeheyon Jung <darrenh.jung@samsung.com>
+ else
+ {
+ free(cache);
+ return TRUE;
+ }
const char *mime_type,
const char *file_name)
{
const char *mime_type,
const char *file_name)
{
+ if(!mtil || !mime_type || !file_name) return;
mime_type_info **mti;
int found = 0;
mime_type_info **mti;
int found = 0;
/* read globs2, and construct data structure */
globs2 = fopen(GLOBS2_PATH, "r");
/* read globs2, and construct data structure */
globs2 = fopen(GLOBS2_PATH, "r");
char *weight, *mime_type, *file_name, *saveptr = NULL;
while(fgets(buf, 255, globs2)) {
/* skip comment */
char *weight, *mime_type, *file_name, *saveptr = NULL;
while(fgets(buf, 255, globs2)) {
/* skip comment */
errno = 0;
retval = strtol (number_string, NULL, 10);
errno = 0;
retval = strtol (number_string, NULL, 10);
- if ((retval < INT_MIN) || (retval > INT_MAX) || (errno != 0))
+ if ((retval == LONG_MIN) || (retval == LONG_MAX) || (errno != 0))
return XDG_MIME_MAGIC_ERROR;
buffer = (char *)_xdg_mime_magic_read_to_newline (magic_file, &end_of_file);
return XDG_MIME_MAGIC_ERROR;
buffer = (char *)_xdg_mime_magic_read_to_newline (magic_file, &end_of_file);
+ if (end_of_file) {
+ if (buffer)
+ free(buffer);
+
return XDG_MIME_MAGIC_EOF;
return XDG_MIME_MAGIC_EOF;
end_ptr = buffer;
while (*end_ptr != ']' && *end_ptr != '\000' && *end_ptr != '\n')
end_ptr = buffer;
while (*end_ptr != ']' && *end_ptr != '\000' && *end_ptr != '\n')
case XDG_MIME_MAGIC_ERROR:
state = _xdg_mime_magic_parse_error (magic_file);
break;
case XDG_MIME_MAGIC_ERROR:
state = _xdg_mime_magic_parse_error (magic_file);
break;
- case XDG_MIME_MAGIC_EOF:
default:
/* Make the compiler happy */
assert (0);
default:
/* Make the compiler happy */
assert (0);