< prev index next >

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

Print this page
rev 16167 : 8170525: Fix minor issues in AWT/ECC/PKCS11 coding
Reviewed-by: vinnie, clanger, prr, ssadetsky


 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             snprintf(fontDirPath, sizeof(fontDirPath), "%s/fonts.dir", fDirP->name[index]);
 247             fontDirPath[sizeof(fontDirPath) - 1] = '\0';
 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 


< prev index next >