Browse Source

No more warnings. Enable -Werror. Yay!

Julius Pfrommer 11 years ago
parent
commit
62403a5750
4 changed files with 6 additions and 4 deletions
  1. 2 2
      Makefile.am
  2. 1 1
      src/UA_stack.c
  3. 1 0
      src/UA_stackInternalTypes.c
  4. 2 1
      src/opcua_basictypes.c

+ 2 - 2
Makefile.am

@@ -1,8 +1,8 @@
 
 if DEBUG
-AM_CFLAGS = -g -O0 -std=c99 -pedantic -pipe -fPIC -fno-exceptions -fstack-protector -Wl,-z,relro -Wl,-z,now -fvisibility=hidden -W -Wall -Wno-unused-parameter -Wno-unused-function -Wno-unused-label -Wpointer-arith -Wformat -Wreturn-type -Wsign-compare -Wmultichar -Wformat-nonliteral -Winit-self -Wuninitialized -Wno-deprecated -Wformat-security
+AM_CFLAGS = -g -O0 -std=c99 -pedantic -pipe -fPIC -fno-exceptions -fstack-protector -Wl,-z,relro -Wl,-z,now -fvisibility=hidden -W -Wall -Wno-unused-parameter -Wno-unused-function -Wno-unused-label -Wpointer-arith -Wformat -Wreturn-type -Wsign-compare -Wmultichar -Wformat-nonliteral -Winit-self -Wuninitialized -Wno-deprecated -Wformat-security -Werror
 else
-AM_CFLAGS = -g -O2 -std=c99 -pedantic -pipe -fPIC -fno-exceptions -fstack-protector -Wl,-z,relro -Wl,-z,now -fvisibility=hidden -W -Wall -Wno-unused-parameter -Wno-unused-function -Wno-unused-label -Wpointer-arith -Wformat -Wreturn-type -Wsign-compare -Wmultichar -Wformat-nonliteral -Winit-self -Wuninitialized -Wno-deprecated -Wformat-security
+AM_CFLAGS = -g -O2 -std=c99 -pedantic -pipe -fPIC -fno-exceptions -fstack-protector -Wl,-z,relro -Wl,-z,now -fvisibility=hidden -W -Wall -Wno-unused-parameter -Wno-unused-function -Wno-unused-label -Wpointer-arith -Wformat -Wreturn-type -Wsign-compare -Wmultichar -Wformat-nonliteral -Winit-self -Wuninitialized -Wno-deprecated -Wformat-security -Werror
 endif
 
 export GLOBAL_AM_CFLAGS = $(AM_CFLAGS)

+ 1 - 1
src/UA_stack.c

@@ -63,7 +63,7 @@ UA_Int32 UA_TL_TCP_write(struct T_TL_connection* c, UA_ByteString* msg) {
 	UA_ByteString_printx("write data:", msg);
 	int nWritten = 0;
 	while (nWritten < msg->length) {
-		int n;
+		int n=0;
 		do {
 			n = write(c->connectionHandle, &(msg->data[n]), msg->length-n);
 		} while (n == -1L && errno == EINTR);

+ 1 - 0
src/UA_stackInternalTypes.c

@@ -1,4 +1,5 @@
 #include "UA_stackInternalTypes.h"
+#include "stdio.h"
 
 UA_Int32 UA_MessageType_calcSize(UA_MessageType const * ptr){
 	if(ptr==UA_NULL){return sizeof(UA_MessageType);}

+ 2 - 1
src/opcua_basictypes.c

@@ -82,8 +82,9 @@ UA_Int32 UA_Array_new(void **p,UA_Int32 noElements, UA_Int32 type) {
 	// Then allocate all the elements. We could allocate all the members in one chunk and
 	// calculate the addresses to prevent memory segmentation. This would however not call
 	// init for each member
+	void *arr = *p;
 	for(i=0; i<noElements; i++) {
-		retval |= UA_[type].new((void**)(*p + i * sizeof(void*)));
+		retval |= UA_[type].new((void**)arr+i);
 	}
 	return retval;
 }