"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/string.c" between
tin-2.4.4.tar.xz and tin-2.4.5.tar.xz

About: TIN is a threaded NNTP and spool based UseNet newsreader.

string.c  (tin-2.4.4.tar.xz):string.c  (tin-2.4.5.tar.xz)
/* /*
* Project : tin - a Usenet reader * Project : tin - a Usenet reader
* Module : string.c * Module : string.c
* Author : Urs Janssen <urs@tin.org> * Author : Urs Janssen <urs@tin.org>
* Created : 1997-01-20 * Created : 1997-01-20
* Updated : 2019-01-08 * Updated : 2020-05-31
* Notes : * Notes :
* *
* Copyright (c) 1997-2020 Urs Janssen <urs@tin.org> * Copyright (c) 1997-2021 Urs Janssen <urs@tin.org>
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions
* are met: * are met:
* *
* 1. Redistributions of source code must retain the above copyright notice, * 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer. * this list of conditions and the following disclaimer.
* *
* 2. Redistributions in binary form must reproduce the above copyright * 2. Redistributions in binary form must reproduce the above copyright
skipping to change at line 96 skipping to change at line 96
size_t i = 0; size_t i = 0;
if (digits <= 0) { if (digits <= 0) {
buffer[0] = 'e'; buffer[0] = 'e';
return buffer; return buffer;
} }
snprintf(buffer, sizeof(buffer), "%"T_ARTNUM_PFMT, value); snprintf(buffer, sizeof(buffer), "%"T_ARTNUM_PFMT, value);
len = (int) strlen(buffer); len = (int) strlen(buffer);
while (len > digits) { /*
len -= 3; * only shorten if necessary,
i++; * then ensure that the metric prefix fits into the buffer
*/
if (len > digits) {
while (len >= digits) {
len -= 3;
i++;
}
} }
if (i >= strlen(power)) { /* buffer is to small */ if (i >= strlen(power)) { /* buffer is to small */
buffer[(digits & 0x7f) - 1] = 'e'; buffer[(digits & 0x7f) - 1] = 'e';
buffer[(digits & 0x7f)] = '\0'; buffer[(digits & 0x7f)] = '\0';
return buffer; return buffer;
} }
if (i) { if (i) {
while (len < (digits - 1)) while (len < (digits - 1))
 End of changes. 3 change blocks. 
5 lines changed or deleted 11 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)