• R/O
  • HTTP
  • SSH
  • HTTPS

提交

標籤
無標籤

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

CLI interface to medialist (fossil mirror)


Commit MetaInfo

修訂bc4b0d898957d1591387d00c295d52a91e9d40e3 (tree)
時間2023-03-11 19:04:34
作者mio <stigma@disr...>
Commitermio

Log Message

change _ml_get_header_positions return type to size_t[2][6] to address deprecation

FossilOrigin-Name: bec009a226c8297fc7ffb05cb0f149d26fd34953f3ee4961658ba25248fc32b0

Change Summary

差異

--- a/medialist.d
+++ b/medialist.d
@@ -797,7 +797,7 @@ MediaListItem ml_fetch_item(MediaList* list, size_t id)
797797 if (false == found)
798798 throw new MLException(MLError.itemNotFound);
799799
800- int[2][6] headerPositions = _ml_get_header_positions(list);
800+ size_t[2][6] headerPositions = _ml_get_header_positions(list);
801801
802802 string[] sections = line.strip().split("\t");
803803 size_t titleIndex = 0;
@@ -807,7 +807,7 @@ MediaListItem ml_fetch_item(MediaList* list, size_t id)
807807 size_t endIndex = 0;
808808 size_t lastIndex = 0;
809809
810- foreach(int[2] header; headerPositions) {
810+ foreach(const ref header; headerPositions) {
811811 switch(header[0]) {
812812 case MLHeaders.title:
813813 titleIndex = header[1];
@@ -944,7 +944,7 @@ MediaListItem[] ml_fetch_items(MediaList* list, size_t[] ids ...)
944944 bool pastHeader = false;
945945 MediaListItem[] items;
946946
947- int[2][6] headerPositions = _ml_get_header_positions(list);
947+ size_t[2][6] headerPositions = _ml_get_header_positions(list);
948948 size_t titleIndex = 0;
949949 size_t progressIndex = 0;
950950 size_t statusIndex = 0;
@@ -952,7 +952,7 @@ MediaListItem[] ml_fetch_items(MediaList* list, size_t[] ids ...)
952952 size_t endIndex = 0;
953953 size_t lastIndex = 0;
954954
955- foreach(size_t idx, int[2] header; headerPositions) {
955+ foreach(const ref header; headerPositions) {
956956 switch(header[0]) {
957957 case MLHeaders.title:
958958 titleIndex = header[1];
@@ -1017,7 +1017,8 @@ MediaListItem[] ml_fetch_items(MediaList* list, size_t[] ids ...)
10171017 /// See_Also:
10181018 /// ml_fetch_item, ml_fetch_all
10191019 ///
1020-MediaListItem[] ml_fetch_items(MediaList* list, out MLError err, size_t[] ids ...) nothrow
1020+MediaListItem[] ml_fetch_items(MediaList* list, out MLError err,
1021+ size_t[] ids ...) nothrow
10211022 {
10221023 import core.stdc.errno : errno, EACCES;
10231024
@@ -1069,7 +1070,7 @@ MediaListItem[] ml_fetch_all(MediaList* list)
10691070 bool pastHeader = false;
10701071 MediaListItem[] items;
10711072
1072- int[2][6] headerPositions = _ml_get_header_positions(list);
1073+ size_t[2][6] headerPositions = _ml_get_header_positions(list);
10731074 size_t titleIndex = 0;
10741075 size_t progressIndex = 0;
10751076 size_t statusIndex = 0;
@@ -1077,7 +1078,7 @@ MediaListItem[] ml_fetch_all(MediaList* list)
10771078 size_t endIndex = 0;
10781079 size_t lastIndex = 0;
10791080
1080- foreach (int[2] header; headerPositions)
1081+ foreach (const ref header; headerPositions)
10811082 {
10821083 switch (header[0])
10831084 {
@@ -1248,7 +1249,7 @@ private MLError _ml_add(MediaList* list, string[] args)
12481249 if (true == list.isOpen)
12491250 return MLError.fileAlreadyOpen;
12501251
1251- int[2][6] headerPositions = _ml_get_header_positions(list);
1252+ size_t[2][6] headerPositions = _ml_get_header_positions(list);
12521253 int currentIndent = 0;
12531254
12541255 list.isOpen = true;
@@ -1256,7 +1257,7 @@ private MLError _ml_add(MediaList* list, string[] args)
12561257
12571258 File listFile = File(list.filePath, "a");
12581259
1259- foreach(const ref int[2] headerPosition; headerPositions) {
1260+ foreach(const ref headerPosition; headerPositions) {
12601261 while (currentIndent < headerPosition[1]) {
12611262 listFile.write("\t");
12621263 currentIndent += 1;
@@ -1442,7 +1443,7 @@ private MLError _ml_update(MediaList* list, string[] args)
14421443 File tempFile = File(tempFilePath, "w+");
14431444 scope(exit) remove(tempFilePath);
14441445
1445- int[2][6] headerPositions = _ml_get_header_positions(list);
1446+ size_t[2][6] headerPositions = _ml_get_header_positions(list);
14461447 size_t titleIndex = 0;
14471448 size_t progressIndex = 0;
14481449 size_t statusIndex = 0;
@@ -1450,7 +1451,7 @@ private MLError _ml_update(MediaList* list, string[] args)
14501451 size_t endDateIndex = 0;
14511452 size_t lastUpdatedIndex = 0;
14521453
1453- foreach (ref header; headerPositions) {
1454+ foreach (const ref header; headerPositions) {
14541455 switch (header[0]) {
14551456 case MLHeaders.title:
14561457 titleIndex = header[1];
@@ -1582,7 +1583,7 @@ private enum MLHeaders
15821583 lastUpdated = 5
15831584 }
15841585
1585-private int[2][6] _ml_get_header_positions(MediaList* list)
1586+private size_t[2][6] _ml_get_header_positions(MediaList* list)
15861587 {
15871588 list.isOpen = true;
15881589 scope(exit) list.isOpen = false;
@@ -1601,7 +1602,7 @@ private int[2][6] _ml_get_header_positions(MediaList* list)
16011602 * We keep the tab indent so we don't mess up any other programs or custom
16021603 * configurations.
16031604 */
1604- int[2][6] headerPositions = -1;
1605+ size_t[2][6] headerPositions = -1;
16051606 int arrayPosition = 0;
16061607
16071608 while ((line = f.readln) !is null) {
@@ -1612,7 +1613,7 @@ private int[2][6] _ml_get_header_positions(MediaList* list)
16121613 /* first non-comment/non-configuration line is the header */
16131614 string[] sections = line.strip().split("\t");
16141615
1615- foreach(int idx, ref string section; sections) {
1616+ foreach(idx, ref string section; sections) {
16161617 switch(section.toLower)
16171618 {
16181619 case "title":