From 5ffb84a4f4212266527f4922ab67ad2f7bd34ff9 Mon Sep 17 00:00:00 2001
From: Vincent Becker <vincentx.becker@intel.com>
Date: Tue, 14 Dec 2010 18:08:14 +0100
Subject: [PATCH] Fix return value of pa_sndfile_format_from_string which prevented to use pacat --file-format option correctly
 Signed-off-by: Vincent Becker <vincentx.becker@intel.com>

---
 src/pulsecore/sndfile-util.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/pulsecore/sndfile-util.c b/src/pulsecore/sndfile-util.c
index 4f7f8bd..9d15a86 100644
--- a/src/pulsecore/sndfile-util.c
+++ b/src/pulsecore/sndfile-util.c
@@ -416,7 +416,7 @@ int pa_sndfile_format_from_string(const char *name) {
         pa_assert_se(sf_command(NULL, SFC_GET_FORMAT_MAJOR, &fi, sizeof(fi)) == 0);
 
         if (strcasecmp(name, fi.name) == 0)
-            return i;
+            return fi.format;
     }
 
     /* Then, try to match via the full extension */
@@ -428,7 +428,7 @@ int pa_sndfile_format_from_string(const char *name) {
         pa_assert_se(sf_command(NULL, SFC_GET_FORMAT_MAJOR, &fi, sizeof(fi)) == 0);
 
         if (strcasecmp(name, fi.extension) == 0)
-            return i;
+            return fi.format;
     }
 
     /* Then, try to match via the start of the type string */
@@ -440,7 +440,7 @@ int pa_sndfile_format_from_string(const char *name) {
         pa_assert_se(sf_command(NULL, SFC_GET_FORMAT_MAJOR, &fi, sizeof(fi)) == 0);
 
         if (strncasecmp(name, fi.extension, strlen(name)) == 0)
-            return i;
+            return fi.format;
     }
 
     return -1;
-- 
1.7.2.3

