Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
585 B

  1. /*
  2. * MemCopy()
  3. *
  4. * A much safer version of memcpy that checks the value of the byte
  5. * count before calling the memcpy() function. This macro is only built
  6. * into the 16 bit non-debug builds.
  7. */
  8. #ifndef __MEMCPY_H_
  9. #define __MEMCPY_H_
  10. #if defined(WIN16) && !defined(DEBUG)
  11. #define MemCopy(_dst,_src,_cb) do \
  12. { \
  13. size_t __cb = (size_t)(_cb); \
  14. if (__cb) \
  15. memcpy(_dst,_src,__cb); \
  16. } while (FALSE)
  17. #else
  18. #define MemCopy(_dst,_src,_cb) memcpy(_dst,_src,(size_t)(_cb))
  19. #endif
  20. #endif