Commit 887d9558 authored by Robert Sprowson's avatar Robert Sprowson
Browse files

Fix ideograph range check and a couple of resource leaks

unicdata.c: condition changed to match unictype_is_ideograph() in UnicodeLib
keygen.c: free kb
keyconvert.c: free memory and close files on exit (the C environment would do this anyway, but this makes it explicit)
Picked up by static analysis
  https://www.riscosopen.org/forum/forums/4/topics/9503#posts-72623

Version 0.99. Tagged as 'IntKey-0_99'
parent 2fca93b2
......@@ -11,13 +11,13 @@
GBLS Module_HelpVersion
GBLS Module_ComponentName
GBLS Module_ComponentPath
Module_MajorVersion SETS "0.98"
Module_Version SETA 98
Module_MajorVersion SETS "0.99"
Module_Version SETA 99
Module_MinorVersion SETS ""
Module_Date SETS "22 Nov 2014"
Module_ApplicationDate SETS "22-Nov-14"
Module_Date SETS "21 Jan 2018"
Module_ApplicationDate SETS "21-Jan-18"
Module_ComponentName SETS "IntKey"
Module_ComponentPath SETS "castle/RiscOS/Sources/Internat/IntKey"
Module_FullVersion SETS "0.98"
Module_HelpVersion SETS "0.98 (22 Nov 2014)"
Module_FullVersion SETS "0.99"
Module_HelpVersion SETS "0.99 (21 Jan 2018)"
END
/* (0.98)
/* (0.99)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 0.98
#define Module_MajorVersion_CMHG 0.99
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 22 Nov 2014
#define Module_Date_CMHG 21 Jan 2018
#define Module_MajorVersion "0.98"
#define Module_Version 98
#define Module_MajorVersion "0.99"
#define Module_Version 99
#define Module_MinorVersion ""
#define Module_Date "22 Nov 2014"
#define Module_Date "21 Jan 2018"
#define Module_ApplicationDate "22-Nov-14"
#define Module_ApplicationDate "21-Jan-18"
#define Module_ComponentName "IntKey"
#define Module_ComponentPath "castle/RiscOS/Sources/Internat/IntKey"
#define Module_FullVersion "0.98"
#define Module_HelpVersion "0.98 (22 Nov 2014)"
#define Module_LibraryVersionInfo "0:98"
#define Module_FullVersion "0.99"
#define Module_HelpVersion "0.99 (21 Jan 2018)"
#define Module_LibraryVersionInfo "0:99"
......@@ -258,6 +258,7 @@ int main(int argc, char **argv)
out = fopen(argv[2], "w");
if (!out)
{
fclose(in);
perror(argv[2]);
exit(1);
}
......@@ -268,6 +269,7 @@ int main(int argc, char **argv)
flags = read_int(in);
#ifdef UNIX
error("Unable to translate alphabet numbers under UNIX");
alphabet_no = -1;
#else
_swix(OS_ServiceCall, _INR(1,3)|_OUT(1)|_OUT(4),
0x43, 1, alphabet,
......@@ -333,7 +335,7 @@ int main(int argc, char **argv)
fprintf(out, "SPECIAL KEY CONFIGURED KEYBOARD\n");
continue;
}
if (i==0x0C && j ==6)
if (i==0x0C && j == 6)
{
fprintf(out, "SPECIAL KEY DIAL KEYBOARD\n");
continue;
......@@ -437,7 +439,11 @@ int main(int argc, char **argv)
fprintf(out, "$EndKeypad\n");
}
return 0;
/* Tidy up */
fclose(in);
fclose(out);
free(cno);
free(alphabet);
return 0;
}
......@@ -1062,6 +1062,7 @@ static void process_keyboard(FILE *in, FILE *out)
fprintf(out, "\n ALIGN\n");
fprintf(out, "\n END\n");
free(kb);
}
int main(int argc, char **argv)
......
......@@ -233,7 +233,7 @@ UCS4 UCS_from_name(const char *name)
if (strncmp(name, "CJK UNIFIED IDEOGRAPH-", 22)==0) {
UCS4 c=extract_code(name+22);
if (!((c>=0x3400 && c<=0x4DB5) || (c>=0x4E00 || c<=0x9FA5)))
if (!((c>=0x3400 && c<=0x4DB5) || (c>=0x4E00 && c<=0x9FA5)))
error("Bad ideograph");
return c;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment