From 39eb314cb922b805e9126d5f0352f31c2f84f151 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 29 Jan 2014 20:01:30 +1100 Subject: UI: Refactor timecode functions into BLI_timecode - deduplicate timecode_simple_string from image.c - replace V2D_UNIT_SECONDSSEQ with V2D_UNIT_SECONDS - avoid possible buffer overflow bugs (sprintf -> BLI_snprintf) - remove option not to use timecode and split into 2 functions Patch D227 by Andrew Buttery with own refactoring. --- source/blender/blenlib/BLI_timecode.h | 41 +++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 source/blender/blenlib/BLI_timecode.h (limited to 'source/blender/blenlib/BLI_timecode.h') diff --git a/source/blender/blenlib/BLI_timecode.h b/source/blender/blenlib/BLI_timecode.h new file mode 100644 index 00000000000..b6cd0117bf5 --- /dev/null +++ b/source/blender/blenlib/BLI_timecode.h @@ -0,0 +1,41 @@ +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2008 Blender Foundation. + * All rights reserved. + * + * + * Contributor(s): Joshua Leung + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#ifndef __BLI_TIMECODE_H__ +#define __BLI_TIMECODE_H__ + +/** \file BLI_timecode.h + * \ingroup BLI + */ + +size_t BLI_timecode_string_from_time( + char *str, const size_t len, const int power, const float time_seconds, + const double scene_fps, const short timecode_style); + +size_t BLI_timecode_string_from_time_simple( + char *str, const size_t len, const int power, const float time_seconds); + +#endif /* __BLI_TIMECODE_H__ */ -- cgit v1.2.3