1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
|
#!/bin/bash
set -e
#
# HEIF codec.
# Copyright (c) 2018 struktur AG, Joachim Bauch <bauch@struktur.de>
#
# This file is part of libheif.
#
# libheif is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# libheif is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with libheif. If not, see <http://www.gnu.org/licenses/>.
#
ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# Assume running from ".git/hooks" folder.
CPPLINT="$ROOT/../../scripts/cpplint.py"
if [ ! -x "$CPPLINT" ]; then
# Running from "scripts" folder.
CPPLINT="$ROOT/cpplint.py"
fi
# Run cpplint against changed C/C++ files.
check_enums=
for file in `git diff-index --cached --name-only HEAD --diff-filter=ACMR| grep -E "\.cc$|\.h$|\.c$"` ; do
"$CPPLINT" "$file"
if [ "$file" = "libheif/heif.h" ] || [ "$file" = "libheif/heif_emscripten.h" ] ; then
check_enums=1
fi
done
if [ "$check_enums" = "1" ]; then
CHECK_EMSCRIPTEN="$ROOT/../../scripts/check-emscripten-enums.sh"
if [ ! -x "$CHECK_EMSCRIPTEN" ]; then
# Running from "scripts" folder.
CHECK_EMSCRIPTEN="$ROOT/check-emscripten-enums.sh"
fi
"$CHECK_EMSCRIPTEN"
fi
|