fix some warnings
This commit is contained in:
parent
ade5b4378f
commit
8bd977ba62
|
@ -25,36 +25,42 @@ double **getDoubleArray(int N, int M) /* Allocate the array */
|
|||
return array;
|
||||
}
|
||||
|
||||
void fillArrayWithRawData(char *rawDataFileName,long** p, int N, int M) {
|
||||
void fillArrayWithRawData(char *rawDataFileName, long **p, int N, int M)
|
||||
{
|
||||
int i, j;
|
||||
char *buffer;
|
||||
size_t bufsize = 200;
|
||||
buffer = (char *)malloc(bufsize * sizeof(char));
|
||||
char* token;
|
||||
int token;
|
||||
|
||||
FILE *f = fopen(rawDataFileName, "r");
|
||||
|
||||
for(i = 0 ; i < N ; i++){
|
||||
if (!getline(&buffer, &bufsize, f)) break; // condition d'arret de la boucle si fichier fini
|
||||
for (i = 0; i < N; i++)
|
||||
{
|
||||
if (!getline(&buffer, &bufsize, f))
|
||||
break; // condition d'arret de la boucle si fichier fini
|
||||
j = 0;
|
||||
while((token = strsep(&buffer,",")) != NULL){ // séparation valeur par virgule initiale : csv
|
||||
p[i][j] = atoi(token);
|
||||
while ((token = strsep(&buffer, ",")) != 0)
|
||||
{ // séparation valeur par virgule initiale : csv
|
||||
p[i][j] = token;
|
||||
j++;
|
||||
}
|
||||
}
|
||||
fclose(f);
|
||||
|
||||
}
|
||||
/**
|
||||
* @brief print all the element of a bidimensionnal array p of shape : N x M
|
||||
*/
|
||||
void printArrayData(long** p, int N, int M) {
|
||||
int i, j;
|
||||
for(i = 0 ; i < N ; i++){
|
||||
void printArrayData(long **p, int N, int M)
|
||||
{
|
||||
for (int i = 0; i < N; i++)
|
||||
{
|
||||
printf("line n°%d : ", i);
|
||||
for(int j = 0 ; j < M ; j++){
|
||||
for (int j = 0; j < M; j++)
|
||||
{
|
||||
printf("%ld , ", p[i][j]);
|
||||
if(j==(M-1)) printf("\n");
|
||||
if (j == (M - 1))
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -67,9 +73,14 @@ void printArrayData(long** p, int N, int M) {
|
|||
* @return true if the array contaign no NULL element
|
||||
* @return false if at least one element is null
|
||||
*/
|
||||
bool checkArrayFullyFill(long **p, int N){
|
||||
for(int i = 0 ; i < N ; i++){
|
||||
if(p[i][0] == '\0'){ return false; }
|
||||
bool checkArrayFullyFill(long **p, int N)
|
||||
{
|
||||
for (int i = 0; i < N; i++)
|
||||
{
|
||||
if (p[i][0] == '\0')
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -80,8 +91,10 @@ bool checkArrayFullyFill(long **p, int N){
|
|||
* @param p array to free memory
|
||||
* @param N number of rows in array
|
||||
*/
|
||||
void freeArray(long **p, int N) {
|
||||
for(int i = 0 ; i < N ; i++){
|
||||
void freeArray(long **p, int N)
|
||||
{
|
||||
for (int i = 0; i < N; i++)
|
||||
{
|
||||
free(p[i]);
|
||||
}
|
||||
free(p);
|
||||
|
@ -95,7 +108,8 @@ void freeArray(long **p, int N) {
|
|||
* @param M numbers of columns to have i the array
|
||||
* @return long** the array fill with raw data
|
||||
*/
|
||||
long **getRawDataArray(char* rawDataFileName){
|
||||
long **getRawDataArray(char *rawDataFileName)
|
||||
{
|
||||
long **p;
|
||||
p = getlongArray(nRowRawData, nCol);
|
||||
fillArrayWithRawData(rawDataFileName, p, nRowRawData, nCol);
|
||||
|
|
|
@ -42,6 +42,7 @@ void *threadCalculPower(void *vargp)
|
|||
remove(fileName);
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void *threadCalculAverage(void *vargp)
|
||||
|
@ -58,6 +59,7 @@ void *threadCalculAverage(void *vargp)
|
|||
remove(fileName);
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void *threadCalculBoth(void *vargp)
|
||||
|
@ -75,6 +77,7 @@ void *threadCalculBoth(void *vargp)
|
|||
remove(fileName);
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void *threadCalculGrowthRate(void *vargp)
|
||||
|
@ -124,6 +127,7 @@ void *threadCalculGrowthRate(void *vargp)
|
|||
remove(fileName);
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
|
@ -144,9 +148,14 @@ int main(int argc, char **argv)
|
|||
firstRawDataQueue = queueCreateEmpty(); // change this for create empty
|
||||
|
||||
pthread_t rawData;
|
||||
pthread_create(&rawData, NULL, threadSimulateFlux, (void *)&rawData);
|
||||
if (pthread_create(&rawData, NULL, threadSimulateFlux, "threadSimulflux") != 0)
|
||||
{
|
||||
perror("pthread_create() error");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
pthread_t calcul;
|
||||
pthread_create(&calcul, NULL, threadCalculGrowthRate, (void *)&calcul);
|
||||
pthread_create(&calcul, NULL, threadCalculGrowthRate, "threadCalcul");
|
||||
|
||||
pthread_exit(NULL);
|
||||
}
|
|
@ -123,7 +123,6 @@ bool writeOneRawData(FILE *rawDataFile)
|
|||
char buff2[18];
|
||||
int32_t values[8];
|
||||
uint32_t valbin[8];
|
||||
quartet value;
|
||||
|
||||
if (fread(&buff, 26, 1, stdin))
|
||||
{
|
||||
|
@ -146,11 +145,13 @@ bool writeOneRawData(FILE *rawDataFile)
|
|||
strncpy(&buff[8], buff2, 18);
|
||||
}
|
||||
}
|
||||
|
||||
int lastIndex = lastIndexCaptor();
|
||||
for (int i = 1; i < 9; i++)
|
||||
{
|
||||
if (selectionCaptors[i - 1])
|
||||
{
|
||||
quartet value;
|
||||
value.octet1 = buff[3 * i + 1];
|
||||
value.octet2 = buff[3 * i + 2];
|
||||
value.octet3 = buff[3 * i + 3];
|
||||
|
@ -183,6 +184,7 @@ bool writeOneRawData(FILE *rawDataFile)
|
|||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void *threadSimulateFlux(void *vargp)
|
||||
|
@ -202,8 +204,9 @@ void *threadSimulateFlux(void *vargp)
|
|||
queueAddLastQ(firstRawDataQueue, fileName, strlen(fileName));
|
||||
// prepare next file now
|
||||
fileName = createNewRawDataFileName();
|
||||
FILE *rawDataFile = fopen(fileName, "w+");
|
||||
rawDataFile = fopen(fileName, "w+");
|
||||
}
|
||||
}
|
||||
rawDataWriteFlag = false;
|
||||
return NULL;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue