Fix some g++4.9 CE.

GitOrigin-RevId: 0d4ed1e684fd623a7ab5849e4f0f7ec2fd182694
This commit is contained in:
levlam 2019-02-13 02:29:52 +03:00
parent ce7c9feef1
commit 8c3eb953ae
8 changed files with 19 additions and 17 deletions

View File

@ -11,7 +11,7 @@ const sleep = ms => new Promise(res => setTimeout(res, ms));
* TDLib can be used from javascript through the [JSON](https://github.com/tdlib/td#using-json) interface. * TDLib can be used from javascript through the [JSON](https://github.com/tdlib/td#using-json) interface.
* This is a convenient wrapper around it. * This is a convenient wrapper around it.
* Internally it uses TDLib built with emscripten as asm.js or WebAssembly. All work happens in a WebWorker. * Internally it uses TDLib built with emscripten as asm.js or WebAssembly. All work happens in a WebWorker.
* TdClient itself just sends queries to WebWorker, recieve updates and results from WebWorker. * TdClient itself just sends queries to WebWorker, receive updates and results from WebWorker.
* *
* <br><br> * <br><br>
* Differences from TDLib API<br> * Differences from TDLib API<br>

View File

@ -136,7 +136,7 @@ std::pair<DocumentsManager::DocumentType, FileId> DocumentsManager::on_get_docum
if (animated != nullptr || default_document_type == DocumentType::Animation) { if (animated != nullptr || default_document_type == DocumentType::Animation) {
document_type = DocumentType::Animation; document_type = DocumentType::Animation;
file_type = FileType::Animation; file_type = FileType::Animation;
default_extension = "mp4"; default_extension = Slice("mp4");
} else if (audio != nullptr || default_document_type == DocumentType::Audio || } else if (audio != nullptr || default_document_type == DocumentType::Audio ||
default_document_type == DocumentType::VoiceNote) { default_document_type == DocumentType::VoiceNote) {
bool is_voice_note = default_document_type == DocumentType::VoiceNote; bool is_voice_note = default_document_type == DocumentType::VoiceNote;
@ -146,17 +146,17 @@ std::pair<DocumentsManager::DocumentType, FileId> DocumentsManager::on_get_docum
if (is_voice_note) { if (is_voice_note) {
document_type = DocumentType::VoiceNote; document_type = DocumentType::VoiceNote;
file_type = FileType::VoiceNote; file_type = FileType::VoiceNote;
default_extension = "oga"; default_extension = Slice("oga");
file_name.clear(); file_name.clear();
} else { } else {
document_type = DocumentType::Audio; document_type = DocumentType::Audio;
file_type = FileType::Audio; file_type = FileType::Audio;
default_extension = "mp3"; default_extension = Slice("mp3");
} }
} else if (sticker != nullptr || default_document_type == DocumentType::Sticker) { } else if (sticker != nullptr || default_document_type == DocumentType::Sticker) {
document_type = DocumentType::Sticker; document_type = DocumentType::Sticker;
file_type = FileType::Sticker; file_type = FileType::Sticker;
default_extension = "webp"; default_extension = Slice("webp");
owner_dialog_id = DialogId(); owner_dialog_id = DialogId();
file_name.clear(); file_name.clear();
has_webp_thumbnail = td_->stickers_manager_->has_webp_thumbnail(sticker); has_webp_thumbnail = td_->stickers_manager_->has_webp_thumbnail(sticker);
@ -177,7 +177,7 @@ std::pair<DocumentsManager::DocumentType, FileId> DocumentsManager::on_get_docum
document_type = DocumentType::Video; document_type = DocumentType::Video;
file_type = FileType::Video; file_type = FileType::Video;
} }
default_extension = "mp4"; default_extension = Slice("mp4");
} }
} else if (type_attributes >= 2) { } else if (type_attributes >= 2) {
LOG(WARNING) << "Receive document with more than 1 type attribute: animated = " << to_string(animated) LOG(WARNING) << "Receive document with more than 1 type attribute: animated = " << to_string(animated)

View File

@ -954,14 +954,14 @@ void Session::connection_open_finish(ConnectionInfo *info,
Slice mode_name; Slice mode_name;
if (mode_ == Mode::Tcp) { if (mode_ == Mode::Tcp) {
mode = mtproto::SessionConnection::Mode::Tcp; mode = mtproto::SessionConnection::Mode::Tcp;
mode_name = "Tcp"; mode_name = Slice("Tcp");
} else { } else {
if (info->connection_id == 0) { if (info->connection_id == 0) {
mode = mtproto::SessionConnection::Mode::Http; mode = mtproto::SessionConnection::Mode::Http;
mode_name = "Http"; mode_name = Slice("Http");
} else { } else {
mode = mtproto::SessionConnection::Mode::HttpLongPoll; mode = mtproto::SessionConnection::Mode::HttpLongPoll;
mode_name = "HttpLongPoll"; mode_name = Slice("HttpLongPoll");
} }
} }
auto name = PSTRING() << get_name() << "::Connect::" << mode_name << "::" << raw_connection->debug_str_; auto name = PSTRING() << get_name() << "::Connect::" << mode_name << "::" << raw_connection->debug_str_;

View File

@ -5,6 +5,7 @@
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// //
#pragma once #pragma once
#include "td/actor/impl/Actor-decl.h" #include "td/actor/impl/Actor-decl.h"
#include "td/actor/impl/ActorId-decl.h" #include "td/actor/impl/ActorId-decl.h"
#include "td/actor/impl/EventFull-decl.h" #include "td/actor/impl/EventFull-decl.h"

View File

@ -691,10 +691,10 @@ Status HttpReader::parse_head(MutableSlice head) {
parser.skip('\n'); parser.skip('\n');
content_length_ = 0; content_length_ = 0;
content_type_ = "application/octet-stream"; content_type_ = Slice("application/octet-stream");
content_type_lowercased_ = content_type_.str(); content_type_lowercased_ = content_type_.str();
transfer_encoding_ = ""; transfer_encoding_ = Slice();
content_encoding_ = ""; content_encoding_ = Slice();
query_->keep_alive_ = false; query_->keep_alive_ = false;
query_->headers_.clear(); query_->headers_.clear();

View File

@ -114,7 +114,7 @@ Result<HttpUrl> parse_url(MutableSlice url, HttpUrl::Protocol default_protocol)
query.remove_suffix(1); query.remove_suffix(1);
} }
if (query.empty()) { if (query.empty()) {
query = "/"; query = Slice("/");
} }
string query_str; string query_str;
if (query[0] != '/') { if (query[0] != '/') {

View File

@ -7,6 +7,7 @@
#include "td/utils/check.h" #include "td/utils/check.h"
#include "td/utils/logging.h" #include "td/utils/logging.h"
#include "td/utils/Slice.h"
namespace td { namespace td {
namespace detail { namespace detail {

View File

@ -217,13 +217,13 @@ class DefaultLog : public LogInterface {
switch (log_level) { switch (log_level) {
case VERBOSITY_NAME(FATAL): case VERBOSITY_NAME(FATAL):
case VERBOSITY_NAME(ERROR): case VERBOSITY_NAME(ERROR):
color = TC_RED; color = Slice(TC_RED);
break; break;
case VERBOSITY_NAME(WARNING): case VERBOSITY_NAME(WARNING):
color = TC_YELLOW; color = Slice(TC_YELLOW);
break; break;
case VERBOSITY_NAME(INFO): case VERBOSITY_NAME(INFO):
color = TC_CYAN; color = Slice(TC_CYAN);
break; break;
} }
TsCerr() << color << slice << TC_EMPTY; TsCerr() << color << slice << TC_EMPTY;