diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-09-02 11:25:03 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-09-02 11:25:03 +0300 |
commit | 1e548eac8c63922315f89c96436b622615c488c7 (patch) | |
tree | d2c36fdaaa0bcc42cbc34bb804de5a7201dba2b1 /src/bookmarks.c | |
parent | 8ed2faadc4ca2497fc3b2e9d2eae6d40921de918 (diff) | |
parent | e2b5ea14d25dbbb62a1e827803e67c30df79c6a1 (diff) |
Merge branch 'master' of skyjake.fi:skyjake/lagrange
Diffstat (limited to 'src/bookmarks.c')
-rw-r--r-- | src/bookmarks.c | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/src/bookmarks.c b/src/bookmarks.c index 795e0d44..eff0146d 100644 --- a/src/bookmarks.c +++ b/src/bookmarks.c | |||
@@ -1,3 +1,25 @@ | |||
1 | /* Copyright 2020 Jaakko Keränen <jaakko.keranen@iki.fi> | ||
2 | |||
3 | Redistribution and use in source and binary forms, with or without | ||
4 | modification, are permitted provided that the following conditions are met: | ||
5 | |||
6 | 1. Redistributions of source code must retain the above copyright notice, this | ||
7 | list of conditions and the following disclaimer. | ||
8 | 2. Redistributions in binary form must reproduce the above copyright notice, | ||
9 | this list of conditions and the following disclaimer in the documentation | ||
10 | and/or other materials provided with the distribution. | ||
11 | |||
12 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | ||
13 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
14 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
15 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR | ||
16 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
17 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
18 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
19 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
20 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
21 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ | ||
22 | |||
1 | #include "bookmarks.h" | 23 | #include "bookmarks.h" |
2 | 24 | ||
3 | #include <the_Foundation/file.h> | 25 | #include <the_Foundation/file.h> |
@@ -63,7 +85,7 @@ void load_Bookmarks(iBookmarks *d, const char *dirPath) { | |||
63 | if (open_File(f, readOnly_FileMode | text_FileMode)) { | 85 | if (open_File(f, readOnly_FileMode | text_FileMode)) { |
64 | const iRangecc src = range_Block(collect_Block(readAll_File(f))); | 86 | const iRangecc src = range_Block(collect_Block(readAll_File(f))); |
65 | iRangecc line = iNullRange; | 87 | iRangecc line = iNullRange; |
66 | while (nextSplit_Rangecc(&src, "\n", &line)) { | 88 | while (nextSplit_Rangecc(src, "\n", &line)) { |
67 | /* Skip empty lines. */ { | 89 | /* Skip empty lines. */ { |
68 | iRangecc ln = line; | 90 | iRangecc ln = line; |
69 | trim_Rangecc(&ln); | 91 | trim_Rangecc(&ln); |
@@ -78,9 +100,9 @@ void load_Bookmarks(iBookmarks *d, const char *dirPath) { | |||
78 | initSeconds_Time(&bm->when, strtod(line.start, &endPos)); | 100 | initSeconds_Time(&bm->when, strtod(line.start, &endPos)); |
79 | line.start = skipSpace_CStr(endPos); | 101 | line.start = skipSpace_CStr(endPos); |
80 | setRange_String(&bm->url, line); | 102 | setRange_String(&bm->url, line); |
81 | nextSplit_Rangecc(&src, "\n", &line); | 103 | nextSplit_Rangecc(src, "\n", &line); |
82 | setRange_String(&bm->title, line); | 104 | setRange_String(&bm->title, line); |
83 | nextSplit_Rangecc(&src, "\n", &line); | 105 | nextSplit_Rangecc(src, "\n", &line); |
84 | setRange_String(&bm->tags, line); | 106 | setRange_String(&bm->tags, line); |
85 | insert_Bookmarks_(d, bm); | 107 | insert_Bookmarks_(d, bm); |
86 | } | 108 | } |