Skip to content

Commit c4fa09e

Browse files
Validation: make sure that it compiles in C++ mode too
Like the rest of our parser and encoder, it's useful to be #include'd in C++ souces. Signed-off-by: Thiago Macieira <[email protected]>
1 parent d1f9416 commit c4fa09e

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/cborvalidation.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ static inline CborError validate_tag(CborValue *it, CborTag tag, int flags, int
355355

356356
/* correct Integer so it's not zero */
357357
if (type == CborIntegerType)
358-
++type;
358+
type = (CborType)(type + 1);
359359

360360
while (allowedTypes) {
361361
if ((uint8_t)(allowedTypes & 0xff) == type)

tests/cpp/tst_cpp.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/****************************************************************************
22
**
3-
** Copyright (C) 2015 Intel Corporation
3+
** Copyright (C) 2017 Intel Corporation
44
**
55
** Permission is hereby granted, free of charge, to any person obtaining a copy
66
** of this software and associated documentation files (the "Software"), to deal
@@ -23,9 +23,10 @@
2323
****************************************************************************/
2424

2525
#include "../../src/cborencoder.c"
26+
#include "../../src/cborerrorstrings.c"
2627
#include "../../src/cborparser.c"
2728
#include "../../src/cborparser_dup_string.c"
28-
#include "../../src/cborerrorstrings.c"
29+
#include "../../src/cborvalidation.c"
2930

3031
#include <QtTest>
3132

0 commit comments

Comments
 (0)