Skip to content

Commit 7c8cf8b

Browse files
committed
EH: CS-1014 verify all calls to xml_Append_Attr_I
1 parent d15581b commit 7c8cf8b

File tree

3 files changed

+34
-35
lines changed

3 files changed

+34
-35
lines changed

Diff for: source/clients/qstat/ocs_qstat_filter.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -1980,7 +1980,7 @@ static int sge_handle_job(lListElem *job, lListElem *jatep, lListElem *qep, lLis
19801980
summary.dlcontr = lGetDouble(job, JB_dlcontr);
19811981
}
19821982
if (sge_pri) {
1983-
summary.priority = lGetUlong(job, JB_priority)-BASE_PRIORITY;
1983+
summary.priority = static_cast<int>(lGetUlong(job, JB_priority)) - BASE_PRIORITY;
19841984
}
19851985
summary.name = lGetString(job, JB_job_name);
19861986
summary.user = lGetString(job, JB_owner);
@@ -2710,7 +2710,7 @@ static int job_handle_subtask(lListElem *job, lListElem *ja_task, lListElem *pe_
27102710
ep=lGetElemStr(usage_list, UA_name, "exit_status");
27112711
if (ep) {
27122712
summary.has_exit_status = true;
2713-
summary.exit_status = (int)lGetDouble(ep, UA_value);
2713+
summary.exit_status = lGetDouble(ep, UA_value);
27142714
} else {
27152715
summary.has_exit_status = false;
27162716
}

Diff for: source/clients/qstat/ocs_qstat_filter.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ typedef struct job_summary_str job_summary_t;
172172

173173
struct job_summary_str {
174174
bool print_jobid;
175-
u_long32 priority;
175+
int priority;
176176
double nurg;
177177
double urg;
178178
double nppri;

Diff for: source/clients/qstat/ocs_qstat_xml.cc

+31-32
Original file line numberDiff line numberDiff line change
@@ -142,24 +142,24 @@ static int cqueue_summary_xml_report_cqueue(cqueue_summary_handler_t *handler, c
142142
if (summary->is_load_available) {
143143
xml_append_Attr_D(attributeList, "load", summary->load);
144144
}
145-
xml_append_Attr_I(attributeList, "used", (int)summary->used);
146-
xml_append_Attr_I(attributeList, "resv", (int)summary->resv);
147-
xml_append_Attr_I(attributeList, "available", (int)summary->available);
148-
xml_append_Attr_I(attributeList, "total", (int)summary->total);
149-
xml_append_Attr_I(attributeList, "temp_disabled", (int)summary->temp_disabled);
150-
xml_append_Attr_I(attributeList, "manual_intervention", (int)summary->manual_intervention);
145+
xml_append_Attr_U(attributeList, "used", summary->used);
146+
xml_append_Attr_U(attributeList, "resv", summary->resv);
147+
xml_append_Attr_U(attributeList, "available", summary->available);
148+
xml_append_Attr_U(attributeList, "total", summary->total);
149+
xml_append_Attr_U(attributeList, "temp_disabled", summary->temp_disabled);
150+
xml_append_Attr_U(attributeList, "manual_intervention", summary->manual_intervention);
151151
if (show_states) {
152-
xml_append_Attr_I(attributeList, "suspend_manual", (int)summary->suspend_manual);
153-
xml_append_Attr_I(attributeList, "suspend_threshold", (int)summary->suspend_threshold);
154-
xml_append_Attr_I(attributeList, "suspend_on_subordinate", (int)summary->suspend_on_subordinate);
155-
xml_append_Attr_I(attributeList, "suspend_calendar", (int)summary->suspend_calendar);
156-
xml_append_Attr_I(attributeList, "unknown", (int)summary->unknown);
157-
xml_append_Attr_I(attributeList, "load_alarm", (int)summary->load_alarm);
158-
xml_append_Attr_I(attributeList, "disabled_manual", (int)summary->disabled_manual);
159-
xml_append_Attr_I(attributeList, "disabled_calendar", (int)summary->disabled_calendar);
160-
xml_append_Attr_I(attributeList, "ambiguous", (int)summary->ambiguous);
161-
xml_append_Attr_I(attributeList, "orphaned", (int)summary->orphaned);
162-
xml_append_Attr_I(attributeList, "error", (int)summary->error);
152+
xml_append_Attr_U(attributeList, "suspend_manual", summary->suspend_manual);
153+
xml_append_Attr_U(attributeList, "suspend_threshold", summary->suspend_threshold);
154+
xml_append_Attr_U(attributeList, "suspend_on_subordinate", summary->suspend_on_subordinate);
155+
xml_append_Attr_U(attributeList, "suspend_calendar", summary->suspend_calendar);
156+
xml_append_Attr_U(attributeList, "unknown", summary->unknown);
157+
xml_append_Attr_U(attributeList, "load_alarm", summary->load_alarm);
158+
xml_append_Attr_U(attributeList, "disabled_manual", summary->disabled_manual);
159+
xml_append_Attr_U(attributeList, "disabled_calendar", summary->disabled_calendar);
160+
xml_append_Attr_U(attributeList, "ambiguous", summary->ambiguous);
161+
xml_append_Attr_U(attributeList, "orphaned", summary->orphaned);
162+
xml_append_Attr_U(attributeList, "error", summary->error);
163163
}
164164
if (elem) {
165165
if (handler->ctx == nullptr){
@@ -481,13 +481,12 @@ static int qstat_xml_job(job_handler_t* handler, u_long32 jid, job_summary_t *su
481481

482482
if (!summary->is_zombie) {
483483
if (sge_ext ||summary->is_queue_assigned) {
484-
xml_append_Attr_I(attribute_list, "tickets", (int)summary->tickets);
485-
xml_append_Attr_I(attribute_list, "JB_override_tickets", (int)summary->override_tickets);
486-
xml_append_Attr_I(attribute_list, "JB_jobshare", (int)summary->share);
487-
xml_append_Attr_I(attribute_list, "otickets", (int)summary->otickets);
488-
xml_append_Attr_I(attribute_list, "ftickets", (int)summary->ftickets);
489-
xml_append_Attr_I(attribute_list, "stickets", (int)summary->stickets);
490-
/* RH TODO: asked Stefan want is the difference between JAT_share and JB_jobshare */
484+
xml_append_Attr_U(attribute_list, "tickets", summary->tickets);
485+
xml_append_Attr_U(attribute_list, "JB_override_tickets", summary->override_tickets);
486+
xml_append_Attr_U(attribute_list, "JB_jobshare", summary->share);
487+
xml_append_Attr_U(attribute_list, "otickets", summary->otickets);
488+
xml_append_Attr_U(attribute_list, "ftickets", summary->ftickets);
489+
xml_append_Attr_U(attribute_list, "stickets", summary->stickets);
491490
xml_append_Attr_D(attribute_list, "JAT_share", summary->share);
492491
}
493492
}
@@ -503,7 +502,7 @@ static int qstat_xml_job(job_handler_t* handler, u_long32 jid, job_summary_t *su
503502
xml_append_Attr_S(attribute_list, "master", summary->master);
504503
}
505504

506-
xml_append_Attr_I(attribute_list, "slots", (int)summary->slots);
505+
xml_append_Attr_U(attribute_list, "slots", summary->slots);
507506

508507
if (summary->task_id && summary->is_array) {
509508
xml_append_Attr_S(attribute_list, "tasks", summary->task_id);
@@ -554,10 +553,10 @@ static int qstat_xml_sub_task(job_handler_t* handler, task_summary_t *summary, l
554553
}
555554

556555
if (summary->has_exit_status) {
557-
xml_append_Attr_I(attribute_list, "stat", summary->exit_status);
556+
xml_append_Attr_U(attribute_list, "stat", summary->exit_status);
558557
}
559558

560-
/* add the sub task to the current job element */
559+
/* add the sub-task to the current job element */
561560
attribute_list = lGetListRW(ctx->job_elem, XMLE_Attribute);
562561
lAppendElem(attribute_list, xml_elem);
563562

@@ -754,7 +753,7 @@ static int qstat_xml_job_predecessor(job_handler_t* handler, u_long32 jid, lList
754753

755754
DENTER(TOP_LAYER);
756755

757-
xml_append_Attr_I(attribute_list, "predecessor_jobs", (int)jid);
756+
xml_append_Attr_U(attribute_list, "predecessor_jobs", jid);
758757

759758
DRETURN(0);
760759
}
@@ -776,7 +775,7 @@ static int qstat_xml_job_ad_predecessor(job_handler_t* handler, u_long32 jid, lL
776775

777776
DENTER(TOP_LAYER);
778777

779-
xml_append_Attr_I(attribute_list, "ad_predecessor_jobs", (int)jid);
778+
xml_append_Attr_U(attribute_list, "ad_predecessor_jobs", jid);
780779

781780
DRETURN(0);
782781
}
@@ -1054,9 +1053,9 @@ static int qstat_xml_queue_summary(qstat_handler_t* handler, const char* qname,
10541053
xml_append_Attr_S(attribute_list, "qtype", summary->queue_type);
10551054

10561055
/* number of used/free slots */
1057-
xml_append_Attr_I(attribute_list, "slots_used", summary->used_slots);
1058-
xml_append_Attr_I(attribute_list, "slots_resv", summary->resv_slots);
1059-
xml_append_Attr_I(attribute_list, "slots_total", summary->total_slots);
1056+
xml_append_Attr_U(attribute_list, "slots_used", summary->used_slots);
1057+
xml_append_Attr_U(attribute_list, "slots_resv", summary->resv_slots);
1058+
xml_append_Attr_U(attribute_list, "slots_total", summary->total_slots);
10601059

10611060
/* load avg */
10621061
if (summary->has_load_value && summary->has_load_value_from_object) {

0 commit comments

Comments
 (0)