"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/charset.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.

charset.c  (tin-2.4.4.tar.xz):charset.c  (tin-2.4.5.tar.xz)
/* /*
* Project : tin - a Usenet reader * Project : tin - a Usenet reader
* Module : charset.c * Module : charset.c
* Author : M. Kuhn, T. Burmester * Author : M. Kuhn, T. Burmester
* Created : 1993-12-10 * Created : 1993-12-10
* Updated : 2019-07-05 * Updated : 2020-02-26
* Notes : ISO to ascii charset conversion routines * Notes : ISO to ascii charset conversion routines
* *
* Copyright (c) 1993-2020 Markus Kuhn <mgk25@cl.cam.ac.uk> * Copyright (c) 1993-2021 Markus Kuhn <mgk25@cl.cam.ac.uk>
* 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 149 skipping to change at line 149
"\212","\202","\210","\211","\215","\241","\214","\213", "\212","\202","\210","\211","\215","\241","\214","\213",
"d","\244","\225","\242","\223","o","\224","\366", "d","\244","\225","\242","\223","o","\224","\366",
"\355","\227","\243","\226","\201","y","t","\230" "\355","\227","\243","\226","\201","y","t","\230"
} }
}; };
/* /*
* german tex style to latin1 conversion (by root@aspic, 12/04/93) * german tex style to latin1 conversion (by root@aspic, 12/04/93)
*/ */
#define TEX_SUBST 15 #define TEX_SUBST 16
#define SPACES " " #define SPACES " "
static const char *const tex_from[TEX_SUBST] = static const char *const tex_from[TEX_SUBST] =
{ {
"\"a","\\\"a","\"o","\\\"o","\"u","\\\"u","\"A","\\\"A","\"O","\\\"O","\" U","\\\"U","\"s","\\\"s","\\3" "\"a","\\\"a","\"o","\\\"o","\"u","\\\"u","\"A","\\\"A","\"O","\\\"O","\" U","\\\"U","\"s","\\\"s","\\3",'\0'
}; };
/* /*
* Now the conversion function... * Now the conversion function...
*/ */
void void
convert_iso2asc( convert_iso2asc(
char *iso, char *iso,
char **asc_buffer, char **asc_buffer,
skipping to change at line 273 skipping to change at line 273
char *to) char *to)
{ {
const char *tex_to[TEX_SUBST]; const char *tex_to[TEX_SUBST];
int i; int i;
size_t spaces = 0; /* spaces to add */ size_t spaces = 0; /* spaces to add */
size_t len, col = 0; /* length of from, col counter */ size_t len, col = 0; /* length of from, col counter */
size_t subst_len; size_t subst_len;
t_bool ex; t_bool ex;
/* initialize tex_to */ /* initialize tex_to */
memset(tex_to, '\0', sizeof(tex_to));
/* /*
* Charsets which have german umlauts incl. sharp s at the same * Charsets which have german umlauts incl. sharp s at the same
* code position as ISO-8859-1 * code position as ISO-8859-1
* DEC-MCS, Windows-1252 * DEC-MCS, Windows-1252
*/ */
if (IS_LOCAL_CHARSET("ISO-8859-1") || if (IS_LOCAL_CHARSET("ISO-8859-1") ||
IS_LOCAL_CHARSET("ISO-8859-2") || IS_LOCAL_CHARSET("ISO-8859-2") ||
IS_LOCAL_CHARSET("ISO-8859-3") || IS_LOCAL_CHARSET("ISO-8859-3") ||
IS_LOCAL_CHARSET("ISO-8859-4") || IS_LOCAL_CHARSET("ISO-8859-4") ||
IS_LOCAL_CHARSET("ISO-8859-9") || IS_LOCAL_CHARSET("ISO-8859-9") ||
skipping to change at line 301 skipping to change at line 303
tex_to[5] = tex_to[4] = "\374"; /* uuml */ tex_to[5] = tex_to[4] = "\374"; /* uuml */
tex_to[7] = tex_to[6] = "\304"; /* Auml */ tex_to[7] = tex_to[6] = "\304"; /* Auml */
tex_to[9] = tex_to[8] = "\326"; /* Ouml */ tex_to[9] = tex_to[8] = "\326"; /* Ouml */
tex_to[11] = tex_to[10] = "\334"; /* Uuml */ tex_to[11] = tex_to[10] = "\334"; /* Uuml */
tex_to[14] = tex_to[13] = tex_to[12] = "\337"; /* szlig */ tex_to[14] = tex_to[13] = tex_to[12] = "\337"; /* szlig */
} else if (IS_LOCAL_CHARSET("UTF-8")) { /* locale charset is UTF-8 */ } else if (IS_LOCAL_CHARSET("UTF-8")) { /* locale charset is UTF-8 */
tex_to[1] = tex_to[0] = "\303\244"; /* auml */ tex_to[1] = tex_to[0] = "\303\244"; /* auml */
tex_to[3] = tex_to[2] = "\303\266"; /* ouml */ tex_to[3] = tex_to[2] = "\303\266"; /* ouml */
tex_to[5] = tex_to[4] = "\303\274"; /* uuml */ tex_to[5] = tex_to[4] = "\303\274"; /* uuml */
tex_to[7] = tex_to[6] = "\303\204"; /* Auml */ tex_to[7] = tex_to[6] = "\303\204"; /* Auml */
tex_to[9] = tex_to[8] = "\303\266"; /* Ouml */ tex_to[9] = tex_to[8] = "\303\226"; /* Ouml */
tex_to[11] = tex_to[10] = "\303\234"; /* Uuml */ tex_to[11] = tex_to[10] = "\303\234"; /* Uuml */
tex_to[14] = tex_to[13] = tex_to[12] = "\303\237"; /* szlig */ tex_to[14] = tex_to[13] = tex_to[12] = "\303\237"; /* szlig */
} else { } else {
strcpy(to, from); strcpy(to, from);
return; return;
} }
*to = '\0'; *to = '\0';
len = strlen(from); len = strlen(from);
while (col < len) { while (col < len) {
i = 0; i = 0;
ex = FALSE; ex = FALSE;
while ((i < TEX_SUBST) && !ex) { while ((i < TEX_SUBST - 1) && !ex) {
subst_len = strlen(tex_from[i]); subst_len = strlen(tex_from[i]);
if (!strncmp(from + col, tex_from[i], subst_len)) { if (!strncmp(from + col, tex_from[i], subst_len)) {
strcat(to, tex_to[i]); strcat(to, tex_to[i]);
spaces += subst_len - strlen(tex_to[i]); spaces += subst_len - strlen(tex_to[i]);
col += subst_len - 1; col += subst_len - 1;
ex = TRUE; ex = TRUE;
} }
i++; i++;
} }
if (!ex) if (!ex)
 End of changes. 7 change blocks. 
6 lines changed or deleted 8 lines changed or added

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