From 661d9227cb27e0bd2ae0c68ec5df6a08050e6cc3 Mon Sep 17 00:00:00 2001 From: DeaDDooMER Date: Mon, 29 Jun 2020 22:02:52 +0400 Subject: [PATCH] fix gcc 4.0 --- Makefile | 12 ++++++------ main/odcread.cc | 2 +- reader/readAlien.cc | 5 ++++- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 0dbb36a..b1fac08 100644 --- a/Makefile +++ b/Makefile @@ -6,8 +6,8 @@ # * $(MODULE)/*.cc -- module source files MODULES := main reader store alien typeregister textmodel fold typepath -CFLAGS = -I. -CC = g++ +CXXFLAGS = -I. +CXX = g++ # Variables for the modules to write to SRCS := @@ -17,11 +17,11 @@ include $(patsubst %,%/Make.inc,$(MODULES)) # This rule just links the object files together odcread: $(SRCS:.cc=.o) - $(CC) -o $@ $^ + $(CXX) -liconv -o $@ $^ # This rule build an object (.o) from a source (.cc). %.o: %.cc - $(CC) $(CFLAGS) $< -c -o $@ + $(CXX) $(CXXFLAGS) $< -c -o $@ # For each implementation header (.ih) generate a dependency (.d) file which # will ensure that the compiled header (.ih.gch) is rebuilt whenever the header @@ -34,8 +34,8 @@ odcread: $(SRCS:.cc=.o) # The .d file is not an explicit target because it will need to be (re-)built # if and only if the .ih.gch needs to be rebuilt. %.ih.gch: %.ih - $(CC) $(CFLAGS) -x c++-header $< -MM -MF $*.d -MP -MT $@ - $(CC) $(CFLAGS) -x c++-header $< -o $@ + $(CXX) $(CXXFLAGS) -x c++-header $< -MM -MF $*.d -MP -MT $@ + $(CXX) $(CXXFLAGS) -x c++-header $< -o $@ # Each module has a .ih file that should be *the only* include from the .cc # files. These .ih files are pre-compiled to .ih.gch, and dependency caching diff --git a/main/odcread.cc b/main/odcread.cc index a2a2bd5..5dc5b42 100644 --- a/main/odcread.cc +++ b/main/odcread.cc @@ -171,7 +171,7 @@ int main(int argc, char *argv[]) { // std::cout << s->toPlainText() << std::endl; // std::cout << std::endl << std::endl; - if (s == nullptr) { + if (s == NULL) { return 1; } diff --git a/reader/readAlien.cc b/reader/readAlien.cc index ba96ca5..1bcec17 100644 --- a/reader/readAlien.cc +++ b/reader/readAlien.cc @@ -3,7 +3,10 @@ namespace odc { void Reader::readAlien(Alien *alien, std::streampos down, std::streampos end) { - std::streampos next = down != 0 ? down : end; + std::streampos next = down; + if (next == (std::streampos)0) { + next = end; + } while (d_rider.tellg() < end) { if (d_rider.tellg() < next) { // for some reason, this means its a piece (unstructured) size_t len = next - d_rider.tellg(); -- 2.29.2