From 78f565375de791178240ac0900d8906ca029f6f3 Mon Sep 17 00:00:00 2001 From: Kaj-Michael Lang Date: Tue, 12 Aug 2008 19:16:23 +0300 Subject: [PATCH] TileRepo: Hmm... g_strdup the tile cache directory. Move some comments and set some defaults. --- libs/libgtkmap/tilerepo.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/libs/libgtkmap/tilerepo.c b/libs/libgtkmap/tilerepo.c index d3d85c0..236b0ee 100644 --- a/libs/libgtkmap/tilerepo.c +++ b/libs/libgtkmap/tilerepo.c @@ -119,6 +119,12 @@ tr->max_zoom=17; tr->view_zoom_steps=1; tr->icache=image_cache_new(64); tr->type=REPOTYPE_NONE; +tr->name=NULL; +tr->url=NULL; +tr->cache_dir=NULL; +tr->dl_zoom_steps=1; +tr->double_size=0; +tr->nextable=FALSE; } /** @@ -126,6 +132,12 @@ tr->type=REPOTYPE_NONE; * @str * * Create a new Map image tile repository structure by filling in values from given configuration string. + * Parses an string with components, delimited by newline characters: + * 1. name + * 2. url + * 3. cache_dir + * 4. dl_zoom_steps + * 5. view_zoom_steps * */ TileRepo * @@ -134,17 +146,11 @@ tile_repo_new_from_string(gchar *str) gchar *token, *error_check; TileRepo *tr; -/* Parse each part of a repo, delimited by newline characters: - * 1. name - * 2. url - * 3. cache_dir - * 4. dl_zoom_steps - * 5. view_zoom_steps - */ - tr=tile_repo_new(); g_return_val_if_fail(tr, NULL); +g_debug("REPOSTR: %s", str); + /* Parse name. */ token=strsep(&str, "\n\t"); if (token) @@ -158,7 +164,7 @@ if (token) /* Parse cache dir. */ token=strsep(&str, "\n\t"); if (token) - tr->cache_dir=token; + tr->cache_dir=g_strdup(token); /* Parse download zoom steps. */ token=strsep(&str, "\n\t"); -- 2.39.5