* Fix wanings for reduce precision on integers.
* Add wrapper for strncat
This commit is contained in:
1 parent
d27c448a94
commit
cc6da8941c
5 files changed
+17
-13
No files matched your search
+6
-6
@@ -706,17 +706,17 @@ M_C(name, _init)(buffer_t v, size_t size) \
|
||||
{ \
|
||||
assert (buffer != NULL); \
|
||||
assert( M_POWEROF2_P(size)); \
|
||||
assert (size < UINT_MAX); \
|
||||
assert (0 < size && size <= UINT_MAX); \
|
||||
assert(((policy) & (BUFFER_STACK|BUFFER_THREAD_UNSAFE|BUFFER_PUSH_OVERWRITE)) == 0); \
|
||||
atomic_init(&buffer->ProdIdx, (unsigned int) size); \
|
||||
atomic_init(&buffer->ConsoIdx, (unsigned int) size); \
|
||||
buffer->size = size; \
|
||||
buffer->size = (unsigned int) size; \
|
||||
buffer->Tab = M_CALL_REALLOC(oplist, M_C(name, _el_t), NULL, size); \
|
||||
if (buffer->Tab == NULL) { \
|
||||
M_MEMORY_FULL (size*sizeof(M_C(name, _el_t) )); \
|
||||
return; \
|
||||
} \
|
||||
for(unsigned int j = 0; j < size; j++) { \
|
||||
for(unsigned int j = 0; j < (unsigned int) size; j++) { \
|
||||
atomic_init(&buffer->Tab[j].seq, 2*j+1U); \
|
||||
if (!BUFFERI_POLICY_P((policy), BUFFER_PUSH_INIT_POP_MOVE)) { \
|
||||
M_CALL_INIT(oplist, buffer->Tab[j].x); \
|
||||
@@ -1022,18 +1022,18 @@ M_C(name, _init)(buffer_t v, size_t size) \
|
||||
{ \
|
||||
assert (buffer != NULL); \
|
||||
assert( M_POWEROF2_P(size)); \
|
||||
assert (size < UINT_MAX); \
|
||||
assert (0 < size && size <= UINT_MAX); \
|
||||
assert(((policy) & (BUFFER_STACK|BUFFER_THREAD_UNSAFE|BUFFER_PUSH_OVERWRITE)) == 0); \
|
||||
atomic_init(&buffer->prodIdx, (unsigned int) size); \
|
||||
atomic_init(&buffer->consoIdx, (unsigned int) size); \
|
||||
buffer->size = size; \
|
||||
buffer->size = (unsigned int) size; \
|
||||
buffer->Tab = M_CALL_REALLOC(oplist, M_C(name, _el_t), NULL, size); \
|
||||
if (buffer->Tab == NULL) { \
|
||||
M_MEMORY_FULL (size*sizeof(M_C(name, _el_t) )); \
|
||||
return; \
|
||||
} \
|
||||
if (!BUFFERI_POLICY_P((policy), BUFFER_PUSH_INIT_POP_MOVE)) { \
|
||||
for(size_t j = 0; j < size; j++) { \
|
||||
for(unsigned int j = 0; j < (unsigned int) size; j++) { \
|
||||
M_CALL_INIT(oplist, buffer->Tab[j].x); \
|
||||
} \
|
||||
} \
|
||||
|
||||
@@ -1476,6 +1476,7 @@
|
||||
* - fopen
|
||||
* - fscanf
|
||||
* - strncpy
|
||||
* - strncat
|
||||
*
|
||||
* There is no real usage outside of MSVS of Annex K,
|
||||
* so the real standard compliant Annex K is not taken into account
|
||||
@@ -1485,9 +1486,8 @@
|
||||
* and the user wants to use the Annex K.
|
||||
* ==> Use Annex K like functions to avoid warnings
|
||||
*
|
||||
* Only fscanf, fopen and strncpy produce warning,
|
||||
* so we keep the wrapper as simple as possible by including only
|
||||
* theses functions.
|
||||
* Only these functions produce warning,
|
||||
* so we keep the wrapper as simple as possible by including only then.
|
||||
*/
|
||||
#if defined(_MSC_VER) && defined(__STDC_WANT_LIB_EXT1__) && __STDC_WANT_LIB_EXT1__
|
||||
|
||||
@@ -1502,6 +1502,8 @@ m_core_fopen(const char filename[], const char opt[])
|
||||
}
|
||||
/* Wrapper around strncpy_s */
|
||||
#define m_core_strncpy(s1, s2, size) strncpy_s(s1, size, s2, size)
|
||||
/* Wrapper around strncat_s */
|
||||
#define m_core_strncat(s1, s2, size) strncat_s(s1, size, s2, size)
|
||||
/* Wrapper around fscanf_s */
|
||||
#define m_core_fscanf(...) fscanf_s(__VA_ARGS__)
|
||||
|
||||
@@ -1516,6 +1518,8 @@ m_core_fopen(const char filename[], const char opt[])
|
||||
#define m_core_fopen(...) fopen(__VA_ARGS__)
|
||||
/* Wrapper around strncpy */
|
||||
#define m_core_strncpy(...) strncpy(__VA_ARGS__)
|
||||
/* Wrapper around strncat */
|
||||
#define m_core_strncat(s1, s2, size) strncat(s1, s2, size)
|
||||
/* Wrapper around fscanf */
|
||||
#define m_core_fscanf(...) fscanf(__VA_ARGS__)
|
||||
|
||||
|
||||
+2
-2
@@ -341,7 +341,7 @@ static inline void snapshot_mrsw_int_init(snapshot_mrsw_int_t s, size_t n)
|
||||
s->cptTab = ptr;
|
||||
for(size_t i = 0; i < n; i++)
|
||||
atomic_init(&s->cptTab[i], 0U);
|
||||
genint_init (s->freeList, n);
|
||||
genint_init (s->freeList, (unsigned int) n);
|
||||
// Get a free buffer and set it as available for readers
|
||||
unsigned int w = genint_pop(s->freeList);
|
||||
assert (w != GENINT_ERROR);
|
||||
@@ -372,7 +372,7 @@ static inline unsigned int snapshot_mrsw_int_get_write_idx(snapshot_mrsw_int_t s
|
||||
static inline unsigned int snapshot_mrsw_int_size(snapshot_mrsw_int_t s)
|
||||
{
|
||||
SNAPSHOTI_SPMC_INT_CONTRACT(s);
|
||||
return s->n;
|
||||
return (unsigned int) s->n;
|
||||
}
|
||||
|
||||
static inline unsigned int snapshot_mrsw_int_write_idx(snapshot_mrsw_int_t s, unsigned int idx)
|
||||
|
||||
+1
-1
@@ -1884,7 +1884,7 @@ namespace m_string {
|
||||
BOUNDED_STRINGI_CONTRACT(s, max_size); \
|
||||
assert (str != NULL); \
|
||||
assert (strlen(s->s) <= max_size); \
|
||||
strncat(s->s, str, max_size-strlen(s->s)); \
|
||||
m_core_strncat(s->s, str, max_size-strlen(s->s)); \
|
||||
} \
|
||||
\
|
||||
static inline void \
|
||||
|
||||
+1
-1
@@ -285,7 +285,7 @@ worker_init(worker_t g, int numWorker, unsigned int extraQueue, void (*resetFunc
|
||||
return;
|
||||
}
|
||||
worker_queue_init(g->queue_g, numWorker_st + extraQueue);
|
||||
g->numWorker_g = numWorker_st;
|
||||
g->numWorker_g = (unsigned int) numWorker_st;
|
||||
g->resetFunc_g = resetFunc;
|
||||
g->clearFunc_g = clearFunc;
|
||||
m_mutex_init(g->lock);
|
||||
|
||||
Reference in new issue
Block a user