mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-31 01:34:58 +02:00
[BUG_FIXED] (Author: Dave Brotherstone) Fix scintilla crash bug while closing a document. git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@1104 f5eea248-9336-0410-98b8-ebc06183d4e3
20 lines
626 B
C
20 lines
626 B
C
// Scintilla source code edit control
|
|
/** @file UnicodeFromUTF8.h
|
|
** Lexer infrastructure.
|
|
**/
|
|
// Copyright 2013 by Neil Hodgson <neilh@scintilla.org>
|
|
// This file is in the public domain.
|
|
|
|
inline int UnicodeFromUTF8(const unsigned char *us) {
|
|
if (us[0] < 0xC2) {
|
|
return us[0];
|
|
} else if (us[0] < 0xE0) {
|
|
return ((us[0] & 0x1F) << 6) + (us[1] & 0x3F);
|
|
} else if (us[0] < 0xF0) {
|
|
return ((us[0] & 0xF) << 12) + ((us[1] & 0x3F) << 6) + (us[2] & 0x3F);
|
|
} else if (us[0] < 0xF5) {
|
|
return ((us[0] & 0x7) << 18) + ((us[1] & 0x3F) << 12) + ((us[2] & 0x3F) << 6) + (us[3] & 0x3F);
|
|
}
|
|
return us[0];
|
|
}
|