[asterisk-commits] file: trunk r41974 - in /trunk:
include/asterisk/frame.h main/frame.c
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Sun Sep 3 20:18:12 MST 2006
Author: file
Date: Sun Sep 3 22:18:12 2006
New Revision: 41974
URL: http://svn.digium.com/view/asterisk?rev=41974&view=rev
Log:
Remove old unused functions
Modified:
trunk/include/asterisk/frame.h
trunk/main/frame.c
Modified: trunk/include/asterisk/frame.h
URL: http://svn.digium.com/view/asterisk/trunk/include/asterisk/frame.h?rev=41974&r1=41973&r2=41974&view=diff
==============================================================================
--- trunk/include/asterisk/frame.h (original)
+++ trunk/include/asterisk/frame.h Sun Sep 3 22:18:12 2006
@@ -386,28 +386,6 @@
*/
struct ast_frame *ast_frdup(const struct ast_frame *fr);
-/*! \brief Reads a frame from an fd
- * Read a frame from a stream or packet fd, as written by fd_write
- * \param fd an opened fd to read from
- * \return returns a frame on success, NULL on error
- */
-struct ast_frame *ast_fr_fdread(int fd);
-
-/*! Writes a frame to an fd
- * Write a frame to an fd
- * \param fd Which fd to write to
- * \param frame frame to write to the fd
- * \return Returns 0 on success, -1 on failure
- */
-int ast_fr_fdwrite(int fd, struct ast_frame *frame);
-
-/*! \brief Sends a hangup to an fd
- * Send a hangup (NULL equivalent) on an fd
- * \param fd fd to write to
- * \return Returns 0 on success, -1 on failure
- */
-int ast_fr_fdhangup(int fd);
-
void ast_swapcopy_samples(void *dst, const void *src, int samples);
/* Helpers for byteswapping native samples to/from
Modified: trunk/main/frame.c
URL: http://svn.digium.com/view/asterisk/trunk/main/frame.c?rev=41974&r1=41973&r2=41974&view=diff
==============================================================================
--- trunk/main/frame.c (original)
+++ trunk/main/frame.c Sun Sep 3 22:18:12 2006
@@ -482,91 +482,6 @@
return out;
}
-#if 0
-/*
- * XXX
- * This function is badly broken - it does not handle correctly
- * partial reads on either header or body.
- * However is it never used anywhere so we leave it commented out
- */
-struct ast_frame *ast_fr_fdread(int fd)
-{
- char buf[65536];
- int res;
- struct ast_frame *f = (struct ast_frame *)buf;
- int ttl = sizeof(*f);
- /* Read a frame directly from there. They're always in the
- right format. */
-
- while(ttl) {
- res = read(fd, buf, ttl);
- if (res < 0) {
- ast_log(LOG_WARNING, "Bad read on %d: %s\n", fd, strerror(errno));
- return NULL;
- }
- ttl -= res;
- }
-
- /* read the frame header */
-
- /* Re-write data position */
- f->data = buf + sizeof(*f);
- f->offset = 0;
- /* Forget about being mallocd */
- f->mallocd = 0;
- /* Re-write the source */
- f->src = (char *)__FUNCTION__;
- if (f->datalen > sizeof(buf) - sizeof(*f)) {
- /* Really bad read */
- ast_log(LOG_WARNING, "Strange read (%d bytes)\n", f->datalen);
- return NULL;
- }
- if (f->datalen) {
- if ((res = read(fd, f->data, f->datalen)) != f->datalen) {
- /* Bad read */
- ast_log(LOG_WARNING, "How very strange, expected %d, got %d\n", f->datalen, res);
- return NULL;
- }
- }
- if ((f->frametype == AST_FRAME_CONTROL) && (f->subclass == AST_CONTROL_HANGUP)) {
- return NULL;
- }
- return ast_frisolate(f);
-}
-
-/* Some convenient routines for sending frames to/from stream or datagram
- sockets, pipes, etc (maybe even files) */
-
-/*
- * XXX this function is also partly broken because it does not handle
- * partial writes. We comment it out too, and also the unique
- * client it has, ast_fr_fdhangup()
- */
-int ast_fr_fdwrite(int fd, struct ast_frame *frame)
-{
- /* Write the frame exactly */
- if (write(fd, frame, sizeof(*frame)) != sizeof(*frame)) {
- ast_log(LOG_WARNING, "Write error: %s\n", strerror(errno));
- return -1;
- }
- if (write(fd, frame->data, frame->datalen) != frame->datalen) {
- ast_log(LOG_WARNING, "Write error: %s\n", strerror(errno));
- return -1;
- }
- return 0;
-}
-
-int ast_fr_fdhangup(int fd)
-{
- struct ast_frame hangup = {
- AST_FRAME_CONTROL,
- AST_CONTROL_HANGUP
- };
- return ast_fr_fdwrite(fd, &hangup);
-}
-
-#endif /* unused functions */
-
void ast_swapcopy_samples(void *dst, const void *src, int samples)
{
int i;
More information about the asterisk-commits
mailing list