Browse Source

Update Doxyconf
Fix build issues now compilable on win32

semlanik 7 years ago
parent
commit
d6c34c80b9
5 changed files with 27 additions and 12 deletions
  1. 0 1
      portable_endian.h
  2. 20 8
      ubx.c
  3. 2 2
      ubxproto.doxyconf
  4. 4 0
      ubxproto.pro
  5. 1 1
      ubxutils.h

+ 0 - 1
portable_endian.h

@@ -59,7 +59,6 @@
 #elif defined(__WINDOWS__)
 
 #	include <winsock2.h>
-#	include <sys/param.h>
 
 #	if BYTE_ORDER == LITTLE_ENDIAN
 

+ 20 - 8
ubx.c

@@ -41,6 +41,11 @@ void fletcherChecksum(unsigned char* buffer, int size, unsigned char* checkSumA,
     }
 }
 
+extern void clearBuffer(const UBXMsgBuffer* buffer)
+{
+    free(buffer->data);
+}
+
 void completeMsg(UBXMsgBuffer* buffer, int payloadSize)
 {
     unsigned char* checkSumA = (unsigned char*)(buffer->data + UBX_HEADER_SIZE  + payloadSize);
@@ -60,7 +65,7 @@ UBXMsgBuffer createBuffer(int payloadSize)
 {
     UBXMsgBuffer buffer = {0, 0};
     buffer.size = UBX_HEADER_SIZE + payloadSize + UBX_CHECKSUM_SIZE;
-    buffer.data = malloc(buffer.size);
+    buffer.data = (char*)malloc(buffer.size);
     memset(buffer.data, 0, buffer.size);
     return buffer;
 }
@@ -68,14 +73,18 @@ UBXMsgBuffer createBuffer(int payloadSize)
 UBXMsgBuffer getAID_ALPSRV(UBXMsg* clientMgs, const UBXAlpFileInfo *fileInfo)
 {
     int requestedAlpSize = (clientMgs->payload.AID_ALPSRV.size << 1);
+    int alpMsgSize = 0;
+    int payloadSize = 0;
+    UBXMsgBuffer buffer;
+    UBXMsg* msg = 0;
     if(fileInfo->dataSize < (clientMgs->payload.AID_ALPSRV.offset + requestedAlpSize))
     {
         requestedAlpSize = fileInfo->dataSize - clientMgs->payload.AID_ALPSRV.offset - 1;
     }
-    int alpMsgSize = sizeof(UBXAID_ALPSRV);
-    int payloadSize = alpMsgSize + requestedAlpSize;
-    UBXMsgBuffer buffer  = createBuffer(payloadSize);
-    UBXMsg* msg = (UBXMsg*) buffer.data;
+    alpMsgSize = sizeof(UBXAID_ALPSRV);
+    payloadSize = alpMsgSize + requestedAlpSize;
+    buffer = createBuffer(payloadSize);
+    msg = (UBXMsg*) buffer.data;
 
     if(requestedAlpSize < 0)
     {
@@ -1016,6 +1025,9 @@ UBXMsgBuffer getCFG_USB(UBXU2_t vendorId,
     int payloadSize = sizeof(UBXCFG_USB);
     UBXMsgBuffer buffer = createBuffer(payloadSize);
     UBXMsg* msg = (UBXMsg*)buffer.data;
+    int vendorStringSize = 0;
+    int productStringSize = 0;
+    int serialNumberSize = 0;
     initMsg(msg, payloadSize, UBXMsgClassCFG, UBXMsgIdCFG_USB);
     msg->payload.CFG_USB.vendorId = vendorId;
     msg->payload.CFG_USB.productId = productId;
@@ -1023,13 +1035,13 @@ UBXMsgBuffer getCFG_USB(UBXU2_t vendorId,
     msg->payload.CFG_USB.reserved2 = 1;
     msg->payload.CFG_USB.powerConsumption = powerConsumption;
     msg->payload.CFG_USB.flags = flags;
-    int vendorStringSize = strlen(vendorString)>32?32:strlen(vendorString);
+    vendorStringSize = strlen(vendorString)>32?32:strlen(vendorString);
     memcpy(msg->payload.CFG_USB.vendorString, vendorString, vendorStringSize);
 
-    int productStringSize = strlen(productString)>32?32:strlen(productString);
+    productStringSize = strlen(productString)>32?32:strlen(productString);
     memcpy(msg->payload.CFG_USB.productString, productString, productStringSize);
 
-    int serialNumberSize = strlen(serialNumber)>32?32:strlen(serialNumber);
+    serialNumberSize = strlen(serialNumber)>32?32:strlen(serialNumber);
     memcpy(msg->payload.CFG_USB.serialNumber, serialNumber, serialNumberSize);
 
     completeMsg(&buffer, payloadSize);

+ 2 - 2
ubxproto.doxyconf

@@ -54,7 +54,7 @@ Receiver Protocol Specification V14
 # If a relative path is entered, it will be relative to the location
 # where doxygen was started. If left blank the current directory will be used.
 
-#OUTPUT_DIRECTORY       = ./doc
+OUTPUT_DIRECTORY       = ./doc
 
 # If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
 # 4096 sub-directories (in 2 levels) under the output directory of each output
@@ -670,7 +670,7 @@ WARN_LOGFILE           =
 # directories like "/usr/src/myproject". Separate the files or directories
 # with spaces.
 
-INPUT                  = /home/semlanik/Projects/ubxproto/
+INPUT                  = ./
 
 # This tag can be used to specify the character encoding of the source files
 # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is

+ 4 - 0
ubxproto.pro

@@ -32,3 +32,7 @@ MOC_DIR = .moc
 DEPLOYMENT += header_files target
 INSTALLS += header_files
 INSTALLS += target
+
+win32 {
+    LIBS += ws2_32
+}

+ 1 - 1
ubxutils.h

@@ -36,7 +36,7 @@ extern "C"
 
 //Additional API will be replaced with checkMessage(const UBXMsgBuffer* buffer);
 extern void fletcherChecksum(unsigned char* buffer, int size, unsigned char* checkSumA, unsigned char* checkSumB);
-
+extern void clearBuffer(const UBXMsgBuffer *buffer);
 #ifdef __cplusplus
 }
 #endif