Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
brechtsanders committed Jul 10, 2020
1 parent 7522f8f commit cfd9ed5
Show file tree
Hide file tree
Showing 13 changed files with 237 additions and 12 deletions.
7 changes: 7 additions & 0 deletions Changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
0.2.29

2020-07-10 Brecht Sanders https://github.com/brechtsanders/

* only treat sheet as a table (with header rows) when XLSXIOREAD_SKIP_EXTRA_CELLS flag is used (issue #75)
* added xlsxioread_free() to fix crashes when calling library build with different compiler (issue #73)

0.2.28

2020-07-06 Brecht Sanders https://github.com/brechtsanders/
Expand Down
4 changes: 2 additions & 2 deletions build/example_xlsxio_read_wchar.depend
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# depslib dependency file v1.0
1521232544 source:z:\xlsxio\examples\example_xlsxio_read.c
1521236144 source:z:\xlsxio\examples\example_xlsxio_read.c
<stdlib.h>
<stdio.h>
<string.h>
Expand All @@ -12,7 +12,7 @@
<fcntl.h>
"xlsxio_read.h"

1521131524 z:\xlsxio\include\xlsxio_read.h
1594390761 z:\xlsxio\include\xlsxio_read.h
<stdlib.h>
<stdint.h>
<time.h>
Expand Down
36 changes: 36 additions & 0 deletions build/libxlsxio_read_minizip_shared.depend
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,39 @@
<stdlib.h>
<string.h>

1594390670 source:z:\xlsxio\lib\xlsxio_read.c
"xlsxio_private.h"
"xlsxio_read_sharedstrings.h"
"xlsxio_read.h"
"xlsxio_version.h"
<stdlib.h>
<stdio.h>
<inttypes.h>
<string.h>
<expat.h>
<minizip/unzip.h>
<io.h>
<unistd.h>
<zip.h>

1521234538 z:\xlsxio\lib\xlsxio_private.h
<wchar.h>

1522321419 z:\xlsxio\lib\xlsxio_read_sharedstrings.h
<stdint.h>
<expat.h>

1594390761 z:\xlsxio\include\xlsxio_read.h
<stdlib.h>
<stdint.h>
<time.h>
<wchar.h>

1594390364 z:\xlsxio\include\xlsxio_version.h

1522321402 source:z:\xlsxio\lib\xlsxio_read_sharedstrings.c
"xlsxio_private.h"
"xlsxio_read_sharedstrings.h"
<stdlib.h>
<string.h>

6 changes: 3 additions & 3 deletions build/libxlsxio_read_shared.depend
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
<stdint.h>
<expat.h>

1585050777 source:z:\xlsxio\lib\xlsxio_read.c
1594390670 source:z:\xlsxio\lib\xlsxio_read.c
"xlsxio_private.h"
"xlsxio_read_sharedstrings.h"
"xlsxio_read.h"
Expand All @@ -63,11 +63,11 @@
<unistd.h>
<zip.h>

1585050781 z:\xlsxio\include\xlsxio_read.h
1594390761 z:\xlsxio\include\xlsxio_read.h
<stdlib.h>
<stdint.h>
<time.h>
<wchar.h>

1585051485 z:\xlsxio\include\xlsxio_version.h
1594390364 z:\xlsxio\include\xlsxio_version.h

36 changes: 36 additions & 0 deletions build/libxlsxio_read_wchar.depend
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,39 @@
<stdlib.h>
<string.h>

1594390670 source:z:\xlsxio\lib\xlsxio_read.c
"xlsxio_private.h"
"xlsxio_read_sharedstrings.h"
"xlsxio_read.h"
"xlsxio_version.h"
<stdlib.h>
<stdio.h>
<inttypes.h>
<string.h>
<expat.h>
<minizip/unzip.h>
<io.h>
<unistd.h>
<zip.h>

1521234538 z:\xlsxio\lib\xlsxio_private.h
<wchar.h>

1522321419 z:\xlsxio\lib\xlsxio_read_sharedstrings.h
<stdint.h>
<expat.h>

1594390761 z:\xlsxio\include\xlsxio_read.h
<stdlib.h>
<stdint.h>
<time.h>
<wchar.h>

1594390364 z:\xlsxio\include\xlsxio_version.h

1522321402 source:z:\xlsxio\lib\xlsxio_read_sharedstrings.c
"xlsxio_private.h"
"xlsxio_read_sharedstrings.h"
<stdlib.h>
<string.h>

36 changes: 36 additions & 0 deletions build/libxlsxio_read_wchar_shared.depend
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,39 @@
<stdlib.h>
<string.h>

1594390670 source:z:\xlsxio\lib\xlsxio_read.c
"xlsxio_private.h"
"xlsxio_read_sharedstrings.h"
"xlsxio_read.h"
"xlsxio_version.h"
<stdlib.h>
<stdio.h>
<inttypes.h>
<string.h>
<expat.h>
<minizip/unzip.h>
<io.h>
<unistd.h>
<zip.h>

1521234538 z:\xlsxio\lib\xlsxio_private.h
<wchar.h>

1522321419 z:\xlsxio\lib\xlsxio_read_sharedstrings.h
<stdint.h>
<expat.h>

1594390761 z:\xlsxio\include\xlsxio_read.h
<stdlib.h>
<stdint.h>
<time.h>
<wchar.h>

1594390364 z:\xlsxio\include\xlsxio_version.h

1522321402 source:z:\xlsxio\lib\xlsxio_read_sharedstrings.c
"xlsxio_private.h"
"xlsxio_read_sharedstrings.h"
<stdlib.h>
<string.h>

23 changes: 23 additions & 0 deletions build/libxlsxio_write_minizip_shared.depend
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,26 @@

1585051485 \\server\users\brecht\sources\cpp\xlsxio\include\xlsxio_version.h

1584727926 source:z:\xlsxio\lib\xlsxio_write.c
"xlsxio_write.h"
"xlsxio_version.h"
<stdlib.h>
<stdio.h>
<string.h>
<time.h>
<inttypes.h>
<unistd.h>
<fcntl.h>
<stdarg.h>
<minizip/zip.h>
<zip.h>
<windows.h>
<pthread.h>

1583785145 z:\xlsxio\include\xlsxio_write.h
<stdlib.h>
<stdint.h>
<time.h>

1594390364 z:\xlsxio\include\xlsxio_version.h

23 changes: 23 additions & 0 deletions build/libxlsxio_write_shared.depend
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,26 @@

1585051485 \\server\users\brecht\sources\cpp\xlsxio\include\xlsxio_version.h

1584727926 source:z:\xlsxio\lib\xlsxio_write.c
"xlsxio_write.h"
"xlsxio_version.h"
<stdlib.h>
<stdio.h>
<string.h>
<time.h>
<inttypes.h>
<unistd.h>
<fcntl.h>
<stdarg.h>
<minizip/zip.h>
<zip.h>
<windows.h>
<pthread.h>

1583785145 z:\xlsxio\include\xlsxio_write.h
<stdlib.h>
<stdint.h>
<time.h>

1594390364 z:\xlsxio\include\xlsxio_version.h

23 changes: 23 additions & 0 deletions build/libxlsxio_write_wchar.depend
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,26 @@

1585051485 \\server\users\brecht\sources\cpp\xlsxio\include\xlsxio_version.h

1584727926 source:z:\xlsxio\lib\xlsxio_write.c
"xlsxio_write.h"
"xlsxio_version.h"
<stdlib.h>
<stdio.h>
<string.h>
<time.h>
<inttypes.h>
<unistd.h>
<fcntl.h>
<stdarg.h>
<minizip/zip.h>
<zip.h>
<windows.h>
<pthread.h>

1583785145 z:\xlsxio\include\xlsxio_write.h
<stdlib.h>
<stdint.h>
<time.h>

1594390364 z:\xlsxio\include\xlsxio_version.h

23 changes: 23 additions & 0 deletions build/libxlsxio_write_wchar_shared.depend
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,26 @@

1585051485 \\server\users\brecht\sources\cpp\xlsxio\include\xlsxio_version.h

1584727926 source:z:\xlsxio\lib\xlsxio_write.c
"xlsxio_write.h"
"xlsxio_version.h"
<stdlib.h>
<stdio.h>
<string.h>
<time.h>
<inttypes.h>
<unistd.h>
<fcntl.h>
<stdarg.h>
<minizip/zip.h>
<zip.h>
<windows.h>
<pthread.h>

1583785145 z:\xlsxio\include\xlsxio_write.h
<stdlib.h>
<stdint.h>
<time.h>

1594390364 z:\xlsxio\include\xlsxio_version.h

15 changes: 13 additions & 2 deletions include/xlsxio_read.h
Original file line number Diff line number Diff line change
Expand Up @@ -267,17 +267,19 @@ DLL_EXPORT_XLSXIO int xlsxioread_sheet_next_row (xlsxioreadersheet sheethandle);

/*! \brief get next cell from worksheet
* \param sheethandle read handle for worksheet object
* \return value (caller must free the result) or NULL if no more cells are available in the current row
* \return value (caller must free the result using xlsxioread_free()) or NULL if no more cells are available in the current row
* \sa xlsxioread_sheet_open()
* \sa xlsxioread_free()
*/
DLL_EXPORT_XLSXIO XLSXIOCHAR* xlsxioread_sheet_next_cell (xlsxioreadersheet sheethandle);

/*! \brief get next cell from worksheet as a string
* \param sheethandle read handle for worksheet object
* \param pvalue pointer where string will be stored if data is available (caller must free the result)
* \param pvalue pointer where string will be stored if data is available (caller must free the result using xlsxioread_free())
* \return non-zero if a new cell was available in the current row
* \sa xlsxioread_sheet_open()
* \sa xlsxioread_sheet_next_cell()
* \sa xlsxioread_free()
*/
DLL_EXPORT_XLSXIO int xlsxioread_sheet_next_cell_string (xlsxioreadersheet sheethandle, XLSXIOCHAR** pvalue);

Expand Down Expand Up @@ -308,6 +310,15 @@ DLL_EXPORT_XLSXIO int xlsxioread_sheet_next_cell_float (xlsxioreadersheet sheeth
*/
DLL_EXPORT_XLSXIO int xlsxioread_sheet_next_cell_datetime (xlsxioreadersheet sheethandle, time_t* pvalue);



/*! \brief free memory allocated by the library
* \param data memory to be freed
* \sa xlsxioread_sheet_next_cell()
* \sa xlsxioread_sheet_next_cell_string()
*/
DLL_EXPORT_XLSXIO void xlsxioread_free (XLSXIOCHAR* data);

#ifdef __cplusplus
}
#endif
Expand Down
2 changes: 1 addition & 1 deletion include/xlsxio_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ THE SOFTWARE.
/*! \brief minor version number */
#define XLSXIO_VERSION_MINOR 2
/*! \brief micro version number */
#define XLSXIO_VERSION_MICRO 28
#define XLSXIO_VERSION_MICRO 29
/*! @} */

/*! \cond PRIVATE */
Expand Down
15 changes: 11 additions & 4 deletions lib/xlsxio_read.c
Original file line number Diff line number Diff line change
Expand Up @@ -1049,7 +1049,7 @@ void data_sheet_expat_callback_find_row_end (void* callbackdata, const XML_Char*
struct data_sheet_callback_data* data = (struct data_sheet_callback_data*)callbackdata;
if (XML_Char_icmp_ins(name, X("row")) == 0) {
//determine number of columns based on first row
if ((data->flags && XLSXIOREAD_SKIP_EXTRA_CELLS) && data->rownr == 1 && data->cols == 0)
if ((data->flags & XLSXIOREAD_SKIP_EXTRA_CELLS) && data->rownr == 1 && data->cols == 0)
data->cols = data->colnr;
//add empty columns if needed
if (!(data->flags & XLSXIOREAD_NO_CALLBACK) && data->sheet_cell_callback && !(data->flags & XLSXIOREAD_SKIP_EMPTY_CELLS)) {
Expand Down Expand Up @@ -1500,10 +1500,9 @@ DLL_EXPORT_XLSXIO XLSXIOCHAR* xlsxioread_sheet_next_cell (xlsxioreadersheet shee
XML_Char* result;
if (!sheethandle)
return NULL;
//append empty column if needed
//if (!(sheethandle->processcallbackdata.flags & XLSXIOREAD_SKIP_EMPTY_CELLS) && sheethandle->paddingcol) {
if ((!(sheethandle->processcallbackdata.flags & XLSXIOREAD_SKIP_EMPTY_CELLS) && sheethandle->paddingcol) || (!(sheethandle->processcallbackdata.flags & XLSXIOREAD_SKIP_EMPTY_ROWS) && sheethandle->paddingrow)) {
if (sheethandle->paddingcol > sheethandle->processcallbackdata.cols || (sheethandle->processcallbackdata.flags & XLSXIOREAD_SKIP_EMPTY_CELLS)) {
if ((/*sheethandle->processcallbackdata.cols > 0 &&*/ sheethandle->paddingcol > sheethandle->processcallbackdata.cols) || (sheethandle->processcallbackdata.flags & XLSXIOREAD_SKIP_EMPTY_CELLS)) {
//last empty column added, finish row
sheethandle->paddingcol = 0;
//when padding rows prepare for the next one
Expand All @@ -1524,6 +1523,9 @@ DLL_EXPORT_XLSXIO XLSXIOCHAR* xlsxioread_sheet_next_cell (xlsxioreadersheet shee
sheethandle->lastcolnr++;
return XML_Char_dup(X(""));
}
} else if ((sheethandle->processcallbackdata.flags & XLSXIOREAD_SKIP_EXTRA_CELLS) && sheethandle->processcallbackdata.cols > 0 && sheethandle->lastcolnr >= sheethandle->processcallbackdata.cols) {
//end of line when out of bounds
return NULL;
}
//get value
if (!sheethandle->processcallbackdata.celldata)
Expand All @@ -1538,7 +1540,8 @@ DLL_EXPORT_XLSXIO XLSXIOCHAR* xlsxioread_sheet_next_cell (xlsxioreadersheet shee
//insert empty column before if needed
if (!(sheethandle->processcallbackdata.flags & XLSXIOREAD_SKIP_EMPTY_CELLS)) {
if (sheethandle->lastcolnr + 1 < sheethandle->processcallbackdata.colnr) {
if (0) {//if ((sheethandle->processcallbackdata.flags & XLSXIOREAD_SKIP_EXTRA_CELLS) && sheethandle->processcallbackdata.cols > 0 && sheethandle->lastcolnr >= sheethandle->processcallbackdata.cols) {
if (0) {
//if ((sheethandle->processcallbackdata.flags & XLSXIOREAD_SKIP_EXTRA_CELLS) && sheethandle->processcallbackdata.cols > 0 && sheethandle->lastcolnr >= sheethandle->processcallbackdata.cols) {
//end of line when out of bounds
return NULL;
} else {
Expand Down Expand Up @@ -1617,3 +1620,7 @@ DLL_EXPORT_XLSXIO int xlsxioread_sheet_next_cell_datetime (xlsxioreadersheet she
return 1;
}

DLL_EXPORT_XLSXIO void xlsxioread_free (XLSXIOCHAR* data)
{
free(data);
}

0 comments on commit cfd9ed5

Please sign in to comment.