Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SWMM output API bug #204

Open
cbuahin opened this issue Nov 20, 2024 · 0 comments
Open

SWMM output API bug #204

cbuahin opened this issue Nov 20, 2024 · 0 comments
Assignees
Labels
addressed Issues that have been addressed. Pending merge before closing. bug
Milestone

Comments

@cbuahin
Copy link
Collaborator

cbuahin commented Nov 20, 2024

Function for retrieving system variable assigns an address to a local variable to the output pointer. This causes an error when the local variable goes out of scope and is generally inconsistent with the strategy used else where in the code.

int EXPORT_OUT_API SMO_getSystemAttribute(SMO_Handle p_handle, int periodIndex,
    SMO_systemAttribute attr, float **outValueArray, int *length)
//
//  Purpose: For the system at given time, get a particular attribute.
//
{
    int     errorcode = 0;
    float   temp;
    data_t *p_data;

    p_data = (data_t *)p_handle;

    if (p_data == NULL)
        errorcode = -1;
    else if (periodIndex < 0 || periodIndex >= p_data->Nperiods)
        errorcode = 422;
    else {
        // don't need to loop since there's only one system
        temp = getSystemValue(p_data, periodIndex, attr);

        *outValueArray = &temp;
        *length        = 1;
    }

https://github.com/USEPA/Stormwater-Management-Model/blob/develop/src/outfile/swmm_output.c#L783-L796

@cbuahin cbuahin added the bug label Nov 20, 2024
@cbuahin cbuahin added this to the v5.3.0 milestone Nov 20, 2024
@cbuahin cbuahin self-assigned this Nov 20, 2024
@cbuahin cbuahin added the addressed Issues that have been addressed. Pending merge before closing. label Nov 22, 2024
cbuahin added a commit that referenced this issue Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addressed Issues that have been addressed. Pending merge before closing. bug
Projects
None yet
Development

No branches or pull requests

1 participant