fast_excel 0.4.1 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/test.yml +1 -7
  3. data/CHANGELOG.md +9 -0
  4. data/Gemfile +1 -1
  5. data/examples/example.rb +2 -0
  6. data/examples/example_date_time.rb +38 -0
  7. data/fast_excel.gemspec +2 -2
  8. data/lib/fast_excel/binding/format.rb +17 -0
  9. data/lib/fast_excel/binding/workbook.rb +39 -17
  10. data/lib/fast_excel/binding/worksheet.rb +57 -13
  11. data/lib/fast_excel/binding.rb +7 -7
  12. data/lib/fast_excel.rb +27 -20
  13. data/libxlsxwriter/.github/FUNDING.yml +1 -0
  14. data/libxlsxwriter/.github/ISSUE_TEMPLATE.md +85 -0
  15. data/libxlsxwriter/.github/PULL_REQUEST_TEMPLATE.md +130 -0
  16. data/libxlsxwriter/.github/workflows/cmake_actions.yml +48 -0
  17. data/libxlsxwriter/.github/workflows/code_style.yml +23 -0
  18. data/libxlsxwriter/.github/workflows/coverity.yml +22 -0
  19. data/libxlsxwriter/.github/workflows/make_actions.yml +52 -0
  20. data/libxlsxwriter/.github/workflows/valgrind.yml +23 -0
  21. data/libxlsxwriter/.github/workflows/windows_build.yml +54 -0
  22. data/libxlsxwriter/.github/workflows/zig_build.yml +22 -0
  23. data/libxlsxwriter/.gitignore +16 -1
  24. data/libxlsxwriter/.indent.pro +24 -0
  25. data/libxlsxwriter/CMakeLists.txt +156 -56
  26. data/libxlsxwriter/CONTRIBUTING.md +2 -2
  27. data/libxlsxwriter/Changes.txt +344 -2
  28. data/libxlsxwriter/LICENSE.txt +66 -8
  29. data/libxlsxwriter/Makefile +151 -54
  30. data/libxlsxwriter/Package.swift +42 -0
  31. data/libxlsxwriter/Readme.md +4 -2
  32. data/libxlsxwriter/build.zig +324 -0
  33. data/libxlsxwriter/build.zig.zon +11 -0
  34. data/libxlsxwriter/cmake/FindMINIZIP.cmake +3 -3
  35. data/libxlsxwriter/cocoapods/libxlsxwriter-umbrella.h +6 -0
  36. data/libxlsxwriter/include/xlsxwriter/app.h +2 -1
  37. data/libxlsxwriter/include/xlsxwriter/chart.h +236 -32
  38. data/libxlsxwriter/include/xlsxwriter/chartsheet.h +7 -7
  39. data/libxlsxwriter/include/xlsxwriter/comment.h +76 -0
  40. data/libxlsxwriter/include/xlsxwriter/common.h +111 -50
  41. data/libxlsxwriter/include/xlsxwriter/content_types.h +8 -1
  42. data/libxlsxwriter/include/xlsxwriter/core.h +1 -1
  43. data/libxlsxwriter/include/xlsxwriter/custom.h +1 -1
  44. data/libxlsxwriter/include/xlsxwriter/drawing.h +11 -20
  45. data/libxlsxwriter/include/xlsxwriter/format.h +121 -8
  46. data/libxlsxwriter/include/xlsxwriter/hash_table.h +1 -1
  47. data/libxlsxwriter/include/xlsxwriter/metadata.h +49 -0
  48. data/libxlsxwriter/include/xlsxwriter/packager.h +27 -16
  49. data/libxlsxwriter/include/xlsxwriter/relationships.h +1 -1
  50. data/libxlsxwriter/include/xlsxwriter/shared_strings.h +1 -1
  51. data/libxlsxwriter/include/xlsxwriter/styles.h +13 -7
  52. data/libxlsxwriter/include/xlsxwriter/table.h +51 -0
  53. data/libxlsxwriter/include/xlsxwriter/theme.h +1 -1
  54. data/libxlsxwriter/include/xlsxwriter/third_party/emyg_dtoa.h +26 -0
  55. data/libxlsxwriter/include/xlsxwriter/third_party/ioapi.h +27 -25
  56. data/libxlsxwriter/include/xlsxwriter/third_party/md5.h +45 -0
  57. data/libxlsxwriter/include/xlsxwriter/third_party/zip.h +155 -153
  58. data/libxlsxwriter/include/xlsxwriter/utility.h +70 -8
  59. data/libxlsxwriter/include/xlsxwriter/vml.h +55 -0
  60. data/libxlsxwriter/include/xlsxwriter/workbook.h +218 -47
  61. data/libxlsxwriter/include/xlsxwriter/worksheet.h +2770 -241
  62. data/libxlsxwriter/include/xlsxwriter/xmlwriter.h +12 -8
  63. data/libxlsxwriter/include/xlsxwriter.h +4 -2
  64. data/libxlsxwriter/libxlsxwriter.podspec +8 -5
  65. data/libxlsxwriter/src/Makefile +58 -21
  66. data/libxlsxwriter/src/app.c +5 -2
  67. data/libxlsxwriter/src/chart.c +396 -81
  68. data/libxlsxwriter/src/chartsheet.c +22 -22
  69. data/libxlsxwriter/src/comment.c +443 -0
  70. data/libxlsxwriter/src/content_types.c +40 -1
  71. data/libxlsxwriter/src/core.c +2 -2
  72. data/libxlsxwriter/src/custom.c +1 -1
  73. data/libxlsxwriter/src/drawing.c +160 -40
  74. data/libxlsxwriter/src/format.c +109 -25
  75. data/libxlsxwriter/src/hash_table.c +1 -1
  76. data/libxlsxwriter/src/metadata.c +283 -0
  77. data/libxlsxwriter/src/packager.c +794 -94
  78. data/libxlsxwriter/src/relationships.c +1 -1
  79. data/libxlsxwriter/src/shared_strings.c +2 -4
  80. data/libxlsxwriter/src/styles.c +353 -58
  81. data/libxlsxwriter/src/table.c +304 -0
  82. data/libxlsxwriter/src/theme.c +1 -1
  83. data/libxlsxwriter/src/utility.c +143 -43
  84. data/libxlsxwriter/src/vml.c +1062 -0
  85. data/libxlsxwriter/src/workbook.c +567 -77
  86. data/libxlsxwriter/src/worksheet.c +6668 -1462
  87. data/libxlsxwriter/src/xmlwriter.c +95 -5
  88. data/libxlsxwriter/third_party/dtoa/Makefile +42 -0
  89. data/libxlsxwriter/third_party/dtoa/emyg_dtoa.c +461 -0
  90. data/libxlsxwriter/third_party/dtoa/emyg_dtoa.h +26 -0
  91. data/libxlsxwriter/third_party/md5/Makefile +42 -0
  92. data/libxlsxwriter/third_party/md5/md5.c +291 -0
  93. data/libxlsxwriter/third_party/md5/md5.h +45 -0
  94. data/libxlsxwriter/third_party/minizip/Makefile +3 -8
  95. data/libxlsxwriter/third_party/minizip/Makefile.orig +8 -4
  96. data/libxlsxwriter/third_party/minizip/MiniZip64_Changes.txt +1 -1
  97. data/libxlsxwriter/third_party/minizip/configure.ac +1 -1
  98. data/libxlsxwriter/third_party/minizip/crypt.h +13 -16
  99. data/libxlsxwriter/third_party/minizip/ioapi.c +31 -57
  100. data/libxlsxwriter/third_party/minizip/ioapi.h +31 -23
  101. data/libxlsxwriter/third_party/minizip/iowin32.c +29 -45
  102. data/libxlsxwriter/third_party/minizip/iowin32.h +4 -4
  103. data/libxlsxwriter/third_party/minizip/miniunz.c +29 -56
  104. data/libxlsxwriter/third_party/minizip/minizip.c +38 -49
  105. data/libxlsxwriter/third_party/minizip/mztools.c +1 -7
  106. data/libxlsxwriter/third_party/minizip/unzip.c +202 -342
  107. data/libxlsxwriter/third_party/minizip/unzip.h +74 -74
  108. data/libxlsxwriter/third_party/minizip/zip.c +165 -218
  109. data/libxlsxwriter/third_party/minizip/zip.h +164 -154
  110. data/libxlsxwriter/third_party/tmpfileplus/Makefile +3 -3
  111. data/libxlsxwriter/version.txt +1 -1
  112. data/test/auto_width_test.rb +20 -0
  113. data/test/default_format_test.rb +1 -1
  114. data/test/validations_test.rb +3 -3
  115. data/test/worksheet_test.rb +6 -1
  116. metadata +33 -7
  117. data/libxlsxwriter/.travis.yml +0 -37
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * libxlsxwriter
3
3
  *
