Skip to content

Commit

Permalink
Merge pull request #4 from DerDakon/oldpatches
Browse files Browse the repository at this point in the history
A bunch of minor patches
  • Loading branch information
AMDmi3 committed May 28, 2016
2 parents cc4e0d4 + a3a066f commit c5e9e7a
Show file tree
Hide file tree
Showing 12 changed files with 31 additions and 15 deletions.
4 changes: 4 additions & 0 deletions src/area_edit.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
#ifndef AREA_EDIT_H
#define AREA_EDIT_H

#include "appdata.h"
#include "pos.h"
#include "settings.h"

typedef struct {
appdata_t *appdata;
GtkWidget *parent; /* parent widget to be placed upon */
Expand Down
2 changes: 1 addition & 1 deletion src/gps.c
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ gpointer gps_thread(gpointer data) {
if(vfs_result == GNOME_VFS_OK) {
str[bytes_read] = 0;

printf("msg: %s (%d)\n", str, strlen(str));
printf("msg: %s (%zi)\n", str, strlen(str));

g_mutex_lock(appdata->gps_state->mutex);

Expand Down
4 changes: 2 additions & 2 deletions src/icon.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ void icon_free(icon_t **icon, GdkPixbuf *buf) {
// printf("freeing unused icon %s\n", (*icon)->name);

g_free((*icon)->name);
gdk_pixbuf_unref((*icon)->buf);
g_object_unref((*icon)->buf);
icon_t *next = (*icon)->next;
g_free(*icon);
*icon = next;
Expand All @@ -118,7 +118,7 @@ void icon_free_all(icon_t **icons) {
while(icon) {
cnt++;
g_free(icon->name);
gdk_pixbuf_unref(icon->buf);
g_object_unref(icon->buf);
icon_t *next = icon->next;
g_free(icon);
icon = next;
Expand Down
7 changes: 6 additions & 1 deletion src/info.c
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ static void on_tag_edit(GtkWidget *button, tag_context_t *context) {
static void on_tag_last(GtkWidget *button, tag_context_t *context) {
static const char *type_name[] = { "illegal", "node", "way", "relation" };

if(yes_no_f(context->dialog,
if(!*context->tag || yes_no_f(context->dialog,
context->appdata, MISC_AGAIN_ID_OVERWRITE_TAGS, 0,
_("Overwrite tags?"),
_("This will overwrite all tags of this %s with the "
Expand All @@ -206,6 +206,11 @@ static void on_tag_last(GtkWidget *button, tag_context_t *context) {
*context->tag = osm_tags_copy(context->appdata->map->last_way_tags);

info_tags_replace(context);

// Adding those tags above will usually make the first of the newly
// added tags selected. Enable edit/remove buttons now.
GtkTreeSelection *sel = list_get_selection(context->list);
changed(sel, context->list);
}
}

Expand Down
4 changes: 4 additions & 0 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,10 @@ static void
cb_menu_undo_changes(GtkMenuItem *item, gpointer data) {
appdata_t *appdata = (appdata_t*)data;

// if there is nothing to clean then don't ask
if (!diff_present(appdata->project) && diff_is_clean(appdata->osm, TRUE))
return;

if(!yes_no_f(GTK_WIDGET(appdata->window), NULL, 0, 0,
_("Undo all changes?"),
_("Throw away all the changes you've not "
Expand Down
2 changes: 1 addition & 1 deletion src/map.c
Original file line number Diff line number Diff line change
Expand Up @@ -2317,7 +2317,7 @@ static gint map_bg_item_destroy_event(GtkWidget *widget, gpointer data) {
map->bg.item = NULL;
if(map->bg.pix) {
printf("destroying background item\n");
gdk_pixbuf_unref(map->bg.pix);
g_object_unref(map->bg.pix);
map->bg.pix = NULL;
}
return FALSE;
Expand Down
2 changes: 0 additions & 2 deletions src/map_edit.c
Original file line number Diff line number Diff line change
Expand Up @@ -785,11 +785,9 @@ void map_edit_node_move(appdata_t *appdata, map_item_t *map_item,

/* take all nodes from way[1] and append them to way[0] */
/* check if we have to append or prepend to way[0] */
gboolean reverse = FALSE;
if(ways2join[0]->node_chain->node == node) {
/* make "prepend" to be "append" by reversing way[0] */
printf(" target prepend -> reverse\n");
reverse = TRUE;
osm_way_reverse(ways2join[0]);
}

Expand Down
3 changes: 2 additions & 1 deletion src/net_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,10 @@ static void request_free(net_io_request_t *request) {
g_free(request);
}

static int curl_progress_func(net_io_request_t *request,
static int curl_progress_func(void *req,
double t, /* dltotal */ double d, /* dlnow */
double ultotal, double ulnow) {
net_io_request_t *request = req;
request->progress = t?d/t:0;
return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion src/osm-gps-map.c
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,7 @@ osm_gps_map_blit_tile(OsmGpsMap *map, GdkPixbuf *pixbuf, int offset_x, int offse
#else
#define MSG_RESPONSE_BODY(a) ((a)->response_body->data)
#define MSG_RESPONSE_LEN(a) ((a)->response_body->length)
#define MSG_RESPONSE_LEN_FORMAT "%lld"
#define MSG_RESPONSE_LEN_FORMAT "%zu"
#endif

#ifdef LIBSOUP22
Expand Down
6 changes: 3 additions & 3 deletions src/osm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1288,7 +1288,7 @@ static char *osm_generate_xml(osm_t *osm, item_id_t changeset,
snprintf(str, sizeof(str), ITEM_ID_FORMAT, OSM_ID(node));
xmlNewProp(node_node, BAD_CAST "id", BAD_CAST str);
}
snprintf(str, sizeof(str), "%u", (unsigned)OSM_VERSION(node));
snprintf(str, sizeof(str), ITEM_ID_FORMAT, OSM_VERSION(node));
xmlNewProp(node_node, BAD_CAST "version", BAD_CAST str);
snprintf(str, sizeof(str), "%u", (unsigned)changeset);
xmlNewProp(node_node, BAD_CAST "changeset", BAD_CAST str);
Expand All @@ -1306,7 +1306,7 @@ static char *osm_generate_xml(osm_t *osm, item_id_t changeset,
xmlNodePtr way_node = xmlNewChild(root_node, NULL, BAD_CAST "way", NULL);
snprintf(str, sizeof(str), ITEM_ID_FORMAT, OSM_ID(way));
xmlNewProp(way_node, BAD_CAST "id", BAD_CAST str);
snprintf(str, sizeof(str), "%u", (unsigned)OSM_VERSION(way));
snprintf(str, sizeof(str), ITEM_ID_FORMAT, OSM_VERSION(way));
xmlNewProp(way_node, BAD_CAST "version", BAD_CAST str);
snprintf(str, sizeof(str), "%u", (unsigned)changeset);
xmlNewProp(way_node, BAD_CAST "changeset", BAD_CAST str);
Expand All @@ -1331,7 +1331,7 @@ static char *osm_generate_xml(osm_t *osm, item_id_t changeset,
BAD_CAST "relation", NULL);
snprintf(str, sizeof(str), ITEM_ID_FORMAT, OSM_ID(relation));
xmlNewProp(rel_node, BAD_CAST "id", BAD_CAST str);
snprintf(str, sizeof(str), "%u", (unsigned)OSM_VERSION(relation));
snprintf(str, sizeof(str), ITEM_ID_FORMAT, OSM_VERSION(relation));
xmlNewProp(rel_node, BAD_CAST "version", BAD_CAST str);
snprintf(str, sizeof(str), "%u", (unsigned)changeset);
xmlNewProp(rel_node, BAD_CAST "changeset", BAD_CAST str);
Expand Down
6 changes: 5 additions & 1 deletion src/project.c
Original file line number Diff line number Diff line change
Expand Up @@ -862,7 +862,11 @@ static gsize file_length(char *path, char *name) {

if(!gmap) return -1;
gsize size = g_mapped_file_get_length(gmap);
#if GLIB_CHECK_VERSION(2,22,0)
g_mapped_file_unref(gmap);
#else
g_mapped_file_free(gmap);
#endif
return size;
}

Expand All @@ -885,7 +889,7 @@ void project_filesize(project_context_t *context) {
gtk_widget_modify_fg(context->fsize, GTK_STATE_NORMAL, NULL);

if(!context->project->data_dirty)
str = g_strdup_printf(_("%d bytes present"),
str = g_strdup_printf(_("%zi bytes present"),
file_length(context->project->path,
context->project->osm));
else
Expand Down
4 changes: 2 additions & 2 deletions src/undo.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
#define UNDO_ENABLE_CHECK if(!appdata->menu_item_map_undo) return;

/* return plain text of type */
static char *undo_type_string(type_t type) {
const struct { undo_type_t type; char *name; } types[] = {
static const char *undo_type_string(const undo_type_t type) {
const struct { undo_type_t type; const char *name; } types[] = {
{ UNDO_DELETE, "deletion" },
{ UNDO_CREATE, "creation" },
{ UNDO_MODIFY, "modification" },
Expand Down

0 comments on commit c5e9e7a

Please sign in to comment.