trunk/src/lib/util/chd.c
| r23842 | r23843 | |
| 2422 | 2422 | |
| 2423 | 2423 | chd_error chd_file_compressor::compress_continue(double &progress, double &ratio) |
| 2424 | 2424 | { |
| 2425 | // if we got an error, return an error |
| 2426 | if (m_read_error) |
| 2427 | return CHDERR_READ_ERROR; |
| 2428 | |
| 2425 | 2429 | // if done reading, queue some more |
| 2426 | 2430 | while (m_read_queue_offset < m_logicalbytes && osd_work_queue_items(m_read_queue) < 2) |
| 2427 | 2431 | { |
| 2428 | | // if we got an error, return an error |
| 2429 | | if (m_read_error) |
| 2430 | | return CHDERR_READ_ERROR; |
| 2431 | | |
| 2432 | 2432 | // see if we have enough free work items to read the next half of a buffer |
| 2433 | 2433 | UINT32 startitem = m_read_queue_offset / hunk_bytes(); |
| 2434 | 2434 | UINT32 enditem = startitem + WORK_BUFFER_HUNKS / 2; |
| r23842 | r23843 | |
| 2690 | 2690 | // advance the read pointer |
| 2691 | 2691 | m_read_done_offset += numbytes; |
| 2692 | 2692 | } |
| 2693 | | catch (...) |
| 2693 | catch (std::exception& ex) |
| 2694 | 2694 | { |
| 2695 | fprintf(stderr, "exception occured: %s\n", ex.what()); |
| 2695 | 2696 | m_read_error = true; |
| 2696 | 2697 | } |
| 2697 | 2698 | } |