Fix gcc4 build:

- use new(std::nothrow) from <new> since we dropped kernel_cpp.h,
- fix "declared 'extern' and later 'static'" warning,
- fix "deprecated conversion from string constant to 'char*'" warning in tracing code.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39784 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
François Revol 2010-12-09 00:40:25 +00:00
parent 0bf128487a
commit b77aa0155d
4 changed files with 8 additions and 15 deletions

View File

@ -90,15 +90,6 @@ void uninit_driver();
bool usb_serial_service(struct tty *tty, uint32 op, void *buffer,
size_t length);
status_t usb_serial_open(const char *name, uint32 flags, void **cookie);
status_t usb_serial_read(void *cookie, off_t position, void *buffer, size_t *numBytes);
status_t usb_serial_write(void *cookie, off_t position, const void *buffer, size_t *numBytes);
status_t usb_serial_control(void *cookie, uint32 op, void *arg, size_t length);
status_t usb_serial_select(void *cookie, uint8 event, uint32 ref, selectsync *sync);
status_t usb_serial_deselect(void *coookie, uint8 event, selectsync *sync);
status_t usb_serial_close(void *cookie);
status_t usb_serial_free(void *cookie);
const char **publish_devices();
device_hooks *find_device(const char *name);
}

View File

@ -5,6 +5,8 @@
* Copyright (c) 2003 by Siarzhuk Zharski <imker@gmx.li>
* Distributed under the terms of the MIT License.
*/
#include <new>
#include "SerialDevice.h"
#include "USB3.h"
@ -637,7 +639,7 @@ SerialDevice::MakeDevice(usb_device device, uint16 vendorID,
if (!description)
break;
return new ProlificDevice(device, vendorID, productID, description);
return new(std::nothrow) ProlificDevice(device, vendorID, productID, description);
}
case VENDOR_FTDI:
@ -650,7 +652,7 @@ SerialDevice::MakeDevice(usb_device device, uint16 vendorID,
if (!description)
break;
return new FTDIDevice(device, vendorID, productID, description);
return new(std::nothrow) FTDIDevice(device, vendorID, productID, description);
}
case VENDOR_PALM:
@ -664,9 +666,9 @@ SerialDevice::MakeDevice(usb_device device, uint16 vendorID,
if (!description)
break;
return new KLSIDevice(device, vendorID, productID, description);
return new(std::nothrow) KLSIDevice(device, vendorID, productID, description);
}
}
return new ACMDevice(device, vendorID, productID, "CDC ACM compatible device");
return new(std::nothrow) ACMDevice(device, vendorID, productID, "CDC ACM compatible device");
}

View File

@ -70,7 +70,7 @@ create_log_file()
void
usb_serial_trace(bool force, char *format, ...)
usb_serial_trace(bool force, const char *format, ...)
{
if (!gLogEnabled && !force)
return;

View File

@ -10,7 +10,7 @@
void load_settings();
void create_log_file();
void usb_serial_trace(bool force, char *format, ...);
void usb_serial_trace(bool force, const char *format, ...);
#define TRACE_ALWAYS(x...) usb_serial_trace(true, x);
#define TRACE(x...) usb_serial_trace(false, x);