Commit 86be9305 authored by ebensza's avatar ebensza
Browse files

warning elimination reported by clang


Signed-off-by: default avatarebensza <bence.janos.szabo@ericsson.com>
parent 8fa8e013
......@@ -503,7 +503,9 @@ void Free(void *ptr)
}
}
#ifdef MEMORY_DEBUG
static const size_t maxprint = 32;
#endif
void check_mem_leak(const char *program_name)
{
......
......@@ -117,7 +117,7 @@ std::string gethostnameFullyQualified ( void )
}
if( !domain[0] && NULL != (fp=fopen("/etc/defaultdomain","r")) ) {
fgets(domain, sizeof(domain), fp);
(void)fgets(domain, sizeof(domain), fp);
fclose(fp);
}
......@@ -238,7 +238,7 @@ ssize_t process_http(int sockfd, const char *host, const char *page, const char
"Content-length: %lu\r\n\r\n"
"%s", page, host, (unsigned long)strlen(poststr), poststr);
write(sockfd, sendline, strlen(sendline));
(void)write(sockfd, sendline, strlen(sendline));
/*while ((n = read(sockfd, recvline, MAXLINE)) > 0) {
recvline[n] = '\0';
printf("%s", recvline);
......
......@@ -1037,19 +1037,19 @@ namespace Common {
// All we can do is store NULLs for the unused namespaces.
size_t num_xml_namespaces = namespaces.size();
if (moduletype == MOD_TTCN) { //TODO remove this when ASN.1 gets EXER
output->source.global_vars = mputprintf(output->source.global_vars,
#ifndef NDEBUG
output->source.global_vars = mputprintf(output->source.global_vars,
"// written by %s in " __FILE__ " at %d\n"
#endif
"static const size_t num_namespaces = %lu;\n"
#ifndef NDEBUG
, __FUNCTION__, __LINE__
#endif
, (unsigned long)num_xml_namespaces
);
#endif
if (num_xml_namespaces != 0 || (control_ns && control_ns_prefix)) {
output->source.global_vars = mputstr(output->source.global_vars,
"static const namespace_t xml_namespaces[num_namespaces+1] = {\n");
output->source.global_vars = mputprintf(output->source.global_vars,
"static const size_t num_namespaces = %lu;\n"
"static const namespace_t xml_namespaces[num_namespaces+1] = {\n"
, (unsigned long)num_xml_namespaces
);
for (size_t i=0; i < namespaces.size(); ++i) {
if (used_namespaces.has_key(i)) {
output->source.global_vars = mputprintf(output->source.global_vars,
......
......@@ -751,7 +751,7 @@ string* remove_bom(const string& encoded_value)
{
size_t length = encoded_value.size();
if (0 == length) return new string();
if (length % 2 || 0 > length) {
if (length % 2) {
ERROR("remove_bom(): Wrong string. The number of nibbles (%d) in string "
"shall be divisible by 2", static_cast<int>(length));
return new string(encoded_value);
......@@ -819,7 +819,7 @@ string* get_stringencoding(const string& encoded_value)
{
size_t length = encoded_value.size();
if (0 == length) return new string("<unknown>");
if (length % 2 || 0 > length) {
if (length % 2) {
ERROR("get_stringencoding(): Wrong string. The number of nibbles (%d) in string "
"shall be divisible by 2", static_cast<int>(length));
return new string("<unknown>");
......
......@@ -3037,7 +3037,7 @@ void Type::generate_json_schema_array(JSON_Tokenizer& json)
"\"record of\"" : "\"set of\"");
} else {
// set the number of elements for arrays
char* size_str = mprintf("%lu", get_nof_comps());
char* size_str = mprintf("%zu", get_nof_comps());
json.put_next_token(JSON_TOKEN_NAME, "minItems");
json.put_next_token(JSON_TOKEN_NUMBER, size_str);
json.put_next_token(JSON_TOKEN_NAME, "maxItems");
......
......@@ -8746,7 +8746,7 @@ PredefinedOps:
{
if ($3->get_nof_logargs() != 1) {
Location loc(infile, @1);
loc.error("The any2unistr function takes exactly one argument, not %lu.",
loc.error("The any2unistr function takes exactly one argument, not %zu.",
$3->get_nof_logargs());
delete $3;
$$ = new Value(Value::OPTYPE_ANY2UNISTR, new LogArguments());
......
......@@ -896,7 +896,7 @@ namespace Profiler_Tools {
// number of lines and functions
if (p_flags & STATS_NUMBER_OF_LINES) {
line_func_count_str = mputprintf(line_func_count_str, "%s:\t%lu lines,\t%lu functions\n",
line_func_count_str = mputprintf(line_func_count_str, "%s:\t%zu lines,\t%zu functions\n",
p_db[i].filename, p_db[i].lines.size(), p_db[i].functions.size());
}
total_code_lines += p_db[i].lines.size();
......@@ -905,7 +905,7 @@ namespace Profiler_Tools {
if (p_flags & STATS_NUMBER_OF_LINES) {
line_func_count_str = mputprintf(line_func_count_str,
"--------------------------------------\n"
"Total:\t%lu lines,\t%lu functions\n", total_code_lines, total_functions);
"Total:\t%zu lines,\t%zu functions\n", total_code_lines, total_functions);
}
if (p_flags & (STATS_TOP10_ALL_DATA | STATS_ALL_DATA_SORTED)) {
......
......@@ -25,7 +25,7 @@ class XmlReaderWrap;
class Base_Type;
#ifdef TITAN_RUNTIME_2
class Record_Of_Type;
class Erroneous_descriptor_t;
struct Erroneous_descriptor_t;
#else
namespace PreGenRecordOf {
class PREGEN__RECORD__OF__UNIVERSAL__CHARSTRING;
......
......@@ -6006,7 +6006,7 @@ int Record_Type::JSON_decode(const TTCN_Typedescriptor_t& p_td, JSON_Tokenizer&
}
}
delete metainfo;
delete[] metainfo;
return dec_len;
}
......
......@@ -100,6 +100,9 @@ public:
return isAnyAttr;
}
void printToFile(FILE* file) {
printToFile(file, 0);
}
void printToFile(FILE* file, unsigned level);
void dump(unsigned int depth) const;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment