~ubuntu-branches/ubuntu/precise/flac/precise-updates

« back to all changes in this revision

Viewing changes to src/libFLAC/memory.c

  • Committer: Bazaar Package Importer
  • Author(s): Joshua Kwan
  • Date: 2007-05-29 22:56:36 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20070529225636-ljeff8xxip09qaap
Tags: 1.1.4-1
* New upstream release. closes: #405167, #411311
  - libOggFLAC and libOggFLAC++ have been merged into libFLAC, so
    remove their corresponding packages.
  - Because of the API changes required to effect the above, there has
    been yet another soname bump. libflac7 -> libflac8 and
    libflac++5 -> libflac++6. Emails have been dispatched to the
    maintainers of dependent packages.
* Some notes on patches that were removed:
  - 02_stdin_stdout, 06_manpage_mention_utf8_convert: merged upstream
  - 08_manpage_warnings: Upstream has changed the manpage so it defintely
    can't fit in in 80 cols, so just forget about it. We'll live.
  - 05_eof_warnings_are_errors: Upstream decided to add a -w option to
    flac to treat all warnings as errors. I am going to defer to that
    for now, but if people think it's stupid let me know and I'll port
    the patch forward.
  - 04_stack_smasher: was a backport from 1.1.3, so it's obsolete.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* libFLAC - Free Lossless Audio Codec library
2
 
 * Copyright (C) 2001,2002,2003,2004,2005  Josh Coalson
 
2
 * Copyright (C) 2001,2002,2003,2004,2005,2006,2007  Josh Coalson
3
3
 *
4
4
 * Redistribution and use in source and binary forms, with or without
5
5
 * modification, are permitted provided that the following conditions
29
29
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
30
 */
31
31
 
 
32
#if HAVE_CONFIG_H
 
33
#  include <config.h>
 
34
#endif
 
35
 
32
36
#include "private/memory.h"
33
37
#include "FLAC/assert.h"
34
38
 
35
 
#ifdef HAVE_CONFIG_H
36
 
#include <config.h>
37
 
#endif
38
 
 
39
39
void *FLAC__memory_alloc_aligned(size_t bytes, void **aligned_address)
40
40
{
41
41
        void *x;
45
45
#ifdef FLAC__ALIGN_MALLOC_DATA
46
46
        /* align on 32-byte (256-bit) boundary */
47
47
        x = malloc(bytes+31);
48
 
        *aligned_address = (void*)(((unsigned)x + 31) & -32);
 
48
        /* there's got to be a better way to do this right for all archs */
 
49
        if(sizeof(void*) == sizeof(unsigned))
 
50
                *aligned_address = (void*)(((unsigned)x + 31) & -32);
 
51
        else if(sizeof(void*) == sizeof(FLAC__uint64))
 
52
                *aligned_address = (void*)(((FLAC__uint64)x + 31) & (FLAC__uint64)(-((FLAC__int64)32)));
 
53
        else
 
54
                return 0;
49
55
#else
50
56
        x = malloc(bytes);
51
57
        *aligned_address = x;