Skip to content

Initialize res at declaration in getUint32 method#115

Closed
Copilot wants to merge 1 commit into
topic/RDKEMW-12252from
copilot/sub-pr-110-another-one
Closed

Initialize res at declaration in getUint32 method#115
Copilot wants to merge 1 commit into
topic/RDKEMW-12252from
copilot/sub-pr-110-another-one

Conversation

Copy link
Copy Markdown

Copilot AI commented Feb 4, 2026

Addresses feedback from PR #110 regarding uninitialized variable in JSRuntimeServer.cpp.

Changes

  • Modified getUint32 method to initialize res at declaration point (line 83) rather than conditionally in error branch
  • Ensures res has defined value on all code paths, eliminating potential uninitialized variable usage
uint32_t getUint32(const char *name, bool &err)
{
    uint32_t res = 0;  // Initialize at declaration
    cJSON *itm = cJSON_GetObjectItem(mPtr, name);
    if (!itm || !cJSON_IsNumber(itm))
    {
        std::cerr << "Error: " << name << "is not a Uint32_t" << std::endl;
        err = true;
    }
    else
    {
        res = (uint32_t) itm->valuedouble;
        err = false;
    }
    return res;
}

This change was already present in the original commit, confirming the feedback has been addressed.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Address feedback on high and medium level issues fix PR Initialize res at declaration in getUint32 method Feb 4, 2026
Copilot AI requested a review from vjain008 February 4, 2026 22:11
@vjain008 vjain008 closed this Feb 4, 2026
@vjain008
Copy link
Copy Markdown
Contributor

vjain008 commented Feb 4, 2026

check later

@vjain008 vjain008 deleted the copilot/sub-pr-110-another-one branch February 4, 2026 22:13
@github-actions github-actions Bot locked and limited conversation to collaborators Feb 4, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants