bug-ddrescue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-ddrescue] Re: ddrescue patch for unsigned/signed compiler warnings


From: Antonio Diaz Diaz
Subject: [Bug-ddrescue] Re: ddrescue patch for unsigned/signed compiler warnings
Date: Mon, 01 Mar 2010 20:05:54 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i586; en-US; rv:1.7.11) Gecko/20050905

Martin Koeppe wrote:
yes, but I prefer a native Windows build because I need it on many different 
boxes and only occasionally on one particular box. And all of the boxes don't 
have cygwin installed.

Of course you are free to port ddrescue to windows.


Why? As I could see, one block is filled by one readblock(),

A small block, split from a larger block, is filled by a call to readblock. The result is then joined to the coreresponding larger block. Both larger blocks can have sizes larger than 32 bits. This is why the ddrescue logfile is so efficient.


However, I saw a use of -1 in the size_ field.

-1 means undefined size. It was used for devices of unknown size.


Where exactly does it break? I can make a new version, if you like.

For example where it moves "#define _FILE_OFFSET_BITS 64" to "os.h" and then includes "os.h" after cstdio. This makes ddrescue unable to read files larger than 2 GiB on 32 bit systems.

But please, don't send a new version. I do not accept patches with windows-specific code.


I think that in all loops such as
for (i=0; i<vector<>::size(); i++)
i should be of the same type as size() returns. That's not int and not unsigned 
int either, but size_t.

If the size never exceeds what an unsigned int can contain, why should I use size_t?


Every index access, i.e. anything within [] should be of type size_t, or at 
least unsigned.

Why? AFAIK, negative indices are generally valid as long as array limits are not surpassed, being p[-1] equivalent to *(p-1).


Regards,
Antonio.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]