From 11ad2d686621a1622680816479799b3a43bbc31f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Mon, 3 Jan 2005 22:37:46 +0000 Subject: [PATCH] because uni_str is incremented in utf8_to_u_hostendian() UNICODE is moved inside the loop in _utf8_to_sjis_bendian() to avoid crashing. (it points to a single unicode char!!) (other option is to not increment uni_str, but it's kept for consistency). some cosmetic changes git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10575 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/kernel/file_systems/dos/encodings.cpp | 10 +++++----- src/add-ons/kernel/file_systems/dos/file.c | 1 + src/add-ons/kernel/file_systems/dos/mime_table.c | 10 +++++----- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/add-ons/kernel/file_systems/dos/encodings.cpp b/src/add-ons/kernel/file_systems/dos/encodings.cpp index 95d97b8ce6..346a1121cb 100644 --- a/src/add-ons/kernel/file_systems/dos/encodings.cpp +++ b/src/add-ons/kernel/file_systems/dos/encodings.cpp @@ -905,19 +905,19 @@ const table_segment sjistables[] = { {sjis00tou, 0x0000}, if ((str[0]&0x80) == 0)\ *uni_str++ = *str++;\ else if ((str[1] & 0xC0) != 0x80) {\ - *uni_str++ = 0xfffd;\ + *uni_str++ = 0xfffd;\ str+=1;\ } else if ((str[0]&0x20) == 0) {\ *uni_str++ = ((str[0]&31)<<6) | (str[1]&63);\ str+=2;\ } else if ((str[2] & 0xC0) != 0x80) {\ - *uni_str++ = 0xfffd;\ + *uni_str++ = 0xfffd;\ str+=2;\ } else if ((str[0]&0x10) == 0) {\ *uni_str++ = ((str[0]&15)<<12) | ((str[1]&63)<<6) | (str[2]&63);\ str+=3;\ } else if ((str[3] & 0xC0) != 0x80) {\ - *uni_str++ = 0xfffd;\ + *uni_str++ = 0xfffd;\ str+=3;\ } else {\ err_flag = 1;\ @@ -1054,13 +1054,13 @@ _utf8_to_sjis_bendian( int32 dstLimit = *dstLen; int32 srcCount = 0; int32 dstCount = 0; - uint16 unicode; - uint16 *UNICODE = &unicode; while ((srcCount < srcLimit) && (dstCount < dstLimit)) { if ((srcCount + utf8_char_len(src[srcCount])) > srcLimit) break; + uint16 unicode; + uint16 *UNICODE = &unicode; int err_flag; bool multibyte = false; const uint16 *table = NULL; diff --git a/src/add-ons/kernel/file_systems/dos/file.c b/src/add-ons/kernel/file_systems/dos/file.c index f25b967d53..b3bda2526f 100644 --- a/src/add-ons/kernel/file_systems/dos/file.c +++ b/src/add-ons/kernel/file_systems/dos/file.c @@ -1209,6 +1209,7 @@ int dosfs_rename(void *_vol, void *_odir, const char *oldname, #endif notify_listener(B_ENTRY_MOVED, vol->id, odir->vnid, ndir->vnid, file->vnid, newname); + // update MIME information if(!(file->mode & FAT_SUBDIR)) { set_mime_type(file, newname); diff --git a/src/add-ons/kernel/file_systems/dos/mime_table.c b/src/add-ons/kernel/file_systems/dos/mime_table.c index ac69e41485..7bb66e72ac 100644 --- a/src/add-ons/kernel/file_systems/dos/mime_table.c +++ b/src/add-ons/kernel/file_systems/dos/mime_table.c @@ -40,11 +40,11 @@ struct ext_mime mimes[] = { { "mod", "audio/mod" }, { "ra", "audio/x-real-audio" }, { "wav", "audio/x-wav" }, - { "mp2", "audio/x-mpeg" }, - { "mp3", "audio/x-mpeg" }, - { "ogg", "audio/x-vorbis" }, - { "mpc", "audio/x-mpc" }, - { "asf", "application/x-asf" }, + { "mp2", "audio/x-mpeg" }, + { "mp3", "audio/x-mpeg" }, + { "ogg", "audio/x-vorbis" }, + { "mpc", "audio/x-mpc" }, + { "asf", "application/x-asf" }, { "riff", "application/x-riff" }, { "wma", "audio/x-ms-wma" },