< prev index next >

src/java.desktop/unix/native/common/awt/fontpath.c

Print this page
rev 16167 : 8170525: Fix minor issues in awt coding


 226 
 227         tempFontPath = origFontPath;
 228         for ( origIndex = 0; origIndex < nPaths; origIndex++ ) {
 229 
 230             onePath = *tempFontPath;
 231 
 232             compareLength = strlen ( onePath );
 233             if ( onePath[compareLength -1] == '/' )
 234               compareLength--;
 235 
 236             /* there is a slash at the end of every solaris X11 font path name */
 237             if ( strncmp ( onePath, fDirP->name[index], compareLength ) == 0 ) {
 238               doNotAppend = 1;
 239               break;
 240             }
 241             tempFontPath++;
 242         }
 243 
 244         appendDirList[index] = 0;
 245         if ( doNotAppend == 0 ) {
 246             strcpy ( fontDirPath, fDirP->name[index] );
 247             strcat ( fontDirPath, "/fonts.dir" );

 248             dirFile = open ( fontDirPath, O_RDONLY, 0 );
 249             if ( dirFile == -1 ) {
 250                 doNotAppend = 1;
 251             } else {
 252                close ( dirFile );
 253                totalDirCount++;
 254                appendDirList[index] = 1;
 255             }
 256         }
 257 
 258     }
 259 
 260     /* if no changes are required do not bother to do a setfontpath */
 261     if ( totalDirCount == nPaths ) {
 262       free ( ( void *) appendDirList );
 263       XFreeFontPath ( origFontPath );
 264       return;
 265     }
 266 
 267 




 226 
 227         tempFontPath = origFontPath;
 228         for ( origIndex = 0; origIndex < nPaths; origIndex++ ) {
 229 
 230             onePath = *tempFontPath;
 231 
 232             compareLength = strlen ( onePath );
 233             if ( onePath[compareLength -1] == '/' )
 234               compareLength--;
 235 
 236             /* there is a slash at the end of every solaris X11 font path name */
 237             if ( strncmp ( onePath, fDirP->name[index], compareLength ) == 0 ) {
 238               doNotAppend = 1;
 239               break;
 240             }
 241             tempFontPath++;
 242         }
 243 
 244         appendDirList[index] = 0;
 245         if ( doNotAppend == 0 ) {
 246             strncpy(fontDirPath, fDirP->name[index], sizeof(fontDirPath));
 247             fontDirPath[sizeof(fontDirPath)-1] = '\0';
 248             strncat(fontDirPath, "/fonts.dir", sizeof(fontDirPath) - strlen(fontDirPath));
 249             dirFile = open ( fontDirPath, O_RDONLY, 0 );
 250             if ( dirFile == -1 ) {
 251                 doNotAppend = 1;
 252             } else {
 253                close ( dirFile );
 254                totalDirCount++;
 255                appendDirList[index] = 1;
 256             }
 257         }
 258 
 259     }
 260 
 261     /* if no changes are required do not bother to do a setfontpath */
 262     if ( totalDirCount == nPaths ) {
 263       free ( ( void *) appendDirList );
 264       XFreeFontPath ( origFontPath );
 265       return;
 266     }
 267 
 268 


< prev index next >