4
- * Copyright 2014-2019, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
4
+ * Copyright 2014-2022, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
5
5
  *
6
6
  * packager - A libxlsxwriter library for creating Excel XLSX packager files.
7
7
  *
@@ -12,6 +12,9 @@
12
12
  #include <stdint.h>
13
13
 
14
14
  #ifdef USE_SYSTEM_MINIZIP
15
+ #ifdef __GNUC__
16
+ #pragma GCC system_header
17
+ #endif
15
18
  #include "minizip/zip.h"
16
19
  #else
17
20
  #include "third_party/zip.h"
@@ -24,27 +27,33 @@
24
27
  #include "app.h"
25
28
  #include "core.h"
26
29
  #include "custom.h"
30
+ #include "table.h"
27
31
  #include "theme.h"
28
32
  #include "styles.h"
29
33
  #include "format.h"
30
34
  #include "content_types.h"
31
35
  #include "relationships.h"
36
+ #include "vml.h"
37
+ #include "comment.h"
38
+ #include "metadata.h"
32
39
 
33
40
  #define LXW_ZIP_BUFFER_SIZE (16384)
34
41
 
35
42
  /* If zip returns a ZIP_XXX error then errno is set and we can trap that in
36
43
  * workbook.c. Otherwise return a default libxlsxwriter error. */
