2 * Copyright (C) 2013 Intel Corporation. All rights reserved.
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public License
6 * as published by the Free Software Foundation; either version 2.1 of
7 * the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
19 * @author Lucas De Marchi <lucas.demarchi@intel.com>
27 struct lms_string_size str_extract_name_from_path(
28 const char *path, unsigned int pathlen, unsigned int baselen,
29 const struct lms_string_size *ext, struct lms_charset_conv *cs_conv)
31 struct lms_string_size str;
33 str.len = pathlen - baselen - ext->len;
34 str.str = malloc(str.len + 1);
36 return (struct lms_string_size) { };
37 memcpy(str.str, path + baselen, str.len);
38 str.str[str.len] = '\0';
40 lms_charset_conv(cs_conv, &str.str, &str.len);
45 /* Euclidean algorithm
46 * http://en.wikipedia.org/wiki/Euclidean_algorithm */
47 static unsigned int gcd(unsigned int a, unsigned int b)
60 void reduce_gcd(unsigned int w, unsigned int h, unsigned int *dw,