Replace std::endl with "\n"

This commit is contained in:
badaix 2025-01-07 20:29:16 +01:00
parent f1ee39e515
commit cd67fb9645
10 changed files with 28 additions and 31 deletions

View file

@ -1,6 +1,6 @@
/***
This file is part of snapcast
Copyright (C) 2014-2024 Johannes Pohl
Copyright (C) 2014-2025 Johannes Pohl
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
@ -272,7 +272,7 @@ bool BrowseBonjour::browse(const string& serviceName, mDNSResult& result, int /*
return false;
if (resultCollection.size() > 1)
LOG(NOTICE, LOG_TAG) << "Multiple servers found. Using first" << endl;
LOG(NOTICE, LOG_TAG) << "Multiple servers found. Using first" << "\n";
result = resultCollection.front();

View file

@ -1,6 +1,6 @@
/***
This file is part of snapcast
Copyright (C) 2014-2024 Johannes Pohl
Copyright (C) 2014-2025 Johannes Pohl
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
@ -173,7 +173,7 @@ void ClientConnection::connect(const ResultHandler& handler)
return;
}
LOG(NOTICE, LOG_TAG) << "Connected to " << socket_.remote_endpoint().address().to_string() << endl;
LOG(NOTICE, LOG_TAG) << "Connected to " << socket_.remote_endpoint().address().to_string() << "\n";
handler(ec);
getNextMessage();
});

View file

@ -1,6 +1,6 @@
/***
This file is part of snapcast
Copyright (C) 2014-2024 Johannes Pohl
Copyright (C) 2014-2025 Johannes Pohl
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
@ -323,7 +323,7 @@ void Controller::browseMdns(const MdnsHandler& handler)
}
catch (const std::exception& e)
{
LOG(ERROR, LOG_TAG) << "Exception: " << e.what() << std::endl;
LOG(ERROR, LOG_TAG) << "Exception: " << e.what() << "\n";
}
timer_.expires_after(500ms);

View file

@ -1,6 +1,6 @@
/***
This file is part of snapcast
Copyright (C) 2014-2024 Johannes Pohl
Copyright (C) 2014-2025 Johannes Pohl
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
@ -89,7 +89,7 @@ EXTERN_C const PROPERTYKEY DECLSPEC_SELECTANY PKEY_Device_FriendlyName = {{0xa45
if (FAILED(hres)) \
{ \
stringstream ss; \
ss << "HRESULT fault status: " << hex << (hres) << " line " << dec << __LINE__ << endl; \
ss << "HRESULT fault status: " << hex << (hres) << " line " << dec << __LINE__ << "\n"; \
LOG(FATAL, LOG_TAG) << ss.str(); \
throw SnapException(ss.str()); \
}

View file

@ -198,7 +198,7 @@ int main(int argc, char** argv)
}
catch (const std::invalid_argument& e)
{
cerr << "Exception: " << e.what() << std::endl;
cerr << "Exception: " << e.what() << "\n";
cout << "\n" << op << "\n";
exit(EXIT_FAILURE);
}
@ -334,9 +334,9 @@ int main(int argc, char** argv)
processPriority = std::min(std::max(-20, processPriority), 19);
if (processPriority != 0)
setpriority(PRIO_PROCESS, 0, processPriority);
LOG(NOTICE, LOG_TAG) << "daemonizing" << std::endl;
LOG(NOTICE, LOG_TAG) << "daemonizing\n";
daemon->daemonize();
LOG(NOTICE, LOG_TAG) << "daemon started" << std::endl;
LOG(NOTICE, LOG_TAG) << "daemon started\n";
}
#endif
@ -455,10 +455,10 @@ int main(int argc, char** argv)
}
catch (const std::exception& e)
{
LOG(FATAL, LOG_TAG) << "Exception: " << e.what() << std::endl;
LOG(FATAL, LOG_TAG) << "Exception: " << e.what() << "\n";
exitcode = EXIT_FAILURE;
}
LOG(NOTICE, LOG_TAG) << "Snapclient terminated." << endl;
LOG(NOTICE, LOG_TAG) << "Snapclient terminated.\n";
exit(exitcode);
}

View file

@ -1,6 +1,6 @@
/***
This file is part of snapcast
Copyright (C) 2014-2024 Johannes Pohl
Copyright (C) 2014-2025 Johannes Pohl
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
@ -16,8 +16,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef MESSAGE_PCM_CHUNK_HPP
#define MESSAGE_PCM_CHUNK_HPP
#pragma once
// local headers
#include "common/sample_format.hpp"
@ -76,7 +75,7 @@ public:
int readFrames(void* outputBuffer, uint32_t frameCount)
{
// logd << "read: " << frameCount << ", total: " << (wireChunk->length / format.frameSize()) << ", idx: " << idx;// << std::endl;
// logd << "read: " << frameCount << ", total: " << (wireChunk->length / format.frameSize()) << ", idx: " << idx;// << "\n";
int result = frameCount;
if (idx_ + frameCount > (payloadSize / format.frameSize()))
result = (payloadSize / format.frameSize()) - idx_;
@ -167,5 +166,3 @@ private:
uint32_t idx_ = 0;
};
} // namespace msg
#endif

View file

@ -1,6 +1,6 @@
/***
This file is part of snapcast
Copyright (C) 2014-2024 Johannes Pohl
Copyright (C) 2014-2025 Johannes Pohl
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
@ -428,7 +428,7 @@ void Server::start()
}
catch (const std::exception& e)
{
LOG(NOTICE, LOG_TAG) << "Server::start: " << e.what() << endl;
LOG(NOTICE, LOG_TAG) << "Server::start: " << e.what() << "\n";
stop();
throw;
}

View file

@ -1,6 +1,6 @@
/***
This file is part of snapcast
Copyright (C) 2014-2023 Johannes Pohl
Copyright (C) 2014-2025 Johannes Pohl
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
@ -208,13 +208,13 @@ void StreamServer::handleAccept(tcp::socket socket)
/// experimental: turn on tcp::no_delay
socket.set_option(tcp::no_delay(true));
LOG(NOTICE, LOG_TAG) << "StreamServer::NewConnection: " << socket.remote_endpoint().address().to_string() << endl;
LOG(NOTICE, LOG_TAG) << "StreamServer::NewConnection: " << socket.remote_endpoint().address().to_string() << "\n";
shared_ptr<StreamSession> session = make_shared<StreamSessionTcp>(this, std::move(socket));
addSession(session);
}
catch (const std::exception& e)
{
LOG(ERROR, LOG_TAG) << "Exception in StreamServer::handleAccept: " << e.what() << endl;
LOG(ERROR, LOG_TAG) << "Exception in StreamServer::handleAccept: " << e.what() << "\n";
}
startAccept();
}

View file

@ -1,6 +1,6 @@
/***
This file is part of snapcast
Copyright (C) 2014-2024 Johannes Pohl
Copyright (C) 2014-2025 Johannes Pohl
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
@ -341,7 +341,7 @@ void AlsaStream::do_read()
{
if (lastException_ != e.what())
{
LOG(ERROR, LOG_TAG) << "Exception: " << e.what() << std::endl;
LOG(ERROR, LOG_TAG) << "Exception: " << e.what() << "\n";
lastException_ = e.what();
}
first_ = true;

View file

@ -1,6 +1,6 @@
/***
This file is part of snapcast
Copyright (C) 2014-2023 Johannes Pohl
Copyright (C) 2014-2025 Johannes Pohl
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
@ -186,11 +186,11 @@ void LibrespotStream::onStderrMsg(const std::string& line)
size_t title_pos = 0;
size_t ms_pos = 0;
size_t n = 0;
if (((title_pos = line.find("<")) != std::string::npos) && ((n = line.find(">", title_pos)) != std::string::npos) &&
((ms_pos = line.find("(", n)) != std::string::npos) && ((n = line.find("ms) loaded", ms_pos)) != std::string::npos))
if (((title_pos = line.find('<')) != std::string::npos) && ((n = line.find('>', title_pos)) != std::string::npos) &&
((ms_pos = line.find('(', n)) != std::string::npos) && ((n = line.find("ms) loaded", ms_pos)) != std::string::npos))
{
title_pos += 1;
std::string title = line.substr(title_pos, line.find(">", title_pos) - title_pos);
std::string title = line.substr(title_pos, line.find('>', title_pos) - title_pos);
LOG(INFO, LOG_TAG) << "metadata: <" << title << ">\n";
ms_pos += 1;
std::string ms = line.substr(ms_pos, n - ms_pos - 1);
@ -205,7 +205,7 @@ void LibrespotStream::onStderrMsg(const std::string& line)
}
catch (const std::exception& e)
{
LOG(ERROR, LOG_TAG) << "Exception: " << e.what() << std::endl;
LOG(ERROR, LOG_TAG) << "Exception: " << e.what() << "\n";
}
}