src/share/Makefile.am : Rejig building of win_utf8_io/libwin_utf8_io.la.
[platform/upstream/flac.git] / src / flac / vorbiscomment.c
index f1c9bcf..5a9f619 100644 (file)
@@ -11,9 +11,9 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
- * You should have received a copy of the GNU 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.
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #if HAVE_CONFIG_H
@@ -29,6 +29,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include "share/compat.h"
 
 
 /*
@@ -113,7 +114,7 @@ static FLAC__bool set_vc_field(FLAC__StreamMetadata *block, const Argument_VcFie
                /* read the file into 'data' */
                FILE *f = 0;
                char *data = 0;
-               const off_t size = grabbag__file_get_filesize(field->field_value);
+               const FLAC__off_t size = grabbag__file_get_filesize(field->field_value);
                if(size < 0) {
                        *violation = "can't open file for tag value";
                        return false;
@@ -125,7 +126,7 @@ static FLAC__bool set_vc_field(FLAC__StreamMetadata *block, const Argument_VcFie
                if(0 == (data = malloc(size+1)))
                        die("out of memory allocating tag value");
                data[size] = '\0';
-               if(0 == (f = fopen(field->field_value, "rb")) || fread(data, 1, size, f) != (size_t)size) {
+               if(0 == (f = flac_fopen(field->field_value, "rb")) || fread(data, 1, size, f) != (size_t)size) {
                        free(data);
                        if(f)
                                fclose(f);
@@ -169,6 +170,9 @@ static FLAC__bool set_vc_field(FLAC__StreamMetadata *block, const Argument_VcFie
        }
        else {
                FLAC__bool needs_free = false;
+#ifdef _WIN32 /* everything in UTF-8 already. Must not alter */
+               entry.entry = (FLAC__byte *)field->field;
+#else
                if(raw) {
                        entry.entry = (FLAC__byte *)field->field;
                }
@@ -180,6 +184,7 @@ static FLAC__bool set_vc_field(FLAC__StreamMetadata *block, const Argument_VcFie
                        *violation = "error converting comment to UTF-8";
                        return false;
                }
+#endif
                entry.length = strlen((const char *)entry.entry);
                if(!FLAC__format_vorbiscomment_entry_is_legal(entry.entry, entry.length)) {
                        if(needs_free)