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
This commit is contained in:
François Revol 2005-01-03 22:37:46 +00:00
parent 92044c244d
commit 11ad2d6866
3 changed files with 11 additions and 10 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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" },