[Git][debian-gis-team/freexl][upstream] New upstream version 2.0.0~rc1

Bas Couwenberg (@sebastic) gitlab at salsa.debian.org
Mon Jul 5 21:00:19 BST 2021



Bas Couwenberg pushed to branch upstream at Debian GIS Project / freexl


Commits:
ba31ae7a by Bas Couwenberg at 2021-07-05T21:52:51+02:00
New upstream version 2.0.0~rc1
- - - - -


8 changed files:

- configure
- configure.ac
- headers/freexl_internals.h
- src/Makefile.am
- src/Makefile.in
- src/freexl.c
- src/freexl_ods.c
- src/freexl_xlsx.c


Changes:

=====================================
configure
=====================================
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for FreeXL 2.0.0-RC0.
+# Generated by GNU Autoconf 2.69 for FreeXL 2.0.0-RC1.
 #
 # Report bugs to <a.furieri at lqt.it>.
 #
@@ -590,8 +590,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='FreeXL'
 PACKAGE_TARNAME='freexl'
-PACKAGE_VERSION='2.0.0-RC0'
-PACKAGE_STRING='FreeXL 2.0.0-RC0'
+PACKAGE_VERSION='2.0.0-RC1'
+PACKAGE_STRING='FreeXL 2.0.0-RC1'
 PACKAGE_BUGREPORT='a.furieri at lqt.it'
 PACKAGE_URL=''
 
