Compare commits

...

4 Commits

Author SHA1 Message Date
e4cd74e741 Add darwin support to Makefile 2026-01-19 17:06:08 -05:00
a7cfd3ef89 Replace sprintf with snprintf 2026-01-19 15:35:24 -05:00
772abdd2f9 Remove unused message field 2026-01-19 14:46:49 -05:00
1605656c73 Exception: fix constructor 2026-01-19 14:45:59 -05:00
3 changed files with 19 additions and 6 deletions

View File

@@ -12,6 +12,8 @@ LDFLAGS = -lpugixml
VERSION := $(shell cat include/libgourou.h |grep LIBGOUROU_VERSION|cut -d '"' -f2) VERSION := $(shell cat include/libgourou.h |grep LIBGOUROU_VERSION|cut -d '"' -f2)
UNAME := $(shell uname)
BUILD_STATIC ?= 0 BUILD_STATIC ?= 0
BUILD_SHARED ?= 1 BUILD_SHARED ?= 1
BUILD_UTILS ?= 1 BUILD_UTILS ?= 1
@@ -27,9 +29,14 @@ ifneq ($(BUILD_STATIC), 0)
STATIC_UTILS=1 STATIC_UTILS=1
endif endif
ifneq ($(BUILD_SHARED), 0) ifneq ($(BUILD_SHARED), 0)
ifeq ($(UNAME), Darwin)
TARGETS += libgourou.dylib
TARGET_LIBRARIES += libgourou.dylib libgourou.dylib.$(VERSION)
else
TARGETS += libgourou.so TARGETS += libgourou.so
TARGET_LIBRARIES += libgourou.so libgourou.so.$(VERSION) TARGET_LIBRARIES += libgourou.so libgourou.so.$(VERSION)
endif endif
endif
ifneq ($(BUILD_UTILS), 0) ifneq ($(BUILD_UTILS), 0)
TARGETS += build_utils TARGETS += build_utils
endif endif
@@ -82,6 +89,12 @@ libgourou.so.$(VERSION): $(OBJECTS) $(UPDFPARSERLIB)
libgourou.so: libgourou.so.$(VERSION) libgourou.so: libgourou.so.$(VERSION)
ln -f -s $^ $@ ln -f -s $^ $@
libgourou.dylib.$(VERSION): $(OBJECTS) $(UPDFPARSERLIB)
$(CXX) $^ $(LDFLAGS) -o $@ -shared
libgourou.dylib: libgourou.dylib.$(VERSION)
ln -f -s $^ $@
build_utils: $(TARGET_LIBRARIES) build_utils: $(TARGET_LIBRARIES)
$(MAKE) -C utils ROOT=$(PWD) CXX=$(CXX) AR=$(AR) DEBUG=$(DEBUG) STATIC_UTILS=$(STATIC_UTILS) DESTDIR=$(DESTDIR) PREFIX=$(PREFIX) $(MAKE) -C utils ROOT=$(PWD) CXX=$(CXX) AR=$(AR) DEBUG=$(DEBUG) STATIC_UTILS=$(STATIC_UTILS) DESTDIR=$(DESTDIR) PREFIX=$(PREFIX)

View File

@@ -165,8 +165,8 @@ namespace gourou
Exception(const Exception& other) Exception(const Exception& other)
{ {
this->code = other.code; this->code = other.code;
this->line = line; this->line = other.line;
this->file = file; this->file = other.file;
this->fullmessage = strdup(other.fullmessage); this->fullmessage = strdup(other.fullmessage);
} }
@@ -181,7 +181,7 @@ namespace gourou
private: private:
int code, line; int code, line;
const char* message, *file; const char* file;
char* fullmessage; char* fullmessage;
}; };

View File

@@ -202,7 +202,7 @@ namespace gourou
char* tmp = new char[_length*2+1]; char* tmp = new char[_length*2+1];
for(int i=0; i<(int)_length; i++) for(int i=0; i<(int)_length; i++)
sprintf(&tmp[i*2], "%02x", _data[i]); snprintf(&tmp[i*2], (_length-i)*2+1, "%02x", _data[i]);
tmp[_length*2] = 0; tmp[_length*2] = 0;