Commits

Shlomi Fish committed 870fea8

More -ansi -pedantic fixes.

git-svn-id: file:///home/shlomif/Backup/svn-dumps/google-code/svnsync-repos/fc-solve/trunk@539 e7e8a897-7ba4-4ee7-b36f-f4c66519b19a

  • Participants
  • Parent commits 1471805

Comments (0)

Files changed (7)

File fc-solve/source/caas.c

             instance->stacks_hash,
             new_state->s.stacks[a],
             freecell_solver_lookup2_hash_function(
-                new_state->s.stacks[a],
+                (ub1 *)new_state->s.stacks[a],
                 (fcs_stack_len(new_state->s, a)+1),
                 24
                 ),

File fc-solve/source/cmd_line.c

 #include "dmalloc.h"
 #endif
 
-static int read_preset(char * preset_name, args_man_t * * args, char * * opened_files_dir_to_assign, char * user_preset_dir)
+static int read_preset(const char * preset_name, args_man_t * * args, char * * opened_files_dir_to_assign, const char * user_preset_dir)
 {
     int ret_code = 1;
-    char * home_dir_presetrc = NULL, * global_presetrc = NULL, * env_var_presetrc = NULL;
-    char * path;
-    char * * presetrc_pathes[5] = {&env_var_presetrc, &home_dir_presetrc, &global_presetrc, &user_preset_dir, NULL};
+    const char * global_presetrc = NULL, * env_var_presetrc = NULL;
+    char * home_dir_presetrc = NULL;
+    const char * path;
+    const char * * presetrc_pathes[5];
     int path_idx;
     char line[8192];
     FILE * f = NULL;
     char * fgets_ret;
     char * opened_files_dir = NULL;
     int read_next_preset = 0;
+    int i=0;
+
+    presetrc_pathes[i++] = &env_var_presetrc;
+    presetrc_pathes[i++] = (const char * *)&home_dir_presetrc;
+    presetrc_pathes[i++] = &global_presetrc;
+    presetrc_pathes[i++] = &user_preset_dir;
+    presetrc_pathes[i++] = NULL;
 
     {
         char * home_dir;
 int freecell_solver_user_cmd_line_parse_args_with_file_nesting_count(
     void * instance,
     int argc,
-    char * argv[],
+    const char * argv[],
     int start_arg,
-    char * * known_parameters,
+    const char * * known_parameters,
     freecell_solver_user_cmd_line_known_commands_callback_t callback,
     void * callback_context,
     char * * error_string,
     )
 {
     int arg;
-    char * * known_param;
+    const char * * known_param;
     int num_to_skip;
     int callback_ret;
     int ret;
             }
             {
                 int a;
-                char * start_num;
-                char * end_num;
+                const char * start_num;
+                const char * end_num;
                 char save;
                 start_num = argv[arg];
                 for(a=0;a<5;a++)

File fc-solve/source/fcs_cl.h

     (
      void * instance,
      int argc,
-     char * argv[],
+     const char * argv[],
      int arg_index,
      int * num_to_skip,
      int * ret,
     FCS_CMD_LINE_PARAM_WITH_NO_ARG,
     FCS_CMD_LINE_ERROR_IN_ARG,
 
-    FCS_CMD_LINE_USER = 0x10000,
+    FCS_CMD_LINE_USER = 0x10000
 };
 
 extern int freecell_solver_user_cmd_line_parse_args(
     void * instance,
     int argc,
-    char * argv[],
+    const char * argv[],
     int start_arg,
-    char * * known_parameters,
+    const char * * known_parameters,
     freecell_solver_user_cmd_line_known_commands_callback_t callback,
     void * callback_context,
     char * * error_string,
 extern int freecell_solver_user_cmd_line_parse_args_with_file_nesting_count(
     void * instance,
     int argc,
-    char * argv[],
+    const char * argv[],
     int start_arg,
-    char * * known_parameters,
+    const char * * known_parameters,
     freecell_solver_user_cmd_line_known_commands_callback_t callback,
     void * callback_context,
     char * * error_string,

File fc-solve/source/fcs_user.h

 
 extern int freecell_solver_user_set_a_star_weight(
     void * user_instance,
-    int index,
+    int weight_index,
     double weight
     );
 

File fc-solve/source/main.c

 
 struct help_screen_struct
 {
-    char * key;
-    char * screen;
+    const char * key;
+    const char * screen;
 };
 
 typedef struct help_screen_struct help_screen_t;
 
 enum MY_FCS_CMD_LINE_RET_VALUES
 {
-    EXIT_AND_RETURN_0 = FCS_CMD_LINE_USER,
-
+    EXIT_AND_RETURN_0 = FCS_CMD_LINE_USER
 };
 
-static void print_help_string(char * key)
+static void print_help_string(const char * key)
 {
     int i;
     for(i=0;help_screens[i].key != NULL ; i++)
 
     if ((!strcmp(argv[arg], "-h")) || (!strcmp(argv[arg], "--help")))
     {
-        char * help_key;
+        const char * help_key;
         
         help_key = getenv("FREECELL_SOLVER_DEFAULT_HELP");
         if (help_key == NULL)
 }
 
 
-static char * known_parameters[] = {
+static const char * known_parameters[] = {
     "-h", "--help",
         "--help-configs", "--help-options", "--help-problems", 
         "--help-real-help", "--help-short-sol", "--help-summary",
     current_instance = instance;
 
 
+    error_string = NULL;
+    
     parser_ret =
         freecell_solver_user_cmd_line_parse_args(
             instance,
             argc,
-            argv,
+            (const char * *)argv,
             1,
             known_parameters,
             cmd_line_callback,
 
     if (ret == FCS_STATE_INVALID_STATE)
     {
-        char * error_string;
         error_string =
             freecell_solver_user_get_invalid_state_error_string(
                 instance,

File fc-solve/source/rand.h

 typedef struct fcs_rand_struct fcs_rand_t;
 
 extern fcs_rand_t * freecell_solver_rand_alloc(unsigned int seed);
-extern void freecell_solver_rand_free(fcs_rand_t * rand);
+extern void freecell_solver_rand_free(fcs_rand_t *);
 
-extern void freecell_solver_rand_srand(fcs_rand_t * rand, int seed);
+extern void freecell_solver_rand_srand(fcs_rand_t *, int seed);
 
-static GCC_INLINE int freecell_solver_rand_rand15(fcs_rand_t * rand)
+static GCC_INLINE int freecell_solver_rand_rand15(fcs_rand_t * self)
 {
-    rand->seed = (rand->seed * 214013 + 2531011);
-    return (rand->seed >> 16) & 0x7fff;
+    self->seed = (self->seed * 214013 + 2531011);
+    return (self->seed >> 16) & 0x7fff;
 }
 
 /*
  * 15-bit ones.
  *
  * */
-static GCC_INLINE int freecell_solver_rand_get_random_number(fcs_rand_t * rand)
+static GCC_INLINE int freecell_solver_rand_get_random_number(fcs_rand_t * self)
 {
     int one, two;
-    one = freecell_solver_rand_rand15(rand);
-    two = freecell_solver_rand_rand15(rand);
+    one = freecell_solver_rand_rand15(self);
+    two = freecell_solver_rand_rand15(self);
 
     return (one | (two << 15));
 }

File fc-solve/source/state.h

     FCS_VISITED_IN_SOLUTION_PATH = 0x2,
     FCS_VISITED_IN_OPTIMIZED_PATH = 0x4,
     FCS_VISITED_DEAD_END = 0x8,
-    FCS_VISITED_ALL_TESTS_DONE = 0x10,
+    FCS_VISITED_ALL_TESTS_DONE = 0x10
 };