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:
@@ -905,19 +905,19 @@ const table_segment sjistables[] = { {sjis00tou, 0x0000},
|
|||||||
if ((str[0]&0x80) == 0)\
|
if ((str[0]&0x80) == 0)\
|
||||||
*uni_str++ = *str++;\
|
*uni_str++ = *str++;\
|
||||||
else if ((str[1] & 0xC0) != 0x80) {\
|
else if ((str[1] & 0xC0) != 0x80) {\
|
||||||
*uni_str++ = 0xfffd;\
|
*uni_str++ = 0xfffd;\
|
||||||
str+=1;\
|
str+=1;\
|
||||||
} else if ((str[0]&0x20) == 0) {\
|
} else if ((str[0]&0x20) == 0) {\
|
||||||
*uni_str++ = ((str[0]&31)<<6) | (str[1]&63);\
|
*uni_str++ = ((str[0]&31)<<6) | (str[1]&63);\
|
||||||
str+=2;\
|
str+=2;\
|
||||||
} else if ((str[2] & 0xC0) != 0x80) {\
|
} else if ((str[2] & 0xC0) != 0x80) {\
|
||||||
*uni_str++ = 0xfffd;\
|
*uni_str++ = 0xfffd;\
|
||||||
str+=2;\
|
str+=2;\
|
||||||
} else if ((str[0]&0x10) == 0) {\
|
} else if ((str[0]&0x10) == 0) {\
|
||||||
*uni_str++ = ((str[0]&15)<<12) | ((str[1]&63)<<6) | (str[2]&63);\
|
*uni_str++ = ((str[0]&15)<<12) | ((str[1]&63)<<6) | (str[2]&63);\
|
||||||
str+=3;\
|
str+=3;\
|
||||||
} else if ((str[3] & 0xC0) != 0x80) {\
|
} else if ((str[3] & 0xC0) != 0x80) {\
|
||||||
*uni_str++ = 0xfffd;\
|
*uni_str++ = 0xfffd;\
|
||||||
str+=3;\
|
str+=3;\
|
||||||
} else {\
|
} else {\
|
||||||
err_flag = 1;\
|
err_flag = 1;\
|
||||||
@@ -1054,13 +1054,13 @@ _utf8_to_sjis_bendian(
|
|||||||
int32 dstLimit = *dstLen;
|
int32 dstLimit = *dstLen;
|
||||||
int32 srcCount = 0;
|
int32 srcCount = 0;
|
||||||
int32 dstCount = 0;
|
int32 dstCount = 0;
|
||||||
uint16 unicode;
|
|
||||||
uint16 *UNICODE = &unicode;
|
|
||||||
|
|
||||||
while ((srcCount < srcLimit) && (dstCount < dstLimit)) {
|
while ((srcCount < srcLimit) && (dstCount < dstLimit)) {
|
||||||
if ((srcCount + utf8_char_len(src[srcCount])) > srcLimit)
|
if ((srcCount + utf8_char_len(src[srcCount])) > srcLimit)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
uint16 unicode;
|
||||||
|
uint16 *UNICODE = &unicode;
|
||||||
int err_flag;
|
int err_flag;
|
||||||
bool multibyte = false;
|
bool multibyte = false;
|
||||||
const uint16 *table = NULL;
|
const uint16 *table = NULL;
|
||||||
|
|||||||
@@ -1209,6 +1209,7 @@ int dosfs_rename(void *_vol, void *_odir, const char *oldname,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
notify_listener(B_ENTRY_MOVED, vol->id, odir->vnid, ndir->vnid, file->vnid, newname);
|
notify_listener(B_ENTRY_MOVED, vol->id, odir->vnid, ndir->vnid, file->vnid, newname);
|
||||||
|
|
||||||
// update MIME information
|
// update MIME information
|
||||||
if(!(file->mode & FAT_SUBDIR)) {
|
if(!(file->mode & FAT_SUBDIR)) {
|
||||||
set_mime_type(file, newname);
|
set_mime_type(file, newname);
|
||||||
|
|||||||
@@ -40,11 +40,11 @@ struct ext_mime mimes[] = {
|
|||||||
{ "mod", "audio/mod" },
|
{ "mod", "audio/mod" },
|
||||||
{ "ra", "audio/x-real-audio" },
|
{ "ra", "audio/x-real-audio" },
|
||||||
{ "wav", "audio/x-wav" },
|
{ "wav", "audio/x-wav" },
|
||||||
{ "mp2", "audio/x-mpeg" },
|
{ "mp2", "audio/x-mpeg" },
|
||||||
{ "mp3", "audio/x-mpeg" },
|
{ "mp3", "audio/x-mpeg" },
|
||||||
{ "ogg", "audio/x-vorbis" },
|
{ "ogg", "audio/x-vorbis" },
|
||||||
{ "mpc", "audio/x-mpc" },
|
{ "mpc", "audio/x-mpc" },
|
||||||
{ "asf", "application/x-asf" },
|
{ "asf", "application/x-asf" },
|
||||||
{ "riff", "application/x-riff" },
|
{ "riff", "application/x-riff" },
|
||||||
{ "wma", "audio/x-ms-wma" },
|
{ "wma", "audio/x-ms-wma" },
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user