comparison lib/sshv2.c @ 747:c8e09269c3e1

2006-5-14 Brian Masney <masneyb@gftp.org> * lib/sshv2.c - make sure the 64 bit data is transformed into network byte order (from Aurelien Jarno <aurelien@aurel32.net>) (closes #168466)
author masneyb
date Mon, 15 May 2006 01:31:20 +0000
parents 1b28a63d125a
children d553d14a2565
comparison
equal deleted inserted replaced
746:1b28a63d125a 747:c8e09269c3e1
1865 1865
1866 return (0); 1866 return (0);
1867 } 1867 }
1868 1868
1869 1869
1870 #ifdef G_HAVE_GINT64
1871
1872 static gint64
1873 sshv2_hton64 (gint64 val)
1874 {
1875 #if G_BYTE_ORDER != G_BIG_ENDIAN
1876 return (GINT64_TO_BE (val));
1877 #else
1878 return (val);
1879 #endif
1880 }
1881
1882 #endif
1883
1884
1885 static void 1870 static void
1886 sshv2_setup_file_offset (sshv2_params * params, char *buf) 1871 sshv2_setup_file_offset (sshv2_params * params, char *buf)
1887 { 1872 {
1888 guint32 hinum, lownum; 1873 guint32 hinum, lownum;
1889 #ifdef G_HAVE_GINT64 1874 #ifdef G_HAVE_GINT64
1890 gint64 offset; 1875 hinum = htonl(params->offset >> 32);
1891 1876 lownum = htonl((guint32) params->offset);
1892 offset = sshv2_hton64 (params->offset);
1893 lownum = offset >> 32;
1894 hinum = (guint32) offset;
1895 #else 1877 #else
1896 hinum = 0; 1878 hinum = 0;
1897 lownum = htonl (params->offset); 1879 lownum = htonl (params->offset);
1898 #endif 1880 #endif
1899 1881