@@ -1327,7 +1327,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures FreeXL 2.0.0-RC0 to adapt to many kinds of systems.
+\`configure' configures FreeXL 2.0.0-RC1 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1397,7 +1397,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of FreeXL 2.0.0-RC0:";;
+     short | recursive ) echo "Configuration of FreeXL 2.0.0-RC1:";;
    esac
   cat <<\_ACEOF
 
@@ -1510,7 +1510,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-FreeXL configure 2.0.0-RC0
+FreeXL configure 2.0.0-RC1
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2054,7 +2054,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by FreeXL $as_me 2.0.0-RC0, which was
+It was created by FreeXL $as_me 2.0.0-RC1, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -2925,7 +2925,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='freexl'
- VERSION='2.0.0-RC0'
+ VERSION='2.0.0-RC1'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -17969,7 +17969,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by FreeXL $as_me 2.0.0-RC0, which was
+This file was extended by FreeXL $as_me 2.0.0-RC1, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -18035,7 +18035,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-FreeXL config.status 2.0.0-RC0
+FreeXL config.status 2.0.0-RC1
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 


=====================================
configure.ac
=====================================
@@ -2,7 +2,7 @@
 # Process this file with autoconf to produce a configure script.
 
 AC_PREREQ(2.61)
-AC_INIT(FreeXL, 2.0.0-RC0, a.furieri at lqt.it)
+AC_INIT(FreeXL, 2.0.0-RC1, a.furieri at lqt.it)
 AC_LANG(C)
 AC_CONFIG_AUX_DIR([.])
 AC_CONFIG_MACRO_DIR([m4])


=====================================
headers/freexl_internals.h
=====================================
@@ -346,6 +346,7 @@ typedef struct xlsx_worksheet_struct
     xlsx_row *last;
     int max_row;
     int max_cell;
+    xlsx_row **rows;
     int error;
     char *CharData;
     int CharDataLen;
@@ -447,6 +448,7 @@ typedef struct ods_worksheet_struct
     ods_row *last;
     int max_row;
     int max_cell;
+    ods_row **rows;
     int RowOk;
     int ColOk;
     int CellValueOk;


=====================================
src/Makefile.am
=====================================
@@ -6,7 +6,7 @@ lib_LTLIBRARIES = libfreexl.la
 
 libfreexl_la_SOURCES = freexl.c freexl_xlsx.c freexl_ods.c
 
-libfreexl_la_LDFLAGS = -version-info 3:0:0 -no-undefined
+libfreexl_la_LDFLAGS = -version-info 3:0:2 -no-undefined
 
 libfreexl_la_LIBADD = -lm
 


=====================================
src/Makefile.in
=====================================
@@ -328,7 +328,7 @@ top_srcdir = @top_srcdir@
 AM_CPPFLAGS = -I$(top_srcdir)/headers -I$(top_srcdir)
 lib_LTLIBRARIES = libfreexl.la 
 libfreexl_la_SOURCES = freexl.c freexl_xlsx.c freexl_ods.c
-libfreexl_la_LDFLAGS = -version-info 3:0:0 -no-undefined
+libfreexl_la_LDFLAGS = -version-info 3:0:2 -no-undefined
 libfreexl_la_LIBADD = -lm
 MOSTLYCLEANFILES = *.gcna *.gcno *.gcda
 all: all-am


=====================================
src/freexl.c
=====================================
@@ -2795,8 +2795,7 @@ read_legacy_biff (biff_workbook * workbook, int swap)
 		      else if (is_datetime)
 			  ret =
 			      set_datetime_double_value (workbook, row, col,
-							 workbook->
-							 biff_date_mode,
+							 workbook->biff_date_mode,
 							 dbl_value);
 		      else if (is_time)
 			  ret =
@@ -3571,8 +3570,7 @@ parse_biff_record (biff_workbook * workbook, int swap)
 		      else if (is_datetime)
 			  ret =
 			      set_datetime_double_value (workbook, row, col,
-							 workbook->
-							 biff_date_mode,
+							 workbook->biff_date_mode,
 							 dbl_value);
 		      else if (is_time)
 			  ret =
@@ -5198,127 +5196,101 @@ get_cell_value_xlsx (xlsx_workbook * workbook, unsigned int row,
 	|| (int) column > workbook->active_sheet->max_cell)
 	return FREEXL_ILLEGAL_CELL_ROW_COL;
 
-    p_row = workbook->active_sheet->first;
-    while (p_row != NULL)
-      {
-	  /* looping on Worksheet rows */
-	  p_col = p_row->first;
-	  while (p_col != NULL)
-	    {
-		p_col = p_col->next;
-	    }
-	  p_row = p_row->next;
-      }
+    if (workbook->active_sheet->rows == NULL)
+	goto stop;
+    p_row = *(workbook->active_sheet->rows + row);
+    if (p_row == NULL)
+	goto stop;
 
-    p_row = workbook->active_sheet->first;
-    while (p_row != NULL)
+    p_col = p_row->first;
+    while (p_col != NULL)
       {
-	  /* looping on Worksheet rows */
-	  if ((unsigned int) (p_row->row_no - 1) == row)
+	  /* looping on row columns */
+	  if ((unsigned int) (p_col->col_no) == column)
 	    {
-		p_col = p_row->first;
-		while (p_col != NULL)
+		if (p_col->assigned)
 		  {
-		      /* looping on row columns */
-		      if ((unsigned int) (p_col->col_no) == column)
+		      /* ok, found the requested Cell */
+		      val->type = FREEXL_CELL_NULL;
+		      if (p_col->is_datetime != XLSX_DATE_NONE)
+			{
+			    /* special case: DATE, TIME, DATETIME */
+			    char *datetime = find_datetime_xlsx (workbook);
+			    double value;
+			    int count;
+			    int hh;
+			    int mm;
+			    int ss;
+			    int year = 1900;
+			    int month = 1;
+			    int day = 1;
+			    if (p_col->type == XLSX_INTEGER)
+			      {
+				  value = 0.0;
+				  count = p_col->int_value;
+			      }
+			    else if (p_col->type == XLSX_DOUBLE)
+			      {
+				  count = (int) floor (p_col->dbl_value);
+				  value = p_col->dbl_value - count;
+			      }
+			    else
+			      {
+				  value = 0.0;
+				  count = 0;
+			      }
+			    compute_time (&hh, &mm, &ss, value);
+			    compute_date (&year, &month, &day, count);
+			    if (p_col->is_datetime == XLSX_DATE_SIMPLE)
+			      {
+				  sprintf (datetime,
+					   "%04d-%02d-%02d", year, month, day);
+				  val->type = FREEXL_CELL_DATE;
+			      }
+			    else if (p_col->is_datetime == XLSX_TIME_SIMPLE)
+			      {
+				  sprintf (datetime,
+					   "%02d:%02d:%02d", hh, mm, ss);
+				  val->type = FREEXL_CELL_TIME;
+			      }
+			    else
+			      {
+				  sprintf (datetime,
+					   "%04d-%02d-%02d %02d:%02d:%02d",
+					   year, month, day, hh, mm, ss);
+				  val->type = FREEXL_CELL_DATETIME;
+			      }
+			    //val->value.text_value = NULL;
+			    val->value.text_value = datetime;
+			}
+		      else
 			{
-			    if (p_col->assigned)
+			    /* ordinary values */
+			    if (p_col->type == XLSX_INTEGER)
 			      {
-				  /* ok, found the requested Cell */
-				  val->type = FREEXL_CELL_NULL;
-				  if (p_col->is_datetime != XLSX_DATE_NONE)
-				    {
-					/* special case: DATE, TIME, DATETIME */
-					char *datetime =
-					    find_datetime_xlsx (workbook);
-					double value;
-					int count;
-					int hh;
-					int mm;
-					int ss;
-					int year = 1900;
-					int month = 1;
-					int day = 1;
-					if (p_col->type == XLSX_INTEGER)
-					  {
-					      value = 0.0;
-					      count = p_col->int_value;
-					  }
-					else if (p_col->type == XLSX_DOUBLE)
-					  {
-					      count =
-						  (int)
-						  floor (p_col->dbl_value);
-					      value = p_col->dbl_value - count;
-					  }
-					else
-					  {
-					      value = 0.0;
-					      count = 0;
-					  }
-					compute_time (&hh, &mm, &ss, value);
-					compute_date (&year, &month, &day,
-						      count);
-					if (p_col->is_datetime ==
-					    XLSX_DATE_SIMPLE)
-					  {
-					      sprintf (datetime,
-						       "%04d-%02d-%02d", year,
-						       month, day);
-					      val->type = FREEXL_CELL_DATE;
-					  }
-					else if (p_col->is_datetime ==
-						 XLSX_TIME_SIMPLE)
-					  {
-					      sprintf (datetime,
-						       "%02d:%02d:%02d", hh, mm,
-						       ss);
-					      val->type = FREEXL_CELL_TIME;
-					  }
-					else
-					  {
-					      sprintf (datetime,
-						       "%04d-%02d-%02d %02d:%02d:%02d",
-						       year, month, day, hh, mm,
-						       ss);
-					      val->type = FREEXL_CELL_DATETIME;
-					  }
-					//val->value.text_value = NULL;
-					val->value.text_value = datetime;
-				    }
-				  else
-				    {
-					/* ordinary values */
-					if (p_col->type == XLSX_INTEGER)
-					  {
-					      val->type = FREEXL_CELL_INT;
-					      val->value.int_value =
-						  p_col->int_value;
-					  }
-					if (p_col->type == XLSX_DOUBLE)
-					  {
-					      val->type = FREEXL_CELL_DOUBLE;
-					      val->value.double_value =
-						  p_col->dbl_value;
-					  }
-					if (p_col->type == XLSX_STR_INDEX)
-					  {
-					      val->type = FREEXL_CELL_SST_TEXT;
-					      val->value.text_value =
-						  *(workbook->strings +
-						    p_col->str_index);
-					  }
-				    }
-				  return FREEXL_OK;
+				  val->type = FREEXL_CELL_INT;
+				  val->value.int_value = p_col->int_value;
+			      }
+			    if (p_col->type == XLSX_DOUBLE)
+			      {
+				  val->type = FREEXL_CELL_DOUBLE;
+				  val->value.double_value = p_col->dbl_value;
+			      }
+			    if (p_col->type == XLSX_STR_INDEX)
+			      {
+				  val->type = FREEXL_CELL_SST_TEXT;
+				  val->value.text_value =
+				      *(workbook->strings + p_col->str_index);
 			      }
 			}
-		      p_col = p_col->next;
+		      return FREEXL_OK;
 		  }
 	    }
-	  p_row = p_row->next;
+	  p_col = p_col->next;
       }
 
 /* any undefined Cell is assumed to be NULL */
+  stop:
     val->type = FREEXL_CELL_NULL;
     return FREEXL_OK;
 }
@@ -5354,62 +5326,56 @@ get_cell_value_ods (ods_workbook * workbook, unsigned int row,
 	|| (int) column > workbook->active_sheet->max_cell)
 	return FREEXL_ILLEGAL_CELL_ROW_COL;
 
-    p_row = workbook->active_sheet->first;
-    while (p_row != NULL)
+    if (workbook->active_sheet->rows == NULL)
+	goto stop;
+    p_row = *(workbook->active_sheet->rows + row);
+    if (p_row == NULL)
+	goto stop;
+
+    p_col = p_row->first;
+    while (p_col != NULL)
       {
-	  /* looping on Worksheet rows */
-	  if ((unsigned int) (p_row->row_no - 1) == row)
+	  /* looping on row columns */
+	  if ((unsigned int) (p_col->col_no) == column)
 	    {
-		p_col = p_row->first;
-		while (p_col != NULL)
+		if (p_col->assigned)
 		  {
-		      /* looping on row columns */
-		      if ((unsigned int) (p_col->col_no) == column)
+		      /* ok, found the requested Cell */
+		      val->type = FREEXL_CELL_NULL;
+		      if (p_col->type == ODS_INTEGER
+			  || p_col->type == ODS_BOOLEAN)
 			{
-			    if (p_col->assigned)
-			      {
-				  /* ok, found the requested Cell */
-				  val->type = FREEXL_CELL_NULL;
-				  if (p_col->type == ODS_INTEGER
-				      || p_col->type == ODS_BOOLEAN)
-				    {
-					val->type = FREEXL_CELL_INT;
-					val->value.int_value = p_col->int_value;
-				    }
-				  if (p_col->type == ODS_FLOAT
-				      || p_col->type == ODS_CURRENCY
-				      || p_col->type == ODS_PERCENTAGE)
-				    {
-					val->type = FREEXL_CELL_DOUBLE;
-					val->value.double_value =
-					    p_col->dbl_value;
-				    }
-				  if (p_col->type == ODS_STRING
-				      || p_col->type == ODS_TIME)
-				    {
-					val->type = FREEXL_CELL_TEXT;
-					val->value.text_value =
-					    p_col->txt_value;
-				    }
-				  if (p_col->type == ODS_DATE)
-				    {
-					char *datetime =
-					    find_datetime_ods (workbook);
-					strcpy (datetime, p_col->txt_value);
-					adjust_ods_datetime (datetime);
-					val->value.text_value = datetime;
-					val->type = FREEXL_CELL_TEXT;
-				    }
-				  return FREEXL_OK;
-			      }
+			    val->type = FREEXL_CELL_INT;
+			    val->value.int_value = p_col->int_value;
+			}
+		      if (p_col->type == ODS_FLOAT
+			  || p_col->type == ODS_CURRENCY
+			  || p_col->type == ODS_PERCENTAGE)
+			{
+			    val->type = FREEXL_CELL_DOUBLE;
+			    val->value.double_value = p_col->dbl_value;
+			}
+		      if (p_col->type == ODS_STRING || p_col->type == ODS_TIME)
+			{
+			    val->type = FREEXL_CELL_TEXT;
+			    val->value.text_value = p_col->txt_value;
+			}
+		      if (p_col->type == ODS_DATE)
+			{
+			    char *datetime = find_datetime_ods (workbook);
+			    strcpy (datetime, p_col->txt_value);
+			    adjust_ods_datetime (datetime);
+			    val->value.text_value = datetime;
+			    val->type = FREEXL_CELL_TEXT;
 			}
-		      p_col = p_col->next;
+		      return FREEXL_OK;
 		  }
 	    }
-	  p_row = p_row->next;
+	  p_col = p_col->next;
       }
 
 /* any undefined Cell is assumed to be NULL */
+  stop:
     val->type = FREEXL_CELL_NULL;
     return FREEXL_OK;
 }


=====================================
src/freexl_ods.c
=====================================
@@ -174,6 +174,8 @@ destroy_worksheet (ods_worksheet * ws)
       }
     if (ws->name != NULL)
 	free (ws->name);
+    if (ws->rows != NULL)
+	free (ws->rows);
     free (ws);
 }
 
@@ -320,6 +322,7 @@ do_add_worksheet (ods_workbook * workbook, char *name)
     ws->last = NULL;
     ws->max_row = -1;
     ws->max_cell = -1;
+    ws->rows = NULL;
     ws->RowOk = 0;
     ws->ColOk = 0;
     ws->CellValueOk = 0;
@@ -762,13 +765,14 @@ do_fetch_ods_worksheets (unzFile uf, ods_workbook * workbook)
 	  while (ws != NULL)
 	    {
 		int max_col_no = -1;
+		ods_cell *cell;
 		ods_row *row = ws->first;
 		ws->max_row = -1;
 		ws->max_cell = -1;
 		while (row != NULL)
 		  {
 		      max_col_no = -1;
-		      ods_cell *cell = row->first;
+		      cell = row->first;
 		      row->max_cell = -1;
 		      while (cell != NULL)
 			{
@@ -789,6 +793,36 @@ do_fetch_ods_worksheets (unzFile uf, ods_workbook * workbook)
 			}
 		      row = row->next;
 		  }
+		if (ws->max_row > 0)
+		  {
+		      /* creating and populating the ROWS Array */
+		      int i;
+		      ws->rows =
+			  malloc (sizeof (ods_row *) * (ws->max_row + 1));
+		      for (i = 0; i < ws->max_row; i++)
+			  *(ws->rows + i) = NULL;
+		      row = ws->first;
+		      while (row != NULL)
+			{
+			    max_col_no = -1;
+			    cell = row->first;
+			    while (cell != NULL)
+			      {
+				  if (cell->assigned && cell->type != ODS_VOID)
+				    {
+					if (cell->col_no > max_col_no)
+					    max_col_no = cell->col_no;
+				    }
+				  cell = cell->next;
+			      }
+			    if (max_col_no >= 0)
+			      {
+				  if (row->row_no > 0)
+				      *(ws->rows + row->row_no - 1) = row;
+			      }
+			    row = row->next;
+			}
+		  }
 		ws = ws->next;
 	    }
       }


=====================================
src/freexl_xlsx.c
=====================================
@@ -210,6 +210,8 @@ destroy_worksheet (xlsx_worksheet * ws)
       }
     if (ws->name != NULL)
 	free (ws->name);
+    if (ws->rows != NULL)
+	free (ws->rows);
     if (ws->CharData != NULL)
 	free (ws->CharData);
     free (ws);
@@ -509,6 +511,8 @@ sheet_start_tag (void *data, const char *el, const char **attr)
 		int s = -1;
 		int col_no = -1;
 		int type = XLSX_NULL;
+		attrib = attr;
+		count = 0;
 		while (*attrib != NULL)
 		  {
 		      if ((count % 2) == 0)
@@ -581,6 +585,12 @@ set_xlsx_cell_value (xlsx_worksheet * worksheet, const char *val)
     if (cell == NULL)
 	return;
 
+	if (cell->type == XLSX_NULL && val != NULL)
+	{
+	/* it could be an Integer or Double */
+		cell->type = XLSX_INTEGER;
+	}
+	
     if (cell->type == XLSX_STR_INDEX)
       {
 	  cell->str_index = atoi (val);
@@ -753,6 +763,7 @@ do_add_worksheet (xlsx_workbook * workbook, int id, char *name)
     ws->last = NULL;
     ws->max_row = -1;
     ws->max_cell = -1;
+    ws->rows = NULL;
     ws->error = 0;
     ws->CharDataStep = 65536;
     ws->CharDataMax = ws->CharDataStep;
@@ -1490,13 +1501,14 @@ freexl_open_xlsx (const char *path, const void **xl_handle)
 	  while (ws != NULL)
 	    {
 		int max_col_no = -1;
+		xlsx_cell *cell;
 		xlsx_row *row = ws->first;
 		ws->max_row = -1;
 		ws->max_cell = -1;
 		while (row != NULL)
 		  {
 		      max_col_no = -1;
-		      xlsx_cell *cell = row->first;
+		      cell = row->first;
 		      row->max_cell = -1;
 		      while (cell != NULL)
 			{
@@ -1517,6 +1529,36 @@ freexl_open_xlsx (const char *path, const void **xl_handle)
 			}
 		      row = row->next;
 		  }
+		if (ws->max_row > 0)
+		  {
+		      /* creating and populating the ROWS Array */
+		      int i;
+		      ws->rows =
+			  malloc (sizeof (ods_row *) * (ws->max_row + 1));
+		      for (i = 0; i < ws->max_row; i++)
+			  *(ws->rows + i) = NULL;
+		      row = ws->first;
+		      while (row != NULL)
+			{
+			    max_col_no = -1;
+			    cell = row->first;
+			    while (cell != NULL)
+			      {
+				  if (cell->assigned && cell->type != ODS_VOID)
+				    {
+					if (cell->col_no > max_col_no)
+					    max_col_no = cell->col_no;
+				    }
+				  cell = cell->next;
+			      }
+			    if (max_col_no >= 0)
+			      {
+				  if (row->row_no > 0)
+				      *(ws->rows + row->row_no - 1) = row;
+			      }
+			    row = row->next;
+			}
+		  }
 		ws = ws->next;
 	    }
       }



View it on GitLab: https://salsa.debian.org/debian-gis-team/freexl/-/commit/ba31ae7acd37b3b77d9a647f0fac671f71ac1346

-- 
View it on GitLab: https://salsa.debian.org/debian-gis-team/freexl/-/commit/ba31ae7acd37b3b77d9a647f0fac671f71ac1346
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20210705/4cadff27/attachment-0001.htm>


More information about the Pkg-grass-devel mailing list