• Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Minor - P4 Minor - P4
    • 4.4
    • Affects Version/s: None
    • Component/s: None
    • None

      redundant code 1, we should remove the PyErr_Occurred check:

      208static int millis_from_datetime_ms(PyObject* dt, long long* out){
      209    PyObject* ll_millis;
      210    long long millis;
      211
         	1. Condition !(ll_millis = PyNumber_Long(dt)), taking true branch.
         	2. var_compare_op: Comparing ll_millis to null implies that ll_millis might be null.
      212    if (!(ll_millis = PyNumber_Long(dt))){
         	3. Condition PyErr_Occurred(), taking false branch.
      213        if (PyErr_Occurred()) { // TypeError
      214            return 0;
      215        }
      216    }
      

      redundant code 2, we should remove "if (dt_auto)":

      1988                    // Continues from here to return a datetime.
          	const: At condition dt_auto, the value of dt_auto must be equal to 1.
          	
      CID 127657 (#1 of 1): Redundant test (DEADCODE)
      dead_error_condition: The condition dt_auto must be true.
      1989                } else if (dt_auto) {
      1990                    if (millis < min_millis || millis > max_millis){
      1991                        value = datetime_ms_from_millis(self, millis);
      1992                        break; // Out-of-range so done.
      1993                    }
      1994                }
      

      Issue 3, we should use strncat instead of strcat:

      702    if (int_flags & 64) {
         	
      CID 123560 (#6 of 6): Calling risky function (DC.STRING_BUFFER)
      dont_call: The destination of a strcat call must have enough space to accept the source.
         	Use strncat instead.
      703        STRCAT(flags, FLAGS_SIZE, "x");
      

            Assignee:
            shane.harvey@mongodb.com Shane Harvey
            Reporter:
            shane.harvey@mongodb.com Shane Harvey
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: