[Patches] fix simple 64-bit warnings/errors in signalmodule.c and bufferobject.c

Trent Mick trentm@activestate.com
Mon, 5 Jun 2000 17:37:02 -0700


Discussion:

A couple leftover patches of mine that I found lurking around.

This patch fixes a couple of warnings for 64-bit platforms.
- Though I know that SIG_DFL and SIG_IGN are just small constants, there are
  cast to function pointers so the appropriate Python call is
  PyLong_FromVoidPtr so that the pointer value cannot overflow on Win64 where
  sizeof(long) < sizeof(void*).

- Fix a compiler warning by casting the NULL value used in the
  _PyBuffer_FromMemory call to PyObject*.



Legal:

I confirm that, to the best of my knowledge and belief, this
contribution is free of any claims of third parties under
copyright, patent or other rights or interests ("claims").  To
the extent that I have any such claims, I hereby grant to CNRI a
nonexclusive, irrevocable, royalty-free, worldwide license to
reproduce, distribute, perform and/or display publicly, prepare
derivative versions, and otherwise use this contribution as part
of the Python software and its related documentation, or any
derivative versions thereof, at no cost to CNRI or its licensed
users, and to authorize others to do so.

I acknowledge that CNRI may, at its sole discretion, decide
whether or not to incorporate this contribution in the Python
software and its related documentation.  I further grant CNRI
permission to use my name and other identifying information
provided to CNRI by me for use in connection with the Python
software and its related documentation.


Patch:

*** /home/trentm/main/contrib/python/dist/src/Modules/signalmodule.c	Thu Jun  1 00:13:39 2000
--- /home/trentm/main/Apps/Perlium/Python/dist/src/Modules/signalmodule.c	Fri Jun  2 15:53:43 2000
***************
*** 356,366 ****
  	/* Add some symbolic constants to the module */
  	d = PyModule_GetDict(m);
  
! 	x = DefaultHandler = PyInt_FromLong((long)SIG_DFL);
          if (!x || PyDict_SetItemString(d, "SIG_DFL", x) < 0)
                  goto finally;
  
! 	x = IgnoreHandler = PyInt_FromLong((long)SIG_IGN);
          if (!x || PyDict_SetItemString(d, "SIG_IGN", x) < 0)
                  goto finally;
  
--- 356,366 ----
  	/* Add some symbolic constants to the module */
  	d = PyModule_GetDict(m);
  
! 	x = DefaultHandler = PyLong_FromVoidPtr(SIG_DFL);
          if (!x || PyDict_SetItemString(d, "SIG_DFL", x) < 0)
                  goto finally;
  
! 	x = IgnoreHandler = PyLong_FromVoidPtr(SIG_IGN);
          if (!x || PyDict_SetItemString(d, "SIG_IGN", x) < 0)
                  goto finally;
  
*** /home/trentm/main/contrib/python/dist/src/Objects/bufferobject.c	Fri Jun  2 11:21:14 2000
--- /home/trentm/main/Apps/Perlium/Python/dist/src/Objects/bufferobject.c	Fri Jun  2 15:53:43 2000
***************
*** 166,172 ****
  	void *ptr;
  	int size;
  {
! 	return _PyBuffer_FromMemory(NULL, ptr, size, 1);
  }
  
  PyObject *
--- 166,172 ----
  	void *ptr;
  	int size;
  {
! 	return _PyBuffer_FromMemory((PyObject*)NULL, ptr, size, 1);
  }
  
  PyObject *
***************
*** 174,180 ****
  	void *ptr;
  	int size;
  {
! 	return _PyBuffer_FromMemory(NULL, ptr, size, 0);
  }
  
  PyObject *
--- 174,180 ----
  	void *ptr;
  	int size;
  {
! 	return _PyBuffer_FromMemory((PyObject*)NULL, ptr, size, 0);
  }
  
  PyObject *


-- 
Trent Mick
trentm@activestate.com