int getInfo(char* buf,int bufLen) { static const char* INFO = "info { name=[ArMarkers to X,Y,Rotation] group=[Position] inputs=[1 video_in ] outputs=[6 X-Position-1 Y-Position-1 R-Position-1 X-Position-2 Y-Position-2 R-Position-2 ] type=xpm } "; char* tmpBuf; int reqLen = 1 + strlen(INFO) + getSizeOfXPM(arboardmodule_xpm); if (buf != 0 && reqLen <= bufLen) { char* offset; int i; int lines = getNumberOfStringsXPM(arboardmodule_xpm); tmpBuf = (char*) malloc(reqLen); if (tmpBuf == 0) { printf("Could not allocate memory in getInfo\n"); return 0; } memcpy(tmpBuf,INFO,strlen(INFO)+1); offset = tmpBuf + strlen(INFO) + 1; for (i = 0; i < lines; ++i) { char* source = arboardmodule_xpm[i]; memcpy(offset,source,strlen(source)+1); offset += strlen(source) + 1; } memcpy(buf,tmpBuf,reqLen); free(tmpBuf); } return reqLen; }
int getInfo(char* buf,int bufLen) { static const char* INFO = "info { name=Interference group=Grafikeffekte inputs=[2 Number] outputs=[1 Bild] type=xpm }"; char* tmpBuf; int reqLen = strlen(INFO) + 1 + getSizeOfXPM(inter_xpm); if (buf != 0 && reqLen <= bufLen) { char* offset; int i; int lines = getNumberOfStringsXPM(inter_xpm); tmpBuf = (char*) malloc(reqLen); memcpy(tmpBuf,INFO,strlen(INFO)+1); offset = tmpBuf + strlen(INFO)+1; for (i = 0; i < lines; ++i) { char* source = inter_xpm[i]; memcpy(offset,source,strlen(source)+1); offset += strlen(source) + 1; } memcpy(buf,tmpBuf,reqLen); free(tmpBuf); } return reqLen; }