This is an automatic generated email to let you know that the following patch 
were queued at the 
http://git.linuxtv.org/v4l-utils.git tree:

Subject: helper.c: run through checkpatch.pl
Author:  Hans Verkuil <hverk...@xs4all.nl>
Date:    Wed Apr 28 08:41:47 2010 +0200

Signed-off-by: Hans Verkuil <hverk...@xs4all.nl>

 lib/libv4lconvert/helper.c |  259 ++++++++++++++++++++++----------------------
 1 files changed, 129 insertions(+), 130 deletions(-)

---

http://git.linuxtv.org/v4l-utils.git?a=commitdiff;h=3b526f7709c90449f5459bfffb0bf7e3d7e79199

diff --git a/lib/libv4lconvert/helper.c b/lib/libv4lconvert/helper.c
index c1d55c2..7674dee 100644
--- a/lib/libv4lconvert/helper.c
+++ b/lib/libv4lconvert/helper.c
@@ -14,7 +14,7 @@
 # You should have received a copy of the GNU Lesser General Public License
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-*/
+ */
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -46,66 +46,66 @@
    From the helper to libv4l the following is send:
    int                 data length (-1 in case of a decompression error)
    unsigned char[]     data (not present when a decompression error happened)
-*/
+ */
 
 static int v4lconvert_helper_start(struct v4lconvert_data *data,
-  const char *helper)
+               const char *helper)
 {
-  if (pipe(data->decompress_in_pipe)) {
-    V4LCONVERT_ERR("with helper pipe: %s\n", strerror(errno));
-    goto error;
-  }
-
-  if (pipe(data->decompress_out_pipe)) {
-    V4LCONVERT_ERR("with helper pipe: %s\n", strerror(errno));
-    goto error_close_in_pipe;
-  }
-
-  data->decompress_pid = fork();
-  if (data->decompress_pid == -1) {
-    V4LCONVERT_ERR("with helper fork: %s\n", strerror(errno));
-    goto error_close_out_pipe;
-  }
-
-  if (data->decompress_pid == 0) {
-    /* We are the child */
-
-    /* Closed unused read / write end of the pipes */
-    close(data->decompress_out_pipe[WRITE_END]);
-    close(data->decompress_in_pipe[READ_END]);
-
-    /* Connect stdin / out to the pipes */
-    if (dup2(data->decompress_out_pipe[READ_END], STDIN_FILENO) == -1) {
-      perror("libv4lconvert: error with helper dup2");
-      exit(1);
-    }
-    if (dup2(data->decompress_in_pipe[WRITE_END], STDOUT_FILENO) == -1) {
-      perror("libv4lconvert: error with helper dup2");
-      exit(1);
-    }
-
-    /* And execute the helper */
-    execl(helper, helper, NULL);
-
-    /* We should never get here */
-    perror("libv4lconvert: error starting helper");
-    exit(1);
-  } else {
-    /* Closed unused read / write end of the pipes */
-    close(data->decompress_out_pipe[READ_END]);
-    close(data->decompress_in_pipe[WRITE_END]);
-  }
-
-  return 0;
+       if (pipe(data->decompress_in_pipe)) {
+               V4LCONVERT_ERR("with helper pipe: %s\n", strerror(errno));
+               goto error;
+       }
+
+       if (pipe(data->decompress_out_pipe)) {
+               V4LCONVERT_ERR("with helper pipe: %s\n", strerror(errno));
+               goto error_close_in_pipe;
+       }
+
+       data->decompress_pid = fork();
+       if (data->decompress_pid == -1) {
+               V4LCONVERT_ERR("with helper fork: %s\n", strerror(errno));
+               goto error_close_out_pipe;
+       }
+
+       if (data->decompress_pid == 0) {
+               /* We are the child */
+
+               /* Closed unused read / write end of the pipes */
+               close(data->decompress_out_pipe[WRITE_END]);
+               close(data->decompress_in_pipe[READ_END]);
+
+               /* Connect stdin / out to the pipes */
+               if (dup2(data->decompress_out_pipe[READ_END], STDIN_FILENO) == 
-1) {
+                       perror("libv4lconvert: error with helper dup2");
+                       exit(1);
+               }
+               if (dup2(data->decompress_in_pipe[WRITE_END], STDOUT_FILENO) == 
-1) {
+                       perror("libv4lconvert: error with helper dup2");
+                       exit(1);
+               }
+
+               /* And execute the helper */
+               execl(helper, helper, NULL);
+
+               /* We should never get here */
+               perror("libv4lconvert: error starting helper");
+               exit(1);
+       } else {
+               /* Closed unused read / write end of the pipes */
+               close(data->decompress_out_pipe[READ_END]);
+               close(data->decompress_in_pipe[WRITE_END]);
+       }
+
+       return 0;
 
 error_close_out_pipe:
-  close(data->decompress_out_pipe[READ_END]);
-  close(data->decompress_out_pipe[WRITE_END]);
+       close(data->decompress_out_pipe[READ_END]);
+       close(data->decompress_out_pipe[WRITE_END]);
 error_close_in_pipe:
-  close(data->decompress_in_pipe[READ_END]);
-  close(data->decompress_in_pipe[WRITE_END]);
+       close(data->decompress_in_pipe[READ_END]);
+       close(data->decompress_in_pipe[WRITE_END]);
 error:
-  return -1;
+       return -1;
 }
 
 /* IMPROVE ME: we could block SIGPIPE here using pthread_sigmask()
@@ -119,106 +119,105 @@ error:
    would mean end of program, so by not handling SIGPIPE we treat
    external decompressors identical. */
 static int v4lconvert_helper_write(struct v4lconvert_data *data,
-  const void *b, size_t count)
+               const void *b, size_t count)
 {
-  const unsigned char *buf = b;
-  const int *i = b;
-  size_t ret, written = 0;
-
-  while (written < count) {
-    ret = write(data->decompress_out_pipe[WRITE_END], buf + written,
-               count - written);
-    if (ret == -1) {
-      if (errno == EINTR)
-       continue;
-
-      V4LCONVERT_ERR("writing to helper: %s\n", strerror(errno));
-      return -1;
-    }
-    written += ret;
-  }
-
-  return 0;
+       const unsigned char *buf = b;
+       size_t ret, written = 0;
+
+       while (written < count) {
+               ret = write(data->decompress_out_pipe[WRITE_END], buf + written,
+                               count - written);
+               if (ret == -1) {
+                       if (errno == EINTR)
+                               continue;
+
+                       V4LCONVERT_ERR("writing to helper: %s\n", 
strerror(errno));
+                       return -1;
+               }
+               written += ret;
+       }
+
+       return 0;
 }
 
 static int v4lconvert_helper_read(struct v4lconvert_data *data, void *b,
-  size_t count)
+               size_t count)
 {
-  unsigned char *buf = b;
-  size_t ret, r = 0;
-
-  while (r < count) {
-    ret = read(data->decompress_in_pipe[READ_END], buf + r, count - r);
-    if (ret == -1) {
-      if (errno == EINTR)
-       continue;
-
-      V4LCONVERT_ERR("reading from helper: %s\n", strerror(errno));
-      return -1;
-    }
-    if (ret == 0) {
-      V4LCONVERT_ERR("reading from helper: unexpected EOF\n");
-      return -1;
-    }
-    r += ret;
-  }
-
-  return 0;
+       unsigned char *buf = b;
+       size_t ret, r = 0;
+
+       while (r < count) {
+               ret = read(data->decompress_in_pipe[READ_END], buf + r, count - 
r);
+               if (ret == -1) {
+                       if (errno == EINTR)
+                               continue;
+
+                       V4LCONVERT_ERR("reading from helper: %s\n", 
strerror(errno));
+                       return -1;
+               }
+               if (ret == 0) {
+                       V4LCONVERT_ERR("reading from helper: unexpected EOF\n");
+                       return -1;
+               }
+               r += ret;
+       }
+
+       return 0;
 }
 
 int v4lconvert_helper_decompress(struct v4lconvert_data *data,
-  const char *helper, const unsigned char *src, int src_size,
-  unsigned char *dest, int dest_size, int width, int height, int flags)
+               const char *helper, const unsigned char *src, int src_size,
+               unsigned char *dest, int dest_size, int width, int height, int 
flags)
 {
-  int r;
+       int r;
 
-  if (data->decompress_pid == -1) {
-    if (v4lconvert_helper_start(data, helper))
-      return -1;
-  }
+       if (data->decompress_pid == -1) {
+               if (v4lconvert_helper_start(data, helper))
+                       return -1;
+       }
 
-  if (v4lconvert_helper_write(data, &width, sizeof(int)))
-    return -1;
+       if (v4lconvert_helper_write(data, &width, sizeof(int)))
+               return -1;
 
-  if (v4lconvert_helper_write(data, &height, sizeof(int)))
-    return -1;
+       if (v4lconvert_helper_write(data, &height, sizeof(int)))
+               return -1;
 
-  if (v4lconvert_helper_write(data, &flags, sizeof(int)))
-    return -1;
+       if (v4lconvert_helper_write(data, &flags, sizeof(int)))
+               return -1;
 
-  if (v4lconvert_helper_write(data, &src_size, sizeof(int)))
-    return -1;
+       if (v4lconvert_helper_write(data, &src_size, sizeof(int)))
+               return -1;
 
-  if (v4lconvert_helper_write(data, src, src_size))
-    return -1;
+       if (v4lconvert_helper_write(data, src, src_size))
+               return -1;
 
-  if (v4lconvert_helper_read(data, &r, sizeof(int)))
-    return -1;
+       if (v4lconvert_helper_read(data, &r, sizeof(int)))
+               return -1;
 
-  if (r < 0) {
-    V4LCONVERT_ERR("decompressing frame data\n");
-    return -1;
-  }
+       if (r < 0) {
+               V4LCONVERT_ERR("decompressing frame data\n");
+               return -1;
+       }
 
-  if (dest_size < r) {
-    V4LCONVERT_ERR("destination buffer to small\n");
-    return -1;
-  }
+       if (dest_size < r) {
+               V4LCONVERT_ERR("destination buffer to small\n");
+               return -1;
+       }
 
-  return v4lconvert_helper_read(data, dest, r);
+       return v4lconvert_helper_read(data, dest, r);
 }
 
 void v4lconvert_helper_cleanup(struct v4lconvert_data *data)
 {
-  int status;
+       int status;
 
-  if (data->decompress_pid != -1) {
-    kill(data->decompress_pid, SIGTERM);
-    waitpid(data->decompress_pid, &status, 0);
+       if (data->decompress_pid != -1) {
+               kill(data->decompress_pid, SIGTERM);
+               waitpid(data->decompress_pid, &status, 0);
 
-    close(data->decompress_out_pipe[WRITE_END]);
-    close(data->decompress_in_pipe[READ_END]);
+               close(data->decompress_out_pipe[WRITE_END]);
+               close(data->decompress_in_pipe[READ_END]);
 
-    data->decompress_pid = -1;
-  }
+               data->decompress_pid = -1;
+       }
 }

_______________________________________________
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to