free(DBId);
}
-static POOLMEM *make_filename(B_DB *mdb, char *name)
+static POOLMEM *make_filename(B_DB *mdb, const char *name)
{
char sep;
POOLMEM *dbf;
}
switch (i) {
case 0: /* Job */
- return Py_BuildValue(getvars[i].fmt, jcr->job->hdr.name);
+ return Py_BuildValue((char *)getvars[i].fmt, jcr->job->hdr.name);
case 1: /* level */
- return Py_BuildValue(getvars[i].fmt, job_level_to_str(jcr->JobLevel));
+ return Py_BuildValue((char *)getvars[i].fmt, job_level_to_str(jcr->JobLevel));
case 2: /* type */
- return Py_BuildValue(getvars[i].fmt, job_type_to_str(jcr->JobType));
+ return Py_BuildValue((char *)getvars[i].fmt, job_type_to_str(jcr->JobType));
case 3: /* JobId */
- return Py_BuildValue(getvars[i].fmt, jcr->JobId);
+ return Py_BuildValue((char *)getvars[i].fmt, jcr->JobId);
case 4: /* Client */
- return Py_BuildValue(getvars[i].fmt, jcr->client->hdr.name);
+ return Py_BuildValue((char *)getvars[i].fmt, jcr->client->hdr.name);
case 5: /* NumVols */
POOL_DBR pr;
memset(&pr, 0, sizeof(pr));
bstrncpy(pr.Name, jcr->pool->hdr.name, sizeof(pr.Name));
if (db_get_pool_record(jcr, jcr->db, &pr)) {
jcr->NumVols = pr.NumVols;
- return Py_BuildValue(getvars[i].fmt, jcr->NumVols);
+ return Py_BuildValue((char *)getvars[i].fmt, jcr->NumVols);
} else {
bsnprintf(errmsg, sizeof(errmsg), _("Pool record not found."));
goto bail_out;
}
case 6: /* Pool */
- return Py_BuildValue(getvars[i].fmt, jcr->pool->name());
+ return Py_BuildValue((char *)getvars[i].fmt, jcr->pool->name());
case 7: /* Storage */
if (jcr->wstore) {
- return Py_BuildValue(getvars[i].fmt, jcr->wstore->name());
+ return Py_BuildValue((char *)getvars[i].fmt, jcr->wstore->name());
} else if (jcr->rstore) {
- return Py_BuildValue(getvars[i].fmt, jcr->rstore->name());
+ return Py_BuildValue((char *)getvars[i].fmt, jcr->rstore->name());
} else {
goto bail_out;
}
case 8:
- return Py_BuildValue(getvars[i].fmt, jcr->catalog->name());
+ return Py_BuildValue((char *)getvars[i].fmt, jcr->catalog->name());
case 9: /* MediaType */
if (jcr->wstore) {
- return Py_BuildValue(getvars[i].fmt, jcr->wstore->media_type);
+ return Py_BuildValue((char *)getvars[i].fmt, jcr->wstore->media_type);
} else if (jcr->rstore) {
- return Py_BuildValue(getvars[i].fmt, jcr->rstore->media_type);
+ return Py_BuildValue((char *)getvars[i].fmt, jcr->rstore->media_type);
} else {
goto bail_out;
}
case 10: /* JobName */
- return Py_BuildValue(getvars[i].fmt, jcr->Job);
+ return Py_BuildValue((char *)getvars[i].fmt, jcr->Job);
case 11: /* JobStatus */
buf[1] = 0;
buf[0] = jcr->JobStatus;
- return Py_BuildValue(getvars[i].fmt, buf);
+ return Py_BuildValue((char *)getvars[i].fmt, buf);
case 12: /* Priority */
- return Py_BuildValue(getvars[i].fmt, jcr->JobPriority);
+ return Py_BuildValue((char *)getvars[i].fmt, jcr->JobPriority);
case 13:
- return Py_BuildValue(getvars[i].fmt, jcr->VolumeName);
+ return Py_BuildValue((char *)getvars[i].fmt, jcr->VolumeName);
case 14: /* CatalogRes */
- return Py_BuildValue(getvars[i].fmt,
+ return Py_BuildValue((char *)getvars[i].fmt,
jcr->catalog->db_name, jcr->catalog->db_address,
jcr->catalog->db_user, jcr->catalog->db_password,
jcr->catalog->db_socket, jcr->catalog->db_port,
db_get_type());
case 15: /* JobErrors */
- return Py_BuildValue(getvars[i].fmt, jcr->JobErrors);
+ return Py_BuildValue((char *)getvars[i].fmt, jcr->JobErrors);
case 16: /* JobFiles */
- return Py_BuildValue(getvars[i].fmt, jcr->JobFiles);
+ return Py_BuildValue((char *)getvars[i].fmt, jcr->JobFiles);
case 17: /* SDJobFiles */
- return Py_BuildValue(getvars[i].fmt, jcr->SDJobFiles);
+ return Py_BuildValue((char *)getvars[i].fmt, jcr->SDJobFiles);
case 18: /* SDErrors */
- return Py_BuildValue(getvars[i].fmt, jcr->SDErrors);
+ return Py_BuildValue((char *)getvars[i].fmt, jcr->SDErrors);
case 19: /* FDJobStatus */
buf[1] = 0;
buf[0] = jcr->FDJobStatus;
- return Py_BuildValue(getvars[i].fmt, buf);
+ return Py_BuildValue((char *)getvars[i].fmt, buf);
case 29: /* SDJobStatus */
buf[1] = 0;
buf[0] = jcr->SDJobStatus;
- return Py_BuildValue(getvars[i].fmt, buf);
+ return Py_BuildValue((char *)getvars[i].fmt, buf);
}
bsnprintf(errmsg, sizeof(errmsg), _("Attribute %s not found."), attrname);
bail_out:
if (setvars[i].fmt != NULL) {
switch (setvars[i].fmt[0]) {
case 's':
- if (!PyArg_Parse(value, setvars[i].fmt, &strval)) {
+ if (!PyArg_Parse(value, (char *)setvars[i].fmt, &strval)) {
PyErr_SetString(PyExc_TypeError, _("Read-only attribute"));
return -1;
}
break;
case 'i':
- if (!PyArg_Parse(value, setvars[i].fmt, &intval)) {
+ if (!PyArg_Parse(value, (char *)setvars[i].fmt, &intval)) {
PyErr_SetString(PyExc_TypeError, _("Read-only attribute"));
return -1;
}
}
bstrncpy(jcr->event, event, sizeof(jcr->event));
- result = PyObject_CallFunction(method, "O", Job);
+ result = PyObject_CallFunction(method, (char *)"O", Job);
jcr->event[0] = 0; /* no event in progress */
if (result == NULL) {
if (PyErr_Occurred()) {
}
switch (i) {
case 0: /* FD's name */
- return Py_BuildValue(getvars[i].fmt, my_name);
+ return Py_BuildValue((char *)getvars[i].fmt, my_name);
case 1: /* level */
- return Py_BuildValue(getvars[i].fmt, job_level_to_str(jcr->JobLevel));
+ return Py_BuildValue((char *)getvars[i].fmt, job_level_to_str(jcr->JobLevel));
case 2: /* type */
- return Py_BuildValue(getvars[i].fmt, job_type_to_str(jcr->JobType));
+ return Py_BuildValue((char *)getvars[i].fmt, job_type_to_str(jcr->JobType));
case 3: /* JobId */
- return Py_BuildValue(getvars[i].fmt, jcr->JobId);
+ return Py_BuildValue((char *)getvars[i].fmt, jcr->JobId);
case 4: /* Client */
- return Py_BuildValue(getvars[i].fmt, jcr->client_name);
+ return Py_BuildValue((char *)getvars[i].fmt, jcr->client_name);
case 5: /* JobName */
- return Py_BuildValue(getvars[i].fmt, jcr->Job);
+ return Py_BuildValue((char *)getvars[i].fmt, jcr->Job);
case 6: /* JobStatus */
buf[1] = 0;
buf[0] = jcr->JobStatus;
- return Py_BuildValue(getvars[i].fmt, buf);
+ return Py_BuildValue((char *)getvars[i].fmt, buf);
}
bsnprintf(errmsg, sizeof(errmsg), _("Attribute %s not found."), attrname);
bail_out:
}
/* Get argument value ***FIXME*** handle other formats */
if (setvars[i].fmt != NULL) {
- if (!PyArg_Parse(value, setvars[i].fmt, &strval)) {
+ if (!PyArg_Parse(value, (char *)setvars[i].fmt, &strval)) {
PyErr_SetString(PyExc_TypeError, _("Read-only attribute"));
return -1;
}
}
bstrncpy(jcr->event, event, sizeof(jcr->event));
- result = PyObject_CallFunction(method, "O", Job);
+ result = PyObject_CallFunction(method, (char *)"O", Job);
jcr->event[0] = 0; /* no event in progress */
if (result == NULL) {
if (PyErr_Occurred()) {
PyObject *pJob;
int stat = -1;
PyObject *result = NULL;
+ char *obj_fmt = (char *)"O";
if (!StartUp_module) {
Dmsg0(100, "No startup module.\n");
}
((JobObject *)pJob)->jcr = jcr;
bstrncpy(jcr->event, event, sizeof(jcr->event));
- result = PyObject_CallFunction(JobStart_method, "O", pJob);
+ result = PyObject_CallFunction(JobStart_method, obj_fmt, pJob);
jcr->event[0] = 0; /* no event in progress */
if (result == NULL) {
JobStart_method = NULL;
}
bstrncpy(jcr->event, event, sizeof(jcr->event));
Dmsg1(100, "Call daemon event=%s\n", event);
- result = PyObject_CallFunction(JobEnd_method, "O", jcr->Python_job);
+ result = PyObject_CallFunction(JobEnd_method, obj_fmt, jcr->Python_job);
jcr->event[0] = 0; /* no event in progress */
if (result == NULL) {
if (PyErr_Occurred()) {
}
switch (i) {
case 0: /* Job */
- return Py_BuildValue(getvars[i].fmt, jcr->job_name); /* Non-unique name */
+ return Py_BuildValue((char *)getvars[i].fmt, jcr->job_name); /* Non-unique name */
case 1: /* SD's name */
- return Py_BuildValue(getvars[i].fmt, my_name);
+ return Py_BuildValue((char *)getvars[i].fmt, my_name);
case 2: /* level */
- return Py_BuildValue(getvars[i].fmt, job_level_to_str(jcr->JobLevel));
+ return Py_BuildValue((char *)getvars[i].fmt, job_level_to_str(jcr->JobLevel));
case 3: /* type */
- return Py_BuildValue(getvars[i].fmt, job_type_to_str(jcr->JobType));
+ return Py_BuildValue((char *)getvars[i].fmt, job_type_to_str(jcr->JobType));
case 4: /* JobId */
- return Py_BuildValue(getvars[i].fmt, jcr->JobId);
+ return Py_BuildValue((char *)getvars[i].fmt, jcr->JobId);
case 5: /* Client */
- return Py_BuildValue(getvars[i].fmt, jcr->client_name);
+ return Py_BuildValue((char *)getvars[i].fmt, jcr->client_name);
case 6: /* Pool */
- return Py_BuildValue(getvars[i].fmt, jcr->dcr->pool_name);
+ return Py_BuildValue((char *)getvars[i].fmt, jcr->dcr->pool_name);
case 7: /* MediaType */
- return Py_BuildValue(getvars[i].fmt, jcr->dcr->media_type);
+ return Py_BuildValue((char *)getvars[i].fmt, jcr->dcr->media_type);
case 8: /* JobName */
- return Py_BuildValue(getvars[i].fmt, jcr->Job);
+ return Py_BuildValue((char *)getvars[i].fmt, jcr->Job);
case 9: /* JobStatus */
buf[1] = 0;
buf[0] = jcr->JobStatus;
- return Py_BuildValue(getvars[i].fmt, buf);
+ return Py_BuildValue((char *)getvars[i].fmt, buf);
case 10:
- return Py_BuildValue(getvars[i].fmt, jcr->dcr->VolumeName);
+ return Py_BuildValue((char *)getvars[i].fmt, jcr->dcr->VolumeName);
case 11:
- return Py_BuildValue(getvars[i].fmt, jcr->dcr->dev_name);
+ return Py_BuildValue((char *)getvars[i].fmt, jcr->dcr->dev_name);
}
bsnprintf(errmsg, sizeof(errmsg), _("Attribute %s not found."), attrname);
bail_out:
}
/* Get argument value ***FIXME*** handle other formats */
if (setvars[i].fmt != NULL) {
- if (!PyArg_Parse(value, setvars[i].fmt, &strval)) {
+ if (!PyArg_Parse(value, (char *)setvars[i].fmt, &strval)) {
PyErr_SetString(PyExc_TypeError, _("Read-only attribute"));
return -1;
}
}
bstrncpy(jcr->event, event, sizeof(jcr->event));
- result = PyObject_CallFunction(method, "O", Job);
+ result = PyObject_CallFunction(method, (char *)"O", Job);
jcr->event[0] = 0; /* no event in progress */
if (result == NULL) {
if (PyErr_Occurred()) {
General:
+03Jul08
+kes Fix python compiler string warning. Note, IMO the GNU C++
+ compiler guys have made a *very* bad change to their compiler.
+ They now force all strings to be 'const' unless you explicitly
+ cast them, which is extremely ugly and ruins nice code as well
+ as creates a lot of useless work.
02Jul08
kes Fix mtx-changer to detect both versions of Ubuntu (Debian)
mt. This fixes bug #1116.