From 6bc83f72f12c8513a1e9e9b6fd880697a73f968f Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 1 Jul 2014 13:43:41 +0100 Subject: [PATCH] while (1) -> while (true) --- src/lib/cross.cc | 4 ++-- src/lib/ffmpeg_decoder.cc | 2 +- src/lib/ffmpeg_examiner.cc | 2 +- src/lib/file_group.cc | 2 +- src/lib/filter_graph.cc | 2 +- src/lib/internet.cc | 2 +- src/lib/job_manager.cc | 2 +- src/lib/json_server.cc | 4 ++-- src/lib/resampler.cc | 2 +- src/lib/server.cc | 4 ++-- src/lib/server_finder.cc | 2 +- src/lib/update.cc | 2 +- src/lib/writer.cc | 6 +++--- src/tools/dcpomatic.cc | 2 +- src/tools/dcpomatic_batch.cc | 2 +- src/tools/dcpomatic_cli.cc | 4 ++-- src/tools/dcpomatic_create.cc | 2 +- src/tools/dcpomatic_kdm.cc | 2 +- src/tools/dcpomatic_server_cli.cc | 2 +- src/tools/server_test.cc | 2 +- src/wx/film_editor.cc | 2 +- test/job_test.cc | 2 +- 22 files changed, 28 insertions(+), 28 deletions(-) diff --git a/src/lib/cross.cc b/src/lib/cross.cc index 70f643913..e30cf6459 100644 --- a/src/lib/cross.cc +++ b/src/lib/cross.cc @@ -202,7 +202,7 @@ run_ffprobe (boost::filesystem::path content, boost::filesystem::path out, share CloseHandle (child_stderr_write); - while (1) { + while (true) { char buffer[512]; DWORD read; if (!ReadFile(child_stderr_read, buffer, sizeof(buffer), &read, 0) || read == 0) { @@ -247,7 +247,7 @@ mount_info () return m; } - while (1) { + while (true) { struct mntent* mnt = getmntent (f); if (!mnt) { break; diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc index a51b521d0..07f988e2b 100644 --- a/src/lib/ffmpeg_decoder.cc +++ b/src/lib/ffmpeg_decoder.cc @@ -360,7 +360,7 @@ FFmpegDecoder::seek (VideoContent::Frame frame, bool accurate) return; } - while (1) { + while (true) { int r = av_read_frame (_format_context, &_packet); if (r < 0) { return; diff --git a/src/lib/ffmpeg_examiner.cc b/src/lib/ffmpeg_examiner.cc index d73063083..bc82a9700 100644 --- a/src/lib/ffmpeg_examiner.cc +++ b/src/lib/ffmpeg_examiner.cc @@ -63,7 +63,7 @@ FFmpegExaminer::FFmpegExaminer (shared_ptr c) /* Run through until we find the first audio (for each stream) and video */ - while (1) { + while (true) { int r = av_read_frame (_format_context, &_packet); if (r < 0) { break; diff --git a/src/lib/file_group.cc b/src/lib/file_group.cc index 9d042554c..048f69233 100644 --- a/src/lib/file_group.cc +++ b/src/lib/file_group.cc @@ -142,7 +142,7 @@ int FileGroup::read (uint8_t* buffer, int amount) const { int read = 0; - while (1) { + while (true) { int const this_time = fread (buffer + read, 1, amount - read, _current_file); read += this_time; if (read == amount) { diff --git a/src/lib/filter_graph.cc b/src/lib/filter_graph.cc index a36a41f43..c11ee6331 100644 --- a/src/lib/filter_graph.cc +++ b/src/lib/filter_graph.cc @@ -142,7 +142,7 @@ FilterGraph::process (AVFrame* frame) throw DecodeError (N_("could not push buffer into filter chain.")); } - while (1) { + while (true) { if (av_buffersink_get_frame (_buffer_sink_context, _frame) < 0) { break; } diff --git a/src/lib/internet.cc b/src/lib/internet.cc index c3f9dce65..99ae5c214 100644 --- a/src/lib/internet.cc +++ b/src/lib/internet.cc @@ -80,7 +80,7 @@ get_from_zip_url (string url, string file, function s (new tcp::socket (io_service)); a.accept (*s); @@ -80,7 +80,7 @@ JSONServer::handle (shared_ptr socket) string url; State state = AWAITING_G; - while (1) { + while (true) { char data[MAX_LENGTH]; boost::system::error_code error; size_t len = socket->read_some (boost::asio::buffer (data), error); diff --git a/src/lib/resampler.cc b/src/lib/resampler.cc index e6b1623d9..e7f50c4b7 100644 --- a/src/lib/resampler.cc +++ b/src/lib/resampler.cc @@ -91,7 +91,7 @@ Resampler::flush () int64_t const pass_size = 256; shared_ptr pass (new AudioBuffers (_channels, 256)); - while (1) { + while (true) { int const frames = swr_convert (_swr_context, (uint8_t **) pass->data(), pass_size, 0, 0); if (frames < 0) { diff --git a/src/lib/server.cc b/src/lib/server.cc index 7450fd12e..f1c6d6c44 100644 --- a/src/lib/server.cc +++ b/src/lib/server.cc @@ -115,7 +115,7 @@ Server::process (shared_ptr socket, struct timeval& after_read, struct t void Server::worker_thread () { - while (1) { + while (true) { boost::mutex::scoped_lock lock (_worker_mutex); while (_queue.empty ()) { _empty_condition.wait (lock); @@ -194,7 +194,7 @@ Server::run (int num_threads) boost::asio::ip::tcp::endpoint (boost::asio::ip::tcp::v4(), Config::instance()->server_port_base ()) ); - while (1) { + while (true) { shared_ptr socket (new Socket); acceptor.accept (socket->socket ()); diff --git a/src/lib/server_finder.cc b/src/lib/server_finder.cc index ed6016c67..65e0940a0 100644 --- a/src/lib/server_finder.cc +++ b/src/lib/server_finder.cc @@ -103,7 +103,7 @@ void ServerFinder::listen_thread () try { - while (1) { + while (true) { shared_ptr sock (new Socket (60)); try { diff --git a/src/lib/update.cc b/src/lib/update.cc index 34eaf385c..af3e46f0e 100644 --- a/src/lib/update.cc +++ b/src/lib/update.cc @@ -85,7 +85,7 @@ UpdateChecker::run () void UpdateChecker::thread () { - while (1) { + while (true) { boost::mutex::scoped_lock lock (_process_mutex); while (_to_do == 0) { _condition.wait (lock); diff --git a/src/lib/writer.cc b/src/lib/writer.cc index 01da6d3b4..66ddb58f7 100644 --- a/src/lib/writer.cc +++ b/src/lib/writer.cc @@ -238,11 +238,11 @@ void Writer::thread () try { - while (1) + while (true) { boost::mutex::scoped_lock lock (_mutex); - while (1) { + while (true) { if (_finish || _queued_full_in_memory > _maximum_frames_in_memory || have_sequenced_image_at_queue_head ()) { /* We've got something to do: go and do it */ @@ -563,7 +563,7 @@ Writer::check_existing_picture_mxf () ++N; } - while (1) { + while (true) { shared_ptr job = _job.lock (); assert (job); diff --git a/src/tools/dcpomatic.cc b/src/tools/dcpomatic.cc index 588fd5c48..aeb62a44e 100644 --- a/src/tools/dcpomatic.cc +++ b/src/tools/dcpomatic.cc @@ -392,7 +392,7 @@ private: ); int r; - while (1) { + while (true) { r = c->ShowModal (); if (r == wxID_OK && c->GetPath() == wxStandardPaths::Get().GetDocumentsDir()) { error_dialog (this, _("You did not select a folder. Make sure that you select a folder before clicking Open.")); diff --git a/src/tools/dcpomatic_batch.cc b/src/tools/dcpomatic_batch.cc index 58fbaec98..49b341443 100644 --- a/src/tools/dcpomatic_batch.cc +++ b/src/tools/dcpomatic_batch.cc @@ -173,7 +173,7 @@ private: } int r; - while (1) { + while (true) { r = c->ShowModal (); if (r == wxID_OK && c->GetPath() == wxStandardPaths::Get().GetDocumentsDir()) { error_dialog (this, _("You did not select a folder. Make sure that you select a folder before clicking Open.")); diff --git a/src/tools/dcpomatic_cli.cc b/src/tools/dcpomatic_cli.cc index 8fed28f18..ff948e9fb 100644 --- a/src/tools/dcpomatic_cli.cc +++ b/src/tools/dcpomatic_cli.cc @@ -69,7 +69,7 @@ main (int argc, char* argv[]) bool keep_going = false; int option_index = 0; - while (1) { + while (true) { static struct option long_options[] = { { "version", no_argument, 0, 'v'}, { "help", no_argument, 0, 'h'}, @@ -212,7 +212,7 @@ main (int argc, char* argv[]) } if (keep_going) { - while (1) { + while (true) { dcpomatic_sleep (3600); } } diff --git a/src/tools/dcpomatic_create.cc b/src/tools/dcpomatic_create.cc index c30f4e51e..26de1c71f 100644 --- a/src/tools/dcpomatic_create.cc +++ b/src/tools/dcpomatic_create.cc @@ -81,7 +81,7 @@ main (int argc, char* argv[]) boost::filesystem::path output; int option_index = 0; - while (1) { + while (true) { static struct option long_options[] = { { "version", no_argument, 0, 'v'}, { "help", no_argument, 0, 'h'}, diff --git a/src/tools/dcpomatic_kdm.cc b/src/tools/dcpomatic_kdm.cc index 8c26ba4cc..092a1ca1b 100644 --- a/src/tools/dcpomatic_kdm.cc +++ b/src/tools/dcpomatic_kdm.cc @@ -116,7 +116,7 @@ int main (int argc, char* argv[]) program_name = argv[0]; int option_index = 0; - while (1) { + while (true) { static struct option long_options[] = { { "help", no_argument, 0, 'h'}, { "output", required_argument, 0, 'o'}, diff --git a/src/tools/dcpomatic_server_cli.cc b/src/tools/dcpomatic_server_cli.cc index 56802d8ae..e4ac85f4c 100644 --- a/src/tools/dcpomatic_server_cli.cc +++ b/src/tools/dcpomatic_server_cli.cc @@ -66,7 +66,7 @@ main (int argc, char* argv[]) bool write_log = false; int option_index = 0; - while (1) { + while (true) { static struct option long_options[] = { { "version", no_argument, 0, 'v'}, { "help", no_argument, 0, 'h'}, diff --git a/src/tools/server_test.cc b/src/tools/server_test.cc index 896517b27..a5d31fc08 100644 --- a/src/tools/server_test.cc +++ b/src/tools/server_test.cc @@ -103,7 +103,7 @@ main (int argc, char* argv[]) string film_dir; string server_host; - while (1) { + while (true) { static struct option long_options[] = { { "help", no_argument, 0, 'h'}, { "server", required_argument, 0, 's'}, diff --git a/src/wx/film_editor.cc b/src/wx/film_editor.cc index de215a0d2..854877ece 100644 --- a/src/wx/film_editor.cc +++ b/src/wx/film_editor.cc @@ -880,7 +880,7 @@ FilmEditor::selected_content () { ContentList sel; long int s = -1; - while (1) { + while (true) { s = _content->GetNextItem (s, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); if (s == -1) { break; diff --git a/test/job_test.cc b/test/job_test.cc index 4d32b1e0c..a77bc949c 100644 --- a/test/job_test.cc +++ b/test/job_test.cc @@ -44,7 +44,7 @@ public: void run () { - while (1) { + while (true) { if (finished ()) { return; } -- 2.30.2