From 5d22e3cbdd251819a4d2d07b9a12994d5aef778d Mon Sep 17 00:00:00 2001 From: Frank Gevaerts Date: Fri, 29 Aug 2008 21:08:38 +0000 Subject: Add wpseditor, the Google Summer of Code 2008 project of Rostislav Chekan. Closes FS#9327 git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18362 a1c6a512-1295-4272-9138-f99709370657 --- apps/misc.c | 47 ++++++++++++++++++++++++++--------------------- 1 file changed, 26 insertions(+), 21 deletions(-) (limited to 'apps/misc.c') diff --git a/apps/misc.c b/apps/misc.c index f3a937f..cd59dbc 100644 --- a/apps/misc.c +++ b/apps/misc.c @@ -27,7 +27,10 @@ #ifdef __PCTOOL__ #include #include -#include +#include +#ifdef WPSEDITOR +#include "string.h" +#endif #else #include "sprintf.h" #include "lang.h" @@ -196,26 +199,6 @@ char *create_numbered_filename(char *buffer, const char *path, return buffer; } -/* Format time into buf. - * - * buf - buffer to format to. - * buf_size - size of buffer. - * t - time to format, in milliseconds. - */ -void format_time(char* buf, int buf_size, long t) -{ - if ( t < 3600000 ) - { - snprintf(buf, buf_size, "%d:%02d", - (int) (t / 60000), (int) (t % 60000 / 1000)); - } - else - { - snprintf(buf, buf_size, "%d:%02d:%02d", - (int) (t / 3600000), (int) (t % 3600000 / 60000), - (int) (t % 60000 / 1000)); - } -} #if CONFIG_RTC /* Create a filename with a date+time part. @@ -1179,6 +1162,28 @@ char *strip_extension(char* buffer, int buffer_size, const char *filename) } #endif /* !defined(__PCTOOL__) */ +/* Format time into buf. + * + * buf - buffer to format to. + * buf_size - size of buffer. + * t - time to format, in milliseconds. + */ +void format_time(char* buf, int buf_size, long t) +{ + if ( t < 3600000 ) + { + snprintf(buf, buf_size, "%d:%02d", + (int) (t / 60000), (int) (t % 60000 / 1000)); + } + else + { + snprintf(buf, buf_size, "%d:%02d:%02d", + (int) (t / 3600000), (int) (t % 3600000 / 60000), + (int) (t % 60000 / 1000)); + } +} + + /** Open a UTF-8 file and set file descriptor to first byte after BOM. * If no BOM is present this behaves like open(). * If the file is opened for writing and O_TRUNC is set, write a BOM to -- cgit v1.1