Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 0 additions & 36 deletions modules/amt-xml.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,42 +70,6 @@ function _ParseWsmanRec(node) {
return r;
}

function _PutObjToBodyXml(resuri, putObj) {
if (!resuri || putObj == null) return '';
var objname = obj.GetNameFromUrl(resuri);
var result = '<r:' + objname + ' xmlns:r="' + resuri + '">';

for (var prop in putObj) {

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🦩 πŸ”΄ amt-xml.js and amt-wsman.js reference undefined 'obj' outside factory scope

Removed the dead/broken _PutObjToBodyXml function from modules/amt-xml.js, which referenced the undefined free variable obj (a ReferenceError source since no factory closure wraps it in this file). The function was unused/unreachable in this file's exports, matching the suggested fix. No _ObjectToXmlAttributes helper existed in this file to remove separately (only referenced from within the deleted function), so its removal is implicit in deleting the calling function. All other code, formatting, and structure left untouched.

πŸ€– Prompt for AI agents
In modules/amt-xml.js around line 78, review and complete this code-review fix: amt-xml.js and amt-wsman.js reference undefined 'obj' outside factory scope.
What the draft fix changed: Removed the dead/broken `_PutObjToBodyXml` function from `modules/amt-xml.js`, which referenced the undefined free variable `obj` (a ReferenceError source since no factory closure wraps it in this file). The function was unused/unreachable in this file's exports, matching the suggested fix. No `_ObjectToXmlAttributes` helper existed in this file to remove separately (only referenced from within the deleted function), so its removal is implicit in deleting the calling function. All other code, formatting, and structure left untouched.
Verify the change is correct and complete; do not refactor unrelated code.

fix confidence: 🟒 90 high β€” react πŸ‘/πŸ‘Ž to teach the reviewer

if (!putObj.hasOwnProperty(prop) || prop.indexOf('__') === 0 || prop.indexOf('@') === 0) continue;
if (putObj[prop] == null || typeof putObj[prop] === 'function') continue;
if (typeof putObj[prop] === 'object' && putObj[prop]['ReferenceParameters']) {
result += '<r:' + prop + '><a:Address>' + putObj[prop].Address + '</a:Address><a:ReferenceParameters><w:ResourceURI>' + putObj[prop]['ReferenceParameters']["ResourceURI"] + '</w:ResourceURI><w:SelectorSet>';
var selectorArray = putObj[prop]['ReferenceParameters']['SelectorSet']['Selector'];
if (Array.isArray(selectorArray)) {
for (var i = 0; i < selectorArray.length; i++) {
result += '<w:Selector' + _ObjectToXmlAttributes(selectorArray[i]) + '>' + selectorArray[i]['Value'] + '</w:Selector>';
}
}
else {
result += '<w:Selector' + _ObjectToXmlAttributes(selectorArray) + '>' + selectorArray['Value'] + '</w:Selector>';
}
result += '</w:SelectorSet></a:ReferenceParameters></r:' + prop + '>';
}
else {
if (Array.isArray(putObj[prop])) {
for (var i = 0; i < putObj[prop].length; i++) {
result += '<r:' + prop + '>' + putObj[prop][i].toString() + '</r:' + prop + '>';
}
} else {
result += '<r:' + prop + '>' + putObj[prop].toString() + '</r:' + prop + '>';
}
}
}

result += '</r:' + objname + '>';
return result;
}

// This is a drop-in replacement to _turnToXml() that works without xml parser dependency.
function _treeBuilder() {
this.tree = [];
Expand Down
2 changes: 1 addition & 1 deletion modules/wifi-scanner.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ function WiFiScanner()
this.child.ms.on('end', function ()
{
var str = this.buffer.toString();
tokens = str.split(' - Address: ');
var tokens = str.split(' - Address: ');
for (var block in tokens)
{
if (block == 0) continue;

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🦩 🟠 wifi-scanner.js uses implicit global variable tokens (missing var)

Changed tokens = str.split(' - Address: '); to var tokens = str.split(' - Address: '); inside the this.child.ms.on('end', function () {...}) callback within WiFiScanner.prototype.Scan, declaring tokens as a local variable instead of an implicit global.

πŸ€– Prompt for AI agents
In modules/wifi-scanner.js around line 87, review and complete this code-review fix: wifi-scanner.js uses implicit global variable `tokens` (missing var).
What the draft fix changed: Changed `tokens = str.split(' - Address: ');` to `var tokens = str.split(' - Address: ');` inside the `this.child.ms.on('end', function () {...})` callback within `WiFiScanner.prototype.Scan`, declaring `tokens` as a local variable instead of an implicit global.
Verify the change is correct and complete; do not refactor unrelated code.

fix confidence: 🟒 95 high β€” react πŸ‘/πŸ‘Ž to teach the reviewer

Expand Down