Author: ithamar Date: 2010-04-11 18:29:37 +0200 (Sun, 11 Apr 2010) New Revision: 36160 Changeset: http://dev.haiku-os.org/changeset/36160/haiku Modified: haiku/trunk/src/add-ons/print/transports/ipp/Ipp.cpp haiku/trunk/src/add-ons/print/transports/usb_port/USBTransport.cpp Log: * More style fixes ;) Modified: haiku/trunk/src/add-ons/print/transports/ipp/Ipp.cpp =================================================================== --- haiku/trunk/src/add-ons/print/transports/ipp/Ipp.cpp 2010-04-11 16:13:53 UTC (rev 36159) +++ haiku/trunk/src/add-ons/print/transports/ipp/Ipp.cpp 2010-04-11 16:29:37 UTC (rev 36160) @@ -18,8 +18,7 @@ uint32 transport_features = B_TRANSPORT_IS_HOTPLUG | B_TRANSPORT_IS_NETWORK; -class IPPPrinter -{ +class IPPPrinter { public: IPPPrinter(const BString& uri, uint32 type) { fURI=uri; fType=type; } @@ -29,8 +28,7 @@ }; -class IPPPrinterRoster -{ +class IPPPrinterRoster { public: IPPPrinterRoster(); ~IPPPrinterRoster(); @@ -38,9 +36,9 @@ status_t ListPorts(BMessage *msg); status_t Listen(); private: - char *_parseString(BString& outStr, char*& pos); + char *_ParseString(BString& outStr, char*& pos); - static status_t _ippListeningThread(void *cookie); + static status_t _IPPListeningThread(void *cookie); typedef HashMap<HashString,IPPPrinter*> IPPPrinterMap; IPPPrinterMap fPrinters; @@ -66,7 +64,7 @@ return; // Now create thread for listening - fListenThreadID = spawn_thread(_ippListeningThread, "IPPListener", B_LOW_PRIORITY, this); + fListenThreadID = spawn_thread(_IPPListeningThread, "IPPListener", B_LOW_PRIORITY, this); if (fListenThreadID <= 0) return; @@ -107,11 +105,11 @@ // Check for option parameters if ((pos=strchr(packet, '"')) != NULL) { BString str; - if (_parseString(str, pos)) + if (_ParseString(str, pos)) printer->fLocation = str; - if (pos && _parseString(str, pos)) + if (pos && _ParseString(str, pos)) printer->fInfo = str; - if (pos && _parseString(str, pos)) + if (pos && _ParseString(str, pos)) printer->fMakeModel = str; if (pos) @@ -128,7 +126,8 @@ } -status_t IPPPrinterRoster::ListPorts(BMessage* msg) +status_t +IPPPrinterRoster::ListPorts(BMessage* msg) { IPPPrinterMap::Iterator iterator = fPrinters.GetIterator(); while (iterator.HasNext()) { @@ -150,7 +149,7 @@ char* -IPPPrinterRoster::_parseString(BString& outStr, char*& pos) +IPPPrinterRoster::_ParseString(BString& outStr, char*& pos) { outStr = ""; @@ -174,7 +173,7 @@ status_t -IPPPrinterRoster::_ippListeningThread(void *cookie) +IPPPrinterRoster::_IPPListeningThread(void *cookie) { return ((IPPPrinterRoster*)cookie)->Listen(); } @@ -182,7 +181,8 @@ // --- general transport hooks -extern "C" _EXPORT void exit_transport() +extern "C" _EXPORT void +exit_transport() { DBGMSG(("> exit_transport\n")); if (transport) { @@ -192,13 +192,17 @@ DBGMSG(("< exit_transport\n")); } + // List detected printers -extern "C" _EXPORT status_t list_transport_ports(BMessage* msg) +extern "C" _EXPORT status_t +list_transport_ports(BMessage* msg) { return gRoster.ListPorts(msg); } -extern "C" _EXPORT BDataIO *init_transport(BMessage *msg) + +extern "C" _EXPORT BDataIO * +init_transport(BMessage *msg) { DBGMSG(("> init_transport\n")); Modified: haiku/trunk/src/add-ons/print/transports/usb_port/USBTransport.cpp =================================================================== --- haiku/trunk/src/add-ons/print/transports/usb_port/USBTransport.cpp 2010-04-11 16:13:53 UTC (rev 36159) +++ haiku/trunk/src/add-ons/print/transports/usb_port/USBTransport.cpp 2010-04-11 16:29:37 UTC (rev 36160) @@ -32,11 +32,10 @@ #define PIT_VENDOR_SPECIFIC 0xff -class USBPrinter -{ +class USBPrinter { public: USBPrinter(const BString& id, const BString& name, - const BUSBInterface *interface, const BUSBEndpoint* in, const BUSBEndpoint* out); + const BUSBInterface *interface, const BUSBEndpoint *in, const BUSBEndpoint *out); ssize_t Write(const void *buf, size_t size); ssize_t Read(void *buf, size_t size); @@ -53,8 +52,8 @@ public: USBPrinterRoster(); - status_t DeviceAdded(BUSBDevice* dev); - void DeviceRemoved(BUSBDevice* dev); + status_t DeviceAdded(BUSBDevice *dev); + void DeviceRemoved(BUSBDevice *dev); USBPrinter *Printer(const BString& key); @@ -65,8 +64,7 @@ }; -class USBTransport : public BDataIO -{ +class USBTransport : public BDataIO { public: USBTransport(BDirectory *printer, BMessage *msg); ~USBTransport(); @@ -93,7 +91,8 @@ } -USBPrinter *USBPrinterRoster::Printer(const BString& key) +USBPrinter * +USBPrinterRoster::Printer(const BString& key) { if (fPrinters.ContainsKey(key.String())) return fPrinters.Get(key.String()); @@ -102,7 +101,8 @@ } -status_t USBPrinterRoster::DeviceAdded(BUSBDevice* dev) +status_t +USBPrinterRoster::DeviceAdded(BUSBDevice *dev) { const BUSBConfiguration *config = dev->ActiveConfiguration(); const BUSBEndpoint *in = NULL, *out = NULL; @@ -112,11 +112,11 @@ if (config) { for (uint32 idx = 0; printer == NULL && idx < config->CountInterfaces(); idx++) { const BUSBInterface *interface = config->InterfaceAt(idx); - if (interface->Class() == PRINTER_INTERFACE_CLASS && - interface->Subclass() == PRINTER_INTERFACE_SUBCLASS && - (interface->Protocol() == PIT_UNIDIRECTIONAL || - interface->Protocol() == PIT_BIDIRECTIONAL || - interface->Protocol() == PIT_1284_4_COMPATIBLE)) { + if (interface->Class() == PRINTER_INTERFACE_CLASS + && interface->Subclass() == PRINTER_INTERFACE_SUBCLASS + && (interface->Protocol() == PIT_UNIDIRECTIONAL + || interface->Protocol() == PIT_BIDIRECTIONAL + || interface->Protocol() == PIT_1284_4_COMPATIBLE)) { // Found a usable Printer interface! for (uint32 endpointIdx = 0; endpointIdx < interface->CountEndpoints(); endpointIdx++) { const BUSBEndpoint *endpoint = interface->EndpointAt(endpointIdx); @@ -166,7 +166,8 @@ } -void USBPrinterRoster::DeviceRemoved(BUSBDevice* dev) +void +USBPrinterRoster::DeviceRemoved(BUSBDevice* dev) { PrinterMap::Iterator iterator = fPrinters.GetIterator(); while (iterator.HasNext()) { @@ -181,7 +182,8 @@ } -status_t USBPrinterRoster::ListPrinters(BMessage* msg) +status_t +USBPrinterRoster::ListPrinters(BMessage* msg) { PrinterMap::Iterator iterator = fPrinters.GetIterator(); while (iterator.HasNext()) { @@ -195,14 +197,15 @@ USBPrinter::USBPrinter(const BString& id, const BString& name, - const BUSBInterface *intf, const BUSBEndpoint* in, const BUSBEndpoint* out) + const BUSBInterface *intf, const BUSBEndpoint *in, const BUSBEndpoint *out) : fInterface(intf), fOut(out), fIn(in), fName(name), fID(id) { } //TODO: see usb_printer.cpp for error handling during read/write! -ssize_t USBPrinter::Write(const void *buf, size_t size) +ssize_t +USBPrinter::Write(const void *buf, size_t size) { if (!buf || size <= 0) return B_BAD_VALUE; @@ -212,7 +215,8 @@ } -ssize_t USBPrinter::Read(void *buf, size_t size) +ssize_t +USBPrinter::Read(void *buf, size_t size) { if (!buf || size <= 0) return B_BAD_VALUE; @@ -236,7 +240,8 @@ // List detected printers -status_t list_transport_ports(BMessage* msg) +status_t +list_transport_ports(BMessage* msg) { return gUSBPrinterRoster.ListPrinters(msg); }