diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ext_depends/D-YAML.meta | 2 | ||||
-rw-r--r-- | src/ext_depends/D-YAML/source/dyaml/exception.d | 5 | ||||
-rw-r--r-- | src/ext_depends/D-YAML/source/dyaml/loader.d | 17 | ||||
-rw-r--r-- | src/ext_depends/D-YAML/source/dyaml/node.d | 4 | ||||
-rw-r--r-- | src/ext_depends/D-YAML/source/dyaml/reader.d | 3 | ||||
-rw-r--r-- | src/ext_depends/D-YAML/source/dyaml/scanner.d | 6 | ||||
-rw-r--r-- | src/ext_depends/d2sqlite3.meta | 2 | ||||
-rw-r--r-- | src/ext_depends/d2sqlite3/source/d2sqlite3/statement.d | 5 |
8 files changed, 38 insertions, 6 deletions
diff --git a/src/ext_depends/D-YAML.meta b/src/ext_depends/D-YAML.meta index 2f596f2..2f64a9f 100644 --- a/src/ext_depends/D-YAML.meta +++ b/src/ext_depends/D-YAML.meta @@ -1,3 +1,3 @@ -D-YAML a6805551 +D-YAML 16e6d17e https://github.com/dlang-community/D-YAML Boost Software License 1.0 (BSL-1.0) diff --git a/src/ext_depends/D-YAML/source/dyaml/exception.d b/src/ext_depends/D-YAML/source/dyaml/exception.d index 2f13a44..46d3047 100644 --- a/src/ext_depends/D-YAML/source/dyaml/exception.d +++ b/src/ext_depends/D-YAML/source/dyaml/exception.d @@ -94,6 +94,9 @@ struct MarkedYAMLExceptionData // Base class of YAML exceptions with marked positions of the problem. abstract class MarkedYAMLException : YAMLException { + /// Position of the error. + Mark mark; + // Construct a MarkedYAMLException with specified context and problem. this(string context, const Mark contextMark, string problem, const Mark problemMark, string file = __FILE__, size_t line = __LINE__) @safe pure nothrow @@ -102,6 +105,7 @@ abstract class MarkedYAMLException : YAMLException (contextMark != problemMark ? contextMark.toString() ~ '\n' : "") ~ problem ~ '\n' ~ problemMark.toString() ~ '\n'; super(msg, file, line); + mark = problemMark; } // Construct a MarkedYAMLException with specified problem. @@ -110,6 +114,7 @@ abstract class MarkedYAMLException : YAMLException @safe pure nothrow { super(problem ~ '\n' ~ problemMark.toString(), file, line); + mark = problemMark; } /// Construct a MarkedYAMLException from a struct storing constructor parameters. diff --git a/src/ext_depends/D-YAML/source/dyaml/loader.d b/src/ext_depends/D-YAML/source/dyaml/loader.d index 7e7096c..09c19db 100644 --- a/src/ext_depends/D-YAML/source/dyaml/loader.d +++ b/src/ext_depends/D-YAML/source/dyaml/loader.d @@ -165,6 +165,7 @@ struct Loader void name(string name) pure @safe nothrow @nogc { name_ = name; + scanner_.name = name; } /// Specify custom Resolver to use. @@ -392,3 +393,19 @@ struct Loader auto doc = Loader.fromString(yaml).load(); assert(doc.isValid); } + +@safe unittest +{ + import std.exception : collectException; + + auto yaml = q"EOS + value: invalid: string +EOS"; + auto filename = "invalid.yml"; + auto loader = Loader.fromString(yaml); + loader.name = filename; + + Node unused; + auto e = loader.load().collectException!ScannerException(unused); + assert(e.mark.name == filename); +} diff --git a/src/ext_depends/D-YAML/source/dyaml/node.d b/src/ext_depends/D-YAML/source/dyaml/node.d index 5cb318e..e96bcec 100644 --- a/src/ext_depends/D-YAML/source/dyaml/node.d +++ b/src/ext_depends/D-YAML/source/dyaml/node.d @@ -27,7 +27,7 @@ import dyaml.exception; import dyaml.style; /// Exception thrown at node related errors. -class NodeException : YAMLException +class NodeException : MarkedYAMLException { package: // Construct a NodeException. @@ -37,7 +37,7 @@ class NodeException : YAMLException this(string msg, Mark start, string file = __FILE__, size_t line = __LINE__) @safe { - super(msg ~ "\nNode at: " ~ start.toString(), file, line); + super(msg, start, file, line); } } diff --git a/src/ext_depends/D-YAML/source/dyaml/reader.d b/src/ext_depends/D-YAML/source/dyaml/reader.d index 9fe42fc..ae44c80 100644 --- a/src/ext_depends/D-YAML/source/dyaml/reader.d +++ b/src/ext_depends/D-YAML/source/dyaml/reader.d @@ -405,6 +405,9 @@ final class Reader /// Get file name. string name() const @safe pure nothrow @nogc { return name_; } + /// Set file name. + void name(string name) pure @safe nothrow @nogc { name_ = name; } + /// Get current line number. uint line() const @safe pure nothrow @nogc { return line_; } diff --git a/src/ext_depends/D-YAML/source/dyaml/scanner.d b/src/ext_depends/D-YAML/source/dyaml/scanner.d index 2009521..3f0f394 100644 --- a/src/ext_depends/D-YAML/source/dyaml/scanner.d +++ b/src/ext_depends/D-YAML/source/dyaml/scanner.d @@ -185,6 +185,12 @@ struct Scanner return tokens_.empty; } + /// Set file name. + void name(string name) @safe pure nothrow @nogc + { + reader_.name = name; + } + private: /// Most scanning error messages have the same format; so build them with this /// function. diff --git a/src/ext_depends/d2sqlite3.meta b/src/ext_depends/d2sqlite3.meta index 3c1e4b5..5d324bd 100644 --- a/src/ext_depends/d2sqlite3.meta +++ b/src/ext_depends/d2sqlite3.meta @@ -1,3 +1,3 @@ -d2sqlite3 f5bc20b8 +d2sqlite3 553e7fec https://github.com/dlang-community/d2sqlite3 Boost Software License 1.0 (BSL-1.0) diff --git a/src/ext_depends/d2sqlite3/source/d2sqlite3/statement.d b/src/ext_depends/d2sqlite3/source/d2sqlite3/statement.d index 8cf6a38..3b262ab 100644 --- a/src/ext_depends/d2sqlite3/source/d2sqlite3/statement.d +++ b/src/ext_depends/d2sqlite3/source/d2sqlite3/statement.d @@ -88,14 +88,15 @@ package(d2sqlite3): this(Database db, string sql) { sqlite3_stmt* handle; + enforce(sql.length <= int.max, "Length of SQL statement exceeds `int.max`"); version (_UnlockNotify) { - auto result = sqlite3_blocking_prepare_v2(db, sql.toStringz, sql.length.to!int, + auto result = sqlite3_blocking_prepare_v2(db, sql.ptr, cast(int) sql.length, &handle, null); } else { - auto result = sqlite3_prepare_v2(db.handle(), sql.toStringz, sql.length.to!int, + auto result = sqlite3_prepare_v2(db.handle(), sql.ptr, cast(int) sql.length, &handle, null); } enforce(result == SQLITE_OK, new SqliteException(errmsg(db.handle()), result, sql)); |