Commits

Palmer, 2E0EOL committed 71f71fa

Round -s input to a minimum of 1KB and down to nearest kilobyte bondary.

Comments (0)

Files changed (1)

 					else if ( sep == 'g' )
 						ChunkSizeK *= ( 1024*1024 );
 				} else { /* Bytes, divide by 1024 for kilobytes */
+					unsigned short int remainder = ChunkSizeK % 1024;
+					if ( remainder ) { /* Not evenly divisible? */
+						const char *const roundDirects[] = { "down", "up" };
+						const char *roundDirect = roundDirects[0];
+						if ( ChunkSizeK < 1024 ) {
+							roundDirect = roundDirects[1];
+							ChunkSizeK = 1024;
+						}
+						if ( DebugLevel ) {
+							fprintf(
+								stderr,
+								"Chunk size rounded %s to nearest kilobyte boundary\n",
+								roundDirect
+							);
+						}
+					}
 					ChunkSizeK /= 1024;
 				}
 				if ( DebugLevel )