Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

fixing warnings - making warnings into errors and some other small things #39

Closed
wants to merge 1 commit into from

1 participant

@clive

...ooth (she's a SAINT people!) is using 686

Added java include for jni.h to makefile, added -Wno-unknown-pragmas to stop gcc complaining about effete Xcode org hints, added -Werror because that's how real men compile.

Fixed a bunch of simple warnings. make is now warning free on x86_64

@clive clive added a makefile for linux x86_64 - as of 2012, afaik, only Dorothy M…
…antooth (she's a SAINT people!) is using 686

Added java include for jni.h to makefile, added -Wno-unknown-pragmas to stop gcc complaining about effete Xcode org hints, added -Werror because that's how real men compile.

Fixed a bunch of simple warnings. make is now warning free on x86_64
a805343
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 22, 2012
  1. @clive

    added a makefile for linux x86_64 - as of 2012, afaik, only Dorothy M…

    clive authored
    …antooth (she's a SAINT people!) is using 686
    
    Added java include for jni.h to makefile, added -Wno-unknown-pragmas to stop gcc complaining about effete Xcode org hints, added -Werror because that's how real men compile.
    
    Fixed a bunch of simple warnings. make is now warning free on x86_64
This page is out of date. Refresh to see the latest.
View
4 src/ArrayArithmetic.h
@@ -379,7 +379,7 @@ class ArrayArithmetic {
res = _mm_div_ps(inVec0, inVec1);
_mm_store_ps(output + i, res);
}
- for (int i = startIndex + numFours<<2; i < endIndex; i++) {
+ for (int i = startIndex + (numFours<<2); i < endIndex; i++) {
output[i] = input0[i] / input1[i];
}
#else
@@ -401,7 +401,7 @@ class ArrayArithmetic {
res = _mm_div_ps(inVec, constVec);
_mm_store_ps(output + i, res);
}
- for (int i = startIndex + numFours<<2; i < endIndex; i++) {
+ for (int i = startIndex + (numFours<<2); i < endIndex; i++) {
output[i] = input[i] / constant;
}
#else
View
3  src/DspLog.cpp
@@ -85,6 +85,7 @@ void DspLog::processDspWithIndex(int fromIndex, int toIndex) {
// this implementation is reproduced from http://www.musicdsp.org/showone.php?id=91
float DspLog::log2Approx(float x) {
// input is assumed to be positive
- int y = (*(int *)&x);
+ //int y = (*(int *)&x);
+ int y = static_cast<int>(x);
return (((y & 0x7f800000)>>23)-0x7f)+(y & 0x007fffff)/(float)0x800000;
}
View
9 src/DspObject.cpp
@@ -97,7 +97,8 @@ ConnectionType DspObject::getConnectionType(int outletIndex) {
float *DspObject::getDspBufferRefAtOutlet(int outletIndex) {
// sanity check on outletIndex
- return (outletIndex < outgoingDspConnections.size()) ? dspBufferAtOutlet0 + (outletIndex * blockSizeInt) : NULL;
+ return (static_cast<unsigned int>(outletIndex) < outgoingDspConnections.size()) ?
+ dspBufferAtOutlet0 + (outletIndex * blockSizeInt) : NULL;
}
bool DspObject::doesProcessAudio() {
@@ -292,7 +293,7 @@ bool DspObject::isLeafNode() {
if (!MessageObject::isLeafNode()) {
return false;
} else {
- for (int i = 0; i < outgoingDspConnections.size(); i++) {
+ for (unsigned int i = 0; i < outgoingDspConnections.size(); i++) {
if (outgoingDspConnections[i].size() > 0) {
return false;
}
@@ -308,7 +309,7 @@ list<MessageObject *> *DspObject::getProcessOrder() {
} else {
isOrdered = true;
list<MessageObject *> *processList = new list<MessageObject *>();
- for (int i = 0; i < incomingMessageConnections.size(); i++) {
+ for (unsigned int i = 0; i < incomingMessageConnections.size(); i++) {
list<ObjectLetPair>::iterator it = incomingMessageConnections[i].begin();
list<ObjectLetPair>::iterator end = incomingMessageConnections[i].end();
while (it != end) {
@@ -318,7 +319,7 @@ list<MessageObject *> *DspObject::getProcessOrder() {
delete parentProcessList;
}
}
- for (int i = 0; i < incomingDspConnections.size(); i++) {
+ for (unsigned int i = 0; i < incomingDspConnections.size(); i++) {
list<ObjectLetPair>::iterator it = incomingDspConnections[i].begin();
list<ObjectLetPair>::iterator end = incomingDspConnections[i].end();
while (it != end) {
View
6 src/DspVariableDelay.cpp
@@ -56,8 +56,10 @@ void DspVariableDelay::processDspWithIndex(int fromIndex, int toIndex) {
int bufferLength;
float *buffer = delayline->getBuffer(&headIndex, &bufferLength);
float bufferLengthFloat = (float) bufferLength;
- float xArray[blockSizeInt];
- float targetIndexBaseArray[blockSizeInt];
+ // compiler thinks the following 2 are unused - mhroth get rid of them if
+ // really not needed
+ // float xArray[blockSizeInt];
+ // float targetIndexBaseArray[blockSizeInt];
float targetIndexBase = (float) (headIndex - blockSizeInt);
#if __APPLE__
View
7 src/Makefile
@@ -9,8 +9,11 @@ OBJS := $(foreach FILE,$(LOCAL_SRC_FILES),$(FILE:.cpp=.o))
SNDFILE_INCLUDE = `pkg-config --cflags sndfile`
SNDFILE_LIB = `pkg-config --libs sndfile`
+# modify your JAVA location here if necessary
+JAVAINCLUDE=/usr/lib/jvm/java-6-openjdk/include
+
# -g
-CXXFLAGS = -O3 -fPIC -Wall -I$(my-dir) $(SNDFILE_INCLUDE)
+CXXFLAGS = -O3 -fPIC -Wall -I$(my-dir) -I$(JAVAINCLUDE) $(SNDFILE_INCLUDE) -Wno-unknown-pragmas -Werror
# figure out what platform we're on
@@ -27,7 +30,7 @@ all %:
@ls Makefile.OS.*
@echo for example:
@echo '`OS=Linux-i386 make`'
- @echo or else make a Makefile.$(OS)
+ @echo or else make a Makefile.OS.$(OS)
else
View
5 src/Makefile.OS.Linux-x86_64
@@ -0,0 +1,5 @@
+#SUPPORTED_PLATFORM=1
+PLATFORM_TARGETS=libzengarden libzengarden-static libjnizengarden java-jar
+MAKE_SO=$(CC) -o $(1) $(CXXFLAGS) -shared $(2) $(3) $(SNDFILE_LIB) -lstdc++
+JNI_EXTENSION=so
+SO_EXTENSION=so
View
12 src/MessageMessageBox.cpp
@@ -46,7 +46,7 @@ MessageMessageBox::MessageMessageBox(char *initString, PdGraph *graph) : Message
// parse the first "message" for individual messages that should be sent from the outlet
vector<string> messageInitList = StaticUtils::tokenizeString((char *) messageInitListAll[0].c_str(), "\\,");
- for (int i = 0; i < messageInitList.size(); i++) {
+ for (unsigned int i = 0; i < messageInitList.size(); i++) {
string initString = messageInitList[i];
int maxElements = (initString.size()/2)+1;
// NOTE(mhroth): though this is alloca is in a for loop, it is not expected that the compiler
@@ -62,7 +62,7 @@ MessageMessageBox::MessageMessageBox(char *initString, PdGraph *graph) : Message
}
// parse the remainder of the init list for all remote messages
- for (int i = 1; i < messageInitListAll.size(); i++) {
+ for (unsigned int i = 1; i < messageInitListAll.size(); i++) {
string initString = messageInitListAll[i];
if (strcmp(initString.c_str(), ";") != 0) {
// NOTE(mhroth): name string is not resolved
@@ -82,12 +82,12 @@ MessageMessageBox::MessageMessageBox(char *initString, PdGraph *graph) : Message
MessageMessageBox::~MessageMessageBox() {
// delete the message list and all of the messages in it
- for (int i = 0; i < localMessageList.size(); i++) {
+ for (unsigned int i = 0; i < localMessageList.size(); i++) {
localMessageList.at(i)->freeMessage();
}
// delete the remote message list
- for (int i = 0; i < remoteMessageList.size(); i++) {
+ for (unsigned int i = 0; i < remoteMessageList.size(); i++) {
MessageNamedDestination namedDestination = remoteMessageList.at(i);
free(namedDestination.first);
namedDestination.second->freeMessage();
@@ -106,7 +106,7 @@ void MessageMessageBox::processMessage(int inletIndex, PdMessage *message) {
PdMessage *outgoingMessage = PD_MESSAGE_ON_STACK(64);
// send local messages
- for (int i = 0; i < localMessageList.size(); i++) {
+ for (unsigned int i = 0; i < localMessageList.size(); i++) {
PdMessage *messageTemplate = localMessageList.at(i);
int numElements = messageTemplate->getNumElements();
outgoingMessage->initWithTimestampAndNumElements(message->getTimestamp(), numElements);
@@ -123,7 +123,7 @@ void MessageMessageBox::processMessage(int inletIndex, PdMessage *message) {
}
// send remote messages
- for (int i = 0; i < remoteMessageList.size(); i++) {
+ for (unsigned int i = 0; i < remoteMessageList.size(); i++) {
MessageNamedDestination namedDestination = remoteMessageList.at(i);
PdMessage::resolveString(namedDestination.first, message, 1, resolvedName, RES_BUFFER_LENGTH);
View
8 src/MessageObject.cpp
@@ -185,7 +185,7 @@ void MessageObject::setCanvasPosition(float x, float y) {
}
bool MessageObject::isLeafNode() {
- for (int i = 0; i < outgoingMessageConnections.size(); i++) {
+ for (unsigned int i = 0; i < outgoingMessageConnections.size(); i++) {
if (!outgoingMessageConnections[i].empty()) return false;
}
return true;
@@ -198,7 +198,7 @@ list<MessageObject *> *MessageObject::getProcessOrder() {
} else {
isOrdered = true;
list<MessageObject *> *processList = new list<MessageObject *>();
- for (int i = 0; i < incomingMessageConnections.size(); i++) {
+ for (unsigned int i = 0; i < incomingMessageConnections.size(); i++) {
list<ObjectLetPair>::iterator it = incomingMessageConnections[i].begin();
list<ObjectLetPair>::iterator end = incomingMessageConnections[i].end();
while (it != end) {
@@ -221,7 +221,7 @@ void MessageObject::updateIncomingMessageConnection(MessageObject *messageObject
int inletIndex, int newOutletIndex) {
/*
vector<ObjectLetPair> incomingMessageConnectionsList = incomingMessageConnections[inletIndex];
- for (int i = 0; i < incomingMessageConnectionsList.size(); i++) {
+ for (unsigned int i = 0; i < incomingMessageConnectionsList.size(); i++) {
ObjectLetPair *objectLetPair = (ObjectLetPair *) incomingMessageConnectionsList->get(i);
if (objectLetPair->object == messageObject &&
objectLetPair->index == oldOutletIndex) {
@@ -237,7 +237,7 @@ void MessageObject::updateOutgoingMessageConnection(MessageObject *messageObject
/*
List *outgoingMessageConnectionsList = (List *) outgoingMessageConnections[outletIndex];
int numConnections = outgoingMessageConnectionsList->size();
- for (int i = 0; i < numConnections; i++) {
+ for (unsigned int i = 0; i < numConnections; i++) {
ObjectLetPair *objectLetPair = (ObjectLetPair *) outgoingMessageConnectionsList->get(i);
if (objectLetPair->object == messageObject &&
objectLetPair->index == oldInletIndex) {
View
2  src/MessageSendController.cpp
@@ -50,7 +50,7 @@ int MessageSendController::getNameIndex(const char *receiverName) {
return SYSTEM_NAME_INDEX; // a special case for sending messages to the system
}
- for (int i = 0; i < sendStack.size(); i++) {
+ for (unsigned int i = 0; i < sendStack.size(); i++) {
string str = sendStack[i].first;
if (!str.compare(receiverName)) return i;
}
View
2  src/OrderedMessageQueue.cpp
@@ -59,7 +59,7 @@ void OrderedMessageQueue::removeMessage(MessageObject *messageObject, int outlet
ObjectMessageLetPair omlPair = *it;
if (omlPair.first == messageObject &&
omlPair.second.first == message &&
- omlPair.second.second == outletIndex) {
+ omlPair.second.second == static_cast<unsigned int>(outletIndex)) {
orderedMessageQueue.erase(it);
return;
} else {
View
2  src/PdContext.cpp
@@ -76,7 +76,7 @@ PdContext::~PdContext() {
delete objectFactoryMap;
// delete all of the PdGraphs in the graph list
- for (int i = 0; i < graphList.size(); i++) {
+ for (unsigned int i = 0; i < graphList.size(); i++) {
delete graphList[i];
}
View
8 src/PdFileParser.cpp
@@ -37,10 +37,14 @@ PdFileParser::PdFileParser(const char *filePath) {
long int posStart = ftell(fp);
fseek(fp, 0, SEEK_END);
long int posEnd = ftell(fp);
- int numChars = posEnd - posStart;
+ unsigned int numChars = posEnd - posStart;
char str[numChars+1];
fseek(fp, 0, SEEK_SET); // seek back to the beginning of the file
- fread(str, sizeof(char), numChars, fp); // read the whole file into memory
+ size_t result =fread(str, sizeof(char), numChars, fp);
+ if (result != numChars) {
+ printf("read error - dying");
+ exit(1);
+ }
fclose(fp); // close the file
str[numChars] = '\0';
stringDesc = string(str);
View
4 src/PdGraph.cpp
@@ -139,7 +139,7 @@ void PdGraph::removeObject(MessageObject *object) {
if (*it == object) {
// remove all incoming connections
- for (int i = 0; i < object->getNumInlets(); i++) {
+ for (unsigned int i = 0; i < object->getNumInlets(); i++) {
list<ObjectLetPair> incomingConnections = object->getIncomingConnections(i);
list<ObjectLetPair>::iterator lit = incomingConnections.begin();
list<ObjectLetPair>::iterator lend = incomingConnections.end();
@@ -150,7 +150,7 @@ void PdGraph::removeObject(MessageObject *object) {
}
// remove all outgoing connections
- for (int i = 0; i < object->getNumOutlets(); i++) {
+ for (unsigned int i = 0; i < object->getNumOutlets(); i++) {
list<ObjectLetPair> outgoingConnections = object->getOutgoingConnections(i);
list<ObjectLetPair>::iterator lit = outgoingConnections.begin();
list<ObjectLetPair>::iterator lend = outgoingConnections.end();
View
18 src/PdMessage.cpp
@@ -57,7 +57,7 @@ void PdMessage::parseAndSetMessageElement(unsigned int index, char *token) {
void PdMessage::resolveString(char *initString, PdMessage *arguments, unsigned int offset,
char *buffer, unsigned int bufferLength) {
- int bufferPos = 0;
+ unsigned int bufferPos = 0; // we only ever increment bufferPos so it's ok for it to be unsigned
int initPos = 0;
char *argPos = NULL;
int numCharsWritten = 0;
@@ -202,7 +202,7 @@ void PdMessage::initWithTimestampAndBang(double aTimestamp) {
setBang(0);
}
-void PdMessage::initWithTimestampAndSymbol(double aTimestamp, char *symbol) {
+void PdMessage::initWithTimestampAndSymbol(double aTimestamp, const char *symbol) {
timestamp = aTimestamp;
numElements = 1;
setSymbol(0, symbol);
@@ -212,7 +212,7 @@ void PdMessage::initWithTimestampAndSymbol(double aTimestamp, char *symbol) {
#pragma mark -
#pragma mark isElement
-bool PdMessage::isFloat(unsigned int index) {
+bool PdMessage::isFloat(int index) {
if (index < numElements) {
return ((&messageAtom)[index].type == FLOAT);
} else {
@@ -220,7 +220,7 @@ bool PdMessage::isFloat(unsigned int index) {
}
}
-bool PdMessage::isSymbol(unsigned int index) {
+bool PdMessage::isSymbol(int index) {
if (index < numElements) {
return ((&messageAtom)[index].type == SYMBOL);
} else {
@@ -228,7 +228,7 @@ bool PdMessage::isSymbol(unsigned int index) {
}
}
-bool PdMessage::isSymbol(unsigned int index, const char *test) {
+bool PdMessage::isSymbol(int index, const char *test) {
if (index < numElements) {
MessageAtom messageElement = (&messageAtom)[index];
if (messageElement.type == SYMBOL) {
@@ -241,7 +241,7 @@ bool PdMessage::isSymbol(unsigned int index, const char *test) {
}
}
-bool PdMessage::isBang(unsigned int index) {
+bool PdMessage::isBang( int index) {
if (index < numElements) {
return ((&messageAtom)[index].type == BANG);
} else {
@@ -249,7 +249,7 @@ bool PdMessage::isBang(unsigned int index) {
}
}
-MessageElementType PdMessage::getType(unsigned int index) {
+MessageElementType PdMessage::getType(int index) {
if (index < numElements) {
return (&messageAtom)[index].type;
} else {
@@ -274,9 +274,9 @@ char *PdMessage::getSymbol(unsigned int index) {
return (&messageAtom)[index].symbol;
}
-void PdMessage::setSymbol(unsigned int index, char *symbol) {
+void PdMessage::setSymbol(unsigned int index, const char *symbol) {
(&messageAtom)[index].type = SYMBOL;
- (&messageAtom)[index].symbol = symbol;
+ (&messageAtom)[index].symbol = const_cast<char*>(symbol);
}
void PdMessage::setBang(unsigned int index) {
View
14 src/PdMessage.h
@@ -67,7 +67,7 @@ class PdMessage {
void initWithTimestampAndNumElements(double aTimestamp, unsigned int numElem);
void initWithTimestampAndFloat(double aTimestamp, float constant);
void initWithTimestampAndBang(double aTimestamp);
- void initWithTimestampAndSymbol(double aTimestamp, char *symbol);
+ void initWithTimestampAndSymbol(double aTimestamp, const char *symbol);
/**
* Initialise the message with a string, arguments, and a resolution buffer. The string will
@@ -117,11 +117,11 @@ class PdMessage {
char *toString();
/** Convenience function to determine if a particular message element is a float. */
- bool isFloat(unsigned int index);
- bool isSymbol(unsigned int index);
- bool isSymbol(unsigned int index, const char *test);
- bool isBang(unsigned int index);
- MessageElementType getType(unsigned int index);
+ bool isFloat(int index);
+ bool isSymbol(int index);
+ bool isSymbol(int index, const char *test);
+ bool isBang(int index);
+ MessageElementType getType(int index);
/**
* Convenience function to get the float value from a particular message element. The user
@@ -136,7 +136,7 @@ class PdMessage {
* for the existence of a message element.
*/
void setFloat(unsigned int index, float value);
- void setSymbol(unsigned int index, char *symbol);
+ void setSymbol(unsigned int index, const char *symbol);
void setBang(unsigned int index);
void setAnything(unsigned int index);
void setList(unsigned int index);
View
1  src/ZenGarden.cpp
@@ -395,7 +395,6 @@ unsigned int zg_graph_get_dollar_zero(ZGGraph *graph) {
ZGObject **zg_graph_get_objects(ZGGraph *graph, unsigned int *n) {
list<MessageObject *> nodeList = graph->getNodeList();
list<MessageObject *>::iterator it = nodeList.begin();
- list<MessageObject *>::iterator end = nodeList.end();
*n = (unsigned int) nodeList.size();
ZGObject **nodeArray = (ZGObject **) malloc(nodeList.size() * sizeof(ZGObject *));
for (unsigned int i = 0; i < *n; i++, it++) {
Something went wrong with that request. Please try again.