Skip to content

[Feature Request]: Issues found PVS studio static analyzer: np_common.cpp #4925

Description

@Seraphimt

Checklist

  • I have searched for a similar issue in this repository and did not find one.

Description

Analyzer message:
V547 Expression compare < 0 is always false. Unsigned type value is never < 0. np_common.cpp 49

The typo is obvious.

s32 PS4_SYSV_ABI sceNpCmpNpIdInOrder(OrbisNpId* np_id1, OrbisNpId* np_id2, 
u32* out_result) {
  ....
  // Compare data
  u32 compare =
    std::strncmp(np_id1->handle.data, np_id2->handle.data, 
    ORBIS_NP_ONLINEID_MAX_LENGTH);
  if (compare < 0) {
    *out_result = -1;
      return ORBIS_OK;
  } else if (compare > 0) {
    *out_result = 1;
    return ORBIS_OK;
  }
  ....
}

Link to an article with additional information: https://pvs-studio.com/en/blog/posts/cpp/1405/

Reason

Fixing potential bug and\or code quality.

Examples

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions