diff options
| author | Carl Hetherington <cth@carlh.net> | 2014-05-03 20:18:07 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2014-05-03 20:18:07 +0100 |
| commit | 09e16aa3acf7878b54a4995a0be79890f26db09f (patch) | |
| tree | fe46fe5a8d980ad0c2e6cfd7300a32a061da9068 /tools/common.cc | |
| parent | fe9bbdf3f5223ee94cb51ba00ddab7f4a6ddb754 (diff) | |
Assorted test fixes.
Diffstat (limited to 'tools/common.cc')
| -rw-r--r-- | tools/common.cc | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/tools/common.cc b/tools/common.cc new file mode 100644 index 00000000..1c0c1df8 --- /dev/null +++ b/tools/common.cc @@ -0,0 +1,42 @@ +/* + Copyright (C) 2014 Carl Hetherington <cth@carlh.net> + + This program 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 2 of the License, or + (at your option) any later version. + + This program 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 this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +#include "common.h" +#include "dcp.h" + +using std::list; +using boost::shared_ptr; +using boost::dynamic_pointer_cast; + +void +dcp::filter_errors (dcp::DCP::ReadErrors& errors, bool ignore_missing_assets) +{ + for (DCP::ReadErrors::iterator i = errors.begin(); i != errors.end(); ) { + + DCP::ReadErrors::iterator tmp = i; + ++tmp; + + if (ignore_missing_assets && dynamic_pointer_cast<MissingAssetError> (*i)) { + errors.erase (i); + } + + i = tmp; + } +} + |
