ReactOS 0.4.17-dev-573-g8315b8c
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 600 of file hash.c.

601{
602 LPSTR strA;
603 ULONG res;
604 INT len;
605
606 if (!str) return 0;
607 len = WideCharToMultiByte( CP_ACP, 0, str, -1, NULL, 0, NULL, NULL );
608 strA = malloc(len);
610 res = LHashValOfNameSysA(skind, lcid, strA);
611 free(strA);
612 return res;
613}
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
#define NULL
Definition: types.h:112
#define CP_ACP
Definition: compat.h:109
#define WideCharToMultiByte
Definition: compat.h:111
LCID lcid
Definition: locale.c:5660
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:2215
const WCHAR * str
char * LPSTR
Definition: typedefs.h:51
int32_t INT
Definition: typedefs.h:58
uint32_t ULONG
Definition: typedefs.h:59

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, %#lx, %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
519
521 {
522 default:
523 nOffset = 16;
524 pnLookup = Lookup_16;
525 break;
526 case LANG_CZECH: case LANG_HUNGARIAN: case LANG_POLISH:
527 case LANG_SLOVAK: case LANG_SPANISH:
528 nOffset = 32;
529 pnLookup = Lookup_32;
530 break;
531 case LANG_HEBREW:
532 nOffset = 48;
533 pnLookup = Lookup_48;
534 break;
535 case LANG_JAPANESE:
536 nOffset = 64;
537 pnLookup = Lookup_64;
538 break;
539 case LANG_KOREAN:
540 nOffset = 80;
541 pnLookup = Lookup_80;
542 break;
543 case LANG_CHINESE:
544 nOffset = 112;
545 pnLookup = Lookup_112;
546 break;
547 case LANG_GREEK:
548 nOffset = 128;
549 pnLookup = Lookup_128;
550 break;
551 case LANG_ICELANDIC:
552 nOffset = 144;
553 pnLookup = Lookup_144;
554 break;
555 case LANG_TURKISH:
556 nOffset = 160;
557 pnLookup = Lookup_160;
558 break;
559 case LANG_NORWEGIAN:
561 {
562 nOffset = 176;
563 pnLookup = Lookup_176;
564 }
565 else
566 {
567 nOffset = 16;
568 pnLookup = Lookup_16;
569 }
570 break;
571 case LANG_ARABIC:
572 case LANG_FARSI:
573 nOffset = 208;
574 pnLookup = Lookup_208;
575 break;
576 case LANG_RUSSIAN:
577 nOffset = 224;
578 pnLookup = Lookup_224;
579 break;
580 }
581
582 nHiWord = (nOffset | nMask) << 16;
583
584 while (*str)
585 {
586 nLoWord = 37 * nLoWord + pnLookup[*str > 0x7f && nMask ? *str + 0x80 : *str];
587 str++;
588 }
589 /* Constrain to a prime modulo and sizeof(WORD) */
590 nLoWord = (nLoWord % 65599) & 0xffff;
591
592 return nHiWord | nLoWord;
593}
LCID WINAPI ConvertDefaultLocale(LCID lcid)
Definition: locale.c:2879
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 SUBLANG_NORWEGIAN_NYNORSK
Definition: nls.h:301
#define LANG_FARSI
Definition: nls.h:55
#define LANG_NORWEGIAN
Definition: nls.h:102
#define SUBLANGID(l)
Definition: nls.h:17
#define LANG_TURKISH
Definition: nls.h:136
#define LANG_SPANISH
Definition: nls.h:123
#define LANG_POLISH
Definition: nls.h:107
#define LANG_HEBREW
Definition: nls.h:67
#define LANG_GREEK
Definition: nls.h:63
#define LANGIDFROMLCID(l)
Definition: nls.h:18
#define LANG_RUSSIAN
Definition: nls.h:113
#define LANG_CZECH
Definition: nls.h:47
#define LANG_HUNGARIAN
Definition: nls.h:69
#define LANG_ARABIC
Definition: nls.h:29
#define LANG_CHINESE
Definition: nls.h:42
#define LANG_JAPANESE
Definition: nls.h:76
#define PRIMARYLANGID(l)
Definition: nls.h:16
#define LANG_ICELANDIC
Definition: nls.h:70
#define LANG_SLOVAK
Definition: nls.h:120
#define LANG_KOREAN
Definition: nls.h:84
#define TRACE(s)
Definition: solgame.cpp:4
@ SYS_WIN16
Definition: widltypes.h:646
@ SYS_WIN32
Definition: widltypes.h:647
@ SYS_MAC
Definition: widltypes.h:648

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().