Corrected wrong use of sizeof

This commit is contained in:
Thomas Schmitt 2013-02-26 08:23:52 +00:00
parent ae10ade47e
commit be6ef03eb8
2 changed files with 8 additions and 8 deletions

View File

@ -1,7 +1,7 @@
/* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. /* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images.
Copyright 2007-2011 Thomas Schmitt, <scdbackup@gmx.net> Copyright 2007-2013 Thomas Schmitt, <scdbackup@gmx.net>
Provided under GPL version 2 or later. Provided under GPL version 2 or later.
@ -282,11 +282,11 @@ int Sectorbitmap_destroy(struct SectorbitmaP **o, int flag)
int Sectorbitmap_from_file(struct SectorbitmaP **o, char *path, char *msg, int Sectorbitmap_from_file(struct SectorbitmaP **o, char *path, char *msg,
int *os_errno, int flag) int *os_errno, int flag)
{ {
int ret, fd= -1, sectors, sector_size, i, todo, map_size, skip; int ret, fd= -1, sectors, sector_size, i, todo, map_size, skip, bufsize= 1024;
unsigned char *map; unsigned char *map;
unsigned char *buf; unsigned char *buf;
buf= TSOB_FELD(unsigned char, 1024); buf= TSOB_FELD(unsigned char, bufsize);
if(buf == NULL) if(buf == NULL)
return(-1); return(-1);
@ -320,8 +320,8 @@ wrong_filetype:;
sscanf(((char *) buf) + 25, "%d", &skip); sscanf(((char *) buf) + 25, "%d", &skip);
if(skip < 0) if(skip < 0)
{ret= 0; goto wrong_filetype;} {ret= 0; goto wrong_filetype;}
for(i= 0; i < skip; i+= sizeof(buf)) { for(i= 0; i < skip; i+= bufsize) {
todo= sizeof(buf); todo= bufsize;
if(i + todo > skip) if(i + todo > skip)
todo= skip - i; todo= skip - i;
ret= read(fd, buf, todo); ret= read(fd, buf, todo);
@ -345,8 +345,8 @@ wrong_filetype:;
} }
map= (*o)->map; map= (*o)->map;
map_size= (*o)->map_size; map_size= (*o)->map_size;
for(i= 0; i < map_size; i+= sizeof(buf)) { for(i= 0; i < map_size; i+= bufsize) {
todo= sizeof(buf); todo= bufsize;
if(i + todo > map_size) if(i + todo > map_size)
todo= map_size - i; todo= map_size - i;
ret= read(fd, buf, todo); ret= read(fd, buf, todo);

View File

@ -1 +1 @@
#define Xorriso_timestamP "2013.02.18.104738" #define Xorriso_timestamP "2013.02.26.082331"