ReactOS 0.4.15-dev-8096-ga0eec98
hash.c File Reference
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
#include "objbase.h"
#include "oaidl.h"
#include "wine/debug.h"
Include dependency graph for hash.c:

Go to the source code of this file.

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (ole)
 
ULONG WINAPI LHashValOfNameSysA (SYSKIND skind, LCID lcid, LPCSTR lpStr)
 
ULONG WINAPI LHashValOfNameSys (SYSKIND skind, LCID lcid, LPCOLESTR str)
 

Variables

static const unsigned char Lookup_16 [128 *3]
 
static const unsigned char Lookup_32 [128 *3]
 
static const unsigned char Lookup_48 [128 *3]
 
static const unsigned char Lookup_64 [128 *3]
 
static const unsigned char Lookup_80 [128 *3]
 
static const unsigned char Lookup_112 [128 *3]
 
static const unsigned char Lookup_128 [128 *3]
 
static const unsigned char Lookup_144 [128 *3]
 
static const unsigned char Lookup_160 [128 *3]
 
static const unsigned char Lookup_176 [128 *3]
 
static const unsigned char Lookup_208 [128 *3]
 
static const unsigned char Lookup_224 [128 *3]
 

Function Documentation

◆ LHashValOfNameSys()

ULONG WINAPI LHashValOfNameSys ( SYSKIND  skind,
LCID  lcid,
LPCOLESTR  str 
)

Definition at line 628 of file hash.c.

629{
630 LPSTR strA;
631 ULONG res;
632 INT len;
633
634 if (!str) return 0;
635 len = WideCharToMultiByte( CP_ACP, 0, str, -1, NULL, 0, NULL, NULL );
636 strA = HeapAlloc( GetProcessHeap(), 0, len );
638 res = LHashValOfNameSysA(skind, lcid, strA);
640 return res;
641}
#define NULL
Definition: types.h:112
#define GetProcessHeap()
Definition: compat.h:736
#define CP_ACP
Definition: compat.h:109
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
#define WideCharToMultiByte
Definition: compat.h:111
ULONG WINAPI LHashValOfNameSysA(SYSKIND skind, LCID lcid, LPCSTR lpStr)
Definition: hash.c:506
GLuint res
Definition: glext.h:9613
GLenum GLsizei len
Definition: glext.h:6722
char strA[12]
Definition: clipboard.c:2028
const WCHAR * str
int32_t INT
Definition: typedefs.h:58
uint32_t ULONG
Definition: typedefs.h:59
char * LPSTR
Definition: xmlstorage.h:182

Referenced by test_TypeComp().

◆ LHashValOfNameSysA()

ULONG WINAPI LHashValOfNameSysA ( SYSKIND  skind,
LCID  lcid,
LPCSTR  lpStr 
)

Definition at line 506 of file hash.c.

