diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-01-29 13:01:30 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-01-29 13:44:01 +0400 |
commit | 39eb314cb922b805e9126d5f0352f31c2f84f151 (patch) | |
tree | 9fc861802eeaab149539eb3692a975969cea03db /source/blender/blenlib/BLI_timecode.h | |
parent | f70d9660474c2be5f56d65247df3be5af0479e08 (diff) |
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.
Diffstat (limited to 'source/blender/blenlib/BLI_timecode.h')
-rw-r--r-- | source/blender/blenlib/BLI_timecode.h | 41 |
1 files changed, 41 insertions, 0 deletions
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__ */ |