diff --git a/build/jam/OptionalBuildFeatures b/build/jam/OptionalBuildFeatures index 391e129a8f..cdd17eb11f 100644 --- a/build/jam/OptionalBuildFeatures +++ b/build/jam/OptionalBuildFeatures @@ -467,7 +467,7 @@ if [ IsOptionalHaikuImagePackageAdded WebPositive ] { HAIKU_BUILD_FEATURE_WEBKIT = 1 ; } -HAIKU_WEBKIT_FILE = haikuwebkit-1.1.2-x86-gcc4-2012-07-11.zip ; +HAIKU_WEBKIT_FILE = haikuwebkit-1.1.3-x86-gcc4-2012-07-20-1.zip ; if $(HAIKU_BUILD_FEATURE_WEBKIT) { if $(TARGET_ARCH) != x86 { diff --git a/build/jam/OptionalPackageDependencies b/build/jam/OptionalPackageDependencies index aa4a525d3b..9bca225c2e 100644 --- a/build/jam/OptionalPackageDependencies +++ b/build/jam/OptionalPackageDependencies @@ -10,7 +10,7 @@ OptionalPackageDependencies ArmyKnife : TagLib ; OptionalPackageDependencies Beam : LibIconv LibLayout OpenSSL PCRE ; OptionalPackageDependencies BeHappy : BeBook NetSurf ; OptionalPackageDependencies BurnItNow : CDRecord ; -OptionalPackageDependencies CDRecord : LibIconv ; +OptionalPackageDependencies CDRecord : GetText LibIconv ; OptionalPackageDependencies Curl : OpenSSL ; OptionalPackageDependencies DevelopmentBase : CDRecord DevelopmentMin Yasm ; OptionalPackageDependencies Development : DevelopmentBase Perl ; diff --git a/build/jam/OptionalPackages b/build/jam/OptionalPackages index f4b3dd97b6..caf1e5e71a 100644 --- a/build/jam/OptionalPackages +++ b/build/jam/OptionalPackages @@ -409,12 +409,12 @@ if [ IsOptionalHaikuImagePackageAdded CDRecord ] { Echo "No optional package CDRecord available for $(TARGET_ARCH)" ; } else if $(HAIKU_GCC_VERSION[1]) >= 4 { InstallOptionalHaikuImagePackage - cdrtools-3.01a06-x86-gcc4-2012-06-19.zip - : $(baseURL)/cdrtools-3.01a06-x86-gcc4-2012-06-19.zip ; + cdrtools-3.01a07-x86-gcc4-2012-06-19.zip + : $(baseURL)/cdrtools-3.01a07-x86-gcc4-2012-07-19.zip ; } else { InstallOptionalHaikuImagePackage - cdrtools-3.01a06-x86-gcc2-2012-06-20.zip - : $(baseURL)/cdrtools-3.01a06-x86-gcc2-2012-06-20.zip ; + cdrtools-3.01a07-x86-gcc2-2012-07-19-r2.zip + : $(baseURL)/cdrtools-3.01a07-x86-gcc2-2012-07-19-r2.zip ; } } diff --git a/headers/posix/alloca.h b/headers/posix/alloca.h index 82bc2971c0..dfe8f0d180 100644 --- a/headers/posix/alloca.h +++ b/headers/posix/alloca.h @@ -1,5 +1,5 @@ /* - * Copyright 2003-2010 Haiku Inc. All Rights Reserved. + * Copyright 2003-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _ALLOCA_H diff --git a/headers/posix/arch/arm/arch_setjmp.h b/headers/posix/arch/arm/arch_setjmp.h index 7db0bea9fe..d1f1a14a10 100644 --- a/headers/posix/arch/arm/arch_setjmp.h +++ b/headers/posix/arch/arm/arch_setjmp.h @@ -1,5 +1,5 @@ /* - * Copyright 2008-2010 Haiku Inc. All Rights Reserved. + * Copyright 2008-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _ARCH_SETJMP_H_ diff --git a/headers/posix/arch/arm/signal.h b/headers/posix/arch/arm/signal.h index a6572ab074..19a593d5db 100644 --- a/headers/posix/arch/arm/signal.h +++ b/headers/posix/arch/arm/signal.h @@ -1,5 +1,5 @@ /* - * Copyright 2008-2010 Haiku Inc. All Rights Reserved. + * Copyright 2008-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _ARCH_SIGNAL_H_ @@ -32,7 +32,7 @@ struct vregs ulong cpsr; #warning ARM: fix floats in vregs, add missing stuff. }; -#endif /* __ARM__ */ +#endif /* __ARM__ */ #endif /* _ARCH_SIGNAL_H_ */ diff --git a/headers/posix/arch/m68k/arch_setjmp.h b/headers/posix/arch/m68k/arch_setjmp.h index 6bf077a3f3..4aa8146a7f 100644 --- a/headers/posix/arch/m68k/arch_setjmp.h +++ b/headers/posix/arch/m68k/arch_setjmp.h @@ -1,5 +1,5 @@ /* - * Copyright 2007-2010 Haiku Inc. All Rights Reserved. + * Copyright 2007-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _ARCH_SETJMP_H_ diff --git a/headers/posix/arch/m68k/signal.h b/headers/posix/arch/m68k/signal.h index 8ff2f3e23a..6623e7a09d 100644 --- a/headers/posix/arch/m68k/signal.h +++ b/headers/posix/arch/m68k/signal.h @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 Haiku Inc. All Rights Reserved. + * Copyright 2002-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _ARCH_SIGNAL_H_ @@ -21,7 +21,7 @@ struct vregs double f0, /* fp scratch */ f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13; /* fp volatile regs */ }; -#endif /* __M68K__ */ +#endif /* __M68K__ */ #endif /* _ARCH_SIGNAL_H_ */ diff --git a/headers/posix/arch/mipsel/arch_setjmp.h b/headers/posix/arch/mipsel/arch_setjmp.h index 8c7189cddc..66e147e37e 100644 --- a/headers/posix/arch/mipsel/arch_setjmp.h +++ b/headers/posix/arch/mipsel/arch_setjmp.h @@ -1,5 +1,5 @@ /* - * Copyright 2008-2010 Haiku Inc. All Rights Reserved. + * Copyright 2008-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _ARCH_SETJMP_H_ diff --git a/headers/posix/arch/mipsel/signal.h b/headers/posix/arch/mipsel/signal.h index 37dfb97261..a3e1f22318 100644 --- a/headers/posix/arch/mipsel/signal.h +++ b/headers/posix/arch/mipsel/signal.h @@ -1,5 +1,5 @@ /* - * Copyright 2008-2010 Haiku Inc. All Rights Reserved. + * Copyright 2008-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _ARCH_SIGNAL_H_ @@ -18,7 +18,7 @@ struct vregs #warning MIPSEL: fixme }; -#endif /* __MIPSEL__ */ +#endif /* __MIPSEL__ */ #endif /* _ARCH_SIGNAL_H_ */ diff --git a/headers/posix/arch/ppc/arch_setjmp.h b/headers/posix/arch/ppc/arch_setjmp.h index 93d552b1f4..f4e9cf16e5 100644 --- a/headers/posix/arch/ppc/arch_setjmp.h +++ b/headers/posix/arch/ppc/arch_setjmp.h @@ -1,5 +1,5 @@ /* - * Copyright 2005-2010 Haiku Inc. All Rights Reserved. + * Copyright 2005-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _ARCH_SETJMP_H_ diff --git a/headers/posix/arch/ppc/signal.h b/headers/posix/arch/ppc/signal.h index bdb67ce940..c1ef3f58d7 100644 --- a/headers/posix/arch/ppc/signal.h +++ b/headers/posix/arch/ppc/signal.h @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 Haiku Inc. All Rights Reserved. + * Copyright 2002-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _ARCH_SIGNAL_H_ @@ -27,7 +27,7 @@ struct vregs fpscr, /* fp condition codes */ ctr, xer, cr, msr, lr; /* misc. status */ }; -#endif /* __POWERPC__ */ +#endif /* __POWERPC__ */ #endif /* _ARCH_SIGNAL_H_ */ diff --git a/headers/posix/arch/x86/arch_setjmp.h b/headers/posix/arch/x86/arch_setjmp.h index 5221087a78..f5d944f4b3 100644 --- a/headers/posix/arch/x86/arch_setjmp.h +++ b/headers/posix/arch/x86/arch_setjmp.h @@ -1,5 +1,5 @@ /* - * Copyright 2005-2010 Haiku Inc. All Rights Reserved. + * Copyright 2005-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _ARCH_SETJMP_H_ diff --git a/headers/posix/arch/x86/signal.h b/headers/posix/arch/x86/signal.h index 6d04281499..be3e743055 100644 --- a/headers/posix/arch/x86/signal.h +++ b/headers/posix/arch/x86/signal.h @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 Haiku Inc. All Rights Reserved. + * Copyright 2002-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _ARCH_SIGNAL_H_ diff --git a/headers/posix/arch/x86_64/arch_setjmp.h b/headers/posix/arch/x86_64/arch_setjmp.h index 3780e9bb78..8371471f01 100644 --- a/headers/posix/arch/x86_64/arch_setjmp.h +++ b/headers/posix/arch/x86_64/arch_setjmp.h @@ -1,5 +1,5 @@ /* - * Copyright 2005-2010 Haiku Inc. All Rights Reserved. + * Copyright 2005-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _ARCH_SETJMP_H_ diff --git a/headers/posix/arch/x86_64/signal.h b/headers/posix/arch/x86_64/signal.h index bc97f98c6e..f48a72f5fa 100644 --- a/headers/posix/arch/x86_64/signal.h +++ b/headers/posix/arch/x86_64/signal.h @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 Haiku Inc. All Rights Reserved. + * Copyright 2002-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _ARCH_SIGNAL_H_ @@ -40,7 +40,7 @@ struct vregs { */ }; - + #endif /* __x86_64__ */ #endif /* _ARCH_SIGNAL_H_ */ diff --git a/headers/posix/arpa/inet.h b/headers/posix/arpa/inet.h index 1c3c19168b..95ee6e3a91 100644 --- a/headers/posix/arpa/inet.h +++ b/headers/posix/arpa/inet.h @@ -1,5 +1,5 @@ /* - * Copyright 2009-2010 Haiku Inc. All Rights Reserved. + * Copyright 2009-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _INET_H_ diff --git a/headers/posix/arpa/nameser.h b/headers/posix/arpa/nameser.h index f62cdc496c..ae88a7a9aa 100644 --- a/headers/posix/arpa/nameser.h +++ b/headers/posix/arpa/nameser.h @@ -1,5 +1,5 @@ /* - * Copyright 2006-2010 Haiku Inc. All Rights Reserved. + * Copyright 2006-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ diff --git a/headers/posix/assert.h b/headers/posix/assert.h index 1d47bd0ad6..b8668925d9 100644 --- a/headers/posix/assert.h +++ b/headers/posix/assert.h @@ -1,5 +1,5 @@ /* - * Copyright 2004-2010 Haiku Inc. All Rights Reserved. + * Copyright 2004-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _ASSERT_H_ diff --git a/headers/posix/bsd_mem.h b/headers/posix/bsd_mem.h index 0d2182aac5..a0e773cbee 100644 --- a/headers/posix/bsd_mem.h +++ b/headers/posix/bsd_mem.h @@ -1,5 +1,5 @@ /* - * Copyright 2005-2010 Haiku Inc. All Rights Reserved. + * Copyright 2005-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ diff --git a/headers/posix/compat/sys/stat.h b/headers/posix/compat/sys/stat.h index 9722e118c3..94aeca1933 100644 --- a/headers/posix/compat/sys/stat.h +++ b/headers/posix/compat/sys/stat.h @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 Haiku Inc. All Rights Reserved. + * Copyright 2002-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _COMPAT_SYS_STAT_H_ diff --git a/headers/posix/ctype.h b/headers/posix/ctype.h index 9d75cea58c..57b2820eff 100644 --- a/headers/posix/ctype.h +++ b/headers/posix/ctype.h @@ -1,5 +1,5 @@ /* - * Copyright 2003-2010 Haiku Inc. All Rights Reserved. + * Copyright 2003-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _CTYPE_H diff --git a/headers/posix/dirent.h b/headers/posix/dirent.h index ea8d941be8..9622a265ac 100644 --- a/headers/posix/dirent.h +++ b/headers/posix/dirent.h @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 Haiku Inc. All Rights Reserved. + * Copyright 2002-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _DIRENT_H diff --git a/headers/posix/div_t.h b/headers/posix/div_t.h index 990240b93c..94b783225a 100644 --- a/headers/posix/div_t.h +++ b/headers/posix/div_t.h @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 Haiku Inc. All Rights Reserved. + * Copyright 2002-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _DIV_T_H_ diff --git a/headers/posix/dlfcn.h b/headers/posix/dlfcn.h index 2b0a63fe09..7fdce4fc64 100644 --- a/headers/posix/dlfcn.h +++ b/headers/posix/dlfcn.h @@ -1,5 +1,5 @@ /* - * Copyright 2003-2010 Haiku Inc. All Rights Reserved. + * Copyright 2003-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _DLFCN_H diff --git a/headers/posix/endian.h b/headers/posix/endian.h index a02cf9efe9..ba93bb128a 100644 --- a/headers/posix/endian.h +++ b/headers/posix/endian.h @@ -1,5 +1,5 @@ /* - * Copyright 2003-2010 Haiku Inc. All rights reserved. + * Copyright 2003-2012 Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. */ #ifndef _ENDIAN_H_ diff --git a/headers/posix/errno.h b/headers/posix/errno.h index e124f0ea89..045b24ec74 100644 --- a/headers/posix/errno.h +++ b/headers/posix/errno.h @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 Haiku Inc. All Rights Reserved. + * Copyright 2002-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _POSIX_ERRNO_H @@ -9,7 +9,7 @@ #ifdef __cplusplus extern "C" { -#endif +#endif #include @@ -21,6 +21,6 @@ extern int *_errnop(void); #ifdef __cplusplus } /* "C" */ -#endif +#endif #endif /* _POSIX_ERRNO_H */ diff --git a/headers/posix/fcntl.h b/headers/posix/fcntl.h index a5561b3cd9..ad762f5b0d 100644 --- a/headers/posix/fcntl.h +++ b/headers/posix/fcntl.h @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 Haiku Inc. All Rights Reserved. + * Copyright 2002-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _FCNTL_H diff --git a/headers/posix/getopt.h b/headers/posix/getopt.h index c39556bdd0..49694a6c1b 100644 --- a/headers/posix/getopt.h +++ b/headers/posix/getopt.h @@ -1,5 +1,5 @@ /* - * Copyright 2004-2010 Haiku Inc. All Rights Reserved. + * Copyright 2004-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _GETOPT_H diff --git a/headers/posix/grp.h b/headers/posix/grp.h index 7be9cca96f..e44c15c9f6 100644 --- a/headers/posix/grp.h +++ b/headers/posix/grp.h @@ -1,5 +1,5 @@ /* - * Copyright 2004-2010 Haiku Inc. All Rights Reserved. + * Copyright 2004-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _GRP_H_ diff --git a/headers/posix/inttypes.h b/headers/posix/inttypes.h index 5f24eda435..8abc015b68 100644 --- a/headers/posix/inttypes.h +++ b/headers/posix/inttypes.h @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 Haiku Inc. All rights reserved. + * Copyright 2002-2012 Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. */ #ifndef _INTTYPES_H_ diff --git a/headers/posix/iovec.h b/headers/posix/iovec.h index ec10f21acd..be253e3f01 100644 --- a/headers/posix/iovec.h +++ b/headers/posix/iovec.h @@ -1,5 +1,5 @@ /* - * Copyright 2008-2010 Haiku Inc. All Rights Reserved. + * Copyright 2008-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _IOVEC_H diff --git a/headers/posix/langinfo.h b/headers/posix/langinfo.h index 1ee23de3da..cbd63bd8b2 100644 --- a/headers/posix/langinfo.h +++ b/headers/posix/langinfo.h @@ -1,5 +1,5 @@ /* - * Copyright 2010 Haiku Inc. All Rights Reserved. + * Copyright 2010-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _LANGINFO_H_ diff --git a/headers/posix/libgen.h b/headers/posix/libgen.h index a89bf98678..3cff2618f7 100644 --- a/headers/posix/libgen.h +++ b/headers/posix/libgen.h @@ -1,5 +1,5 @@ /* - * Copyright 2009-2010 Haiku Inc. All Rights Reserved. + * Copyright 2009-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _LIBGEN_H diff --git a/headers/posix/limits.h b/headers/posix/limits.h index 5f90d74059..e010cf3ea2 100644 --- a/headers/posix/limits.h +++ b/headers/posix/limits.h @@ -1,5 +1,5 @@ /* - * Copyright 2001-2012 Haiku Inc. All rights reserved. + * Copyright 2001-2012 Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. */ #ifndef _LIBC_LIMITS_H_ diff --git a/headers/posix/locale.h b/headers/posix/locale.h index 624c717844..2cc8717623 100644 --- a/headers/posix/locale.h +++ b/headers/posix/locale.h @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 Haiku Inc. All Rights Reserved. + * Copyright 2002-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _LOCALE_H_ diff --git a/headers/posix/malloc.h b/headers/posix/malloc.h index c5cc068e95..b36b17d9e9 100644 --- a/headers/posix/malloc.h +++ b/headers/posix/malloc.h @@ -1,12 +1,12 @@ /* - * Copyright 2002-2010 Haiku Inc. All Rights Reserved. + * Copyright 2002-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _MALLOC_H #define _MALLOC_H -#include +#include #ifdef __cplusplus diff --git a/headers/posix/malloc_debug.h b/headers/posix/malloc_debug.h index 1bfe75a809..0c23bbb9e7 100644 --- a/headers/posix/malloc_debug.h +++ b/headers/posix/malloc_debug.h @@ -1,5 +1,5 @@ /* - * Copyright 2010 Haiku Inc. All Rights Reserved. + * Copyright 2010-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef MALLOC_DEBUG_H diff --git a/headers/posix/math.h b/headers/posix/math.h index 1089c05d83..df34b2594c 100644 --- a/headers/posix/math.h +++ b/headers/posix/math.h @@ -1,5 +1,5 @@ /* - * Copyright 2001-2010 Haiku Inc. All Rights Reserved. + * Copyright 2001-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _MATH_H_ diff --git a/headers/posix/memory.h b/headers/posix/memory.h index f218fba642..16940bbe40 100644 --- a/headers/posix/memory.h +++ b/headers/posix/memory.h @@ -1,8 +1,8 @@ /* - * Copyright 2005-2010 Haiku Inc. All Rights Reserved. + * Copyright 2005-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ - - + + #include diff --git a/headers/posix/monetary.h b/headers/posix/monetary.h index a2877576d4..0624f4c31c 100644 --- a/headers/posix/monetary.h +++ b/headers/posix/monetary.h @@ -1,5 +1,5 @@ /* - * Copyright 2010 Haiku Inc. All Rights Reserved. + * Copyright 2010-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _MONETARY_H_ diff --git a/headers/posix/net/if.h b/headers/posix/net/if.h index fdeff5d579..80522f2bc8 100644 --- a/headers/posix/net/if.h +++ b/headers/posix/net/if.h @@ -1,5 +1,5 @@ /* - * Copyright 2006-2010 Haiku Inc. All Rights Reserved. + * Copyright 2006-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _NET_IF_H diff --git a/headers/posix/net/if_dl.h b/headers/posix/net/if_dl.h index 50bb72250a..b7dc7ad99b 100644 --- a/headers/posix/net/if_dl.h +++ b/headers/posix/net/if_dl.h @@ -1,5 +1,5 @@ /* - * Copyright 2006-2010 Haiku Inc. All Rights Reserved. + * Copyright 2006-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _NET_IF_DL_H diff --git a/headers/posix/net/if_media.h b/headers/posix/net/if_media.h index 4e70897c6a..e0fdc4e76d 100644 --- a/headers/posix/net/if_media.h +++ b/headers/posix/net/if_media.h @@ -1,5 +1,5 @@ /* - * Copyright 2007-2010 Haiku Inc. All Rights Reserved. + * Copyright 2007-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _NET_IF_MEDIA_H diff --git a/headers/posix/net/if_types.h b/headers/posix/net/if_types.h index f954c33048..fda4534f03 100644 --- a/headers/posix/net/if_types.h +++ b/headers/posix/net/if_types.h @@ -1,5 +1,5 @@ /* - * Copyright 2006-2010 Haiku Inc. All Rights Reserved. + * Copyright 2006-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _NET_IF_TYPES_H diff --git a/headers/posix/net/route.h b/headers/posix/net/route.h index 4e021fd620..70e81e8d9e 100644 --- a/headers/posix/net/route.h +++ b/headers/posix/net/route.h @@ -1,5 +1,5 @@ /* - * Copyright 2006-2010 Haiku Inc. All Rights Reserved. + * Copyright 2006-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _NET_ROUTE_H diff --git a/headers/posix/netdb.h b/headers/posix/netdb.h index d29eceed06..c6a6aff208 100644 --- a/headers/posix/netdb.h +++ b/headers/posix/netdb.h @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 Haiku Inc. All Rights Reserved. + * Copyright 2002-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ diff --git a/headers/posix/netinet/in.h b/headers/posix/netinet/in.h index c729b738d2..36310d1161 100644 --- a/headers/posix/netinet/in.h +++ b/headers/posix/netinet/in.h @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 Haiku Inc. All Rights Reserved. + * Copyright 2002-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _NETINET_IN_H_ diff --git a/headers/posix/netinet/tcp.h b/headers/posix/netinet/tcp.h index 4d3124653a..f865c58239 100644 --- a/headers/posix/netinet/tcp.h +++ b/headers/posix/netinet/tcp.h @@ -1,5 +1,5 @@ /* - * Copyright 2006-2010 Haiku Inc. All Rights Reserved. + * Copyright 2006-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef NETINET_TCP_H @@ -15,7 +15,7 @@ struct tcphdr { uint16_t th_dport; /* destination port */ uint32_t th_seq; uint32_t th_ack; - + #if BIG_ENDIAN uint8_t th_off : 4; /* data offset */ uint8_t th_x2 : 4; /* unused */ diff --git a/headers/posix/netinet6/in6.h b/headers/posix/netinet6/in6.h index 1898617d66..f348d60a27 100644 --- a/headers/posix/netinet6/in6.h +++ b/headers/posix/netinet6/in6.h @@ -1,5 +1,5 @@ /* - * Copyright 2006-2010 Haiku Inc. All Rights Reserved. + * Copyright 2006-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _NETINET6_IN6_H_ diff --git a/headers/posix/nl_types.h b/headers/posix/nl_types.h index 6a91f93fbc..a437a9e328 100644 --- a/headers/posix/nl_types.h +++ b/headers/posix/nl_types.h @@ -1,5 +1,5 @@ /* - * Copyright 2010 Haiku Inc. All Rights Reserved. + * Copyright 2010-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _NL_TYPES_H_ diff --git a/headers/posix/null.h b/headers/posix/null.h index 9d63e4f46e..c74b189c9a 100644 --- a/headers/posix/null.h +++ b/headers/posix/null.h @@ -1,5 +1,5 @@ /* - * Copyright 2008 Haiku Inc. All Rights Reserved. + * Copyright 2008-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _NULL_H diff --git a/headers/posix/poll.h b/headers/posix/poll.h index 3580699c4d..8935f66fae 100644 --- a/headers/posix/poll.h +++ b/headers/posix/poll.h @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 Haiku Inc. All Rights Reserved. + * Copyright 2002-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _POLL_H diff --git a/headers/posix/pwd.h b/headers/posix/pwd.h index ea5b604ec6..f08e96c6df 100644 --- a/headers/posix/pwd.h +++ b/headers/posix/pwd.h @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 Haiku Inc. All Rights Reserved. + * Copyright 2002-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _PWD_H_ diff --git a/headers/posix/resolv.h b/headers/posix/resolv.h index 7ed5767697..2b1b569b1f 100644 --- a/headers/posix/resolv.h +++ b/headers/posix/resolv.h @@ -1,5 +1,5 @@ /* - * Copyright 2009-2010 Haiku Inc. All Rights Reserved. + * Copyright 2009-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ diff --git a/headers/posix/sched.h b/headers/posix/sched.h index 543c2a3523..c37f757049 100644 --- a/headers/posix/sched.h +++ b/headers/posix/sched.h @@ -1,5 +1,5 @@ /* - * Copyright 2008-2010 Haiku Inc. All rights reserved. + * Copyright 2008-2012 Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT license. */ #ifndef _SCHED_H_ diff --git a/headers/posix/search.h b/headers/posix/search.h index 8892c9b4fd..60bb76f77a 100644 --- a/headers/posix/search.h +++ b/headers/posix/search.h @@ -1,5 +1,5 @@ /* - * Copyright 2008-2010 Haiku Inc. All Rights Reserved. + * Copyright 2008-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _SEARCH_H_ @@ -9,9 +9,9 @@ #include -typedef enum { - FIND, - ENTER +typedef enum { + FIND, + ENTER } ACTION; typedef struct entry { diff --git a/headers/posix/semaphore.h b/headers/posix/semaphore.h index 8d6708f360..6be5f81bfb 100644 --- a/headers/posix/semaphore.h +++ b/headers/posix/semaphore.h @@ -1,5 +1,5 @@ /* - * Copyright 2008-2010 Haiku Inc. + * Copyright 2008-2012 Haiku, Inc. * Distributed under the terms of the MIT License. */ #ifndef _SEMAPHORE_H_ diff --git a/headers/posix/setjmp.h b/headers/posix/setjmp.h index 30b24ea0be..67f4ec04be 100644 --- a/headers/posix/setjmp.h +++ b/headers/posix/setjmp.h @@ -1,5 +1,5 @@ /* - * Copyright 2004-2010 Haiku Inc. + * Copyright 2004-2012 Haiku, Inc. * Distributed under the terms of the MIT License. */ #ifndef _SETJMP_H_ diff --git a/headers/posix/shadow.h b/headers/posix/shadow.h index 1866be6a06..ed85ee07ec 100644 --- a/headers/posix/shadow.h +++ b/headers/posix/shadow.h @@ -1,5 +1,5 @@ /* - * Copyright 2008-2010 Haiku Inc. All Rights Reserved. + * Copyright 2008-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _SHADOW_H_ diff --git a/headers/posix/size_t.h b/headers/posix/size_t.h index aaf4bc0cb3..f8235c914f 100644 --- a/headers/posix/size_t.h +++ b/headers/posix/size_t.h @@ -1,5 +1,5 @@ /* - * Copyright 2008-2010 Haiku Inc. All Rights Reserved. + * Copyright 2008-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _SIZE_T_H_ diff --git a/headers/posix/stdint.h b/headers/posix/stdint.h index 37c5e67bd4..eb07104a5a 100644 --- a/headers/posix/stdint.h +++ b/headers/posix/stdint.h @@ -1,5 +1,5 @@ /* - * Copyright 2003-2010 Haiku Inc. All Rights Reserved. + * Copyright 2003-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _STDINT_H_ diff --git a/headers/posix/stdio.h b/headers/posix/stdio.h index aa8fd9e5ef..f5ad972b07 100644 --- a/headers/posix/stdio.h +++ b/headers/posix/stdio.h @@ -1,5 +1,5 @@ /* - * Copyright 2004-2010 Haiku Inc. All Rights Reserved. + * Copyright 2004-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _STDIO_H_ diff --git a/headers/posix/stdio_ext.h b/headers/posix/stdio_ext.h index 95d533da0a..fb0c4c28a3 100644 --- a/headers/posix/stdio_ext.h +++ b/headers/posix/stdio_ext.h @@ -1,5 +1,5 @@ /* - * Copyright 2008-2010 Haiku Inc. All Rights Reserved. + * Copyright 2008-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _STDIO_EXT_H_ diff --git a/headers/posix/stdio_post.h b/headers/posix/stdio_post.h index 83662d8cdf..71a841dfc2 100644 --- a/headers/posix/stdio_post.h +++ b/headers/posix/stdio_post.h @@ -1,5 +1,5 @@ /* - * Copyright 2003-2010 Haiku Inc. All Rights Reserved. + * Copyright 2003-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _STDIO_POST_H_ diff --git a/headers/posix/stdio_pre.h b/headers/posix/stdio_pre.h index 5e973422aa..3d37b86e4d 100644 --- a/headers/posix/stdio_pre.h +++ b/headers/posix/stdio_pre.h @@ -1,5 +1,5 @@ /* - * Copyright 2003-2010 Haiku Inc. All Rights Reserved. + * Copyright 2003-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _STDIO_PRE_H_ diff --git a/headers/posix/stdlib.h b/headers/posix/stdlib.h index efec9062a5..aef3e9184e 100644 --- a/headers/posix/stdlib.h +++ b/headers/posix/stdlib.h @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 Haiku Inc. All Rights Reserved. + * Copyright 2002-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _STDLIB_H_ diff --git a/headers/posix/string.h b/headers/posix/string.h index f7e4ab4b1f..d3a9035364 100644 --- a/headers/posix/string.h +++ b/headers/posix/string.h @@ -1,5 +1,5 @@ /* - * Copyright 2004-2010 Haiku Inc. All Rights Reserved. + * Copyright 2004-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _STRING_H_ diff --git a/headers/posix/sys/file.h b/headers/posix/sys/file.h index 01839a6236..a7c3384c9d 100644 --- a/headers/posix/sys/file.h +++ b/headers/posix/sys/file.h @@ -1,5 +1,5 @@ /* - * Copyright 2008-2010 Haiku Inc. All Rights Reserved. + * Copyright 2008-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _SYS_FILE_H diff --git a/headers/posix/sys/ioctl.h b/headers/posix/sys/ioctl.h index ee32b3c718..22c3094cfa 100644 --- a/headers/posix/sys/ioctl.h +++ b/headers/posix/sys/ioctl.h @@ -1,5 +1,5 @@ /* - * Copyright 2006-2010 Haiku Inc. All Rights Reserved. + * Copyright 2006-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _SYS_IOCTL_H diff --git a/headers/posix/sys/ipc.h b/headers/posix/sys/ipc.h index 2b2cbff93a..90ed41ef87 100644 --- a/headers/posix/sys/ipc.h +++ b/headers/posix/sys/ipc.h @@ -1,5 +1,5 @@ /* - * Copyright 2008-2010 Haiku Inc. All Rights Reserved. + * Copyright 2008-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _SYS_IPC_H diff --git a/headers/posix/sys/mman.h b/headers/posix/sys/mman.h index c5f9f2ce40..a69991ac05 100644 --- a/headers/posix/sys/mman.h +++ b/headers/posix/sys/mman.h @@ -1,5 +1,5 @@ /* - * Copyright 2008-2010 Haiku Inc. All Rights Reserved. + * Copyright 2008-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _SYS_MMAN_H diff --git a/headers/posix/sys/msg.h b/headers/posix/sys/msg.h index 9d5256d9a6..5ab90b46af 100644 --- a/headers/posix/sys/msg.h +++ b/headers/posix/sys/msg.h @@ -1,5 +1,5 @@ /* - * Copyright 2008-2010 Haiku Inc. All Rights Reserved. + * Copyright 2008-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _SYS_MSG_H diff --git a/headers/posix/sys/param.h b/headers/posix/sys/param.h index e28f0239cb..3e5c2b0b66 100644 --- a/headers/posix/sys/param.h +++ b/headers/posix/sys/param.h @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 Haiku Inc. All Rights Reserved. + * Copyright 2002-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _SYS_PARAM_H diff --git a/headers/posix/sys/poll.h b/headers/posix/sys/poll.h index 529cd331a8..c8f1144ee1 100644 --- a/headers/posix/sys/poll.h +++ b/headers/posix/sys/poll.h @@ -1,5 +1,5 @@ /* - * Copyright 2008-2010 Haiku Inc. All Rights Reserved. + * Copyright 2008-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _SYS_POLL_H diff --git a/headers/posix/sys/resource.h b/headers/posix/sys/resource.h index 66e4c2d597..96ac924a20 100644 --- a/headers/posix/sys/resource.h +++ b/headers/posix/sys/resource.h @@ -1,5 +1,5 @@ /* - * Copyright 2003-2010 Haiku Inc. All Rights Reserved. + * Copyright 2003-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _SYS_RESOURCE_H diff --git a/headers/posix/sys/select.h b/headers/posix/sys/select.h index 4a99504312..ebc9d0e49d 100644 --- a/headers/posix/sys/select.h +++ b/headers/posix/sys/select.h @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 Haiku Inc. All Rights Reserved. + * Copyright 2002-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _SYS_SELECT_H diff --git a/headers/posix/sys/sem.h b/headers/posix/sys/sem.h index 0a80354655..4dc8540005 100644 --- a/headers/posix/sys/sem.h +++ b/headers/posix/sys/sem.h @@ -1,5 +1,5 @@ /* - * Copyright 2008-2010 Haiku Inc. All Rights Reserved. + * Copyright 2008-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _SYS_SEM_H diff --git a/headers/posix/sys/socket.h b/headers/posix/sys/socket.h index 1962acea96..0514d91dda 100644 --- a/headers/posix/sys/socket.h +++ b/headers/posix/sys/socket.h @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 Haiku Inc. All Rights Reserved. + * Copyright 2002-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _SYS_SOCKET_H @@ -47,7 +47,7 @@ typedef uint32_t socklen_t; #define SOCK_MISC 255 /* Socket options for SOL_SOCKET level */ -#define SOL_SOCKET -1 +#define SOL_SOCKET -1 #define SO_ACCEPTCONN 0x00000001 /* socket has had listen() */ #define SO_BROADCAST 0x00000002 /* permit sending of broadcast msgs */ @@ -85,7 +85,7 @@ struct linger { }; struct sockaddr { - uint8_t sa_len; + uint8_t sa_len; uint8_t sa_family; uint8_t sa_data[30]; }; diff --git a/headers/posix/sys/sockio.h b/headers/posix/sys/sockio.h index 666f05fa76..e486f50241 100644 --- a/headers/posix/sys/sockio.h +++ b/headers/posix/sys/sockio.h @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 Haiku Inc. All Rights Reserved. + * Copyright 2002-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _SYS_SOCKIO_H @@ -47,9 +47,9 @@ #define SIOCGIFSTATS 8929 /* get interface stats */ #define SIOCGIFTYPE 8931 /* get interface type */ -#define SIOCSPACKETCAP 8932 +#define SIOCSPACKETCAP 8932 /* Start capturing packets on an interface */ -#define SIOCCPACKETCAP 8933 +#define SIOCCPACKETCAP 8933 /* Stop capturing packets on an interface */ #define SIOCSHIWAT 8934 /* set high watermark */ diff --git a/headers/posix/sys/stat.h b/headers/posix/sys/stat.h index 90a10d0d38..358354c6a8 100644 --- a/headers/posix/sys/stat.h +++ b/headers/posix/sys/stat.h @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 Haiku Inc. All Rights Reserved. + * Copyright 2002-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _SYS_STAT_H_ diff --git a/headers/posix/sys/statvfs.h b/headers/posix/sys/statvfs.h index 916f06083a..4d86ad229c 100644 --- a/headers/posix/sys/statvfs.h +++ b/headers/posix/sys/statvfs.h @@ -1,5 +1,5 @@ /* - * Copyright 2005-2010 Haiku Inc. All Rights Reserved. + * Copyright 2005-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _STAT_VFS_H_ diff --git a/headers/posix/sys/time.h b/headers/posix/sys/time.h index e8606791fc..62f2efee0c 100644 --- a/headers/posix/sys/time.h +++ b/headers/posix/sys/time.h @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 Haiku Inc. All Rights Reserved. + * Copyright 2002-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _SYS_TIME_H diff --git a/headers/posix/sys/timeb.h b/headers/posix/sys/timeb.h index c338d45d49..e1e2742b8a 100644 --- a/headers/posix/sys/timeb.h +++ b/headers/posix/sys/timeb.h @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 Haiku Inc. All Rights Reserved. + * Copyright 2002-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _SYS_TIMEB_H diff --git a/headers/posix/sys/times.h b/headers/posix/sys/times.h index 296e814900..bef2d83072 100644 --- a/headers/posix/sys/times.h +++ b/headers/posix/sys/times.h @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 Haiku Inc. All Rights Reserved. + * Copyright 2002-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _SYS_TIMES_H @@ -21,6 +21,6 @@ extern #ifdef __cplusplus "C" #endif -clock_t times(struct tms *tms); +clock_t times(struct tms *tms); #endif /* _SYS_TIMES_H */ diff --git a/headers/posix/sys/types.h b/headers/posix/sys/types.h index 4a12ba06f8..7ae5450630 100644 --- a/headers/posix/sys/types.h +++ b/headers/posix/sys/types.h @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 Haiku Inc. All Rights Reserved. + * Copyright 2002-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _SYS_TYPES_H diff --git a/headers/posix/sys/uio.h b/headers/posix/sys/uio.h index ea23c1513b..2e637e40f3 100644 --- a/headers/posix/sys/uio.h +++ b/headers/posix/sys/uio.h @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 Haiku Inc. All Rights Reserved. + * Copyright 2002-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _SYS_UIO_H diff --git a/headers/posix/sys/un.h b/headers/posix/sys/un.h index 4f55ea4a4a..0cdd5783ae 100644 --- a/headers/posix/sys/un.h +++ b/headers/posix/sys/un.h @@ -1,5 +1,5 @@ /* - * Copyright 2006-2010 Haiku Inc. All Rights Reserved. + * Copyright 2006-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _SYS_UN_H @@ -10,7 +10,7 @@ struct sockaddr_un { - uint8_t sun_len; + uint8_t sun_len; uint8_t sun_family; char sun_path[126]; }; diff --git a/headers/posix/sys/utsname.h b/headers/posix/sys/utsname.h index 43fd413871..8b3db846b1 100644 --- a/headers/posix/sys/utsname.h +++ b/headers/posix/sys/utsname.h @@ -1,5 +1,5 @@ /* - * Copyright 2004-2010 Haiku Inc. All Rights Reserved. + * Copyright 2004-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _SYS_UTSNAME_H diff --git a/headers/posix/syslog.h b/headers/posix/syslog.h index aae1ad8d8c..d0ee5ca577 100644 --- a/headers/posix/syslog.h +++ b/headers/posix/syslog.h @@ -1,5 +1,5 @@ /* - * Copyright 2003-2010 Haiku Inc. All Rights Reserved. + * Copyright 2003-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _SYSLOG_H_ diff --git a/headers/posix/termios.h b/headers/posix/termios.h index 88db94675a..ccf13ea7c2 100644 --- a/headers/posix/termios.h +++ b/headers/posix/termios.h @@ -1,5 +1,5 @@ /* - * Copyright 2004-2010 Haiku Inc. All Rights Reserved. + * Copyright 2004-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _TERMIOS_H_ diff --git a/headers/posix/utime.h b/headers/posix/utime.h index b29d46191b..485eea9b7a 100644 --- a/headers/posix/utime.h +++ b/headers/posix/utime.h @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 Haiku Inc. All Rights Reserved. + * Copyright 2002-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _UTIME_H_ diff --git a/headers/posix/wchar.h b/headers/posix/wchar.h index d2bebb9213..eebc4e5bba 100644 --- a/headers/posix/wchar.h +++ b/headers/posix/wchar.h @@ -1,5 +1,5 @@ /* - * Copyright 2008-2011 Haiku Inc. All Rights Reserved. + * Copyright 2008-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _WCHAR_H diff --git a/headers/posix/wchar_t.h b/headers/posix/wchar_t.h index a0b412335a..30077e5791 100644 --- a/headers/posix/wchar_t.h +++ b/headers/posix/wchar_t.h @@ -1,5 +1,5 @@ /* - * Copyright 2008-2010 Haiku Inc. All Rights Reserved. + * Copyright 2008-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ diff --git a/headers/posix/wctype.h b/headers/posix/wctype.h index f71bac7393..00d7776542 100644 --- a/headers/posix/wctype.h +++ b/headers/posix/wctype.h @@ -1,5 +1,5 @@ /* - * Copyright 2005-2011 Haiku Inc. All Rights Reserved. + * Copyright 2005-2012 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _WCTYPE_H_ diff --git a/headers/private/interface/ColumnListView.h b/headers/private/interface/ColumnListView.h index 33773acd8e..2acbbdbb6c 100644 --- a/headers/private/interface/ColumnListView.h +++ b/headers/private/interface/ColumnListView.h @@ -385,9 +385,8 @@ protected: virtual void DoLayout(); private: - void _Init(bool showHorizontalScrollbar); + void _Init(); void _GetChildViewRects(const BRect& bounds, - bool showHorizontalScrollBar, BRect& titleRect, BRect& outlineRect, BRect& vScrollBarRect, BRect& hScrollBarRect); @@ -404,6 +403,7 @@ private: bool fSortingEnabled; float fLatchWidth; border_style fBorderStyle; + bool fShowingHorizontalScrollBar; }; #endif // _COLUMN_LIST_VIEW_H diff --git a/headers/private/shared/ArgumentVector.h b/headers/private/shared/ArgumentVector.h new file mode 100644 index 0000000000..0b32a8743d --- /dev/null +++ b/headers/private/shared/ArgumentVector.h @@ -0,0 +1,53 @@ +/* + * Copyright 2007-2012, Ingo Weinhold, ingo_weinhold@gmx.de. + * Distributed under the terms of the MIT License. + */ +#ifndef _ARGUMENT_VECTOR_H +#define _ARGUMENT_VECTOR_H + + +#include + + +namespace BPrivate { + + +class ArgumentVector { +public: + enum ParseError { + NO_ERROR, + NO_MEMORY, + UNTERMINATED_QUOTED_STRING, + TRAILING_BACKSPACE + }; + +public: + ArgumentVector(); + ~ArgumentVector(); + + int32 ArgumentCount() const { return fCount; } + const char* const* Arguments() const { return fArguments; } + + char** DetachArguments(); + // Caller must free() -- it's all one big allocation at the + // returned pointer. + + ParseError Parse(const char* commandLine, + const char** _errorLocation = NULL); + +private: + struct Parser; + +private: + char** fArguments; + int32 fCount; +}; + + +} // namespace BPrivate + + +using BPrivate::ArgumentVector; + + +#endif // _ARGUMENT_VECTOR_H diff --git a/src/add-ons/kernel/drivers/ports/usb_serial/FTDI.cpp b/src/add-ons/kernel/drivers/ports/usb_serial/FTDI.cpp index 1d77c605c1..649975bbd9 100644 --- a/src/add-ons/kernel/drivers/ports/usb_serial/FTDI.cpp +++ b/src/add-ons/kernel/drivers/ports/usb_serial/FTDI.cpp @@ -4,10 +4,16 @@ * * Copyright (c) 2003 by Siarzhuk Zharski * Distributed under the terms of the MIT License. + * + * Authors: + * Alexander von Gluck IV, kallisti5@unixzen.com */ + + #include "FTDI.h" #include "FTDIRegs.h" + FTDIDevice::FTDIDevice(usb_device device, uint16 vendorID, uint16 productID, const char *description) : SerialDevice(device, vendorID, productID, description), @@ -46,7 +52,7 @@ FTDIDevice::AddDevice(const usb_configuration_info *config) } if (pipesSet >= 3) { - if (ProductID() == PRODUCT_FTDI_8U100AX) + if (ProductID() == 0x8372) // AU100AX fHeaderLength = 1; else fHeaderLength = 0; @@ -84,7 +90,8 @@ FTDIDevice::SetLineCoding(usb_cdc_line_coding *lineCoding) lineCoding->databits); int32 rate = 0; - if (ProductID() == PRODUCT_FTDI_8U100AX) { + if (ProductID() == 0x8372) { + // AU100AX switch (lineCoding->speed) { case 300: rate = ftdi_sio_b300; break; case 600: rate = ftdi_sio_b600; break; diff --git a/src/add-ons/kernel/drivers/ports/usb_serial/FTDI.h b/src/add-ons/kernel/drivers/ports/usb_serial/FTDI.h index 05b7cb2a3d..7e32721aed 100644 --- a/src/add-ons/kernel/drivers/ports/usb_serial/FTDI.h +++ b/src/add-ons/kernel/drivers/ports/usb_serial/FTDI.h @@ -4,16 +4,24 @@ * * Copyright (c) 2003 by Siarzhuk Zharski * Distributed under the terms of the MIT License. + * + * Authors: + * Alexander von Gluck IV, kallisti5@unixzen.com */ #ifndef _USB_FTDI_H_ #define _USB_FTDI_H_ + #include "SerialDevice.h" + /* supported vendor and product ids */ -#define VENDOR_FTDI 0x0403 -#define PRODUCT_FTDI_8U100AX 0x8372 -#define PRODUCT_FTDI_8U232AM 0x6001 +#define VENDOR_FTDI 0x0403 + +const usb_serial_device kFTDIDevices[] = { + {VENDOR_FTDI, 0x8372, "FTDI 8U100AX serial converter"}, + {VENDOR_FTDI, 0x6001, "FTDI 8U232AM serial converter"} +}; #define FTDI_BUFFER_SIZE 64 @@ -40,4 +48,5 @@ private: uint8 fStatusLSR; }; + #endif //_USB_FTDI_H_ diff --git a/src/add-ons/kernel/drivers/ports/usb_serial/Jamfile b/src/add-ons/kernel/drivers/ports/usb_serial/Jamfile index c9521a221f..7fea83c129 100644 --- a/src/add-ons/kernel/drivers/ports/usb_serial/Jamfile +++ b/src/add-ons/kernel/drivers/ports/usb_serial/Jamfile @@ -14,6 +14,7 @@ KernelAddon usb_serial : ACM.cpp FTDI.cpp KLSI.cpp + Option.cpp Prolific.cpp Silicon.cpp ; diff --git a/src/add-ons/kernel/drivers/ports/usb_serial/KLSI.h b/src/add-ons/kernel/drivers/ports/usb_serial/KLSI.h index bc2dce506f..52e1e78700 100644 --- a/src/add-ons/kernel/drivers/ports/usb_serial/KLSI.h +++ b/src/add-ons/kernel/drivers/ports/usb_serial/KLSI.h @@ -8,13 +8,19 @@ #ifndef _USB_KLSI_H_ #define _USB_KLSI_H_ + #include "SerialDevice.h" + /* supported vendor and product ids */ -#define VENDOR_PALM 0x0830 -#define VENDOR_KLSI 0x05e9 -#define PRODUCT_PALM_CONNECT 0x0080 -#define PRODUCT_KLSI_KL5KUSB105D 0x00c0 +#define VENDOR_PALM 0x0830 +#define VENDOR_KLSI 0x05e9 + +const usb_serial_device kKLSIDevices[] = { + {VENDOR_PALM, 0x0080, "PalmConnect RS232"}, + {VENDOR_KLSI, 0x00c0, "KLSI KL5KUSB105D"} +}; + /* protocol defines */ #define KLSI_SET_REQUEST 0x01 @@ -58,4 +64,5 @@ virtual void OnWrite(const char *buffer, size_t *numBytes, virtual void OnClose(); }; + #endif //_USB_KLSI_H_ diff --git a/src/add-ons/kernel/drivers/ports/usb_serial/Option.cpp b/src/add-ons/kernel/drivers/ports/usb_serial/Option.cpp new file mode 100644 index 0000000000..2041d8fe24 --- /dev/null +++ b/src/add-ons/kernel/drivers/ports/usb_serial/Option.cpp @@ -0,0 +1,97 @@ +/* + * Copyright 2011-2012 Haiku, Inc. All rights reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Alexander von Gluck IV, kallisti5@unixzen.com + */ + + +#include "Option.h" + + +OptionDevice::OptionDevice(usb_device device, uint16 vendorID, + uint16 productID, const char *description) + : + ACMDevice(device, vendorID, productID, description) +{ + TRACE_FUNCALLS("> OptionDevice found: %s\n", description); +} + + +status_t +OptionDevice::AddDevice(const usb_configuration_info *config) +{ + TRACE_FUNCALLS("> OptionDevice::AddDevice(%08x, %08x)\n", this, config); + + int portsFound = 0; + if (config->interface_count > 0) { + for (size_t index = 0; index < config->interface_count; index++) { + usb_interface_info *interface = config->interface[index].active; + + int txEndpointID = -1; + int rxEndpointID = -1; + int irEndpointID = -1; + + for (size_t i = 0; i < interface->endpoint_count; i++) { + usb_endpoint_info *endpoint = &interface->endpoint[i]; + + // Find our Interrupt endpoint + if (endpoint->descr->attributes == USB_ENDPOINT_ATTR_INTERRUPT + && (endpoint->descr->endpoint_address + & USB_ENDPOINT_ADDR_DIR_IN) != 0) { + irEndpointID = i; + continue; + } + + // Find our Transmit / Receive endpoints + if (endpoint->descr->attributes == USB_ENDPOINT_ATTR_BULK) { + if ((endpoint->descr->endpoint_address + & USB_ENDPOINT_ADDR_DIR_IN) != 0) { + rxEndpointID = i; + } else { + txEndpointID = i; + } + continue; + } + } + + TRACE("> OptionDevice::%s: endpoint %d, tx: %d, rx: %d, ir: %d\n", + __func__, index, txEndpointID, rxEndpointID, irEndpointID); + + if (txEndpointID < 0 || rxEndpointID < 0 || irEndpointID < 0) + continue; + + TRACE("> OptionDevice::%s: found port at interface %d\n", __func__, + index); + portsFound++; + + usb_endpoint_info *irEndpoint = &interface->endpoint[irEndpointID]; + usb_endpoint_info *txEndpoint = &interface->endpoint[txEndpointID]; + usb_endpoint_info *rxEndpoint = &interface->endpoint[rxEndpointID]; + SetControlPipe(irEndpoint->handle); + SetReadPipe(rxEndpoint->handle); + SetWritePipe(txEndpoint->handle); + } + + // TODO: We need to handle multiple ports + // We use the last found serial port for now + if (portsFound > 0) { + if (portsFound > 1) { + TRACE_ALWAYS("> OptionDevice::%s: Warning: Found more than one " + "serial port on this device (%d). Only the last one is " + "is used.\n", __func__, portsFound); + } + return B_OK; + } + } + return ENODEV; +} + + +status_t +OptionDevice::ResetDevice() +{ + TRACE_FUNCALLS("> OptionDevice::ResetDevice(%08x)\n", this); + return B_OK; +} diff --git a/src/add-ons/kernel/drivers/ports/usb_serial/Option.h b/src/add-ons/kernel/drivers/ports/usb_serial/Option.h new file mode 100644 index 0000000000..31204ed56f --- /dev/null +++ b/src/add-ons/kernel/drivers/ports/usb_serial/Option.h @@ -0,0 +1,68 @@ +/* + * Copyright 2011-2012 Haiku, Inc. All rights reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Alexander von Gluck IV, kallisti5@unixzen.com + */ +#ifndef _USB_OPTION_H_ +#define _USB_OPTION_H_ + + +#include "ACM.h" + + +/* supported vendor and product ids */ +#define VENDOR_AIRPLUS 0x1011 +#define VENDOR_ALCATEL 0x1bbb +#define VENDOR_ALINK 0x1e0e +#define VENDOR_AMOI 0x1614 +#define VENDOR_ANYDATA 0x16d5 +#define VENDOR_AXESSTEL 0x1726 +#define VENDOR_BANDRICH 0x1A8D +#define VENDOR_BENQ 0x04a5 +#define VENDOR_CELOT 0x211f +#define VENDOR_CMOTECH 0x16d8 +#define VENDOR_DELL 0x413C +#define VENDOR_DLINK 0x1186 +#define VENDOR_HAIER 0x201e +#define VENDOR_HUAWEI 0x12D1 +#define VENDOR_KYOCERA 0x0c88 +#define VENDOR_LG 0x1004 +#define VENDOR_LONGCHEER 0x1c9e +#define VENDOR_MEDIATEK 0x0e8d +#define VENDOR_NOVATEL 0x1410 +#define VENDOR_OLIVETTI 0x0b3c +#define VENDOR_ONDA 0x1ee8 +#define VENDOR_OPTION 0x0AF0 +#define VENDOR_QISDA 0x1da5 +#define VENDOR_QUALCOMM 0x05C6 +#define VENDOR_SAMSUNG 0x04e8 +#define VENDOR_TELIT 0x1bc7 +#define VENDOR_TLAYTECH 0x20B9 +#define VENDOR_TOSHIBA 0x0930 +#define VENDOR_VIETTEL 0x2262 +#define VENDOR_YISO 0x0EAB +#define VENDOR_YUGA 0x257A +#define VENDOR_ZD 0x0685 +#define VENDOR_ZTE 0x19d2 + +const usb_serial_device kOptionDevices[] = { + {VENDOR_CMOTECH, 0x6008, "CMOTECH CDMA Modem"}, + {VENDOR_CMOTECH, 0x5553, "CMOTECH CDU550"}, + {VENDOR_CMOTECH, 0x6512, "CMOTECH CDX650"} +}; + + +class OptionDevice : public ACMDevice { +public: + OptionDevice(usb_device device, + uint16 vendorID, uint16 productID, + const char *description); + + virtual status_t AddDevice(const usb_configuration_info *config); + virtual status_t ResetDevice(); +}; + + +#endif /*_USB_OPTION_H_ */ diff --git a/src/add-ons/kernel/drivers/ports/usb_serial/Prolific.h b/src/add-ons/kernel/drivers/ports/usb_serial/Prolific.h index 81e6de0843..acae2541f4 100644 --- a/src/add-ons/kernel/drivers/ports/usb_serial/Prolific.h +++ b/src/add-ons/kernel/drivers/ports/usb_serial/Prolific.h @@ -4,36 +4,43 @@ * * Copyright (c) 2003-2004 by Siarzhuk Zharski * Distributed under the terms of the MIT License. + * + * Authors: + * Alexander von Gluck IV, kallisti5@unixzen.com */ #ifndef _USB_PROLIFIC_H_ #define _USB_PROLIFIC_H_ + #include "ACM.h" + /* supported vendor and product ids */ #define VENDOR_PROLIFIC 0x067b -#define VENDOR_IODATA 0x04bb #define VENDOR_ATEN 0x0557 -#define VENDOR_TDK 0x04bf -#define VENDOR_RATOC 0x0584 #define VENDOR_ELECOM 0x056e -#define VENDOR_SOURCENEXT 0x0833 -#define VENDOR_HAL 0x0b41 +#define VENDOR_HAL 0x0b41 +#define VENDOR_IODATA 0x04bb +#define VENDOR_RATOC 0x0584 +#define VENDOR_SOURCENEXT 0x0833 +#define VENDOR_TDK 0x04bf + +const usb_serial_device kProlificDevices[] = { + {VENDOR_PROLIFIC, 0x04bb, "PL2303 Serial adapter (IODATA USB-RSAQ2)"}, + {VENDOR_PROLIFIC, 0x2303, "PL2303 Serial adapter (ATEN/IOGEAR UC232A)"}, + {VENDOR_ATEN, 0x2008, "Aten Serial adapter"}, + {VENDOR_ELECOM, 0x5003, "Elecom UC-SGT"}, + {VENDOR_HAL, 0x0011, "HAL Corporation Crossam2+USB"}, + {VENDOR_IODATA, 0x0a03, "I/O Data USB serial adapter USB-RSAQ1"}, + {VENDOR_RATOC, 0xb000, "Ratoc USB serial adapter REX-USB60"}, + {VENDOR_SOURCENEXT, 0x039f, "SOURCENEXT KeikaiDenwa 8"}, + {VENDOR_SOURCENEXT, 0x039f, "SOURCENEXT KeikaiDenwa 8 with charger"}, + {VENDOR_TDK, 0x0117, "TDK USB-PHS Adapter UHA6400"} +}; -#define PRODUCT_IODATA_USBRSAQ 0x0a03 -#define PRODUCT_PROLIFIC_RSAQ2 0x04bb -#define PRODUCT_ATEN_UC232A 0x2008 -#define PRODUCT_PROLIFIC_PL2303 0x2303 -#define PRODUCT_TDK_UHA6400 0x0117 -#define PRODUCT_RATOC_REXUSB60 0xb000 -#define PRODUCT_ELECOM_UCSGT 0x5003 -#define PRODUCT_SOURCENEXT_KEIKAI8 0x039f -#define PRODUCT_SOURCENEXT_KEIKAI8_CHG 0x012e -#define PRODUCT_HAL_IMR001 0x0011 /* protocol defines */ #define PROLIFIC_SET_REQUEST 0x01 - #define PROLIFIC_BUF_SIZE 256 struct request_item; @@ -55,4 +62,5 @@ private: bool fIsHX; }; + #endif //_USB_PROLIFIC_H_ diff --git a/src/add-ons/kernel/drivers/ports/usb_serial/SerialDevice.cpp b/src/add-ons/kernel/drivers/ports/usb_serial/SerialDevice.cpp index 0d76a31550..e8bb192c35 100644 --- a/src/add-ons/kernel/drivers/ports/usb_serial/SerialDevice.cpp +++ b/src/add-ons/kernel/drivers/ports/usb_serial/SerialDevice.cpp @@ -4,7 +4,12 @@ * * Copyright (c) 2003 by Siarzhuk Zharski * Distributed under the terms of the MIT License. + * + * Authors: + * Alexander von Gluck IV, kallisti5@unixzen.com */ + + #include #include "SerialDevice.h" @@ -13,6 +18,7 @@ #include "ACM.h" #include "FTDI.h" #include "KLSI.h" +#include "Option.h" #include "Prolific.h" #include "Silicon.h" @@ -714,451 +720,57 @@ SerialDevice * SerialDevice::MakeDevice(usb_device device, uint16 vendorID, uint16 productID) { - const char *description = NULL; - - switch (vendorID) { - case VENDOR_IODATA: - case VENDOR_ATEN: - case VENDOR_TDK: - case VENDOR_RATOC: - case VENDOR_PROLIFIC: - case VENDOR_ELECOM: - case VENDOR_SOURCENEXT: - case VENDOR_HAL: - { - switch (productID) { - case PRODUCT_PROLIFIC_RSAQ2: - description = "PL2303 Serial adapter (IODATA USB-RSAQ2)"; - break; - case PRODUCT_IODATA_USBRSAQ: - description = "I/O Data USB serial adapter USB-RSAQ1"; - break; - case PRODUCT_ATEN_UC232A: - description = "Aten Serial adapter"; - break; - case PRODUCT_TDK_UHA6400: - description = "TDK USB-PHS Adapter UHA6400"; - break; - case PRODUCT_RATOC_REXUSB60: - description = "Ratoc USB serial adapter REX-USB60"; - break; - case PRODUCT_PROLIFIC_PL2303: - description = "PL2303 Serial adapter (ATEN/IOGEAR UC232A)"; - break; - case PRODUCT_ELECOM_UCSGT: - description = "Elecom UC-SGT"; - break; - case PRODUCT_SOURCENEXT_KEIKAI8: - description = "SOURCENEXT KeikaiDenwa 8"; - break; - case PRODUCT_SOURCENEXT_KEIKAI8_CHG: - description = "SOURCENEXT KeikaiDenwa 8 with charger"; - break; - case PRODUCT_HAL_IMR001: - description = "HAL Corporation Crossam2+USB"; - break; - } - - if (description == NULL) - break; - - return new(std::nothrow) ProlificDevice(device, vendorID, productID, - description); - } - - case VENDOR_FTDI: - { - switch (productID) { - case PRODUCT_FTDI_8U100AX: - description = "FTDI 8U100AX serial converter"; - break; - case PRODUCT_FTDI_8U232AM: - description = "FTDI 8U232AM serial converter"; - break; - } - - if (description == NULL) - break; - + // FTDI Serial Device + for (uint32 i = 0; i < sizeof(kFTDIDevices) + / sizeof(kFTDIDevices[0]); i++) { + if (vendorID == kFTDIDevices[i].vendorID + && productID == kFTDIDevices[i].productID) { return new(std::nothrow) FTDIDevice(device, vendorID, productID, - description); + kFTDIDevices[i].deviceName); } - - case VENDOR_PALM: - case VENDOR_KLSI: - { - switch (productID) { - case PRODUCT_PALM_CONNECT: - description = "PalmConnect RS232"; - break; - case PRODUCT_KLSI_KL5KUSB105D: - description = "KLSI KL5KUSB105D"; - break; - } - - if (description == NULL) - break; - - return new(std::nothrow) KLSIDevice(device, vendorID, productID, - description); - } - - case VENDOR_RENESAS: - { - switch (productID) { - case 0x0053: - description = "Renesas RX610 RX-Stick"; - break; - } - - if (description != NULL) - goto SILICON; - break; - } - case VENDOR_AKATOM: - { - switch (productID) { - case 0x066A: - description = "AKTAKOM ACE-1001"; - break; - } - - if (description != NULL) - goto SILICON; - break; - } - case VENDOR_PIRELLI: - { - switch (productID) { - case 0xE000: - case 0xE003: - description = "Pirelli DP-L10 GSM Mobile"; - break; - } - - if (description != NULL) - goto SILICON; - break; - } - case VENDOR_CYPHERLAB: - { - switch (productID) { - case 0x1000: - description = "Cipherlab CCD Barcode Scanner"; - break; - } - - if (description != NULL) - goto SILICON; - break; - } - case VENDOR_GEMALTO: - { - switch (productID) { - case 0x5501: - description = "Gemalto contactless smartcard reader"; - break; - } - - if (description != NULL) - goto SILICON; - break; - } - case VENDOR_DIGIANSWER: - { - switch (productID) { - case 0x000A: - description = "Digianswer ZigBee MAC device"; - break; - } - - if (description != NULL) - goto SILICON; - break; - } - case VENDOR_MEI: - { - switch (productID) { - case 0x1100: - case 0x1101: - description = "MEI Acceptor"; - break; - } - - if (description != NULL) - goto SILICON; - break; - } - case VENDOR_DYNASTREAM: - { - switch (productID) { - case 0x1003: - case 0x1004: - case 0x1006: - description = "Dynastream ANT development board"; - break; - } - - if (description != NULL) - goto SILICON; - break; - } - case VENDOR_KNOCKOFF: - { - switch (productID) { - case 0xAA26: - description = "Knock-off DCU-11"; - break; - } - - if (description != NULL) - goto SILICON; - break; - } - case VENDOR_SIEMENS: - { - switch (productID) { - case 0x10C5: - description = "Siemens MC60"; - break; - } - - if (description != NULL) - goto SILICON; - break; - } - case VENDOR_NOKIA: - { - switch (productID) { - case 0xAC70: - description = "Nokia CA-42"; - break; - } - - if (description != NULL) - goto SILICON; - break; - } - case VENDOR_SILICON: - { - switch (productID) { - case 0x0F91: - case 0x1101: - case 0x1601: - case 0x800A: - case 0x803B: - case 0x8044: - case 0x804E: - case 0x8053: - case 0x8054: - case 0x8066: - case 0x806F: - case 0x807A: - case 0x80CA: - case 0x80DD: - case 0x80F6: - case 0x8115: - case 0x813D: - case 0x813F: - case 0x814A: - case 0x814B: - case 0x8156: - case 0x815E: - case 0x818B: - case 0x819F: - case 0x81A6: - case 0x81AC: - case 0x81AD: - case 0x81C8: - case 0x81E2: - case 0x81E7: - case 0x81E8: - case 0x81F2: - case 0x8218: - case 0x822B: - case 0x826B: - case 0x8293: - case 0x82F9: - case 0x8341: - case 0x8382: - case 0x83A8: - case 0x83D8: - case 0x8411: - case 0x8418: - case 0x846E: - case 0x8477: - case 0x85EA: - case 0x85EB: - case 0x8664: - case 0x8665: - case 0xEA60: - case 0xEA61: - case 0xEA71: - case 0xF001: - case 0xF002: - case 0xF003: - case 0xF004: - description = "Silicon Labs CP210x USB UART converter"; - break; - } - - if (description != NULL) - goto SILICON; - break; - } - case VENDOR_SILICON2: - { - switch (productID) { - case 0xEA61: - description = "Silicon Labs GPRS USB Modem"; - break; - } - - if (description != NULL) - goto SILICON; - break; - } - case VENDOR_SILICON3: - { - switch (productID) { - case 0xEA6A: - description = "Silicon Labs GPRS USB Modem 100EU"; - break; - } - - if (description != NULL) - goto SILICON; - break; - } - case VENDOR_BALTECH: - { - switch (productID) { - case 0x9999: - description = "Balteck card reader"; - break; - } - - if (description != NULL) - goto SILICON; - break; - } - case VENDOR_OWEN: - { - switch (productID) { - case 0x0004: - description = "Owen AC4 USB-RS485 Converter"; - break; - } - - if (description != NULL) - goto SILICON; - break; - } - case VENDOR_CLIPSAL: - { - switch (productID) { - case 0x0303: - description = "Clipsal 5500PCU C-Bus USB interface"; - break; - } - - if (description != NULL) - goto SILICON; - break; - } - case VENDOR_JABLOTRON: - { - switch (productID) { - case 0x0001: - description = "Jablotron serial interface"; - break; - } - - if (description != NULL) - goto SILICON; - break; - } - case VENDOR_WIENER: - { - switch (productID) { - case 0x0010: - case 0x0011: - case 0x0012: - case 0x0015: - description = "W-IE-NE-R Plein & Baus GmbH device"; - break; - } - - if (description != NULL) - goto SILICON; - break; - } - case VENDOR_WAVESENSE: - { - switch (productID) { - case 0xAAAA: - description = "Wavesense Jazz blood glucose meter"; - break; - } - - if (description != NULL) - goto SILICON; - break; - } - case VENDOR_VAISALA: - { - switch (productID) { - case 0x0200: - description = "Vaisala USB instrument"; - break; - } - - if (description != NULL) - goto SILICON; - break; - } - case VENDOR_ELV: - { - switch (productID) { - case 0xE00F: - description = "ELV USB I²C interface"; - break; - } - - if (description != NULL) - goto SILICON; - break; - } - case VENDOR_WAGO: - { - switch (productID) { - case 0x07A6: - description = "WAGO 750-923 USB Service"; - break; - } - - if (description != NULL) - goto SILICON; - break; - } - case VENDOR_DW700: - { - switch (productID) { - case 0x9500: - description = "DW700 GPS USB interface"; - break; - } - - if (description != NULL) - goto SILICON; - break; - } - -SILICON: - return new(std::nothrow) SiliconDevice(device, vendorID, productID, - description); } + // KLSI Serial Device + for (uint32 i = 0; i < sizeof(kKLSIDevices) + / sizeof(kKLSIDevices[0]); i++) { + if (vendorID == kKLSIDevices[i].vendorID + && productID == kKLSIDevices[i].productID) { + return new(std::nothrow) KLSIDevice(device, vendorID, productID, + kKLSIDevices[i].deviceName); + } + } + + // Prolific Serial Device + for (uint32 i = 0; i < sizeof(kProlificDevices) + / sizeof(kProlificDevices[0]); i++) { + if (vendorID == kProlificDevices[i].vendorID + && productID == kProlificDevices[i].productID) { + return new(std::nothrow) ProlificDevice(device, vendorID, productID, + kProlificDevices[i].deviceName); + } + } + + // Silicon Serial Device + for (uint32 i = 0; i < sizeof(kSiliconDevices) + / sizeof(kSiliconDevices[0]); i++) { + if (vendorID == kSiliconDevices[i].vendorID + && productID == kSiliconDevices[i].productID) { + return new(std::nothrow) SiliconDevice(device, vendorID, productID, + kSiliconDevices[i].deviceName); + } + } + + // Option Serial Device + for (uint32 i = 0; i < sizeof(kOptionDevices) + / sizeof(kOptionDevices[0]); i++) { + if (vendorID == kOptionDevices[i].vendorID + && productID == kOptionDevices[i].productID) { + return new(std::nothrow) OptionDevice(device, vendorID, productID, + kOptionDevices[i].deviceName); + } + } + + // Otherwise, return standard ACM device return new(std::nothrow) ACMDevice(device, vendorID, productID, "CDC ACM compatible device"); } diff --git a/src/add-ons/kernel/drivers/ports/usb_serial/SerialDevice.h b/src/add-ons/kernel/drivers/ports/usb_serial/SerialDevice.h index e27ecddb7a..57afc10cb7 100644 --- a/src/add-ons/kernel/drivers/ports/usb_serial/SerialDevice.h +++ b/src/add-ons/kernel/drivers/ports/usb_serial/SerialDevice.h @@ -4,12 +4,24 @@ * * Copyright (c) 2003 by Siarzhuk Zharski * Distributed under the terms of the MIT License. + * + * Authors: + * Alexander von Gluck IV, kallisti5@unixzen.com */ #ifndef _USB_DEVICE_H_ #define _USB_DEVICE_H_ + #include "Driver.h" + +struct usb_serial_device { + uint32 vendorID; + uint32 productID; + const char* deviceName; +}; + + class SerialDevice { public: SerialDevice(usb_device device, diff --git a/src/add-ons/kernel/drivers/ports/usb_serial/Silicon.cpp b/src/add-ons/kernel/drivers/ports/usb_serial/Silicon.cpp index 5f3a33e451..f902302f98 100644 --- a/src/add-ons/kernel/drivers/ports/usb_serial/Silicon.cpp +++ b/src/add-ons/kernel/drivers/ports/usb_serial/Silicon.cpp @@ -1,6 +1,9 @@ /* * Copyright 2011, Adrien Destugues * Distributed under the terms of the MIT License. + * + * Authors: + * Alexander von Gluck IV, kallisti5@unixzen.com */ diff --git a/src/add-ons/kernel/drivers/ports/usb_serial/Silicon.h b/src/add-ons/kernel/drivers/ports/usb_serial/Silicon.h index 3c1897dac4..e12916b94b 100644 --- a/src/add-ons/kernel/drivers/ports/usb_serial/Silicon.h +++ b/src/add-ons/kernel/drivers/ports/usb_serial/Silicon.h @@ -1,12 +1,133 @@ /* * Copyright 2011, Adrien Destugues * Distributed under the terms of the MIT License. + * + * Authors: + * Alexander von Gluck IV, kallisti5@unixzen.com */ #ifndef _USB_SILICON_H_ #define _USB_SILICON_H_ + #include "SerialDevice.h" + +/* supported vendor and product ids */ +#define VENDOR_RENESAS 0x045B +#define VENDOR_AKATOM 0x0471 +#define VENDOR_PIRELLI 0x0489 +#define VENDOR_CYPHERLAB 0x0745 +#define VENDOR_GEMALTO 0x08E6 +#define VENDOR_DIGIANSWER 0x08FD +#define VENDOR_MEI 0x0BED +#define VENDOR_DYNASTREAM 0x0FCF +#define VENDOR_KNOCKOFF 0x10A6 +#define VENDOR_SIEMENS 0x10AB +#define VENDOR_NOKIA 0x10B5 +#define VENDOR_SILICON 0x10C4 +#define VENDOR_SILICON2 0x10C5 +#define VENDOR_SILICON3 0x10CE +#define VENDOR_BALTECH 0x13AD +#define VENDOR_OWEN 0x1555 +#define VENDOR_CLIPSAL 0x166A +#define VENDOR_JABLOTRON 0x16D6 +#define VENDOR_WIENER 0x16DC +#define VENDOR_WAVESENSE 0x17F4 +#define VENDOR_VAISALA 0x1843 +#define VENDOR_ELV 0x18EF +#define VENDOR_WAGO 0x1BE3 +#define VENDOR_DW700 0x413C + +const usb_serial_device kSiliconDevices[] = { + {VENDOR_RENESAS, 0x0053, "Renesas RX610 RX-Stick"}, + {VENDOR_AKATOM, 0x066A, "AKTAKOM ACE-1001"}, + {VENDOR_PIRELLI, 0xE000, "Pirelli DP-L10 GSM Mobile"}, + {VENDOR_PIRELLI, 0xE003, "Pirelli DP-L10 GSM Mobile"}, + {VENDOR_CYPHERLAB, 0x1000, "Cipherlab CCD Barcode Scanner"}, + {VENDOR_GEMALTO, 0x5501, "Gemalto contactless smartcard reader"}, + {VENDOR_DIGIANSWER, 0x000A, "Digianswer ZigBee MAC device"}, + {VENDOR_MEI, 0x1100, "MEI Acceptor"}, + {VENDOR_MEI, 0x1101, "MEI Acceptor"}, + {VENDOR_DYNASTREAM, 0x1003, "Dynastream ANT development board"}, + {VENDOR_DYNASTREAM, 0x1004, "Dynastream ANT development board"}, + {VENDOR_DYNASTREAM, 0x1006, "Dynastream ANT development board"}, + {VENDOR_KNOCKOFF, 0xAA26, "Knock-off DCU-11"}, + {VENDOR_SIEMENS, 0x10C5, "Siemens MC60"}, + {VENDOR_NOKIA, 0xAC70, "Nokia CA-42"}, + {VENDOR_BALTECH, 0x9999, "Balteck card reader"}, + {VENDOR_OWEN, 0x0004, "Owen AC4 USB-RS485 Converter"}, + {VENDOR_CLIPSAL, 0x0303, "Clipsal 5500PCU C-Bus USB interface"}, + {VENDOR_JABLOTRON, 0x0001, "Jablotron serial interface"}, + {VENDOR_WIENER, 0x0010, "W-IE-NE-R Plein & Baus GmbH device"}, + {VENDOR_WIENER, 0x0011, "W-IE-NE-R Plein & Baus GmbH device"}, + {VENDOR_WIENER, 0x0012, "W-IE-NE-R Plein & Baus GmbH device"}, + {VENDOR_WIENER, 0x0015, "W-IE-NE-R Plein & Baus GmbH device"}, + {VENDOR_WAVESENSE, 0xAAAA, "Wavesense Jazz blood glucose meter"}, + {VENDOR_VAISALA, 0x0200, "Vaisala USB instrument"}, + {VENDOR_ELV, 0xE00F, "ELV USB I²C interface"}, + {VENDOR_WAGO, 0x07A6, "WAGO 750-923 USB Service"}, + {VENDOR_DW700, 0x9500, "DW700 GPS USB interface"}, + {VENDOR_SILICON, 0x0F91, "Silicon Labs CP210x USB UART converter"}, + {VENDOR_SILICON, 0x1101, "Silicon Labs CP210x USB UART converter"}, + {VENDOR_SILICON, 0x1601, "Silicon Labs CP210x USB UART converter"}, + {VENDOR_SILICON, 0x800A, "Silicon Labs CP210x USB UART converter"}, + {VENDOR_SILICON, 0x803B, "Silicon Labs CP210x USB UART converter"}, + {VENDOR_SILICON, 0x8044, "Silicon Labs CP210x USB UART converter"}, + {VENDOR_SILICON, 0x804E, "Silicon Labs CP210x USB UART converter"}, + {VENDOR_SILICON, 0x8053, "Silicon Labs CP210x USB UART converter"}, + {VENDOR_SILICON, 0x8054, "Silicon Labs CP210x USB UART converter"}, + {VENDOR_SILICON, 0x8066, "Silicon Labs CP210x USB UART converter"}, + {VENDOR_SILICON, 0x806F, "Silicon Labs CP210x USB UART converter"}, + {VENDOR_SILICON, 0x807A, "Silicon Labs CP210x USB UART converter"}, + {VENDOR_SILICON, 0x80CA, "Silicon Labs CP210x USB UART converter"}, + {VENDOR_SILICON, 0x80DD, "Silicon Labs CP210x USB UART converter"}, + {VENDOR_SILICON, 0x80F6, "Silicon Labs CP210x USB UART converter"}, + {VENDOR_SILICON, 0x8115, "Silicon Labs CP210x USB UART converter"}, + {VENDOR_SILICON, 0x813D, "Silicon Labs CP210x USB UART converter"}, + {VENDOR_SILICON, 0x813F, "Silicon Labs CP210x USB UART converter"}, + {VENDOR_SILICON, 0x814A, "Silicon Labs CP210x USB UART converter"}, + {VENDOR_SILICON, 0x814B, "Silicon Labs CP210x USB UART converter"}, + {VENDOR_SILICON, 0x8156, "Silicon Labs CP210x USB UART converter"}, + {VENDOR_SILICON, 0x815E, "Silicon Labs CP210x USB UART converter"}, + {VENDOR_SILICON, 0x818B, "Silicon Labs CP210x USB UART converter"}, + {VENDOR_SILICON, 0x819F, "Silicon Labs CP210x USB UART converter"}, + {VENDOR_SILICON, 0x81A6, "Silicon Labs CP210x USB UART converter"}, + {VENDOR_SILICON, 0x81AC, "Silicon Labs CP210x USB UART converter"}, + {VENDOR_SILICON, 0x81AD, "Silicon Labs CP210x USB UART converter"}, + {VENDOR_SILICON, 0x81C8, "Silicon Labs CP210x USB UART converter"}, + {VENDOR_SILICON, 0x81E2, "Silicon Labs CP210x USB UART converter"}, + {VENDOR_SILICON, 0x81E7, "Silicon Labs CP210x USB UART converter"}, + {VENDOR_SILICON, 0x81E8, "Silicon Labs CP210x USB UART converter"}, + {VENDOR_SILICON, 0x81F2, "Silicon Labs CP210x USB UART converter"}, + {VENDOR_SILICON, 0x8218, "Silicon Labs CP210x USB UART converter"}, + {VENDOR_SILICON, 0x822B, "Silicon Labs CP210x USB UART converter"}, + {VENDOR_SILICON, 0x826B, "Silicon Labs CP210x USB UART converter"}, + {VENDOR_SILICON, 0x8293, "Silicon Labs CP210x USB UART converter"}, + {VENDOR_SILICON, 0x82F9, "Silicon Labs CP210x USB UART converter"}, + {VENDOR_SILICON, 0x8341, "Silicon Labs CP210x USB UART converter"}, + {VENDOR_SILICON, 0x8382, "Silicon Labs CP210x USB UART converter"}, + {VENDOR_SILICON, 0x83A8, "Silicon Labs CP210x USB UART converter"}, + {VENDOR_SILICON, 0x83D8, "Silicon Labs CP210x USB UART converter"}, + {VENDOR_SILICON, 0x8411, "Silicon Labs CP210x USB UART converter"}, + {VENDOR_SILICON, 0x8418, "Silicon Labs CP210x USB UART converter"}, + {VENDOR_SILICON, 0x846E, "Silicon Labs CP210x USB UART converter"}, + {VENDOR_SILICON, 0x8477, "Silicon Labs CP210x USB UART converter"}, + {VENDOR_SILICON, 0x85EA, "Silicon Labs CP210x USB UART converter"}, + {VENDOR_SILICON, 0x85EB, "Silicon Labs CP210x USB UART converter"}, + {VENDOR_SILICON, 0x8664, "Silicon Labs CP210x USB UART converter"}, + {VENDOR_SILICON, 0x8665, "Silicon Labs CP210x USB UART converter"}, + {VENDOR_SILICON, 0xEA60, "Silicon Labs CP210x USB UART converter"}, + {VENDOR_SILICON, 0xEA61, "Silicon Labs CP210x USB UART converter"}, + {VENDOR_SILICON, 0xEA71, "Silicon Labs CP210x USB UART converter"}, + {VENDOR_SILICON, 0xF001, "Silicon Labs CP210x USB UART converter"}, + {VENDOR_SILICON, 0xF002, "Silicon Labs CP210x USB UART converter"}, + {VENDOR_SILICON, 0xF003, "Silicon Labs CP210x USB UART converter"}, + {VENDOR_SILICON, 0xF004, "Silicon Labs CP210x USB UART converter"}, + {VENDOR_SILICON2, 0xEA61, "Silicon Labs GPRS USB Modem"}, + {VENDOR_SILICON3, 0xEA6A, "Silicon Labs GPRS USB Modem 100EU"} +}; + + class SiliconDevice : public SerialDevice { public: SiliconDevice(usb_device device, uint16 vendorID, @@ -98,30 +219,5 @@ status_t WriteConfig(CP210XRequest request, uint16_t* data, size_t size); }; -#define VENDOR_RENESAS 0x045B -#define VENDOR_AKATOM 0x0471 -#define VENDOR_PIRELLI 0x0489 -#define VENDOR_CYPHERLAB 0x0745 -#define VENDOR_GEMALTO 0x08E6 -#define VENDOR_DIGIANSWER 0x08FD -#define VENDOR_MEI 0x0BED -#define VENDOR_DYNASTREAM 0x0FCF -#define VENDOR_KNOCKOFF 0x10A6 -#define VENDOR_SIEMENS 0x10AB -#define VENDOR_NOKIA 0x10B5 -#define VENDOR_SILICON 0x10C4 -#define VENDOR_SILICON2 0x10C5 -#define VENDOR_SILICON3 0x10CE -#define VENDOR_BALTECH 0x13AD -#define VENDOR_OWEN 0x1555 -#define VENDOR_CLIPSAL 0x166A -#define VENDOR_JABLOTRON 0x16D6 -#define VENDOR_WIENER 0x16DC -#define VENDOR_WAVESENSE 0x17F4 -#define VENDOR_VAISALA 0x1843 -#define VENDOR_ELV 0x18EF -#define VENDOR_WAGO 0x1BE3 -#define VENDOR_DW700 0x413C - #endif //_USB_SILICON_H_ diff --git a/src/add-ons/kernel/file_systems/bfs/BPlusTree.cpp b/src/add-ons/kernel/file_systems/bfs/BPlusTree.cpp index 90972f37ec..51b896a17b 100644 --- a/src/add-ons/kernel/file_systems/bfs/BPlusTree.cpp +++ b/src/add-ons/kernel/file_systems/bfs/BPlusTree.cpp @@ -1782,7 +1782,7 @@ BPlusTree::_RemoveDuplicate(Transaction& transaction, bplustree_node::FragmentIndex(oldValue)); int32 arrayCount = array->Count(); - if (arrayCount > NUM_FRAGMENT_VALUES || arrayCount < 1) { + if (arrayCount > NUM_FRAGMENT_VALUES || arrayCount <= 1) { FATAL(("_RemoveDuplicate: Invalid array[%d] size in fragment %" B_PRIdOFF " == %" B_PRId32 ", inode %" B_PRIdOFF "!\n", (int)bplustree_node::FragmentIndex(oldValue), duplicateOffset, @@ -2361,7 +2361,7 @@ BPlusTree::_ValidateChildren(TreeCheck& check, uint32 level, off_t offset, } int32 arrayCount = array->Count(); - if (arrayCount < 1 || arrayCount > maxSize) { + if (arrayCount <= 1 || arrayCount > maxSize) { dprintf("inode %" B_PRIdOFF ": duplicate at %" B_PRIdOFF " has invalid array size %" B_PRId32 "!\n", fStream->ID(), duplicateOffset, arrayCount); diff --git a/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp b/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp index 8dc8f3f4b0..b0d446f75b 100644 --- a/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp +++ b/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp @@ -1699,9 +1699,11 @@ BlockAllocator::CheckBlocks(off_t start, off_t length, bool allocated) if (start < 0 || start + length > fVolume->NumBlocks()) return B_BAD_VALUE; - uint32 group = start >> fVolume->AllocationGroupShift(); - uint32 groupBlock = start / (fVolume->BlockSize() << 3); - uint32 blockOffset = start % fVolume->BlockSize(); + int32 group = start >> fVolume->AllocationGroupShift(); + uint32 bitmapBlock = start / (fVolume->BlockSize() << 3); + uint32 blockOffset = start % (fVolume->BlockSize() << 3); + + uint32 groupBlock = bitmapBlock % fBlocksPerGroup; AllocationBlock cached(fVolume); diff --git a/src/add-ons/kernel/file_systems/ntfs/ntfsdir.c b/src/add-ons/kernel/file_systems/ntfs/ntfsdir.c index e222434897..bc3bb5e92f 100644 --- a/src/add-ons/kernel/file_systems/ntfs/ntfsdir.c +++ b/src/add-ons/kernel/file_systems/ntfs/ntfsdir.c @@ -183,7 +183,7 @@ fs_readdir(fs_volume *_vol, fs_vnode *_node, void *_cookie, struct dirent *buf, TRACE("fs_readdir - ENTER (sizeof(buf)=%d, bufsize=%d, num=%d\n", sizeof(buf), bufsize, *num); - if (!ns || !node || !cookie || !num || bufsize < sizeof(buf)) { + if (!ns || !node || !cookie || !num || bufsize < sizeof(*buf)) { result = EINVAL; goto exit; } diff --git a/src/add-ons/media/media-add-ons/usb_webcam/addons/sonix/SonixCamDevice.cpp b/src/add-ons/media/media-add-ons/usb_webcam/addons/sonix/SonixCamDevice.cpp index e0f3df6fc4..eb20ace8eb 100644 --- a/src/add-ons/media/media-add-ons/usb_webcam/addons/sonix/SonixCamDevice.cpp +++ b/src/add-ons/media/media-add-ons/usb_webcam/addons/sonix/SonixCamDevice.cpp @@ -407,8 +407,8 @@ SonixCamDevice::ReadIIC(uint8 address, uint8 *data) if (!Sensor()) return B_NO_INIT; //dprintf(ID "sonix_i2c_write_multi(, %02x, %d, {%02x, %02x, %02x, %02x, %02x})\n", slave, count, d0, d1, d2, d3, d4); - buffer[0] = (1 << 4) | Sensor()->Use400kHz()?0x01:0 - | Sensor()->UseRealIIC()?0x80:0; + buffer[0] = (1 << 4) | (Sensor()->Use400kHz()?0x01:0) + | (Sensor()->UseRealIIC()?0x80:0); buffer[1] = Sensor()->IICWriteAddress(); buffer[2] = address; buffer[7] = 0x10; /* absolutely no idea why V4L2 driver use that value */ @@ -421,8 +421,8 @@ SonixCamDevice::ReadIIC(uint8 address, uint8 *data) //dprintf(ID "sonix_i2c_write_multi(, %02x, %d, {%02x, %02x, %02x, %02x, %02x})\n", slave, count, d0, d1, d2, d3, d4); - buffer[0] = (1 << 4) | Sensor()->Use400kHz()?0x01:0 - | 0x02 | Sensor()->UseRealIIC()?0x80:0; /* read 1 byte */ + buffer[0] = (1 << 4) | (Sensor()->Use400kHz()?0x01:0) + | 0x02 | (Sensor()->UseRealIIC()?0x80:0); /* read 1 byte */ buffer[1] = Sensor()->IICReadAddress();//IICWriteAddress buffer[7] = 0x10; /* absolutely no idea why V4L2 driver use that value */ err = WriteReg(SN9C102_I2C_SETUP, buffer, 8); diff --git a/src/apps/codycam/CodyCam.cpp b/src/apps/codycam/CodyCam.cpp index 0df1c060a6..2b79880cd9 100644 --- a/src/apps/codycam/CodyCam.cpp +++ b/src/apps/codycam/CodyCam.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -23,8 +24,6 @@ #include #include -#include - #undef B_TRANSLATION_CONTEXT #define B_TRANSLATION_CONTEXT "CodyCam" diff --git a/src/apps/debugger/Debugger.cpp b/src/apps/debugger/Debugger.cpp index c7a687c855..bac8ac0d13 100644 --- a/src/apps/debugger/Debugger.cpp +++ b/src/apps/debugger/Debugger.cpp @@ -56,7 +56,7 @@ static const char* kUsage = "\n" "Options:\n" " -h, --help - Print this usage info and exit.\n" - " -c, --cli - Use command line user interface (not yet implemented)\n" + " -c, --cli - Use command line user interface\n" ; @@ -88,6 +88,13 @@ struct Options { }; +struct DebuggedProgramInfo { + team_id team; + thread_id thread; + bool stopInMain; +}; + + static bool parse_arguments(int argc, const char* const* argv, bool noOutput, Options& options) @@ -174,25 +181,104 @@ parse_arguments(int argc, const char* const* argv, bool noOutput, return true; } +static status_t +global_init() +{ + status_t error = TypeHandlerRoster::CreateDefault(); + if (error != B_OK) + return error; + error = ValueHandlerRoster::CreateDefault(); + if (error != B_OK) + return error; + + return B_OK; +} + + +/** + * Finds or runs the program to debug, depending on the command line options. + * @param options The parsed command line options. + * @param _info The info for the program to fill in. Will only be filled in + * if successful. + * @return \c true, if the program has been found or ran. + */ +static bool +get_debugged_program(const Options& options, DebuggedProgramInfo& _info) +{ + team_id team = options.team; + thread_id thread = options.thread; + bool stopInMain = false; + + // If command line arguments were given, start the program. + if (options.commandLineArgc > 0) { + printf("loading program: \"%s\" ...\n", options.commandLineArgv[0]); + // TODO: What about the CWD? + thread = load_program(options.commandLineArgv, + options.commandLineArgc, false); + if (thread < 0) { + // TODO: Notify the user! + fprintf(stderr, "Error: Failed to load program \"%s\": %s\n", + options.commandLineArgv[0], strerror(thread)); + return false; + } + + team = thread; + // main thread ID == team ID + stopInMain = true; + } + + // no parameters given, prompt the user to attach to a team + if (team < 0 && thread < 0) + return false; + + // no team, but a thread -- get team + if (team < 0) { + printf("no team yet, getting thread info...\n"); + thread_info threadInfo; + status_t error = get_thread_info(thread, &threadInfo); + if (error != B_OK) { + // TODO: Notify the user! + fprintf(stderr, "Error: Failed to get info for thread \"%ld\": " + "%s\n", thread, strerror(error)); + return false; + } + + team = threadInfo.team; + } + printf("team: %ld, thread: %ld\n", team, thread); + + _info.team = team; + _info.thread = thread; + _info.stopInMain = stopInMain; + return true; +} + + +/** + * Creates a TeamDebugger for the given team. If userInterface is given, + * that user interface is used (the caller retains its reference), otherwise + * a graphical user interface is created. + */ static TeamDebugger* start_team_debugger(team_id teamID, SettingsManager* settingsManager, TeamDebugger::Listener* listener, thread_id threadID = -1, - bool stopInMain = false, bool useCLI = false) + bool stopInMain = false, UserInterface* userInterface = NULL) { if (teamID < 0) return NULL; - UserInterface* userInterface = useCLI - ? (UserInterface*)new(std::nothrow) CommandLineUserInterface - : (UserInterface*)new(std::nothrow) GraphicalUserInterface; - + BReference userInterfaceReference; if (userInterface == NULL) { - // TODO: Notify the user! - fprintf(stderr, "Error: Out of memory!\n"); - return NULL; + userInterface = new(std::nothrow) GraphicalUserInterface; + if (userInterface == NULL) { + // TODO: Notify the user! + fprintf(stderr, "Error: Out of memory!\n"); + return NULL; + } + + userInterfaceReference.SetTo(userInterface, true); } - BReference userInterfaceReference(userInterface, true); status_t error = B_NO_MEMORY; @@ -213,6 +299,7 @@ start_team_debugger(team_id teamID, SettingsManager* settingsManager, return debugger; } + // #pragma mark - Debugger application class @@ -247,6 +334,26 @@ private: }; +// #pragma mark - CliDebugger + + +class CliDebugger : private TeamDebugger::Listener { +public: + CliDebugger(); + ~CliDebugger(); + + bool Run(const Options& options); + +private: + // TeamDebugger::Listener + virtual void TeamDebuggerStarted(TeamDebugger* debugger); + virtual void TeamDebuggerQuit(TeamDebugger* debugger); +}; + + +// #pragma mark - Debugger application class + + Debugger::Debugger() : BApplication(kDebuggerSignature), @@ -266,11 +373,7 @@ Debugger::~Debugger() status_t Debugger::Init() { - status_t error = TypeHandlerRoster::CreateDefault(); - if (error != B_OK) - return error; - - error = ValueHandlerRoster::CreateDefault(); + status_t error = global_init(); if (error != B_OK) return error; @@ -348,62 +451,22 @@ Debugger::ArgvReceived(int32 argc, char** argv) return; } - team_id team = options.team; - thread_id thread = options.thread; - bool stopInMain = false; - - // If command line arguments were given, start the program. - if (options.commandLineArgc > 0) { - printf("loading program: \"%s\" ...\n", options.commandLineArgv[0]); - // TODO: What about the CWD? - thread = load_program(options.commandLineArgv, - options.commandLineArgc, false); - if (thread < 0) { - // TODO: Notify the user! - fprintf(stderr, "Error: Failed to load program \"%s\": %s\n", - options.commandLineArgv[0], strerror(thread)); - return; - } - - team = thread; - // main thread ID == team ID - stopInMain = true; - } - - // no parameters given, prompt the user to attach to a team - if (team < 0 && thread < 0) + DebuggedProgramInfo programInfo; + if (!get_debugged_program(options, programInfo)) return; - // If we've got - if (team < 0) { - printf("no team yet, getting thread info...\n"); - thread_info threadInfo; - status_t error = get_thread_info(thread, &threadInfo); - if (error != B_OK) { - // TODO: Notify the user! - fprintf(stderr, "Error: Failed to get info for thread \"%ld\": " - "%s\n", thread, strerror(error)); - return; - } - - team = threadInfo.team; - } - printf("team: %ld, thread: %ld\n", team, thread); - - TeamDebugger* debugger = _FindTeamDebugger(team); + TeamDebugger* debugger = _FindTeamDebugger(programInfo.team); if (debugger != NULL) { - printf("There's already a debugger for team: %ld\n", team); + printf("There's already a debugger for team: %ld\n", programInfo.team); debugger->Activate(); return; } - start_team_debugger(team, &fSettingsManager, this, thread, stopInMain); + start_team_debugger(programInfo.team, &fSettingsManager, this, + programInfo.thread, programInfo.stopInMain); } -// TeamDebugger::Listener - - void Debugger::TeamDebuggerStarted(TeamDebugger* debugger) { @@ -479,8 +542,79 @@ Debugger::_FindTeamDebugger(team_id teamID) const } +// #pragma mark - CliDebugger + + +CliDebugger::CliDebugger() +{ +} + + +CliDebugger::~CliDebugger() +{ +} + + +bool +CliDebugger::Run(const Options& options) +{ + // initialize global objects and settings manager + status_t error = global_init(); + if (error != B_OK) { + fprintf(stderr, "Error: Global initialization failed: %s\n", + strerror(error)); + return false; + } + + SettingsManager settingsManager; + error = settingsManager.Init(); + if (error != B_OK) { + fprintf(stderr, "Error: Settings manager initialization failed: " + "%s\n", strerror(error)); + return false; + } + + // create the command line UI + CommandLineUserInterface* userInterface + = new(std::nothrow) CommandLineUserInterface; + if (userInterface == NULL) { + fprintf(stderr, "Error: Out of memory!\n"); + return false; + } + BReference userInterfaceReference(userInterface, true); + + // get/run the program to be debugged and start the team debugger + DebuggedProgramInfo programInfo; + if (!get_debugged_program(options, programInfo)) + return false; + + if (start_team_debugger(programInfo.team, &settingsManager, this, + programInfo.thread, programInfo.stopInMain, userInterface) + == NULL) { + return false; + } + + userInterface->Run(); + + return true; +} + + +void +CliDebugger::TeamDebuggerStarted(TeamDebugger* debugger) +{ +} + + +void +CliDebugger::TeamDebuggerQuit(TeamDebugger* debugger) +{ +} + + // #pragma mark - + int main(int argc, const char* const* argv) { @@ -494,19 +628,19 @@ main(int argc, const char* const* argv) parse_arguments(argc, argv, false, options); if (options.useCLI) { - // TODO: implement - fprintf(stderr, "Error: Command line interface unimplemented\n"); - return 1; - } else { - Debugger app; - status_t error = app.Init(); - if (error != B_OK) { - fprintf(stderr, "Error: Failed to init application: %s\n", - strerror(error)); - return 1; - } - - app.Run(); + CliDebugger debugger; + return debugger.Run(options) ? 0 : 1; } + + Debugger app; + status_t error = app.Init(); + if (error != B_OK) { + fprintf(stderr, "Error: Failed to init application: %s\n", + strerror(error)); + return 1; + } + + app.Run(); + return 0; } diff --git a/src/apps/debugger/Jamfile b/src/apps/debugger/Jamfile index 193bc20961..80c98fe660 100644 --- a/src/apps/debugger/Jamfile +++ b/src/apps/debugger/Jamfile @@ -169,12 +169,13 @@ Application Debugger : # user_interface UserInterface.cpp + # user_interface/cli + CliCommand.cpp + CommandLineUserInterface.cpp + # user_interface/gui GraphicalUserInterface.cpp - # user_interface/cli - CommandLineUserInterface.cpp - # user_interface/gui/model VariablesViewState.cpp VariablesViewStateHistory.cpp diff --git a/src/apps/debugger/Jobs.cpp b/src/apps/debugger/Jobs.cpp index 0e812cc114..bfd2fe11dc 100644 --- a/src/apps/debugger/Jobs.cpp +++ b/src/apps/debugger/Jobs.cpp @@ -1,4 +1,5 @@ /* + * Copyright 2012, Rene Gollent, rene@gollent.com. * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. * Distributed under the terms of the MIT License. */ @@ -523,6 +524,9 @@ ResolveValueNodeValueJob::_ResolveNodeValue() fValueNode, fValueNode->Name().String(), parentNode); return error; } + + if (State() == JOB_STATE_WAITING) + return B_OK; } // resolve the node child location, if necessary @@ -629,6 +633,8 @@ ResolveValueNodeValueJob::_ResolveParentNodeValue(ValueNode* parentNode) // "Not found" can happen due to a race condition between // unlocking the worker and starting to wait. break; + case JOB_DEPENDENCY_ACTIVE: + return B_OK; case JOB_DEPENDENCY_FAILED: case JOB_DEPENDENCY_ABORTED: default: diff --git a/src/apps/debugger/Worker.cpp b/src/apps/debugger/Worker.cpp index dc1f06af09..304c3bd033 100644 --- a/src/apps/debugger/Worker.cpp +++ b/src/apps/debugger/Worker.cpp @@ -1,4 +1,5 @@ /* + * Copyright 2012, Rene Gollent, rene@gollent.com. * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. * Distributed under the terms of the MIT License. */ @@ -138,6 +139,14 @@ void Job::SetWaitStatus(job_wait_status status) { fWaitStatus = status; + switch (fWaitStatus) { + case JOB_DEPENDENCY_ACTIVE: + fState = JOB_STATE_WAITING; + break; + default: + fState = JOB_STATE_ACTIVE; + break; + } } @@ -346,18 +355,6 @@ Worker::WaitForJob(Job* waitingJob, const JobKey& key) waitingJob->SetDependency(job); job->DependentJobs().Add(waitingJob); - // TODO: Continuations would be nice. For the time being we have to use - // recursion. Disadvantages are that we'll use more stack and that aborting - // a job waiting for a dependency won't abort the job before the dependency - // is done. - locker.Unlock(); - _ProcessJobs(waitingJob); - locker.Lock(); - - // ignore the actual wait status when the game is over anyway - if (fTerminating || waitingJob->State() == JOB_STATE_ABORTED) - return JOB_DEPENDENCY_ABORTED; - return waitingJob->WaitStatus(); } @@ -372,7 +369,7 @@ Worker::_WorkerLoopEntry(void* data) status_t Worker::_WorkerLoop() { - _ProcessJobs(NULL); + _ProcessJobs(); // clean up aborted jobs AutoLocker locker(this); @@ -384,7 +381,7 @@ Worker::_WorkerLoop() void -Worker::_ProcessJobs(Job* waitingJob) +Worker::_ProcessJobs() { while (true) { AutoLocker locker(this); @@ -395,8 +392,10 @@ Worker::_ProcessJobs(Job* waitingJob) status_t error = acquire_sem(fWorkToDoSem); if (error != B_OK) { - if (error == B_INTERRUPTED) + if (error == B_INTERRUPTED) { + locker.Lock(); continue; + } break; } @@ -404,13 +403,9 @@ Worker::_ProcessJobs(Job* waitingJob) } // clean up aborted jobs - while (Job* job = fAbortedJobs.RemoveHead()) { + while (Job* job = fAbortedJobs.RemoveHead()) _FinishJob(job); - if (waitingJob != NULL && waitingJob->State() != JOB_STATE_WAITING) - break; - } - // process the next job if (Job* job = fUnscheduledJobs.RemoveHead()) { job->SetState(JOB_STATE_ACTIVE); @@ -422,12 +417,10 @@ Worker::_ProcessJobs(Job* waitingJob) if (job->State() == JOB_STATE_ACTIVE) { job->SetState( error == B_OK ? JOB_STATE_SUCCEEDED : JOB_STATE_FAILED); - } + } else if (job->State() == JOB_STATE_WAITING) + continue; _FinishJob(job); - - if (waitingJob != NULL && waitingJob->State() != JOB_STATE_WAITING) - break; } } } @@ -492,7 +485,10 @@ Worker::_FinishJob(Job* job) while (Job* dependentJob = job->DependentJobs().RemoveHead()) { dependentJob->SetDependency(NULL); dependentJob->SetWaitStatus(waitStatus); + fUnscheduledJobs.Add(dependentJob); } + + release_sem(fWorkToDoSem); } if (job->State() != JOB_STATE_ABORTED) diff --git a/src/apps/debugger/Worker.h b/src/apps/debugger/Worker.h index 241a3f4afa..7e356992a7 100644 --- a/src/apps/debugger/Worker.h +++ b/src/apps/debugger/Worker.h @@ -182,7 +182,7 @@ private: static status_t _WorkerLoopEntry(void* data); status_t _WorkerLoop(); - void _ProcessJobs(Job* waitingJob); + void _ProcessJobs(); void _AbortJob(Job* job, bool removeFromTable); void _FinishJob(Job* job); diff --git a/src/apps/debugger/dwarf/DwarfUtils.cpp b/src/apps/debugger/dwarf/DwarfUtils.cpp index 233a41ca13..f32816101e 100644 --- a/src/apps/debugger/dwarf/DwarfUtils.cpp +++ b/src/apps/debugger/dwarf/DwarfUtils.cpp @@ -1,6 +1,6 @@ /* * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. - * Copyright 2011, Rene Gollent, rene@gollent.com. + * Copyright 2011-2012, Rene Gollent, rene@gollent.com. * Distributed under the terms of the MIT License. */ @@ -102,7 +102,7 @@ DwarfUtils::GetFullDIEName(const DebugInfoEntry* entry, BString& _name) type)) { DIEType* baseType = type; while ((modifiedType = dynamic_cast( - baseType)) != NULL && modifiedType->GetType() != NULL) { + baseType)) != NULL) { switch (modifiedType->Tag()) { case DW_TAG_pointer_type: modifier.Prepend("*"); @@ -122,7 +122,13 @@ DwarfUtils::GetFullDIEName(const DebugInfoEntry* entry, BString& _name) type = baseType; } - GetFullyQualifiedDIEName(type, paramName); + // if the parameter has no type associated, + // then it's the unspecified type. + if (type == NULL) + paramName = "void"; + else + GetFullyQualifiedDIEName(type, paramName); + if (modifier.Length() > 0) { if (modifier[modifier.Length() - 1] == ' ') modifier.Truncate(modifier.Length() - 1); diff --git a/src/apps/debugger/user_interface/cli/CliCommand.cpp b/src/apps/debugger/user_interface/cli/CliCommand.cpp new file mode 100644 index 0000000000..c83c8cfbad --- /dev/null +++ b/src/apps/debugger/user_interface/cli/CliCommand.cpp @@ -0,0 +1,20 @@ +/* + * Copyright 2012, Ingo Weinhold, ingo_weinhold@gmx.de. + * Distributed under the terms of the MIT License. + */ + + +#include "CliCommand.h" + + +CliCommand::CliCommand(const char* summary, const char* usage) + : + fSummary(summary), + fUsage(usage) +{ +} + + +CliCommand::~CliCommand() +{ +} diff --git a/src/apps/debugger/user_interface/cli/CliCommand.h b/src/apps/debugger/user_interface/cli/CliCommand.h new file mode 100644 index 0000000000..2a65e19aa3 --- /dev/null +++ b/src/apps/debugger/user_interface/cli/CliCommand.h @@ -0,0 +1,33 @@ +/* + * Copyright 2012, Ingo Weinhold, ingo_weinhold@gmx.de. + * Distributed under the terms of the MIT License. + */ +#ifndef CLI_COMMAND_H +#define CLI_COMMAND_H + + +#include + + +class CliContext; + + +class CliCommand : public BReferenceable { +public: + CliCommand(const char* summary, + const char* usage); + virtual ~CliCommand(); + + const char* Summary() const { return fSummary; } + const char* Usage() const { return fUsage; } + + virtual void Execute(int argc, const char* const* argv, + CliContext& context) = 0; + +private: + const char* fSummary; + const char* fUsage; +}; + + +#endif // CLI_COMMAND_H diff --git a/src/apps/debugger/user_interface/cli/CliContext.h b/src/apps/debugger/user_interface/cli/CliContext.h new file mode 100644 index 0000000000..df318160a9 --- /dev/null +++ b/src/apps/debugger/user_interface/cli/CliContext.h @@ -0,0 +1,13 @@ +/* + * Copyright 2012, Ingo Weinhold, ingo_weinhold@gmx.de. + * Distributed under the terms of the MIT License. + */ +#ifndef CLI_CONTEXT_H +#define CLI_CONTEXT_H + + +class CliContext { +}; + + +#endif // CLI_CONTEXT_H diff --git a/src/apps/debugger/user_interface/cli/CommandLineUserInterface.cpp b/src/apps/debugger/user_interface/cli/CommandLineUserInterface.cpp index 95fd5f29fb..09db85f913 100644 --- a/src/apps/debugger/user_interface/cli/CommandLineUserInterface.cpp +++ b/src/apps/debugger/user_interface/cli/CommandLineUserInterface.cpp @@ -1,19 +1,115 @@ /* * Copyright 2011, Rene Gollent, rene@gollent.com. + * Copyright 2012, Ingo Weinhold, ingo_weinhold@gmx.de. * Distributed under the terms of the MIT License. */ #include "CommandLineUserInterface.h" +#include + +#include + +#include +#include + +#include "CliCommand.h" +#include "CliContext.h" + + +// #pragma mark - CommandEntry + + +struct CommandLineUserInterface::CommandEntry { + CommandEntry(const BString& name, CliCommand* command) + : + fName(name), + fCommand(command) + { + } + + const BString& Name() const + { + return fName; + } + + CliCommand* Command() const + { + return fCommand.Get(); + } + +private: + BString fName; + BReference fCommand; +}; + + +// #pragma mark - HelpCommand + + +struct CommandLineUserInterface::HelpCommand : CliCommand { + HelpCommand(CommandLineUserInterface* userInterface) + : + CliCommand("print a list of all commands", + "%s\n" + "Prints a list of all commands."), + fUserInterface(userInterface) + { + } + + virtual void Execute(int argc, const char* const* argv, CliContext& context) + { + fUserInterface->_PrintHelp(); + } + +private: + CommandLineUserInterface* fUserInterface; +}; + + +// #pragma mark - HelpCommand + + +struct CommandLineUserInterface::QuitCommand : CliCommand { + QuitCommand(CommandLineUserInterface* userInterface) + : + CliCommand("quit Debugger", + "%s\n" + "Quits Debugger."), + fUserInterface(userInterface) + { + } + + virtual void Execute(int argc, const char* const* argv, CliContext& context) + { + fUserInterface->fListener->UserInterfaceQuitRequested(); + } + +private: + CommandLineUserInterface* fUserInterface; +}; + + +// #pragma mark - CommandLineUserInterface + CommandLineUserInterface::CommandLineUserInterface() + : + fTeam(NULL), + fListener(NULL), + fCommands(20, true), + fShowSemaphore(-1), + fShown(false), + fTerminating(false) { } CommandLineUserInterface::~CommandLineUserInterface() { + if (fShowSemaphore >= 0) + delete_sem(fShowSemaphore); } @@ -27,33 +123,59 @@ CommandLineUserInterface::ID() const status_t CommandLineUserInterface::Init(Team* team, UserInterfaceListener* listener) { - return B_UNSUPPORTED; + fTeam = team; + fListener = listener; + + status_t error = _RegisterCommands(); + if (error != B_OK) + return error; + + fShowSemaphore = create_sem(0, "show CLI"); + if (fShowSemaphore < 0) + return fShowSemaphore; + + return B_OK; } void CommandLineUserInterface::Show() { + fShown = true; + release_sem(fShowSemaphore); } void CommandLineUserInterface::Terminate() { + fTerminating = true; + + if (fShown) { + // TODO: Signal the thread so it wakes up! + + // Wait for input loop to finish. + while (acquire_sem(fShowSemaphore) == B_INTERRUPTED) { + } + } else { + // The main thread will still be blocked in Run(). Unblock it. + delete_sem(fShowSemaphore); + fShowSemaphore = -1; + } } status_t CommandLineUserInterface::LoadSettings(const TeamUISettings* settings) { - return B_UNSUPPORTED; + return B_OK; } status_t CommandLineUserInterface::SaveSettings(TeamUISettings*& settings) const { - return B_UNSUPPORTED;; + return B_OK; } @@ -71,3 +193,144 @@ CommandLineUserInterface::SynchronouslyAskUser(const char* title, { return 0; } + + +void +CommandLineUserInterface::Run() +{ + // Wait for the Show() semaphore to be released. + status_t error; + do { + error = acquire_sem(fShowSemaphore); + } while (error == B_INTERRUPTED); + + if (error != B_OK) + return; + + _InputLoop(); + + // Release the Show() semaphore to signal Terminate(). + release_sem(fShowSemaphore); +} + + +/*static*/ status_t +CommandLineUserInterface::_InputLoopEntry(void* data) +{ + return ((CommandLineUserInterface*)data)->_InputLoop(); +} + + +status_t +CommandLineUserInterface::_InputLoop() +{ + while (!fTerminating) { + // read a command line + printf("debugger> "); + fflush(stdout); + char buffer[256]; + if (fgets(buffer, sizeof(buffer), stdin) == NULL) + break; + + // parse the command line + ArgumentVector args; + const char* parseErrorLocation; + switch (args.Parse(buffer, &parseErrorLocation)) { + case ArgumentVector::NO_ERROR: + break; + case ArgumentVector::NO_MEMORY: + printf("Insufficient memory parsing the command line.\n"); + continue; + case ArgumentVector::UNTERMINATED_QUOTED_STRING: + printf("Parse error: Unterminated quoted string starting at " + "character %zu.\n", parseErrorLocation - buffer + 1); + continue; + case ArgumentVector::TRAILING_BACKSPACE: + printf("Parse error: trailing backspace.\n"); + continue; + } + + if (args.ArgumentCount() == 0) + continue; + + _ExecuteCommand(args.ArgumentCount(), args.Arguments()); + } + + return B_OK; +} + + +status_t +CommandLineUserInterface::_RegisterCommands() +{ + if (_RegisterCommand("help", new(std::nothrow) HelpCommand(this)) && + _RegisterCommand("quit", new(std::nothrow) QuitCommand(this))) { + return B_OK; + } + + return B_NO_MEMORY; +} + + +bool +CommandLineUserInterface::_RegisterCommand(const BString& name, + CliCommand* command) +{ + BReference commandReference(command, true); + if (name.IsEmpty() || command == NULL) + return false; + + CommandEntry* entry = new(std::nothrow) CommandEntry(name, command); + if (entry == NULL || !fCommands.AddItem(entry)) { + delete entry; + return false; + } + + return true; +} + + +void +CommandLineUserInterface::_ExecuteCommand(int argc, const char* const* argv) +{ + const char* commandName = argv[0]; + size_t commandNameLength = strlen(commandName); + + CommandEntry* firstEntry = NULL; + for (int32 i = 0; CommandEntry* entry = fCommands.ItemAt(i); i++) { + if (entry->Name().Compare(commandName, commandNameLength) == 0) { + if (firstEntry != NULL) { + printf("Ambiguous command \"%s\".\n", commandName); + return; + } + + firstEntry = entry; + } + } + + if (firstEntry == NULL) { + printf("Unknown command \"%s\".\n", commandName); + return; + } + + CliContext context; + firstEntry->Command()->Execute(argc, argv, context); +} + + +void +CommandLineUserInterface::_PrintHelp() +{ + // determine longest command name + int32 longestCommandName = 0; + for (int32 i = 0; CommandEntry* entry = fCommands.ItemAt(i); i++) { + longestCommandName + = std::max(longestCommandName, entry->Name().Length()); + } + + // print the command list + for (int32 i = 0; CommandEntry* entry = fCommands.ItemAt(i); i++) { + printf("%*s - %s\n", (int)longestCommandName, entry->Name().String(), + entry->Command()->Summary()); + } +} diff --git a/src/apps/debugger/user_interface/cli/CommandLineUserInterface.h b/src/apps/debugger/user_interface/cli/CommandLineUserInterface.h index 4d04a7c2ee..9d0c0714b5 100644 --- a/src/apps/debugger/user_interface/cli/CommandLineUserInterface.h +++ b/src/apps/debugger/user_interface/cli/CommandLineUserInterface.h @@ -1,14 +1,21 @@ /* * Copyright 2011, Rene Gollent, rene@gollent.com. + * Copyright 2012, Ingo Weinhold, ingo_weinhold@gmx.de. * Distributed under the terms of the MIT License. */ #ifndef COMMAND_LINE_USER_INTERFACE_H #define COMMAND_LINE_USER_INTERFACE_H +#include +#include + #include "UserInterface.h" +class CliCommand; + + class CommandLineUserInterface : public UserInterface { public: CommandLineUserInterface(); @@ -33,6 +40,40 @@ public: const char* message, const char* choice1, const char* choice2, const char* choice3); + void Run(); + // Called by the main thread, when + // everything has been set up. Enters the + // input loop. + +private: + struct CommandEntry; + typedef BObjectList CommandList; + + struct HelpCommand; + struct QuitCommand; + + // GCC 2 support + friend struct HelpCommand; + friend struct QuitCommand; + +private: + static status_t _InputLoopEntry(void* data); + status_t _InputLoop(); + + status_t _RegisterCommands(); + bool _RegisterCommand(const BString& name, + CliCommand* command); + void _ExecuteCommand(int argc, + const char* const* argv); + void _PrintHelp(); + +private: + Team* fTeam; + UserInterfaceListener* fListener; + CommandList fCommands; + sem_id fShowSemaphore; + bool fShown; + bool fTerminating; }; diff --git a/src/apps/deskbar/BarView.cpp b/src/apps/deskbar/BarView.cpp index 8fb1715936..0bc16d2f6f 100644 --- a/src/apps/deskbar/BarView.cpp +++ b/src/apps/deskbar/BarView.cpp @@ -69,6 +69,8 @@ const int32 kDefaultRecentAppCount = 10; const int32 kMenuTrackMargin = 20; +const uint32 kUpdateOrientation = 'UpOr'; + class BarViewMessageFilter : public BMessageFilter { @@ -102,7 +104,7 @@ BarViewMessageFilter::Filter(BMessage* message, BHandler** target) if (message->what == B_MOUSE_DOWN || message->what == B_MOUSE_MOVED) { BPoint where = message->FindPoint("be:view_where"); uint32 transit = message->FindInt32("be:transit"); - BMessage *dragMessage = NULL; + BMessage* dragMessage = NULL; if (message->HasMessage("be:drag_message")) { dragMessage = new BMessage(); message->FindMessage("be:drag_message", dragMessage); @@ -111,11 +113,11 @@ BarViewMessageFilter::Filter(BMessage* message, BHandler** target) switch (message->what) { case B_MOUSE_DOWN: fBarView->MouseDown(where); - break; + break; case B_MOUSE_MOVED: fBarView->MouseMoved(where, transit, dragMessage); - break; + break; } delete dragMessage; @@ -140,7 +142,8 @@ TBarView::TBarView(BRect frame, bool vertical, bool left, bool top, fCachedTypesList(NULL), fMaxRecentDocs(kDefaultRecentDocCount), fMaxRecentApps(kDefaultRecentAppCount), - fLastDragItem(NULL) + fLastDragItem(NULL), + fMouseFilter(NULL) { fReplicantTray = new TReplicantTray(this, fVertical); fDragRegion = new TDragRegion(this, fReplicantTray); @@ -167,7 +170,8 @@ TBarView::AttachedToWindow() SetViewColor(ui_color(B_MENU_BACKGROUND_COLOR)); SetFont(be_plain_font); - Window()->AddCommonFilter(new BarViewMessageFilter(this)); + fMouseFilter = new BarViewMessageFilter(this); + Window()->AddCommonFilter(fMouseFilter); UpdatePlacement(); @@ -180,6 +184,9 @@ TBarView::AttachedToWindow() void TBarView::DetachedFromWindow() { + Window()->RemoveCommonFilter(fMouseFilter); + delete fMouseFilter; + fMouseFilter = NULL; delete fTrackingHookData.fDragMessage; fTrackingHookData.fDragMessage = NULL; } @@ -232,6 +239,12 @@ TBarView::MessageReceived(BMessage* message) break; } + case kUpdateOrientation: + { + _ChangeState(message); + break; + } + default: BView::MessageReceived(message); } @@ -241,19 +254,19 @@ TBarView::MessageReceived(BMessage* message) void TBarView::MouseMoved(BPoint where, uint32 transit, const BMessage* dragMessage) { - desk_settings* settings = ((TBarApp*)be_app)->Settings(); - bool alwaysOnTop = settings->alwaysOnTop; - bool autoRaise = settings->autoRaise; - bool autoHide = settings->autoHide; - - if (DragRegion()->IsDragging()) { - DragRegion()->MouseMoved(where, transit, dragMessage); + if (fDragRegion->IsDragging()) { + fDragRegion->MouseMoved(where, transit, dragMessage); return; } if (transit == B_ENTERED_VIEW && EventMask() == 0) SetEventMask(B_POINTER_EVENTS, B_NO_POINTER_HISTORY); + desk_settings* settings = ((TBarApp*)be_app)->Settings(); + bool alwaysOnTop = settings->alwaysOnTop; + bool autoRaise = settings->autoRaise; + bool autoHide = settings->autoHide; + if (!autoRaise && !autoHide) { if (transit == B_EXITED_VIEW || transit == B_OUTSIDE_VIEW) SetEventMask(0); @@ -311,8 +324,7 @@ TBarView::MouseDown(BPoint where) if ((modifiers() & (B_CONTROL_KEY | B_COMMAND_KEY | B_OPTION_KEY | B_SHIFT_KEY)) == (B_CONTROL_KEY | B_COMMAND_KEY)) { // The window key was pressed - enter dragging code - DragRegion()->MouseDown( - DragRegion()->DragRegion().LeftTop()); + fDragRegion->MouseDown(fDragRegion->DragRegion().LeftTop()); return; } } else { @@ -491,7 +503,7 @@ TBarView::GetPreferredWindowSize(BRect screenFrame, float* width, float* height) float windowHeight = 0; float windowWidth = sMinimumWindowWidth; bool setToHiddenSize = ((TBarApp*)be_app)->Settings()->autoHide - && IsHidden() && !DragRegion()->IsDragging(); + && IsHidden() && !fDragRegion->IsDragging(); int32 iconSize = static_cast(be_app)->IconSize(); if (setToHiddenSize) { @@ -588,25 +600,19 @@ TBarView::UpdatePlacement() void -TBarView::ChangeState(int32 state, bool vertical, bool left, bool top) +TBarView::ChangeState(int32 state, bool vertical, bool left, bool top, + bool async) { - bool vertSwap = (fVertical != vertical); - bool leftSwap = (fLeft != left); - bool stateChanged = (fState != state); + BMessage message(kUpdateOrientation); + message.AddInt32("state", state); + message.AddBool("vertical", vertical); + message.AddBool("left", left); + message.AddBool("top", top); - fState = state; - fVertical = vertical; - fLeft = left; - fTop = top; - - // Send a message to the preferences window to let it know to enable - // or disable preference items - if (stateChanged || vertSwap) - be_app->PostMessage(kStateChanged); - - PlaceDeskbarMenu(); - PlaceTray(vertSwap, leftSwap); - PlaceApplicationBar(); + if (async) + BMessenger(this).SendMessage(&message); + else + _ChangeState(&message); } @@ -677,6 +683,34 @@ TBarView::ExpandItems() } +void +TBarView::_ChangeState(BMessage* message) +{ + int32 state = message->FindInt32("state"); + bool vertical = message->FindBool("vertical"); + bool left = message->FindBool("left"); + bool top = message->FindBool("top"); + + bool vertSwap = (fVertical != vertical); + bool leftSwap = (fLeft != left); + bool stateChanged = (fState != state); + + fState = state; + fVertical = vertical; + fLeft = left; + fTop = top; + + // Send a message to the preferences window to let it know to enable + // or disable preference items + if (stateChanged || vertSwap) + be_app->PostMessage(kStateChanged); + + PlaceDeskbarMenu(); + PlaceTray(vertSwap, leftSwap); + PlaceApplicationBar(); +} + + void TBarView::AddExpandedItem(const char* signature) { diff --git a/src/apps/deskbar/BarView.h b/src/apps/deskbar/BarView.h index 293bed7ea5..f375c872d4 100644 --- a/src/apps/deskbar/BarView.h +++ b/src/apps/deskbar/BarView.h @@ -90,7 +90,8 @@ class TBarView : public BView { void SaveSettings(); void UpdatePlacement(); - void ChangeState(int32 state, bool vertical, bool left, bool top); + void ChangeState(int32 state, bool vertical, bool left, bool top, + bool aSync = false); void RaiseDeskbar(bool raise); void HideDeskbar(bool hide); @@ -165,6 +166,7 @@ class TBarView : public BView { void SaveExpandedItems(); void RemoveExpandedItems(); void ExpandItems(); + void _ChangeState(BMessage* message); TBarMenuBar* fBarMenuBar; TExpandoMenuBar* fExpando; @@ -190,6 +192,7 @@ class TBarView : public BView { TTeamMenuItem* fLastDragItem; BList fExpandedItems; + BMessageFilter* fMouseFilter; }; diff --git a/src/apps/deskbar/StatusView.cpp b/src/apps/deskbar/StatusView.cpp index e32b769839..4b2df60065 100644 --- a/src/apps/deskbar/StatusView.cpp +++ b/src/apps/deskbar/StatusView.cpp @@ -1483,7 +1483,7 @@ TDragRegion::SwitchModeForRect(BPoint mouse, BRect rect, return true; } - fBarView->ChangeState(newState, newVertical, newLeft, newTop); + fBarView->ChangeState(newState, newVertical, newLeft, newTop, true); return true; } diff --git a/src/apps/fontdemo/FontDemoView.cpp b/src/apps/fontdemo/FontDemoView.cpp index 1dae1a56ed..af4205ed3d 100644 --- a/src/apps/fontdemo/FontDemoView.cpp +++ b/src/apps/fontdemo/FontDemoView.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #include "messages.h" @@ -29,7 +30,6 @@ FontDemoView::FontDemoView(BRect rect) : BView(rect, "FontDemoView", B_FOLLOW_ALL, B_WILL_DRAW | B_FRAME_EVENTS), fBitmap(NULL), fBufferView(NULL), - fString(NULL), fFontSize(50.0), fSpacing(0.0), fOutLineLevel(0), @@ -50,7 +50,6 @@ FontDemoView::FontDemoView(BRect rect) FontDemoView::~FontDemoView() { - free(fString); free(fShapes); fBitmap->Lock(); @@ -99,7 +98,7 @@ FontDemoView::_DrawView(BView* view) view->SetFont(&fFont, B_FONT_ALL); - const size_t size = strlen(fString); + const size_t size = fString.CountChars(); BRect boundBoxes[size]; if (OutLineLevel()) @@ -116,8 +115,8 @@ FontDemoView::_DrawView(BView* view) escapeDeltas[j].space = 0.0f; } */ - fFont.GetEdges(fString, size, edgeInfo); - fFont.GetEscapements(fString, size, /*escapeDeltas,*/ escapementArray); + fFont.GetEdges(fString.String(), size, edgeInfo); + fFont.GetEscapements(fString.String(), size, /*escapeDeltas,*/ escapementArray); font_height fh; fFont.GetHeight(&fh); @@ -136,7 +135,7 @@ FontDemoView::_DrawView(BView* view) // region area instead of the whole view. fBoxRegion.MakeEmpty(); - + for (size_t i = 0; i < size; i++) { xCoordArray[i] = 0.0f; yCoordArray[i] = 0.0f; @@ -159,7 +158,10 @@ FontDemoView::_DrawView(BView* view) } else { view->SetHighColor(0, 0, 0); view->SetDrawingMode(fDrawingMode); - view->DrawChar(fString[i], BPoint(xCoordArray[i], yCoordArray[i])); + int32 charLength; + const char* charAt = fString.CharAt(i, &charLength); + view->DrawString(charAt, charLength, + BPoint(xCoordArray[i], yCoordArray[i])); } if (BoundingBoxes() && !OutLineLevel()) { @@ -187,7 +189,7 @@ FontDemoView::MessageReceived(BMessage* msg) switch (msg->what) { case TEXT_CHANGED_MSG: { - const char* text = NULL; + BString text; if (msg->FindString("_text", &text) == B_OK) { SetString(text); Invalidate(/*&fBoxRegion*/); @@ -353,16 +355,15 @@ FontDemoView::MessageReceived(BMessage* msg) void -FontDemoView::SetString(const char* string) +FontDemoView::SetString(BString string) { - free(fString); - fString = strdup(string); + fString = string; free(fShapes); _AddShapes(fString); } -const char* +BString FontDemoView::String() const { return fString; @@ -419,10 +420,10 @@ FontDemoView::SetOutlineLevel(int8 outline) void -FontDemoView::_AddShapes(const char* string) +FontDemoView::_AddShapes(BString string) { - const size_t size = strlen(string); - fShapes = (BShape**)malloc(sizeof(BShape*)*size); + const size_t size = string.CountChars(); + fShapes = (BShape**)malloc(sizeof(BShape*) * size); for (size_t i = 0; i < size; i++) { fShapes[i] = new BShape(); @@ -455,5 +456,4 @@ FontDemoView::_NewBitmap(BRect rect) delete fBitmap; fBitmap = NULL; } -} - +} \ No newline at end of file diff --git a/src/apps/fontdemo/FontDemoView.h b/src/apps/fontdemo/FontDemoView.h index 66d3daca9e..23b1395eff 100644 --- a/src/apps/fontdemo/FontDemoView.h +++ b/src/apps/fontdemo/FontDemoView.h @@ -11,6 +11,7 @@ #include #include +#include class BShape; class BBitmap; @@ -37,8 +38,8 @@ class FontDemoView : public BView { void SetFontRotation(float rotation); const float Rotation() const { return fFont.Rotation(); } - void SetString(const char* string); - const char* String() const; + void SetString(BString string); + BString String() const; void SetAntialiasing(bool state); @@ -49,7 +50,7 @@ class FontDemoView : public BView { const int8 OutLineLevel() const { return fOutLineLevel; } private: - void _AddShapes(const char* string); + void _AddShapes(BString string); void _DrawView(BView* view); BView* _GetView(BRect rect); @@ -58,7 +59,7 @@ class FontDemoView : public BView { BBitmap* fBitmap; BView* fBufferView; - char* fString; + BString fString; float fFontSize; float fSpacing; int8 fOutLineLevel; diff --git a/src/apps/icon-o-matic/CanvasView.h b/src/apps/icon-o-matic/CanvasView.h index b022ca3555..57dfa94dbf 100644 --- a/src/apps/icon-o-matic/CanvasView.h +++ b/src/apps/icon-o-matic/CanvasView.h @@ -118,9 +118,6 @@ private: BPoint fScrollOffsetStart; uint32 fMouseFilterMode; - - BBitmap* fOffsreenBitmap; - BView* fOffsreenView; }; #endif // CANVAS_VIEW_H diff --git a/src/apps/icon-o-matic/IconEditorApp.cpp b/src/apps/icon-o-matic/IconEditorApp.cpp index 27f73a9484..d667ce90ce 100644 --- a/src/apps/icon-o-matic/IconEditorApp.cpp +++ b/src/apps/icon-o-matic/IconEditorApp.cpp @@ -13,12 +13,12 @@ #include #include #include +#include #include #include #include #include #include -#include #include "support_settings.h" @@ -331,7 +331,7 @@ IconEditorApp::_LastFilePath(path_kind which) path = fLastOpenPath.String(); break; } - if (!path) { + if (path == NULL) { BPath homePath; if (find_directory(B_USER_DIRECTORY, &homePath) == B_OK) @@ -372,7 +372,11 @@ IconEditorApp::_RestoreSettings() // Compensate offset for next window... fLastWindowFrame.OffsetBy(-kWindowOffset, -kWindowOffset); } - settings.FindMessage("window settings", &fLastWindowSettings); + BMessage lastSettings; + if (settings.FindMessage("window settings", &lastSettings) + == B_OK) { + fLastWindowSettings = lastSettings; + } int32 mode; if (settings.FindInt32("export mode", &mode) >= B_OK) diff --git a/src/apps/mediaconverter/MediaConverterWindow.cpp b/src/apps/mediaconverter/MediaConverterWindow.cpp index d97dcb1b0e..c6288660d2 100644 --- a/src/apps/mediaconverter/MediaConverterWindow.cpp +++ b/src/apps/mediaconverter/MediaConverterWindow.cpp @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -31,8 +32,6 @@ #include #include -#include - #include "MediaFileInfoView.h" #include "MediaFileListView.h" #include "MessageConstants.h" diff --git a/src/apps/mediaplayer/interface/SubtitleBitmap.cpp b/src/apps/mediaplayer/interface/SubtitleBitmap.cpp index 4d9af3998d..839af6896d 100644 --- a/src/apps/mediaplayer/interface/SubtitleBitmap.cpp +++ b/src/apps/mediaplayer/interface/SubtitleBitmap.cpp @@ -316,7 +316,7 @@ parse_text(const BString& string, BTextView* textView, const BFont& font, // Cleanup states in case the input text had non-matching tags. while (state->previous != NULL) { - ParseState* oldState = state->previous; + ParseState* oldState = state; state = state->previous; delete oldState; } diff --git a/src/apps/processcontroller/ProcessController.cpp b/src/apps/processcontroller/ProcessController.cpp index d70c7361a0..1a5d5d20cc 100644 --- a/src/apps/processcontroller/ProcessController.cpp +++ b/src/apps/processcontroller/ProcessController.cpp @@ -124,7 +124,7 @@ layoutT layout[] = { { 1, 1, 1 }, { 5, 1, 5 }, // 1 { 3, 1, 4 }, // 2 - { 1, 1, 1 }, + { 2, 1, 3 }, { 2, 0, 3 }, // 4 { 1, 1, 1 }, { 1, 1, 1 }, @@ -542,16 +542,17 @@ ProcessController::DoDraw(bool force) float right = left + gCPUcount * (barWidth + layout[gCPUcount].cpu_inter) - layout[gCPUcount].cpu_inter; // right of CPU frame... if (force && Parent()) { - SetHighColor(Parent()->ViewColor ()); + SetHighColor(Parent()->ViewColor()); FillRect(BRect(right + 1, top - 1, right + 2, bottom + 1)); } if (force) { SetHighColor(frame_color); StrokeRect(BRect(left - 1, top - 1, right, bottom + 1)); - if (gCPUcount == 2) { - StrokeLine(BPoint(left + barWidth, top), BPoint(left + barWidth, - bottom)); + if (gCPUcount > 1 && layout[gCPUcount].cpu_inter == 1) { + for (int x = 1; x < gCPUcount; x++) + StrokeLine(BPoint(left + x * barWidth + x - 1, top), + BPoint(left + x * barWidth + x - 1, bottom)); } } float leftMem = bounds.Width() - layout[gCPUcount].mem_width; @@ -592,9 +593,9 @@ ProcessController::DoDraw(bool force) fLastBarHeight[x] = barHeight; } - float rightMem = bounds.Width () - 1; + float rightMem = bounds.Width() - 1; float rem = fMemoryUsage * (h + 1); - float barHeight = floorf (rem); + float barHeight = floorf(rem); rem -= barHeight; rgb_color used_memory_color; diff --git a/src/apps/webpositive/tabview/TabContainerView.cpp b/src/apps/webpositive/tabview/TabContainerView.cpp index 52217fa9c7..7f231e1d9c 100644 --- a/src/apps/webpositive/tabview/TabContainerView.cpp +++ b/src/apps/webpositive/tabview/TabContainerView.cpp @@ -140,7 +140,7 @@ TabContainerView::MouseDown(BPoint where) // Middle click outside tabs should always open a new tab. fClickCount = 2; } else if (clicks > 1) - fClickCount = fClickCount++; + fClickCount++; else fClickCount = 1; } diff --git a/src/data/beos_mime/image/svg+xml b/src/data/beos_mime/image/svg+xml index 88ef6db6c1..94532c1cfa 100644 --- a/src/data/beos_mime/image/svg+xml +++ b/src/data/beos_mime/image/svg+xml @@ -5,8 +5,15 @@ resource(1, "META:TYPE") "image/svg+xml"; resource(2, "META:S:DESC") #'MSDC' "SVG image"; -resource(3, "META:EXTENS") message(234) { +resource(3, "META:SNIFF_RULE") #'CSTR' array { + "0.60 [0:511] ( -i \"IsHidden(), - titleRect, outlineRect, vScrollBarRect, hScrollBarRect); + _GetChildViewRects(Bounds(), titleRect, outlineRect, vScrollBarRect, + hScrollBarRect); // Start with the extra width for border and scrollbars etc. size.width = titleRect.left - Bounds().left; size.width += Bounds().right - titleRect.right; @@ -1901,8 +1903,8 @@ BColumnListView::DoLayout() BRect outlineRect; BRect vScrollBarRect; BRect hScrollBarRect; - _GetChildViewRects(Bounds(), !fHorizontalScrollBar->IsHidden(), - titleRect, outlineRect, vScrollBarRect, hScrollBarRect); + _GetChildViewRects(Bounds(), titleRect, outlineRect, vScrollBarRect, + hScrollBarRect); fTitleView->MoveTo(titleRect.LeftTop()); fTitleView->ResizeTo(titleRect.Width(), titleRect.Height()); @@ -1923,7 +1925,7 @@ BColumnListView::DoLayout() void -BColumnListView::_Init(bool showHorizontalScrollbar) +BColumnListView::_Init() { SetViewColor(B_TRANSPARENT_32_BIT); @@ -1940,8 +1942,8 @@ BColumnListView::_Init(bool showHorizontalScrollbar) BRect outlineRect; BRect vScrollBarRect; BRect hScrollBarRect; - _GetChildViewRects(bounds, showHorizontalScrollbar, titleRect, outlineRect, - vScrollBarRect, hScrollBarRect); + _GetChildViewRects(bounds, titleRect, outlineRect, vScrollBarRect, + hScrollBarRect); fOutlineView = new OutlineView(outlineRect, &fColumns, &fSortColumns, this); AddChild(fOutlineView); @@ -1959,7 +1961,7 @@ BColumnListView::_Init(bool showHorizontalScrollbar) "horizontal_scroll_bar", fTitleView, 0.0, bounds.Width(), B_HORIZONTAL); AddChild(fHorizontalScrollBar); - if (!showHorizontalScrollbar) + if (!fShowingHorizontalScrollBar) fHorizontalScrollBar->Hide(); fOutlineView->FixScrollBar(true); @@ -1967,9 +1969,8 @@ BColumnListView::_Init(bool showHorizontalScrollbar) void -BColumnListView::_GetChildViewRects(const BRect& bounds, - bool showHorizontalScrollbar, BRect& titleRect, BRect& outlineRect, - BRect& vScrollBarRect, BRect& hScrollBarRect) +BColumnListView::_GetChildViewRects(const BRect& bounds, BRect& titleRect, + BRect& outlineRect, BRect& vScrollBarRect, BRect& hScrollBarRect) { titleRect = bounds; titleRect.bottom = titleRect.top + kTitleHeight; @@ -1980,7 +1981,7 @@ BColumnListView::_GetChildViewRects(const BRect& bounds, outlineRect = bounds; outlineRect.top = titleRect.bottom + 1.0; outlineRect.right -= B_V_SCROLL_BAR_WIDTH; - if (showHorizontalScrollbar) + if (fShowingHorizontalScrollBar) outlineRect.bottom -= B_H_SCROLL_BAR_HEIGHT; vScrollBarRect = bounds; @@ -1989,7 +1990,7 @@ BColumnListView::_GetChildViewRects(const BRect& bounds, #endif vScrollBarRect.left = vScrollBarRect.right - B_V_SCROLL_BAR_WIDTH; - if (showHorizontalScrollbar) + if (fShowingHorizontalScrollBar) vScrollBarRect.bottom -= B_H_SCROLL_BAR_HEIGHT; hScrollBarRect = bounds; diff --git a/src/kits/media/SoundFile.cpp b/src/kits/media/SoundFile.cpp index 8a0371673e..7428680f72 100644 --- a/src/kits/media/SoundFile.cpp +++ b/src/kits/media/SoundFile.cpp @@ -361,8 +361,11 @@ BSoundFile::_ref_to_file(const entry_ref *ref) raw = &mf.u.raw_audio; } - if (raw == NULL) + if (raw == NULL) { + delete media; + delete file; return B_ERROR; + } fSamplingRate = (int)raw->frame_rate; fChannelCount = raw->channel_count; diff --git a/src/kits/shared/ArgumentVector.cpp b/src/kits/shared/ArgumentVector.cpp new file mode 100644 index 0000000000..c678f5de7c --- /dev/null +++ b/src/kits/shared/ArgumentVector.cpp @@ -0,0 +1,203 @@ +/* + * Copyright 2007-2012, Ingo Weinhold, ingo_weinhold@gmx.de. + * Distributed under the terms of the MIT License. + */ + + +#include + +#include +#include + +#include +#include + + +struct ArgumentVector::Parser { + ParseError Parse(const char* commandLine, const char*& _errorLocation) + { + // init temporary arg/argv storage + fCurrentArg.clear(); + fCurrentArgStarted = false; + fArgVector.clear(); + fTotalStringSize = 0; + + for (; *commandLine; commandLine++) { + char c = *commandLine; + + // whitespace delimits args and is otherwise ignored + if (isspace(c)) { + _PushCurrentArg(); + continue; + } + + const char* errorBase = commandLine; + + switch (c) { + case '\'': + // quoted string -- no quoting + while (*++commandLine != '\'') { + c = *commandLine; + if (c == '\0') { + _errorLocation = errorBase; + return UNTERMINATED_QUOTED_STRING; + } + _PushCharacter(c); + } + break; + + case '"': + // quoted string -- some quoting + while (*++commandLine != '"') { + c = *commandLine; + if (c == '\0') { + _errorLocation = errorBase; + return UNTERMINATED_QUOTED_STRING; + } + + if (c == '\\') { + c = *++commandLine; + if (c == '\0') { + _errorLocation = errorBase; + return UNTERMINATED_QUOTED_STRING; + } + + // only '\' and '"' can be quoted, otherwise the + // the '\' is treated as a normal char + if (c != '\\' && c != '"') + _PushCharacter('\\'); + } + + _PushCharacter(c); + } + break; + + case '\\': + // quoted char + c = *++commandLine; + if (c == '\0') { + _errorLocation = errorBase; + return TRAILING_BACKSPACE; + } + _PushCharacter(c); + break; + + default: + // normal char + _PushCharacter(c); + break; + } + } + + // commit last arg + _PushCurrentArg(); + + return NO_ERROR; + } + + const std::vector& ArgVector() const + { + return fArgVector; + } + + size_t TotalStringSize() const + { + return fTotalStringSize; + } + +private: + void _PushCurrentArg() + { + if (fCurrentArgStarted) { + fArgVector.push_back(fCurrentArg); + fTotalStringSize += fCurrentArg.length() + 1; + fCurrentArgStarted = false; + } + } + + void _PushCharacter(char c) + { + if (!fCurrentArgStarted) { + fCurrentArg = ""; + fCurrentArgStarted = true; + } + + fCurrentArg += c; + } + +private: + // temporaries + std::string fCurrentArg; + bool fCurrentArgStarted; + std::vector fArgVector; + size_t fTotalStringSize; +}; + + +ArgumentVector::ArgumentVector() + : + fArguments(NULL), + fCount(0) +{ +} + + +ArgumentVector::~ArgumentVector() +{ + free(fArguments); +} + + +char** +ArgumentVector::DetachArguments() +{ + char** arguments = fArguments; + fArguments = NULL; + fCount = 0; + return arguments; +} + + +ArgumentVector::ParseError +ArgumentVector::Parse(const char* commandLine, const char** _errorLocation) +{ + free(DetachArguments()); + + ParseError error; + const char* errorLocation = commandLine; + + try { + Parser parser; + error = parser.Parse(commandLine, errorLocation); + + if (error == NO_ERROR) { + // Create a char* array and copy everything into a single + // allocation. + int count = parser.ArgVector().size(); + size_t arraySize = (count + 1) * sizeof(char*); + fArguments = (char**)malloc( + arraySize + parser.TotalStringSize()); + if (fArguments != 0) { + char* argument = (char*)(fArguments + count + 1); + for (int i = 0; i < count; i++) { + fArguments[i] = argument; + const std::string& sourceArgument = parser.ArgVector()[i]; + size_t argumentSize = sourceArgument.length() + 1; + memcpy(argument, sourceArgument.c_str(), argumentSize); + argument += argumentSize; + } + + fArguments[count] = NULL; + fCount = count; + } else + error = NO_MEMORY; + } + } catch (...) { + error = NO_MEMORY; + } + + if (error != NO_ERROR && _errorLocation != NULL) + *_errorLocation = errorLocation; + + return error; +} diff --git a/src/kits/shared/Jamfile b/src/kits/shared/Jamfile index d56a8b6fe2..8992caa24f 100644 --- a/src/kits/shared/Jamfile +++ b/src/kits/shared/Jamfile @@ -15,6 +15,7 @@ UsePrivateHeaders kernel libroot ; StaticLibrary libshared.a : AboutMenuItem.cpp AboutWindow.cpp + ArgumentVector.cpp CalendarView.cpp ColorQuantizer.cpp CommandPipe.cpp diff --git a/src/kits/tracker/ContainerWindow.cpp b/src/kits/tracker/ContainerWindow.cpp index bcbb092d4f..e5b044bc8d 100644 --- a/src/kits/tracker/ContainerWindow.cpp +++ b/src/kits/tracker/ContainerWindow.cpp @@ -130,6 +130,7 @@ class DraggableContainerIcon : public BView { struct AddOneAddonParams { BObjectList *primaryList; BObjectList *secondaryList; + BObjectList *mimeTypes; }; struct StaggerOneParams { @@ -318,12 +319,7 @@ static void AddMimeTypeString(BObjectList &list, Model *model) { BString *mimeType = new BString(model->MimeType()); - if (!mimeType->Length() || !mimeType->ICompare(B_FILE_MIMETYPE)) { - // if model is of unknown type, try mimeseting it first - model->Mimeset(true); - mimeType->SetTo(model->MimeType()); - } - + if (mimeType->Length()) { // only add the type if it's not already there for (int32 i = list.CountItems(); i-- > 0;) { @@ -2843,34 +2839,12 @@ BContainerWindow::EachAddon(BPath &path, bool (*eachAddon)(const Model *, BDirectory dir; BEntry entry; + + BObjectList *mimeTypes = ((AddOneAddonParams *)params)->mimeTypes; if (dir.SetTo(path.Path()) != B_OK) return false; - // build a list of the MIME types of the selected items - - BObjectList mimeTypes(10, true); - - int32 count = PoseView()->SelectionList()->CountItems(); - if (!count) { - // just add the type of the current directory - AddMimeTypeString(mimeTypes, TargetModel()); - } else { - for (int32 index = 0; index < count; index++) { - BPose *pose = PoseView()->SelectionList()->ItemAt(index); - AddMimeTypeString(mimeTypes, pose->TargetModel()); - // If it's a symlink, resolves it and add the Target's MimeType - if (pose->TargetModel()->IsSymLink()) { - Model* resolved = new Model( - pose->TargetModel()->EntryRef(), true, true); - if (resolved->InitCheck() == B_OK) { - AddMimeTypeString(mimeTypes, resolved); - } - delete resolved; - } - } - } - dir.Rewind(); while (dir.GetNextEntry(&entry) == B_OK) { Model *model = new Model(&entry); @@ -2892,7 +2866,7 @@ BContainerWindow::EachAddon(BPath &path, bool (*eachAddon)(const Model *, bool primary = false; - if (mimeTypes.CountItems()) { + if (mimeTypes->CountItems()) { BFile file(&entry, B_READ_ONLY); if (file.InitCheck() == B_OK) { BAppFileInfo info(&file); @@ -2910,8 +2884,8 @@ BContainerWindow::EachAddon(BPath &path, bool (*eachAddon)(const Model *, // check all supported types if it has some set if (!secondary) { - for (int32 i = mimeTypes.CountItems(); !primary && i-- > 0;) { - BString *type = mimeTypes.ItemAt(i); + for (int32 i = mimeTypes->CountItems(); !primary && i-- > 0;) { + BString *type = mimeTypes->ItemAt(i); if (info.IsSupportedType(type->String())) { BMimeType mimeType(type->String()); if (info.Supports(&mimeType)) @@ -2983,12 +2957,39 @@ BContainerWindow::BuildAddOnMenu(BMenu *menu) params.primaryList = &primaryList; params.secondaryList = &secondaryList; + // build a list of the MIME types of the selected items + BObjectList mimeTypes(10, true); + + int32 count = PoseView()->SelectionList()->CountItems(); + if (!count) { + // just add the type of the current directory + AddMimeTypeString(mimeTypes, TargetModel()); + } else { + _UpdateSelectionMIMEInfo(); + for (int32 index = 0; index < count; index++) { + BPose *pose = PoseView()->SelectionList()->ItemAt(index); + + AddMimeTypeString(mimeTypes, pose->TargetModel()); + // If it's a symlink, resolves it and add the Target's MimeType + if (pose->TargetModel()->IsSymLink()) { + Model* resolved = new Model( + pose->TargetModel()->EntryRef(), true, true); + if (resolved->InitCheck() == B_OK) { + AddMimeTypeString(mimeTypes, resolved); + } + delete resolved; + } + } + } + + params.mimeTypes = &mimeTypes; + EachAddon(AddOneAddon, ¶ms); primaryList.SortItems(CompareLabels); secondaryList.SortItems(CompareLabels); - int32 count = primaryList.CountItems(); + count = primaryList.CountItems(); for (int32 index = 0; index < count; index++) menu->AddItem(primaryList.ItemAt(index)); @@ -3141,6 +3142,29 @@ BContainerWindow::LoadAddOn(BMessage *message) } +void +BContainerWindow::_UpdateSelectionMIMEInfo() +{ + BPose* pose; + int32 index = 0; + while ((pose = PoseView()->SelectionList()->ItemAt(index++)) != NULL) { + BString mimeType(pose->TargetModel()->MimeType()); + if (!mimeType.Length() || mimeType.ICompare(B_FILE_MIMETYPE) == 0) { + pose->TargetModel()->Mimeset(true); + if (pose->TargetModel()->IsSymLink()) { + Model* resolved = new Model(pose->TargetModel()->EntryRef(), true, true); + if (resolved->InitCheck() == B_OK) { + mimeType.SetTo(resolved->MimeType()); + if (!mimeType.Length() || mimeType.ICompare(B_FILE_MIMETYPE) == 0) + resolved->Mimeset(true); + } + delete resolved; + } + } + } +} + + BMenuItem * BContainerWindow::NewAttributeMenuItem(const char *label, const char *name, int32 type, float width, int32 align, bool editable, bool statField) diff --git a/src/kits/tracker/ContainerWindow.h b/src/kits/tracker/ContainerWindow.h index 5bee938731..373b81a7a1 100644 --- a/src/kits/tracker/ContainerWindow.h +++ b/src/kits/tracker/ContainerWindow.h @@ -303,6 +303,8 @@ class BContainerWindow : public BWindow { friend int32 show_context_menu(void*); friend class BackgroundView; + + void _UpdateSelectionMIMEInfo(); }; class WindowStateNodeOpener { diff --git a/src/kits/tracker/Model.cpp b/src/kits/tracker/Model.cpp index 392b8e4d08..dcf5e3e889 100644 --- a/src/kits/tracker/Model.cpp +++ b/src/kits/tracker/Model.cpp @@ -883,6 +883,8 @@ Model::AttrChanged(const char *attrName) if (!attrName || strcmp(attrName, kAttrMIMEType) == 0 || strcmp(attrName, kAttrPreferredApp) == 0) { + ModelNodeLazyOpener opener(this); + opener.OpenNode(); char mimeString[B_MIME_TYPE_LENGTH]; BNodeInfo info(fNode); if (info.GetType(mimeString) != B_OK) @@ -1178,18 +1180,11 @@ bool Model::Mimeset(bool force) { BString oldType = MimeType(); - ModelNodeLazyOpener opener(this); BPath path; GetPath(&path); - if (force) { - if (opener.OpenNode(true) != B_OK) - return false; - - Node()->RemoveAttr(kAttrMIMEType); - update_mime_info(path.Path(), 0, 1, 1); - } else - update_mime_info(path.Path(), 0, 1, 0); + update_mime_info(path.Path(), 0, 1, force ? 2 : 0); + AttrChanged(0); return !oldType.ICompare(MimeType()); diff --git a/src/kits/tracker/PoseView.cpp b/src/kits/tracker/PoseView.cpp index 07bacbb1ac..fba21fe3db 100644 --- a/src/kits/tracker/PoseView.cpp +++ b/src/kits/tracker/PoseView.cpp @@ -149,6 +149,24 @@ const BPoint kTransparentDragThreshold(256, 192); // if larger in any direction +struct attr_column_relation { + uint32 attrHash; + int32 fieldMask; +}; + + +static struct attr_column_relation sAttrColumnMap[] = { + { AttrHashString(kAttrStatModified, B_TIME_TYPE), + B_STAT_MODIFICATION_TIME }, + { AttrHashString(kAttrStatSize, B_OFF_T_TYPE), + B_STAT_SIZE }, + { AttrHashString(kAttrStatCreated, B_TIME_TYPE), + B_STAT_CREATION_TIME }, + { AttrHashString(kAttrStatMode, B_STRING_TYPE), + B_STAT_MODE } +}; + + struct AddPosesResult { ~AddPosesResult(); void ReleaseModels(); @@ -1674,7 +1692,7 @@ BPoseView::AddPoseToList(PoseList *list, bool visibleList, bool insertionSort, bool needToDraw = true; if (insertionSort && list->CountItems()) { - int32 orientation = BSearchList(list, pose, &poseIndex); + int32 orientation = BSearchList(list, pose, &poseIndex, 0); if (orientation == kInsertAfter) poseIndex++; @@ -5323,6 +5341,7 @@ BPoseView::EntryMoved(const BMessage *message) ReadPoseInfo(pose->TargetModel(), &poseInfo); if (!ShouldShowPose(pose->TargetModel(), &poseInfo)) return DeletePose(&itemNode, pose, index); + return true; } BPoint loc(0, index * fListElemHeight); @@ -5354,7 +5373,6 @@ BPoseView::EntryMoved(const BMessage *message) return DeletePose(&itemNode); else if (dirNode.node == thisDirNode.node) EntryCreated(&dirNode, &itemNode, name); - return true; } @@ -5430,7 +5448,6 @@ BPoseView::AttributeChanged(const BMessage *message) return false; } - uint32 attrHash; if (attrName) { // rebuild the MIME type list, if the MIME type has changed if (strcmp(attrName, kAttrMIMEType) == 0) @@ -5438,14 +5455,29 @@ BPoseView::AttributeChanged(const BMessage *message) // note: the following code is wrong, because this sort of hashing // may overlap and we get aliasing - attrHash = AttrHashString(attrName, info.type); - } + uint32 attrHash = AttrHashString(attrName, info.type); + if (attrHash == PrimarySort() || attrHash == SecondarySort()) { + _CheckPoseSortOrder(fPoseList, pose, poseListIndex); + if (fFiltering && visible) + _CheckPoseSortOrder(fFilteredPoseList, pose, index); + } + } else { + int32 fields; + if (message->FindInt32("fields", &fields) != B_OK) + return true; - if (!attrName || attrHash == PrimarySort() - || attrHash == SecondarySort()) { - _CheckPoseSortOrder(fPoseList, pose, poseListIndex); - if (fFiltering && visible) - _CheckPoseSortOrder(fFilteredPoseList, pose, index); + for (int i = sizeof(sAttrColumnMap) / sizeof(attr_column_relation); + i--;) { + if (sAttrColumnMap[i].attrHash == PrimarySort() + || sAttrColumnMap[i].attrHash == SecondarySort()) { + if ((fields & sAttrColumnMap[i].fieldMask) != 0) { + _CheckPoseSortOrder(fPoseList, pose, poseListIndex); + if (fFiltering && visible) + _CheckPoseSortOrder(fFilteredPoseList, pose, index); + return true; + } + } + } } } else { // we received an attr changed notification for a zombie model, it means @@ -8667,7 +8699,7 @@ BPoseView::_CheckPoseSortOrder(PoseList *poseList, BPose *pose, int32 oldIndex) // take pose out of list for BSearch poseList->RemoveItemAt(oldIndex); int32 afterIndex; - int32 orientation = BSearchList(poseList, pose, &afterIndex); + int32 orientation = BSearchList(poseList, pose, &afterIndex, oldIndex); int32 newIndex; if (orientation == kInsertAtFront) @@ -8777,19 +8809,33 @@ BSearch(PoseList *table, const BPose* key, BPoseView *view, int32 BPoseView::BSearchList(PoseList *poseList, const BPose *pose, - int32 *resultingIndex) + int32 *resultingIndex, int32 oldIndex) { // check to see if insertion should be at beginning of list const BPose *firstPose = poseList->FirstItem(); if (!firstPose) - return kInsertAtFront; - - if (PoseCompareAddWidget(pose, firstPose, this) <= 0) { + return kInsertAtFront; + + if (PoseCompareAddWidget(pose, firstPose, this) < 0) { *resultingIndex = 0; return kInsertAtFront; } int32 count = poseList->CountItems(); + + // look if old position is still ok, by comparing to siblings + bool valid = oldIndex > 0 && oldIndex < count - 1; + valid = valid && PoseCompareAddWidget(pose, + poseList->ItemAt(oldIndex - 1), this) >= 0; + // the current item is gone, so not oldIndex+1 + valid = valid && PoseCompareAddWidget(pose, + poseList->ItemAt(oldIndex), this) <= 0; + + if (valid) { + *resultingIndex = oldIndex - 1; + return kInsertAfter; + } + *resultingIndex = count - 1; const BPose *searchResult = BSearch(poseList, pose, this, diff --git a/src/kits/tracker/PoseView.h b/src/kits/tracker/PoseView.h index 65a7f6a802..ce6fd0b728 100644 --- a/src/kits/tracker/PoseView.h +++ b/src/kits/tracker/PoseView.h @@ -520,7 +520,8 @@ class BPoseView : public BView { void DrawViewCommon(const BRect &updateRect); // pose list handling - int32 BSearchList(PoseList *poseList, const BPose *, int32 *index); + int32 BSearchList(PoseList *poseList, const BPose *, int32 *index, + int32 oldIndex); void InsertPoseAfter(BPose *pose, int32 *index, int32 orientation, BRect *invalidRect); // does a CopyBits to scroll poses making room for a new pose, diff --git a/src/libs/compat/freebsd_network/clock.c b/src/libs/compat/freebsd_network/clock.c index 91a095429d..fce43ccef2 100644 --- a/src/libs/compat/freebsd_network/clock.c +++ b/src/libs/compat/freebsd_network/clock.c @@ -5,7 +5,8 @@ #include "device.h" -#include "kernel.h" + +#include int ticks; diff --git a/src/system/kernel/cache/block_cache.cpp b/src/system/kernel/cache/block_cache.cpp index b49bf6e902..943e6517f0 100644 --- a/src/system/kernel/cache/block_cache.cpp +++ b/src/system/kernel/cache/block_cache.cpp @@ -89,7 +89,17 @@ struct cached_block { bool busy_reading_waiters : 1; bool busy_writing_waiters : 1; cache_transaction* transaction; + // This is the current active transaction, if any, the block is + // currently in (meaning was changed as a part of it). cache_transaction* previous_transaction; + // This is set to the last transaction that was ended containing this + // block. In this case, the block has not yet written back yet, and + // the changed data is either in current_data, or original_data -- the + // latter if the block is already being part of another transaction. + // There can only be one previous transaction, so when the active + // transaction ends, the changes of the previous transaction have to + // be written back before that transaction becomes the next previous + // transaction. bool CanBeWritten() const; int32 LastAccess() const @@ -1189,7 +1199,7 @@ BlockWriter::WriteBlock(block_cache* cache, cached_block* block) void* BlockWriter::_Data(cached_block* block) const { - return block->previous_transaction && block->original_data + return block->previous_transaction != NULL && block->original_data != NULL ? block->original_data : block->current_data; // We first need to write back changes from previous transactions } @@ -1268,7 +1278,7 @@ BlockWriter::_BlockDone(cached_block* block, hash_iterator* iterator) fDeletedTransaction = true; } } - if (block->transaction == NULL && block->ref_count == 0) { + if (block->transaction == NULL && block->ref_count == 0 && !block->unused) { // the block is no longer used block->unused = true; fCache->unused_blocks.Add(block); @@ -1761,7 +1771,9 @@ put_cached_block(block_cache* cache, cached_block* block) cache->RemoveBlock(block); } else { // put this block in the list of unused blocks + ASSERT(!block->unused); block->unused = true; + ASSERT(block->original_data == NULL && block->parent_data == NULL); cache->unused_blocks.Add(block); @@ -2865,6 +2877,8 @@ cache_abort_transaction(void* _cache, int32 id) block->transaction_next = NULL; block->transaction = NULL; block->discard = false; + if (block->previous_transaction == NULL) + block->is_dirty = false; } hash_remove(cache->transaction_hash, transaction); @@ -3016,17 +3030,24 @@ cache_abort_sub_transaction(void* _cache, int32 id) next = block->transaction_next; if (block->parent_data == NULL) { - // the parent transaction didn't change the block, but the sub - // transaction did - we need to revert from the original data + // The parent transaction didn't change the block, but the sub + // transaction did - we need to revert to the original data. + // The block is no longer part of the transaction ASSERT(block->original_data != NULL); memcpy(block->current_data, block->original_data, cache->block_size); + block->transaction_next = NULL; + block->transaction = NULL; + if (block->previous_transaction == NULL) + block->is_dirty = false; } else if (block->parent_data != block->current_data) { - // the block has been changed and must be restored + // The block has been changed and must be restored - the block + // is still dirty and part of the transaction TRACE(("cache_abort_sub_transaction(id = %ld): restored contents " "of block %Ld\n", transaction->id, block->block_number)); memcpy(block->current_data, block->parent_data, cache->block_size); cache->Free(block->parent_data); + // The block stays dirty } block->parent_data = NULL; diff --git a/src/system/libroot/posix/syslog.cpp b/src/system/libroot/posix/syslog.cpp index ca50038cd2..7ed66d97de 100644 --- a/src/system/libroot/posix/syslog.cpp +++ b/src/system/libroot/posix/syslog.cpp @@ -215,7 +215,7 @@ void openlog_team(const char *ident, int options, int facility) { if (ident != NULL) - strcpy(sTeamContext.ident, ident); + strlcpy(sTeamContext.ident, ident, sizeof(sTeamContext.ident)); sTeamContext.options = options; sTeamContext.facility = SYSLOG_FACILITY(facility); diff --git a/src/tools/fs_shell/block_cache.cpp b/src/tools/fs_shell/block_cache.cpp index 78f69d2865..2f47a094dc 100644 --- a/src/tools/fs_shell/block_cache.cpp +++ b/src/tools/fs_shell/block_cache.cpp @@ -927,7 +927,7 @@ write_cached_block(block_cache* cache, cached_block* block, } } } - if (block->transaction == NULL && block->ref_count == 0) { + if (block->transaction == NULL && block->ref_count == 0 && !block->unused) { // the block is no longer used block->unused = true; cache->unused_blocks.Add(block); diff --git a/src/tools/rm_attrs.cpp b/src/tools/rm_attrs.cpp index 49a696ed45..e25ee9af57 100644 --- a/src/tools/rm_attrs.cpp +++ b/src/tools/rm_attrs.cpp @@ -89,7 +89,7 @@ remove_dir_contents(Path& path, bool force, bool removeAttributes) { // open the dir DIR* dir = opendir(path.GetPath()); - if (dir < 0) { + if (dir == NULL) { fprintf(stderr, "Error: Failed to open dir \"%s\": %s\n", path.GetPath(), strerror(errno)); return;