507{
508 ULONG nOffset, nMask = skind == SYS_MAC ? 1 : 0;
509 ULONG nHiWord, nLoWord = 0x0deadbee;
510 const unsigned char *str = (const unsigned char *)lpStr, *pnLookup = NULL;
511
512 TRACE("(%d, 0x%x, %s) %s\n", skind, lcid, debugstr_a(lpStr),
513 (skind == SYS_WIN16) ? "SYS_WIN16" : (skind == SYS_WIN32) ? "SYS_WIN32" : "");
514
515 if (!str)
516 return 0;
517
518 lcid = ConvertDefaultLocale(lcid);
519
520 switch (PRIMARYLANGID(LANGIDFROMLCID(lcid)))
521 {
522 default:
523 ERR("Unknown lcid %x, treating as latin-based, please report\n", lcid);
524 /* .. Fall Through .. */
526 case LANG_ASSAMESE: case LANG_AZERI: case LANG_BASQUE:
528 case LANG_CATALAN: case LANG_DANISH: case LANG_DIVEHI:
529 case LANG_DUTCH: case LANG_ENGLISH: case LANG_ESTONIAN:
530 case LANG_FAEROESE: case LANG_FINNISH: case LANG_FRENCH:
531 case LANG_GALICIAN: case LANG_GEORGIAN: case LANG_GERMAN:
533 case LANG_ITALIAN: case LANG_KANNADA: case LANG_KASHMIRI:
534 case LANG_KAZAK: case LANG_KONKANI: case LANG_KYRGYZ:
536 case LANG_MALAY: case LANG_MALAYALAM: case LANG_MANIPURI:
537 case LANG_MARATHI: case LANG_MONGOLIAN: case LANG_NEPALI:
538 case LANG_ORIYA: case LANG_PORTUGUESE: case LANG_PUNJABI:
540 case LANG_SINDHI: case LANG_SLOVENIAN: case LANG_SWAHILI:
541 case LANG_SWEDISH: case LANG_SYRIAC: case LANG_TAMIL:
542 case LANG_TATAR: case LANG_TELUGU: case LANG_THAI:
543 case LANG_UKRAINIAN: case LANG_URDU: case LANG_UZBEK:
545 case LANG_MAORI: case LANG_ROMANSH: case LANG_IRISH:
546 case LANG_SAMI: case LANG_UPPER_SORBIAN: case LANG_SUTU:
547 case LANG_TSONGA: case LANG_TSWANA: case LANG_VENDA:
548 case LANG_XHOSA: case LANG_ZULU: case LANG_ESPERANTO:
549 case LANG_WALON: case LANG_CORNISH: case LANG_WELSH:
550 case LANG_BRETON: case LANG_MANX_GAELIC:
551 nOffset = 16;
552 pnLookup = Lookup_16;
553 break;
554 case LANG_CZECH: case LANG_HUNGARIAN: case LANG_POLISH:
555 case LANG_SLOVAK: case LANG_SPANISH:
556 nOffset = 32;
557 pnLookup = Lookup_32;
558 break;
559 case LANG_HEBREW:
560 nOffset = 48;
561 pnLookup = Lookup_48;
562 break;
563 case LANG_JAPANESE:
564 nOffset = 64;
565 pnLookup = Lookup_64;
566 break;
567 case LANG_KOREAN:
568 nOffset = 80;
569 pnLookup = Lookup_80;
570 break;
571 case LANG_CHINESE:
572 nOffset = 112;
573 pnLookup = Lookup_112;
574 break;
575 case LANG_GREEK:
576 nOffset = 128;
577 pnLookup = Lookup_128;
578 break;
579 case LANG_ICELANDIC:
580 nOffset = 144;
581 pnLookup = Lookup_144;
582 break;
583 case LANG_TURKISH:
584 nOffset = 160;
585 pnLookup = Lookup_160;
586 break;
587 case LANG_NORWEGIAN:
589 {
590 nOffset = 176;
591 pnLookup = Lookup_176;
592 }
593 else
594 {
595 nOffset = 16;
596 pnLookup = Lookup_16;
597 }
598 break;
599 case LANG_ARABIC:
600 case LANG_FARSI:
601 nOffset = 208;
602 pnLookup = Lookup_208;
603 break;
604 case LANG_RUSSIAN:
605 nOffset = 224;
606 pnLookup = Lookup_224;
607 break;
608 }
609
610 nHiWord = (nOffset | nMask) << 16;
611
612 while (*str)
613 {
614 nLoWord = 37 * nLoWord + pnLookup[*str > 0x7f && nMask ? *str + 0x80 : *str];
615 str++;
616 }
617 /* Constrain to a prime modulo and sizeof(WORD) */
618 nLoWord = (nLoWord % 65599) & 0xffff;
619
620 return nHiWord | nLoWord;
621}
#define ERR(fmt,...)
Definition: debug.h:113
LCID WINAPI ConvertDefaultLocale(LCID lcid)
Definition: locale.c:2876
static const unsigned char Lookup_16[128 *3]
Definition: hash.c:32
static const unsigned char Lookup_208[128 *3]
Definition: hash.c:411
static const unsigned char Lookup_112[128 *3]
Definition: hash.c:221
static const unsigned char Lookup_48[128 *3]
Definition: hash.c:108
static const unsigned char Lookup_128[128 *3]
Definition: hash.c:259
static const unsigned char Lookup_144[128 *3]
Definition: hash.c:297
static const unsigned char Lookup_80[128 *3]
Definition: hash.c:183
static const unsigned char Lookup_224[128 *3]
Definition: hash.c:449
static const unsigned char Lookup_160[128 *3]
Definition: hash.c:335
static const unsigned char Lookup_32[128 *3]
Definition: hash.c:70
static const unsigned char Lookup_64[128 *3]
Definition: hash.c:146
static const unsigned char Lookup_176[128 *3]
Definition: hash.c:373
#define debugstr_a
Definition: kernel32.h:31
#define LANG_SCOTTISH_GAELIC
#define LANG_TATAR
Definition: nls.h:130
#define LANG_MAORI
Definition: nls.h:96
#define LANG_MALAYALAM
Definition: nls.h:93
#define LANG_KONKANI
Definition: nls.h:83
#define SUBLANG_NORWEGIAN_NYNORSK
Definition: nls.h:301
#define LANG_HINDI
Definition: nls.h:68
#define LANG_VENDA
Definition: nls.h:158
#define LANG_TAMIL
Definition: nls.h:129
#define LANG_MALTESE
Definition: nls.h:94
#define LANG_FARSI
Definition: nls.h:55
#define LANG_THAI
Definition: nls.h:132
#define LANG_LITHUANIAN
Definition: nls.h:88
#define LANG_ASSAMESE
Definition: nls.h:31
#define LANG_NORWEGIAN
Definition: nls.h:102
#define LANG_TSONGA
Definition: nls.h:157
#define SUBLANGID(l)
Definition: nls.h:17
#define LANG_ALBANIAN
Definition: nls.h:26
#define LANG_TURKISH
Definition: nls.h:136
#define LANG_SANSKRIT
Definition: nls.h:115
#define LANG_KASHMIRI
Definition: nls.h:78
#define LANG_DANISH
Definition: nls.h:48
#define LANG_SPANISH
Definition: nls.h:123
#define LANG_POLISH
Definition: nls.h:107
#define LANG_AZERI
Definition: nls.h:32
#define LANG_NEPALI
Definition: nls.h:101
#define LANG_SYRIAC
Definition: nls.h:126
#define LANG_GALICIAN
Definition: nls.h:60
#define LANG_INDONESIAN
Definition: nls.h:72
#define LANG_GERMAN
Definition: nls.h:62
#define LANG_ESTONIAN
Definition: nls.h:53
#define LANG_WALON
Definition: nls.h:162
#define LANG_HEBREW
Definition: nls.h:67
#define LANG_KANNADA
Definition: nls.h:77
#define LANG_ORIYA
Definition: nls.h:104
#define LANG_UKRAINIAN
Definition: nls.h:139
#define LANG_SUTU
Definition: nls.h:156
#define LANG_URDU
Definition: nls.h:141
#define LANG_BULGARIAN
Definition: nls.h:40
#define LANG_FINNISH
Definition: nls.h:57
#define LANG_XHOSA
Definition: nls.h:146
#define LANG_BELARUSIAN
Definition: nls.h:35
#define LANG_ROMANSH
Definition: nls.h:112
#define LANG_GEORGIAN
Definition: nls.h:61
#define LANG_GREEK
Definition: nls.h:63
#define LANG_TSWANA
Definition: nls.h:135
#define LANG_BASQUE
Definition: nls.h:34
#define LANG_MACEDONIAN
Definition: nls.h:91
#define LANG_ENGLISH
Definition: nls.h:52
#define LANGIDFROMLCID(l)
Definition: nls.h:18
#define LANG_ROMANIAN
Definition: nls.h:111
#define LANG_ZULU
Definition: nls.h:150
#define LANG_MALAY
Definition: nls.h:92
#define LANG_BENGALI
Definition: nls.h:36
#define LANG_DUTCH
Definition: nls.h:51
#define LANG_MANIPURI
Definition: nls.h:95
#define LANG_ESPERANTO
Definition: nls.h:161
#define LANG_RUSSIAN
Definition: nls.h:113
#define LANG_VIETNAMESE
Definition: nls.h:143
#define LANG_PUNJABI
Definition: nls.h:109
#define LANG_CZECH
Definition: nls.h:47
#define LANG_HUNGARIAN
Definition: nls.h:69
#define LANG_SWEDISH
Definition: nls.h:125
#define LANG_ARABIC
Definition: nls.h:29
#define LANG_UPPER_SORBIAN
Definition: nls.h:140
#define LANG_KYRGYZ
Definition: nls.h:85
#define LANG_CHINESE
Definition: nls.h:42
#define LANG_SERBIAN
Definition: nls.h:116
#define LANG_JAPANESE
Definition: nls.h:76
#define LANG_SAMI
Definition: nls.h:114
#define PRIMARYLANGID(l)
Definition: nls.h:16
#define LANG_DIVEHI
Definition: nls.h:50
#define LANG_LATVIAN
Definition: nls.h:87
#define LANG_BRETON
Definition: nls.h:39
#define LANG_ICELANDIC
Definition: nls.h:70
#define LANG_SINDHI
Definition: nls.h:118
#define LANG_SLOVAK
Definition: nls.h:120
#define LANG_KOREAN
Definition: nls.h:84
#define LANG_AFRIKAANS
Definition: nls.h:25
#define LANG_SLOVENIAN
Definition: nls.h:121
#define LANG_CORNISH
Definition: nls.h:163
#define LANG_GUJARATI
Definition: nls.h:65
#define LANG_WELSH
Definition: nls.h:144
#define LANG_MARATHI
Definition: nls.h:98
#define LANG_SWAHILI
Definition: nls.h:124
#define LANG_FRENCH
Definition: nls.h:58
#define LANG_UZBEK
Definition: nls.h:142
#define LANG_TELUGU
Definition: nls.h:131
#define LANG_ITALIAN
Definition: nls.h:75
#define LANG_ARMENIAN
Definition: nls.h:30
#define LANG_PORTUGUESE
Definition: nls.h:108
#define LANG_CATALAN
Definition: nls.h:41
#define LANG_KAZAK
Definition: nls.h:79
#define LANG_MONGOLIAN
Definition: nls.h:100
#define LANG_IRISH
Definition: nls.h:74
#define LANG_FAEROESE
Definition: nls.h:54
#define TRACE(s)
Definition: solgame.cpp:4
@ SYS_WIN16
Definition: widltypes.h:551
@ SYS_WIN32
Definition: widltypes.h:552
@ SYS_MAC
Definition: widltypes.h:553
#define LANG_MANX_GAELIC
Definition: winnt_old.h:420