37
- #define RETURN_ON_ZIP_ERROR(err, default_err) \
38
- if (err == ZIP_ERRNO) \
39
- return LXW_ERROR_ZIP_FILE_OPERATION; \
40
- else if (err == ZIP_PARAMERROR) \
41
- return LXW_ERROR_ZIP_PARAMETER_ERROR; \
42
- else if (err == ZIP_BADZIPFILE) \
43
- return LXW_ERROR_ZIP_BAD_ZIP_FILE; \
44
- else if (err == ZIP_INTERNALERROR) \
45
- return LXW_ERROR_ZIP_INTERNAL_ERROR; \
46
- else \
47
- return default_err;
44
+ #define RETURN_ON_ZIP_ERROR(err, default_err) \
45
+ do { \
46
+ if (err == ZIP_ERRNO) \
47
+ return LXW_ERROR_ZIP_FILE_OPERATION; \
48
+ else if (err == ZIP_PARAMERROR) \
49
+ return LXW_ERROR_ZIP_PARAMETER_ERROR; \
50
+ else if (err == ZIP_BADZIPFILE) \
51
+ return LXW_ERROR_ZIP_BAD_ZIP_FILE; \
52
+ else if (err == ZIP_INTERNALERROR) \
53
+ return LXW_ERROR_ZIP_INTERNAL_ERROR; \
54
+ else \
55
+ return default_err; \
56
+ } while (0)
48
57
 
49
58
  /*
50
59
  * Struct to represent a packager.
@@ -55,11 +64,13 @@ typedef struct lxw_packager {
55
64
  lxw_workbook *workbook;
56
65
 
57
66
  size_t buffer_size;
67
+ size_t output_buffer_size;
58
68
  zipFile zipfile;
59
69
  zip_fileinfo zipfile_info;
60
- char *filename;
61
- char *buffer;
62
- char *tmpdir;
70
+ const char *filename;
71
+ const char *buffer;
72
+ char *output_buffer;
73
+ const char *tmpdir;
63
74
  uint8_t use_zip64;
64
75
 
65
76
  } lxw_packager;
@@ -71,7 +82,7 @@ extern "C" {
71
82
  #endif
72
83
  /* *INDENT-ON* */
73
84
 
