mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-07-23 07:58:09 +02:00
2016-07-20 Fred Gleason <fredg@paravelsystems.com>
* Fixed a bug in 'utils/rdclilogedit/rdclilogedit.cpp' that caused segfaults with certain commands when run without a log loaded.
This commit is contained in:
parent
27e674544c
commit
f4cf690ff3
@ -15334,3 +15334,6 @@
|
|||||||
* Added a 'settime' command to rdclilogedit(1) in
|
* Added a 'settime' command to rdclilogedit(1) in
|
||||||
'utils/rdclilogedit/rdclilogedit.cpp' and
|
'utils/rdclilogedit/rdclilogedit.cpp' and
|
||||||
'utils/rdclilogedit/rdclilogedit.h'.
|
'utils/rdclilogedit/rdclilogedit.h'.
|
||||||
|
2016-07-20 Fred Gleason <fredg@paravelsystems.com>
|
||||||
|
* Fixed a bug in 'utils/rdclilogedit/rdclilogedit.cpp' that caused
|
||||||
|
segfaults with certain commands when run without a log loaded.
|
||||||
|
@ -143,10 +143,6 @@ void MainObject::inputActivatedData(int sock)
|
|||||||
|
|
||||||
void MainObject::Addcart(int line,unsigned cartnum)
|
void MainObject::Addcart(int line,unsigned cartnum)
|
||||||
{
|
{
|
||||||
if(edit_log_event==NULL) {
|
|
||||||
fprintf(stderr,"addcart: no log loaded\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if(edit_user->addtoLog()) {
|
if(edit_user->addtoLog()) {
|
||||||
if(line>edit_log_event->size()) {
|
if(line>edit_log_event->size()) {
|
||||||
line=edit_log_event->size();
|
line=edit_log_event->size();
|
||||||
@ -204,10 +200,6 @@ void MainObject::Load(const QString &logname)
|
|||||||
|
|
||||||
void MainObject::List()
|
void MainObject::List()
|
||||||
{
|
{
|
||||||
if(edit_log_event==NULL) {
|
|
||||||
fprintf(stderr,"list: no log loaded\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
for(int i=0;i<edit_log_event->size();i++) {
|
for(int i=0;i<edit_log_event->size();i++) {
|
||||||
printf("%4d %s\n",i,(const char *)ListLine(edit_log_event,i));
|
printf("%4d %s\n",i,(const char *)ListLine(edit_log_event,i));
|
||||||
}
|
}
|
||||||
@ -223,10 +215,6 @@ void MainObject::Remove(int line)
|
|||||||
|
|
||||||
void MainObject::Save()
|
void MainObject::Save()
|
||||||
{
|
{
|
||||||
if(edit_log_event==NULL) {
|
|
||||||
fprintf(stderr,"save: no log loaded\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if(edit_user->arrangeLog()) {
|
if(edit_user->arrangeLog()) {
|
||||||
edit_log_event->save();
|
edit_log_event->save();
|
||||||
edit_log->
|
edit_log->
|
||||||
@ -243,10 +231,6 @@ void MainObject::Saveas(const QString &logname)
|
|||||||
QString sql;
|
QString sql;
|
||||||
RDSqlQuery *q;
|
RDSqlQuery *q;
|
||||||
|
|
||||||
if(edit_log_event==NULL) {
|
|
||||||
fprintf(stderr,"save: no log loaded\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if(edit_user->arrangeLog()) {
|
if(edit_user->arrangeLog()) {
|
||||||
RDLog *log=new RDLog(logname);
|
RDLog *log=new RDLog(logname);
|
||||||
if(!log->exists()) {
|
if(!log->exists()) {
|
||||||
@ -280,10 +264,6 @@ void MainObject::Saveas(const QString &logname)
|
|||||||
|
|
||||||
void MainObject::Setcart(int line,unsigned cartnum)
|
void MainObject::Setcart(int line,unsigned cartnum)
|
||||||
{
|
{
|
||||||
if(edit_log_event==NULL) {
|
|
||||||
fprintf(stderr,"setcart: no log loaded\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if(edit_user->arrangeLog()) {
|
if(edit_user->arrangeLog()) {
|
||||||
RDLogLine *logline=edit_log_event->logLine(line);
|
RDLogLine *logline=edit_log_event->logLine(line);
|
||||||
if(logline!=NULL) {
|
if(logline!=NULL) {
|
||||||
@ -308,10 +288,6 @@ void MainObject::Setcart(int line,unsigned cartnum)
|
|||||||
|
|
||||||
void MainObject::Settime(int line,RDLogLine::TimeType type,const QTime &time)
|
void MainObject::Settime(int line,RDLogLine::TimeType type,const QTime &time)
|
||||||
{
|
{
|
||||||
if(edit_log_event==NULL) {
|
|
||||||
fprintf(stderr,"settime: no log loaded\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
edit_log_event->logLine(line)->setTimeType(type);
|
edit_log_event->logLine(line)->setTimeType(type);
|
||||||
edit_log_event->logLine(line)->setStartTime(RDLogLine::Logged,time);
|
edit_log_event->logLine(line)->setStartTime(RDLogLine::Logged,time);
|
||||||
}
|
}
|
||||||
@ -346,6 +322,37 @@ void MainObject::DispatchCommand(const QString &cmd)
|
|||||||
QTime time;
|
QTime time;
|
||||||
bool ok=false;
|
bool ok=false;
|
||||||
|
|
||||||
|
//
|
||||||
|
// No loaded log needed for these
|
||||||
|
//
|
||||||
|
if((verb=="exit")||(verb=="quit")||(verb=="bye")) {
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if((verb=="help")||(verb=="?")) {
|
||||||
|
Help(cmds);
|
||||||
|
processed=true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(verb=="listlogs") {
|
||||||
|
ListLogs();
|
||||||
|
processed=true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(verb=="load") {
|
||||||
|
if(cmds.size()==2) {
|
||||||
|
Load(cmds[1]);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
fprintf(stderr,"load: invalid command arguments\n");
|
||||||
|
}
|
||||||
|
processed=true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// These need a log loaded
|
||||||
|
//
|
||||||
|
if((processed)||(edit_log_event!=NULL)) {
|
||||||
if(verb=="addcart") {
|
if(verb=="addcart") {
|
||||||
if(cmds.size()==3) {
|
if(cmds.size()==3) {
|
||||||
line=cmds[1].toInt(&ok);
|
line=cmds[1].toInt(&ok);
|
||||||
@ -368,35 +375,11 @@ void MainObject::DispatchCommand(const QString &cmd)
|
|||||||
processed=true;
|
processed=true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if((verb=="exit")||(verb=="quit")||(verb=="bye")) {
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if((verb=="help")||(verb=="?")) {
|
|
||||||
Help(cmds);
|
|
||||||
processed=true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(verb=="listlogs") {
|
|
||||||
ListLogs();
|
|
||||||
processed=true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(verb=="list") {
|
if(verb=="list") {
|
||||||
List();
|
List();
|
||||||
processed=true;
|
processed=true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(verb=="load") {
|
|
||||||
if(cmds.size()==2) {
|
|
||||||
Load(cmds[1]);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
fprintf(stderr,"load: invalid command arguments\n");
|
|
||||||
}
|
|
||||||
processed=true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(verb=="remove") {
|
if(verb=="remove") {
|
||||||
if(cmds.size()==2) {
|
if(cmds.size()==2) {
|
||||||
line=cmds[1].toInt(&ok);
|
line=cmds[1].toInt(&ok);
|
||||||
@ -534,6 +517,11 @@ void MainObject::DispatchCommand(const QString &cmd)
|
|||||||
Unload();
|
Unload();
|
||||||
processed=true;
|
processed=true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
fprintf(stderr,"%s: no log loaded\n",(const char *)verb);
|
||||||
|
processed=true;
|
||||||
|
}
|
||||||
|
|
||||||
if(!processed) {
|
if(!processed) {
|
||||||
fprintf(stderr,"invalid command\n");
|
fprintf(stderr,"invalid command\n");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user