diff --git a/daemon/ReadSession.cpp b/daemon/SessionXML.cpp
similarity index 87%
rename from daemon/ReadSession.cpp
rename to daemon/SessionXML.cpp
index 1aaf4d85598e05e82f48b44b442b6a3a251eb61d..5034e48229c95e2e1562ca02dd55b6d87ddba73d 100644 (file)
rename from daemon/ReadSession.cpp
rename to daemon/SessionXML.cpp
index 1aaf4d85598e05e82f48b44b442b6a3a251eb61d..5034e48229c95e2e1562ca02dd55b6d87ddba73d 100644 (file)
--- a/daemon/ReadSession.cpp
+++ b/daemon/SessionXML.cpp
* published by the Free Software Foundation.
*/
-typedef unsigned long long uint64_t;
#include <string.h>
#include <stdlib.h>
#include <limits.h>
-#include "ReadSession.h"
+#include "SessionXML.h"
#include "Logging.h"
extern void handleException();
static const char* ATTR_DURATION = "duration";
static const char* ATTR_PATH = "path";
-ReadSession::ReadSession(const char * str) {
+SessionXML::SessionXML(const char * str) {
parameters.title = 0;
parameters.uuid[0] = 0;
parameters.target_path = 0;
logg->logMessage(mSessionXML);
}
-ReadSession::~ReadSession() {
+SessionXML::~SessionXML() {
if (mPath != 0) {
free(mSessionXML);
}
}
-void ReadSession::parse() {
+void SessionXML::parse() {
XMLReader reader(mSessionXML);
char * tag = reader.nextTag();
while(tag != 0) {
handleException();
}
-void ReadSession::sessionTag(XMLReader* in) {
- char tempBuffer[PATH_MAX];
+void SessionXML::sessionTag(XMLReader* in) {
+ char* tempBuffer = (char*)malloc(PATH_MAX);
int version = in->getAttributeAsInteger(ATTR_VERSION, 0);
if (version != 1) {
logg->logError(__FILE__, __LINE__, "Invalid session.xml version: %d", version);
handleException();
}
- in->getAttribute(ATTR_TITLE, tempBuffer, sizeof(tempBuffer), "unnamed");
+ in->getAttribute(ATTR_TITLE, tempBuffer, PATH_MAX, "unnamed");
parameters.title = strdup(tempBuffer); // freed when the child process exits
if (parameters.title == NULL) {
logg->logError(__FILE__, __LINE__, "failed to allocate parameters.title (%d bytes)", strlen(tempBuffer));
parameters.call_stack_unwinding = in->getAttributeAsBoolean(ATTR_CALL_STACK_UNWINDING, true);
in->getAttribute(ATTR_BUFFER_MODE, parameters.buffer_mode, sizeof(parameters.buffer_mode), "normal");
in->getAttribute(ATTR_SAMPLE_RATE, parameters.sample_rate, sizeof(parameters.sample_rate), "");
- in->getAttribute(ATTR_TARGET_PATH, tempBuffer, sizeof(tempBuffer), "");
+ in->getAttribute(ATTR_TARGET_PATH, tempBuffer, PATH_MAX, "");
parameters.target_path = strdup(tempBuffer); // freed when the child process exits
if (parameters.target_path == NULL) {
logg->logError(__FILE__, __LINE__, "failed to allocate parameters.target_path (%d bytes)", strlen(tempBuffer));
handleException();
}
- in->getAttribute(ATTR_OUTPUT_PATH, tempBuffer, sizeof(tempBuffer), "");
+ in->getAttribute(ATTR_OUTPUT_PATH, tempBuffer, PATH_MAX, "");
parameters.output_path = strdup(tempBuffer); // freed when the child process exits
if (parameters.output_path == NULL) {
logg->logError(__FILE__, __LINE__, "failed to allocate parameters.output_path (%d bytes)", strlen(tempBuffer));
handleException();
}
+ free(tempBuffer);
+
char * tag = in->nextTag();
while(tag != 0) {
if (strcmp(tag, TAG_IMAGE) == 0) {
}
}
-void ReadSession::sessionImage(XMLReader* in) {
+void SessionXML::sessionImage(XMLReader* in) {
int length = in->getAttributeLength(ATTR_PATH);
struct ImageLinkList *image;