Andrew Talbot : itss: Declare a function static.
Alexandre Julliard
julliard at wine.codeweavers.com
Wed Jan 10 15:47:33 CST 2007
Module: wine
Branch: master
Commit: 852ae99662f3f7e6cbb050936c270991ea725f7d
URL: http://source.winehq.org/git/wine.git/?a=commit;h=852ae99662f3f7e6cbb050936c270991ea725f7d
Author: Andrew Talbot <Andrew.Talbot at talbotville.com>
Date: Wed Jan 10 15:22:39 2007 +0000
itss: Declare a function static.
---
dlls/itss/chm_lib.c | 147 ++++++++++++++++++++++++++-------------------------
dlls/itss/chm_lib.h | 6 --
2 files changed, 74 insertions(+), 79 deletions(-)
diff --git a/dlls/itss/chm_lib.c b/dlls/itss/chm_lib.c
index 33420e5..438bbe4 100644
--- a/dlls/itss/chm_lib.c
+++ b/dlls/itss/chm_lib.c
@@ -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 chm
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
*/
diff --git a/dlls/itss/chm_lib.h b/dlls/itss/chm_lib.h
index 57b75d8..0413fe3 100644
--- a/dlls/itss/chm_lib.h
+++ b/dlls/itss/chm_lib.h
@@ -68,12 +68,6 @@ struct chmFile* chm_openW(const WCHAR *f
/* 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)
More information about the wine-cvs
mailing list