* help.c (search_string): Fixed a warning about a const qualifier.
A local copy of the string is used for modifying. * menu.h: Removed the const qualifier from Menu.name and Menu.help_node as they are freed in destroy_menu. * menu.c (destroy_menu): Removed the (now unnecessary) casts. * popt.h: Removed a const qualifier to avoid compiler warnings. * profile.c (get_profile_string): Added const qualifiers to avoid compiler warnings. (GetSetProfile): likewise. (GetSetProfileChar): likewise. * profile.h (get_profile_string): likewise. * win.c (check_movement_keys): likewise. * win.h (check_movement_keys): likewise.
Этот коммит содержится в:
родитель
312da833ff
Коммит
2994c738d0
@ -1,3 +1,18 @@
|
||||
2004-09-18 Roland Illig <roland.illig@gmx.de>
|
||||
|
||||
* help.c (search_string): Fixed a warning about a const qualifier.
|
||||
A local copy of the string is used for modifying.
|
||||
* menu.h: Removed the const qualifier from Menu.name and
|
||||
Menu.help_node as they are freed in destroy_menu.
|
||||
* menu.c (destroy_menu): Removed the (now unnecessary) casts.
|
||||
* popt.h: Removed a const qualifier to avoid compiler warnings.
|
||||
* profile.c (get_profile_string): Added const qualifiers to
|
||||
avoid compiler warnings. (GetSetProfile): likewise.
|
||||
(GetSetProfileChar): likewise.
|
||||
* profile.h (get_profile_string): likewise.
|
||||
* win.c (check_movement_keys): likewise.
|
||||
* win.h (check_movement_keys): likewise.
|
||||
|
||||
2004-09-17 Pavel Shirshov <pavelsh@mail.ru>
|
||||
|
||||
* ext.c (get_file_type_local): Fixes <zombies> in
|
||||
|
21
src/help.c
21
src/help.c
@ -125,12 +125,13 @@ static int acs2pc (int acscode)
|
||||
/* returns the position where text was found in the start buffer */
|
||||
/* or 0 if not found */
|
||||
static const char *
|
||||
search_string (const char *start, char *text)
|
||||
search_string (const char *start, const char *text)
|
||||
{
|
||||
char *d = text;
|
||||
const char *result = NULL;
|
||||
char *local_text = g_strdup (text);
|
||||
char *d = local_text;
|
||||
const char *e = start;
|
||||
|
||||
/* FIXME: correct this bug elsewhere, not in this function */
|
||||
/* fmt sometimes replaces a space with a newline in the help file */
|
||||
/* Replace the newlines in the link name with spaces to correct the situation */
|
||||
while (*d){
|
||||
@ -139,15 +140,19 @@ search_string (const char *start, char *text)
|
||||
d++;
|
||||
}
|
||||
/* Do search */
|
||||
for (d = text; *e; e++){
|
||||
for (d = local_text; *e; e++){
|
||||
if (*d == *e)
|
||||
d++;
|
||||
else
|
||||
d = text;
|
||||
if (!*d)
|
||||
return e+1;
|
||||
d = local_text;
|
||||
if (!*d) {
|
||||
result = e + 1;
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
cleanup:
|
||||
g_free (local_text);
|
||||
return result;
|
||||
}
|
||||
|
||||
/* Searches text in the buffer pointed by start. Search ends */
|
||||
|
@ -526,8 +526,8 @@ menubar_arrange(WMenu* menubar)
|
||||
void
|
||||
destroy_menu (Menu *menu)
|
||||
{
|
||||
g_free ((char *) menu->name);
|
||||
g_free ((char *) menu->help_node);
|
||||
g_free (menu->name);
|
||||
g_free (menu->help_node);
|
||||
g_free (menu);
|
||||
}
|
||||
|
||||
|
@ -13,14 +13,14 @@ typedef struct {
|
||||
} menu_entry;
|
||||
|
||||
typedef struct Menu {
|
||||
const char *name;
|
||||
char *name;
|
||||
int count;
|
||||
int max_entry_len;
|
||||
int selected;
|
||||
int hotkey;
|
||||
menu_entry *entries;
|
||||
int start_x; /* position relative to menubar start */
|
||||
const char *help_node;
|
||||
char *help_node;
|
||||
} Menu;
|
||||
|
||||
extern int menubar_visible;
|
||||
|
@ -57,7 +57,7 @@ struct poptOption {
|
||||
int argInfo;
|
||||
void * arg; /* depends on argInfo */
|
||||
int val; /* 0 means don't return, just update flag */
|
||||
const char * descrip; /* description for autohelp -- may be NULL */
|
||||
char * descrip; /* description for autohelp -- may be NULL */
|
||||
const char * argDescrip; /* argument description for autohelp */
|
||||
};
|
||||
|
||||
|
@ -266,7 +266,7 @@ static void new_key (TSecHeader *section, const char *KeyName, const char *Value
|
||||
section->Keys = key;
|
||||
}
|
||||
|
||||
static char *
|
||||
static const char *
|
||||
GetSetProfileChar (int set, const char *AppName, const char *KeyName,
|
||||
const char *Default, const char *FileName)
|
||||
{
|
||||
@ -324,7 +324,7 @@ static short GetSetProfile (int set, const char * AppName, const char * KeyName,
|
||||
short Size, const char * FileName)
|
||||
|
||||
{
|
||||
char *s;
|
||||
const char *s;
|
||||
|
||||
s = GetSetProfileChar (set, AppName, KeyName, Default, FileName);
|
||||
if (!set)
|
||||
@ -340,7 +340,7 @@ short GetPrivateProfileString (const char * AppName, const char * KeyName,
|
||||
return (GetSetProfile (0, AppName, KeyName, Default, ReturnedString, Size, FileName));
|
||||
}
|
||||
|
||||
char *get_profile_string (const char *AppName, const char *KeyName, const char *Default,
|
||||
const char *get_profile_string (const char *AppName, const char *KeyName, const char *Default,
|
||||
const char *FileName)
|
||||
{
|
||||
return GetSetProfileChar (0, AppName, KeyName, Default, FileName);
|
||||
|
@ -22,7 +22,7 @@ int WriteProfileString (const char * AppName, const char * KeyName, const char *
|
||||
void sync_profiles (void);
|
||||
|
||||
void free_profiles (void);
|
||||
char *get_profile_string (const char *AppName, const char *KeyName, const char *Default,
|
||||
const char *get_profile_string (const char *AppName, const char *KeyName, const char *Default,
|
||||
const char *FileName);
|
||||
|
||||
/* New profile functions */
|
||||
|
@ -39,7 +39,7 @@
|
||||
* the key was handled, 0 otherwise.
|
||||
*/
|
||||
int
|
||||
check_movement_keys (int key, int page_size, void *data, movefn backfn,
|
||||
check_movement_keys (int key, int page_size, const void *data, movefn backfn,
|
||||
movefn forfn, movefn topfn, movefn bottomfn)
|
||||
{
|
||||
switch (key) {
|
||||
|
@ -2,8 +2,8 @@
|
||||
#define __WIN_H
|
||||
|
||||
/* Keys management */
|
||||
typedef void (*movefn) (void *, int);
|
||||
int check_movement_keys (int key, int page_size, void *data, movefn backfn,
|
||||
typedef void (*movefn) (const void *, int);
|
||||
int check_movement_keys (int key, int page_size, const void *data, movefn backfn,
|
||||
movefn forfn, movefn topfn, movefn bottomfn);
|
||||
int lookup_key (char *keyname);
|
||||
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user