From 0f6b3796d6143f36300e7f3136ba4ad73ab41913 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Bernardy Date: Wed, 9 Feb 2005 10:56:54 +0000 Subject: [PATCH] long policy git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5863 a1c6a512-1295-4272-9138-f99709370657 --- apps/bookmark.c | 27 ++++++++++++++------------- apps/filetypes.c | 12 ++++++------ firmware/id3.c | 22 +++++++++++----------- 3 files changed, 31 insertions(+), 30 deletions(-) diff --git a/apps/bookmark.c b/apps/bookmark.c index 969371eeeb..e96561319b 100644 --- a/apps/bookmark.c +++ b/apps/bookmark.c @@ -1,4 +1,4 @@ - /*************************************************************************** +/*************************************************************************** * __________ __ ___. * Open \______ \ ____ ____ | | _\_ |__ _______ ___ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / @@ -6,7 +6,7 @@ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ * \/ \/ \/ \/ \/ * - * Copyright (C) 2003 by Benjamin Metzler + * Copyright (C)2003 by Benjamin Metzler * * All files in this archive are subject to the GNU General Public License. * See the file COPYING in the source tree root for full license agreement. @@ -70,7 +70,7 @@ static bool parse_bookmark(const char *bookmark, int *resume_first_index, char* resume_file, unsigned int resume_file_size, - int* ms, + long* ms, int * repeat_mode, bool *shuffle, char* file_name); @@ -778,7 +778,7 @@ static void display_bookmark(const char* bookmark, int bookmark_count) { int resume_index = 0; - int ms = 0; + long ms = 0; int repeat_mode = 0; bool playlist_shuffle = false; int len; @@ -834,19 +834,20 @@ static void display_bookmark(const char* bookmark, /* elapsed time*/ if ( ms < 3600000 ) { - snprintf(global_temp_buffer, sizeof(global_temp_buffer), "%s: %d:%02d", + snprintf(global_temp_buffer, sizeof(global_temp_buffer), "%s: %ld:%02d", str(LANG_BOOKMARK_SELECT_TIME_TEXT), ms / 60000, - ms % 60000 / 1000); + (unsigned int)(ms % 60000) / 1000); + /* unsigned int: hinting for 16bits archs */ } else { snprintf(global_temp_buffer, sizeof(global_temp_buffer), - "%s: %d:%02d:%02d", - str(LANG_BOOKMARK_SELECT_TIME_TEXT), - ms / 3600000, - ms % 3600000 / 60000, - ms % 60000 / 1000); + "%s: %ld:%02ld:%02d", + str(LANG_BOOKMARK_SELECT_TIME_TEXT), + ms / 3600000, + ms % 3600000 / 60000, + (unsigned int)(ms % 60000) / 1000); } lcd_puts_scroll(0, 3, global_temp_buffer); @@ -900,7 +901,7 @@ static void say_bookmark(const char* bookmark, int bookmark_id) { int resume_index; - int ms; + long ms; char dir[MAX_PATH]; bool enqueue = false; /* only the first voice is not queued */ @@ -987,7 +988,7 @@ static bool parse_bookmark(const char *bookmark, int *resume_first_index, char* resume_file, unsigned int resume_file_size, - int* ms, + long* ms, int * repeat_mode, bool *shuffle, char* file_name) { diff --git a/apps/filetypes.c b/apps/filetypes.c index 09090c30d4..2788d3c151 100644 --- a/apps/filetypes.c +++ b/apps/filetypes.c @@ -209,8 +209,8 @@ int filetype_get_attr(const char* name) strlen(exttypes[i].extension)], exttypes[i].extension)) { - return ((((unsigned int)exttypes[i].type - - (unsigned int)&filetypes[0]) / + return ((((unsigned long)exttypes[i].type - + (unsigned long)&filetypes[0]) / sizeof(struct file_type)) << 8); } } @@ -594,8 +594,8 @@ static char* string2icon(const char* str) return NULL; if ((sizeof(string_buffer) + - (unsigned int) string_buffer - - (unsigned int) next_free_string) < ICON_LENGTH) + (unsigned long) string_buffer - + (unsigned long) next_free_string) < ICON_LENGTH) { splash(HZ,true,str(LANG_FILETYPES_STRING_BUFFER_EMPTY)); return NULL; @@ -643,8 +643,8 @@ static char* get_string(const char* str) return NULL; if (l <= (sizeof(string_buffer) + - (unsigned int) string_buffer - - (unsigned int) next_free_string)) + (unsigned long) string_buffer - + (unsigned long) next_free_string)) { strcpy(next_free_string,str); cp=next_free_string; diff --git a/firmware/id3.c b/firmware/id3.c index 4297c8ba70..d8f7c0db7b 100644 --- a/firmware/id3.c +++ b/firmware/id3.c @@ -41,15 +41,15 @@ #include "mp3data.h" #include "system.h" -#define UNSYNC(b0,b1,b2,b3) (((b0 & 0x7F) << (3*7)) | \ - ((b1 & 0x7F) << (2*7)) | \ - ((b2 & 0x7F) << (1*7)) | \ - ((b3 & 0x7F) << (0*7))) +#define UNSYNC(b0,b1,b2,b3) (((long)(b0 & 0x7F) << (3*7)) | \ + ((long)(b1 & 0x7F) << (2*7)) | \ + ((long)(b2 & 0x7F) << (1*7)) | \ + ((long)(b3 & 0x7F) << (0*7))) -#define BYTES2INT(b0,b1,b2,b3) (((b0 & 0xFF) << (3*8)) | \ - ((b1 & 0xFF) << (2*8)) | \ - ((b2 & 0xFF) << (1*8)) | \ - ((b3 & 0xFF) << (0*8))) +#define BYTES2INT(b0,b1,b2,b3) (((long)(b0 & 0xFF) << (3*8)) | \ + ((long)(b1 & 0xFF) << (2*8)) | \ + ((long)(b2 & 0xFF) << (1*8)) | \ + ((long)(b3 & 0xFF) << (0*8))) static const char* const genres[] = { "Blues", "Classic Rock", "Country", "Dance", "Disco", "Funk", "Grunge", @@ -171,7 +171,7 @@ static int unsynchronize(char* tag, int len, bool *ff_found) wp++; } } - return (int)wp - (int)tag; + return (long)wp - (long)tag; } static int unsynchronize_frame(char* tag, int len) @@ -292,7 +292,7 @@ static const struct tag_resolver taglist[] = { (for valid 8-bit ASCII characters). If it's not unicode, we leave it alone. At some point we should fully support unicode strings */ static int unicode_munge(char** string, int *len) { - int tmp; + long tmp; bool le = false; int i; char *str = *string; @@ -460,7 +460,7 @@ static void setid3v2title(int fd, struct mp3entry *entry) { int minframesize; int size; - int bufferpos = 0, totframelen, framelen; + long bufferpos = 0, totframelen, framelen; char header[10]; char tmp[4]; unsigned char version;