Commit 7a2606aa authored by shans's avatar shans

(1) changed reported type of oggz_seek to use loff_t instead of off_t in the .h

file.  In the oggz_seek.c, oggz_off_t is used, which is defined in config.h to 
be loff_t on my platform.  Not sure how to resolve this properly.
(2) Some minor formatting changes
(3) Prevented oggz_write from returning a user error when hungry writing ran
out of packets



git-svn-id: http://svn.annodex.net/liboggz/trunk@2540 8158c8cd-e7e1-0310-9fa4-c5954c97daef
parent b2957fb7
......@@ -137,7 +137,7 @@ off_t oggz_tell (OGGZ * oggz);
* \param whence As defined in <stdio.h>: SEEK_SET, SEEK_CUR or SEEK_END
* \returns the new file offset, or -1 on failure.
*/
off_t oggz_seek (OGGZ * oggz, off_t offset, int whence);
off_t oggz_seek (OGGZ * oggz, loff_t offset, int whence);
#ifdef _UNIMPLEMENTED
long oggz_seek_packets (OGGZ * oggz, long serialno, long packets, int whence);
......
......@@ -87,8 +87,10 @@ oggz_io_write (OGGZ * oggz, void * buf, size_t n)
bytes = io->write (io->write_user_handle, buf, n);
}
else return (size_t) OGGZ_ERR_INVALID;
else {
return (size_t) OGGZ_ERR_INVALID;
}
return bytes;
}
......
......@@ -564,12 +564,15 @@ oggz_dequeue_packet (OGGZ * oggz, oggz_writer_packet_t ** next_zpacket)
if (*next_zpacket == NULL) {
if (writer->hungry) {
ret = writer->hungry (oggz, 1, writer->hungry_user_data);
*next_zpacket = oggz_vector_pop (writer->packet_queue);
ret = writer->hungry (oggz, 1, writer->hungry_user_data);
*next_zpacket = oggz_vector_pop (writer->packet_queue);
}
}
}
#ifdef DEBUG
printf("oggz_dequeue_packeT: returning %d\n", ret);
#endif
return ret;
}
......@@ -621,6 +624,10 @@ oggz_writer_make_packet (OGGZ * oggz)
}
}
#ifdef DEBUG
printf("oggz_writer_make_packet: cb_ret is %d\n", cb_ret);
#endif
if (cb_ret == 0 && next_zpacket == NULL) return OGGZ_WRITE_EMPTY;
return cb_ret;
......@@ -713,6 +720,7 @@ oggz_write (OGGZ * oggz, long n)
if ((cb_ret = oggz->cb_next) != OGGZ_CONTINUE) {
oggz->cb_next = 0;
if (cb_ret == OGGZ_WRITE_EMPTY) cb_ret = 0;
return oggz_map_return_value_to_error (cb_ret);
}
......@@ -726,14 +734,14 @@ oggz_write (OGGZ * oggz, long n)
while (writer->state == OGGZ_MAKING_PACKETS) {
if ((cb_ret = oggz_writer_make_packet (oggz)) != OGGZ_CONTINUE) {
active = 0;
active = 0;
#ifdef DEBUG
printf ("oggz_write: no packets\n");
printf ("oggz_write: no packets (cb_ret is %d)\n", cb_ret);
#endif
break;
break;
}
if (oggz_page_init (oggz)) {
writer->state = OGGZ_WRITING_PAGES;
writer->state = OGGZ_WRITING_PAGES;
}
}
......@@ -741,8 +749,8 @@ oggz_write (OGGZ * oggz, long n)
bytes_written = oggz_page_writeout (oggz, bytes);
if (bytes_written == -1) {
active = 0;
return OGGZ_ERR_SYSTEM; /* XXX: catch next */
active = 0;
return OGGZ_ERR_SYSTEM; /* XXX: catch next */
} else if (bytes_written == 0) {
if (!oggz_page_init (oggz)) {
#ifdef DEBUG
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment