stop overusing std::endl

This commit is contained in:
Sébastien Bourdeauducq 2025-01-20 20:26:25 +08:00
parent 6dc6307045
commit e1e70e7618
2 changed files with 12 additions and 12 deletions

View File

@ -23,7 +23,7 @@ Json::Value Kirdy::command(Json::Value &request)
Json::Value reply;
JSONCPP_STRING err;
if(!reader->parse(reply_str.data(), reply_str.data() + reply_str.size(), &reply, &err))
std::cerr << "JSON parse error: " << err << std::endl;
std::cerr << "JSON parse error: " << err << "\n";
return reply;
}
@ -41,5 +41,5 @@ void Kirdy::set_tec_current(float amps)
request["tec_set_i"] = amps;
Json::Value reply = command(request);
if(reply["msg_type"].asString() != "Acknowledge")
std::cerr << "TEC set current failed" << std::endl;
std::cerr << "TEC set current failed\n";
}

View File

@ -55,7 +55,7 @@ static void dsp_thread()
hdl = sio_open(SIO_DEVANY, SIO_PLAY|SIO_REC, 1);
if(hdl == nullptr) {
std::cerr << "failed to open sound device" << std::endl;
std::cerr << "failed to open sound device\n";
return;
}
sio_initpar(&par);
@ -67,12 +67,12 @@ static void dsp_thread()
par.le = SIO_LE_NATIVE;
par.xrun = SIO_ERROR;
if(!sio_setpar(hdl, &par)) {
std::cerr << "failed to set sound device parameters" << std::endl;
std::cerr << "failed to set sound device parameters\n";
sio_close(hdl);
return;
}
if(!sio_getpar(hdl, &par)) {
std::cerr << "failed to get back sound device parameters" << std::endl;
std::cerr << "failed to get back sound device parameters\n";
sio_close(hdl);
return;
}
@ -82,13 +82,13 @@ static void dsp_thread()
|| par.rchan != SND_RCHAN
|| par.rate != SND_RATE
|| par.le != SIO_LE_NATIVE) {
std::cerr << "sound device parameter mismatch" << std::endl;
std::cerr << "sound device parameter mismatch\n";
sio_close(hdl);
return;
}
if(!sio_start(hdl)) {
std::cerr << "failed to start sound device" << std::endl;
std::cerr << "failed to start sound device\n";
sio_close(hdl);
return;
}
@ -134,7 +134,7 @@ static void dsp_thread()
phase_t ftw = frequency_to_ftw(frequency[i]/SND_RATE);
dds[i].ftw = ftw;
if(!ftw_fifo[i].push(ftw))
std::cerr << "FTW FIFO overflow" << std::endl;
std::cerr << "FTW FIFO overflow\n";
}
for(int i=0;i<SND_PCHAN;i++) {
double scale = amplitude[i]*(pow(2.0, SND_BITS-1) - 1.0);
@ -156,7 +156,7 @@ static void dsp_thread()
if(ftw.has_value())
lockin[i].ftw = ftw.value();
else
std::cerr << "FTW FIFO underflow" << std::endl;
std::cerr << "FTW FIFO underflow\n";
}
buf_in_offset -= sizeof(buf_in);
}
@ -236,7 +236,7 @@ static void dsp_thread()
}
if(sio_eof(hdl)) {
std::cerr << "sound I/O error" << std::endl;
std::cerr << "sound I/O error\n";
sio_close(hdl);
return;
}
@ -282,7 +282,7 @@ static void servo_thread(int channel)
int main(int argc, char* argv[])
{
if(!glfwInit()) {
std::cerr << "failed to initialize GLFW" << std::endl;
std::cerr << "failed to initialize GLFW\n";
return 1;
}
std::atexit(glfwTerminate);
@ -290,7 +290,7 @@ int main(int argc, char* argv[])
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);
static GLFWwindow *window = glfwCreateWindow(1024, 1200, "Soundlocker", nullptr, nullptr);
if(window == nullptr) {
std::cerr << "failed to create GLFW window" << std::endl;
std::cerr << "failed to create GLFW window\n";
return 1;
}
static auto DestroyWindow = []() {