Previous 15994 Revisions Next

r2468 Friday 25th April, 2008 at 12:12:41 UTC by Nathan Woods
Cleanups related to coding standards
[src/mess]hashfile.c hashfile.h image.c
[src/mess/osd/winui]softwarepicker.c

src/mess/image.c
r2467r2468
11921192static int read_hash_config(const char *sysname, image_slot_data *image)
11931193{
11941194   hash_file *hashfile = NULL;
1195   const struct hash_info *info = NULL;
1195   const hash_info *info = NULL;
11961196
11971197   /* open the hash file */
11981198   hashfile = hashfile_open(sysname, FALSE, NULL);
src/mess/osd/winui/softwarepicker.c
r2467r2468
4343   // hash information
4444   char szHash[HASH_BUF_SIZE];
4545   BOOL bHashRealized;
46   const struct hash_info *pHashInfo;
46   const hash_info *pHashInfo;
4747
4848   LPCSTR pszZipEntryName;
4949   LPCSTR pszSubName;
src/mess/hashfile.c
r2467r2468
2222   object_pool *pool;
2323   unsigned int functions[IO_COUNT];
2424
25   struct hash_info **preloaded_hashes;
25   hash_info **preloaded_hashes;
2626   int preloaded_hash_count;
2727
2828   void (*error_proc)(const char *message);
r2467r2468
4646   int done;
4747
4848   int (*selector_proc)(hash_file *hashfile, void *param, const char *name, const char *hash);
49   void (*use_proc)(hash_file *hashfile, void *param, struct hash_info *hi);
49   void (*use_proc)(hash_file *hashfile, void *param, hash_info *hi);
5050   void (*error_proc)(const char *message);
5151   void *param;
5252
5353   enum hash_parse_position pos;
5454   char **text_dest;
55   struct hash_info *hi;
55   hash_info *hi;
5656};
5757
5858
r2467r2468
122122{
123123   struct hash_parse_state *state = (struct hash_parse_state *) data;
124124   const char *name;
125   struct hash_info *hi;
125   hash_info *hi;
126126   char **text_dest;
127127   char hash_string[HASH_BUF_SIZE];
128128   unsigned int functions, all_functions;
r2467r2468
207207         /* do we use this hash? */
208208         if (!state->selector_proc || state->selector_proc(state->hashfile, state->param, name, hash_string))
209209         {
210            hi = pool_malloc(state->hashfile->pool, sizeof(struct hash_info));
210            hi = pool_malloc(state->hashfile->pool, sizeof(hash_info));
211211            if (!hi)
212212               return;
213213            memset(hi, 0, sizeof(*hi));
r2467r2468
296296
297297static void hashfile_parse(hash_file *hashfile,
298298   int (*selector_proc)(hash_file *hashfile, void *param, const char *name, const char *hash),
299   void (*use_proc)(hash_file *hashfile, void *param, struct hash_info *hi),
299   void (*use_proc)(hash_file *hashfile, void *param, hash_info *hi),
300300   void (*error_proc)(const char *message),
301301   void *param)
302302{
r2467r2468
349349
350350/* ----------------------------------------------------------------------- */
351351
352static void preload_use_proc(hash_file *hashfile, void *param, struct hash_info *hi)
352static void preload_use_proc(hash_file *hashfile, void *param, hash_info *hi)
353353{
354   struct hash_info **new_preloaded_hashes;
354   hash_info **new_preloaded_hashes;
355355
356356   new_preloaded_hashes = pool_realloc(hashfile->pool, hashfile->preloaded_hashes,
357357      (hashfile->preloaded_hash_count + 1) * sizeof(*new_preloaded_hashes));
r2467r2468
428428struct hashlookup_params
429429{
430430   const char *hash;
431   struct hash_info *hi;
431   hash_info *hi;
432432};
433433
434434
r2467r2468
442442
443443
444444
445static void singular_use_proc(hash_file *hashfile, void *param, struct hash_info *hi)
445static void singular_use_proc(hash_file *hashfile, void *param, hash_info *hi)
446446{
447447   struct hashlookup_params *hlparams = (struct hashlookup_params *) param;
448448   hlparams->hi = hi;
r2467r2468
450450
451451
452452
453const struct hash_info *hashfile_lookup(hash_file *hashfile, const char *hash)
453const hash_info *hashfile_lookup(hash_file *hashfile, const char *hash)
454454{
455455   struct hashlookup_params param;
456456   int i;
src/mess/hashfile.h
r2467r2468
66
77*********************************************************************/
88
9#ifndef HASHFILE_H
10#define HASHFILE_H
9#ifndef __HASHFILE_H__
10#define __HASHFILE_H__
1111
1212#include "driver.h"
1313#include "hash.h"
1414
1515
16struct hash_info
16/***************************************************************************
17    TYPE DEFINITIONS
18***************************************************************************/
19
20typedef struct _hash_info hash_info;
21struct _hash_info
1722{
1823   char hash[HASH_BUF_SIZE];
1924   const char *longname;
r2467r2468
2631typedef struct _hash_file hash_file;
2732
2833
34
35/***************************************************************************
36    FUNCTION PROTOTYPES
37***************************************************************************/
38
2939/* opens a hash file; if is_preload is non-zero, the entire file is preloaded */
3040hash_file *hashfile_open(const char *sysname, int is_preload,
3141   void (*error_proc)(const char *message));
r2467r2468
3848void hashfile_close(hash_file *hashfile);
3949
4050/* looks up information in a hash file */
41const struct hash_info *hashfile_lookup(hash_file *hashfile, const char *hash);
51const hash_info *hashfile_lookup(hash_file *hashfile, const char *hash);
4252
4353/* performs a syntax check on a hash file */
4454int hashfile_verify(const char *sysname, void (*error_proc)(const char *message));
r2467r2468
4757unsigned int hashfile_functions_used(hash_file *hashfile, iodevice_t devtype);
4858
4959
50#endif /* HASHFILE_H */
60#endif /* __HASHFILE_H__ */

Previous 15994 Revisions Next


© 1998-2018 The MESS Team