summaryrefslogtreecommitdiff
path: root/navit
diff options
context:
space:
mode:
Diffstat (limited to 'navit')
-rw-r--r--navit/gui.c2
-rw-r--r--navit/gui.h4
-rw-r--r--navit/gui/gtk/datawindow.c2
-rw-r--r--navit/gui/gtk/gui_gtk.h2
-rw-r--r--navit/gui/gtk/gui_gtk_statusbar.c6
-rw-r--r--navit/messages.c2
-rw-r--r--navit/messages.h2
-rw-r--r--navit/navigation.c6
-rw-r--r--navit/navit.c4
-rw-r--r--navit/navit.h4
-rw-r--r--navit/param.c21
-rw-r--r--navit/param.h12
12 files changed, 36 insertions, 31 deletions
diff --git a/navit/gui.c b/navit/gui.c
index b0835a364..340e3db2d 100644
--- a/navit/gui.c
+++ b/navit/gui.c
@@ -127,7 +127,7 @@ gui_popup_new(struct gui *gui)
}
struct datawindow *
-gui_datawindow_new(struct gui *gui, char *name, struct callback *click, struct callback *close)
+gui_datawindow_new(struct gui *gui, const char *name, struct callback *click, struct callback *close)
{
struct datawindow *this_;
if (! gui->meth.datawindow_new)
diff --git a/navit/gui.h b/navit/gui.h
index a5e635668..5bb936938 100644
--- a/navit/gui.h
+++ b/navit/gui.h
@@ -37,7 +37,7 @@ struct gui_methods {
struct menu_priv *(*popup_new)(struct gui_priv *priv, struct menu_methods *meth);
int (*set_graphics)(struct gui_priv *priv, struct graphics *gra);
int (*run_main_loop)(struct gui_priv *priv);
- struct datawindow_priv *(*datawindow_new)(struct gui_priv *priv, char *name, struct callback *click, struct callback *close, struct datawindow_methods *meth);
+ struct datawindow_priv *(*datawindow_new)(struct gui_priv *priv, const char *name, struct callback *click, struct callback *close, struct datawindow_methods *meth);
int (*add_bookmark)(struct gui_priv *priv, struct pcoord *c, char *description);
void (*disable_suspend)(struct gui_priv *priv);
int (*get_attr)(struct gui_priv *priv, enum attr_type type, struct attr *attr);
@@ -62,7 +62,7 @@ int gui_set_attr(struct gui *this_, struct attr *attr);
int gui_add_attr(struct gui *this_, struct attr *attr);
struct menu *gui_menubar_new(struct gui *gui);
struct menu *gui_popup_new(struct gui *gui);
-struct datawindow *gui_datawindow_new(struct gui *gui, char *name, struct callback *click, struct callback *close);
+struct datawindow *gui_datawindow_new(struct gui *gui, const char *name, struct callback *click, struct callback *close);
int gui_add_bookmark(struct gui *gui, struct pcoord *c, char *description);
int gui_set_graphics(struct gui *this_, struct graphics *gra);
void gui_disable_suspend(struct gui *this_);
diff --git a/navit/gui/gtk/datawindow.c b/navit/gui/gtk/datawindow.c
index 75f43a80a..8a1327332 100644
--- a/navit/gui/gtk/datawindow.c
+++ b/navit/gui/gtk/datawindow.c
@@ -182,7 +182,7 @@ static struct datawindow_methods gui_gtk_datawindow_meth = {
};
struct datawindow_priv *
-gui_gtk_datawindow_new(struct gui_priv *gui, char *name, struct callback *click, struct callback *close, struct datawindow_methods *meth)
+gui_gtk_datawindow_new(struct gui_priv *gui, const char *name, struct callback *click, struct callback *close, struct datawindow_methods *meth)
{
struct datawindow_priv *win;
diff --git a/navit/gui/gtk/gui_gtk.h b/navit/gui/gtk/gui_gtk.h
index 6168b9aef..10051beaf 100644
--- a/navit/gui/gtk/gui_gtk.h
+++ b/navit/gui/gtk/gui_gtk.h
@@ -56,7 +56,7 @@ void gui_gtk_ui_init(struct gui_priv *this);
struct menu_priv *gui_gtk_menubar_new(struct gui_priv *gui, struct menu_methods *meth);
struct statusbar_priv *gui_gtk_statusbar_new(struct gui_priv *gui);
struct menu_priv *gui_gtk_popup_new(struct gui_priv *gui, struct menu_methods *meth);
-struct datawindow_priv *gui_gtk_datawindow_new(struct gui_priv *gui, char *name, struct callback *click, struct callback *close, struct datawindow_methods *meth);
+struct datawindow_priv *gui_gtk_datawindow_new(struct gui_priv *gui, const char *name, struct callback *click, struct callback *close, struct datawindow_methods *meth);
void gui_gtk_datawindow_destroy(struct datawindow_priv *win);
void gui_gtk_datawindow_set_button(struct datawindow_priv *this_, GtkWidget *btn);
diff --git a/navit/gui/gtk/gui_gtk_statusbar.c b/navit/gui/gtk/gui_gtk_statusbar.c
index 368134a3e..0f0dcc0e8 100644
--- a/navit/gui/gtk/gui_gtk_statusbar.c
+++ b/navit/gui/gtk/gui_gtk_statusbar.c
@@ -68,7 +68,7 @@ statusbar_gps_update(struct statusbar_priv *this, int sats, int qual, double lng
}
#endif
-static char *status_fix2str(int type)
+static const char *status_fix2str(int type)
{
switch(type) {
case 0: return _("No");
@@ -94,8 +94,8 @@ statusbar_route_update(struct statusbar_priv *this, struct navit *navit, struct
double lng, lat, direction=0, height=0, speed=0, hdop=0;
int sats=0, qual=0;
int status=0;
- char *dirs[]={_("N"),_("NE"),_("E"),_("SE"),_("S"),_("SW"),_("W"),_("NW"),_("N")};
- char *dir;
+ const char *dirs[]={_("N"),_("NE"),_("E"),_("SE"),_("S"),_("SW"),_("W"),_("NW"),_("N")};
+ const char *dir;
int dir_idx;
if (navit)
diff --git a/navit/messages.c b/navit/messages.c
index b3d9ddcce..80b17236a 100644
--- a/navit/messages.c
+++ b/navit/messages.c
@@ -34,7 +34,7 @@ struct messagelist {
};
int
-message_new(struct messagelist *this_, char *message)
+message_new(struct messagelist *this_, const char *message)
{
struct message *msg;
diff --git a/navit/messages.h b/navit/messages.h
index 0b6c66c32..8570c6dad 100644
--- a/navit/messages.h
+++ b/navit/messages.h
@@ -32,7 +32,7 @@ struct message {
/* Prototypes */
struct attr;
-int message_new(struct messagelist *this_, char *message);
+int message_new(struct messagelist *this_, const char *message);
int message_delete(struct messagelist *this_, int mid);
struct messagelist *messagelist_new(struct attr **attrs);
void messagelist_init(struct messagelist *this_);
diff --git a/navit/navigation.c b/navit/navigation.c
index c697a42d7..f20834286 100644
--- a/navit/navigation.c
+++ b/navit/navigation.c
@@ -315,7 +315,7 @@ road_angle(struct coord *c1, struct coord *c2, int dir)
return ret;
}
-static char
+static const char
*get_count_str(int n)
{
switch (n) {
@@ -339,7 +339,7 @@ static char
}
}
-static char
+static const char
*get_exit_count_str(int n)
{
switch (n) {
@@ -1525,7 +1525,7 @@ static char *
show_maneuver(struct navigation *nav, struct navigation_itm *itm, struct navigation_command *cmd, enum attr_type type, int connect)
{
/* TRANSLATORS: right, as in 'Turn right' */
- char *dir=_("right"),*strength="";
+ const char *dir=_("right"),*strength="";
int distance=itm->dest_length-cmd->itm->dest_length;
char *d,*ret=NULL;
int delta=cmd->delta;
diff --git a/navit/navit.c b/navit/navit.c
index 349f1e378..a1da9139a 100644
--- a/navit/navit.c
+++ b/navit/navit.c
@@ -1447,7 +1447,7 @@ navit_set_gui(struct navit *this_, struct gui *gui)
}
void
-navit_add_message(struct navit *this_, char *message)
+navit_add_message(struct navit *this_, const char *message)
{
message_new(this_->messages, message);
}
@@ -1816,7 +1816,7 @@ navit_textfile_debug_log_at(struct navit *this_, struct pcoord *pc, const char *
}
void
-navit_say(struct navit *this_, char *text)
+navit_say(struct navit *this_, const char *text)
{
struct attr attr;
if(this_->speech) {
diff --git a/navit/navit.h b/navit/navit.h
index 68d3c9feb..e8cc29078 100644
--- a/navit/navit.h
+++ b/navit/navit.h
@@ -72,7 +72,7 @@ void navit_zoom_out(struct navit *this_, int factor, struct point *p);
void navit_zoom_in_cursor(struct navit *this_, int factor);
void navit_zoom_out_cursor(struct navit *this_, int factor);
struct navit *navit_new(struct attr *parent, struct attr **attrs);
-void navit_add_message(struct navit *this_, char *message);
+void navit_add_message(struct navit *this_, const char *message);
struct message *navit_get_messages(struct navit *this_);
struct graphics *navit_get_graphics(struct navit *this_);
struct vehicleprofile *navit_get_vehicleprofile(struct navit *this_);
@@ -91,7 +91,7 @@ struct map* read_former_destinations_from_file(void);
void navit_textfile_debug_log(struct navit *this_, const char *fmt, ...);
void navit_textfile_debug_log_at(struct navit *this_, struct pcoord *pc, const char *fmt, ...);
int navit_speech_estimate(struct navit *this_, char *str);
-void navit_say(struct navit *this_, char *text);
+void navit_say(struct navit *this_, const char *text);
void navit_speak(struct navit *this_);
void navit_window_roadbook_destroy(struct navit *this_);
void navit_window_roadbook_new(struct navit *this_);
diff --git a/navit/param.c b/navit/param.c
index 522f19fce..fbf14b316 100644
--- a/navit/param.c
+++ b/navit/param.c
@@ -23,13 +23,18 @@
#include "param.h"
void
-param_add_string(char *name, char *value, struct param_list **param, int *count)
+param_add_string(const char *name, const char *value, struct param_list **param, int *count)
{
+ char *param_name;
+ char *param_value;
if (*count > 0) {
- (*param)->name=malloc(strlen(value)+strlen(name)+2);
- (*param)->value=(*param)->name+strlen(name)+1;
- strcpy((*param)->name, name);
- strcpy((*param)->value, value);
+ param_name=malloc(strlen(value)+strlen(name)+2);
+ param_value=param_name+strlen(name)+1;
+ strcpy(param_name, name);
+ strcpy(param_value, value);
+ (*param)->name=param_name;
+ (*param)->value=param_value;
+
(*count)--;
(*param)++;
}
@@ -37,7 +42,7 @@ param_add_string(char *name, char *value, struct param_list **param, int *count)
}
void
-param_add_dec(char *name, unsigned long value, struct param_list **param, int *count)
+param_add_dec(const char *name, unsigned long value, struct param_list **param, int *count)
{
char buffer[1024];
sprintf(buffer, "%ld", value);
@@ -46,7 +51,7 @@ param_add_dec(char *name, unsigned long value, struct param_list **param, int *c
void
-param_add_hex(char *name, unsigned long value, struct param_list **param, int *count)
+param_add_hex(const char *name, unsigned long value, struct param_list **param, int *count)
{
char buffer[1024];
sprintf(buffer, "0x%lx", value);
@@ -54,7 +59,7 @@ param_add_hex(char *name, unsigned long value, struct param_list **param, int *c
}
void
-param_add_hex_sig(char *name, long value, struct param_list **param, int *count)
+param_add_hex_sig(const char *name, long value, struct param_list **param, int *count)
{
char buffer[1024];
if (value < 0)
diff --git a/navit/param.h b/navit/param.h
index d89e2583b..8b7ec04f7 100644
--- a/navit/param.h
+++ b/navit/param.h
@@ -21,14 +21,14 @@
#define NAVIT_PARAM_H
struct param_list {
- char *name;
- char *value;
+ const char *name;
+ const char *value;
};
-void param_add_string(char *name, char *value, struct param_list **param, int *count);
-void param_add_dec(char *name, unsigned long value, struct param_list **param, int *count);
-void param_add_hex(char *name, unsigned long value, struct param_list **param, int *count);
-void param_add_hex_sig(char *name, long value, struct param_list **param, int *count);
+void param_add_string(const char *name, const char *value, struct param_list **param, int *count);
+void param_add_dec(const char *name, unsigned long value, struct param_list **param, int *count);
+void param_add_hex(const char *name, unsigned long value, struct param_list **param, int *count);
+void param_add_hex_sig(const char *name, long value, struct param_list **param, int *count);
#endif