From: Kaj-Michael Lang Date: Tue, 12 Aug 2008 16:16:23 +0000 (+0300) Subject: TileRepo: Hmm... g_strdup the tile cache directory. Move some comments and set some... X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=78f565375de791178240ac0900d8906ca029f6f3;p=mapper TileRepo: Hmm... g_strdup the tile cache directory. Move some comments and set some defaults. --- 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");