Referenced by LHashValOfNameSys(), and WMSFT_compile_names().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( ole  )

Variable Documentation

◆ Lookup_112

const unsigned char Lookup_112[128 *3]
static

Definition at line 221 of file hash.c.

Referenced by lhash_val_of_name_sys(), and LHashValOfNameSysA().

◆ Lookup_128

const unsigned char Lookup_128[128 *3]
static

Definition at line 259 of file hash.c.

Referenced by lhash_val_of_name_sys(), and LHashValOfNameSysA().

◆ Lookup_144

const unsigned char Lookup_144[128 *3]
static

Definition at line 297 of file hash.c.

Referenced by lhash_val_of_name_sys(), and LHashValOfNameSysA().

◆ Lookup_16

const unsigned char Lookup_16[128 *3]
static

Definition at line 32 of file hash.c.

Referenced by lhash_val_of_name_sys(), and LHashValOfNameSysA().

◆ Lookup_160

const unsigned char Lookup_160[128 *3]
static

Definition at line 335 of file hash.c.

Referenced by lhash_val_of_name_sys(), and LHashValOfNameSysA().

◆ Lookup_176

const unsigned char Lookup_176[128 *3]
static

Definition at line 373 of file hash.c.

Referenced by lhash_val_of_name_sys(), and LHashValOfNameSysA().

◆ Lookup_208

const unsigned char Lookup_208[128 *3]
static

Definition at line 411 of file hash.c.

Referenced by lhash_val_of_name_sys(), and LHashValOfNameSysA().

◆ Lookup_224

const unsigned char Lookup_224[128 *3]
static

Definition at line 449 of file hash.c.

Referenced by lhash_val_of_name_sys(), and LHashValOfNameSysA().

◆ Lookup_32

const unsigned char Lookup_32[128 *3]
static

Definition at line 70 of file hash.c.

Referenced by lhash_val_of_name_sys(), and LHashValOfNameSysA().

◆ Lookup_48

const unsigned char Lookup_48[128 *3]
static

Definition at line 108 of file hash.c.

Referenced by lhash_val_of_name_sys(), and LHashValOfNameSysA().

◆ Lookup_64

const unsigned char Lookup_64[128 *3]
static

Definition at line 146 of file hash.c.

Referenced by lhash_val_of_name_sys(), and LHashValOfNameSysA().

◆ Lookup_80

const unsigned char Lookup_80[128 *3]
static

Definition at line 183 of file hash.c.

Referenced by lhash_val_of_name_sys(), and LHashValOfNameSysA().