Commit Graph

40 Commits

Author SHA1 Message Date
Matt Mackall
c4f5764d33 mpatch: rewrite pointer overflow checks 2013-12-11 18:33:42 -06:00
Adrian Buehlmann
3a26ebacab mpatch: use Py_ssize_t for string length 2012-05-20 01:28:31 +02:00
Adrian Buehlmann
96bc6f8416 mpatch: use Py_ssize_t
Eliminates

  mpatch.c(73) : warning C4244: 'return' : conversion from '__int64' to 'int',
  possible loss of data
  mpatch.c(299) : warning C4244: 'function' : conversion from 'Py_ssize_t' to
  'int', possible loss of data
  mpatch.c(321) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int',
  possible loss of data
  mpatch.c(335) : warning C4244: 'function' : conversion from 'Py_ssize_t' to
  'int', possible loss of data
  mpatch.c(346) : warning C4244: 'function' : conversion from 'Py_ssize_t' to
  'int', possible loss of data

when compiling for Windows x64 target using the Microsoft compiler.
2012-05-20 00:08:18 +02:00
Matt Mackall
0fa9895915 util.h: replace ntohl/htonl with get/putbe32 2012-04-16 11:26:00 -05:00
Matt Mackall
fd4256c9b1 util.h: unify some common platform tweaks 2012-04-10 12:07:14 -05:00
Matt Mackall
935d420846 util.h: move Py_ssize_t bits from mpatch.c 2012-04-10 12:07:09 -05:00
Matt Mackall
cb69aaee4e parsers: avoid pointer aliasing
Newer versions of GCC have aggressive pointer alias optimizations that
might get fooled by our pointer manipulations. These issues shouldn't
be encountered in practice because distutils compiles extensions with
-fno-strict-alias but the code was not valid according to the standard.
2011-08-10 13:40:01 -05:00
Martin Geisler
a76e121863 backout of e4cb9628354c
Matt and a majority of crew did not like this approach.
2011-01-27 11:15:08 +01:00
Martin Geisler
d23e1973c2 specify C indention style using Emacs file local variables 2011-01-26 12:05:01 +01:00
Renato Cunha
f8467c0605 mpatch.c: Added preliminary support for py3k.
This is done by including the util.h header file, that defines appropriate
macros according to the current python version.
2010-06-15 19:49:56 -03:00
Matt Mackall
8d99be19f0 many, many trivial check-code fixups 2010-01-25 00:05:27 -06:00
Scott McCreary
501e6fe68f allow Mercurial to compile on Haiku 2008-09-17 10:22:35 +02:00
Shun-ichi GOTO
bc6b138bfb mpatch: Define Py_ssize_t for old pythons and use it instead of ssize_t.
See also PEP 353.
NOTE: Microsoft compilers (8 or earlier) does not have ssize_t.
2007-10-12 11:46:49 +09:00
Matt Mackall
507b4b92da mpatch: allow buffer objects for input 2007-10-11 00:46:45 -05:00
Thomas Arendsen Hein
b4fc156022 merge with stable 2007-04-25 18:43:55 +02:00
Thomas Arendsen Hein
2f0fd5e3bc Fix segfaults when parsing bdiff hunks in mpatch.decode() and .patchedsize()
- fix off by 11 when checking if there are more hunks (found by Maris Fogels)
- bail out if start is greater than end
- check if new hunk starts after start/end/len block of current hunk as
  the pointer can wrap around on very large values, reproducible with
  import mpatch; mpatch.patchedsize(12, 'x'*12)
