[SCM] exiv2 packaging branch, master, updated. debian/0.25-3.1-3734-gdcbc29a
Maximiliano Curia
maxy at moszumanska.debian.org
Thu Jul 13 17:36:31 UTC 2017
Gitweb-URL: http://git.debian.org/?p=pkg-kde/kde-extras/exiv2.git;a=commitdiff;h=eba6b82
The following commit has been merged in the master branch:
commit eba6b8238638fc0690d09c625e862d2c66ddf3a9
Author: Andreas Huggel <ahuggel at gmx.net>
Date: Wed Jul 7 15:41:54 2004 +0000
Added timegm() from the tz distribution and preparations for conditional compilation (requires configure script)
---
Doxyfile | 2 +-
config.h | 9 +
config.mk | 12 +-
src/Makefile | 17 +-
src/actions.cpp | 8 +-
src/image.cpp | 8 +-
src/localtime.c | 1707 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
src/private.h | 233 ++++++++
src/timegm.h | 88 +++
src/tzfile.h | 193 +++++++
src/utils.cpp | 13 +-
11 files changed, 2269 insertions(+), 21 deletions(-)
diff --git a/Doxyfile b/Doxyfile
index c309f43..fb2a14f 100644
--- a/Doxyfile
+++ b/Doxyfile
@@ -412,7 +412,7 @@ RECURSIVE = NO
# excluded from the INPUT source files. This way you can easily exclude a
# subdirectory from a directory tree whose root is specified with the INPUT tag.
-EXCLUDE =
+EXCLUDE = ../src/getopt_win32.c ../src/getopt_win32.h ../src/localtime.c ../src/private.h ../src/timegm.h ../src/tzfile.h
# The EXCLUDE_SYMLINKS tag can be used select whether or not files or directories
# that are symbolic links (a Unix filesystem feature) are excluded from the input.
diff --git a/config.h b/config.h
index a0538d7..9f24a18 100644
--- a/config.h
+++ b/config.h
@@ -11,3 +11,12 @@
/* Define to the version of this package. */
#define PACKAGE_VERSION "0.4"
+
+/* Define as 1 if you have the timegm function */
+#undef HAVE_TIMEGM
+
+/* Define as 1 if you have sys/wait.h */
+#undef HAVE_SYS_WAIT_H
+
+/* Define as 1 if you have unistd.h */
+#define HAVE_UNISTD_H 1
diff --git a/config.mk b/config.mk
index a451e03..9fac840 100644
--- a/config.mk
+++ b/config.mk
@@ -20,7 +20,7 @@
# 02111-1307, USA.
#
# File: config.mk
-# Version: $Name: $ $Revision: 1.4 $
+# Version: $Name: $ $Revision: 1.5 $
# Author(s): Andreas Huggel (ahu) <ahuggel at gmx.net>
# History: 10-Dec-03, ahu: created
#
@@ -39,7 +39,7 @@ STATIC_LIBS =
CXX = g++
# Common compiler flags (warnings, symbols [-ggdb], optimization [-O2], etc)
-CXXFLAGS := -Wall -Woverloaded-virtual -Wsign-promo -O2
+CXXFLAGS := -Wall -O2
# Compiler flags to compile static objects
CXXFLAGS_STATIC := $(CXXFLAGS)
# Compiler flags for shared objects
@@ -53,9 +53,6 @@ CPPFLAGS =
# Command to run the compiler or preprocessor to produce dependencies
CXXDEP = $(CXX) -MM
-# Flag to $(CXXDEP) to treat all subsequent file names as C++ source
-# files, regardless of their suffixes
-CXXLANGCXX = -x c++
# Linker flags
LDFLAGS =
@@ -72,6 +69,11 @@ SHAREDLIB_SUFFIX = .so
ARCHIVE_SUFFIX = .a
# **********************************************************************
+# C Compiler
+CC = gcc
+CFLAGS = $(CXXFLAGS)
+
+# **********************************************************************
# Global includes, libraries and defines
INCS = -I. -I$(top_srcdir) -I$(incdir)
LIBS = -L. -L$(libdir) -L/usr/local/lib
diff --git a/src/Makefile b/src/Makefile
index 1b2cd54..97b470e 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -20,7 +20,7 @@
# 02111-1307, USA.
#
# File: Makefile
-# Version: $Name: $ $Revision: 1.27 $
+# Version: Exiv2-0_4_040703 1.27
# Author(s): Andreas Huggel (ahu) <ahuggel at gmx.net>
# History: 10-Dec-03, ahu: created
#
@@ -62,7 +62,11 @@ BINSRC = addmoddel.cpp exifcomment.cpp exifprint.cpp ifd-test.cpp \
EXIV2MAIN = exiv2.cpp
# Add additional source files of the real application to this list
-EXIV2SRC = actions.cpp utils.cpp
+EXIV2SRC = actions.cpp utils.cpp
+# C source files of the application
+ifndef HAVE_TIMEGM
+EXIVCSRC = localtime.c
+endif
# ******************************************************************************
# Library
@@ -83,7 +87,7 @@ LDLIBS = $(LIBS) -l$(LIBNAME)
SHELL = /bin/sh
.SUFFIXES:
-.SUFFIXES: .cpp .o .so
+.SUFFIXES: .c .cpp .o .so
.PRECIOUS: %.cpp
@@ -97,12 +101,12 @@ HDR = $(CCHDR)
OBJ = $(CCOBJ)
SOBJ = $(CCSOBJ)
DEP = $(CCSRC:%.cpp=.%.d) $(BINSRC:%.cpp=.%.d) \
- $(EXIV2MAIN:%.cpp=.%.d) $(EXIV2SRC:%.cpp=.%.d)
+ $(EXIV2MAIN:%.cpp=.%.d) $(EXIV2SRC:%.cpp=.%.d) $(EXIVCSRC:%.c=.%.d)
BINOBJ = $(BINSRC:.cpp=.o)
BINARY = $(BINSRC:.cpp=)
-EXIV2OBJ = $(EXIV2MAIN:.cpp=.o) $(EXIV2SRC:.cpp=.o)
+EXIV2OBJ = $(EXIV2MAIN:.cpp=.o) $(EXIV2SRC:.cpp=.o) $(EXIVCSRC:.c=.o)
EXIV2BIN = $(EXIV2MAIN:.cpp=)
ARCHIVE = lib$(LIBNAME)$(ARCHIVE_SUFFIX)
@@ -146,6 +150,9 @@ endif
# ******************************************************************************
# Rules
+%.o: %.c
+ $(CC) $(CFLAGS) $(DEFS) $(INCS) -c $< -o $@
+
%.o: %.cpp
$(CXX) $(CXXFLAGS_STATIC) $(CXXDEFS) $(CXXINCS) -c $< -o $@
diff --git a/src/actions.cpp b/src/actions.cpp
index 25d066c..5ef0aff 100644
--- a/src/actions.cpp
+++ b/src/actions.cpp
@@ -20,16 +20,18 @@
*/
/*
File: actions.cpp
- Version: $Name: $ $Revision: 1.28 $
+ Version: $Name: $ $Revision: 1.29 $
Author(s): Andreas Huggel (ahu) <ahuggel at gmx.net>
History: 08-Dec-03, ahu: created
*/
// *****************************************************************************
#include "rcsid.hpp"
-EXIV2_RCSID("@(#) $Name: $ $Revision: 1.28 $ $RCSfile: actions.cpp,v $")
+EXIV2_RCSID("@(#) $Name: $ $Revision: 1.29 $ $RCSfile: actions.cpp,v $")
// *****************************************************************************
// included header files
+#include <config.h>
+
#include "actions.hpp"
#include "exiv2.hpp"
#include "utils.hpp"
@@ -49,7 +51,7 @@ EXIV2_RCSID("@(#) $Name: $ $Revision: 1.28 $ $RCSfile: actions.cpp,v $")
#include <cmath>
#include <sys/types.h> // for stat()
#include <sys/stat.h> // for stat()
-#ifndef _MSC_VER
+#if defined HAVE_UNISTD_H && !defined _MSC_VER
#include <unistd.h> // for stat()
#endif
diff --git a/src/image.cpp b/src/image.cpp
index 4e32e89..58376f4 100644
--- a/src/image.cpp
+++ b/src/image.cpp
@@ -20,17 +20,19 @@
*/
/*
File: image.cpp
- Version: $Name: $ $Revision: 1.17 $
+ Version: $Name: $ $Revision: 1.18 $
Author(s): Andreas Huggel (ahu) <ahuggel at gmx.net>
History: 26-Jan-04, ahu: created
11-Feb-04, ahu: isolated as a component
*/
// *****************************************************************************
#include "rcsid.hpp"
-EXIV2_RCSID("@(#) $Name: $ $Revision: 1.17 $ $RCSfile: image.cpp,v $")
+EXIV2_RCSID("@(#) $Name: $ $Revision: 1.18 $ $RCSfile: image.cpp,v $")
// *****************************************************************************
// included header files
+#include <config.h>
+
#include "image.hpp"
#include "types.hpp"
@@ -44,8 +46,10 @@ EXIV2_RCSID("@(#) $Name: $ $Revision: 1.17 $ $RCSfile: image.cpp,v $")
typedef int pid_t;
#else
#include <sys/types.h> // for getpid
+#ifdef HAVE_UNISTD_H
#include <unistd.h> // for getpid
#endif
+#endif
// *****************************************************************************
// class member definitions
diff --git a/src/localtime.c b/src/localtime.c
new file mode 100644
index 0000000..12d533c
--- /dev/null
+++ b/src/localtime.c
@@ -0,0 +1,1707 @@
+/*!
+ @file localtime.c
+ @brief This file is from the tz distribution at ftp://elsie.nci.nih.gov/pub/
+ @version $Name: $ $Revision: 1.1 $
+*/
+#include <config.h>
+#include "timegm.h"
+
+/*
+** This file is in the public domain, so clarified as of
+** 1996-06-05 by Arthur David Olson (arthur_david_olson at nih.gov).
+*/
+
+#ifndef lint
+#ifndef NOID
+static char elsieid[] = "@(#)localtime.c 7.78";
+#endif /* !defined NOID */
+#endif /* !defined lint */
+
+/*
+** Leap second handling from Bradley White (bww at k.gp.cs.cmu.edu).
+** POSIX-style TZ environment variable handling from Guy Harris
+** (guy at auspex.com).
+*/
+
+/*LINTLIBRARY*/
+
+#include "private.h"
+#include "tzfile.h"
+#include "fcntl.h"
+
+/*
+** SunOS 4.1.1 headers lack O_BINARY.
+*/
+
+#ifdef O_BINARY
+#define OPEN_MODE (O_RDONLY | O_BINARY)
+#endif /* defined O_BINARY */
+#ifndef O_BINARY
+#define OPEN_MODE O_RDONLY
+#endif /* !defined O_BINARY */
+
+#ifndef WILDABBR
+/*
+** Someone might make incorrect use of a time zone abbreviation:
+** 1. They might reference tzname[0] before calling tzset (explicitly
+** or implicitly).
+** 2. They might reference tzname[1] before calling tzset (explicitly
+** or implicitly).
+** 3. They might reference tzname[1] after setting to a time zone
+** in which Daylight Saving Time is never observed.
+** 4. They might reference tzname[0] after setting to a time zone
+** in which Standard Time is never observed.
+** 5. They might reference tm.TM_ZONE after calling offtime.
+** What's best to do in the above cases is open to debate;
+** for now, we just set things up so that in any of the five cases
+** WILDABBR is used. Another possibility: initialize tzname[0] to the
+** string "tzname[0] used before set", and similarly for the other cases.
+** And another: initialize tzname[0] to "ERA", with an explanation in the
+** manual page of what this "time zone abbreviation" means (doing this so
+** that tzname[0] has the "normal" length of three characters).
+*/
+#define WILDABBR " "
+#endif /* !defined WILDABBR */
+
+static char wildabbr[] = "WILDABBR";
+
+static const char gmt[] = "GMT";
+
+/*
+** The DST rules to use if TZ has no rules and we can't load TZDEFRULES.
+** We default to US rules as of 1999-08-17.
+** POSIX 1003.1 section 8.1.1 says that the default DST rules are
+** implementation dependent; for historical reasons, US rules are a
+** common default.
+*/
+#ifndef TZDEFRULESTRING
+#define TZDEFRULESTRING ",M4.1.0,M10.5.0"
+#endif /* !defined TZDEFDST */
+
+struct ttinfo { /* time type information */
+ long tt_gmtoff; /* UTC offset in seconds */
+ int tt_isdst; /* used to set tm_isdst */
+ int tt_abbrind; /* abbreviation list index */
+ int tt_ttisstd; /* TRUE if transition is std time */
+ int tt_ttisgmt; /* TRUE if transition is UTC */
+};
+
+struct lsinfo { /* leap second information */
+ time_t ls_trans; /* transition time */
+ long ls_corr; /* correction to apply */
+};
+
+#define BIGGEST(a, b) (((a) > (b)) ? (a) : (b))
+
+#ifdef TZNAME_MAX
+#define MY_TZNAME_MAX TZNAME_MAX
+#endif /* defined TZNAME_MAX */
+#ifndef TZNAME_MAX
+#define MY_TZNAME_MAX 255
+#endif /* !defined TZNAME_MAX */
+
+struct state {
+ int leapcnt;
+ int timecnt;
+ int typecnt;
+ int charcnt;
+ time_t ats[TZ_MAX_TIMES];
+ unsigned char types[TZ_MAX_TIMES];
+ struct ttinfo ttis[TZ_MAX_TYPES];
+ char chars[BIGGEST(BIGGEST(TZ_MAX_CHARS + 1, sizeof gmt),
+ (2 * (MY_TZNAME_MAX + 1)))];
+ struct lsinfo lsis[TZ_MAX_LEAPS];
+};
+
+struct rule {
+ int r_type; /* type of rule--see below */
+ int r_day; /* day number of rule */
+ int r_week; /* week number of rule */
+ int r_mon; /* month number of rule */
+ long r_time; /* transition time of rule */
+};
+
+#define JULIAN_DAY 0 /* Jn - Julian day */
+#define DAY_OF_YEAR 1 /* n - day of year */
+#define MONTH_NTH_DAY_OF_WEEK 2 /* Mm.n.d - month, week, day of week */
+
+/*
+** Prototypes for static functions.
+*/
+
+static long detzcode P((const char * codep));
+static const char * getzname P((const char * strp));
+static const char * getnum P((const char * strp, int * nump, int min,
+ int max));
+static const char * getsecs P((const char * strp, long * secsp));
+static const char * getoffset P((const char * strp, long * offsetp));
+static const char * getrule P((const char * strp, struct rule * rulep));
+static void gmtload P((struct state * sp));
+static void gmtsub P((const time_t * timep, long offset,
+ struct tm * tmp));
+static void localsub P((const time_t * timep, long offset,
+ struct tm * tmp));
+static int increment_overflow P((int * number, int delta));
+static int normalize_overflow P((int * tensptr, int * unitsptr,
+ int base));
+static void settzname P((void));
+static time_t time1 P((struct tm * tmp,
+ void(*funcp) P((const time_t *,
+ long, struct tm *)),
+ long offset));
+static time_t time2 P((struct tm *tmp,
+ void(*funcp) P((const time_t *,
+ long, struct tm*)),
+ long offset, int * okayp));
+static time_t time2sub P((struct tm *tmp,
+ void(*funcp) P((const time_t *,
+ long, struct tm*)),
+ long offset, int * okayp, int do_norm_secs));
+static void timesub P((const time_t * timep, long offset,
+ const struct state * sp, struct tm * tmp));
+static int tmcomp P((const struct tm * atmp,
+ const struct tm * btmp));
+static time_t transtime P((time_t janfirst, int year,
+ const struct rule * rulep, long offset));
+static int tzload P((const char * name, struct state * sp));
+static int tzparse P((const char * name, struct state * sp,
+ int lastditch));
+
+#ifdef ALL_STATE
+static struct state * lclptr;
+static struct state * gmtptr;
+#endif /* defined ALL_STATE */
+
+#ifndef ALL_STATE
+static struct state lclmem;
+static struct state gmtmem;
+#define lclptr (&lclmem)
+#define gmtptr (&gmtmem)
+#endif /* State Farm */
+
+#ifndef TZ_STRLEN_MAX
+#define TZ_STRLEN_MAX 255
+#endif /* !defined TZ_STRLEN_MAX */
+
+static char lcl_TZname[TZ_STRLEN_MAX + 1];
+static int lcl_is_set;
+static int gmt_is_set;
+
+char * tzname[2] = {
+ wildabbr,
+ wildabbr
+};
+
+/*
+** Section 4.12.3 of X3.159-1989 requires that
+** Except for the strftime function, these functions [asctime,
+** ctime, gmtime, localtime] return values in one of two static
+** objects: a broken-down time structure and an array of char.
+** Thanks to Paul Eggert (eggert at twinsun.com) for noting this.
+*/
+
+static struct tm tm;
+
+#ifdef USG_COMPAT
+time_t timezone = 0;
+int daylight = 0;
+#endif /* defined USG_COMPAT */
+
+#ifdef ALTZONE
+time_t altzone = 0;
+#endif /* defined ALTZONE */
+
+static long
+detzcode(codep)
+const char * const codep;
+{
+ register long result;
+ register int i;
+
+ result = (codep[0] & 0x80) ? ~0L : 0L;
+ for (i = 0; i < 4; ++i)
+ result = (result << 8) | (codep[i] & 0xff);
+ return result;
+}
+
+static void
+settzname P((void))
+{
+ register struct state * const sp = lclptr;
+ register int i;
+
+ tzname[0] = wildabbr;
+ tzname[1] = wildabbr;
+#ifdef USG_COMPAT
+ daylight = 0;
+ timezone = 0;
+#endif /* defined USG_COMPAT */
+#ifdef ALTZONE
+ altzone = 0;
+#endif /* defined ALTZONE */
+#ifdef ALL_STATE
+ if (sp == NULL) {
+ tzname[0] = tzname[1] = gmt;
+ return;
+ }
+#endif /* defined ALL_STATE */
+ for (i = 0; i < sp->typecnt; ++i) {
+ register const struct ttinfo * const ttisp = &sp->ttis[i];
+
+ tzname[ttisp->tt_isdst] =
+ &sp->chars[ttisp->tt_abbrind];
+#ifdef USG_COMPAT
+ if (ttisp->tt_isdst)
+ daylight = 1;
+ if (i == 0 || !ttisp->tt_isdst)
+ timezone = -(ttisp->tt_gmtoff);
+#endif /* defined USG_COMPAT */
+#ifdef ALTZONE
+ if (i == 0 || ttisp->tt_isdst)
+ altzone = -(ttisp->tt_gmtoff);
+#endif /* defined ALTZONE */
+ }
+ /*
+ ** And to get the latest zone names into tzname. . .
+ */
+ for (i = 0; i < sp->timecnt; ++i) {
+ register const struct ttinfo * const ttisp =
+ &sp->ttis[
+ sp->types[i]];
+
+ tzname[ttisp->tt_isdst] =
+ &sp->chars[ttisp->tt_abbrind];
+ }
+}
+
+static int
+tzload(name, sp)
+register const char * name;
+register struct state * const sp;
+{
+ register const char * p;
+ register int i;
+ register int fid;
+
+ if (name == NULL && (name = TZDEFAULT) == NULL)
+ return -1;
+ {
+ register int doaccess;
+ /*
+ ** Section 4.9.1 of the C standard says that
+ ** "FILENAME_MAX expands to an integral constant expression
+ ** that is the size needed for an array of char large enough
+ ** to hold the longest file name string that the implementation
+ ** guarantees can be opened."
+ */
+ char fullname[FILENAME_MAX + 1];
+
+ if (name[0] == ':')
+ ++name;
+ doaccess = name[0] == '/';
+ if (!doaccess) {
+ if ((p = TZDIR) == NULL)
+ return -1;
+ if ((strlen(p) + strlen(name) + 1) >= sizeof fullname)
+ return -1;
+ (void) strcpy(fullname, p);
+ (void) strcat(fullname, "/");
+ (void) strcat(fullname, name);
+ /*
+ ** Set doaccess if '.' (as in "../") shows up in name.
+ */
+ if (strchr(name, '.') != NULL)
+ doaccess = TRUE;
+ name = fullname;
+ }
+ if (doaccess && access(name, R_OK) != 0)
+ return -1;
+ if ((fid = open(name, OPEN_MODE)) == -1)
+ return -1;
+ }
+ {
+ struct tzhead * tzhp;
+ union {
+ struct tzhead tzhead;
+ char buf[sizeof *sp + sizeof *tzhp];
+ } u;
+ int ttisstdcnt;
+ int ttisgmtcnt;
+
+ i = read(fid, u.buf, sizeof u.buf);
+ if (close(fid) != 0)
+ return -1;
+ ttisstdcnt = (int) detzcode(u.tzhead.tzh_ttisstdcnt);
+ ttisgmtcnt = (int) detzcode(u.tzhead.tzh_ttisgmtcnt);
+ sp->leapcnt = (int) detzcode(u.tzhead.tzh_leapcnt);
+ sp->timecnt = (int) detzcode(u.tzhead.tzh_timecnt);
+ sp->typecnt = (int) detzcode(u.tzhead.tzh_typecnt);
+ sp->charcnt = (int) detzcode(u.tzhead.tzh_charcnt);
+ p = u.tzhead.tzh_charcnt + sizeof u.tzhead.tzh_charcnt;
+ if (sp->leapcnt < 0 || sp->leapcnt > TZ_MAX_LEAPS ||
+ sp->typecnt <= 0 || sp->typecnt > TZ_MAX_TYPES ||
+ sp->timecnt < 0 || sp->timecnt > TZ_MAX_TIMES ||
+ sp->charcnt < 0 || sp->charcnt > TZ_MAX_CHARS ||
+ (ttisstdcnt != sp->typecnt && ttisstdcnt != 0) ||
+ (ttisgmtcnt != sp->typecnt && ttisgmtcnt != 0))
+ return -1;
+ if (i - (p - u.buf) < sp->timecnt * 4 + /* ats */
+ sp->timecnt + /* types */
+ sp->typecnt * (4 + 2) + /* ttinfos */
+ sp->charcnt + /* chars */
+ sp->leapcnt * (4 + 4) + /* lsinfos */
+ ttisstdcnt + /* ttisstds */
+ ttisgmtcnt) /* ttisgmts */
+ return -1;
+ for (i = 0; i < sp->timecnt; ++i) {
+ sp->ats[i] = detzcode(p);
+ p += 4;
+ }
+ for (i = 0; i < sp->timecnt; ++i) {
+ sp->types[i] = (unsigned char) *p++;
+ if (sp->types[i] >= sp->typecnt)
+ return -1;
+ }
+ for (i = 0; i < sp->typecnt; ++i) {
+ register struct ttinfo * ttisp;
+
+ ttisp = &sp->ttis[i];
+ ttisp->tt_gmtoff = detzcode(p);
+ p += 4;
+ ttisp->tt_isdst = (unsigned char) *p++;
+ if (ttisp->tt_isdst != 0 && ttisp->tt_isdst != 1)
+ return -1;
+ ttisp->tt_abbrind = (unsigned char) *p++;
+ if (ttisp->tt_abbrind < 0 ||
+ ttisp->tt_abbrind > sp->charcnt)
+ return -1;
+ }
+ for (i = 0; i < sp->charcnt; ++i)
+ sp->chars[i] = *p++;
+ sp->chars[i] = '
--
exiv2 packaging
More information about the pkg-kde-commits
mailing list