diff options
Diffstat (limited to 'project/dclib')
| -rw-r--r-- | project/dclib/dclib-basics.c | 16 | ||||
| -rw-r--r-- | project/dclib/dclib-file.c | 12 | ||||
| -rw-r--r-- | project/dclib/dclib-network.c | 24 | ||||
| -rw-r--r-- | project/dclib/dclib-option.c | 2 | ||||
| -rw-r--r-- | project/dclib/dclib-ui.c | 7 | ||||
| -rw-r--r-- | project/dclib/dclib-xdump.c | 2 |
6 files changed, 32 insertions, 31 deletions
diff --git a/project/dclib/dclib-basics.c b/project/dclib/dclib-basics.c index 793ddcd..1aab8cb 100644 --- a/project/dclib/dclib-basics.c +++ b/project/dclib/dclib-basics.c @@ -1956,7 +1956,8 @@ uint SetupAllocInfo() noPRINT("%4x: %p [%zx]\n",i,alloc[i],alloc[i]-alloc[ i>0 ? i-1 : 0 ] ); if ( i > 1 ) { - int diff = abs ( alloc[i-1] - alloc[i] ); + const int diff = abs ( (int)(uintptr_t)(alloc[i-1]) + - (int)(uintptr_t)(alloc[i]) ); mask_found &= diff - 1; } } @@ -1976,7 +1977,8 @@ uint SetupAllocInfo() int found = 0x100; for ( i = 2; i <= MAX; i++ ) { - const int diff = abs ( alloc[i-1] - alloc[i] ) - i; + const int diff = abs ( (int)(uintptr_t)(alloc[i-1]) + - (int)(uintptr_t)(alloc[i]) ) - i; if ( diff >= 0 && found > diff ) found = diff; } @@ -5315,9 +5317,9 @@ u32 ColorTab_M0_M15[16] = u8 ConvertColorRGB3ToM256 ( u8 r, u8 g, u8 b ) { // 0..5 - const uint r6 = SingleColorToM6(r); - const uint g6 = SingleColorToM6(g); - const uint b6 = SingleColorToM6(b); + const int r6 = SingleColorToM6(r); + const int g6 = SingleColorToM6(g); + const int b6 = SingleColorToM6(b); u8 m256 = 36*r6 + 6*g6 + b6 + 16; uint delta = abs ( ( r6 ? 55 + 40 * r6 : 0 ) - r ) @@ -5326,7 +5328,7 @@ u8 ConvertColorRGB3ToM256 ( u8 r, u8 g, u8 b ) //printf("%02x>%u %02x>%u %02x>%u : m=%u delta=%d\n",r,r6,g,g6,b,b6,m256,delta); - uint m, gray, prev = 0x1000000; + int m, gray, prev = 0x1000000; for ( m = 232, gray = 8; m < 256; m++, gray += 10 ) { const uint d = abs( gray - r ) + abs( gray - g ) + abs( gray - b ); @@ -7839,7 +7841,7 @@ void LogGrowBuffer PrintSize1024(0,0,gb->used,DC_SFORM_TINY|DC_SFORM_ALIGN), PrintSize1024(0,0,gb->max_used,DC_SFORM_TINY|DC_SFORM_ALIGN), PrintSize1024(0,0,gb->size,DC_SFORM_TINY|DC_SFORM_ALIGN), - PrintNumberU6(0,0,gb->ptr-gb->buf,true), + PrintNumberU6(0,0,gb->ptr-gb->buf,DC_SFORM_ALIGN), PrintSize1024(0,0,gb->grow_size,DC_SFORM_TINY|DC_SFORM_ALIGN), PrintSize1024(0,0,gb->max_size,DC_SFORM_TINY|DC_SFORM_ALIGN), gb->disabled ); diff --git a/project/dclib/dclib-file.c b/project/dclib/dclib-file.c index b7f1702..eb4f9ea 100644 --- a/project/dclib/dclib-file.c +++ b/project/dclib/dclib-file.c @@ -875,8 +875,8 @@ enumError OpenFile if ( limit && f->st.st_size > limit ) { char sbuf[12], lbuf[12]; - PrintSize1024(sbuf,sizeof(sbuf),(u64)f->st.st_size,false); - PrintSize1024(lbuf,sizeof(lbuf),(u64)limit,false); + PrintSize1024(sbuf,sizeof(sbuf),(u64)f->st.st_size,0); + PrintSize1024(lbuf,sizeof(lbuf),(u64)limit,0); // be tolerant, if both values produce same text if (strcmp(sbuf,lbuf)) @@ -1839,13 +1839,13 @@ enumError TransferFile LOGPRINT("TransferFile(MOVE1) %s -> %s\n",src,dest); struct stat st; if ( !stat(src,&st) && st.st_nlink == 1 && !rename(src,dest) ) - return true; + return ERR_OK; } else if ( tfer_mode & TFMD_J_MOVE ) { LOGPRINT("TransferFile(MOVE) %s -> %s\n",src,dest); if (!rename(src,dest)) - return true; + return ERR_OK; } if ( tfer_mode & TFMD_J_LINK ) @@ -1856,7 +1856,7 @@ enumError TransferFile LOGPRINT("TransferFile(LINK) %s -> %s\n",src,dest); if (!link(src,dest)) - return true; + return ERR_OK; } if ( tfer_mode & TFMD_J_COPY ) @@ -1872,7 +1872,7 @@ enumError TransferFile PRINT("TransferFile(RM_SRC) %s",src); unlink(src); } - return true; + return ERR_OK; } } diff --git a/project/dclib/dclib-network.c b/project/dclib/dclib-network.c index a1fb253..eec0030 100644 --- a/project/dclib/dclib-network.c +++ b/project/dclib/dclib-network.c @@ -1423,9 +1423,9 @@ void PrintTranferStatistics prefix, color1, name, stat->conn_count, stat->conn_count == 1 ? "" : "s", stat->recv_count, stat->recv_count == 1 ? "" : "s", - PrintSize1024(0,0,stat->recv_size,false), + PrintSize1024(0,0,stat->recv_size,0), stat->send_count, stat->send_count == 1 ? "" : "s", - PrintSize1024(0,0,stat->send_size,false), + PrintSize1024(0,0,stat->send_size,0), color0 ); } else if ( stat->recv_count || stat->send_count ) @@ -1434,9 +1434,9 @@ void PrintTranferStatistics "%s%s#STAT-%-5s %u packet%s (%s) received, %u packet%s (%s) send.%s\n", prefix, color1, name, stat->recv_count, stat->recv_count == 1 ? "" : "s", - PrintSize1024(0,0,stat->recv_size,false), + PrintSize1024(0,0,stat->recv_size,0), stat->send_count, stat->send_count == 1 ? "" : "s", - PrintSize1024(0,0,stat->send_size,false), + PrintSize1024(0,0,stat->send_size,0), color0 ); } else @@ -1465,8 +1465,8 @@ void PrintTranferStatistics duration_info, delta.recv_count, crate, delta.recv_count == 1 ? "" : "s", - PrintSize1024(0,0,delta.recv_size,false), - PrintSize1024(0,0,srate,false), + PrintSize1024(0,0,delta.recv_size,0), + PrintSize1024(0,0,srate,0), color0 ); } @@ -1481,8 +1481,8 @@ void PrintTranferStatistics duration_info, delta.send_count, crate, delta.send_count == 1 ? "" : "s", - PrintSize1024(0,0,delta.send_size,false), - PrintSize1024(0,0,srate,false), + PrintSize1024(0,0,delta.send_size,0), + PrintSize1024(0,0,srate,0), color0 ); } } @@ -2204,8 +2204,8 @@ void LogTCPStream fprintf(f,"%*sTS: id:%x, sock=%d, %u packets received (%s), %u packets send (%s)", indent,"", ts->unique_id, ts->sock, - ts->stat.recv_count, PrintSize1024(0,0,ts->stat.recv_size,false), - ts->stat.send_count, PrintSize1024(0,0,ts->stat.send_size,false) ); + ts->stat.recv_count, PrintSize1024(0,0,ts->stat.recv_size,0), + ts->stat.send_count, PrintSize1024(0,0,ts->stat.send_size,0) ); if (format) { @@ -3394,8 +3394,8 @@ void LogTCPHandler fprintf(f,"\n%*s %u connects, %u packets received (%s), %u packets send (%s)\n", indent,"", th->stat.conn_count, - th->stat.recv_count, PrintSize1024(0,0,th->stat.recv_size,false), - th->stat.send_count, PrintSize1024(0,0,th->stat.send_size,false) ); + th->stat.recv_count, PrintSize1024(0,0,th->stat.recv_size,0), + th->stat.send_count, PrintSize1024(0,0,th->stat.send_size,0) ); if (recurse>0) { diff --git a/project/dclib/dclib-option.c b/project/dclib/dclib-option.c index 5a2044b..9dc07b7 100644 --- a/project/dclib/dclib-option.c +++ b/project/dclib/dclib-option.c @@ -538,7 +538,7 @@ ccp PrintGParam ( const GParam_t *par ) case GOPT_IDX_SIZE: snprintf(buf,sizeof(buf),"[SIZE] %llu = %s", - par->un64, PrintSize1024(0,0,par->un64,false) ); + par->un64, PrintSize1024(0,0,par->un64,0) ); break; case GOPT_IDX_DOUBLE: diff --git a/project/dclib/dclib-ui.c b/project/dclib/dclib-ui.c index 67226dd..a642431 100644 --- a/project/dclib/dclib-ui.c +++ b/project/dclib/dclib-ui.c @@ -424,7 +424,6 @@ void DumpText case '@': case '$': - case '§': if (!is_makedoc) { if ( text[1] == *text ) @@ -574,11 +573,11 @@ static void print_help_options if (title) { - const bool is_col = IsFileColorized(f); + const ColorMode_t colmode = GetFileColorized(f); fprintf(f,"%*s%s%s:%s\n\n", indent,"", - GetTextMode(is_col,TTM_COL_HEADING), title, - GetTextMode(is_col,TTM_RESET) ); + GetTextMode(colmode,TTM_COL_HEADING), title, + GetTextMode(colmode,TTM_RESET) ); } const int fw = GetTermWidth(80,40) - 1; diff --git a/project/dclib/dclib-xdump.c b/project/dclib/dclib-xdump.c index c404966..ec0e49a 100644 --- a/project/dclib/dclib-xdump.c +++ b/project/dclib/dclib-xdump.c @@ -602,7 +602,7 @@ static int DumpFloat if ( xd->bytes_per_col == 4 ) { val = xd->endian_func->rdf4(p.d); - format = fabsf(val) <= 9999.0 && fabsf(val) >= 1e-3 + format = fabs(val) <= 9999.0 && fabs(val) >= 1e-3 ? xd->num_format1 : xd->num_format2; p.d += 4; } |
