From 5553a706031c14464c384641e4fefec4c5a4f9f0 Mon Sep 17 00:00:00 2001 From: Chunting Gu Date: Tue, 16 Apr 2019 16:59:58 +0800 Subject: [PATCH] Remove two error codes --- webcc/common.cc | 6 ++++-- webcc/common.h | 4 ++-- webcc/globals.cc | 4 ---- webcc/globals.h | 9 +-------- 4 files changed, 7 insertions(+), 16 deletions(-) diff --git a/webcc/common.cc b/webcc/common.cc index 3189ca9..e401676 100644 --- a/webcc/common.cc +++ b/webcc/common.cc @@ -1,5 +1,7 @@ #include "webcc/common.h" +#include + #include "boost/algorithm/string.hpp" #include "boost/filesystem/fstream.hpp" @@ -215,8 +217,8 @@ FormPart::FormPart(const std::string& name, const Path& path, } // Determine file name from file path. - // TODO: Encoding - file_name_ = path.filename().string(); + // TODO: encoding + file_name_ = path.filename().string(std::codecvt_utf8()); // Determine content type from file extension. if (mime_type_.empty()) { diff --git a/webcc/common.h b/webcc/common.h index 3c236b1..d232b71 100644 --- a/webcc/common.h +++ b/webcc/common.h @@ -156,8 +156,8 @@ class FormPart { public: FormPart() = default; - explicit FormPart(const std::string& name, const Path& path, - const std::string& mime_type = ""); + FormPart(const std::string& name, const Path& path, + const std::string& mime_type = ""); FormPart(const std::string& name, std::string&& data, const std::string& mime_type = ""); diff --git a/webcc/globals.cc b/webcc/globals.cc index 4299bc4..ff0e4b7 100644 --- a/webcc/globals.cc +++ b/webcc/globals.cc @@ -72,12 +72,8 @@ const char* DescribeError(Error error) { return "Socket write error"; case kHttpError: return "HTTP error"; - case kServerError: - return "Server error"; case kFileIOError: return "File IO error"; - case kXmlError: - return "XML error"; default: return ""; } diff --git a/webcc/globals.h b/webcc/globals.h index 2b66029..4b602a9 100644 --- a/webcc/globals.h +++ b/webcc/globals.h @@ -164,7 +164,7 @@ const std::string& UserAgent(); enum Error { kNoError = 0, // i.e., OK - kSchemaError, + kSchemaError, // TODO kHostResolveError, kEndpointConnectError, @@ -176,15 +176,8 @@ enum Error { // E.g., failed to parse HTTP response (invalid content length, etc.). kHttpError, - // Server error. - // E.g., HTTP status 500 + SOAP Fault element. - kServerError, - // File read/write error. kFileIOError, - - // XML parsing error. - kXmlError, }; // Return a descriptive message for the given error code.