Zero-sized array added again
pragma added for MSVC compiler.
This commit is contained in:
parent
ebcc2f9860
commit
5e5fe8ffa8
@ -3,6 +3,10 @@
|
||||
*/
|
||||
|
||||
#include "wavelib.h"
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning(disable : 4200)
|
||||
#pragma warning(disable : 4996)
|
||||
#endif
|
||||
|
||||
wave_object wave_init(char* wname) {
|
||||
wave_object obj = NULL;
|
||||
@ -15,8 +19,7 @@ wave_object wave_init(char* wname) {
|
||||
//strcopy(obj->wname, wname);
|
||||
}
|
||||
|
||||
obj = (wave_object)malloc(sizeof(struct wave_set));
|
||||
obj->params = (double*)malloc(sizeof(double) * 4 * retval);
|
||||
obj = (wave_object)malloc(sizeof(struct wave_set) + sizeof(double) * 4 * retval);
|
||||
|
||||
obj->filtlength = retval;
|
||||
obj->lpd_len = obj->hpd_len = obj->lpr_len = obj->hpr_len = obj->filtlength;
|
||||
@ -50,14 +53,12 @@ wt_object wt_init(wave_object wave,char* method, int siglength,int J) {
|
||||
}
|
||||
|
||||
if (method == NULL) {
|
||||
obj = (wt_object)malloc(sizeof(struct wt_set));
|
||||
obj->params = (double*)malloc(sizeof(double)* (siglength + 2 * J * (size + 1)));
|
||||
obj = (wt_object)malloc(sizeof(struct wt_set) + sizeof(double)* (siglength + 2 * J * (size + 1)));
|
||||
obj->outlength = siglength + 2 * J * (size + 1); // Default
|
||||
strcpy(obj->ext, "sym"); // Default
|
||||
}
|
||||
else if (!strcmp(method, "dwt") || !strcmp(method, "DWT")) {
|
||||
obj = (wt_object)malloc(sizeof(struct wt_set));
|
||||
obj->params = (double*)malloc(sizeof(double)* (siglength + 2 * J * (size + 1)));
|
||||
obj = (wt_object)malloc(sizeof(struct wt_set) + sizeof(double)* (siglength + 2 * J * (size + 1)));
|
||||
obj->outlength = siglength + 2 * J * (size + 1); // Default
|
||||
strcpy(obj->ext, "sym"); // Default
|
||||
}
|
||||
@ -67,8 +68,7 @@ wt_object wt_init(wave_object wave,char* method, int siglength,int J) {
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
obj = (wt_object)malloc(sizeof(struct wt_set));
|
||||
obj->params = (double*)malloc(sizeof(double)* (siglength * (J + 1)));
|
||||
obj = (wt_object)malloc(sizeof(struct wt_set) + sizeof(double)* (siglength * (J + 1)));
|
||||
obj->outlength = siglength * (J + 1); // Default
|
||||
strcpy(obj->ext, "per"); // Default
|
||||
}
|
||||
@ -83,8 +83,7 @@ wt_object wt_init(wave_object wave,char* method, int siglength,int J) {
|
||||
}
|
||||
}
|
||||
|
||||
obj = (wt_object)malloc(sizeof(struct wt_set));
|
||||
obj->params = (double*)malloc(sizeof(double)* (siglength * (J + 1)));
|
||||
obj = (wt_object)malloc(sizeof(struct wt_set) + sizeof(double)* (siglength * (J + 1)));
|
||||
obj->outlength = siglength * (J + 1); // Default
|
||||
strcpy(obj->ext, "per"); // Default
|
||||
}
|
||||
@ -150,8 +149,7 @@ wtree_object wtree_init(wave_object wave, int siglength,int J) {
|
||||
elength += temp2;
|
||||
}
|
||||
|
||||
obj = (wtree_object)malloc(sizeof(struct wtree_set));
|
||||
obj->params = (double*)malloc(sizeof(double)* (siglength * (J + 1) + elength + nodes + J + 1));
|
||||
obj = (wtree_object)malloc(sizeof(struct wtree_set) + sizeof(double)* (siglength * (J + 1) + elength + nodes + J + 1));
|
||||
obj->outlength = siglength * (J + 1) + elength;
|
||||
strcpy(obj->ext, "sym");
|
||||
|
||||
@ -224,8 +222,7 @@ wpt_object wpt_init(wave_object wave, int siglength, int J) {
|
||||
}
|
||||
//printf("elength %d", elength);
|
||||
|
||||
obj = (wpt_object)malloc(sizeof(struct wpt_set));
|
||||
obj->params = (double*)malloc(sizeof(double)* (elength + 4 * nodes + 2 * J + 6));
|
||||
obj = (wpt_object)malloc(sizeof(struct wpt_set) + sizeof(double)* (elength + 4 * nodes + 2 * J + 6));
|
||||
obj->outlength = siglength + 2 * (J + 1) * (size + 1);
|
||||
strcpy(obj->ext, "sym");
|
||||
strcpy(obj->entropy, "shannon");
|
||||
@ -2537,21 +2534,17 @@ void wpt_summary(wpt_object wt) {
|
||||
}
|
||||
|
||||
void wave_free(wave_object object) {
|
||||
free(object->params);
|
||||
free(object);
|
||||
}
|
||||
|
||||
void wt_free(wt_object object) {
|
||||
free(object->params);
|
||||
free(object);
|
||||
}
|
||||
|
||||
void wtree_free(wtree_object object) {
|
||||
free(object->params);
|
||||
free(object);
|
||||
}
|
||||
|
||||
void wpt_free(wpt_object object) {
|
||||
free(object->params);
|
||||
free(object);
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ struct wave_set{
|
||||
double *hpd;
|
||||
double *lpr;
|
||||
double *hpr;
|
||||
double *params;
|
||||
double params[0];
|
||||
};
|
||||
|
||||
typedef struct wt_set* wt_object;
|
||||
@ -50,7 +50,7 @@ struct wt_set{
|
||||
int zpad;
|
||||
int length[102];
|
||||
double *output;
|
||||
double *params;
|
||||
double params[0];
|
||||
};
|
||||
|
||||
typedef struct wtree_set* wtree_object;
|
||||
@ -77,7 +77,7 @@ struct wtree_set{
|
||||
double *output;
|
||||
int *nodelength;
|
||||
int *coeflength;
|
||||
double *params;
|
||||
double params[0];
|
||||
};
|
||||
|
||||
typedef struct wpt_set* wpt_object;
|
||||
@ -106,7 +106,7 @@ struct wpt_set{
|
||||
int *nodeindex;
|
||||
int *numnodeslevel;
|
||||
int *coeflength;
|
||||
double *params;
|
||||
double params[0];
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user