archivers/dir.c
changeset 106 fabd503dfde9
parent 104 01f40ec3c62f
child 110 203bd958330d
equal deleted inserted replaced
105:842fb00667f9 106:fabd503dfde9
   193     size_t seplen = strlen(dirsep);
   193     size_t seplen = strlen(dirsep);
   194 
   194 
   195     BAIL_IF_MACRO(!DIR_isArchive(name, forWriting),
   195     BAIL_IF_MACRO(!DIR_isArchive(name, forWriting),
   196                     ERR_UNSUPPORTED_ARCHIVE, NULL);
   196                     ERR_UNSUPPORTED_ARCHIVE, NULL);
   197 
   197 
   198     retval = malloc(sizeof (DirHandle));
   198     retval = (DirHandle *) malloc(sizeof (DirHandle));
   199     BAIL_IF_MACRO(retval == NULL, ERR_OUT_OF_MEMORY, NULL);
   199     BAIL_IF_MACRO(retval == NULL, ERR_OUT_OF_MEMORY, NULL);
   200     retval->opaque = malloc(namelen + seplen + 1);
   200     retval->opaque = malloc(namelen + seplen + 1);
   201     if (retval->opaque == NULL)
   201     if (retval->opaque == NULL)
   202     {
   202     {
   203         free(retval);
   203         free(retval);
   204         BAIL_IF_MACRO(1, ERR_OUT_OF_MEMORY, NULL);
   204         BAIL_MACRO(ERR_OUT_OF_MEMORY, NULL);
   205     } /* if */
   205     } /* if */
   206 
   206 
   207         /* make sure there's a dir separator at the end of the string */
   207         /* make sure there's a dir separator at the end of the string */
   208     strcpy((char *) (retval->opaque), name);
   208     strcpy((char *) (retval->opaque), name);
   209     if (strcmp((name + namelen) - seplen, dirsep) != 0)
   209     if (strcmp((name + namelen) - seplen, dirsep) != 0)