Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
852ae996
Commit
852ae996
authored
Jan 10, 2007
by
Andrew Talbot
Committed by
Alexandre Julliard
Jan 10, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
itss: Declare a function static.
parent
39e6c8c9
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
74 additions
and
79 deletions
+74
-79
chm_lib.c
dlls/itss/chm_lib.c
+74
-73
chm_lib.h
dlls/itss/chm_lib.h
+0
-6
No files found.
dlls/itss/chm_lib.c
View file @
852ae996
...
...
@@ -76,6 +76,7 @@
#ifndef CHM_MAX_BLOCKS_CACHED
#define CHM_MAX_BLOCKS_CACHED 5
#endif
#define CHM_PARAM_MAX_BLOCKS_CACHED 0
/*
* architecture specific defines
...
...
@@ -599,6 +600,79 @@ static Int64 _chm_fetch_bytes(struct chmFile *h,
return
readLen
;
}
/*
* set a parameter on the file handle.
* valid parameter types:
* CHM_PARAM_MAX_BLOCKS_CACHED:
* how many decompressed blocks should be cached? A simple
* caching scheme is used, wherein the index of the block is
* used as a hash value, and hash collision results in the
* invalidation of the previously cached block.
*/
static
void
chm_set_param
(
struct
chmFile
*
h
,
int
paramType
,
int
paramVal
)
{
switch
(
paramType
)
{
case
CHM_PARAM_MAX_BLOCKS_CACHED
:
CHM_ACQUIRE_LOCK
(
h
->
cache_mutex
);
if
(
paramVal
!=
h
->
cache_num_blocks
)
{
UChar
**
newBlocks
;
Int64
*
newIndices
;
int
i
;
/* allocate new cached blocks */
newBlocks
=
malloc
(
paramVal
*
sizeof
(
UChar
*
));
newIndices
=
malloc
(
paramVal
*
sizeof
(
UInt64
));
for
(
i
=
0
;
i
<
paramVal
;
i
++
)
{
newBlocks
[
i
]
=
NULL
;
newIndices
[
i
]
=
0
;
}
/* re-distribute old cached blocks */
if
(
h
->
cache_blocks
)
{
for
(
i
=
0
;
i
<
h
->
cache_num_blocks
;
i
++
)
{
int
newSlot
=
(
int
)(
h
->
cache_block_indices
[
i
]
%
paramVal
);
if
(
h
->
cache_blocks
[
i
])
{
/* in case of collision, destroy newcomer */
if
(
newBlocks
[
newSlot
])
{
free
(
h
->
cache_blocks
[
i
]);
h
->
cache_blocks
[
i
]
=
NULL
;
}
else
{
newBlocks
[
newSlot
]
=
h
->
cache_blocks
[
i
];
newIndices
[
newSlot
]
=
h
->
cache_block_indices
[
i
];
}
}
}
free
(
h
->
cache_blocks
);
free
(
h
->
cache_block_indices
);
}
/* now, set new values */
h
->
cache_blocks
=
newBlocks
;
h
->
cache_block_indices
=
newIndices
;
h
->
cache_num_blocks
=
paramVal
;
}
CHM_RELEASE_LOCK
(
h
->
cache_mutex
);
break
;
default:
break
;
}
}
/* open an ITS archive */
struct
chmFile
*
chm_openW
(
const
WCHAR
*
filename
)
{
...
...
@@ -813,79 +887,6 @@ void chm_close(struct chmFile *h)
}
/*
* set a parameter on the file handle.
* valid parameter types:
* CHM_PARAM_MAX_BLOCKS_CACHED:
* how many decompressed blocks should be cached? A simple
* caching scheme is used, wherein the index of the block is
* used as a hash value, and hash collision results in the
* invalidation of the previously cached block.
*/
void
chm_set_param
(
struct
chmFile
*
h
,
int
paramType
,
int
paramVal
)
{
switch
(
paramType
)
{
case
CHM_PARAM_MAX_BLOCKS_CACHED
:
CHM_ACQUIRE_LOCK
(
h
->
cache_mutex
);
if
(
paramVal
!=
h
->
cache_num_blocks
)
{
UChar
**
newBlocks
;
Int64
*
newIndices
;
int
i
;
/* allocate new cached blocks */
newBlocks
=
malloc
(
paramVal
*
sizeof
(
UChar
*
));
newIndices
=
malloc
(
paramVal
*
sizeof
(
UInt64
));
for
(
i
=
0
;
i
<
paramVal
;
i
++
)
{
newBlocks
[
i
]
=
NULL
;
newIndices
[
i
]
=
0
;
}
/* re-distribute old cached blocks */
if
(
h
->
cache_blocks
)
{
for
(
i
=
0
;
i
<
h
->
cache_num_blocks
;
i
++
)
{
int
newSlot
=
(
int
)(
h
->
cache_block_indices
[
i
]
%
paramVal
);
if
(
h
->
cache_blocks
[
i
])
{
/* in case of collision, destroy newcomer */
if
(
newBlocks
[
newSlot
])
{
free
(
h
->
cache_blocks
[
i
]);
h
->
cache_blocks
[
i
]
=
NULL
;
}
else
{
newBlocks
[
newSlot
]
=
h
->
cache_blocks
[
i
];
newIndices
[
newSlot
]
=
h
->
cache_block_indices
[
i
];
}
}
}
free
(
h
->
cache_blocks
);
free
(
h
->
cache_block_indices
);
}
/* now, set new values */
h
->
cache_blocks
=
newBlocks
;
h
->
cache_block_indices
=
newIndices
;
h
->
cache_num_blocks
=
paramVal
;
}
CHM_RELEASE_LOCK
(
h
->
cache_mutex
);
break
;
default:
break
;
}
}
/*
* helper methods for chm_resolve_object
*/
...
...
dlls/itss/chm_lib.h
View file @
852ae996
...
...
@@ -68,12 +68,6 @@ struct chmFile* chm_openW(const WCHAR *filename);
/* close an ITS archive */
void
chm_close
(
struct
chmFile
*
h
);
/* methods for ssetting tuning parameters for particular file */
#define CHM_PARAM_MAX_BLOCKS_CACHED 0
void
chm_set_param
(
struct
chmFile
*
h
,
int
paramType
,
int
paramVal
);
/* resolve a particular object from the archive */
#define CHM_RESOLVE_SUCCESS (0)
#define CHM_RESOLVE_FAILURE (1)
...
...
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