Avoided use of function alloca() by macro Libisofs_avoid_using_allocA

and incremented version to 0.6.17
This commit is contained in:
2009-03-17 21:25:43 +01:00
parent a6090a6273
commit 50edfbea51
4 changed files with 110 additions and 18 deletions

View File

@@ -13,6 +13,8 @@
#include "image.h"
#include "filesrc.h"
#include "eltorito.h"
#include "libisofs.h"
#include <stdlib.h>
#include <stdio.h>
@@ -296,7 +298,13 @@ int joliet_create_mangled_name(uint16_t *dest, uint16_t *src, int digits,
int ret, pos;
uint16_t *ucsnumber;
char fmt[16];
#ifdef Libisofs_avoid_using_allocA
char nstr[72]; /* The only caller of this function allocates dest with 66
elements and limits digits to < 8 */
#else
char *nstr = alloca(digits + 1);
#endif
sprintf(fmt, "%%0%dd", digits);
sprintf(nstr, fmt, number);
@@ -372,6 +380,11 @@ int mangle_single_dir(Ecma119Image *t, JolietNode *dir)
* A max of 7 characters is good enought, it allows handling up to
* 9,999,999 files with same name.
*/
#ifdef Libisofs_avoid_using_allocA
/* Important: joliet_create_mangled_name() relies on digits < 72 */
#endif
while (digits < 8) {
int ok, k;
uint16_t *dot;