mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
217c6462f5
commit
9d8b05f47e
2 changed files with 14 additions and 12 deletions
24
load-git.c
24
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
|
* - 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
|
* which describes the date and time of a dive (yyyy and mm
|
||||||
* are optional, and may be encoded in the path leading up to
|
* 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.
|
* - It's some random non-dive-data directory.
|
||||||
*
|
*
|
||||||
* Subsurface doesn't create these yet, but maybe we'll encode
|
* If it doesn't match the above patterns, we'll ignore them
|
||||||
* pictures etc. If it doesn't match the above patterns, we'll
|
* for dive loading purposes, and not even recurse into them.
|
||||||
* 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)
|
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;
|
char sign;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The format of the picture name files is just the offset
|
* The format of the picture name files is just the offset within
|
||||||
* within the dive in form [[+-]hh:mm:ss, possibly followed
|
* the dive in form [[+-]hh=mm=ss (previously [[+-]hh:mm:ss, but
|
||||||
* by a hash to make the filename unique (which we can just
|
* that didn't work on Windows), possibly followed by a hash to
|
||||||
* ignore).
|
* 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);
|
return report_error("Unknown file name %s", name);
|
||||||
offset = ss + 60*(mm + 60*hh);
|
offset = ss + 60*(mm + 60*hh);
|
||||||
if (sign == '-')
|
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);
|
blob = git_tree_entry_blob(repo, entry);
|
||||||
if (!blob)
|
if (!blob)
|
||||||
return report_error("Unable to read trip file");
|
return report_error("Unable to read picture file");
|
||||||
|
|
||||||
pic = alloc_picture();
|
pic = alloc_picture();
|
||||||
pic->offset.seconds = offset;
|
pic->offset.seconds = offset;
|
||||||
|
|
|
@ -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 */
|
/* Use full hh:mm:ss format to make it all sort nicely */
|
||||||
h = offset / 3600;
|
h = offset / 3600;
|
||||||
offset -= h *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));
|
sign, h, FRACTION(offset, 60));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue