970 /* okay, this is a new dir. Build and hash us. */ |
970 /* okay, this is a new dir. Build and hash us. */ |
971 retval = (ZIPentry *) allocator.Malloc(sizeof (ZIPentry) + namelen); |
971 retval = (ZIPentry *) allocator.Malloc(sizeof (ZIPentry) + namelen); |
972 BAIL_IF_MACRO(!retval, PHYSFS_ERR_OUT_OF_MEMORY, NULL); |
972 BAIL_IF_MACRO(!retval, PHYSFS_ERR_OUT_OF_MEMORY, NULL); |
973 memset(retval, '\0', sizeof (*retval)); |
973 memset(retval, '\0', sizeof (*retval)); |
974 retval->name = ((char *) retval) + sizeof (ZIPentry); |
974 retval->name = ((char *) retval) + sizeof (ZIPentry); |
975 memcpy(retval->name, name, namelen); |
975 memcpy(retval->name, name, namelen - 1); |
976 retval->name[namelen] = '\0'; |
976 retval->name[namelen - 1] = '\0'; |
977 retval->resolved = ZIP_DIRECTORY; |
977 retval->resolved = ZIP_DIRECTORY; |
978 if (!zip_hash_entry(info, retval)) |
978 if (!zip_hash_entry(info, retval)) |
979 { |
979 { |
980 allocator.Free(retval); |
980 allocator.Free(retval); |
981 return NULL; |
981 return NULL; |