xlsxwriter 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (31) hide show
  1. checksums.yaml +4 -4
  2. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter.h +1 -1
  3. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/chart.h +55 -5
  4. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/chartsheet.h +544 -0
  5. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/common.h +6 -0
  6. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/content_types.h +2 -0
  7. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/drawing.h +1 -0
  8. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/format.h +1 -1
  9. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/shared_strings.h +3 -1
  10. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/styles.h +7 -2
  11. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/utility.h +16 -0
  12. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/workbook.h +122 -24
  13. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/worksheet.h +236 -48
  14. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/xmlwriter.h +2 -0
  15. data/ext/xlsxwriter/libxlsxwriter/src/chart.c +40 -4
  16. data/ext/xlsxwriter/libxlsxwriter/src/chartsheet.c +508 -0
  17. data/ext/xlsxwriter/libxlsxwriter/src/content_types.c +10 -0
  18. data/ext/xlsxwriter/libxlsxwriter/src/drawing.c +100 -3
  19. data/ext/xlsxwriter/libxlsxwriter/src/packager.c +252 -30
  20. data/ext/xlsxwriter/libxlsxwriter/src/shared_strings.c +16 -2
  21. data/ext/xlsxwriter/libxlsxwriter/src/styles.c +54 -7
  22. data/ext/xlsxwriter/libxlsxwriter/src/utility.c +43 -1
  23. data/ext/xlsxwriter/libxlsxwriter/src/workbook.c +254 -41
  24. data/ext/xlsxwriter/libxlsxwriter/src/worksheet.c +381 -65
  25. data/ext/xlsxwriter/libxlsxwriter/src/xmlwriter.c +16 -7
  26. data/ext/xlsxwriter/libxlsxwriter/third_party/minizip/ioapi.c +10 -0
  27. data/ext/xlsxwriter/libxlsxwriter/third_party/minizip/zip.c +2 -0
  28. data/ext/xlsxwriter/libxlsxwriter/third_party/tmpfileplus/tmpfileplus.c +2 -2
  29. data/ext/xlsxwriter/workbook.c +9 -6
  30. data/lib/xlsxwriter/version.rb +1 -1
  31. metadata +5 -4
@@ -140,6 +140,15 @@ lxw_xml_data_element(FILE * xmlfile,
140
140
  fprintf(xmlfile, "</%s>", tag);
141
141
  }
142
142
 
143
+ /*
144
+ * Write an XML <si> element for rich strings, without encoding.
145
+ */
146
+ void
147
+ lxw_xml_rich_si_element(FILE * xmlfile, const char *string)
148
+ {
149
+ fprintf(xmlfile, "<si>%s</si>", string);
150
+ }
151
+
143
152
  /*
144
153
  * Escape XML characters in attributes.
145
154
  */
