dfu-util pull request
lists.tormod at gmail.com
Sun Apr 22 11:50:20 CEST 2012
On Sun, Apr 22, 2012 at 11:02 AM, Tormod Volden wrote:
> On Sun, Apr 22, 2012 at 12:07 AM, Tormod Volden wrote:
>> On Sat, Apr 21, 2012 at 11:01 PM, Stefan Schmidt wrote:
>>>> dfu-suffix: Check for availability of truncate() function
>>> You happen to know which platforms are missing this?
>> No, but I would guess everything non-posix. I believe, unless you are
>> using cygwin, the posix layer on Windows is not so complete. I know
>> that when compiling with MinGW, truncate() is not available. I just
>> found this http://stackoverflow.com/questions/584639/truncate-file so
>> it looks like we can use SetEndOfFile() on Windows instead. I will
>> look into that another day.
> I found ftruncate() on MinGW, so I changed to use that (with help of
> fileno() to avoid reopening the file this got much cleaner too). For
> non-MinGW Windows, it seems like _chsize_s is an equivalent (forget
> about SetEndOfFile() which acts on Windows file handles). Since I can
> not test that variant, and MinGW works fine, I am not including it.
BTW, I squashed this commit into the "porting to stdio" commit, since
it ended up as a small change, and even more so combined (it was
originally using ftruncate, so otherwise it would be a lot of back and
forth between commits).
>> We could maybe wait to see if I can get suffix truncation work on
>> Windows easily, that would save some documentation and make dfu-util
>> fully consistent across architectures.
> Should be fine now.
Tested and works fine on Windows 7.
More information about the devel