Re: read/write as binary
Rory Yorke <[email protected]> Thu, 27 Feb 2014 17:17:29 +0200
| Newsgroups | gmane.comp.ipod.gtkpod |
|---|---|
| Message-ID | <[email protected]> |
Hi Yasuhiro,
> Below is a patch.
> Please check and include.
>
> https://gist.github.com/mattn/100bb84e2c5b5f54649d
[from URL above:]
> --- a/src/itdb_device.c
> +++ b/src/itdb_device.c
> @@ -1047,7 +1047,7 @@ gboolean itdb_device_read_sysinfo (Itdb_Device *device)
> gchar *ptr;
> gint len = strlen (buf);
> /* suppress newline at end of line */
> - if ((len>0) && (buf[len-1]==0x0a))
> + if ((len>0) && (buf[len-1]==0x0a || buf[len-1]==0x0d))
I don't know what this data is for, but (going with the comment)
shouldn't you strip newlines and carriage returns? So something like
(untested):
while(len>0 && (buf[len-1]==0x0a || buf[len-1]==0x0d))
{
buf[len-1]=0;
--len;
}
And, again speaking from ignorance: it's not clear why the fopen() on
line 1041 of this file doesn't get the "rb" treatment like the other
fopen() calls.
Regards,
Rory
------------------------------------------------------------------------------
Flow-based real-time traffic analytics software. Cisco certified tool.
Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
Customize your own dashboards, set traffic alerts and generate reports.
Network behavioral analysis & security monitoring. All-in-one tool.
http://pubads.g.doubleclick.net/gampad/clk?id=126839071&iu=/4140/ostg.clktrk