@@ -153,19 +162,19 @@ _escape_attributes(struct xml_attribute *attribute)
153
162
  while (*p_attr) {
154
163
  switch (*p_attr) {
155
164
  case '&':
156
- strncat(p_encoded, LXW_AMP, sizeof(LXW_AMP) - 1);
165
+ memcpy(p_encoded, LXW_AMP, sizeof(LXW_AMP) - 1);
157
166
  p_encoded += sizeof(LXW_AMP) - 1;
158
167
  break;
159
168
  case '<':
160
- strncat(p_encoded, LXW_LT, sizeof(LXW_LT) - 1);
169
+ memcpy(p_encoded, LXW_LT, sizeof(LXW_LT) - 1);
161
170
  p_encoded += sizeof(LXW_LT) - 1;
162
171
  break;
163
172
  case '>':
164
- strncat(p_encoded, LXW_GT, sizeof(LXW_GT) - 1);
173
+ memcpy(p_encoded, LXW_GT, sizeof(LXW_GT) - 1);
165
174
  p_encoded += sizeof(LXW_GT) - 1;
166
175
  break;
167
176
  case '"':
168
- strncat(p_encoded, LXW_QUOT, sizeof(LXW_QUOT) - 1);
177
+ memcpy(p_encoded, LXW_QUOT, sizeof(LXW_QUOT) - 1);
169
178
  p_encoded += sizeof(LXW_QUOT) - 1;
170
179
  break;
171
180
  default:
@@ -195,15 +204,15 @@ lxw_escape_data(const char *data)
195
204
  while (*data) {
196
205
  switch (*data) {
197
206
  case '&':
198
- strncat(p_encoded, LXW_AMP, sizeof(LXW_AMP) - 1);
207
+ memcpy(p_encoded, LXW_AMP, sizeof(LXW_AMP) - 1);
199
208
  p_encoded += sizeof(LXW_AMP) - 1;
200
209
  break;
201
210
  case '<':
202
- strncat(p_encoded, LXW_LT, sizeof(LXW_LT) - 1);
211
+ memcpy(p_encoded, LXW_LT, sizeof(LXW_LT) - 1);
203
212
  p_encoded += sizeof(LXW_LT) - 1;
204
213
  break;
205
214
  case '>':
206
- strncat(p_encoded, LXW_GT, sizeof(LXW_GT) - 1);
215
+ memcpy(p_encoded, LXW_GT, sizeof(LXW_GT) - 1);
207
216
  p_encoded += sizeof(LXW_GT) - 1;
208
217
  break;
209
218
  default:
@@ -96,6 +96,7 @@ static voidpf ZCALLBACK fopen_file_func (voidpf opaque, const char* filename, in
96
96
  {
97
97
  FILE* file = NULL;
98
98
  const char* mode_fopen = NULL;
99
+ (void) opaque;
99
100
  if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ)
100
101
  mode_fopen = "rb";
101
102
  else
@@ -114,6 +115,7 @@ static voidpf ZCALLBACK fopen64_file_func (voidpf opaque, const void* filename,
114
115
  {
115
116
  FILE* file = NULL;
116
117
  const char* mode_fopen = NULL;
118
+ (void) opaque;
117
119
  if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ)
118
120
  mode_fopen = "rb";
119
121
  else
@@ -132,6 +134,7 @@ static voidpf ZCALLBACK fopen64_file_func (voidpf opaque, const void* filename,
132
134
  static uLong ZCALLBACK fread_file_func (voidpf opaque, voidpf stream, void* buf, uLong size)
133
135
  {
134
136
  uLong ret;
137
+ (void) opaque;
135
138
  ret = (uLong)fread(buf, 1, (size_t)size, (FILE *)stream);
136
139
  return ret;
137
140
  }
@@ -139,6 +142,7 @@ static uLong ZCALLBACK fread_file_func (voidpf opaque, voidpf stream, void* buf,
139
142
  static uLong ZCALLBACK fwrite_file_func (voidpf opaque, voidpf stream, const void* buf, uLong size)
140
143
  {
141
144
  uLong ret;
145
+ (void) opaque;
142
146
  ret = (uLong)fwrite(buf, 1, (size_t)size, (FILE *)stream);
143
147
  return ret;
144
148
  }
@@ -146,6 +150,7 @@ static uLong ZCALLBACK fwrite_file_func (voidpf opaque, voidpf stream, const voi
146
150
  static long ZCALLBACK ftell_file_func (voidpf opaque, voidpf stream)
147
151
  {
148
152
  long ret;
153
+ (void) opaque;
149
154
  ret = ftell((FILE *)stream);
150
155
  return ret;
151
156
  }
@@ -154,6 +159,7 @@ static long ZCALLBACK ftell_file_func (voidpf opaque, voidpf stream)
154
159
  static ZPOS64_T ZCALLBACK ftell64_file_func (voidpf opaque, voidpf stream)
155
160
  {
156
161
  ZPOS64_T ret;
162
+ (void) opaque;
157
163
  ret = FTELLO_FUNC((FILE *)stream);
158
164
  return ret;
159
165
  }
@@ -162,6 +168,7 @@ static long ZCALLBACK fseek_file_func (voidpf opaque, voidpf stream, uLong offs
162
168
  {
163
169
  int fseek_origin=0;
164
170
  long ret;
171
+ (void) opaque;
165
172
  switch (origin)
166
173
  {
167
174
  case ZLIB_FILEFUNC_SEEK_CUR :
@@ -185,6 +192,7 @@ static long ZCALLBACK fseek64_file_func (voidpf opaque, voidpf stream, ZPOS64_T
185
192
  {
186
193
  int fseek_origin=0;
187
194
  long ret;
195
+ (void) opaque;
188
196
  switch (origin)
189
197
  {
190
198
  case ZLIB_FILEFUNC_SEEK_CUR :
@@ -210,6 +218,7 @@ static long ZCALLBACK fseek64_file_func (voidpf opaque, voidpf stream, ZPOS64_T
210
218
  static int ZCALLBACK fclose_file_func (voidpf opaque, voidpf stream)
211
219
  {
212
220
  int ret;
221
+ (void) opaque;
213
222
  ret = fclose((FILE *)stream);
214
223
  return ret;
215
224
  }
@@ -217,6 +226,7 @@ static int ZCALLBACK fclose_file_func (voidpf opaque, voidpf stream)
217
226
  static int ZCALLBACK ferror_file_func (voidpf opaque, voidpf stream)
218
227
  {
219
228
  int ret;
229
+ (void) opaque;
220
230
  ret = ferror((FILE *)stream);
221
231
  return ret;
222
232
  }
@@ -519,12 +519,14 @@ local ZPOS64_T zip64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_f
519
519
  break;
520
520
 
521
521
  for (i=(int)uReadSize-3; (i--)>0;)
522
+ {
522
523
  if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) &&
523
524
  ((*(buf+i+2))==0x05) && ((*(buf+i+3))==0x06))
524
525
  {
525
526
  uPosFound = uReadPos+i;
526
527
  break;
527
528
  }
529
+ }
528
530
 
529
531
  if (uPosFound!=0)
530
532
  break;
@@ -169,7 +169,7 @@ static char *getenv_save(const char *varname, char *buf, size_t bufsize)
169
169
  buf[0] = '\0';
170
170
  if (ptr)
171
171
  {
172
- strncpy(buf, ptr, bufsize);
172
+ strncpy(buf, ptr, bufsize-1);
173
173
  buf[bufsize-1] = '\0';
174
174
  return buf;
175
175
  }
@@ -189,7 +189,7 @@ static FILE *mktempfile_internal(const char *tmpdir, const char *pfx, char **tmp
189
189
  */
190
190
  {
191
191
  FILE *fp;
192
- int fd;
192
+ int fd = 0;
193
193
  char randpart[] = "1234567890";
194
194
  size_t lentempname;
195
195
  int i;
@@ -13,8 +13,7 @@ VALUE workbook_release(VALUE self);
13
13
 
14
14
 
15
15
  VALUE
16
- workbook_alloc(VALUE klass)
17
- {
16
+ workbook_alloc(VALUE klass) {
18
17
  VALUE obj;
19
18
  struct workbook *ptr;
20
19
 
@@ -308,17 +307,20 @@ workbook_define_name_(VALUE self, VALUE name, VALUE formula) {
308
307
  return self;
309
308
  }
310
309
 
311
- /* call-seq: wb.validate_worksheet_name(name) -> true
310
+ /* call-seq:
311
+ * wb.validate_sheet_name(name) -> true
312
+ * wb.validate_worksheet_name(name) -> true
312
313
  *
313
314
  * Validates a worksheet +name+. Returns +true+ or raises an exception (not
314
315
  * implemented yet).
316
+ *
315
317
  */
316
318
  VALUE
317
- workbook_validate_worksheet_name_(VALUE self, VALUE name) {
319
+ workbook_validate_sheet_name_(VALUE self, VALUE name) {
318
320
  struct workbook *ptr;
319
321
  lxw_error err;
320
322
  Data_Get_Struct(self, struct workbook, ptr);
321
- err = workbook_validate_worksheet_name(ptr->workbook, StringValueCStr(name));
323
+ err = workbook_validate_sheet_name(ptr->workbook, StringValueCStr(name));
322
324
  handle_lxw_error(err);
323
325
  return Qtrue;
324
326
  }
@@ -386,7 +388,8 @@ init_xlsxwriter_workbook() {
386
388
  rb_define_method(cWorkbook, "set_default_xf_indices", workbook_set_default_xf_indices_, 0);
387
389
  rb_define_method(cWorkbook, "properties", workbook_properties_, 0);
388
390
  rb_define_method(cWorkbook, "define_name", workbook_define_name_, 2);
389
- rb_define_method(cWorkbook, "validate_worksheet_name", workbook_validate_worksheet_name_, 1);
391
+ rb_define_method(cWorkbook, "validate_sheet_name", workbook_validate_sheet_name_, 1);
392
+ rb_define_method(cWorkbook, "validate_worksheet_name", workbook_validate_sheet_name_, 1);
390
393
 
391
394
  /*
392
395
  * This attribute contains effective font widths used for automatic column
@@ -1,4 +1,4 @@
1
1
  module XlsxWriter
2
2
  # :nodoc:
3
- VERSION='0.0.5'.freeze
3
+ VERSION='0.0.6'.freeze
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xlsxwriter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick H
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-02 00:00:00.000000000 Z
11
+ date: 2019-01-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake-compiler
@@ -70,6 +70,7 @@ files:
70
70
  - ext/xlsxwriter/libxlsxwriter/include/xlsxwriter.h
71
71
  - ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/app.h
72
72
  - ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/chart.h
73
+ - ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/chartsheet.h
73
74
  - ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/common.h
74
75
  - ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/content_types.h
75
76
  - ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/core.h
@@ -95,6 +96,7 @@ files:
95
96
  - ext/xlsxwriter/libxlsxwriter/src/Makefile
96
97
  - ext/xlsxwriter/libxlsxwriter/src/app.c
97
98
  - ext/xlsxwriter/libxlsxwriter/src/chart.c
99
+ - ext/xlsxwriter/libxlsxwriter/src/chartsheet.c
98
100
  - ext/xlsxwriter/libxlsxwriter/src/content_types.c
99
101
  - ext/xlsxwriter/libxlsxwriter/src/core.c
100
102
  - ext/xlsxwriter/libxlsxwriter/src/custom.c
@@ -197,8 +199,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
197
199
  - !ruby/object:Gem::Version
198
200
  version: '0'
199
201
  requirements: []
200
- rubyforge_project:
201
- rubygems_version: 2.7.7
202
+ rubygems_version: 3.0.1
202
203
  signing_key:
203
204
  specification_version: 4
204
205
  summary: Ruby interface to libxlsxwriter