From: marshmellow42 Date: Thu, 13 Apr 2017 21:14:40 +0000 (-0400) Subject: fix compile errors in newer environment X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/commitdiff_plain/refs/heads/graphwork?ds=sidebyside;hp=58a0fa747eab16c1997da619c2994a9cda640b00 fix compile errors in newer environment --- diff --git a/armsrc/crapto1.c b/armsrc/crapto1.c index 9d491d12..74b4eea7 100644 --- a/armsrc/crapto1.c +++ b/armsrc/crapto1.c @@ -34,22 +34,29 @@ static void __attribute__((constructor)) fill_lut() static void quicksort(uint32_t* const start, uint32_t* const stop) { uint32_t *it = start + 1, *rit = stop; - + uint32_t tmp; if(it > rit) return; - while(it < rit) - if(*it <= *start) + while(it < rit) { + if(*it <= *start) { ++it; - else if(*rit > *start) + } else if(*rit > *start) { --rit; - else - *it ^= (*it ^= *rit, *rit ^= *it); + } else { + tmp = *it; + *it = *rit; + *rit = tmp; + } + } if(*rit >= *start) --rit; - if(rit != start) - *rit ^= (*rit ^= *start, *start ^= *rit); + if(rit != start) { + tmp = *rit; + *rit = *start; + *start = tmp; + } quicksort(start, rit - 1); quicksort(rit + 1, stop); @@ -319,9 +326,11 @@ uint8_t lfsr_rollback_bit(struct Crypto1State *s, uint32_t in, int fb) { int out; uint8_t ret; - + uint32_t tmp; s->odd &= 0xffffff; - s->odd ^= (s->odd ^= s->even, s->even ^= s->odd); + tmp = s->odd; + s->odd = s->even; + s->even = tmp; out = s->even & 1; out ^= LF_POLY_EVEN & (s->even >>= 1); diff --git a/armsrc/crypto1.c b/armsrc/crypto1.c index 9d103c7f..3d56fab4 100644 --- a/armsrc/crypto1.c +++ b/armsrc/crypto1.c @@ -52,6 +52,7 @@ uint8_t crypto1_bit(struct Crypto1State *s, uint8_t in, int is_encrypted) { uint32_t feedin; uint8_t ret = filter(s->odd); + uint32_t tmp; feedin = ret & !!is_encrypted; feedin ^= !!in; @@ -59,7 +60,9 @@ uint8_t crypto1_bit(struct Crypto1State *s, uint8_t in, int is_encrypted) feedin ^= LF_POLY_EVEN & s->even; s->even = s->even << 1 | parity(feedin); - s->odd ^= (s->odd ^= s->even, s->even ^= s->odd); + tmp = s->odd; + s->odd = s->even; + s->even = tmp; return ret; } diff --git a/client/Makefile b/client/Makefile index 621b5779..4d28216b 100644 --- a/client/Makefile +++ b/client/Makefile @@ -16,25 +16,34 @@ LDLIBS = -L/opt/local/lib -L/usr/local/lib ../liblua/liblua.a -lreadline -lpthre LDFLAGS = $(COMMON_FLAGS) CFLAGS = -std=c99 -I. -I../include -I../common -I/opt/local/include -I../liblua -Wall $(COMMON_FLAGS) -g -O4 LUAPLATFORM = generic + +platform = $(shell uname) ifneq (,$(findstring MINGW,$(platform))) -CXXFLAGS = -I$(QTDIR)/include -I$(QTDIR)/include/QtCore -I$(QTDIR)/include/QtGui -QTLDLIBS = -L$(QTDIR)/lib -lQtCore4 -lQtGui4 -MOC = $(QTDIR)/bin/moc -LUAPLATFORM = mingw -else ifeq ($(platform),Darwin) -CXXFLAGS = $(shell pkg-config --cflags QtCore QtGui 2>/dev/null) -Wall -O4 -QTLDLIBS = $(shell pkg-config --libs QtCore QtGui 2>/dev/null) -MOC = $(shell pkg-config --variable=moc_location QtCore) -LUAPLATFORM = macosx + CXXFLAGS = -I$(QTDIR)/include -I$(QTDIR)/include/QtCore -I$(QTDIR)/include/QtGui + ifneq ($(wildcard $(QTDIR)/include/QtWidgets),) + CXXFLAGS += -I$(QTDIR)/include/QtWidgets + QTLDLIBS = -L$(QTDIR)/lib -lQt5Core -lQt5Gui -lQt5Widgets + else + QTLDLIBS = -L$(QTDIR)/lib -lQtCore4 -lQtGui4 + endif + MOC = $(QTDIR)/bin/moc + LUAPLATFORM = mingw else -CXXFLAGS = $(shell pkg-config --cflags QtCore QtGui 2>/dev/null) -Wall -O4 -QTLDLIBS = $(shell pkg-config --libs QtCore QtGui 2>/dev/null) -MOC = $(shell pkg-config --variable=moc_location QtCore) -LDLIBS += -ldl - -# Below is a variant you can use if you have problems compiling with QT5 on ubuntu. see http://www.proxmark.org/forum/viewtopic.php?id=1661 for more info. -#MOC = /usr/lib/x86_64-linux-gnu/qt4/bin/moc -LUAPLATFORM = linux + CXXFLAGS = $(shell pkg-config --cflags Qt5Core Qt5Widgets 2>/dev/null) -Wall -O4 + QTLDLIBS = $(shell pkg-config --libs Qt5Core Qt5Widgets 2>/dev/null) + MOC = $(shell pkg-config --variable=host_bins Qt5Core)/moc + ifeq ($(QTLDLIBS), ) + CXXFLAGS = $(shell pkg-config --cflags QtCore QtGui 2>/dev/null) -Wall -O4 + QTLDLIBS = $(shell pkg-config --libs QtCore QtGui 2>/dev/null) + MOC = $(shell pkg-config --variable=moc_location QtCore) + endif + ifeq ($(platform),Darwin) + LUAPLATFORM = macosx + else + LUALIB += -ldl + LDLIBS += -ltermcap -lncurses + LUAPLATFORM = linux + endif endif diff --git a/client/proxgui.h b/client/proxgui.h index 0d50a4f6..b8c4f6c4 100644 --- a/client/proxgui.h +++ b/client/proxgui.h @@ -8,7 +8,7 @@ // GUI functions //----------------------------------------------------------------------------- #include - +#include #ifdef __cplusplus extern "C" { #endif diff --git a/client/ui.c b/client/ui.c index c0d01bc3..bdaaf60c 100644 --- a/client/ui.c +++ b/client/ui.c @@ -18,7 +18,7 @@ #include "ui.h" -double CursorScaleFactor; +double CursorScaleFactor = 0; int PlotGridX, PlotGridY, PlotGridXdefault= 64, PlotGridYdefault= 64; int offline; int flushAfterWrite = 0; //buzzy diff --git a/client/ui/ui_overlays.h b/client/ui/ui_overlays.h index 6e652c12..83aa3e6c 100644 --- a/client/ui/ui_overlays.h +++ b/client/ui/ui_overlays.h @@ -10,19 +10,19 @@ #define OVERLAYSTQ7020_H #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include QT_BEGIN_NAMESPACE @@ -198,19 +198,19 @@ public: void retranslateUi(QWidget *Form) { - Form->setWindowTitle(QApplication::translate("Form", "Overlays", 0, QApplication::UnicodeUTF8)); - label->setText(QApplication::translate("Form", "Window size", 0, QApplication::UnicodeUTF8)); + Form->setWindowTitle(QApplication::translate("Form", "Overlays", 0)); + label->setText(QApplication::translate("Form", "Window size", 0)); label_5->setText(QString()); - tabWidget_overlays->setTabText(tabWidget_overlays->indexOf(tab), QApplication::translate("Form", "Autocorrelate", 0, QApplication::UnicodeUTF8)); - tabWidget_overlays->setTabText(tabWidget_overlays->indexOf(tab_3), QApplication::translate("Form", "Askdemod", 0, QApplication::UnicodeUTF8)); - label_2->setText(QApplication::translate("Form", "Up", 0, QApplication::UnicodeUTF8)); + tabWidget_overlays->setTabText(tabWidget_overlays->indexOf(tab), QApplication::translate("Form", "Autocorrelate", 0)); + tabWidget_overlays->setTabText(tabWidget_overlays->indexOf(tab_3), QApplication::translate("Form", "Askdemod", 0)); + label_2->setText(QApplication::translate("Form", "Up", 0)); label_6->setText(QString()); - label_3->setText(QApplication::translate("Form", "Down", 0, QApplication::UnicodeUTF8)); + label_3->setText(QApplication::translate("Form", "Down", 0)); label_7->setText(QString()); - tabWidget_overlays->setTabText(tabWidget_overlays->indexOf(tab_2), QApplication::translate("Form", "Dirthreshold", 0, QApplication::UnicodeUTF8)); - pushButton_apply->setText(QApplication::translate("Form", "Apply", 0, QApplication::UnicodeUTF8)); - pushButton_sticky->setText(QApplication::translate("Form", "Sticky", 0, QApplication::UnicodeUTF8)); - label_4->setText(QApplication::translate("Form", "TextLabel", 0, QApplication::UnicodeUTF8)); + tabWidget_overlays->setTabText(tabWidget_overlays->indexOf(tab_2), QApplication::translate("Form", "Dirthreshold", 0)); + pushButton_apply->setText(QApplication::translate("Form", "Apply", 0)); + pushButton_sticky->setText(QApplication::translate("Form", "Sticky", 0)); + label_4->setText(QApplication::translate("Form", "TextLabel", 0)); } // retranslateUi };