fast_excel 0.1.4 → 0.1.5
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.
- checksums.yaml +4 -4
- data/.gitignore +5 -2
- data/Makefile +14 -0
- data/README.md +7 -2
- data/Rakefile +10 -0
- data/extconf.rb +0 -0
- data/fast_excel.gemspec +3 -1
- data/lib/fast_excel/binding.rb +3 -7
- data/lib/rubygems_plugin.rb +3 -0
- data/libxlsxwriter/.gitignore +49 -0
- data/libxlsxwriter/.indent.pro +125 -0
- data/libxlsxwriter/.travis.yml +25 -0
- data/libxlsxwriter/CONTRIBUTING.md +226 -0
- data/libxlsxwriter/Changes.txt +557 -0
- data/libxlsxwriter/LICENSE.txt +89 -0
- data/libxlsxwriter/Makefile +156 -0
- data/libxlsxwriter/Readme.md +78 -0
- data/libxlsxwriter/cocoapods/libxlsxwriter-umbrella.h +30 -0
- data/libxlsxwriter/cocoapods/libxlsxwriter.modulemap +7 -0
- data/libxlsxwriter/include/xlsxwriter/app.h +79 -0
- data/libxlsxwriter/include/xlsxwriter/chart.h +3476 -0
- data/libxlsxwriter/include/xlsxwriter/common.h +372 -0
- data/libxlsxwriter/include/xlsxwriter/content_types.h +74 -0
- data/libxlsxwriter/include/xlsxwriter/core.h +51 -0
- data/libxlsxwriter/include/xlsxwriter/custom.h +52 -0
- data/libxlsxwriter/include/xlsxwriter/drawing.h +111 -0
- data/libxlsxwriter/include/xlsxwriter/format.h +1214 -0
- data/libxlsxwriter/include/xlsxwriter/hash_table.h +76 -0
- data/libxlsxwriter/include/xlsxwriter/packager.h +80 -0
- data/libxlsxwriter/include/xlsxwriter/relationships.h +77 -0
- data/libxlsxwriter/include/xlsxwriter/shared_strings.h +83 -0
- data/libxlsxwriter/include/xlsxwriter/styles.h +77 -0
- data/libxlsxwriter/include/xlsxwriter/theme.h +47 -0
- data/libxlsxwriter/include/xlsxwriter/third_party/ioapi.h +214 -0
- data/libxlsxwriter/include/xlsxwriter/third_party/queue.h +694 -0
- data/libxlsxwriter/include/xlsxwriter/third_party/tmpfileplus.h +53 -0
- data/libxlsxwriter/include/xlsxwriter/third_party/tree.h +801 -0
- data/libxlsxwriter/include/xlsxwriter/third_party/zip.h +375 -0
- data/libxlsxwriter/include/xlsxwriter/utility.h +166 -0
- data/libxlsxwriter/include/xlsxwriter/workbook.h +757 -0
- data/libxlsxwriter/include/xlsxwriter/worksheet.h +2641 -0
- data/libxlsxwriter/include/xlsxwriter/xmlwriter.h +178 -0
- data/libxlsxwriter/include/xlsxwriter.h +23 -0
- data/libxlsxwriter/lib/.gitignore +0 -0
- data/libxlsxwriter/libxlsxwriter.podspec +47 -0
- data/libxlsxwriter/src/Makefile +130 -0
- data/libxlsxwriter/src/app.c +443 -0
- data/libxlsxwriter/src/chart.c +6346 -0
- data/libxlsxwriter/src/content_types.c +345 -0
- data/libxlsxwriter/src/core.c +293 -0
- data/libxlsxwriter/src/custom.c +224 -0
- data/libxlsxwriter/src/drawing.c +746 -0
- data/libxlsxwriter/src/format.c +729 -0
- data/libxlsxwriter/src/hash_table.c +223 -0
- data/libxlsxwriter/src/packager.c +948 -0
- data/libxlsxwriter/src/relationships.c +245 -0
- data/libxlsxwriter/src/shared_strings.c +266 -0
- data/libxlsxwriter/src/styles.c +1088 -0
- data/libxlsxwriter/src/theme.c +348 -0
- data/libxlsxwriter/src/utility.c +515 -0
- data/libxlsxwriter/src/workbook.c +1930 -0
- data/libxlsxwriter/src/worksheet.c +5022 -0
- data/libxlsxwriter/src/xmlwriter.c +355 -0
- data/libxlsxwriter/third_party/minizip/Makefile +44 -0
- data/libxlsxwriter/third_party/minizip/Makefile.am +45 -0
- data/libxlsxwriter/third_party/minizip/Makefile.orig +25 -0
- data/libxlsxwriter/third_party/minizip/MiniZip64_Changes.txt +6 -0
- data/libxlsxwriter/third_party/minizip/MiniZip64_info.txt +74 -0
- data/libxlsxwriter/third_party/minizip/README.txt +5 -0
- data/libxlsxwriter/third_party/minizip/configure.ac +32 -0
- data/libxlsxwriter/third_party/minizip/crypt.h +131 -0
- data/libxlsxwriter/third_party/minizip/ioapi.c +247 -0
- data/libxlsxwriter/third_party/minizip/ioapi.h +208 -0
- data/libxlsxwriter/third_party/minizip/iowin32.c +456 -0
- data/libxlsxwriter/third_party/minizip/iowin32.h +28 -0
- data/libxlsxwriter/third_party/minizip/make_vms.com +25 -0
- data/libxlsxwriter/third_party/minizip/miniunz.c +660 -0
- data/libxlsxwriter/third_party/minizip/miniunzip.1 +63 -0
- data/libxlsxwriter/third_party/minizip/minizip.1 +46 -0
- data/libxlsxwriter/third_party/minizip/minizip.c +520 -0
- data/libxlsxwriter/third_party/minizip/minizip.pc.in +12 -0
- data/libxlsxwriter/third_party/minizip/mztools.c +291 -0
- data/libxlsxwriter/third_party/minizip/mztools.h +37 -0
- data/libxlsxwriter/third_party/minizip/unzip.c +2125 -0
- data/libxlsxwriter/third_party/minizip/unzip.h +437 -0
- data/libxlsxwriter/third_party/minizip/zip.c +2007 -0
- data/libxlsxwriter/third_party/minizip/zip.h +367 -0
- data/libxlsxwriter/third_party/tmpfileplus/Makefile +42 -0
- data/libxlsxwriter/third_party/tmpfileplus/tmpfileplus.c +342 -0
- data/libxlsxwriter/third_party/tmpfileplus/tmpfileplus.h +53 -0
- data/libxlsxwriter/version.txt +1 -0
- metadata +89 -6
- data/binaries/libxlsxwriter-alpine.so +0 -0
- data/binaries/libxlsxwriter-darwin.dylib +0 -0
- data/binaries/libxlsxwriter-glibc.so +0 -0
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
/* $Id: tmpfileplus.c $ */
|
|
2
|
+
/*
|
|
3
|
+
* $Date: 2016-06-01 03:31Z $
|
|
4
|
+
* $Revision: 2.0.0 $
|
|
5
|
+
* $Author: dai $
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/*
|
|
9
|
+
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
10
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
11
|
+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) 2012-16 David Ireland, DI Management Services Pty Ltd
|
|
14
|
+
* <http://www.di-mgt.com.au/contact/>.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
/*
|
|
19
|
+
* NAME
|
|
20
|
+
* tmpfileplus - create a unique temporary file
|
|
21
|
+
*
|
|
22
|
+
* SYNOPSIS
|
|
23
|
+
* FILE *tmpfileplus(const char *dir, const char *prefix, char **pathname, int keep)
|
|
24
|
+
*
|
|
25
|
+
* DESCRIPTION
|
|
26
|
+
* The tmpfileplus() function opens a unique temporary file in binary
|
|
27
|
+
* read/write (w+b) mode. The file is opened with the O_EXCL flag,
|
|
28
|
+
* guaranteeing that the caller is the only user. The filename will consist
|
|
29
|
+
* of the string given by `prefix` followed by 10 random characters. If
|
|
30
|
+
* `prefix` is NULL, then the string "tmp." will be used instead. The file
|
|
31
|
+
* will be created in an appropriate directory chosen by the first
|
|
32
|
+
* successful attempt in the following sequence:
|
|
33
|
+
*
|
|
34
|
+
* a) The directory given by the `dir` argument (so the caller can specify
|
|
35
|
+
* a secure directory to take precedence).
|
|
36
|
+
*
|
|
37
|
+
* b) The directory name in the environment variables:
|
|
38
|
+
*
|
|
39
|
+
* (i) "TMP" [Windows only]
|
|
40
|
+
* (ii) "TEMP" [Windows only]
|
|
41
|
+
* (iii) "TMPDIR" [Unix only]
|
|
42
|
+
*
|
|
43
|
+
* c) `P_tmpdir` as defined in <stdio.h> [Unix only] (in Windows, this is
|
|
44
|
+
* usually "\", which is no good).
|
|
45
|
+
*
|
|
46
|
+
* d) The current working directory.
|
|
47
|
+
*
|
|
48
|
+
* If a file cannot be created in any of the above directories, then the
|
|
49
|
+
* function fails and NULL is returned.
|
|
50
|
+
*
|
|
51
|
+
* If the argument `pathname` is not a null pointer, then it will point to
|
|
52
|
+
* the full pathname of the file. The pathname is allocated using `malloc`
|
|
53
|
+
* and therefore should be freed by `free`.
|
|
54
|
+
*
|
|
55
|
+
* If `keep` is nonzero and `pathname` is not a null pointer, then the file
|
|
56
|
+
* will be kept after it is closed. Otherwise the file will be
|
|
57
|
+
* automatically deleted when it is closed or the program terminates.
|
|
58
|
+
*
|
|
59
|
+
*
|
|
60
|
+
* RETURN VALUE
|
|
61
|
+
* The tmpfileplus() function returns a pointer to the open file stream,
|
|
62
|
+
* or NULL if a unique file cannot be opened.
|
|
63
|
+
*
|
|
64
|
+
*
|
|
65
|
+
* ERRORS
|
|
66
|
+
* ENOMEM Not enough memory to allocate filename.
|
|
67
|
+
*
|
|
68
|
+
*/
|
|
69
|
+
|
|
70
|
+
/* ADDED IN v2.0 */
|
|
71
|
+
|
|
72
|
+
/*
|
|
73
|
+
* NAME
|
|
74
|
+
* tmpfileplus_f - create a unique temporary file with filename stored in a fixed-length buffer
|
|
75
|
+
*
|
|
76
|
+
* SYNOPSIS
|
|
77
|
+
* FILE *tmpfileplus_f(const char *dir, const char *prefix, char *pathnamebuf, size_t pathsize, int keep);
|
|
78
|
+
*
|
|
79
|
+
* DESCRIPTION
|
|
80
|
+
* Same as tmpfileplus() except receives filename in a fixed-length buffer. No allocated memory to free.
|
|
81
|
+
|
|
82
|
+
* ERRORS
|
|
83
|
+
* E2BIG Resulting filename is too big for the buffer `pathnamebuf`.
|
|
84
|
+
|
|
85
|
+
*/
|
|
86
|
+
|
|
87
|
+
#include "tmpfileplus.h"
|
|
88
|
+
|
|
89
|
+
#include <stdio.h>
|
|
90
|
+
#include <stdlib.h>
|
|
91
|
+
#include <string.h>
|
|
92
|
+
#include <time.h>
|
|
93
|
+
#include <errno.h>
|
|
94
|
+
|
|
95
|
+
/* Non-ANSI include files that seem to work in both MSVC and Linux */
|
|
96
|
+
#include <sys/types.h>
|
|
97
|
+
#include <sys/stat.h>
|
|
98
|
+
#include <fcntl.h>
|
|
99
|
+
|
|
100
|
+
#ifdef _WIN32
|
|
101
|
+
#include <io.h>
|
|
102
|
+
#else
|
|
103
|
+
#include <unistd.h>
|
|
104
|
+
#endif
|
|
105
|
+
|
|
106
|
+
#ifdef _WIN32
|
|
107
|
+
/* MSVC nags to enforce ISO C++ conformant function names with leading "_",
|
|
108
|
+
* so we define our own function names to avoid whingeing compilers...
|
|
109
|
+
*/
|
|
110
|
+
#define OPEN_ _open
|
|
111
|
+
#define FDOPEN_ _fdopen
|
|
112
|
+
#else
|
|
113
|
+
#define OPEN_ open
|
|
114
|
+
#define FDOPEN_ fdopen
|
|
115
|
+
#endif
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
/* DEBUGGING STUFF */
|
|
119
|
+
#if defined(_DEBUG) && defined(SHOW_DPRINTF)
|
|
120
|
+
#define DPRINTF1(s, a1) printf(s, a1)
|
|
121
|
+
#else
|
|
122
|
+
#define DPRINTF1(s, a1)
|
|
123
|
+
#endif
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
#ifdef _WIN32
|
|
127
|
+
#define FILE_SEPARATOR "\\"
|
|
128
|
+
#else
|
|
129
|
+
#define FILE_SEPARATOR "/"
|
|
130
|
+
#endif
|
|
131
|
+
|
|
132
|
+
#define RANDCHARS "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
|
|
133
|
+
#define NRANDCHARS (sizeof(RANDCHARS) - 1)
|
|
134
|
+
|
|
135
|
+
/** Replace each byte in string s with a random character from TEMPCHARS */
|
|
136
|
+
static char *set_randpart(char *s)
|
|
137
|
+
{
|
|
138
|
+
size_t i;
|
|
139
|
+
unsigned int r;
|
|
140
|
+
static unsigned int seed; /* NB static */
|
|
141
|
+
|
|
142
|
+
if (seed == 0)
|
|
143
|
+
{ /* First time set our seed using current time and clock */
|
|
144
|
+
seed = ((unsigned)time(NULL)<<8) ^ (unsigned)clock();
|
|
145
|
+
}
|
|
146
|
+
srand(seed++);
|
|
147
|
+
for (i = 0; i < strlen(s); i++)
|
|
148
|
+
{
|
|
149
|
+
r = rand() % NRANDCHARS;
|
|
150
|
+
s[i] = (RANDCHARS)[r];
|
|
151
|
+
}
|
|
152
|
+
return s;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/** Return 1 if path is a valid directory otherwise 0 */
|
|
156
|
+
static int is_valid_dir(const char *path)
|
|
157
|
+
{
|
|
158
|
+
struct stat st;
|
|
159
|
+
if ((stat(path, &st) == 0) && (st.st_mode & S_IFDIR))
|
|
160
|
+
return 1;
|
|
161
|
+
|
|
162
|
+
return 0;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/** Call getenv and save a copy in buf */
|
|
166
|
+
static char *getenv_save(const char *varname, char *buf, size_t bufsize)
|
|
167
|
+
{
|
|
168
|
+
char *ptr = getenv(varname);
|
|
169
|
+
buf[0] = '\0';
|
|
170
|
+
if (ptr)
|
|
171
|
+
{
|
|
172
|
+
strncpy(buf, ptr, bufsize);
|
|
173
|
+
buf[bufsize-1] = '\0';
|
|
174
|
+
return buf;
|
|
175
|
+
}
|
|
176
|
+
return NULL;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Try and create a randomly-named file in directory `tmpdir`.
|
|
181
|
+
* If successful, allocate memory and set `tmpname_ptr` to full filepath, and return file pointer;
|
|
182
|
+
* otherwise return NULL.
|
|
183
|
+
* If `keep` is zero then create the file as temporary and it should not exist once closed.
|
|
184
|
+
*/
|
|
185
|
+
static FILE *mktempfile_internal(const char *tmpdir, const char *pfx, char **tmpname_ptr, int keep)
|
|
186
|
+
/* PRE:
|
|
187
|
+
* pfx is not NULL and points to a valid null-terminated string
|
|
188
|
+
* tmpname_ptr is not NULL.
|
|
189
|
+
*/
|
|
190
|
+
{
|
|
191
|
+
FILE *fp;
|
|
192
|
+
int fd;
|
|
193
|
+
char randpart[] = "1234567890";
|
|
194
|
+
size_t lentempname;
|
|
195
|
+
int i;
|
|
196
|
+
char *tmpname = NULL;
|
|
197
|
+
int oflag, pmode;
|
|
198
|
+
|
|
199
|
+
/* In Windows, we use the _O_TEMPORARY flag with `open` to ensure the file is deleted when closed.
|
|
200
|
+
* In Unix, we use the unlink function after opening the file. (This does not work in Windows,
|
|
201
|
+
* which does not allow an open file to be unlinked.)
|
|
202
|
+
*/
|
|
203
|
+
#ifdef _WIN32
|
|
204
|
+
/* MSVC flags */
|
|
205
|
+
oflag = _O_BINARY|_O_CREAT|_O_EXCL|_O_RDWR;
|
|
206
|
+
if (!keep)
|
|
207
|
+
oflag |= _O_TEMPORARY;
|
|
208
|
+
pmode = _S_IREAD | _S_IWRITE;
|
|
209
|
+
#else
|
|
210
|
+
/* Standard POSIX flags */
|
|
211
|
+
oflag = O_CREAT|O_EXCL|O_RDWR;
|
|
212
|
+
pmode = S_IRUSR|S_IWUSR;
|
|
213
|
+
#endif
|
|
214
|
+
|
|
215
|
+
if (!tmpdir || !is_valid_dir(tmpdir)) {
|
|
216
|
+
errno = ENOENT;
|
|
217
|
+
return NULL;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
lentempname = strlen(tmpdir) + strlen(FILE_SEPARATOR) + strlen(pfx) + strlen(randpart);
|
|
221
|
+
DPRINTF1("lentempname=%d\n", lentempname);
|
|
222
|
+
tmpname = malloc(lentempname + 1);
|
|
223
|
+
if (!tmpname)
|
|
224
|
+
{
|
|
225
|
+
errno = ENOMEM;
|
|
226
|
+
return NULL;
|
|
227
|
+
}
|
|
228
|
+
/* If we don't manage to create a file after 10 goes, there is something wrong... */
|
|
229
|
+
for (i = 0; i < 10; i++)
|
|
230
|
+
{
|
|
231
|
+
sprintf(tmpname, "%s%s%s%s", tmpdir, FILE_SEPARATOR, pfx, set_randpart(randpart));
|
|
232
|
+
DPRINTF1("[%s]\n", tmpname);
|
|
233
|
+
fd = OPEN_(tmpname, oflag, pmode);
|
|
234
|
+
if (fd != -1) break;
|
|
235
|
+
}
|
|
236
|
+
DPRINTF1("strlen(tmpname)=%d\n", strlen(tmpname));
|
|
237
|
+
if (fd != -1)
|
|
238
|
+
{ /* Success, so return user a proper ANSI C file pointer */
|
|
239
|
+
fp = FDOPEN_(fd, "w+b");
|
|
240
|
+
errno = 0;
|
|
241
|
+
|
|
242
|
+
#ifndef _WIN32
|
|
243
|
+
/* [Unix only] And make sure the file will be deleted once closed */
|
|
244
|
+
if (!keep) unlink(tmpname);
|
|
245
|
+
#endif
|
|
246
|
+
|
|
247
|
+
}
|
|
248
|
+
else
|
|
249
|
+
{ /* We failed */
|
|
250
|
+
fp = NULL;
|
|
251
|
+
}
|
|
252
|
+
if (!fp)
|
|
253
|
+
{
|
|
254
|
+
free(tmpname);
|
|
255
|
+
tmpname = NULL;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
*tmpname_ptr = tmpname;
|
|
259
|
+
return fp;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/**********************/
|
|
263
|
+
/* EXPORTED FUNCTIONS */
|
|
264
|
+
/**********************/
|
|
265
|
+
|
|
266
|
+
FILE *tmpfileplus(const char *dir, const char *prefix, char **pathname, int keep)
|
|
267
|
+
{
|
|
268
|
+
FILE *fp = NULL;
|
|
269
|
+
char *tmpname = NULL;
|
|
270
|
+
char *tmpdir = NULL;
|
|
271
|
+
const char *pfx = (prefix ? prefix : "tmp.");
|
|
272
|
+
char *tempdirs[12] = { 0 };
|
|
273
|
+
#ifdef _WIN32
|
|
274
|
+
char env1[FILENAME_MAX+1] = { 0 };
|
|
275
|
+
char env2[FILENAME_MAX+1] = { 0 };
|
|
276
|
+
#else
|
|
277
|
+
char env3[FILENAME_MAX+1] = { 0 };
|
|
278
|
+
#endif
|
|
279
|
+
int ntempdirs = 0;
|
|
280
|
+
int i;
|
|
281
|
+
|
|
282
|
+
/* Set up a list of temp directories we will try in order */
|
|
283
|
+
i = 0;
|
|
284
|
+
tempdirs[i++] = (char *)dir;
|
|
285
|
+
#ifdef _WIN32
|
|
286
|
+
tempdirs[i++] = getenv_save("TMP", env1, sizeof(env1));
|
|
287
|
+
tempdirs[i++] = getenv_save("TEMP", env2, sizeof(env2));
|
|
288
|
+
#else
|
|
289
|
+
tempdirs[i++] = getenv_save("TMPDIR", env3, sizeof(env3));
|
|
290
|
+
tempdirs[i++] = P_tmpdir;
|
|
291
|
+
#endif
|
|
292
|
+
tempdirs[i++] = ".";
|
|
293
|
+
ntempdirs = i;
|
|
294
|
+
|
|
295
|
+
errno = 0;
|
|
296
|
+
|
|
297
|
+
/* Work through list we set up before, and break once we are successful */
|
|
298
|
+
for (i = 0; i < ntempdirs; i++)
|
|
299
|
+
{
|
|
300
|
+
tmpdir = tempdirs[i];
|
|
301
|
+
DPRINTF1("Trying tmpdir=[%s]\n", tmpdir);
|
|
302
|
+
fp = mktempfile_internal(tmpdir, pfx, &tmpname, keep);
|
|
303
|
+
if (fp) break;
|
|
304
|
+
}
|
|
305
|
+
/* If we succeeded and the user passed a pointer, set it to the alloc'd pathname: the user must free this */
|
|
306
|
+
if (fp && pathname)
|
|
307
|
+
*pathname = tmpname;
|
|
308
|
+
else /* Otherwise, free the alloc'd memory */
|
|
309
|
+
free(tmpname);
|
|
310
|
+
|
|
311
|
+
return fp;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
/* Same as tmpfileplus() but with fixed length buffer for output filename and no memory allocation */
|
|
315
|
+
FILE *tmpfileplus_f(const char *dir, const char *prefix, char *pathnamebuf, size_t pathsize, int keep)
|
|
316
|
+
{
|
|
317
|
+
char *tmpbuf = NULL;
|
|
318
|
+
FILE *fp;
|
|
319
|
+
|
|
320
|
+
/* If no buffer provided, do the normal way */
|
|
321
|
+
if (!pathnamebuf || (int)pathsize <= 0) {
|
|
322
|
+
return tmpfileplus(dir, prefix, NULL, keep);
|
|
323
|
+
}
|
|
324
|
+
/* Call with a temporary buffer */
|
|
325
|
+
fp = tmpfileplus(dir, prefix, &tmpbuf, keep);
|
|
326
|
+
if (fp && strlen(tmpbuf) > pathsize - 1) {
|
|
327
|
+
/* Succeeded but not enough room in output buffer, so clean up and return an error */
|
|
328
|
+
pathnamebuf[0] = 0;
|
|
329
|
+
fclose(fp);
|
|
330
|
+
if (keep) remove(tmpbuf);
|
|
331
|
+
free(tmpbuf);
|
|
332
|
+
errno = E2BIG;
|
|
333
|
+
return NULL;
|
|
334
|
+
}
|
|
335
|
+
/* Copy name into buffer */
|
|
336
|
+
strcpy(pathnamebuf, tmpbuf);
|
|
337
|
+
free(tmpbuf);
|
|
338
|
+
|
|
339
|
+
return fp;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/* $Id: tmpfileplus.h $ */
|
|
2
|
+
/*
|
|
3
|
+
* $Date: 2016-06-01 03:31Z $
|
|
4
|
+
* $Revision: 2.0.0 $
|
|
5
|
+
* $Author: dai $
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/*
|
|
9
|
+
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
10
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
11
|
+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) 2012-16 David Ireland, DI Management Services Pty Ltd
|
|
14
|
+
* <http://www.di-mgt.com.au/contact/>.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
#if _MSC_VER > 1000
|
|
18
|
+
#pragma once
|
|
19
|
+
#endif
|
|
20
|
+
|
|
21
|
+
#ifndef TMPFILEPLUS_H_
|
|
22
|
+
#define TMPFILEPLUS_H_
|
|
23
|
+
|
|
24
|
+
#include <stdio.h>
|
|
25
|
+
|
|
26
|
+
/** Create a unique temporary file.
|
|
27
|
+
@param dir (optional) directory to create file. If NULL use default TMP directory.
|
|
28
|
+
@param prefix (optional) prefix for file name. If NULL use "tmp.".
|
|
29
|
+
@param pathname (optional) pointer to a buffer to receive the temp filename.
|
|
30
|
+
Allocated using `malloc()`; user to free. Ignored if NULL.
|
|
31
|
+
@param keep If `keep` is nonzero and `pathname` is not NULL, then keep the file after closing.
|
|
32
|
+
Otherwise file is automatically deleted when closed.
|
|
33
|
+
@return Pointer to stream opened in binary read/write (w+b) mode, or a null pointer on error.
|
|
34
|
+
@exception ENOMEM Not enough memory to allocate filename.
|
|
35
|
+
*/
|
|
36
|
+
FILE *tmpfileplus(const char *dir, const char *prefix, char **pathname, int keep);
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
/** Create a unique temporary file with filename stored in a fixed-length buffer.
|
|
40
|
+
@param dir (optional) directory to create file. If NULL use default directory.
|
|
41
|
+
@param prefix (optional) prefix for file name. If NULL use "tmp.".
|
|
42
|
+
@param pathnamebuf (optional) buffer to receive full pathname of temporary file. Ignored if NULL.
|
|
43
|
+
@param pathsize Size of buffer to receive filename and its terminating null character.
|
|
44
|
+
@param keep If `keep` is nonzero and `pathname` is not NULL, then keep the file after closing.
|
|
45
|
+
Otherwise file is automatically deleted when closed.
|
|
46
|
+
@return Pointer to stream opened in binary read/write (w+b) mode, or a null pointer on error.
|
|
47
|
+
@exception E2BIG Resulting filename is too big for the buffer `pathnamebuf`.
|
|
48
|
+
*/
|
|
49
|
+
FILE *tmpfileplus_f(const char *dir, const char *prefix, char *pathnamebuf, size_t pathsize, int keep);
|
|
50
|
+
|
|
51
|
+
#define TMPFILE_KEEP 1
|
|
52
|
+
|
|
53
|
+
#endif /* end TMPFILEPLUS_H_ */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
2017-02-28 20:35:27 +0800 c8064ee
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: fast_excel
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Pavel Evstigneev
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2017-
|
|
11
|
+
date: 2017-03-06 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: ffi
|
|
@@ -34,7 +34,8 @@ description: Wrapper for libxlsxwriter using ffi
|
|
|
34
34
|
email:
|
|
35
35
|
- pavel.evst@gmail.com
|
|
36
36
|
executables: []
|
|
37
|
-
extensions:
|
|
37
|
+
extensions:
|
|
38
|
+
- extconf.rb
|
|
38
39
|
extra_rdoc_files: []
|
|
39
40
|
files:
|
|
40
41
|
- ".dockerignore"
|
|
@@ -42,19 +43,101 @@ files:
|
|
|
42
43
|
- BUILD.md
|
|
43
44
|
- Gemfile
|
|
44
45
|
- Gemfile.lock
|
|
46
|
+
- Makefile
|
|
45
47
|
- README.md
|
|
46
48
|
- Rakefile
|
|
47
|
-
- binaries/libxlsxwriter-alpine.so
|
|
48
|
-
- binaries/libxlsxwriter-darwin.dylib
|
|
49
|
-
- binaries/libxlsxwriter-glibc.so
|
|
50
49
|
- build_alpine_linux.docker
|
|
51
50
|
- build_centos_linux.docker
|
|
52
51
|
- example.rb
|
|
53
52
|
- example_chart.rb
|
|
54
53
|
- example_image.rb
|
|
54
|
+
- extconf.rb
|
|
55
55
|
- fast_excel.gemspec
|
|
56
56
|
- lib/fast_excel.rb
|
|
57
57
|
- lib/fast_excel/binding.rb
|
|
58
|
+
- lib/rubygems_plugin.rb
|
|
59
|
+
- libxlsxwriter/.gitignore
|
|
60
|
+
- libxlsxwriter/.indent.pro
|
|
61
|
+
- libxlsxwriter/.travis.yml
|
|
62
|
+
- libxlsxwriter/CONTRIBUTING.md
|
|
63
|
+
- libxlsxwriter/Changes.txt
|
|
64
|
+
- libxlsxwriter/LICENSE.txt
|
|
65
|
+
- libxlsxwriter/Makefile
|
|
66
|
+
- libxlsxwriter/Readme.md
|
|
67
|
+
- libxlsxwriter/cocoapods/libxlsxwriter-umbrella.h
|
|
68
|
+
- libxlsxwriter/cocoapods/libxlsxwriter.modulemap
|
|
69
|
+
- libxlsxwriter/include/xlsxwriter.h
|
|
70
|
+
- libxlsxwriter/include/xlsxwriter/app.h
|
|
71
|
+
- libxlsxwriter/include/xlsxwriter/chart.h
|
|
72
|
+
- libxlsxwriter/include/xlsxwriter/common.h
|
|
73
|
+
- libxlsxwriter/include/xlsxwriter/content_types.h
|
|
74
|
+
- libxlsxwriter/include/xlsxwriter/core.h
|
|
75
|
+
- libxlsxwriter/include/xlsxwriter/custom.h
|
|
76
|
+
- libxlsxwriter/include/xlsxwriter/drawing.h
|
|
77
|
+
- libxlsxwriter/include/xlsxwriter/format.h
|
|
78
|
+
- libxlsxwriter/include/xlsxwriter/hash_table.h
|
|
79
|
+
- libxlsxwriter/include/xlsxwriter/packager.h
|
|
80
|
+
- libxlsxwriter/include/xlsxwriter/relationships.h
|
|
81
|
+
- libxlsxwriter/include/xlsxwriter/shared_strings.h
|
|
82
|
+
- libxlsxwriter/include/xlsxwriter/styles.h
|
|
83
|
+
- libxlsxwriter/include/xlsxwriter/theme.h
|
|
84
|
+
- libxlsxwriter/include/xlsxwriter/third_party/ioapi.h
|
|
85
|
+
- libxlsxwriter/include/xlsxwriter/third_party/queue.h
|
|
86
|
+
- libxlsxwriter/include/xlsxwriter/third_party/tmpfileplus.h
|
|
87
|
+
- libxlsxwriter/include/xlsxwriter/third_party/tree.h
|
|
88
|
+
- libxlsxwriter/include/xlsxwriter/third_party/zip.h
|
|
89
|
+
- libxlsxwriter/include/xlsxwriter/utility.h
|
|
90
|
+
- libxlsxwriter/include/xlsxwriter/workbook.h
|
|
91
|
+
- libxlsxwriter/include/xlsxwriter/worksheet.h
|
|
92
|
+
- libxlsxwriter/include/xlsxwriter/xmlwriter.h
|
|
93
|
+
- libxlsxwriter/lib/.gitignore
|
|
94
|
+
- libxlsxwriter/libxlsxwriter.podspec
|
|
95
|
+
- libxlsxwriter/src/Makefile
|
|
96
|
+
- libxlsxwriter/src/app.c
|
|
97
|
+
- libxlsxwriter/src/chart.c
|
|
98
|
+
- libxlsxwriter/src/content_types.c
|
|
99
|
+
- libxlsxwriter/src/core.c
|
|
100
|
+
- libxlsxwriter/src/custom.c
|
|
101
|
+
- libxlsxwriter/src/drawing.c
|
|
102
|
+
- libxlsxwriter/src/format.c
|
|
103
|
+
- libxlsxwriter/src/hash_table.c
|
|
104
|
+
- libxlsxwriter/src/packager.c
|
|
105
|
+
- libxlsxwriter/src/relationships.c
|
|
106
|
+
- libxlsxwriter/src/shared_strings.c
|
|
107
|
+
- libxlsxwriter/src/styles.c
|
|
108
|
+
- libxlsxwriter/src/theme.c
|
|
109
|
+
- libxlsxwriter/src/utility.c
|
|
110
|
+
- libxlsxwriter/src/workbook.c
|
|
111
|
+
- libxlsxwriter/src/worksheet.c
|
|
112
|
+
- libxlsxwriter/src/xmlwriter.c
|
|
113
|
+
- libxlsxwriter/third_party/minizip/Makefile
|
|
114
|
+
- libxlsxwriter/third_party/minizip/Makefile.am
|
|
115
|
+
- libxlsxwriter/third_party/minizip/Makefile.orig
|
|
116
|
+
- libxlsxwriter/third_party/minizip/MiniZip64_Changes.txt
|
|
117
|
+
- libxlsxwriter/third_party/minizip/MiniZip64_info.txt
|
|
118
|
+
- libxlsxwriter/third_party/minizip/README.txt
|
|
119
|
+
- libxlsxwriter/third_party/minizip/configure.ac
|
|
120
|
+
- libxlsxwriter/third_party/minizip/crypt.h
|
|
121
|
+
- libxlsxwriter/third_party/minizip/ioapi.c
|
|
122
|
+
- libxlsxwriter/third_party/minizip/ioapi.h
|
|
123
|
+
- libxlsxwriter/third_party/minizip/iowin32.c
|
|
124
|
+
- libxlsxwriter/third_party/minizip/iowin32.h
|
|
125
|
+
- libxlsxwriter/third_party/minizip/make_vms.com
|
|
126
|
+
- libxlsxwriter/third_party/minizip/miniunz.c
|
|
127
|
+
- libxlsxwriter/third_party/minizip/miniunzip.1
|
|
128
|
+
- libxlsxwriter/third_party/minizip/minizip.1
|
|
129
|
+
- libxlsxwriter/third_party/minizip/minizip.c
|
|
130
|
+
- libxlsxwriter/third_party/minizip/minizip.pc.in
|
|
131
|
+
- libxlsxwriter/third_party/minizip/mztools.c
|
|
132
|
+
- libxlsxwriter/third_party/minizip/mztools.h
|
|
133
|
+
- libxlsxwriter/third_party/minizip/unzip.c
|
|
134
|
+
- libxlsxwriter/third_party/minizip/unzip.h
|
|
135
|
+
- libxlsxwriter/third_party/minizip/zip.c
|
|
136
|
+
- libxlsxwriter/third_party/minizip/zip.h
|
|
137
|
+
- libxlsxwriter/third_party/tmpfileplus/Makefile
|
|
138
|
+
- libxlsxwriter/third_party/tmpfileplus/tmpfileplus.c
|
|
139
|
+
- libxlsxwriter/third_party/tmpfileplus/tmpfileplus.h
|
|
140
|
+
- libxlsxwriter/version.txt
|
|
58
141
|
homepage: https://github.com/paxa/fast_excel
|
|
59
142
|
licenses:
|
|
60
143
|
- MIT
|
|
Binary file
|
|
Binary file
|
|
Binary file
|