2007-01-27 23:07:06 +01:00
Andrew Bachmann
3b2c3dac24 BeOS compatibility support 2007-01-02 21:40:20 -08:00
Matt Mackall
f61dd23d9b mpatch: Fix for malloc corner case on AIX 2006-09-21 16:16:39 -05:00
Vadim Gelfer
dc377b58c1 update copyrights. 2006-08-12 12:30:02 -07:00
Thomas Arendsen Hein
5088fdd568 Include inttypes.h instead of stdint.h (fixes issue299)
Many projects use inttypes.h, too. stdint.h isn't available everywhere, e.g.
on some versions of Solaris, while inttypes.h is available everywhere where
stdint.h is.
2006-06-30 21:41:46 +02:00
Vadim Gelfer
e18ca75a83 mac os x: fixes for 10.2 from chris monson <monpublic@gmail.com> 2006-06-20 17:51:39 -07:00
Chris Mason
b52474f560 merge 0.8.1 with revlogng 2006-04-08 20:10:46 -04:00
Thomas Arendsen Hein
faa1c52566 Set correct exception for another possible malloc error in mpatch.c 2006-04-05 15:39:48 +02:00
mason@suse.com
492b52fda3 Fill in the uncompressed size during revlog.addgroup
This uses code from Matt to calculate the size change that
would result from applying a delta to keep an accurate running
total of the text size during revlog.addgroup
2006-04-04 16:38:44 -04:00
TK Soh
9681381233 do proper typecasting on malloc() and calloc() calls
to support build on Solaris 2.6 using Sun Pro SC4.0 (C++ 4.1) compiler.
2006-03-20 08:46:29 +01:00
Thomas Arendsen Hein
8d6e52f81a Fixed misleading indentation in mpatch.c 2006-02-18 16:31:02 +01:00
Benoit Boissinot
af35f643ab catch errors and throw exception with invalid binary patch data 2006-02-15 04:37:47 +01:00
mpm@selenic.com
eee2ab41c0 [PATCH] use <arpa/inet.h> instead of <netinet/in.h> for ntohl/htonl
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

[PATCH] use <arpa/inet.h> instead of <netinet/in.h> for ntohl/htonl

From: Jed Davis <jdev@panix.com>

This fixes the Mac OS X build problem; hopefully it won't break any
other OSes, especially since SUSv3 says arpa/inet is the right header.
( http://www.opengroup.org/onlinepubs/009695399/functions/ntohl.html )

manifest hash: 2f06ff0cffefdb35e794131afcd1f34f9fdfa5cf
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)

iD8DBQFCyEoFywK+sNU5EO8RAk6WAJ9v/pnr07zUXKM9EBQQGaKSZAlhxACdHrwS
XTLSL6pPGAwaRfExGF2A3DQ=
=Rtv9
-----END PGP SIGNATURE-----
2005-07-03 12:26:45 -08:00
mpm@selenic.com
68e36bb922 [PATCH] bdiff/mpatch under MSVC
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

[PATCH] bdiff/mpatch under MSVC

From: K Thananchayan <thananck@yahoo.com>

