Skip to content
This repository was archived by the owner on Feb 5, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions ALAC/codec/ALACBitUtilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ enum


typedef enum
{

{
ID_SCE = 0, /* Single Channel Element */
ID_CPE = 1, /* Channel Pair Element */
ID_CCE = 2, /* Coupling Channel Element */
Expand All @@ -65,7 +64,7 @@ typedef enum
ID_PCE = 5,
ID_FIL = 6,
ID_END = 7
} ELEMENT_TYPE;
} AELEMENT_TYPE;

// types
typedef struct BitBuffer
Expand Down
4 changes: 4 additions & 0 deletions ALAC/codec/ag_dec.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@
#define ALWAYS_INLINE
#endif

#ifdef _MSC_VER
#define inline __inline
#endif

/* And on the subject of the CodeWarrior x86 compiler and inlining, I reworked a lot of this
to help the compiler out. In many cases this required manual inlining or a macro. Sorry
if it is ugly but the performance gains are well worth it.
Expand Down
4 changes: 4 additions & 0 deletions ALAC/codec/ag_enc.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@
#define ALWAYS_INLINE
#endif

#ifdef _MSC_VER
#define inline __inline
#endif


/* And on the subject of the CodeWarrior x86 compiler and inlining, I reworked a lot of this
to help the compiler out. In many cases this required manual inlining or a macro. Sorry
Expand Down
4 changes: 4 additions & 0 deletions ALAC/codec/dp_dec.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@
#define ALWAYS_INLINE
#endif

#ifdef _MSC_VER
#define inline __inline
#endif

#if TARGET_CPU_PPC && (__MWERKS__ >= 0x3200)
// align loops to a 16 byte boundary to make the G5 happy
#pragma function_align 16
Expand Down
4 changes: 4 additions & 0 deletions ALAC/codec/dp_enc.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@
#define ALWAYS_INLINE
#endif

#ifdef _MSC_VER
#define inline __inline
#endif

#if TARGET_CPU_PPC && (__MWERKS__ >= 0x3200)
// align loops to a 16 byte boundary to make the G5 happy
#pragma function_align 16
Expand Down
2 changes: 1 addition & 1 deletion binding.cc
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class Encoder : public Nan::ObjectWrap

// Build cookie buffer.
uint32_t cookieSize = e->enc_.GetMagicCookieSize(e->outf_.mChannelsPerFrame);
char cookie[cookieSize];
char* cookie = (char*)alloca(sizeof(char) * (cookieSize));
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You never free this, it will leak memory...

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alloca shouldn't need to be freed. Read the docs.

Copy link

@LinusU LinusU May 8, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're absolutely correct, nevermind :)

Copy link

@m-a-v m-a-v May 8, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I solved the same problems (building for a VS version < VS2013).

I would prefer a ifndef since for gcc it doesn't seem to be a problem.

See my changes here:
https://github.com/m-a-v/node-libalac/commits/master

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code should have the same effect on gcc, the alloca statement is just more specific. One would need to check if it truly gives the same code path, but I feel preprocessor directives are an "ugly" hack and should be minimized. I already hated the fact I needed to add one for __inline.

e->enc_.GetMagicCookie(cookie, &cookieSize);

// Init self.
Expand Down