ChipMaster's trial hacks on C++CMS starting with v1.2.1. Not sure I'll follow on with the v2 since it looks to be breaking and mostly frivolous.
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.
 
 
 
 
 
 

39 lines
931 B

  1. ///////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (C) 2008-2012 Artyom Beilis (Tonkikh) <artyomtnk@yahoo.com>
  4. //
  5. // See accompanying file COPYING.TXT file for licensing details.
  6. //
  7. ///////////////////////////////////////////////////////////////////////////////
  8. #ifndef CPPCMS_IMPL_CRC32_H
  9. #define CPPCMS_IMPL_CRC32_H
  10. #include <cppcms/cstdint.h>
  11. #include <zlib.h>
  12. namespace cppcms {
  13. namespace impl {
  14. class crc32_calc {
  15. public:
  16. crc32_calc()
  17. {
  18. value_ = crc32(0,0,0);
  19. }
  20. void process_bytes(void const *ptr,size_t n)
  21. {
  22. if(n==0)
  23. return;
  24. value_ = crc32(value_,reinterpret_cast<Bytef const *>(ptr),n);
  25. }
  26. uint32_t checksum() const
  27. {
  28. return value_;
  29. }
  30. private:
  31. uint32_t value_;
  32. };
  33. } // impl
  34. } // cppcms
  35. #endif