MSVC (6.0) environment does not have 'stdint.h' and does not provide
`inline' qualifier. The following patch is needed to make mecurial
installable under MSVC.

manifest hash: a5b64235acced16cb451faa698922559fec4e573
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)

iD8DBQFCxPapywK+sNU5EO8RAmRnAKCt9cOASaIsYB6kNUDSIStR1DmY4gCgnXlL
Jf0nMmGEkoyXtB0eV+fLzJU=
=fKD5
-----END PGP SIGNATURE-----
2005-06-30 23:54:17 -08:00
mpm@selenic.com
a053dfbfab More fiddling with uint32_t includes for extensions
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

More fiddling with uint32_t includes for extensions

manifest hash: 1ad16a0262e9bd2769e32c13c7fd0c7b0cd7dde7
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)

iD8DBQFCwS+/ywK+sNU5EO8RAhK1AKCtF/57nKCc1AU+l0sR74kHhY1NCwCfSvQK
QQc5i8abuGkFpU5VUBJt5XQ=
=H+CX
-----END PGP SIGNATURE-----
2005-06-28 03:08:47 -08:00
mpm@selenic.com
fad4970cee Remove stdint.h from mpatch and bdiff
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Remove stdint.h from mpatch and bdiff

It's only there for ntohl and htonl and should be pulled in by in.h.

manifest hash: 65954290279241ac92c9ce04c21cf1a3c9dd54e0
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)

iD8DBQFCwD8KywK+sNU5EO8RAhv2AJ40R/T72XK63IbeEFqMLSRJbRJWdACcDa9r
dOL9XpyYxR09REbAHw0JrlE=
=8wkZ
-----END PGP SIGNATURE-----
2005-06-27 10:01:46 -08:00
mpm@selenic.com
44ac4156e1 extensions: use stdint.h
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

extensions: use stdint.h

Not sure why I didn't do this the first time around. Hopefully still
builds everywhere.

manifest hash: 965582286a190728f8cc0dfb8e11ee56628a59a5
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)

iD8DBQFCvfRgywK+sNU5EO8RAg9SAJ4/ZVpQZcDY5xovLDTZK2txEegEgwCdF2b+
lzSIP109qq8D+KIdUWsbEPc=
=+0Yy
-----END PGP SIGNATURE-----
2005-06-25 16:18:40 -08:00
kyle@zeus.moffetthome.net
b724addd44 Added stdint.h include to fix build on Mac OS X Tiger [v10.4] 2005-06-24 20:53:51 -05:00
mpm@selenic.com
4266c33df9 Add 'other OS' bits to bdiff.c / style cleanups
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Add 'other OS' bits to bdiff.c / style cleanups

manifest hash: 9a0ef60a59af0594f95a2b22de243fe8ef059762
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)

iD8DBQFCuNL0ywK+sNU5EO8RAg+yAKCe8dG411HdZZvsxB25AtfBBApQBQCgnb7O
MGO0xvEBgAtt+3F+VJBkiU4=
=F7r7
-----END PGP SIGNATURE-----
2005-06-21 18:54:44 -08:00
mpm@selenic.com
474ceb8130 Make mpatch.c compilable under the other `OS'
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Make mpatch.c compilable under the other `OS'

From: K Thananchayan <thananck@yahoo.com>

manifest hash: 7b3033b761b147149fb0bcd6ff6120ccb73f16f1
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)

iD8DBQFCuNJCywK+sNU5EO8RAtMVAKCJxQYOa7VX4DYKDPw02ILjINiDmwCggreC
9Xw/stNxkV7zVY2IFDC14is=
=tFmZ
-----END PGP SIGNATURE-----
2005-06-21 18:51:46 -08:00
mpm@selenic.com
61535bd5d9 mpatch: attempt to handle unpack alignment issues on Solaris
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

mpatch: attempt to handle unpack alignment issues on Solaris

manifest hash: e185dc380bab61cf11a9973ee3ddd2e904e56299
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)

iD8DBQFCsnOtywK+sNU5EO8RAlzQAJ9YIhbL8BJjT+J/pOiQVES2wsF0igCgnFRl
ok5f8i8GbNk77sRbpsGnUF0=
=m0Zh
-----END PGP SIGNATURE-----
2005-06-16 22:54:37 -08:00
mpm@selenic.com
c91ce39fc5 mpatch: properly NULL out return in lalloc
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

mpatch: properly NULL out return in lalloc

From: K Thananchayan <thananck@yahoo.com>

manifest hash: 69952cb34e184eff19e3abff7638eb3a446f4dca
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)

iD8DBQFCp0B+ywK+sNU5EO8RAuGdAJ4iZOnxExpZuhTjO0fcOFE9mNn/IACgjXbw
7mVqfBJeLbxViBorImLE12k=
=A1Vj
-----END PGP SIGNATURE-----
2005-06-08 11:01:18 -08:00
mpm@selenic.com
e7e047fdee Add safety checking to mpatch 2005-05-21 13:14:58 -08:00
mpm@selenic.com
e85a2a9d28 Gotos are embarrassing. 2005-05-17 10:13:00 -08:00
mpm@selenic.com
f161c8bdc8 Add an O(m + nlog n) patching extension 2005-05-16 22:08:33 -08:00