diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2022-02-06 16:04:38 +0100 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2022-02-06 16:04:38 +0100 |
commit | d0ca838c7ab297036b4a7c45351761a48fe05efd (patch) | |
tree | f0f3cc006e8157d6bd699bd644b7dd7b35387ac2 /app/lib/params/mkcarpart.c | |
parent | fd6639655b399a79fb72f494786a4f57da9c90e7 (diff) | |
parent | 5d2c2b27a6323e2666378b986129b2a7c2c39e5c (diff) |
Update upstream source from tag 'upstream/5.2.2GA'
Update to upstream version '5.2.2GA'
with Debian dir 9c80045d0b4f9e463647bc8af8c090a673df4132
Diffstat (limited to 'app/lib/params/mkcarpart.c')
-rw-r--r-- | app/lib/params/mkcarpart.c | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/app/lib/params/mkcarpart.c b/app/lib/params/mkcarpart.c index 7680a8b..1d2bf9f 100644 --- a/app/lib/params/mkcarpart.c +++ b/app/lib/params/mkcarpart.c @@ -55,7 +55,7 @@ void readMap( { FILE * mapF; char line[256]; - int len; + size_t len; mapF = fopen( mapFile, "r" ); if ( mapF == NULL ) { perror( mapFile ); @@ -110,7 +110,7 @@ void readRoadnameMap( exit(1); } while ( fgets( line, sizeof line, mapF ) != NULL ) { - int len = strlen( line ); + size_t len = strlen( line ); if ( line[len-1] == '\n' ) line[--len] = '\0'; if ( line[0] == '\0' || line[0] == '\n' || line[0] == '#' ) @@ -282,16 +282,16 @@ void processFile( int lineNumber = 0; char roadnameS[256]; char repmarkS[256]; - int len; + size_t len; int inx; char * cp, *cq; char * tab[20]; char blanks[10]; - int partX = 1; - int descX = 2; - int roadX = 3; - int numbX = 4; - int colorX = 5; + size_t partX = 1; + size_t descX = 2; + size_t roadX = 3; + size_t numbX = 4; + size_t colorX = 5; inF = fopen( inFile, "r" ); if ( inF == NULL ) { @@ -309,18 +309,28 @@ void processFile( if ( line[0] == '\n' || line[0] == '#' ) continue; len = strlen(line); - if ( line[len-1] == '\n' ) + if ( len >= 1 && line[len-1] == '\n' ) line[len-1] = '\0'; + if ( len >= 2 && line[len-2] == '\r' ) + line[len-2] = '\0'; if ( strnicmp( line, "scale=", 6 ) == 0 ) { strcpy( scale, line+6 ); if ( stricmp( scale, "N" ) == 0 ) ratio = 160.0; - else if ( stricmp( scale, "HO" ) == 0 ) + else if ( stricmp( scale, "HO" ) == 0 || stricmp(scale, "HOn3") == 0 ) ratio = 87.1; - else if ( stricmp( scale, "O" ) == 0 ) - ratio = 48.0; - else if ( stricmp( scale, "S" ) == 0 ) + else if ( stricmp( scale, "S" ) == 0 || stricmp(scale, "Sn3") == 0 ) ratio = 64.0; + else if ( stricmp(scale, "O") == 0 || stricmp(scale, "On3") == 0 || stricmp(scale, "On30") == 0 ) + ratio = 48.0; + else if ( stricmp(scale, "1") == 0 ) + ratio = 32.0; + else if ( stricmp(scale, "A") == 0 ) + ratio = 29.0; + else if ( stricmp(scale, "G") == 0 ) + ratio = 22.5; + else if ( stricmp(scale, "F") == 0 || stricmp(scale, "Fn2") == 0 || stricmp(scale, "Fn3") == 0 ) + ratio = 20.32; else { fprintf( stderr, "%d: Unknown scale %s\n", lineNumber, scale ); ratio = 87.1; |