summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2015-06-21 06:12:33 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-06-21 06:23:49 -0700
commit9d8b05f47e8d608a7a8b2d565905a2d6c1feb274 (patch)
tree8bd54f6319eadf92e67aa2e401225bd8c33290bf
parent217c6462f5f32732afa18d3a5f074bd5f736afd0 (diff)
downloadsubsurface-9d8b05f47e8d608a7a8b2d565905a2d6c1feb274.tar.gz
Git storage: replaces colons with equal in picture offset
I found another place where we had colons in file names... This fixes a small cut and paste error in an error message as well. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--load-git.c24
-rw-r--r--save-git.c2
2 files changed, 14 insertions, 12 deletions
diff --git a/load-git.c b/load-git.c
index 6cf62ec79..6942b6a41 100644
--- a/load-git.c
+++ b/load-git.c
@@ -1262,7 +1262,10 @@ static int nonunique_length(const char *str)
*
* - It's a dive directory. The name will be of the form
*
- * [[yyyy-]mm-]nn-ddd-hh:mm:ss[~hex]
+ * [[yyyy-]mm-]nn-ddd-hh=mm=ss[~hex]
+ *
+ * (older versions had this as [[yyyy-]mm-]nn-ddd-hh:mm:ss[~hex]
+ * but that faile on Windows)
*
* which describes the date and time of a dive (yyyy and mm
* are optional, and may be encoded in the path leading up to
@@ -1272,10 +1275,8 @@ static int nonunique_length(const char *str)
*
* - It's some random non-dive-data directory.
*
- * Subsurface doesn't create these yet, but maybe we'll encode
- * pictures etc. If it doesn't match the above patterns, we'll
- * ignore them for dive loading purposes, and not even recurse
- * into them.
+ * If it doesn't match the above patterns, we'll ignore them
+ * for dive loading purposes, and not even recurse into them.
*/
static int walk_tree_directory(const char *root, const git_tree_entry *entry)
{
@@ -1427,12 +1428,13 @@ static int parse_picture_entry(git_repository *repo, const git_tree_entry *entry
char sign;
/*
- * The format of the picture name files is just the offset
- * within the dive in form [[+-]hh:mm:ss, possibly followed
- * by a hash to make the filename unique (which we can just
- * ignore).
+ * The format of the picture name files is just the offset within
+ * the dive in form [[+-]hh=mm=ss (previously [[+-]hh:mm:ss, but
+ * that didn't work on Windows), possibly followed by a hash to
+ * make the filename unique (which we can just ignore).
*/
- if (sscanf(name, "%c%d:%d:%d", &sign, &hh, &mm, &ss) != 4)
+ if (sscanf(name, "%c%d:%d:%d", &sign, &hh, &mm, &ss) != 4 &&
+ sscanf(name, "%c%d=%d=%d", &sign, &hh, &mm, &ss) != 4)
return report_error("Unknown file name %s", name);
offset = ss + 60*(mm + 60*hh);
if (sign == '-')
@@ -1440,7 +1442,7 @@ static int parse_picture_entry(git_repository *repo, const git_tree_entry *entry
blob = git_tree_entry_blob(repo, entry);
if (!blob)
- return report_error("Unable to read trip file");
+ return report_error("Unable to read picture file");
pic = alloc_picture();
pic->offset.seconds = offset;
diff --git a/save-git.c b/save-git.c
index 4e5ed38e0..f674b9d84 100644
--- a/save-git.c
+++ b/save-git.c
@@ -608,7 +608,7 @@ static int save_one_picture(git_repository *repo, struct dir *dir, struct pictur
/* Use full hh:mm:ss format to make it all sort nicely */
h = offset / 3600;
offset -= h *3600;
- return blob_insert(repo, dir, &buf, "%c%02u:%02u:%02u",
+ return blob_insert(repo, dir, &buf, "%c%02u=%02u=%02u",
sign, h, FRACTION(offset, 60));
}