Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
bf4dc2e1
Commit
bf4dc2e1
authored
Mar 15, 2005
by
Phil Krylov
Committed by
Alexandre Julliard
Mar 15, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implemented hash table lookup for RTF keywords in RTF reader.
parent
300240bf
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
2 deletions
+32
-2
reader.c
dlls/riched20/reader.c
+31
-2
rtf.h
dlls/riched20/rtf.h
+1
-0
No files found.
dlls/riched20/reader.c
View file @
bf4dc2e1
...
...
@@ -3274,6 +3274,14 @@ static RTFKey rtfKey[] =
{
0
,
-
1
,
(
char
*
)
NULL
,
0
}
};
#define RTF_KEY_COUNT (sizeof(rtfKey) / sizeof(RTFKey))
typedef
struct
tagRTFHashTableEntry
{
int
count
;
RTFKey
**
value
;
}
RTFHashTableEntry
;
static
RTFHashTableEntry
rtfHashTable
[
RTF_KEY_COUNT
];
/*
...
...
@@ -3287,8 +3295,18 @@ static void LookupInit(void)
if
(
inited
==
0
)
{
for
(
rp
=
rtfKey
;
rp
->
rtfKStr
!=
(
char
*
)
NULL
;
rp
++
)
memset
(
rtfHashTable
,
0
,
RTF_KEY_COUNT
*
sizeof
(
*
rtfHashTable
));
for
(
rp
=
rtfKey
;
rp
->
rtfKStr
!=
(
char
*
)
NULL
;
rp
++
)
{
int
index
;
rp
->
rtfKHash
=
Hash
((
char
*
)
rp
->
rtfKStr
);
index
=
rp
->
rtfKHash
%
RTF_KEY_COUNT
;
if
(
!
rtfHashTable
[
index
].
count
)
rtfHashTable
[
index
].
value
=
(
void
*
)
RTFAlloc
(
sizeof
(
RTFKey
*
));
else
rtfHashTable
[
index
].
value
=
(
void
*
)
RTFReAlloc
((
void
*
)
rtfHashTable
[
index
].
value
,
sizeof
(
RTFKey
*
)
*
(
rtfHashTable
[
index
].
count
+
1
));
rtfHashTable
[
index
].
value
[
rtfHashTable
[
index
].
count
++
]
=
rp
;
}
++
inited
;
}
}
...
...
@@ -3303,12 +3321,16 @@ static void Lookup(RTF_Info *info, char *s)
{
RTFKey
*
rp
;
int
hash
;
RTFHashTableEntry
*
entry
;
int
i
;
TRACE
(
"
\n
"
);
++
s
;
/* skip over the leading \ character */
hash
=
Hash
(
s
);
for
(
rp
=
rtfKey
;
rp
->
rtfKStr
!=
(
char
*
)
NULL
;
rp
++
)
entry
=
&
rtfHashTable
[
hash
%
RTF_KEY_COUNT
];
for
(
i
=
0
;
i
<
entry
->
count
;
i
++
)
{
rp
=
entry
->
value
[
i
];
if
(
hash
==
rp
->
rtfKHash
&&
strcmp
(
s
,
rp
->
rtfKStr
)
==
0
)
{
info
->
rtfClass
=
rtfControl
;
...
...
@@ -3358,6 +3380,13 @@ char *_RTFAlloc(int size)
}
char
*
RTFReAlloc
(
char
*
ptr
,
int
size
)
{
return
HeapReAlloc
(
me_heap
,
0
,
ptr
,
size
);
}
/*
* Saves a string on the heap and returns a pointer to it.
*/
...
...
dlls/riched20/rtf.h
View file @
bf4dc2e1
...
...
@@ -1533,6 +1533,7 @@ RTFColor *RTFGetColor (RTF_Info *, int);
RTFStyle
*
RTFGetStyle
(
RTF_Info
*
,
int
);
# define RTFAlloc(size) _RTFAlloc ((int) size)
char
*
_RTFAlloc
(
int
);
char
*
RTFReAlloc
(
char
*
ptr
,
int
size
);
char
*
RTFStrSave
(
char
*
);
void
RTFFree
(
char
*
);
int
RTFCharToHex
(
char
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment