summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorViktor Verebelyi <vviktor2@gmail.com>2021-06-22 15:52:11 +0100
committerViktor Verebelyi <vviktor2@gmail.com>2021-06-22 15:52:11 +0100
commit4186db4e533b47c36c09154139389f72ceb0529d (patch)
tree453afe66779ea78ceb8bbe6d29e07aaf3e54b125
parent7608877de8f07e8a038af79487f1fdb2d6b824bf (diff)
downloadnavit-4186db4e533b47c36c09154139389f72ceb0529d.tar.gz
Smaller fixes:
Fix win32 debug messages Add some include guards Fix route_has_graph segfault
-rw-r--r--navit/debug.c12
-rw-r--r--navit/event.h5
-rw-r--r--navit/route.c3
-rw-r--r--navit/window.h4
4 files changed, 18 insertions, 6 deletions
diff --git a/navit/debug.c b/navit/debug.c
index e46637cb2..75a30e91d 100644
--- a/navit/debug.c
+++ b/navit/debug.c
@@ -376,12 +376,12 @@ void debug_vprintf(dbg_level level, const char *module, const int mlen, const ch
/* In the code below, we prepend the end-of-line sequence to the current string pointed by debug_message ("\r\n" for Windows, "\r" otherwise */
#ifdef HAVE_API_WIN32_BASE
- if (len + 1 < sizeof(debug_message) - 1) {
- /* For Windows platforms, add \r at the end of the buffer (if any room), make sure that we have room for one more character */
- *end++ = '\r';
- len++;
- *end = '\0';
- }
+// if (len + 1 < sizeof(debug_message) - 1) {
+// /* For Windows platforms, add \r at the end of the buffer (if any room), make sure that we have room for one more character */
+// *end++ = '\r';
+// len++;
+// *end = '\0';
+// }
#endif
if (len + 1 < sizeof(debug_message)) { /* Add \n at the end of the buffer (if any room) */
*end++ = '\n';
diff --git a/navit/event.h b/navit/event.h
index 1aa10cc4f..1abb7fad8 100644
--- a/navit/event.h
+++ b/navit/event.h
@@ -17,6 +17,9 @@
* Boston, MA 02110-1301, USA.
*/
+#ifndef NAVIT_EVENT_H
+#define NAVIT_EVENT_H
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -70,3 +73,5 @@ int event_request_system(const char *system, const char *requestor);
#ifdef __cplusplus
}
#endif
+
+#endif //NAVIT_EVENT_H
diff --git a/navit/route.c b/navit/route.c
index 94717d007..74cb98da5 100644
--- a/navit/route.c
+++ b/navit/route.c
@@ -4162,6 +4162,9 @@ struct route_graph * route_get_graph(struct route *this_) {
* @return True if the route has a graph, false if not.
*/
int route_has_graph(struct route *this_) {
+ if(this_== NULL){
+ return 0;
+ }
return (this_->graph != NULL);
}
diff --git a/navit/window.h b/navit/window.h
index 706bea798..51d7b0df7 100644
--- a/navit/window.h
+++ b/navit/window.h
@@ -17,6 +17,8 @@
* Boston, MA 02110-1301, USA.
*/
+#ifndef NAVIT_WINDOW_H
+#define NAVIT_WINDOW_H
/**
* Describes the Navit application window or equivalent.
*/
@@ -25,3 +27,5 @@ struct window {
int (*fullscreen)(struct window *win, int on); /**< Method to toggle fullscreen mode */
void (*disable_suspend)(struct window *win); /**< Method to disable suspend mode or screen savers */
};
+
+#endif //NAVIT_WINDOW_H