Author: ekohl Date: Sun Apr 25 21:20:59 2010 New Revision: 47018
URL: http://svn.reactos.org/svn/reactos?rev=47018&view=rev Log: [NEWINFLIB] - Use LANGID instead of LCID. - Move LANGID and language macros into the host typedefs header. - Remove dead code.
Modified: trunk/reactos/include/host/typedefs.h trunk/reactos/lib/newinflib/builddep.h trunk/reactos/lib/newinflib/infget.c trunk/reactos/lib/newinflib/infhost.h trunk/reactos/lib/newinflib/infhostgen.c trunk/reactos/lib/newinflib/infpriv.h trunk/reactos/lib/newinflib/infros.h trunk/reactos/lib/newinflib/infrosgen.c
Modified: trunk/reactos/include/host/typedefs.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/host/typedefs.h?rev... ============================================================================== --- trunk/reactos/include/host/typedefs.h [iso-8859-1] (original) +++ trunk/reactos/include/host/typedefs.h [iso-8859-1] Sun Apr 25 21:20:59 2010 @@ -65,6 +65,7 @@ typedef INT NTSTATUS, POOL_TYPE; typedef LONG HRESULT; typedef ULONG_PTR SIZE_T, *PSIZE_T; +typedef WORD LANGID;
#define MAXUSHORT USHRT_MAX
@@ -232,6 +233,11 @@ #define RtlCopyMemory(Destination, Source, Length) memcpy(Destination, Source, Length) #define RtlMoveMemory(Destination, Source, Length) memmove(Destination, Source, Length)
+#define MAKELANGID(p,s) ((((WORD)(s))<<10)|(WORD)(p)) +#define PRIMARYLANGID(l) ((WORD)(l)&0x3ff) +#define SUBLANGID(l) ((WORD)(l)>>10) +#define SUBLANG_NEUTRAL 0x00 + /* Prevent inclusion of some other headers */ #define __INTERNAL_DEBUG #define RTL_H
Modified: trunk/reactos/lib/newinflib/builddep.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/newinflib/builddep.h?re... ============================================================================== --- trunk/reactos/lib/newinflib/builddep.h [iso-8859-1] (original) +++ trunk/reactos/lib/newinflib/builddep.h [iso-8859-1] Sun Apr 25 21:20:59 2010 @@ -30,7 +30,6 @@
typedef char TCHAR, *PTCHAR, *PTSTR; typedef const TCHAR *PCTSTR; -typedef WORD LCID;
#define _T(x) x #define _tcsicmp strcasecmp @@ -59,11 +58,6 @@ #define IS_TEXT_UNICODE_REVERSE_MASK 240 #define IS_TEXT_UNICODE_NOT_UNICODE_MASK 3840 #define IS_TEXT_UNICODE_NOT_ASCII_MASK 61440 - -#define SUBLANG_NEUTRAL 0 -#define PRIMARYLANGID(lgid) ((WORD)(lgid) & 0x3ff) -#define MAKELANGID(p, s) ((((WORD)(s)) << 10) | (WORD)(p)) -
#else /* ! defined(INFLIB_HOST) */
Modified: trunk/reactos/lib/newinflib/infget.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/newinflib/infget.c?rev=... ============================================================================== --- trunk/reactos/lib/newinflib/infget.c [iso-8859-1] (original) +++ trunk/reactos/lib/newinflib/infget.c [iso-8859-1] Sun Apr 25 21:20:59 2010 @@ -46,11 +46,11 @@
DPRINT("Value name: %S\n", ValueName);
- if (Inf->LocaleId != 0) + if (Inf->LanguageId != 0) { swprintf(StringLangId, L"Strings.%04hx", - Inf->LocaleId); + Inf->LanguageId);
Status = InfpFindFirstLine(Inf, StringLangId, @@ -60,7 +60,7 @@ { swprintf(StringLangId, L"Strings.%04hx", - MAKELANGID(PRIMARYLANGID(Inf->LocaleId), SUBLANG_NEUTRAL)); + MAKELANGID(PRIMARYLANGID(Inf->LanguageId), SUBLANG_NEUTRAL));
Status = InfpFindFirstLine(Inf, StringLangId,
Modified: trunk/reactos/lib/newinflib/infhost.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/newinflib/infhost.h?rev... ============================================================================== --- trunk/reactos/lib/newinflib/infhost.h [iso-8859-1] (original) +++ trunk/reactos/lib/newinflib/infhost.h [iso-8859-1] Sun Apr 25 21:20:59 2010 @@ -23,11 +23,11 @@ extern int InfHostOpenBufferedFile(PHINF InfHandle, void *Buffer, ULONG BufferSize, - LCID LocaleId, + LANGID LanguageId, ULONG *ErrorLine); extern int InfHostOpenFile(PHINF InfHandle, const CHAR *FileName, - LCID LocaleId, + LANGID LanguageId, ULONG *ErrorLine); extern int InfHostWriteFile(HINF InfHandle, const CHAR *FileName,
Modified: trunk/reactos/lib/newinflib/infhostgen.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/newinflib/infhostgen.c?... ============================================================================== --- trunk/reactos/lib/newinflib/infhostgen.c [iso-8859-1] (original) +++ trunk/reactos/lib/newinflib/infhostgen.c [iso-8859-1] Sun Apr 25 21:20:59 2010 @@ -20,7 +20,7 @@ InfHostOpenBufferedFile(PHINF InfHandle, void *Buffer, ULONG BufferSize, - LCID LocaleId, + LANGID LanguageId, ULONG *ErrorLine) { INFSTATUS Status; @@ -59,8 +59,9 @@ ZEROMEMORY(Cache, sizeof(INFCACHE));
- Cache->LocaleId = LocaleId; - + Cache->LanguageId = LanguageId; + + /* Parse the inf buffer */ if (!RtlIsTextUnicode(FileBuffer, (INT)FileBufferSize, NULL)) { // static const BYTE utf8_bom[3] = { 0xef, 0xbb, 0xbf }; @@ -77,9 +78,6 @@ new_buff = MALLOC(FileBufferSize * sizeof(WCHAR)); if (new_buff != NULL) { -// DWORD len = MultiByteToWideChar( codepage, 0, (char *)FileBuffer + offset, -// FileBufferSize - offset, new_buff, FileBufferSize); - ULONG len; Status = RtlMultiByteToUnicodeN(new_buff, FileBufferSize * sizeof(WCHAR), @@ -111,11 +109,6 @@ ErrorLine); }
- /* Parse the inf buffer */ -// Status = InfpParseBuffer (Cache, -// FileBuffer, -// FileBuffer + BufferSize, -// ErrorLine); if (!INF_SUCCESS(Status)) { FREE(Cache); @@ -134,7 +127,7 @@ int InfHostOpenFile(PHINF InfHandle, const CHAR *FileName, - LCID LocaleId, + LANGID LanguageId, ULONG *ErrorLine) { FILE *File; @@ -219,7 +212,7 @@ ZEROMEMORY(Cache, sizeof(INFCACHE));
- Cache->LocaleId = LocaleId; + Cache->LanguageId = LanguageId;
/* Parse the inf buffer */ if (!RtlIsTextUnicode(FileBuffer, (INT)FileBufferLength, NULL)) @@ -238,9 +231,6 @@ new_buff = MALLOC(FileBufferLength * sizeof(WCHAR)); if (new_buff != NULL) { -// DWORD len = MultiByteToWideChar( codepage, 0, (char *)FileBuffer + offset, -// FileLength - offset, new_buff, FileLength); - ULONG len; Status = RtlMultiByteToUnicodeN(new_buff, FileBufferLength * sizeof(WCHAR), @@ -273,10 +263,6 @@ ErrorLine); }
-// Status = InfpParseBuffer (Cache, -// FileBuffer, -// FileBuffer + FileLength, -// ErrorLine); if (!INF_SUCCESS(Status)) { FREE(Cache);
Modified: trunk/reactos/lib/newinflib/infpriv.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/newinflib/infpriv.h?rev... ============================================================================== --- trunk/reactos/lib/newinflib/infpriv.h [iso-8859-1] (original) +++ trunk/reactos/lib/newinflib/infpriv.h [iso-8859-1] Sun Apr 25 21:20:59 2010 @@ -55,7 +55,7 @@
typedef struct _INFCACHE { - LCID LocaleId; + LANGID LanguageId; PINFCACHESECTION FirstSection; PINFCACHESECTION LastSection;
Modified: trunk/reactos/lib/newinflib/infros.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/newinflib/infros.h?rev=... ============================================================================== --- trunk/reactos/lib/newinflib/infros.h [iso-8859-1] (original) +++ trunk/reactos/lib/newinflib/infros.h [iso-8859-1] Sun Apr 25 21:20:59 2010 @@ -18,11 +18,11 @@ extern NTSTATUS InfOpenBufferedFile(PHINF InfHandle, PVOID Buffer, ULONG BufferSize, - LCID LocaleId, + LANGID LanguageId, PULONG ErrorLine); extern NTSTATUS InfOpenFile(PHINF InfHandle, PUNICODE_STRING FileName, - LCID LocaleId, + LANGID LanguageId, PULONG ErrorLine); extern NTSTATUS InfWriteFile(HINF InfHandle, PUNICODE_STRING FileName,
Modified: trunk/reactos/lib/newinflib/infrosgen.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/newinflib/infrosgen.c?r... ============================================================================== --- trunk/reactos/lib/newinflib/infrosgen.c [iso-8859-1] (original) +++ trunk/reactos/lib/newinflib/infrosgen.c [iso-8859-1] Sun Apr 25 21:20:59 2010 @@ -51,7 +51,7 @@ InfOpenBufferedFile(PHINF InfHandle, PVOID Buffer, ULONG BufferSize, - LCID LocaleId, + LANGID LanguageId, PULONG ErrorLine) { INFSTATUS Status; @@ -92,8 +92,9 @@ ZEROMEMORY(Cache, sizeof(INFCACHE));
- Cache->LocaleId = LocaleId; - + Cache->LanguageId = LanguageId; + + /* Parse the inf buffer */ if (!RtlIsTextUnicode(FileBuffer, FileBufferSize, NULL)) { // static const BYTE utf8_bom[3] = { 0xef, 0xbb, 0xbf }; @@ -110,9 +111,6 @@ new_buff = MALLOC(FileBufferSize * sizeof(WCHAR)); if (new_buff != NULL) { -// DWORD len = MultiByteToWideChar( codepage, 0, (char *)FileBuffer + offset, -// FileBufferSize - offset, new_buff, FileBufferSize); - ULONG len; Status = RtlMultiByteToUnicodeN(new_buff, FileBufferSize * sizeof(WCHAR), @@ -162,7 +160,7 @@ NTSTATUS InfOpenFile(PHINF InfHandle, PUNICODE_STRING FileName, - LCID LocaleId, + LANGID LanguageId, PULONG ErrorLine) { OBJECT_ATTRIBUTES ObjectAttributes; @@ -267,7 +265,7 @@ ZEROMEMORY(Cache, sizeof(INFCACHE));
- Cache->LocaleId = LocaleId; + Cache->LanguageId = LanguageId;
/* Parse the inf buffer */ if (!RtlIsTextUnicode(FileBuffer, FileBufferLength, NULL)) @@ -286,9 +284,6 @@ new_buff = MALLOC(FileBufferLength * sizeof(WCHAR)); if (new_buff != NULL) { -// DWORD len = MultiByteToWideChar( codepage, 0, (char *)FileBuffer + offset, -// FileLength - offset, new_buff, FileLength); - ULONG len; Status = RtlMultiByteToUnicodeN(new_buff, FileBufferLength * sizeof(WCHAR),