LibreOffice Module vcl (master)  1
checksum.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 
21 #ifndef INCLUDED_VCL_INC_CHECKSUM_HXX
22 #define INCLUDED_VCL_INC_CHECKSUM_HXX
23 
24 #include <sal/config.h>
25 #include <sal/types.h>
26 #include <vcl/dllapi.h>
27 
28 #define BITMAP_CHECKSUM_SIZE 8
29 
30 typedef sal_uInt64 BitmapChecksum;
32 
33 template< sal_uInt8 N = 0 >
35 {
36  p[N] = static_cast<sal_uInt8>(n >> ( 8 * N ));
37  return BCToBCOA< N + 1 >( n, p );
38 }
39 
40 template<>
42 {
43  return;
44 }
45 
46 extern "C" {
47 
48 /*========================================================================
49  *
50  * vcl_crc64 interface.
51  *
52  *======================================================================*/
62 VCL_DLLPUBLIC sal_uInt64 vcl_crc64 (
63  sal_uInt64 Crc,
64  const void *Data, sal_uInt32 DatLen
66 
67 
68 VCL_DLLPUBLIC const sal_uInt64* vcl_get_crc64_table();
69 
70 }
71 
73  BitmapChecksum Checksum,
74  const void *Data,
75  sal_uInt32 DatLen
76 )
77 {
78  return static_cast<BitmapChecksum>(vcl_crc64( Checksum, Data, DatLen ));
79 }
80 
81 
82 #endif // INCLUDED_VCL_INC_CHECKSUM_HXX
83 
84 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_uInt64 BitmapChecksum
Definition: checksum.hxx:30
void BCToBCOA< BITMAP_CHECKSUM_SIZE >(BitmapChecksum, BitmapChecksumOctetArray)
Definition: checksum.hxx:41
#define VCL_DLLPUBLIC
Definition: dllapi.h:29
VCL_DLLPUBLIC const sal_uInt64 * vcl_get_crc64_table()
Definition: checksum.cxx:149
#define N
BitmapChecksum vcl_get_checksum(BitmapChecksum Checksum, const void *Data, sal_uInt32 DatLen)
Definition: checksum.hxx:72
#define SAL_THROW_EXTERN_C()
#define BITMAP_CHECKSUM_SIZE
Definition: checksum.hxx:28
VCL_DLLPUBLIC sal_uInt64 vcl_crc64(sal_uInt64 Crc, const void *Data, sal_uInt32 DatLen) SAL_THROW_EXTERN_C()
Evaluate CRC64 over given data.
Definition: checksum.cxx:129
unsigned char sal_uInt8
void BCToBCOA(BitmapChecksum n, BitmapChecksumOctetArray p)
Definition: checksum.hxx:34
sal_uInt8 BitmapChecksumOctetArray[BITMAP_CHECKSUM_SIZE]
Definition: checksum.hxx:31