]> granicus.if.org Git - graphviz/commit
cdt: use 'size_t' types for counting stats instead of 'int'
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Thu, 3 Nov 2022 05:02:42 +0000 (22:02 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Fri, 4 Nov 2022 04:18:04 +0000 (21:18 -0700)
commit98544a496f58864028517747584d49bd90355e33
treefddfe5aa8086d8a84112e8fa81a548bb98a1a50c
parenta97b535cd279d36a34c9de982ce8886179c80751
cdt: use 'size_t' types for counting stats instead of 'int'

This squashes two compiler warnings:

  dtstat.c: In function ‘dtstat’:
  dtstat.c:60:59: warning: conversion to ‘long unsigned int’ from ‘int’ may
    change the sign of the result [-Wsign-conversion]
     60 |  if(!(Count = malloc((ds->dt_max+1)*sizeof(int))) )
        |                                    ^
  dtstat.c:74:65: warning: conversion to ‘long unsigned int’ from ‘int’ may
    change the sign of the result [-Wsign-conversion]
     74 |  if(!(Count = malloc((ds->dt_n+1)*sizeof(int))) )
        |                                  ^

It also allows these functions to now count beyond 2³¹ - 1.
lib/cdt/cdt.h
lib/cdt/dtstat.c