versions.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. * Copyright 2005 - 2016 Zarafa and its licensors
  3. *
  4. * This program is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU Affero General Public License, version 3,
  6. * as published by the Free Software Foundation.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU Affero General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU Affero General Public License
  14. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. *
  16. */
  17. #ifndef KC_VERSIONS_H
  18. #define KC_VERSIONS_H 1
  19. #include <kopano/ecversion.h>
  20. #define MAKE_KOPANO_VERSION(major, minor, update) \
  21. ((((major) & 0xff) << 24) | (((minor) & 0xff) << 16) | ((update) & 0xffff))
  22. #define MAKE_KOPANO_MAJOR(major, minor) \
  23. MAKE_KOPANO_VERSION((major), (minor), 0)
  24. #define MAKE_KOPANO_GENERAL(major) \
  25. MAKE_KOPANO_MAJOR((major), 0)
  26. #define KOPANO_MAOJR_MASK 0xffff0000
  27. #define KOPANO_GENERAL_MASK 0xff000000
  28. #define KOPANO_GET_MAJOR(version) \
  29. ((version) & KOPANO_MAOJR_MASK)
  30. #define KOPANO_GET_GENERAL(version) \
  31. ((version) & KOPANO_GENERAL_MASK)
  32. // Current thing
  33. #define KOPANO_CUR_MAJOR MAKE_KOPANO_MAJOR(PROJECT_VERSION_MAJOR, PROJECT_VERSION_MINOR)
  34. #define KOPANO_CUR_GENERAL MAKE_KOPANO_GENERAL(PROJECT_VERSION_MAJOR)
  35. // Important version(s) we check for
  36. #define ZARAFA_VERSION_6_40_0 MAKE_KOPANO_VERSION(6, 40, 0)
  37. #define KOPANO_VERSION_UNKNOWN MAKE_KOPANO_VERSION(0xff, 0xff, 0xffff)
  38. #define KOPANO_COMPARE_VERSION_TO_MAJOR(version, major) \
  39. ((version) < (major) ? -1 : (KOPANO_GET_MAJOR(version) > (major) ? 1 : 0))
  40. #define KOPANO_COMPARE_VERSION_TO_GENERAL(version, general) \
  41. ((version) < (general) ? -1 : (KOPANO_GET_GENERAL(version) > (general) ? 1 : 0))
  42. #endif /* KC_VERSIONS_H */