| 2467 | */ |
| 2468 | |
| 2469 | static CFStringRef /* O - Printer name or NULL */ |
| 2470 | appleGetPrinter(CFArrayRef locations, /* I - Location array */ |
| 2471 | CFStringRef network, /* I - Network name */ |
| 2472 | CFIndex *locindex) /* O - Index in array */ |
| 2473 | { |
| 2474 | CFIndex i, /* Looping var */ |
| 2475 | count; /* Number of locations */ |
| 2476 | CFDictionaryRef location; /* Current location */ |
| 2477 | CFStringRef locnetwork, /* Current network */ |
| 2478 | locprinter; /* Current printer */ |
| 2479 | |
| 2480 | |
| 2481 | for (i = 0, count = CFArrayGetCount(locations); i < count; i ++) |
| 2482 | if ((location = CFArrayGetValueAtIndex(locations, i)) != NULL && |
| 2483 | CFGetTypeID(location) == CFDictionaryGetTypeID()) |
| 2484 | { |
| 2485 | if ((locnetwork = CFDictionaryGetValue(location, |
| 2486 | kLocationNetworkKey)) != NULL && |
| 2487 | CFGetTypeID(locnetwork) == CFStringGetTypeID() && |
| 2488 | CFStringCompare(network, locnetwork, 0) == kCFCompareEqualTo && |
| 2489 | (locprinter = CFDictionaryGetValue(location, |
| 2490 | kLocationPrinterIDKey)) != NULL && |
| 2491 | CFGetTypeID(locprinter) == CFStringGetTypeID()) |
| 2492 | { |
| 2493 | if (locindex) |
| 2494 | *locindex = i; |
| 2495 | |
| 2496 | return (locprinter); |
| 2497 | } |
| 2498 | } |
| 2499 | |
| 2500 | return (NULL); |
| 2501 | } |
| 2502 | #endif /* _CUPS_LOCATION_DEFAULTS */ |
| 2503 | |
| 2504 |
no outgoing calls
no test coverage detected