while (1) -> while (true)
authorCarl Hetherington <cth@carlh.net>
Tue, 1 Jul 2014 12:43:41 +0000 (13:43 +0100)
committerCarl Hetherington <cth@carlh.net>
Tue, 1 Jul 2014 12:43:41 +0000 (13:43 +0100)
22 files changed:
src/lib/cross.cc
src/lib/ffmpeg_decoder.cc
src/lib/ffmpeg_examiner.cc
src/lib/file_group.cc
src/lib/filter_graph.cc
src/lib/internet.cc
src/lib/job_manager.cc
src/lib/json_server.cc
src/lib/resampler.cc
src/lib/server.cc
src/lib/server_finder.cc
src/lib/update.cc
src/lib/writer.cc
src/tools/dcpomatic.cc
src/tools/dcpomatic_batch.cc
src/tools/dcpomatic_cli.cc
src/tools/dcpomatic_create.cc
src/tools/dcpomatic_kdm.cc
src/tools/dcpomatic_server_cli.cc
src/tools/server_test.cc
src/wx/film_editor.cc
test/job_test.cc

index 70f643913abfa9cab7e22b20858fc7edc7648602..e30cf64598f57e717745cc22291022ebbb0eccac 100644 (file)
@@ -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;
index a51b521d0fe22918010a6976c5ae754dd9d8e051..07f988e2baeaac6d5702e0238781bbce2d651367 100644 (file)
@@ -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;
index d73063083f894fa82a39e5dd316796ac97f79589..bc82a9700f8c3b254ea287c43483919299a37de7 100644 (file)
@@ -63,7 +63,7 @@ FFmpegExaminer::FFmpegExaminer (shared_ptr<const FFmpegContent> 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;
index 9d042554c5b8c0649385456895d0358d813a7b0c..048f6923316e2cae13edfa9033daaa982f143db3 100644 (file)
@@ -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) {
index a36a41f43c651abe8073a20f278411e95e848073..c11ee633185aabac54837744b99604fa1f3b359a 100644 (file)
@@ -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;
                }
index c3f9dce659522099a13b047477494307ecaf3a18..99ae5c2142ed255d3731e1a667591e811bc63bb9 100644 (file)
@@ -80,7 +80,7 @@ get_from_zip_url (string url, string file, function<void (boost::filesystem::pat
        ScopedTemporary temp_cert;
        f = temp_cert.open ("wb");
        char buffer[4096];
-       while (1) {
+       while (true) {
                int const N = zip_fread (zip_file, buffer, sizeof (buffer));
                fwrite (buffer, 1, N, f);
                if (N < int (sizeof (buffer))) {
index 056b9f925e1b237946122d804241614bb87f416c..2b727b0aaa43985942674f07d4f881051369236b 100644 (file)
@@ -106,7 +106,7 @@ JobManager::errors () const
 void
 JobManager::scheduler ()
 {
-       while (1) {
+       while (true) {
 
                bool active_jobs = false;
 
index f4aa292d7779ca8cee77af2855b489242738d6fe..1be3c7d0e9d894698534d84d6df4aaeaea265c30 100644 (file)
@@ -58,7 +58,7 @@ try
 {
        boost::asio::io_service io_service;
        tcp::acceptor a (io_service, tcp::endpoint (tcp::v4 (), port));
-       while (1) {
+       while (true) {
                try {
                        shared_ptr<tcp::socket> s (new tcp::socket (io_service));
                        a.accept (*s);
@@ -80,7 +80,7 @@ JSONServer::handle (shared_ptr<tcp::socket> 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);
index e6b1623d9cbeb3afbe7df32a758323d9980b36b9..e7f50c4b7bf7fc2174248b2317d3d50d45813da9 100644 (file)
@@ -91,7 +91,7 @@ Resampler::flush ()
        int64_t const pass_size = 256;
        shared_ptr<AudioBuffers> 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) {
index 7450fd12e476324c190b9b93aa9e68b1e0ac4c35..f1c6d6c44afd0e34d6eb3436a1a493042a6a52c8 100644 (file)
@@ -115,7 +115,7 @@ Server::process (shared_ptr<Socket> 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> socket (new Socket);
                acceptor.accept (socket->socket ());
 
index ed6016c6723f51e1be2f028b67fc952fda482978..65e0940a0a11aab9469f32247a0a58ba36e11ba3 100644 (file)
@@ -103,7 +103,7 @@ void
 ServerFinder::listen_thread ()
 try
 {
-       while (1) {
+       while (true) {
                shared_ptr<Socket> sock (new Socket (60));
 
                try {
index 34eaf385c92e77340b361ad634705083a938a459..af3e46f0e7d14ea1abb8d64c4c4e467143588547 100644 (file)
@@ -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);
index 01da6d3b4d9e6c5aad73287e0a8ed8d4c8d1f616..66ddb58f7e901e0c32a14aa3f5414739cc8c1c68 100644 (file)
@@ -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 = _job.lock ();
                assert (job);
index 588fd5c486da54bd037cf2228bcaa05ceac4c448..aeb62a44e5f2cfd2b7cf5c92511fd2bec83b69a8 100644 (file)
@@ -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."));
index 58fbaec985a4c369c9de547d869fd87cd9082f9e..49b341443e4bebaeae755563deae93299efd1d74 100644 (file)
@@ -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."));
index 8fed28f18039217e82aa618e36e985f0d98f695e..ff948e9fbbae1472089acfc10594c0c914c03f0e 100644 (file)
@@ -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);
                }
        }
index c30f4e51e7fc66c7963f3aaa2f65b3c7b9c1296d..26de1c71f8f2485bf273135f110bca61dc9a1bb6 100644 (file)
@@ -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'},
index 8c26ba4ccc5cba33eb8eadd0b06cfae9e9bf461a..092a1ca1b0725027a5026491ea1efb54b93a7866 100644 (file)
@@ -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'},
index 56802d8aef07a43b357c8371767d5d83eea33826..e4ac85f4cb6d48f47f19786238ec1a5c221fddc6 100644 (file)
@@ -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'},
index 896517b270ae0bfc293f3505d208abb491a213fd..a5d31fc086444e70c3bc07b11235df356ea04d3e 100644 (file)
@@ -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'},
index de215a0d294298a484f6407715ef7d9bb9b55933..854877ecec86d1e063b982a95dc6fc9222facac6 100644 (file)
@@ -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;
index 4d32b1e0ccf8692497f5be9778b594d2485b98d2..a77bc949ce123e7e851ea23d038315039476b1a9 100644 (file)
@@ -44,7 +44,7 @@ public:
 
        void run ()
        {
-               while (1) {
+               while (true) {
                        if (finished ()) {
                                return;
                        }