forked from nzbgetcom/nzbget
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add: better long-paths support on Windows (nzbgetcom#441)
- fixed multiple bugs related to bad support of long-paths on Windows
- Loading branch information
Showing
27 changed files
with
245 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
/* | ||
* This file is part of nzbget. See <https://nzbget.com>. | ||
* | ||
* Copyright (C) 2023 Denis <[email protected]> | ||
* Copyright (C) 2023-2024 Denis <[email protected]> | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
|
@@ -21,32 +21,37 @@ | |
|
||
#include "Json.h" | ||
|
||
namespace Json { | ||
JsonValue Deserialize(std::istream& is, ErrorCode& ec) | ||
namespace Json | ||
{ | ||
std::optional<JsonValue> Deserialize(std::basic_istream<char>& is) noexcept | ||
{ | ||
ErrorCode ec; | ||
StreamParser parser; | ||
std::string line; | ||
|
||
while (std::getline(is, line)) | ||
{ | ||
parser.write(line, ec); | ||
if (ec) | ||
{ | ||
return nullptr; | ||
} | ||
if (ec) return std::nullopt; | ||
} | ||
|
||
parser.finish(ec); | ||
|
||
if (ec) | ||
{ | ||
return nullptr; | ||
} | ||
if (ec) return std::nullopt; | ||
|
||
return parser.release(); | ||
} | ||
|
||
std::string Serialize(const JsonObject& json) | ||
std::optional<JsonValue> Deserialize(const std::string& jsonStr) noexcept | ||
{ | ||
ErrorCode ec; | ||
JsonValue value = parse(jsonStr, ec); | ||
|
||
if (ec) return std::nullopt; | ||
|
||
return value; | ||
} | ||
|
||
std::string Serialize(const JsonObject& json) noexcept | ||
{ | ||
return serialize(json); | ||
} | ||
|
Oops, something went wrong.