74
- lxw_packager *lxw_packager_new(const char *filename, char *tmpdir,
85
+ lxw_packager *lxw_packager_new(const char *filename, const char *tmpdir,
75
86
  uint8_t use_zip64);
76
87
  void lxw_packager_free(lxw_packager *packager);
77
88
  lxw_error lxw_create_package(lxw_packager *self);
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * libxlsxwriter
3
3
  *
4
- * Copyright 2014-2019, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
4
+ * Copyright 2014-2022, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
5
5
  *
6
6
  * relationships - A libxlsxwriter library for creating Excel XLSX
7
7
  * relationships files.
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * libxlsxwriter
3
3
  *
4
- * Copyright 2014-2019, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
4
+ * Copyright 2014-2022, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
5
5
  *
6
6
  * shared_strings - A libxlsxwriter library for creating Excel XLSX
7
7
  * sst files.
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * libxlsxwriter
3
3
  *
4
- * Copyright 2014-2019, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
4
+ * Copyright 2014-2022, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
5
5
  *
6
6
  * styles - A libxlsxwriter library for creating Excel XLSX styles files.
7
7
  *
@@ -28,6 +28,9 @@ typedef struct lxw_styles {
28
28
  uint32_t fill_count;
29
29
  struct lxw_formats *xf_formats;
30
30
  struct lxw_formats *dxf_formats;
31
+ uint8_t has_hyperlink;
32
+ uint16_t hyperlink_font_id;
33
+ uint8_t has_comments;
31
34
 
32
35
  } lxw_styles;
33
36
 
@@ -41,8 +44,8 @@ extern "C" {
41
44
  lxw_styles *lxw_styles_new(void);
42
45
  void lxw_styles_free(lxw_styles *styles);
43
46
  void lxw_styles_assemble_xml_file(lxw_styles *self);
44
- void lxw_styles_write_string_fragment(lxw_styles *self, char *string);
45
- void lxw_styles_write_rich_font(lxw_styles *lxw_styles, lxw_format *format);
47
+ void lxw_styles_write_string_fragment(lxw_styles *self, const char *string);
48
+ void lxw_styles_write_rich_font(lxw_styles *styles, lxw_format *format);
46
49
 
47
50
  /* Declarations required for unit testing. */
48
51
  #ifdef TESTING
@@ -55,18 +58,21 @@ STATIC void _write_font_name(lxw_styles *self, const char *font_name,
55
58
  uint8_t is_rich_string);
56
59
  STATIC void _write_font_family(lxw_styles *self, uint8_t font_family);
57
60
  STATIC void _write_font_scheme(lxw_styles *self, const char *font_scheme);
58
- STATIC void _write_font(lxw_styles *self, lxw_format *format,
61
+ STATIC void _write_font(lxw_styles *self, lxw_format *format, uint8_t is_dxf,
59
62
  uint8_t is_rich_string);
60
63
  STATIC void _write_fonts(lxw_styles *self);
61
64
  STATIC void _write_default_fill(lxw_styles *self, const char *pattern);
62
65
  STATIC void _write_fills(lxw_styles *self);
63
- STATIC void _write_border(lxw_styles *self, lxw_format *format);
66
+ STATIC void _write_border(lxw_styles *self, lxw_format *format,
67
+ uint8_t is_dxf);
64
68
  STATIC void _write_borders(lxw_styles *self);
65
- STATIC void _write_style_xf(lxw_styles *self);
69
+ STATIC void _write_style_xf(lxw_styles *self, uint8_t has_hyperlink,
70
+ uint16_t font_id);
66
71
  STATIC void _write_cell_style_xfs(lxw_styles *self);
67
72
  STATIC void _write_xf(lxw_styles *self, lxw_format *format);
68
73
  STATIC void _write_cell_xfs(lxw_styles *self);
69
- STATIC void _write_cell_style(lxw_styles *self);
74
+ STATIC void _write_cell_style(lxw_styles *self, char *name, uint8_t xf_id,
75
+ uint8_t builtin_id);
70
76
  STATIC void _write_cell_styles(lxw_styles *self);
71
77
  STATIC void _write_dxfs(lxw_styles *self);
72
78
  STATIC void _write_table_styles(lxw_styles *self);
@@ -0,0 +1,51 @@
1
+ /*
2
+ * libxlsxwriter
3
+ *
4
+ * Copyright 2014-2022, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
5
+ *
6
+ * table - A libxlsxwriter library for creating Excel XLSX table files.
7
+ *
8
+ */
9
+ #ifndef __LXW_TABLE_H__
10
+ #define __LXW_TABLE_H__
11
+
12
+ #include <stdint.h>
13
+
14
+ #include "common.h"
15
+
16
+ /*
17
+ * Struct to represent a table object.
18
+ */
19
+ typedef struct lxw_table {
20
+
21
+ FILE *file;
22
+
23
+ struct lxw_table_obj *table_obj;
24
+
25
+ } lxw_table;
26
+
27
+
28
+ /* *INDENT-OFF* */
29
+ #ifdef __cplusplus
30
+ extern "C" {
31
+ #endif
32
+ /* *INDENT-ON* */
33
+
34
+ lxw_table *lxw_table_new(void);
35
+ void lxw_table_free(lxw_table *table);
36
+ void lxw_table_assemble_xml_file(lxw_table *self);
37
+
38
+ /* Declarations required for unit testing. */
39
+ #ifdef TESTING
40
+
41
+ STATIC void _table_xml_declaration(lxw_table *self);
42
+
43
+ #endif /* TESTING */
44
+
45
+ /* *INDENT-OFF* */
46
+ #ifdef __cplusplus
47
+ }
48
+ #endif
49
+ /* *INDENT-ON* */
50
+
51
+ #endif /* __LXW_TABLE_H__ */
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * libxlsxwriter
3
3
  *
4
- * Copyright 2014-2019, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
4
+ * Copyright 2014-2022, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
5
5
  *
6
6
  * theme - A libxlsxwriter library for creating Excel XLSX theme files.
7
7
  *
@@ -0,0 +1,26 @@
1
+ /* emyg_dtoa.h
2
+ ** Copyright (C) 2015 Doug Currie
3
+ ** based on dtoa_milo.h
4
+ ** Copyright (C) 2014 Milo Yip
5
+ **
6
+ ** Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ ** of this software and associated documentation files (the "Software"), to deal
8
+ ** in the Software without restriction, including without limitation the rights
9
+ ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ ** copies of the Software, and to permit persons to whom the Software is
11
+ ** furnished to do so, subject to the following conditions:
12
+ **
13
+ ** The above copyright notice and this permission notice shall be included in
14
+ ** all copies or substantial portions of the Software.
15
+ **
16
+ ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
+ ** THE SOFTWARE.
23
+ */
24
+
25
+ /* Source from https://github.com/miloyip/dtoa-benchmark */
26
+ void emyg_dtoa (double value, char* buffer);
@@ -29,8 +29,8 @@
29
29
 
30
30
  #if (!defined(_WIN32)) && (!defined(WIN32)) && (!defined(__APPLE__))
31
31
 
32
- // Linux needs this to support file operation on files larger then 4+GB
33
- // But might need better if/def to select just the platforms that needs them.
32
+ /* Linux needs this to support file operation on files larger then 4+GB
33
+ * But might need better if/def to select just the platforms that needs them. */
34
34
 
35
35
  #ifndef __USE_FILE_OFFSET64
36
36
  #define __USE_FILE_OFFSET64
@@ -56,7 +56,7 @@
56
56
  #define ftello64 ftell
57
57
  #define fseeko64 fseek
58
58
  #else
59
- #ifdef __FreeBSD__
59
+ #if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__HAIKU__) || defined(MINIZIP_FOPEN_NO_64)
60
60
  #define fopen64 fopen
61
61
  #define ftello64 ftello
62
62
  #define fseeko64 fseeko
@@ -88,7 +88,7 @@
88
88
  #include "mz64conf.h"
89
89
  #endif
90
90
 
91
- /* a type choosen by DEFINE */
91
+ /* a type chosen by DEFINE */
92
92
  #ifdef HAVE_64BIT_INT_CUSTOM
93
93
  typedef 64BIT_INT_CUSTOM_TYPE ZPOS64_T;
94
94
  #else
@@ -97,8 +97,7 @@ typedef 64BIT_INT_CUSTOM_TYPE ZPOS64_T;
97
97
  typedef uint64_t ZPOS64_T;
98
98
  #else
99
99
 
100
- /* Maximum unsigned 32-bit value used as placeholder for zip64 */
101
- #define MAXU32 0xffffffff
100
+
102
101
 
103
102
  #if defined(_MSC_VER) || defined(__BORLANDC__)
104
103
  typedef unsigned __int64 ZPOS64_T;
@@ -108,7 +107,10 @@ typedef unsigned long long int ZPOS64_T;
108
107
  #endif
109
108
  #endif
110
109
 
111
-
110
+ /* Maximum unsigned 32-bit value used as placeholder for zip64 */
111
+ #ifndef MAXU32
112
+ #define MAXU32 (0xffffffff)
113
+ #endif
112
114
 
113
115
  #ifdef __cplusplus
114
116
  extern "C" {
@@ -138,14 +140,14 @@ extern "C" {
138
140
 
139
141
 
140
142
 
141
- typedef voidpf (ZCALLBACK *open_file_func) OF((voidpf opaque, const char* filename, int mode));
142
- typedef uLong (ZCALLBACK *read_file_func) OF((voidpf opaque, voidpf stream, void* buf, uLong size));
143
- typedef uLong (ZCALLBACK *write_file_func) OF((voidpf opaque, voidpf stream, const void* buf, uLong size));
144
- typedef int (ZCALLBACK *close_file_func) OF((voidpf opaque, voidpf stream));
145
- typedef int (ZCALLBACK *testerror_file_func) OF((voidpf opaque, voidpf stream));
143
+ typedef voidpf (ZCALLBACK *open_file_func) (voidpf opaque, const char* filename, int mode);
144
+ typedef uLong (ZCALLBACK *read_file_func) (voidpf opaque, voidpf stream, void* buf, uLong size);
145
+ typedef uLong (ZCALLBACK *write_file_func) (voidpf opaque, voidpf stream, const void* buf, uLong size);
146
+ typedef int (ZCALLBACK *close_file_func) (voidpf opaque, voidpf stream);
147
+ typedef int (ZCALLBACK *testerror_file_func) (voidpf opaque, voidpf stream);
146
148
 
147
- typedef long (ZCALLBACK *tell_file_func) OF((voidpf opaque, voidpf stream));
148
- typedef long (ZCALLBACK *seek_file_func) OF((voidpf opaque, voidpf stream, uLong offset, int origin));
149
+ typedef long (ZCALLBACK *tell_file_func) (voidpf opaque, voidpf stream);
150
+ typedef long (ZCALLBACK *seek_file_func) (voidpf opaque, voidpf stream, uLong offset, int origin);
149
151
 
150
152
 
151
153
  /* here is the "old" 32 bits structure structure */
@@ -161,9 +163,9 @@ typedef struct zlib_filefunc_def_s
161
163
  voidpf opaque;
162
164
  } zlib_filefunc_def;
163
165
 
164
- typedef ZPOS64_T (ZCALLBACK *tell64_file_func) OF((voidpf opaque, voidpf stream));
165
- typedef long (ZCALLBACK *seek64_file_func) OF((voidpf opaque, voidpf stream, ZPOS64_T offset, int origin));
166
- typedef voidpf (ZCALLBACK *open64_file_func) OF((voidpf opaque, const void* filename, int mode));
166
+ typedef ZPOS64_T (ZCALLBACK *tell64_file_func) (voidpf opaque, voidpf stream);
167
+ typedef long (ZCALLBACK *seek64_file_func) (voidpf opaque, voidpf stream, ZPOS64_T offset, int origin);
168
+ typedef voidpf (ZCALLBACK *open64_file_func) (voidpf opaque, const void* filename, int mode);
167
169
 
168
170
  typedef struct zlib_filefunc64_def_s
169
171
  {
@@ -177,8 +179,8 @@ typedef struct zlib_filefunc64_def_s
177
179
  voidpf opaque;
178
180
  } zlib_filefunc64_def;
179
181
 
180
- void fill_fopen64_filefunc OF((zlib_filefunc64_def* pzlib_filefunc_def));
181
- void fill_fopen_filefunc OF((zlib_filefunc_def* pzlib_filefunc_def));
182
+ void fill_fopen64_filefunc(zlib_filefunc64_def* pzlib_filefunc_def);
183
+ void fill_fopen_filefunc(zlib_filefunc_def* pzlib_filefunc_def);
182
184
 
183
185
  /* now internal definition, only for zip.c and unzip.h */
184
186
  typedef struct zlib_filefunc64_32_def_s
@@ -192,16 +194,16 @@ typedef struct zlib_filefunc64_32_def_s
192
194
 
193
195
  #define ZREAD64(filefunc,filestream,buf,size) ((*((filefunc).zfile_func64.zread_file)) ((filefunc).zfile_func64.opaque,filestream,buf,size))
194
196
  #define ZWRITE64(filefunc,filestream,buf,size) ((*((filefunc).zfile_func64.zwrite_file)) ((filefunc).zfile_func64.opaque,filestream,buf,size))
195
- /* #define ZTELL64(filefunc,filestream) ((*((filefunc).ztell64_file)) ((filefunc).opaque,filestream)) */
196
- /* #define ZSEEK64(filefunc,filestream,pos,mode) ((*((filefunc).zseek64_file)) ((filefunc).opaque,filestream,pos,mode)) */
197
+ /*#define ZTELL64(filefunc,filestream) ((*((filefunc).ztell64_file)) ((filefunc).opaque,filestream))*/
198
+ /*#define ZSEEK64(filefunc,filestream,pos,mode) ((*((filefunc).zseek64_file)) ((filefunc).opaque,filestream,pos,mode))*/
197
199
  #define ZCLOSE64(filefunc,filestream) ((*((filefunc).zfile_func64.zclose_file)) ((filefunc).zfile_func64.opaque,filestream))
198
200
  #define ZERROR64(filefunc,filestream) ((*((filefunc).zfile_func64.zerror_file)) ((filefunc).zfile_func64.opaque,filestream))
199
201
 
200
- voidpf call_zopen64 OF((const zlib_filefunc64_32_def* pfilefunc,const void*filename,int mode));
201
- long call_zseek64 OF((const zlib_filefunc64_32_def* pfilefunc,voidpf filestream, ZPOS64_T offset, int origin));
202
- ZPOS64_T call_ztell64 OF((const zlib_filefunc64_32_def* pfilefunc,voidpf filestream));
202
+ voidpf call_zopen64(const zlib_filefunc64_32_def* pfilefunc,const void*filename,int mode);
203
+ long call_zseek64(const zlib_filefunc64_32_def* pfilefunc,voidpf filestream, ZPOS64_T offset, int origin);
204
+ ZPOS64_T call_ztell64(const zlib_filefunc64_32_def* pfilefunc,voidpf filestream);
203
205
 
204
- void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def* p_filefunc64_32,const zlib_filefunc_def* p_filefunc32);
206
+ void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def* p_filefunc64_32,const zlib_filefunc_def* p_filefunc32);
205
207
 
206
208
  #define ZOPEN64(filefunc,filename,mode) (call_zopen64((&(filefunc)),(filename),(mode)))
207
209
  #define ZTELL64(filefunc,filestream) (call_ztell64((&(filefunc)),(filestream)))
@@ -0,0 +1,45 @@
1
+ /*
2
+ * This is an OpenSSL-compatible implementation of the RSA Data Security, Inc.
3
+ * MD5 Message-Digest Algorithm (RFC 1321).
4
+ *
5
+ * Homepage:
6
+ * http://openwall.info/wiki/people/solar/software/public-domain-source-code/md5
7
+ *
8
+ * Author:
9
+ * Alexander Peslyak, better known as Solar Designer <solar at openwall.com>
10
+ *
11
+ * This software was written by Alexander Peslyak in 2001. No copyright is
12
+ * claimed, and the software is hereby placed in the public domain.
13
+ * In case this attempt to disclaim copyright and place the software in the
14
+ * public domain is deemed null and void, then the software is
15
+ * Copyright (c) 2001 Alexander Peslyak and it is hereby released to the
16
+ * general public under the following terms:
17
+ *
18
+ * Redistribution and use in source and binary forms, with or without
19
+ * modification, are permitted.
20
+ *
21
+ * There's ABSOLUTELY NO WARRANTY, express or implied.
22
+ *
23
+ * See md5.c for more information.
24
+ */
25
+
26
+ #ifdef HAVE_OPENSSL
27
+ #include <openssl/md5.h>
28
+ #elif !defined(_MD5_H)
29
+ #define _MD5_H
30
+
31
+ /* Any 32-bit or wider unsigned integer data type will do */
32
+ typedef unsigned int MD5_u32plus;
33
+
34
+ typedef struct {
35
+ MD5_u32plus lo, hi;
36
+ MD5_u32plus a, b, c, d;
37
+ unsigned char buffer[64];
38
+ MD5_u32plus block[16];
39
+ } MD5_CTX;
40
+
41
+ extern void MD5_Init(MD5_CTX *ctx);
42
+ extern void MD5_Update(MD5_CTX *ctx, const void *data, unsigned long size);
43
+ extern void MD5_Final(unsigned char *result, MD5_CTX *ctx);
44
+
45
+ #endif