mirror of
https://github.com/Martin-P/OpenV2G.git
synced 2024-11-08 12:45:42 +00:00
* switch off pedantic warnings
* remove unnecessary code string value code git-svn-id: https://svn.code.sf.net/p/openv2g/code/trunk@87 d9f2db14-54d0-4bde-b00c-16405c910529
This commit is contained in:
parent
c3dab49523
commit
fafba1ecd0
13 changed files with 12 additions and 368 deletions
|
@ -5,12 +5,12 @@
|
|||
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.mingw.exe.debug.181718907" moduleId="org.eclipse.cdt.core.settings" name="Debug">
|
||||
<externalSettings/>
|
||||
<extensions>
|
||||
<extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
</extensions>
|
||||
</storageModule>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
|
@ -36,7 +36,7 @@
|
|||
</option>
|
||||
<option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.option.optimization.level.1880660058" name="Optimization Level" superClass="gnu.c.compiler.option.optimization.level" valueType="enumerated"/>
|
||||
<option id="gnu.c.compiler.option.debugging.level.890071608" name="Debug Level" superClass="gnu.c.compiler.option.debugging.level" value="gnu.c.debugging.level.max" valueType="enumerated"/>
|
||||
<option id="gnu.c.compiler.option.warnings.pedantic.1983095151" name="Pedantic (-pedantic)" superClass="gnu.c.compiler.option.warnings.pedantic" value="true" valueType="boolean"/>
|
||||
<option id="gnu.c.compiler.option.warnings.pedantic.1983095151" name="Pedantic (-pedantic)" superClass="gnu.c.compiler.option.warnings.pedantic" value="false" valueType="boolean"/>
|
||||
<option id="gnu.c.compiler.option.misc.ansi.1916749690" name="Support ANSI programs (-ansi)" superClass="gnu.c.compiler.option.misc.ansi" value="true" valueType="boolean"/>
|
||||
<option id="gnu.c.compiler.option.warnings.toerrors.990186240" name="Warnings as errors (-Werror)" superClass="gnu.c.compiler.option.warnings.toerrors" value="false" valueType="boolean"/>
|
||||
<option id="gnu.c.compiler.option.warnings.pedantic.error.145905553" name="Pedantic warnings as errors (-pedantic-errors)" superClass="gnu.c.compiler.option.warnings.pedantic.error" value="false" valueType="boolean"/>
|
||||
|
@ -64,12 +64,12 @@
|
|||
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.mingw.exe.release.681614450" moduleId="org.eclipse.cdt.core.settings" name="Release">
|
||||
<externalSettings/>
|
||||
<extensions>
|
||||
<extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
</extensions>
|
||||
</storageModule>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
|
@ -96,7 +96,7 @@
|
|||
<option defaultValue="gnu.c.optimization.level.most" id="gnu.c.compiler.option.optimization.level.899621054" name="Optimization Level" superClass="gnu.c.compiler.option.optimization.level" value="gnu.c.optimization.level.size" valueType="enumerated"/>
|
||||
<option id="gnu.c.compiler.option.debugging.level.1251127335" name="Debug Level" superClass="gnu.c.compiler.option.debugging.level" value="gnu.c.debugging.level.none" valueType="enumerated"/>
|
||||
<option id="gnu.c.compiler.option.misc.ansi.496561434" name="Support ANSI programs (-ansi)" superClass="gnu.c.compiler.option.misc.ansi" value="false" valueType="boolean"/>
|
||||
<option id="gnu.c.compiler.option.warnings.pedantic.289278524" name="Pedantic (-pedantic)" superClass="gnu.c.compiler.option.warnings.pedantic" value="true" valueType="boolean"/>
|
||||
<option id="gnu.c.compiler.option.warnings.pedantic.289278524" name="Pedantic (-pedantic)" superClass="gnu.c.compiler.option.warnings.pedantic" value="false" valueType="boolean"/>
|
||||
<option id="gnu.c.compiler.option.warnings.pedantic.error.822372173" name="Pedantic warnings as errors (-pedantic-errors)" superClass="gnu.c.compiler.option.warnings.pedantic.error" value="false" valueType="boolean"/>
|
||||
<option id="gnu.c.compiler.option.optimization.flags.1051939537" name="Other optimization flags" superClass="gnu.c.compiler.option.optimization.flags" value="" valueType="string"/>
|
||||
<option id="gnu.c.compiler.option.misc.other.1470884128" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0" valueType="string"/>
|
||||
|
|
|
@ -23,7 +23,7 @@ C_DEPS += \
|
|||
src/appHandshake/%.o: ../src/appHandshake/%.c
|
||||
@echo 'Building file: $<'
|
||||
@echo 'Invoking: GCC C Compiler'
|
||||
gcc -I"../src/codec" -I"../src/appHandshake" -I"../src/transport" -I"../src/test" -O0 -g3 -pedantic -Wall -c -fmessage-length=0 -ansi -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o "$@" "$<"
|
||||
gcc -I"../src/codec" -I"../src/appHandshake" -I"../src/transport" -I"../src/test" -O0 -g3 -Wall -c -fmessage-length=0 -ansi -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o "$@" "$<"
|
||||
@echo 'Finished building: $<'
|
||||
@echo ' '
|
||||
|
||||
|
|
|
@ -16,7 +16,6 @@ C_SRCS += \
|
|||
../src/codec/EXIHeaderDecoder.c \
|
||||
../src/codec/EXIHeaderEncoder.c \
|
||||
../src/codec/MethodsBag.c \
|
||||
../src/codec/StringValueTable.c \
|
||||
../src/codec/v2gEXIDatatypes.c \
|
||||
../src/codec/v2gEXIDatatypesDecoder.c \
|
||||
../src/codec/v2gEXIDatatypesEncoder.c
|
||||
|
@ -34,7 +33,6 @@ OBJS += \
|
|||
./src/codec/EXIHeaderDecoder.o \
|
||||
./src/codec/EXIHeaderEncoder.o \
|
||||
./src/codec/MethodsBag.o \
|
||||
./src/codec/StringValueTable.o \
|
||||
./src/codec/v2gEXIDatatypes.o \
|
||||
./src/codec/v2gEXIDatatypesDecoder.o \
|
||||
./src/codec/v2gEXIDatatypesEncoder.o
|
||||
|
@ -52,7 +50,6 @@ C_DEPS += \
|
|||
./src/codec/EXIHeaderDecoder.d \
|
||||
./src/codec/EXIHeaderEncoder.d \
|
||||
./src/codec/MethodsBag.d \
|
||||
./src/codec/StringValueTable.d \
|
||||
./src/codec/v2gEXIDatatypes.d \
|
||||
./src/codec/v2gEXIDatatypesDecoder.d \
|
||||
./src/codec/v2gEXIDatatypesEncoder.d
|
||||
|
@ -62,7 +59,7 @@ C_DEPS += \
|
|||
src/codec/%.o: ../src/codec/%.c
|
||||
@echo 'Building file: $<'
|
||||
@echo 'Invoking: GCC C Compiler'
|
||||
gcc -I"../src/codec" -I"../src/appHandshake" -I"../src/transport" -I"../src/test" -O0 -g3 -pedantic -Wall -c -fmessage-length=0 -ansi -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o "$@" "$<"
|
||||
gcc -I"../src/codec" -I"../src/appHandshake" -I"../src/transport" -I"../src/test" -O0 -g3 -Wall -c -fmessage-length=0 -ansi -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o "$@" "$<"
|
||||
@echo 'Finished building: $<'
|
||||
@echo ' '
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ C_DEPS += \
|
|||
src/test/%.o: ../src/test/%.c
|
||||
@echo 'Building file: $<'
|
||||
@echo 'Invoking: GCC C Compiler'
|
||||
gcc -I"../src/codec" -I"../src/appHandshake" -I"../src/transport" -I"../src/test" -O0 -g3 -pedantic -Wall -c -fmessage-length=0 -ansi -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o "$@" "$<"
|
||||
gcc -I"../src/codec" -I"../src/appHandshake" -I"../src/transport" -I"../src/test" -O0 -g3 -Wall -c -fmessage-length=0 -ansi -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o "$@" "$<"
|
||||
@echo 'Finished building: $<'
|
||||
@echo ' '
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ C_DEPS += \
|
|||
src/transport/%.o: ../src/transport/%.c
|
||||
@echo 'Building file: $<'
|
||||
@echo 'Invoking: GCC C Compiler'
|
||||
gcc -I"../src/codec" -I"../src/appHandshake" -I"../src/transport" -I"../src/test" -O0 -g3 -pedantic -Wall -c -fmessage-length=0 -ansi -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o "$@" "$<"
|
||||
gcc -I"../src/codec" -I"../src/appHandshake" -I"../src/transport" -I"../src/test" -O0 -g3 -Wall -c -fmessage-length=0 -ansi -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o "$@" "$<"
|
||||
@echo 'Finished building: $<'
|
||||
@echo ' '
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ C_DEPS += \
|
|||
src/appHandshake/%.o: ../src/appHandshake/%.c
|
||||
@echo 'Building file: $<'
|
||||
@echo 'Invoking: GCC C Compiler'
|
||||
gcc -I"../src/codec" -I"../src/appHandshake" -I"../src/transport" -I"../src/test" -Os -pedantic -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o "$@" "$<"
|
||||
gcc -I"../src/codec" -I"../src/appHandshake" -I"../src/transport" -I"../src/test" -Os -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o "$@" "$<"
|
||||
@echo 'Finished building: $<'
|
||||
@echo ' '
|
||||
|
||||
|
|
|
@ -16,7 +16,6 @@ C_SRCS += \
|
|||
../src/codec/EXIHeaderDecoder.c \
|
||||
../src/codec/EXIHeaderEncoder.c \
|
||||
../src/codec/MethodsBag.c \
|
||||
../src/codec/StringValueTable.c \
|
||||
../src/codec/v2gEXIDatatypes.c \
|
||||
../src/codec/v2gEXIDatatypesDecoder.c \
|
||||
../src/codec/v2gEXIDatatypesEncoder.c
|
||||
|
@ -34,7 +33,6 @@ OBJS += \
|
|||
./src/codec/EXIHeaderDecoder.o \
|
||||
./src/codec/EXIHeaderEncoder.o \
|
||||
./src/codec/MethodsBag.o \
|
||||
./src/codec/StringValueTable.o \
|
||||
./src/codec/v2gEXIDatatypes.o \
|
||||
./src/codec/v2gEXIDatatypesDecoder.o \
|
||||
./src/codec/v2gEXIDatatypesEncoder.o
|
||||
|
@ -52,7 +50,6 @@ C_DEPS += \
|
|||
./src/codec/EXIHeaderDecoder.d \
|
||||
./src/codec/EXIHeaderEncoder.d \
|
||||
./src/codec/MethodsBag.d \
|
||||
./src/codec/StringValueTable.d \
|
||||
./src/codec/v2gEXIDatatypes.d \
|
||||
./src/codec/v2gEXIDatatypesDecoder.d \
|
||||
./src/codec/v2gEXIDatatypesEncoder.d
|
||||
|
@ -62,7 +59,7 @@ C_DEPS += \
|
|||
src/codec/%.o: ../src/codec/%.c
|
||||
@echo 'Building file: $<'
|
||||
@echo 'Invoking: GCC C Compiler'
|
||||
gcc -I"../src/codec" -I"../src/appHandshake" -I"../src/transport" -I"../src/test" -Os -pedantic -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o "$@" "$<"
|
||||
gcc -I"../src/codec" -I"../src/appHandshake" -I"../src/transport" -I"../src/test" -Os -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o "$@" "$<"
|
||||
@echo 'Finished building: $<'
|
||||
@echo ' '
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ C_DEPS += \
|
|||
src/test/%.o: ../src/test/%.c
|
||||
@echo 'Building file: $<'
|
||||
@echo 'Invoking: GCC C Compiler'
|
||||
gcc -I"../src/codec" -I"../src/appHandshake" -I"../src/transport" -I"../src/test" -Os -pedantic -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o "$@" "$<"
|
||||
gcc -I"../src/codec" -I"../src/appHandshake" -I"../src/transport" -I"../src/test" -Os -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o "$@" "$<"
|
||||
@echo 'Finished building: $<'
|
||||
@echo ' '
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ C_DEPS += \
|
|||
src/transport/%.o: ../src/transport/%.c
|
||||
@echo 'Building file: $<'
|
||||
@echo 'Invoking: GCC C Compiler'
|
||||
gcc -I"../src/codec" -I"../src/appHandshake" -I"../src/transport" -I"../src/test" -Os -pedantic -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o "$@" "$<"
|
||||
gcc -I"../src/codec" -I"../src/appHandshake" -I"../src/transport" -I"../src/test" -Os -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o "$@" "$<"
|
||||
@echo 'Finished building: $<'
|
||||
@echo ' '
|
||||
|
||||
|
|
|
@ -39,8 +39,6 @@
|
|||
/*#include "v2gEXICoder.h"*/
|
||||
#include "ErrorCodes.h"
|
||||
|
||||
#include "StringValueTable.h"
|
||||
|
||||
#if MEMORY_ALLOCATION == DYNAMIC_ALLOCATION
|
||||
#include "DynamicMemory.h"
|
||||
#endif /* DYNAMIC_ALLOCATION */
|
||||
|
|
|
@ -37,8 +37,6 @@
|
|||
#include "MethodsBag.h"
|
||||
/*#include "v2gEXICoder.h"*/
|
||||
|
||||
#include "StringValueTable.h"
|
||||
|
||||
#ifndef ABSTRACT_ENCODER_CHANNEL_C
|
||||
#define ABSTRACT_ENCODER_CHANNEL_C
|
||||
|
||||
|
|
|
@ -1,227 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2007-2014 Siemens AG
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published
|
||||
* by the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
* @author Daniel.Peintner.EXT@siemens.com
|
||||
* @version 0.9
|
||||
* @contact Joerg.Heuer@siemens.com
|
||||
*
|
||||
* <p>Code generated by EXIdizer</p>
|
||||
* <p>Schema: V2G_CI_MsgDef.xsd</p>
|
||||
*
|
||||
*
|
||||
********************************************************************/
|
||||
|
||||
|
||||
|
||||
#ifndef STRING_VALUE_TABLE_C
|
||||
#define STRING_VALUE_TABLE_C
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "StringValueTable.h"
|
||||
|
||||
#include "EXIConfig.h"
|
||||
#include "ErrorCodes.h"
|
||||
#include "EXIOptions.h"
|
||||
|
||||
#if MEMORY_ALLOCATION == DYNAMIC_ALLOCATION
|
||||
#include "DynamicMemory.h"
|
||||
#include <stdlib.h>
|
||||
#endif /* DYNAMIC_ALLOCATION */
|
||||
|
||||
#define STRING_TABLE_INIT_VALUE_ENTRY_SIZE 16
|
||||
|
||||
int exiInitValueStrings(exi_value_table_t* valueTable) {
|
||||
int i;
|
||||
int errn = 0;
|
||||
|
||||
valueTable->numberOfGlobalStrings = 0;
|
||||
#if EXI_OPTION_VALUE_PARTITION_CAPACITY != 0
|
||||
#if EXI_OPTION_VALUE_MAX_LENGTH != 0
|
||||
for(i=0; i<(valueTable->sizeLocalStrings); i++) {
|
||||
valueTable->numberOfLocalStrings[i] = 0;
|
||||
}
|
||||
#endif /* EXI_OPTION_VALUE_MAX_LENGTH != 0 */
|
||||
#endif /* EXI_OPTION_VALUE_PARTITION_CAPACITY != 0 */
|
||||
|
||||
valueTable->valueStringTable->len = 0;
|
||||
|
||||
return errn;
|
||||
}
|
||||
|
||||
|
||||
static int __exiAddStringValue(exi_value_table_t* valueTable,
|
||||
exi_string_t* sv, uint16_t qnameID) {
|
||||
int currLen;
|
||||
int errn;
|
||||
|
||||
|
||||
#if MEMORY_ALLOCATION == DYNAMIC_ALLOCATION
|
||||
exi_value_string_table_entry_t* oldStrs;
|
||||
int i;
|
||||
#endif /* DYNAMIC_ALLOCATION */
|
||||
|
||||
errn = 0;
|
||||
currLen = valueTable->valueStringTable->len;
|
||||
|
||||
if( valueTable->valueStringTable->size == currLen ) {
|
||||
#if MEMORY_ALLOCATION == STATIC_ALLOCATION
|
||||
/* no memory left to handle this string */
|
||||
errn = EXI_ERROR_STRINGVALUES_OUT_OF_MEMORY;
|
||||
#endif/* STATIC_ALLOCATION */
|
||||
#if MEMORY_ALLOCATION == DYNAMIC_ALLOCATION
|
||||
/* expand entries */
|
||||
if (valueTable->valueStringTable->size == 0) {
|
||||
valueTable->valueStringTable->size = STRING_TABLE_INIT_VALUE_ENTRY_SIZE;
|
||||
} else {
|
||||
valueTable->valueStringTable->size = (uint16_t)(currLen << 1); /* length * 2 */
|
||||
}
|
||||
|
||||
/* old data */
|
||||
oldStrs = valueTable->valueStringTable->strs;
|
||||
valueTable->valueStringTable->strs = (exi_value_string_table_entry_t*) malloc(valueTable->valueStringTable->size * sizeof(exi_value_string_table_entry_t));
|
||||
|
||||
if(currLen > 0) {
|
||||
/* copy old data */
|
||||
for(i=0; i<currLen; i++) {
|
||||
valueTable->valueStringTable->strs[i].localValueID = oldStrs[i].localValueID;
|
||||
valueTable->valueStringTable->strs[i].qnameID = oldStrs[i].qnameID;
|
||||
valueTable->valueStringTable->strs[i].str.size = oldStrs[i].str.size;
|
||||
valueTable->valueStringTable->strs[i].str.len = oldStrs[i].str.len;
|
||||
valueTable->valueStringTable->strs[i].str.characters = oldStrs[i].str.characters;
|
||||
}
|
||||
/*free old data */
|
||||
free(oldStrs);
|
||||
}
|
||||
#endif /* DYNAMIC_ALLOCATION */
|
||||
}
|
||||
|
||||
if (errn == 0) {
|
||||
valueTable->valueStringTable->strs[currLen].qnameID = qnameID;
|
||||
valueTable->valueStringTable->strs[currLen].localValueID = valueTable->numberOfLocalStrings[qnameID];
|
||||
|
||||
|
||||
#if MEMORY_ALLOCATION == STATIC_ALLOCATION
|
||||
/* make sure the str length fits into existing buffer */
|
||||
if ( sv->len > valueTable->valueStringTable->strs[currLen].str.size ) {
|
||||
errn = EXI_ERROR_STRINGVALUES_OUT_OF_MEMORY;
|
||||
}
|
||||
/* set new length */
|
||||
valueTable->valueStringTable->strs[currLen].str.len = sv->len;
|
||||
#endif/* STATIC_ALLOCATION */
|
||||
#if MEMORY_ALLOCATION == DYNAMIC_ALLOCATION
|
||||
/* allocate codepoints memory */
|
||||
errn = exiAllocateDynamicStringMemory(&valueTable->valueStringTable->strs[currLen].str, sv->len);
|
||||
valueTable->valueStringTable->strs[currLen].str.len = sv->len;
|
||||
#endif /* DYNAMIC_ALLOCATION */
|
||||
|
||||
if(errn == 0) {
|
||||
/* copy codepoints */
|
||||
if ( memcpy(valueTable->valueStringTable->strs[currLen].str.characters, sv->characters, sv->len*sizeof(uint32_t)) == NULL ) {
|
||||
errn = EXI_ERROR_STRINGVALUES_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
valueTable->valueStringTable->len++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return errn;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int exiAddStringValue(exi_value_table_t* valueTable, exi_string_t* sv, uint16_t qnameID) {
|
||||
int errn = 0;
|
||||
#if EXI_OPTION_VALUE_PARTITION_CAPACITY != 0
|
||||
#if EXI_OPTION_VALUE_MAX_LENGTH != 0
|
||||
/* increment global string count */
|
||||
#if EXI_OPTION_VALUE_PARTITION_CAPACITY < 0
|
||||
valueTable->numberOfGlobalStrings++;
|
||||
#else /* EXI_OPTION_VALUE_PARTITION_CAPACITY < 0 */
|
||||
if (valueTable->numberOfGlobalStrings < EXI_OPTION_VALUE_PARTITION_CAPACITY) {
|
||||
valueTable->numberOfGlobalStrings++;
|
||||
}
|
||||
#endif /* EXI_OPTION_VALUE_PARTITION_CAPACITY < 0 */
|
||||
/* increment local string count */
|
||||
if (qnameID < valueTable->sizeLocalStrings) {
|
||||
#if MEMORY_ALLOCATION == DYNAMIC_ALLOCATION
|
||||
errn = __exiAddStringValue(valueTable, sv, qnameID);
|
||||
#endif /* DYNAMIC_ALLOCATION */
|
||||
valueTable->numberOfLocalStrings[qnameID]++;
|
||||
/* printf("\tSV %d: lv=%d and gv=%d \n", qnameID, state->numberOfLocalStrings[qnameID], state->numberOfGlobalStrings);*/
|
||||
} else {
|
||||
/* currently we do support a set of qnames only */
|
||||
errn = EXI_ERROR_OUT_OF_QNAMES;
|
||||
}
|
||||
#endif /* EXI_OPTION_VALUE_MAX_LENGTH != 0 */
|
||||
#endif /* EXI_OPTION_VALUE_PARTITION_CAPACITY != 0 */
|
||||
|
||||
return errn;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int exiGetNumberOfLocalStringValueEntries(exi_value_table_t* valueTable,
|
||||
uint16_t qnameID, uint16_t* numberOfEntries) {
|
||||
/* TODO number of local entries and next id must not match, e.g, if string-table is restricted in number of entries */
|
||||
int i;
|
||||
int errn = 0;
|
||||
*numberOfEntries = 0;
|
||||
for(i=0; i<valueTable->valueStringTable->len; i++) {
|
||||
if( valueTable->valueStringTable->strs[i].qnameID == qnameID ) {
|
||||
(*numberOfEntries)++;
|
||||
}
|
||||
}
|
||||
|
||||
return errn;
|
||||
}
|
||||
|
||||
int exiGetGlobalStringValue(exi_value_table_t* valueTable,
|
||||
uint16_t globalID, exi_string_t* sv) {
|
||||
int errn = 0;
|
||||
|
||||
if( valueTable->valueStringTable->len > globalID) {
|
||||
*sv = valueTable->valueStringTable->strs[globalID].str;
|
||||
} else {
|
||||
errn = EXI_ERROR_STRINGVALUES_OUT_OF_BOUND;
|
||||
}
|
||||
return errn;
|
||||
}
|
||||
|
||||
int exiGetLocalStringValue(exi_value_table_t* valueTable,
|
||||
uint16_t qnameID, uint16_t localID, exi_string_t* sv) {
|
||||
int i;
|
||||
int errn = EXI_ERROR_STRINGVALUES_OUT_OF_BOUND;
|
||||
|
||||
/* walk over all entries. Note that if number of entries is restricted the local ID may be larger than the number of global entries */
|
||||
for(i=0; i<valueTable->valueStringTable->len && errn != 0; i++) {
|
||||
if( valueTable->valueStringTable->strs[i].qnameID == qnameID && valueTable->valueStringTable->strs[i].localValueID == localID ) {
|
||||
*sv = valueTable->valueStringTable->strs[i].str;
|
||||
errn = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return errn;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -1,119 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2007-2014 Siemens AG
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published
|
||||
* by the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
* @author Daniel.Peintner.EXT@siemens.com
|
||||
* @version 0.9
|
||||
* @contact Joerg.Heuer@siemens.com
|
||||
*
|
||||
* <p>Code generated by EXIdizer</p>
|
||||
* <p>Schema: V2G_CI_MsgDef.xsd</p>
|
||||
*
|
||||
*
|
||||
********************************************************************/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* \file StringValueTable.h
|
||||
* \brief Value string table implementation
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef STRING_VALUE_TABLE_H
|
||||
#define STRING_VALUE_TABLE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
#include "EXITypes.h"
|
||||
|
||||
|
||||
/**
|
||||
* \brief Init value string tables & partitions
|
||||
*
|
||||
* Resets string value entries
|
||||
*
|
||||
* \param valueTable Value Table
|
||||
* \return Error-Code <> 0
|
||||
*
|
||||
*/
|
||||
int exiInitValueStrings(exi_value_table_t* valueTable);
|
||||
|
||||
|
||||
/**
|
||||
* \brief Add string value
|
||||
*
|
||||
* \param valueTable Value Table
|
||||
* \param sv String value to add
|
||||
* \param qnameID Qualified Name ID
|
||||
* \return Error-Code <> 0
|
||||
*
|
||||
*/
|
||||
int exiAddStringValue(exi_value_table_t* valueTable,
|
||||
exi_string_t* sv, uint16_t qnameID);
|
||||
|
||||
|
||||
/**
|
||||
* \brief Get number of local string values
|
||||
*
|
||||
* \param valueTable Value Table
|
||||
* \param qnameID Qualified Name ID
|
||||
* \param numberOfEntries Number of local entries for given qname ID
|
||||
* \return Error-Code <> 0
|
||||
*
|
||||
*/
|
||||
int exiGetNumberOfLocalStringValueEntries(exi_value_table_t* valueTable,
|
||||
uint16_t qnameID, uint16_t* numberOfEntries);
|
||||
|
||||
|
||||
/**
|
||||
* \brief Get global string value hit
|
||||
*
|
||||
* \param valueTable Value Table
|
||||
* \param globalID Global Value ID
|
||||
* \param sv Returned Global String value
|
||||
* \return Error-Code <> 0
|
||||
*
|
||||
*/
|
||||
int exiGetGlobalStringValue(exi_value_table_t* valueTable,
|
||||
uint16_t globalID, exi_string_t* sv);
|
||||
|
||||
|
||||
/**
|
||||
* \brief Get local string value hit
|
||||
*
|
||||
* \param valueTable Value Table
|
||||
* \param qnameID Qualified Name ID
|
||||
* \param localID Local Value ID
|
||||
* \param sv Returned Local String value
|
||||
* \return Error-Code <> 0
|
||||
*
|
||||
*/
|
||||
int exiGetLocalStringValue(exi_value_table_t* valueTable,
|
||||
uint16_t qnameID, uint16_t localID, exi_string_t* sv);
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
Loading…
Reference in a new issue