diff --git a/build/jam/Haiku64Image b/build/jam/Haiku64Image index 80ce8c827d..16537412f6 100644 --- a/build/jam/Haiku64Image +++ b/build/jam/Haiku64Image @@ -6,20 +6,34 @@ # easily add things to the image as I port them. -SYSTEM_BIN = "[" addattr alert arp base64 basename bash bc beep cal cat catattr - checkfs chgrp chmod chown chroot cksum clear clockconfig cmp - collectcatkeys comm compress copyattr CortexAddOnHost cp csplit cut date - dd diff diff3 dircolors dirname df du dumpcatalog echo eject env error - expand expr factor false find finddir fmt fold fortune ftp gawk gdb gzip - gzexe getlimits groups head hostname id ifconfig install isvolume - join kernel_debugger kill less lessecho lesskey link linkcatkeys listdev - ln locale locate logger logname ls makebootable md5sum mimeset mkdir - mkfifo mkfs mktemp mount mountvolume mv nl nohup notify nproc od open - paste patch pathchk ping pr printenv printf ps ptx pwd query rc readlink - ReadOnlyBootPrompt rm rmattr rmdir safemode sdiff seq sha1sum shred shuf - shutdown sleep sort split stat strace stty su sum sync sysinfo tac tail - tee test timeout touch tr true truncate tsort tty unexpand uname uniq - unlink unmount unzip updatedb waitfor wc wget whoami xargs xres yes +SYSTEM_BIN = "[" + addattr alert arp + base64 basename bash bc beep + cal cat catattr checkfs chgrp chmod chown chroot cksum clear clockconfig + cmp collectcatkeys comm compress copyattr CortexAddOnHost cp csplit cut + date dd diff diff3 dircolors dirname df du dumpcatalog + echo eject env error expand expr + factor false find finddir FirstBootPrompt fmt fold fortune ftp + gawk gdb gzip gzexe getlimits groups + head hostname + id ifconfig install isvolume + join + kernel_debugger kill + less lessecho lesskey link linkcatkeys listdev ln locale locate logger + logname ls + makebootable md5sum mimeset mkdir mkfifo mkfs mktemp mount mountvolume mv + nl nohup notify nproc + od open + paste patch pathchk ping pr printenv printf ps ptx pwd + query + rc readlink rm rmattr rmdir + safemode sdiff seq sha1sum shred shuf shutdown sleep sort split stat + strace stty su sum sync sysinfo + tac tail tee test timeout touch tr true truncate tsort tty + unexpand uname uniq unlink unmount unzip updatedb + waitfor wc wget whoami + xargs xres + yes zdiff zforce zgrep zip zipcloak zipgrep zipnote zipsplit zmore znew ; diff --git a/build/jam/HaikuImage b/build/jam/HaikuImage index a90dca68ca..d2486b4f6d 100644 --- a/build/jam/HaikuImage +++ b/build/jam/HaikuImage @@ -4,14 +4,16 @@ SYSTEM_BIN = [ FFilterByBuildFeatures - "[" addattr alert arp base64 basename bash bc beep bfsinfo + "[" + addattr alert arp + base64 basename bash bc beep bfsinfo cal cat catattr checkfs checkitout chgrp chmod chop chown chroot cksum clear clockconfig cmp collectcatkeys comm compress copyattr CortexAddOnHost cp csplit cut date dc dd desklink df diff diff3 dircolors dirname diskimage draggers driveinfo dstcheck du dumpcatalog echo eject env error expand expr - factor false fdinfo ffm filepanel find finddir fmt fold fortune frcode - ftp ftpd funzip fwcontrol + factor false fdinfo ffm filepanel find finddir FirstBootPrompt fmt fold + fortune frcode ftp ftpd funzip fwcontrol gawk gdb@x86 getlimits groups gzip gzexe hd head hey hostname id ident ifconfig install installsound iroster isvolume @@ -27,18 +29,18 @@ SYSTEM_BIN = [ FFilterByBuildFeatures passwd paste patch pathchk pc ping ping6 play playfile playsound playwav pr prio printenv printf profile ps ptx pwd query quit - rc readlink ReadOnlyBootPrompt reindex release renice rlog rm rmattr - rmindex rmdir roster route + rc readlink reindex release renice rlog rm rmattr rmindex rmdir roster + route safemode screen_blanker screenmode screenshot sdiff setdecor setmime settype setversion setvolume seq sha1sum shar shred shuf shutdown sleep sort - spamdbm - split stat strace stty su sum sync sysinfo + spamdbm split stat strace stty su sum sync sysinfo tac tail tcpdump tcptester tee telnet telnetd test timeout top touch tput tr traceroute translate trash true truncate tsort tty - uname unchop unexpand unmount uniq unlink unrar unshar unzip unzipsfx + uname unchop unexpand unmount uniq unlink unshar unzip unzipsfx updatedb uptime urlwrapper useradd uudecode uuencode vdir version vmstat - waitfor watch wc wget whoami writembr@x86 xargs xres yes + waitfor watch wc wget whoami writembr@x86 xargs xres + yes zdiff zforce zgrep zip zipcloak zipgrep zipnote zipsplit zmore znew ] ; @@ -676,7 +678,7 @@ AddFilesToHaikuImage system add-ons Screen\ Savers : $(SYSTEM_ADD_ONS_SCREENSAVERS) ; AddFilesToHaikuImage system add-ons disk_systems - : intel bfs ntfs ; + : intel gpt bfs ntfs ; # decorators AddDirectoryToHaikuImage home config add-ons decorators ; diff --git a/build/jam/OptionalPackages b/build/jam/OptionalPackages index 39525947e4..b0d4a60846 100644 --- a/build/jam/OptionalPackages +++ b/build/jam/OptionalPackages @@ -95,6 +95,7 @@ if $(HAIKU_ADD_ALTERNATIVE_GCC_LIBS) = 1 # TimGMSoundFont - a good quality General MIDI Sound Font # TrackerNewTemplates - template files for Tracker's New menu # Transmission - a fast, easy, and free BitTorrent Client +# UnRAR - utility to list, test and extract RAR archives # UserlandFS - aids native file system development (like FUSE) # Vim - Vi IMproved. Highly configurable text editor # Vision - powerful native IRC client @@ -1330,22 +1331,29 @@ if [ IsOptionalHaikuImagePackageAdded ICU-devel ] { # KeymapSwitcher if [ IsOptionalHaikuImagePackageAdded KeymapSwitcher ] { - if $(TARGET_ARCH) != x86 { - Echo "No optional package KeymapSwitcher available for $(TARGET_ARCH)" ; - } else { + if $(TARGET_ARCH) = x86 { if $(HAIKU_GCC_VERSION[1]) >= 4 { InstallOptionalHaikuImagePackage - KeymapSwitcher-1.2.7-r1a4-x86-gcc4-2012-11-01.zip - : $(baseURL)/KeymapSwitcher-1.2.7-r1a4-x86-gcc4-2012-11-01.zip + KeymapSwitcher-1.2.7-x86-gcc4-2013-01-08.zip + : $(baseURL)/KeymapSwitcher-1.2.7-x86-gcc4-2013-01-08.zip : : : false ; } else { InstallOptionalHaikuImagePackage - KeymapSwitcher-1.2.7-r1a4-x86-gcc2-2012-11-01.zip - : $(baseURL)/KeymapSwitcher-1.2.7-r1a4-x86-gcc2-2012-11-01.zip + KeymapSwitcher-1.2.7-x86-gcc2-2013-01-08.zip + : $(baseURL)/KeymapSwitcher-1.2.7-x86-gcc2-2013-01-08.zip : : : false ; } AddSymlinkToHaikuImage home config settings deskbar Preferences : /boot/common/bin/KeymapSwitcher ; + } else if $(TARGET_ARCH) = x86_64 { + InstallOptionalHaikuImagePackage + KeymapSwitcher-1.2.7-x86_64-2013-01-08.zip + : $(baseURL)/KeymapSwitcher-1.2.7-x86_64-2013-01-08.zip + : : true ; + AddSymlinkToHaikuImage home config settings deskbar Preferences + : /boot/common/bin/KeymapSwitcher ; + } else { + Echo "No optional package KeymapSwitcher available for $(TARGET_ARCH)" ; } } @@ -2080,6 +2088,31 @@ if [ IsOptionalHaikuImagePackageAdded Transmission ] { } +# UnRAR +if [ IsOptionalHaikuImagePackageAdded UnRAR ] { + if $(TARGET_ARCH) = x86 { + if $(HAIKU_GCC_VERSION[1]) >= 4 { + InstallOptionalHaikuImagePackage + UnRAR-4.2.4-x86-gcc4-2013-01-21.zip + : $(baseURL)/UnRAR-4.2.4-x86-gcc4-2013-01-21.zip + : : true ; + } else { + InstallOptionalHaikuImagePackage + UnRAR-4.2.4-x86-gcc2-2013-01-21.zip + : $(baseURL)/UnRAR-4.2.4-x86-gcc2-2013-01-21.zip + : : true ; + } + } else if $(TARGET_ARCH) = x86_64 { + InstallOptionalHaikuImagePackage + UnRAR-4.2.4-x86_64-2013-01-21.zip + : $(baseURL)/UnRAR-4.2.4-x86_64-2013-01-21.zip + : : true ; + } else { + Echo "No optional package UnRAR available for $(TARGET_ARCH)" ; + } +} + + # UserlandFS if [ IsOptionalHaikuImagePackageAdded UserlandFS ] { local arch = $(TARGET_ARCH) ; @@ -2135,9 +2168,7 @@ if [ IsOptionalHaikuImagePackageAdded UserlandFS ] { # Vim if [ IsOptionalHaikuImagePackageAdded Vim ] { - if $(TARGET_ARCH) != x86 { - Echo "No optional package Vim available for $(TARGET_ARCH)" ; - } else { + if $(TARGET_ARCH) = x86 { if $(HAIKU_GCC_VERSION[1]) >= 4 { InstallOptionalHaikuImagePackage vim-7.3-r1a4-x86-gcc4-2012-09-26.zip : $(baseURL)/vim-7.3-r1a4-x86-gcc4-2012-09-26.zip @@ -2149,6 +2180,14 @@ if [ IsOptionalHaikuImagePackageAdded Vim ] { } AddSymlinkToHaikuImage home config settings deskbar Applications : /boot/common/bin/gvim ; + } else if $(TARGET_ARCH) = x86_64 { + InstallOptionalHaikuImagePackage vim-7.3-x86_64-2013-01-19.zip + : $(baseURL)/vim-7.3-x86_64-2013-01-19.zip + : : true ; + AddSymlinkToHaikuImage home config settings deskbar Applications + : /boot/common/bin/gvim ; + } else { + Echo "No optional package Vim available for $(TARGET_ARCH)" ; } } diff --git a/data/catalogs/add-ons/media/media-add-ons/mixer/hu.catkeys b/data/catalogs/add-ons/media/media-add-ons/mixer/hu.catkeys index fad7110362..ba5511b234 100644 --- a/data/catalogs/add-ons/media/media-add-ons/mixer/hu.catkeys +++ b/data/catalogs/add-ons/media/media-add-ons/mixer/hu.catkeys @@ -22,6 +22,6 @@ To master AudioMixer Az elsődlegesre Master output AudioMixer Elsődleges kimenet Setup AudioMixer Beállítás Use non linear gain sliders (like BeOS R5) AudioMixer Nem lineáris előerősítés csúszkák használata (mint a BeOS R5-ben) -Gain AudioMixer Előerősítés +Gain AudioMixer Erősítés Allow output channel remapping AudioMixer Kimeneti csatorna újraképezésének az engedélyezése Physical input channels AudioMixer Fizikai bemeneti csatornák diff --git a/data/catalogs/add-ons/media/media-add-ons/multi_audio/be.catkeys b/data/catalogs/add-ons/media/media-add-ons/multi_audio/be.catkeys new file mode 100644 index 0000000000..5497b93946 --- /dev/null +++ b/data/catalogs/add-ons/media/media-add-ons/multi_audio/be.catkeys @@ -0,0 +1,34 @@ +1 belarusian x-vnd.Haiku-hmulti_audio.media_addon 451057402 +Master MultiAudio Галоўны +SPDIF MultiAudio SPDIF +Gain MultiAudio Гучнасць +Output 3D center MultiAudio Цэнтр Выхад 3D +Extended Setup MultiAudio Пашыраныя Наладкі +CD MultiAudio CD +Tone control MultiAudio Кіраванне тонам +Phone MultiAudio Тэлефон +Aux MultiAudio Дадатковы +Output bass MultiAudio Выхад басу +Headphones MultiAudio Навушнікі +Beep MultiAudio Званок +Output mono mix MultiAudio Выхад моно мікс +Output stereo mix MultiAudio Выхад стэрэа мікс +Input MultiAudio Уваход +Output treble MultiAudio Выхад высокіх +Mono mix MultiAudio Моно мікс +General MultiAudio Агульны +Input & Output MultiAudio Выхад і Ўваход +Enhanced Setup MultiAudio Спец. Наладкі +Stereo mix MultiAudio Стэрэа мікс +Output 3D depth MultiAudio Выхад глыбіня 3D +Volume MultiAudio Гучнасьць +Output MultiAudio Выхад +Video MultiAudio Відэа +Line MultiAudio Лінія +Mic MultiAudio Мікрафон + frequency: MultiAudio частата: +Enable MultiAudio Уключыць +Mute MultiAudio Сцішыць +Wave MultiAudio Хваля +Setup MultiAudio Наладкі +Level MultiAudio Узровень diff --git a/data/catalogs/add-ons/media/media-add-ons/multi_audio/hu.catkeys b/data/catalogs/add-ons/media/media-add-ons/multi_audio/hu.catkeys new file mode 100644 index 0000000000..c061c3da02 --- /dev/null +++ b/data/catalogs/add-ons/media/media-add-ons/multi_audio/hu.catkeys @@ -0,0 +1,34 @@ +1 hungarian x-vnd.Haiku-hmulti_audio.media_addon 451057402 +Master MultiAudio Elsődleges +SPDIF MultiAudio SPDIF +Gain MultiAudio Erősítés +Output 3D center MultiAudio Kimeneti 3D közép +Extended Setup MultiAudio További beállítások +CD MultiAudio CD +Tone control MultiAudio Hangszín vezérlés +Phone MultiAudio Telefon +Aux MultiAudio Aux +Output bass MultiAudio Kimeneti basszus +Headphones MultiAudio Fejhallgató +Beep MultiAudio Csipogó +Output mono mix MultiAudio Kimeneti monó keverő +Output stereo mix MultiAudio Kimeneti sztereó keverő +Input MultiAudio Bemenet +Output treble MultiAudio Kimeneti szólam +Mono mix MultiAudio Monó keverő +General MultiAudio Általános +Input & Output MultiAudio Ki- és bemenet +Enhanced Setup MultiAudio További beállítások +Stereo mix MultiAudio Sztereó keverő +Output 3D depth MultiAudio Kimeneti 3D mélység +Volume MultiAudio Hangerő +Output MultiAudio Kimenet +Video MultiAudio Videó +Line MultiAudio Vonalbemenet +Mic MultiAudio Mikrofon + frequency: MultiAudio frekvencia: +Enable MultiAudio Engedélyezés +Mute MultiAudio Némítás +Wave MultiAudio Hanghullám +Setup MultiAudio Beállítás +Level MultiAudio Szint diff --git a/data/catalogs/add-ons/media/media-add-ons/multi_audio/ja.catkeys b/data/catalogs/add-ons/media/media-add-ons/multi_audio/ja.catkeys new file mode 100644 index 0000000000..24ec83672c --- /dev/null +++ b/data/catalogs/add-ons/media/media-add-ons/multi_audio/ja.catkeys @@ -0,0 +1,28 @@ +1 japanese x-vnd.Haiku-hmulti_audio.media_addon 342589902 +Master MultiAudio マスター +SPDIF MultiAudio SPDIF +Gain MultiAudio ゲイン +Extended Setup MultiAudio 高度な設定 +CD MultiAudio CD +Tone control MultiAudio 音質調整 +Phone MultiAudio 電話 +Aux MultiAudio Aux +Headphones MultiAudio ヘッドフォン +Beep MultiAudio ビープ音 +Input MultiAudio 入力 +Mono mix MultiAudio モノラルミックス +General MultiAudio 一般 +Input & Output MultiAudio 入出力 +Enhanced Setup MultiAudio 高度なセットアップ +Stereo mix MultiAudio ステレオミックス +Volume MultiAudio 音量 +Output MultiAudio 出力 +Video MultiAudio ビデオ +Line MultiAudio ライン +Mic MultiAudio マイク + frequency: MultiAudio 周波数: +Enable MultiAudio 有効にする +Mute MultiAudio ミュート +Wave MultiAudio Wave +Setup MultiAudio セットアップ +Level MultiAudio レベル diff --git a/data/catalogs/add-ons/media/media-add-ons/multi_audio/pt_BR.catkeys b/data/catalogs/add-ons/media/media-add-ons/multi_audio/pt_BR.catkeys new file mode 100644 index 0000000000..ecf905a4bd --- /dev/null +++ b/data/catalogs/add-ons/media/media-add-ons/multi_audio/pt_BR.catkeys @@ -0,0 +1,34 @@ +1 portuguese (brazil) x-vnd.Haiku-hmulti_audio.media_addon 451057402 +Master MultiAudio Mestre +SPDIF MultiAudio SPDIF +Gain MultiAudio Ganho +Output 3D center MultiAudio Centro da saída 3D +Extended Setup MultiAudio Configuração adicional +CD MultiAudio CD +Tone control MultiAudio Controle de tonalidade +Phone MultiAudio Fone +Aux MultiAudio Aux +Output bass MultiAudio Saída do baixo +Headphones MultiAudio Fones de ouvido +Beep MultiAudio Bip +Output mono mix MultiAudio Misturador da saída mono +Output stereo mix MultiAudio Misturador da saída estéreo +Input MultiAudio Entrada +Output treble MultiAudio Saída de agudos +Mono mix MultiAudio Misturador mono +General MultiAudio Geral +Input & Output MultiAudio Entrada e Saída +Enhanced Setup MultiAudio Configuração Avançada +Stereo mix MultiAudio Misturador estéreo +Output 3D depth MultiAudio Profundidade de saída 3D +Volume MultiAudio Volume +Output MultiAudio Saída +Video MultiAudio Vídeo +Line MultiAudio Linha +Mic MultiAudio Microfone + frequency: MultiAudio frequência: +Enable MultiAudio Habilitar +Mute MultiAudio Mudo +Wave MultiAudio Onda +Setup MultiAudio Configurar +Level MultiAudio Nível diff --git a/data/catalogs/add-ons/media/media-add-ons/multi_audio/sv.catkeys b/data/catalogs/add-ons/media/media-add-ons/multi_audio/sv.catkeys new file mode 100644 index 0000000000..19a87b0617 --- /dev/null +++ b/data/catalogs/add-ons/media/media-add-ons/multi_audio/sv.catkeys @@ -0,0 +1,34 @@ +1 swedish x-vnd.Haiku-hmulti_audio.media_addon 451057402 +Master MultiAudio Master +SPDIF MultiAudio SPDIF +Gain MultiAudio Förstärk +Output 3D center MultiAudio Utgång 3D center +Extended Setup MultiAudio Utökad inställning +CD MultiAudio CD +Tone control MultiAudio Ton kontroll +Phone MultiAudio Telefon +Aux MultiAudio Aux +Output bass MultiAudio Utgångsbas +Headphones MultiAudio Hörlurar +Beep MultiAudio Ljudsignal +Output mono mix MultiAudio Utgång mono mix +Output stereo mix MultiAudio Utgång stereo mix +Input MultiAudio Ingång +Output treble MultiAudio Utgång tredubbel +Mono mix MultiAudio Monomix +General MultiAudio Allmän +Input & Output MultiAudio Ingång & Utgång +Enhanced Setup MultiAudio Avancerad Inställning +Stereo mix MultiAudio Stereomix +Output 3D depth MultiAudio Utgång 3D djup +Volume MultiAudio Volym +Output MultiAudio Utgång +Video MultiAudio Video +Line MultiAudio Linje +Mic MultiAudio Mic + frequency: MultiAudio frekvens: +Enable MultiAudio Aktivera +Mute MultiAudio Tyst +Wave MultiAudio Våg +Setup MultiAudio Inställningar +Level MultiAudio Nivå diff --git a/data/catalogs/add-ons/translators/icns/sv.catkeys b/data/catalogs/add-ons/translators/icns/sv.catkeys new file mode 100644 index 0000000000..53375337a0 --- /dev/null +++ b/data/catalogs/add-ons/translators/icns/sv.catkeys @@ -0,0 +1,5 @@ +1 swedish x-vnd.Haiku-ICNSTranslator 2416672857 +Version %d.%d.%d, %s ICNSConfig Version %d.%d.%d, %s +Apple icons ICNSTranslator Appleikoner +Apple icon translator ICNSTranslator Översättning av Appleikoner +Apple icon translator ICNSConfig Översättning av Appleikoner diff --git a/data/catalogs/apps/diskusage/sv.catkeys b/data/catalogs/apps/diskusage/sv.catkeys index c547b0f767..1eac1c1bc4 100644 --- a/data/catalogs/apps/diskusage/sv.catkeys +++ b/data/catalogs/apps/diskusage/sv.catkeys @@ -1,4 +1,4 @@ -1 swedish x-vnd.Haiku-DiskUsage 274830116 +1 swedish x-vnd.Haiku-DiskUsage 3631077986 Scanning %refName% Scanner Skannar %refName% Size Info Window Storlek Rescan Pie View Skanna om @@ -11,12 +11,14 @@ Scan Status View Skanna 9999.99 GB Status View 9999.99 GB Rescan Status View Skanna om file unavailable Status View fil ej tillgänglig +Get info Pie View Hämta information DiskUsage System name DiskAnvändning in %d files Info Window i %d filer %d files Status View %d filer Created Info Window Skapad Modified Info Window Modifierad Abort Status View Avbryt +Open with Pie View Öppna med Open Pie View Öppna %a, %d %b %Y, %r Info Window %a, %d %b %Y, %r Free on %refName% Scanner Ledigt på %refName% diff --git a/data/catalogs/apps/drivesetup/hu.catkeys b/data/catalogs/apps/drivesetup/hu.catkeys index 4a154d6253..610be66891 100644 --- a/data/catalogs/apps/drivesetup/hu.catkeys +++ b/data/catalogs/apps/drivesetup/hu.catkeys @@ -1,4 +1,4 @@ -1 hungarian x-vnd.Haiku-DriveSetup 1372142450 +1 hungarian x-vnd.Haiku-DriveSetup 1387045579 DriveSetup System name Lemezkezelő Delete MainWindow Törlés Are you sure you want to write the changes back to disk now?\n\nAll data on the selected partition will be irretrievably lost if you do so! MainWindow Biztosan jóváhagyja az adatok felírását a lemezre?\n\nEz esetben a partíció teljes tartalma visszavonhatatlanul meg fog semmisülni. @@ -46,6 +46,7 @@ The disk has been successfully initialized.\n MainWindow A partíció (%s) hiba Could not unmount partition %s. MainWindow Nem lehet leválasztani a partíciót (%s). Failed to format the partition %s!\n MainWindow Nem sikerült előkészíteni a partíciót: „%s”.\n Mount MainWindow Csatol +Partition type PartitionList Partíció típusa: Create CreateParamsPanel Létrehoz Are you sure you want to format a raw disk? (most people initialize the disk with a partitioning system first) You will be asked again before changes are written to the disk. MainWindow Biztosan formázni szeretné a nyers lemezt? (A legtöbb esetben elő szokták készíteni a lemezt formázás előtt.) Ezt még egyszer meg kell majd erősítenie. Device PartitionList Eszköz diff --git a/data/catalogs/apps/expander/ru.catkeys b/data/catalogs/apps/expander/ru.catkeys index bc43a0b23f..3e17e4cf4f 100644 --- a/data/catalogs/apps/expander/ru.catkeys +++ b/data/catalogs/apps/expander/ru.catkeys @@ -1,4 +1,4 @@ -1 russian x-vnd.Haiku-Expander 1269216169 +1 russian x-vnd.Haiku-Expander 2603318510 Expand ExpanderMenu Распаковать Close window when done expanding ExpanderPreferences Закрывать окно после распаковки Set destination… ExpanderMenu Путь назначения для извлечения… @@ -33,6 +33,8 @@ Show contents ExpanderWindow Показать содержимое Automatically show contents listing ExpanderPreferences Автоматически отображать содержимое архива OK ExpanderPreferences ОК Leave destination folder path empty ExpanderPreferences Оставить путь назначения пустым +Failed to create the destination folder. ExpanderWindow Не удалось создать папку назначения. +Create ExpanderWindow Создать The folder was either moved, renamed or not\nsupported. ExpanderWindow Папка была перемещена, переименована либо не\nподдерживается. The file doesn't exist ExpanderWindow Файл не существует Stop ExpanderMenu Остановить diff --git a/data/catalogs/apps/firstbootprompt/be.catkeys b/data/catalogs/apps/firstbootprompt/be.catkeys new file mode 100644 index 0000000000..626dfdc14c --- /dev/null +++ b/data/catalogs/apps/firstbootprompt/be.catkeys @@ -0,0 +1,8 @@ +1 belarusian x-vnd.Haiku-FirstBootPrompt 2544294242 +Custom BootPromptWindow Карыстальніка +Thank you for trying out Haiku! We hope you'll like it!\n\nYou can select your preferred language and keyboard layout from the list on the left which will then be used instantly. You can easily change both settings from the Desktop later on on the fly.\n\nDo you wish to run the Installer or continue booting to the Desktop?\n BootPromptWindow For other languages, a note could be added: \"Note: Localization of Haiku applications and other components is an on-going effort. You will frequently encounter untranslated strings, but if you like, you can join in the work at .\" Мы дзякуем вас за спробу усталяваць Haiku. Спадзяемся, што вам спадабаецца!\n\nВы можаце абраць пажаданую мову інтэрфейса і раскладку клавіятуры ў левым спісе. Гэтыя параметры таксма могуць быць змененыя пазней.\n\nЖадаеце запусціць Усталёўшчык ці загрузіць Дэсктоп?\n +Desktop (Live-CD) BootPromptWindow Дэсктоп (Live-CD) +Language BootPromptWindow Мова +Welcome to Haiku! BootPromptWindow Вітаем! +Run Installer BootPromptWindow Запусціць Усталёўшчык +Keymap BootPromptWindow Расклад клавіятуры diff --git a/data/catalogs/apps/readonlybootprompt/cs.catkeys b/data/catalogs/apps/firstbootprompt/cs.catkeys similarity index 82% rename from data/catalogs/apps/readonlybootprompt/cs.catkeys rename to data/catalogs/apps/firstbootprompt/cs.catkeys index 933e47f74a..3de4f7ea6c 100644 --- a/data/catalogs/apps/readonlybootprompt/cs.catkeys +++ b/data/catalogs/apps/firstbootprompt/cs.catkeys @@ -1,4 +1,4 @@ -1 czech x-vnd.Haiku-ReadOnlyBootPrompt 1972532432 +1 czech x-vnd.Haiku-FirstBootPrompt 1972532432 Desktop (Live-CD) BootPromptWindow Plocha (Live-CD) Keymap BootPromptWindow Rozložení klávesnice Language BootPromptWindow Jazyk diff --git a/data/catalogs/apps/readonlybootprompt/da.catkeys b/data/catalogs/apps/firstbootprompt/da.catkeys similarity index 82% rename from data/catalogs/apps/readonlybootprompt/da.catkeys rename to data/catalogs/apps/firstbootprompt/da.catkeys index ee319931a7..1ae7438266 100644 --- a/data/catalogs/apps/readonlybootprompt/da.catkeys +++ b/data/catalogs/apps/firstbootprompt/da.catkeys @@ -1,4 +1,4 @@ -1 danish x-vnd.Haiku-ReadOnlyBootPrompt 1972532432 +1 danish x-vnd.Haiku-FirstBootPrompt 1972532432 Desktop (Live-CD) BootPromptWindow Skrivebord (Live-CD) Keymap BootPromptWindow Tastatur layout Language BootPromptWindow Sprog diff --git a/data/catalogs/apps/firstbootprompt/de.catkeys b/data/catalogs/apps/firstbootprompt/de.catkeys new file mode 100644 index 0000000000..7a72ee417b --- /dev/null +++ b/data/catalogs/apps/firstbootprompt/de.catkeys @@ -0,0 +1,8 @@ +1 german x-vnd.Haiku-FirstBootPrompt 2544294242 +Custom BootPromptWindow Benutzerdefiniert +Thank you for trying out Haiku! We hope you'll like it!\n\nYou can select your preferred language and keyboard layout from the list on the left which will then be used instantly. You can easily change both settings from the Desktop later on on the fly.\n\nDo you wish to run the Installer or continue booting to the Desktop?\n BootPromptWindow For other languages, a note could be added: \"Note: Localization of Haiku applications and other components is an on-going effort. You will frequently encounter untranslated strings, but if you like, you can join in the work at .\" Danke für das Interesse an Haiku!\n\nAus der nebenstehenden Liste können Sprache und Tastaturlayout gewählt werden. Die Einstellungen werden sofort verwendet, lassen sich aber jederzeit im laufenden System ändern.\n\nSoll die Installation gestartet werden oder soll weiter zum Desktop gebootet werden?\n\nDie Übersetzung der Haiku-Anwendungen und anderer Komponenten ist noch nicht abgeschlossen. Wer auf nicht übersetzte Texte stößt und bei der Arbeit helfen möchte, findet dazu weitere Informationen auf der Webseite . +Desktop (Live-CD) BootPromptWindow Desktop (Live-CD) +Language BootPromptWindow Sprache +Welcome to Haiku! BootPromptWindow Willkommen bei Haiku! +Run Installer BootPromptWindow Installer starten +Keymap BootPromptWindow Tastaturschema diff --git a/data/catalogs/apps/firstbootprompt/el.catkeys b/data/catalogs/apps/firstbootprompt/el.catkeys new file mode 100644 index 0000000000..314dee8c4d --- /dev/null +++ b/data/catalogs/apps/firstbootprompt/el.catkeys @@ -0,0 +1,8 @@ +1 greek, modern (1453-) x-vnd.Haiku-FirstBootPrompt 2544294242 +Custom BootPromptWindow Προσαρμοσμένο +Thank you for trying out Haiku! We hope you'll like it!\n\nYou can select your preferred language and keyboard layout from the list on the left which will then be used instantly. You can easily change both settings from the Desktop later on on the fly.\n\nDo you wish to run the Installer or continue booting to the Desktop?\n BootPromptWindow For other languages, a note could be added: \"Note: Localization of Haiku applications and other components is an on-going effort. You will frequently encounter untranslated strings, but if you like, you can join in the work at .\" Ευχαριστούμε που δοκιμάζετε το Haiku! Ευχόμαστε να σας αρέσει!\n\nΜπορείτε να επιλέξετε τον επιθυμιτή γλώσσα σας και τη διάταξη πληκτρολογίου από τη λίστα στα αριστερά που θα χρησιμοποιείται έπειτα στιγμιαία. Μπορείτε εύκολα να αλλάξετε και τις ρυθμίσεις για την επιφάνεια εργασίας.\n\nΘέλετε να εκτελέσετε τον Εγκαταστάση ή να συνεχίσετε την εκκίνηση στην επιφάνεια εργασίας;\nΣημείωση: Για τις υπόλοιπες γλώσσες, πρoστίθεται μια ενημέρωση:\"Σημείωση: Η μετάφραση των εφαρμογών του Haiku και άλλων περιεχομένων χρειάζεται ακόμη προσπάθεια.. Θα βρείτε συχνά τμήματα χωρίς μετάφραση, αλλά εαν θέλετε μπορείτε να συνεισφέρετε σε αυτή τη δουλεία στο .\" +Desktop (Live-CD) BootPromptWindow Επιφάνεια εργασίας (Live-CD) +Language BootPromptWindow Γλώσσα +Welcome to Haiku! BootPromptWindow Καλώς ήλθατε στο Haiku! +Run Installer BootPromptWindow Έναρξη Εγκατάστασης +Keymap BootPromptWindow Διάταξη πληκτρολογίου diff --git a/data/catalogs/apps/readonlybootprompt/eo.catkeys b/data/catalogs/apps/firstbootprompt/eo.catkeys similarity index 81% rename from data/catalogs/apps/readonlybootprompt/eo.catkeys rename to data/catalogs/apps/firstbootprompt/eo.catkeys index 973a0fa49b..e6ac53f6a6 100644 --- a/data/catalogs/apps/readonlybootprompt/eo.catkeys +++ b/data/catalogs/apps/firstbootprompt/eo.catkeys @@ -1,4 +1,4 @@ -1 esperanto x-vnd.Haiku-ReadOnlyBootPrompt 1972532432 +1 esperanto x-vnd.Haiku-FirstBootPrompt 1972532432 Desktop (Live-CD) BootPromptWindow Labortablo (Viva Lumdisko) Keymap BootPromptWindow Klavara aranĝo Language BootPromptWindow Lingvo diff --git a/data/catalogs/apps/readonlybootprompt/es.catkeys b/data/catalogs/apps/firstbootprompt/es.catkeys similarity index 82% rename from data/catalogs/apps/readonlybootprompt/es.catkeys rename to data/catalogs/apps/firstbootprompt/es.catkeys index 04699cbeff..f8dde383f8 100644 --- a/data/catalogs/apps/readonlybootprompt/es.catkeys +++ b/data/catalogs/apps/firstbootprompt/es.catkeys @@ -1,4 +1,4 @@ -1 spanish x-vnd.Haiku-ReadOnlyBootPrompt 1972532432 +1 spanish x-vnd.Haiku-FirstBootPrompt 1972532432 Desktop (Live-CD) BootPromptWindow Escritorio (Live-CD) Keymap BootPromptWindow Distribución de teclado Language BootPromptWindow Idioma diff --git a/data/catalogs/apps/firstbootprompt/fi.catkeys b/data/catalogs/apps/firstbootprompt/fi.catkeys new file mode 100644 index 0000000000..a505542fd5 --- /dev/null +++ b/data/catalogs/apps/firstbootprompt/fi.catkeys @@ -0,0 +1,8 @@ +1 finnish x-vnd.Haiku-FirstBootPrompt 2544294242 +Custom BootPromptWindow Oma +Thank you for trying out Haiku! We hope you'll like it!\n\nYou can select your preferred language and keyboard layout from the list on the left which will then be used instantly. You can easily change both settings from the Desktop later on on the fly.\n\nDo you wish to run the Installer or continue booting to the Desktop?\n BootPromptWindow For other languages, a note could be added: \"Note: Localization of Haiku applications and other components is an on-going effort. You will frequently encounter untranslated strings, but if you like, you can join in the work at .\" Kiitoksia siitä, että kokeilet Haikua! Toivomme, että pidät siitä!\n\nVoit valita ensisijaisen kielen ja näppäimistöasetuksen vasemmalla näkyvästä luettelosta. Asetukset otetaan käyttöön välittömästi. Voit helposti vaihtaa molempia asetuksia myöhemmin työpöydältäsi.\n\nHaluatko suorittaa asennusohjelman tai jatkaa alkulautausta työpöydälle?\n Huomaa: Ponnistelemme edelleen Haiku-sovellusten ja muiden komponenttien kotoistamiseksi. Kohtaat usein suomentamattomia merkkijonoja, mutta jos haluat, voit liittyä työhön osoitteessa . +Desktop (Live-CD) BootPromptWindow Työpöytä (Live-CD) +Language BootPromptWindow Kieli +Welcome to Haiku! BootPromptWindow Tervetuloa Haikuun! +Run Installer BootPromptWindow Suorita asennusohjelma +Keymap BootPromptWindow Näppäinkartta diff --git a/data/catalogs/apps/firstbootprompt/fr.catkeys b/data/catalogs/apps/firstbootprompt/fr.catkeys new file mode 100644 index 0000000000..9f98d9be11 --- /dev/null +++ b/data/catalogs/apps/firstbootprompt/fr.catkeys @@ -0,0 +1,8 @@ +1 french x-vnd.Haiku-FirstBootPrompt 2544294242 +Custom BootPromptWindow Personnalisé +Thank you for trying out Haiku! We hope you'll like it!\n\nYou can select your preferred language and keyboard layout from the list on the left which will then be used instantly. You can easily change both settings from the Desktop later on on the fly.\n\nDo you wish to run the Installer or continue booting to the Desktop?\n BootPromptWindow For other languages, a note could be added: \"Note: Localization of Haiku applications and other components is an on-going effort. You will frequently encounter untranslated strings, but if you like, you can join in the work at .\" Merci d'essayer Haiku ! Nous espérons que vous l'aimerez !\n\nVeuillez choisir votre clavier et votre langue préférés dans la liste à gauche. Ils seront pris en compte instantanément. Plus tard, vous pourrez facilement modifier à la volée ces deux réglages à partir du bureau.\n\nVoulez-vous exécuter le programme d'installation ou continuer le démarrage du bureau ?\n\nNote : La traduction des applications et des autres parties d'Haiku n'est pas terminée. Vous trouverez souvent des phrases non traduites, mais si vous le souhaitez, vous pouvez apporter votre contribution sur .\n +Desktop (Live-CD) BootPromptWindow Bureau (CD Live) +Language BootPromptWindow Langue +Welcome to Haiku! BootPromptWindow Bienvenue dans Haiku ! +Run Installer BootPromptWindow Lancer l'installeur +Keymap BootPromptWindow Disposition du clavier diff --git a/data/catalogs/apps/firstbootprompt/hi.catkeys b/data/catalogs/apps/firstbootprompt/hi.catkeys new file mode 100644 index 0000000000..1534a21a4e --- /dev/null +++ b/data/catalogs/apps/firstbootprompt/hi.catkeys @@ -0,0 +1,8 @@ +1 hindi x-vnd.Haiku-FirstBootPrompt 2544294242 +Custom BootPromptWindow कस्टम +Thank you for trying out Haiku! We hope you'll like it!\n\nYou can select your preferred language and keyboard layout from the list on the left which will then be used instantly. You can easily change both settings from the Desktop later on on the fly.\n\nDo you wish to run the Installer or continue booting to the Desktop?\n BootPromptWindow For other languages, a note could be added: \"Note: Localization of Haiku applications and other components is an on-going effort. You will frequently encounter untranslated strings, but if you like, you can join in the work at .\" धन्यवाद हाइकु को इस्तमाल करने के लिए! हम आशा करते हैं की आप को यह पसंद आया होगा!\n\nआप अपने मनपसंद भाषा और कीबोर्ड लेयाओउट चुन सकते है लिस्ट में से. आप बाद में दोंनो चीज़ बदल सकते है डेस्कटॉप पर से.\n\nक्या आप इंस्टॉलर रन करना चाहेंगे या फिर डेस्कटॉप को बूट करना जारी रखना चाहेंगे?\n +Desktop (Live-CD) BootPromptWindow डेस्कटॉप (लाइव सीडी) +Language BootPromptWindow भाषा +Welcome to Haiku! BootPromptWindow हाइकू में आपका स्वागत है! +Run Installer BootPromptWindow इंस्टॉलर चलाएँ +Keymap BootPromptWindow कीमैप diff --git a/data/catalogs/apps/readonlybootprompt/hr.catkeys b/data/catalogs/apps/firstbootprompt/hr.catkeys similarity index 84% rename from data/catalogs/apps/readonlybootprompt/hr.catkeys rename to data/catalogs/apps/firstbootprompt/hr.catkeys index 41e339eb33..79e7874264 100644 --- a/data/catalogs/apps/readonlybootprompt/hr.catkeys +++ b/data/catalogs/apps/firstbootprompt/hr.catkeys @@ -1,4 +1,4 @@ -1 croatian x-vnd.Haiku-ReadOnlyBootPrompt 2686989872 +1 croatian x-vnd.Haiku-FirstBootPrompt 2686989872 Custom BootPromptWindow Prilagođeno Desktop (Live-CD) BootPromptWindow Desktop (Live-CD) Keymap BootPromptWindow Tipkovnica diff --git a/data/catalogs/apps/firstbootprompt/hu.catkeys b/data/catalogs/apps/firstbootprompt/hu.catkeys new file mode 100644 index 0000000000..9ffa3e07b1 --- /dev/null +++ b/data/catalogs/apps/firstbootprompt/hu.catkeys @@ -0,0 +1,8 @@ +1 hungarian x-vnd.Haiku-FirstBootPrompt 2649051796 +Custom BootPromptWindow Egyéni +Boot to Desktop BootPromptWindow Az Asztalt +Thank you for trying out Haiku! We hope you'll like it!\n\nYou can select your preferred language and keyboard layout from the list on the left which will then be used instantly. You can easily change both settings from the Desktop later on on the fly.\n\nDo you wish to run the Installer or continue booting to the Desktop?\n BootPromptWindow For other languages, a note could be added: \"Note: Localization of Haiku applications and other components is an on-going effort. You will frequently encounter untranslated strings, but if you like, you can join in the work at .\" Köszönjük, hogy kipróbálja a Haiku-t, reméljük, meg lesz vele elégedve!\n\nA bal oldali listából kiválasztva a nyelvet a felület nyelve és a billentyűzetkiosztás automatikusan beállításra kerül. A későbbiekben ez bármikor módosítható a beállításoknál.\n\nMegjegyzés: a Haiku-t önkéntesek fordítják, így megeshet, hogy valami angolul jelenik meg. Ha Ön is részt szeretne venni a fordításban, akkor csatlakozhat a fordítókhoz a oldalon.\n\nA Telepítőt, vagy inkább az Asztalt indítsuk most el?\n +Language BootPromptWindow Nyelv +Welcome to Haiku! BootPromptWindow A Haiku üdvözli Önt! +Run Installer BootPromptWindow A Telepítót +Keymap BootPromptWindow Billentyűzetkiosztás diff --git a/data/catalogs/apps/readonlybootprompt/it.catkeys b/data/catalogs/apps/firstbootprompt/it.catkeys similarity index 81% rename from data/catalogs/apps/readonlybootprompt/it.catkeys rename to data/catalogs/apps/firstbootprompt/it.catkeys index fa9f005a00..9c390eb1d0 100644 --- a/data/catalogs/apps/readonlybootprompt/it.catkeys +++ b/data/catalogs/apps/firstbootprompt/it.catkeys @@ -1,4 +1,4 @@ -1 italian x-vnd.Haiku-ReadOnlyBootPrompt 1972532432 +1 italian x-vnd.Haiku-FirstBootPrompt 1972532432 Desktop (Live-CD) BootPromptWindow Desktop (Live-CD) Keymap BootPromptWindow Keymap Language BootPromptWindow Lingua diff --git a/data/catalogs/apps/firstbootprompt/ja.catkeys b/data/catalogs/apps/firstbootprompt/ja.catkeys new file mode 100644 index 0000000000..bc4b0778cb --- /dev/null +++ b/data/catalogs/apps/firstbootprompt/ja.catkeys @@ -0,0 +1,8 @@ +1 japanese x-vnd.Haiku-FirstBootPrompt 2649051796 +Custom BootPromptWindow カスタム +Boot to Desktop BootPromptWindow デスクトップを起動 +Thank you for trying out Haiku! We hope you'll like it!\n\nYou can select your preferred language and keyboard layout from the list on the left which will then be used instantly. You can easily change both settings from the Desktop later on on the fly.\n\nDo you wish to run the Installer or continue booting to the Desktop?\n BootPromptWindow For other languages, a note could be added: \"Note: Localization of Haiku applications and other components is an on-going effort. You will frequently encounter untranslated strings, but if you like, you can join in the work at .\" Haikuを試用していただきありがとうございます。Haikuのことを気に入っていただければ幸いです。\n\n左のリストからご希望の言語とキーマップの選択がすぐできます。あとで、デスクトップからこれらの設定をすぐに簡単に変更できます。\n\nインストーラーを実行しますか、それともデスクトップの起動を続行しますか?\n +Language BootPromptWindow 言語 +Welcome to Haiku! BootPromptWindow Haikuへようこそ! +Run Installer BootPromptWindow インストーラーを実行 +Keymap BootPromptWindow キーマップ diff --git a/data/catalogs/apps/readonlybootprompt/ko.catkeys b/data/catalogs/apps/firstbootprompt/ko.catkeys similarity index 84% rename from data/catalogs/apps/readonlybootprompt/ko.catkeys rename to data/catalogs/apps/firstbootprompt/ko.catkeys index 1fb8878b2a..53b0beef1d 100644 --- a/data/catalogs/apps/readonlybootprompt/ko.catkeys +++ b/data/catalogs/apps/firstbootprompt/ko.catkeys @@ -1,4 +1,4 @@ -1 korean x-vnd.Haiku-ReadOnlyBootPrompt 1972532432 +1 korean x-vnd.Haiku-FirstBootPrompt 1972532432 Desktop (Live-CD) BootPromptWindow 데스크탑 (라이브 시디) Keymap BootPromptWindow 키보드배열 Language BootPromptWindow 언어 diff --git a/data/catalogs/apps/firstbootprompt/lt.catkeys b/data/catalogs/apps/firstbootprompt/lt.catkeys new file mode 100644 index 0000000000..5a8c21c142 --- /dev/null +++ b/data/catalogs/apps/firstbootprompt/lt.catkeys @@ -0,0 +1,8 @@ +1 lithuanian x-vnd.Haiku-FirstBootPrompt 2544294242 +Custom BootPromptWindow Pasirinktinė +Thank you for trying out Haiku! We hope you'll like it!\n\nYou can select your preferred language and keyboard layout from the list on the left which will then be used instantly. You can easily change both settings from the Desktop later on on the fly.\n\nDo you wish to run the Installer or continue booting to the Desktop?\n BootPromptWindow For other languages, a note could be added: \"Note: Localization of Haiku applications and other components is an on-going effort. You will frequently encounter untranslated strings, but if you like, you can join in the work at .\" Dėkojame, kad nusprendėte išbandyti „Haiku“! Mes tikimės, kad ši operacinė sistema Jums patiks!\n\nIš sąrašo kairėje galite išsirinkti norimą kalbą ir klaviatūros išdėstymą – šių nuostatų pakeitimai bus iškart pritaikyti. Taip pat lengvai jas galėsite pasikeisti ir vėliau, jau naudodamiesi sistema.\n\nAr norite paleisti įdiegimo programą, ar išbandyti „Haiku“ aplinką, ją paleidžiant tiesiai iš šios laikmenos? +Desktop (Live-CD) BootPromptWindow Išbandyti „Haiku“ +Language BootPromptWindow Kalba +Welcome to Haiku! BootPromptWindow Sveiki, čia – „Haiku“! +Run Installer BootPromptWindow Paleisti įdiegimo programą +Keymap BootPromptWindow Klaviatūros išdėstymas diff --git a/data/catalogs/apps/firstbootprompt/nb.catkeys b/data/catalogs/apps/firstbootprompt/nb.catkeys new file mode 100644 index 0000000000..1a720c09e7 --- /dev/null +++ b/data/catalogs/apps/firstbootprompt/nb.catkeys @@ -0,0 +1,8 @@ +1 bokmål, norwegian; norwegian bokmål x-vnd.Haiku-FirstBootPrompt 2544294242 +Custom BootPromptWindow Tilpasset +Thank you for trying out Haiku! We hope you'll like it!\n\nYou can select your preferred language and keyboard layout from the list on the left which will then be used instantly. You can easily change both settings from the Desktop later on on the fly.\n\nDo you wish to run the Installer or continue booting to the Desktop?\n BootPromptWindow For other languages, a note could be added: \"Note: Localization of Haiku applications and other components is an on-going effort. You will frequently encounter untranslated strings, but if you like, you can join in the work at .\" Takk for at du prøver ut Haiku! Vi håper du vil like det!\n\nDu kan velge hvilket språk du foretrekker og tastaturoppsett fra sliten til venstre, som så vil bli tatt i bruk umiddelbart. Du kan enkelt endre begge innstillingne fra skrivebordet senere.\n\nØnsker du å kjøre installasjonsprogrammet, eller fortsette oppstartsprosessen fra CD-en?\n +Desktop (Live-CD) BootPromptWindow Skrivebord (Live-CD) +Language BootPromptWindow Språk +Welcome to Haiku! BootPromptWindow Velkommen til Haiku! +Run Installer BootPromptWindow Kjør installeringsprogram +Keymap BootPromptWindow Tastaturspråk diff --git a/data/catalogs/apps/firstbootprompt/nl.catkeys b/data/catalogs/apps/firstbootprompt/nl.catkeys new file mode 100644 index 0000000000..9a9e6e4e1a --- /dev/null +++ b/data/catalogs/apps/firstbootprompt/nl.catkeys @@ -0,0 +1,8 @@ +1 dutch; flemish x-vnd.Haiku-FirstBootPrompt 2544294242 +Custom BootPromptWindow Aangepast +Thank you for trying out Haiku! We hope you'll like it!\n\nYou can select your preferred language and keyboard layout from the list on the left which will then be used instantly. You can easily change both settings from the Desktop later on on the fly.\n\nDo you wish to run the Installer or continue booting to the Desktop?\n BootPromptWindow For other languages, a note could be added: \"Note: Localization of Haiku applications and other components is an on-going effort. You will frequently encounter untranslated strings, but if you like, you can join in the work at .\" Bedankt om Haiku uit te proberen! We hopen dat Haiku u bevalt!\n\nU kunt uw voorkeurstaal en -toetsenbordindeling kiezen uit de lijst, waarna deze onmiddellijk gebruikt zullen worden. U kunt beide instellingen later eenvoudig wijzigen vanaf het bureaublad.\n\nWenst u het installatieprogramma uit te voeren of verder op te starten naar het bureaublad? +Desktop (Live-CD) BootPromptWindow Bureaublad (Live-CD) +Language BootPromptWindow Taal +Welcome to Haiku! BootPromptWindow Welkom bij Haiku! +Run Installer BootPromptWindow Activeer Installer +Keymap BootPromptWindow Toetsenbordindeling diff --git a/data/catalogs/apps/firstbootprompt/pl.catkeys b/data/catalogs/apps/firstbootprompt/pl.catkeys new file mode 100644 index 0000000000..e76186a77a --- /dev/null +++ b/data/catalogs/apps/firstbootprompt/pl.catkeys @@ -0,0 +1,8 @@ +1 polish x-vnd.Haiku-FirstBootPrompt 2544294242 +Custom BootPromptWindow Własne +Thank you for trying out Haiku! We hope you'll like it!\n\nYou can select your preferred language and keyboard layout from the list on the left which will then be used instantly. You can easily change both settings from the Desktop later on on the fly.\n\nDo you wish to run the Installer or continue booting to the Desktop?\n BootPromptWindow For other languages, a note could be added: \"Note: Localization of Haiku applications and other components is an on-going effort. You will frequently encounter untranslated strings, but if you like, you can join in the work at .\" Dziękujemy za wypróbowanie Haiku! Mamy nadzieję, że Ci się spodoba!\n\nMożesz wybrać swój język i układ klawiatury z listy po lewej stronie, które to zostaną następnie użyte. Możesz później łatwo zmienić oba ustawienia w ustawieniach Pulpitu.\n\nChcesz od razu przejść do instalatora, czy może kontynuować rozruch do Pulpitu?\n +Desktop (Live-CD) BootPromptWindow Pulpit (Live-CD) +Language BootPromptWindow Język +Welcome to Haiku! BootPromptWindow Witaj w Haiku! +Run Installer BootPromptWindow Uruchom instalator +Keymap BootPromptWindow Układ klawiatury diff --git a/data/catalogs/apps/readonlybootprompt/pt.catkeys b/data/catalogs/apps/firstbootprompt/pt.catkeys similarity index 81% rename from data/catalogs/apps/readonlybootprompt/pt.catkeys rename to data/catalogs/apps/firstbootprompt/pt.catkeys index 69bb564be6..2a21bbaa08 100644 --- a/data/catalogs/apps/readonlybootprompt/pt.catkeys +++ b/data/catalogs/apps/firstbootprompt/pt.catkeys @@ -1,4 +1,4 @@ -1 portuguese x-vnd.Haiku-ReadOnlyBootPrompt 1972532432 +1 portuguese x-vnd.Haiku-FirstBootPrompt 1972532432 Desktop (Live-CD) BootPromptWindow Desktop (Live-CD) Keymap BootPromptWindow Esquema de teclado Language BootPromptWindow Idioma diff --git a/data/catalogs/apps/firstbootprompt/pt_BR.catkeys b/data/catalogs/apps/firstbootprompt/pt_BR.catkeys new file mode 100644 index 0000000000..e8d55925ed --- /dev/null +++ b/data/catalogs/apps/firstbootprompt/pt_BR.catkeys @@ -0,0 +1,8 @@ +1 portuguese (brazil) x-vnd.Haiku-FirstBootPrompt 2649051796 +Custom BootPromptWindow Personalizado +Boot to Desktop BootPromptWindow Inicializar a Área de Trabalho +Thank you for trying out Haiku! We hope you'll like it!\n\nYou can select your preferred language and keyboard layout from the list on the left which will then be used instantly. You can easily change both settings from the Desktop later on on the fly.\n\nDo you wish to run the Installer or continue booting to the Desktop?\n BootPromptWindow For other languages, a note could be added: \"Note: Localization of Haiku applications and other components is an on-going effort. You will frequently encounter untranslated strings, but if you like, you can join in the work at .\" Obrigado por experimentar o Haiku! Esperamos que goste dele!\n\nVocê pode selecionar seu idioma preferido e disposição de teclado a partir da lista à esquerda, os quais serão utilizados imediatamente. Você pode facilmente alterar ambas as definições a partir da Área de Trabalho mais tarde rapidamente.\n\nDeseja executar o Instalador ou continuar inicializando a Área de Trabalho?\n +Language BootPromptWindow Idioma +Welcome to Haiku! BootPromptWindow Bem-vindo ao Haiku! +Run Installer BootPromptWindow Executar o Instalador +Keymap BootPromptWindow Mapa do teclado diff --git a/data/catalogs/apps/readonlybootprompt/pt_br.catkeys b/data/catalogs/apps/firstbootprompt/pt_br.catkeys similarity index 94% rename from data/catalogs/apps/readonlybootprompt/pt_br.catkeys rename to data/catalogs/apps/firstbootprompt/pt_br.catkeys index 333e65705f..a029bc3bae 100644 --- a/data/catalogs/apps/readonlybootprompt/pt_br.catkeys +++ b/data/catalogs/apps/firstbootprompt/pt_br.catkeys @@ -1,4 +1,4 @@ -1 brazilian_portuguese x-vnd.Haiku-ReadOnlyBootPrompt 988630706 +1 brazilian_portuguese x-vnd.Haiku-FirstBootPrompt 988630706 Custom BootPromptWindow Personalizado Keymap BootPromptWindow Mapa de Teclas Language BootPromptWindow Linguagem diff --git a/data/catalogs/apps/firstbootprompt/ro.catkeys b/data/catalogs/apps/firstbootprompt/ro.catkeys new file mode 100644 index 0000000000..1fe91fa369 --- /dev/null +++ b/data/catalogs/apps/firstbootprompt/ro.catkeys @@ -0,0 +1,8 @@ +1 romanian x-vnd.Haiku-FirstBootPrompt 2544294242 +Custom BootPromptWindow Personalizat +Thank you for trying out Haiku! We hope you'll like it!\n\nYou can select your preferred language and keyboard layout from the list on the left which will then be used instantly. You can easily change both settings from the Desktop later on on the fly.\n\nDo you wish to run the Installer or continue booting to the Desktop?\n BootPromptWindow For other languages, a note could be added: \"Note: Localization of Haiku applications and other components is an on-going effort. You will frequently encounter untranslated strings, but if you like, you can join in the work at .\" Vă mulțumim că ați încercat Haiku! Sperăm că o să vă placă!\n\nPuteți să selectați limba preferată și aranjamentul de tastatură din lista din stânga care vor fi apoi utilizate automat. Puteți să schimbați ușor mai târziu cele două configurări de pe Desktop.\n\nDoriți să rulați Programul de instalare sau continuați să porniți sistemul?\nNotă: Localizarea aplicațiilor Haiku și a altor componente este un efort susținut. Veți întâlni frecvent șiruri netraduse, dar dacă doriți, puteți să vă implicați în muncă la +Desktop (Live-CD) BootPromptWindow Birou (Live-CD) +Language BootPromptWindow Limbaj +Welcome to Haiku! BootPromptWindow Bun venit în Haiku! +Run Installer BootPromptWindow Rulează Instalator +Keymap BootPromptWindow Hartă de taste diff --git a/data/catalogs/apps/firstbootprompt/ru.catkeys b/data/catalogs/apps/firstbootprompt/ru.catkeys new file mode 100644 index 0000000000..43e15d0bfa --- /dev/null +++ b/data/catalogs/apps/firstbootprompt/ru.catkeys @@ -0,0 +1,8 @@ +1 russian x-vnd.Haiku-FirstBootPrompt 2544294242 +Custom BootPromptWindow Пользовательская +Thank you for trying out Haiku! We hope you'll like it!\n\nYou can select your preferred language and keyboard layout from the list on the left which will then be used instantly. You can easily change both settings from the Desktop later on on the fly.\n\nDo you wish to run the Installer or continue booting to the Desktop?\n BootPromptWindow For other languages, a note could be added: \"Note: Localization of Haiku applications and other components is an on-going effort. You will frequently encounter untranslated strings, but if you like, you can join in the work at .\" Большое спасибо за то, что решили попробовать Haiku.\nМы очень надеемся, что она вам понравится!\n\nИз списка слева вы можете выбрать предпочитаемый язык и клавиатурную раскладку, которые активируются немедленно. Вы легко сможете изменить эти настройки после запуска рабочего стола без перезагрузки.\n\nВы хотите запустить Установщик или продолжить загрузку рабочего стола?\n +Desktop (Live-CD) BootPromptWindow Рабочий стол (Live-CD) +Language BootPromptWindow Язык +Welcome to Haiku! BootPromptWindow Добро пожаловать в Haiku! +Run Installer BootPromptWindow Запустить Установщик +Keymap BootPromptWindow Раскладка клавиатуры diff --git a/data/catalogs/apps/firstbootprompt/sk.catkeys b/data/catalogs/apps/firstbootprompt/sk.catkeys new file mode 100644 index 0000000000..68638601c6 --- /dev/null +++ b/data/catalogs/apps/firstbootprompt/sk.catkeys @@ -0,0 +1,8 @@ +1 slovak x-vnd.Haiku-FirstBootPrompt 2544294242 +Custom BootPromptWindow Vlastná +Thank you for trying out Haiku! We hope you'll like it!\n\nYou can select your preferred language and keyboard layout from the list on the left which will then be used instantly. You can easily change both settings from the Desktop later on on the fly.\n\nDo you wish to run the Installer or continue booting to the Desktop?\n BootPromptWindow For other languages, a note could be added: \"Note: Localization of Haiku applications and other components is an on-going effort. You will frequently encounter untranslated strings, but if you like, you can join in the work at .\" Ďakujeme, že skúšate Haiku! Dúfame, že sa vám bude páčiť!\n\nZo zoznamu vľavo môžete vybrať váš preferovaný jazyk a rozloženie klávesnice, ktoré sa ihneď použije. Obe nastavenia môžete neskôr jednoducho za behu zmeniť z pracovného prostredia.\n\nChcete spustiť inštalátor alebo pokračovať v zavedení pracovného prostredia?\n +Desktop (Live-CD) BootPromptWindow Pracovné prostredie (živé CD) +Language BootPromptWindow Jazyk +Welcome to Haiku! BootPromptWindow Vitajte v Haiku! +Run Installer BootPromptWindow Spustiť inštalátor +Keymap BootPromptWindow Mapa klávesov diff --git a/data/catalogs/apps/firstbootprompt/sv.catkeys b/data/catalogs/apps/firstbootprompt/sv.catkeys new file mode 100644 index 0000000000..57bcf99123 --- /dev/null +++ b/data/catalogs/apps/firstbootprompt/sv.catkeys @@ -0,0 +1,8 @@ +1 swedish x-vnd.Haiku-FirstBootPrompt 2649051796 +Custom BootPromptWindow Anpassad +Boot to Desktop BootPromptWindow Boota till Skrivbordet +Thank you for trying out Haiku! We hope you'll like it!\n\nYou can select your preferred language and keyboard layout from the list on the left which will then be used instantly. You can easily change both settings from the Desktop later on on the fly.\n\nDo you wish to run the Installer or continue booting to the Desktop?\n BootPromptWindow For other languages, a note could be added: \"Note: Localization of Haiku applications and other components is an on-going effort. You will frequently encounter untranslated strings, but if you like, you can join in the work at .\" Tack för att du testar Haiku! Vi hoppas att du kommer att gilla det!\n \nDu kan ändra till det språk och tangentbordslayout du vill ha från listan till vänster. Valet kommer att gälla direkt. Du kan senare ändra båda inställningarna från skrivbordet\n\nVill du köra installationen eller fortsätta till skrivbordet?\nNotering: Översättning av Haiku till Svenska är något vi arbetar med regelbundet. Du kommer att träffa på delar som inte är översatta. Vill du hjälpa till kan du kontakta oss på .\ +Language BootPromptWindow Språk +Welcome to Haiku! BootPromptWindow Välkommen till Haiku! +Run Installer BootPromptWindow Kör Installationen +Keymap BootPromptWindow Tangentkarta diff --git a/data/catalogs/apps/firstbootprompt/uk.catkeys b/data/catalogs/apps/firstbootprompt/uk.catkeys new file mode 100644 index 0000000000..c7cad64ae0 --- /dev/null +++ b/data/catalogs/apps/firstbootprompt/uk.catkeys @@ -0,0 +1,8 @@ +1 ukrainian x-vnd.Haiku-FirstBootPrompt 2544294242 +Custom BootPromptWindow Задане +Thank you for trying out Haiku! We hope you'll like it!\n\nYou can select your preferred language and keyboard layout from the list on the left which will then be used instantly. You can easily change both settings from the Desktop later on on the fly.\n\nDo you wish to run the Installer or continue booting to the Desktop?\n BootPromptWindow For other languages, a note could be added: \"Note: Localization of Haiku applications and other components is an on-going effort. You will frequently encounter untranslated strings, but if you like, you can join in the work at .\" Дякуємо за ваше зацікавлення Haiku. Ми надіємося що вона Вам сподобається!\n\nВи можете вибрати бажану мову і розкладку клавіатури зі списку зліва при використанні. Ви можете просто змінити обидві настройки Робочого столу на льоту .\n\nDo you wish to run the Installer or continue booting to the Desktop?\n +Desktop (Live-CD) BootPromptWindow Робочий стіл (Live-CD) +Language BootPromptWindow Мова +Welcome to Haiku! BootPromptWindow Ласкаво просимо в Haiku! +Run Installer BootPromptWindow Виконати встановлення +Keymap BootPromptWindow Розкладка diff --git a/data/catalogs/apps/readonlybootprompt/zh-Hans.catkeys b/data/catalogs/apps/firstbootprompt/zh-Hans.catkeys similarity index 95% rename from data/catalogs/apps/readonlybootprompt/zh-Hans.catkeys rename to data/catalogs/apps/firstbootprompt/zh-Hans.catkeys index e5b90ab242..999699fcc1 100644 --- a/data/catalogs/apps/readonlybootprompt/zh-Hans.catkeys +++ b/data/catalogs/apps/firstbootprompt/zh-Hans.catkeys @@ -1,4 +1,4 @@ -1 english x-vnd.Haiku-ReadOnlyBootPrompt 2544294242 +1 english x-vnd.Haiku-FirstBootPrompt 2544294242 Custom BootPromptWindow 自定义 Thank you for trying out Haiku! We hope you'll like it!\n\nYou can select your preferred language and keyboard layout from the list on the left which will then be used instantly. You can easily change both settings from the Desktop later on on the fly.\n\nDo you wish to run the Installer or continue booting to the Desktop?\n BootPromptWindow For other languages, a note could be added: \"Note: Localization of Haiku applications and other components is an on-going effort. You will frequently encounter untranslated strings, but if you like, you can join in the work at .\" 欢迎使用 Haiku!希望喜欢它!\n\n您可以从左边的列表中选择首选语言和键盘类型,它们将马上启用。您可以在进入桌面之后进行修改。\n\n您希望运行系统安装器,还是继续引导进入桌面? Desktop (Live-CD) BootPromptWindow 桌面系统 (Live-CD) diff --git a/data/catalogs/apps/firstbootprompt/zh_Hans.catkeys b/data/catalogs/apps/firstbootprompt/zh_Hans.catkeys new file mode 100644 index 0000000000..999699fcc1 --- /dev/null +++ b/data/catalogs/apps/firstbootprompt/zh_Hans.catkeys @@ -0,0 +1,8 @@ +1 english x-vnd.Haiku-FirstBootPrompt 2544294242 +Custom BootPromptWindow 自定义 +Thank you for trying out Haiku! We hope you'll like it!\n\nYou can select your preferred language and keyboard layout from the list on the left which will then be used instantly. You can easily change both settings from the Desktop later on on the fly.\n\nDo you wish to run the Installer or continue booting to the Desktop?\n BootPromptWindow For other languages, a note could be added: \"Note: Localization of Haiku applications and other components is an on-going effort. You will frequently encounter untranslated strings, but if you like, you can join in the work at .\" 欢迎使用 Haiku!希望喜欢它!\n\n您可以从左边的列表中选择首选语言和键盘类型,它们将马上启用。您可以在进入桌面之后进行修改。\n\n您希望运行系统安装器,还是继续引导进入桌面? +Desktop (Live-CD) BootPromptWindow 桌面系统 (Live-CD) +Language BootPromptWindow 语言 +Welcome to Haiku! BootPromptWindow 欢迎使用 Haiku! +Run Installer BootPromptWindow 运行系统安装器 +Keymap BootPromptWindow 键盘映射 diff --git a/data/catalogs/apps/icon-o-matic/ru.catkeys b/data/catalogs/apps/icon-o-matic/ru.catkeys index 5ab37fa343..e174cbf45c 100644 --- a/data/catalogs/apps/icon-o-matic/ru.catkeys +++ b/data/catalogs/apps/icon-o-matic/ru.catkeys @@ -1,4 +1,4 @@ -1 russian x-vnd.haiku-icon_o_matic 3069426771 +1 russian x-vnd.haiku-icon_o_matic 3933520036 Select All Icon-O-Matic-PathManipulator Выделить всё Add Style Icon-O-Matic-AddStylesCmd Добавить стиль Color (#%02x%02x%02x) Style name after dropping a color Цвет (#%02x%02x%02x) @@ -43,6 +43,7 @@ Untitled Icon-O-Matic-Main Новый значок Multi Set Multi Set (property name) Множество any of the other lists to Empty property list - 2nd line любом другом списке для того, Save as… Icon-O-Matic-Menu-File Сохранить как… +Don't save Icon-O-Matic-Menu-Settings Не сохранять Change Color Icon-O-Matic-SetColorCmd Изменить цвет Style Icon-O-Matic-Menus Стиль Icon-O-Matic-PathCmd <изменить путь> @@ -72,6 +73,7 @@ Undo Icon-O-Matic-Main Отменить Click on a shape above Empty transformers list - 1st line Нажмите на форму выше Add Shape Icon-O-Matic-AddShapesCmd Добавить форму Contour Transformation Обводка +Save changes to current icon before closing? Icon-O-Matic-Menu-Settings Сохранить изменения теущего значка перед закрытием? Icon-O-Matic-Menu-Edit <нечего возвращать> Perspective Transformation Перспектива Move Transformer Icon-O-Matic-MoveTransformersCmd Переместить трансформатор diff --git a/data/catalogs/apps/icon-o-matic/sv.catkeys b/data/catalogs/apps/icon-o-matic/sv.catkeys index 61565290f5..c0e865ee10 100644 --- a/data/catalogs/apps/icon-o-matic/sv.catkeys +++ b/data/catalogs/apps/icon-o-matic/sv.catkeys @@ -1,4 +1,4 @@ -1 swedish x-vnd.haiku-icon_o_matic 3069426771 +1 swedish x-vnd.haiku-icon_o_matic 3933520036 Select All Icon-O-Matic-PathManipulator Markera allt Add Style Icon-O-Matic-AddStylesCmd Lägg till stil Color (#%02x%02x%02x) Style name after dropping a color Färg (#%02x%02x%02x) @@ -43,6 +43,7 @@ Untitled Icon-O-Matic-Main Namnlös Multi Set Multi Set (property name) Mängduppsättning any of the other lists to Empty property list - 2nd line någon av dom andra listorna till Save as… Icon-O-Matic-Menu-File Spara som... +Don't save Icon-O-Matic-Menu-Settings Spara inte Change Color Icon-O-Matic-SetColorCmd Byt färg Style Icon-O-Matic-Menus Stil Icon-O-Matic-PathCmd @@ -72,6 +73,7 @@ Undo Icon-O-Matic-Main Ångra Click on a shape above Empty transformers list - 1st line Klicka på en figur ovan Add Shape Icon-O-Matic-AddShapesCmd Lägg till figur Contour Transformation Kontur +Save changes to current icon before closing? Icon-O-Matic-Menu-Settings Spara ändringarna till ikonen "%s" innan det stängs? Icon-O-Matic-Menu-Edit Perspective Transformation Perspektiv Move Transformer Icon-O-Matic-MoveTransformersCmd Förflyttningsomvandlare diff --git a/data/catalogs/apps/installer/sv.catkeys b/data/catalogs/apps/installer/sv.catkeys index e6c61f955c..ba2d09258a 100644 --- a/data/catalogs/apps/installer/sv.catkeys +++ b/data/catalogs/apps/installer/sv.catkeys @@ -1,4 +1,4 @@ -1 swedish x-vnd.Haiku-Installer 3015727137 +1 swedish x-vnd.Haiku-Installer 3488795908 So behind the other menu entries towards the bottom of the file, add something similar to these lines:\n\n InstallerApp Efter de andra menyposterna mot slutet av filen, lägg till något som liknar dessa rader:\n\n Are you sure you want to abort the installation and restart the system? InstallerWindow Är du säker på att du vill avbryta installationen och starta om systemet \t}\n\n InstallerApp \t}\n\n @@ -109,12 +109,14 @@ NOTE: While the naming strategy for hard disks is still as described under 2.1) Cancel InstallProgress Avbryt Running Boot Manager and DriveSetup…\n\nClose both applications to continue with the installation. InstallerWindow Kör Boot Manager och DriveSetup…\n\nStäng båda programmen för att fortsätta med installationen. Try installing anyway InstallProgress Försök installera iallafall +So below the heading that must not be edited, add something similar to these lines:\n\n InstallerApp Under rubriken ska inte ändras. Lägg till något liknande till dessa rader:\n\n Are you sure you want to to stop the installation? InstallerWindow Är du säker på att du vill stoppa installationen? Onto: InstallerWindow På: Please close the Boot Manager window before closing the Installer window. InstallerWindow Stäng Boot Manager fönstret före du stänger installatione fönstret. 3) When you successfully boot into Haiku for the first time, make sure to read our \"Welcome\" and \"Userguide\" documentation. There are links on the Desktop and in WebPositive's bookmarks.\n\n InstallerApp 3) När du har startat Haiku första gången. Läs gärna våra dokument \"Välkommen\" och \"Användarguid\". Det finns länkar på skrivbordet och i WebPositive's bokmärken.\n\n Tools InstallerWindow Verktyg The mount point could not be retrieved. InstallProgress Monteringspunkt kunde inte läsas av. +The target volume is not empty. Are you sure you want to install anyway?\n\nNote: The 'system' folder will be a clean copy from the source volume, all other folders will be merged, whereas files and links that exist on both the source and target volume will be overwritten with the source volume version. InstallProgress volymen du vill installera till är inte tom. Vill du installera ändå?\n\nNotera: System foldern kommer att tömmas och vara en 'ren' kopia från käll katalogen. Övriga mappar kommer att mergas och de filer och länkar som finns både i källmappen och destinations mappen kommer att skrivas över med källmappen. You can see the correct partition in GParted for example.\n\n\n InstallerApp Du kan se de rätta partionerna i tex GParted.\n\n\n \ttitle\t\t\t\tHaiku\n InstallerApp \t titel\t \t \t \t Haiku\n \tsudo /etc/grub.d/40_custom\n\n InstallerApp \t sudo /etc/grub.d/40_custom\n\n diff --git a/data/catalogs/apps/mail/hu.catkeys b/data/catalogs/apps/mail/hu.catkeys index cf5d68669a..ee41f920be 100644 --- a/data/catalogs/apps/mail/hu.catkeys +++ b/data/catalogs/apps/mail/hu.catkeys @@ -21,7 +21,7 @@ Enclosure: %name% (Type: %type%) Mail Don't translate the variables %name% and % Show icons & labels Mail Ikonok és feliratok Remove attachment Mail Eltávolítás Button bar: Mail Gombsor: -spam B_USER_DIRECTORY/mail/spam spam +spam B_USER_DIRECTORY/mail/spam Levélszemét Beginner Mail Kezdő Don't save Mail Ne mentse Expert Mail Haladó @@ -109,7 +109,7 @@ The mail_daemon is not running. The message is queued and will be sent when the Really delete this signature? This cannot be undone. Mail Biztosan törli az aláírást? Ez nem vonható vissza. Save this message as a draft before closing? Mail Menti ezt az üzenetet piszkozatként bezárás előtt? Open Mail Megnyitás -draft B_USER_DIRECTORY/mail/draft piszkozat +draft B_USER_DIRECTORY/mail/draft Piszkozat Quote Mail Idézet Add Mail Hozzáadás Next message Mail Következő levél diff --git a/data/catalogs/apps/mail/ru.catkeys b/data/catalogs/apps/mail/ru.catkeys index 9a4dc32db0..80cbf54e82 100644 --- a/data/catalogs/apps/mail/ru.catkeys +++ b/data/catalogs/apps/mail/ru.catkeys @@ -1,4 +1,4 @@ -1 russian x-vnd.Be-MAIL 2646020355 +1 russian x-vnd.Be-MAIL 233997769 View Mail Вид %d - Date Mail %d - Дата Attach attributes: Mail Прикрепление атрибутов: @@ -10,6 +10,7 @@ Edit Mail Изменить Print Mail Печать Mail <пусто> New mail message Mail Новое сообщение +Untitled Mail Безымянный Automatic Mail Автоматическая Automatically mark mail as read: Mail Автоматически помечать письмо как прочитанное: helpful message Mail полезное сообщение @@ -106,6 +107,7 @@ Close Mail Закрыть No matches Mail Нет совпадений The mail_daemon is not running. The message is queued and will be sent when the mail_daemon is started. Mail Не запущен mail_daemon. Сообщение поставлено в очередь и будет отправлено как только mail_daemon будет запущен. Really delete this signature? This cannot be undone. Mail Действительно удалить эту подпись? Эту операцию будет невозможно отменить. +Save this message as a draft before closing? Mail Сохранитьэто сообщение в черновики перед закрытием? Open Mail Открыть draft B_USER_DIRECTORY/mail/draft Черновики Quote Mail Цитата @@ -119,6 +121,7 @@ Account: Mail Аккаунт: Decoding: Mail Кодировка: Sorry, could not find an application that supports the 'Person' data type. Mail Извините, не удалось найти приложение поддерживающее тип файлов 'Персона'. Delete Mail Удалить +Don't send Mail Не отправлять Leave as '%s' Mail Оставить как '%s' Copy Mail Копия Mail couldn't find its dictionary. Mail Невозможно найти файл словаря. @@ -133,6 +136,7 @@ Font: Mail Шрифт: (Address unavailable) Mail (Адрес недоступен) Save address Mail Сохранить адрес Queries Mail Запросы +Send this message before closing? Mail Отправить это сообщение перед закрытием? Save Mail Сохранить Random Mail Случайная Close and Mail Закрыть и diff --git a/data/catalogs/apps/mediaconverter/ru.catkeys b/data/catalogs/apps/mediaconverter/ru.catkeys index 0e8b435053..b2f12acf11 100644 --- a/data/catalogs/apps/mediaconverter/ru.catkeys +++ b/data/catalogs/apps/mediaconverter/ru.catkeys @@ -1,9 +1,11 @@ -1 russian x-vnd.Haiku-MediaConverter 2955071341 +1 russian x-vnd.Haiku-MediaConverter 2722282283 Video using parameters form settings MediaConverter Видео использует параметры из настроек Video encoding: MediaConverter Кодирование видео: +Error read audio frame %lld MediaConverter Ошибка чтения аудио кадра %lld No audio Audio codecs list Без аудио Error MediaConverter Ошибка Error loading a file MediaConverter Ошибка при загрузке файла +Error read video frame %lld MediaConverter Ошибка чтения видеокадра %lld File Error MediaConverter-FileInfo Ошибка файла Open… Menu Открыть… Start [ms]: MediaConverter Начало [мс]: @@ -22,6 +24,8 @@ Audio: MediaConverter-FileInfo Аудио: OK MediaConverter-FileInfo ОК seconds MediaFileInfo секунд Source files MediaConverter Исходные файлы +Error writing video frame %lld MediaConverter Ошибка записи видеокадра %lld +Error writing audio frame %lld MediaConverter Ошибка записи аудио кадра %lld Cancelling MediaConverter Отменяется %d byte MediaFileInfo %d байт Error loading files MediaConverter Ошибка при загрузке файлов diff --git a/data/catalogs/apps/mediaconverter/sv.catkeys b/data/catalogs/apps/mediaconverter/sv.catkeys index 19cfd8a106..8bdf20b8df 100644 --- a/data/catalogs/apps/mediaconverter/sv.catkeys +++ b/data/catalogs/apps/mediaconverter/sv.catkeys @@ -1,9 +1,11 @@ -1 swedish x-vnd.Haiku-MediaConverter 2955071341 +1 swedish x-vnd.Haiku-MediaConverter 2722282283 Video using parameters form settings MediaConverter Video med parametrar från inställningar Video encoding: MediaConverter Videokodning: +Error read audio frame %lld MediaConverter Fel vid inläsning av ljudstycke %lld No audio Audio codecs list Inget ljud Error MediaConverter Fel Error loading a file MediaConverter Fel vid inläsning av en fil +Error read video frame %lld MediaConverter Fel vid inläsning av bildruta %lld File Error MediaConverter-FileInfo Filfel Open… Menu Öppna... Start [ms]: MediaConverter Start [ms]: @@ -22,6 +24,8 @@ Audio: MediaConverter-FileInfo Ljud: OK MediaConverter-FileInfo OK seconds MediaFileInfo sekunder Source files MediaConverter Källfiler +Error writing video frame %lld MediaConverter Fel vid skrivande av bildruta %lld +Error writing audio frame %lld MediaConverter Fel vid skrivning av ljudstycke %lld Cancelling MediaConverter Avbryter %d byte MediaFileInfo %d bytes Error loading files MediaConverter Fel vid inläsning av filer diff --git a/data/catalogs/apps/people/ru.catkeys b/data/catalogs/apps/people/ru.catkeys index 7d340e096b..c04c04006e 100644 --- a/data/catalogs/apps/people/ru.catkeys +++ b/data/catalogs/apps/people/ru.catkeys @@ -1,4 +1,4 @@ -1 russian x-vnd.Be-PEPL 3273435274 +1 russian x-vnd.Be-PEPL 2332202134 Edit People Изменить Error People Ошибка City People Город @@ -21,6 +21,7 @@ Nickname People Прозвище Quit People Выход Name People Имя Revert People Вернуть +Don't save People Не сохранять Undo People Отменить E-mail People E-mail Load image… People Выбрать рисунок… @@ -30,6 +31,7 @@ Launching the FileTypes preflet to configure Person attributes has failed.\n\nEr Home phone People Домашний телефон Save as… People Сохранить как… Redo People Отменить +Save changes before closing? People Сохранить изменения перед выходом? Paste People Вставить Drop an image here,\nor use the contextual menu. People Перенесите сюда фотографию\nили используйте контекстное меню. Save People Сохранить diff --git a/data/catalogs/apps/people/sv.catkeys b/data/catalogs/apps/people/sv.catkeys index ea945041d6..b93217bad9 100644 --- a/data/catalogs/apps/people/sv.catkeys +++ b/data/catalogs/apps/people/sv.catkeys @@ -1,4 +1,4 @@ -1 swedish x-vnd.Be-PEPL 3273435274 +1 swedish x-vnd.Be-PEPL 2332202134 Edit People Redigera Error People Fel City People Stad @@ -21,6 +21,7 @@ Nickname People Smeknamn Quit People Avsluta Name People Namn Revert People Återställ +Don't save People Spara inte Undo People Ångra E-mail People E-post Load image… People Välj bild... @@ -30,6 +31,7 @@ Launching the FileTypes preflet to configure Person attributes has failed.\n\nEr Home phone People Hemtelefon Save as… People Spara som... Redo People Gör om +Save changes before closing? People Spara ändringar innan avslut? Paste People Klistra in Drop an image here,\nor use the contextual menu. People Släpp en bild här,\neller använd högerklicksmenyn. Save People Spara diff --git a/data/catalogs/apps/readonlybootprompt/hu.catkeys b/data/catalogs/apps/readonlybootprompt/hu.catkeys index 24595b9c0a..125fcca6c5 100644 --- a/data/catalogs/apps/readonlybootprompt/hu.catkeys +++ b/data/catalogs/apps/readonlybootprompt/hu.catkeys @@ -1,8 +1,8 @@ 1 hungarian x-vnd.Haiku-ReadOnlyBootPrompt 2544294242 Custom BootPromptWindow Egyéni -Thank you for trying out Haiku! We hope you'll like it!\n\nYou can select your preferred language and keyboard layout from the list on the left which will then be used instantly. You can easily change both settings from the Desktop later on on the fly.\n\nDo you wish to run the Installer or continue booting to the Desktop?\n BootPromptWindow For other languages, a note could be added: \"Note: Localization of Haiku applications and other components is an on-going effort. You will frequently encounter untranslated strings, but if you like, you can join in the work at .\" Köszönjük, hogy kipróbálja a Haiku-t! Reméljük tetszeni fog!\n\nA baloldali listából választhat nyelvet és billentyűzetkiosztást. Mindkét beállítást könnyen átállíthatja majd később az Asztalról.\n\nA Telepítőt vagy az Asztalt indítsuk el most?\n\nMegjegyzés: A Haiku programjait önkéntesek fordítják, folyamatosan. Könnyen megeshet hogy hiányosan, vagy hibásan fordított programokkal fog találkozni. Ha szeretné, csatlakozhat a munkához és kijavíthatja ezeket a oldalon. Köszönjük! +Thank you for trying out Haiku! We hope you'll like it!\n\nYou can select your preferred language and keyboard layout from the list on the left which will then be used instantly. You can easily change both settings from the Desktop later on on the fly.\n\nDo you wish to run the Installer or continue booting to the Desktop?\n BootPromptWindow For other languages, a note could be added: \"Note: Localization of Haiku applications and other components is an on-going effort. You will frequently encounter untranslated strings, but if you like, you can join in the work at .\" Köszönjük, hogy kipróbálja a Haiku-t!\n\nA baloldali listából választhat nyelvet és billentyűzetkiosztást. Mindkét beállítást könnyen átállíthatja majd később az Asztalról.\n\nA Telepítőt vagy az Asztalt indítsuk most el?\n\nMegjegyzés: A Haiku programjait önkéntesek fordítják, folyamatosan. Könnyen megeshet hogy hiányosan, vagy hibásan fordított programokkal fog találkozni. Ha szeretné, csatlakozhat a munkához és kijavíthatja ezeket a oldalon. Köszönjük! Desktop (Live-CD) BootPromptWindow Asztal Language BootPromptWindow Nyelv Welcome to Haiku! BootPromptWindow A Haiku üdvözli Önt! -Run Installer BootPromptWindow Telepítés +Run Installer BootPromptWindow Telepítő Keymap BootPromptWindow Billentyűzetkiosztás diff --git a/data/catalogs/apps/stylededit/ja.catkeys b/data/catalogs/apps/stylededit/ja.catkeys index 962f357cb8..139d5ad999 100644 --- a/data/catalogs/apps/stylededit/ja.catkeys +++ b/data/catalogs/apps/stylededit/ja.catkeys @@ -1,10 +1,11 @@ -1 japanese x-vnd.Haiku-StyledEdit 2434449144 +1 japanese x-vnd.Haiku-StyledEdit 3208803155 StyledEdit System name StyledEdit This file is marked read-only. Save changes to the document \"%s\"? SaveAlert このファイルは読み取り専用です。変更を\"%s\"ドキュメントに保存しますか? Paste Menus 貼り付け OK LoadAlert OK File Menus ファイル ??? LoadAlert ??? +Modified StatusView 変更あり Lines: Statistics 行数: Italic Menus イタリック Left Menus 左揃え diff --git a/data/catalogs/apps/stylededit/ru.catkeys b/data/catalogs/apps/stylededit/ru.catkeys index f7b027fa81..c135065b24 100644 --- a/data/catalogs/apps/stylededit/ru.catkeys +++ b/data/catalogs/apps/stylededit/ru.catkeys @@ -1,13 +1,16 @@ -1 russian x-vnd.Haiku-StyledEdit 3117187160 +1 russian x-vnd.Haiku-StyledEdit 3208803155 StyledEdit System name Стильный редактор +This file is marked read-only. Save changes to the document \"%s\"? SaveAlert Этот файл отмечен только для чтения. Сохранить изменения в документе \"%s\"? Paste Menus Вставить OK LoadAlert ОК File Menus Файл ??? LoadAlert ??? +Modified StatusView Изменён Lines: Statistics Строк: Italic Menus Наклонный Left Menus По левому краю Search backwards FindandReplaceWindow Искать снизу вверх +Unlock file StatusView Разблокировать Size Menus Размер Save QuitAlert Сохранить Page setup… Menus Настройка печати… @@ -19,21 +22,27 @@ Cancel SaveAlert Отмена Cannot revert, file not found: \"%s\". RevertToSavedAlert Невозможно вернуть, файл не найден: \"%s\". Case-sensitive FindandReplaceWindow Учитывать регистр Green Menus Зеленый +Reload NodeMonitorAlerts Перезагрузить Yellow Menus Желтый Replace in all windows FindandReplaceWindow Заменить во всех окнах Wrap lines Menus Перенос строк Quit Menus Выход +File \"%file%\" was removed by another application, recover it? NodeMonitorAlerts Файл \"%file%\" был удален другой программой, восстановить его? Document statistics Statistics Статистика документа Cancel RevertToSavedAlert Отмена +Autodetect Menus Автоопределение Document Menus Документ Save changes to the document \"%s\"? QuitAlert Сохранить изменения в файле \"%s\"? Edit Menus Изменить +Revert RevertToSavedAlert Вернуть Font Menus Шрифт Replace all FindandReplaceWindow Заменить все Statistics… Menus Статистика… Default Open_and_SaveAsPanel По умолчанию Replace next Menus Заменить далее +\"%s\" has unsaved changes.\nRevert it to the last saved version? RevertToSavedAlert \"%s\" имеет несохраненные изменения.\nВернуться его до последней сохраненной версии? Cancel FindandReplaceWindow Отмена +Text encoding Menus Кодировка Close Menus Закрыть Save SaveAlert Сохранить Words: Statistics Слов: @@ -43,10 +52,13 @@ Don't save QuitAlert Не сохранять Align Menus Выровнять Color Menus Цвет Red Menus Красный +OK QuitAlert ОК Open… Menus Открыть… Center Menus По центру Blue Menus Синий +Unable to unlock file\n\t%s QuitAlert Невозможно разблокировать файл\n\t%s Cyan Menus Бирюзовый +line %d, column %d StatusView линия %d, позиция %d OK Statistics ОК Magenta Menus Пурпурный New Menus Новый @@ -57,13 +69,17 @@ Find: FindandReplaceWindow Найти: Error saving \"%s\":\n%s SaveAlert Ошибка сохранения \"%s\":\n%s Copy Menus Копировать Cut Menus Вырезать +File \"%file%\" was modified by another application, reload it? NodeMonitorAlerts Файл \"%file%\" был изменен другой программой, перезагрузить его? Replace FindandReplaceWindow Заменить Find again Menus Найти далее Cancel QuitAlert Отмена Find… Menus Найти… Select all Menus Выделить всё Don't save SaveAlert Не сохранять +Recover NodeMonitorAlerts Восстановить Error loading \"%s\":\n\t%s LoadAlert Ошибка загрузки \"%s\":\n\t%s +Ignore NodeMonitorAlerts Игнорировать +Read-only StatusView Только чтение Undo typing QuitAlert Отменить ввод Black Menus Черный Untitled StyledEditWindow Новый документ @@ -73,5 +89,6 @@ Encoding Open_and_SaveAsPanel Кодировка Characters: Statistics Символов: Save as… Menus Сохранить как… Redo typing QuitAlert Повторить ввод +Reload… Menus Перезагрузить… Replace… Menus Заменить… Right Menus По правому краю diff --git a/data/catalogs/apps/stylededit/sv.catkeys b/data/catalogs/apps/stylededit/sv.catkeys index 0b28bbfa8e..eb5f64cedb 100644 --- a/data/catalogs/apps/stylededit/sv.catkeys +++ b/data/catalogs/apps/stylededit/sv.catkeys @@ -1,13 +1,16 @@ -1 swedish x-vnd.Haiku-StyledEdit 894766086 +1 swedish x-vnd.Haiku-StyledEdit 3208803155 StyledEdit System name SkrivStiligt +This file is marked read-only. Save changes to the document \"%s\"? SaveAlert Denna fil är markerad som endast läsbar. Vill du spara ändringarna till dokumentet \"%s\"? Paste Menus Klistra in OK LoadAlert OK File Menus Arkiv ??? LoadAlert ??? +Modified StatusView Ändrad Lines: Statistics Rader: Italic Menus Kursiv Left Menus Vänster Search backwards FindandReplaceWindow Sök bakåt +Unlock file StatusView Låsupp fil Size Menus Storlek Save QuitAlert Spara Page setup… Menus Sidinställningar... @@ -31,6 +34,7 @@ Autodetect Menus Identifiera automatiskt Document Menus Dokument Save changes to the document \"%s\"? QuitAlert Spara ändringar till dokumentet "%s"? Edit Menus Redigera +Revert RevertToSavedAlert Återställ Font Menus Font Replace all FindandReplaceWindow Ersätt alla Statistics… Menus Statistik... @@ -48,10 +52,13 @@ Don't save QuitAlert Spara inte Align Menus Justera Color Menus Färg Red Menus Röd +OK QuitAlert OK Open… Menus Öppna… Center Menus Mitten Blue Menus Blå +Unable to unlock file\n\t%s QuitAlert Kan inte låsaupp fil\n\t %s Cyan Menus Cyan +line %d, column %d StatusView rad %d, kolumn %d OK Statistics OK Magenta Menus Magenta New Menus Ny @@ -72,6 +79,7 @@ Don't save SaveAlert Spara inte Recover NodeMonitorAlerts Återskapa Error loading \"%s\":\n\t%s LoadAlert Fel vid inläsning "%s":\n\t%s Ignore NodeMonitorAlerts Ignorera +Read-only StatusView Skrivskyddad Undo typing QuitAlert Ångra inmatning Black Menus Svart Untitled StyledEditWindow Namnlös diff --git a/data/catalogs/apps/terminal/ru.catkeys b/data/catalogs/apps/terminal/ru.catkeys index 6b29a0c641..57eb2a308f 100644 --- a/data/catalogs/apps/terminal/ru.catkeys +++ b/data/catalogs/apps/terminal/ru.catkeys @@ -1,7 +1,9 @@ -1 russian x-vnd.Haiku-Terminal 2912171349 +1 russian x-vnd.Haiku-Terminal 3561344903 Not found. Terminal TermWindow Текст не найден Switch Terminals Terminal TermWindow Переключить терминалы Change directory Terminal TermView Сменить каталог +Cursor Terminal AppearancePrefView Курсор +Professional Terminal colors scheme Профессионал OK Terminal TermWindow ОК New Terminal Terminal TermWindow Новый терминал Terminal couldn't start the shell. Sorry. Terminal TermApp Терминал не смог запустить оболочку. Простите. @@ -19,8 +21,11 @@ Font: Terminal AppearancePrefView Шрифт: Copy here Terminal TermView Копировать сюда Really close? Terminal TermWindow Действительно закрыть? Copy Terminal TermWindow Копировать +Color scheme: Terminal AppearancePrefView Цветовая схема: Window title: Terminal TermWindow Заголовок окна: Unrecognized option \"%s\"\n Terminal arguments parsing Нераспознанная опция \"%s\"\n +Blue Terminal colors scheme Синий +Custom Terminal colors scheme Настроена вручную %app% settings Terminal PrefWindow window title Настройки терминала Cancel Terminal SetTitleWindow Отмена Increase Terminal TermWindow Увеличить @@ -44,6 +49,8 @@ The following processes are still running:\n\n\t%1\n\nIf you close the Terminal, Insert path Terminal TermView Вставить путь Haiku Terminal\nCopyright 2001-2009 Haiku, Inc.\nCopyright(C) 1999 Kazuho Okui and Takashi Murai.\n\nUsage: %s [OPTION] [SHELL]\n Terminal TermApp Haiku Терминал\nCopyright 2001-2009 Haiku, Inc.\nCopyright(C) 1999 Kazuho Okui and Takashi Murai.\n\nИспользование: %s [OPTION] [SHELL]\n No search string was entered. Terminal TermWindow Не введена строка поиска +Font size Terminal TermWindow Размер шрифта +Blinking cursor Terminal AppearancePrefView Мигающий курсор Don't save Terminal PrefWindow Не сохранять Set window title Terminal TermWindow Установить заголовок окна Terminal System name Терминал @@ -55,11 +62,16 @@ Find… Terminal TermWindow Найти… The process \"%1\" is still running.\nIf you close the Terminal, the process will be killed. Terminal TermWindow Процесс \"%1\" все еще работает.\nЕсли вы закроете Терминал, то этот процесс будет уничтожен. Move here Terminal TermView Переместить сюда \t%d\t-\tThe current working directory of the active process in the\n\t\t\tcurrent tab. Optionally the maximum number of path components\n\t\t\tcan be specified. E.g. '%2d' for at most two components.\n\t%i\t-\tThe index of the window.\n\t%p\t-\tThe name of the active process in the current tab.\n\t%t\t-\tThe title of the current tab.\n\t%%\t-\tThe character '%'. Terminal ToolTips \t%d\t-\tТекущая директория активного процесса текущей вкладки.\n\t\t\tОпционально можно указать максимальное число отображаемых компонентов пути.\n\t\t\tНапример '%2d' отобразит последние 2 компонента.\n\t%i\t-\tНомер окна.\n\t%p\t-\tНазвание активного процесса в текущей вкладке.\n\t%t\t-\tЗаголовок текущей вкладки.\n\t%%\t-\tСимвол процента - '%'. +Retro Terminal colors scheme Ретро Error! Terminal getString Ошибка! New tab Terminal TermWindow Новая вкладка The pattern specifying the tab titles. The following placeholders\ncan be used:\n Terminal AppearancePrefView Этот шаблон описывает заголовки вкладок.\nВозможно использовать следующие переменные:\n Selected background Terminal AppearancePrefView Выделенного фона +Slate Terminal colors scheme Шифер +Text under cursor Terminal AppearancePrefView Текст под под курсором +Midnight Terminal colors scheme Полночь Decrease Terminal TermWindow Уменьшить +Default Terminal colors scheme По умолчанию Create link here Terminal TermView Создать ссылку здесь Close Terminal TermWindow Закрыть Text Terminal AppearancePrefView Текста diff --git a/data/catalogs/apps/terminal/sv.catkeys b/data/catalogs/apps/terminal/sv.catkeys index bb72461a42..2f0c2b0a71 100644 --- a/data/catalogs/apps/terminal/sv.catkeys +++ b/data/catalogs/apps/terminal/sv.catkeys @@ -1,4 +1,4 @@ -1 swedish x-vnd.Haiku-Terminal 2178478404 +1 swedish x-vnd.Haiku-Terminal 3561344903 Not found. Terminal TermWindow Hittades ej. Switch Terminals Terminal TermWindow Växla terminal Change directory Terminal TermView Byt katalog @@ -67,6 +67,7 @@ Error! Terminal getString Fel! New tab Terminal TermWindow Ny flik The pattern specifying the tab titles. The following placeholders\ncan be used:\n Terminal AppearancePrefView Mönstret bestämmer namn på flikar. Följande alternativ finns:\n Selected background Terminal AppearancePrefView Vald bakgrund +Slate Terminal colors scheme Slate Text under cursor Terminal AppearancePrefView Text under markören Midnight Terminal colors scheme Midnatt Decrease Terminal TermWindow Minska diff --git a/data/catalogs/kits/tracker/be.catkeys b/data/catalogs/kits/tracker/be.catkeys index bbea15998d..8314ff27d6 100644 --- a/data/catalogs/kits/tracker/be.catkeys +++ b/data/catalogs/kits/tracker/be.catkeys @@ -1,4 +1,4 @@ -1 belarusian x-vnd.Haiku-libtracker 3779634732 +1 belarusian x-vnd.Haiku-libtracker 2580969822 common B_COMMON_DIRECTORY агульны OK WidgetAttributeText ОК Icon view VolumeWindow Від іконак @@ -81,6 +81,7 @@ Decrease size DeskWindow Паменшыць памер Size ContainerWindow Памер All disks AutoMounterSettings Усе дыскі Would you like to find some other suitable application? FSUtils Жадаеце пашукаць іншую падыходзячую праграму? +Ask before deleting for good SettingsView Спытаць перад выдаленнем Finish: %time - %finishtime left StatusWindow Завяршэнне: %time - засталося %finishtime Could not open \"%document\" with application \"%app\" (Missing libraries: %library). \n FSUtils Немагчыма адкрыць \"%document\" праграмай \"%app\" (Не хапае: %library). \n no items CountView няма элементаў @@ -101,6 +102,7 @@ New folder FilePanelPriv Новы каталог %name info InfoWindow InfoWindow Title %name інфа Favorites FavoritesMenu Выбранае Add-ons VolumeWindow Дапаўненні +Move deleted files to Trash first SettingsView Перасунуць выдаленыя файлы спярша ў Сметніцу Sorry, you can't copy items to the Trash. PoseView Прабачце, вы не можаце капіяваць элементы ў Сметніцу. List view VolumeWindow Від спісу matches wildcard expression SelectionWindow супадае з падстановачнымі выразамі diff --git a/data/catalogs/kits/tracker/sv.catkeys b/data/catalogs/kits/tracker/sv.catkeys index e6c168f23d..587f374c85 100644 --- a/data/catalogs/kits/tracker/sv.catkeys +++ b/data/catalogs/kits/tracker/sv.catkeys @@ -1,4 +1,4 @@ -1 swedish x-vnd.Haiku-libtracker 3779634732 +1 swedish x-vnd.Haiku-libtracker 2580969822 common B_COMMON_DIRECTORY gemensam OK WidgetAttributeText OK Icon view VolumeWindow Ikonvy @@ -81,6 +81,7 @@ Decrease size DeskWindow Minska storleken Size ContainerWindow Storlek All disks AutoMounterSettings Alla diskar Would you like to find some other suitable application? FSUtils Vill du söka efter ett annat program? +Ask before deleting for good SettingsView Fråga innan det tasbort permanent Finish: %time - %finishtime left StatusWindow Klar: %time - %finishtime kvar Could not open \"%document\" with application \"%app\" (Missing libraries: %library). \n FSUtils Kunde inte öppna "%document" med programmet "%app" (Saknar bibliotek: %library). \n no items CountView inga objekt @@ -101,6 +102,7 @@ New folder FilePanelPriv Ny mapp %name info InfoWindow InfoWindow Title %name information Favorites FavoritesMenu Favoriter Add-ons VolumeWindow Tillägg +Move deleted files to Trash first SettingsView Flytta borttagna filer till papperskorgen först Sorry, you can't copy items to the Trash. PoseView Du kan inte kopiera filer till Papperskorgen. List view VolumeWindow Listvy matches wildcard expression SelectionWindow matchar jokeruttryck diff --git a/data/catalogs/preferences/appearance/ru.catkeys b/data/catalogs/preferences/appearance/ru.catkeys index ec815655f2..3b571e4a7a 100644 --- a/data/catalogs/preferences/appearance/ru.catkeys +++ b/data/catalogs/preferences/appearance/ru.catkeys @@ -1,4 +1,4 @@ -1 russian x-vnd.Haiku-Appearance 1428480647 +1 russian x-vnd.Haiku-Appearance 3266657197 Plain font: Font view Простой шрифт: Control highlight Colors tab Подсветка элемента Control border Colors tab Граница элемента @@ -23,7 +23,9 @@ Tooltip background Colors tab Фон подсказки Selected menu item background Colors tab Фон выбранного пункта меню Antialiasing APRWindow Сглаживание Navigation base Colors tab Основа навигации +Selected list item text Colors tab Текст выделенного пункта меню Window border Colors tab Рамка окна +Double: DecorSettingsView Двойной: Window tab text Colors tab Текст заголовка окна Document text Colors tab Текст документа Navigation pulse Colors tab Навигационная пульсация diff --git a/data/catalogs/preferences/filetypes/sv.catkeys b/data/catalogs/preferences/filetypes/sv.catkeys index dd569e8a51..17ae257f71 100644 --- a/data/catalogs/preferences/filetypes/sv.catkeys +++ b/data/catalogs/preferences/filetypes/sv.catkeys @@ -1,4 +1,4 @@ -1 swedish x-vnd.Haiku-FileTypes 1059171929 +1 swedish x-vnd.Haiku-FileTypes 133192727 Application types… FileTypes Window Programtyper... Description: Application Types Window Beskrivning: Args only Application Type Window Endast argument @@ -49,6 +49,8 @@ Group name: New File Type Window Gruppnamn: Preferred application FileType Window Förvalt program Progress Application Types Window Fortskridning: Set preferred application Preferred App Menu Välj förinställt program +Don't save Application Type Window Spara inte +Save changes before closing? Application Type Window Spara ändringar innan programmet avslutas? File Application Type Window Arkiv Version: Application Type Window Version: Select… FileTypes Window Välj... diff --git a/data/catalogs/preferences/shortcuts/be.catkeys b/data/catalogs/preferences/shortcuts/be.catkeys index 85fd759c62..4e2c5f0177 100644 --- a/data/catalogs/preferences/shortcuts/be.catkeys +++ b/data/catalogs/preferences/shortcuts/be.catkeys @@ -1,4 +1,4 @@ -1 belarusian x-vnd.Haiku-Shortcuts 3661393357 +1 belarusian x-vnd.Haiku-Shortcuts 341885426 Error, NULL state description?\n ShortcutsSpec Памылка, апісанне стану NULL?\n MoveMouse ShortcutsSpec РухацьМыш OK ShortcutsWindow ОК @@ -15,12 +15,12 @@ Alt ShortcutsSpec Name for modifier on keyboard Alt *InsertString \"Your Text Here\" ShortcutsWindow *УставіцьСтраку \"Ваш Тэкст\" *MouseUp ShortcutsWindow *МышУверх (Choose application with file requester) ShortcutsWindow (Выберыце праграму, якая патрабуе выбара файлу) -Window ShortcutsSpec Name for modifier on keyboard Window *LaunchHandler text/html ShortcutsWindow *АпрацоўшчыкЗапуску text/html Shortcuts was couldn't open your KeySet file! ShortcutsWindow Рэдактар Гарачых Клавішаў не змог адкрыць ваш файл KeySet! *Multi \"*MoveMouseTo 100% 0\" \"*MouseButton 1\" ShortcutsWindow *Множнае \"*РухацьМышДа 100% 0\" \"*КнопкаМышы 1\" SendMessage ShortcutsSpec АдаслацьПаведамленне MoveMouseTo ShortcutsSpec РухацьМышДа +Option ShortcutsSpec Name for modifier on keyboard Параметр Save ShortcutsWindow Захаваць *MouseButton 1 ShortcutsWindow *КнопкаМышы 1 *MoveMouse +20 +0 ShortcutsWindow *РухацьМыш +20 +0 diff --git a/data/catalogs/preferences/shortcuts/de.catkeys b/data/catalogs/preferences/shortcuts/de.catkeys index 5c23a24f85..deff86116c 100644 --- a/data/catalogs/preferences/shortcuts/de.catkeys +++ b/data/catalogs/preferences/shortcuts/de.catkeys @@ -1,4 +1,4 @@ -1 german x-vnd.Haiku-Shortcuts 3661393357 +1 german x-vnd.Haiku-Shortcuts 341885426 Error, NULL state description?\n ShortcutsSpec Fehler, NULL Status Beschreibung?\n MoveMouse ShortcutsSpec Bewege Maus OK ShortcutsWindow OK @@ -15,12 +15,12 @@ Alt ShortcutsSpec Name for modifier on keyboard Alt *InsertString \"Your Text Here\" ShortcutsWindow *Zeichen einfügen \"Hier der Text\" *MouseUp ShortcutsWindow *Maustaste losgelassen (Choose application with file requester) ShortcutsWindow (Eine Anwendung per Datei-Dialog wählen) -Window ShortcutsSpec Name for modifier on keyboard Windows *LaunchHandler text/html ShortcutsWindow *LaunchHandler text/html Shortcuts was couldn't open your KeySet file! ShortcutsWindow Die Tastenbelegungsdatei konnte nicht geladen werden. *Multi \"*MoveMouseTo 100% 0\" \"*MouseButton 1\" ShortcutsWindow Maus nach oben ins linke Eck und Maustaste 1 drücken SendMessage ShortcutsSpec Nachricht senden MoveMouseTo ShortcutsSpec Bewege Maus nach +Option ShortcutsSpec Name for modifier on keyboard Option Save ShortcutsWindow Speichern *MouseButton 1 ShortcutsWindow *Maustaste 1 drücken *MoveMouse +20 +0 ShortcutsWindow *Maus 20 Pixel nach rechts bewegen diff --git a/data/catalogs/preferences/shortcuts/el.catkeys b/data/catalogs/preferences/shortcuts/el.catkeys index f51fb62691..bbc7eb34b8 100644 --- a/data/catalogs/preferences/shortcuts/el.catkeys +++ b/data/catalogs/preferences/shortcuts/el.catkeys @@ -1,4 +1,4 @@ -1 greek, modern (1453-) x-vnd.Haiku-Shortcuts 1741147146 +1 greek, modern (1453-) x-vnd.Haiku-Shortcuts 1477375596 Error, NULL state description?\n ShortcutsSpec Σφάλμα, ΚΕΝΗ αναφορά περιγραφής;\n MoveMouse ShortcutsSpec Μετακίνηση Ποντικιού OK ShortcutsWindow Εντάξει @@ -15,7 +15,6 @@ Alt ShortcutsSpec Name for modifier on keyboard Alt *InsertString \"Your Text Here\" ShortcutsWindow *Εισάγετε συμβολοσεια \"Το Κείμενο σας Εδώ\" *MouseUp ShortcutsWindow *Ποντίκι Επάνω (Choose application with file requester) ShortcutsWindow (Επιλέξτε εφαρμογή με τον file requester) -Window ShortcutsSpec Name for modifier on keyboard Παράθυρο *LaunchHandler text/html ShortcutsWindow *LaunchHandler text/html Shortcuts was couldn't open your KeySet file! ShortcutsWindow Το Shortcuts δε μπόρεσε να ανοίξει το αρχείο του σετ πλήκτρων! *Multi \"*MoveMouseTo 100% 0\" \"*MouseButton 1\" ShortcutsWindow *Πολλαπλό \"*Μετακίνηση ποντικιού σε 100% 0\" \"*Πλήκτρο ποντικιού 1\" diff --git a/data/catalogs/preferences/shortcuts/fi.catkeys b/data/catalogs/preferences/shortcuts/fi.catkeys index 1beae11c36..76741a339d 100644 --- a/data/catalogs/preferences/shortcuts/fi.catkeys +++ b/data/catalogs/preferences/shortcuts/fi.catkeys @@ -1,4 +1,4 @@ -1 finnish x-vnd.Haiku-Shortcuts 3661393357 +1 finnish x-vnd.Haiku-Shortcuts 3397621807 Error, NULL state description?\n ShortcutsSpec Virhe, NULL-tilakuvaus?\n MoveMouse ShortcutsSpec SiirräHiirtä OK ShortcutsWindow Valmis @@ -15,7 +15,6 @@ Alt ShortcutsSpec Name for modifier on keyboard Alt-painike *InsertString \"Your Text Here\" ShortcutsWindow *Lisää merkkijono ”Tekstisi tänne” *MouseUp ShortcutsWindow *HiiriYlös (Choose application with file requester) ShortcutsWindow (Valitse sovellus tiedostohakijalla) -Window ShortcutsSpec Name for modifier on keyboard Ikkuna *LaunchHandler text/html ShortcutsWindow *Käynnistyskäsittelijä text/html Shortcuts was couldn't open your KeySet file! ShortcutsWindow Pikanäppäinasetukset ei kyennyt avaamaan KeySet-tiedostoa! *Multi \"*MoveMouseTo 100% 0\" \"*MouseButton 1\" ShortcutsWindow *Moni ”*SiirräHiiriKohteeseen 100% 0” ”*Hiiripainike 1” diff --git a/data/catalogs/preferences/shortcuts/fr.catkeys b/data/catalogs/preferences/shortcuts/fr.catkeys index 667787f5c8..0c6ebaff23 100644 --- a/data/catalogs/preferences/shortcuts/fr.catkeys +++ b/data/catalogs/preferences/shortcuts/fr.catkeys @@ -1,4 +1,4 @@ -1 french x-vnd.Haiku-Shortcuts 3661393357 +1 french x-vnd.Haiku-Shortcuts 3397621807 Error, NULL state description?\n ShortcutsSpec Erreur : description d'état NULL ?\n MoveMouse ShortcutsSpec BougerSouris OK ShortcutsWindow OK @@ -15,7 +15,6 @@ Alt ShortcutsSpec Name for modifier on keyboard Alt *InsertString \"Your Text Here\" ShortcutsWindow *InsérerTexte « votre texte ici » *MouseUp ShortcutsWindow *SourisEnHaut (Choose application with file requester) ShortcutsWindow (Choisissez une application avec une requête de fichier) -Window ShortcutsSpec Name for modifier on keyboard Fenêtre *LaunchHandler text/html ShortcutsWindow *GestionnaireDeLancement text/html Shortcuts was couldn't open your KeySet file! ShortcutsWindow Raccourcis n'a pas pu ouvrir le fichier de jeu de touches ! *Multi \"*MoveMouseTo 100% 0\" \"*MouseButton 1\" ShortcutsWindow *Multi « *BougerSourisEn 100% 0 » « *BoutonSouris 1 » diff --git a/data/catalogs/preferences/shortcuts/hi.catkeys b/data/catalogs/preferences/shortcuts/hi.catkeys index 087fa754e6..73837f020b 100644 --- a/data/catalogs/preferences/shortcuts/hi.catkeys +++ b/data/catalogs/preferences/shortcuts/hi.catkeys @@ -1,4 +1,4 @@ -1 hindi x-vnd.Haiku-Shortcuts 1741147146 +1 hindi x-vnd.Haiku-Shortcuts 1477375596 Error, NULL state description?\n ShortcutsSpec त्रुटि, नल स्थिति का विवरण?\n MoveMouse ShortcutsSpec माउस को हिलाएँ OK ShortcutsWindow ठीक है @@ -15,7 +15,6 @@ Alt ShortcutsSpec Name for modifier on keyboard ऑल्ट *InsertString \"Your Text Here\" ShortcutsWindow *स्ट्रिंग डालें \"Your Text Here\" *MouseUp ShortcutsWindow *माउसअप (Choose application with file requester) ShortcutsWindow (फ़ाइल रिक्वेस्टर साथ आवेदन चुनें) -Window ShortcutsSpec Name for modifier on keyboard विंडों *LaunchHandler text/html ShortcutsWindow *लांचहैंडलर टेक्स्ट/एचटीएमएल Shortcuts was couldn't open your KeySet file! ShortcutsWindow शॉर्टकट्स आपके कीसेट फ़ाइल नहीं खोल सकता था! *Multi \"*MoveMouseTo 100% 0\" \"*MouseButton 1\" ShortcutsWindow *बहु\"*MoveMouseTo 100% 0\" \"*MouseButton 1\" diff --git a/data/catalogs/preferences/shortcuts/hu.catkeys b/data/catalogs/preferences/shortcuts/hu.catkeys index b3de8f2d6d..a5bb8a1ca3 100644 --- a/data/catalogs/preferences/shortcuts/hu.catkeys +++ b/data/catalogs/preferences/shortcuts/hu.catkeys @@ -1,4 +1,4 @@ -1 hungarian x-vnd.Haiku-Shortcuts 3661393357 +1 hungarian x-vnd.Haiku-Shortcuts 341885426 Error, NULL state description?\n ShortcutsSpec Hiba, NULL állapotleírás?\n MoveMouse ShortcutsSpec EgérMozgatás OK ShortcutsWindow Rendben @@ -15,12 +15,12 @@ Alt ShortcutsSpec Name for modifier on keyboard Alt *InsertString \"Your Text Here\" ShortcutsWindow *KarakterekBeszúrása \"Ide írja a szöveget\" *MouseUp ShortcutsWindow *EgérFel (Choose application with file requester) ShortcutsWindow (A fájlkérővel válasszon programot) -Window ShortcutsSpec Name for modifier on keyboard Win *LaunchHandler text/html ShortcutsWindow *Indítás text/html Shortcuts was couldn't open your KeySet file! ShortcutsWindow A Parancsgombok nem tudta megnyitni a beállításfájlját! *Multi \"*MoveMouseTo 100% 0\" \"*MouseButton 1\" ShortcutsWindow *Multi \"*EgérMozgatásIde 100% 0\" \"*EgérGomb 1\" SendMessage ShortcutsSpec ÜzenetKüldés MoveMouseTo ShortcutsSpec EgérMozgatásIde +Option ShortcutsSpec Name for modifier on keyboard Opció Save ShortcutsWindow Mentés *MouseButton 1 ShortcutsWindow *EgérGomb 1 *MoveMouse +20 +0 ShortcutsWindow *EgérMozgatás +20 +0 diff --git a/data/catalogs/preferences/shortcuts/ja.catkeys b/data/catalogs/preferences/shortcuts/ja.catkeys index b57abaa485..be99ce927a 100644 --- a/data/catalogs/preferences/shortcuts/ja.catkeys +++ b/data/catalogs/preferences/shortcuts/ja.catkeys @@ -1,4 +1,4 @@ -1 japanese x-vnd.Haiku-Shortcuts 3661393357 +1 japanese x-vnd.Haiku-Shortcuts 341885426 Error, NULL state description?\n ShortcutsSpec エラー、記述がありません?\n MoveMouse ShortcutsSpec MoveMouse OK ShortcutsWindow OK @@ -15,12 +15,12 @@ Alt ShortcutsSpec Name for modifier on keyboard Alt *InsertString \"Your Text Here\" ShortcutsWindow *InsertString \"テキストをここに\" *MouseUp ShortcutsWindow *MouseUp (Choose application with file requester) ShortcutsWindow (ファイルリクエスタと共にアプリケーションを選択) -Window ShortcutsSpec Name for modifier on keyboard Window *LaunchHandler text/html ShortcutsWindow *LaunchHandler text/html Shortcuts was couldn't open your KeySet file! ShortcutsWindow キーセットファイルを開けませんでした! *Multi \"*MoveMouseTo 100% 0\" \"*MouseButton 1\" ShortcutsWindow *Multi \"*MoveMouseTo 100% 0\" \"*MouseButton 1\" SendMessage ShortcutsSpec SendMessage MoveMouseTo ShortcutsSpec MoveMouseTo +Option ShortcutsSpec Name for modifier on keyboard オプション Save ShortcutsWindow 保存 *MouseButton 1 ShortcutsWindow *MouseButton 1 *MoveMouse +20 +0 ShortcutsWindow *MoveMouse +20 +0 diff --git a/data/catalogs/preferences/shortcuts/lt.catkeys b/data/catalogs/preferences/shortcuts/lt.catkeys index a74963b330..160f6fb565 100644 --- a/data/catalogs/preferences/shortcuts/lt.catkeys +++ b/data/catalogs/preferences/shortcuts/lt.catkeys @@ -1,4 +1,4 @@ -1 lithuanian x-vnd.Haiku-Shortcuts 1963206485 +1 lithuanian x-vnd.Haiku-Shortcuts 1699434935 Error, NULL state description?\n ShortcutsSpec Klaida. Neapibrėžta būsena?\n OK ShortcutsWindow Gerai Shortcuts wasn't able to save your keyset. ShortcutsWindow Sparčiųjų klavišų rinkinio įrašyti nepavyko. @@ -10,7 +10,6 @@ Open KeySet… ShortcutsWindow Atverti sparčiųjų klavišų rinkinį… Revert to saved ShortcutsWindow Grįžti prie įrašyto Alt ShortcutsSpec Name for modifier on keyboard Alt (Choose application with file requester) ShortcutsWindow (Atverti programos parinkimo langą) -Window ShortcutsSpec Name for modifier on keyboard Win Shortcuts was couldn't open your KeySet file! ShortcutsWindow Sparčiųjų klavišų rinkinio atverti nepavyko! Save ShortcutsWindow Įrašyti Remove selected shortcut ShortcutsWindow Pašalinti pažymėtąjį klavišų derinį diff --git a/data/catalogs/preferences/shortcuts/nl.catkeys b/data/catalogs/preferences/shortcuts/nl.catkeys index 521e046422..91954e8e45 100644 --- a/data/catalogs/preferences/shortcuts/nl.catkeys +++ b/data/catalogs/preferences/shortcuts/nl.catkeys @@ -1,4 +1,4 @@ -1 dutch; flemish x-vnd.Haiku-Shortcuts 1741147146 +1 dutch; flemish x-vnd.Haiku-Shortcuts 1477375596 Error, NULL state description?\n ShortcutsSpec Fout, NULL-statusbeschrijving?\n MoveMouse ShortcutsSpec VerplaatsMuis OK ShortcutsWindow Oké @@ -15,7 +15,6 @@ Alt ShortcutsSpec Name for modifier on keyboard Alt *InsertString \"Your Text Here\" ShortcutsWindow *VoegTekstIn \"Uw Tekst Hier\" *MouseUp ShortcutsWindow *MuisOmhoog (Choose application with file requester) ShortcutsWindow (Kies een toepassing met een bestandskiezer) -Window ShortcutsSpec Name for modifier on keyboard Windows-toets *LaunchHandler text/html ShortcutsWindow *StartAfhandelaar text/html Shortcuts was couldn't open your KeySet file! ShortcutsWindow Sneltoetsen kon uw toetsencombinatiebestand niet openen! *Multi \"*MoveMouseTo 100% 0\" \"*MouseButton 1\" ShortcutsWindow *Meerdere \"*VerplaatsMuisNaar 100% 0\" \"*MuisKnop 1\" diff --git a/data/catalogs/preferences/shortcuts/pl.catkeys b/data/catalogs/preferences/shortcuts/pl.catkeys index 8dabc1514c..45ec5f9e39 100644 --- a/data/catalogs/preferences/shortcuts/pl.catkeys +++ b/data/catalogs/preferences/shortcuts/pl.catkeys @@ -1,4 +1,4 @@ -1 polish x-vnd.Haiku-Shortcuts 1741147146 +1 polish x-vnd.Haiku-Shortcuts 1477375596 Error, NULL state description?\n ShortcutsSpec Błąd, brak opisu stanu?\n MoveMouse ShortcutsSpec MoveMouse OK ShortcutsWindow OK @@ -15,7 +15,6 @@ Alt ShortcutsSpec Name for modifier on keyboard Alt *InsertString \"Your Text Here\" ShortcutsWindow *InsertString \"Tutaj umieść swój tekst\" *MouseUp ShortcutsWindow *MouseUp (Choose application with file requester) ShortcutsWindow (Wybierz aplikację żądającą pliku) -Window ShortcutsSpec Name for modifier on keyboard Window *LaunchHandler text/html ShortcutsWindow *LaunchHandler text/html Shortcuts was couldn't open your KeySet file! ShortcutsWindow Skróty nie zdołały otworzyć pliku KeySet! *Multi \"*MoveMouseTo 100% 0\" \"*MouseButton 1\" ShortcutsWindow Multi \"*MoveMouseTo 100% 0\" \"*MouseButton 1\" diff --git a/data/catalogs/preferences/shortcuts/pt_BR.catkeys b/data/catalogs/preferences/shortcuts/pt_BR.catkeys index f3597591f2..ce6e89db02 100644 --- a/data/catalogs/preferences/shortcuts/pt_BR.catkeys +++ b/data/catalogs/preferences/shortcuts/pt_BR.catkeys @@ -1,4 +1,4 @@ -1 portuguese (brazil) x-vnd.Haiku-Shortcuts 3661393357 +1 portuguese (brazil) x-vnd.Haiku-Shortcuts 341885426 Error, NULL state description?\n ShortcutsSpec Erro, descrição de estado em branco?\n MoveMouse ShortcutsSpec Mover o Mouse OK ShortcutsWindow OK @@ -15,12 +15,12 @@ Alt ShortcutsSpec Name for modifier on keyboard Alt *InsertString \"Your Text Here\" ShortcutsWindow *InsertString \"Seu Texto Aqui\" *MouseUp ShortcutsWindow *MouseUp (Choose application with file requester) ShortcutsWindow (Escolha um aplicativo que contenha um requerente de arquivo) -Window ShortcutsSpec Name for modifier on keyboard Windows *LaunchHandler text/html ShortcutsWindow *LaunchHandler text/html Shortcuts was couldn't open your KeySet file! ShortcutsWindow O Atalhos não pode abrir seu arquivo de combinação de teclas! *Multi \"*MoveMouseTo 100% 0\" \"*MouseButton 1\" ShortcutsWindow *Multi \"*MoveMouseTo 100% 0\" \"*MouseButton 1\" SendMessage ShortcutsSpec Enviar Mensagem MoveMouseTo ShortcutsSpec Mover Mouse Para +Option ShortcutsSpec Name for modifier on keyboard Opção Save ShortcutsWindow Salvar *MouseButton 1 ShortcutsWindow *Botão do Mouse 1 *MoveMouse +20 +0 ShortcutsWindow *Mover Mouse +20 +0 diff --git a/data/catalogs/preferences/shortcuts/ro.catkeys b/data/catalogs/preferences/shortcuts/ro.catkeys index a51558e58f..8a00f2e9c8 100644 --- a/data/catalogs/preferences/shortcuts/ro.catkeys +++ b/data/catalogs/preferences/shortcuts/ro.catkeys @@ -1,4 +1,4 @@ -1 romanian x-vnd.Haiku-Shortcuts 1741147146 +1 romanian x-vnd.Haiku-Shortcuts 1477375596 Error, NULL state description?\n ShortcutsSpec Eroare, descriere stare NULL?\n MoveMouse ShortcutsSpec MutăMaus OK ShortcutsWindow OK @@ -15,7 +15,6 @@ Alt ShortcutsSpec Name for modifier on keyboard Alt *InsertString \"Your Text Here\" ShortcutsWindow *InsereazăȘir "Textul dumneavoastră aici" *MouseUp ShortcutsWindow *MauSus (Choose application with file requester) ShortcutsWindow (Selectează aplicație cu solicitantul de fișier) -Window ShortcutsSpec Name for modifier on keyboard Fereastră *LaunchHandler text/html ShortcutsWindow *OperatorLansare text/html Shortcuts was couldn't open your KeySet file! ShortcutsWindow Scurtături nu a putut deschide fișierul dumneavoastră set de taste! *Multi \"*MoveMouseTo 100% 0\" \"*MouseButton 1\" ShortcutsWindow *Multi "*MutăMausLa 100% 0" "*ButonMaus 1" diff --git a/data/catalogs/preferences/shortcuts/ru.catkeys b/data/catalogs/preferences/shortcuts/ru.catkeys index d2bafd8cae..a379555c68 100644 --- a/data/catalogs/preferences/shortcuts/ru.catkeys +++ b/data/catalogs/preferences/shortcuts/ru.catkeys @@ -1,4 +1,4 @@ -1 russian x-vnd.Haiku-Shortcuts 1741147146 +1 russian x-vnd.Haiku-Shortcuts 1477375596 Error, NULL state description?\n ShortcutsSpec Ошибка, состояние описания NULL?\n MoveMouse ShortcutsSpec MoveMouse OK ShortcutsWindow ОК @@ -15,7 +15,6 @@ Alt ShortcutsSpec Name for modifier on keyboard Alt *InsertString \"Your Text Here\" ShortcutsWindow *InsertString \"Ваш текст\" *MouseUp ShortcutsWindow *MouseUp (Choose application with file requester) ShortcutsWindow (Выбрать программу) -Window ShortcutsSpec Name for modifier on keyboard Window *LaunchHandler text/html ShortcutsWindow *LaunchHandler text/html Shortcuts was couldn't open your KeySet file! ShortcutsWindow Не удалось открыть список горячих клавиш! *Multi \"*MoveMouseTo 100% 0\" \"*MouseButton 1\" ShortcutsWindow *Multi \"*MoveMouseTo 100% 0\" \"*MouseButton 1\" diff --git a/data/catalogs/preferences/shortcuts/sk.catkeys b/data/catalogs/preferences/shortcuts/sk.catkeys index c8f0092516..34d367d31a 100644 --- a/data/catalogs/preferences/shortcuts/sk.catkeys +++ b/data/catalogs/preferences/shortcuts/sk.catkeys @@ -1,4 +1,4 @@ -1 slovak x-vnd.Haiku-Shortcuts 1741147146 +1 slovak x-vnd.Haiku-Shortcuts 1477375596 Error, NULL state description?\n ShortcutsSpec Chyba, NULL popis stavu?\n MoveMouse ShortcutsSpec PosunúťMyš OK ShortcutsWindow OK @@ -15,7 +15,6 @@ Alt ShortcutsSpec Name for modifier on keyboard Alt *InsertString \"Your Text Here\" ShortcutsWindow *VložiťReťazec \"Váš text sem\" *MouseUp ShortcutsWindow *MyšHore (Choose application with file requester) ShortcutsWindow (Vyberte aplikáciu pomocou žiadača súboru) -Window ShortcutsSpec Name for modifier on keyboard Okno *LaunchHandler text/html ShortcutsWindow *SpustiťObsluhu text/html Shortcuts was couldn't open your KeySet file! ShortcutsWindow Aplikácia Skratky nedokázala otvoriť váš súbor SadaKláves! *Multi \"*MoveMouseTo 100% 0\" \"*MouseButton 1\" ShortcutsWindow *Multi \"*PresunúťMyšNa 100% 0\" \"*TlačidloMyši 1\" diff --git a/data/catalogs/preferences/shortcuts/sv.catkeys b/data/catalogs/preferences/shortcuts/sv.catkeys index a3c5ffefc0..053ea29133 100644 --- a/data/catalogs/preferences/shortcuts/sv.catkeys +++ b/data/catalogs/preferences/shortcuts/sv.catkeys @@ -1,4 +1,4 @@ -1 swedish x-vnd.Haiku-Shortcuts 1741147146 +1 swedish x-vnd.Haiku-Shortcuts 341885426 Error, NULL state description?\n ShortcutsSpec Fel: NULL i tillståndsbeskrivning?\n MoveMouse ShortcutsSpec FlyttaMus OK ShortcutsWindow OK @@ -15,16 +15,17 @@ Alt ShortcutsSpec Name for modifier on keyboard Alt *InsertString \"Your Text Here\" ShortcutsWindow *InfogaSträng \"Din text\" *MouseUp ShortcutsWindow *MusnappUpp (Choose application with file requester) ShortcutsWindow (Välj applikation i filväljarfönstret) -Window ShortcutsSpec Name for modifier on keyboard Start *LaunchHandler text/html ShortcutsWindow *StartHanterare text/html Shortcuts was couldn't open your KeySet file! ShortcutsWindow Genvägar kunde inte öppna din tagentuppsättning! *Multi \"*MoveMouseTo 100% 0\" \"*MouseButton 1\" ShortcutsWindow *Flera \"*FlyttaMusTill 100% 0\" \"*Musknapp 1\" SendMessage ShortcutsSpec SkickaMeddelande MoveMouseTo ShortcutsSpec FlyttaMusenTill +Option ShortcutsSpec Name for modifier on keyboard Alternativ Save ShortcutsWindow Spara *MouseButton 1 ShortcutsWindow *Musknapp 1 *MoveMouse +20 +0 ShortcutsWindow *FlyttaMusenTill +20 +0 MouseDown ShortcutsSpec MusknappNer +Save changes before closing? ShortcutsWindow Spara ändringar innan programmet avslutas? Remove selected shortcut ShortcutsWindow Ta bort MouseButton ShortcutsSpec Musknapp Add new shortcut ShortcutsWindow Lägg till diff --git a/data/catalogs/preferences/shortcuts/uk.catkeys b/data/catalogs/preferences/shortcuts/uk.catkeys index bf9edb4503..ef20e1bf34 100644 --- a/data/catalogs/preferences/shortcuts/uk.catkeys +++ b/data/catalogs/preferences/shortcuts/uk.catkeys @@ -1,4 +1,4 @@ -1 ukrainian x-vnd.Haiku-Shortcuts 1741147146 +1 ukrainian x-vnd.Haiku-Shortcuts 1477375596 Error, NULL state description?\n ShortcutsSpec Помилка, NULL опису стану?\n MoveMouse ShortcutsSpec Переміщення мишки OK ShortcutsWindow Гаразд @@ -15,7 +15,6 @@ Alt ShortcutsSpec Name for modifier on keyboard Alt *InsertString \"Your Text Here\" ShortcutsWindow *Вставити Рядок \"Ваш текст тут\" *MouseUp ShortcutsWindow *Мишку вгору (Choose application with file requester) ShortcutsWindow (Виберіть програму з файлами запису) -Window ShortcutsSpec Name for modifier on keyboard Win Key *LaunchHandler text/html ShortcutsWindow *Запустити обробник текст/html Shortcuts was couldn't open your KeySet file! ShortcutsWindow Не вдалося відкрити список гарячих клавіш! *Multi \"*MoveMouseTo 100% 0\" \"*MouseButton 1\" ShortcutsWindow *Багато \"*Перемістити мишку до 100% 0\" \"*Кнопка мишки1\" diff --git a/data/catalogs/preferences/shortcuts/zh_Hans.catkeys b/data/catalogs/preferences/shortcuts/zh_Hans.catkeys index f976f37ff5..442536d3ab 100644 --- a/data/catalogs/preferences/shortcuts/zh_Hans.catkeys +++ b/data/catalogs/preferences/shortcuts/zh_Hans.catkeys @@ -1,4 +1,4 @@ -1 english x-vnd.Haiku-Shortcuts 3661393357 +1 english x-vnd.Haiku-Shortcuts 3397621807 Error, NULL state description?\n ShortcutsSpec 错误,无效状态描述?\n MoveMouse ShortcutsSpec 鼠标移动 OK ShortcutsWindow 确定 @@ -15,7 +15,6 @@ Alt ShortcutsSpec Name for modifier on keyboard Alt *InsertString \"Your Text Here\" ShortcutsWindow *插入字符串 \"在此处写入文本\" *MouseUp ShortcutsWindow *MouseUp (Choose application with file requester) ShortcutsWindow (使用文件查询选取应用程序) -Window ShortcutsSpec Name for modifier on keyboard Window *LaunchHandler text/html ShortcutsWindow *LaunchHandler text/html Shortcuts was couldn't open your KeySet file! ShortcutsWindow 无法打开您的按键设置文件! *Multi \"*MoveMouseTo 100% 0\" \"*MouseButton 1\" ShortcutsWindow *Multi \'*MoveMouseTo 100% 0\" \"*MouseButton 1\" diff --git a/data/catalogs/preferences/virtualmemory/be.catkeys b/data/catalogs/preferences/virtualmemory/be.catkeys index 57a7881ccd..dce4dacb0b 100644 --- a/data/catalogs/preferences/virtualmemory/be.catkeys +++ b/data/catalogs/preferences/virtualmemory/be.catkeys @@ -1,5 +1,6 @@ -1 belarusian x-vnd.Haiku-VirtualMemory 4238590117 +1 belarusian x-vnd.Haiku-VirtualMemory 2090796060 Quit SettingsWindow Выйсці +Automatic swap management SettingsWindow Вызначаць аўтаматычна Turn off SettingsWindow Адключыць Disabling virtual memory will have unwanted effects on system stability once the memory is used up.\nVirtual memory does not affect system performance until this point is reached.\n\nAre you really sure you want to turn it off? SettingsWindow Адмова ад ужывання уяўнай памяці можа спарадзіць нечаканыя праблемы ў функцыянаванні праграмаў падчас працы сістэмы ў рэжыме скарыстання усёй фізічнай памяці. Але майце на ўвазе, што да таго моманту як сістэма вычарпае ўсю фізічную памяць, наладкі ўяўнай памяці ніяк ня будуць ўплываць на агульную прадукцыйнасьць сістэмы.\n\nВы упэўнены у тым, што сістэма не павінна карыстацца уяўнаю памяццю? Requested swap file size: SettingsWindow Запатрабаваны памер уяўнай памяці: diff --git a/data/catalogs/preferences/virtualmemory/sv.catkeys b/data/catalogs/preferences/virtualmemory/sv.catkeys index 642671128f..fdee5d0b05 100644 --- a/data/catalogs/preferences/virtualmemory/sv.catkeys +++ b/data/catalogs/preferences/virtualmemory/sv.catkeys @@ -1,5 +1,6 @@ -1 swedish x-vnd.Haiku-VirtualMemory 4238590117 +1 swedish x-vnd.Haiku-VirtualMemory 2090796060 Quit SettingsWindow Avsluta +Automatic swap management SettingsWindow Automatisk swap hantering Turn off SettingsWindow Stäng av Disabling virtual memory will have unwanted effects on system stability once the memory is used up.\nVirtual memory does not affect system performance until this point is reached.\n\nAre you really sure you want to turn it off? SettingsWindow Om du stänger av det virtuella minnet så kommer det att orsaka instabilitet i systemet när minnet är fullt.\nVirtuellt minne påverkar inte systemets prestanda när det inte används.\n\nÄr du säker på att du vill inaktivera virtuellt minne? Requested swap file size: SettingsWindow Begärd växlingsfils storlek: diff --git a/data/catalogs/servers/debug/ru.catkeys b/data/catalogs/servers/debug/ru.catkeys index 756b521a69..bf2f316939 100644 --- a/data/catalogs/servers/debug/ru.catkeys +++ b/data/catalogs/servers/debug/ru.catkeys @@ -1,3 +1,5 @@ -1 russian x-vnd.Haiku-debug_server 3203333611 +1 russian x-vnd.Haiku-debug_server 1440673937 +Terminate DebugServer Завершить Debug DebugServer Отладить +Save report DebugServer Сохранить отчёт The application:\n\n %app\n\nhas encountered an error which prevents it from continuing. Haiku will terminate the application and clean up. DebugServer Программа:\n\n %app\n\nобнаружила ошибку, которая мешает продолжению её работы. Haiku завершит эту программу и немного приберется за ней. diff --git a/data/catalogs/servers/debug/sv.catkeys b/data/catalogs/servers/debug/sv.catkeys index 44a75bc10b..367e9c8201 100644 --- a/data/catalogs/servers/debug/sv.catkeys +++ b/data/catalogs/servers/debug/sv.catkeys @@ -1,4 +1,5 @@ -1 swedish x-vnd.Haiku-debug_server 857491333 +1 swedish x-vnd.Haiku-debug_server 1440673937 Terminate DebugServer Avsluta Debug DebugServer Felsök +Save report DebugServer Spara rapport The application:\n\n %app\n\nhas encountered an error which prevents it from continuing. Haiku will terminate the application and clean up. DebugServer Programmet:\n\n %app\n\nhar stött på ett fel som förhindrar den från att fortsätta. Haiku kommer att avsluta programmet och stöda upp. diff --git a/data/catalogs/tests/servers/app/playground/de.catkeys b/data/catalogs/tests/servers/app/playground/de.catkeys index 588351b7e2..5d8c92972d 100644 --- a/data/catalogs/tests/servers/app/playground/de.catkeys +++ b/data/catalogs/tests/servers/app/playground/de.catkeys @@ -1,4 +1,4 @@ -1 german application/x-vnd.Haiku-Playground 3841053224 +1 german x-vnd.Haiku-Playground 3841053224 Line Playground Linie Fill Playground Füllen Quit Playground Beenden diff --git a/data/catalogs/tests/servers/app/playground/fi.catkeys b/data/catalogs/tests/servers/app/playground/fi.catkeys index 78a864c992..890380aeaa 100644 --- a/data/catalogs/tests/servers/app/playground/fi.catkeys +++ b/data/catalogs/tests/servers/app/playground/fi.catkeys @@ -1,4 +1,4 @@ -1 finnish application/x-vnd.Haiku-Playground 1375574837 +1 finnish x-vnd.Haiku-Playground 1375574837 Line Playground Rivi Fill Playground Täytä Over Playground Ylitä diff --git a/data/catalogs/tests/servers/app/playground/hu.catkeys b/data/catalogs/tests/servers/app/playground/hu.catkeys index 91ecacb462..ca949a74dd 100644 --- a/data/catalogs/tests/servers/app/playground/hu.catkeys +++ b/data/catalogs/tests/servers/app/playground/hu.catkeys @@ -1,4 +1,4 @@ -1 hungarian application/x-vnd.Haiku-Playground 1375574837 +1 hungarian x-vnd.Haiku-Playground 1375574837 Line Playground Vonal Fill Playground Kitöltés Over Playground Felül diff --git a/data/catalogs/tests/servers/app/playground/ja.catkeys b/data/catalogs/tests/servers/app/playground/ja.catkeys index 2acb379768..1331e3ab36 100644 --- a/data/catalogs/tests/servers/app/playground/ja.catkeys +++ b/data/catalogs/tests/servers/app/playground/ja.catkeys @@ -1,26 +1,28 @@ -1 japanese application/x-vnd.Haiku-Playground 2051069653 +1 japanese x-vnd.Haiku-Playground 3859386218 Line Playground 直線 -Fill Playground 塗りつぶし +Fill Playground 塗りつぶす +Over Playground 上書き Quit Playground 終了 -Rect Playground 矩形 +Rect Playground 四角形 Select Playground 選択 Click and drag to draw an object Playground クリック&ドラッグでオブジェクトを描いてください Controls Playground コントロール Round rect Playground 角丸四角形 -Alpha: Playground 透明度: -Mode: Playground モード: +Alpha: Playground 不透明度: +Mode: Playground 描画モード: Submenu Playground サブメニュー Copy Playground コピー Cancel Playground キャンセル Clear Playground 消去 Blend Playground ブレンド Invert Playground 反転 -Clear all drawing objects? Playground すべてのオブジェクトを削除しても良いですか? +Clear all drawing objects? Playground オブジェクトをすべて削除しても良いですか? Width: Playground 幅: -Alpha Playground 透明度 +Alpha Playground アルファ New object Playground 新規オブジェクト Test Playground テスト +Add Playground 加算 Playground System name プレイグラウンド -Erase Playground 削除 File Playground ファイル +Subtract Playground 減算 Ellipse Playground 楕円 diff --git a/data/catalogs/tests/servers/app/playground/pt_BR.catkeys b/data/catalogs/tests/servers/app/playground/pt_BR.catkeys index 6c901387b3..f2c4f15a6a 100644 --- a/data/catalogs/tests/servers/app/playground/pt_BR.catkeys +++ b/data/catalogs/tests/servers/app/playground/pt_BR.catkeys @@ -1,4 +1,4 @@ -1 portuguese (brazil) application/x-vnd.Haiku-Playground 1375574837 +1 portuguese (brazil) x-vnd.Haiku-Playground 1375574837 Line Playground Linha Fill Playground Preencher Over Playground Sobre diff --git a/data/catalogs/tests/servers/app/playground/sv.catkeys b/data/catalogs/tests/servers/app/playground/sv.catkeys new file mode 100644 index 0000000000..ba30234b4d --- /dev/null +++ b/data/catalogs/tests/servers/app/playground/sv.catkeys @@ -0,0 +1,32 @@ +1 swedish x-vnd.Haiku-Playground 1375574837 +Line Playground Rad +Fill Playground Fyll +Over Playground Över +Quit Playground Avsluta +Rect Playground Rektangel +Select Playground Välj +Click and drag to draw an object Playground Klicka och dra för att rita ett object +Controls Playground Kontroller +Round rect Playground Rund form +Alpha: Playground Alfa: +Mode: Playground Läge: +Submenu Playground Undermeny +Copy Playground Kopiera +Cancel Playground Avbryt +Clear Playground Töm +Min Playground Min +Blend Playground Tona +Invert Playground Invertera +Clear all drawing objects? Playground Tabort alla ritade objekt? +Width: Playground Bredd: +Alpha Playground Alfa +New object Playground Nytt objekt +Test Playground Test +Max Playground Max +Add Playground Lägg till +Playground System name Lekplats +Erase Playground Ta bort +File Playground Fil +Subtract Playground Subtrahera + Playground +Ellipse Playground Ellips diff --git a/data/system/boot/Bootscript b/data/system/boot/Bootscript index 3a52cb2ea2..a49439d831 100644 --- a/data/system/boot/Bootscript +++ b/data/system/boot/Bootscript @@ -109,7 +109,7 @@ if [ "$SAFEMODE" != "yes" ]; then launch $SERVERS/net_server # launch net_server fi -launch $SERVERS/app_server picasso # launch app_server +launch $SERVERS/app_server picasso # launch app_server if [ "$SAFEMODE" != "yes" ]; then launch $SERVERS/syslog_daemon @@ -117,14 +117,15 @@ if [ "$SAFEMODE" != "yes" ]; then fi # Now ask the user if he wants to run the Installer or continue to the Desktop. -if [ "$isReadOnly" = "yes" ]; then - # Create Installer link (using the write overlay) - ln -sf /boot/system/apps/Installer /boot/home/Desktop/Installer - - /bin/ReadOnlyBootPrompt +freshInstallIndicator=/boot/common/settings/fresh_install +if [ "$isReadOnly" = "yes" -o -e $freshInstallIndicator ]; then + /bin/FirstBootPrompt if [ $? -eq 0 ]; then launchscript $SCRIPTS/Bootscript.cd exit 0 # and return + elif [ "$isReadOnly" = "yes" ] ; then + # Create Installer link (using the write overlay) + ln -sf /boot/system/apps/Installer /boot/home/Desktop/Installer fi fi @@ -190,7 +191,6 @@ fi # Check for fresh install and run post install scripts. postInstallDir=/boot/common/boot/post_install -freshInstallIndicator=/boot/common/settings/fresh_install if [ -e $freshInstallIndicator ]; then # wait a moment for things to calm down a bit sleep 3 diff --git a/docs/develop/opengl/openGLkit_Jan-2013.png b/docs/develop/opengl/openGLkit_Jan-2013.png new file mode 100644 index 0000000000..0daf542378 Binary files /dev/null and b/docs/develop/opengl/openGLkit_Jan-2013.png differ diff --git a/docs/develop/opengl/readme b/docs/develop/opengl/readme new file mode 100644 index 0000000000..96dd321c7a --- /dev/null +++ b/docs/develop/opengl/readme @@ -0,0 +1,120 @@ +Haiku OpenGL kit developers introduction + +The Haiku OpenGL kit is made up of the folwing pieces: + +* The "OpenGL Kit" aka libGL.so and supporting libraries. + This is what the user applications interact with. + +* The "OpenGL Add-ons" (which do the real work) + These are chosen by the OpenGL kit and utilized + +In the traditional BeOS sense, the OpenGL Add-ons are the +vendor provided OpenGL drivers. This actually doesn't +mesh well with the current open source OpenGL stack. + +Our "OpenGL Add-ons" are really wrappers around Mesa +and Gallium code. We gain greater OS control of OpenGL +rendering with the drawback of increased work overall. +The OpenGL Add-ons call private Mesa functions, thus +we get no compatibility saftey net between Mesa versions. + +Our Gallium connecting Add-ons could actually fit into +the upstream Mesa / Gallium project, however this would +cause complications in the build process (linking in +OpenGL and all of it's libraries into a small number of +shared libraries is not really what the Mesa project +designs it's stack for. Several symbol collisions exist +when trying to link libmesa and libgallium together for +example) + +Mesa drivers are the classical Mesa software rasterizers +Gallium drivers are the new-school software drivers. + + +********** +Mesa versions + +The Haiku project uses two different versions of Mesa. + + * Mesa 7.8.2 for gcc2 OpenGL Add-ons + * Mesa 9.0.1+ for gcc4 OpenGL Add-ons. + +The reasoning behind this is that any version of Mesa +above 7.8.2 will require a *massive* porting effort to +make it compile under gcc2. Given this fact, it makes +sense to bump the gcc2 version of Mesa as far as it will +go and set it there statically. Think of Mesa 7.8.2 +as the "stable" version Haiku R1 will use :) + +Hardware 3D rendering and llvm-based software rendering +will never work for legacy gcc2 applications. Period. + +However! If you're running a gcc2 hybrid version of +Haiku, llvm or hardware based rendering should be possible +on gcc4 applications. + +It is *essential* to upgrade our build Mesa packages +with the latest release Mesa versions. If we fall too +far behind the update gets extremely tricky as functions +inside Mesa and Gallium change at a fast pace. + + +********** +gcc2 OpenGL kit + +The following process occurs in order to generate the +gcc2 (Mesa 7.8.2) OpenGL kit: + +* Some kind soul compiles a Mesa optional package on a + gcc2 Haiku system with the bep on haikuports. This + gets uploaded to Haiku-files and the package name + / version gets updated as in the BuildFeatures jam + build script. + + - The bep generally applies a few minimal patches to + Mesa 7.8.2 and compiles it. Then it rounds up all of + the headers and static libraries and throws them into + a .zip for the build + +* Someone starts a gcc2 Haiku build. The build process pulls + down the Mesa optional package above and links the needed + parts into libGL and the swrast_legacy OpenGL add-on + + +********** +gcc4 OpenGL kit + +The following process occurs in order to generate the +gcc4 (Mesa 9.0.1+) OpenGL kit: + +* Some kind soul compiles a Mesa optional package on a + gcc4 Haiku system with the bep on haikuports. This + gets uploaded to Haiku-files and the package name + / version gets updated as in the BuildFeatures jam + build script. + + - The kind soul also needs to install the LLVM Optional + build package on his build machine *before* compiling + the Mesa bep. (unless he or she doesn't want llvmpipe + rendering) + + - The bep for Mesa 9.0.1+ doesn't apply too many patches as + Haiku build fixes are accepted upstream. + + - The bep rounds up all of the headers and static + libraries and throws them into a .zip for the build + +* Someone starts a gcc4 Haiku build. The build process pulls + down the Mesa optional package above and links the needed + parts into libGL and OpenGL add-ons. + + - If the user didn't link in LLVM, he can disable the LLVM + dependencies in the OpenGL kit Jamfile. swpipe will + automagically fall back to softpipe rendering + + - The build system will download the LLVM optional package + and link it into any OpenGL add-ons that need it. + + !! The LLVM optional package needs to match the LLVM + binaries on the machine which compiled Mesa + !! diff --git a/docs/user/app/Application.dox b/docs/user/app/Application.dox index f64f2399b2..f48beb9817 100644 --- a/docs/user/app/Application.dox +++ b/docs/user/app/Application.dox @@ -387,10 +387,10 @@ main() /*! \fn BWindow* BApplication::WindowAt(int32 index) const - \brief Returns the BWindow object at the specified index in the + \brief Returns the BWindow object at the specified \a index in the application's window list. - - If index is out of range, this function returns \c NULL. + + If \a index is out of range, this function returns \c NULL. \warning Locking the BApplication object doesn't lock the window list. @@ -520,7 +520,8 @@ main() If the \a rate is set to 0 then the \c B_PULSE messages are not sent. The pulse rate can be no faster than once per 100,000 microseconds or so. - \param rate The rate \a B_PULSE messages are sent to the application. + \param rate The rate at which \c B_PULSE messages are sent to the + application. */ diff --git a/docs/user/app/Handler.dox b/docs/user/app/Handler.dox index 87f7e84a0b..33fc2a0e5b 100644 --- a/docs/user/app/Handler.dox +++ b/docs/user/app/Handler.dox @@ -26,7 +26,7 @@ /*! \def B_OBSERVE_ORIGINAL_WHAT \brief Constant for a message data field in observer messages. - + If you have called one of the flavors of BHandler::StartWachting(), and you receive a notification, sometimes there can be send a BMessage to go with that notification. The message you receive is a copy of that message, @@ -52,17 +52,17 @@ \class BHandler \ingroup app \brief Handles messages that are passed on by a BLooper. - + The BHandler class implements two important pieces of functionality. It provides the foundations for handling messages, and it serves as a state machine that sends out notifications of the state changes. - + The most common use of this class is to handle messages. Handlers can be tied to loopers, which are the objects that send and receive messages. As soon as a message is received, the looper passes through its list of associated handlers and tries them in a certain order until the message is handled, or the options are exhausted. - + You should know that a looper is a subclass of a handler, and as such, loopers can be self-contained and do not need additional handlers. In many cases, this construction will suffice. You will simply subclass the looper, @@ -74,18 +74,18 @@ messages such as clicks are received, the window loops the handlers until there is a handler that is at the screen position the click was in. It is not unlikely that you will some day want to use this functionality of the - API. - + API. + If your handler is limited to a certain type of messages, you can set a filter that the looper will apply to your message before passing it on to your overridden MessageReceived() method. The BMessageFilter class provides the framework for the flexible filtering options, and using AddFilter() you can apply filters to this handler. Note that a filter object should only be applied to one handler. They cannot be shared. - + For more information on the handling chain, have a look at the documentation of the BLooper class. - + Using BHandler as a state machine is a second area of functionality. Since handlers process messages, and perform actions associated with those, they are the center of keeping track on the current state of things within @@ -93,7 +93,7 @@ parts of your application, you could perform this manually by sending messages to the interested components, or you can use the more flexible approach with observers. - + Observers watch a certain state. A handler can track one or more different states. Each state is represented by a four byte constant - just like the \c what property of a message. Using the StartWatching() methods, you can @@ -105,7 +105,7 @@ that you want to be send to the observers. This data is in the form of the very flexible BMessage, as such you are almost free to pass anything you want. - + Whenever SendNotices() is called, all interested observers will receive a message of the \a B_OBSERVER_NOTICE_CHANGE type. Please note that the constant that is associated with the state itself is not transmitted. If @@ -119,9 +119,9 @@ /*! - \fn BHandler::BHandler(const char* name = NULL) + \fn BHandler::BHandler(const char *name) \brief Construct a new handler with a \a name. - + The newly constructed handler is not associated with a looper until you explicitly request this to happen. To associate this handler with a looper, use BLooper::AddHandler(). @@ -131,11 +131,11 @@ /*! \fn BHandler::~BHandler() \brief Free the filters of this handler, as well as the list of observers. - + This method does not remove the handler from the looper to which this handler is associated. You should do this yourself, using BLooper::RemoveHandler(). - + \warning This constructor does no type check whatsoever. Since you can pass any BMessage, you should - if you are not sure about the exact type - use the Instantiate() method, which does check the type. @@ -145,7 +145,7 @@ /*! \fn BArchivable *BHandler::Instantiate(BMessage *data) \brief Static method to instantiate a handler from an archived message. - + \return A pointer to the instantiated handler, or \c NULL if the \a data is not a valid archived BHandler object. \see BHandler(BMessage* data) @@ -156,18 +156,19 @@ /*! \name Archiving + BHandler inherits the BArchivable class, and as such implements support for archiving and unarchiving handlers. */ //! @{ - - + + /*! \fn BHandler::BHandler(BMessage* data) \brief Construct a handler from an archived message. - + This \a data has to be created using the BHandler::Archive() method. Note that only the name is stored. The filters, the associated looper and the observers are not stored, and should be manually added when you are @@ -178,10 +179,10 @@ /*! \fn status_t BHandler::Archive(BMessage *data, bool deep) const \brief Archive a handler to a message - + Currently, only the name is archived. The filters, the associated looper and the observers are not stored. - + \param data The message to archive the object in. \param deep This parameter is ignored, as BHandler does not have children. \retval B_OK Archiving succeeded. @@ -206,13 +207,13 @@ /*! \fn void BHandler::MessageReceived(BMessage *message) - \brief Handle a message that has been received by the associated looper. + \brief Handle \a message that has been received by the associated looper. This method is reimplemented by subclasses. If the messages that have been received by a looper pass through the filters, then they end up in the MessageReceived() methods. - The example below shows a very common way to handle message. Usually, + The example below shows a very common way to handle \a message. Usually, this involves parsing the BMessage::what constant and then perform an action based on that. @@ -239,13 +240,13 @@ ShowImageApp::MessageReceived(BMessage *message) } \endcode - If your handler cannot process this message, you should pass it on + If your handler cannot process this \a message, you should pass it on to the base class. Eventually, it will reach the base implementation, which will reply with \c B_MESSAGE_NOT_UNDERSTOOD. \attention If you want to keep or manipulate the \a message, have a look at BLooper::DetachCurrentMessage() to receive ownership of - the message. + the \a message. \param message The message that needs to be handled. */ @@ -279,19 +280,19 @@ ShowImageApp::MessageReceived(BMessage *message) /*! \fn void BHandler::SetNextHandler(BHandler *handler) \brief Set the next handler in the chain that the message is passed on to - if this handler cannot process it. - + if this \a handler cannot process it. + This method has three requirements: - -# This handler should belong to a looper. + -# This \a handler should belong to a looper. -# The looper needs to be locked. See LockLooper(). -# The \a handler that you pass must be associated with the same looper. - + Failure to meet any of these requirements will result in your application crashing. - + By default, the handlers are chained in order that they were associated to a looper with BLooper::AddHander(). - + \see NextHandler() */ @@ -316,36 +317,36 @@ ShowImageApp::MessageReceived(BMessage *message) //! @{ - - + + /*! \fn void BHandler::AddFilter(BMessageFilter *filter) - \brief Add a filter as a prerequisite to this handler. - + \brief Add \a filter as a prerequisite to this handler. + If the handler is associated with a looper, this looper needs to be locked in order for this operation to succeed. - - Note that the filter is not copied, rather a pointer to the filter is - stored. As such, you need to make sure that the filter object exists as + + Note that the filter is not copied, rather a pointer to the \a filter is + stored. As such, you need to make sure that the \a filter object exists as long as it is added to this handler. - + \see RemoveFilter(), SetFilterList() */ /*! \fn bool BHandler::RemoveFilter(BMessageFilter *filter) - \brief Remove a filter from the filter list. - + \brief Remove \a filter from the filter list. + If the handler is associated with a looper, this looper needs to be locked in order for this operation to succeed. - - Note that the filter is not deleted, merely removed from the list. You need - to take care of the memory yourself. - - \retval true The filter was in the filter list and is removed. - \retval false The filter was not found in the filter list. - + + Note that the \a filter is not deleted, merely removed from the list. You + need to take care of the memory yourself. + + \retval true The \a filter was in the filter list and is removed. + \retval false The \a filter was not found in the filter list. + \see AddFilter(), FilterList() */ @@ -356,7 +357,7 @@ ShowImageApp::MessageReceived(BMessage *message) If the handler is associated with a looper, this looper needs to be locked in order for this operation to succeed. - + The internal list will be replaced with the new list of \a filters. All the existing filters will be \b deleted. @@ -367,11 +368,11 @@ ShowImageApp::MessageReceived(BMessage *message) /*! \fn BList *BHandler::FilterList() \brief Return a pointer to the list of filters. - + \return A pointer to the list of filters. Do not manipulate the list of filters directly, but use the methods provided by this class, in order to maintain internal consistency. - + \see AddFilter(), RemoveFilter(), SetFilterList(). */ @@ -384,22 +385,22 @@ ShowImageApp::MessageReceived(BMessage *message) /*! \name Locking - + This class provides some utility functions to look the looper associated with this handler. */ //! @{ - - + + /*! \fn bool BHandler::LockLooper() \brief Lock the looper associated with this handler. - + \retval true The looper is locked. \retval false There was an error acquiring the lock. - + \see LockLooperWithTimeout(), UnlockLooper() */ @@ -407,16 +408,16 @@ ShowImageApp::MessageReceived(BMessage *message) /*! \fn status_t BHandler::LockLooperWithTimeout(bigtime_t timeout) \brief Lock the looper associated with this handler, with a time out value. - + \param timeout The time to wait for acquiring the lock in microseconds. You may also use B_INFINITE_TIMEOUT, in which this method will wait as long as it takes to acquire the lock. - + \retval B_OK Locking succeeded. \retval B_BAD_VALUE This handler is not associated with a looper (anymore). \retval B_TIMED_OUT The time specified in \a timeout has passed without locking the looper. - + \see LockLooper(), UnlockLooper() */ @@ -463,16 +464,16 @@ ShowImageApp::MessageReceived(BMessage *message) /*! \name Observing - + Handlers can function as state machines, which emit messages to observers when the state changes. Use the following methods to subscribe to these notifications. - + Note that there is a semantic difference between the two StartWatching() methods. The overloaded method that accepts a BHandler, expects as - argument an \a observer that watches this handler. The method that + argument an \a observer that watches this handler. The method that accepts a BMessenger, expects a \a target that emits the state changes - to this handler. + to this handler. */ @@ -483,25 +484,26 @@ ShowImageApp::MessageReceived(BMessage *message) \fn status_t BHandler::StartWatching(BMessenger target, uint32 what) \brief Subscribe this handler to watch a specific state change of a \a target. - - Use this method to subscribe messengers to watch state changes in this - handler. This means that also observers from other teams can be + + Use this method to subscribe messengers to watch state changes in this + handler, this also means that observers from other teams can be subscribed. - + \code - // Handler B watches Handler A - BHandler A, B; - BMessenger messengerA(&A) - - B.StartWatching(messengerA, kNetworkConnection); +// Handler B watches Handler A +BHandler A, B; +BMessenger messengerA(&A) + +B.StartWatching(messengerA, kNetworkConnection); \endcode - + \param target The messenger from which the notifications would be received. \param what The state that needs to be watched. \return During the call of this method, a notification will be transmitted using the \a target. If this works, then this method will return \c B_OK. + \see StartWatchingAll(BMessenger), StopWatching(BMessenger, uint32) */ @@ -509,10 +511,10 @@ ShowImageApp::MessageReceived(BMessage *message) /*! \fn status_t BHandler::StartWatchingAll(BMessenger target) \brief Subscribe this handler to watch a \a target for all events. - + This method performs the same task as StartWatching(BMessenger, uint32), but it will subscribe to all the state changes the \a target knows. - + \see StartWatching(BMessenger, uint32), StopWatchingAll(BMessenger) */ @@ -520,10 +522,10 @@ ShowImageApp::MessageReceived(BMessage *message) /*! \fn status_t BHandler::StopWatching(BMessenger target, uint32 what) \brief Unsubscribe this handler from watching a specific state. - + This method will unsubscribe this handler from watching a specific event in a \a target. - + \see StartWatching(BMessenger, uint32) */ @@ -531,9 +533,9 @@ ShowImageApp::MessageReceived(BMessage *message) /*! \fn status_t BHandler::StopWatchingAll(BMessenger target) \brief Unsubscribe this handler from watching all states. - + This method will unsubscribe the \a target from watching all state changes. - + \see StartWatchingAll(BMessenger) */ @@ -541,39 +543,39 @@ ShowImageApp::MessageReceived(BMessage *message) /*! \fn status_t BHandler::StartWatching(BHandler* observer, uint32 what) \brief Subscribe an \a observer for a specific state change of this handler. - + Use this method to subscribe observers to watch this handler. State changes - of this handler that match the \a what argment, will be sent. + of this handler that match the \a what argument, will be sent. \code - // Handler B wants to observe Handler A - BHandler A, B; - - A.StartWatching(&B, kNetworkConnection); +// Handler B wants to observe Handler A +BHandler A, B; + +A.StartWatching(&B, kNetworkConnection); \endcode Since pointers to handlers can only exist in the local namespace, have a look at StartWatching(BMessenger, uint32) for inter-team watching. - + \param observer The observer for this handler. \param what The state that needs to be watched. \return During the call of this method, a notification will be transmitted using the \a observer. If this works, then this method will return \c B_OK. - + \see StartWatchingAll(BHandler*), StopWatching(BHandler*, uint32) */ /*! \fn status_t BHandler::StartWatchingAll(BHandler* observer) - \brief Subscribe an \a observer for a all state changes. - + \brief Subscribe an \a observer for a all state changes. + This method performs the same task as StartWatching(BHandler, uint32), but it will subscribe the \a observer to all the state changes this handler tracks. - + \see StartWatching(BHandler*, uint32), StopWatchingAll(BHandler*) */ @@ -591,9 +593,9 @@ ShowImageApp::MessageReceived(BMessage *message) /*! \fn status_t BHandler::StopWatchingAll(BHandler* handler) \brief Unsubscribe an observer from watching all states. - + This method will unsubscribe the \a handler from watching all state changes. - + \see StartWatchingAll(BHandler*) */ @@ -606,6 +608,7 @@ ShowImageApp::MessageReceived(BMessage *message) /*! \name Emitting State Changes + If your handler functions as a state machine, and it has observers (which subscribed using the StartWatching() method), you can emit these state changes. @@ -613,12 +616,12 @@ ShowImageApp::MessageReceived(BMessage *message) //! @{ - - + + /*! \fn void BHandler::SendNotices(uint32 what, const BMessage *msg) \brief Emit a state change to the observers. - + The actual state (specified by \a what) will not be transmitted. This is merely for internal bookkeeping. It is not entirely unimaginable that you still want to inform the observers of what actually took place. You can @@ -626,13 +629,13 @@ ShowImageApp::MessageReceived(BMessage *message) message will be copied and slightly altered: the \c what member of the message will be \c B_OBSERVER_NOTICE_CHANGE, and the \c what constant you specified will be stored in the #B_OBSERVE_ORIGINAL_WHAT label. - + \param what The identifier of the state. \param msg Any data associated with the state change. You retain ownership of this data, so make sure you dispose it when you are done. */ - - + + /*! \fn bool BHandler::IsWatched() const \brief Check if there are any observers watching this handler. @@ -640,4 +643,3 @@ ShowImageApp::MessageReceived(BMessage *message) //! @} - diff --git a/docs/user/book.css b/docs/user/book.css index 41cff2d11a..bef8af336e 100644 --- a/docs/user/book.css +++ b/docs/user/book.css @@ -259,6 +259,10 @@ div.contents em, div.contents code { font-style: normal; } +div.contents em { + color: #dc3c01; /* grenadier */ +} + div.contents code { color: blue; } @@ -309,10 +313,6 @@ div.contents li { margin-left: 20px; } -div.contents dd { - font-size: 12px; -} - div.contents dt { margin-top: 16px; margin-bottom: 8px; @@ -328,6 +328,10 @@ dl.note, dl.remark, dl.warning, dl.attention { min-height: 48px; } +dl.note dd, dl.remark dd, dl.warning dd, dl.attention dd { + font-size: 12px; +} + dl.note { /* rice flower */ background:#e4ffde url('http://haiku-os.org/sites/haiku-os.org/themes/shijin/haiku-icons/alert_info_32.png') 15px 15px no-repeat; @@ -764,6 +768,7 @@ div.memdoc dl dd table.params td.paramname { vertical-align: top; font-weight: normal; font-style: normal; + color: #dc3c01; /* grenadier */ width: 157px; } diff --git a/docs/user/keyboard/US_PC_keyboard_keycodes.png b/docs/user/keyboard/US_PC_keyboard_keycodes.png index 134f01213e..5e81286adb 100644 Binary files a/docs/user/keyboard/US_PC_keyboard_keycodes.png and b/docs/user/keyboard/US_PC_keyboard_keycodes.png differ diff --git a/docs/user/locale/DurationFormat.dox b/docs/user/locale/DurationFormat.dox index 7f47e104fa..b35c57f014 100644 --- a/docs/user/locale/DurationFormat.dox +++ b/docs/user/locale/DurationFormat.dox @@ -50,8 +50,7 @@ /*! - \fn BDurationFormat& - BDurationFormat::operator=(const BDurationFormat& other) + \fn BDurationFormat& BDurationFormat::operator=(const BDurationFormat& other) \brief Assignment overload. \param other The BDurationFormat object to copy from. diff --git a/docs/user/storage/FilePanel.dox b/docs/user/storage/FilePanel.dox index b952ae4f65..b04804c050 100644 --- a/docs/user/storage/FilePanel.dox +++ b/docs/user/storage/FilePanel.dox @@ -62,7 +62,7 @@ /*! - \fn virtual bool Filter(const entry_ref* ref, BNode* node, + \fn virtual bool BRefFilter::Filter(const entry_ref* ref, BNode* node, struct stat_beos* stat, const char* mimeType) \brief Hook method that's called on each file in the target directory displayed by a file panel. diff --git a/docs/user/storage/Mime.dox b/docs/user/storage/Mime.dox new file mode 100644 index 0000000000..2488a75cba --- /dev/null +++ b/docs/user/storage/Mime.dox @@ -0,0 +1,187 @@ +/* + * Copyright 2013 Haiku Inc. + * Distributed under the terms of the MIT License. + * + * Documentation by: + * Ingo Weinhold, bonefish@users.sf.net + * John Scipione, jscipione@gmail.com + * + * Corresponds to: + * /trunk/headers/os/storage/Mime.h hrev45224 + * /trunk/src/kits/storage/Mime.cpp hrev45224 + */ + + +/*! + \file Mime.h + \ingroup storage + \brief Provides C and Haiku-only C++ MIME-type handling functions. +*/ + + +/*! + \enum icon_size + \brief Legacy BeOS icon size constants. +*/ + + +/*! + \var icon_size B_LARGE_ICON + + 32x32 "Large" icon. +*/ + + +/*! + \var icon_size B_MINI_ICON + + 16x16 "Mini" icon. +*/ + + +/*! + \var B_UPDATE_MIME_INFO_NO_FORCE + + Files that already have a \c BEOS:TYPE attribute won't be updated. +*/ + + +/*! + \var B_UPDATE_MIME_INFO_FORCE_KEEP_TYPE + + Files that already have a \c BEOS:TYPE attribute will be updated too, but + \c BEOS:TYPE itself will remain untouched. +*/ + + +/*! + \var B_UPDATE_MIME_INFO_FORCE_UPDATE_ALL + + Similar to \c B_UPDATE_MIME_INFO_FORCE_KEEP_TYPE, but the \c BEOS:TYPE + attribute will be updated too. +*/ + + +/*! + \fn status_t do_mime_update(int32 what, const char *path, int recursive, + int synchronous, int force) + \brief Helper function that contacts the registrar for mime update calls. + + \param what The message identifier. + \param path The path to a file or directory, or \c NULL. + \param recursive Triggers recursive behavior if not \c NULL. + \param synchronous If not \c NULL update_mime_info() waits until the + operation is finished, otherwise it returns immediately and the + update is done asynchronously. + \param force Specifies how to handle files that already have MIME + information. + + \returns A status code. + + \see update_mime_info +*/ + + +/*! + \fn int update_mime_info(const char *path, int recursive, int synchronous, + int force) + \brief Updates the MIME information (i.e MIME type) for one or more files. + + If \a path points to a file, the MIME information for this file are + updated only. If it points to a directory and \a recursive is non-null, + the information for all the files in the given directory tree are updated. + If path is \c NULL all files are considered; \a recursive is ignored in + this case. + + \param path The path to a file or directory, or \c NULL. + \param recursive Triggers recursive behavior if not \c NULL. + \param synchronous If not \c NULL update_mime_info() waits until the + operation is finished, otherwise it returns immediately and the + update is done asynchronously. + \param force Specifies how to handle files that already have MIME + information. See enum definitions for more information. + - \c B_UPDATE_MIME_INFO_NO_FORCE + - \c B_UPDATE_MIME_INFO_FORCE_KEEP_TYPE + - \c B_UPDATE_MIME_INFO_FORCE_UPDATE_ALL + + \returns A status code. \c B_OK if everything went fine, an error code + otherwise. +*/ + + +/*! + \fn status_t create_app_meta_mime(const char *path, int recursive, + int synchronous, int force) + \brief Creates a MIME database entry for one or more applications. + + If \a path points to an application file, a MIME DB entry is create for + the application. If it points to a directory and \a recursive is not + \c NULL then entries are created for all application files in the given + directory tree. If path is \c NULL then all files are considered and + \a recursive is ignored. + + \param path The path to an application file, a directory, or \c NULL. + \param recursive Trigger recursive behavior if not \c NULL. + \param synchronous Waits until the operation is finished if not \c NULL, + otherwise it returns immediately and the operation is done + asynchronously. + \param force Entries are created even if they do already exist if not + \c NULL. + + \returns A status code. \c B_OK if everything went fine, an error code + otherwise. +*/ + + +/*! + \fn status_t get_device_icon(const char *device, void *icon, int32 size) + \brief Retrieves an icon associated with a given device. + + \param device The path to the device. + \param icon A pointer to a buffer the icon data shall be written to. + \param size The size of the icon to retrieve. Currently 16 + (\c B_MINI_ICON) and 32 (\c B_LARGE_ICON) are supported. + + \returns A status code. + \retval B_OK Everything went fine. + \retval B_BAD_VALUE \a device or \a icon was \c NULL. + \retval B_NO_MEMORY Ran out of memory allocating bitmap. +*/ + + +/*! + \fn status_t get_device_icon(const char *device, BBitmap *icon, + icon_size which) + \brief Retrieves an icon associated with a given device into a BBitmap. + + \param device The path to the device. + \param icon A pointer to a pre-allocated BBitmap of the correct dimension + to store the requested icon (16x16 for the mini and 32x32 for the + large icon). + \param which The size of the icon to retrieve. Currently 16 + (\c B_MINI_ICON) and 32 (\c B_LARGE_ICON) are supported. + + \returns A status code. \c B_OK if everything went fine, an error code + otherwise. +*/ + + +/*! + \fn status_t get_device_icon(const char* device, uint8** _data, + size_t* _size, type_code* _type); + \brief Undocumented. +*/ + + +/*! + \fn status_t get_named_icon(const char* name, BBitmap* icon, + icon_size which); + \brief Undocumented. +*/ + + +/*! + \fn status_t get_named_icon(const char* name, uint8** _data, + size_t* _size, type_code* _type); + \brief Undocumented. +*/ diff --git a/headers/private/graphics/common/edid_raw.h b/headers/private/graphics/common/edid_raw.h index 5473d2341a..ee553a7a1c 100644 --- a/headers/private/graphics/common/edid_raw.h +++ b/headers/private/graphics/common/edid_raw.h @@ -1,6 +1,13 @@ /* * Copyright 2003, Thomas Kurschel. All Rights Reserved. * Distributed under the terms of the MIT License. + * + * Copyright 2006-2013 Haiku, Inc. All rights reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Thomas Kurschel + * Bill Randle, billr@neocat.org */ #ifndef _EDID_RAW_H #define _EDID_RAW_H @@ -224,12 +231,13 @@ typedef struct _PACKED { ); uint8 h_border; uint8 v_border; - BBITFIELD8_4 ( + BBITFIELD8_5 ( interlaced : 1, stereo : 2, // upper bit set - left on sync // lower bit set - right on sync sync : 2, - misc : 2 + misc : 2, + stereo_il : 1 ); } edid1_detailed_timing_raw; diff --git a/headers/private/graphics/radeon_hd/avivo_reg.h b/headers/private/graphics/radeon_hd/avivo_reg.h index 68e14ee1d7..0276617bb5 100644 --- a/headers/private/graphics/radeon_hd/avivo_reg.h +++ b/headers/private/graphics/radeon_hd/avivo_reg.h @@ -303,6 +303,8 @@ #define AVIVO_DDIA_BIT_DEPTH_CONTROL 0x7214 +#define AVIVO_DP_VID_STREAM_CNTL 0x770C + #define AVIVO_DACA_ENABLE 0x7800 #define AVIVO_DAC_ENABLE (1 << 0) #define AVIVO_DACA_SOURCE_SELECT 0x7804 @@ -558,4 +560,4 @@ #define AVIVO_D2_VBLANK_INTERRUPT (1 << 5) -#endif /* __AVIVO_REG_H__ */ \ No newline at end of file +#endif /* __AVIVO_REG_H__ */ diff --git a/headers/private/graphics/radeon_hd/ni_reg.h b/headers/private/graphics/radeon_hd/ni_reg.h new file mode 100644 index 0000000000..5db7b7d6fe --- /dev/null +++ b/headers/private/graphics/radeon_hd/ni_reg.h @@ -0,0 +1,86 @@ +/* + * Copyright 2010 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: Alex Deucher + */ +#ifndef __NI_REG_H__ +#define __NI_REG_H__ + +/* northern islands - DCE5 */ + +#define NI_INPUT_GAMMA_CONTROL 0x6840 +# define NI_GRPH_INPUT_GAMMA_MODE(x) (((x) & 0x3) << 0) +# define NI_INPUT_GAMMA_USE_LUT 0 +# define NI_INPUT_GAMMA_BYPASS 1 +# define NI_INPUT_GAMMA_SRGB_24 2 +# define NI_INPUT_GAMMA_XVYCC_222 3 +# define NI_OVL_INPUT_GAMMA_MODE(x) (((x) & 0x3) << 4) + +#define NI_PRESCALE_GRPH_CONTROL 0x68b4 +# define NI_GRPH_PRESCALE_BYPASS (1 << 4) + +#define NI_PRESCALE_OVL_CONTROL 0x68c4 +# define NI_OVL_PRESCALE_BYPASS (1 << 4) + +#define NI_INPUT_CSC_CONTROL 0x68d4 +# define NI_INPUT_CSC_GRPH_MODE(x) (((x) & 0x3) << 0) +# define NI_INPUT_CSC_BYPASS 0 +# define NI_INPUT_CSC_PROG_COEFF 1 +# define NI_INPUT_CSC_PROG_SHARED_MATRIXA 2 +# define NI_INPUT_CSC_OVL_MODE(x) (((x) & 0x3) << 4) + +#define NI_OUTPUT_CSC_CONTROL 0x68f0 +# define NI_OUTPUT_CSC_GRPH_MODE(x) (((x) & 0x7) << 0) +# define NI_OUTPUT_CSC_BYPASS 0 +# define NI_OUTPUT_CSC_TV_RGB 1 +# define NI_OUTPUT_CSC_YCBCR_601 2 +# define NI_OUTPUT_CSC_YCBCR_709 3 +# define NI_OUTPUT_CSC_PROG_COEFF 4 +# define NI_OUTPUT_CSC_PROG_SHARED_MATRIXB 5 +# define NI_OUTPUT_CSC_OVL_MODE(x) (((x) & 0x7) << 4) + +#define NI_DEGAMMA_CONTROL 0x6960 +# define NI_GRPH_DEGAMMA_MODE(x) (((x) & 0x3) << 0) +# define NI_DEGAMMA_BYPASS 0 +# define NI_DEGAMMA_SRGB_24 1 +# define NI_DEGAMMA_XVYCC_222 2 +# define NI_OVL_DEGAMMA_MODE(x) (((x) & 0x3) << 4) +# define NI_ICON_DEGAMMA_MODE(x) (((x) & 0x3) << 8) +# define NI_CURSOR_DEGAMMA_MODE(x) (((x) & 0x3) << 12) + +#define NI_GAMUT_REMAP_CONTROL 0x6964 +# define NI_GRPH_GAMUT_REMAP_MODE(x) (((x) & 0x3) << 0) +# define NI_GAMUT_REMAP_BYPASS 0 +# define NI_GAMUT_REMAP_PROG_COEFF 1 +# define NI_GAMUT_REMAP_PROG_SHARED_MATRIXA 2 +# define NI_GAMUT_REMAP_PROG_SHARED_MATRIXB 3 +# define NI_OVL_GAMUT_REMAP_MODE(x) (((x) & 0x3) << 4) + +#define NI_REGAMMA_CONTROL 0x6a80 +# define NI_GRPH_REGAMMA_MODE(x) (((x) & 0x7) << 0) +# define NI_REGAMMA_BYPASS 0 +# define NI_REGAMMA_SRGB_24 1 +# define NI_REGAMMA_XVYCC_222 2 +# define NI_REGAMMA_PROG_A 3 +# define NI_REGAMMA_PROG_B 4 +# define NI_OVL_REGAMMA_MODE(x) (((x) & 0x7) << 4) + +#endif diff --git a/headers/private/graphics/radeon_hd/radeon_hd.h b/headers/private/graphics/radeon_hd/radeon_hd.h index 952b16e894..6ae08f929d 100644 --- a/headers/private/graphics/radeon_hd/radeon_hd.h +++ b/headers/private/graphics/radeon_hd/radeon_hd.h @@ -20,6 +20,7 @@ #include "r700_reg.h" #include "evergreen_reg.h" #include "si_reg.h" +#include "ni_reg.h" #include #include @@ -170,6 +171,8 @@ struct radeon_shared_info { uint32 chipsetFlags; uint8 dceMajor; uint8 dceMinor; + + uint16 color_data[3 * 256]; // colour lookup table }; //----------------- ioctl() interface ---------------- diff --git a/headers/private/storage/PartitionParameterEditor.h b/headers/private/storage/PartitionParameterEditor.h index 701d84e759..757d6d14f4 100644 --- a/headers/private/storage/PartitionParameterEditor.h +++ b/headers/private/storage/PartitionParameterEditor.h @@ -1,4 +1,5 @@ /* + * Copyright 2013, Axel Dörfler, axeld@pinc-software.de. * Copyright 2009, Bryce Groff, brycegroff@gmail.com. * Distributed under the terms of the MIT License. */ @@ -9,26 +10,32 @@ #include -// BPartitionParameterEditor +class BMessage; +class BPartition; +class BVariant; + + class BPartitionParameterEditor { public: BPartitionParameterEditor(); virtual ~BPartitionParameterEditor(); - virtual bool FinishedEditing(); + virtual void SetTo(BPartition* partition); + + void SetModificationMessage(BMessage* message); + BMessage* ModificationMessage() const; virtual BView* View(); - virtual status_t GetParameters(BString* parameters); + virtual bool ValidateParameters() const; + virtual status_t ParameterChanged(const char* name, + const BVariant& variant); - // TODO: Those are child creation specific and shouldn't be in a generic - // interface. Something like a - // GenericPartitionParameterChanged(partition_parameter_type, - // const BVariant&) - // would be better. - virtual status_t PartitionTypeChanged(const char* type); - virtual status_t PartitionNameChanged(const char* name); + virtual status_t GetParameters(BString& parameters); + +private: + BMessage* fModificationMessage; }; -#endif //_PARTITION_PARAMETER_EDITOR_H +#endif // _PARTITION_PARAMETER_EDITOR_H diff --git a/headers/private/system/disk_device_types.h b/headers/private/system/disk_device_types.h index e428769c86..40ce1a50f9 100644 --- a/headers/private/system/disk_device_types.h +++ b/headers/private/system/disk_device_types.h @@ -25,7 +25,7 @@ #define AMIGA_PARTITION_NAME "Amiga Partition Map" #define APPLE_PARTITION_NAME "Apple Partition Map" -#define EFI_PARTITION_NAME "EFI GUID Partition Map" +#define EFI_PARTITION_NAME "GUID Partition Map" #define INTEL_PARTITION_NAME "Intel Partition Map" #define INTEL_EXTENDED_PARTITION_NAME "Intel Extended Partition" #define VMDK_PARTITION_NAME "VMDK Partition" diff --git a/src/add-ons/accelerants/radeon_hd/accelerant.h b/src/add-ons/accelerants/radeon_hd/accelerant.h index 4f5379a792..29651fa962 100644 --- a/src/add-ons/accelerants/radeon_hd/accelerant.h +++ b/src/add-ons/accelerants/radeon_hd/accelerant.h @@ -172,6 +172,7 @@ typedef struct { uint32 hfreqMin; edid1_info edidData; display_mode preferredMode; + display_mode currentMode; } display_info; diff --git a/src/add-ons/accelerants/radeon_hd/display.cpp b/src/add-ons/accelerants/radeon_hd/display.cpp index 7b212ee090..3400f083f4 100644 --- a/src/add-ons/accelerants/radeon_hd/display.cpp +++ b/src/add-ons/accelerants/radeon_hd/display.cpp @@ -3,7 +3,8 @@ * Distributed under the terms of the MIT License. * * Authors: - * Alexander von Gluck, kallisti5@unixzen.com + * Alexander von Gluck, kallisti5@unixzen.com + * Bill Randle, billr@neocat.org */ /* @@ -240,6 +241,29 @@ detect_crt_ranges(uint32 crtid) } +static void +remove_dup_displays(uint32 displayIndex, uint32 id) +{ + /* hack for both digital and analog interfaces active */ + if ((displayIndex > 0) && gDisplay[displayIndex]->attached) { + if (gConnector[id-1]->encoder.type == VIDEO_ENCODER_TMDS) { + int gpioID1 = gConnector[id-1]->gpioID; + int gpioID2 = gConnector[id]->gpioID; + edid1_info* edid = &gDisplay[displayIndex-1]->edidData; + + if ((gGPIOInfo[gpioID1]->hwPin == gGPIOInfo[gpioID2]->hwPin) && + edid->display.input_type) + // give preference to digital display when both are present + // and other display indicates it is digital + TRACE("%s: skipping connector %" B_PRIu32 + ": giving preference to digital " + "connector %d\n", __func__, id, id-1); + gDisplay[displayIndex]->attached = 0; + } + } +} + + status_t detect_displays() { @@ -264,19 +288,18 @@ detect_displays() } if (gConnector[id]->type == VIDEO_CONNECTOR_DP) { - edid1_info* edid = &gDisplay[displayIndex]->edidData; - TRACE("%s: connector(%" B_PRIu32 "): Checking DP.\n", __func__, id); - status_t dpHasEDID = ddc2_dp_read_edid1(id, edid); + + edid1_info* edid = &gDisplay[displayIndex]->edidData; gDisplay[displayIndex]->attached - = (dpHasEDID == B_OK ? true : false); + = ddc2_dp_read_edid1(id, edid); + if (gDisplay[displayIndex]->attached) { TRACE("%s: connector(%" B_PRIu32 "): Found DisplayPort EDID!\n", __func__); } } - - // TODO: As DP aux transactions don't work yet, just use LVDS as a hack + // TODO: Handle external DP brides - ?? #if 0 if (gConnector[id]->encoderExternal.isDPBridge == true) { // If this is a DisplayPort Bridge, setup ddc on bus @@ -287,11 +310,9 @@ detect_displays() gDisplay[displayIndex]->attached = true; // TODO: DDC Router switching for DisplayPort (and others?) - } else if (gConnector[id]->type == VIDEO_CONNECTOR_LVDS) { + } #endif - - if (gDisplay[displayIndex]->attached == false - && gConnector[id]->type == VIDEO_CONNECTOR_LVDS) { + if (gConnector[id]->type == VIDEO_CONNECTOR_LVDS) { // If plain (non-DP) laptop LVDS, read mode info from AtomBIOS //TRACE("%s: non-DP laptop LVDS detected\n", __func__); gDisplay[displayIndex]->attached = connector_read_mode_lvds(id, @@ -313,7 +334,7 @@ detect_displays() // Since DVI-I shows up as two connectors, and there is only one // edid channel, we have to make *sure* the edid data received is - // valid for te connector. + // valid for the connector. // Found EDID data? if (gDisplay[displayIndex]->attached) { @@ -331,6 +352,7 @@ detect_displays() "and a analog encoder.\n", __func__, id); gDisplay[displayIndex]->attached = encoder_analog_load_detect(id); + remove_dup_displays(displayIndex, id); } else if (edid->display.input_type && !analogEncoder) { // If EDID is digital, we make an assumption here. TRACE("%s: connector(%" B_PRIu32 "): has digital EDID " @@ -339,9 +361,16 @@ detect_displays() // This generally means the monitor is of poor design // Since we *know* there is no load on the analog encoder // we assume that it is a digital display. + // This can also occur when a display has both DVI and VGA + // inputs and the graphics board has a DVI-I connector + // (reported as both digital and analog connectors) and the + // analog connection is the one in use. In that case, we + // get here when checking the digital connector and want + // to disable that display in favor of the analog one. TRACE("%s: connector(%" B_PRIu32 "): Warning: monitor has " "false digital EDID flag + unloaded analog encoder!\n", __func__, id); + gDisplay[displayIndex]->attached = false; } } } @@ -558,7 +587,6 @@ display_crtc_scale(uint8 crtcID, display_mode* mode) void display_crtc_dpms(uint8 crtcID, int mode) { - radeon_shared_info &info = *gInfo->shared_info; switch (mode) { @@ -566,8 +594,8 @@ display_crtc_dpms(uint8 crtcID, int mode) TRACE("%s: crtc %" B_PRIu8 " dpms powerup\n", __func__, crtcID); if (gDisplay[crtcID]->attached == false) return; - gDisplay[crtcID]->powered = true; display_crtc_power(crtcID, ATOM_ENABLE); + gDisplay[crtcID]->powered = true; if (info.dceMajor >= 3) display_crtc_memreq(crtcID, ATOM_ENABLE); display_crtc_blank(crtcID, ATOM_BLANKING_OFF); @@ -588,12 +616,121 @@ display_crtc_dpms(uint8 crtcID, int mode) } +void +display_dce45_crtc_load_lut(uint8 crtcID) +{ + radeon_shared_info &info = *gInfo->shared_info; + register_info* regs = gDisplay[crtcID]->regs; + + TRACE("%s: crtcID %" B_PRIu8 "\n", __func__, crtcID); + + uint16* r = info.color_data; + uint16* g = r + 256; + uint16* b = r + 512; + + if (info.dceMajor >= 5) { + Write32(OUT, NI_INPUT_CSC_CONTROL + regs->crtcOffset, + (NI_INPUT_CSC_GRPH_MODE(NI_INPUT_CSC_BYPASS) | + NI_INPUT_CSC_OVL_MODE(NI_INPUT_CSC_BYPASS))); + Write32(OUT, NI_PRESCALE_GRPH_CONTROL + regs->crtcOffset, + NI_GRPH_PRESCALE_BYPASS); + Write32(OUT, NI_PRESCALE_OVL_CONTROL + regs->crtcOffset, + NI_OVL_PRESCALE_BYPASS); + Write32(OUT, NI_INPUT_GAMMA_CONTROL + regs->crtcOffset, + (NI_GRPH_INPUT_GAMMA_MODE(NI_INPUT_GAMMA_USE_LUT) | + NI_OVL_INPUT_GAMMA_MODE(NI_INPUT_GAMMA_USE_LUT))); + } + + Write32(OUT, EVERGREEN_DC_LUT_CONTROL + regs->crtcOffset, 0); + + Write32(OUT, EVERGREEN_DC_LUT_BLACK_OFFSET_BLUE + regs->crtcOffset, 0); + Write32(OUT, EVERGREEN_DC_LUT_BLACK_OFFSET_GREEN + regs->crtcOffset, 0); + Write32(OUT, EVERGREEN_DC_LUT_BLACK_OFFSET_RED + regs->crtcOffset, 0); + + Write32(OUT, EVERGREEN_DC_LUT_WHITE_OFFSET_BLUE + regs->crtcOffset, 0xffff); + Write32(OUT, EVERGREEN_DC_LUT_WHITE_OFFSET_GREEN + regs->crtcOffset, 0xffff); + Write32(OUT, EVERGREEN_DC_LUT_WHITE_OFFSET_RED + regs->crtcOffset, 0xffff); + + Write32(OUT, EVERGREEN_DC_LUT_RW_MODE, 0); + Write32(OUT, EVERGREEN_DC_LUT_WRITE_EN_MASK, 0x00000007); + + Write32(OUT, EVERGREEN_DC_LUT_RW_INDEX, 0); + for (int i = 0; i < 256; i++) { + Write32(OUT, EVERGREEN_DC_LUT_30_COLOR + regs->crtcOffset, + (r[i] << 20) | + (g[i] << 10) | + (b[i] << 0)); + } + + if (info.dceMajor >= 5) { + Write32(OUT, NI_DEGAMMA_CONTROL + regs->crtcOffset, + (NI_GRPH_DEGAMMA_MODE(NI_DEGAMMA_BYPASS) | + NI_OVL_DEGAMMA_MODE(NI_DEGAMMA_BYPASS) | + NI_ICON_DEGAMMA_MODE(NI_DEGAMMA_BYPASS) | + NI_CURSOR_DEGAMMA_MODE(NI_DEGAMMA_BYPASS))); + Write32(OUT, NI_GAMUT_REMAP_CONTROL + regs->crtcOffset, + (NI_GRPH_GAMUT_REMAP_MODE(NI_GAMUT_REMAP_BYPASS) | + NI_OVL_GAMUT_REMAP_MODE(NI_GAMUT_REMAP_BYPASS))); + Write32(OUT, NI_REGAMMA_CONTROL + regs->crtcOffset, + (NI_GRPH_REGAMMA_MODE(NI_REGAMMA_BYPASS) | + NI_OVL_REGAMMA_MODE(NI_REGAMMA_BYPASS))); + Write32(OUT, NI_OUTPUT_CSC_CONTROL + regs->crtcOffset, + (NI_OUTPUT_CSC_GRPH_MODE(NI_OUTPUT_CSC_BYPASS) | + NI_OUTPUT_CSC_OVL_MODE(NI_OUTPUT_CSC_BYPASS))); + /* XXX match this to the depth of the crtc fmt block, move to modeset? */ + Write32(OUT, 0x6940 + regs->crtcOffset, 0); + } +} + + +void +display_avivo_crtc_load_lut(uint8 crtcID) +{ + radeon_shared_info &info = *gInfo->shared_info; + register_info* regs = gDisplay[crtcID]->regs; + + TRACE("%s: crtcID %" B_PRIu8 "\n", __func__, crtcID); + + uint16* r = info.color_data; + uint16* g = r + 256; + uint16* b = r + 512; + + Write32(OUT, AVIVO_DC_LUTA_CONTROL + regs->crtcOffset, 0); + + Write32(OUT, AVIVO_DC_LUTA_BLACK_OFFSET_BLUE + regs->crtcOffset, 0); + Write32(OUT, AVIVO_DC_LUTA_BLACK_OFFSET_GREEN + regs->crtcOffset, 0); + Write32(OUT, AVIVO_DC_LUTA_BLACK_OFFSET_RED + regs->crtcOffset, 0); + + Write32(OUT, AVIVO_DC_LUTA_WHITE_OFFSET_BLUE + regs->crtcOffset, 0xffff); + Write32(OUT, AVIVO_DC_LUTA_WHITE_OFFSET_GREEN + regs->crtcOffset, 0xffff); + Write32(OUT, AVIVO_DC_LUTA_WHITE_OFFSET_RED + regs->crtcOffset, 0xffff); + + Write32(OUT, AVIVO_DC_LUT_RW_SELECT, crtcID); + Write32(OUT, AVIVO_DC_LUT_RW_MODE, 0); + Write32(OUT, AVIVO_DC_LUT_WRITE_EN_MASK, 0x0000003f); + + Write32(OUT, AVIVO_DC_LUT_RW_INDEX, 0); + for (int i = 0; i < 256; i++) { + Write32(OUT, AVIVO_DC_LUT_30_COLOR, + (r[i] << 20) | + (g[i] << 10) | + (b[i] << 0)); + } + + Write32(OUT, AVIVO_D1GRPH_LUT_SEL + regs->crtcOffset, crtcID); +} + + void display_crtc_fb_set(uint8 crtcID, display_mode* mode) { radeon_shared_info &info = *gInfo->shared_info; register_info* regs = gDisplay[crtcID]->regs; + uint16* r = info.color_data; + uint16* g = r + 256; + uint16* b = r + 512; + uint32 fbSwap; if (info.dceMajor >= 4) fbSwap = EVERGREEN_GRPH_ENDIAN_SWAP(EVERGREEN_GRPH_ENDIAN_NONE); @@ -616,6 +753,7 @@ display_crtc_fb_set(uint8 crtcID, display_mode* mode) fbFormat = AVIVO_D1GRPH_CONTROL_DEPTH_8BPP | AVIVO_D1GRPH_CONTROL_8BPP_INDEXED; } + // TODO: copy system color map into shared info break; case B_RGB15_LITTLE: bytesPerPixel = 2; @@ -646,6 +784,17 @@ display_crtc_fb_set(uint8 crtcID, display_mode* mode) fbSwap = R600_D1GRPH_SWAP_ENDIAN_16BIT; #endif } + + { + // default gamma table + uint16 gamma = 0; + for (int i = 0; i < 256; i++) { + r[i] = gamma; + g[i] = gamma; + b[i] = gamma; + gamma += 4; + } + } break; case B_RGB24_LITTLE: case B_RGB32_LITTLE: @@ -666,6 +815,17 @@ display_crtc_fb_set(uint8 crtcID, display_mode* mode) fbSwap = R600_D1GRPH_SWAP_ENDIAN_32BIT; #endif } + + { + // default gamma table + uint16 gamma = 0; + for (int i = 0; i < 256; i++) { + r[i] = gamma; + g[i] = gamma; + b[i] = gamma; + gamma += 4; + } + } break; } @@ -685,7 +845,7 @@ display_crtc_fb_set(uint8 crtcID, display_mode* mode) (fbAddress >> 32) & 0xf); } - TRACE("%s: Set SurfaceAddress: 0x%" B_PRIX32 "\n", + TRACE("%s: Set SurfaceAddress: 0x%" B_PRIX64 "\n", __func__, (fbAddress & 0xFFFFFFFF)); Write32(OUT, regs->grphPrimarySurfaceAddr, (fbAddress & 0xFFFFFFFF)); @@ -700,16 +860,17 @@ display_crtc_fb_set(uint8 crtcID, display_mode* mode) uint32 widthAligned = mode->virtual_width; uint32 pitchMask = 0; + // assume micro-linear/macro-linear mode (i.e., not tiled) switch (bytesPerPixel) { case 1: - pitchMask = 255; + pitchMask = 63; break; case 2: - pitchMask = 127; + pitchMask = 31; break; case 3: case 4: - pitchMask = 63; + pitchMask = 31; break; } widthAligned += pitchMask; @@ -718,7 +879,7 @@ display_crtc_fb_set(uint8 crtcID, display_mode* mode) TRACE("%s: fb: %" B_PRIu32 "x%" B_PRIu32 " (%" B_PRIu32 " bpp)\n", __func__, mode->virtual_width, mode->virtual_height, bitsPerPixel); TRACE("%s: fb pitch: %" B_PRIu32 " \n", __func__, - widthAligned * bytesPerPixel / 4); + widthAligned); TRACE("%s: fb width aligned: %" B_PRIu32 "\n", __func__, widthAligned); @@ -728,7 +889,7 @@ display_crtc_fb_set(uint8 crtcID, display_mode* mode) Write32(CRT, regs->grphYStart, 0); Write32(CRT, regs->grphXEnd, mode->virtual_width); Write32(CRT, regs->grphYEnd, mode->virtual_height); - Write32(CRT, regs->grphPitch, widthAligned * bytesPerPixel / 4); + Write32(CRT, regs->grphPitch, widthAligned); Write32(CRT, regs->grphEnable, 1); // Enable Frame buffer @@ -751,7 +912,7 @@ display_crtc_fb_set(uint8 crtcID, display_mode* mode) Write32(OUT, EVERGREEN_MASTER_UPDATE_MODE + regs->crtcOffset, 0); // Pageflip to happen anywhere in vblank - + display_dce45_crtc_load_lut(crtcID); } else { uint32 tmp = Read32(OUT, AVIVO_D1GRPH_FLIP_CONTROL + regs->crtcOffset); tmp &= ~AVIVO_D1GRPH_SURFACE_UPDATE_H_RETRACE_EN; @@ -759,6 +920,7 @@ display_crtc_fb_set(uint8 crtcID, display_mode* mode) Write32(OUT, AVIVO_D1MODE_MASTER_UPDATE_MODE + regs->crtcOffset, 0); // Pageflip to happen anywhere in vblank + display_avivo_crtc_load_lut(crtcID); } // update shared info @@ -816,8 +978,8 @@ display_crtc_set_dtd(uint8 crtcID, display_mode* mode) { display_timing& displayTiming = mode->timing; - TRACE("%s called to do %dx%d\n", - __func__, displayTiming.h_display, displayTiming.v_display); + TRACE("%s called to do %dx%d\n", __func__, + displayTiming.h_display, displayTiming.v_display); SET_CRTC_USING_DTD_TIMING_PARAMETERS args; int index = GetIndexIntoMasterTable(COMMAND, SetCRTC_UsingDTDTiming); @@ -825,6 +987,7 @@ display_crtc_set_dtd(uint8 crtcID, display_mode* mode) memset(&args, 0, sizeof(args)); + // Note: the code below assumes H & V borders are both zero uint16 blankStart = MIN(displayTiming.h_sync_start, displayTiming.h_display); uint16 blankEnd diff --git a/src/add-ons/accelerants/radeon_hd/display.h b/src/add-ons/accelerants/radeon_hd/display.h index 93c25e1b32..5676bbdb58 100644 --- a/src/add-ons/accelerants/radeon_hd/display.h +++ b/src/add-ons/accelerants/radeon_hd/display.h @@ -31,6 +31,8 @@ void display_crtc_set(uint8 crtcID, display_mode* mode); void display_crtc_set_dtd(uint8 crtcID, display_mode* mode); void display_crtc_power(uint8 crtcID, int command); void display_crtc_memreq(uint8 crtcID, int command); +void display_avivo_crtc_load_lut(uint8 crtcID); +void display_dce45_crtc_load_lut(uint8 crtcID); #endif /* RADEON_HD_DISPLAY_H */ diff --git a/src/add-ons/accelerants/radeon_hd/displayport.cpp b/src/add-ons/accelerants/radeon_hd/displayport.cpp index 3acd66d267..a2421a54b9 100644 --- a/src/add-ons/accelerants/radeon_hd/displayport.cpp +++ b/src/add-ons/accelerants/radeon_hd/displayport.cpp @@ -15,6 +15,7 @@ #include "accelerant_protos.h" #include "connector.h" #include "mode.h" +#include "edid.h" #undef TRACE @@ -341,8 +342,8 @@ dp_get_lane_count(uint32 connectorIndex, display_mode* mode) size_t pixelChunk; size_t pixelsPerChunk; - status_t result = dp_get_pixel_size_for((color_space)mode->space, &pixelChunk, - NULL, &pixelsPerChunk); + status_t result = dp_get_pixel_size_for((color_space)mode->space, + &pixelChunk, NULL, &pixelsPerChunk); if (result != B_OK) { TRACE("%s: Invalid color space!\n", __func__); @@ -355,7 +356,8 @@ dp_get_lane_count(uint32 connectorIndex, display_mode* mode) uint32 dpMaxLaneCount = dp_get_lane_count_max(dpInfo); uint32 lane; - for (lane = 1; lane < dpMaxLaneCount; lane <<= 1) { + // don't go below 2 lanes or display is jittery + for (lane = 2; lane < dpMaxLaneCount; lane <<= 1) { uint32 maxPixelClock = dp_get_pixel_clock_max(dpMaxLinkRate, lane, bitsPerPixel); if (mode->timing.pixel_clock <= maxPixelClock) @@ -380,8 +382,8 @@ dp_get_link_rate(uint32 connectorIndex, display_mode* mode) size_t pixelChunk; size_t pixelsPerChunk; - status_t result = dp_get_pixel_size_for((color_space)mode->space, &pixelChunk, - NULL, &pixelsPerChunk); + status_t result = dp_get_pixel_size_for((color_space)mode->space, + &pixelChunk, NULL, &pixelsPerChunk); if (result != B_OK) { TRACE("%s: Invalid color space!\n", __func__); @@ -430,6 +432,8 @@ dp_setup_connectors() continue; } + TRACE("%s: found dp connector on index %" B_PRIu32 "\n", + __func__, index); uint32 gpioID = gConnector[index]->gpioID; uint32 auxPin = gGPIOInfo[gpioID]->hwPin; @@ -655,6 +659,7 @@ dp_link_train_cr(uint32 connectorIndex) dp_set_tp(connectorIndex, DP_TRAIN_PATTERN_1); memset(dp->trainingSet, 0, 4); dp_update_vs_emph(connectorIndex); + snooze(400); while (1) { if (dp->trainingReadInterval == 0) @@ -763,11 +768,13 @@ dp_link_train_ce(uint32 connectorIndex) status_t -dp_link_train(uint32 connectorIndex, display_mode* mode) +dp_link_train(uint8 crtcID) { TRACE("%s\n", __func__); + uint32 connectorIndex = gDisplay[crtcID]->connectorIndex; dp_info* dp = &gConnector[connectorIndex]->dpInfo; + display_mode* mode = &gDisplay[crtcID]->currentMode; if (dp->valid != true) { ERROR("%s: started on invalid DisplayPort connector #%" B_PRIu32 "\n", @@ -830,7 +837,10 @@ dp_link_train(uint32 connectorIndex, display_mode* mode) encoder_dig_setup(connectorIndex, mode->timing.pixel_clock, ATOM_ENCODER_CMD_SETUP_PANEL_MODE); - if (dp->config[0] >= DP_DPCD_REV_11) + // TODO: Doesn't this overwrite important dpcd info? + sandbox = dp->laneCount; + if ((dp->config[0] >= DP_DPCD_REV_11) + && (dp->config[2] & DP_ENHANCED_FRAME_CAP_EN)) sandbox |= DP_ENHANCED_FRAME_EN; dpcd_reg_write(hwPin, DP_LANE_COUNT, sandbox); @@ -872,7 +882,7 @@ dp_link_train(uint32 connectorIndex, display_mode* mode) } -status_t +bool ddc2_dp_read_edid1(uint32 connectorIndex, edid1_info* edid) { TRACE("%s\n", __func__); @@ -880,15 +890,16 @@ ddc2_dp_read_edid1(uint32 connectorIndex, edid1_info* edid) dp_info* dpInfo = &gConnector[connectorIndex]->dpInfo; if (!dpInfo->valid) - return B_ERROR; - - edid1_raw raw; - uint8* rdata = (uint8_t*)&raw; - uint8 sdata = 0; + return false; // The following sequence is from a trace of the Linux kernel // radeon code; not sure if the initial writes to address 0 are // requried. + + // TODO: This surely cane be cleaned up + edid1_raw raw; + uint8* rdata = (uint8*)&raw; + uint8 sdata = 0; dp_aux_set_i2c_byte(dpInfo->auxPin, 0x00, &sdata, true, false); dp_aux_set_i2c_byte(dpInfo->auxPin, 0x00, &sdata, false, true); @@ -902,25 +913,25 @@ ddc2_dp_read_edid1(uint32 connectorIndex, edid1_info* edid) dp_aux_get_i2c_byte(dpInfo->auxPin, 0x50, rdata, true, false); for (uint32 i = 0; i < sizeof(raw); i++) { - status_t result = dp_aux_get_i2c_byte(dpInfo->auxPin, 0x50, rdata++, - false, false); - if (result) { - ERROR("%s: error reading EDID data at index %" B_PRIu32 "\n", - __func__, i); + status_t ret = dp_aux_get_i2c_byte(dpInfo->auxPin, 0x50, + rdata++, false, false); + if (ret) { + TRACE("%s: error reading EDID data at index %d, ret = %d\n", + __func__, i, ret); dp_aux_get_i2c_byte(dpInfo->auxPin, 0x50, &sdata, false, true); - return B_ERROR; + return false; } } dp_aux_get_i2c_byte(dpInfo->auxPin, 0x50, &sdata, false, true); if (raw.version.version != 1 || raw.version.revision > 4) { ERROR("%s: EDID version or revision out of range\n", __func__); - return B_ERROR; + return false; } edid_decode(edid, &raw); - return B_OK; + return true; } diff --git a/src/add-ons/accelerants/radeon_hd/displayport.h b/src/add-ons/accelerants/radeon_hd/displayport.h index ae484d081a..46c97fac2f 100644 --- a/src/add-ons/accelerants/radeon_hd/displayport.h +++ b/src/add-ons/accelerants/radeon_hd/displayport.h @@ -40,7 +40,7 @@ uint32 dp_get_lane_count(uint32 connectorIndex, display_mode* mode); void dp_setup_connectors(); -status_t dp_link_train(uint32 connectorIndex, display_mode* mode); +status_t dp_link_train(uint8 crtcID); status_t dp_link_train_cr(uint32 connectorIndex); status_t dp_link_train_ce(uint32 connectorIndex); @@ -48,7 +48,8 @@ void debug_dp_info(); status_t dp_get_pixel_size_for(color_space space, size_t *pixelChunk, size_t *rowAlignment, size_t *pixelsPerChunk); -status_t ddc2_dp_read_edid1(uint32 connectorIndex, edid1_info *edid); + +bool ddc2_dp_read_edid1(uint32 connectorIndex, edid1_info *edid); -#endif /* RADEON_HD_DISPLAYPORT_H */ \ No newline at end of file +#endif /* RADEON_HD_DISPLAYPORT_H */ diff --git a/src/add-ons/accelerants/radeon_hd/encoder.cpp b/src/add-ons/accelerants/radeon_hd/encoder.cpp index 314bb4ef61..4064d2cb01 100644 --- a/src/add-ons/accelerants/radeon_hd/encoder.cpp +++ b/src/add-ons/accelerants/radeon_hd/encoder.cpp @@ -294,7 +294,7 @@ encoder_mode_set(uint8 crtcID) uint16 encoderFlags = gConnector[connectorIndex]->encoder.flags; pll_info* pll = &gConnector[connectorIndex]->encoder.pll; - // Adjusted pixel clock (*NOT* original mode pixel clock) + // TODO: Should this be the adjusted pll or the original? uint32 pixelClock = pll->pixelClock; switch (gConnector[connectorIndex]->encoder.objectID) { @@ -324,6 +324,9 @@ encoder_mode_set(uint8 crtcID) case ENCODER_OBJECT_ID_INTERNAL_UNIPHY1: case ENCODER_OBJECT_ID_INTERNAL_UNIPHY2: case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_LVTMA: + // already handled by virue of setting DPMS_OFF before + // getting here +#if 0 if ((info.chipsetFlags & CHIP_APU) != 0 || info.dceMajor >= 5) { // Setup DIG encoder @@ -356,6 +359,7 @@ encoder_mode_set(uint8 crtcID) transmitter_dig_setup(connectorIndex, pixelClock, 0, 0, ATOM_TRANSMITTER_ACTION_ENABLE); } +#endif break; case ENCODER_OBJECT_ID_INTERNAL_DDI: case ENCODER_OBJECT_ID_INTERNAL_DVO1: @@ -1828,8 +1832,17 @@ encoder_dpms_set_dig(uint8 crtcID, int mode) transmitter_dig_setup(connectorIndex, pll->pixelClock, 0, 0, ATOM_ENCODER_CMD_SETUP); } + encoder_dig_setup(connectorIndex, pll->pixelClock, ATOM_ENABLE); + transmitter_dig_setup(connectorIndex, pll->pixelClock, 0, 0, + ATOM_TRANSMITTER_ACTION_SETUP); transmitter_dig_setup(connectorIndex, pll->pixelClock, 0, 0, ATOM_TRANSMITTER_ACTION_ENABLE); + /* some early dce3.2 boards have a bug in their transmitter + control table */ + if (info.chipsetID != RADEON_RV710 + && info.chipsetID != RADEON_RV730) + transmitter_dig_setup(connectorIndex, pll->pixelClock, 0, 0, + ATOM_TRANSMITTER_ACTION_ENABLE_OUTPUT); } else { transmitter_dig_setup(connectorIndex, pll->pixelClock, 0, 0, ATOM_TRANSMITTER_ACTION_ENABLE_OUTPUT); @@ -1845,12 +1858,15 @@ encoder_dpms_set_dig(uint8 crtcID, int mode) encoder_dig_setup(connectorIndex, pll->pixelClock, ATOM_ENCODER_CMD_DP_VIDEO_OFF); } - // TODO: dp link train here - //radeon_dp_link_train(encoder, connector); + // dp link train + dp_link_train(crtcID); if (info.dceMajor >= 4) { encoder_dig_setup(connectorIndex, pll->pixelClock, ATOM_ENCODER_CMD_DP_VIDEO_ON); } + // not sure what AtomBIOS table/command sets this + // register, but it's required to get the video output + Write32(OUT, AVIVO_DP_VID_STREAM_CNTL, 0x201); } if ((encoderFlags & ATOM_DEVICE_LCD_SUPPORT) != 0) { transmitter_dig_setup(connectorIndex, pll->pixelClock, @@ -1866,6 +1882,9 @@ encoder_dpms_set_dig(uint8 crtcID, int mode) } else { transmitter_dig_setup(connectorIndex, pll->pixelClock, 0, 0, ATOM_TRANSMITTER_ACTION_DISABLE_OUTPUT); + transmitter_dig_setup(connectorIndex, pll->pixelClock, 0, 0, + ATOM_TRANSMITTER_ACTION_DISABLE); + encoder_dig_setup(connectorIndex, pll->pixelClock, ATOM_DISABLE); } if (connector_is_dp(connectorIndex)) { if (info.dceMajor >= 4) { diff --git a/src/add-ons/accelerants/radeon_hd/hooks.cpp b/src/add-ons/accelerants/radeon_hd/hooks.cpp index d57bb73517..238c9624e8 100644 --- a/src/add-ons/accelerants/radeon_hd/hooks.cpp +++ b/src/add-ons/accelerants/radeon_hd/hooks.cpp @@ -39,7 +39,7 @@ get_accelerant_hook(uint32 feature, void* data) case B_DPMS_MODE: return (void*)radeon_dpms_mode; case B_SET_DPMS_MODE: - return (void*)radeon_dpms_set; + return (void*)radeon_dpms_set_hook; /* mode configuration */ case B_ACCELERANT_MODE_COUNT: diff --git a/src/add-ons/accelerants/radeon_hd/mode.cpp b/src/add-ons/accelerants/radeon_hd/mode.cpp index d272965cc3..815d52f42f 100644 --- a/src/add-ons/accelerants/radeon_hd/mode.cpp +++ b/src/add-ons/accelerants/radeon_hd/mode.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2006-2011, Haiku, Inc. All Rights Reserved. + * Copyright 2006-2013, Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. * * Support for i915 chipset and up based on the X driver, @@ -69,6 +69,7 @@ uint32 radeon_accelerant_mode_count(void) { TRACE("%s\n", __func__); + // TODO: multi-monitor? we need crtcid here return gInfo->shared_info->mode_count; } @@ -78,6 +79,7 @@ status_t radeon_get_mode_list(display_mode* modeList) { TRACE("%s\n", __func__); + // TODO: multi-monitor? we need crtcid here memcpy(modeList, gInfo->mode_list, gInfo->shared_info->mode_count * sizeof(display_mode)); return B_OK; @@ -88,8 +90,8 @@ status_t radeon_get_preferred_mode(display_mode* preferredMode) { TRACE("%s\n", __func__); + // TODO: multi-monitor? we need crtcid here - // TODO: Argh! Which display? :) uint8_t crtc = 0; if (gDisplay[crtc]->preferredMode.virtual_width > 0 @@ -119,7 +121,7 @@ radeon_get_edid_info(void* info, size_t size, uint32* edid_version) memcpy(info, &gInfo->shared_info->edid_info, sizeof(struct edid1_info)); // VESA //memcpy(info, &gDisplay[0]->edidData, sizeof(struct edid1_info)); - // BitBanged display 0 + // Display 0 *edid_version = EDID_VERSION_1; @@ -145,27 +147,46 @@ radeon_dpms_mode(void) void -radeon_dpms_set(int mode) +radeon_dpms_set(uint8 id, int mode) { - for (uint8 id = 0; id < MAX_DISPLAY; id++) { + if (mode == B_DPMS_ON) { + display_crtc_dpms(id, mode); + encoder_dpms_set(id, mode); + } else { encoder_dpms_set(id, mode); display_crtc_dpms(id, mode); } - gInfo->dpms_mode = mode; } +void +radeon_dpms_set_hook(int mode) +{ + // TODO: multi-monitor? for now we use VESA edid + + // As the accelerant hook doesn't pass crtc id + for (uint8 id = 0; id < MAX_DISPLAY; id++) { + radeon_dpms_set(id, mode); + } +} + + status_t radeon_set_display_mode(display_mode* mode) { - radeon_shared_info &info = *gInfo->shared_info; + // TODO: multi-monitor? For now we set the mode on + // all displays (this is very incorrect). This also + // causes a lot of problems on DisplayPort devices // Set mode on each display for (uint8 id = 0; id < MAX_DISPLAY; id++) { if (gDisplay[id]->attached == false) continue; + // Copy this display mode into the "current mode" for the display + memcpy(&gDisplay[id]->currentMode, mode, sizeof(display_mode)); + uint32 connectorIndex = gDisplay[id]->connectorIndex; // Determine DP lanes if DP @@ -177,9 +198,8 @@ radeon_set_display_mode(display_mode* mode) // *** crtc and encoder prep encoder_output_lock(true); - encoder_dpms_set(id, B_DPMS_OFF); display_crtc_lock(id, ATOM_ENABLE); - display_crtc_dpms(id, B_DPMS_OFF); + radeon_dpms_set(id, B_DPMS_OFF); // *** Set up encoder -> crtc routing encoder_assign_crtc(id); @@ -201,31 +221,15 @@ radeon_set_display_mode(display_mode* mode) // *** encoder mode set encoder_mode_set(id); - // *** CRT controler commit - display_crtc_dpms(id, B_DPMS_ON); + // *** encoder and CRT controller commit + radeon_dpms_set(id, B_DPMS_ON); display_crtc_lock(id, ATOM_DISABLE); - - // *** encoder commit - - // handle DisplayPort link training - if (connector_is_dp(connectorIndex)) { - if (info.dceMajor >= 4) - encoder_dig_setup(connectorIndex, - ATOM_ENCODER_CMD_DP_VIDEO_OFF, 0); - - dp_link_train(connectorIndex, mode); - - if (info.dceMajor >= 4) - encoder_dig_setup(connectorIndex, - ATOM_ENCODER_CMD_DP_VIDEO_ON, 0); - } - - encoder_dpms_set(id, B_DPMS_ON); encoder_output_lock(false); } + #ifdef TRACE_MODE // for debugging - // debug_dp_info(); + debug_dp_info(); TRACE("D1CRTC_STATUS Value: 0x%X\n", Read32(CRT, AVIVO_D1CRTC_STATUS)); @@ -247,6 +251,7 @@ radeon_set_display_mode(display_mode* mode) Read32(CRT, AVIVO_D1CRTC_BLANK_CONTROL)); TRACE("D2CRTC_BLANK_CONTROL Value: 0x%X\n", Read32(CRT, AVIVO_D1CRTC_BLANK_CONTROL)); + #endif return B_OK; } @@ -258,6 +263,7 @@ radeon_get_display_mode(display_mode* _currentMode) TRACE("%s\n", __func__); *_currentMode = gInfo->shared_info->current_mode; + //*_currentMode = gDisplay[X]->currentMode; return B_OK; } diff --git a/src/add-ons/accelerants/radeon_hd/mode.h b/src/add-ons/accelerants/radeon_hd/mode.h index 59a5ce1147..db98aecb90 100644 --- a/src/add-ons/accelerants/radeon_hd/mode.h +++ b/src/add-ons/accelerants/radeon_hd/mode.h @@ -32,7 +32,8 @@ bool is_mode_supported(display_mode* mode); status_t is_mode_sane(display_mode* mode); uint32 radeon_dpms_capabilities(void); uint32 radeon_dpms_mode(void); -void radeon_dpms_set(int mode); +void radeon_dpms_set(uint8 id, int mode); +void radeon_dpms_set_hook(int mode); uint32 get_mode_bpp(display_mode* mode); diff --git a/src/add-ons/accelerants/radeon_hd/pll.cpp b/src/add-ons/accelerants/radeon_hd/pll.cpp index 9ee2695eeb..4a614d47d6 100644 --- a/src/add-ons/accelerants/radeon_hd/pll.cpp +++ b/src/add-ons/accelerants/radeon_hd/pll.cpp @@ -301,7 +301,7 @@ pll_compute_post_divider(pll_info* pll) if ((pll->flags & PLL_IS_LCD) != 0) vco = pll->lcdPllOutMin; else - vco = pll->pllOutMin; + vco = pll->pllOutMax; } else { if ((pll->flags & PLL_IS_LCD) != 0) vco = pll->lcdPllOutMax; @@ -311,8 +311,8 @@ pll_compute_post_divider(pll_info* pll) TRACE("%s: vco = %" B_PRIu32 "\n", __func__, vco); - uint32 postDivider = vco / pll->pixelClock; - uint32 tmp = vco % pll->pixelClock; + uint32 postDivider = vco / pll->adjustedClock; + uint32 tmp = vco % pll->adjustedClock; if ((pll->flags & PLL_PREFER_MINM_OVER_MAXP) != 0) { if (tmp) @@ -337,7 +337,7 @@ pll_compute(pll_info* pll) { pll_compute_post_divider(pll); - uint32 targetClock = pll->pixelClock; + uint32 targetClock = pll->adjustedClock; pll->feedbackDiv = 0; pll->feedbackDivFrac = 0; @@ -364,7 +364,7 @@ pll_compute(pll_info* pll) pll->feedbackDiv = pll->minFeedbackDiv; pll->feedbackDivFrac - = (100 * pll->feedbackDivFrac) / pll->referenceFreq; + = (1000 * pll->feedbackDivFrac) / pll->referenceFreq; if (pll->feedbackDivFrac >= 5) { pll->feedbackDivFrac -= 5; @@ -436,12 +436,12 @@ pll_compute(pll_info* pll) TRACE("%s: pixel clock: %" B_PRIu32 " gives:" " feedbackDivider = %" B_PRIu32 ".%" B_PRIu32 "; referenceDivider = %" B_PRIu32 "; postDivider = %" B_PRIu32 "\n", - __func__, pll->pixelClock, pll->feedbackDiv, pll->feedbackDivFrac, + __func__, pll->adjustedClock, pll->feedbackDiv, pll->feedbackDivFrac, pll->referenceDiv, pll->postDiv); - if (pll->pixelClock != calculatedClock) { + if (pll->adjustedClock != calculatedClock) { TRACE("%s: pixel clock %" B_PRIu32 " was changed to %" B_PRIu32 "\n", - __func__, pll->pixelClock, calculatedClock); + __func__, pll->adjustedClock, calculatedClock); pll->pixelClock = calculatedClock; } @@ -515,6 +515,7 @@ pll_adjust(pll_info* pll, display_mode* mode, uint8 crtcID) uint32 encoderFlags = connector->encoder.flags; uint32 externalEncoderID = 0; + pll->adjustedClock = pll->pixelClock; if (connector->encoderExternal.isDPBridge) externalEncoderID = connector->encoderExternal.objectID; @@ -557,9 +558,9 @@ pll_adjust(pll_info* pll, display_mode* mode, uint8 crtcID) atom_execute_table(gAtomContext, index, (uint32*)&args); // get returned adjusted clock - pll->pixelClock + pll->adjustedClock = B_LENDIAN_TO_HOST_INT16(args.v1.usPixelClock); - pll->pixelClock *= 10; + pll->adjustedClock *= 10; break; case 3: args.v3.sInput.usPixelClock @@ -607,10 +608,10 @@ pll_adjust(pll_info* pll, display_mode* mode, uint8 crtcID) atom_execute_table(gAtomContext, index, (uint32*)&args); // get returned adjusted clock - pll->pixelClock + pll->adjustedClock = B_LENDIAN_TO_HOST_INT32( args.v3.sOutput.ulDispPllFreq); - pll->pixelClock *= 10; + pll->adjustedClock *= 10; // convert to kHz for storage if (args.v3.sOutput.ucRefDiv) { @@ -638,7 +639,7 @@ pll_adjust(pll_info* pll, display_mode* mode, uint8 crtcID) } TRACE("%s: was: %" B_PRIu32 ", now: %" B_PRIu32 "\n", __func__, - pixelClock, pll->pixelClock); + pixelClock, pll->adjustedClock); return B_OK; } @@ -649,6 +650,8 @@ pll_set(display_mode* mode, uint8 crtcID) { uint32 connectorIndex = gDisplay[crtcID]->connectorIndex; pll_info* pll = &gConnector[connectorIndex]->encoder.pll; + uint32 dp_clock = gConnector[connectorIndex]->dpInfo.linkRate / 10; + bool ssEnabled = false; pll->pixelClock = mode->timing.pixel_clock; @@ -668,23 +671,28 @@ pll_set(display_mode* mode, uint8 crtcID) if (info.dceMajor >= 4) pll_asic_ss_probe(pll, ASIC_INTERNAL_SS_ON_DP); else { - // TODO: DP Clock == 1.62Ghz? - pll_ppll_ss_probe(pll, ATOM_DP_SS_ID1); + if (dp_clock == 16200) { + ssEnabled = pll_ppll_ss_probe(pll, ATOM_DP_SS_ID2); + if (!ssEnabled) + // id2 failed, try id1 + ssEnabled = pll_ppll_ss_probe(pll, ATOM_DP_SS_ID1); + } else + ssEnabled = pll_ppll_ss_probe(pll, ATOM_DP_SS_ID1); } break; case ATOM_ENCODER_MODE_LVDS: if (info.dceMajor >= 4) - pll_asic_ss_probe(pll, gInfo->lvdsSpreadSpectrumID); + ssEnabled = pll_asic_ss_probe(pll, gInfo->lvdsSpreadSpectrumID); else - pll_ppll_ss_probe(pll, gInfo->lvdsSpreadSpectrumID); + ssEnabled = pll_ppll_ss_probe(pll, gInfo->lvdsSpreadSpectrumID); break; case ATOM_ENCODER_MODE_DVI: if (info.dceMajor >= 4) - pll_asic_ss_probe(pll, ASIC_INTERNAL_SS_ON_TMDS); + ssEnabled = pll_asic_ss_probe(pll, ASIC_INTERNAL_SS_ON_TMDS); break; case ATOM_ENCODER_MODE_HDMI: if (info.dceMajor >= 4) - pll_asic_ss_probe(pll, ASIC_INTERNAL_SS_ON_HDMI); + ssEnabled = pll_asic_ss_probe(pll, ASIC_INTERNAL_SS_ON_HDMI); break; } @@ -836,7 +844,8 @@ pll_set(display_mode* mode, uint8 crtcID) status_t result = atom_execute_table(gAtomContext, index, (uint32*)&args); - display_crtc_ss(pll, ATOM_ENABLE); + if (ssEnabled) + display_crtc_ss(pll, ATOM_ENABLE); return result; } diff --git a/src/add-ons/accelerants/radeon_hd/pll.h b/src/add-ons/accelerants/radeon_hd/pll.h index 3a5cbba7e0..1a29381082 100644 --- a/src/add-ons/accelerants/radeon_hd/pll.h +++ b/src/add-ons/accelerants/radeon_hd/pll.h @@ -93,6 +93,9 @@ struct pll_info { /* asic spread spectrum */ uint16 ssRate; uint16 ssAmount; + + /* pixel clock to be used in pll calculations (kHz) */ + uint32 adjustedClock; }; diff --git a/src/add-ons/disk_systems/Jamfile b/src/add-ons/disk_systems/Jamfile index 6262e19a6f..9ef53ba605 100644 --- a/src/add-ons/disk_systems/Jamfile +++ b/src/add-ons/disk_systems/Jamfile @@ -1,5 +1,6 @@ SubDir HAIKU_TOP src add-ons disk_systems ; SubInclude HAIKU_TOP src add-ons disk_systems bfs ; +SubInclude HAIKU_TOP src add-ons disk_systems gpt ; SubInclude HAIKU_TOP src add-ons disk_systems intel ; SubInclude HAIKU_TOP src add-ons disk_systems ntfs ; diff --git a/src/add-ons/disk_systems/bfs/BFSAddOn.rdef b/src/add-ons/disk_systems/bfs/BFSAddOn.rdef index 862d9dbe33..3c2589d5db 100644 --- a/src/add-ons/disk_systems/bfs/BFSAddOn.rdef +++ b/src/add-ons/disk_systems/bfs/BFSAddOn.rdef @@ -1,7 +1,3 @@ -/* - * BFSAddOn.rdef - */ - resource app_signature "application/x-vnd.Haiku-BFSAddOn"; resource app_version { @@ -11,5 +7,5 @@ resource app_version { variety = 0, internal = 0, short_info = "1.0.0", - long_info = "Haiku BFS disk add-on." + long_info = "BFS disk add-on." }; diff --git a/src/add-ons/disk_systems/bfs/InitializeParameterEditor.cpp b/src/add-ons/disk_systems/bfs/InitializeParameterEditor.cpp index 50e12534af..99ac65215a 100644 --- a/src/add-ons/disk_systems/bfs/InitializeParameterEditor.cpp +++ b/src/add-ons/disk_systems/bfs/InitializeParameterEditor.cpp @@ -1,4 +1,5 @@ /* + * Copyright 2013, Axel Dörfler, axeld@pinc-software.de. * Copyright 2009-2010, Stephan Aßmus * Copyright 2009, Bryce Groff, brycegroff@gmail.com. * Distributed under the terms of the MIT License. @@ -16,10 +17,11 @@ #include #include #include -#include +#include #include #include #include +#include #include #include @@ -36,10 +38,9 @@ InitializeBFSEditor::InitializeBFSEditor() : BPartitionParameterEditor(), fView(NULL), - fNameTC(NULL), - fBlockSizeMF(NULL), - fUseIndicesCB(NULL), - fParameters(NULL) + fNameControl(NULL), + fBlockSizeMenuField(NULL), + fUseIndicesCheckBox(NULL) { _CreateViewControls(); } @@ -50,6 +51,15 @@ InitializeBFSEditor::~InitializeBFSEditor() } +void +InitializeBFSEditor::SetTo(BPartition* partition) +{ + BString name = partition->ContentName(); + if (!name.IsEmpty()) + fNameControl->SetText(name.String()); +} + + BView* InitializeBFSEditor::View() { @@ -58,41 +68,39 @@ InitializeBFSEditor::View() bool -InitializeBFSEditor::FinishedEditing() +InitializeBFSEditor::ValidateParameters() const { - fParameters = ""; - if (BMenuItem* item = fBlockSizeMF->Menu()->FindMarked()) { - const char* size; - BMessage* message = item->Message(); - if (!message || message->FindString("size", &size) < B_OK) - size = "2048"; - // TODO: use libroot driver settings API - fParameters << "block_size " << size << ";\n"; - } - if (fUseIndicesCB->Value() == B_CONTROL_OFF) - fParameters << "noindex;\n"; - - fParameters << "name \"" << fNameTC->Text() << "\";\n"; - - return true; + // The name must be set + return fNameControl->TextView()->TextLength() > 0; } status_t -InitializeBFSEditor::GetParameters(BString* parameters) +InitializeBFSEditor::ParameterChanged(const char* name, const BVariant& variant) { - if (parameters == NULL) - return B_BAD_VALUE; - - *parameters = fParameters; + if (!strcmp(name, "name")) + fNameControl->SetText(variant.ToString()); return B_OK; } status_t -InitializeBFSEditor::PartitionNameChanged(const char* name) +InitializeBFSEditor::GetParameters(BString& parameters) { - fNameTC->SetText(name); + parameters = ""; + + if (BMenuItem* item = fBlockSizeMenuField->Menu()->FindMarked()) { + const char* size; + BMessage* message = item->Message(); + if (!message || message->FindString("size", &size) < B_OK) + size = "2048"; + // TODO: use libroot driver settings API + parameters << "block_size " << size << ";\n"; + } + if (fUseIndicesCheckBox->Value() == B_CONTROL_OFF) + parameters << "noindex;\n"; + + parameters << "name \"" << fNameControl->Text() << "\";\n"; return B_OK; } @@ -100,10 +108,9 @@ InitializeBFSEditor::PartitionNameChanged(const char* name) void InitializeBFSEditor::_CreateViewControls() { - fNameTC = new BTextControl(B_TRANSLATE("Name:"), "Haiku", NULL); - fNameTC->SetModificationMessage(new BMessage(MSG_NAME_CHANGED)); - // TODO find out what is the max length for this specific FS partition name - fNameTC->TextView()->SetMaxBytes(31); + fNameControl = new BTextControl(B_TRANSLATE("Name:"), "Haiku", NULL); + fNameControl->SetModificationMessage(new BMessage(MSG_NAME_CHANGED)); + fNameControl->TextView()->SetMaxBytes(31); BPopUpMenu* blocksizeMenu = new BPopUpMenu("blocksize"); BMessage* message = new BMessage(MSG_BLOCK_SIZE); @@ -123,13 +130,15 @@ InitializeBFSEditor::_CreateViewControls() blocksizeMenu->AddItem(new BMenuItem( B_TRANSLATE("8192 (Mostly large files)"), message)); - fBlockSizeMF = new BMenuField(B_TRANSLATE("Blocksize:"), blocksizeMenu); + fBlockSizeMenuField = new BMenuField(B_TRANSLATE("Blocksize:"), + blocksizeMenu); defaultItem->SetMarked(true); - fUseIndicesCB = new BCheckBox(B_TRANSLATE("Enable query support"), NULL); - fUseIndicesCB->SetValue(true); - fUseIndicesCB->SetToolTip(B_TRANSLATE("Disabling query support may speed " - "up certain file system operations, but should only be used " + fUseIndicesCheckBox = new BCheckBox(B_TRANSLATE("Enable query support"), + NULL); + fUseIndicesCheckBox->SetValue(true); + fUseIndicesCheckBox->SetToolTip(B_TRANSLATE("Disabling query support may " + "speed up certain file system operations, but should only be used " "if one is absolutely certain that one will not need queries.\n" "Any volume that is intended for booting Haiku must have query " "support enabled.")); @@ -138,14 +147,14 @@ InitializeBFSEditor::_CreateViewControls() fView = BGridLayoutBuilder(spacing, spacing) // row 1 - .Add(fNameTC->CreateLabelLayoutItem(), 0, 0) - .Add(fNameTC->CreateTextViewLayoutItem(), 1, 0) + .Add(fNameControl->CreateLabelLayoutItem(), 0, 0) + .Add(fNameControl->CreateTextViewLayoutItem(), 1, 0) // row 2 - .Add(fBlockSizeMF->CreateLabelLayoutItem(), 0, 1) - .Add(fBlockSizeMF->CreateMenuBarLayoutItem(), 1, 1) + .Add(fBlockSizeMenuField->CreateLabelLayoutItem(), 0, 1) + .Add(fBlockSizeMenuField->CreateMenuBarLayoutItem(), 1, 1) // row 3 - .Add(fUseIndicesCB, 0, 2, 2).View() + .Add(fUseIndicesCheckBox, 0, 2, 2).View() ; } diff --git a/src/add-ons/disk_systems/bfs/InitializeParameterEditor.h b/src/add-ons/disk_systems/bfs/InitializeParameterEditor.h index 339cea0519..9f7abc32e9 100644 --- a/src/add-ons/disk_systems/bfs/InitializeParameterEditor.h +++ b/src/add-ons/disk_systems/bfs/InitializeParameterEditor.h @@ -1,4 +1,5 @@ /* + * Copyright 2013, Axel Dörfler, axeld@pinc-software.de. * Copyright 2009-2010, Stephan Aßmus * Copyright 2009, Bryce Groff, brycegroff@gmail.com. * Distributed under the terms of the MIT License. @@ -10,6 +11,7 @@ #include #include + class BCheckBox; class BMenuField; class BTextControl; @@ -21,21 +23,24 @@ public: InitializeBFSEditor(); virtual ~InitializeBFSEditor(); - virtual bool FinishedEditing(); - virtual BView* View(); - virtual status_t GetParameters(BString* parameters); + virtual void SetTo(BPartition* partition); - virtual status_t PartitionNameChanged(const char* name); + virtual bool ValidateParameters() const; + virtual status_t ParameterChanged(const char* name, + const BVariant& variant); + + virtual BView* View(); + + virtual status_t GetParameters(BString& parameters); private: void _CreateViewControls(); +private: BView* fView; - BTextControl* fNameTC; - BMenuField* fBlockSizeMF; - BCheckBox* fUseIndicesCB; - - BString fParameters; + BTextControl* fNameControl; + BMenuField* fBlockSizeMenuField; + BCheckBox* fUseIndicesCheckBox; }; diff --git a/src/add-ons/disk_systems/gpt/GPTDiskAddOn.cpp b/src/add-ons/disk_systems/gpt/GPTDiskAddOn.cpp new file mode 100644 index 0000000000..5fc79e0ecb --- /dev/null +++ b/src/add-ons/disk_systems/gpt/GPTDiskAddOn.cpp @@ -0,0 +1,155 @@ +/* + * Copyright 2013, Axel Dörfler, axeld@pinc-software.de. + * Distributed under the terms of the MIT License. + */ + + +#include "GPTDiskAddOn.h" + +#include +#include + +#include +#include +#include +#include + +#include +#include + +#include "efi_gpt.h" + +#include "GPTPartitionHandle.h" +#include "Utility.h" + + +//#define TRACE_GPT_DISK_ADD_ON +#undef TRACE +#ifdef TRACE_GPT_DISK_ADD_ON +# define TRACE(x...) printf(x) +#else +# define TRACE(x...) do {} while (false) +#endif + + +static const uint32 kDiskSystemFlags = + 0 +// | B_DISK_SYSTEM_SUPPORTS_CHECKING +// | B_DISK_SYSTEM_SUPPORTS_REPAIRING +// | B_DISK_SYSTEM_SUPPORTS_RESIZING +// | B_DISK_SYSTEM_SUPPORTS_MOVING +// | B_DISK_SYSTEM_SUPPORTS_SETTING_CONTENT_NAME +// | B_DISK_SYSTEM_SUPPORTS_SETTING_CONTENT_PARAMETERS + | B_DISK_SYSTEM_SUPPORTS_INITIALIZING +// | B_DISK_SYSTEM_SUPPORTS_CONTENT_NAME + +// | B_DISK_SYSTEM_SUPPORTS_RESIZING_CHILD +// | B_DISK_SYSTEM_SUPPORTS_MOVING_CHILD +// | B_DISK_SYSTEM_SUPPORTS_SETTING_NAME + | B_DISK_SYSTEM_SUPPORTS_SETTING_TYPE +// | B_DISK_SYSTEM_SUPPORTS_SETTING_PARAMETERS + | B_DISK_SYSTEM_SUPPORTS_CREATING_CHILD + | B_DISK_SYSTEM_SUPPORTS_DELETING_CHILD +// | B_DISK_SYSTEM_SUPPORTS_NAME +; + + +// #pragma mark - GPTDiskAddOn + + +GPTDiskAddOn::GPTDiskAddOn() + : + BDiskSystemAddOn(EFI_PARTITION_NAME, kDiskSystemFlags) +{ +} + + +GPTDiskAddOn::~GPTDiskAddOn() +{ +} + + +status_t +GPTDiskAddOn::CreatePartitionHandle(BMutablePartition* partition, + BPartitionHandle** _handle) +{ + GPTPartitionHandle* handle + = new(std::nothrow) GPTPartitionHandle(partition); + if (handle == NULL) + return B_NO_MEMORY; + + status_t error = handle->Init(); + if (error != B_OK) { + delete handle; + return error; + } + + *_handle = handle; + return B_OK; +} + + +bool +GPTDiskAddOn::CanInitialize(const BMutablePartition* partition) +{ + // If it's big enough, we can initialize it. + return partition->Size() >= round_up(partition->BlockSize() + + EFI_PARTITION_ENTRY_COUNT * EFI_PARTITION_ENTRY_SIZE, + partition->BlockSize()); +} + + +status_t +GPTDiskAddOn::GetInitializationParameterEditor( + const BMutablePartition* partition, BPartitionParameterEditor** editor) +{ + // Nothing to edit, really. + *editor = NULL; + return B_OK; +} + + +status_t +GPTDiskAddOn::ValidateInitialize(const BMutablePartition* partition, + BString* name, const char* parameters) +{ + if (!CanInitialize(partition) + || (parameters != NULL && parameters[0] != '\0')) + return B_BAD_VALUE; + + // we don't support a content name + if (name != NULL) + name->Truncate(0); + + return B_OK; +} + + +status_t +GPTDiskAddOn::Initialize(BMutablePartition* partition, const char* name, + const char* parameters, BPartitionHandle** _handle) +{ + if (!CanInitialize(partition) + || (name != NULL && name[0] != '\0') + || (parameters != NULL && parameters[0] != '\0')) + return B_BAD_VALUE; + + GPTPartitionHandle* handle + = new(std::nothrow) GPTPartitionHandle(partition); + if (handle == NULL) + return B_NO_MEMORY; + + status_t status = partition->SetContentType(Name()); + if (status != B_OK) { + delete handle; + return status; + } + + partition->SetContentName(NULL); + partition->SetContentParameters(NULL); + partition->SetContentSize( + round_down(partition->Size(), partition->BlockSize())); + + *_handle = handle; + return B_OK; +} diff --git a/src/add-ons/disk_systems/gpt/GPTDiskAddOn.h b/src/add-ons/disk_systems/gpt/GPTDiskAddOn.h new file mode 100644 index 0000000000..40349b7f71 --- /dev/null +++ b/src/add-ons/disk_systems/gpt/GPTDiskAddOn.h @@ -0,0 +1,35 @@ +/* + * Copyright 2013, Axel Dörfler, axeld@pinc-software.de. + * Distributed under the terms of the MIT License. + */ +#ifndef GPT_DISK_ADD_ON_H +#define GPT_DISK_ADD_ON_H + + +#include + + +class GPTDiskAddOn : public BDiskSystemAddOn { +public: + GPTDiskAddOn(); + virtual ~GPTDiskAddOn(); + + virtual status_t CreatePartitionHandle( + BMutablePartition* partition, + BPartitionHandle** handle); + + virtual bool CanInitialize( + const BMutablePartition* partition); + virtual status_t GetInitializationParameterEditor( + const BMutablePartition* partition, + BPartitionParameterEditor** editor); + virtual status_t ValidateInitialize( + const BMutablePartition* partition, + BString* name, const char* parameters); + virtual status_t Initialize(BMutablePartition* partition, + const char* name, const char* parameters, + BPartitionHandle** handle); +}; + + +#endif // GPT_DISK_ADD_ON_H diff --git a/src/add-ons/disk_systems/gpt/GPTDiskAddOn.rdef b/src/add-ons/disk_systems/gpt/GPTDiskAddOn.rdef new file mode 100644 index 0000000000..41771bdba8 --- /dev/null +++ b/src/add-ons/disk_systems/gpt/GPTDiskAddOn.rdef @@ -0,0 +1,11 @@ +resource app_signature "application/x-vnd.Haiku-GPTDiskAddOn"; + +resource app_version { + major = 1, + middle = 0, + minor = 0, + variety = 0, + internal = 0, + short_info = "1.0.0", + long_info = "GUID Partition Table disk add-on." +}; diff --git a/src/add-ons/disk_systems/gpt/GPTDiskSystem.cpp b/src/add-ons/disk_systems/gpt/GPTDiskSystem.cpp new file mode 100644 index 0000000000..a40b84065c --- /dev/null +++ b/src/add-ons/disk_systems/gpt/GPTDiskSystem.cpp @@ -0,0 +1,24 @@ +/* + * Copyright 2013, Axel Dörfler, axeld@pinc-software.de. + * Distributed under the terms of the MIT License. + */ + + +#include + +#include + +#include "GPTDiskAddOn.h" + + +status_t +get_disk_system_add_ons(BList* addOns) +{ + GPTDiskAddOn* addOn = new(std::nothrow) GPTDiskAddOn(); + if (!addOns->AddItem(addOn)) { + delete addOn; + return B_NO_MEMORY; + } + + return B_OK; +} diff --git a/src/add-ons/disk_systems/gpt/GPTPartitionHandle.cpp b/src/add-ons/disk_systems/gpt/GPTPartitionHandle.cpp new file mode 100644 index 0000000000..73dfc1c3e5 --- /dev/null +++ b/src/add-ons/disk_systems/gpt/GPTPartitionHandle.cpp @@ -0,0 +1,197 @@ +/* + * Copyright 2013, Axel Dörfler, axeld@pinc-software.de. + * Copyright 2007, Ingo Weinhold, bonefish@users.sf.net. + * Distributed under the terms of the MIT License. + */ + + +#include "GPTPartitionHandle.h" + +#include +#include + +#include +#include +#include +#include +#include + +#include + +#include "gpt_known_guids.h" + + +//#define TRACE_GPT_PARTITION_HANDLE +#undef TRACE +#ifdef TRACE_GPT_PARTITION_HANDLE +# define TRACE(x...) printf(x) +#else +# define TRACE(x...) do {} while (false) +#endif + + +GPTPartitionHandle::GPTPartitionHandle(BMutablePartition* partition) + : + BPartitionHandle(partition) +{ +} + + +GPTPartitionHandle::~GPTPartitionHandle() +{ +} + + +status_t +GPTPartitionHandle::Init() +{ + // TODO: how to get the path of a BMutablePartition? + //BPath path; + //status_t status = Partition()->GetPath(&path); + //if (status != B_OK) + //return status; + + //fd = open(path.Path(), O_RDONLY); + //if (fd < 0) + //return errno; + + //fHeader = new EFI::Header(fd, Partition()->BlockSize(), + //Partition()->BlockSize()); + //status = fHeader->InitCheck(); + //if (status != B_OK) + //return status; + + //close(fd); + return B_OK; +} + + +uint32 +GPTPartitionHandle::SupportedOperations(uint32 mask) +{ + uint32 flags = B_DISK_SYSTEM_SUPPORTS_RESIZING + | B_DISK_SYSTEM_SUPPORTS_MOVING + | B_DISK_SYSTEM_SUPPORTS_SETTING_CONTENT_PARAMETERS + | B_DISK_SYSTEM_SUPPORTS_INITIALIZING; + + // creating child + if ((mask & B_DISK_SYSTEM_SUPPORTS_CREATING_CHILD) != 0) { + BPartitioningInfo info; + if (GetPartitioningInfo(&info) == B_OK + && info.CountPartitionableSpaces() > 1) { + flags |= B_DISK_SYSTEM_SUPPORTS_CREATING_CHILD; + } + } + + return flags; +} + + +uint32 +GPTPartitionHandle::SupportedChildOperations(const BMutablePartition* child, + uint32 mask) +{ + return B_DISK_SYSTEM_SUPPORTS_RESIZING_CHILD + | B_DISK_SYSTEM_SUPPORTS_MOVING_CHILD + | B_DISK_SYSTEM_SUPPORTS_SETTING_TYPE + | B_DISK_SYSTEM_SUPPORTS_DELETING_CHILD; +} + + +status_t +GPTPartitionHandle::GetNextSupportedType(const BMutablePartition* child, + int32* cookie, BString* type) +{ + int32 index = *cookie; + TRACE("GPTPartitionHandle::GetNextSupportedType(child: %p, cookie: %ld)\n", + child, index); + + if (index >= int32(sizeof(kTypeMap) / sizeof(kTypeMap[0]))) + return B_ENTRY_NOT_FOUND; + + type->SetTo(kTypeMap[index].type); + *cookie = index + 1; + + return B_OK; +} + + +status_t +GPTPartitionHandle::GetPartitioningInfo(BPartitioningInfo* info) +{ + // init to the full size (minus the GPT table header and entries) + off_t size = Partition()->ContentSize(); + // TODO: use fHeader + size_t headerSize = Partition()->BlockSize() + 16384; + status_t status = info->SetTo(Partition()->BlockSize() + headerSize, + size - Partition()->BlockSize() - 2 * headerSize); + if (status != B_OK) + return status; + + // Exclude the space of the existing partitions + size_t count = Partition()->CountChildren(); + for (size_t index = 0; index < count; index++) { + BMutablePartition* child = Partition()->ChildAt(index); + status = info->ExcludeOccupiedSpace(child->Offset(), child->Size()); + if (status != B_OK) + return status; + } + + return B_OK; +} + + +status_t +GPTPartitionHandle::GetParameterEditor(B_PARAMETER_EDITOR_TYPE type, + BPartitionParameterEditor** editor) +{ + *editor = NULL; + if (type == B_CREATE_PARAMETER_EDITOR) { + try { + *editor = new BPartitionParameterEditor(); + } catch (std::bad_alloc) { + return B_NO_MEMORY; + } + return B_OK; + } + return B_NOT_SUPPORTED; +} + + +status_t +GPTPartitionHandle::ValidateCreateChild(off_t* _offset, off_t* _size, + const char* typeString, BString* name, const char* parameters) +{ + return B_OK; +} + + +status_t +GPTPartitionHandle::CreateChild(off_t offset, off_t size, + const char* typeString, const char* name, const char* parameters, + BMutablePartition** _child) +{ + // create the child + BMutablePartition* partition = Partition(); + BMutablePartition* child; + status_t status = partition->CreateChild(partition->CountChildren(), + typeString, name, parameters, &child); + if (status != B_OK) + return status; + + // init the child + child->SetOffset(offset); + child->SetSize(size); + child->SetBlockSize(partition->BlockSize()); + + *_child = child; + return B_OK; +} + + +status_t +GPTPartitionHandle::DeleteChild(BMutablePartition* child) +{ + BMutablePartition* parent = child->Parent(); + return parent->DeleteChild(child); +} diff --git a/src/add-ons/disk_systems/gpt/GPTPartitionHandle.h b/src/add-ons/disk_systems/gpt/GPTPartitionHandle.h new file mode 100644 index 0000000000..c743bd0065 --- /dev/null +++ b/src/add-ons/disk_systems/gpt/GPTPartitionHandle.h @@ -0,0 +1,50 @@ +/* + * Copyright 2013, Axel Dörfler, axeld@pinc-software.de. + * Distributed under the terms of the MIT License. + */ +#ifndef GPT_PARTITION_HANDLE_H +#define GPT_PARTITION_HANDLE_H + + +#include + +#include "Header.h" + + +class GPTPartitionHandle : public BPartitionHandle { +public: + GPTPartitionHandle( + BMutablePartition* partition); + virtual ~GPTPartitionHandle(); + + status_t Init(); + + virtual uint32 SupportedOperations(uint32 mask); + virtual uint32 SupportedChildOperations( + const BMutablePartition* child, + uint32 mask); + + virtual status_t GetNextSupportedType( + const BMutablePartition* child, + int32* cookie, BString* type); + + virtual status_t GetPartitioningInfo(BPartitioningInfo* info); + + virtual status_t GetParameterEditor( + B_PARAMETER_EDITOR_TYPE type, + BPartitionParameterEditor** editor); + virtual status_t ValidateCreateChild(off_t* offset, + off_t* size, const char* type, + BString* name, const char* parameters); + virtual status_t CreateChild(off_t offset, off_t size, + const char* type, const char* name, + const char* parameters, + BMutablePartition** child); + virtual status_t DeleteChild(BMutablePartition* child); + +private: + EFI::Header* fHeader; +}; + + +#endif // GPT_PARTITION_HANDLE_H diff --git a/src/add-ons/disk_systems/gpt/Jamfile b/src/add-ons/disk_systems/gpt/Jamfile new file mode 100644 index 0000000000..5174bc5cbd --- /dev/null +++ b/src/add-ons/disk_systems/gpt/Jamfile @@ -0,0 +1,22 @@ +SubDir HAIKU_TOP src add-ons disk_systems gpt ; + +UsePrivateHeaders interface shared storage ; +UsePrivateSystemHeaders ; + +SEARCH_SOURCE + += [ FDirName $(HAIKU_TOP) src add-ons kernel partitioning_systems gpt ] ; + +AddResources gpt : GPTDiskAddOn.rdef ; + +Addon gpt : + GPTDiskSystem.cpp + GPTDiskAddOn.cpp + GPTPartitionHandle.cpp + + # from the kernel partitioning system add-on + Header.cpp + crc32.cpp + utility.cpp + + : be $(TARGET_LIBSUPC++) +; diff --git a/src/add-ons/disk_systems/gpt/Utility.h b/src/add-ons/disk_systems/gpt/Utility.h new file mode 100644 index 0000000000..2c2ad1a077 --- /dev/null +++ b/src/add-ons/disk_systems/gpt/Utility.h @@ -0,0 +1,26 @@ +/* + * Copyright 2013, Axel Dörfler, axeld@pinc-software.de. + * Distributed under the terms of the MIT License. + */ +#ifndef UTILITY_H +#define UTILITY_H + + +#include + + +static inline off_t +round_down(off_t a, uint32 b) +{ + return a / b * b; +} + + +static inline off_t +round_up(off_t a, uint32 b) +{ + return round_down(a + b - 1, b); +} + + +#endif // UTILITY_H diff --git a/src/add-ons/disk_systems/intel/CreationParameterEditor.cpp b/src/add-ons/disk_systems/intel/CreationParameterEditor.cpp index 881a6e07b9..75c3819b9e 100644 --- a/src/add-ons/disk_systems/intel/CreationParameterEditor.cpp +++ b/src/add-ons/disk_systems/intel/CreationParameterEditor.cpp @@ -1,4 +1,5 @@ /* + * Copyright 2013, Axel Dörfler, axeld@pinc-software.de. * Copyright 2009, Bryce Groff, brycegroff@gmail.com. * Distributed under the terms of the MIT License. */ @@ -10,15 +11,15 @@ #include #include #include +#include #include + #undef B_TRANSLATION_CONTEXT -#define B_TRANSLATION_CONTEXT "BFS_Creation_Parameter" +#define B_TRANSLATION_CONTEXT "PrimaryPartitionEditor" PrimaryPartitionEditor::PrimaryPartitionEditor() - : - fParameters(NULL) { fActiveCheckBox = new BCheckBox("active", B_TRANSLATE("Active partition"), NULL); @@ -39,35 +40,28 @@ PrimaryPartitionEditor::View() } -bool -PrimaryPartitionEditor::FinishedEditing() +status_t +PrimaryPartitionEditor::ParameterChanged(const char* name, + const BVariant& variant) +{ + if (!strcmp(name, "type")) { + fActiveCheckBox->SetEnabled(strcmp(variant.ToString(), + kPartitionTypeIntelExtended) != 0); + } + return B_OK; +} + + +status_t +PrimaryPartitionEditor::GetParameters(BString& parameters) { if (fActiveCheckBox->IsEnabled()) { if (fActiveCheckBox->Value() == B_CONTROL_ON) - fParameters.SetTo("active true ;"); + parameters.SetTo("active true ;"); else - fParameters.SetTo("active false ;"); + parameters.SetTo("active false ;"); } else - fParameters.SetTo(""); + parameters.SetTo(""); - return true; -} - - -status_t -PrimaryPartitionEditor::GetParameters(BString* parameters) -{ - if (fParameters == NULL) - return B_BAD_VALUE; - - *parameters = fParameters; - return B_OK; -} - - -status_t -PrimaryPartitionEditor::PartitionTypeChanged(const char* type) -{ - fActiveCheckBox->SetEnabled(strcmp(type, kPartitionTypeIntelExtended) != 0); return B_OK; } diff --git a/src/add-ons/disk_systems/intel/CreationParameterEditor.h b/src/add-ons/disk_systems/intel/CreationParameterEditor.h index ff2374db21..e165560668 100644 --- a/src/add-ons/disk_systems/intel/CreationParameterEditor.h +++ b/src/add-ons/disk_systems/intel/CreationParameterEditor.h @@ -1,4 +1,5 @@ /* + * Copyright 2013, Axel Dörfler, axeld@pinc-software.de. * Copyright 2009, Bryce Groff, brycegroff@gmail.com. * Distributed under the terms of the MIT License. */ @@ -18,17 +19,17 @@ public: PrimaryPartitionEditor(); virtual ~PrimaryPartitionEditor(); - virtual bool FinishedEditing(); virtual BView* View(); - virtual status_t GetParameters(BString* parameters); - virtual status_t PartitionTypeChanged(const char* type); + virtual status_t ParameterChanged(const char* name, + const BVariant& variant); + + virtual status_t GetParameters(BString& parameters); private: BView* fView; BCheckBox* fActiveCheckBox; - BString fParameters; }; -#endif //_CREATION_PARAMETER_EDITOR +#endif // _CREATION_PARAMETER_EDITOR diff --git a/src/add-ons/disk_systems/intel/Jamfile b/src/add-ons/disk_systems/intel/Jamfile index fac4f5d0db..db47924aba 100644 --- a/src/add-ons/disk_systems/intel/Jamfile +++ b/src/add-ons/disk_systems/intel/Jamfile @@ -23,7 +23,7 @@ Addon intel : # kernel sources PartitionMap.cpp - : be $(HAIKU_LOCALE_LIBS) $(TARGET_LIBSUPC++) + : be libshared.a $(HAIKU_LOCALE_LIBS) $(TARGET_LIBSUPC++) ; DoCatalogs intel : diff --git a/src/add-ons/disk_systems/intel/PartitionMapAddOn.cpp b/src/add-ons/disk_systems/intel/PartitionMapAddOn.cpp index 4dc6b2a3f4..f4cbb0aa1e 100644 --- a/src/add-ons/disk_systems/intel/PartitionMapAddOn.cpp +++ b/src/add-ons/disk_systems/intel/PartitionMapAddOn.cpp @@ -90,8 +90,10 @@ PartitionMapAddOn::CreatePartitionHandle(BMutablePartition* partition, bool PartitionMapAddOn::CanInitialize(const BMutablePartition* partition) { - // If it's big enough, we can initialize it. - return partition->Size() >= 2 * partition->BlockSize(); + // If it's big enough, but not too big (ie. larger than 2^32 blocks) we can + // initialize it. + return partition->Size() >= 2 * partition->BlockSize() + && partition->Size() / partition->BlockSize() < UINT32_MAX; } diff --git a/src/add-ons/disk_systems/ntfs/InitializeParameterEditor.cpp b/src/add-ons/disk_systems/ntfs/InitializeParameterEditor.cpp index ba14586b9f..a5c9a134b4 100644 --- a/src/add-ons/disk_systems/ntfs/InitializeParameterEditor.cpp +++ b/src/add-ons/disk_systems/ntfs/InitializeParameterEditor.cpp @@ -1,4 +1,5 @@ /* + * Copyright 2013, Axel Dörfler, axeld@pinc-software.de. * Copyright 2009-2010, Stephan Aßmus * Copyright 2009, Bryce Groff, brycegroff@gmail.com. * Distributed under the terms of the MIT License. @@ -11,19 +12,20 @@ #include #include -#include #include #include -#include -#include -#include -#include +#include #include #include +#include #include #include +#undef B_TRANSLATION_CONTEXT +#define B_TRANSLATION_CONTEXT "NTFS_Initialize_Parameter" + + static uint32 MSG_NAME_CHANGED = 'nmch'; @@ -31,7 +33,7 @@ InitializeNTFSEditor::InitializeNTFSEditor() : BPartitionParameterEditor(), fView(NULL), - fNameTC(NULL), + fNameControl(NULL), fParameters(NULL) { _CreateViewControls(); @@ -43,6 +45,15 @@ InitializeNTFSEditor::~InitializeNTFSEditor() } +void +InitializeNTFSEditor::SetTo(BPartition* partition) +{ + BString name = partition->ContentName(); + if (!name.IsEmpty()) + fNameControl->SetText(name.String()); +} + + BView* InitializeNTFSEditor::View() { @@ -51,30 +62,28 @@ InitializeNTFSEditor::View() bool -InitializeNTFSEditor::FinishedEditing() +InitializeNTFSEditor::ValidateParameters() const { - fParameters = ""; - fParameters << "name \"" << fNameTC->Text() << "\";\n"; - - return true; + // The name must be set + return fNameControl->TextView()->TextLength() > 0; } status_t -InitializeNTFSEditor::GetParameters(BString* parameters) +InitializeNTFSEditor::ParameterChanged(const char* name, + const BVariant& variant) { - if (parameters == NULL) - return B_BAD_VALUE; - - *parameters = fParameters; + if (!strcmp(name, "name")) + fNameControl->SetText(variant.ToString()); return B_OK; } status_t -InitializeNTFSEditor::PartitionNameChanged(const char* name) +InitializeNTFSEditor::GetParameters(BString& parameters) { - fNameTC->SetText(name); + parameters = "name \""; + parameters << fNameControl->Text() << "\";\n"; return B_OK; } @@ -82,16 +91,15 @@ InitializeNTFSEditor::PartitionNameChanged(const char* name) void InitializeNTFSEditor::_CreateViewControls() { - fNameTC = new BTextControl("Name:", "New NTFS Volume", NULL); - fNameTC->SetModificationMessage(new BMessage(MSG_NAME_CHANGED)); - // TODO find out what is the max length for this specific FS partition name - fNameTC->TextView()->SetMaxBytes(31); + fNameControl = new BTextControl(B_TRANSLATE("Name:"), "New NTFS Volume", + NULL); + fNameControl->SetModificationMessage(new BMessage(MSG_NAME_CHANGED)); + fNameControl->TextView()->SetMaxBytes(127); float spacing = be_control_look->DefaultItemSpacing(); fView = BGridLayoutBuilder(spacing, spacing) - // row 1 - .Add(fNameTC->CreateLabelLayoutItem(), 0, 0) - .Add(fNameTC->CreateTextViewLayoutItem(), 1, 0).View() + .Add(fNameControl->CreateLabelLayoutItem(), 0, 0) + .Add(fNameControl->CreateTextViewLayoutItem(), 1, 0).View() ; } diff --git a/src/add-ons/disk_systems/ntfs/InitializeParameterEditor.h b/src/add-ons/disk_systems/ntfs/InitializeParameterEditor.h index bdb66471d8..5a4ce7db96 100644 --- a/src/add-ons/disk_systems/ntfs/InitializeParameterEditor.h +++ b/src/add-ons/disk_systems/ntfs/InitializeParameterEditor.h @@ -1,4 +1,5 @@ /* + * Copyright 2013, Axel Dörfler, axeld@pinc-software.de. * Copyright 2009-2010, Stephan Aßmus * Copyright 2009, Bryce Groff, brycegroff@gmail.com. * Distributed under the terms of the MIT License. @@ -10,6 +11,7 @@ #include #include + class BCheckBox; class BMenuField; class BTextControl; @@ -21,17 +23,22 @@ public: InitializeNTFSEditor(); virtual ~InitializeNTFSEditor(); - virtual bool FinishedEditing(); - virtual BView* View(); - virtual status_t GetParameters(BString* parameters); + virtual void SetTo(BPartition* partition); - virtual status_t PartitionNameChanged(const char* name); + virtual bool ValidateParameters() const; + virtual status_t ParameterChanged(const char* name, + const BVariant& variant); + + virtual BView* View(); + + virtual status_t GetParameters(BString& parameters); private: void _CreateViewControls(); +private: BView* fView; - BTextControl* fNameTC; + BTextControl* fNameControl; BString fParameters; }; diff --git a/src/add-ons/disk_systems/ntfs/Jamfile b/src/add-ons/disk_systems/ntfs/Jamfile index 342108b552..4abdcfbb85 100644 --- a/src/add-ons/disk_systems/ntfs/Jamfile +++ b/src/add-ons/disk_systems/ntfs/Jamfile @@ -13,3 +13,9 @@ Addon ntfs : : be $(HAIKU_LOCALE_LIBS) $(TARGET_LIBSUPC++) libshared.a ; + +DoCatalogs ntfs : + x-vnd.Haiku-NTFSDiskAddOn + : + InitializeParameterEditor.cpp +; diff --git a/src/add-ons/disk_systems/ntfs/NTFSAddOn.rdef b/src/add-ons/disk_systems/ntfs/NTFSAddOn.rdef index 44435fe18f..7cb9cd547b 100644 --- a/src/add-ons/disk_systems/ntfs/NTFSAddOn.rdef +++ b/src/add-ons/disk_systems/ntfs/NTFSAddOn.rdef @@ -1,15 +1,11 @@ -/* - * NTFSAddOn.rdef - */ - -resource app_signature "application/x-vnd.Haiku-NTFSAddOn"; +resource app_signature "application/x-vnd.Haiku-NTFSDiskAddOn"; resource app_version { - major = 0, + major = 1, middle = 0, - minor = 1, + minor = 0, variety = 0, internal = 0, - short_info = "0.0.1", - long_info = "Haiku NTFS disk add-on." + short_info = "1.0.0", + long_info = "NTFS disk add-on." }; diff --git a/src/add-ons/kernel/bus_managers/ata/ATADevice.cpp b/src/add-ons/kernel/bus_managers/ata/ATADevice.cpp index 323b30fd8b..41f633da5a 100644 --- a/src/add-ons/kernel/bus_managers/ata/ATADevice.cpp +++ b/src/add-ons/kernel/bus_managers/ata/ATADevice.cpp @@ -532,33 +532,14 @@ ATADevice::Configure() return B_ERROR; } - fTotalSectors = fInfoBlock.lba_sector_count; - - if (fInfoBlock.word_106_bit_14_one && !fInfoBlock.word_106_bit_15_zero) { - // contains a valid block size configuration - if (fInfoBlock.logical_sector_not_512_bytes) - fBlockSize = fInfoBlock.logical_sector_size * 2; - - if (fInfoBlock.multiple_logical_per_physical_sectors) { - fPhysicalBlockSize - = fBlockSize << fInfoBlock.logical_sectors_per_physical_sector; - } else - fPhysicalBlockSize = fBlockSize; - } - if (fInfoBlock.word_209_bit_14_one && !fInfoBlock.word_209_bit_15_zero) { - // contains a valid logical block offset configuration - fBlockOffset = fInfoBlock.logical_sector_offset; - } + fTotalSectors = fInfoBlock.SectorCount(fUse48Bits, false); + fBlockSize = fInfoBlock.SectorSize(); + fPhysicalBlockSize = fInfoBlock.PhysicalSectorSize(); + fBlockOffset = fInfoBlock.BlockOffset(); fTaskFile.lba.mode = ATA_MODE_LBA; fTaskFile.lba.device = fIndex; - if (fInfoBlock.lba48_supported - && fInfoBlock.lba48_sector_count >= fInfoBlock.lba_sector_count) { - fUse48Bits = true; - fTotalSectors = fInfoBlock.lba48_sector_count; - } - status_t result = ConfigureDMA(); if (result != B_OK) return result; diff --git a/src/add-ons/kernel/bus_managers/ata/ATAInfoBlock.h b/src/add-ons/kernel/bus_managers/ata/ATAInfoBlock.h index 197696f913..402fd20323 100644 --- a/src/add-ons/kernel/bus_managers/ata/ATAInfoBlock.h +++ b/src/add-ons/kernel/bus_managers/ata/ATAInfoBlock.h @@ -1,5 +1,5 @@ /* - * Copyright 2010, Axel Dörfler, axeld@pinc-software.de. + * Copyright 2010-2013, Axel Dörfler, axeld@pinc-software.de. * Copyright 2009, Michael Lotz, mmlr@mlotz.ch. * Distributed under the terms of the MIT License. */ @@ -364,6 +364,51 @@ typedef struct ata_device_infoblock { signature : 8, checksum : 8 ); + + uint64 SectorCount(bool& use48Bits, bool force) + { + if (lba48_supported && lba48_sector_count >= lba_sector_count) { + use48Bits = true; + return lba48_sector_count; + } + + use48Bits = force ? lba48_supported : false; + return lba_sector_count; + } + + uint32 PhysicalSectorSize() + { + uint32 blockSize = 512; + if (word_106_bit_14_one && !word_106_bit_15_zero) { + // contains a valid block size configuration + if (logical_sector_not_512_bytes) + blockSize = logical_sector_size * 2; + + if (multiple_logical_per_physical_sectors) + return blockSize << logical_sectors_per_physical_sector; + } + return blockSize; + } + + uint32 SectorSize() + { + if (word_106_bit_14_one && !word_106_bit_15_zero) { + // contains a valid block size configuration + if (logical_sector_not_512_bytes) + return logical_sector_size * 2; + } + return 512; + } + + uint32 BlockOffset() + { + if (word_209_bit_14_one && !word_209_bit_15_zero) { + // contains a valid logical block offset configuration + return logical_sector_offset; + } + return 0; + } } _PACKED ata_device_infoblock; + #endif // ATA_INFOBLOCK_H diff --git a/src/add-ons/kernel/bus_managers/ps2/movement_maker.cpp b/src/add-ons/kernel/bus_managers/ps2/movement_maker.cpp index 868cd1266c..41bdf86315 100644 --- a/src/add-ons/kernel/bus_managers/ps2/movement_maker.cpp +++ b/src/add-ons/kernel/bus_managers/ps2/movement_maker.cpp @@ -483,7 +483,7 @@ TouchpadMovement::_EdgeMotion(mouse_movement *movement, touch_event *event, Also, it sets the button state from movement->buttons. */ void -TouchpadMovement::_UpdateButtons(mouse_movement *movement) +TouchpadMovement::UpdateButtons(mouse_movement *movement) { // set click count correctly according to double click timeout if (movement->buttons != 0 && fButtonsState == 0) { @@ -549,7 +549,7 @@ TouchpadMovement::_NoTouchToMovement(touch_event *event, } movement->buttons = buttons; - _UpdateButtons(movement); + UpdateButtons(movement); } @@ -601,7 +601,7 @@ TouchpadMovement::_MoveToMovement(touch_event *event, mouse_movement *movement) fTapDeltaY = 0; } - _UpdateButtons(movement); + UpdateButtons(movement); } diff --git a/src/add-ons/kernel/bus_managers/ps2/movement_maker.h b/src/add-ons/kernel/bus_managers/ps2/movement_maker.h index 31692c0291..2c762b5574 100644 --- a/src/add-ons/kernel/bus_managers/ps2/movement_maker.h +++ b/src/add-ons/kernel/bus_managers/ps2/movement_maker.h @@ -111,11 +111,12 @@ public: bool TapDragStarted() { return fTapdragStarted; } bool WasEdgeMotion() { return fValidEdgeMotion; } + void UpdateButtons(mouse_movement *movement); + bigtime_t click_speed; private: bool _EdgeMotion(mouse_movement *movement, touch_event *event, bool validStart); - inline void _UpdateButtons(mouse_movement *movement); inline void _NoTouchToMovement(touch_event *event, mouse_movement *movement); inline void _MoveToMovement(touch_event *event, diff --git a/src/add-ons/kernel/bus_managers/ps2/ps2_alps.cpp b/src/add-ons/kernel/bus_managers/ps2/ps2_alps.cpp index 16aded4c38..70625df8dd 100644 --- a/src/add-ons/kernel/bus_managers/ps2/ps2_alps.cpp +++ b/src/add-ons/kernel/bus_managers/ps2/ps2_alps.cpp @@ -215,7 +215,7 @@ get_alps_movment(alps_cookie *cookie, mouse_movement *movement) } event.buttons = event_buffer[3] & 7; - event.zPressure = event_buffer[5]; + event.zPressure = event_buffer[5]; // finger on touchpad if (event_buffer[2] & 0x2) { @@ -236,8 +236,8 @@ get_alps_movment(alps_cookie *cookie, mouse_movement *movement) cookie->previousZ = event.zPressure; - event.xPosition = event_buffer[1] | ((event_buffer[2] & 0x78) << 4); - event.yPosition = event_buffer[4] | ((event_buffer[3] & 0x70) << 3); + event.xPosition = event_buffer[1] | ((event_buffer[2] & 0x78) << 4); + event.yPosition = event_buffer[4] | ((event_buffer[3] & 0x70) << 3); // check for trackpoint even (z pressure 127) if (sFoundModel->flags & ALPS_DUALPOINT && event.zPressure == 127) { @@ -248,9 +248,11 @@ get_alps_movment(alps_cookie *cookie, mouse_movement *movement) movement->wheel_xdelta = 0; movement->wheel_ydelta = 0; movement->buttons = event.buttons; + movement->timestamp = system_time(); + cookie->movementMaker.UpdateButtons(movement); } else { event.yPosition = AREA_END_Y - (event.yPosition - AREA_START_Y); - status = cookie->movementMaker.EventToMovement(&event, movement); + status = cookie->movementMaker.EventToMovement(&event, movement); } if (cookie->movementMaker.WasEdgeMotion() diff --git a/src/add-ons/kernel/busses/scsi/ahci/ahci_port.cpp b/src/add-ons/kernel/busses/scsi/ahci/ahci_port.cpp index 3d51f71281..e88a1a4690 100644 --- a/src/add-ons/kernel/busses/scsi/ahci/ahci_port.cpp +++ b/src/add-ons/kernel/busses/scsi/ahci/ahci_port.cpp @@ -471,10 +471,10 @@ AHCIPort::FillPrdTable(volatile prd *prdTable, int *prdCount, int prdMax, FLOW("FillPrdTable: prd-entry %u, addr %p, size %lu\n", *prdCount, address, bytes); - prdTable->dba = LO32(address); + prdTable->dba = LO32(address); prdTable->dbau = HI32(address); - prdTable->res = 0; - prdTable->dbc = bytes - 1; + prdTable->res = 0; + prdTable->dbc = bytes - 1; *prdCount += 1; prdTable++; address = address + bytes; @@ -582,16 +582,17 @@ AHCIPort::ScsiInquiry(scsi_ccb *request) } */ - scsiData.device_type = fIsATAPI ? scsi_dev_CDROM : scsi_dev_direct_access; + scsiData.device_type = fIsATAPI + ? ataData.word_0.atapi.command_packet_set : scsi_dev_direct_access; scsiData.device_qualifier = scsi_periph_qual_connected; scsiData.device_type_modifier = 0; - scsiData.removable_medium = fIsATAPI; + scsiData.removable_medium = ataData.word_0.ata.removable_media_device; scsiData.ansi_version = 2; scsiData.ecma_version = 0; scsiData.iso_version = 0; scsiData.response_data_format = 2; scsiData.term_iop = false; - scsiData.additional_length = sizeof(scsiData) - 4; + scsiData.additional_length = sizeof(scsi_res_inquiry) - 4; scsiData.soft_reset = false; scsiData.cmd_queue = false; scsiData.linked = false; @@ -601,18 +602,14 @@ AHCIPort::ScsiInquiry(scsi_ccb *request) scsiData.relative_address = false; if (!fIsATAPI) { - bool lba = ataData.dma_supported != 0; - bool lba48 = ataData.lba48_supported != 0; - uint32 sectors = ataData.lba_sector_count; - uint64 sectors48 = ataData.lba48_sector_count; - fUse48BitCommands = lba && lba48; - fSectorSize = 512; - fSectorCount = !(lba || sectors) ? 0 : lba48 ? sectors48 : sectors; + fSectorCount = ataData.SectorCount(fUse48BitCommands, true); + fSectorSize = ataData.SectorSize(); fTrim = ataData.data_set_management_support; TRACE("lba %d, lba48 %d, fUse48BitCommands %d, sectors %" B_PRIu32 ", sectors48 %" B_PRIu64 ", size %" B_PRIu64 "\n", - lba, lba48, fUse48BitCommands, sectors, sectors48, - fSectorCount * fSectorSize); + ataData.dma_supported != 0, ataData.lba48_supported != 0, + fUse48BitCommands, ataData.lba_sector_count, + ataData.lba48_sector_count, fSectorCount * fSectorSize); } #if 0 @@ -955,7 +952,7 @@ AHCIPort::ScsiExecuteRequest(scsi_ccb *request) request->subsys_status = SCSI_REQ_INVALID; gSCSI->finished(request, 1); } - break; + break; case SCSI_OP_SYNCHRONIZE_CACHE: ScsiSynchronizeCache(request); break; diff --git a/src/add-ons/kernel/busses/scsi/usb/device_info.h b/src/add-ons/kernel/busses/scsi/usb/device_info.h index 6f917fd764..3b5c9d2b96 100644 --- a/src/add-ons/kernel/busses/scsi/usb/device_info.h +++ b/src/add-ons/kernel/busses/scsi/usb/device_info.h @@ -1,55 +1,55 @@ /** * * TODO: description - * - * This file is a part of USB SCSI CAM for Haiku OS. + * + * This file is a part of USB SCSI CAM for Haiku. * May be used under terms of the MIT License * * Author(s): * Siarzhuk Zharski - * - * + * + * */ -#ifndef _DEVICE_INFO_H_ +#ifndef _DEVICE_INFO_H_ #define _DEVICE_INFO_H_ #ifndef _SCSI_COMMANDS_H_ #include "scsi_commands.h" -#endif /*_SCSI_COMMANDS_H_*/ +#endif /*_SCSI_COMMANDS_H_*/ -#ifndef _PROTO_MODULE_H_ +#ifndef _PROTO_MODULE_H_ #include "proto_module.h" -#endif /* _PROTO_MODULE_H_ */ +#endif /* _PROTO_MODULE_H_ */ typedef struct _usb_device_info{ uint8 dev_num; /**/ const usb_device device; /**/ uint16 interface; /**/ uint8 max_lun; /**/ - + uint32 properties; - + usb_pipe pipe_in; /**/ usb_pipe pipe_out; /**/ usb_pipe pipe_intr; /**/ - + sem_id lock_sem; /**/ sem_id trans_sem; /**/ uint32 tag; /**/ status_t status; /**/ - + bigtime_t trans_timeout; usb_module_info *usb_m; - + void *data; /**/ int actual_len; /**/ - + protocol_module_info *protocol_m; char *protocol_m_path; - + transform_module_info *transform_m; char *transform_m_path; - + bool b_trace; void (*trace)(bool b_force, const char *fmt, ...); void (*trace_bytes)(const char *prefix, const uint8 *bytes, size_t bytes_len); diff --git a/src/add-ons/kernel/busses/scsi/usb/fake_device.c b/src/add-ons/kernel/busses/scsi/usb/fake_device.c index e20ade153e..d49e7b160d 100644 --- a/src/add-ons/kernel/busses/scsi/usb/fake_device.c +++ b/src/add-ons/kernel/busses/scsi/usb/fake_device.c @@ -1,20 +1,20 @@ /** * * TODO: description - * - * This file is a part of USB SCSI CAM for Haiku OS. + * + * This file is a part of USB SCSI CAM for Haiku. * May be used under terms of the MIT License * * Author(s): * Siarzhuk Zharski - * - * + * + * */ -#include "usb_scsi.h" +#include "usb_scsi.h" #include -#include "device_info.h" -#include "tracing.h" +#include "device_info.h" +#include "tracing.h" #include "fake_device.h" @@ -38,7 +38,7 @@ void fake_inquiry_request(usb_device_info *udi, CCB_SCSIIO *ccbio) if(ccbio->cam_dxfer_len >= 0x24){ strncpy(&data[8], "USB SCSI", INQ_VENDOR_LEN); strncpy(&data[16], "Reserved", INQ_PRODUCT_LEN); - strncpy(&data[32], "N/A", INQ_REVISION_LEN); + strncpy(&data[32], "N/A", INQ_REVISION_LEN); } } } @@ -62,8 +62,8 @@ void fake_test_unit_ready_request(CCB_SCSIIO *ccbio) \fn:fake_scsi_io \param ccbio: ???? \return: ??? - - xpt_scsi_io - handle XPT_SCSI_IO sim action + + xpt_scsi_io - handle XPT_SCSI_IO sim action */ status_t fake_scsi_io(CCB_SCSIIO *ccbio) { diff --git a/src/add-ons/kernel/busses/scsi/usb/fake_device.h b/src/add-ons/kernel/busses/scsi/usb/fake_device.h index ea89ac8e19..571e5017a8 100644 --- a/src/add-ons/kernel/busses/scsi/usb/fake_device.h +++ b/src/add-ons/kernel/busses/scsi/usb/fake_device.h @@ -1,16 +1,16 @@ /** * * TODO: description - * - * This file is a part of USB SCSI CAM for Haiku OS. + * + * This file is a part of USB SCSI CAM for Haiku. * May be used under terms of the MIT License * * Author(s): * Siarzhuk Zharski - * - * + * + * */ -#ifndef _FAKE_DEVICE_H_ +#ifndef _FAKE_DEVICE_H_ #define _FAKE_DEVICE_H_ void fake_inquiry_request(usb_device_info *udi, CCB_SCSIIO *ccbio); diff --git a/src/add-ons/kernel/busses/scsi/usb/proto_bulk.c b/src/add-ons/kernel/busses/scsi/usb/proto_bulk.c index cec9ad9a83..c369152a29 100644 --- a/src/add-ons/kernel/busses/scsi/usb/proto_bulk.c +++ b/src/add-ons/kernel/busses/scsi/usb/proto_bulk.c @@ -1,14 +1,14 @@ /** * * TODO: description - * - * This file is a part of USB SCSI CAM for Haiku OS. + * + * This file is a part of USB SCSI CAM for Haiku. * May be used under terms of the MIT License * * Author(s): * Siarzhuk Zharski - * - * + * + * */ /** bulk-only protocol specific implementation */ @@ -17,15 +17,15 @@ * http://www.usb.org/developers/data/devclass/usbmassover_11.pdf [1] * http://www.usb.org/developers/data/devclass/usbmassbulk_10.pdf [2] */ -#include "usb_scsi.h" +#include "usb_scsi.h" -#include "device_info.h" +#include "device_info.h" -#include "proto_module.h" -#include "proto_common.h" -#include "proto_bulk.h" +#include "proto_module.h" +#include "proto_common.h" +#include "proto_bulk.h" -#include "usb_defs.h" +#include "usb_defs.h" #include /* strncpy */ @@ -83,7 +83,7 @@ void trace_CBW(usb_device_info *udi, const usb_mass_CBW *cbw) PTRACE(udi, "\nCBW:{'%s'; tag:%d; data_len:%d; flags:0x%02x; lun:%d; cdb_len:%d;}\n", buf, cbw->tag, cbw->data_transfer_len, cbw->flags, cbw->lun, cbw->cdb_len); - udi->trace_bytes("CDB:\n", cbw->CDB, CBW_CDB_LENGTH); + udi->trace_bytes("CDB:\n", cbw->CDB, CBW_CDB_LENGTH); } void trace_CSW(usb_device_info *udi, const usb_mass_CSW *csw) @@ -97,8 +97,8 @@ void trace_CSW(usb_device_info *udi, const usb_mass_CSW *csw) /** \fn:get_max_luns \param udi: device for wich max LUN info is requested - \return:always B_OK - if info was not retrieved max LUN is defaulted to 0 - + \return:always B_OK - if info was not retrieved max LUN is defaulted to 0 + tries to retrieve the maximal Logical Unit Number supported by this device. If device doesn't support GET_MAX_LUN request - single LUN is assumed. ([2] 3.2) @@ -123,7 +123,7 @@ get_max_luns(usb_device_info *udi) "Assuming single LUN available.\n", udi->dev_num, status); } udi->max_lun = 0; - status = B_OK; + status = B_OK; } /* else - all is OK - max luns info readed */ } return status; @@ -135,7 +135,7 @@ get_max_luns(usb_device_info *udi) \param len: length of data buffer \param b_in: is "true" if input (device->host) data transfer, "false" otherwise \return: status of operation. - + performs queue_bulk USB request for corresponding pipe and handle timeout of this operation. */ @@ -159,10 +159,10 @@ queue_bulk(usb_device_info *udi, void* buffer, size_t len, bool b_in) /** \fn:check_CSW \param udi:corresponding device info - \param csw: CSW to be checked for validity and meaningfullness + \param csw: CSW to be checked for validity and meaningfullness \param transfer_len: data transferred during operation, which is checked for status \return: "true" if CSW valid and meanigfull, "false" otherwise - + checks CSW for validity and meaningfullness as required by USB mass strorge BulkOnly specification ([2] 6.3) */ @@ -199,7 +199,7 @@ check_CSW(usb_device_info *udi, usb_mass_CSW* csw, int transfer_len) break;/* failed */ } is_valid = true; - }while(false); + }while(false); return is_valid; } /** @@ -208,7 +208,7 @@ check_CSW(usb_device_info *udi, usb_mass_CSW* csw, int transfer_len) \param csw: buffer for CSW data \param transfer_len: data transferred during operation, which is checked for status \return: success status code - + reads CSW from device as proposed in ([2] 5.3.3; Figure 2.). */ static status_t @@ -216,8 +216,8 @@ read_status(usb_device_info *udi, usb_mass_CSW* csw, int transfer_len) { status_t status = B_ERROR; int try = 0; - do{ - status = queue_bulk(udi, csw, CSW_LENGTH, true); + do{ + status = queue_bulk(udi, csw, CSW_LENGTH, true); if(0 == try){ if(B_OK != status || B_OK != udi->status){ status = (*udi->usb_m->clear_feature)(udi->pipe_in, USB_FEATURE_ENDPOINT_HALT); @@ -243,7 +243,7 @@ read_status(usb_device_info *udi, usb_mass_CSW* csw, int transfer_len) (*udi->protocol_m->reset)(udi); status = B_ERROR; break; - } + } trace_CSW(udi, csw); break; /* CSW was read successfully */ }while(try++ < 2); @@ -256,7 +256,7 @@ read_status(usb_device_info *udi, usb_mass_CSW* csw, int transfer_len) \fn:bulk_only_initialize \param udi: device on wich we should perform initialization \return:error code if initialization failed or B_OK if it passed - + initialize procedure for bulk only protocol devices. */ status_t @@ -270,7 +270,7 @@ bulk_only_initialize(usb_device_info *udi) \fn:bulk_only_reset \param udi: device on wich we should perform reset \return:error code if reset failed or B_OK if it passed - + reset procedure for bulk only protocol devices. Tries to send BulkOnlyReset USB request and clear USB_FEATURE_ENDPOINT_HALT features on input and output pipes. ([2] 3.1) @@ -295,13 +295,13 @@ bulk_only_reset(usb_device_info *udi) USB_FEATURE_ENDPOINT_HALT))) { PTRACE_ALWAYS(udi, "bulk_only_reset: clear_feature on pipe_out failed: %08x\n", status); - } + } PTRACE(udi, "bulk_only_reset:%08x\n", status); return status; } /** \fn:bulk_only_transfer - \param udi: corresponding device + \param udi: corresponding device \param cmd: SCSI command to be performed on USB device \param cmdlen: length of SCSI command \param data_sg: io vectors array with data to transfer @@ -311,7 +311,7 @@ bulk_only_reset(usb_device_info *udi) \param ccbio: CCB_SCSIIO struct for original SCSI command \param cb: callback to handle of final stage of command performing (autosense \ request etc.) - + transfer procedure for bulk-only protocol. Performs SCSI command on USB device [2] */ @@ -352,7 +352,7 @@ bulk_only_transfer(usb_device_info *udi, uint8 *cmd, uint8 cmdlen, //sg_buffer command_status = B_CMD_WIRE_FAILED; break; } - } + } /* get status of command */ status = read_status(udi, &csw, transfer_len); if(B_OK != status){ diff --git a/src/add-ons/kernel/busses/scsi/usb/proto_bulk.h b/src/add-ons/kernel/busses/scsi/usb/proto_bulk.h index 8ca165f186..632eace8c9 100644 --- a/src/add-ons/kernel/busses/scsi/usb/proto_bulk.h +++ b/src/add-ons/kernel/busses/scsi/usb/proto_bulk.h @@ -1,25 +1,25 @@ /** * * TODO: description - * - * This file is a part of USB SCSI CAM for Haiku OS. + * + * This file is a part of USB SCSI CAM for Haiku. * May be used under terms of the MIT License * * Author(s): * Siarzhuk Zharski - * - * + * + * */ /** bulk-only protocol "standard" procedures */ -#ifndef _PROTO_BULK_H_ +#ifndef _PROTO_BULK_H_ #define _PROTO_BULK_H_ -#ifndef _PROTO_MODULE_H_ +#ifndef _PROTO_MODULE_H_ #include "proto_module.h" -#endif /* _PROTO_MODULE_H_ */ +#endif /* _PROTO_MODULE_H_ */ extern protocol_module_info bulk_only_protocol_m; -#endif /*_PROTO_BULK_H_*/ +#endif /*_PROTO_BULK_H_*/ diff --git a/src/add-ons/kernel/busses/scsi/usb/proto_cbi.c b/src/add-ons/kernel/busses/scsi/usb/proto_cbi.c index 6973c972b0..f3a53e379a 100644 --- a/src/add-ons/kernel/busses/scsi/usb/proto_cbi.c +++ b/src/add-ons/kernel/busses/scsi/usb/proto_cbi.c @@ -1,14 +1,14 @@ /** * * TODO: description - * - * This file is a part of USB SCSI CAM for Haiku OS. + * + * This file is a part of USB SCSI CAM for Haiku. * May be used under terms of the MIT License * * Author(s): * Siarzhuk Zharski - * - * + * + * */ /* References: * USB Mass Storage Class specifications: @@ -19,17 +19,17 @@ #include -#include "usb_scsi.h" +#include "usb_scsi.h" -#include "device_info.h" +#include "device_info.h" -#include "proto_module.h" +#include "proto_module.h" #include "proto_common.h" -#include "proto_cbi.h" +#include "proto_cbi.h" -#include "usb_defs.h" +#include "usb_defs.h" -#define USB_REQ_CBI_ADSC 0x00 +#define USB_REQ_CBI_ADSC 0x00 typedef struct _usb_mass_CBI_CB{ @@ -38,8 +38,8 @@ typedef struct _usb_mass_CBI_CB{ uint8 padding[14]; } usb_mass_CBI_CB; -#define CDB_LEN 16 -#define CDB_RESET_LEN 12 +#define CDB_LEN 16 +#define CDB_RESET_LEN 12 //typedef uint8 usb_mass_CDB[CDB_LEN]; @@ -81,7 +81,7 @@ static void cbi_transfer(usb_device_info *udi, uint8 *cmd, uint8 cmdlen, //sg_bu void trace_CDB(usb_device_info *udi, const usb_mass_CBI_CB *cb, int len) { PTRACE(udi, "CB:{op:0x%02x; op2:0x%02x;}\n", cb->op, cb->op2); - udi->trace_bytes(" padding:", cb->padding, len - 2); + udi->trace_bytes(" padding:", cb->padding, len - 2); } static status_t @@ -143,7 +143,7 @@ parse_status(usb_device_info *udi, usb_mass_CBI_IDB *idb) break; } } /* else ?? */ - } + } return command_status; } @@ -153,14 +153,14 @@ parse_status(usb_device_info *udi, usb_mass_CBI_IDB *idb) \fn: \param udi: ??? \return:?? - + ?? */ status_t cbi_reset(usb_device_info *udi) { status_t status = B_ERROR; - //usb_mass_CBI_CB *cb = CB_BUFFER(udi->proto_buf); + //usb_mass_CBI_CB *cb = CB_BUFFER(udi->proto_buf); //usb_mass_CDB cdb = {0x1d, 0x04, 0x00}; //memset(cdb + 2, 0xff, CDB_RESET_LEN - 2); usb_mass_CBI_CB cb = { @@ -171,7 +171,7 @@ cbi_reset(usb_device_info *udi) status = send_request_adsc(udi, &cb, CDB_RESET_LEN); if(status != B_OK) PTRACE_ALWAYS(udi, "command_block_reset: reset request failed: %08x\n", status); - + if(B_OK != (status = (*udi->usb_m->clear_feature)(udi->pipe_in, USB_FEATURE_ENDPOINT_HALT))) PTRACE_ALWAYS(udi, "command_block_reset: clear_feature on pipe_in failed: %08x\n", status); @@ -201,7 +201,7 @@ cbi_initialize(usb_device_info *udi) \param cmd: ??? \param cmdlen: ??? \return:??? - + ??? */ void @@ -225,7 +225,7 @@ cbi_transfer(usb_device_info *udi, uint8 *cmd, uint8 cmdlen, (*udi->protocol_m->reset)(udi); } break; - } + } if(transfer_len != 0){ status = process_data_io(udi, sg_data, sg_count, dir); if(status != B_OK){ @@ -233,8 +233,8 @@ cbi_transfer(usb_device_info *udi, uint8 *cmd, uint8 cmdlen, break; } } - - if(PROTO(udi->properties) == PROTO_CBI){ + + if(PROTO(udi->properties) == PROTO_CBI){ status = request_interrupt(udi, &idb); PTRACE(udi, "cbi_transfer:request interrupt: %08x(%08x)\n", status, udi->status); if(status != B_OK){ @@ -246,9 +246,9 @@ cbi_transfer(usb_device_info *udi, uint8 *cmd, uint8 cmdlen, command_status = parse_status(udi, &idb); } else { /* PROP_CB ???*/ command_status = B_CMD_UNKNOWN; - } + } residue = 0; /* DEBUG!!!!!!!!!*/ - }while(false); + }while(false); cb(udi, ccbio, residue, command_status); } diff --git a/src/add-ons/kernel/busses/scsi/usb/proto_cbi.h b/src/add-ons/kernel/busses/scsi/usb/proto_cbi.h index cbb002d7cf..9c994cd62b 100644 --- a/src/add-ons/kernel/busses/scsi/usb/proto_cbi.h +++ b/src/add-ons/kernel/busses/scsi/usb/proto_cbi.h @@ -1,22 +1,22 @@ /** * * TODO: description - * - * This file is a part of USB SCSI CAM for Haiku OS. + * + * This file is a part of USB SCSI CAM for Haiku. * May be used under terms of the MIT License * * Author(s): * Siarzhuk Zharski - * - * + * + * */ -#ifndef _PROTO_CBI_H_ +#ifndef _PROTO_CBI_H_ #define _PROTO_CBI_H_ -#ifndef _PROTO_MODULE_H_ +#ifndef _PROTO_MODULE_H_ #include "proto_module.h" -#endif /* _PROTO_MODULE_H_ */ - +#endif /* _PROTO_MODULE_H_ */ + extern protocol_module_info cbi_protocol_m; -#endif /*_PROTO_CBI_H_*/ +#endif /*_PROTO_CBI_H_*/ diff --git a/src/add-ons/kernel/busses/scsi/usb/proto_common.c b/src/add-ons/kernel/busses/scsi/usb/proto_common.c index c4bcd23698..593ac87f2a 100644 --- a/src/add-ons/kernel/busses/scsi/usb/proto_common.c +++ b/src/add-ons/kernel/busses/scsi/usb/proto_common.c @@ -1,24 +1,24 @@ /** * * TODO: description - * - * This file is a part of USB SCSI CAM for Haiku OS. + * + * This file is a part of USB SCSI CAM for Haiku. * May be used under terms of the MIT License * * Author(s): * Siarzhuk Zharski - * - * + * + * */ #include #include "usb_scsi.h" - -#include "device_info.h" -#include "proto_common.h" -#include "tracing.h" -#include "usb_defs.h" -#include "scsi_commands.h" + +#include "device_info.h" +#include "proto_common.h" +#include "tracing.h" +#include "usb_defs.h" +#include "scsi_commands.h" /** \fn:bulk_callback @@ -27,7 +27,7 @@ \param data:??? \param actual_len:??? \return:??? - + ??? */ void bulk_callback(void *cookie, status_t status, void* data, uint32 actual_len) @@ -40,14 +40,14 @@ void bulk_callback(void *cookie, status_t status, void* data, uint32 actual_len) udi->actual_len = actual_len; if(udi->status != B_CANCELED) release_sem(udi->trans_sem); - } + } } /** \fn:exec_io \param udi: ??? \return:??? - + ??? */ status_t process_data_io(usb_device_info *udi, //sg_buffer *sgb, @@ -64,15 +64,15 @@ status_t process_data_io(usb_device_info *udi, //sg_buffer *sgb, if(udi->status == B_DEV_STALLED){ status_t st=(*udi->usb_m->clear_feature)(pipe, USB_FEATURE_ENDPOINT_HALT); TRACE_ALWAYS("clear_on_STALL:%08x\n",st); - } + } }else{ - TRACE_ALWAYS("process_data_io:acquire_sem failed:%08x\n", status); + TRACE_ALWAYS("process_data_io:acquire_sem failed:%08x\n", status); (*udi->usb_m->cancel_queued_transfers)(pipe); - } + } } else { TRACE_ALWAYS("process_data_io:queue_bulk_v failed:%08x\n", status); } - TRACE_DATA_IO("process_data_io:processed:%d;status:%08x\n", udi->actual_len, status); + TRACE_DATA_IO("process_data_io:processed:%d;status:%08x\n", udi->actual_len, status); return status; } @@ -124,7 +124,7 @@ void sense_callback(struct _usb_device_info *udi, CCB_SCSIIO *ccbio, { ccbio->cam_sense_resid = residue; switch(status){ - case B_CMD_UNKNOWN: + case B_CMD_UNKNOWN: case B_CMD_FAILED: case B_OK:{ bool b_own_data = (ccbio->cam_sense_ptr == NULL); @@ -147,7 +147,7 @@ void sense_callback(struct _usb_device_info *udi, CCB_SCSIIO *ccbio, // ccbio->cam_ch.cam_status = CAM_REQ_CMP_ERR /*| CAM_AUTOSNS_VALID*/; // ccbio->cam_scsi_status = SCSI_STATUS_CHECK_CONDITION; TRACE("sense_callback: sense still not handled...\n"); - } + } } } break; diff --git a/src/add-ons/kernel/busses/scsi/usb/proto_common.h b/src/add-ons/kernel/busses/scsi/usb/proto_common.h index 74f74d60bc..a7af9438f0 100644 --- a/src/add-ons/kernel/busses/scsi/usb/proto_common.h +++ b/src/add-ons/kernel/busses/scsi/usb/proto_common.h @@ -1,16 +1,16 @@ /** * * TODO: description - * - * This file is a part of USB SCSI CAM for Haiku OS. + * + * This file is a part of USB SCSI CAM for Haiku. * May be used under terms of the MIT License * * Author(s): * Siarzhuk Zharski - * - * + * + * */ -#ifndef _PROTO_COMMON_H_ +#ifndef _PROTO_COMMON_H_ #define _PROTO_COMMON_H_ #ifndef _DEVICE_INFO_H_ @@ -18,9 +18,9 @@ #endif /* _DEVICE_INFO_H_ */ void bulk_callback(void *cookie, status_t status, void* data, uint32 actual_len); - + status_t process_data_io(usb_device_info *udi, iovec *sg_data, int32 sg_count/*sg_buffer *sgb*/, EDirection dir); - + void transfer_callback(usb_device_info *udi, CCB_SCSIIO *ccbio, int32 residue, status_t status); void sense_callback(usb_device_info *udi, CCB_SCSIIO *ccbio, diff --git a/src/add-ons/kernel/busses/scsi/usb/proto_module.h b/src/add-ons/kernel/busses/scsi/usb/proto_module.h index b97a67b9cd..690262229e 100644 --- a/src/add-ons/kernel/busses/scsi/usb/proto_module.h +++ b/src/add-ons/kernel/busses/scsi/usb/proto_module.h @@ -1,16 +1,16 @@ /** * * TODO: description - * - * This file is a part of USB SCSI CAM for Haiku OS. + * + * This file is a part of USB SCSI CAM for Haiku. * May be used under terms of the MIT License * * Author(s): * Siarzhuk Zharski - * - * + * + * */ -#ifndef _PROTO_MODULE_H_ +#ifndef _PROTO_MODULE_H_ #define _PROTO_MODULE_H_ #ifndef _MODULE_H @@ -22,7 +22,7 @@ #endif / *_SG_BUFFER_H_*/ enum { - /* B_OK */ /* JFYI:command is OK */ + /* B_OK */ /* JFYI:command is OK */ B_CMD_FAILED = B_ERRORS_END + 1, /* command failed */ B_CMD_WIRE_FAILED, /* device problems */ B_CMD_UNKNOWN, /* command state unknown */ @@ -43,9 +43,9 @@ typedef void (*ud_transfer_callback)(struct _usb_device_info *udi, typedef struct { module_info module; - - status_t (*init)(struct _usb_device_info *udi); - status_t (*reset)(struct _usb_device_info *udi); + + status_t (*init)(struct _usb_device_info *udi); + status_t (*reset)(struct _usb_device_info *udi); void (*transfer)(struct _usb_device_info *udi, uint8 *cmd, uint8 cmdlen, //sg_buffer *sgb, @@ -54,7 +54,7 @@ typedef struct { int32 transfer_len, EDirection dir, CCB_SCSIIO *ccbio, - ud_transfer_callback cb); + ud_transfer_callback cb); } protocol_module_info; @@ -63,10 +63,10 @@ typedef struct { status_t (*transform)(struct _usb_device_info *udi, uint8 *cmd, uint8 len, - uint8 **rcmd, uint8 *rlen); + uint8 **rcmd, uint8 *rlen); } transform_module_info; -#define MODULE_PREFIX "generic/usb_scsi_extensions/" +#define MODULE_PREFIX "generic/usb_scsi_extensions/" #define PROTOCOL_SUFFIX "/protocol/v1" #define TRANSFORM_SUFFIX "/transform/v1" #define PROTOCOL_MODULE_MASK MODULE_PREFIX"%s"PROTOCOL_SUFFIX @@ -74,13 +74,13 @@ typedef struct { /** \define:_TRACE_ALWAYS - trace always - used mainly for error messages + trace always - used mainly for error messages */ #define PTRACE_ALWAYS(__udi, __x...) \ { /*if(__udi->b_trace)*/ __udi->trace(true, __x); } /** \define:TRACE - trace only if logging is activated + trace only if logging is activated */ #define PTRACE(__udi, __x...) \ { if(__udi->b_trace) __udi->trace(false, __x); } diff --git a/src/add-ons/kernel/busses/scsi/usb/settings.c b/src/add-ons/kernel/busses/scsi/usb/settings.c index 9b154c3a4e..dd0c595de5 100644 --- a/src/add-ons/kernel/busses/scsi/usb/settings.c +++ b/src/add-ons/kernel/busses/scsi/usb/settings.c @@ -1,20 +1,20 @@ /** * * TODO: description - * - * This file is a part of USB SCSI CAM for Haiku OS. + * + * This file is a part of USB SCSI CAM for Haiku. * May be used under terms of the MIT License * * Author(s): * Siarzhuk Zharski - * - * + * + * */ /** driver settings support implementation */ #include "usb_scsi.h" #include "settings.h" -//#include "proto_common.h" +//#include "proto_common.h" #include /* strtoul */ #include /* strncpy */ @@ -37,46 +37,46 @@ bool b_ignore_sysinit2 = false; settings_keys array. */ enum SKKeys{ - skkVendor = 0, - skkDevice, -// skkName, -// skkTransport, - skkProtocol, - skkCommandSet, - skkFakeInq, - skk6ByteCmd, + skkVendor = 0, + skkDevice, +// skkName, +// skkTransport, + skkProtocol, + skkCommandSet, + skkFakeInq, + skk6ByteCmd, skkTransTU, skkNoTU, - skkNoGetMaxLUN, - skkNoPreventMedia, - skkUseModeSense10, - skkForceReadOnly, - skkProtoBulk, - skkProtoCB, + skkNoGetMaxLUN, + skkNoPreventMedia, + skkUseModeSense10, + skkForceReadOnly, + skkProtoBulk, + skkProtoCB, skkProtoCBI, // skkProtoFreecom, - skkCmdSetSCSI, - skkCmdSetUFI, - skkCmdSetATAPI, - skkCmdSetRBC, - skkCmdSetQIC157, - + skkCmdSetSCSI, + skkCmdSetUFI, + skkCmdSetATAPI, + skkCmdSetRBC, + skkCmdSetQIC157, + skkKeysCount, -// skkTransportBase = skkSubClassSCSI, - skkProtoBegin = skkProtoBulk, - skkProtoEnd = skkProtoCBI, - skkCmdSetBegin = skkCmdSetSCSI, - skkCmdSetEnd = skkCmdSetQIC157, +// skkTransportBase = skkSubClassSCSI, + skkProtoBegin = skkProtoBulk, + skkProtoEnd = skkProtoCBI, + skkCmdSetBegin = skkCmdSetSCSI, + skkCmdSetEnd = skkCmdSetQIC157, }; /** - helper struct, used in our "quick" search algorithm + helper struct, used in our "quick" search algorithm */ struct _settings_key{ union _hash{ char name[32]; uint16 key; }hash; - uint32 property; + uint32 property; }settings_keys[] = { /**< array of keys, used in our settings files */ {{"vendor" }, 0}, /* MUST BE SYNCHRONISED WITH skk*** indexes!!! */ {{"device" }, 0}, @@ -105,7 +105,7 @@ struct _settings_key{ /** \define:SK_EQUAL checks is the __name parameter correspond to value, pointed by __id index - in settings_keys array. The magic of our "quick" search algorithm =-)) + in settings_keys array. The magic of our "quick" search algorithm =-)) */ #define CAST_SK(__name) (*(uint16 *)(__name)) #define SK_EQUAL(__name, __id) ((CAST_SK(__name) == (settings_keys[__id].hash.key)) && \ @@ -114,7 +114,7 @@ struct _settings_key{ \fn:load_module_settings loads driver settings from extarnal settings file through BeOS driver settings API. Called on initialization of the module -*/ +*/ void load_module_settings(void) { void *sh = load_driver_settings(MODULE_NAME); @@ -128,25 +128,25 @@ void load_module_settings(void) b_ignore_sysinit2 = get_driver_boolean_parameter(sh, "ignore_sysinit2", b_ignore_sysinit2, false); if(reserved_devices > MAX_DEVICES_COUNT) - reserved_devices = MAX_DEVICES_COUNT; + reserved_devices = MAX_DEVICES_COUNT; if(reserved_luns > MAX_LUNS_COUNT) reserved_luns = MAX_LUNS_COUNT; b_reservation_on = (reserved_devices != 0); - + unload_driver_settings(sh); } else { TRACE("settings:load:file '%s' was not found. Using default setting...\n", MODULE_NAME); - } + } } /** \fn:strncpy_value \param to: buffer for copied string \param dp: driver_parameter, from wich copied string come - \param size: maximal size of copied string + \param size: maximal size of copied string copies a string, containing value[0] of this parameter, from driver_parameter, pointed by dp, to buffer pointed by to. Semantic of this function is similar - to standard strncpy() one. + to standard strncpy() one. */ /*static void strncpy_value(char *to, driver_parameter *dp, size_t size) @@ -162,7 +162,7 @@ strncpy_value(char *to, driver_parameter *dp, size_t size) \return: a bitmasked value from PROP_-defined flags for USB subclass and \ protocol parse the transport driver_parameter for known USB subclasses, protocols and - compose a bitmasked value from those settings + compose a bitmasked value from those settings */ static uint32 parse_transport(driver_parameter *dp, int skkBase, int skkEnd, @@ -185,14 +185,14 @@ parse_transport(driver_parameter *dp, int skkBase, int skkEnd, if(dp->value_count > 1){ TRACE("settings:parse_transport:accept '%s', ignore extra...\n", value); } - } + } return ret; } /** \fn:lookup_device_info \param product_id: product id of device to be checked for private settings \param dp: driver_parameter, containing device information - \param udd: on return contains name,protocol etc. information about device + \param udd: on return contains name,protocol etc. information about device \return: "true" if private settings for device found - "false" otherwise looks through device parameter, pointed by dp, obtains the name and other parameters of private device settings if available @@ -218,12 +218,12 @@ lookup_device_info(uint16 product_id, driver_parameter *dp, } else*/ if(SK_EQUAL(dp->parameters[prm].name, skkProtocol)){ uds->properties |= parse_transport(&dp->parameters[prm], - skkProtoBegin, skkProtoEnd, + skkProtoBegin, skkProtoEnd, PROTO_VENDOR, uds->vendor_protocol); } else if(SK_EQUAL(dp->parameters[prm].name, skkCommandSet)){ uds->properties |= parse_transport(&dp->parameters[prm], - skkCmdSetBegin, skkCmdSetEnd, + skkCmdSetBegin, skkCmdSetEnd, CMDSET_VENDOR, uds->vendor_commandset); } else if(SK_EQUAL(dp->parameters[prm].name, skkFakeInq)){ @@ -234,10 +234,10 @@ lookup_device_info(uint16 product_id, driver_parameter *dp, } else if(SK_EQUAL(dp->parameters[prm].name, skkTransTU)){ uds->properties |= FIX_TRANS_TEST_UNIT; - } else + } else if(SK_EQUAL(dp->parameters[prm].name, skkNoTU)){ uds->properties |= FIX_NO_TEST_UNIT; - } else + } else if(SK_EQUAL(dp->parameters[prm].name, skkNoPreventMedia)){ uds->properties |= FIX_NO_PREVENT_MEDIA; } else @@ -276,7 +276,7 @@ lookup_vendor_info(uint16 vendor_id, uint16 product_id, driver_parameter *dp, usb_device_settings *uds) { bool b_found = false; - if(dp && dp->value_count > 0 && dp->values[0]){ + if(dp && dp->value_count > 0 && dp->values[0]){ uint16 id = strtoul(dp->values[0], NULL, 0) & 0xffff; if(vendor_id == id){ int i = 0; @@ -302,7 +302,7 @@ lookup_vendor_info(uint16 vendor_id, uint16 product_id, \param udd: on return contains name,protocol etc. information about device \return: "true" if private settings for device found - "false" otherwise looks through driver settings file for private device description and load it - if available into struct pointed by udd + if available into struct pointed by udd */ bool lookup_device_settings(const usb_device_descriptor *udd, usb_device_settings *uds) @@ -322,10 +322,10 @@ bool lookup_device_settings(const usb_device_descriptor *udd, if(b_found){ uds->vendor_id = udd->vendor_id; break; //we've got it - stop enumeration. - } + } } } /*for(...) - enumerate "root" parameters*/ - } /* if(ds) */ + } /* if(ds) */ unload_driver_settings(sh); } /* if(sh) */ if(b_found){ diff --git a/src/add-ons/kernel/busses/scsi/usb/settings.h b/src/add-ons/kernel/busses/scsi/usb/settings.h index 68c8161bc1..18969c2e19 100644 --- a/src/add-ons/kernel/busses/scsi/usb/settings.h +++ b/src/add-ons/kernel/busses/scsi/usb/settings.h @@ -1,18 +1,18 @@ /** * * TODO: description - * - * This file is a part of USB SCSI CAM for Haiku OS. + * + * This file is a part of USB SCSI CAM for Haiku. * May be used under terms of the MIT License * * Author(s): * Siarzhuk Zharski - * - * + * + * */ /** driver settings support definitions */ -#ifndef _USB_SCSI_SETTINGS_H_ +#ifndef _USB_SCSI_SETTINGS_H_ #define _USB_SCSI_SETTINGS_H_ void load_module_settings(void); @@ -31,8 +31,8 @@ bool lookup_device_settings(const usb_device_descriptor *udd, extern int reserved_devices; extern int reserved_luns; -extern bool b_reservation_on; +extern bool b_reservation_on; extern bool b_ignore_sysinit2; -#endif /*_USB_SCSI_SETTINGS_H_*/ +#endif /*_USB_SCSI_SETTINGS_H_*/ diff --git a/src/add-ons/kernel/busses/scsi/usb/sg_buffer.c b/src/add-ons/kernel/busses/scsi/usb/sg_buffer.c index 1eafe16960..930b5a60cb 100644 --- a/src/add-ons/kernel/busses/scsi/usb/sg_buffer.c +++ b/src/add-ons/kernel/busses/scsi/usb/sg_buffer.c @@ -1,23 +1,23 @@ /** * * TODO: description - * - * This file is a part of USB SCSI CAM for Haiku OS. + * + * This file is a part of USB SCSI CAM for Haiku. * May be used under terms of the MIT License * * Author(s): * Siarzhuk Zharski - * - * + * + * */ /** handling SCSI data-buffer (both usual "plain" and scatter/gather ones) */ #include -#include "usb_scsi.h" +#include "usb_scsi.h" #include -#include "tracing.h" +#include "tracing.h" #include "sg_buffer.h" /** @@ -77,7 +77,7 @@ realloc_sg_buffer(sg_buffer *sgb, size_t size) status_t sg_access_byte(sg_buffer *sgb, off_t offset, uchar *byte, bool b_set) { - status_t status = B_ERROR; + status_t status = B_ERROR; int i = 0; for(; i < sgb->count; i++){ if(offset >= sgb->piov[i].iov_len){ @@ -101,7 +101,7 @@ sg_memcpy(sg_buffer *d_sgb, off_t d_offset, sg_buffer *s_sgb, off_t s_offset, size_t size) { status_t status = B_NO_INIT; - while(0 != d_sgb && 0 != s_sgb){ + while(0 != d_sgb && 0 != s_sgb){ uchar *d_ptr = 0; uchar *s_ptr = 0; status = B_ERROR; @@ -166,7 +166,7 @@ sg_buffer_len(sg_buffer *sgb, size_t *size) { status_t status = B_NO_INIT; if(0!=sgb && 0!=size){ - int i = 0; + int i = 0; *size = 0; for(; i < sgb->count; i++){ *size += sgb->piov[i].iov_len; diff --git a/src/add-ons/kernel/busses/scsi/usb/sg_buffer.h b/src/add-ons/kernel/busses/scsi/usb/sg_buffer.h index 736f74632e..f5e71b83c6 100644 --- a/src/add-ons/kernel/busses/scsi/usb/sg_buffer.h +++ b/src/add-ons/kernel/busses/scsi/usb/sg_buffer.h @@ -1,18 +1,18 @@ /** * * TODO: description - * - * This file is a part of USB SCSI CAM for Haiku OS. + * + * This file is a part of USB SCSI CAM for Haiku. * May be used under terms of the MIT License * * Author(s): * Siarzhuk Zharski - * - * + * + * */ /** handling SCSI data-buffer (both usual "plain" and scatter/gather ones) */ - -#ifndef _SG_BUFFER_H_ + +#ifndef _SG_BUFFER_H_ #define _SG_BUFFER_H_ #ifndef _IOVEC_H @@ -40,5 +40,5 @@ status_t sg_memcpy(sg_buffer *dest_sgb, off_t dest_offset, sg_buffer *src_sgb, off_t src_offset, size_t size); void free_sg_buffer(sg_buffer *sgb); -#endif /*_SG_BUFFER_H_*/ +#endif /*_SG_BUFFER_H_*/ diff --git a/src/add-ons/kernel/busses/scsi/usb/tracing.c b/src/add-ons/kernel/busses/scsi/usb/tracing.c index 9adbd7c423..d11855ab37 100644 --- a/src/add-ons/kernel/busses/scsi/usb/tracing.c +++ b/src/add-ons/kernel/busses/scsi/usb/tracing.c @@ -1,14 +1,14 @@ /** * * TODO: description - * - * This file is a part of USB SCSI CAM for Haiku OS. + * + * This file is a part of USB SCSI CAM for Haiku. * May be used under terms of the MIT License * * Author(s): * Siarzhuk Zharski - * - * + * + * */ /** tracing support implementation */ @@ -18,15 +18,15 @@ #include #include /* posix file i/o - create, write, close */ #include -#include -#include +#include +#include /** private log path name */ static const char *private_log_path = "/var/log/"MODULE_NAME".log"; static const char *log_port_name = MODULE_NAME"-logging"; -#ifdef BUILD_LOG_DAEMON +#ifdef BUILD_LOG_DAEMON int main(int argc, char**argv) { @@ -45,10 +45,10 @@ int main(int argc, char**argv) FILE *f = fopen(private_log_path, "a"); fwrite(buffer, sz, 1, f); fclose(f); - } + } } } - } + } return 0; } @@ -56,7 +56,7 @@ int main(int argc, char**argv) /** is activity logging on or off? */ #if DEBUG -bool b_log = true; +bool b_log = true; #else bool b_log = false; #endif @@ -79,7 +79,7 @@ static bool b_log_time = false; /** log thread id from wich logging performed */ static bool b_log_thid = false; /** log thread name from wich logging performed */ -static bool b_log_thname = false; +static bool b_log_thname = false; /** semaphore id used to synchronizing logging requests */ //static sem_id loglock; /** log result of READ_CAPACITY command */ @@ -118,11 +118,11 @@ load_log_settings(void *sh) b_log_data_processing = get_driver_boolean_parameter(sh, "debug_trace_data_io", b_log_data_processing, false); - b_log_sense_data = + b_log_sense_data = get_driver_boolean_parameter(sh, "debug_trace_sense_data", b_log_sense_data, false); b_log_capacity = get_driver_boolean_parameter(sh, "debug_trace_capacity", - b_log_capacity, false); + b_log_capacity, false); if(!b_log_file){ /* some information is already in system log entries */ b_log_thid = false; b_log_thname = false; @@ -144,7 +144,7 @@ create_log(void) /** \fn: usb_scsi_trace - \param b_force: if true - output message ignoring current logging state + \param b_force: if true - output message ignoring current logging state \param fmt: format string used in message formatting \param ...: variable argument used in message formatting formats and traces messages to current debug output target. @@ -267,13 +267,13 @@ usb_scsi_trace_CCB_SCSIIO(const CCB_SCSIIO *ccbio) ccbio->cam_vu_flags, ccbio->cam_tag_action); - usb_scsi_trace_bytes("CDB_UN:\n", ccbio->cam_cdb_io.cam_cdb_bytes, IOCDBLEN); + usb_scsi_trace_bytes("CDB_UN:\n", ccbio->cam_cdb_io.cam_cdb_bytes, IOCDBLEN); } /** \fn: usb_scsi_command_trace \param b_hlight: highlight command and prefix it with spec. charachter \param cmd: array of bytes to be traced. typically pointer SCSI command buffer - \param cmdlen: size of buffer in cmd parameter + \param cmdlen: size of buffer in cmd parameter traces SCSI commands into debug output target.can highlight and prefix the text with special charachter and color for two different types of commands. @@ -294,7 +294,7 @@ usb_scsi_trace_command(bool b_hlight, const uint8 *cmd, size_t cmdlen) /** \fn:usb_scsi_bytes_trace \param bytes:array of bytes to be traced. - \param bytes_len: size of buffer in bytes parameter + \param bytes_len: size of buffer in bytes parameter traces buffer bytes one by one into debug output target. */ void @@ -319,7 +319,7 @@ usb_scsi_trace_bytes(const char *prefix, const uint8 *bytes, size_t bytes_len) } else { TRACE_ALWAYS("usb_scsi_trace_bytes:error allocate " "memory for tracing %d bytes\n", len); - } + } } void usb_scsi_trace_sgb(const char *prefix, sg_buffer *sgb) @@ -360,8 +360,8 @@ void usb_scsi_trace_SG(iovec *sg, int count) char sg_mask[] = "SG:{%s}\n"; char truncTail[] = ""; size_t trunc_count = min(count, 0x20); /* length watchdog */ - size_t len = sizeof(sg_mask) + sizeof(truncTail) + trunc_count * 16; - char *pbuf = (char *)malloc(len + 1); + size_t len = sizeof(sg_mask) + sizeof(truncTail) + trunc_count * 16; + char *pbuf = (char *)malloc(len + 1); if(pbuf){ int i = 0; char *p = pbuf; @@ -372,13 +372,13 @@ void usb_scsi_trace_SG(iovec *sg, int count) /* user should be informed about truncation too*/ if(trunc_count < count) strcpy(p, truncTail); - + TRACE(sg_mask, pbuf); free(pbuf); } else { TRACE_ALWAYS("usb_scsi_trace_SG:error allocate " "memory for tracing %d SG entries\n", trunc_count); - } + } } #endif /* BUILD_LOG_DAEMON */ diff --git a/src/add-ons/kernel/busses/scsi/usb/tracing.h b/src/add-ons/kernel/busses/scsi/usb/tracing.h index 9b60f35ed1..455eef450d 100644 --- a/src/add-ons/kernel/busses/scsi/usb/tracing.h +++ b/src/add-ons/kernel/busses/scsi/usb/tracing.h @@ -1,24 +1,24 @@ /** * * TODO: description - * - * This file is a part of USB SCSI CAM for Haiku OS. + * + * This file is a part of USB SCSI CAM for Haiku. * May be used under terms of the MIT License * * Author(s): * Siarzhuk Zharski - * - * + * + * */ /** tracing support definitions */ -#ifndef _USB_SCSI_TRACING_H_ +#ifndef _USB_SCSI_TRACING_H_ #define _USB_SCSI_TRACING_H_ #ifndef _SG_BUFFER_H_ #include "sg_buffer.h" #endif /*_SG_BUFFER_H_*/ - + void load_log_settings(void *sh); void create_log(void); void usb_scsi_trace(bool b_force, const char *fmt, ...); @@ -32,13 +32,13 @@ void usb_scsi_trace_CCB_SCSIIO(const CCB_SCSIIO *ccbio); /* ---------------------- Generic tracing --------------------------------------- */ /** \define:TRACE_ALWAYS - trace always - used mainly for error messages + trace always - used mainly for error messages */ #define TRACE_ALWAYS(x...) \ usb_scsi_trace(true, x) /** \define:TRACE - trace only if logging is activated + trace only if logging is activated */ #define TRACE(x...) \ usb_scsi_trace(false, x) @@ -48,7 +48,7 @@ extern bool b_log_scsi_cmd; void usb_scsi_trace_command(bool b_hlight, const uint8 *cmd, size_t cmdlen); /** \define:TRACE_SCSI_COMMAND - trace SCSI command + trace SCSI command */ #define TRACE_SCSI_COMMAND(cmd, cmdlen)\ { if(b_log_scsi_cmd) usb_scsi_trace_command(false, cmd, cmdlen); } @@ -89,7 +89,7 @@ extern bool b_log_sense_data; trace the information REQUEST SENSE data. */ #define TRACE_SENSE_DATA(data, len)\ - { if(b_log_sense_data) usb_scsi_trace_bytes("SENSE:", data, len); } + { if(b_log_sense_data) usb_scsi_trace_bytes("SENSE:", data, len); } #define TRACE_MODE_SENSE_DATA(prefix, data, len)\ { if(b_log_sense_data) usb_scsi_trace_bytes(prefix, data, len); } #define TRACE_MODE_SENSE_SGB(prefix, data)\ @@ -99,5 +99,5 @@ extern bool b_log_capacity; #define TRACE_CAPACITY(prefix, data)\ { if(b_log_capacity) usb_scsi_trace_sgb(prefix, data); } -#endif /*_USB_SCSI_TRACING_H_*/ +#endif /*_USB_SCSI_TRACING_H_*/ diff --git a/src/add-ons/kernel/busses/scsi/usb/transform_procs.h b/src/add-ons/kernel/busses/scsi/usb/transform_procs.h index fb19eca327..b31ad1cb77 100644 --- a/src/add-ons/kernel/busses/scsi/usb/transform_procs.h +++ b/src/add-ons/kernel/busses/scsi/usb/transform_procs.h @@ -1,23 +1,23 @@ /** * * TODO: description - * - * This file is a part of USB SCSI CAM for Haiku OS. + * + * This file is a part of USB SCSI CAM for Haiku. * May be used under terms of the MIT License * * Author(s): * Siarzhuk Zharski - * - * + * + * */ /** decalration of SCSI commands transformation procedures */ -#ifndef _TRANSFORM_PROCS_H_ +#ifndef _TRANSFORM_PROCS_H_ #define _TRANSFORM_PROCS_H_ -#ifndef _PROTO_MODULE_H_ +#ifndef _PROTO_MODULE_H_ #include "proto_module.h" -#endif /* _PROTO_MODULE_H_ */ +#endif /* _PROTO_MODULE_H_ */ /* transforms SCSI commands */ extern transform_module_info scsi_transform_m; /* transforms RBC commands */ @@ -28,4 +28,4 @@ extern transform_module_info ufi_transform_m; extern transform_module_info atapi_transform_m; /* transforms QIC-157 commands */ extern transform_module_info qic157_transform_m; -#endif /*_TRANSFORM_PROCS_H_*/ +#endif /*_TRANSFORM_PROCS_H_*/ diff --git a/src/add-ons/kernel/busses/scsi/usb/usb_defs.h b/src/add-ons/kernel/busses/scsi/usb/usb_defs.h index aedadedccb..d8a3fd17b4 100644 --- a/src/add-ons/kernel/busses/scsi/usb/usb_defs.h +++ b/src/add-ons/kernel/busses/scsi/usb/usb_defs.h @@ -1,26 +1,26 @@ /** * * TODO: description - * - * This file is a part of USB SCSI CAM for Haiku OS. + * + * This file is a part of USB SCSI CAM for Haiku. * May be used under terms of the MIT License * * Author(s): * Siarzhuk Zharski - * - * + * + * */ /** definitions that should be in system headers but ... */ -#ifndef _USB_DEFS_H_ +#ifndef _USB_DEFS_H_ #define _USB_DEFS_H_ // TODO: Shouldn't it be declared in system USB headers? #define USB_EP_ATTR_CONTROL 0x00 #define USB_EP_ATTR_ISOCHRONOUS 0x01 -#define USB_EP_ATTR_BULK 0x02 -#define USB_EP_ATTR_INTERRUPT 0x03 -#define USB_EP_ATTR_MASK 0x03 +#define USB_EP_ATTR_BULK 0x02 +#define USB_EP_ATTR_INTERRUPT 0x03 +#define USB_EP_ATTR_MASK 0x03 #define USB_EP_ADDR_DIR_IN 0x80 #define USB_EP_ADDR_DIR_OUT 0x00 @@ -42,5 +42,5 @@ //TODO: And this was in old v3 stack what now ??? #define B_DEV_STALLED 0x8000a015 /* some "forgotten" error */ -#endif /*_USB_DEFS_H_*/ +#endif /*_USB_DEFS_H_*/ diff --git a/src/add-ons/kernel/busses/scsi/usb/usb_scsi.c b/src/add-ons/kernel/busses/scsi/usb/usb_scsi.c index 3629d750cf..2a6320accf 100644 --- a/src/add-ons/kernel/busses/scsi/usb/usb_scsi.c +++ b/src/add-ons/kernel/busses/scsi/usb/usb_scsi.c @@ -1,18 +1,18 @@ /** * * TODO: description - * - * This file is a part of USB SCSI CAM for Haiku OS. + * + * This file is a part of USB SCSI CAM for Haiku. * May be used under terms of the MIT License * * Author(s): * Siarzhuk Zharski - * - * + * + * */ /** Main part of USB SIM implementation */ -#include "usb_scsi.h" +#include "usb_scsi.h" #include #include @@ -21,22 +21,22 @@ #include #include #include -#include "device_info.h" -#include "settings.h" -#include "transform_procs.h" -#include "tracing.h" -#include "scsi_commands.h" +#include "device_info.h" +#include "settings.h" +#include "transform_procs.h" +#include "tracing.h" +#include "scsi_commands.h" #include "proto_common.h" -#include "proto_bulk.h" -#include "proto_cbi.h" -#include "usb_defs.h" -#include "fake_device.h" -#include "sg_buffer.h" +#include "proto_bulk.h" +#include "proto_cbi.h" +#include "usb_defs.h" +#include "fake_device.h" +#include "sg_buffer.h" #if 0 status_t device_added(const usb_device device, void **cookie); - + status_t device_removed(void *cookie); static long sim_action(CCB_HEADER *ccbh); @@ -55,11 +55,11 @@ static long sim_init(); static long path_id = -1; static int32 load_count = 0; - + static char sim_vendor_name[] = "Haiku"; /* who wrote this driver */ static char hba_vendor_name[] = "USB"; /* who made the hardware */ static char controller_family[] = "USB SCSI"; /* what family of products */ - + struct usb_support_descriptor supported_devices[] = { {0, 0, 0, 0, 0} }; @@ -69,7 +69,7 @@ struct usb_support_descriptor supported_devices[] = { usb_device_info *usb_devices[MAX_DEVICES_COUNT]; /* main devices table locking semaphore */ sem_id usb_serial_lock = -1; - + usb_module_info *usb; static cam_for_sim_module_info *cam; @@ -95,7 +95,7 @@ static status_t xpt_extended_path_inquiry(CCB_EXTENDED_PATHINQ *ccbep); \param uii:??? \param pproperties:??? \return:B_BAD_TYPE , B_ENTRY_NOT_FOUND, B_OK - + ?? */ status_t get_interface_properties(usb_interface_info *uii, uint32 *pproperties) @@ -105,12 +105,12 @@ status_t get_interface_properties(usb_interface_info *uii, uint32 *pproperties) status = B_OK; switch(uii->descr->interface_subclass){ case USB_DEV_SUBCLASS_RBC: *pproperties |= CMDSET_RBC; break; - case USB_DEV_SUBCLASS_UFI: *pproperties |= CMDSET_UFI; break; - case USB_DEV_SUBCLASS_SFF8020I: + case USB_DEV_SUBCLASS_UFI: *pproperties |= CMDSET_UFI; break; + case USB_DEV_SUBCLASS_SFF8020I: case USB_DEV_SUBCLASS_SFF8070I: *pproperties |= CMDSET_ATAPI; break; case USB_DEV_SUBCLASS_SCSI: *pproperties |= CMDSET_SCSI; break; case USB_DEV_SUBCLASS_QIC157: *pproperties |= CMDSET_QIC157; break; - default: + default: TRACE_ALWAYS("get_interface_properties:unknown USB subclass:%02x\n", uii->descr->interface_subclass); /*status = B_ENTRY_NOT_FOUND;*/ /*B_BAD_TYPE assumed*/ @@ -120,7 +120,7 @@ status_t get_interface_properties(usb_interface_info *uii, uint32 *pproperties) case USB_DEV_PROTOCOL_CBI: *pproperties |= PROTO_CBI; break; case USB_DEV_PROTOCOL_CB: *pproperties |= PROTO_CB; break; case USB_DEV_PROTOCOL_BULK: *pproperties |= PROTO_BULK_ONLY; break; - default: + default: TRACE_ALWAYS("get_interface_properties:unknown USB protocol:%02x\n", uii->descr->interface_protocol); /*status = B_ENTRY_NOT_FOUND;*/ /*B_BAD_TYPE assumed*/ @@ -134,7 +134,7 @@ status_t get_interface_properties(usb_interface_info *uii, uint32 *pproperties) } /** \fn: - + */ status_t load_vendor_module(char **path, const char *path_mask, const char *prop, module_info **mi) @@ -154,7 +154,7 @@ status_t load_vendor_module(char **path, const char *path_mask, } /** \fn: - + */ status_t setup_transport_modules(usb_device_info *udi, usb_device_settings *uds) @@ -286,7 +286,7 @@ status_t setup_endpoints(usb_interface_info *uii, usb_device_info *udi) \param device:??? \param ppudi:??? \return:??? - + ??? */ status_t allocate_resources(usb_device_info *udi) @@ -310,11 +310,11 @@ status_t allocate_resources(usb_device_info *udi) udi->dev_num = dev; release_sem(udi->lock_sem); status = B_OK; - }else + }else status = udi->trans_sem; - } else + } else status = udi->lock_sem; - + if(status != B_OK){ TRACE_ALWAYS("allocate_resources:error:%s", strerror(status)); if(udi->lock_sem >= 0) @@ -333,7 +333,7 @@ status_t allocate_resources(usb_device_info *udi) } /** \fn: - + */ void release_resources(usb_device_info *udi) { @@ -352,7 +352,7 @@ void release_resources(usb_device_info *udi) \param device:?? \param cookie:?? \return:?? - + ?? */ status_t device_added(const usb_device device, void **cookie){ @@ -364,10 +364,10 @@ status_t device_added(const usb_device device, void **cookie){ const usb_device_descriptor *udd = (*usb->get_device_descriptor)(device); usb_device_info *udi = (usb_device_info *)malloc(sizeof(usb_device_info)); TRACE("device_added: probing canidate: " - "%04x/%04x %02d/%02d/%02d\n", + "%04x/%04x %02d/%02d/%02d\n", udd->vendor_id, udd->product_id, - udd->device_class, - udd->device_subclass, + udd->device_class, + udd->device_subclass, udd->device_protocol); if(udi){ status = B_NO_INIT; @@ -405,7 +405,7 @@ status_t device_added(const usb_device device, void **cookie){ if( B_OK == setup_transport_modules(udi, &ud_settings)){ break; } /* else - no break - fall through */ - default: + default: continue; /* skip to next interface */ } if(alt != 0){ /*TODO: are we need this ???*/ @@ -413,7 +413,7 @@ status_t device_added(const usb_device device, void **cookie){ TRACE_ALWAYS("device_added:setting alt interface failed:%s", strerror(status)); goto Failed;/* Break - is it right?*/ - } + } } if((*usb->get_configuration)(device) != uci){ if((status = (*usb->set_configuration)(device, uci)) != B_OK){ @@ -421,7 +421,7 @@ status_t device_added(const usb_device device, void **cookie){ (*usb->get_configuration)(device), uci); TRACE_ALWAYS("device_added:setting configuration failed:%s\n", strerror(status)); - + goto Failed;/* Break - is it right?*/ } } @@ -432,7 +432,7 @@ status_t device_added(const usb_device device, void **cookie){ udi->b_trace = b_log_protocol; udi->trace = usb_scsi_trace; udi->trace_bytes = usb_scsi_trace_bytes; - udi->trans_timeout = TRANS_TIMEOUT; + udi->trans_timeout = TRANS_TIMEOUT; udi->usb_m = usb; udi->not_ready_luns = 0xff; /*assume all LUNs initially not ready */ if((status = (*udi->protocol_m->init)(udi)) == B_OK){ @@ -440,7 +440,7 @@ status_t device_added(const usb_device device, void **cookie){ *cookie = udi; b_found = true; /* we have found something useful - time to go out! */ break; /* ... now break alternatives iteration.*/ - } else { + } else { release_resources(udi); } } @@ -457,26 +457,26 @@ status_t device_added(const usb_device device, void **cookie){ if(status != B_OK){ TRACE("device_added: probing failed (%s) for: %04x/%04x\n", strerror(status), udd->vendor_id, udd->product_id); - } -Failed: + } +Failed: return status; } /** \fn:device_removed \param cookie:??? \return:??? - + ??? */ status_t device_removed(void *cookie) { status_t status = B_OK; usb_device_info *udi = (usb_device_info *)cookie; - acquire_sem(udi->lock_sem); /* wait for possible I/O operation complete */ + acquire_sem(udi->lock_sem); /* wait for possible I/O operation complete */ release_resources(udi); /* no corresponding call of release_sem(udi->lock_sem); - semaphore was deleted in release_resources, any waiting thread - was failed with BAD_SEM_ID. + was failed with BAD_SEM_ID. */ TRACE_ALWAYS("device_removed[%d]:All The Best !!!\n", udi->dev_num); free(udi); @@ -486,7 +486,7 @@ status_t device_removed(void *cookie) /** \fn:sim_init \return: ??? - + called on SIM init */ static long sim_init(void) @@ -506,7 +506,7 @@ pre_check_scsi_io_request(usb_device_info *udi, CCB_SCSIIO *ccbio, uint8 target_lun = ccbio->cam_ch.cam_target_lun; *ret_status = B_OK; /* handle reserved device and luns entries */ - if(b_reservation_on && udi == NULL && + if(b_reservation_on && udi == NULL && target_id < reserved_devices && target_lun < reserved_luns) { @@ -535,7 +535,7 @@ pre_check_scsi_io_request(usb_device_info *udi, CCB_SCSIIO *ccbio, memset(&udi->autosense_data, 0, sizeof(udi->autosense_data)); } else { memset(ccbio->cam_sense_ptr, 0, ccbio->cam_sense_len); - } + } return true; } /** @@ -547,7 +547,7 @@ pre_handle_features(usb_device_info *udi, CCB_SCSIIO *ccbio, { uint8 target_lun = ccbio->cam_ch.cam_target_lun; *ret_status = B_OK; - udi->trans_timeout = TRANS_TIMEOUT; + udi->trans_timeout = TRANS_TIMEOUT; switch(command->opcode){ case MODE_SELECT_6: case MODE_SENSE_6:{ @@ -572,18 +572,18 @@ pre_handle_features(usb_device_info *udi, CCB_SCSIIO *ccbio, } TRACE_MODE_SENSE_SGB("MODE SELECT 6:", &sgb_sense_6); if(B_OK != sg_memcpy(sgb, 1, &sgb_sense_6, 0, 3) || - B_OK != sg_memcpy(sgb, 7, &sgb_sense_6, 3, 1) || + B_OK != sg_memcpy(sgb, 7, &sgb_sense_6, 3, 1) || B_OK != sg_memcpy(sgb, 8, &sgb_sense_6, 4, ccbio->cam_dxfer_len - sizeof(scsi_mode_param_header_6))) { /* In case of error TRACE-ing was already performed in sg_ functions */ goto set_REQ_INVALID_and_return; } TRACE_MODE_SENSE_SGB("MODE SELECT 10:", sgb); - } + } } /*else { if(b_select){ / * trace data if configured in settings * / TRACE_MODE_SENSE_DATA("MODE_SELECT:", ccbio->cam_data_ptr, ccbio->cam_dxfer_len); - } + } }*/ }break; case INQUIRY: /* fake INQUIRY request */ @@ -605,7 +605,7 @@ pre_handle_features(usb_device_info *udi, CCB_SCSIIO *ccbio, default: break; } return true; - + set_REQ_CMP_and_return: ccbio->cam_ch.cam_status = CAM_REQ_CMP; return false;//*ret_status = B_OK; @@ -625,11 +625,11 @@ post_handle_features(usb_device_info *udi, CCB_SCSIIO *ccbio, bool b_cmd_ok = (ccbio->cam_ch.cam_status == CAM_REQ_CMP); uint8 target_lun = ccbio->cam_ch.cam_target_lun; switch(command->opcode){ - case READ_6: + case READ_6: case WRITE_6: -#if 0 +#if 0 /* Disabled - single problem can switch to 6-bytes mode. If device doesn't - support 6-bytes command all goes totally wrong. That's bad. */ + support 6-bytes command all goes totally wrong. That's bad. */ if(!b_cmd_ok && !HAS_FEATURES(udi->descr.properties, PROP_FORCE_RW_TO_6)){ TRACE("post_handle_features:READ(10)/WRITE(10) failed - retry 6-byte one\n"); udi->descr.properties |= PROP_FORCE_RW_TO_6; @@ -668,13 +668,13 @@ post_handle_features(usb_device_info *udi, CCB_SCSIIO *ccbio, } TRACE_MODE_SENSE_SGB("MODE SENSE 10:", sgb); if( B_OK != sg_memcpy(&sgb_sense_6, 0, sgb, 1, 3) || - B_OK != sg_memcpy(&sgb_sense_6, 3, sgb, 7, 1) || + B_OK != sg_memcpy(&sgb_sense_6, 3, sgb, 7, 1) || B_OK != sg_memcpy(&sgb_sense_6, 4, sgb, 8, ccbio->cam_dxfer_len - sizeof(scsi_mode_param_header_6))) { /* In case of error TRACE-ing was already performed in sg_ functions */ TRACE_ALWAYS("MODE_SENSE 10->6 conversion failed\n"); goto set_REQ_INVALID_and_return; - } + } } /* set write-protected flag if required by user */ if(HAS_FIXES(udi->properties, FIX_FORCE_READ_ONLY)){ @@ -719,14 +719,14 @@ post_handle_features(usb_device_info *udi, CCB_SCSIIO *ccbio, set_REQ_INVALID_and_return: ccbio->cam_ch.cam_status = CAM_REQ_INVALID; *ret_status = B_BAD_VALUE; - return false; /* do not retry - fatal error */ + return false; /* do not retry - fatal error */ } /** \fn:xpt_scsi_io \param ccbio: ???? \return: ??? - - xpt_scsi_io - handle XPT_SCSI_IO sim action + + xpt_scsi_io - handle XPT_SCSI_IO sim action */ status_t xpt_scsi_io(CCB_SCSIIO *ccbio) { @@ -743,12 +743,12 @@ status_t xpt_scsi_io(CCB_SCSIIO *ccbio) } #if 0 /* activate if you need detailed logging of CCB_SCSI request*/ - usb_scsi_trace_CCB_SCSIIO(ccbio); + usb_scsi_trace_CCB_SCSIIO(ccbio); #endif /* acquire semaphore - avoid re-enters */ -/* if((status = acquire_sem_etc(udi->lock_sem, 1, +/* if((status = acquire_sem_etc(udi->lock_sem, 1, B_RELATIVE_TIMEOUT, udi->trans_timeout)) != B_OK) */ // TRACE_ALWAYS("sem before acq:%08x\n",udi->lock_sem); @@ -756,14 +756,14 @@ status_t xpt_scsi_io(CCB_SCSIIO *ccbio) /* disabled - CAM_BUSY flag is not recognized by BeOS ... :-( if(status == B_WOULD_BLOCK){ TRACE("locked sema bypass OK\n"); - ccbio->cam_ch.cam_status = CAM_BUSY; + ccbio->cam_ch.cam_status = CAM_BUSY; return B_OK; - }*/ + }*/ TRACE("xpt_scsi_io:acquire_sem_etc() failed:%08x\n", status); ccbio->cam_ch.cam_status = CAM_DEV_NOT_THERE; return B_DEV_BAD_DRIVE_NUM; } - /* set the command data pointer */ + /* set the command data pointer */ if(ccbio->cam_ch.cam_flags & CAM_CDB_POINTER){ cmd = ccbio->cam_cdb_io.cam_cdb_ptr; }else{ @@ -773,7 +773,7 @@ status_t xpt_scsi_io(CCB_SCSIIO *ccbio) *_handle_features() functions! Twice reallocation is also not awaited! Note this on refactoring!!! */ /*TODO returns!*/ - init_sg_buffer(&sgb, ccbio); + init_sg_buffer(&sgb, ccbio); do{ /* <-- will be repeated if 6-byte RW/MS commands failed */ uint8 *rcmd; uint8 rcmdlen; @@ -801,11 +801,11 @@ status_t xpt_scsi_io(CCB_SCSIIO *ccbio) case CAM_DIR_OUT: dir = eDirOut; break; default: dir = eDirNone; break; } - + TRACE_DATA_IO_SG(sgb.piov, sgb.count); - + /*TODO: return!*/ - sg_buffer_len(&sgb, &transfer_len); + sg_buffer_len(&sgb, &transfer_len); /* transfer command to device. SCSI status will be handled in callback */ (*udi->protocol_m->transfer)(udi, rcmd, rcmdlen, sgb.piov, sgb.count, transfer_len/*ccbio->cam_dxfer_len*/, @@ -820,26 +820,26 @@ status_t xpt_scsi_io(CCB_SCSIIO *ccbio) \fn:xpt_path_inquiry \param ccbp: \return: - - xpt_path_inquiry - handle XPT_PATH_INQ sim action + + xpt_path_inquiry - handle XPT_PATH_INQ sim action */ status_t xpt_path_inquiry(CCB_PATHINQ *ccbp) { status_t status = B_OK; - + ccbp->cam_version_num = SIM_VERSION; ccbp->cam_target_sprt = 0; ccbp->cam_hba_eng_cnt = 0; memset (ccbp->cam_vuhba_flags, 0, VUHBA); ccbp->cam_sim_priv = SIM_PRIV; ccbp->cam_async_flags = 0; - ccbp->cam_initiator_id = CONTROLLER_SCSI_ID; + ccbp->cam_initiator_id = CONTROLLER_SCSI_ID; ccbp->cam_hba_inquiry = CONTROLLER_SCSI_BUS; /* Narrow SCSI bus */ ccbp->cam_hba_misc = PIM_NOINQUIRY; ccbp->cam_osd_usage = 0; /* There should be special handling of path_id == 0xff but looks like it's not used by BeOS now */ - /*ccbp->cam_hpath_id = path_id;*/ + /*ccbp->cam_hpath_id = path_id;*/ strncpy(ccbp->cam_sim_vid, sim_vendor_name, SIM_ID); strncpy(ccbp->cam_hba_vid, hba_vendor_name, HBA_ID); ccbp->cam_ch.cam_status = CAM_REQ_CMP; @@ -849,13 +849,13 @@ status_t xpt_path_inquiry(CCB_PATHINQ *ccbp) \fn:xpt_extended_path_inquiry \param ccbep: ??? \return:??? - - xpt_extended_path_inquiry - handle XPT_EXTENDED_PATH_INQ sim action + + xpt_extended_path_inquiry - handle XPT_EXTENDED_PATH_INQ sim action */ status_t xpt_extended_path_inquiry(CCB_EXTENDED_PATHINQ *ccbep) { status_t status = B_OK; - xpt_path_inquiry((CCB_PATHINQ *)ccbep); + xpt_path_inquiry((CCB_PATHINQ *)ccbep); sprintf(ccbep->cam_sim_version, "%d.0", SIM_VERSION); sprintf(ccbep->cam_hba_version, "%d.0", HBA_VERSION); strncpy(ccbep->cam_controller_family, controller_family, FAM_ID); @@ -866,7 +866,7 @@ status_t xpt_extended_path_inquiry(CCB_EXTENDED_PATHINQ *ccbep) \fn:sim_action \param ccbh: ???? \return: ???? - + This fucntion performs SCSI interface module actions - calls corresponding xpt_* - functions. */ @@ -904,9 +904,9 @@ static long sim_action(CCB_HEADER *ccbh) \param op: operation to be performed on this module \param ...: possible additional arguments \return: B_OK on success, error status on failure - + This function deals with standard module operations. Currently, the only - two things that entails are initialization and uninitialization. + two things that entails are initialization and uninitialization. - get the SCSI Bus Manager Module and USB Manager Module - put them when we're finished */ @@ -920,15 +920,15 @@ static status_t std_ops(int32 op, ...) TRACE_ALWAYS("std_ops: B_MODULE_INIT called!\n"); /* if(0 == atomic_add(&load_count, 1)){ thread_info tinfo = {0}; */ - load_module_settings(); + load_module_settings(); /* get_thread_info(find_thread(0), &tinfo); if(!b_ignore_sysinit2 || (0 != strcmp(tinfo.name, "sysinit2"))){ - create_log(); - if(get_module(B_USB_MODULE_NAME, (module_info **)&usb) == B_OK){ - if(get_module(B_CAM_FOR_SIM_MODULE_NAME, (module_info **)&cam) == B_OK){ + create_log(); + if(get_module(B_USB_MODULE_NAME, (module_info **)&usb) == B_OK){ + if(get_module(B_CAM_FOR_SIM_MODULE_NAME, (module_info **)&cam) == B_OK){ for(i = 0; i < MAX_DEVICES_COUNT; i++) - usb_devices[i] = NULL; - + usb_devices[i] = NULL; + if((*usb->register_driver)(MODULE_NAME, supported_devices, SIZEOF(supported_devices), "usb_dsk") == B_OK){ if((*usb->install_notify)(MODULE_NAME, ¬ify_hooks) == B_OK){ entry.sim_init = sim_init; @@ -936,9 +936,9 @@ static status_t std_ops(int32 op, ...) path_id =(*cam->xpt_bus_register)(&entry); usb_serial_lock = create_sem(1, MODULE_NAME"_devices_table_lock"); status = B_OK; - break; - } - } + break; + } + } put_module(B_CAM_FOR_SIM_MODULE_NAME); } put_module(B_USB_MODULE_NAME); @@ -948,7 +948,7 @@ static status_t std_ops(int32 op, ...) } } else { atomic_add(&load_count, -1); - }*/ + }*/ break; case B_MODULE_UNINIT: TRACE_ALWAYS("std_ops: B_MODULE_UNINIT called!\n"); @@ -961,7 +961,7 @@ static status_t std_ops(int32 op, ...) } delete_sem(usb_serial_lock); put_module(B_USB_MODULE_NAME); - put_module(B_CAM_FOR_SIM_MODULE_NAME); + put_module(B_CAM_FOR_SIM_MODULE_NAME); } else { atomic_add(&load_count, 1); }*/ @@ -971,12 +971,12 @@ static status_t std_ops(int32 op, ...) } /** - * \fn: + * \fn: * \param : * \return: * TODO */ -static float +static float supports_device(device_node_handle parent, bool *_noConnection) { TRACE_ALWAYS("supports_device\n"); @@ -984,7 +984,7 @@ supports_device(device_node_handle parent, bool *_noConnection) } /** - * \fn: + * \fn: * \param : * \return: * TODO @@ -997,7 +997,7 @@ register_device(device_node_handle parent) } /** - * \fn: + * \fn: * \param : * \return: * TODO @@ -1010,7 +1010,7 @@ init_module(device_node_handle node, void *user_cookie, void **_cookie) } /** - * \fn: + * \fn: * \param : * \return: * TODO @@ -1023,7 +1023,7 @@ uninit_module(void *cookie) } /** - * \fn: + * \fn: * \param : * TODO */ @@ -1034,7 +1034,7 @@ device_removed(device_node_handle node, void *cookie) } /** - * \fn: + * \fn: * \param : * TODO */ @@ -1045,7 +1045,7 @@ device_cleanup(device_node_handle node) } /** - * \fn: + * \fn: * \param : * TODO */ @@ -1056,7 +1056,7 @@ get_supported_paths(const char ***_busses, const char ***_devices) } /** - * \fn: + * \fn: * \param : * TODO */ @@ -1067,7 +1067,7 @@ scsi_io( scsi_sim_cookie cookie, scsi_ccb *ccb ) } /** - * \fn: + * \fn: * \param : * \return: * TODO @@ -1080,7 +1080,7 @@ abort( scsi_sim_cookie cookie, scsi_ccb *ccb_to_abort ) } /** - * \fn: + * \fn: * \param : * \return: * TODO @@ -1093,7 +1093,7 @@ reset_device( scsi_sim_cookie cookie, uchar target_id, uchar target_lun ) } /** - * \fn: + * \fn: * \param : * \return: * TODO @@ -1106,7 +1106,7 @@ term_io( scsi_sim_cookie cookie, scsi_ccb *ccb_to_terminate ) } /** - * \fn: + * \fn: * \param : * \return: * TODO @@ -1119,7 +1119,7 @@ path_inquiry( scsi_sim_cookie cookie, scsi_path_inquiry *inquiry_data ) } /** - * \fn: + * \fn: * \param : * \return: * TODO @@ -1132,7 +1132,7 @@ scan_bus( scsi_sim_cookie cookie ) } /** - * \fn: + * \fn: * \param : * \return: * TODO @@ -1145,7 +1145,7 @@ reset_bus( scsi_sim_cookie cookie ) } /** - * \fn: + * \fn: * \param : * TODO */ @@ -1156,7 +1156,7 @@ get_restrictions(scsi_sim_cookie cookie, uchar target_id, bool *is_atapi, bool * } /** - * \fn: + * \fn: * \param : * \return: * TODO @@ -1173,41 +1173,41 @@ module_ioctl(scsi_sim_cookie cookie, uint8 targetID, uint32 op, void *buffer, si Declare our module_info so we can be loaded as a kernel module */ static scsi_sim_interface usb_scsi_sim = { - { //driver_module_info + { //driver_module_info { // module_info "busses/scsi/usb/device_v1", // is device_v1 really required? or v1 is enough? - 0, + 0, &std_ops }, - + supports_device, register_device, - init_module, // init_driver, + init_module, // init_driver, uninit_module, // uninit_driver, - + device_removed, device_cleanup, get_supported_paths, }, - + scsi_io, abort, reset_device, term_io, - + path_inquiry, scan_bus, reset_bus, - + get_restrictions, - - module_ioctl //ioctl + + module_ioctl //ioctl }; /** - Export module_info-s list + Export module_info-s list */ _EXPORT module_info *modules[] = { (module_info *) &usb_scsi_sim, diff --git a/src/add-ons/kernel/busses/scsi/usb/usb_scsi.h b/src/add-ons/kernel/busses/scsi/usb/usb_scsi.h index 4bef6bafcf..e86ff3f258 100644 --- a/src/add-ons/kernel/busses/scsi/usb/usb_scsi.h +++ b/src/add-ons/kernel/busses/scsi/usb/usb_scsi.h @@ -1,16 +1,16 @@ /** * * TODO: description - * - * This file is a part of USB SCSI CAM for Haiku OS. + * + * This file is a part of USB SCSI CAM for Haiku. * May be used under terms of the MIT License * * Author(s): * Siarzhuk Zharski - * - * + * + * */ -#ifndef _USB_SCSI_H_ +#ifndef _USB_SCSI_H_ #define _USB_SCSI_H_ #ifndef _OS_H @@ -26,7 +26,7 @@ #endif /*_CAM_H*/ #define MODULE_NAME "usb_scsi" - + #define CONTROLLER_SCSI_BUS 0x00 /* Narrow SCSI bus. Use PI_* to alter this*/ #define MAX_DEVICES_COUNT 0x07 /* simulate Narrow SCSI bus - 8 devices*/ #define CONTROLLER_SCSI_ID 0x07 /* "controller" SCSI ID */ @@ -42,7 +42,7 @@ #define PROTO_MASK 0x0000000f #define PROTO(__value) ((__value) & PROTO_MASK) - + /* command set definitions - are not bitmasks */ #define CMDSET_NONE 0x00000000 #define CMDSET_SCSI 0x00000010 @@ -59,7 +59,7 @@ #define HAS_SET(__mask, __flag) \ (((__mask) & __flag) == (__flag)) -/* fixes - bitmasked */ +/* fixes - bitmasked */ #define FIX_NO_GETMAXLUN 0x00000100 #define FIX_FORCE_RW_TO_6 0x00000200 #define FIX_NO_TEST_UNIT 0x00000400 diff --git a/src/add-ons/kernel/drivers/audio/ice1712/multi.c b/src/add-ons/kernel/drivers/audio/ice1712/multi.c index 9867e9bc1d..745315f89b 100644 --- a/src/add-ons/kernel/drivers/audio/ice1712/multi.c +++ b/src/add-ons/kernel/drivers/audio/ice1712/multi.c @@ -145,7 +145,7 @@ ice1712_get_description(ice1712 *card, multi_description *data) break; } - strncpy(data->vendor_info, "Haiku OS", 32); + strncpy(data->vendor_info, "Haiku", 32); data->output_channel_count = card->total_output_channels; data->input_channel_count = card->total_input_channels; diff --git a/src/add-ons/kernel/drivers/random/driver.cpp b/src/add-ons/kernel/drivers/random/driver.cpp index a5853e4506..194702e97c 100644 --- a/src/add-ons/kernel/drivers/random/driver.cpp +++ b/src/add-ons/kernel/drivers/random/driver.cpp @@ -189,6 +189,8 @@ reseed(ch_randgen *prandgen, const uint32 initTimes) { volatile uint32 i, j; OCTET x, y; + + x.Q[0] = 0; for (j = initTimes; j; j--) { for (i = NK * initTimes; i; i--) { @@ -402,7 +404,7 @@ random_read(void *cookie, off_t position, void *_buffer, size_t *_numBytes) int32 *buffer = (int32 *)_buffer; uint8 *buffer8 = (uint8 *)_buffer; uint32 i, j; - TRACE((DRIVER_NAME ": read(%Ld,, %d)\n", position, *_numBytes)); + TRACE((DRIVER_NAME ": read(%Ld,, %ld)\n", position, *_numBytes)); mutex_lock(&sRandomLock); sRandomCount += *_numBytes; @@ -430,16 +432,22 @@ random_read(void *cookie, off_t position, void *_buffer, size_t *_numBytes) static status_t random_write(void *cookie, off_t position, const void *buffer, size_t *_numBytes) { - TRACE((DRIVER_NAME ": write(%Ld,, %d)\n", position, *_numBytes)); - *_numBytes = 0; - return EINVAL; + TRACE((DRIVER_NAME ": write(%Ld,, %ld)\n", position, *_numBytes)); + mutex_lock(&sRandomLock); + OCTET* data = (OCTET*)buffer; + for (size_t i = 0; i < *_numBytes / sizeof(OCTET); i++) { + chseed(sRandomEnv, data->Q[0]); + data++; + } + mutex_unlock(&sRandomLock); + return B_OK; } static status_t random_control(void *cookie, uint32 op, void *arg, size_t length) { - TRACE((DRIVER_NAME ": ioctl(%d)\n", op)); + TRACE((DRIVER_NAME ": ioctl(%ld)\n", op)); return B_ERROR; } @@ -473,10 +481,13 @@ random_select(void *cookie, uint8 event, uint32 ref, selectsync *sync) notify_select_event(sync, event); #endif } else if (event == B_SELECT_WRITE) { - /* we're not writable */ - return EINVAL; + /* we're now writable */ +#ifndef HAIKU_TARGET_PLATFORM_HAIKU + notify_select_event(sync, ref); +#else + notify_select_event(sync, event); +#endif } - return B_OK; } diff --git a/src/add-ons/kernel/network/protocols/ipv6/ipv6.cpp b/src/add-ons/kernel/network/protocols/ipv6/ipv6.cpp index 0a5120fb96..76a5ec5dec 100644 --- a/src/add-ons/kernel/network/protocols/ipv6/ipv6.cpp +++ b/src/add-ons/kernel/network/protocols/ipv6/ipv6.cpp @@ -501,7 +501,7 @@ size_t MulticastStateHash::HashKey(const KeyType &key) const { size_t result = 0; - result = jenkins_hashword((const uint32*)&key.first, + result = jenkins_hashword((const uint32*)key.first, sizeof(in6_addr) / sizeof(uint32), result); result = jenkins_hashword(&key.second, 1, result); return result; diff --git a/src/add-ons/kernel/network/protocols/ipv6/multicast.h b/src/add-ons/kernel/network/protocols/ipv6/multicast.h index 9b3915da5d..4583d205a6 100644 --- a/src/add-ons/kernel/network/protocols/ipv6/multicast.h +++ b/src/add-ons/kernel/network/protocols/ipv6/multicast.h @@ -172,7 +172,7 @@ public: size_t HashKey(const KeyType &key) const { size_t result = 0; - result = jenkins_hashword((const uint32*)&key.first, + result = jenkins_hashword((const uint32*)key.first, sizeof(in6_addr) / sizeof(uint32), result); result = jenkins_hashword(&key.second, 1, result); return result; diff --git a/src/add-ons/kernel/partitioning_systems/Jamfile b/src/add-ons/kernel/partitioning_systems/Jamfile index 353620fac0..77c050c83e 100644 --- a/src/add-ons/kernel/partitioning_systems/Jamfile +++ b/src/add-ons/kernel/partitioning_systems/Jamfile @@ -3,7 +3,7 @@ SubDir HAIKU_TOP src add-ons kernel partitioning_systems ; HaikuSubInclude amiga ; HaikuSubInclude apple ; HaikuSubInclude atari ; -HaikuSubInclude efi ; +HaikuSubInclude gpt ; HaikuSubInclude intel ; HaikuSubInclude session ; HaikuSubInclude vmdk ; diff --git a/src/add-ons/kernel/partitioning_systems/gpt/Header.cpp b/src/add-ons/kernel/partitioning_systems/gpt/Header.cpp new file mode 100644 index 0000000000..289f926ada --- /dev/null +++ b/src/add-ons/kernel/partitioning_systems/gpt/Header.cpp @@ -0,0 +1,393 @@ +/* + * Copyright 2007-2013, Axel Dörfler, axeld@pinc-software.de. + * Copyright 2009, Michael Lotz, mmlr@mlotz.ch. All rights reserved. + * + * Distributed under the terms of the MIT License. + */ + + +#include "Header.h" + +#include +#include +#include + +#include + +#ifdef _KERNEL_MODE +# include +#else +# include +#endif + +#include "crc32.h" +#include "utility.h" + + +#define TRACE_EFI_GPT +#ifdef TRACE_EFI_GPT +# ifndef _KERNEL_MODE +# define dprintf printf +# endif +# define TRACE(x) dprintf x +#else +# define TRACE(x) ; +#endif + + +namespace EFI { + + +Header::Header(int fd, uint64 lastBlock, uint32 blockSize) + : + fBlockSize(blockSize), + fStatus(B_NO_INIT), + fEntries(NULL) +{ + // TODO: check the correctness of the protective MBR and warn if invalid + + // Read and check the partition table header + + fStatus = _Read(fd, (uint64)EFI_HEADER_LOCATION * blockSize, + &fHeader, sizeof(efi_table_header)); + if (fStatus == B_OK) { + if (!_IsHeaderValid(fHeader, EFI_HEADER_LOCATION)) + fStatus = B_BAD_DATA; + } + + if (fStatus == B_OK && lastBlock != fHeader.AlternateBlock()) { + dprintf("gpt: alternate header not in last block (%" B_PRIu64 " vs. %" + B_PRIu64 ")\n", fHeader.AlternateBlock(), lastBlock); + lastBlock = fHeader.AlternateBlock(); + } + + // Read backup header, too + status_t status = _Read(fd, lastBlock * blockSize, &fBackupHeader, + sizeof(efi_table_header)); + if (status == B_OK) { + if (!_IsHeaderValid(fBackupHeader, lastBlock)) + status = B_BAD_DATA; + } + + // If both headers are invalid, bail out -- this is probably not a GPT disk + if (status != B_OK && fStatus != B_OK) + return; + + if (fStatus != B_OK) { + // Recreate primary header from the backup + fHeader = fBackupHeader; + fHeader.SetAbsoluteBlock(EFI_HEADER_LOCATION); + fHeader.SetEntriesBlock(EFI_PARTITION_ENTRIES_BLOCK); + fHeader.SetAlternateBlock(lastBlock); + } else if (status != B_OK) { + // Recreate backup header from primary + _SetBackupHeaderFromPrimary(lastBlock); + } + + // allocate, read, and check partition entry array + + fEntries = new (std::nothrow) uint8[_EntryArraySize()]; + if (fEntries == NULL) { + // TODO: if there cannot be allocated enough (ie. the boot loader's + // heap is limited), try a smaller size before failing + fStatus = B_NO_MEMORY; + return; + } + + fStatus = _Read(fd, fHeader.EntriesBlock() * blockSize, + fEntries, _EntryArraySize()); + if (fStatus != B_OK || !_ValidateEntriesCRC()) { + // Read backup entries instead + fStatus = _Read(fd, fBackupHeader.EntriesBlock() * blockSize, + fEntries, _EntryArraySize()); + if (fStatus != B_OK) + return; + + if (!_ValidateEntriesCRC()) { + fStatus = B_BAD_DATA; + return; + } + } + + // TODO: check overlapping or out of range partitions + +#ifdef TRACE_EFI_GPT + _Dump(fHeader); + _Dump(fBackupHeader); + _DumpPartitions(); +#endif + + fStatus = B_OK; +} + + +#ifndef _BOOT_MODE +Header::Header(uint64 lastBlock, uint32 blockSize) + : + fBlockSize(blockSize), + fStatus(B_NO_INIT), + fEntries(NULL) +{ + TRACE(("EFI::Header: Initialize GPT, block size %" B_PRIu32 "\n", + blockSize)); + + // Initialize to an empty header + memcpy(fHeader.header, EFI_PARTITION_HEADER, sizeof(fHeader.header)); + fHeader.SetRevision(EFI_TABLE_REVISION); + fHeader.SetHeaderSize(sizeof(fHeader)); + fHeader.SetHeaderCRC(0); + fHeader.SetAbsoluteBlock(EFI_HEADER_LOCATION); + fHeader.SetAlternateBlock(0); // TODO + // TODO: set disk guid + fHeader.SetEntriesBlock(EFI_PARTITION_ENTRIES_BLOCK); + fHeader.SetEntryCount(EFI_PARTITION_ENTRY_COUNT); + fHeader.SetEntrySize(EFI_PARTITION_ENTRY_SIZE); + fHeader.SetEntriesCRC(0); + + size_t arraySize = _EntryArraySize(); + fEntries = new (std::nothrow) uint8[arraySize]; + if (fEntries == NULL) { + fStatus = B_NO_MEMORY; + return; + } + + memset(fEntries, 0, arraySize); + // TODO: initialize the entry guids + + uint32 entryBlocks = (arraySize + fBlockSize - 1) / fBlockSize; + fHeader.SetFirstUsableBlock(EFI_PARTITION_ENTRIES_BLOCK + entryBlocks); + fHeader.SetLastUsableBlock(lastBlock - 1 - entryBlocks); + + _SetBackupHeaderFromPrimary(lastBlock); + +#ifdef TRACE_EFI_GPT + _Dump(fHeader); + _DumpPartitions(); +#endif + + fStatus = B_OK; +} +#endif // !_BOOT_MODE + + +Header::~Header() +{ + delete[] fEntries; +} + + +status_t +Header::InitCheck() const +{ + return fStatus; +} + + +#ifndef _BOOT_MODE +status_t +Header::WriteEntry(int fd, uint32 entryIndex) +{ + // Determine block to write + off_t blockOffset = + + entryIndex * fHeader.EntrySize() / fBlockSize; + uint32 entryOffset = entryIndex * fHeader.EntrySize() % fBlockSize; + + status_t status = _Write(fd, + (fHeader.EntriesBlock() + blockOffset) * fBlockSize, + fEntries + entryOffset, fBlockSize); + if (status != B_OK) + return status; + + // Update header, too -- the entries CRC changed + status = _WriteHeader(fd); + + // Write backup + status_t backupStatus = _Write(fd, + (fBackupHeader.EntriesBlock() + blockOffset) * fBlockSize, + fEntries + entryOffset, fBlockSize); + + return status == B_OK ? backupStatus : status; +} + + +status_t +Header::Write(int fd) +{ + status_t status = _Write(fd, fHeader.EntriesBlock() * fBlockSize, fEntries, + _EntryArraySize()); + if (status != B_OK) + return status; + + // First write the header, so that we have at least one completely correct + // data set + status = _WriteHeader(fd); + + // Write backup entries + status_t backupStatus = _Write(fd, + fBackupHeader.EntriesBlock() * fBlockSize, fEntries, _EntryArraySize()); + + return status == B_OK ? backupStatus : status; +} + + +status_t +Header::_WriteHeader(int fd) +{ + _UpdateCRC(); + + status_t status = _Write(fd, fHeader.AbsoluteBlock() * fBlockSize, + &fHeader, sizeof(efi_table_header)); + if (status != B_OK) + return status; + + return _Write(fd, fBackupHeader.AbsoluteBlock() * fBlockSize, + &fBackupHeader, sizeof(efi_table_header)); +} + + +status_t +Header::_Write(int fd, off_t offset, const void* data, size_t size) const +{ + ssize_t bytesWritten = write_pos(fd, offset, data, size); + if (bytesWritten < 0) + return bytesWritten; + if (bytesWritten != (ssize_t)size) + return B_IO_ERROR; + + return B_OK; +} + + +void +Header::_UpdateCRC() +{ + _UpdateCRC(fHeader); + _UpdateCRC(fBackupHeader); +} + + +void +Header::_UpdateCRC(efi_table_header& header) +{ + header.SetEntriesCRC(crc32(fEntries, _EntryArraySize())); + header.SetHeaderCRC(0); + header.SetHeaderCRC(crc32((uint8*)&header, sizeof(efi_table_header))); +} +#endif // !_BOOT_MODE + + +status_t +Header::_Read(int fd, off_t offset, void* data, size_t size) const +{ + ssize_t bytesRead = read_pos(fd, offset, data, size); + if (bytesRead < 0) + return bytesRead; + if (bytesRead != (ssize_t)size) + return B_IO_ERROR; + + return B_OK; +} + + +bool +Header::_IsHeaderValid(const efi_table_header& header, uint64 block) +{ + return !memcmp(fHeader.header, EFI_PARTITION_HEADER, sizeof(fHeader.header)) + && _ValidateHeaderCRC() + && fHeader.AbsoluteBlock() == block; +} + + +bool +Header::_ValidateHeaderCRC() +{ + uint32 originalCRC = fHeader.HeaderCRC(); + fHeader.SetHeaderCRC(0); + + bool matches = originalCRC == crc32((const uint8*)&fHeader, + sizeof(efi_table_header)); + + fHeader.SetHeaderCRC(originalCRC); + return matches; +} + + +bool +Header::_ValidateEntriesCRC() const +{ + return fHeader.EntriesCRC() == crc32(fEntries, _EntryArraySize()); +} + + +void +Header::_SetBackupHeaderFromPrimary(uint64 lastBlock) +{ + fBackupHeader = fHeader; + fBackupHeader.SetAbsoluteBlock(lastBlock); + fBackupHeader.SetEntriesBlock( + lastBlock - _EntryArraySize() / fBlockSize); + fBackupHeader.SetAlternateBlock(1); +} + + +#ifdef TRACE_EFI_GPT +const char * +Header::_PrintGUID(const guid_t &id) +{ + static char guid[48]; + snprintf(guid, sizeof(guid), + "%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", + B_LENDIAN_TO_HOST_INT32(id.data1), B_LENDIAN_TO_HOST_INT16(id.data2), + B_LENDIAN_TO_HOST_INT16(id.data3), id.data4[0], id.data4[1], + id.data4[2], id.data4[3], id.data4[4], id.data4[5], id.data4[6], + id.data4[7]); + return guid; +} + + +void +Header::_Dump(const efi_table_header& header) +{ + dprintf("EFI header: %.8s\n", header.header); + dprintf("EFI revision: %" B_PRIx32 "\n", header.Revision()); + dprintf("header size: %ld\n", header.HeaderSize()); + dprintf("header CRC: %ld\n", header.HeaderCRC()); + dprintf("absolute block: %Ld\n", header.AbsoluteBlock()); + dprintf("alternate block: %Ld\n", header.AlternateBlock()); + dprintf("first usable block: %Ld\n", header.FirstUsableBlock()); + dprintf("last usable block: %Ld\n", header.LastUsableBlock()); + dprintf("disk GUID: %s\n", _PrintGUID(header.disk_guid)); + dprintf("entries block: %Ld\n", header.EntriesBlock()); + dprintf("entry size: %ld\n", header.EntrySize()); + dprintf("entry count: %ld\n", header.EntryCount()); + dprintf("entries CRC: %ld\n", header.EntriesCRC()); +} + + +void +Header::_DumpPartitions() +{ + for (uint32 i = 0; i < EntryCount(); i++) { + const efi_partition_entry &entry = EntryAt(i); + + if (entry.partition_type == kEmptyGUID) + continue; + + dprintf("[%3ld] partition type: %s\n", i, + _PrintGUID(entry.partition_type)); + dprintf(" unique id: %s\n", _PrintGUID(entry.unique_guid)); + dprintf(" start block: %Ld\n", entry.StartBlock()); + dprintf(" end block: %Ld\n", entry.EndBlock()); + dprintf(" size: %g MB\n", (entry.EndBlock() - entry.StartBlock()) + * 512 / 1024.0 / 1024.0); + dprintf(" attributes: %Lx\n", entry.Attributes()); + + char name[64]; + to_utf8(entry.name, EFI_PARTITION_NAME_LENGTH, name, sizeof(name)); + dprintf(" name: %s\n", name); + } +} +#endif // TRACE_EFI_GPT + + +} // namespace EFI diff --git a/src/add-ons/kernel/partitioning_systems/gpt/Header.h b/src/add-ons/kernel/partitioning_systems/gpt/Header.h new file mode 100644 index 0000000000..f6781c642b --- /dev/null +++ b/src/add-ons/kernel/partitioning_systems/gpt/Header.h @@ -0,0 +1,81 @@ +/* + * Copyright 2007-2013, Axel Dörfler, axeld@pinc-software.de. + * Copyright 2009, Michael Lotz, mmlr@mlotz.ch. All rights reserved. + * + * Distributed under the terms of the MIT License. + */ +#ifndef GPT_HEADER_H +#define GPT_HEADER_H + + +#include "efi_gpt.h" + + +namespace EFI { + + +class Header { +public: + Header(int fd, uint64 lastBlock, + uint32 blockSize); +#ifndef _BOOT_MODE + // constructor for empty header + Header(uint64 lastBlock, uint32 blockSize); +#endif + ~Header(); + + status_t InitCheck() const; + + uint64 FirstUsableBlock() const + { return fHeader.FirstUsableBlock(); } + uint64 LastUsableBlock() const + { return fHeader.LastUsableBlock(); } + + uint32 EntryCount() const + { return fHeader.EntryCount(); } + efi_partition_entry& EntryAt(int32 index) const + { return *(efi_partition_entry*)(fEntries + + fHeader.EntrySize() * index); } + +#ifndef _BOOT_MODE + status_t WriteEntry(int fd, uint32 entryIndex); + status_t Write(int fd); +#endif + +private: +#ifndef _BOOT_MODE + status_t _WriteHeader(int fd); + status_t _Write(int fd, off_t offset, const void* data, + size_t size) const; + void _UpdateCRC(); + void _UpdateCRC(efi_table_header& header); +#endif + + status_t _Read(int fd, off_t offset, void* data, + size_t size) const; + bool _IsHeaderValid(const efi_table_header& header, + uint64 block); + bool _ValidateHeaderCRC(); + bool _ValidateEntriesCRC() const; + void _SetBackupHeaderFromPrimary(uint64 lastBlock); + size_t _EntryArraySize() const + { return fHeader.EntrySize() + * fHeader.EntryCount(); } + + const char* _PrintGUID(const guid_t& id); + void _Dump(const efi_table_header& header); + void _DumpPartitions(); + +private: + uint32 fBlockSize; + status_t fStatus; + efi_table_header fHeader; + efi_table_header fBackupHeader; + uint8* fEntries; +}; + + +} // namespace EFI + + +#endif // GPT_HEADER_H diff --git a/src/add-ons/kernel/partitioning_systems/efi/Jamfile b/src/add-ons/kernel/partitioning_systems/gpt/Jamfile similarity index 56% rename from src/add-ons/kernel/partitioning_systems/efi/Jamfile rename to src/add-ons/kernel/partitioning_systems/gpt/Jamfile index 431a677789..3d31aba1b3 100644 --- a/src/add-ons/kernel/partitioning_systems/efi/Jamfile +++ b/src/add-ons/kernel/partitioning_systems/gpt/Jamfile @@ -1,9 +1,12 @@ -SubDir HAIKU_TOP src add-ons kernel partitioning_systems efi ; +SubDir HAIKU_TOP src add-ons kernel partitioning_systems gpt ; UsePrivateHeaders interface kernel storage ; UsePrivateSystemHeaders ; KernelAddon efi_gpt : efi_gpt.cpp + Header.cpp + crc32.cpp + utility.cpp PartitionLocker.cpp ; diff --git a/src/add-ons/kernel/partitioning_systems/efi/PartitionLocker.cpp b/src/add-ons/kernel/partitioning_systems/gpt/PartitionLocker.cpp similarity index 100% rename from src/add-ons/kernel/partitioning_systems/efi/PartitionLocker.cpp rename to src/add-ons/kernel/partitioning_systems/gpt/PartitionLocker.cpp diff --git a/src/add-ons/kernel/partitioning_systems/efi/PartitionLocker.h b/src/add-ons/kernel/partitioning_systems/gpt/PartitionLocker.h similarity index 100% rename from src/add-ons/kernel/partitioning_systems/efi/PartitionLocker.h rename to src/add-ons/kernel/partitioning_systems/gpt/PartitionLocker.h diff --git a/src/add-ons/kernel/partitioning_systems/gpt/crc32.cpp b/src/add-ons/kernel/partitioning_systems/gpt/crc32.cpp new file mode 100644 index 0000000000..3fbf7ec3c0 --- /dev/null +++ b/src/add-ons/kernel/partitioning_systems/gpt/crc32.cpp @@ -0,0 +1,105 @@ +/* + * Copyright 2013, Axel Dörfler, axeld@pinc-software.de. + * Distributed under the terms of the MIT License. + */ + +/* + * COPYRIGHT (C) 1986 Gary S. Brown. You may use this program, or + * code or tables extracted from it, as desired without restriction. + */ + +/* + * First, the polynomial itself and its table of feedback terms. The + * polynomial is + * X^32+X^26+X^23+X^22+X^16+X^12+X^11+X^10+X^8+X^7+X^5+X^4+X^2+X^1+X^0 + * + * Note that we take it "backwards" and put the highest-order term in + * the lowest-order bit. The X^32 term is "implied"; the LSB is the + * X^31 term, etc. The X^0 term (usually shown as "+1") results in + * the MSB being 1 + * + * Note that the usual hardware shift register implementation, which + * is what we're using (we're merely optimizing it by doing eight-bit + * chunks at a time) shifts bits into the lowest-order term. In our + * implementation, that means shifting towards the right. Why do we + * do it this way? Because the calculated CRC must be transmitted in + * order from highest-order term to lowest-order term. UARTs transmit + * characters in order from LSB to MSB. By storing the CRC this way + * we hand it to the UART in the order low-byte to high-byte; the UART + * sends each low-bit to hight-bit; and the result is transmission bit + * by bit from highest- to lowest-order term without requiring any bit + * shuffling on our part. Reception works similarly + * + * The feedback terms table consists of 256, 32-bit entries. Notes + * + * The table can be generated at runtime if desired; code to do so + * is shown later. It might not be obvious, but the feedback + * terms simply represent the results of eight shift/xor opera + * tions for all combinations of data and CRC register values + * + * The values must be right-shifted by eight bits by the "updcrc + * logic; the shift must be unsigned (bring in zeroes). On some + * hardware you could probably optimize the shift in assembler by + * using byte-swap instructions + * polynomial $edb88320 + */ + + +#include "crc32.h" + + +static const uint32 kTab[] = { + 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, + 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, + 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2, + 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, + 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, + 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, + 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c, + 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59, + 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, + 0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, + 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106, + 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433, + 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, + 0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, + 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, + 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65, + 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, + 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, + 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, + 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, + 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, + 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, + 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84, + 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, + 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, + 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, + 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e, + 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b, + 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, + 0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, + 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28, + 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d, + 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f, + 0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, + 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, + 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777, + 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, + 0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, + 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, + 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, + 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, + 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, + 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d +}; + + +uint32 +crc32(const uint8* buffer, size_t size) +{ + uint32 crc = ~0U; + while (size-- != 0) + crc = kTab[(crc ^ *buffer++) & 0xff] ^ (crc >> 8); + return crc ^ ~0U; +} diff --git a/src/add-ons/kernel/partitioning_systems/gpt/crc32.h b/src/add-ons/kernel/partitioning_systems/gpt/crc32.h new file mode 100644 index 0000000000..1509379885 --- /dev/null +++ b/src/add-ons/kernel/partitioning_systems/gpt/crc32.h @@ -0,0 +1,15 @@ +/* + * Copyright 2013, Axel Dörfler, axeld@pinc-software.de. + * Distributed under the terms of the MIT License. + */ +#ifndef CRC32_H +#define CRC32_H + + +#include + + +uint32 crc32(const uint8* buffer, size_t size); + + +#endif // CRC32_H diff --git a/src/add-ons/kernel/partitioning_systems/efi/efi_gpt.cpp b/src/add-ons/kernel/partitioning_systems/gpt/efi_gpt.cpp similarity index 52% rename from src/add-ons/kernel/partitioning_systems/efi/efi_gpt.cpp rename to src/add-ons/kernel/partitioning_systems/gpt/efi_gpt.cpp index 6ab4665971..8dbf7ad741 100644 --- a/src/add-ons/kernel/partitioning_systems/efi/efi_gpt.cpp +++ b/src/add-ons/kernel/partitioning_systems/gpt/efi_gpt.cpp @@ -1,6 +1,6 @@ /* * Copyright 2009, Michael Lotz, mmlr@mlotz.ch. All rights reserved. - * Copyright 2007-2009, Axel Dörfler, axeld@pinc-software.de. + * Copyright 2007-2013, Axel Dörfler, axeld@pinc-software.de. * * Distributed under the terms of the MIT License. */ @@ -16,7 +16,6 @@ #else # include # include "PartitionLocker.h" -# include #endif #include @@ -24,6 +23,9 @@ #include #include +#include "Header.h" +#include "utility.h" + #define TRACE_EFI_GPT #ifdef TRACE_EFI_GPT @@ -36,415 +38,21 @@ #define EFI_PARTITION_MODULE_NAME "partitioning_systems/efi_gpt/v1" -struct static_guid { - uint32 data1; - uint16 data2; - uint16 data3; - uint64 data4; - - inline bool operator==(const guid &other) const; -} _PACKED; - -const static struct type_map { - static_guid guid; - const char *type; -} kTypeMap[] = { - {{0xC12A7328, 0xF81F, 0x11D2, 0xBA4B00A0C93EC93BLL}, "EFI System Data"}, - {{0x21686148, 0x6449, 0x6E6F, 0x744E656564454649LL}, "BIOS Boot Data"}, - {{0x024DEE41, 0x33E7, 0x11D3, 0x9D690008C781F39FLL}, "MBR Partition Nest"}, - {{0x42465331, 0x3BA3, 0x10F1, 0x802A4861696B7521LL}, "Haiku BFS"}, - {{0x0FC63DAF, 0x8483, 0x4772, 0x8E793D69D8477DE4LL}, "Linux File System"}, - {{0xA19D880F, 0x05FC, 0x4D3B, 0xA006743F0F84911ELL}, "Linux RAID"}, - {{0x0657FD6D, 0xA4AB, 0x43C4, 0x84E50933C84B4F4FLL}, "Linux Swap"}, - {{0xE6D6D379, 0xF507, 0x44C2, 0xA23C238F2A3DF928LL}, "Linux LVM"}, - {{0xEBD0A0A2, 0xB9E5, 0x4433, 0x87C068B6B72699C7LL}, "Windows Data"}, - {{0x48465300, 0x0000, 0x11AA, 0xAA1100306543ECACLL}, "HFS+ File System"}, - {{0x55465300, 0x0000, 0x11AA, 0xAA1100306543ECACLL}, "UFS File System"}, - {{0x52414944, 0x0000, 0x11AA, 0xAA1100306543ECACLL}, "Apple RAID"}, - {{0x52414944, 0x5F4F, 0x11AA, 0xAA1100306543ECACLL}, "Apple RAID, offline"} -}; - - -namespace EFI { - -class Header { - public: - Header(int fd, off_t block, uint32 blockSize); #ifndef _BOOT_MODE - // constructor for empty header - Header(off_t block, uint32 blockSize); -#endif - ~Header(); - - status_t InitCheck() const; - bool IsPrimary() const - { return fBlock == EFI_HEADER_LOCATION; } - - uint64 FirstUsableBlock() const - { return fHeader.FirstUsableBlock(); } - uint64 LastUsableBlock() const - { return fHeader.LastUsableBlock(); } - - uint32 EntryCount() const - { return fHeader.EntryCount(); } - efi_partition_entry &EntryAt(int32 index) const - { return *(efi_partition_entry *) - (fEntries + fHeader.EntrySize() * index); } - -#ifndef _BOOT_MODE - status_t WriteEntry(int fd, uint32 entryIndex); - status_t Write(int fd); -#endif - - private: -#ifdef TRACE_EFI_GPT - const char *_PrintGUID(const guid_t &id); - void _Dump(); - void _DumpPartitions(); -#endif - - bool _ValidateCRC(uint8 *data, size_t size) const; - size_t _EntryArraySize() const - { return fHeader.EntrySize() * fHeader.EntryCount(); } - - uint64 fBlock; - uint32 fBlockSize; - status_t fStatus; - efi_table_header fHeader; - uint8 *fEntries; -}; - -} // namespace EFI - - -const static guid_t kEmptyGUID = {0, 0, 0, {0, 0, 0, 0, 0, 0, 0, 0}}; - - -inline bool -static_guid::operator==(const guid_t &other) const -{ - return B_HOST_TO_LENDIAN_INT32(data1) == other.data1 - && B_HOST_TO_LENDIAN_INT16(data2) == other.data2 - && B_HOST_TO_LENDIAN_INT16(data3) == other.data3 - && B_HOST_TO_BENDIAN_INT64(*(uint64 *)&data4) == *(uint64 *)other.data4; - // the last 8 bytes are in big-endian order -} - - -static void -put_utf8_byte(char *&to, size_t &left, char c) -{ - if (left <= 1) - return; - - *(to++) = c; - left--; -} - - -static void -to_utf8(const uint16 *from, size_t maxFromLength, char *to, size_t toSize) -{ - for (uint32 i = 0; i < maxFromLength; i++) { - uint16 c = B_LENDIAN_TO_HOST_INT16(from[i]); - if (!c) - break; - - if (c < 0x80) - put_utf8_byte(to, toSize, c); - else if (c < 0x800) { - put_utf8_byte(to, toSize, 0xc0 | (c >> 6)); - put_utf8_byte(to, toSize, 0x80 | (c & 0x3f)); - } else if (c < 0x10000) { - put_utf8_byte(to, toSize, 0xe0 | (c >> 12)); - put_utf8_byte(to, toSize, 0x80 | ((c >> 6) & 0x3f)); - put_utf8_byte(to, toSize, 0x80 | (c & 0x3f)); - } else if (c <= 0x10ffff) { - put_utf8_byte(to, toSize, 0xf0 | (c >> 18)); - put_utf8_byte(to, toSize, 0x80 | ((c >> 12) & 0x3f)); - put_utf8_byte(to, toSize, 0x80 | ((c >> 6) & 0x3f)); - put_utf8_byte(to, toSize, 0x80 | (c & 0x3f)); - } - } - - if (toSize > 0) - *to = '\0'; -} - - -#ifndef _BOOT_MODE -static void -to_ucs2(const char *from, size_t fromLength, uint16 *to, size_t maxToLength) -{ - size_t index = 0; - while (from[0] && index < maxToLength) { - // TODO: handle characters that are not representable in UCS-2 better - uint32 code = UTF8ToCharCode(&from); - if (code < 0x10000) - to[index++] = code; - } - - if (index < maxToLength) - to[index] = '\0'; -} -#endif // !_BOOT_MODE - - -static const char * -get_partition_type(const guid_t &guid) -{ - for (uint32 i = 0; i < sizeof(kTypeMap) / sizeof(kTypeMap[0]); i++) { - if (kTypeMap[i].guid == guid) - return kTypeMap[i].type; - } - - return NULL; -} - - -#ifndef _BOOT_MODE -static const static_guid * -guid_for_partition_type(const char *type) -{ - for (uint32 i = 0; i < sizeof(kTypeMap) / sizeof(kTypeMap[0]); i++) { - if (strcmp(kTypeMap[i].type, type) == 0) - return &kTypeMap[i].guid; - } - - return NULL; -} - - static off_t -block_align(partition_data *partition, off_t offset, bool upwards) +block_align(partition_data* partition, off_t offset, bool upwards) { - if (upwards) { - return ((offset + partition->block_size - 1) / partition->block_size) - * partition->block_size; - } + // Take HDs into account that hide the fact they are using a + // block size of 4096 bytes, and round to that. + uint32 blockSize = max_c(partition->block_size, 4096); + if (upwards) + return ((offset + blockSize - 1) / blockSize) * blockSize; - return (offset / partition->block_size) * partition->block_size; + return (offset / blockSize) * blockSize; } #endif // !_BOOT_MODE -// #pragma mark - - - -namespace EFI { - -Header::Header(int fd, off_t block, uint32 blockSize) - : - fBlock(block), - fBlockSize(blockSize), - fStatus(B_NO_INIT), - fEntries(NULL) -{ - // TODO: check the correctness of the protective MBR - - // read and check the partition table header - - ssize_t bytesRead = read_pos(fd, block * blockSize, &fHeader, - sizeof(fHeader)); - if (bytesRead != (ssize_t)sizeof(fHeader)) { - if (bytesRead < B_OK) - fStatus = bytesRead; - else - fStatus = B_IO_ERROR; - - return; - } - - if (memcmp(fHeader.header, EFI_PARTITION_HEADER, sizeof(fHeader.header)) - || !_ValidateCRC((uint8 *)&fHeader, sizeof(fHeader)) - || fHeader.AbsoluteBlock() != fBlock) { - // TODO: check that partition counts are in valid bounds - fStatus = B_BAD_DATA; - return; - } - - // allocate, read, and check partition entry array - - fEntries = new (std::nothrow) uint8[_EntryArraySize()]; - if (fEntries == NULL) { - // TODO: if there cannot be allocated enough (ie. the boot loader's - // heap is limited), try a smaller size before failing - fStatus = B_NO_MEMORY; - return; - } - - bytesRead = read_pos(fd, fHeader.EntriesBlock() * blockSize, - fEntries, _EntryArraySize()); - if (bytesRead != (ssize_t)_EntryArraySize()) { - if (bytesRead < B_OK) - fStatus = bytesRead; - else - fStatus = B_IO_ERROR; - - return; - } - - if (!_ValidateCRC(fEntries, _EntryArraySize())) { - // TODO: check overlapping or out of range partitions - fStatus = B_BAD_DATA; - return; - } - -#ifdef TRACE_EFI_GPT - _Dump(); - _DumpPartitions(); -#endif - - fStatus = B_OK; -} - - -#ifndef _BOOT_MODE -Header::Header(off_t block, uint32 blockSize) - : - fBlock(block), - fBlockSize(blockSize), - fStatus(B_NO_INIT), - fEntries(NULL) -{ - // initialize to an empty header - memcpy(fHeader.header, EFI_PARTITION_HEADER, sizeof(fHeader.header)); - fHeader.SetRevision(EFI_TABLE_REVISION); - fHeader.SetHeaderSize(sizeof(fHeader)); - fHeader.SetHeaderCRC(0); - fHeader.SetAbsoluteBlock(fBlock); - fHeader.SetAlternateBlock(0); // TODO - // TODO: set disk guid - fHeader.SetEntriesBlock(EFI_PARTITION_ENTRIES_BLOCK); - fHeader.SetEntryCount(EFI_PARTITION_ENTRY_COUNT); - fHeader.SetEntrySize(EFI_PARTITION_ENTRY_SIZE); - fHeader.SetEntriesCRC(0); - - size_t arraySize = _EntryArraySize(); - fEntries = new (std::nothrow) uint8[arraySize]; - if (fEntries == NULL) { - fStatus = B_NO_MEMORY; - return; - } - - memset(fEntries, 0, arraySize); - // TODO: initialize the entry guids - - fHeader.SetFirstUsableBlock(EFI_PARTITION_ENTRIES_BLOCK - + (arraySize + fBlockSize - 1) / fBlockSize); - fHeader.SetLastUsableBlock(0); // TODO - -#ifdef TRACE_EFI_GPT - _Dump(); - _DumpPartitions(); -#endif - - fStatus = B_OK; -} -#endif // !_BOOT_MODE - - -Header::~Header() -{ - delete[] fEntries; -} - - -status_t -Header::InitCheck() const -{ - return fStatus; -} - - -#ifndef _BOOT_MODE -status_t -Header::WriteEntry(int fd, uint32 entryIndex) -{ - // TODO: implement - return B_ERROR; -} - - -status_t -Header::Write(int fd) -{ - // TODO: implement - return B_ERROR; -} -#endif // !_BOOT_MODE - - -bool -Header::_ValidateCRC(uint8 *data, size_t size) const -{ - // TODO: implement! - return true; -} - - -#ifdef TRACE_EFI_GPT -const char * -Header::_PrintGUID(const guid_t &id) -{ - static char guid[48]; - snprintf(guid, sizeof(guid), - "%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", - B_LENDIAN_TO_HOST_INT32(id.data1), B_LENDIAN_TO_HOST_INT16(id.data2), - B_LENDIAN_TO_HOST_INT16(id.data3), id.data4[0], id.data4[1], - id.data4[2], id.data4[3], id.data4[4], id.data4[5], id.data4[6], - id.data4[7]); - return guid; -} - - -void -Header::_Dump() -{ - dprintf("EFI header: %.8s\n", fHeader.header); - dprintf("EFI revision: %ld\n", fHeader.Revision()); - dprintf("header size: %ld\n", fHeader.HeaderSize()); - dprintf("header CRC: %ld\n", fHeader.HeaderCRC()); - dprintf("absolute block: %Ld\n", fHeader.AbsoluteBlock()); - dprintf("alternate block: %Ld\n", fHeader.AlternateBlock()); - dprintf("first usable block: %Ld\n", fHeader.FirstUsableBlock()); - dprintf("last usable block: %Ld\n", fHeader.LastUsableBlock()); - dprintf("disk GUID: %s\n", _PrintGUID(fHeader.disk_guid)); - dprintf("entries block: %Ld\n", fHeader.EntriesBlock()); - dprintf("entry size: %ld\n", fHeader.EntrySize()); - dprintf("entry count: %ld\n", fHeader.EntryCount()); - dprintf("entries CRC: %ld\n", fHeader.EntriesCRC()); -} - - -void -Header::_DumpPartitions() -{ - for (uint32 i = 0; i < EntryCount(); i++) { - const efi_partition_entry &entry = EntryAt(i); - - if (entry.partition_type == kEmptyGUID) - continue; - - dprintf("[%3ld] partition type: %s\n", i, - _PrintGUID(entry.partition_type)); - dprintf(" unique id: %s\n", _PrintGUID(entry.unique_guid)); - dprintf(" start block: %Ld\n", entry.StartBlock()); - dprintf(" end block: %Ld\n", entry.EndBlock()); - dprintf(" size: %g MB\n", (entry.EndBlock() - entry.StartBlock()) - * 512 / 1024.0 / 1024.0); - dprintf(" attributes: %Lx\n", entry.Attributes()); - - char name[64]; - to_utf8(entry.name, EFI_PARTITION_NAME_LENGTH, name, sizeof(name)); - dprintf(" name: %s\n", name); - } -} -#endif // TRACE_EFI_GPT - -} // namespace EFI - - // #pragma mark - public module interface @@ -462,12 +70,12 @@ efi_gpt_std_ops(int32 op, ...) static float -efi_gpt_identify_partition(int fd, partition_data *partition, void **_cookie) +efi_gpt_identify_partition(int fd, partition_data* partition, void** _cookie) { - EFI::Header *header = new (std::nothrow) EFI::Header(fd, - EFI_HEADER_LOCATION, partition->block_size); + EFI::Header* header = new (std::nothrow) EFI::Header(fd, + (partition->size - 1) / partition->block_size, partition->block_size); status_t status = header->InitCheck(); - if (status < B_OK) { + if (status != B_OK) { delete header; return -1; } @@ -480,13 +88,13 @@ efi_gpt_identify_partition(int fd, partition_data *partition, void **_cookie) static status_t -efi_gpt_scan_partition(int fd, partition_data *partition, void *_cookie) +efi_gpt_scan_partition(int fd, partition_data* partition, void* _cookie) { TRACE(("efi_gpt_scan_partition(cookie = %p)\n", _cookie)); - EFI::Header *header = (EFI::Header *)_cookie; + EFI::Header* header = (EFI::Header*)_cookie; partition->status = B_PARTITION_VALID; - partition->flags |= B_PARTITION_PARTITIONING_SYSTEM | B_PARTITION_READ_ONLY; + partition->flags |= B_PARTITION_PARTITIONING_SYSTEM; partition->content_size = partition->size; partition->content_cookie = header; @@ -495,20 +103,19 @@ efi_gpt_scan_partition(int fd, partition_data *partition, void *_cookie) uint32 index = 0; for (uint32 i = 0; i < header->EntryCount(); i++) { - const efi_partition_entry &entry = header->EntryAt(i); + const efi_partition_entry& entry = header->EntryAt(i); if (entry.partition_type == kEmptyGUID) continue; if (entry.EndBlock() * partition->block_size > (uint64)partition->size) { - TRACE(("efi_gpt: child partition exceeds existing space (%Ld MB)\n", - (entry.EndBlock() - entry.StartBlock()) * partition->block_size - / 1024 / 1024)); + TRACE(("efi_gpt: child partition exceeds existing space (ends at " + "block %" B_PRIu64 ")\n", entry.EndBlock())); continue; } - partition_data *child = create_child_partition(partition->id, index++, + partition_data* child = create_child_partition(partition->id, index++, partition->offset + entry.StartBlock() * partition->block_size, entry.BlockCount() * partition->block_size, -1); if (child == NULL) { @@ -521,7 +128,7 @@ efi_gpt_scan_partition(int fd, partition_data *partition, void *_cookie) child->name = strdup(name); child->type = strdup(get_partition_type(entry.partition_type)); child->block_size = partition->block_size; - child->cookie = (void *)i; + child->cookie = (void*)i; } return B_OK; @@ -529,22 +136,22 @@ efi_gpt_scan_partition(int fd, partition_data *partition, void *_cookie) static void -efi_gpt_free_identify_partition_cookie(partition_data *partition, void *_cookie) +efi_gpt_free_identify_partition_cookie(partition_data* partition, void* _cookie) { // Cookie is freed in efi_gpt_free_partition_content_cookie(). } static void -efi_gpt_free_partition_content_cookie(partition_data *partition) +efi_gpt_free_partition_content_cookie(partition_data* partition) { - delete (EFI::Header *)partition->content_cookie; + delete (EFI::Header*)partition->content_cookie; } #ifndef _BOOT_MODE static uint32 -efi_gpt_get_supported_operations(partition_data *partition, uint32 mask) +efi_gpt_get_supported_operations(partition_data* partition, uint32 mask) { uint32 flags = B_DISK_SYSTEM_SUPPORTS_INITIALIZING | B_DISK_SYSTEM_SUPPORTS_SETTING_CONTENT_NAME @@ -559,8 +166,8 @@ efi_gpt_get_supported_operations(partition_data *partition, uint32 mask) static uint32 -efi_gpt_get_supported_child_operations(partition_data *partition, - partition_data *child, uint32 mask) +efi_gpt_get_supported_child_operations(partition_data* partition, + partition_data* child, uint32 mask) { return B_DISK_SYSTEM_SUPPORTS_MOVING_CHILD | B_DISK_SYSTEM_SUPPORTS_RESIZING_CHILD @@ -570,7 +177,7 @@ efi_gpt_get_supported_child_operations(partition_data *partition, static bool -efi_gpt_is_sub_system_for(partition_data *partition) +efi_gpt_is_sub_system_for(partition_data* partition) { // a GUID Partition Table doesn't usually live inside another partition return false; @@ -578,7 +185,7 @@ efi_gpt_is_sub_system_for(partition_data *partition) static bool -efi_gpt_validate_resize(partition_data *partition, off_t *size) +efi_gpt_validate_resize(partition_data* partition, off_t* size) { off_t newSize = *size; if (newSize == partition->size) @@ -598,7 +205,7 @@ efi_gpt_validate_resize(partition_data *partition, off_t *size) // shrinking, only so that no child would be truncated off_t newEnd = partition->offset + newSize; for (int32 i = 0; i < partition->child_count; i++) { - partition_data *child = get_child_partition(partition->id, i); + partition_data* child = get_child_partition(partition->id, i); if (child == NULL) continue; @@ -613,8 +220,8 @@ efi_gpt_validate_resize(partition_data *partition, off_t *size) static bool -efi_gpt_validate_resize_child(partition_data *partition, partition_data *child, - off_t *size) +efi_gpt_validate_resize_child(partition_data* partition, partition_data* child, + off_t* size) { off_t newSize = *size; if (newSize == child->size) @@ -637,7 +244,7 @@ efi_gpt_validate_resize_child(partition_data *partition, partition_data *child, // make sure that the child doesn't overlap any sibling partitions off_t newEnd = child->offset + newSize; for (int32 i = 0; i < partition->child_count; i++) { - partition_data *other = get_child_partition(partition->id, i); + partition_data* other = get_child_partition(partition->id, i); if (other == NULL || other->id == child->id || other->offset < child->offset) continue; @@ -652,7 +259,7 @@ efi_gpt_validate_resize_child(partition_data *partition, partition_data *child, static bool -efi_gpt_validate_move(partition_data *partition, off_t *start) +efi_gpt_validate_move(partition_data* partition, off_t* start) { // nothing to do return true; @@ -660,8 +267,8 @@ efi_gpt_validate_move(partition_data *partition, off_t *start) static bool -efi_gpt_validate_move_child(partition_data *partition, partition_data *child, - off_t *start) +efi_gpt_validate_move_child(partition_data* partition, partition_data* child, + off_t* start) { off_t newStart = *start; if (newStart < 0) @@ -673,7 +280,7 @@ efi_gpt_validate_move_child(partition_data *partition, partition_data *child, newStart = block_align(partition, newStart, false); if (newStart > child->offset) { for (int32 i = 0; i < partition->child_count; i++) { - partition_data *other = get_child_partition(partition->id, i); + partition_data* other = get_child_partition(partition->id, i); if (other == NULL || other->id == child->id || other->offset < child->offset) continue; @@ -685,7 +292,7 @@ efi_gpt_validate_move_child(partition_data *partition, partition_data *child, newStart = block_align(partition, newStart, false); } else { for (int32 i = 0; i < partition->child_count; i++) { - partition_data *other = get_child_partition(partition->id, i); + partition_data* other = get_child_partition(partition->id, i); if (other == NULL || other->id == child->id || other->offset > child->offset) continue; @@ -703,7 +310,7 @@ efi_gpt_validate_move_child(partition_data *partition, partition_data *child, static bool -efi_gpt_validate_set_content_name(partition_data *partition, char *name) +efi_gpt_validate_set_content_name(partition_data* partition, char* name) { // TODO: should validate that the utf-8 -> ucs-2 is valid // TODO: should count actual utf-8 chars @@ -714,15 +321,16 @@ efi_gpt_validate_set_content_name(partition_data *partition, char *name) static bool -efi_gpt_validate_set_type(partition_data *partition, const char *type) +efi_gpt_validate_set_type(partition_data* partition, const char* type) { - return guid_for_partition_type(type) != NULL; + guid_t typeGUID; + return get_guid_for_partition_type(type, typeGUID); } static bool -efi_gpt_validate_initialize(partition_data *partition, char *name, - const char *parameters) +efi_gpt_validate_initialize(partition_data* partition, char* name, + const char* parameters) { if ((efi_gpt_get_supported_operations(partition, ~0) & B_DISK_SYSTEM_SUPPORTS_INITIALIZING) == 0) @@ -737,21 +345,21 @@ efi_gpt_validate_initialize(partition_data *partition, char *name, static bool -efi_gpt_validate_create_child(partition_data *partition, off_t *start, - off_t *size, const char *type, const char *name, const char *parameters, - int32 *index) +efi_gpt_validate_create_child(partition_data* partition, off_t* start, + off_t* size, const char* type, const char* name, const char* parameters, + int32* index) { if ((efi_gpt_get_supported_operations(partition, ~0) & B_DISK_SYSTEM_SUPPORTS_CREATING_CHILD) == 0) return false; - if (guid_for_partition_type(type) == NULL) + if (!efi_gpt_validate_set_type(partition, type)) return false; - EFI::Header *header = (EFI::Header *)partition->content_cookie; + EFI::Header* header = (EFI::Header*)partition->content_cookie; int32 entryIndex = -1; for (uint32 i = 0; i < header->EntryCount(); i++) { - const efi_partition_entry &entry = header->EntryAt(i); + const efi_partition_entry& entry = header->EntryAt(i); if (entry.partition_type == kEmptyGUID) { entryIndex = i; break; @@ -778,7 +386,7 @@ efi_gpt_validate_create_child(partition_data *partition, off_t *start, // ensure that we don't overlap any siblings for (int32 i = 0; i < partition->child_count; i++) { - partition_data *other = get_child_partition(partition->id, i); + partition_data* other = get_child_partition(partition->id, i); if (other == NULL) continue; @@ -789,7 +397,7 @@ efi_gpt_validate_create_child(partition_data *partition, off_t *start, *size = other->offset - *start; } - *start = block_align(partition, *size, true); + *start = block_align(partition, *start, true); *size = block_align(partition, *size, false); // TODO: support parameters @@ -798,8 +406,8 @@ efi_gpt_validate_create_child(partition_data *partition, off_t *start, static status_t -efi_gpt_get_partitionable_spaces(partition_data *partition, - partitionable_space_data *buffer, int32 count, int32 *actualCount) +efi_gpt_get_partitionable_spaces(partition_data* partition, + partitionable_space_data* buffer, int32 count, int32* actualCount) { // TODO: implement return B_ERROR; @@ -807,8 +415,8 @@ efi_gpt_get_partitionable_spaces(partition_data *partition, static status_t -efi_gpt_get_next_supported_type(partition_data *partition, int32 *cookie, - char *type) +efi_gpt_get_next_supported_type(partition_data* partition, int32* cookie, + char* type) { // TODO: implement return B_ERROR; @@ -816,7 +424,7 @@ efi_gpt_get_next_supported_type(partition_data *partition, int32 *cookie, static status_t -efi_gpt_shadow_changed(partition_data *partition, partition_data *child, +efi_gpt_shadow_changed(partition_data* partition, partition_data* child, uint32 operation) { // TODO: implement @@ -842,7 +450,7 @@ efi_gpt_resize(int fd, partition_id partitionID, off_t size, disk_job_id job) if (!locker.IsLocked()) return B_ERROR; - partition_data *partition = get_partition(partitionID); + partition_data* partition = get_partition(partitionID); if (partition == NULL) return B_BAD_VALUE; @@ -872,15 +480,15 @@ efi_gpt_resize_child(int fd, partition_id partitionID, off_t size, if (!locker.IsLocked()) return B_ERROR; - partition_data *child = get_partition(partitionID); + partition_data* child = get_partition(partitionID); if (child == NULL) return B_BAD_VALUE; - partition_data *partition = get_parent_partition(partitionID); + partition_data* partition = get_parent_partition(partitionID); if (partition == NULL) return B_BAD_VALUE; - EFI::Header *header = (EFI::Header *)partition->content_cookie; + EFI::Header* header = (EFI::Header*)partition->content_cookie; if (header == NULL) return B_BAD_VALUE; @@ -897,7 +505,7 @@ efi_gpt_resize_child(int fd, partition_id partitionID, off_t size, update_disk_device_job_progress(job, 0.0); - efi_partition_entry &entry = header->EntryAt(entryIndex); + efi_partition_entry& entry = header->EntryAt(entryIndex); entry.SetBlockCount(validatedSize / partition->block_size); status_t result = header->WriteEntry(fd, entryIndex); @@ -933,15 +541,15 @@ efi_gpt_move_child(int fd, partition_id partitionID, partition_id childID, if (!locker.IsLocked()) return B_ERROR; - partition_data *partition = get_partition(partitionID); + partition_data* partition = get_partition(partitionID); if (partition == NULL) return B_BAD_VALUE; - partition_data *child = get_partition(childID); + partition_data* child = get_partition(childID); if (child == NULL) return B_BAD_VALUE; - EFI::Header *header = (EFI::Header *)partition->content_cookie; + EFI::Header* header = (EFI::Header*)partition->content_cookie; if (header == NULL) return B_BAD_VALUE; @@ -962,7 +570,7 @@ efi_gpt_move_child(int fd, partition_id partitionID, partition_id childID, update_disk_device_job_progress(job, 0.0); - efi_partition_entry &entry = header->EntryAt(entryIndex); + efi_partition_entry& entry = header->EntryAt(entryIndex); uint64 blockCount = entry.BlockCount(); entry.SetStartBlock((validatedOffset - partition->offset) / partition->block_size); @@ -984,7 +592,7 @@ efi_gpt_move_child(int fd, partition_id partitionID, partition_id childID, static status_t -efi_gpt_set_content_name(int fd, partition_id partitionID, const char *name, +efi_gpt_set_content_name(int fd, partition_id partitionID, const char* name, disk_job_id job) { if (fd < 0) @@ -994,15 +602,15 @@ efi_gpt_set_content_name(int fd, partition_id partitionID, const char *name, if (!locker.IsLocked()) return B_ERROR; - partition_data *child = get_partition(partitionID); + partition_data* child = get_partition(partitionID); if (child == NULL) return B_BAD_VALUE; - partition_data *partition = get_parent_partition(partitionID); + partition_data* partition = get_parent_partition(partitionID); if (partition == NULL) return B_BAD_VALUE; - EFI::Header *header = (EFI::Header *)partition->content_cookie; + EFI::Header* header = (EFI::Header*)partition->content_cookie; if (header == NULL) return B_BAD_VALUE; @@ -1012,7 +620,7 @@ efi_gpt_set_content_name(int fd, partition_id partitionID, const char *name, update_disk_device_job_progress(job, 0.0); - efi_partition_entry &entry = header->EntryAt(entryIndex); + efi_partition_entry& entry = header->EntryAt(entryIndex); to_ucs2(name, strlen(name), entry.name, EFI_PARTITION_NAME_LENGTH); status_t result = header->WriteEntry(fd, entryIndex); @@ -1030,7 +638,7 @@ efi_gpt_set_content_name(int fd, partition_id partitionID, const char *name, static status_t -efi_gpt_set_type(int fd, partition_id partitionID, const char *type, +efi_gpt_set_type(int fd, partition_id partitionID, const char* type, disk_job_id job) { if (fd < 0) @@ -1040,15 +648,15 @@ efi_gpt_set_type(int fd, partition_id partitionID, const char *type, if (!locker.IsLocked()) return B_ERROR; - partition_data *child = get_partition(partitionID); + partition_data* child = get_partition(partitionID); if (child == NULL) return B_BAD_VALUE; - partition_data *partition = get_parent_partition(partitionID); + partition_data* partition = get_parent_partition(partitionID); if (partition == NULL) return B_BAD_VALUE; - EFI::Header *header = (EFI::Header *)partition->content_cookie; + EFI::Header* header = (EFI::Header*)partition->content_cookie; if (header == NULL) return B_BAD_VALUE; @@ -1056,14 +664,14 @@ efi_gpt_set_type(int fd, partition_id partitionID, const char *type, if (entryIndex >= header->EntryCount()) return B_BAD_VALUE; - const static_guid *newType = guid_for_partition_type(type); - if (newType == NULL) + guid_t typeGUID; + if (!get_guid_for_partition_type(type, typeGUID)) return B_BAD_VALUE; update_disk_device_job_progress(job, 0.0); - efi_partition_entry &entry = header->EntryAt(entryIndex); - memcpy(&entry.partition_type, newType, sizeof(entry.partition_type)); + efi_partition_entry& entry = header->EntryAt(entryIndex); + entry.partition_type = typeGUID; status_t result = header->WriteEntry(fd, entryIndex); if (result != B_OK) @@ -1078,19 +686,20 @@ efi_gpt_set_type(int fd, partition_id partitionID, const char *type, static status_t -efi_gpt_initialize(int fd, partition_id partitionID, const char *name, - const char *parameters, off_t partitionSize, disk_job_id job) +efi_gpt_initialize(int fd, partition_id partitionID, const char* name, + const char* parameters, off_t partitionSize, disk_job_id job) { if (fd < 0) return B_ERROR; - partition_data *partition = get_partition(partitionID); + partition_data* partition = get_partition(partitionID); if (partition == NULL) return B_BAD_VALUE; update_disk_device_job_progress(job, 0.0); - EFI::Header header(EFI_HEADER_LOCATION, partition->block_size); + EFI::Header header((partitionSize - 1) / partition->block_size, + partition->block_size); status_t result = header.InitCheck(); if (result != B_OK) return result; @@ -1111,8 +720,8 @@ efi_gpt_initialize(int fd, partition_id partitionID, const char *name, static status_t efi_gpt_create_child(int fd, partition_id partitionID, off_t offset, - off_t size, const char *type, const char *name, const char *parameters, - disk_job_id job, partition_id *childID) + off_t size, const char* type, const char* name, const char* parameters, + disk_job_id job, partition_id* childID) { if (fd < 0) return B_ERROR; @@ -1121,11 +730,11 @@ efi_gpt_create_child(int fd, partition_id partitionID, off_t offset, if (!locker.IsLocked()) return B_ERROR; - partition_data *partition = get_partition(partitionID); + partition_data* partition = get_partition(partitionID); if (partition == NULL) return B_BAD_VALUE; - EFI::Header *header = (EFI::Header *)partition->content_cookie; + EFI::Header* header = (EFI::Header*)partition->content_cookie; if (header == NULL) return B_BAD_VALUE; @@ -1134,22 +743,23 @@ efi_gpt_create_child(int fd, partition_id partitionID, off_t offset, uint32 entryIndex = 0; if (!efi_gpt_validate_create_child(partition, &validatedOffset, - &validatedSize, type, name, parameters, (int32 *)&entryIndex)) + &validatedSize, type, name, parameters, (int32*)&entryIndex)) return B_BAD_VALUE; - const static_guid *newType = guid_for_partition_type(type); - if (newType == NULL) + guid_t typeGUID; + if (!get_guid_for_partition_type(type, typeGUID)) return B_BAD_VALUE; update_disk_device_job_progress(job, 0.0); - partition_data *child = create_child_partition(partition->id, entryIndex, + partition_data* child = create_child_partition(partition->id, entryIndex, validatedOffset, validatedSize, *childID); if (child == NULL) return B_ERROR; - efi_partition_entry &entry = header->EntryAt(entryIndex); - memcpy(&entry.partition_type, newType, sizeof(entry.partition_type)); + efi_partition_entry& entry = header->EntryAt(entryIndex); + entry.partition_type = typeGUID; + // TODO: set unique partition ID to_ucs2(name, strlen(name), entry.name, EFI_PARTITION_NAME_LENGTH); entry.SetStartBlock((validatedOffset - partition->offset) / partition->block_size); @@ -1167,7 +777,7 @@ efi_gpt_create_child(int fd, partition_id partitionID, off_t offset, child->name = strdup(name); child->type = strdup(type); child->parameters = strdup(parameters); - child->cookie = (void *)entryIndex; + child->cookie = (void*)entryIndex; if (child->type == NULL || child->parameters == NULL) { delete_partition(child->id); @@ -1191,15 +801,15 @@ efi_gpt_delete_child(int fd, partition_id partitionID, partition_id childID, if (!locker.IsLocked()) return B_ERROR; - partition_data *partition = get_partition(partitionID); + partition_data* partition = get_partition(partitionID); if (partition == NULL) return B_BAD_VALUE; - partition_data *child = get_partition(childID); + partition_data* child = get_partition(childID); if (child == NULL) return B_BAD_VALUE; - EFI::Header *header = (EFI::Header *)partition->content_cookie; + EFI::Header* header = (EFI::Header*)partition->content_cookie; if (header == NULL) return B_BAD_VALUE; @@ -1212,7 +822,7 @@ efi_gpt_delete_child(int fd, partition_id partitionID, partition_id childID, if (!delete_partition(childID)) return B_ERROR; - efi_partition_entry &entry = header->EntryAt(entryIndex); + efi_partition_entry& entry = header->EntryAt(entryIndex); entry.partition_type = kEmptyGUID; status_t result = header->WriteEntry(fd, entryIndex); @@ -1236,7 +846,7 @@ partition_module_info gEFIPartitionModule = { 0, efi_gpt_std_ops }, - "efi", // short_name + "gpt", // short_name EFI_PARTITION_NAME, // pretty_name 0 // flags | B_DISK_SYSTEM_SUPPORTS_INITIALIZING @@ -1304,7 +914,7 @@ partition_module_info gEFIPartitionModule = { }; #ifndef _BOOT_MODE -partition_module_info *modules[] = { +partition_module_info* modules[] = { &sEFIPartitionModule, NULL }; diff --git a/src/add-ons/kernel/partitioning_systems/efi/efi_gpt.h b/src/add-ons/kernel/partitioning_systems/gpt/efi_gpt.h similarity index 97% rename from src/add-ons/kernel/partitioning_systems/efi/efi_gpt.h rename to src/add-ons/kernel/partitioning_systems/gpt/efi_gpt.h index 2de5e9a4d2..50e1043573 100644 --- a/src/add-ons/kernel/partitioning_systems/efi/efi_gpt.h +++ b/src/add-ons/kernel/partitioning_systems/gpt/efi_gpt.h @@ -31,8 +31,8 @@ struct efi_table_header { // the rest of the block is reserved - void SetRevision(uint32 revision) - { revision = B_HOST_TO_LENDIAN_INT32(revision); } + void SetRevision(uint32 newRevision) + { revision = B_HOST_TO_LENDIAN_INT32(newRevision); } uint32 Revision() const { return B_LENDIAN_TO_HOST_INT32(revision); } void SetHeaderSize(uint32 size) diff --git a/src/add-ons/kernel/partitioning_systems/gpt/gpt_known_guids.h b/src/add-ons/kernel/partitioning_systems/gpt/gpt_known_guids.h new file mode 100644 index 0000000000..249f63975e --- /dev/null +++ b/src/add-ons/kernel/partitioning_systems/gpt/gpt_known_guids.h @@ -0,0 +1,75 @@ +/* + * Copyright 2009, Michael Lotz, mmlr@mlotz.ch. All rights reserved. + * Copyright 2007-2013, Axel Dörfler, axeld@pinc-software.de. + * + * Distributed under the terms of the MIT License. + */ +#ifndef GPT_KNOWN_GUIDS_H +#define GPT_KNOWN_GUIDS_H + + +#include + +#include + + +struct guid; + + +struct static_guid { + uint32 data1; + uint16 data2; + uint16 data3; + uint64 data4; + + inline bool operator==(const guid& other) const; + inline operator guid_t() const; +} _PACKED; + + +inline bool +static_guid::operator==(const guid_t& other) const +{ + return B_HOST_TO_LENDIAN_INT32(data1) == other.data1 + && B_HOST_TO_LENDIAN_INT16(data2) == other.data2 + && B_HOST_TO_LENDIAN_INT16(data3) == other.data3 + && B_HOST_TO_BENDIAN_INT64(*(uint64*)&data4) == *(uint64*)other.data4; + // the last 8 bytes are in big-endian order +} + + +inline +static_guid::operator guid_t() const +{ + guid_t guid; + guid.data1 = B_HOST_TO_LENDIAN_INT32(data1); + guid.data2 = B_HOST_TO_LENDIAN_INT16(data2); + guid.data3 = B_HOST_TO_LENDIAN_INT16(data3); + uint64 last = B_HOST_TO_BENDIAN_INT64(*(uint64*)&data4); + memcpy(guid.data4, &last, sizeof(uint64)); + + return guid; +} + + +const static struct type_map { + static_guid guid; + const char* type; +} kTypeMap[] = { + {{0xC12A7328, 0xF81F, 0x11D2, 0xBA4B00A0C93EC93BLL}, "EFI System Data"}, + {{0x21686148, 0x6449, 0x6E6F, 0x744E656564454649LL}, "BIOS Boot Data"}, + {{0x024DEE41, 0x33E7, 0x11D3, 0x9D690008C781F39FLL}, "MBR Partition Nest"}, + {{0x42465331, 0x3BA3, 0x10F1, 0x802A4861696B7521LL}, BFS_NAME}, + {{0x0FC63DAF, 0x8483, 0x4772, 0x8E793D69D8477DE4LL}, "Linux File System"}, + {{0xA19D880F, 0x05FC, 0x4D3B, 0xA006743F0F84911ELL}, "Linux RAID"}, + {{0x0657FD6D, 0xA4AB, 0x43C4, 0x84E50933C84B4F4FLL}, "Linux Swap"}, + {{0xE6D6D379, 0xF507, 0x44C2, 0xA23C238F2A3DF928LL}, "Linux LVM"}, + {{0xEBD0A0A2, 0xB9E5, 0x4433, 0x87C068B6B72699C7LL}, "Windows Data"}, + {{0x48465300, 0x0000, 0x11AA, 0xAA1100306543ECACLL}, "HFS+ File System"}, + {{0x55465300, 0x0000, 0x11AA, 0xAA1100306543ECACLL}, "UFS File System"}, + {{0x52414944, 0x0000, 0x11AA, 0xAA1100306543ECACLL}, "Apple RAID"}, + {{0x52414944, 0x5F4F, 0x11AA, 0xAA1100306543ECACLL}, "Apple RAID, offline"} +}; + + +#endif // GPT_KNOWN_GUIDS_H diff --git a/src/add-ons/kernel/partitioning_systems/efi/guid.h b/src/add-ons/kernel/partitioning_systems/gpt/guid.h similarity index 100% rename from src/add-ons/kernel/partitioning_systems/efi/guid.h rename to src/add-ons/kernel/partitioning_systems/gpt/guid.h diff --git a/src/add-ons/kernel/partitioning_systems/gpt/utility.cpp b/src/add-ons/kernel/partitioning_systems/gpt/utility.cpp new file mode 100644 index 0000000000..4564377d8c --- /dev/null +++ b/src/add-ons/kernel/partitioning_systems/gpt/utility.cpp @@ -0,0 +1,110 @@ +/* + * Copyright 2007-2013, Axel Dörfler, axeld@pinc-software.de. + * Copyright 2009, Michael Lotz, mmlr@mlotz.ch. All rights reserved. + * + * Distributed under the terms of the MIT License. + */ + + +#include "utility.h" + +#include + +#ifndef _BOOT_MODE +# include +#endif + +#include "gpt_known_guids.h" + + +const guid_t kEmptyGUID = {0, 0, 0, {0, 0, 0, 0, 0, 0, 0, 0}}; + + +static void +put_utf8_byte(char*& to, size_t& left, char c) +{ + if (left <= 1) + return; + + *(to++) = c; + left--; +} + + +// #pragma mark - + + +void +to_utf8(const uint16* from, size_t maxFromLength, char* to, size_t toSize) +{ + for (uint32 i = 0; i < maxFromLength; i++) { + uint16 c = B_LENDIAN_TO_HOST_INT16(from[i]); + if (!c) + break; + + if (c < 0x80) + put_utf8_byte(to, toSize, c); + else if (c < 0x800) { + put_utf8_byte(to, toSize, 0xc0 | (c >> 6)); + put_utf8_byte(to, toSize, 0x80 | (c & 0x3f)); + } else if (c < 0x10000) { + put_utf8_byte(to, toSize, 0xe0 | (c >> 12)); + put_utf8_byte(to, toSize, 0x80 | ((c >> 6) & 0x3f)); + put_utf8_byte(to, toSize, 0x80 | (c & 0x3f)); + } else if (c <= 0x10ffff) { + put_utf8_byte(to, toSize, 0xf0 | (c >> 18)); + put_utf8_byte(to, toSize, 0x80 | ((c >> 12) & 0x3f)); + put_utf8_byte(to, toSize, 0x80 | ((c >> 6) & 0x3f)); + put_utf8_byte(to, toSize, 0x80 | (c & 0x3f)); + } + } + + if (toSize > 0) + *to = '\0'; +} + + +#ifndef _BOOT_MODE +void +to_ucs2(const char* from, size_t fromLength, uint16* to, size_t maxToLength) +{ + size_t index = 0; + while (from[0] != '\0' && index < maxToLength) { + // TODO: handle characters that are not representable in UCS-2 better + uint32 code = UTF8ToCharCode(&from); + if (code < 0x10000) + to[index++] = code; + } + + if (index < maxToLength) + to[index] = '\0'; +} +#endif // !_BOOT_MODE + + +const char* +get_partition_type(const guid_t& guid) +{ + for (uint32 i = 0; i < sizeof(kTypeMap) / sizeof(kTypeMap[0]); i++) { + if (kTypeMap[i].guid == guid) + return kTypeMap[i].type; + } + + return NULL; +} + + +#ifndef _BOOT_MODE +bool +get_guid_for_partition_type(const char* type, guid_t& guid) +{ + for (uint32 i = 0; i < sizeof(kTypeMap) / sizeof(kTypeMap[0]); i++) { + if (strcmp(kTypeMap[i].type, type) == 0) { + guid = kTypeMap[i].guid; + return true; + } + } + + return false; +} +#endif // !_BOOT_MODE diff --git a/src/add-ons/kernel/partitioning_systems/gpt/utility.h b/src/add-ons/kernel/partitioning_systems/gpt/utility.h new file mode 100644 index 0000000000..c89db23984 --- /dev/null +++ b/src/add-ons/kernel/partitioning_systems/gpt/utility.h @@ -0,0 +1,31 @@ +/* + * Copyright 2007-2013, Axel Dörfler, axeld@pinc-software.de. + * Copyright 2009, Michael Lotz, mmlr@mlotz.ch. All rights reserved. + * + * Distributed under the terms of the MIT License. + */ +#ifndef UTILITY_H +#define UTILITY_H + + +#include + +#include "guid.h" + + +struct static_guid; + +extern const guid_t kEmptyGUID; + + +void to_utf8(const uint16* from, size_t maxFromLength, char* to, size_t toSize); +const char* get_partition_type(const guid_t& guid); + +#ifndef _BOOT_MODE +void to_ucs2(const char* from, size_t fromLength, uint16* to, + size_t maxToLength); +bool get_guid_for_partition_type(const char* type, guid_t& guid); +#endif // !_BOOT_MODE + + +#endif // UTILITY_H diff --git a/src/add-ons/opengl/swpipe/Jamfile b/src/add-ons/opengl/swpipe/Jamfile index 4f462b6685..01b3a9a8d0 100644 --- a/src/add-ons/opengl/swpipe/Jamfile +++ b/src/add-ons/opengl/swpipe/Jamfile @@ -21,6 +21,7 @@ UseHeaders [ FDirName $(HAIKU_MESA_DIR) src mesa ] ; AddResources Software\ Renderer : SoftwareRenderer.rdef ; if FIsBuildFeatureEnabled(llvm) { + Depends Software\ Renderer : $(HAIKU_LLVM_HEADERS_DEPENDENCY) ; SubDirC++Flags [ FDefines HAVE_LLVM=0x0302 ] ; } diff --git a/src/apps/Jamfile b/src/apps/Jamfile index 0f90365340..7cd5efc724 100644 --- a/src/apps/Jamfile +++ b/src/apps/Jamfile @@ -20,6 +20,7 @@ HaikuSubInclude diskprobe ; HaikuSubInclude diskusage ; HaikuSubInclude drivesetup ; HaikuSubInclude expander ; +HaikuSubInclude firstbootprompt ; HaikuSubInclude fontdemo ; HaikuSubInclude glteapot ; HaikuSubInclude gradients ; @@ -46,7 +47,6 @@ HaikuSubInclude poorman ; HaikuSubInclude powerstatus ; HaikuSubInclude processcontroller ; HaikuSubInclude pulse ; -HaikuSubInclude readonlybootprompt ; HaikuSubInclude remotedesktop ; HaikuSubInclude resedit ; HaikuSubInclude screenshot ; diff --git a/src/apps/aboutsystem/AboutSystem.cpp b/src/apps/aboutsystem/AboutSystem.cpp index d2eb569faa..0fcca5098a 100644 --- a/src/apps/aboutsystem/AboutSystem.cpp +++ b/src/apps/aboutsystem/AboutSystem.cpp @@ -1132,6 +1132,7 @@ AboutView::_CreateCreditsView() "Pier Luigi Fiorini\n" "Marc Flerackers\n" "Michele Frau - zuMi\n" + "Landon Fuller\n" "Deyan Genovski\n" "Pete Goodeve\n" "Lucian Adrian Grijincu\n" diff --git a/src/apps/debugger/controllers/DebugReportGenerator.cpp b/src/apps/debugger/controllers/DebugReportGenerator.cpp index 4041bfe369..e5aa62da9b 100644 --- a/src/apps/debugger/controllers/DebugReportGenerator.cpp +++ b/src/apps/debugger/controllers/DebugReportGenerator.cpp @@ -341,8 +341,11 @@ DebugReportGenerator::_DumpDebuggedThreadInfo(BString& _output, if (frame->CountParameters() == 0 && frame->CountLocalVariables() == 0) { // only dump the topmost frame - if (i == 0) - _DumpStackFrameMemory(_output, thread->GetCpuState()); + if (i == 0) { + _DumpStackFrameMemory(_output, thread->GetCpuState(), + frame->FrameAddress(), thread->GetTeam()->GetArchitecture() + ->StackGrowthDirection()); + } continue; } @@ -384,19 +387,29 @@ DebugReportGenerator::_DumpDebuggedThreadInfo(BString& _output, void DebugReportGenerator::_DumpStackFrameMemory(BString& _output, - CpuState* state) + CpuState* state, target_addr_t framePointer, uint8 stackDirection) { - target_addr_t address = state->StackPointer(); - if (fCurrentBlock == NULL || !fCurrentBlock->Contains(address)) { - fListener->InspectRequested(address, this); + target_addr_t startAddress; + target_addr_t endAddress; + if (stackDirection == STACK_GROWTH_DIRECTION_POSITIVE) { + startAddress = framePointer; + endAddress = state->StackPointer(); + } else { + startAddress = state->StackPointer(); + endAddress = framePointer; + } + + if (fCurrentBlock == NULL || !fCurrentBlock->Contains(startAddress)) { + fListener->InspectRequested(startAddress, this); status_t result = B_OK; do { result = acquire_sem(fTeamDataSem); } while (result == B_INTERRUPTED); } + _output << "\t\t\tFrame memory:\n"; - UiUtils::DumpMemory(_output, 3, fCurrentBlock, address, 1, 16, - fCurrentBlock->BaseAddress() + fCurrentBlock->Size() - address); + UiUtils::DumpMemory(_output, 3, fCurrentBlock, startAddress, 1, 16, + endAddress - startAddress); } diff --git a/src/apps/debugger/controllers/DebugReportGenerator.h b/src/apps/debugger/controllers/DebugReportGenerator.h index 56bf8a4a7c..5ff78b484d 100644 --- a/src/apps/debugger/controllers/DebugReportGenerator.h +++ b/src/apps/debugger/controllers/DebugReportGenerator.h @@ -60,7 +60,9 @@ private: status_t _DumpDebuggedThreadInfo(BString& _output, ::Thread* thread); void _DumpStackFrameMemory(BString& _output, - CpuState* state); + CpuState* state, + target_addr_t framePointer, + uint8 stackDirection); status_t _ResolveValueIfNeeded(ValueNode* node, StackFrame* frame, int32 maxDepth); diff --git a/src/apps/debugger/dwarf/DebugInfoEntries.cpp b/src/apps/debugger/dwarf/DebugInfoEntries.cpp index d4643a46e5..be38f23a2c 100644 --- a/src/apps/debugger/dwarf/DebugInfoEntries.cpp +++ b/src/apps/debugger/dwarf/DebugInfoEntries.cpp @@ -1,6 +1,6 @@ /* * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. - * Copyright 2011, Rene Gollent, rene@gollent.com. + * Copyright 2011-2013, Rene Gollent, rene@gollent.com. * Distributed under the terms of the MIT License. */ @@ -2514,6 +2514,96 @@ DIESharedType::AddAttribute_decl_column(uint16 attributeName, } +// #pragma mark - DIETemplateTypeParameterPack + + +DIETemplateTypeParameterPack::DIETemplateTypeParameterPack() + : + fName(NULL) +{ +} + + +uint16 +DIETemplateTypeParameterPack::Tag() const +{ + return DW_TAG_GNU_template_parameter_pack; +} + + +const char* +DIETemplateTypeParameterPack::Name() const +{ + return fName; +} + + +status_t +DIETemplateTypeParameterPack::AddAttribute_name(uint16 attributeName, + const AttributeValue& value) +{ + fName = value.string; + return B_OK; +} + + +status_t +DIETemplateTypeParameterPack::AddChild(DebugInfoEntry* child) +{ + if (child->Tag() == DW_TAG_template_type_parameter) { + fChildren.Add(child); + return B_OK; + } + + return DIEDeclaredBase::AddChild(child); +} + + +// #pragma mark - DIETemplateValueParameterPack + + +DIETemplateValueParameterPack::DIETemplateValueParameterPack() + : + fName(NULL) +{ +} + + +uint16 +DIETemplateValueParameterPack::Tag() const +{ + return DW_TAG_GNU_formal_parameter_pack; +} + + +const char* +DIETemplateValueParameterPack::Name() const +{ + return fName; +} + + +status_t +DIETemplateValueParameterPack::AddAttribute_name(uint16 attributeName, + const AttributeValue& value) +{ + fName = value.string; + return B_OK; +} + + +status_t +DIETemplateValueParameterPack::AddChild(DebugInfoEntry* child) +{ + if (child->Tag() == DW_TAG_formal_parameter) { + fChildren.Add(child); + return B_OK; + } + + return DIEDeclaredBase::AddChild(child); +} + + // #pragma mark - DebugInfoEntryFactory @@ -2699,6 +2789,12 @@ DebugInfoEntryFactory::CreateDebugInfoEntry(uint16 tag, DebugInfoEntry*& _entry) case DW_TAG_shared_type: entry = new(std::nothrow) DIESharedType; break; + case DW_TAG_GNU_template_parameter_pack: + entry = new(std::nothrow) DIETemplateTypeParameterPack; + break; + case DW_TAG_GNU_formal_parameter_pack: + entry = new(std::nothrow) DIETemplateValueParameterPack; + break; default: return B_ENTRY_NOT_FOUND; break; diff --git a/src/apps/debugger/dwarf/DebugInfoEntries.h b/src/apps/debugger/dwarf/DebugInfoEntries.h index 757007fe54..a4a5c01ce4 100644 --- a/src/apps/debugger/dwarf/DebugInfoEntries.h +++ b/src/apps/debugger/dwarf/DebugInfoEntries.h @@ -1,5 +1,6 @@ /* * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. + * Copyright 2013, Rene Gollent, rene@gollent.com. * Distributed under the terms of the MIT License. */ #ifndef DEBUG_INFO_ENTRIES_H @@ -1596,6 +1597,50 @@ private: }; +class DIETemplateTypeParameterPack : public DIEDeclaredBase { +public: + DIETemplateTypeParameterPack(); + + virtual uint16 Tag() const; + + virtual const char* Name() const; + + virtual status_t AddAttribute_name(uint16 attributeName, + const AttributeValue& value); + + const DebugInfoEntryList& Children() const + { return fChildren; } + + virtual status_t AddChild(DebugInfoEntry* child); + +private: + const char* fName; + DebugInfoEntryList fChildren; +}; + + +class DIETemplateValueParameterPack : public DIEDeclaredBase { +public: + DIETemplateValueParameterPack(); + + virtual uint16 Tag() const; + + virtual const char* Name() const; + + virtual status_t AddAttribute_name(uint16 attributeName, + const AttributeValue& value); + + const DebugInfoEntryList& Children() const + { return fChildren; } + + virtual status_t AddChild(DebugInfoEntry* child); + +private: + const char* fName; + DebugInfoEntryList fChildren; +}; + + // #pragma mark - DebugInfoEntryFactory diff --git a/src/apps/debugger/dwarf/Dwarf.h b/src/apps/debugger/dwarf/Dwarf.h index 1d83cbaffd..1e9c99bc74 100644 --- a/src/apps/debugger/dwarf/Dwarf.h +++ b/src/apps/debugger/dwarf/Dwarf.h @@ -65,6 +65,10 @@ enum { DW_TAG_condition = 0x3f, DW_TAG_shared_type = 0x40, DW_TAG_lo_user = 0x4080, + DW_TAG_GNU_template_parameter_pack + = 0x4107, + DW_TAG_GNU_formal_parameter_pack + = 0x4108, DW_TAG_hi_user = 0xffff }; diff --git a/src/apps/drivesetup/AbstractParametersPanel.cpp b/src/apps/drivesetup/AbstractParametersPanel.cpp new file mode 100644 index 0000000000..1c38f64029 --- /dev/null +++ b/src/apps/drivesetup/AbstractParametersPanel.cpp @@ -0,0 +1,248 @@ +/* + * Copyright 2008-2013 Haiku, Inc. All rights reserved. + * Distributed under the terms of the MIT license. + * + * Authors: + * Stephan Aßmus + * Axel Dörfler, axeld@pinc-software.de. + * Karsten Heimrich. + */ + + +#include "AbstractParametersPanel.h" + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + + +#undef B_TRANSLATION_CONTEXT +#define B_TRANSLATION_CONTEXT "AbstractParametersPanel" + + +static const uint32 kMsgOk = 'okok'; +static const uint32 kParameterChanged = 'pmch'; + + +class AbstractParametersPanel::EscapeFilter : public BMessageFilter { +public: + EscapeFilter(AbstractParametersPanel* target) + : + BMessageFilter(B_ANY_DELIVERY, B_ANY_SOURCE), + fPanel(target) + { + } + + virtual ~EscapeFilter() + { + } + + virtual filter_result Filter(BMessage* message, BHandler** target) + { + filter_result result = B_DISPATCH_MESSAGE; + switch (message->what) { + case B_KEY_DOWN: + case B_UNMAPPED_KEY_DOWN: { + uint32 key; + if (message->FindInt32("raw_char", (int32*)&key) >= B_OK) { + if (key == B_ESCAPE) { + result = B_SKIP_MESSAGE; + fPanel->Cancel(); + } + } + break; + } + default: + break; + } + return result; + } + +private: + AbstractParametersPanel* fPanel; +}; + + +// #pragma mark - + + +AbstractParametersPanel::AbstractParametersPanel(BWindow* window) + : + BWindow(BRect(300.0, 200.0, 600.0, 300.0), 0, B_MODAL_WINDOW_LOOK, + B_MODAL_SUBSET_WINDOW_FEEL, + B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS), + fOkButton(new BButton(B_TRANSLATE("OK"), new BMessage(kMsgOk))), + fReturnStatus(B_CANCELED), + fEditor(NULL), + fEscapeFilter(new EscapeFilter(this)), + fExitSemaphore(create_sem(0, "AbstractParametersPanel exit")), + fWindow(window) +{ + AddCommonFilter(fEscapeFilter); + AddToSubset(fWindow); +} + + +AbstractParametersPanel::~AbstractParametersPanel() +{ + RemoveCommonFilter(fEscapeFilter); + delete fEscapeFilter; + + delete_sem(fExitSemaphore); + + if (fEditor == NULL) + delete fOkButton; +} + + +bool +AbstractParametersPanel::QuitRequested() +{ + release_sem(fExitSemaphore); + return false; +} + + +void +AbstractParametersPanel::MessageReceived(BMessage* message) +{ + switch (message->what) { + case B_CANCEL: + Cancel(); + break; + + case kMsgOk: + fReturnStatus = B_OK; + release_sem(fExitSemaphore); + break; + + case kParameterChanged: + fOkButton->SetEnabled(fEditor->ValidateParameters()); + break; + + default: + BWindow::MessageReceived(message); + } +} + + +status_t +AbstractParametersPanel::Go(BString& parameters) +{ + // Without an editor, we cannot change anything, anyway + if (fEditor == NULL) { + parameters = ""; + if (fReturnStatus == B_CANCELED) + fReturnStatus = B_OK; + + if (!Lock()) + return B_ERROR; + } else { + // run the window thread, to get an initial layout of the controls + Hide(); + Show(); + if (!Lock()) + return B_CANCELED; + + // center the panel above the parent window + CenterIn(fWindow->Frame()); + + Show(); + Unlock(); + + // block this thread now, but keep the window repainting + while (true) { + status_t status = acquire_sem_etc(fExitSemaphore, 1, + B_CAN_INTERRUPT | B_RELATIVE_TIMEOUT, 50000); + if (status != B_TIMED_OUT && status != B_INTERRUPTED) + break; + fWindow->UpdateIfNeeded(); + } + + if (!Lock()) + return B_CANCELED; + + if (fReturnStatus == B_OK) { + if (fEditor->ValidateParameters()) { + status_t err = fEditor->GetParameters(parameters); + if (err != B_OK) + fReturnStatus = err; + } + } + } + + status_t status = fReturnStatus; + + Quit(); + // NOTE: this object is toast now! + + return status; +} + + +void +AbstractParametersPanel::Cancel() +{ + fReturnStatus = B_CANCELED; + release_sem(fExitSemaphore); +} + + +void +AbstractParametersPanel::Init(B_PARAMETER_EDITOR_TYPE type, + const BString& diskSystem, BPartition* partition) +{ + // Create partition parameter editor + + status_t status = B_ERROR; + if (diskSystem.IsEmpty()) { + status = partition->GetParameterEditor(type, &fEditor); + } else { + DiskSystemAddOnManager* manager = DiskSystemAddOnManager::Default(); + BDiskSystemAddOn* addOn = manager->GetAddOn(diskSystem); + if (addOn != NULL) { + // put the add-on + manager->PutAddOn(addOn); + + status = addOn->GetParameterEditor(type, &fEditor); + } + } + if (status != B_OK && status != B_NOT_SUPPORTED) + fReturnStatus = status; + + if (fEditor == NULL) + return; + + // Create controls + + BLayoutBuilder::Group<> builder = BLayoutBuilder::Group<>(this, + B_VERTICAL); + AddControls(builder, fEditor->View()); + + builder.AddGroup(B_HORIZONTAL, B_USE_DEFAULT_SPACING) + .AddGlue() + .Add(new BButton(B_TRANSLATE("Cancel"), new BMessage(B_CANCEL))) + .Add(fOkButton) + .End() + .SetInsets(B_USE_DEFAULT_SPACING); + + SetDefaultButton(fOkButton); + + fEditor->SetTo(partition); + fEditor->SetModificationMessage(new BMessage(kParameterChanged)); +} + + +void +AbstractParametersPanel::AddControls(BLayoutBuilder::Group<>& builder, + BView* editorView) +{ + builder.Add(editorView); +} diff --git a/src/apps/drivesetup/AbstractParametersPanel.h b/src/apps/drivesetup/AbstractParametersPanel.h new file mode 100644 index 0000000000..123e9574c6 --- /dev/null +++ b/src/apps/drivesetup/AbstractParametersPanel.h @@ -0,0 +1,58 @@ +/* + * Copyright 2008-2013 Haiku, Inc. All rights reserved. + * Distributed under the terms of the MIT license. + * + * Authors: + * Stephan Aßmus + * Axel Dörfler, axeld@pinc-software.de. + */ +#ifndef ABSTRACT_PARAMETERS_PANEL_H +#define ABSTRACT_PARAMETERS_PANEL_H + + +#include +#include +#include +#include + +#include "Support.h" + + +class BMenuField; +class BTextControl; + + +class AbstractParametersPanel : public BWindow { +public: + AbstractParametersPanel(BWindow* window); + virtual ~AbstractParametersPanel(); + + virtual bool QuitRequested(); + virtual void MessageReceived(BMessage* message); + + status_t Go(BString& parameters); + void Cancel(); + +protected: + void Init(B_PARAMETER_EDITOR_TYPE type, + const BString& diskSystem, + BPartition* partition); + + virtual void AddControls(BLayoutBuilder::Group<>& builder, + BView* editorView); + +protected: + BButton* fOkButton; + status_t fReturnStatus; + + BPartitionParameterEditor* fEditor; + +private: + class EscapeFilter; + EscapeFilter* fEscapeFilter; + sem_id fExitSemaphore; + BWindow* fWindow; +}; + + +#endif // ABSTRACT_PARAMETERS_PANEL_H diff --git a/src/apps/drivesetup/CreateParametersPanel.cpp b/src/apps/drivesetup/CreateParametersPanel.cpp new file mode 100644 index 0000000000..f85713d7ec --- /dev/null +++ b/src/apps/drivesetup/CreateParametersPanel.cpp @@ -0,0 +1,187 @@ +/* + * Copyright 2008-2013 Haiku Inc. All rights reserved. + * Distributed under the terms of the MIT license. + * + * Authors: + * Stephan Aßmus + * Axel Dörfler, axeld@pinc-software.de. + * Bryce Groff + * Karsten Heimrich + */ + + +#include "CreateParametersPanel.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "Support.h" + + +#undef B_TRANSLATION_CONTEXT +#define B_TRANSLATION_CONTEXT "CreateParametersPanel" + + +enum { + MSG_PARTITION_TYPE = 'type', + MSG_SIZE_SLIDER = 'ssld', + MSG_SIZE_TEXTCONTROL = 'stct' +}; + + +CreateParametersPanel::CreateParametersPanel(BWindow* window, + BPartition* partition, off_t offset, off_t size) + : + AbstractParametersPanel(window) +{ + Init(B_CREATE_PARAMETER_EDITOR, "", partition); + + // Scale offset, and size from bytes to megabytes (2^20) + // so that we do not run over a signed int32. + offset /= kMegaByte; + size /= kMegaByte; + _CreateViewControls(partition, offset, size); +} + + +CreateParametersPanel::~CreateParametersPanel() +{ +} + + +status_t +CreateParametersPanel::Go(off_t& offset, off_t& size, BString& name, + BString& type, BString& parameters) +{ + // The object will be deleted in Go(), so we need to get the values before + + // Return the value back as bytes. + size = (off_t)fSizeSlider->Size() * kMegaByte; + offset = (off_t)fSizeSlider->Offset() * kMegaByte; + + // get name + name.SetTo(fNameTextControl->Text()); + + // get type + if (BMenuItem* item = fTypeMenuField->Menu()->FindMarked()) { + const char* _type; + BMessage* message = item->Message(); + if (!message || message->FindString("type", &_type) < B_OK) + _type = kPartitionTypeBFS; + type << _type; + } + + return AbstractParametersPanel::Go(parameters); +} + + +void +CreateParametersPanel::AddControls(BLayoutBuilder::Group<>& builder, + BView* editorView) +{ + builder + .Add(fSizeSlider) + .Add(fSizeTextControl) + .AddGrid(0.0, 5.0) + .Add(fNameTextControl->CreateLabelLayoutItem(), 0, 0) + .Add(fNameTextControl->CreateTextViewLayoutItem(), 1, 0) + .Add(fTypeMenuField->CreateLabelLayoutItem(), 0, 1) + .Add(fTypeMenuField->CreateMenuBarLayoutItem(), 1, 1) + .End() + .Add(editorView); +} + + +void +CreateParametersPanel::_CreateViewControls(BPartition* parent, off_t offset, + off_t size) +{ + // Setup the controls + fSizeSlider = new SizeSlider("Slider", B_TRANSLATE("Partition size"), NULL, + offset, offset + size); + fSizeSlider->SetPosition(1.0); + fSizeSlider->SetModificationMessage(new BMessage(MSG_SIZE_SLIDER)); + + fSizeTextControl = new BTextControl("Size Control", "", "", NULL); + for(int32 i = 0; i < 256; i++) + fSizeTextControl->TextView()->DisallowChar(i); + for(int32 i = '0'; i <= '9'; i++) + fSizeTextControl->TextView()->AllowChar(i); + _UpdateSizeTextControl(); + fSizeTextControl->SetModificationMessage( + new BMessage(MSG_SIZE_TEXTCONTROL)); + + fNameTextControl = new BTextControl("Name Control", + B_TRANSLATE("Partition name:"), "", NULL); + if (!parent->SupportsChildName()) + fNameTextControl->SetEnabled(false); + + fTypePopUpMenu = new BPopUpMenu("Partition Type"); + + int32 cookie = 0; + BString supportedType; + while (parent->GetNextSupportedChildType(&cookie, &supportedType) == B_OK) { + BMessage* message = new BMessage(MSG_PARTITION_TYPE); + message->AddString("type", supportedType); + BMenuItem* item = new BMenuItem(supportedType, message); + fTypePopUpMenu->AddItem(item); + + if (strcmp(supportedType, kPartitionTypeBFS) == 0) + item->SetMarked(true); + } + + fTypeMenuField = new BMenuField(B_TRANSLATE("Partition type:"), + fTypePopUpMenu); + + fOkButton->SetLabel(B_TRANSLATE("Create")); +} + + +void +CreateParametersPanel::MessageReceived(BMessage* message) +{ + switch (message->what) { + case MSG_PARTITION_TYPE: + if (fEditor != NULL) { + const char* type; + if (message->FindString("type", &type) == B_OK) + fEditor->ParameterChanged("type", BVariant(type)); + } + break; + + case MSG_SIZE_SLIDER: + _UpdateSizeTextControl(); + break; + + case MSG_SIZE_TEXTCONTROL: + { + int32 size = atoi(fSizeTextControl->Text()); + if (size >= 0 && size <= fSizeSlider->MaxPartitionSize()) + fSizeSlider->SetValue(size + fSizeSlider->Offset()); + else + _UpdateSizeTextControl(); + break; + } + + default: + AbstractParametersPanel::MessageReceived(message); + } +} + + +void +CreateParametersPanel::_UpdateSizeTextControl() +{ + BString sizeString; + sizeString << fSizeSlider->Value() - fSizeSlider->Offset(); + fSizeTextControl->SetText(sizeString.String()); +} diff --git a/src/apps/drivesetup/CreateParamsPanel.h b/src/apps/drivesetup/CreateParametersPanel.h similarity index 58% rename from src/apps/drivesetup/CreateParamsPanel.h rename to src/apps/drivesetup/CreateParametersPanel.h index eef3cc2011..4746397985 100644 --- a/src/apps/drivesetup/CreateParamsPanel.h +++ b/src/apps/drivesetup/CreateParametersPanel.h @@ -1,40 +1,40 @@ /* - * Copyright 2008-2012 Haiku Inc. All rights reserved. + * Copyright 2008-2013 Haiku Inc. All rights reserved. * Distributed under the terms of the MIT license. * * Authors: * Stephan Aßmus + * Axel Dörfler, axeld@pinc-software.de. * Bryce Groff */ #ifndef CREATE_PARAMS_PANEL_H #define CREATE_PARAMS_PANEL_H -#include -#include -#include -#include +#include "AbstractParametersPanel.h" class BMenuField; +class BPopUpMenu; class BTextControl; class SizeSlider; -class CreateParamsPanel : public BWindow { +class CreateParametersPanel : public AbstractParametersPanel { public: - CreateParamsPanel(BWindow* window, + CreateParametersPanel(BWindow* window, BPartition* parent, off_t offset, off_t size); - virtual ~CreateParamsPanel(); + virtual ~CreateParametersPanel(); + + status_t Go(off_t& offset, off_t& size, BString& name, + BString& type, BString& parameters); - virtual bool QuitRequested(); virtual void MessageReceived(BMessage* message); - int32 Go(off_t& offset, off_t& size, BString& name, - BString& type, BString& parameters); - void Cancel(); - +protected: + virtual void AddControls(BLayoutBuilder::Group<>& builder, + BView* editorView); private: void _CreateViewControls(BPartition* parent, @@ -43,15 +43,6 @@ private: void _UpdateSizeTextControl(); private: - class EscapeFilter; - - EscapeFilter* fEscapeFilter; - sem_id fExitSemaphore; - BWindow* fWindow; - int32 fReturnValue; - - BPartitionParameterEditor* fEditor; - BPopUpMenu* fTypePopUpMenu; BMenuField* fTypeMenuField; BTextControl* fNameTextControl; diff --git a/src/apps/drivesetup/CreateParamsPanel.cpp b/src/apps/drivesetup/CreateParamsPanel.cpp deleted file mode 100644 index deeee1219a..0000000000 --- a/src/apps/drivesetup/CreateParamsPanel.cpp +++ /dev/null @@ -1,326 +0,0 @@ -/* - * Copyright 2008-2012 Haiku Inc. All rights reserved. - * Distributed under the terms of the MIT license. - * - * Authors: - * Stephan Aßmus - * Bryce Groff - * Karsten Heimrich - */ - - -#include "CreateParamsPanel.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "Support.h" - - -#undef B_TRANSLATION_CONTEXT -#define B_TRANSLATION_CONTEXT "CreateParamsPanel" - - -class CreateParamsPanel::EscapeFilter : public BMessageFilter { -public: - EscapeFilter(CreateParamsPanel* target) - : - BMessageFilter(B_ANY_DELIVERY, B_ANY_SOURCE), - fPanel(target) - { - } - - virtual ~EscapeFilter() - { - } - - virtual filter_result Filter(BMessage* message, BHandler** target) - { - filter_result result = B_DISPATCH_MESSAGE; - switch (message->what) { - case B_KEY_DOWN: - case B_UNMAPPED_KEY_DOWN: { - uint32 key; - if (message->FindInt32("raw_char", (int32*)&key) >= B_OK) { - if (key == B_ESCAPE) { - result = B_SKIP_MESSAGE; - fPanel->Cancel(); - } - } - break; - } - default: - break; - } - return result; - } - -private: - CreateParamsPanel* fPanel; -}; - - -// #pragma mark - - - -enum { - MSG_OK = 'okok', - MSG_CANCEL = 'cncl', - MSG_PARTITION_TYPE = 'type', - MSG_SIZE_SLIDER = 'ssld', - MSG_SIZE_TEXTCONTROL = 'stct' -}; - - -CreateParamsPanel::CreateParamsPanel(BWindow* window, BPartition* partition, - off_t offset, off_t size) - : - BWindow(BRect(300.0, 200.0, 600.0, 300.0), 0, B_MODAL_WINDOW_LOOK, - B_MODAL_SUBSET_WINDOW_FEEL, - B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS), - fEscapeFilter(new EscapeFilter(this)), - fExitSemaphore(create_sem(0, "CreateParamsPanel exit")), - fWindow(window), - fReturnValue(GO_CANCELED) -{ - AddCommonFilter(fEscapeFilter); - - // Scale offset, and size from bytes to megabytes (2^20) - // so that we do not run over a signed int32. - offset /= kMegaByte; - size /= kMegaByte; - _CreateViewControls(partition, offset, size); -} - - -CreateParamsPanel::~CreateParamsPanel() -{ - RemoveCommonFilter(fEscapeFilter); - delete fEscapeFilter; - - delete_sem(fExitSemaphore); -} - - -bool -CreateParamsPanel::QuitRequested() -{ - release_sem(fExitSemaphore); - return false; -} - - -void -CreateParamsPanel::MessageReceived(BMessage* message) -{ - switch (message->what) { - case MSG_CANCEL: - Cancel(); - break; - - case MSG_OK: - fReturnValue = GO_SUCCESS; - release_sem(fExitSemaphore); - break; - - case MSG_PARTITION_TYPE: - if (fEditor != NULL) { - const char* type; - message->FindString("type", &type); - fEditor->PartitionTypeChanged(type); - } - break; - - case MSG_SIZE_SLIDER: - _UpdateSizeTextControl(); - break; - - case MSG_SIZE_TEXTCONTROL: - { - int32 size = atoi(fSizeTextControl->Text()); - if (size >= 0 && size <= fSizeSlider->MaxPartitionSize()) - fSizeSlider->SetValue(size + fSizeSlider->Offset()); - else - _UpdateSizeTextControl(); - break; - } - - default: - BWindow::MessageReceived(message); - } -} - - -int32 -CreateParamsPanel::Go(off_t& offset, off_t& size, BString& name, - BString& type, BString& parameters) -{ - // run the window thread, to get an initial layout of the controls - Hide(); - Show(); - if (!Lock()) - return GO_CANCELED; - - // center the panel above the parent window - CenterIn(fWindow->Frame()); - - Show(); - Unlock(); - - // block this thread now, but keep the window repainting - while (true) { - status_t err = acquire_sem_etc(fExitSemaphore, 1, - B_CAN_INTERRUPT | B_RELATIVE_TIMEOUT, 50000); - if (err != B_TIMED_OUT && err != B_INTERRUPTED) - break; - fWindow->UpdateIfNeeded(); - } - - if (!Lock()) - return GO_CANCELED; - - if (fReturnValue == GO_SUCCESS) { - // Return the value back as bytes. - size = (off_t)fSizeSlider->Size() * kMegaByte; - offset = (off_t)fSizeSlider->Offset() * kMegaByte; - - // get name - name.SetTo(fNameTextControl->Text()); - - // get type - if (BMenuItem* item = fTypeMenuField->Menu()->FindMarked()) { - const char* _type; - BMessage* message = item->Message(); - if (!message || message->FindString("type", &_type) < B_OK) - _type = kPartitionTypeBFS; - type << _type; - } - - // get editors parameters - if (fEditor != NULL) { - if (fEditor->FinishedEditing()) { - status_t status = fEditor->GetParameters(¶meters); - if (status != B_OK) - fReturnValue = status; - } - } - } - - int32 value = fReturnValue; - - Quit(); - // NOTE: this object is toast now! - - return value; -} - - -void -CreateParamsPanel::Cancel() -{ - fReturnValue = GO_CANCELED; - release_sem(fExitSemaphore); -} - - -void -CreateParamsPanel::_CreateViewControls(BPartition* parent, off_t offset, - off_t size) -{ - // Setup the controls - fSizeSlider = new SizeSlider("Slider", B_TRANSLATE("Partition size"), NULL, - offset, offset + size); - fSizeSlider->SetPosition(1.0); - fSizeSlider->SetModificationMessage(new BMessage(MSG_SIZE_SLIDER)); - - fSizeTextControl = new BTextControl("Size Control", "", "", NULL); - for(int32 i = 0; i < 256; i++) - fSizeTextControl->TextView()->DisallowChar(i); - for(int32 i = '0'; i <= '9'; i++) - fSizeTextControl->TextView()->AllowChar(i); - _UpdateSizeTextControl(); - fSizeTextControl->SetModificationMessage( - new BMessage(MSG_SIZE_TEXTCONTROL)); - - fNameTextControl = new BTextControl("Name Control", - B_TRANSLATE("Partition name:"), "", NULL); - if (!parent->SupportsChildName()) - fNameTextControl->SetEnabled(false); - - fTypePopUpMenu = new BPopUpMenu("Partition Type"); - - int32 cookie = 0; - BString supportedType; - while (parent->GetNextSupportedChildType(&cookie, &supportedType) - == B_OK) { - BMessage* message = new BMessage(MSG_PARTITION_TYPE); - message->AddString("type", supportedType); - BMenuItem* item = new BMenuItem(supportedType, message); - fTypePopUpMenu->AddItem(item); - - if (strcmp(supportedType, kPartitionTypeBFS) == 0) - item->SetMarked(true); - } - - fTypeMenuField = new BMenuField(B_TRANSLATE("Partition type:"), - fTypePopUpMenu); - - const float spacing = be_control_look->DefaultItemSpacing(); - BGroupLayout* layout = new BGroupLayout(B_VERTICAL, spacing); - layout->SetInsets(spacing, spacing, spacing, spacing); - - SetLayout(layout); - - AddChild(BGroupLayoutBuilder(B_VERTICAL, spacing) - .Add(fSizeSlider) - .Add(fSizeTextControl) - .Add(BGridLayoutBuilder(0.0, 5.0) - .Add(fNameTextControl->CreateLabelLayoutItem(), 0, 0) - .Add(fNameTextControl->CreateTextViewLayoutItem(), 1, 0) - .Add(fTypeMenuField->CreateLabelLayoutItem(), 0, 1) - .Add(fTypeMenuField->CreateMenuBarLayoutItem(), 1, 1) - ) - ); - - status_t err = parent->GetParameterEditor(B_CREATE_PARAMETER_EDITOR, - &fEditor); - if (err == B_OK && fEditor != NULL) - AddChild(fEditor->View()); - else - fEditor = NULL; - - BButton* okButton = new BButton(B_TRANSLATE("Create"), - new BMessage(MSG_OK)); - AddChild(BGroupLayoutBuilder(B_HORIZONTAL, spacing) - .AddGlue() - .Add(new BButton(B_TRANSLATE("Cancel"), new BMessage(MSG_CANCEL))) - .Add(okButton) - ); - SetDefaultButton(okButton); - - AddToSubset(fWindow); - layout->View()->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); -} - - -void -CreateParamsPanel::_UpdateSizeTextControl() -{ - BString sizeString; - sizeString << fSizeSlider->Value() - fSizeSlider->Offset(); - fSizeTextControl->SetText(sizeString.String()); -} diff --git a/src/apps/drivesetup/DiskView.cpp b/src/apps/drivesetup/DiskView.cpp index 7dd0df5657..02e8872ed0 100644 --- a/src/apps/drivesetup/DiskView.cpp +++ b/src/apps/drivesetup/DiskView.cpp @@ -202,7 +202,13 @@ public: virtual bool Visit(BDiskDevice* device) { - PartitionView* view = new PartitionView(B_TRANSLATE("Device"), 1.0, + const char* name; + if (device->Name() != NULL && device->Name()[0] != '\0') + name = device->Name(); + else + name = B_TRANSLATE("Device"); + + PartitionView* view = new PartitionView(name, 1.0, device->Offset(), 0, device->ID()); fViewMap.Put(device->ID(), view); fView->GetLayout()->AddView(view); diff --git a/src/apps/drivesetup/DriveSetup.cpp b/src/apps/drivesetup/DriveSetup.cpp index bff334f172..e3220c1ece 100644 --- a/src/apps/drivesetup/DriveSetup.cpp +++ b/src/apps/drivesetup/DriveSetup.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 Haiku Inc. All rights reserved. + * Copyright 2002-2013 Haiku Inc. All rights reserved. * Distributed under the terms of the MIT license. * * Authors: @@ -36,7 +36,7 @@ DriveSetup::~DriveSetup() void DriveSetup::ReadyToRun() { - fWindow = new MainWindow(BRect(50, 50, 600, 450)); + fWindow = new MainWindow(); if (_RestoreSettings() != B_OK) fWindow->ApplyDefaultSettings(); fWindow->Show(); diff --git a/src/apps/drivesetup/InitParametersPanel.cpp b/src/apps/drivesetup/InitParametersPanel.cpp new file mode 100644 index 0000000000..c047bb27e2 --- /dev/null +++ b/src/apps/drivesetup/InitParametersPanel.cpp @@ -0,0 +1,56 @@ +/* + * Copyright 2008-2013 Haiku, Inc. All rights reserved. + * Distributed under the terms of the MIT license. + * + * Authors: + * Stephan Aßmus + * Axel Dörfler, axeld@pinc-software.de. + * Karsten Heimrich. + */ + + +#include "InitParametersPanel.h" + +#include +#include + +#include +#include + + +#undef B_TRANSLATION_CONTEXT +#define B_TRANSLATION_CONTEXT "InitializeParametersPanel" + + +InitParametersPanel::InitParametersPanel(BWindow* window, + const BString& diskSystem, BPartition* partition) + : + AbstractParametersPanel(window) +{ + Init(B_INITIALIZE_PARAMETER_EDITOR, diskSystem, partition); + + fOkButton->SetLabel(B_TRANSLATE("Initialize")); +} + + +InitParametersPanel::~InitParametersPanel() +{ +} + + +status_t +InitParametersPanel::Go(BString& name, BString& parameters) +{ + status_t status = AbstractParametersPanel::Go(parameters); + if (status == B_OK) { + void* handle = parse_driver_settings_string(parameters.String()); + if (handle != NULL) { + const char* string = get_driver_parameter(handle, "name", + NULL, NULL); + name.SetTo(string); + delete_driver_settings(handle); + } + } + + return status; +} diff --git a/src/apps/drivesetup/InitParametersPanel.h b/src/apps/drivesetup/InitParametersPanel.h new file mode 100644 index 0000000000..338eac9481 --- /dev/null +++ b/src/apps/drivesetup/InitParametersPanel.h @@ -0,0 +1,27 @@ +/* + * Copyright 2008-2013 Haiku, Inc. All rights reserved. + * Distributed under the terms of the MIT license. + * + * Authors: + * Stephan Aßmus + * Axel Dörfler, axeld@pinc-software.de. + */ +#ifndef INIT_PARAMETERS_PANEL_H +#define INIT_PARAMETERS_PANEL_H + + +#include "AbstractParametersPanel.h" + + +class InitParametersPanel : public AbstractParametersPanel { +public: + InitParametersPanel(BWindow* window, + const BString& diskSystem, + BPartition* partition); + virtual ~InitParametersPanel(); + + status_t Go(BString& name, BString& parameters); +}; + + +#endif // INIT_PARAMETERS_PANEL_H diff --git a/src/apps/drivesetup/InitParamsPanel.cpp b/src/apps/drivesetup/InitParamsPanel.cpp deleted file mode 100644 index 6c2f9de90a..0000000000 --- a/src/apps/drivesetup/InitParamsPanel.cpp +++ /dev/null @@ -1,249 +0,0 @@ -/* - * Copyright 2008-2010 Haiku Inc. All rights reserved. - * Distributed under the terms of the MIT license. - * - * Authors: - * Stephan Aßmus - * Karsten Heimrich. - */ - - -#include "InitParamsPanel.h" - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -#undef B_TRANSLATION_CONTEXT -#define B_TRANSLATION_CONTEXT "InitParamsPanel" - - -class InitParamsPanel::EscapeFilter : public BMessageFilter { -public: - EscapeFilter(InitParamsPanel* target) - : - BMessageFilter(B_ANY_DELIVERY, B_ANY_SOURCE), - fPanel(target) - { - } - - virtual ~EscapeFilter() - { - } - - virtual filter_result Filter(BMessage* message, BHandler** target) - { - filter_result result = B_DISPATCH_MESSAGE; - switch (message->what) { - case B_KEY_DOWN: - case B_UNMAPPED_KEY_DOWN: { - uint32 key; - if (message->FindInt32("raw_char", (int32*)&key) >= B_OK) { - if (key == B_ESCAPE) { - result = B_SKIP_MESSAGE; - fPanel->Cancel(); - } - } - break; - } - default: - break; - } - return result; - } - -private: - InitParamsPanel* fPanel; -}; - - -// #pragma mark - - - -// TODO: MSG_NAME_CHANGED is shared with the disk system add-ons, so it should -// be in some private shared header. -// TODO: there is already B_CANCEL, why not use that one? -enum { - MSG_OK = 'okok', - MSG_CANCEL = 'cncl', - MSG_NAME_CHANGED = 'nmch' -}; - - -InitParamsPanel::InitParamsPanel(BWindow* window, const BString& diskSystem, - BPartition* partition) - : - BWindow(BRect(300.0, 200.0, 600.0, 300.0), 0, B_MODAL_WINDOW_LOOK, - B_MODAL_SUBSET_WINDOW_FEEL, - B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS), - fEscapeFilter(new EscapeFilter(this)), - fExitSemaphore(create_sem(0, "InitParamsPanel exit")), - fWindow(window), - fReturnValue(GO_CANCELED) -{ - AddCommonFilter(fEscapeFilter); - - fOkButton = new BButton(B_TRANSLATE("Initialize"), new BMessage(MSG_OK)); - - DiskSystemAddOnManager* manager = DiskSystemAddOnManager::Default(); - BDiskSystemAddOn* addOn = manager->GetAddOn(diskSystem); - if (addOn) { - // put the add-on - manager->PutAddOn(addOn); - - status_t err = addOn->GetParameterEditor(B_INITIALIZE_PARAMETER_EDITOR, &fEditor); - if (err != B_OK) { - fEditor = NULL; - } - } else { - fEditor = NULL; - } - - // TODO: fEditor should be checked for NULL before adding. - SetLayout(new BGroupLayout(B_HORIZONTAL)); - const float spacing = be_control_look->DefaultItemSpacing(); - AddChild(BGroupLayoutBuilder(B_VERTICAL, spacing) - .Add(fEditor->View()) - .AddGroup(B_HORIZONTAL, spacing) - .AddGlue() - .Add(new BButton(B_TRANSLATE("Cancel"), new BMessage(MSG_CANCEL))) - .Add(fOkButton) - .End() - .SetInsets(spacing, spacing, spacing, spacing) - ); - - SetDefaultButton(fOkButton); - - // If the partition had a previous name, set to that name. - BString name = partition->ContentName(); - if (name.Length() > 0) - fEditor->PartitionNameChanged(name.String()); - - AddToSubset(fWindow); -} - - -InitParamsPanel::~InitParamsPanel() -{ - RemoveCommonFilter(fEscapeFilter); - delete fEscapeFilter; - - delete_sem(fExitSemaphore); -} - - -bool -InitParamsPanel::QuitRequested() -{ - release_sem(fExitSemaphore); - return false; -} - - -void -InitParamsPanel::MessageReceived(BMessage* message) -{ - switch (message->what) { - case MSG_CANCEL: - Cancel(); - break; - - case MSG_OK: - fReturnValue = GO_SUCCESS; - release_sem(fExitSemaphore); - break; - - case MSG_NAME_CHANGED: - // message comes from fEditor's BTextControl - BTextControl* control; - if (message->FindPointer("source", (void**)&control) != B_OK) - break; - if (control->TextView()->TextLength() == 0 - && fOkButton->IsEnabled()) - fOkButton->SetEnabled(false); - else if (control->TextView()->TextLength() > 0 - && !fOkButton->IsEnabled()) - fOkButton->SetEnabled(true); - break; - - default: - BWindow::MessageReceived(message); - } -} - - -int32 -InitParamsPanel::Go(BString& name, BString& parameters) -{ - // run the window thread, to get an initial layout of the controls - Hide(); - Show(); - if (!Lock()) - return GO_CANCELED; - - // center the panel above the parent window - CenterIn(fWindow->Frame()); - - Show(); - Unlock(); - - // block this thread now, but keep the window repainting - while (true) { - status_t err = acquire_sem_etc(fExitSemaphore, 1, - B_CAN_INTERRUPT | B_RELATIVE_TIMEOUT, 50000); - if (err != B_TIMED_OUT && err != B_INTERRUPTED) - break; - fWindow->UpdateIfNeeded(); - } - - if (!Lock()) - return GO_CANCELED; - - if (fEditor == NULL) - fReturnValue = B_BAD_VALUE; - - if (fReturnValue == GO_SUCCESS) { - if (fEditor->FinishedEditing()) { - status_t err = fEditor->GetParameters(¶meters); - if (err == B_OK) { - void* handle = parse_driver_settings_string( - parameters.String()); - if (handle != NULL) { - const char* string = get_driver_parameter(handle, "name", - NULL, NULL); - name.SetTo(string); - delete_driver_settings(handle); - } - } else - fReturnValue = err; - } - } - - int32 value = fReturnValue; - - Quit(); - // NOTE: this object is toast now! - - return value; -} - - -void -InitParamsPanel::Cancel() -{ - fReturnValue = GO_CANCELED; - release_sem(fExitSemaphore); -} diff --git a/src/apps/drivesetup/InitParamsPanel.h b/src/apps/drivesetup/InitParamsPanel.h deleted file mode 100644 index 98b1022446..0000000000 --- a/src/apps/drivesetup/InitParamsPanel.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2008 Haiku Inc. All rights reserved. - * Distributed under the terms of the MIT license. - * - * Authors: - * Stephan Aßmus - */ -#ifndef INIT_PARAMS_PANEL_H -#define INIT_PARAMS_PANEL_H - -#include "Support.h" - -#include -#include -#include - -class BMenuField; -class BTextControl; - - -class InitParamsPanel : public BWindow { -public: - InitParamsPanel(BWindow* window, - const BString& diskSystem, - BPartition* partition); - virtual ~InitParamsPanel(); - - virtual bool QuitRequested(); - virtual void MessageReceived(BMessage* message); - - int32 Go(BString& name, BString& parameters); - void Cancel(); - -private: - class EscapeFilter; - EscapeFilter* fEscapeFilter; - sem_id fExitSemaphore; - BWindow* fWindow; - BButton* fOkButton; - int32 fReturnValue; - - BPartitionParameterEditor* fEditor; -}; - -#endif // INIT_PARAMS_PANEL_H diff --git a/src/apps/drivesetup/Jamfile b/src/apps/drivesetup/Jamfile index 1e9b483d77..b288480126 100644 --- a/src/apps/drivesetup/Jamfile +++ b/src/apps/drivesetup/Jamfile @@ -5,10 +5,11 @@ AddSubDirSupportedPlatforms libbe_test ; UsePrivateHeaders interface shared storage tracker ; Preference DriveSetup : - CreateParamsPanel.cpp + AbstractParametersPanel.cpp + CreateParametersPanel.cpp DiskView.cpp DriveSetup.cpp - InitParamsPanel.cpp + InitParametersPanel.cpp MainWindow.cpp PartitionList.cpp Support.cpp @@ -21,9 +22,10 @@ Preference DriveSetup : DoCatalogs DriveSetup : x-vnd.Haiku-DriveSetup : - CreateParamsPanel.cpp + AbstractParametersPanel.cpp + CreateParametersPanel.cpp DiskView.cpp - InitParamsPanel.cpp + InitParametersPanel.cpp MainWindow.cpp PartitionList.cpp Support.cpp diff --git a/src/apps/drivesetup/MainWindow.cpp b/src/apps/drivesetup/MainWindow.cpp index f97a8696a5..6376e88bc1 100644 --- a/src/apps/drivesetup/MainWindow.cpp +++ b/src/apps/drivesetup/MainWindow.cpp @@ -1,14 +1,16 @@ /* - * Copyright 2002-2010 Haiku Inc. All rights reserved. + * Copyright 2002-2013 Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT license. * * Authors: - * Erik Jaesler * Ithamar R. Adema - * Ingo Weinhold * Stephan Aßmus + * Axel Dörfler, axeld@pinc-software.de. + * Erik Jaesler + * Ingo Weinhold */ + #include "MainWindow.h" #include @@ -36,12 +38,13 @@ #include #include -#include "CreateParamsPanel.h" +#include + +#include "CreateParametersPanel.h" #include "DiskView.h" -#include "InitParamsPanel.h" +#include "InitParametersPanel.h" #include "PartitionList.h" #include "Support.h" -#include "tracker_private.h" #undef B_TRANSLATION_CONTEXT @@ -140,6 +143,38 @@ private: }; +class ModificationPreparer { +public: + ModificationPreparer(BDiskDevice* disk) + : + fDisk(disk), + fModificationStatus(fDisk->PrepareModifications()) + { + } + ~ModificationPreparer() + { + if (fModificationStatus == B_OK) + fDisk->CancelModifications(); + } + status_t ModificationStatus() const + { + return fModificationStatus; + } + status_t CommitModifications() + { + status_t ret = fDisk->CommitModifications(); + if (ret == B_OK) + fModificationStatus = B_ERROR; + + return ret; + } + +private: + BDiskDevice* fDisk; + status_t fModificationStatus; +}; + + enum { MSG_MOUNT_ALL = 'mnta', MSG_MOUNT = 'mnts', @@ -159,10 +194,10 @@ enum { // #pragma mark - -MainWindow::MainWindow(BRect frame) +MainWindow::MainWindow() : - BWindow(frame, B_TRANSLATE_SYSTEM_NAME("DriveSetup"), B_DOCUMENT_WINDOW, - B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE), + BWindow(BRect(50, 50, 600, 500), B_TRANSLATE_SYSTEM_NAME("DriveSetup"), + B_DOCUMENT_WINDOW, B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE), fCurrentDisk(NULL), fCurrentPartitionID(-1), fSpaceIDMap() @@ -170,59 +205,60 @@ MainWindow::MainWindow(BRect frame) BMenuBar* menuBar = new BMenuBar(Bounds(), "root menu"); // create all the menu items - fWipeMI = new BMenuItem(B_TRANSLATE("Wipe (not implemented)"), + fWipeMenuItem = new BMenuItem(B_TRANSLATE("Wipe (not implemented)"), new BMessage(MSG_FORMAT)); - fEjectMI = new BMenuItem(B_TRANSLATE("Eject"), + fEjectMenuItem = new BMenuItem(B_TRANSLATE("Eject"), new BMessage(MSG_EJECT), 'E'); - fSurfaceTestMI = new BMenuItem( + fSurfaceTestMenuItem = new BMenuItem( B_TRANSLATE("Surface test (not implemented)"), new BMessage(MSG_SURFACE_TEST)); - fRescanMI = new BMenuItem(B_TRANSLATE("Rescan"), new BMessage(MSG_RESCAN)); + fRescanMenuItem = new BMenuItem(B_TRANSLATE("Rescan"), + new BMessage(MSG_RESCAN)); - fCreateMI = new BMenuItem(B_TRANSLATE("Create" B_UTF8_ELLIPSIS), + fCreateMenuItem = new BMenuItem(B_TRANSLATE("Create" B_UTF8_ELLIPSIS), new BMessage(MSG_CREATE), 'C'); - fDeleteMI = new BMenuItem(B_TRANSLATE("Delete"), + fDeleteMenuItem = new BMenuItem(B_TRANSLATE("Delete"), new BMessage(MSG_DELETE), 'D'); - fMountMI = new BMenuItem(B_TRANSLATE("Mount"), + fMountMenuItem = new BMenuItem(B_TRANSLATE("Mount"), new BMessage(MSG_MOUNT), 'M'); - fUnmountMI = new BMenuItem(B_TRANSLATE("Unmount"), + fUnmountMenuItem = new BMenuItem(B_TRANSLATE("Unmount"), new BMessage(MSG_UNMOUNT), 'U'); - fMountAllMI = new BMenuItem(B_TRANSLATE("Mount all"), + fMountAllMenuItem = new BMenuItem(B_TRANSLATE("Mount all"), new BMessage(MSG_MOUNT_ALL), 'M', B_SHIFT_KEY); // Disk menu fDiskMenu = new BMenu(B_TRANSLATE("Disk")); - // fDiskMenu->AddItem(fWipeMI); + // fDiskMenu->AddItem(fWipeMenuItem); fDiskInitMenu = new BMenu(B_TRANSLATE("Initialize")); fDiskMenu->AddItem(fDiskInitMenu); fDiskMenu->AddSeparatorItem(); - fDiskMenu->AddItem(fEjectMI); - // fDiskMenu->AddItem(fSurfaceTestMI); - fDiskMenu->AddItem(fRescanMI); + fDiskMenu->AddItem(fEjectMenuItem); + // fDiskMenu->AddItem(fSurfaceTestMenuItem); + fDiskMenu->AddItem(fRescanMenuItem); menuBar->AddItem(fDiskMenu); // Parition menu fPartitionMenu = new BMenu(B_TRANSLATE("Partition")); - fPartitionMenu->AddItem(fCreateMI); + fPartitionMenu->AddItem(fCreateMenuItem); fFormatMenu = new BMenu(B_TRANSLATE("Format")); fPartitionMenu->AddItem(fFormatMenu); - fPartitionMenu->AddItem(fDeleteMI); + fPartitionMenu->AddItem(fDeleteMenuItem); fPartitionMenu->AddSeparatorItem(); - fPartitionMenu->AddItem(fMountMI); - fPartitionMenu->AddItem(fUnmountMI); + fPartitionMenu->AddItem(fMountMenuItem); + fPartitionMenu->AddItem(fUnmountMenuItem); fPartitionMenu->AddSeparatorItem(); - fPartitionMenu->AddItem(fMountAllMI); + fPartitionMenu->AddItem(fMountAllMenuItem); menuBar->AddItem(fPartitionMenu); AddChild(menuBar); @@ -405,17 +441,26 @@ MainWindow::ApplyDefaultSettings() fListView->ResizeAllColumnsToPreferred(); // Adjust window size for convenience - float enlargeBy = fListView->PreferredSize().width + BScreen screen(this); + float windowWidth = Frame().Width(); + float windowHeight = Frame().Height(); + + float enlargeWidthBy = fListView->PreferredSize().width - fListView->Bounds().Width(); - if (enlargeBy > 0.0f) { - BScreen screen(this); - float windowWidth = Frame().Width() + enlargeBy; - if (windowWidth > screen.Frame().Width() - 20.0f) - windowWidth = screen.Frame().Width() - 20.0f; + float enlargeHeightBy = fListView->PreferredSize().height + - fListView->Bounds().Height(); - ResizeTo(windowWidth, Frame().Height()); - } + if (enlargeWidthBy > 0.0f) + windowWidth += enlargeWidthBy; + if (enlargeHeightBy > 0.0f) + windowHeight += enlargeHeightBy; + if (windowWidth > screen.Frame().Width() - 20.0f) + windowWidth = screen.Frame().Width() - 20.0f; + if (windowHeight > screen.Frame().Height() - 20.0f) + windowHeight = screen.Frame().Height() - 20.0f; + + ResizeTo(windowWidth, windowHeight); CenterOnScreen(); Unlock(); @@ -523,21 +568,21 @@ MainWindow::_UpdateMenus(BDiskDevice* disk, while (BMenuItem* item = fDiskInitMenu->RemoveItem((int32)0)) delete item; - fCreateMI->SetEnabled(false); - fUnmountMI->SetEnabled(false); + fCreateMenuItem->SetEnabled(false); + fUnmountMenuItem->SetEnabled(false); fDiskInitMenu->SetEnabled(false); fFormatMenu->SetEnabled(false); if (!disk) { - fWipeMI->SetEnabled(false); - fEjectMI->SetEnabled(false); - fSurfaceTestMI->SetEnabled(false); + fWipeMenuItem->SetEnabled(false); + fEjectMenuItem->SetEnabled(false); + fSurfaceTestMenuItem->SetEnabled(false); } else { -// fWipeMI->SetEnabled(true); - fWipeMI->SetEnabled(false); - fEjectMI->SetEnabled(disk->IsRemovableMedia()); -// fSurfaceTestMI->SetEnabled(true); - fSurfaceTestMI->SetEnabled(false); +// fWipeMenuItem->SetEnabled(true); + fWipeMenuItem->SetEnabled(false); + fEjectMenuItem->SetEnabled(disk->IsRemovableMedia()); +// fSurfaceTestMenuItem->SetEnabled(true); + fSurfaceTestMenuItem->SetEnabled(false); // Create menu and items BPartition* parentPartition = NULL; @@ -547,11 +592,11 @@ MainWindow::_UpdateMenus(BDiskDevice* disk, } if (parentPartition && parentPartition->ContainsPartitioningSystem()) - fCreateMI->SetEnabled(true); + fCreateMenuItem->SetEnabled(true); bool prepared = disk->PrepareModifications() == B_OK; fFormatMenu->SetEnabled(prepared); - fDeleteMI->SetEnabled(prepared); + fDeleteMenuItem->SetEnabled(prepared); BPartition* partition = disk->FindDescendant(selectedPartition); @@ -584,7 +629,7 @@ MainWindow::_UpdateMenus(BDiskDevice* disk, } // Mount items - if (partition) { + if (partition != NULL) { fFormatMenu->SetEnabled(!partition->IsMounted() && !partition->IsReadOnly() && partition->Device()->HasMedia() @@ -596,10 +641,10 @@ MainWindow::_UpdateMenus(BDiskDevice* disk, && partition->IsDevice() && fDiskInitMenu->CountItems() > 0); - fDeleteMI->SetEnabled(!partition->IsMounted() + fDeleteMenuItem->SetEnabled(!partition->IsMounted() && !partition->IsDevice()); - fMountMI->SetEnabled(!partition->IsMounted()); + fMountMenuItem->SetEnabled(!partition->IsMounted()); bool unMountable = false; if (partition->IsMounted()) { @@ -612,10 +657,10 @@ MainWindow::_UpdateMenus(BDiskDevice* disk, } else unMountable = true; } - fUnmountMI->SetEnabled(unMountable); + fUnmountMenuItem->SetEnabled(unMountable); } else { - fDeleteMI->SetEnabled(false); - fMountMI->SetEnabled(false); + fDeleteMenuItem->SetEnabled(false); + fMountMenuItem->SetEnabled(false); fFormatMenu->SetEnabled(false); fDiskInitMenu->SetEnabled(false); } @@ -623,11 +668,11 @@ MainWindow::_UpdateMenus(BDiskDevice* disk, if (prepared) disk->CancelModifications(); - fMountAllMI->SetEnabled(true); + fMountAllMenuItem->SetEnabled(true); } if (selectedPartition < 0) { - fDeleteMI->SetEnabled(false); - fMountMI->SetEnabled(false); + fDeleteMenuItem->SetEnabled(false); + fMountMenuItem->SetEnabled(false); } } @@ -746,38 +791,6 @@ MainWindow::_MountAll() // #pragma mark - -class ModificationPreparer { -public: - ModificationPreparer(BDiskDevice* disk) - : - fDisk(disk), - fModificationStatus(fDisk->PrepareModifications()) - { - } - ~ModificationPreparer() - { - if (fModificationStatus == B_OK) - fDisk->CancelModifications(); - } - status_t ModificationStatus() const - { - return fModificationStatus; - } - status_t CommitModifications() - { - status_t ret = fDisk->CommitModifications(); - if (ret == B_OK) - fModificationStatus = B_ERROR; - - return ret; - } - -private: - BDiskDevice* fDisk; - status_t fModificationStatus; -}; - - void MainWindow::_Initialize(BDiskDevice* disk, partition_id selectedPartition, const BString& diskSystemName) @@ -870,19 +883,10 @@ MainWindow::_Initialize(BDiskDevice* disk, partition_id selectedPartition, BString name; BString parameters; - - // TODO: diskSystem.IsFileSystem() seems like a better fit here? - if (diskSystemName == "Be File System" - || diskSystemName == "NT File System") { - InitParamsPanel* panel = new InitParamsPanel(this, diskSystemName, - partition); - if (panel->Go(name, parameters) == GO_CANCELED) - return; - } else if (diskSystemName == "Intel Partition Map") { - // TODO: parameters? - } else if (diskSystemName == "Intel Extended Partition") { - // TODO: parameters? - } + InitParametersPanel* panel = new InitParametersPanel(this, diskSystemName, + partition); + if (panel->Go(name, parameters) != B_OK) + return; bool supportsName = diskSystem.SupportsContentName(); BString validatedName(name); @@ -1034,9 +1038,9 @@ MainWindow::_Create(BDiskDevice* disk, partition_id selectedPartition) off_t offset = currentSelection->Offset(); off_t size = currentSelection->Size(); - CreateParamsPanel* panel = new CreateParamsPanel(this, parent, offset, - size); - if (panel->Go(offset, size, name, type, parameters) == GO_CANCELED) + CreateParametersPanel* panel = new CreateParametersPanel(this, parent, + offset, size); + if (panel->Go(offset, size, name, type, parameters) != B_OK) return; ret = parent->ValidateCreateChild(&offset, &size, type.String(), @@ -1065,7 +1069,7 @@ MainWindow::_Create(BDiskDevice* disk, partition_id selectedPartition) if (ret != B_OK) { _DisplayPartitionError(B_TRANSLATE("Creation of the partition has " - "failed.")); + "failed."), NULL, ret); return; } @@ -1074,7 +1078,7 @@ MainWindow::_Create(BDiskDevice* disk, partition_id selectedPartition) if (ret != B_OK) { _DisplayPartitionError(B_TRANSLATE("Failed to format the " - "partition. No changes have been written to disk.")); + "partition. No changes have been written to disk."), NULL, ret); return; } @@ -1144,7 +1148,7 @@ MainWindow::_Delete(BDiskDevice* disk, partition_id selectedPartition) ret = parent->DeleteChild(partition->Index()); if (ret != B_OK) { _DisplayPartitionError( - B_TRANSLATE("Could not delete the selected partition.")); + B_TRANSLATE("Could not delete the selected partition."), NULL, ret); return; } @@ -1152,7 +1156,7 @@ MainWindow::_Delete(BDiskDevice* disk, partition_id selectedPartition) if (ret != B_OK) { _DisplayPartitionError(B_TRANSLATE("Failed to delete the partition. " - "No changes have been written to disk.")); + "No changes have been written to disk."), NULL, ret); return; } diff --git a/src/apps/drivesetup/MainWindow.h b/src/apps/drivesetup/MainWindow.h index 24d0e44b88..26c7df420b 100644 --- a/src/apps/drivesetup/MainWindow.h +++ b/src/apps/drivesetup/MainWindow.h @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 Haiku Inc. All rights reserved. + * Copyright 2002-2013 Haiku Inc. All rights reserved. * Distributed under the terms of the MIT license. * * Authors: @@ -31,7 +31,7 @@ enum { class MainWindow : public BWindow { public: - MainWindow(BRect frame); + MainWindow(); virtual ~MainWindow(); // BWindow interface @@ -88,16 +88,16 @@ private: BMenu* fPartitionMenu; BMenu* fFormatMenu; - BMenuItem* fWipeMI; - BMenuItem* fEjectMI; - BMenuItem* fSurfaceTestMI; - BMenuItem* fRescanMI; + BMenuItem* fWipeMenuItem; + BMenuItem* fEjectMenuItem; + BMenuItem* fSurfaceTestMenuItem; + BMenuItem* fRescanMenuItem; - BMenuItem* fCreateMI; - BMenuItem* fDeleteMI; - BMenuItem* fMountMI; - BMenuItem* fUnmountMI; - BMenuItem* fMountAllMI; + BMenuItem* fCreateMenuItem; + BMenuItem* fDeleteMenuItem; + BMenuItem* fMountMenuItem; + BMenuItem* fUnmountMenuItem; + BMenuItem* fMountAllMenuItem; }; diff --git a/src/apps/drivesetup/PartitionList.cpp b/src/apps/drivesetup/PartitionList.cpp index 898e3569b8..04246ed2a7 100644 --- a/src/apps/drivesetup/PartitionList.cpp +++ b/src/apps/drivesetup/PartitionList.cpp @@ -1,13 +1,15 @@ /* - * Copyright 2006-2012 Haiku Inc. All rights reserved. + * Copyright 2006-2013, Haiku Inc. All rights reserved. * Distributed under the terms of the MIT license. * * Authors: * Ithamar R. Adema * James Urquhart * Stephan Aßmus + * Axel Dörfler, axeld@pinc-software.de */ + #include "PartitionList.h" #include @@ -24,6 +26,19 @@ #define B_TRANSLATION_CONTEXT "PartitionList" +static const char* kUnavailableString = ""; + +enum { + kDeviceColumn, + kFilesystemColumn, + kVolumeNameColumn, + kMountedAtColumn, + kSizeColumn, + kParametersColumn, + kPartitionTypeColumn, +}; + + // #pragma mark - BBitmapStringField @@ -179,18 +194,6 @@ PartitionColumn::InitTextMargin(BView* parent) // #pragma mark - PartitionListRow -static const char* kUnavailableString = ""; - -enum { - kDeviceColumn, - kFilesystemColumn, - kVolumeNameColumn, - kMountedAtColumn, - kSizeColumn, - kParametersColumn -}; - - PartitionListRow::PartitionListRow(BPartition* partition) : Inherited(), @@ -218,20 +221,21 @@ PartitionListRow::PartitionListRow(BPartition* partition) // File system & volume name + BString partitionType(partition->Type()); + if (partition->ContainsFileSystem()) { SetField(new BStringField(partition->ContentType()), kFilesystemColumn); SetField(new BStringField(partition->ContentName()), kVolumeNameColumn); } else if (partition->IsDevice()) { + SetField(new BStringField(kUnavailableString), kFilesystemColumn); if (partition->Name() != NULL && partition->Name()[0]) SetField(new BStringField(partition->Name()), kVolumeNameColumn); else SetField(new BStringField(kUnavailableString), kVolumeNameColumn); - SetField(new BStringField(kUnavailableString), kFilesystemColumn); } else if (partition->CountChildren() > 0) { SetField(new BStringField(kUnavailableString), kFilesystemColumn); SetField(new BStringField(kUnavailableString), kVolumeNameColumn); } else { - BString partitionType(partition->Type()); if (!partitionType.IsEmpty()) { partitionType.Prepend("("); partitionType.Append(")"); @@ -251,9 +255,13 @@ PartitionListRow::PartitionListRow(BPartition* partition) // Size - char size[1024]; - SetField(new BStringField(string_for_size(partition->Size(), size, - sizeof(size))), kSizeColumn); + if (fSize > 0) { + char size[1024]; + SetField(new BStringField(string_for_size(partition->Size(), size, + sizeof(size))), kSizeColumn); + } else { + SetField(new BStringField(kUnavailableString), kSizeColumn); + } // Additional parameters @@ -274,6 +282,12 @@ PartitionListRow::PartitionListRow(BPartition* partition) } else { SetField(new BStringField(kUnavailableString), kParametersColumn); } + + // Partition type + + if (partitionType.IsEmpty()) + partitionType = partition->ContentType(); + SetField(new BStringField(partitionType), kPartitionTypeColumn); } @@ -329,8 +343,10 @@ PartitionListView::PartitionListView(const BRect& frame, uint32 resizeMode) B_TRUNCATE_MIDDLE), kMountedAtColumn); AddColumn(new PartitionColumn(B_TRANSLATE("Size"), 100, 50, 500, B_TRUNCATE_END, B_ALIGN_RIGHT), kSizeColumn); - AddColumn(new PartitionColumn(B_TRANSLATE("Parameters"), 150, 50, 500, - B_TRUNCATE_MIDDLE), kParametersColumn); + AddColumn(new PartitionColumn(B_TRANSLATE("Parameters"), 100, 50, 500, + B_TRUNCATE_END), kParametersColumn); + AddColumn(new PartitionColumn(B_TRANSLATE("Partition type"), 200, 50, 500, + B_TRUNCATE_END), kPartitionTypeColumn); SetSortingEnabled(false); } @@ -452,6 +468,17 @@ PartitionListView::AddSpace(partition_id parentID, partition_id id, } +BSize +PartitionListView::PreferredSize() +{ + // Remove default size for parameters + partition type column + BSize size = BColumnListView::PreferredSize(); + size.width -= ColumnAt(kParametersColumn)->Width() + + ColumnAt(kPartitionTypeColumn)->Width(); + return size; +} + + int32 PartitionListView::_InsertIndexForOffset(PartitionListRow* parent, off_t offset) const diff --git a/src/apps/drivesetup/PartitionList.h b/src/apps/drivesetup/PartitionList.h index 8ed7952025..acc0374b50 100644 --- a/src/apps/drivesetup/PartitionList.h +++ b/src/apps/drivesetup/PartitionList.h @@ -104,6 +104,8 @@ public: PartitionListRow* AddSpace(partition_id parent, partition_id id, off_t offset, off_t size); + virtual BSize PreferredSize(); + private: int32 _InsertIndexForOffset(PartitionListRow* parent, off_t offset) const; diff --git a/src/apps/drivesetup/Support.h b/src/apps/drivesetup/Support.h index 9314446d67..b7540c6363 100644 --- a/src/apps/drivesetup/Support.h +++ b/src/apps/drivesetup/Support.h @@ -21,11 +21,6 @@ void dump_partition_info(const BPartition* partition); bool is_valid_partitionable_space(size_t size); -enum { - GO_CANCELED = 0, - GO_SUCCESS -}; - static const uint32 kMegaByte = 0x100000; diff --git a/src/apps/readonlybootprompt/BootPrompt.cpp b/src/apps/firstbootprompt/BootPrompt.cpp similarity index 92% rename from src/apps/readonlybootprompt/BootPrompt.cpp rename to src/apps/firstbootprompt/BootPrompt.cpp index 6bda68837c..d25ac66950 100644 --- a/src/apps/readonlybootprompt/BootPrompt.cpp +++ b/src/apps/firstbootprompt/BootPrompt.cpp @@ -28,7 +28,7 @@ main(int, char **) // #pragma mark - -const char* kAppSignature = "application/x-vnd.Haiku-ReadOnlyBootPrompt"; +const char* kAppSignature = "application/x-vnd.Haiku-FirstBootPrompt"; BootPromptApp::BootPromptApp() diff --git a/src/apps/readonlybootprompt/BootPrompt.h b/src/apps/firstbootprompt/BootPrompt.h similarity index 100% rename from src/apps/readonlybootprompt/BootPrompt.h rename to src/apps/firstbootprompt/BootPrompt.h diff --git a/src/apps/firstbootprompt/BootPrompt.rdef b/src/apps/firstbootprompt/BootPrompt.rdef new file mode 100644 index 0000000000..68eb6b1f69 --- /dev/null +++ b/src/apps/firstbootprompt/BootPrompt.rdef @@ -0,0 +1,18 @@ + +resource app_signature "application/x-vnd.Haiku-FirstBootPrompt"; + +resource app_name_catalog_entry "x-vnd.Haiku-FirstBootPrompt:System name:FirstBootPrompt"; + +resource app_version { + major = 1, + middle = 0, + minor = 0, + + variety = B_APPV_BETA, + internal = 0, + + short_info = "FirstBootPrompt", + long_info = "FirstBootPrompt ©2011-2013 The Haiku Project" +}; + +resource app_flags B_EXCLUSIVE_LAUNCH; diff --git a/src/apps/readonlybootprompt/BootPromptWindow.cpp b/src/apps/firstbootprompt/BootPromptWindow.cpp similarity index 99% rename from src/apps/readonlybootprompt/BootPromptWindow.cpp rename to src/apps/firstbootprompt/BootPromptWindow.cpp index f34d3af422..113a7d7fcd 100644 --- a/src/apps/readonlybootprompt/BootPromptWindow.cpp +++ b/src/apps/firstbootprompt/BootPromptWindow.cpp @@ -289,7 +289,7 @@ BootPromptWindow::_UpdateStrings() "strings, but if you like, you can join in the work at " ".\"")); - fDesktopButton->SetLabel(B_TRANSLATE("Desktop (Live-CD)")); + fDesktopButton->SetLabel(B_TRANSLATE("Boot to Desktop")); fInstallerButton->SetLabel(B_TRANSLATE("Run Installer")); fLanguagesLabelView->SetText(B_TRANSLATE("Language")); @@ -316,7 +316,7 @@ BootPromptWindow::_PopulateLanguages() BMessage installedCatalogs; BLocaleRoster::Default()->GetAvailableCatalogs(&installedCatalogs, - "x-vnd.Haiku-ReadOnlyBootPrompt"); + "x-vnd.Haiku-FirstBootPrompt"); BFont font; fLanguagesListView->GetFont(&font); diff --git a/src/apps/readonlybootprompt/BootPromptWindow.h b/src/apps/firstbootprompt/BootPromptWindow.h similarity index 100% rename from src/apps/readonlybootprompt/BootPromptWindow.h rename to src/apps/firstbootprompt/BootPromptWindow.h diff --git a/src/apps/readonlybootprompt/Jamfile b/src/apps/firstbootprompt/Jamfile similarity index 69% rename from src/apps/readonlybootprompt/Jamfile rename to src/apps/firstbootprompt/Jamfile index cc60acc5e8..c0a67929ad 100644 --- a/src/apps/readonlybootprompt/Jamfile +++ b/src/apps/firstbootprompt/Jamfile @@ -1,10 +1,10 @@ -SubDir HAIKU_TOP src apps readonlybootprompt ; +SubDir HAIKU_TOP src apps firstbootprompt ; UsePrivateHeaders interface locale shared ; SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src preferences keymap ] ; -Application ReadOnlyBootPrompt : +Application FirstBootPrompt : BootPrompt.cpp BootPromptWindow.cpp Keymap.cpp @@ -13,8 +13,8 @@ Application ReadOnlyBootPrompt : : BootPrompt.rdef ; -DoCatalogs ReadOnlyBootPrompt : - x-vnd.Haiku-ReadOnlyBootPrompt +DoCatalogs FirstBootPrompt : + x-vnd.Haiku-FirstBootPrompt : BootPrompt.cpp BootPromptWindow.cpp diff --git a/src/apps/readonlybootprompt/BootPrompt.rdef b/src/apps/readonlybootprompt/BootPrompt.rdef deleted file mode 100644 index 93792b1253..0000000000 --- a/src/apps/readonlybootprompt/BootPrompt.rdef +++ /dev/null @@ -1,18 +0,0 @@ - -resource app_signature "application/x-vnd.Haiku-ReadOnlyBootPrompt"; - -resource app_name_catalog_entry "x-vnd.Haiku-ReadOnlyBootPrompt:System name:ReadOnlyBootPrompt"; - -resource app_version { - major = 1, - middle = 0, - minor = 0, - - variety = B_APPV_BETA, - internal = 0, - - short_info = "ReadOnlyBootPrompt", - long_info = "ReadOnlyBootPrompt ©2011 The Haiku Project" -}; - -resource app_flags B_EXCLUSIVE_LAUNCH; diff --git a/src/bin/Jamfile b/src/bin/Jamfile index dccce63da5..4d1f6530bb 100644 --- a/src/bin/Jamfile +++ b/src/bin/Jamfile @@ -274,7 +274,6 @@ SubInclude HAIKU_TOP src bin rmd160 ; SubInclude HAIKU_TOP src bin screen_blanker ; SubInclude HAIKU_TOP src bin screenmode ; SubInclude HAIKU_TOP src bin sharutils ; -SubInclude HAIKU_TOP src bin unrar ; SubInclude HAIKU_TOP src bin writembr ; SubInclude HAIKU_TOP src bin zic ; diff --git a/src/bin/unrar/Jamfile b/src/bin/unrar/Jamfile deleted file mode 100644 index b7a0dce075..0000000000 --- a/src/bin/unrar/Jamfile +++ /dev/null @@ -1,47 +0,0 @@ -SubDir HAIKU_TOP src bin unrar ; - -BinCommand unrar : - rar.cpp - strlist.cpp - strfn.cpp - pathfn.cpp - int64.cpp - savepos.cpp - global.cpp - file.cpp - filefn.cpp - filcreat.cpp - archive.cpp - arcread.cpp - unicode.cpp - system.cpp - isnt.cpp - crypt.cpp - crc.cpp - rawread.cpp - encname.cpp - resource.cpp - match.cpp - timefn.cpp - rdwrfn.cpp - consio.cpp - options.cpp - ulinks.cpp - errhnd.cpp - rarvm.cpp - rijndael.cpp - getbits.cpp - sha1.cpp - extinfo.cpp - extract.cpp - volume.cpp - list.cpp - find.cpp - unpack.cpp - cmddata.cpp - scantree.cpp - filestr.cpp - recvol.cpp - rs.cpp - : be $(TARGET_LIBSUPC++) : unrar.rdef -; diff --git a/src/bin/unrar/arccmt.cpp b/src/bin/unrar/arccmt.cpp deleted file mode 100644 index 6ada2f03c4..0000000000 --- a/src/bin/unrar/arccmt.cpp +++ /dev/null @@ -1,215 +0,0 @@ -bool Archive::GetComment(Array *CmtData,Array *CmtDataW) -{ - if (!MainComment) - return(false); - SaveFilePos SavePos(*this); - - ushort CmtLength; -#ifndef SFX_MODULE - if (OldFormat) - { - Seek(SFXSize+SIZEOF_OLDMHD,SEEK_SET); - CmtLength=GetByte()+(GetByte()<<8); - } - else -#endif - { - if (NewMhd.Flags & MHD_COMMENT) - { - Seek(SFXSize+SIZEOF_MARKHEAD+SIZEOF_NEWMHD,SEEK_SET); - ReadHeader(); - } - else - { - Seek(SFXSize+SIZEOF_MARKHEAD+NewMhd.HeadSize,SEEK_SET); - return(SearchSubBlock(SUBHEAD_TYPE_CMT)!=0 && ReadCommentData(CmtData,CmtDataW)!=0); - } -#ifndef SFX_MODULE - if (CommHead.HeadCRC!=HeaderCRC) - { - Log(FileName,St(MLogCommHead)); - Alarm(); - return(false); - } - CmtLength=CommHead.HeadSize-SIZEOF_COMMHEAD; -#endif - } -#ifndef SFX_MODULE - if (OldFormat && (OldMhd.Flags & MHD_PACK_COMMENT) || !OldFormat && CommHead.Method!=0x30) - { - if (!OldFormat && (CommHead.UnpVer < 15 || CommHead.UnpVer > UNP_VER || CommHead.Method > 0x35)) - return(false); - ComprDataIO DataIO; - Unpack Unpack(&DataIO); - Unpack.Init(); - DataIO.SetTestMode(true); - uint UnpCmtLength; - if (OldFormat) - { -#ifdef NOCRYPT - return(false); -#else - UnpCmtLength=GetByte()+(GetByte()<<8); - CmtLength-=2; - DataIO.SetCmt13Encryption(); -#endif - } - else - UnpCmtLength=CommHead.UnpSize; - DataIO.SetFiles(this,NULL); - DataIO.EnableShowProgress(false); - DataIO.SetPackedSizeToRead(CmtLength); - Unpack.SetDestSize(UnpCmtLength); - Unpack.DoUnpack(CommHead.UnpVer,false); - - if (!OldFormat && ((~DataIO.UnpFileCRC)&0xffff)!=CommHead.CommCRC) - { - Log(FileName,St(MLogCommBrk)); - Alarm(); - return(false); - } - else - { - unsigned char *UnpData; - uint UnpDataSize; - DataIO.GetUnpackedData(&UnpData,&UnpDataSize); - CmtData->Alloc(UnpDataSize); - memcpy(&((*CmtData)[0]),UnpData,UnpDataSize); - } - } - else - { - CmtData->Alloc(CmtLength); - - Read(&((*CmtData)[0]),CmtLength); - if (!OldFormat && CommHead.CommCRC!=(~CRC(0xffffffff,&((*CmtData)[0]),CmtLength)&0xffff)) - { - Log(FileName,St(MLogCommBrk)); - Alarm(); - CmtData->Reset(); - return(false); - } - } -#endif -#if defined(_WIN_32) && !defined(_WIN_CE) - if (CmtData->Size()>0) - { - int CmtSize=CmtData->Size(); - OemToCharBuff((char *)CmtData->Addr(),(char *)CmtData->Addr(),CmtSize); - - if (CmtDataW!=NULL) - { - CmtDataW->Alloc(CmtSize+1); - CmtData->Push(0); - CharToWide((char *)CmtData->Addr(),CmtDataW->Addr(),CmtSize+1); - CmtData->Alloc(CmtSize); - CmtDataW->Alloc(strlenw(CmtDataW->Addr())); - } - } -#endif - return(CmtData->Size()>0); -} - - -int Archive::ReadCommentData(Array *CmtData,Array *CmtDataW) -{ - bool Unicode=SubHead.SubFlags & SUBHEAD_FLAGS_CMT_UNICODE; - if (!ReadSubData(CmtData,NULL)) - return(0); - int CmtSize=CmtData->Size(); - if (Unicode) - { - CmtSize/=2; - Array DataW(CmtSize+1); - RawToWide(CmtData->Addr(),DataW.Addr(),CmtSize); - DataW[CmtSize]=0; - int DestSize=CmtSize*4; - CmtData->Alloc(DestSize+1); - WideToChar(DataW.Addr(),(char *)CmtData->Addr(),DestSize); - (*CmtData)[DestSize]=0; - CmtSize=strlen((char *)CmtData->Addr()); - CmtData->Alloc(CmtSize); - if (CmtDataW!=NULL) - { - *CmtDataW=DataW; - CmtDataW->Alloc(CmtSize); - } - } - else - if (CmtDataW!=NULL) - { - CmtData->Push(0); - CmtDataW->Alloc(CmtSize+1); - CharToWide((char *)CmtData->Addr(),CmtDataW->Addr(),CmtSize+1); - CmtData->Alloc(CmtSize); - CmtDataW->Alloc(strlenw(CmtDataW->Addr())); - } - return(CmtSize); -} - - -void Archive::ViewComment() -{ -#ifndef GUI - if (Cmd->DisableComment) - return; - Array CmtBuf; - if (GetComment(&CmtBuf,NULL)) - { - int CmtSize=CmtBuf.Size(); - char *ChPtr=(char *)memchr(&CmtBuf[0],0x1A,CmtSize); - if (ChPtr!=NULL) - CmtSize=ChPtr-(char *)&CmtBuf[0]; - mprintf("\n"); - OutComment((char *)&CmtBuf[0],CmtSize); - } -#endif -} - - -#ifndef SFX_MODULE -void Archive::ViewFileComment() -{ - if (!(NewLhd.Flags & LHD_COMMENT) || Cmd->DisableComment || OldFormat) - return; -#ifndef GUI - mprintf(St(MFileComment)); -#endif - const int MaxSize=0x8000; - Array CmtBuf(MaxSize); - SaveFilePos SavePos(*this); - Seek(CurBlockPos+SIZEOF_NEWLHD+NewLhd.NameSize,SEEK_SET); - Int64 SaveCurBlockPos=CurBlockPos; - Int64 SaveNextBlockPos=NextBlockPos; - - int Size=ReadHeader(); - - CurBlockPos=SaveCurBlockPos; - NextBlockPos=SaveNextBlockPos; - - if (Size<7 || CommHead.HeadType!=COMM_HEAD) - return; - if (CommHead.HeadCRC!=HeaderCRC) - { -#ifndef GUI - Log(FileName,St(MLogCommHead)); -#endif - return; - } - if (CommHead.UnpVer < 15 || CommHead.UnpVer > UNP_VER || - CommHead.Method > 0x30 || CommHead.UnpSize > MaxSize) - return; - Read(&CmtBuf[0],CommHead.UnpSize); - if (CommHead.CommCRC!=((~CRC(0xffffffff,&CmtBuf[0],CommHead.UnpSize)&0xffff))) - { - Log(FileName,St(MLogBrokFCmt)); - } - else - { - OutComment(&CmtBuf[0],CommHead.UnpSize); -#ifndef GUI - mprintf("\n"); -#endif - } -} -#endif diff --git a/src/bin/unrar/archive.cpp b/src/bin/unrar/archive.cpp deleted file mode 100644 index 3460f993ef..0000000000 --- a/src/bin/unrar/archive.cpp +++ /dev/null @@ -1,267 +0,0 @@ -#include "rar.hpp" - -#ifndef SHELL_EXT -#include "arccmt.cpp" -#endif - - -Archive::Archive(RAROptions *InitCmd) -{ - Cmd=InitCmd==NULL ? &DummyCmd:InitCmd; - OpenShared=Cmd->OpenShared; - OldFormat=false; - Solid=false; - Volume=false; - MainComment=false; - Locked=false; - Signed=false; - NotFirstVolume=false; - SFXSize=0; - LatestTime.Reset(); - Protected=false; - Encrypted=false; - BrokenFileHeader=false; - LastReadBlock=0; - - CurBlockPos=0; - NextBlockPos=0; - - RecoveryPos=SIZEOF_MARKHEAD; - RecoverySectors=-1; - - memset(&NewMhd,0,sizeof(NewMhd)); - NewMhd.HeadType=MAIN_HEAD; - NewMhd.HeadSize=SIZEOF_NEWMHD; - HeaderCRC=0; - VolWrite=0; - AddingFilesSize=0; - AddingHeadersSize=0; -#if !defined(SHELL_EXT) && !defined(NOCRYPT) - *HeadersSalt=0; - *SubDataSalt=0; -#endif - *FirstVolumeName=0; - *FirstVolumeNameW=0; - - Splitting=false; - NewArchive=false; - - SilentOpen=false; - -} - - -#ifndef SHELL_EXT -void Archive::CheckArc(bool EnableBroken) -{ - if (!IsArchive(EnableBroken)) - { - Log(FileName,St(MBadArc),FileName); - ErrHandler.Exit(FATAL_ERROR); - } -} -#endif - - -#if !defined(SHELL_EXT) && !defined(SFX_MODULE) -void Archive::CheckOpen(char *Name,wchar *NameW) -{ - TOpen(Name,NameW); - CheckArc(false); -} -#endif - - -bool Archive::WCheckOpen(char *Name,wchar *NameW) -{ - if (!WOpen(Name,NameW)) - return(false); - if (!IsArchive(false)) - { -#ifndef SHELL_EXT - Log(FileName,St(MNotRAR),FileName); -#endif - Close(); - return(false); - } - return(true); -} - - -bool Archive::IsSignature(byte *D) -{ - bool Valid=false; - if (D[0]==0x52) -#ifndef SFX_MODULE - if (D[1]==0x45 && D[2]==0x7e && D[3]==0x5e) - { - OldFormat=true; - Valid=true; - } - else -#endif - if (D[1]==0x61 && D[2]==0x72 && D[3]==0x21 && D[4]==0x1a && D[5]==0x07 && D[6]==0x00) - { - OldFormat=false; - Valid=true; - } - return(Valid); -} - - -bool Archive::IsArchive(bool EnableBroken) -{ - Encrypted=false; -#ifndef SFX_MODULE - if (IsDevice()) - { -#ifndef SHELL_EXT - Log(FileName,St(MInvalidName),FileName); -#endif - return(false); - } -#endif - if (Read(MarkHead.Mark,SIZEOF_MARKHEAD)!=SIZEOF_MARKHEAD) - return(false); - SFXSize=0; - if (IsSignature(MarkHead.Mark)) - { - if (OldFormat) - Seek(0,SEEK_SET); - } - else - { - Array Buffer(MAXSFXSIZE); - long CurPos=int64to32(Tell()); - int ReadSize=Read(&Buffer[0],Buffer.Size()-16); - for (int I=0;I0 && CurPos<28 && ReadSize>31) - { - char *D=&Buffer[28-CurPos]; - if (D[0]!=0x52 || D[1]!=0x53 || D[2]!=0x46 || D[3]!=0x58) - continue; - } - SFXSize=CurPos+I; - Seek(SFXSize,SEEK_SET); - if (!OldFormat) - Read(MarkHead.Mark,SIZEOF_MARKHEAD); - break; - } - if (SFXSize==0) - return(false); - } - ReadHeader(); - SeekToNext(); -#ifndef SFX_MODULE - if (OldFormat) - { - NewMhd.Flags=OldMhd.Flags & 0x3f; - NewMhd.HeadSize=OldMhd.HeadSize; - } - else -#endif - { - if (HeaderCRC!=NewMhd.HeadCRC) - { -#ifndef SHELL_EXT - Log(FileName,St(MLogMainHead)); -#endif - Alarm(); - if (!EnableBroken) - return(false); - } - } - Volume=(NewMhd.Flags & MHD_VOLUME); - Solid=(NewMhd.Flags & MHD_SOLID)!=0; - MainComment=(NewMhd.Flags & MHD_COMMENT)!=0; - Locked=(NewMhd.Flags & MHD_LOCK)!=0; - Signed=(NewMhd.PosAV!=0); - Protected=(NewMhd.Flags & MHD_PROTECT)!=0; - Encrypted=(NewMhd.Flags & MHD_PASSWORD)!=0; - - if (NewMhd.EncryptVer>UNP_VER) - { -#ifdef RARDLL - Cmd->DllError=ERAR_UNKNOWN_FORMAT; -#else - ErrHandler.SetErrorCode(WARNING); - #if !defined(SILENT) && !defined(SFX_MODULE) - Log(FileName,St(MUnknownMeth),FileName); - Log(FileName,St(MVerRequired),NewMhd.EncryptVer/10,NewMhd.EncryptVer%10); - #endif -#endif - return(false); - } -#ifdef RARDLL - SilentOpen=true; -#endif - - //if not encrypted, we'll check it below - NotFirstVolume=Encrypted && (NewMhd.Flags & MHD_FIRSTVOLUME)==0; - - if (!SilentOpen || !Encrypted) - { - SaveFilePos SavePos(*this); - Int64 SaveCurBlockPos=CurBlockPos,SaveNextBlockPos=NextBlockPos; - - NotFirstVolume=false; - while (ReadHeader()) - { - int HeaderType=GetHeaderType(); - if (HeaderType==NEWSUB_HEAD) - { - if (SubHead.CmpName(SUBHEAD_TYPE_CMT)) - MainComment=true; - if ((SubHead.Flags & LHD_SPLIT_BEFORE) || - Volume && (NewMhd.Flags & MHD_FIRSTVOLUME)==0) - NotFirstVolume=true; - } - else - { - if (HeaderType==FILE_HEAD && ((NewLhd.Flags & LHD_SPLIT_BEFORE)!=0 || - Volume && NewLhd.UnpVer>=29 && (NewMhd.Flags & MHD_FIRSTVOLUME)==0)) - NotFirstVolume=true; - break; - } - SeekToNext(); - } - CurBlockPos=SaveCurBlockPos; - NextBlockPos=SaveNextBlockPos; - } - if (!Volume || !NotFirstVolume) - { - strcpy(FirstVolumeName,FileName); - strcpyw(FirstVolumeNameW,FileNameW); - } - - return(true); -} - - - - -void Archive::SeekToNext() -{ - Seek(NextBlockPos,SEEK_SET); -} - - -#ifndef SFX_MODULE -int Archive::GetRecoverySize(bool Required) -{ - if (!Protected) - return(0); - if (RecoverySectors!=-1 || !Required) - return(RecoverySectors); - SaveFilePos SavePos(*this); - Seek(SFXSize,SEEK_SET); - SearchSubBlock(SUBHEAD_TYPE_RR); - return(RecoverySectors); -} -#endif - - - - diff --git a/src/bin/unrar/archive.hpp b/src/bin/unrar/archive.hpp deleted file mode 100644 index 1e0675e759..0000000000 --- a/src/bin/unrar/archive.hpp +++ /dev/null @@ -1,126 +0,0 @@ -#ifndef _RAR_ARCHIVE_ -#define _RAR_ARCHIVE_ - -class Pack; - -enum {EN_LOCK=1,EN_VOL=2,EN_FIRSTVOL=4}; - -class Archive:public File -{ - private: - bool IsSignature(byte *D); - void UpdateLatestTime(FileHeader *CurBlock); - void ConvertNameCase(char *Name); - void ConvertNameCase(wchar *Name); - void ConvertUnknownHeader(); - int ReadOldHeader(); - void PrepareExtraTime(FileHeader *hd,EXTTIME_MODE etm,EXTTIME_MODE etc,EXTTIME_MODE eta,EXTTIME_MODE etarc,Array &TimeData); - -#if !defined(SHELL_EXT) && !defined(NOCRYPT) - CryptData HeadersCrypt; - byte HeadersSalt[SALT_SIZE]; -#endif -#ifndef SHELL_EXT - ComprDataIO SubDataIO; - byte SubDataSalt[SALT_SIZE]; -#endif - RAROptions *Cmd,DummyCmd; - - MarkHeader MarkHead; - OldMainHeader OldMhd; - - int RecoverySectors; - Int64 RecoveryPos; - - RarTime LatestTime; - int LastReadBlock; - int CurHeaderType; - - bool SilentOpen; - public: - Archive(RAROptions *InitCmd=NULL); - bool IsArchive(bool EnableBroken); - int SearchBlock(int BlockType); - int SearchSubBlock(const char *Type); - int ReadBlock(int BlockType); - void WriteBlock(int BlockType,BaseBlock *wb=NULL); - int PrepareNamesToWrite(char *Name,wchar *NameW,char *DestName,byte *DestNameW); - void SetLhdSize(); - int ReadHeader(); - void CheckArc(bool EnableBroken); - void CheckOpen(char *Name,wchar *NameW=NULL); - bool WCheckOpen(char *Name,wchar *NameW=NULL); - bool TestLock(int Mode); - void MakeTemp(); - void CopyMainHeader(Archive &Src,bool CopySFX=true,char *NameToDisplay=NULL); - bool ProcessToFileHead(Archive &Src,bool LastBlockAdded, - Pack *Pack=NULL,const char *SkipName=NULL); - void TmpToArc(Archive &Src); - void CloseNew(int AdjustRecovery,bool CloseVolume); - void WriteEndBlock(bool CloseVolume); - void CopyFileRecord(Archive &Src); - void CopyArchiveData(Archive &Src); - bool GetComment(Array *CmtData,Array *CmtDataW); - void ViewComment(); - void ViewFileComment(); - void SetLatestTime(RarTime *NewTime); - void SeekToNext(); - bool CheckAccess(); - bool IsArcDir(); - bool IsArcLabel(); - void ConvertAttributes(); - int GetRecoverySize(bool Required); - void VolSubtractHeaderSize(int SubSize); - void AddSubData(byte *SrcData,int DataSize,File *SrcFile,char *Name,bool AllowSplit); - bool ReadSubData(Array *UnpData,File *DestFile); - int GetHeaderType() {return(CurHeaderType);}; - int ReadCommentData(Array *CmtData,Array *CmtDataW); - void WriteCommentData(byte *Data,int DataSize,bool FileComment); - RAROptions* GetRAROptions() {return(Cmd);} - void SetSilentOpen(bool Mode) {SilentOpen=Mode;} - - BaseBlock ShortBlock; - MainHeader NewMhd; - FileHeader NewLhd; - EndArcHeader EndArcHead; - SubBlockHeader SubBlockHead; - FileHeader SubHead; - CommentHeader CommHead; - ProtectHeader ProtectHead; - AVHeader AVHead; - SignHeader SignHead; - UnixOwnersHeader UOHead; - MacFInfoHeader MACHead; - EAHeader EAHead; - StreamHeader StreamHead; - - Int64 CurBlockPos; - Int64 NextBlockPos; - - bool OldFormat; - bool Solid; - bool Volume; - bool MainComment; - bool Locked; - bool Signed; - bool NotFirstVolume; - bool Protected; - bool Encrypted; - uint SFXSize; - bool BrokenFileHeader; - - bool Splitting; - - ushort HeaderCRC; - - Int64 VolWrite; - Int64 AddingFilesSize; - uint AddingHeadersSize; - - bool NewArchive; - - char FirstVolumeName[NM]; - wchar FirstVolumeNameW[NM]; -}; - -#endif diff --git a/src/bin/unrar/arcread.cpp b/src/bin/unrar/arcread.cpp deleted file mode 100644 index 43a23db074..0000000000 --- a/src/bin/unrar/arcread.cpp +++ /dev/null @@ -1,653 +0,0 @@ -#include "rar.hpp" - -int Archive::SearchBlock(int BlockType) -{ - int Size,Count=0; - while ((Size=ReadHeader())!=0 && - (BlockType==ENDARC_HEAD || GetHeaderType()!=ENDARC_HEAD)) - { - if ((++Count & 127)==0) - Wait(); - if (GetHeaderType()==BlockType) - return(Size); - SeekToNext(); - } - return(0); -} - - -int Archive::SearchSubBlock(const char *Type) -{ - int Size; - while ((Size=ReadHeader())!=0 && GetHeaderType()!=ENDARC_HEAD) - { - if (GetHeaderType()==NEWSUB_HEAD && SubHead.CmpName(Type)) - return(Size); - SeekToNext(); - } - return(0); -} - - -int Archive::ReadHeader() -{ - CurBlockPos=Tell(); - -#ifndef SFX_MODULE - if (OldFormat) - return(ReadOldHeader()); -#endif - - RawRead Raw(this); - - bool Decrypt=Encrypted && CurBlockPos>=SFXSize+SIZEOF_MARKHEAD+SIZEOF_NEWMHD; - - if (Decrypt) - { -#if defined(SHELL_EXT) || defined(NOCRYPT) - return(0); -#else - if (Read(HeadersSalt,SALT_SIZE)!=SALT_SIZE) - return(0); - if (*Cmd->Password==0) -#ifdef RARDLL - if (Cmd->Callback==NULL || - Cmd->Callback(UCM_NEEDPASSWORD,Cmd->UserData,(LONG)Cmd->Password,sizeof(Cmd->Password))==-1) - { - Close(); - ErrHandler.Exit(USER_BREAK); - } - -#else - if (!GetPassword(PASSWORD_ARCHIVE,FileName,Cmd->Password,sizeof(Cmd->Password))) - { - Close(); - ErrHandler.Exit(USER_BREAK); - } -#endif - HeadersCrypt.SetCryptKeys(Cmd->Password,HeadersSalt,false,false,NewMhd.EncryptVer>=36); - Raw.SetCrypt(&HeadersCrypt); -#endif - } - - Raw.Read(SIZEOF_SHORTBLOCKHEAD); - if (Raw.Size()==0) - { - Int64 ArcSize=FileLength(); - if (CurBlockPos>ArcSize || NextBlockPos>ArcSize) - { - #ifndef SHELL_EXT - Log(FileName,St(MLogUnexpEOF)); - #endif - ErrHandler.SetErrorCode(WARNING); - } - return(0); - } - - Raw.Get(ShortBlock.HeadCRC); - byte HeadType; - Raw.Get(HeadType); - ShortBlock.HeadType=(HEADER_TYPE)HeadType; - Raw.Get(ShortBlock.Flags); - Raw.Get(ShortBlock.HeadSize); - if (ShortBlock.HeadSizePackSize); - Raw.Get(hd->UnpSize); - Raw.Get(hd->HostOS); - Raw.Get(hd->FileCRC); - Raw.Get(hd->FileTime); - Raw.Get(hd->UnpVer); - Raw.Get(hd->Method); - Raw.Get(hd->NameSize); - Raw.Get(hd->FileAttr); - if (hd->Flags & LHD_LARGE) - { - Raw.Get(hd->HighPackSize); - Raw.Get(hd->HighUnpSize); - } - else - { - hd->HighPackSize=hd->HighUnpSize=0; - if (hd->UnpSize==0xffffffff) - { - hd->UnpSize=int64to32(INT64MAX); - hd->HighUnpSize=int64to32(INT64MAX>>32); - } - } - hd->FullPackSize=int32to64(hd->HighPackSize,hd->PackSize); - hd->FullUnpSize=int32to64(hd->HighUnpSize,hd->UnpSize); - - char FileName[NM*4]; - int NameSize=Min(hd->NameSize,sizeof(FileName)-1); - Raw.Get((byte *)FileName,NameSize); - FileName[NameSize]=0; - - strncpyz(hd->FileName,FileName,ASIZE(hd->FileName)); - - if (hd->HeadType==NEWSUB_HEAD) - { - int DataSize=hd->HeadSize-hd->NameSize-SIZEOF_NEWLHD; - if (hd->Flags & LHD_SALT) - DataSize-=SALT_SIZE; - if (DataSize>0) - { - hd->SubData.Alloc(DataSize); - Raw.Get(&hd->SubData[0],DataSize); - if (hd->CmpName(SUBHEAD_TYPE_RR)) - { - byte *D=&hd->SubData[8]; - RecoverySectors=D[0]+((uint)D[1]<<8)+((uint)D[2]<<16)+((uint)D[3]<<24); - } - } - } - else - if (hd->HeadType==FILE_HEAD) - { - if (hd->Flags & LHD_UNICODE) - { - EncodeFileName NameCoder; - int Length=strlen(FileName); - if (Length==hd->NameSize) - { - UtfToWide(FileName,hd->FileNameW,sizeof(hd->FileNameW)/sizeof(hd->FileNameW[0])-1); - WideToChar(hd->FileNameW,hd->FileName,sizeof(hd->FileName)/sizeof(hd->FileName[0])-1); - ExtToInt(hd->FileName,hd->FileName); - } - else - { - Length++; - NameCoder.Decode(FileName,(byte *)FileName+Length, - hd->NameSize-Length,hd->FileNameW, - sizeof(hd->FileNameW)/sizeof(hd->FileNameW[0])); - } - if (*hd->FileNameW==0) - hd->Flags &= ~LHD_UNICODE; - } - else - *hd->FileNameW=0; -#ifndef SFX_MODULE - ConvertNameCase(hd->FileName); - ConvertNameCase(hd->FileNameW); -#endif - ConvertUnknownHeader(); - } - if (hd->Flags & LHD_SALT) - Raw.Get(hd->Salt,SALT_SIZE); - hd->mtime.SetDos(hd->FileTime); - hd->ctime.Reset(); - hd->atime.Reset(); - hd->arctime.Reset(); - if (hd->Flags & LHD_EXTTIME) - { - ushort Flags; - Raw.Get(Flags); - RarTime *tbl[4]; - tbl[0]=&NewLhd.mtime; - tbl[1]=&NewLhd.ctime; - tbl[2]=&NewLhd.atime; - tbl[3]=&NewLhd.arctime; - for (int I=0;I<4;I++) - { - RarTime *CurTime=tbl[I]; - uint rmode=Flags>>(3-I)*4; - if ((rmode & 8)==0) - continue; - if (I!=0) - { - uint DosTime; - Raw.Get(DosTime); - CurTime->SetDos(DosTime); - } - RarLocalTime rlt; - CurTime->GetLocal(&rlt); - if (rmode & 4) - rlt.Second++; - rlt.Reminder=0; - int count=rmode&3; - for (int J=0;JSetLocal(&rlt); - } - } - NextBlockPos+=hd->FullPackSize; - bool CRCProcessedOnly=(hd->Flags & LHD_COMMENT)!=0; - HeaderCRC=~Raw.GetCRC(CRCProcessedOnly)&0xffff; - if (hd->HeadCRC!=HeaderCRC) - { - if (hd->HeadType==NEWSUB_HEAD) - strcat(hd->FileName,"- ???"); - BrokenFileHeader=true; - ErrHandler.SetErrorCode(WARNING); -#ifndef SHELL_EXT - Log(Archive::FileName,St(MLogFileHead),IntNameToExt(hd->FileName)); - Alarm(); -#endif - } - } - break; -#ifndef SFX_MODULE - case COMM_HEAD: - *(BaseBlock *)&CommHead=ShortBlock; - Raw.Get(CommHead.UnpSize); - Raw.Get(CommHead.UnpVer); - Raw.Get(CommHead.Method); - Raw.Get(CommHead.CommCRC); - break; - case SIGN_HEAD: - *(BaseBlock *)&SignHead=ShortBlock; - Raw.Get(SignHead.CreationTime); - Raw.Get(SignHead.ArcNameSize); - Raw.Get(SignHead.UserNameSize); - break; - case AV_HEAD: - *(BaseBlock *)&AVHead=ShortBlock; - Raw.Get(AVHead.UnpVer); - Raw.Get(AVHead.Method); - Raw.Get(AVHead.AVVer); - Raw.Get(AVHead.AVInfoCRC); - break; - case PROTECT_HEAD: - *(BaseBlock *)&ProtectHead=ShortBlock; - Raw.Get(ProtectHead.DataSize); - Raw.Get(ProtectHead.Version); - Raw.Get(ProtectHead.RecSectors); - Raw.Get(ProtectHead.TotalBlocks); - Raw.Get(ProtectHead.Mark,8); - NextBlockPos+=ProtectHead.DataSize; - RecoverySectors=ProtectHead.RecSectors; - break; - case SUB_HEAD: - *(BaseBlock *)&SubBlockHead=ShortBlock; - Raw.Get(SubBlockHead.DataSize); - NextBlockPos+=SubBlockHead.DataSize; - Raw.Get(SubBlockHead.SubType); - Raw.Get(SubBlockHead.Level); - switch(SubBlockHead.SubType) - { - case UO_HEAD: - *(SubBlockHeader *)&UOHead=SubBlockHead; - Raw.Get(UOHead.OwnerNameSize); - Raw.Get(UOHead.GroupNameSize); - if (UOHead.OwnerNameSize>NM-1) - UOHead.OwnerNameSize=NM-1; - if (UOHead.GroupNameSize>NM-1) - UOHead.GroupNameSize=NM-1; - Raw.Get((byte *)UOHead.OwnerName,UOHead.OwnerNameSize); - Raw.Get((byte *)UOHead.GroupName,UOHead.GroupNameSize); - UOHead.OwnerName[UOHead.OwnerNameSize]=0; - UOHead.GroupName[UOHead.GroupNameSize]=0; - break; - case MAC_HEAD: - *(SubBlockHeader *)&MACHead=SubBlockHead; - Raw.Get(MACHead.fileType); - Raw.Get(MACHead.fileCreator); - break; - case EA_HEAD: - case BEEA_HEAD: - case NTACL_HEAD: - *(SubBlockHeader *)&EAHead=SubBlockHead; - Raw.Get(EAHead.UnpSize); - Raw.Get(EAHead.UnpVer); - Raw.Get(EAHead.Method); - Raw.Get(EAHead.EACRC); - break; - case STREAM_HEAD: - *(SubBlockHeader *)&StreamHead=SubBlockHead; - Raw.Get(StreamHead.UnpSize); - Raw.Get(StreamHead.UnpVer); - Raw.Get(StreamHead.Method); - Raw.Get(StreamHead.StreamCRC); - Raw.Get(StreamHead.StreamNameSize); - if (StreamHead.StreamNameSize>NM-1) - StreamHead.StreamNameSize=NM-1; - Raw.Get((byte *)StreamHead.StreamName,StreamHead.StreamNameSize); - StreamHead.StreamName[StreamHead.StreamNameSize]=0; - break; - } - break; -#endif - default: - if (ShortBlock.Flags & LONG_BLOCK) - { - uint DataSize; - Raw.Get(DataSize); - NextBlockPos+=DataSize; - } - break; - } - HeaderCRC=~Raw.GetCRC(false)&0xffff; - CurHeaderType=ShortBlock.HeadType; - if (Decrypt) - { - NextBlockPos+=Raw.PaddedSize()+SALT_SIZE; - - if (ShortBlock.HeadCRC!=HeaderCRC) - { - bool Recovered=false; - if (ShortBlock.HeadType==ENDARC_HEAD && (EndArcHead.Flags & EARC_REVSPACE)!=0) - { - SaveFilePos SavePos(*this); - Int64 Length=Tell(); - Seek(Length-7,SEEK_SET); - Recovered=true; - for (int J=0;J<7;J++) - if (GetByte()!=0) - Recovered=false; - } - if (!Recovered) - { -#ifndef SILENT - Log(FileName,St(MEncrBadCRC),FileName); -#endif - Close(); - - BrokenFileHeader=true; - ErrHandler.SetErrorCode(CRC_ERROR); - return(0); -// ErrHandler.Exit(CRC_ERROR); - } - } - } - - if (NextBlockPos<=CurBlockPos) - { -#ifndef SHELL_EXT - Log(FileName,St(MLogFileHead),"???"); -#endif - BrokenFileHeader=true; - ErrHandler.SetErrorCode(CRC_ERROR); - return(0); - } - return(Raw.Size()); -} - - -#ifndef SFX_MODULE -int Archive::ReadOldHeader() -{ - RawRead Raw(this); - if (CurBlockPos<=SFXSize) - { - Raw.Read(SIZEOF_OLDMHD); - Raw.Get(OldMhd.Mark,4); - Raw.Get(OldMhd.HeadSize); - Raw.Get(OldMhd.Flags); - NextBlockPos=CurBlockPos+OldMhd.HeadSize; - CurHeaderType=MAIN_HEAD; - } - else - { - OldFileHeader OldLhd; - Raw.Read(SIZEOF_OLDLHD); - NewLhd.HeadType=FILE_HEAD; - Raw.Get(NewLhd.PackSize); - Raw.Get(NewLhd.UnpSize); - Raw.Get(OldLhd.FileCRC); - Raw.Get(NewLhd.HeadSize); - Raw.Get(NewLhd.FileTime); - Raw.Get(OldLhd.FileAttr); - Raw.Get(OldLhd.Flags); - Raw.Get(OldLhd.UnpVer); - Raw.Get(OldLhd.NameSize); - Raw.Get(OldLhd.Method); - - NewLhd.Flags=OldLhd.Flags|LONG_BLOCK; - NewLhd.UnpVer=(OldLhd.UnpVer==2) ? 13 : 10; - NewLhd.Method=OldLhd.Method+0x30; - NewLhd.NameSize=OldLhd.NameSize; - NewLhd.FileAttr=OldLhd.FileAttr; - NewLhd.FileCRC=OldLhd.FileCRC; - NewLhd.FullPackSize=NewLhd.PackSize; - NewLhd.FullUnpSize=NewLhd.UnpSize; - - NewLhd.mtime.SetDos(NewLhd.FileTime); - NewLhd.ctime.Reset(); - NewLhd.atime.Reset(); - NewLhd.arctime.Reset(); - - Raw.Read(OldLhd.NameSize); - Raw.Get((byte *)NewLhd.FileName,OldLhd.NameSize); - NewLhd.FileName[OldLhd.NameSize]=0; - ConvertNameCase(NewLhd.FileName); - *NewLhd.FileNameW=0; - - if (Raw.Size()!=0) - NextBlockPos=CurBlockPos+NewLhd.HeadSize+NewLhd.PackSize; - CurHeaderType=FILE_HEAD; - } - return(NextBlockPos>CurBlockPos ? Raw.Size():0); -} -#endif - - -void Archive::ConvertNameCase(char *Name) -{ - if (Cmd->ConvertNames==NAMES_UPPERCASE) - { - IntToExt(Name,Name); - strupper(Name); - ExtToInt(Name,Name); - } - if (Cmd->ConvertNames==NAMES_LOWERCASE) - { - IntToExt(Name,Name); - strlower(Name); - ExtToInt(Name,Name); - } -} - - -#ifndef SFX_MODULE -void Archive::ConvertNameCase(wchar *Name) -{ - if (Cmd->ConvertNames==NAMES_UPPERCASE) - strupperw(Name); - if (Cmd->ConvertNames==NAMES_LOWERCASE) - strlowerw(Name); -} -#endif - - -bool Archive::IsArcDir() -{ - return((NewLhd.Flags & LHD_WINDOWMASK)==LHD_DIRECTORY); -} - - -bool Archive::IsArcLabel() -{ - return(NewLhd.HostOS<=HOST_WIN32 && (NewLhd.FileAttr & 8)); -} - - -void Archive::ConvertAttributes() -{ -#if defined(_WIN_32) || defined(_EMX) - switch(NewLhd.HostOS) - { - case HOST_MSDOS: - case HOST_OS2: - case HOST_WIN32: - break; - case HOST_UNIX: - case HOST_BEOS: - if ((NewLhd.Flags & LHD_WINDOWMASK)==LHD_DIRECTORY) - NewLhd.FileAttr=0x10; - else - NewLhd.FileAttr=0x20; - break; - default: - if ((NewLhd.Flags & LHD_WINDOWMASK)==LHD_DIRECTORY) - NewLhd.FileAttr=0x10; - else - NewLhd.FileAttr=0x20; - break; - } -#endif -#ifdef _UNIX - static mode_t mask = (mode_t) -1; - - if (mask == (mode_t) -1) - { - mask = umask(022); - umask(mask); - } - switch(NewLhd.HostOS) - { - case HOST_MSDOS: - case HOST_OS2: - case HOST_WIN32: - if (NewLhd.FileAttr & 0x10) - NewLhd.FileAttr=0x41ff & ~mask; - else - if (NewLhd.FileAttr & 1) - NewLhd.FileAttr=0x8124 & ~mask; - else - NewLhd.FileAttr=0x81b6 & ~mask; - break; - case HOST_UNIX: - case HOST_BEOS: - break; - default: - if ((NewLhd.Flags & LHD_WINDOWMASK)==LHD_DIRECTORY) - NewLhd.FileAttr=0x41ff & ~mask; - else - NewLhd.FileAttr=0x81b6 & ~mask; - break; - } -#endif -} - - -void Archive::ConvertUnknownHeader() -{ - if (NewLhd.UnpVer<20 && (NewLhd.FileAttr & 0x10)) - NewLhd.Flags|=LHD_DIRECTORY; - if (NewLhd.HostOS>=HOST_MAX) - { - if ((NewLhd.Flags & LHD_WINDOWMASK)==LHD_DIRECTORY) - NewLhd.FileAttr=0x10; - else - NewLhd.FileAttr=0x20; - } - for (char *s=NewLhd.FileName;*s!=0;s=charnext(s)) - { - if (*s=='/' || *s=='\\') - *s=CPATHDIVIDER; -#if defined(_APPLE) && !defined(UNICODE_SUPPORTED) - if ((byte)*s<32 || (byte)*s>127) - *s='_'; -#endif - } - for (wchar *s=NewLhd.FileNameW;*s!=0;s++) - if (*s=='/' || *s=='\\') - *s=CPATHDIVIDER; -} - - -#ifndef SHELL_EXT -bool Archive::ReadSubData(Array *UnpData,File *DestFile) -{ - if (HeaderCRC!=SubHead.HeadCRC) - { -#ifndef SHELL_EXT - Log(FileName,St(MSubHeadCorrupt)); -#endif - ErrHandler.SetErrorCode(CRC_ERROR); - return(false); - } - if (SubHead.Method<0x30 || SubHead.Method>0x35 || SubHead.UnpVer>/*PACK_VER*/36) - { -#ifndef SHELL_EXT - Log(FileName,St(MSubHeadUnknown)); -#endif - return(false); - } - - if (SubHead.PackSize==0 && (SubHead.Flags & LHD_SPLIT_AFTER)==0) - return(true); - - SubDataIO.Init(); - Unpack Unpack(&SubDataIO); - Unpack.Init(); - - if (DestFile==NULL) - { - UnpData->Alloc(SubHead.UnpSize); - SubDataIO.SetUnpackToMemory(&(*UnpData)[0],SubHead.UnpSize); - } - if (SubHead.Flags & LHD_PASSWORD) - if (*Cmd->Password) - SubDataIO.SetEncryption(SubHead.UnpVer,Cmd->Password, - (SubHead.Flags & LHD_SALT) ? SubHead.Salt:NULL,false, - SubHead.UnpVer>=36); - else - return(false); - SubDataIO.SetPackedSizeToRead(SubHead.PackSize); - SubDataIO.EnableShowProgress(false); - SubDataIO.SetFiles(this,DestFile); - SubDataIO.UnpVolume=(SubHead.Flags & LHD_SPLIT_AFTER); - SubDataIO.SetSubHeader(&SubHead,NULL); - Unpack.SetDestSize(SubHead.UnpSize); - if (SubHead.Method==0x30) - CmdExtract::UnstoreFile(SubDataIO,SubHead.UnpSize); - else - Unpack.DoUnpack(SubHead.UnpVer,false); - - if (SubHead.FileCRC!=~SubDataIO.UnpFileCRC) - { -#ifndef SHELL_EXT - Log(FileName,St(MSubHeadDataCRC),SubHead.FileName); -#endif - ErrHandler.SetErrorCode(CRC_ERROR); - if (UnpData!=NULL) - UnpData->Reset(); - return(false); - } - return(true); -} -#endif diff --git a/src/bin/unrar/array.hpp b/src/bin/unrar/array.hpp deleted file mode 100644 index 1130bfb8ae..0000000000 --- a/src/bin/unrar/array.hpp +++ /dev/null @@ -1,122 +0,0 @@ -#ifndef _RAR_ARRAY_ -#define _RAR_ARRAY_ - -extern ErrorHandler ErrHandler; - -template class Array -{ - private: - T *Buffer; - int BufSize; - int AllocSize; - public: - Array(); - Array(int Size); - ~Array(); - inline void CleanData(); - inline T& operator [](int Item); - inline int Size(); - void Add(int Items); - void Alloc(int Items); - void Reset(); - void operator = (Array &Src); - void Push(T Item); - T* Addr() {return(Buffer);} -}; - -template void Array::CleanData() -{ - Buffer=NULL; - BufSize=0; - AllocSize=0; -} - - -template Array::Array() -{ - CleanData(); -} - - -template Array::Array(int Size) -{ - Buffer=(T *)rarmalloc(sizeof(T)*Size); - if (Buffer==NULL && Size!=0) - ErrHandler.MemoryError(); - - AllocSize=BufSize=Size; -} - - -template Array::~Array() -{ - if (Buffer!=NULL) - rarfree(Buffer); -} - - -template inline T& Array::operator [](int Item) -{ - return(Buffer[Item]); -} - - -template inline int Array::Size() -{ - return(BufSize); -} - - -template void Array::Add(int Items) -{ - BufSize+=Items; - if (BufSize>AllocSize) - { - int Suggested=AllocSize+AllocSize/4+32; - int NewSize=Max(BufSize,Suggested); - - Buffer=(T *)rarrealloc(Buffer,NewSize*sizeof(T)); - if (Buffer==NULL) - ErrHandler.MemoryError(); - AllocSize=NewSize; - } -} - - -template void Array::Alloc(int Items) -{ - if (Items>AllocSize) - Add(Items-BufSize); - else - BufSize=Items; -} - - -template void Array::Reset() -{ - if (Buffer!=NULL) - { - rarfree(Buffer); - Buffer=NULL; - } - BufSize=0; - AllocSize=0; -} - - -template void Array::operator =(Array &Src) -{ - Reset(); - Alloc(Src.BufSize); - if (Src.BufSize!=0) - memcpy((void *)Buffer,(void *)Src.Buffer,Src.BufSize*sizeof(T)); -} - - -template void Array::Push(T Item) -{ - Add(1); - (*this)[Size()-1]=Item; -} - -#endif diff --git a/src/bin/unrar/beosea.cpp b/src/bin/unrar/beosea.cpp deleted file mode 100644 index 86eb7d400c..0000000000 --- a/src/bin/unrar/beosea.cpp +++ /dev/null @@ -1,113 +0,0 @@ - - -void ExtractBeEA(Archive &Arc,char *FileName) -{ - if (Arc.HeaderCRC!=Arc.EAHead.HeadCRC) - { - Log(Arc.FileName,St(MEABroken),FileName); - ErrHandler.SetErrorCode(CRC_ERROR); - return; - } - if (Arc.EAHead.Method<0x31 || Arc.EAHead.Method>0x35 || Arc.EAHead.UnpVer>PACK_VER) - { - Log(Arc.FileName,St(MEAUnknHeader),FileName); - return; - } - - ComprDataIO DataIO; - Unpack Unpack(&DataIO); - Unpack.Init(); - - Array UnpData(Arc.EAHead.UnpSize); - DataIO.SetUnpackToMemory(&UnpData[0],Arc.EAHead.UnpSize); - DataIO.SetPackedSizeToRead(Arc.EAHead.DataSize); - DataIO.EnableShowProgress(false); - DataIO.SetFiles(&Arc,NULL); - Unpack.SetDestSize(Arc.EAHead.UnpSize); - Unpack.DoUnpack(Arc.EAHead.UnpVer,false); - - if (Arc.EAHead.EACRC!=~DataIO.UnpFileCRC) - { - Log(Arc.FileName,St(MEABroken),FileName); - ErrHandler.SetErrorCode(CRC_ERROR); - return; - } - int fd = open(FileName,O_WRONLY); - if (fd==-1) - { - Log(Arc.FileName,St(MCannotSetEA),FileName); - ErrHandler.SetErrorCode(WARNING); - return; - } - - int AttrPos=0; - while (AttrPos=sizeof(Name)) - { - Log(Arc.FileName,St(MCannotSetEA),FileName); - ErrHandler.SetErrorCode(WARNING); - break; - } - memcpy(Name,CurItem+10,NameSize); - Name[NameSize]=0; - if (fs_write_attr(fd,Name,Type,0,CurItem+10+NameSize,Size)==-1) - { - Log(Arc.FileName,St(MCannotSetEA),FileName); - ErrHandler.SetErrorCode(WARNING); - break; - } - AttrPos+=10+NameSize+Size; - } - close(fd); - mprintf(St(MShowEA)); -} - - -void ExtractBeEANew(Archive &Arc,char *FileName) -{ - Array SubData; - if (!Arc.ReadSubData(&SubData,NULL)) - return; - - int fd = open(FileName,O_WRONLY); - if (fd==-1) - { - Log(Arc.FileName,St(MCannotSetEA),FileName); - ErrHandler.SetErrorCode(WARNING); - return; - } - - int AttrPos=0; - while (AttrPos=sizeof(Name)) - { - Log(Arc.FileName,St(MCannotSetEA),FileName); - ErrHandler.SetErrorCode(WARNING); - break; - } - memcpy(Name,CurItem+10,NameSize); - Name[NameSize]=0; - if (fs_write_attr(fd,Name,Type,0,CurItem+10+NameSize,Size)==-1) - { - Log(Arc.FileName,St(MCannotSetEA),FileName); - ErrHandler.SetErrorCode(WARNING); - break; - } - AttrPos+=10+NameSize+Size; - } - close(fd); - mprintf(St(MShowEA)); -} - diff --git a/src/bin/unrar/cmddata.cpp b/src/bin/unrar/cmddata.cpp deleted file mode 100644 index 41f3dd7e39..0000000000 --- a/src/bin/unrar/cmddata.cpp +++ /dev/null @@ -1,1287 +0,0 @@ -#include "rar.hpp" - -CommandData::CommandData() -{ - FileArgs=ExclArgs=InclArgs=StoreArgs=ArcNames=NULL; - Init(); -} - - -CommandData::~CommandData() -{ - Close(); -} - - -void CommandData::Init() -{ - Close(); - - *Command=0; - *ArcName=0; - *ArcNameW=0; - FileLists=false; - NoMoreSwitches=false; - TimeConverted=false; - - FileArgs=new StringList; - ExclArgs=new StringList; - InclArgs=new StringList; - StoreArgs=new StringList; - ArcNames=new StringList; -} - - -void CommandData::Close() -{ - delete FileArgs; - delete ExclArgs; - delete InclArgs; - delete StoreArgs; - delete ArcNames; - FileArgs=ExclArgs=InclArgs=StoreArgs=ArcNames=NULL; - NextVolSizes.Reset(); -} - - -#if !defined(SFX_MODULE) -void CommandData::ParseArg(char *Arg,wchar *ArgW) -{ - if (IsSwitch(*Arg) && !NoMoreSwitches) - if (Arg[1]=='-') - NoMoreSwitches=true; - else - ProcessSwitch(&Arg[1]); - else - if (*Command==0) - { - strncpyz(Command,Arg,ASIZE(Command)); - if (ArgW!=NULL) - strncpyw(CommandW,ArgW,sizeof(CommandW)/sizeof(CommandW[0])); - if (etoupper(*Command)=='S') - { - const char *SFXName=Command[1] ? Command+1:DefSFXName; - if (PointToName(SFXName)!=SFXName || FileExist(SFXName)) - strcpy(SFXModule,SFXName); - else - GetConfigName(SFXName,SFXModule,true); - } -#ifndef GUI - *Command=etoupper(*Command); - if (*Command!='I' && *Command!='S') - strupper(Command); -#endif - } - else - if (*ArcName==0) - { - strncpyz(ArcName,Arg,ASIZE(ArcName)); - if (ArgW!=NULL) - strncpyzw(ArcNameW,ArgW,ASIZE(ArcNameW)); - } - else - { - int Length=strlen(Arg); - char EndChar=Arg[Length-1]; - char CmdChar=etoupper(*Command); - bool Add=strchr("AFUM",CmdChar)!=NULL; - bool Extract=CmdChar=='X' || CmdChar=='E'; - if ((IsDriveDiv(EndChar) || IsPathDiv(EndChar)) && !Add) - { - strncpyz(ExtrPath,Arg,ASIZE(ExtrPath)); - if (ArgW!=NULL) - strncpyzw(ExtrPathW,ArgW,ASIZE(ExtrPathW)); - } - else - if ((Add || CmdChar=='T') && *Arg!='@') - FileArgs->AddString(Arg); - else - { - struct FindData FileData; - bool Found=FindFile::FastFind(Arg,NULL,&FileData); - if (!Found && *Arg=='@' && !IsWildcard(Arg)) - { - FileLists=true; - - RAR_CHARSET Charset=FilelistCharset; - -#if defined(_WIN_32) && !defined(GUI) - // for compatibility reasons we use OEM encoding - // in Win32 console version by default - - if (Charset==RCH_DEFAULT) - Charset=RCH_OEM; -#endif - - ReadTextFile(Arg+1,FileArgs,false,true,Charset,true,true); - } - else - if (Found && FileData.IsDir && Extract && *ExtrPath==0) - { - strcpy(ExtrPath,Arg); - AddEndSlash(ExtrPath); - } - else - FileArgs->AddString(Arg); - } - } -} -#endif - - -void CommandData::ParseDone() -{ - if (FileArgs->ItemsCount()==0 && !FileLists) - FileArgs->AddString(MASKALL); - char CmdChar=etoupper(*Command); - bool Extract=CmdChar=='X' || CmdChar=='E'; - if (Test && Extract) - Test=false; - BareOutput=(CmdChar=='L' || CmdChar=='V') && Command[1]=='B'; -} - - -#if !defined(SFX_MODULE) && !defined(_WIN_CE) -void CommandData::ParseEnvVar() -{ - char *EnvStr=getenv("RAR"); - if (EnvStr!=NULL) - ProcessSwitchesString(EnvStr); -} -#endif - - - -// return 'false' if -cfg- is present and preprocess switches -// which must be processed before the rest of command line - -#ifndef SFX_MODULE -bool CommandData::IsConfigEnabled(int argc,char *argv[]) -{ - bool ConfigEnabled=true; - for (int I=1;I='0' && Switch[2]<='4'; - if (CommonMode) - Mode=(EXTTIME_MODE)(Switch[2]-'0'); - if (Switch[2]=='-') - Mode=EXTTIME_NONE; - if (CommonMode || Switch[2]=='-' || Switch[2]=='+' || Switch[2]==0) - xmtime=xctime=xatime=Mode; - else - { - if (Switch[3]>='0' && Switch[3]<='4') - Mode=(EXTTIME_MODE)(Switch[3]-'0'); - if (Switch[3]=='-') - Mode=EXTTIME_NONE; - switch(etoupper(Switch[2])) - { - case 'M': - xmtime=Mode; - break; - case 'C': - xctime=Mode; - break; - case 'A': - xatime=Mode; - break; - case 'R': - xarctime=Mode; - break; - } - } - } - break; - case '-': - Test=false; - break; - case 0: - Test=true; - break; - default: - BadSwitch(Switch); - break; - } - break; - case 'A': - switch(etoupper(Switch[1])) - { - case 'C': - ClearArc=true; - break; - case 'D': - AppendArcNameToPath=true; - break; - case 'G': - if (Switch[2]=='-' && Switch[3]==0) - GenerateArcName=0; - else - { - GenerateArcName=true; - strncpyz(GenerateMask,Switch+2,ASIZE(GenerateMask)); - } - break; - case 'N': //reserved for archive name - break; - case 'O': - AddArcOnly=true; - break; - case 'P': - strcpy(ArcPath,Switch+2); - break; - case 'S': - SyncFiles=true; - break; - default: - BadSwitch(Switch); - break; - } - break; - case 'D': - if (Switch[2]==0) - switch(etoupper(Switch[1])) - { - case 'S': - DisableSortSolid=true; - break; - case 'H': - OpenShared=true; - break; - case 'F': - DeleteFiles=true; - break; - } - break; - case 'O': - switch(etoupper(Switch[1])) - { - case '+': - Overwrite=OVERWRITE_ALL; - break; - case '-': - Overwrite=OVERWRITE_NONE; - break; - case 'R': - Overwrite=OVERWRITE_AUTORENAME; - break; - case 'W': - ProcessOwners=true; - break; -#ifdef SAVE_LINKS - case 'L': - SaveLinks=true; - break; -#endif -#ifdef _WIN_32 - case 'S': - SaveStreams=true; - break; - case 'C': - SetCompressedAttr=true; - break; -#endif - default : - BadSwitch(Switch); - break; - } - break; - case 'R': - switch(etoupper(Switch[1])) - { - case 0: - Recurse=RECURSE_ALWAYS; - break; - case '-': - Recurse=0; - break; - case '0': - Recurse=RECURSE_WILDCARDS; - break; -#ifndef _WIN_CE - case 'I': - { - Priority=atoi(Switch+2); - char *ChPtr=strchr(Switch+2,':'); - if (ChPtr!=NULL) - { - SleepTime=atoi(ChPtr+1); - InitSystemOptions(SleepTime); - } - SetPriority(Priority); - } - break; -#endif - } - break; - case 'Y': - AllYes=true; - break; - case 'N': - case 'X': - if (Switch[1]!=0) - { - StringList *Args=etoupper(Switch[0])=='N' ? InclArgs:ExclArgs; - if (Switch[1]=='@' && !IsWildcard(Switch)) - { - RAR_CHARSET Charset=FilelistCharset; - -#if defined(_WIN_32) && !defined(GUI) - // for compatibility reasons we use OEM encoding - // in Win32 console version by default - - if (Charset==RCH_DEFAULT) - Charset=RCH_OEM; -#endif - - ReadTextFile(Switch+2,Args,false,true,Charset,true,true); - } - else - Args->AddString(Switch+1); - } - break; - case 'E': - switch(etoupper(Switch[1])) - { - case 'P': - switch(Switch[2]) - { - case 0: - ExclPath=EXCL_SKIPWHOLEPATH; - break; - case '1': - ExclPath=EXCL_BASEPATH; - break; - case '2': - ExclPath=EXCL_SAVEFULLPATH; - break; - case '3': - ExclPath=EXCL_ABSPATH; - break; - } - break; - case 'D': - ExclEmptyDir=true; - break; - case 'E': - ProcessEA=false; - break; - case 'N': - NoEndBlock=true; - break; - default: - if (Switch[1]=='+') - { - InclFileAttr=GetExclAttr(&Switch[2]); - InclAttrSet=true; - } - else - ExclFileAttr=GetExclAttr(&Switch[1]); - break; - } - break; - case 'P': - if (Switch[1]==0) - { - GetPassword(PASSWORD_GLOBAL,NULL,Password,sizeof(Password)); - eprintf("\n"); - } - else - strncpyz(Password,Switch+1,ASIZE(Password)); - break; - case 'H': - if (etoupper(Switch[1])=='P') - { - EncryptHeaders=true; - if (Switch[2]!=0) - strncpyz(Password,Switch+2,ASIZE(Password)); - else - if (*Password==0) - { - GetPassword(PASSWORD_GLOBAL,NULL,Password,sizeof(Password)); - eprintf("\n"); - } - } - break; - case 'Z': - strncpyz(CommentFile,Switch[1]!=0 ? Switch+1:"stdin",ASIZE(CommentFile)); - break; - case 'M': - switch(etoupper(Switch[1])) - { - case 'C': - { - char *Str=Switch+2; - if (*Str=='-') - for (int I=0;IAddString(Mask); - if (End==NULL) - break; - Names=End+1; - } - } - break; -#ifdef PACK_SMP - case 'T': - Threads=atoi(Switch+2); - if (Threads>MaxSearchThreads) - BadSwitch(Switch); - else - { - } - break; -#endif - default: - Method=Switch[1]-'0'; - if (Method>5 || Method<0) - BadSwitch(Switch); - break; - } - break; - case 'V': - switch(etoupper(Switch[1])) - { -#ifdef _WIN_32 - case 'D': - EraseDisk=true; - break; -#endif - case 'N': - OldNumbering=true; - break; - case 'P': - VolumePause=true; - break; - case 'E': - if (etoupper(Switch[2])=='R') - VersionControl=atoi(Switch+3)+1; - break; - case '-': - VolSize=0; - break; - default: - { - Int64 NewVolSize=atoil(&Switch[1]); - - if (NewVolSize==0) - NewVolSize=INT64ERR; - else - switch (Switch[strlen(Switch)-1]) - { - case 'f': - case 'F': - switch(int64to32(NewVolSize)) - { - case 360: - NewVolSize=362496; - break; - case 720: - NewVolSize=730112; - break; - case 1200: - NewVolSize=1213952; - break; - case 1440: - NewVolSize=1457664; - break; - case 2880: - NewVolSize=2915328; - break; - } - break; - case 'k': - NewVolSize*=1024; - break; - case 'm': - NewVolSize*=1024*1024; - break; - case 'M': - NewVolSize*=1000*1000; - break; - case 'g': - NewVolSize*=1024*1024; - NewVolSize*=1024; - break; - case 'G': - NewVolSize*=1000*1000; - NewVolSize*=1000; - break; - case 'b': - case 'B': - break; - default: - NewVolSize*=1000; - break; - } - if (VolSize==0) - VolSize=NewVolSize; - else - NextVolSizes.Push(NewVolSize); - } - break; - } - break; - case 'F': - if (Switch[1]==0) - FreshFiles=true; - else - BadSwitch(Switch); - break; - case 'U': - if (Switch[1]==0) - UpdateFiles=true; - else - BadSwitch(Switch); - break; - case 'W': - strncpyz(TempPath,&Switch[1],ASIZE(TempPath)); - AddEndSlash(TempPath); - break; - case 'S': - if (strnicomp(Switch,"SFX",3)==0) - { - const char *SFXName=Switch[3] ? Switch+3:DefSFXName; - if (PointToName(SFXName)!=SFXName || FileExist(SFXName)) - strcpy(SFXModule,SFXName); - else - GetConfigName(SFXName,SFXModule,true); - } - if (isdigit(Switch[1])) - { - Solid|=SOLID_COUNT; - SolidCount=atoi(&Switch[1]); - } - else - switch(etoupper(Switch[1])) - { - case 0: - Solid|=SOLID_NORMAL; - break; - case '-': - Solid=SOLID_NONE; - break; - case 'E': - Solid|=SOLID_FILEEXT; - break; - case 'V': - Solid|=Switch[2]=='-' ? SOLID_VOLUME_DEPENDENT:SOLID_VOLUME_INDEPENDENT; - break; - case 'D': - Solid|=SOLID_VOLUME_DEPENDENT; - break; - case 'L': - if (isdigit(Switch[2])) - FileSizeLess=atoil(Switch+2); - break; - case 'M': - if (isdigit(Switch[2])) - FileSizeMore=atoil(Switch+2); - break; - case 'C': - { - RAR_CHARSET rch; - switch(etoupper(Switch[2])) - { - case 'A': - rch=RCH_ANSI; - break; - case 'O': - rch=RCH_OEM; - break; - case 'U': - rch=RCH_UNICODE; - break; - default : - BadSwitch(Switch); - break; - }; - if (Switch[3]==0) - CommentCharset=FilelistCharset=rch; - else - for (int I=3;Switch[I]!=0;I++) - switch(etoupper(Switch[I])) - { - case 'C': - CommentCharset=rch; - break; - case 'L': - FilelistCharset=rch; - break; - default: - BadSwitch(Switch); - break; - } - } - break; - - } - break; - case 'C': - if (Switch[2]==0) - switch(etoupper(Switch[1])) - { - case '-': - DisableComment=true; - break; - case 'U': - ConvertNames=NAMES_UPPERCASE; - break; - case 'L': - ConvertNames=NAMES_LOWERCASE; - break; - } - break; - case 'K': - switch(etoupper(Switch[1])) - { - case 'B': - KeepBroken=true; - break; - case 0: - Lock=true; - break; - } - break; -#ifndef GUI - case '?' : - OutHelp(); - break; -#endif - default : - BadSwitch(Switch); - break; - } -} -#endif - - -#ifndef SFX_MODULE -void CommandData::BadSwitch(char *Switch) -{ - mprintf(St(MUnknownOption),Switch); - ErrHandler.Exit(USER_ERROR); -} -#endif - - -#ifndef GUI -void CommandData::OutTitle() -{ - if (BareOutput || DisableCopyright) - return; -#if defined(__GNUC__) && defined(SFX_MODULE) - mprintf(St(MCopyrightS)); -#else -#ifndef SILENT - static bool TitleShown=false; - if (TitleShown) - return; - TitleShown=true; - char Version[50]; - int Beta=RARVER_BETA; - if (Beta!=0) - sprintf(Version,"%d.%02d %s %d",RARVER_MAJOR,RARVER_MINOR,St(MBeta),RARVER_BETA); - else - sprintf(Version,"%d.%02d",RARVER_MAJOR,RARVER_MINOR); -#ifdef UNRAR - mprintf(St(MUCopyright),Version,RARVER_YEAR); -#else -#endif -#endif -#endif -} -#endif - - -void CommandData::OutHelp() -{ -#if !defined(GUI) && !defined(SILENT) - OutTitle(); - static MSGID Help[]={ -#ifdef SFX_MODULE - MCHelpCmd,MSHelpCmdE,MSHelpCmdT,MSHelpCmdV -#elif defined(UNRAR) - MUNRARTitle1,MRARTitle2,MCHelpCmd,MCHelpCmdE,MCHelpCmdL,MCHelpCmdP, - MCHelpCmdT,MCHelpCmdV,MCHelpCmdX,MCHelpSw,MCHelpSwm,MCHelpSwAC,MCHelpSwAD, - MCHelpSwAP,MCHelpSwAVm,MCHelpSwCm,MCHelpSwCFGm,MCHelpSwCL,MCHelpSwCU, - MCHelpSwDH,MCHelpSwEP,MCHelpSwEP3,MCHelpSwF,MCHelpSwIDP,MCHelpSwIERR, - MCHelpSwINUL,MCHelpSwIOFF,MCHelpSwKB,MCHelpSwN,MCHelpSwNa,MCHelpSwNal, - MCHelpSwOp,MCHelpSwOm,MCHelpSwOC,MCHelpSwOR,MCHelpSwOW,MCHelpSwP, - MCHelpSwPm,MCHelpSwR,MCHelpSwRI,MCHelpSwSL,MCHelpSwSM,MCHelpSwTA, - MCHelpSwTB,MCHelpSwTN,MCHelpSwTO,MCHelpSwTS,MCHelpSwU,MCHelpSwVUnr, - MCHelpSwVER,MCHelpSwVP,MCHelpSwX,MCHelpSwXa,MCHelpSwXal,MCHelpSwY -#else - MRARTitle1,MRARTitle2,MCHelpCmd,MCHelpCmdA,MCHelpCmdC,MCHelpCmdCF, - MCHelpCmdCH,MCHelpCmdCW,MCHelpCmdD,MCHelpCmdE,MCHelpCmdF,MCHelpCmdI, - MCHelpCmdK,MCHelpCmdL,MCHelpCmdM,MCHelpCmdP,MCHelpCmdR,MCHelpCmdRC, - MCHelpCmdRN,MCHelpCmdRR,MCHelpCmdRV,MCHelpCmdS,MCHelpCmdT,MCHelpCmdU, - MCHelpCmdV,MCHelpCmdX,MCHelpSw,MCHelpSwm,MCHelpSwAC,MCHelpSwAD,MCHelpSwAG, - MCHelpSwAO,MCHelpSwAP,MCHelpSwAS,MCHelpSwAV,MCHelpSwAVm,MCHelpSwCm, - MCHelpSwCFGm,MCHelpSwCL,MCHelpSwCU,MCHelpSwDF,MCHelpSwDH,MCHelpSwDS, - MCHelpSwEa,MCHelpSwED,MCHelpSwEE,MCHelpSwEN,MCHelpSwEP,MCHelpSwEP1, - MCHelpSwEP2,MCHelpSwEP3,MCHelpSwF,MCHelpSwHP,MCHelpSwIDP, - MCHelpSwIEML,MCHelpSwIERR,MCHelpSwILOG,MCHelpSwINUL,MCHelpSwIOFF, - MCHelpSwISND,MCHelpSwK,MCHelpSwKB,MCHelpSwMn,MCHelpSwMC,MCHelpSwMD, - MCHelpSwMS,MCHelpSwMT,MCHelpSwN,MCHelpSwNa,MCHelpSwNal,MCHelpSwOp, - MCHelpSwOm,MCHelpSwOC,MCHelpSwOL,MCHelpSwOR,MCHelpSwOS,MCHelpSwOW, - MCHelpSwP,MCHelpSwPm,MCHelpSwR,MCHelpSwR0,MCHelpSwRI,MCHelpSwRR, - MCHelpSwRV,MCHelpSwS,MCHelpSwSm,MCHelpSwSC,MCHelpSwSFX,MCHelpSwSI, - MCHelpSwSL,MCHelpSwSM,MCHelpSwT,MCHelpSwTA,MCHelpSwTB,MCHelpSwTK, - MCHelpSwTL,MCHelpSwTN,MCHelpSwTO,MCHelpSwTS,MCHelpSwU,MCHelpSwV, - MCHelpSwVn,MCHelpSwVD,MCHelpSwVER,MCHelpSwVN,MCHelpSwVP,MCHelpSwW, - MCHelpSwX,MCHelpSwXa,MCHelpSwXal,MCHelpSwY,MCHelpSwZ -#endif - }; - - for (int I=0;IRewind(); - while ((CurName=Args->GetString())!=NULL) -#ifndef SFX_MODULE - if (CheckFullPath && IsFullPath(CurName)) - { - if (*FullName==0) - ConvertNameToFull(CheckName,FullName); - if (CmpName(CurName,FullName,MatchMode)) - return(true); - } - else -#endif - if (CmpName(ConvertPath(CurName,NULL),Name,MatchMode)) - return(true); - return(false); -} - - -bool CommandData::ExclCheck(char *CheckName,bool CheckFullPath) -{ - if (ExclCheckArgs(ExclArgs,CheckName,CheckFullPath,MATCH_WILDSUBPATH)) - return(true); - if (InclArgs->ItemsCount()==0) - return(false); - if (ExclCheckArgs(InclArgs,CheckName,false,MATCH_WILDSUBPATH)) - return(false); - return(true); -} - - - - -#ifndef SFX_MODULE -bool CommandData::TimeCheck(RarTime &ft) -{ - if (FileTimeBefore.IsSet() && ft>=FileTimeBefore) - return(true); - if (FileTimeAfter.IsSet() && ft<=FileTimeAfter) - return(true); -/* - if (FileTimeOlder!=0 || FileTimeNewer!=0) - { - if (!TimeConverted) - { - if (FileTimeOlder!=0) - FileTimeOlder=SecondsToDosTime(FileTimeOlder); - if (FileTimeNewer!=0) - FileTimeNewer=SecondsToDosTime(FileTimeNewer); - TimeConverted=true; - } - if (FileTimeOlder!=0 && ft>=FileTimeOlder) - return(true); - if (FileTimeNewer!=0 && ft<=FileTimeNewer) - return(true); - - } -*/ - return(false); -} -#endif - - -#ifndef SFX_MODULE -bool CommandData::SizeCheck(Int64 Size) -{ - if (FileSizeLess!=INT64ERR && Size>=FileSizeLess) - return(true); - if (FileSizeMore!=INT64ERR && Size<=FileSizeMore) - return(true); - return(false); -} -#endif - - -int CommandData::IsProcessFile(FileHeader &NewLhd,bool *ExactMatch,int MatchType) -{ - if (strlen(NewLhd.FileName)>=NM || strlenw(NewLhd.FileNameW)>=NM) - return(0); - if (ExclCheck(NewLhd.FileName,false)) - return(0); -#ifndef SFX_MODULE - if (TimeCheck(NewLhd.mtime)) - return(0); - if ((NewLhd.FileAttr & ExclFileAttr)!=0 || InclAttrSet && (NewLhd.FileAttr & InclFileAttr)==0) - return(0); - if ((NewLhd.Flags & LHD_WINDOWMASK)!=LHD_DIRECTORY && SizeCheck(NewLhd.FullUnpSize)) - return(0); -#endif - char *ArgName; - wchar *ArgNameW; - FileArgs->Rewind(); - for (int StringCount=1;FileArgs->GetString(&ArgName,&ArgNameW);StringCount++) - { -#ifndef SFX_MODULE - bool Unicode=(NewLhd.Flags & LHD_UNICODE) || ArgNameW!=NULL; - if (Unicode) - { - wchar NameW[NM],ArgW[NM],*NamePtr=NewLhd.FileNameW; - bool CorrectUnicode=true; - if (ArgNameW==NULL) - { - if (!CharToWide(ArgName,ArgW) || *ArgW==0) - CorrectUnicode=false; - ArgNameW=ArgW; - } - if ((NewLhd.Flags & LHD_UNICODE)==0) - { - if (!CharToWide(NewLhd.FileName,NameW) || *NameW==0) - CorrectUnicode=false; - NamePtr=NameW; - } - if (CmpName(ArgNameW,NamePtr,MatchType)) - { - if (ExactMatch!=NULL) - *ExactMatch=stricompcw(ArgNameW,NamePtr)==0; - return(StringCount); - } - if (CorrectUnicode) - continue; - } -#endif - if (CmpName(ArgName,NewLhd.FileName,MatchType)) - { - if (ExactMatch!=NULL) - *ExactMatch=stricompc(ArgName,NewLhd.FileName)==0; - return(StringCount); - } - } - return(0); -} - - -#ifndef GUI -void CommandData::ProcessCommand() -{ -#ifndef SFX_MODULE - - const char *SingleCharCommands="FUADPXETK"; - if (Command[1] && strchr(SingleCharCommands,*Command)!=NULL || *ArcName==0) - OutHelp(); - -#ifdef _UNIX - if (GetExt(ArcName)==NULL && (!FileExist(ArcName) || IsDir(GetFileAttr(ArcName)))) - strcat(ArcName,".rar"); -#else - if (GetExt(ArcName)==NULL) - strcat(ArcName,".rar"); -#endif - - if (strchr("AFUMD",*Command)==NULL) - { - StringList ArcMasks; - ArcMasks.AddString(ArcName); - ScanTree Scan(&ArcMasks,Recurse,SaveLinks,SCAN_SKIPDIRS); - FindData FindData; - while (Scan.GetNext(&FindData)==SCAN_SUCCESS) - AddArcName(FindData.Name,FindData.NameW); - } - else - AddArcName(ArcName,NULL); -#endif - - switch(Command[0]) - { - case 'P': - case 'X': - case 'E': - case 'T': - case 'I': - { - CmdExtract Extract; - Extract.DoExtract(this); - } - break; -#ifndef SILENT - case 'V': - case 'L': - ListArchive(this); - break; - default: - OutHelp(); -#endif - } - if (!BareOutput) - mprintf("\n"); -} -#endif - - -void CommandData::AddArcName(char *Name,wchar *NameW) -{ - ArcNames->AddString(Name,NameW); -} - - -bool CommandData::GetArcName(char *Name,wchar *NameW,int MaxSize) -{ - if (!ArcNames->GetString(Name,NameW,NM)) - return(false); - return(true); -} - - -bool CommandData::IsSwitch(int Ch) -{ -#if defined(_WIN_32) || defined(_EMX) - return(Ch=='-' || Ch=='/'); -#else - return(Ch=='-'); -#endif -} - - -#ifndef SFX_MODULE -uint CommandData::GetExclAttr(char *Str) -{ - if (isdigit(*Str)) - return(strtol(Str,NULL,0)); - else - { - uint Attr; - for (Attr=0;*Str;Str++) - switch(etoupper(*Str)) - { -#ifdef _UNIX - case 'D': - Attr|=S_IFDIR; - break; - case 'V': - Attr|=S_IFCHR; - break; -#elif defined(_WIN_32) || defined(_EMX) - case 'R': - Attr|=0x1; - break; - case 'H': - Attr|=0x2; - break; - case 'S': - Attr|=0x4; - break; - case 'D': - Attr|=0x10; - break; - case 'A': - Attr|=0x20; - break; -#endif - } - return(Attr); - } -} -#endif - - - - -#ifndef SFX_MODULE -bool CommandData::CheckWinSize() -{ - static int ValidSize[]={ - 0x10000,0x20000,0x40000,0x80000,0x100000,0x200000,0x400000 - }; - for (int I=0;IGetChar()); -} - - -void RangeCoder::InitDecoder(Unpack *UnpackRead) -{ - RangeCoder::UnpackRead=UnpackRead; - - low=code=0; - range=uint(-1); - for (int i=0;i < 4;i++) - code=(code << 8) | GetChar(); -} - - -#define ARI_DEC_NORMALIZE(code,low,range,read) \ -{ \ - while ((low^(low+range))GetChar(); \ - range <<= 8; \ - low <<= 8; \ - } \ -} - - -inline int RangeCoder::GetCurrentCount() -{ - return (code-low)/(range /= SubRange.scale); -} - - -inline uint RangeCoder::GetCurrentShiftCount(uint SHIFT) -{ - return (code-low)/(range >>= SHIFT); -} - - -inline void RangeCoder::Decode() -{ - low += range*SubRange.LowCount; - range *= SubRange.HighCount-SubRange.LowCount; -} diff --git a/src/bin/unrar/coder.hpp b/src/bin/unrar/coder.hpp deleted file mode 100644 index f09f911c09..0000000000 --- a/src/bin/unrar/coder.hpp +++ /dev/null @@ -1,24 +0,0 @@ -/**************************************************************************** - * Contents: 'Carryless rangecoder' by Dmitry Subbotin * - ****************************************************************************/ - -const uint TOP=1 << 24, BOT=1 << 15; - -class RangeCoder -{ - public: - void InitDecoder(Unpack *UnpackRead); - inline int GetCurrentCount(); - inline uint GetCurrentShiftCount(uint SHIFT); - inline void Decode(); - inline void PutChar(unsigned int c); - inline unsigned int GetChar(); - - uint low, code, range; - struct SUBRANGE - { - uint LowCount, HighCount, scale; - } SubRange; - - Unpack *UnpackRead; -}; diff --git a/src/bin/unrar/compress.hpp b/src/bin/unrar/compress.hpp deleted file mode 100644 index 3181e45de7..0000000000 --- a/src/bin/unrar/compress.hpp +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef _RAR_COMPRESS_ -#define _RAR_COMPRESS_ - -class ComprDataIO; -class PackingFileTable; - -#define CODEBUFSIZE 0x4000 -#define MAXWINSIZE 0x400000 -#define MAXWINMASK (MAXWINSIZE-1) - -#define LOW_DIST_REP_COUNT 16 - -#define NC 299 /* alphabet = {0, 1, 2, ..., NC - 1} */ -#define DC 60 -#define LDC 17 -#define RC 28 -#define HUFF_TABLE_SIZE (NC+DC+RC+LDC) -#define BC 20 - -#define NC20 298 /* alphabet = {0, 1, 2, ..., NC - 1} */ -#define DC20 48 -#define RC20 28 -#define BC20 19 -#define MC20 257 - -enum {CODE_HUFFMAN,CODE_LZ,CODE_LZ2,CODE_REPEATLZ,CODE_CACHELZ, - CODE_STARTFILE,CODE_ENDFILE,CODE_VM,CODE_VMDATA}; - - -enum FilterType { - FILTER_NONE, FILTER_PPM /*dummy*/, FILTER_E8, FILTER_E8E9, - FILTER_UPCASETOLOW, FILTER_AUDIO, FILTER_RGB, FILTER_DELTA, - FILTER_ITANIUM, FILTER_E8E9V2 -}; - -#endif diff --git a/src/bin/unrar/consio.cpp b/src/bin/unrar/consio.cpp deleted file mode 100644 index f1f4ba0965..0000000000 --- a/src/bin/unrar/consio.cpp +++ /dev/null @@ -1,289 +0,0 @@ -#include "rar.hpp" - -#ifndef GUI -#include "log.cpp" -#endif - -#if !defined(GUI) && !defined(SILENT) -static void RawPrint(char *Msg,MESSAGE_TYPE MessageType); -#endif - -static MESSAGE_TYPE MsgStream=MSG_STDOUT; -static bool Sound=false; -const int MaxMsgSize=2*NM+2048; - -void InitConsoleOptions(MESSAGE_TYPE MsgStream,bool Sound) -{ - ::MsgStream=MsgStream; - ::Sound=Sound; -} - -#if !defined(GUI) && !defined(SILENT) -void mprintf(const char *fmt,...) -{ - if (MsgStream==MSG_NULL || MsgStream==MSG_ERRONLY) - return; - safebuf char Msg[MaxMsgSize]; - va_list argptr; - va_start(argptr,fmt); - vsprintf(Msg,fmt,argptr); - RawPrint(Msg,MsgStream); - va_end(argptr); -} -#endif - - -#if !defined(GUI) && !defined(SILENT) -void eprintf(const char *fmt,...) -{ - if (MsgStream==MSG_NULL) - return; - safebuf char Msg[MaxMsgSize]; - va_list argptr; - va_start(argptr,fmt); - vsprintf(Msg,fmt,argptr); - RawPrint(Msg,MSG_STDERR); - va_end(argptr); -} -#endif - - -#if !defined(GUI) && !defined(SILENT) -void RawPrint(char *Msg,MESSAGE_TYPE MessageType) -{ - File OutFile; - switch(MessageType) - { - case MSG_STDOUT: - OutFile.SetHandleType(FILE_HANDLESTD); - break; - case MSG_STDERR: - case MSG_ERRONLY: - OutFile.SetHandleType(FILE_HANDLEERR); - break; - default: - return; - } -#ifdef _WIN_32 - CharToOem(Msg,Msg); - - char OutMsg[MaxMsgSize],*OutPos=OutMsg; - for (int I=0;Msg[I]!=0;I++) - { - if (Msg[I]=='\n' && (I==0 || Msg[I-1]!='\r')) - *(OutPos++)='\r'; - *(OutPos++)=Msg[I]; - } - *OutPos=0; - strcpy(Msg,OutMsg); -#endif -#if defined(_UNIX) || defined(_EMX) - char OutMsg[MaxMsgSize],*OutPos=OutMsg; - for (int I=0;Msg[I]!=0;I++) - if (Msg[I]!='\r') - *(OutPos++)=Msg[I]; - *OutPos=0; - strcpy(Msg,OutMsg); -#endif - - OutFile.Write(Msg,strlen(Msg)); -// OutFile.Flush(); -} -#endif - - -#ifndef SILENT -void Alarm() -{ -#ifndef SFX_MODULE - if (Sound) - putchar('\007'); -#endif -} -#endif - - -#ifndef SILENT -#ifndef GUI -void GetPasswordText(char *Str,int MaxLength) -{ -#ifdef _WIN_32 - HANDLE hConIn=GetStdHandle(STD_INPUT_HANDLE); - HANDLE hConOut=GetStdHandle(STD_OUTPUT_HANDLE); - DWORD ConInMode,ConOutMode; - DWORD Read=0; - GetConsoleMode(hConIn,&ConInMode); - GetConsoleMode(hConOut,&ConOutMode); - SetConsoleMode(hConIn,ENABLE_LINE_INPUT); - SetConsoleMode(hConOut,ENABLE_PROCESSED_OUTPUT|ENABLE_WRAP_AT_EOL_OUTPUT); - ReadConsole(hConIn,Str,MaxLength-1,&Read,NULL); - Str[Read]=0; - OemToChar(Str,Str); - SetConsoleMode(hConIn,ConInMode); - SetConsoleMode(hConOut,ConOutMode); -#elif defined(_EMX) || defined(_BEOS) || defined(__sparc) || defined(sparc) || defined (__VMS) - fgets(Str,MaxLength-1,stdin); -#else - strncpyz(Str,getpass(""),MaxLength); -#endif - Str[MaxLength-1]=0; - RemoveLF(Str); -} -#endif -#endif - - -#if !defined(GUI) && !defined(SILENT) -unsigned int GetKey() -{ -#ifdef SILENT - return(0); -#else - char Str[80]; -#ifdef __GNUC__ - fgets(Str,sizeof(Str),stdin); - return(Str[0]); -#else - File SrcFile; - SrcFile.SetHandleType(FILE_HANDLESTD); - SrcFile.Read(Str,sizeof(Str)); - return(Str[0]); -#endif -#endif -} -#endif - - -#ifndef SILENT -bool GetPassword(PASSWORD_TYPE Type,const char *FileName,char *Password,int MaxLength) -{ - Alarm(); - while (true) - { - char PromptStr[NM+256]; -#if defined(_EMX) || defined(_BEOS) - strcpy(PromptStr,St(MAskPswEcho)); -#else - strcpy(PromptStr,St(MAskPsw)); -#endif - if (Type!=PASSWORD_GLOBAL) - { - strcat(PromptStr,St(MFor)); - char *NameOnly=PointToName(FileName); - if (strlen(PromptStr)+strlen(NameOnly)4 ? "\n":" "):", "); - int KeyPos=ItemKeyPos[I]; - for (int J=0;J>1)^0xEDB88320L : (C>>1); - CRCTab[I]=C; - } -} - - -uint CRC(uint StartCRC,const void *Addr,uint Size) -{ - if (CRCTab[1]==0) - InitCRC(); - byte *Data=(byte *)Addr; -#if defined(LITTLE_ENDIAN) && defined(PRESENT_INT32) && defined(ALLOW_NOT_ALIGNED_INT) - while (Size>0 && ((long)Data & 7)) - { - StartCRC=CRCTab[(byte)(StartCRC^Data[0])]^(StartCRC>>8); - Size--; - Data++; - } - while (Size>=8) - { - StartCRC^=*(uint32 *)Data; - StartCRC=CRCTab[(byte)StartCRC]^(StartCRC>>8); - StartCRC=CRCTab[(byte)StartCRC]^(StartCRC>>8); - StartCRC=CRCTab[(byte)StartCRC]^(StartCRC>>8); - StartCRC=CRCTab[(byte)StartCRC]^(StartCRC>>8); - StartCRC^=*(uint32 *)(Data+4); - StartCRC=CRCTab[(byte)StartCRC]^(StartCRC>>8); - StartCRC=CRCTab[(byte)StartCRC]^(StartCRC>>8); - StartCRC=CRCTab[(byte)StartCRC]^(StartCRC>>8); - StartCRC=CRCTab[(byte)StartCRC]^(StartCRC>>8); - Data+=8; - Size-=8; - } -#endif - for (int I=0;I>8); - return(StartCRC); -} - -#ifndef SFX_MODULE -ushort OldCRC(ushort StartCRC,const void *Addr,uint Size) -{ - byte *Data=(byte *)Addr; - for (int I=0;I>15))&0xffff; - } - return(StartCRC); -} -#endif diff --git a/src/bin/unrar/crc.hpp b/src/bin/unrar/crc.hpp deleted file mode 100644 index 47ee7e230b..0000000000 --- a/src/bin/unrar/crc.hpp +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef _RAR_CRC_ -#define _RAR_CRC_ - -extern uint CRCTab[256]; - -void InitCRC(); -uint CRC(uint StartCRC,const void *Addr,uint Size); -ushort OldCRC(ushort StartCRC,const void *Addr,uint Size); - -#endif diff --git a/src/bin/unrar/crypt.cpp b/src/bin/unrar/crypt.cpp deleted file mode 100644 index 04a1d7086b..0000000000 --- a/src/bin/unrar/crypt.cpp +++ /dev/null @@ -1,381 +0,0 @@ -#include "rar.hpp" - -#ifndef SFX_MODULE -extern uint CRCTab[256]; -#endif - -#define NROUNDS 32 - -#define rol(x,n,xsize) (((x)<<(n)) | ((x)>>(xsize-(n)))) -#define ror(x,n,xsize) (((x)>>(n)) | ((x)<<(xsize-(n)))) - -#define substLong(t) ( (uint)SubstTable[(uint)t&255] | \ - ((uint)SubstTable[(int)(t>> 8)&255]<< 8) | \ - ((uint)SubstTable[(int)(t>>16)&255]<<16) | \ - ((uint)SubstTable[(int)(t>>24)&255]<<24) ) - -CryptKeyCacheItem CryptData::Cache[4]; -int CryptData::CachePos=0; - - -#ifndef SFX_MODULE -static byte InitSubstTable[256]={ - 215, 19,149, 35, 73,197,192,205,249, 28, 16,119, 48,221, 2, 42, - 232, 1,177,233, 14, 88,219, 25,223,195,244, 90, 87,239,153,137, - 255,199,147, 70, 92, 66,246, 13,216, 40, 62, 29,217,230, 86, 6, - 71, 24,171,196,101,113,218,123, 93, 91,163,178,202, 67, 44,235, - 107,250, 75,234, 49,167,125,211, 83,114,157,144, 32,193,143, 36, - 158,124,247,187, 89,214,141, 47,121,228, 61,130,213,194,174,251, - 97,110, 54,229,115, 57,152, 94,105,243,212, 55,209,245, 63, 11, - 164,200, 31,156, 81,176,227, 21, 76, 99,139,188,127, 17,248, 51, - 207,120,189,210, 8,226, 41, 72,183,203,135,165,166, 60, 98, 7, - 122, 38,155,170, 69,172,252,238, 39,134, 59,128,236, 27,240, 80, - 131, 3, 85,206,145, 79,154,142,159,220,201,133, 74, 64, 20,129, - 224,185,138,103,173,182, 43, 34,254, 82,198,151,231,180, 58, 10, - 118, 26,102, 12, 50,132, 22,191,136,111,162,179, 45, 4,148,108, - 161, 56, 78,126,242,222, 15,175,146, 23, 33,241,181,190, 77,225, - 0, 46,169,186, 68, 95,237, 65, 53,208,253,168, 9, 18,100, 52, - 116,184,160, 96,109, 37, 30,106,140,104,150, 5,204,117,112, 84 -}; -#endif - - - -void CryptData::DecryptBlock(byte *Buf,int Size) -{ - rin.blockDecrypt(Buf,Size,Buf); -} - - -#ifndef SFX_MODULE -void CryptData::EncryptBlock20(byte *Buf) -{ - uint A,B,C,D,T,TA,TB; -#if defined(BIG_ENDIAN) || !defined(PRESENT_INT32) || !defined(ALLOW_NOT_ALIGNED_INT) - A=((uint)Buf[0]|((uint)Buf[1]<<8)|((uint)Buf[2]<<16)|((uint)Buf[3]<<24))^Key[0]; - B=((uint)Buf[4]|((uint)Buf[5]<<8)|((uint)Buf[6]<<16)|((uint)Buf[7]<<24))^Key[1]; - C=((uint)Buf[8]|((uint)Buf[9]<<8)|((uint)Buf[10]<<16)|((uint)Buf[11]<<24))^Key[2]; - D=((uint)Buf[12]|((uint)Buf[13]<<8)|((uint)Buf[14]<<16)|((uint)Buf[15]<<24))^Key[3]; -#else - uint32 *BufPtr=(uint32 *)Buf; - A=BufPtr[0]^Key[0]; - B=BufPtr[1]^Key[1]; - C=BufPtr[2]^Key[2]; - D=BufPtr[3]^Key[3]; -#endif - for(int I=0;I>8); - Buf[2]=(byte)(C>>16); - Buf[3]=(byte)(C>>24); - D^=Key[1]; - Buf[4]=(byte)D; - Buf[5]=(byte)(D>>8); - Buf[6]=(byte)(D>>16); - Buf[7]=(byte)(D>>24); - A^=Key[2]; - Buf[8]=(byte)A; - Buf[9]=(byte)(A>>8); - Buf[10]=(byte)(A>>16); - Buf[11]=(byte)(A>>24); - B^=Key[3]; - Buf[12]=(byte)B; - Buf[13]=(byte)(B>>8); - Buf[14]=(byte)(B>>16); - Buf[15]=(byte)(B>>24); -#else - BufPtr[0]=C^Key[0]; - BufPtr[1]=D^Key[1]; - BufPtr[2]=A^Key[2]; - BufPtr[3]=B^Key[3]; -#endif - UpdKeys(Buf); -} - - -void CryptData::DecryptBlock20(byte *Buf) -{ - byte InBuf[16]; - uint A,B,C,D,T,TA,TB; -#if defined(BIG_ENDIAN) || !defined(PRESENT_INT32) || !defined(ALLOW_NOT_ALIGNED_INT) - A=((uint)Buf[0]|((uint)Buf[1]<<8)|((uint)Buf[2]<<16)|((uint)Buf[3]<<24))^Key[0]; - B=((uint)Buf[4]|((uint)Buf[5]<<8)|((uint)Buf[6]<<16)|((uint)Buf[7]<<24))^Key[1]; - C=((uint)Buf[8]|((uint)Buf[9]<<8)|((uint)Buf[10]<<16)|((uint)Buf[11]<<24))^Key[2]; - D=((uint)Buf[12]|((uint)Buf[13]<<8)|((uint)Buf[14]<<16)|((uint)Buf[15]<<24))^Key[3]; -#else - uint32 *BufPtr=(uint32 *)Buf; - A=BufPtr[0]^Key[0]; - B=BufPtr[1]^Key[1]; - C=BufPtr[2]^Key[2]; - D=BufPtr[3]^Key[3]; -#endif - memcpy(InBuf,Buf,sizeof(InBuf)); - for(int I=NROUNDS-1;I>=0;I--) - { - T=((C+rol(D,11,32))^Key[I&3]); - TA=A^substLong(T); - T=((D^rol(C,17,32))+Key[I&3]); - TB=B^substLong(T); - A=C; - B=D; - C=TA; - D=TB; - } -#if defined(BIG_ENDIAN) || !defined(PRESENT_INT32) || !defined(ALLOW_NOT_ALIGNED_INT) - C^=Key[0]; - Buf[0]=(byte)C; - Buf[1]=(byte)(C>>8); - Buf[2]=(byte)(C>>16); - Buf[3]=(byte)(C>>24); - D^=Key[1]; - Buf[4]=(byte)D; - Buf[5]=(byte)(D>>8); - Buf[6]=(byte)(D>>16); - Buf[7]=(byte)(D>>24); - A^=Key[2]; - Buf[8]=(byte)A; - Buf[9]=(byte)(A>>8); - Buf[10]=(byte)(A>>16); - Buf[11]=(byte)(A>>24); - B^=Key[3]; - Buf[12]=(byte)B; - Buf[13]=(byte)(B>>8); - Buf[14]=(byte)(B>>16); - Buf[15]=(byte)(B>>24); -#else - BufPtr[0]=C^Key[0]; - BufPtr[1]=D^Key[1]; - BufPtr[2]=A^Key[2]; - BufPtr[3]=B^Key[3]; -#endif - UpdKeys(InBuf); -} - - -void CryptData::UpdKeys(byte *Buf) -{ - for (int I=0;I<16;I+=4) - { - Key[0]^=CRCTab[Buf[I]]; - Key[1]^=CRCTab[Buf[I+1]]; - Key[2]^=CRCTab[Buf[I+2]]; - Key[3]^=CRCTab[Buf[I+3]]; - } -} - - -void CryptData::Swap(byte *Ch1,byte *Ch2) -{ - byte Ch=*Ch1; - *Ch1=*Ch2; - *Ch2=Ch; -} -#endif - - -void CryptData::SetCryptKeys(char *Password,byte *Salt,bool Encrypt,bool OldOnly,bool HandsOffHash) -{ - if (*Password==0) - return; - if (OldOnly) - { -#ifndef SFX_MODULE - if (CRCTab[1]==0) - InitCRC(); - byte Psw[MAXPASSWORD]; - SetOldKeys(Password); - Key[0]=0xD3A3B879L; - Key[1]=0x3F6D12F7L; - Key[2]=0x7515A235L; - Key[3]=0xA4E7F123L; - memset(Psw,0,sizeof(Psw)); -#if defined(_WIN_32) && !defined(GUI) - CharToOemBuff(Password,(char*)Psw,strlen(Password)); -#else - strncpyz((char *)Psw,Password,ASIZE(Psw)); -#endif - int PswLength=strlen(Password); - memcpy(SubstTable,InitSubstTable,sizeof(SubstTable)); - for (int J=0;J<256;J++) - for (int I=0;I>8); - PswNum[2]=(byte)(I>>16); - hash_process( &c, PswNum, 3, HandsOffHash); - if (I%(HashRounds/16)==0) - { - hash_context tempc=c; - uint32 digest[5]; - hash_final( &tempc, digest, HandsOffHash); - AESInit[I/(HashRounds/16)]=(byte)digest[4]; - } - } - uint32 digest[5]; - hash_final( &c, digest, HandsOffHash); - for (int I=0;I<4;I++) - for (int J=0;J<4;J++) - AESKey[I*4+J]=(byte)(digest[I]>>(J*8)); - - strcpy(Cache[CachePos].Password,Password); - if ((Cache[CachePos].SaltPresent=(Salt!=NULL))==true) - memcpy(Cache[CachePos].Salt,Salt,SALT_SIZE); - Cache[CachePos].HandsOffHash=HandsOffHash; - memcpy(Cache[CachePos].AESKey,AESKey,sizeof(AESKey)); - memcpy(Cache[CachePos].AESInit,AESInit,sizeof(AESInit)); - CachePos=(CachePos+1)%(sizeof(Cache)/sizeof(Cache[0])); - } - rin.init(Encrypt ? Rijndael::Encrypt : Rijndael::Decrypt,AESKey,AESInit); -} - - -#ifndef SFX_MODULE -void CryptData::SetOldKeys(char *Password) -{ - uint PswCRC=CRC(0xffffffff,Password,strlen(Password)); - OldKey[0]=PswCRC&0xffff; - OldKey[1]=(PswCRC>>16)&0xffff; - OldKey[2]=OldKey[3]=0; - PN1=PN2=PN3=0; - byte Ch; - while ((Ch=*Password)!=0) - { - PN1+=Ch; - PN2^=Ch; - PN3+=Ch; - PN3=(byte)rol(PN3,1,8); - OldKey[2]^=Ch^CRCTab[Ch]; - OldKey[3]+=Ch+(CRCTab[Ch]>>16); - Password++; - } -} - - -void CryptData::SetAV15Encryption() -{ - OldKey[0]=0x4765; - OldKey[1]=0x9021; - OldKey[2]=0x7382; - OldKey[3]=0x5215; -} - - -void CryptData::SetCmt13Encryption() -{ - PN1=0; - PN2=7; - PN3=77; -} - - -void CryptData::Crypt(byte *Data,uint Count,int Method) -{ - if (Method==OLD_DECODE) - Decode13(Data,Count); - else - if (Method==OLD_ENCODE) - Encode13(Data,Count); - else - Crypt15(Data,Count); -} - - -void CryptData::Encode13(byte *Data,uint Count) -{ - while (Count--) - { - PN2+=PN3; - PN1+=PN2; - *Data+=PN1; - Data++; - } -} - - -void CryptData::Decode13(byte *Data,uint Count) -{ - while (Count--) - { - PN2+=PN3; - PN1+=PN2; - *Data-=PN1; - Data++; - } -} - - -void CryptData::Crypt15(byte *Data,uint Count) -{ - while (Count--) - { - OldKey[0]+=0x1234; - OldKey[1]^=CRCTab[(OldKey[0] & 0x1fe)>>1]; - OldKey[2]-=CRCTab[(OldKey[0] & 0x1fe)>>1]>>16; - OldKey[0]^=OldKey[2]; - OldKey[3]=ror(OldKey[3]&0xffff,1,16)^OldKey[1]; - OldKey[3]=ror(OldKey[3]&0xffff,1,16); - OldKey[0]^=OldKey[3]; - *Data^=(byte)(OldKey[0]>>8); - Data++; - } -} -#endif - - diff --git a/src/bin/unrar/crypt.hpp b/src/bin/unrar/crypt.hpp deleted file mode 100644 index e70aaa3f73..0000000000 --- a/src/bin/unrar/crypt.hpp +++ /dev/null @@ -1,62 +0,0 @@ -#ifndef _RAR_CRYPT_ -#define _RAR_CRYPT_ - -enum { OLD_DECODE=0,OLD_ENCODE=1,NEW_CRYPT=2 }; - - -struct CryptKeyCacheItem -{ -#ifndef _SFX_RTL_ - CryptKeyCacheItem() - { - *Password=0; - } - - ~CryptKeyCacheItem() - { - memset(AESKey,0,sizeof(AESKey)); - memset(AESInit,0,sizeof(AESInit)); - memset(Password,0,sizeof(Password)); - } -#endif - byte AESKey[16],AESInit[16]; - char Password[MAXPASSWORD]; - bool SaltPresent; - byte Salt[SALT_SIZE]; - bool HandsOffHash; -}; - -class CryptData -{ - private: - void Encode13(byte *Data,uint Count); - void Decode13(byte *Data,uint Count); - void Crypt15(byte *Data,uint Count); - void UpdKeys(byte *Buf); - void Swap(byte *Ch1,byte *Ch2); - void SetOldKeys(char *Password); - - Rijndael rin; - - byte SubstTable[256]; - uint Key[4]; - ushort OldKey[4]; - byte PN1,PN2,PN3; - - byte AESKey[16],AESInit[16]; - - static CryptKeyCacheItem Cache[4]; - static int CachePos; - public: - void SetCryptKeys(char *Password,byte *Salt,bool Encrypt,bool OldOnly,bool HandsOffHash); - void SetAV15Encryption(); - void SetCmt13Encryption(); - void EncryptBlock20(byte *Buf); - void DecryptBlock20(byte *Buf); - void EncryptBlock(byte *Buf,int Size); - void DecryptBlock(byte *Buf,int Size); - void Crypt(byte *Data,uint Count,int Method); - static void SetSalt(byte *Salt,int SaltSize); -}; - -#endif diff --git a/src/bin/unrar/dll.cpp b/src/bin/unrar/dll.cpp deleted file mode 100644 index f1a2cc90ea..0000000000 --- a/src/bin/unrar/dll.cpp +++ /dev/null @@ -1,365 +0,0 @@ -#include "rar.hpp" -#include "dll.hpp" - -static int RarErrorToDll(int ErrCode); - -struct DataSet -{ - CommandData Cmd; - CmdExtract Extract; - Archive Arc; - int OpenMode; - int HeaderSize; - - DataSet():Arc(&Cmd) {}; -}; - - -HANDLE PASCAL RAROpenArchive(struct RAROpenArchiveData *r) -{ - RAROpenArchiveDataEx rx; - memset(&rx,0,sizeof(rx)); - rx.ArcName=r->ArcName; - rx.OpenMode=r->OpenMode; - rx.CmtBuf=r->CmtBuf; - rx.CmtBufSize=r->CmtBufSize; - HANDLE hArc=RAROpenArchiveEx(&rx); - r->OpenResult=rx.OpenResult; - r->CmtSize=rx.CmtSize; - r->CmtState=rx.CmtState; - return(hArc); -} - - -HANDLE PASCAL RAROpenArchiveEx(struct RAROpenArchiveDataEx *r) -{ - try - { - r->OpenResult=0; - DataSet *Data=new DataSet; - Data->Cmd.DllError=0; - Data->OpenMode=r->OpenMode; - Data->Cmd.FileArgs->AddString("*"); - - char an[NM]; - if (r->ArcName==NULL && r->ArcNameW!=NULL) - { - WideToChar(r->ArcNameW,an,NM); - r->ArcName=an; - } - - Data->Cmd.AddArcName(r->ArcName,r->ArcNameW); - Data->Cmd.Overwrite=OVERWRITE_ALL; - Data->Cmd.VersionControl=1; - if (!Data->Arc.Open(r->ArcName,r->ArcNameW)) - { - r->OpenResult=ERAR_EOPEN; - delete Data; - return(NULL); - } - if (!Data->Arc.IsArchive(false)) - { - r->OpenResult=Data->Cmd.DllError!=0 ? Data->Cmd.DllError:ERAR_BAD_ARCHIVE; - delete Data; - return(NULL); - } - r->Flags=Data->Arc.NewMhd.Flags; - Array CmtData; - if (r->CmtBufSize!=0 && Data->Arc.GetComment(&CmtData,NULL)) - { - r->Flags|=2; - int Size=CmtData.Size()+1; - r->CmtState=Size>r->CmtBufSize ? ERAR_SMALL_BUF:1; - r->CmtSize=Min(Size,r->CmtBufSize); - memcpy(r->CmtBuf,&CmtData[0],r->CmtSize-1); - if (Size<=r->CmtBufSize) - r->CmtBuf[r->CmtSize-1]=0; - } - else - r->CmtState=r->CmtSize=0; - if (Data->Arc.Signed) - r->Flags|=0x20; - Data->Extract.ExtractArchiveInit(&Data->Cmd,Data->Arc); - return((HANDLE)Data); - } - catch (int ErrCode) - { - r->OpenResult=RarErrorToDll(ErrCode); - return(NULL); - } -} - - -int PASCAL RARCloseArchive(HANDLE hArcData) -{ - DataSet *Data=(DataSet *)hArcData; - bool Success=Data==NULL ? false:Data->Arc.Close(); - delete Data; - return(Success ? 0:ERAR_ECLOSE); -} - - -int PASCAL RARReadHeader(HANDLE hArcData,struct RARHeaderData *D) -{ - DataSet *Data=(DataSet *)hArcData; - try - { - if ((Data->HeaderSize=Data->Arc.SearchBlock(FILE_HEAD))<=0) - { - if (Data->Arc.Volume && Data->Arc.GetHeaderType()==ENDARC_HEAD && - (Data->Arc.EndArcHead.Flags & EARC_NEXT_VOLUME)) - if (MergeArchive(Data->Arc,NULL,false,'L')) - { - Data->Extract.SignatureFound=false; - Data->Arc.Seek(Data->Arc.CurBlockPos,SEEK_SET); - return(RARReadHeader(hArcData,D)); - } - else - return(ERAR_EOPEN); - return(Data->Arc.BrokenFileHeader ? ERAR_BAD_DATA:ERAR_END_ARCHIVE); - } - if (Data->OpenMode==RAR_OM_LIST && (Data->Arc.NewLhd.Flags & LHD_SPLIT_BEFORE)) - { - int Code=RARProcessFile(hArcData,RAR_SKIP,NULL,NULL); - if (Code==0) - return(RARReadHeader(hArcData,D)); - else - return(Code); - } - strncpyz(D->ArcName,Data->Arc.FileName,ASIZE(D->ArcName)); - strncpyz(D->FileName,Data->Arc.NewLhd.FileName,ASIZE(D->FileName)); - D->Flags=Data->Arc.NewLhd.Flags; - D->PackSize=Data->Arc.NewLhd.PackSize; - D->UnpSize=Data->Arc.NewLhd.UnpSize; - D->HostOS=Data->Arc.NewLhd.HostOS; - D->FileCRC=Data->Arc.NewLhd.FileCRC; - D->FileTime=Data->Arc.NewLhd.FileTime; - D->UnpVer=Data->Arc.NewLhd.UnpVer; - D->Method=Data->Arc.NewLhd.Method; - D->FileAttr=Data->Arc.NewLhd.FileAttr; - D->CmtSize=0; - D->CmtState=0; - } - catch (int ErrCode) - { - return(RarErrorToDll(ErrCode)); - } - return(0); -} - - -int PASCAL RARReadHeaderEx(HANDLE hArcData,struct RARHeaderDataEx *D) -{ - DataSet *Data=(DataSet *)hArcData; - try - { - if ((Data->HeaderSize=Data->Arc.SearchBlock(FILE_HEAD))<=0) - { - if (Data->Arc.Volume && Data->Arc.GetHeaderType()==ENDARC_HEAD && - (Data->Arc.EndArcHead.Flags & EARC_NEXT_VOLUME)) - if (MergeArchive(Data->Arc,NULL,false,'L')) - { - Data->Extract.SignatureFound=false; - Data->Arc.Seek(Data->Arc.CurBlockPos,SEEK_SET); - return(RARReadHeaderEx(hArcData,D)); - } - else - return(ERAR_EOPEN); - return(Data->Arc.BrokenFileHeader ? ERAR_BAD_DATA:ERAR_END_ARCHIVE); - } - if (Data->OpenMode==RAR_OM_LIST && (Data->Arc.NewLhd.Flags & LHD_SPLIT_BEFORE)) - { - int Code=RARProcessFile(hArcData,RAR_SKIP,NULL,NULL); - if (Code==0) - return(RARReadHeaderEx(hArcData,D)); - else - return(Code); - } - strncpyz(D->ArcName,Data->Arc.FileName,ASIZE(D->ArcName)); - if (*Data->Arc.FileNameW) - strncpyw(D->ArcNameW,Data->Arc.FileNameW,sizeof(D->ArcNameW)); - else - CharToWide(Data->Arc.FileName,D->ArcNameW); - strncpyz(D->FileName,Data->Arc.NewLhd.FileName,ASIZE(D->FileName)); - if (*Data->Arc.NewLhd.FileNameW) - strncpyw(D->FileNameW,Data->Arc.NewLhd.FileNameW,sizeof(D->FileNameW)); - else - { -#ifdef _WIN_32 - char AnsiName[NM]; - OemToChar(Data->Arc.NewLhd.FileName,AnsiName); - CharToWide(AnsiName,D->FileNameW); -#else - CharToWide(Data->Arc.NewLhd.FileName,D->FileNameW); -#endif - } - D->Flags=Data->Arc.NewLhd.Flags; - D->PackSize=Data->Arc.NewLhd.PackSize; - D->PackSizeHigh=Data->Arc.NewLhd.HighPackSize; - D->UnpSize=Data->Arc.NewLhd.UnpSize; - D->UnpSizeHigh=Data->Arc.NewLhd.HighUnpSize; - D->HostOS=Data->Arc.NewLhd.HostOS; - D->FileCRC=Data->Arc.NewLhd.FileCRC; - D->FileTime=Data->Arc.NewLhd.FileTime; - D->UnpVer=Data->Arc.NewLhd.UnpVer; - D->Method=Data->Arc.NewLhd.Method; - D->FileAttr=Data->Arc.NewLhd.FileAttr; - D->CmtSize=0; - D->CmtState=0; - } - catch (int ErrCode) - { - return(RarErrorToDll(ErrCode)); - } - return(0); -} - - -int PASCAL ProcessFile(HANDLE hArcData,int Operation,char *DestPath,char *DestName,wchar *DestPathW,wchar *DestNameW) -{ - DataSet *Data=(DataSet *)hArcData; - try - { - Data->Cmd.DllError=0; - if (Data->OpenMode==RAR_OM_LIST || Operation==RAR_SKIP && !Data->Arc.Solid) - { - if (/*Data->OpenMode==RAR_OM_LIST && */Data->Arc.Volume && - Data->Arc.GetHeaderType()==FILE_HEAD && - (Data->Arc.NewLhd.Flags & LHD_SPLIT_AFTER)!=0) - if (MergeArchive(Data->Arc,NULL,false,'L')) - { - Data->Extract.SignatureFound=false; - Data->Arc.Seek(Data->Arc.CurBlockPos,SEEK_SET); - return(0); - } - else - return(ERAR_EOPEN); - Data->Arc.SeekToNext(); - } - else - { - Data->Cmd.DllOpMode=Operation; - - if (DestPath!=NULL || DestName!=NULL) - { -#ifdef _WIN_32 - OemToChar(NullToEmpty(DestPath),Data->Cmd.ExtrPath); -#else - strcpy(Data->Cmd.ExtrPath,NullToEmpty(DestPath)); -#endif - AddEndSlash(Data->Cmd.ExtrPath); -#ifdef _WIN_32 - OemToChar(NullToEmpty(DestName),Data->Cmd.DllDestName); -#else - strcpy(Data->Cmd.DllDestName,NullToEmpty(DestName)); -#endif - } - else - { - *Data->Cmd.ExtrPath=0; - *Data->Cmd.DllDestName=0; - } - - if (DestPathW!=NULL || DestNameW!=NULL) - { - strncpyw(Data->Cmd.ExtrPathW,NullToEmpty(DestPathW),NM-2); - AddEndSlash(Data->Cmd.ExtrPathW); - strncpyw(Data->Cmd.DllDestNameW,NullToEmpty(DestNameW),NM-1); - } - else - { - *Data->Cmd.ExtrPathW=0; - *Data->Cmd.DllDestNameW=0; - } - - strcpy(Data->Cmd.Command,Operation==RAR_EXTRACT ? "X":"T"); - Data->Cmd.Test=Operation!=RAR_EXTRACT; - bool Repeat=false; - Data->Extract.ExtractCurrentFile(&Data->Cmd,Data->Arc,Data->HeaderSize,Repeat); - - while (Data->Arc.ReadHeader()!=0 && Data->Arc.GetHeaderType()==NEWSUB_HEAD) - { - Data->Extract.ExtractCurrentFile(&Data->Cmd,Data->Arc,Data->HeaderSize,Repeat); - Data->Arc.SeekToNext(); - } - Data->Arc.Seek(Data->Arc.CurBlockPos,SEEK_SET); - } - } - catch (int ErrCode) - { - return(RarErrorToDll(ErrCode)); - } - return(Data->Cmd.DllError); -} - - -int PASCAL RARProcessFile(HANDLE hArcData,int Operation,char *DestPath,char *DestName) -{ - return(ProcessFile(hArcData,Operation,DestPath,DestName,NULL,NULL)); -} - - -int PASCAL RARProcessFileW(HANDLE hArcData,int Operation,wchar *DestPath,wchar *DestName) -{ - return(ProcessFile(hArcData,Operation,NULL,NULL,DestPath,DestName)); -} - - -void PASCAL RARSetChangeVolProc(HANDLE hArcData,CHANGEVOLPROC ChangeVolProc) -{ - DataSet *Data=(DataSet *)hArcData; - Data->Cmd.ChangeVolProc=ChangeVolProc; -} - - -void PASCAL RARSetCallback(HANDLE hArcData,UNRARCALLBACK Callback,LONG UserData) -{ - DataSet *Data=(DataSet *)hArcData; - Data->Cmd.Callback=Callback; - Data->Cmd.UserData=UserData; -} - - -void PASCAL RARSetProcessDataProc(HANDLE hArcData,PROCESSDATAPROC ProcessDataProc) -{ - DataSet *Data=(DataSet *)hArcData; - Data->Cmd.ProcessDataProc=ProcessDataProc; -} - -#ifndef NOCRYPT -void PASCAL RARSetPassword(HANDLE hArcData,char *Password) -{ - DataSet *Data=(DataSet *)hArcData; - strncpyz(Data->Cmd.Password,Password,ASIZE(Data->Cmd.Password)); -} -#endif - - -int PASCAL RARGetDllVersion() -{ - return(RAR_DLL_VERSION); -} - - -static int RarErrorToDll(int ErrCode) -{ - switch(ErrCode) - { - case FATAL_ERROR: - return(ERAR_EREAD); - case CRC_ERROR: - return(ERAR_BAD_DATA); - case WRITE_ERROR: - return(ERAR_EWRITE); - case OPEN_ERROR: - return(ERAR_EOPEN); - case CREATE_ERROR: - return(ERAR_ECREATE); - case MEMORY_ERROR: - return(ERAR_NO_MEMORY); - case SUCCESS: - return(0); - default: - return(ERAR_UNKNOWN); - } -} diff --git a/src/bin/unrar/dll.def b/src/bin/unrar/dll.def deleted file mode 100644 index 660f69bf6e..0000000000 --- a/src/bin/unrar/dll.def +++ /dev/null @@ -1,12 +0,0 @@ -EXPORTS - RAROpenArchive - RAROpenArchiveEx - RARCloseArchive - RARReadHeader - RARReadHeaderEx - RARProcessFile - RARSetCallback - RARSetChangeVolProc - RARSetProcessDataProc - RARSetPassword - RARGetDllVersion diff --git a/src/bin/unrar/dll.hpp b/src/bin/unrar/dll.hpp deleted file mode 100644 index 4b677441f3..0000000000 --- a/src/bin/unrar/dll.hpp +++ /dev/null @@ -1,138 +0,0 @@ -#ifndef _UNRAR_DLL_ -#define _UNRAR_DLL_ - -#define ERAR_END_ARCHIVE 10 -#define ERAR_NO_MEMORY 11 -#define ERAR_BAD_DATA 12 -#define ERAR_BAD_ARCHIVE 13 -#define ERAR_UNKNOWN_FORMAT 14 -#define ERAR_EOPEN 15 -#define ERAR_ECREATE 16 -#define ERAR_ECLOSE 17 -#define ERAR_EREAD 18 -#define ERAR_EWRITE 19 -#define ERAR_SMALL_BUF 20 -#define ERAR_UNKNOWN 21 -#define ERAR_MISSING_PASSWORD 22 - -#define RAR_OM_LIST 0 -#define RAR_OM_EXTRACT 1 - -#define RAR_SKIP 0 -#define RAR_TEST 1 -#define RAR_EXTRACT 2 - -#define RAR_VOL_ASK 0 -#define RAR_VOL_NOTIFY 1 - -#define RAR_DLL_VERSION 4 - -#ifdef _UNIX -#define CALLBACK -#define PASCAL -#define LONG long -#define HANDLE void * -#define UINT unsigned int -#endif - -struct RARHeaderData -{ - char ArcName[260]; - char FileName[260]; - unsigned int Flags; - unsigned int PackSize; - unsigned int UnpSize; - unsigned int HostOS; - unsigned int FileCRC; - unsigned int FileTime; - unsigned int UnpVer; - unsigned int Method; - unsigned int FileAttr; - char *CmtBuf; - unsigned int CmtBufSize; - unsigned int CmtSize; - unsigned int CmtState; -}; - - -struct RARHeaderDataEx -{ - char ArcName[1024]; - wchar_t ArcNameW[1024]; - char FileName[1024]; - wchar_t FileNameW[1024]; - unsigned int Flags; - unsigned int PackSize; - unsigned int PackSizeHigh; - unsigned int UnpSize; - unsigned int UnpSizeHigh; - unsigned int HostOS; - unsigned int FileCRC; - unsigned int FileTime; - unsigned int UnpVer; - unsigned int Method; - unsigned int FileAttr; - char *CmtBuf; - unsigned int CmtBufSize; - unsigned int CmtSize; - unsigned int CmtState; - unsigned int Reserved[1024]; -}; - - -struct RAROpenArchiveData -{ - char *ArcName; - unsigned int OpenMode; - unsigned int OpenResult; - char *CmtBuf; - unsigned int CmtBufSize; - unsigned int CmtSize; - unsigned int CmtState; -}; - -struct RAROpenArchiveDataEx -{ - char *ArcName; - wchar_t *ArcNameW; - unsigned int OpenMode; - unsigned int OpenResult; - char *CmtBuf; - unsigned int CmtBufSize; - unsigned int CmtSize; - unsigned int CmtState; - unsigned int Flags; - unsigned int Reserved[32]; -}; - -enum UNRARCALLBACK_MESSAGES { - UCM_CHANGEVOLUME,UCM_PROCESSDATA,UCM_NEEDPASSWORD -}; - -typedef int (CALLBACK *UNRARCALLBACK)(UINT msg,LONG UserData,LONG P1,LONG P2); - -typedef int (PASCAL *CHANGEVOLPROC)(char *ArcName,int Mode); -typedef int (PASCAL *PROCESSDATAPROC)(unsigned char *Addr,int Size); - -#ifdef __cplusplus -extern "C" { -#endif - -HANDLE PASCAL RAROpenArchive(struct RAROpenArchiveData *ArchiveData); -HANDLE PASCAL RAROpenArchiveEx(struct RAROpenArchiveDataEx *ArchiveData); -int PASCAL RARCloseArchive(HANDLE hArcData); -int PASCAL RARReadHeader(HANDLE hArcData,struct RARHeaderData *HeaderData); -int PASCAL RARReadHeaderEx(HANDLE hArcData,struct RARHeaderDataEx *HeaderData); -int PASCAL RARProcessFile(HANDLE hArcData,int Operation,char *DestPath,char *DestName); -int PASCAL RARProcessFileW(HANDLE hArcData,int Operation,wchar_t *DestPath,wchar_t *DestName); -void PASCAL RARSetCallback(HANDLE hArcData,UNRARCALLBACK Callback,LONG UserData); -void PASCAL RARSetChangeVolProc(HANDLE hArcData,CHANGEVOLPROC ChangeVolProc); -void PASCAL RARSetProcessDataProc(HANDLE hArcData,PROCESSDATAPROC ProcessDataProc); -void PASCAL RARSetPassword(HANDLE hArcData,char *Password); -int PASCAL RARGetDllVersion(); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/bin/unrar/encname.cpp b/src/bin/unrar/encname.cpp deleted file mode 100644 index 6f57cd912b..0000000000 --- a/src/bin/unrar/encname.cpp +++ /dev/null @@ -1,57 +0,0 @@ -#include "rar.hpp" - -EncodeFileName::EncodeFileName() -{ - Flags=0; - FlagBits=0; - FlagsPos=0; - DestSize=0; -} - - - - -void EncodeFileName::Decode(char *Name,byte *EncName,int EncSize,wchar *NameW, - int MaxDecSize) -{ - int EncPos=0,DecPos=0; - byte HighByte=EncName[EncPos++]; - while (EncPos>6) - { - case 0: - NameW[DecPos++]=EncName[EncPos++]; - break; - case 1: - NameW[DecPos++]=EncName[EncPos++]+(HighByte<<8); - break; - case 2: - NameW[DecPos++]=EncName[EncPos]+(EncName[EncPos+1]<<8); - EncPos+=2; - break; - case 3: - { - int Length=EncName[EncPos++]; - if (Length & 0x80) - { - byte Correction=EncName[EncPos++]; - for (Length=(Length&0x7f)+2;Length>0 && DecPos0 && DecPosMAXPATH) - { - Log(ArcName && *ArcName ? ArcName:NULL,St(MMaxPathLimit),MAXPATH); - } - } -#endif - SysErrMsg(); -#endif -} - - -void ErrorHandler::ReadErrorMsg(const char *ArcName,const char *FileName) -{ -#ifndef SILENT - ErrMsg(ArcName,St(MErrRead),FileName); - SysErrMsg(); -#endif -} - - -void ErrorHandler::WriteErrorMsg(const char *ArcName,const char *FileName) -{ -#ifndef SILENT - ErrMsg(ArcName,St(MErrWrite),FileName); - SysErrMsg(); -#endif -} - - -void ErrorHandler::Exit(int ExitCode) -{ -#ifndef SFX_MODULE - Alarm(); -#endif - Throw(ExitCode); -} - - -#ifndef GUI -void ErrorHandler::ErrMsg(const char *ArcName,const char *fmt,...) -{ - safebuf char Msg[NM+1024]; - va_list argptr; - va_start(argptr,fmt); - vsprintf(Msg,fmt,argptr); - va_end(argptr); -#ifdef _WIN_32 - if (UserBreak) - Sleep(5000); -#endif - Alarm(); - if (*Msg) - { - Log(ArcName,"\n%s",Msg); - mprintf("\n%s\n",St(MProgAborted)); - } -} -#endif - - -void ErrorHandler::SetErrorCode(int Code) -{ - switch(Code) - { - case WARNING: - case USER_BREAK: - if (ExitCode==SUCCESS) - ExitCode=Code; - break; - case FATAL_ERROR: - if (ExitCode==SUCCESS || ExitCode==WARNING) - ExitCode=FATAL_ERROR; - break; - default: - ExitCode=Code; - break; - } - ErrCount++; -} - - -#if !defined(GUI) && !defined(_SFX_RTL_) -#ifdef _WIN_32 -BOOL __stdcall ProcessSignal(DWORD SigType) -#else -#if defined(__sun) -extern "C" -#endif -void _stdfunction ProcessSignal(int SigType) -#endif -{ -#ifdef _WIN_32 - if (SigType==CTRL_LOGOFF_EVENT) - return(TRUE); -#endif - UserBreak=true; - mprintf(St(MBreak)); - for (int I=0;!File::RemoveCreated() && I<3;I++) - { -#ifdef _WIN_32 - Sleep(100); -#endif - } -#if defined(USE_RC) && !defined(SFX_MODULE) && !defined(_WIN_CE) - ExtRes.UnloadDLL(); -#endif - exit(USER_BREAK); -#ifdef _WIN_32 - return(TRUE); -#endif -} -#endif - - -void ErrorHandler::SetSignalHandlers(bool Enable) -{ - EnableBreak=Enable; -#if !defined(GUI) && !defined(_SFX_RTL_) -#ifdef _WIN_32 - SetConsoleCtrlHandler(Enable ? ProcessSignal:NULL,TRUE); -// signal(SIGBREAK,Enable ? ProcessSignal:SIG_IGN); -#else - signal(SIGINT,Enable ? ProcessSignal:SIG_IGN); - signal(SIGTERM,Enable ? ProcessSignal:SIG_IGN); -#endif -#endif -} - - -void ErrorHandler::Throw(int Code) -{ - if (Code==USER_BREAK && !EnableBreak) - return; - ErrHandler.SetErrorCode(Code); -#ifdef ALLOW_EXCEPTIONS - throw Code; -#else - File::RemoveCreated(); - exit(Code); -#endif -} - - -void ErrorHandler::SysErrMsg() -{ -#if !defined(SFX_MODULE) && !defined(SILENT) -#ifdef _WIN_32 - #define STRCHR strchr - #define ERRCHAR char - ERRCHAR *lpMsgBuf=NULL; - int ErrType=GetLastError(); - if (ErrType!=0 && FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM, - NULL,ErrType,MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), - (LPTSTR)&lpMsgBuf,0,NULL)) - { - ERRCHAR *CurMsg=lpMsgBuf; - while (CurMsg!=NULL) - { - while (*CurMsg=='\r' || *CurMsg=='\n') - CurMsg++; - if (*CurMsg==0) - break; - ERRCHAR *EndMsg=STRCHR(CurMsg,'\r'); - if (EndMsg==NULL) - EndMsg=STRCHR(CurMsg,'\n'); - if (EndMsg!=NULL) - { - *EndMsg=0; - EndMsg++; - } - Log(NULL,"\n%s",CurMsg); - CurMsg=EndMsg; - } - } - LocalFree( lpMsgBuf ); -#endif - -#if defined(_UNIX) || defined(_EMX) - char *err=strerror(errno); - if (err!=NULL) - Log(NULL,"\n%s",err); -#endif - -#endif -} - - - - diff --git a/src/bin/unrar/errhnd.hpp b/src/bin/unrar/errhnd.hpp deleted file mode 100644 index 732243ceee..0000000000 --- a/src/bin/unrar/errhnd.hpp +++ /dev/null @@ -1,62 +0,0 @@ -#ifndef _RAR_ERRHANDLER_ -#define _RAR_ERRHANDLER_ - -#if (defined(GUI) || !defined(_WIN_32)) && !defined(SFX_MODULE) && !defined(_WIN_CE) || defined(RARDLL) -#define ALLOW_EXCEPTIONS -#endif - - - -#define rarmalloc malloc -#define rarcalloc calloc -#define rarrealloc realloc -#define rarfree free -#define rarstrdup strdup - - - -enum { SUCCESS,WARNING,FATAL_ERROR,CRC_ERROR,LOCK_ERROR,WRITE_ERROR, - OPEN_ERROR,USER_ERROR,MEMORY_ERROR,CREATE_ERROR,USER_BREAK=255}; - -class ErrorHandler -{ - private: - void ErrMsg(const char *ArcName,const char *fmt,...); - - int ExitCode; - int ErrCount; - bool EnableBreak; - bool Silent; - bool DoShutdown; - public: - ErrorHandler(); - void Clean(); - void MemoryError(); - void OpenError(const char *FileName); - void CloseError(const char *FileName); - void ReadError(const char *FileName); - bool AskRepeatRead(const char *FileName); - void WriteError(const char *ArcName,const char *FileName); - void WriteErrorFAT(const char *FileName); - bool AskRepeatWrite(const char *FileName); - void SeekError(const char *FileName); - void GeneralErrMsg(const char *Msg); - void MemoryErrorMsg(); - void OpenErrorMsg(const char *FileName); - void OpenErrorMsg(const char *ArcName,const char *FileName); - void CreateErrorMsg(const char *FileName); - void CreateErrorMsg(const char *ArcName,const char *FileName); - void ReadErrorMsg(const char *ArcName,const char *FileName); - void WriteErrorMsg(const char *ArcName,const char *FileName); - void Exit(int ExitCode); - void SetErrorCode(int Code); - int GetErrorCode() {return(ExitCode);} - int GetErrorCount() {return(ErrCount);} - void SetSignalHandlers(bool Enable); - void Throw(int Code); - void SetSilent(bool Mode) {Silent=Mode;}; - void SetShutdown(bool Mode) {DoShutdown=Mode;}; - void SysErrMsg(); -}; - -#endif diff --git a/src/bin/unrar/extinfo.cpp b/src/bin/unrar/extinfo.cpp deleted file mode 100644 index 13239fe72c..0000000000 --- a/src/bin/unrar/extinfo.cpp +++ /dev/null @@ -1,76 +0,0 @@ -#include "rar.hpp" - -#ifdef _WIN_32 -#include "win32acl.cpp" -#include "win32stm.cpp" -#endif -#ifdef _BEOS -#include "beosea.cpp" -#endif -#if defined(_EMX) && !defined(_DJGPP) -#include "os2ea.cpp" -#endif -#ifdef _UNIX -#include "uowners.cpp" -#endif - - - -#ifndef SFX_MODULE -void SetExtraInfo(CommandData *Cmd,Archive &Arc,char *Name,wchar *NameW) -{ - switch(Arc.SubBlockHead.SubType) - { -#if defined(_EMX) && !defined(_DJGPP) - case EA_HEAD: - if (Cmd->ProcessEA) - ExtractOS2EA(Arc,Name); - break; -#endif -#ifdef _UNIX - case UO_HEAD: - if (Cmd->ProcessOwners) - ExtractUnixOwner(Arc,Name); - break; -#endif -#ifdef _BEOS - case BEEA_HEAD: - if (Cmd->ProcessEA) - ExtractBeEA(Arc,Name); - break; -#endif -#ifdef _WIN_32 - case NTACL_HEAD: - if (Cmd->ProcessOwners) - ExtractACL(Arc,Name,NameW); - break; - case STREAM_HEAD: - ExtractStreams(Arc,Name,NameW); - break; -#endif - } -} -#endif - - -void SetExtraInfoNew(CommandData *Cmd,Archive &Arc,char *Name,wchar *NameW) -{ -#if defined(_EMX) && !defined(_DJGPP) - if (Cmd->ProcessEA && Arc.SubHead.CmpName(SUBHEAD_TYPE_OS2EA)) - ExtractOS2EANew(Arc,Name); -#endif -#ifdef _UNIX - if (Cmd->ProcessOwners && Arc.SubHead.CmpName(SUBHEAD_TYPE_UOWNER)) - ExtractUnixOwnerNew(Arc,Name); -#endif -#ifdef _BEOS - if (Cmd->ProcessEA && Arc.SubHead.CmpName(SUBHEAD_TYPE_UOWNER)) - ExtractUnixOwnerNew(Arc,Name); -#endif -#ifdef _WIN_32 - if (Cmd->ProcessOwners && Arc.SubHead.CmpName(SUBHEAD_TYPE_ACL)) - ExtractACLNew(Arc,Name,NameW); - if (Arc.SubHead.CmpName(SUBHEAD_TYPE_STREAM)) - ExtractStreamsNew(Arc,Name,NameW); -#endif -} diff --git a/src/bin/unrar/extinfo.hpp b/src/bin/unrar/extinfo.hpp deleted file mode 100644 index db7cea53f8..0000000000 --- a/src/bin/unrar/extinfo.hpp +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef _RAR_EXTINFO_ -#define _RAR_EXTINFO_ - - -void SetExtraInfo(CommandData *Cmd,Archive &Arc,char *Name,wchar *NameW); -void SetExtraInfoNew(CommandData *Cmd,Archive &Arc,char *Name,wchar *NameW); - -#endif diff --git a/src/bin/unrar/extract.cpp b/src/bin/unrar/extract.cpp deleted file mode 100644 index e9d75173ba..0000000000 --- a/src/bin/unrar/extract.cpp +++ /dev/null @@ -1,873 +0,0 @@ -#include "rar.hpp" - -CmdExtract::CmdExtract() -{ - TotalFileCount=0; - *Password=0; - Unp=new Unpack(&DataIO); - Unp->Init(NULL); -} - - -CmdExtract::~CmdExtract() -{ - delete Unp; - memset(Password,0,sizeof(Password)); -} - - -void CmdExtract::DoExtract(CommandData *Cmd) -{ - PasswordCancelled=false; - DataIO.SetCurrentCommand(*Cmd->Command); - - struct FindData FD; - while (Cmd->GetArcName(ArcName,ArcNameW,sizeof(ArcName))) - if (FindFile::FastFind(ArcName,ArcNameW,&FD)) - DataIO.TotalArcSize+=FD.Size; - Cmd->ArcNames->Rewind(); - while (Cmd->GetArcName(ArcName,ArcNameW,sizeof(ArcName))) - { - while (true) - { - char PrevCmdPassword[MAXPASSWORD]; - strcpy(PrevCmdPassword,Cmd->Password); - - EXTRACT_ARC_CODE Code=ExtractArchive(Cmd); - -/* - restore Cmd->Password which could be changed in IsArchive() call - for next header encrypted archive -*/ - strcpy(Cmd->Password,PrevCmdPassword); - - if (Code!=EXTRACT_ARC_REPEAT) - break; - } - if (FindFile::FastFind(ArcName,ArcNameW,&FD)) - DataIO.ProcessedArcSize+=FD.Size; - } - - if (TotalFileCount==0 && *Cmd->Command!='I') - { - if (!PasswordCancelled) - { - mprintf(St(MExtrNoFiles)); - } - ErrHandler.SetErrorCode(WARNING); - } -#ifndef GUI - else - if (!Cmd->DisableDone) - if (*Cmd->Command=='I') - mprintf(St(MDone)); - else - if (ErrHandler.GetErrorCount()==0) - mprintf(St(MExtrAllOk)); - else - mprintf(St(MExtrTotalErr),ErrHandler.GetErrorCount()); -#endif -} - - -void CmdExtract::ExtractArchiveInit(CommandData *Cmd,Archive &Arc) -{ - DataIO.UnpArcSize=Arc.FileLength(); - - FileCount=0; - MatchedArgs=0; -#ifndef SFX_MODULE - FirstFile=true; -#endif - - if (*Cmd->Password!=0) - strcpy(Password,Cmd->Password); - PasswordAll=(*Cmd->Password!=0); - - DataIO.UnpVolume=false; - - PrevExtracted=false; - SignatureFound=false; - AllMatchesExact=true; - ReconstructDone=false; -} - - -EXTRACT_ARC_CODE CmdExtract::ExtractArchive(CommandData *Cmd) -{ - Archive Arc(Cmd); - if (!Arc.WOpen(ArcName,ArcNameW)) - { - ErrHandler.SetErrorCode(OPEN_ERROR); - return(EXTRACT_ARC_NEXT); - } - - if (!Arc.IsArchive(true)) - { -#ifndef GUI - mprintf(St(MNotRAR),ArcName); -#endif - if (CmpExt(ArcName,"rar")) - ErrHandler.SetErrorCode(WARNING); - return(EXTRACT_ARC_NEXT); - } - - if (!Arc.IsOpened()) - return(EXTRACT_ARC_NEXT); - -#ifndef SFX_MODULE - if (Arc.Volume && Arc.NotFirstVolume) - { - char FirstVolName[NM]; - - VolNameToFirstName(ArcName,FirstVolName,(Arc.NewMhd.Flags & MHD_NEWNUMBERING)); - if (stricomp(ArcName,FirstVolName)!=0 && FileExist(FirstVolName) && - Cmd->ArcNames->Search(FirstVolName,NULL,false)) - return(EXTRACT_ARC_NEXT); - } -#endif - ExtractArchiveInit(Cmd,Arc); - - if (*Cmd->Command=='T' || *Cmd->Command=='I') - Cmd->Test=true; - -#ifndef GUI - if (*Cmd->Command=='I') - Cmd->DisablePercentage=true; - else - if (Cmd->Test) - mprintf(St(MExtrTest),ArcName); - else - mprintf(St(MExtracting),ArcName); -#endif - - Arc.ViewComment(); - - // RAR can close a corrupt encrypted archive - if (!Arc.IsOpened()) - return(EXTRACT_ARC_NEXT); - - - while (1) - { - int Size=Arc.ReadHeader(); - bool Repeat=false; - if (!ExtractCurrentFile(Cmd,Arc,Size,Repeat)) - if (Repeat) - { - return(EXTRACT_ARC_REPEAT); - } - else - break; - } - - return(EXTRACT_ARC_NEXT); -} - - -bool CmdExtract::ExtractCurrentFile(CommandData *Cmd,Archive &Arc,int HeaderSize,bool &Repeat) -{ - char Command=*Cmd->Command; - if (HeaderSize<=0) - if (DataIO.UnpVolume) - { -#ifdef NOVOLUME - return(false); -#else - if (!MergeArchive(Arc,NULL,false,Command)) - { - ErrHandler.SetErrorCode(WARNING); - return(false); - } - SignatureFound=false; -#endif - } - else - return(false); - int HeadType=Arc.GetHeaderType(); - if (HeadType!=FILE_HEAD) - { - if (HeadType==AV_HEAD || HeadType==SIGN_HEAD) - SignatureFound=true; -#if !defined(SFX_MODULE) && !defined(_WIN_CE) - if (HeadType==SUB_HEAD && PrevExtracted) - SetExtraInfo(Cmd,Arc,DestFileName,*DestFileNameW ? DestFileNameW:NULL); -#endif - if (HeadType==NEWSUB_HEAD) - { - if (Arc.SubHead.CmpName(SUBHEAD_TYPE_AV)) - SignatureFound=true; -#if !defined(NOSUBBLOCKS) && !defined(_WIN_CE) - if (PrevExtracted) - SetExtraInfoNew(Cmd,Arc,DestFileName,*DestFileNameW ? DestFileNameW:NULL); -#endif - } - if (HeadType==ENDARC_HEAD) - if (Arc.EndArcHead.Flags & EARC_NEXT_VOLUME) - { -#ifndef NOVOLUME - if (!MergeArchive(Arc,NULL,false,Command)) - { - ErrHandler.SetErrorCode(WARNING); - return(false); - } - SignatureFound=false; -#endif - Arc.Seek(Arc.CurBlockPos,SEEK_SET); - return(true); - } - else - return(false); - Arc.SeekToNext(); - return(true); - } - PrevExtracted=false; - - if (SignatureFound || - !Cmd->Recurse && MatchedArgs>=Cmd->FileArgs->ItemsCount() && - AllMatchesExact) - return(false); - - char ArcFileName[NM]; - IntToExt(Arc.NewLhd.FileName,Arc.NewLhd.FileName); - strcpy(ArcFileName,Arc.NewLhd.FileName); - - wchar ArcFileNameW[NM]; - *ArcFileNameW=0; - - int MatchType=MATCH_WILDSUBPATH; - - bool EqualNames=false; - int MatchNumber=Cmd->IsProcessFile(Arc.NewLhd,&EqualNames,MatchType); - bool ExactMatch=MatchNumber!=0; -#if !defined(SFX_MODULE) && !defined(_WIN_CE) - if (Cmd->ExclPath==EXCL_BASEPATH) - { - *Cmd->ArcPath=0; - if (ExactMatch) - { - Cmd->FileArgs->Rewind(); - if (Cmd->FileArgs->GetString(Cmd->ArcPath,NULL,sizeof(Cmd->ArcPath),MatchNumber-1)) - *PointToName(Cmd->ArcPath)=0; - } - } -#endif - if (ExactMatch && !EqualNames) - AllMatchesExact=false; - -#ifdef UNICODE_SUPPORTED - bool WideName=(Arc.NewLhd.Flags & LHD_UNICODE) && UnicodeEnabled(); -#else - bool WideName=false; -#endif - -#ifdef _APPLE - if (WideName) - { - WideToUtf(Arc.NewLhd.FileNameW,ArcFileName,sizeof(ArcFileName)); - WideName=false; - } -#endif - - wchar *DestNameW=WideName ? DestFileNameW:NULL; - -#ifdef UNICODE_SUPPORTED - if (WideName) - { - ConvertPath(Arc.NewLhd.FileNameW,ArcFileNameW); - char Name[NM]; - if (WideToChar(ArcFileNameW,Name) && IsNameUsable(Name)) - strcpy(ArcFileName,Name); - } -#endif - - ConvertPath(ArcFileName,ArcFileName); - - if (Arc.IsArcLabel()) - return(true); - - if (Arc.NewLhd.Flags & LHD_VERSION) - { - if (Cmd->VersionControl!=1 && !EqualNames) - { - if (Cmd->VersionControl==0) - ExactMatch=false; - int Version=ParseVersionFileName(ArcFileName,ArcFileNameW,false); - if (Cmd->VersionControl-1==Version) - ParseVersionFileName(ArcFileName,ArcFileNameW,true); - else - ExactMatch=false; - } - } - else - if (!Arc.IsArcDir() && Cmd->VersionControl>1) - ExactMatch=false; - - Arc.ConvertAttributes(); - -#ifndef SFX_MODULE - if ((Arc.NewLhd.Flags & (LHD_SPLIT_BEFORE/*|LHD_SOLID*/)) && FirstFile) - { - char CurVolName[NM]; - strcpy(CurVolName,ArcName); - - VolNameToFirstName(ArcName,ArcName,(Arc.NewMhd.Flags & MHD_NEWNUMBERING)); - if (stricomp(ArcName,CurVolName)!=0 && FileExist(ArcName)) - { - *ArcNameW=0; - Repeat=true; - return(false); - } -#if !defined(RARDLL) && !defined(_WIN_CE) - if (!ReconstructDone) - { - ReconstructDone=true; - - RecVolumes RecVol; - if (RecVol.Restore(Cmd,Arc.FileName,Arc.FileNameW,true)) - { - Repeat=true; - return(false); - } - } -#endif - strcpy(ArcName,CurVolName); - } -#endif - DataIO.UnpVolume=(Arc.NewLhd.Flags & LHD_SPLIT_AFTER); - DataIO.NextVolumeMissing=false; - - Arc.Seek(Arc.NextBlockPos-Arc.NewLhd.FullPackSize,SEEK_SET); - - bool TestMode=false; - bool ExtrFile=false; - bool SkipSolid=false; - -#ifndef SFX_MODULE - if (FirstFile && (ExactMatch || Arc.Solid) && (Arc.NewLhd.Flags & (LHD_SPLIT_BEFORE/*|LHD_SOLID*/))!=0) - { - if (ExactMatch) - { - Log(Arc.FileName,St(MUnpCannotMerge),ArcFileName); -#ifdef RARDLL - Cmd->DllError=ERAR_BAD_DATA; -#endif - ErrHandler.SetErrorCode(WARNING); - } - ExactMatch=false; - } - - FirstFile=false; -#endif - - if (ExactMatch || (SkipSolid=Arc.Solid)!=0) - { - if ((Arc.NewLhd.Flags & LHD_PASSWORD)!=0) -#ifndef RARDLL - if (*Password==0) -#endif - { -#ifdef RARDLL - if (*Cmd->Password==0) - if (Cmd->Callback==NULL || - Cmd->Callback(UCM_NEEDPASSWORD,Cmd->UserData,(LONG)Cmd->Password,sizeof(Cmd->Password))==-1) - return(false); - strcpy(Password,Cmd->Password); - -#else - if (!GetPassword(PASSWORD_FILE,ArcFileName,Password,sizeof(Password))) - { - PasswordCancelled=true; - return(false); - } -#endif - } -#if !defined(GUI) && !defined(SILENT) - else - if (!PasswordAll && (!Arc.Solid || Arc.NewLhd.UnpVer>=20 && (Arc.NewLhd.Flags & LHD_SOLID)==0)) - { - eprintf(St(MUseCurPsw),ArcFileName); - switch(Cmd->AllYes ? 1:Ask(St(MYesNoAll))) - { - case -1: - ErrHandler.Exit(USER_BREAK); - case 2: - if (!GetPassword(PASSWORD_FILE,ArcFileName,Password,sizeof(Password))) - { - return(false); - } - break; - case 3: - PasswordAll=true; - break; - } - } -#endif - -#ifndef SFX_MODULE - if (*Cmd->ExtrPath==0 && *Cmd->ExtrPathW!=0) - WideToChar(Cmd->ExtrPathW,DestFileName); - else -#endif - strcpy(DestFileName,Cmd->ExtrPath); - - -#ifndef SFX_MODULE - if (Cmd->AppendArcNameToPath) - { - strcat(DestFileName,PointToName(Arc.FirstVolumeName)); - SetExt(DestFileName,NULL); - AddEndSlash(DestFileName); - } -#endif - - char *ExtrName=ArcFileName; - - bool EmptyName=false; -#ifndef SFX_MODULE - int Length=strlen(Cmd->ArcPath); - if (Length>1 && IsPathDiv(Cmd->ArcPath[Length-1]) && - strlen(ArcFileName)==Length-1) - Length--; - if (Length>0 && strnicomp(Cmd->ArcPath,ArcFileName,Length)==0) - { - ExtrName+=Length; - while (*ExtrName==CPATHDIVIDER) - ExtrName++; - if (*ExtrName==0) - EmptyName=true; - } -#endif - - bool AbsPaths=Cmd->ExclPath==EXCL_ABSPATH && Command=='X' && IsDriveDiv(':'); - if (AbsPaths) - *DestFileName=0; - - if (Command=='E' || Cmd->ExclPath==EXCL_SKIPWHOLEPATH) - strcat(DestFileName,PointToName(ExtrName)); - else - strcat(DestFileName,ExtrName); - - char DiskLetter=etoupper(DestFileName[0]); - - if (AbsPaths && DestFileName[1]=='_' && IsPathDiv(DestFileName[2]) && - DiskLetter>='A' && DiskLetter<='Z') - DestFileName[1]=':'; - -#ifndef SFX_MODULE - if (!WideName && *Cmd->ExtrPathW!=0) - { - DestNameW=DestFileNameW; - WideName=true; - CharToWide(ArcFileName,ArcFileNameW); - } -#endif - - if (WideName) - { - if (*Cmd->ExtrPathW!=0) - strcpyw(DestFileNameW,Cmd->ExtrPathW); - else - CharToWide(Cmd->ExtrPath,DestFileNameW); - -#ifndef SFX_MODULE - if (Cmd->AppendArcNameToPath) - { - wchar FileNameW[NM]; - if (*Arc.FirstVolumeNameW!=0) - strcpyw(FileNameW,Arc.FirstVolumeNameW); - else - CharToWide(Arc.FirstVolumeName,FileNameW); - strcatw(DestFileNameW,PointToName(FileNameW)); - SetExt(DestFileNameW,NULL); - AddEndSlash(DestFileNameW); - } -#endif - wchar *ExtrNameW=ArcFileNameW; -#ifndef SFX_MODULE - if (Length>0) - { - wchar ArcPathW[NM]; - CharToWide(Cmd->ArcPath,ArcPathW); - Length=strlenw(ArcPathW); - } - ExtrNameW+=Length; - while (*ExtrNameW==CPATHDIVIDER) - ExtrNameW++; -#endif - - if (AbsPaths) - *DestFileNameW=0; - - if (Command=='E' || Cmd->ExclPath==EXCL_SKIPWHOLEPATH) - strcatw(DestFileNameW,PointToName(ExtrNameW)); - else - strcatw(DestFileNameW,ExtrNameW); - - if (AbsPaths && DestFileNameW[1]=='_' && IsPathDiv(DestFileNameW[2])) - DestFileNameW[1]=':'; - } - else - *DestFileNameW=0; - - ExtrFile=!SkipSolid && !EmptyName && (Arc.NewLhd.Flags & LHD_SPLIT_BEFORE)==0; - - if ((Cmd->FreshFiles || Cmd->UpdateFiles) && (Command=='E' || Command=='X')) - { - struct FindData FD; - if (FindFile::FastFind(DestFileName,DestNameW,&FD)) - { - if (FD.mtime >= Arc.NewLhd.mtime) - ExtrFile=false; - } - else - if (Cmd->FreshFiles) - ExtrFile=false; - } - - // skip encrypted file if no password is specified - if ((Arc.NewLhd.Flags & LHD_PASSWORD)!=0 && *Password==0) - { - ErrHandler.SetErrorCode(WARNING); -#ifdef RARDLL - Cmd->DllError=ERAR_MISSING_PASSWORD; -#endif - ExtrFile=false; - } - -#ifdef RARDLL - if (*Cmd->DllDestName) - { - strncpyz(DestFileName,Cmd->DllDestName,ASIZE(DestFileName)); - *DestFileNameW=0; - if (Cmd->DllOpMode!=RAR_EXTRACT) - ExtrFile=false; - } - if (*Cmd->DllDestNameW) - { - strncpyzw(DestFileNameW,Cmd->DllDestNameW,ASIZE(DestFileNameW)); - DestNameW=DestFileNameW; - if (Cmd->DllOpMode!=RAR_EXTRACT) - ExtrFile=false; - } -#endif - -#ifdef SFX_MODULE - if ((Arc.NewLhd.UnpVer!=UNP_VER && Arc.NewLhd.UnpVer!=29) && - Arc.NewLhd.Method!=0x30) -#else - if (Arc.NewLhd.UnpVer<13 || Arc.NewLhd.UnpVer>UNP_VER) -#endif - { -#ifndef SILENT - Log(Arc.FileName,St(MUnknownMeth),ArcFileName); -#ifndef SFX_MODULE - Log(Arc.FileName,St(MVerRequired),Arc.NewLhd.UnpVer/10,Arc.NewLhd.UnpVer%10); -#endif -#endif - ExtrFile=false; - ErrHandler.SetErrorCode(WARNING); -#ifdef RARDLL - Cmd->DllError=ERAR_UNKNOWN_FORMAT; -#endif - } - - File CurFile; - - if (!IsLink(Arc.NewLhd.FileAttr)) - if (Arc.IsArcDir()) - { - if (!ExtrFile || Command=='P' || Command=='E' || Cmd->ExclPath==EXCL_SKIPWHOLEPATH) - return(true); - if (SkipSolid) - { -#ifndef GUI - mprintf(St(MExtrSkipFile),ArcFileName); -#endif - return(true); - } - TotalFileCount++; - if (Cmd->Test) - { -#ifndef GUI - mprintf(St(MExtrTestFile),ArcFileName); - mprintf(" %s",St(MOk)); -#endif - return(true); - } - MKDIR_CODE MDCode=MakeDir(DestFileName,DestNameW,Arc.NewLhd.FileAttr); - bool DirExist=false; - if (MDCode!=MKDIR_SUCCESS) - { - DirExist=FileExist(DestFileName,DestNameW); - if (DirExist && !IsDir(GetFileAttr(DestFileName,DestNameW))) - { - bool UserReject; - FileCreate(Cmd,NULL,DestFileName,DestNameW,Cmd->Overwrite,&UserReject,Arc.NewLhd.FullUnpSize,Arc.NewLhd.FileTime); - DirExist=false; - } - CreatePath(DestFileName,DestNameW,true); - MDCode=MakeDir(DestFileName,DestNameW,Arc.NewLhd.FileAttr); - } - if (MDCode==MKDIR_SUCCESS) - { -#ifndef GUI - mprintf(St(MCreatDir),DestFileName); - mprintf(" %s",St(MOk)); -#endif - PrevExtracted=true; - } - else - if (DirExist) - { - SetFileAttr(DestFileName,DestNameW,Arc.NewLhd.FileAttr); - PrevExtracted=true; - } - else - { - Log(Arc.FileName,St(MExtrErrMkDir),DestFileName); - ErrHandler.SysErrMsg(); -#ifdef RARDLL - Cmd->DllError=ERAR_ECREATE; -#endif - ErrHandler.SetErrorCode(CREATE_ERROR); - } - if (PrevExtracted) - { -#if defined(_WIN_32) && !defined(_WIN_CE) && !defined(SFX_MODULE) - if (Cmd->SetCompressedAttr && - (Arc.NewLhd.FileAttr & FILE_ATTRIBUTE_COMPRESSED)!=0 && WinNT()) - SetFileCompression(DestFileName,DestFileNameW,true); -#endif - SetDirTime(DestFileName, - Cmd->xmtime==EXTTIME_NONE ? NULL:&Arc.NewLhd.mtime, - Cmd->xctime==EXTTIME_NONE ? NULL:&Arc.NewLhd.ctime, - Cmd->xatime==EXTTIME_NONE ? NULL:&Arc.NewLhd.atime); - } - return(true); - } - else - { - if (Cmd->Test && ExtrFile) - TestMode=true; -#if !defined(GUI) && !defined(SFX_MODULE) - if (Command=='P' && ExtrFile) - CurFile.SetHandleType(FILE_HANDLESTD); -#endif - if ((Command=='E' || Command=='X') && ExtrFile && !Cmd->Test) - { - bool UserReject; - if (!FileCreate(Cmd,&CurFile,DestFileName,DestNameW,Cmd->Overwrite,&UserReject,Arc.NewLhd.FullUnpSize,Arc.NewLhd.FileTime)) - { - ExtrFile=false; - if (!UserReject) - { - ErrHandler.CreateErrorMsg(Arc.FileName,DestFileName); - ErrHandler.SetErrorCode(CREATE_ERROR); -#ifdef RARDLL - Cmd->DllError=ERAR_ECREATE; -#endif - if (!IsNameUsable(DestFileName)) - { - Log(Arc.FileName,St(MCorrectingName)); - char OrigName[sizeof(DestFileName)]; - strncpyz(OrigName,DestFileName,ASIZE(OrigName)); - - MakeNameUsable(DestFileName,true); - CreatePath(DestFileName,NULL,true); - if (FileCreate(Cmd,&CurFile,DestFileName,NULL,Cmd->Overwrite,&UserReject,Arc.NewLhd.FullUnpSize,Arc.NewLhd.FileTime)) - { -#ifndef SFX_MODULE - Log(Arc.FileName,St(MRenaming),OrigName,DestFileName); -#endif - ExtrFile=true; - } - else - ErrHandler.CreateErrorMsg(Arc.FileName,DestFileName); - } - } - } - } - } - - if (!ExtrFile && Arc.Solid) - { - SkipSolid=true; - TestMode=true; - ExtrFile=true; - } - if (ExtrFile) - { - if (!SkipSolid) - { - if (!TestMode && Command!='P' && CurFile.IsDevice()) - { - Log(Arc.FileName,St(MInvalidName),DestFileName); - ErrHandler.WriteError(Arc.FileName,DestFileName); - } - TotalFileCount++; - } - FileCount++; -#ifndef GUI - if (Command!='I') - if (SkipSolid) - mprintf(St(MExtrSkipFile),ArcFileName); - else - switch(Cmd->Test ? 'T':Command) - { - case 'T': - mprintf(St(MExtrTestFile),ArcFileName); - break; -#ifndef SFX_MODULE - case 'P': - mprintf(St(MExtrPrinting),ArcFileName); - break; -#endif - case 'X': - case 'E': - mprintf(St(MExtrFile),DestFileName); - break; - } - if (!Cmd->DisablePercentage) - mprintf(" "); -#endif - DataIO.CurUnpRead=0; - DataIO.CurUnpWrite=0; - DataIO.UnpFileCRC=Arc.OldFormat ? 0 : 0xffffffff; - DataIO.PackedCRC=0xffffffff; - DataIO.SetEncryption( - (Arc.NewLhd.Flags & LHD_PASSWORD) ? Arc.NewLhd.UnpVer:0,Password, - (Arc.NewLhd.Flags & LHD_SALT) ? Arc.NewLhd.Salt:NULL,false, - Arc.NewLhd.UnpVer>=36); - DataIO.SetPackedSizeToRead(Arc.NewLhd.FullPackSize); - DataIO.SetFiles(&Arc,&CurFile); - DataIO.SetTestMode(TestMode); - DataIO.SetSkipUnpCRC(SkipSolid); -#ifndef _WIN_CE - if (!TestMode && !Arc.BrokenFileHeader && - (Arc.NewLhd.FullPackSize<<11)>Arc.NewLhd.FullUnpSize && - (Arc.NewLhd.FullUnpSize<100000000 || Arc.FileLength()>Arc.NewLhd.FullPackSize)) - CurFile.Prealloc(Arc.NewLhd.FullUnpSize); -#endif - - CurFile.SetAllowDelete(!Cmd->KeepBroken); - - bool LinkCreateMode=!Cmd->Test && !SkipSolid; - if (ExtractLink(DataIO,Arc,DestFileName,DataIO.UnpFileCRC,LinkCreateMode)) - PrevExtracted=LinkCreateMode; - else - if ((Arc.NewLhd.Flags & LHD_SPLIT_BEFORE)==0) - if (Arc.NewLhd.Method==0x30) - UnstoreFile(DataIO,Arc.NewLhd.FullUnpSize); - else - { - Unp->SetDestSize(Arc.NewLhd.FullUnpSize); -#ifndef SFX_MODULE - if (Arc.NewLhd.UnpVer<=15) - Unp->DoUnpack(15,FileCount>1 && Arc.Solid); - else -#endif - Unp->DoUnpack(Arc.NewLhd.UnpVer,Arc.NewLhd.Flags & LHD_SOLID); - } - - if (Arc.IsOpened()) - Arc.SeekToNext(); - - bool BrokenFile=false; - if (!SkipSolid) - { - if (Arc.OldFormat && UINT32(DataIO.UnpFileCRC)==UINT32(Arc.NewLhd.FileCRC) || - !Arc.OldFormat && UINT32(DataIO.UnpFileCRC)==UINT32(Arc.NewLhd.FileCRC^0xffffffff)) - { -#ifndef GUI - if (Command!='P' && Command!='I') - mprintf("%s%s ",Cmd->DisablePercentage ? " ":"\b\b\b\b\b ",St(MOk)); -#endif - } - else - { - char *BadArcName=/*(Arc.NewLhd.Flags & LHD_SPLIT_BEFORE) ? NULL:*/Arc.FileName; - if (Arc.NewLhd.Flags & LHD_PASSWORD) - { - Log(BadArcName,St(MEncrBadCRC),ArcFileName); - } - else - { - Log(BadArcName,St(MCRCFailed),ArcFileName); - } - BrokenFile=true; - ErrHandler.SetErrorCode(CRC_ERROR); -#ifdef RARDLL - Cmd->DllError=ERAR_BAD_DATA; -#endif - Alarm(); - } - } -#ifndef GUI - else - mprintf("\b\b\b\b\b "); -#endif - - if (!TestMode && (Command=='X' || Command=='E') && - !IsLink(Arc.NewLhd.FileAttr)) - { -#if defined(_WIN_32) || defined(_EMX) - if (Cmd->ClearArc) - Arc.NewLhd.FileAttr&=~FA_ARCH; -/* - else - Arc.NewLhd.FileAttr|=FA_ARCH; //set archive bit for unpacked files (file is not backed up) -*/ -#endif - if (!BrokenFile || Cmd->KeepBroken) - { - if (BrokenFile) - CurFile.Truncate(); - CurFile.SetOpenFileStat( - Cmd->xmtime==EXTTIME_NONE ? NULL:&Arc.NewLhd.mtime, - Cmd->xctime==EXTTIME_NONE ? NULL:&Arc.NewLhd.ctime, - Cmd->xatime==EXTTIME_NONE ? NULL:&Arc.NewLhd.atime); - CurFile.Close(); -#if defined(_WIN_32) && !defined(_WIN_CE) && !defined(SFX_MODULE) - if (Cmd->SetCompressedAttr && - (Arc.NewLhd.FileAttr & FILE_ATTRIBUTE_COMPRESSED)!=0 && WinNT()) - SetFileCompression(CurFile.FileName,CurFile.FileNameW,true); -#endif - CurFile.SetCloseFileStat( - Cmd->xmtime==EXTTIME_NONE ? NULL:&Arc.NewLhd.mtime, - Cmd->xatime==EXTTIME_NONE ? NULL:&Arc.NewLhd.atime, - Arc.NewLhd.FileAttr); - PrevExtracted=true; - } - } - } - } - if (ExactMatch) - MatchedArgs++; - if (DataIO.NextVolumeMissing || !Arc.IsOpened()) - return(false); - if (!ExtrFile) - if (!Arc.Solid) - Arc.SeekToNext(); - else - if (!SkipSolid) - return(false); - return(true); -} - - -void CmdExtract::UnstoreFile(ComprDataIO &DataIO,Int64 DestUnpSize) -{ - Array Buffer(0x10000); - while (1) - { - unsigned int Code=DataIO.UnpRead(&Buffer[0],Buffer.Size()); - if (Code==0 || (int)Code==-1) - break; - Code=Code=0) - DestUnpSize-=Code; - } -} - diff --git a/src/bin/unrar/extract.hpp b/src/bin/unrar/extract.hpp deleted file mode 100644 index 09dfc94f8f..0000000000 --- a/src/bin/unrar/extract.hpp +++ /dev/null @@ -1,42 +0,0 @@ -#ifndef _RAR_EXTRACT_ -#define _RAR_EXTRACT_ - -enum EXTRACT_ARC_CODE {EXTRACT_ARC_NEXT,EXTRACT_ARC_REPEAT}; - -class CmdExtract -{ - private: - EXTRACT_ARC_CODE ExtractArchive(CommandData *Cmd); - - ComprDataIO DataIO; - Unpack *Unp; - long TotalFileCount; - - long FileCount; - long MatchedArgs; - bool FirstFile; - bool AllMatchesExact; - bool ReconstructDone; - - char ArcName[NM]; - wchar ArcNameW[NM]; - - char Password[MAXPASSWORD]; - bool PasswordAll; - bool PrevExtracted; - char DestFileName[NM]; - wchar DestFileNameW[NM]; - bool PasswordCancelled; - public: - CmdExtract(); - ~CmdExtract(); - void DoExtract(CommandData *Cmd); - void ExtractArchiveInit(CommandData *Cmd,Archive &Arc); - bool ExtractCurrentFile(CommandData *Cmd,Archive &Arc,int HeaderSize, - bool &Repeat); - static void UnstoreFile(ComprDataIO &DataIO,Int64 DestUnpSize); - - bool SignatureFound; -}; - -#endif diff --git a/src/bin/unrar/filcreat.cpp b/src/bin/unrar/filcreat.cpp deleted file mode 100644 index 175736a663..0000000000 --- a/src/bin/unrar/filcreat.cpp +++ /dev/null @@ -1,239 +0,0 @@ -#include "rar.hpp" - -bool FileCreate(RAROptions *Cmd,File *NewFile,char *Name,wchar *NameW, - OVERWRITE_MODE Mode,bool *UserReject,Int64 FileSize, - uint FileTime) -{ - if (UserReject!=NULL) - *UserReject=false; -#if defined(_WIN_32) && !defined(_WIN_CE) - bool ShortNameChanged=false; -#endif - while (FileExist(Name,NameW)) - { -#if defined(_WIN_32) && !defined(_WIN_CE) - if (!ShortNameChanged) - { - ShortNameChanged=true; - if (UpdateExistingShortName(Name,NameW)) - continue; - } -#endif - if (Mode==OVERWRITE_NONE) - { - if (UserReject!=NULL) - *UserReject=true; - return(false); - } -#ifdef SILENT - Mode=OVERWRITE_ALL; -#endif - if (Cmd->AllYes || Mode==OVERWRITE_ALL) - break; - if (Mode==OVERWRITE_ASK) - { - eprintf(St(MFileExists),Name); - int Choice=Ask(St(MYesNoAllRenQ)); - if (Choice==1) - break; - if (Choice==2) - { - if (UserReject!=NULL) - *UserReject=true; - return(false); - } - if (Choice==3) - { - Cmd->Overwrite=OVERWRITE_ALL; - break; - } - if (Choice==4) - { - if (UserReject!=NULL) - *UserReject=true; - Cmd->Overwrite=OVERWRITE_NONE; - return(false); - } - if (Choice==5) - { - mprintf(St(MAskNewName)); - - char NewName[NM]; -#ifdef _WIN_32 - File SrcFile; - SrcFile.SetHandleType(FILE_HANDLESTD); - int Size=SrcFile.Read(NewName,sizeof(NewName)-1); - NewName[Size]=0; - OemToChar(NewName,NewName); -#else - fgets(NewName,sizeof(NewName),stdin); -#endif - RemoveLF(NewName); - if (PointToName(NewName)==NewName) - strcpy(PointToName(Name),NewName); - else - strcpy(Name,NewName); - if (NameW!=NULL) - *NameW=0; - continue; - } - if (Choice==6) - ErrHandler.Exit(USER_BREAK); - } - if (Mode==OVERWRITE_AUTORENAME) - { - if (GetAutoRenamedName(Name)) - { - if (NameW!=NULL) - *NameW=0; - } - else - Mode=OVERWRITE_ASK; - continue; - } - } - if (NewFile!=NULL && NewFile->Create(Name,NameW)) - return(true); - PrepareToDelete(Name,NameW); - CreatePath(Name,NameW,true); - return(NewFile!=NULL ? NewFile->Create(Name,NameW):DelFile(Name,NameW)); -} - - -bool GetAutoRenamedName(char *Name) -{ - char NewName[NM]; - - if (strlen(Name)>sizeof(NewName)-10) - return(false); - char *Ext=GetExt(Name); - if (Ext==NULL) - Ext=Name+strlen(Name); - for (int FileVer=1;;FileVer++) - { - sprintf(NewName,"%.*s(%d)%s",Ext-Name,Name,FileVer,Ext); - if (!FileExist(NewName)) - { - strcpy(Name,NewName); - break; - } - if (FileVer>=1000000) - return(false); - } - return(true); -} - - -#if defined(_WIN_32) && !defined(_WIN_CE) -bool UpdateExistingShortName(char *Name,wchar *NameW) -{ - FindData fd; - if (!FindFile::FastFind(Name,NameW,&fd)) - return(false); - if (*fd.Name==0 || *fd.ShortName==0) - return(false); - if (stricomp(PointToName(fd.Name),fd.ShortName)==0 || - stricomp(PointToName(Name),fd.ShortName)!=0) - return(false); - - char NewName[NM]; - for (int I=0;I<10000;I+=123) - { - strncpyz(NewName,Name,ASIZE(NewName)); - sprintf(PointToName(NewName),"rtmp%d",I); - if (!FileExist(NewName)) - break; - } - if (FileExist(NewName)) - return(false); - char FullName[NM]; - strncpyz(FullName,Name,ASIZE(FullName)); - strcpy(PointToName(FullName),PointToName(fd.Name)); - if (!MoveFile(FullName,NewName)) - return(false); - File KeepShortFile; - bool Created=false; - if (!FileExist(Name)) - Created=KeepShortFile.Create(Name); - MoveFile(NewName,FullName); - if (Created) - { - KeepShortFile.Close(); - KeepShortFile.Delete(); - } - return(true); -} - -/* -bool UpdateExistingShortName(char *Name,wchar *NameW) -{ - if (WinNT()<5) - return(false); - FindData fd; - if (!FindFile::FastFind(Name,NameW,&fd)) - return(false); - if (*fd.Name==0 || *fd.ShortName==0) - return(false); - if (stricomp(PointToName(fd.Name),fd.ShortName)==0 || - stricomp(PointToName(Name),fd.ShortName)!=0) - return(false); - - typedef BOOL (WINAPI *SETFILESHORTNAME)(HANDLE,LPCSTR); - static SETFILESHORTNAME pSetFileShortName=NULL; - if (pSetFileShortName==NULL) - { - HMODULE hKernel=GetModuleHandle("kernel32.dll"); - if (hKernel!=NULL) - pSetFileShortName=(SETFILESHORTNAME)GetProcAddress(hKernel,"SetFileShortNameA"); - if (pSetFileShortName==NULL) - return(false); - } - static bool RestoreEnabled=false; - if (!RestoreEnabled) - { - HANDLE hToken; - if (!OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES, &hToken)) - return(false); - - TOKEN_PRIVILEGES tp; - tp.PrivilegeCount = 1; - tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED; - - if (LookupPrivilegeValue(NULL,SE_RESTORE_NAME,&tp.Privileges[0].Luid)) - AdjustTokenPrivileges(hToken, FALSE, &tp, 0, NULL, NULL); - - CloseHandle(hToken); - RestoreEnabled=true; - } - - wchar FileNameW[NM]; - GetWideName(Name,NameW,FileNameW); - HANDLE hFile=CreateFileW(FileNameW,GENERIC_WRITE|DELETE,FILE_SHARE_READ|FILE_SHARE_WRITE, - NULL,OPEN_EXISTING,FILE_FLAG_BACKUP_SEMANTICS,NULL); - if (hFile==INVALID_HANDLE_VALUE) - return(false); - - bool RetCode=false; - - char FullName[NM]; - wchar FullNameW[NM]; - strcpy(FullName,Name); - strcpyw(FullNameW,NullToEmpty(NameW)); - for (int I=1;I<1000000;I++) - { - char NewName[NM]; - sprintf(NewName,"NAME~%d.%d",I%1000,I/1000+1); - strcpy(PointToName(FullName),NewName); - if (*FullNameW) - CharToWide(NewName,PointToName(FullNameW)); - if (!FileExist(FullName,FullNameW)) - { - RetCode=pSetFileShortName(hFile,NewName); - break; - } - } - CloseHandle(hFile); - return(RetCode); -} -*/ -#endif diff --git a/src/bin/unrar/filcreat.hpp b/src/bin/unrar/filcreat.hpp deleted file mode 100644 index d803582a1a..0000000000 --- a/src/bin/unrar/filcreat.hpp +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef _RAR_FILECREATE_ -#define _RAR_FILECREATE_ - -bool FileCreate(RAROptions *Cmd,File *NewFile,char *Name,wchar *NameW, - OVERWRITE_MODE Mode,bool *UserReject,Int64 FileSize=INT64ERR, - uint FileTime=0); -bool GetAutoRenamedName(char *Name); - -#if defined(_WIN_32) && !defined(_WIN_CE) -bool UpdateExistingShortName(char *Name,wchar *NameW); -#endif - -#endif diff --git a/src/bin/unrar/file.cpp b/src/bin/unrar/file.cpp deleted file mode 100644 index f8dba45d2b..0000000000 --- a/src/bin/unrar/file.cpp +++ /dev/null @@ -1,704 +0,0 @@ -#include "rar.hpp" - -static File *CreatedFiles[256]; -static int RemoveCreatedActive=0; - -File::File() -{ - hFile=BAD_HANDLE; - *FileName=0; - *FileNameW=0; - NewFile=false; - LastWrite=false; - HandleType=FILE_HANDLENORMAL; - SkipClose=false; - IgnoreReadErrors=false; - ErrorType=FILE_SUCCESS; - OpenShared=false; - AllowDelete=true; - CloseCount=0; - AllowExceptions=true; -#ifdef _WIN_32 - NoSequentialRead=false; -#endif -} - - -File::~File() -{ - if (hFile!=BAD_HANDLE && !SkipClose) - if (NewFile) - Delete(); - else - Close(); -} - - -void File::operator = (File &SrcFile) -{ - hFile=SrcFile.hFile; - strcpy(FileName,SrcFile.FileName); - NewFile=SrcFile.NewFile; - LastWrite=SrcFile.LastWrite; - HandleType=SrcFile.HandleType; - SrcFile.SkipClose=true; -} - - -bool File::Open(const char *Name,const wchar *NameW,bool OpenShared,bool Update) -{ - ErrorType=FILE_SUCCESS; - FileHandle hNewFile; - if (File::OpenShared) - OpenShared=true; -#ifdef _WIN_32 - uint Access=GENERIC_READ; - if (Update) - Access|=GENERIC_WRITE; - uint ShareMode=FILE_SHARE_READ; - if (OpenShared) - ShareMode|=FILE_SHARE_WRITE; - uint Flags=NoSequentialRead ? 0:FILE_FLAG_SEQUENTIAL_SCAN; - if (WinNT() && NameW!=NULL && *NameW!=0) - hNewFile=CreateFileW(NameW,Access,ShareMode,NULL,OPEN_EXISTING,Flags,NULL); - else - hNewFile=CreateFile(Name,Access,ShareMode,NULL,OPEN_EXISTING,Flags,NULL); - - if (hNewFile==BAD_HANDLE && GetLastError()==ERROR_FILE_NOT_FOUND) - ErrorType=FILE_NOTFOUND; -#else - int flags=Update ? O_RDWR:O_RDONLY; -#ifdef O_BINARY - flags|=O_BINARY; -#if defined(_AIX) && defined(_LARGE_FILE_API) - flags|=O_LARGEFILE; -#endif -#endif -#if defined(_EMX) && !defined(_DJGPP) - int sflags=OpenShared ? SH_DENYNO:SH_DENYWR; - int handle=sopen(Name,flags,sflags); -#else - int handle=open(Name,flags); -#ifdef LOCK_EX - -#ifdef _OSF_SOURCE - extern "C" int flock(int, int); -#endif - -#ifndef __HAIKU__ - if (!OpenShared && Update && handle>=0 && flock(handle,LOCK_EX|LOCK_NB)==-1) - { - close(handle); - return(false); - } -#else - { - struct flock lock; - lock.l_type=LOCK_EX|LOCK_NB; - lock.l_whence=SEEK_SET; - lock.l_start=0; - lock.l_len=OFF_MAX; - if (!OpenShared && Update && handle>=0 && fcntl(handle,F_SETLK,&lock)==-1) - { - close(handle); - return(false); - } - } -#endif -#endif -#endif - hNewFile=handle==-1 ? BAD_HANDLE:fdopen(handle,Update ? UPDATEBINARY:READBINARY); - if (hNewFile==BAD_HANDLE && errno==ENOENT) - ErrorType=FILE_NOTFOUND; -#endif - NewFile=false; - HandleType=FILE_HANDLENORMAL; - SkipClose=false; - bool Success=hNewFile!=BAD_HANDLE; - if (Success) - { - hFile=hNewFile; - if (NameW!=NULL) - strcpyw(FileNameW,NameW); - else - *FileNameW=0; - if (Name!=NULL) - strcpy(FileName,Name); - else - WideToChar(NameW,FileName); - AddFileToList(hFile); - } - return(Success); -} - - -#if !defined(SHELL_EXT) && !defined(SFX_MODULE) -void File::TOpen(const char *Name,const wchar *NameW) -{ - if (!WOpen(Name,NameW)) - ErrHandler.Exit(OPEN_ERROR); -} -#endif - - -bool File::WOpen(const char *Name,const wchar *NameW) -{ - if (Open(Name,NameW)) - return(true); - ErrHandler.OpenErrorMsg(Name); - return(false); -} - - -bool File::Create(const char *Name,const wchar *NameW) -{ -#ifdef _WIN_32 - if (WinNT() && NameW!=NULL && *NameW!=0) - hFile=CreateFileW(NameW,GENERIC_READ|GENERIC_WRITE,FILE_SHARE_READ,NULL, - CREATE_ALWAYS,0,NULL); - else - hFile=CreateFile(Name,GENERIC_READ|GENERIC_WRITE,FILE_SHARE_READ,NULL, - CREATE_ALWAYS,0,NULL); -#else - hFile=fopen(Name,CREATEBINARY); -#endif - NewFile=true; - HandleType=FILE_HANDLENORMAL; - SkipClose=false; - if (NameW!=NULL) - strcpyw(FileNameW,NameW); - else - *FileNameW=0; - if (Name!=NULL) - strcpy(FileName,Name); - else - WideToChar(NameW,FileName); - AddFileToList(hFile); - return(hFile!=BAD_HANDLE); -} - - -void File::AddFileToList(FileHandle hFile) -{ - if (hFile!=BAD_HANDLE) - for (int I=0;ISize && FilePos-Size<=0xffffffff && FilePos+Size>0xffffffff) - ErrHandler.WriteErrorFAT(FileName); -#endif - if (ErrHandler.AskRepeatWrite(FileName)) - { -#ifndef _WIN_32 - clearerr(hFile); -#endif - if (Written0) - Seek(Tell()-Written,SEEK_SET); - continue; - } - ErrHandler.WriteError(NULL,FileName); - } - break; - } - LastWrite=true; -} - - -int File::Read(void *Data,int Size) -{ - Int64 FilePos; - if (IgnoreReadErrors) - FilePos=Tell(); - int ReadSize; - while (true) - { - ReadSize=DirectRead(Data,Size); - if (ReadSize==-1) - { - ErrorType=FILE_READERROR; - if (AllowExceptions) - if (IgnoreReadErrors) - { - ReadSize=0; - for (int I=0;IMaxDeviceRead) - Size=MaxDeviceRead; - hFile=GetStdHandle(STD_INPUT_HANDLE); -#else - hFile=stdin; -#endif - } -#endif -#ifdef _WIN_32 - DWORD Read; - if (!ReadFile(hFile,Data,Size,&Read,NULL)) - { - if (IsDevice() && Size>MaxDeviceRead) - return(DirectRead(Data,MaxDeviceRead)); - if (HandleType==FILE_HANDLESTD && GetLastError()==ERROR_BROKEN_PIPE) - return(0); - return(-1); - } - return(Read); -#else - if (LastWrite) - { - fflush(hFile); - LastWrite=false; - } - clearerr(hFile); - int ReadSize=fread(Data,1,Size,hFile); - if (ferror(hFile)) - return(-1); - return(ReadSize); -#endif -} - - -void File::Seek(Int64 Offset,int Method) -{ - if (!RawSeek(Offset,Method) && AllowExceptions) - ErrHandler.SeekError(FileName); -} - - -bool File::RawSeek(Int64 Offset,int Method) -{ - if (hFile==BAD_HANDLE) - return(true); - if (!is64plus(Offset) && Method!=SEEK_SET) - { - Offset=(Method==SEEK_CUR ? Tell():FileLength())+Offset; - Method=SEEK_SET; - } -#ifdef _WIN_32 - LONG HighDist=int64to32(Offset>>32); - if (SetFilePointer(hFile,int64to32(Offset),&HighDist,Method)==0xffffffff && - GetLastError()!=NO_ERROR) - return(false); -#else - LastWrite=false; -#if defined(_LARGEFILE_SOURCE) && !defined(_OSF_SOURCE) && !defined(__VMS) - if (fseeko(hFile,Offset,Method)!=0) -#else - if (fseek(hFile,(long)int64to32(Offset),Method)!=0) -#endif - return(false); -#endif - return(true); -} - - -Int64 File::Tell() -{ -#ifdef _WIN_32 - LONG HighDist=0; - uint LowDist=SetFilePointer(hFile,0,&HighDist,FILE_CURRENT); - if (LowDist==0xffffffff && GetLastError()!=NO_ERROR) - if (AllowExceptions) - ErrHandler.SeekError(FileName); - else - return(-1); - return(int32to64(HighDist,LowDist)); -#else -#if defined(_LARGEFILE_SOURCE) && !defined(_OSF_SOURCE) - return(ftello(hFile)); -#else - return(ftell(hFile)); -#endif -#endif -} - - -void File::Prealloc(Int64 Size) -{ -#ifdef _WIN_32 - if (RawSeek(Size,SEEK_SET)) - { - Truncate(); - Seek(0,SEEK_SET); - } -#endif -} - - -byte File::GetByte() -{ - byte Byte=0; - Read(&Byte,1); - return(Byte); -} - - -void File::PutByte(byte Byte) -{ - Write(&Byte,1); -} - - -bool File::Truncate() -{ -#ifdef _WIN_32 - return(SetEndOfFile(hFile)); -#else - return(false); -#endif -} - - -void File::SetOpenFileTime(RarTime *ftm,RarTime *ftc,RarTime *fta) -{ -#ifdef _WIN_32 - bool sm=ftm!=NULL && ftm->IsSet(); - bool sc=ftc!=NULL && ftc->IsSet(); - bool sa=fta!=NULL && fta->IsSet(); - FILETIME fm,fc,fa; - if (sm) - ftm->GetWin32(&fm); - if (sc) - ftc->GetWin32(&fc); - if (sa) - fta->GetWin32(&fa); - SetFileTime(hFile,sc ? &fc:NULL,sa ? &fa:NULL,sm ? &fm:NULL); -#endif -} - - -void File::SetCloseFileTime(RarTime *ftm,RarTime *fta) -{ -#if defined(_UNIX) || defined(_EMX) - SetCloseFileTimeByName(FileName,ftm,fta); -#endif -} - - -void File::SetCloseFileTimeByName(const char *Name,RarTime *ftm,RarTime *fta) -{ -#if defined(_UNIX) || defined(_EMX) - bool setm=ftm!=NULL && ftm->IsSet(); - bool seta=fta!=NULL && fta->IsSet(); - if (setm || seta) - { - struct utimbuf ut; - if (setm) - ut.modtime=ftm->GetUnix(); - else - ut.modtime=fta->GetUnix(); - if (seta) - ut.actime=fta->GetUnix(); - else - ut.actime=ut.modtime; - utime(Name,&ut); - } -#endif -} - - -void File::GetOpenFileTime(RarTime *ft) -{ -#ifdef _WIN_32 - FILETIME FileTime; - GetFileTime(hFile,NULL,NULL,&FileTime); - *ft=FileTime; -#endif -#if defined(_UNIX) || defined(_EMX) - struct stat st; - fstat(fileno(hFile),&st); - *ft=st.st_mtime; -#endif -} - - -void File::SetOpenFileStat(RarTime *ftm,RarTime *ftc,RarTime *fta) -{ -#ifdef _WIN_32 - SetOpenFileTime(ftm,ftc,fta); -#endif -} - - -void File::SetCloseFileStat(RarTime *ftm,RarTime *fta,uint FileAttr) -{ -#ifdef _WIN_32 - SetFileAttr(FileName,FileNameW,FileAttr); -#endif -#ifdef _EMX - SetCloseFileTime(ftm,fta); - SetFileAttr(FileName,FileNameW,FileAttr); -#endif -#ifdef _UNIX - SetCloseFileTime(ftm,fta); - chmod(FileName,(mode_t)FileAttr); -#endif -} - - -Int64 File::FileLength() -{ - SaveFilePos SavePos(*this); - Seek(0,SEEK_END); - return(Tell()); -} - - -void File::SetHandleType(FILE_HANDLETYPE Type) -{ - HandleType=Type; -} - - -bool File::IsDevice() -{ - if (hFile==BAD_HANDLE) - return(false); -#ifdef _WIN_32 - uint Type=GetFileType(hFile); - return(Type==FILE_TYPE_CHAR || Type==FILE_TYPE_PIPE); -#else - return(isatty(fileno(hFile))); -#endif -} - - -#ifndef SFX_MODULE -void File::fprintf(const char *fmt,...) -{ - va_list argptr; - va_start(argptr,fmt); - safebuf char Msg[2*NM+1024],OutMsg[2*NM+1024]; - vsprintf(Msg,fmt,argptr); -#ifdef _WIN_32 - for (int Src=0,Dest=0;;Src++) - { - char CurChar=Msg[Src]; - if (CurChar=='\n') - OutMsg[Dest++]='\r'; - OutMsg[Dest++]=CurChar; - if (CurChar==0) - break; - } -#else - strcpy(OutMsg,Msg); -#endif - Write(OutMsg,strlen(OutMsg)); - va_end(argptr); -} -#endif - - -bool File::RemoveCreated() -{ - RemoveCreatedActive++; - bool RetCode=true; - for (int I=0;ISetExceptions(false); - bool Success; - if (CreatedFiles[I]->NewFile) - Success=CreatedFiles[I]->Delete(); - else - Success=CreatedFiles[I]->Close(); - if (Success) - CreatedFiles[I]=NULL; - else - RetCode=false; - } - RemoveCreatedActive--; - return(RetCode); -} - - -#ifndef SFX_MODULE -long File::Copy(File &Dest,Int64 Length) -{ - Array Buffer(0x10000); - long CopySize=0; - bool CopyAll=(Length==INT64ERR); - - while (CopyAll || Length>0) - { - Wait(); - int SizeToRead=(!CopyAll && Length=NM || *s==0) - IgnoreAscii=true; - if (Wide && (PosW>=NM || PathW[PosW]==0) || !Wide && IgnoreAscii) - break; - if (Wide && PathW[PosW]==CPATHDIVIDER || !Wide && *s==CPATHDIVIDER) - { - wchar *DirPtrW=NULL,DirNameW[NM]; - if (Wide) - { - strncpyw(DirNameW,PathW,PosW); - DirNameW[PosW]=0; - DirPtrW=DirNameW; - } - char DirName[NM]; - if (IgnoreAscii) - WideToChar(DirPtrW,DirName); - else - { -#ifndef DBCS_SUPPORTED - if (*s!=CPATHDIVIDER) - for (const char *n=s;*n!=0 && n-PathIsSet(); - bool sc=ftc!=NULL && ftc->IsSet(); - bool sa=fta!=NULL && fta->IsSet(); - - unsigned int DirAttr=GetFileAttr(Name); - bool ResetAttr=(DirAttr!=0xffffffff && (DirAttr & FA_RDONLY)!=0); - if (ResetAttr) - SetFileAttr(Name,NULL,0); - HANDLE hFile=CreateFile(Name,GENERIC_WRITE,FILE_SHARE_READ|FILE_SHARE_WRITE, - NULL,OPEN_EXISTING,FILE_FLAG_BACKUP_SEMANTICS,NULL); - if (hFile==INVALID_HANDLE_VALUE) - return; - FILETIME fm,fc,fa; - if (sm) - ftm->GetWin32(&fm); - if (sc) - ftc->GetWin32(&fc); - if (sa) - fta->GetWin32(&fa); - SetFileTime(hFile,sc ? &fc:NULL,sa ? &fa:NULL,sm ? &fm:NULL); - CloseHandle(hFile); - if (ResetAttr) - SetFileAttr(Name,NULL,DirAttr); -#endif -#if defined(_UNIX) || defined(_EMX) - File::SetCloseFileTimeByName(Name,ftm,fta); -#endif -} - - -bool IsRemovable(const char *Name) -{ -#ifdef _WIN_32 - char Root[NM]; - GetPathRoot(Name,Root); - int Type=GetDriveType(*Root ? Root:NULL); - return(Type==DRIVE_REMOVABLE || Type==DRIVE_CDROM); -#elif defined(_EMX) - char Drive=etoupper(Name[0]); - return((Drive=='A' || Drive=='B') && Name[1]==':'); -#else - return(false); -#endif -} - - -#ifndef SFX_MODULE -Int64 GetFreeDisk(const char *Name) -{ -#ifdef _WIN_32 - char Root[NM]; - GetPathRoot(Name,Root); - - typedef BOOL (WINAPI *GETDISKFREESPACEEX)( - LPCTSTR,PULARGE_INTEGER,PULARGE_INTEGER,PULARGE_INTEGER - ); - static GETDISKFREESPACEEX pGetDiskFreeSpaceEx=NULL; - - if (pGetDiskFreeSpaceEx==NULL) - { - HMODULE hKernel=GetModuleHandle("kernel32.dll"); - if (hKernel!=NULL) - pGetDiskFreeSpaceEx=(GETDISKFREESPACEEX)GetProcAddress(hKernel,"GetDiskFreeSpaceExA"); - } - if (pGetDiskFreeSpaceEx!=NULL) - { - GetFilePath(Name,Root,ASIZE(Root)); - ULARGE_INTEGER uiTotalSize,uiTotalFree,uiUserFree; - uiUserFree.u.LowPart=uiUserFree.u.HighPart=0; - if (pGetDiskFreeSpaceEx(*Root ? Root:NULL,&uiUserFree,&uiTotalSize,&uiTotalFree) && - uiUserFree.u.HighPart<=uiTotalFree.u.HighPart) - return(int32to64(uiUserFree.u.HighPart,uiUserFree.u.LowPart)); - } - - DWORD SectorsPerCluster,BytesPerSector,FreeClusters,TotalClusters; - if (!GetDiskFreeSpace(*Root ? Root:NULL,&SectorsPerCluster,&BytesPerSector,&FreeClusters,&TotalClusters)) - return(1457664); - Int64 FreeSize=SectorsPerCluster*BytesPerSector; - FreeSize=FreeSize*FreeClusters; - return(FreeSize); -#elif defined(_BEOS) - char Root[NM]; - GetFilePath(Name,Root,ASIZE(Root)); - dev_t Dev=dev_for_path(*Root ? Root:"."); - if (Dev<0) - return(1457664); - fs_info Info; - if (fs_stat_dev(Dev,&Info)!=0) - return(1457664); - Int64 FreeSize=Info.block_size; - FreeSize=FreeSize*Info.free_blocks; - return(FreeSize); -#elif defined(_UNIX) - return(1457664); -#elif defined(_EMX) - int Drive=(!isalpha(Name[0]) || Name[1]!=':') ? 0:etoupper(Name[0])-'A'+1; -#ifndef _DJGPP - if (_osmode == OS2_MODE) - { - FSALLOCATE fsa; - if (DosQueryFSInfo(Drive,1,&fsa,sizeof(fsa))!=0) - return(1457664); - Int64 FreeSize=fsa.cSectorUnit*fsa.cbSector; - FreeSize=FreeSize*fsa.cUnitAvail; - return(FreeSize); - } - else -#endif - { - union REGS regs,outregs; - memset(®s,0,sizeof(regs)); - regs.h.ah=0x36; - regs.h.dl=Drive; -#ifdef _DJGPP - int86 (0x21,®s,&outregs); -#else - _int86 (0x21,®s,&outregs); -#endif - if (outregs.x.ax==0xffff) - return(1457664); - Int64 FreeSize=outregs.x.ax*outregs.x.cx; - FreeSize=FreeSize*outregs.x.bx; - return(FreeSize); - } -#else - #define DISABLEAUTODETECT - return(1457664); -#endif -} -#endif - - -bool FileExist(const char *Name,const wchar *NameW) -{ -#ifdef _WIN_32 - if (WinNT() && NameW!=NULL && *NameW!=0) - return(GetFileAttributesW(NameW)!=0xffffffff); - else - return(GetFileAttributes(Name)!=0xffffffff); -#elif defined(ENABLE_ACCESS) - return(access(Name,0)==0); -#else - struct FindData FD; - return(FindFile::FastFind(Name,NameW,&FD)); -#endif -} - - -bool WildFileExist(const char *Name,const wchar *NameW) -{ - if (IsWildcard(Name,NameW)) - { - FindFile Find; - Find.SetMask(Name); - Find.SetMaskW(NameW); - struct FindData fd; - return(Find.Next(&fd)); - } - return(FileExist(Name,NameW)); -} - - -bool IsDir(uint Attr) -{ -#if defined (_WIN_32) || defined(_EMX) - return(Attr!=0xffffffff && (Attr & 0x10)!=0); -#endif -#if defined(_UNIX) - return((Attr & 0xF000)==0x4000); -#endif -} - - -bool IsUnreadable(uint Attr) -{ -#if defined(_UNIX) && defined(S_ISFIFO) && defined(S_ISSOCK) && defined(S_ISCHR) - return(S_ISFIFO(Attr) || S_ISSOCK(Attr) || S_ISCHR(Attr)); -#endif - return(false); -} - - -bool IsLabel(uint Attr) -{ -#if defined (_WIN_32) || defined(_EMX) - return((Attr & 8)!=0); -#else - return(false); -#endif -} - - -bool IsLink(uint Attr) -{ -#ifdef _UNIX - return((Attr & 0xF000)==0xA000); -#else - return(false); -#endif -} - - - - - - -bool IsDeleteAllowed(uint FileAttr) -{ -#if defined(_WIN_32) || defined(_EMX) - return((FileAttr & (FA_RDONLY|FA_SYSTEM|FA_HIDDEN))==0); -#else - return((FileAttr & (S_IRUSR|S_IWUSR))==(S_IRUSR|S_IWUSR)); -#endif -} - - -void PrepareToDelete(const char *Name,const wchar *NameW) -{ -#if defined(_WIN_32) || defined(_EMX) - SetFileAttr(Name,NameW,0); -#endif -#ifdef _UNIX - chmod(Name,S_IRUSR|S_IWUSR|S_IXUSR); -#endif -} - - -uint GetFileAttr(const char *Name,const wchar *NameW) -{ -#ifdef _WIN_32 - if (WinNT() && NameW!=NULL && *NameW!=0) - return(GetFileAttributesW(NameW)); - else - return(GetFileAttributes(Name)); -#elif defined(_DJGPP) - return(_chmod(Name,0)); -#else - struct stat st; - if (stat(Name,&st)!=0) - return(0); -#ifdef _EMX - return(st.st_attr); -#else - return(st.st_mode); -#endif -#endif -} - - -bool SetFileAttr(const char *Name,const wchar *NameW,uint Attr) -{ - bool Success; -#ifdef _WIN_32 - if (WinNT() && NameW!=NULL && *NameW!=0) - Success=SetFileAttributesW(NameW,Attr)!=0; - else - Success=SetFileAttributes(Name,Attr)!=0; -#elif defined(_DJGPP) - Success=_chmod(Name,1,Attr)!=-1; -#elif defined(_EMX) - Success=__chmod(Name,1,Attr)!=-1; -#elif defined(_UNIX) - Success=chmod(Name,(mode_t)Attr)==0; -#else - Success=false; -#endif - return(Success); -} - - -void ConvertNameToFull(const char *Src,char *Dest) -{ -#ifdef _WIN_32 -#ifndef _WIN_CE - char FullName[NM],*NamePtr; - if (GetFullPathName(Src,sizeof(FullName),FullName,&NamePtr)) - strcpy(Dest,FullName); - else -#endif - if (Src!=Dest) - strcpy(Dest,Src); -#else - char FullName[NM]; - if (IsPathDiv(*Src) || IsDiskLetter(Src)) - strcpy(FullName,Src); - else - { - getcwd(FullName,sizeof(FullName)); - AddEndSlash(FullName); - strcat(FullName,Src); - } - strcpy(Dest,FullName); -#endif -} - - -#ifndef SFX_MODULE -void ConvertNameToFull(const wchar *Src,wchar *Dest) -{ - if (Src==NULL || *Src==0) - { - *Dest=0; - return; - } -#ifdef _WIN_32 -#ifndef _WIN_CE - if (WinNT()) -#endif - { -#ifndef _WIN_CE - wchar FullName[NM],*NamePtr; - if (GetFullPathNameW(Src,sizeof(FullName)/sizeof(FullName[0]),FullName,&NamePtr)) - strcpyw(Dest,FullName); - else -#endif - if (Src!=Dest) - strcpyw(Dest,Src); - } -#ifndef _WIN_CE - else - { - char AnsiName[NM]; - WideToChar(Src,AnsiName); - ConvertNameToFull(AnsiName,AnsiName); - CharToWide(AnsiName,Dest); - } -#endif -#else - char AnsiName[NM]; - WideToChar(Src,AnsiName); - ConvertNameToFull(AnsiName,AnsiName); - CharToWide(AnsiName,Dest); -#endif -} -#endif - - -#ifndef SFX_MODULE -char *MkTemp(char *Name) -{ - int Length=strlen(Name); - if (Length<=6) - return(NULL); - int Random=clock(); - for (int Attempt=0;;Attempt++) - { - sprintf(Name+Length-6,"%06u",Random+Attempt); - Name[Length-4]='.'; - if (!FileExist(Name)) - break; - if (Attempt==1000) - return(NULL); - } - return(Name); -} -#endif - - - - -#ifndef SFX_MODULE -uint CalcFileCRC(File *SrcFile,Int64 Size,CALCCRC_SHOWMODE ShowMode) -{ - SaveFilePos SavePos(*SrcFile); - const int BufSize=0x10000; - Array Data(BufSize); - Int64 BlockCount=0; - uint DataCRC=0xffffffff; - int ReadSize; - -#if !defined(SILENT) && !defined(_WIN_CE) - Int64 FileLength=SrcFile->FileLength(); - if (ShowMode!=CALCCRC_SHOWNONE) - { - mprintf(St(MCalcCRC)); - mprintf(" "); - } - -#endif - - SrcFile->Seek(0,SEEK_SET); - while ((ReadSize=SrcFile->Read(&Data[0],int64to32(Size==INT64ERR ? Int64(BufSize):Min(Int64(BufSize),Size))))!=0) - { - ++BlockCount; - if ((BlockCount & 15)==0) - { -#if !defined(SILENT) && !defined(_WIN_CE) - if (ShowMode==CALCCRC_SHOWALL) - mprintf("\b\b\b\b%3d%%",ToPercent(BlockCount*Int64(BufSize),FileLength)); -#endif - Wait(); - } - DataCRC=CRC(DataCRC,&Data[0],ReadSize); - if (Size!=INT64ERR) - Size-=ReadSize; - } -#if !defined(SILENT) && !defined(_WIN_CE) - if (ShowMode==CALCCRC_SHOWALL) - mprintf("\b\b\b\b "); -#endif - return(DataCRC^0xffffffff); -} -#endif - - -bool RenameFile(const char *SrcName,const wchar *SrcNameW,const char *DestName,const wchar *DestNameW) -{ - return(rename(SrcName,DestName)==0); -} - - -bool DelFile(const char *Name) -{ - return(DelFile(Name,NULL)); -} - - -bool DelFile(const char *Name,const wchar *NameW) -{ - return(remove(Name)==0); -} - - -bool DelDir(const char *Name) -{ - return(DelDir(Name,NULL)); -} - - -bool DelDir(const char *Name,const wchar *NameW) -{ - return(rmdir(Name)==0); -} - - -#if defined(_WIN_32) && !defined(_WIN_CE) -bool SetFileCompression(char *Name,wchar *NameW,bool State) -{ - wchar FileNameW[NM]; - GetWideName(Name,NameW,FileNameW); - HANDLE hFile=CreateFileW(FileNameW,FILE_READ_DATA|FILE_WRITE_DATA, - FILE_SHARE_READ|FILE_SHARE_WRITE,NULL,OPEN_EXISTING, - FILE_FLAG_BACKUP_SEMANTICS|FILE_FLAG_SEQUENTIAL_SCAN,NULL); - if (hFile==INVALID_HANDLE_VALUE) - return(false); - SHORT NewState=State ? COMPRESSION_FORMAT_DEFAULT:COMPRESSION_FORMAT_NONE; - DWORD Result; - int RetCode=DeviceIoControl(hFile,FSCTL_SET_COMPRESSION,&NewState, - sizeof(NewState),NULL,0,&Result,NULL); - CloseHandle(hFile); - return(RetCode!=0); -} -#endif diff --git a/src/bin/unrar/filefn.hpp b/src/bin/unrar/filefn.hpp deleted file mode 100644 index ec6cba528a..0000000000 --- a/src/bin/unrar/filefn.hpp +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef _RAR_FILEFN_ -#define _RAR_FILEFN_ - -enum MKDIR_CODE {MKDIR_SUCCESS,MKDIR_ERROR,MKDIR_BADPATH}; - -MKDIR_CODE MakeDir(const char *Name,const wchar *NameW,uint Attr); -bool CreatePath(const char *Path,const wchar *PathW,bool SkipLastName); -void SetDirTime(const char *Name,RarTime *ftm,RarTime *ftc,RarTime *fta); -bool IsRemovable(const char *Name); -Int64 GetFreeDisk(const char *Name); -bool FileExist(const char *Name,const wchar *NameW=NULL); -bool WildFileExist(const char *Name,const wchar *NameW=NULL); -bool IsDir(uint Attr); -bool IsUnreadable(uint Attr); -bool IsLabel(uint Attr); -bool IsLink(uint Attr); -void SetSFXMode(const char *FileName); -void EraseDiskContents(const char *FileName); -bool IsDeleteAllowed(uint FileAttr); -void PrepareToDelete(const char *Name,const wchar *NameW=NULL); -uint GetFileAttr(const char *Name,const wchar *NameW=NULL); -bool SetFileAttr(const char *Name,const wchar *NameW,uint Attr); -void ConvertNameToFull(const char *Src,char *Dest); -void ConvertNameToFull(const wchar *Src,wchar *Dest); -char* MkTemp(char *Name); - - -enum CALCCRC_SHOWMODE {CALCCRC_SHOWNONE,CALCCRC_SHOWTEXT,CALCCRC_SHOWALL}; -uint CalcFileCRC(File *SrcFile,Int64 Size=INT64ERR,CALCCRC_SHOWMODE ShowMode=CALCCRC_SHOWNONE); - -bool RenameFile(const char *SrcName,const wchar *SrcNameW,const char *DestName,const wchar *DestNameW); -bool DelFile(const char *Name); -bool DelFile(const char *Name,const wchar *NameW); -bool DelDir(const char *Name); -bool DelDir(const char *Name,const wchar *NameW); - -#if defined(_WIN_32) && !defined(_WIN_CE) -bool SetFileCompression(char *Name,wchar *NameW,bool State); -#endif - -#endif diff --git a/src/bin/unrar/filestr.cpp b/src/bin/unrar/filestr.cpp deleted file mode 100644 index 55e79a1fd7..0000000000 --- a/src/bin/unrar/filestr.cpp +++ /dev/null @@ -1,145 +0,0 @@ -#include "rar.hpp" - -static bool IsUnicode(byte *Data,int Size); - -bool ReadTextFile(char *Name,StringList *List,bool Config,bool AbortOnError, - RAR_CHARSET SrcCharset,bool Unquote,bool SkipComments) -{ - char FileName[NM]; - if (Config) - GetConfigName(Name,FileName,true); - else - strcpy(FileName,Name); - - File SrcFile; - if (*FileName) - { - bool OpenCode=AbortOnError ? SrcFile.WOpen(FileName):SrcFile.Open(FileName); - - if (!OpenCode) - { - if (AbortOnError) - ErrHandler.Exit(OPEN_ERROR); - return(false); - } - } - else - SrcFile.SetHandleType(FILE_HANDLESTD); - - unsigned int DataSize=0,ReadSize; - const int ReadBlock=1024; - Array Data(ReadBlock+5); - while ((ReadSize=SrcFile.Read(&Data[DataSize],ReadBlock))!=0) - { - DataSize+=ReadSize; - Data.Add(ReadSize); - } - - memset(&Data[DataSize],0,5); - - if (SrcCharset==RCH_UNICODE || - SrcCharset==RCH_DEFAULT && IsUnicode((byte *)&Data[0],DataSize)) - { - // Unicode in native system format, can be more than 2 bytes per character - Array DataW(Data.Size()/2+1); - for (int I=2;I AnsiName; - - while (*CurStr!=0) - { - wchar *NextStr=CurStr,*CmtPtr=NULL; - while (*NextStr!='\r' && *NextStr!='\n' && *NextStr!=0) - { - if (SkipComments && NextStr[0]=='/' && NextStr[1]=='/') - { - *NextStr=0; - CmtPtr=NextStr; - } - NextStr++; - } - *NextStr=0; - for (wchar *SpacePtr=(CmtPtr ? CmtPtr:NextStr)-1;SpacePtr>=CurStr;SpacePtr--) - { - if (*SpacePtr!=' ' && *SpacePtr!='\t') - break; - *SpacePtr=0; - } - if (*CurStr) - { - int Length=strlenw(CurStr); - int AddSize=4*(Length-AnsiName.Size()+1); - if (AddSize>0) - AnsiName.Add(AddSize); - if (Unquote && *CurStr=='\"' && CurStr[Length-1]=='\"') - { - CurStr[Length-1]=0; - CurStr++; - } - WideToChar(CurStr,&AnsiName[0],AnsiName.Size()); - List->AddString(&AnsiName[0],CurStr); - } - CurStr=NextStr+1; - while (*CurStr=='\r' || *CurStr=='\n') - CurStr++; - } - } - else - { - char *CurStr=&Data[0]; - while (*CurStr!=0) - { - char *NextStr=CurStr,*CmtPtr=NULL; - while (*NextStr!='\r' && *NextStr!='\n' && *NextStr!=0) - { - if (SkipComments && NextStr[0]=='/' && NextStr[1]=='/') - { - *NextStr=0; - CmtPtr=NextStr; - } - NextStr++; - } - *NextStr=0; - for (char *SpacePtr=(CmtPtr ? CmtPtr:NextStr)-1;SpacePtr>=CurStr;SpacePtr--) - { - if (*SpacePtr!=' ' && *SpacePtr!='\t') - break; - *SpacePtr=0; - } - if (*CurStr) - { - if (Unquote && *CurStr=='\"') - { - int Length=strlen(CurStr); - if (CurStr[Length-1]=='\"') - { - CurStr[Length-1]=0; - CurStr++; - } - } -#if defined(_WIN_32) - if (SrcCharset==RCH_OEM) - OemToChar(CurStr,CurStr); -#endif - List->AddString(CurStr); - } - CurStr=NextStr+1; - while (*CurStr=='\r' || *CurStr=='\n') - CurStr++; - } - } - return(true); -} - - -bool IsUnicode(byte *Data,int Size) -{ - if (Size<4 || Data[0]!=0xff || Data[1]!=0xfe) - return(false); - for (int I=2;IError=false; - if (*FindMask==0) - return(false); -#ifdef _WIN_32 - if (FirstCall) - { - if ((hFind=Win32Find(INVALID_HANDLE_VALUE,FindMask,FindMaskW,fd))==INVALID_HANDLE_VALUE) - return(false); - } - else - if (Win32Find(hFind,FindMask,FindMaskW,fd)==INVALID_HANDLE_VALUE) - return(false); -#else - if (FirstCall) - { - char DirName[NM]; - strcpy(DirName,FindMask); - RemoveNameFromPath(DirName); - if (*DirName==0) - strcpy(DirName,"."); -/* - else - { - int Length=strlen(DirName); - if (Length>1 && DirName[Length-1]==CPATHDIVIDER && (Length!=3 || !IsDriveDiv(DirName[1]))) - DirName[Length-1]=0; - } -*/ - if ((dirp=opendir(DirName))==NULL) - { - fd->Error=(errno!=ENOENT); - return(false); - } - } - while (1) - { - struct dirent *ent=readdir(dirp); - if (ent==NULL) - return(false); - if (strcmp(ent->d_name,".")==0 || strcmp(ent->d_name,"..")==0) - continue; - if (CmpName(FindMask,ent->d_name,MATCH_NAMES)) - { - char FullName[NM]; - strcpy(FullName,FindMask); - *PointToName(FullName)=0; - if (strlen(FullName)+strlen(ent->d_name)>=ASIZE(FullName)-1) - { -#ifndef SILENT - Log(NULL,"\n%s%s",FullName,ent->d_name); - Log(NULL,St(MPathTooLong)); -#endif - return(false); - } - strcat(FullName,ent->d_name); - if (!FastFind(FullName,NULL,fd,GetSymLink)) - { - ErrHandler.OpenErrorMsg(FullName); - continue; - } - strcpy(fd->Name,FullName); - break; - } - } - *fd->NameW=0; -#ifdef _APPLE - if (!LowAscii(fd->Name)) - UtfToWide(fd->Name,fd->NameW,sizeof(fd->NameW)); -#elif defined(UNICODE_SUPPORTED) - if (!LowAscii(fd->Name) && UnicodeEnabled()) - CharToWide(fd->Name,fd->NameW); -#endif -#endif - fd->IsDir=IsDir(fd->FileAttr); - FirstCall=FALSE; - char *Name=PointToName(fd->Name); - if (strcmp(Name,".")==0 || strcmp(Name,"..")==0) - return(Next(fd)); - return(true); -} - - -bool FindFile::FastFind(const char *FindMask,const wchar *FindMaskW,struct FindData *fd,bool GetSymLink) -{ - fd->Error=false; -#ifndef _UNIX - if (IsWildcard(FindMask,FindMaskW)) - return(false); -#endif -#ifdef _WIN_32 - HANDLE hFind=Win32Find(INVALID_HANDLE_VALUE,FindMask,FindMaskW,fd); - if (hFind==INVALID_HANDLE_VALUE) - return(false); - FindClose(hFind); -#else - struct stat st; - if (GetSymLink) - { -#ifdef SAVE_LINKS - if (lstat(FindMask,&st)!=0) -#else - if (stat(FindMask,&st)!=0) -#endif - { - fd->Error=(errno!=ENOENT); - return(false); - } - } - else - if (stat(FindMask,&st)!=0) - { - fd->Error=(errno!=ENOENT); - return(false); - } -#ifdef _DJGPP - fd->FileAttr=_chmod(FindMask,0); -#elif defined(_EMX) - fd->FileAttr=st.st_attr; -#else - fd->FileAttr=st.st_mode; -#endif - fd->IsDir=IsDir(st.st_mode); - fd->Size=st.st_size; - fd->mtime=st.st_mtime; - fd->atime=st.st_atime; - fd->ctime=st.st_ctime; - fd->FileTime=fd->mtime.GetDos(); - strcpy(fd->Name,FindMask); - - *fd->NameW=0; -#ifdef _APPLE - if (!LowAscii(fd->Name)) - UtfToWide(fd->Name,fd->NameW,sizeof(fd->NameW)); -#elif defined(UNICODE_SUPPORTED) - if (!LowAscii(fd->Name) && UnicodeEnabled()) - CharToWide(fd->Name,fd->NameW); -#endif -#endif - fd->IsDir=IsDir(fd->FileAttr); - return(true); -} - - -#ifdef _WIN_32 -HANDLE FindFile::Win32Find(HANDLE hFind,const char *Mask,const wchar *MaskW,struct FindData *fd) -{ -#ifndef _WIN_CE - if (WinNT()) -#endif - { - wchar WideMask[NM]; - if (MaskW!=NULL && *MaskW!=0) - strcpyw(WideMask,MaskW); - else - CharToWide(Mask,WideMask); - - WIN32_FIND_DATAW FindData; - if (hFind==INVALID_HANDLE_VALUE) - { - hFind=FindFirstFileW(WideMask,&FindData); - if (hFind==INVALID_HANDLE_VALUE) - { - int SysErr=GetLastError(); - fd->Error=(SysErr!=ERROR_FILE_NOT_FOUND && - SysErr!=ERROR_PATH_NOT_FOUND && - SysErr!=ERROR_NO_MORE_FILES); - } - } - else - if (!FindNextFileW(hFind,&FindData)) - { - hFind=INVALID_HANDLE_VALUE; - fd->Error=GetLastError()!=ERROR_NO_MORE_FILES; - } - - if (hFind!=INVALID_HANDLE_VALUE) - { - strcpyw(fd->NameW,WideMask); - strcpyw(PointToName(fd->NameW),FindData.cFileName); - WideToChar(fd->NameW,fd->Name); - fd->Size=int32to64(FindData.nFileSizeHigh,FindData.nFileSizeLow); - fd->FileAttr=FindData.dwFileAttributes; - WideToChar(FindData.cAlternateFileName,fd->ShortName); - fd->ftCreationTime=FindData.ftCreationTime; - fd->ftLastAccessTime=FindData.ftLastAccessTime; - fd->ftLastWriteTime=FindData.ftLastWriteTime; - fd->mtime=FindData.ftLastWriteTime; - fd->ctime=FindData.ftCreationTime; - fd->atime=FindData.ftLastAccessTime; - fd->FileTime=fd->mtime.GetDos(); - -#ifndef _WIN_CE - if (LowAscii(fd->NameW)) - *fd->NameW=0; -#endif - } - } -#ifndef _WIN_CE - else - { - char CharMask[NM]; - if (Mask!=NULL && *Mask!=0) - strcpy(CharMask,Mask); - else - WideToChar(MaskW,CharMask); - - WIN32_FIND_DATA FindData; - if (hFind==INVALID_HANDLE_VALUE) - { - hFind=FindFirstFile(CharMask,&FindData); - if (hFind==INVALID_HANDLE_VALUE) - { - int SysErr=GetLastError(); - fd->Error=SysErr!=ERROR_FILE_NOT_FOUND && SysErr!=ERROR_PATH_NOT_FOUND; - } - } - else - if (!FindNextFile(hFind,&FindData)) - { - hFind=INVALID_HANDLE_VALUE; - fd->Error=GetLastError()!=ERROR_NO_MORE_FILES; - } - - if (hFind!=INVALID_HANDLE_VALUE) - { - strcpy(fd->Name,CharMask); - strcpy(PointToName(fd->Name),FindData.cFileName); - CharToWide(fd->Name,fd->NameW); - fd->Size=int32to64(FindData.nFileSizeHigh,FindData.nFileSizeLow); - fd->FileAttr=FindData.dwFileAttributes; - strcpy(fd->ShortName,FindData.cAlternateFileName); - fd->ftCreationTime=FindData.ftCreationTime; - fd->ftLastAccessTime=FindData.ftLastAccessTime; - fd->ftLastWriteTime=FindData.ftLastWriteTime; - fd->mtime=FindData.ftLastWriteTime; - fd->ctime=FindData.ftCreationTime; - fd->atime=FindData.ftLastAccessTime; - fd->FileTime=fd->mtime.GetDos(); - if (LowAscii(fd->Name)) - *fd->NameW=0; - } - } -#endif - return(hFind); -} -#endif - diff --git a/src/bin/unrar/find.hpp b/src/bin/unrar/find.hpp deleted file mode 100644 index 81548199c3..0000000000 --- a/src/bin/unrar/find.hpp +++ /dev/null @@ -1,48 +0,0 @@ -#ifndef _RAR_FINDDATA_ -#define _RAR_FINDDATA_ - -struct FindData -{ - char Name[NM]; - wchar NameW[NM]; - Int64 Size; - uint FileAttr; - uint FileTime; - bool IsDir; - RarTime mtime; - RarTime ctime; - RarTime atime; -#ifdef _WIN_32 - char ShortName[NM]; - FILETIME ftCreationTime; - FILETIME ftLastAccessTime; - FILETIME ftLastWriteTime; -#endif - bool Error; -}; - -class FindFile -{ - private: -#ifdef _WIN_32 - static HANDLE Win32Find(HANDLE hFind,const char *Mask,const wchar *MaskW,struct FindData *fd); -#endif - - char FindMask[NM]; - wchar FindMaskW[NM]; - int FirstCall; -#ifdef _WIN_32 - HANDLE hFind; -#else - DIR *dirp; -#endif - public: - FindFile(); - ~FindFile(); - void SetMask(const char *FindMask); - void SetMaskW(const wchar *FindMaskW); - bool Next(struct FindData *fd,bool GetSymLink=false); - static bool FastFind(const char *FindMask,const wchar *FindMaskW,struct FindData *fd,bool GetSymLink=false); -}; - -#endif diff --git a/src/bin/unrar/getbits.cpp b/src/bin/unrar/getbits.cpp deleted file mode 100644 index 71ecfc875c..0000000000 --- a/src/bin/unrar/getbits.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include "rar.hpp" - -BitInput::BitInput() -{ - InBuf=new byte[MAX_SIZE]; -} - - -BitInput::~BitInput() -{ - delete[] InBuf; -} - - -void BitInput::faddbits(int Bits) -{ - addbits(Bits); -} - - -unsigned int BitInput::fgetbits() -{ - return(getbits()); -} diff --git a/src/bin/unrar/getbits.hpp b/src/bin/unrar/getbits.hpp deleted file mode 100644 index eff4dafcbf..0000000000 --- a/src/bin/unrar/getbits.hpp +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef _RAR_GETBITS_ -#define _RAR_GETBITS_ - -class BitInput -{ - public: - enum BufferSize {MAX_SIZE=0x8000}; - protected: - int InAddr,InBit; - public: - BitInput(); - ~BitInput(); - - byte *InBuf; - - void InitBitInput() - { - InAddr=InBit=0; - } - void addbits(int Bits) - { - Bits+=InBit; - InAddr+=Bits>>3; - InBit=Bits&7; - } - unsigned int getbits() - { - unsigned int BitField=(uint)InBuf[InAddr] << 16; - BitField|=(uint)InBuf[InAddr+1] << 8; - BitField|=(uint)InBuf[InAddr+2]; - BitField >>= (8-InBit); - return(BitField & 0xffff); - } - void faddbits(int Bits); - unsigned int fgetbits(); - bool Overflow(int IncPtr) {return(InAddr+IncPtr>=MAX_SIZE);} -}; -#endif diff --git a/src/bin/unrar/global.cpp b/src/bin/unrar/global.cpp deleted file mode 100644 index 593a057cbf..0000000000 --- a/src/bin/unrar/global.cpp +++ /dev/null @@ -1,4 +0,0 @@ -#define INCLUDEGLOBAL - - -#include "rar.hpp" diff --git a/src/bin/unrar/global.hpp b/src/bin/unrar/global.hpp deleted file mode 100644 index 35c6cf9130..0000000000 --- a/src/bin/unrar/global.hpp +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef _RAR_GLOBAL_ -#define _RAR_GLOBAL_ - -#ifdef INCLUDEGLOBAL - #define EXTVAR -#else - #define EXTVAR extern -#endif - -EXTVAR ErrorHandler ErrHandler; - - - -#endif diff --git a/src/bin/unrar/headers.hpp b/src/bin/unrar/headers.hpp deleted file mode 100644 index acf597d758..0000000000 --- a/src/bin/unrar/headers.hpp +++ /dev/null @@ -1,306 +0,0 @@ -#ifndef _RAR_HEADERS_ -#define _RAR_HEADERS_ - -#define SIZEOF_MARKHEAD 7 -#define SIZEOF_OLDMHD 7 -#define SIZEOF_NEWMHD 13 -#define SIZEOF_OLDLHD 21 -#define SIZEOF_NEWLHD 32 -#define SIZEOF_SHORTBLOCKHEAD 7 -#define SIZEOF_LONGBLOCKHEAD 11 -#define SIZEOF_SUBBLOCKHEAD 14 -#define SIZEOF_COMMHEAD 13 -#define SIZEOF_PROTECTHEAD 26 -#define SIZEOF_AVHEAD 14 -#define SIZEOF_SIGNHEAD 15 -#define SIZEOF_UOHEAD 18 -#define SIZEOF_MACHEAD 22 -#define SIZEOF_EAHEAD 24 -#define SIZEOF_BEEAHEAD 24 -#define SIZEOF_STREAMHEAD 26 - -#define PACK_VER 29 -#define PACK_CRYPT_VER 29 -#define UNP_VER 36 -#define CRYPT_VER 29 -#define AV_VER 20 -#define PROTECT_VER 20 - -#define MHD_VOLUME 0x0001 -#define MHD_COMMENT 0x0002 -#define MHD_LOCK 0x0004 -#define MHD_SOLID 0x0008 -#define MHD_PACK_COMMENT 0x0010 -#define MHD_NEWNUMBERING 0x0010 -#define MHD_AV 0x0020 -#define MHD_PROTECT 0x0040 -#define MHD_PASSWORD 0x0080 -#define MHD_FIRSTVOLUME 0x0100 -#define MHD_ENCRYPTVER 0x0200 - -#define LHD_SPLIT_BEFORE 0x0001 -#define LHD_SPLIT_AFTER 0x0002 -#define LHD_PASSWORD 0x0004 -#define LHD_COMMENT 0x0008 -#define LHD_SOLID 0x0010 - -#define LHD_WINDOWMASK 0x00e0 -#define LHD_WINDOW64 0x0000 -#define LHD_WINDOW128 0x0020 -#define LHD_WINDOW256 0x0040 -#define LHD_WINDOW512 0x0060 -#define LHD_WINDOW1024 0x0080 -#define LHD_WINDOW2048 0x00a0 -#define LHD_WINDOW4096 0x00c0 -#define LHD_DIRECTORY 0x00e0 - -#define LHD_LARGE 0x0100 -#define LHD_UNICODE 0x0200 -#define LHD_SALT 0x0400 -#define LHD_VERSION 0x0800 -#define LHD_EXTTIME 0x1000 -#define LHD_EXTFLAGS 0x2000 - -#define SKIP_IF_UNKNOWN 0x4000 -#define LONG_BLOCK 0x8000 - -#define EARC_NEXT_VOLUME 0x0001 // not last volume -#define EARC_DATACRC 0x0002 -#define EARC_REVSPACE 0x0004 -#define EARC_VOLNUMBER 0x0008 - -enum HEADER_TYPE { - MARK_HEAD=0x72,MAIN_HEAD=0x73,FILE_HEAD=0x74,COMM_HEAD=0x75,AV_HEAD=0x76, - SUB_HEAD=0x77,PROTECT_HEAD=0x78,SIGN_HEAD=0x79,NEWSUB_HEAD=0x7a, - ENDARC_HEAD=0x7b -}; - -enum { EA_HEAD=0x100,UO_HEAD=0x101,MAC_HEAD=0x102,BEEA_HEAD=0x103, - NTACL_HEAD=0x104,STREAM_HEAD=0x105 }; - -enum HOST_SYSTEM { - HOST_MSDOS=0,HOST_OS2=1,HOST_WIN32=2,HOST_UNIX=3,HOST_MACOS=4, - HOST_BEOS=5,HOST_MAX -}; - -#define SUBHEAD_TYPE_CMT "CMT" -#define SUBHEAD_TYPE_ACL "ACL" -#define SUBHEAD_TYPE_STREAM "STM" -#define SUBHEAD_TYPE_UOWNER "UOW" -#define SUBHEAD_TYPE_AV "AV" -#define SUBHEAD_TYPE_RR "RR" -#define SUBHEAD_TYPE_OS2EA "EA2" -#define SUBHEAD_TYPE_BEOSEA "EABE" - -/* new file inherits a subblock when updating a host file */ -#define SUBHEAD_FLAGS_INHERITED 0x80000000 - -#define SUBHEAD_FLAGS_CMT_UNICODE 0x00000001 - -struct OldMainHeader -{ - byte Mark[4]; - ushort HeadSize; - byte Flags; -}; - - -struct OldFileHeader -{ - uint PackSize; - uint UnpSize; - ushort FileCRC; - ushort HeadSize; - uint FileTime; - byte FileAttr; - byte Flags; - byte UnpVer; - byte NameSize; - byte Method; -}; - - -struct MarkHeader -{ - byte Mark[7]; -}; - - -struct BaseBlock -{ - ushort HeadCRC; - HEADER_TYPE HeadType;//byte - ushort Flags; - ushort HeadSize; - - bool IsSubBlock() - { - if (HeadType==SUB_HEAD) - return(true); - if (HeadType==NEWSUB_HEAD && (Flags & LHD_SOLID)!=0) - return(true); - return(false); - } -}; - -struct BlockHeader:BaseBlock -{ - union { - uint DataSize; - uint PackSize; - }; -}; - - -struct MainHeader:BaseBlock -{ - ushort HighPosAV; - uint PosAV; - byte EncryptVer; -}; - - -#define SALT_SIZE 8 - -struct FileHeader:BlockHeader -{ - uint UnpSize; - byte HostOS; - uint FileCRC; - uint FileTime; - byte UnpVer; - byte Method; - ushort NameSize; - union { - uint FileAttr; - uint SubFlags; - }; -/* optional */ - uint HighPackSize; - uint HighUnpSize; -/* names */ - char FileName[NM]; - wchar FileNameW[NM]; -/* optional */ - Array SubData; - byte Salt[SALT_SIZE]; - - RarTime mtime; - RarTime ctime; - RarTime atime; - RarTime arctime; -/* dummy */ - Int64 FullPackSize; - Int64 FullUnpSize; - - void Clear(int SubDataSize) - { - SubData.Alloc(SubDataSize); - Flags=LONG_BLOCK; - SubFlags=0; - } - - bool CmpName(const char *Name) - { - return(strcmp(FileName,Name)==0); - } - - FileHeader& operator = (FileHeader &hd) - { - SubData.Reset(); - memcpy(this,&hd,sizeof(*this)); - SubData.CleanData(); - SubData=hd.SubData; - return(*this); - } -}; - - -struct EndArcHeader:BaseBlock -{ - uint ArcDataCRC; - ushort VolNumber; -}; - - -struct SubBlockHeader:BlockHeader -{ - ushort SubType; - byte Level; -}; - - -struct CommentHeader:BaseBlock -{ - ushort UnpSize; - byte UnpVer; - byte Method; - ushort CommCRC; -}; - - -struct ProtectHeader:BlockHeader -{ - byte Version; - ushort RecSectors; - uint TotalBlocks; - byte Mark[8]; -}; - - -struct AVHeader:BaseBlock -{ - byte UnpVer; - byte Method; - byte AVVer; - uint AVInfoCRC; -}; - - -struct SignHeader:BaseBlock -{ - uint CreationTime; - ushort ArcNameSize; - ushort UserNameSize; -}; - - -struct UnixOwnersHeader:SubBlockHeader -{ - ushort OwnerNameSize; - ushort GroupNameSize; -/* dummy */ - char OwnerName[NM]; - char GroupName[NM]; -}; - - -struct EAHeader:SubBlockHeader -{ - uint UnpSize; - byte UnpVer; - byte Method; - uint EACRC; -}; - - -struct StreamHeader:SubBlockHeader -{ - uint UnpSize; - byte UnpVer; - byte Method; - uint StreamCRC; - ushort StreamNameSize; -/* dummy */ - byte StreamName[NM]; -}; - - -struct MacFInfoHeader:SubBlockHeader -{ - uint fileType; - uint fileCreator; -}; - - -#endif diff --git a/src/bin/unrar/int64.cpp b/src/bin/unrar/int64.cpp deleted file mode 100644 index 996d0ea62d..0000000000 --- a/src/bin/unrar/int64.cpp +++ /dev/null @@ -1,274 +0,0 @@ -#include "rar.hpp" - -#ifndef NATIVE_INT64 - -Int64::Int64() -{ -} - - -Int64::Int64(uint n) -{ - HighPart=0; - LowPart=n; -} - - -Int64::Int64(uint HighPart,uint LowPart) -{ - Int64::HighPart=HighPart; - Int64::LowPart=LowPart; -} - - -/* -Int64 Int64::operator = (Int64 n) -{ - HighPart=n.HighPart; - LowPart=n.LowPart; - return(*this); -} -*/ - - -Int64 Int64::operator << (int n) -{ - Int64 res=*this; - while (n--) - { - res.HighPart<<=1; - if (res.LowPart & 0x80000000) - res.HighPart|=1; - res.LowPart<<=1; - } - return(res); -} - - -Int64 Int64::operator >> (int n) -{ - Int64 res=*this; - while (n--) - { - res.LowPart>>=1; - if (res.HighPart & 1) - res.LowPart|=0x80000000; - res.HighPart>>=1; - } - return(res); -} - - -Int64 operator / (Int64 n1,Int64 n2) -{ - if (n1.HighPart==0 && n2.HighPart==0) - return(Int64(0,n1.LowPart/n2.LowPart)); - int ShiftCount=0; - while (n1>n2) - { - n2=n2<<1; - if (++ShiftCount>64) - return(0); - } - Int64 res=0; - while (ShiftCount-- >= 0) - { - res=res<<1; - if (n1>=n2) - { - n1-=n2; - ++res; - } - n2=n2>>1; - } - return(res); -} - - -Int64 operator * (Int64 n1,Int64 n2) -{ - if (n1<0x10000 && n2<0x10000) - return(Int64(0,n1.LowPart*n2.LowPart)); - Int64 res=0; - for (int I=0;I<64;I++) - { - if (n2.LowPart & 1) - res+=n1; - n1=n1<<1; - n2=n2>>1; - } - return(res); -} - - -Int64 operator % (Int64 n1,Int64 n2) -{ - if (n1.HighPart==0 && n2.HighPart==0) - return(Int64(0,n1.LowPart%n2.LowPart)); - return(n1-n1/n2*n2); -} - - -Int64 operator + (Int64 n1,Int64 n2) -{ - n1.LowPart+=n2.LowPart; - if (n1.LowPart (Int64 n1,Int64 n2) -{ - return((int)n1.HighPart>(int)n2.HighPart || n1.HighPart==n2.HighPart && n1.LowPart>n2.LowPart); -} - - -bool operator < (Int64 n1,Int64 n2) -{ - return((int)n1.HighPart<(int)n2.HighPart || n1.HighPart==n2.HighPart && n1.LowPart= (Int64 n1,Int64 n2) -{ - return(n1>n2 || n1==n2); -} - - -bool operator <= (Int64 n1,Int64 n2) -{ - return(n1='0' && *Str<='9') - { - n=n*10+*Str-'0'; - Str++; - } - return(n); -} diff --git a/src/bin/unrar/int64.hpp b/src/bin/unrar/int64.hpp deleted file mode 100644 index d2f34bb156..0000000000 --- a/src/bin/unrar/int64.hpp +++ /dev/null @@ -1,86 +0,0 @@ -#ifndef _RAR_INT64_ -#define _RAR_INT64_ - -#if defined(__BORLANDC__) || defined(_MSC_VER) -#define NATIVE_INT64 -typedef __int64 Int64; -#endif - -#if defined(__GNUC__) || defined(__HP_aCC) || defined(__SUNPRO_CC) -#define NATIVE_INT64 -typedef long long Int64; -#endif - -#ifdef NATIVE_INT64 - -#define int64to32(x) ((uint)(x)) -#define int32to64(high,low) ((((Int64)(high))<<32)+(low)) -#define is64plus(x) (x>=0) - -#else - -class Int64 -{ - public: - Int64(); - Int64(uint n); - Int64(uint HighPart,uint LowPart); - -// Int64 operator = (Int64 n); - Int64 operator << (int n); - Int64 operator >> (int n); - - friend Int64 operator / (Int64 n1,Int64 n2); - friend Int64 operator * (Int64 n1,Int64 n2); - friend Int64 operator % (Int64 n1,Int64 n2); - friend Int64 operator + (Int64 n1,Int64 n2); - friend Int64 operator - (Int64 n1,Int64 n2); - friend Int64 operator += (Int64 &n1,Int64 n2); - friend Int64 operator -= (Int64 &n1,Int64 n2); - friend Int64 operator *= (Int64 &n1,Int64 n2); - friend Int64 operator /= (Int64 &n1,Int64 n2); - friend Int64 operator | (Int64 n1,Int64 n2); - friend Int64 operator & (Int64 n1,Int64 n2); - inline friend void operator -= (Int64 &n1,unsigned int n2) - { - if (n1.LowPart (Int64 n1,Int64 n2); - friend bool operator < (Int64 n1,Int64 n2); - friend bool operator != (Int64 n1,Int64 n2); - friend bool operator >= (Int64 n1,Int64 n2); - friend bool operator <= (Int64 n1,Int64 n2); - - void Set(uint HighPart,uint LowPart); - uint GetLowPart() {return(LowPart);} - - uint LowPart; - uint HighPart; -}; - -inline uint int64to32(Int64 n) {return(n.GetLowPart());} -#define int32to64(high,low) (Int64((high),(low))) -#define is64plus(x) ((int)(x).HighPart>=0) - -#endif - -#define INT64ERR int32to64(0x80000000,0) -#define INT64MAX int32to64(0x7fffffff,0) - -void itoa(Int64 n,char *Str); -Int64 atoil(char *Str); - -#endif diff --git a/src/bin/unrar/isnt.cpp b/src/bin/unrar/isnt.cpp deleted file mode 100644 index 493a9eb918..0000000000 --- a/src/bin/unrar/isnt.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include "rar.hpp" - -#ifdef _WIN_32 -int WinNT() -{ - static int dwPlatformId=-1,dwMajorVersion; - if (dwPlatformId==-1) - { - OSVERSIONINFO WinVer; - WinVer.dwOSVersionInfoSize=sizeof(WinVer); - GetVersionEx(&WinVer); - dwPlatformId=WinVer.dwPlatformId; - dwMajorVersion=WinVer.dwMajorVersion; - } - return(dwPlatformId==VER_PLATFORM_WIN32_NT ? dwMajorVersion:0); -} -#endif diff --git a/src/bin/unrar/isnt.hpp b/src/bin/unrar/isnt.hpp deleted file mode 100644 index 026523614f..0000000000 --- a/src/bin/unrar/isnt.hpp +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef _RAR_ISNT_ -#define _RAR_ISNT_ - -int WinNT(); - -#endif diff --git a/src/bin/unrar/license.txt b/src/bin/unrar/license.txt deleted file mode 100644 index ec35e09a8f..0000000000 --- a/src/bin/unrar/license.txt +++ /dev/null @@ -1,40 +0,0 @@ - ****** ***** ****** UnRAR - free utility for RAR archives - ** ** ** ** ** ** ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - ****** ******* ****** License for use and distribution of - ** ** ** ** ** ** ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - ** ** ** ** ** ** FREE portable version - ~~~~~~~~~~~~~~~~~~~~~ - - The source code of UnRAR utility is freeware. This means: - - 1. All copyrights to RAR and the utility UnRAR are exclusively - owned by the author - Alexander Roshal. - - 2. The UnRAR sources may be used in any software to handle RAR - archives without limitations free of charge, but cannot be used - to re-create the RAR compression algorithm, which is proprietary. - Distribution of modified UnRAR sources in separate form or as a - part of other software is permitted, provided that it is clearly - stated in the documentation and source comments that the code may - not be used to develop a RAR (WinRAR) compatible archiver. - - 3. The UnRAR utility may be freely distributed. It is allowed - to distribute UnRAR inside of other software packages. - - 4. THE RAR ARCHIVER AND THE UnRAR UTILITY ARE DISTRIBUTED "AS IS". - NO WARRANTY OF ANY KIND IS EXPRESSED OR IMPLIED. YOU USE AT - YOUR OWN RISK. THE AUTHOR WILL NOT BE LIABLE FOR DATA LOSS, - DAMAGES, LOSS OF PROFITS OR ANY OTHER KIND OF LOSS WHILE USING - OR MISUSING THIS SOFTWARE. - - 5. Installing and using the UnRAR utility signifies acceptance of - these terms and conditions of the license. - - 6. If you don't agree with terms of the license you must remove - UnRAR files from your storage devices and cease to use the - utility. - - Thank you for your interest in RAR and UnRAR. - - - Alexander L. Roshal \ No newline at end of file diff --git a/src/bin/unrar/list.cpp b/src/bin/unrar/list.cpp deleted file mode 100644 index d5690064d8..0000000000 --- a/src/bin/unrar/list.cpp +++ /dev/null @@ -1,388 +0,0 @@ -#include "rar.hpp" - -static void ListFileHeader(FileHeader &hd,bool Verbose,bool Technical,bool &TitleShown,bool Bare); -static void ListSymLink(Archive &Arc); -static void ListFileAttr(uint A,int HostOS); -static void ListOldSubHeader(Archive &Arc); -static void ListNewSubHeader(CommandData *Cmd,Archive &Arc,bool Technical); - -void ListArchive(CommandData *Cmd) -{ - Int64 SumPackSize=0,SumUnpSize=0; - uint ArcCount=0,SumFileCount=0; - bool Technical=(Cmd->Command[1]=='T'); - bool Bare=(Cmd->Command[1]=='B'); - bool Verbose=(*Cmd->Command=='V'); - - char ArcName[NM]; - wchar ArcNameW[NM]; - - while (Cmd->GetArcName(ArcName,ArcNameW,sizeof(ArcName))) - { - Archive Arc(Cmd); -#ifdef _WIN_32 - Arc.RemoveSequentialFlag(); -#endif - if (!Arc.WOpen(ArcName,ArcNameW)) - continue; - bool FileMatched=true; - while (1) - { - Int64 TotalPackSize=0,TotalUnpSize=0; - uint FileCount=0; - if (Arc.IsArchive(true)) - { - if (!Arc.IsOpened()) - break; - bool TitleShown=false; - if (!Bare) - { - Arc.ViewComment(); - - // RAR can close a corrupt encrypted archive - if (!Arc.IsOpened()) - break; - - mprintf("\n"); - if (Arc.Solid) - mprintf(St(MListSolid)); - if (Arc.SFXSize>0) - mprintf(St(MListSFX)); - if (Arc.Volume) - if (Arc.Solid) - mprintf(St(MListVol1)); - else - mprintf(St(MListVol2)); - else - if (Arc.Solid) - mprintf(St(MListArc1)); - else - mprintf(St(MListArc2)); - mprintf(" %s\n",Arc.FileName); - if (Technical) - { - if (Arc.Protected) - mprintf(St(MListRecRec)); - if (Arc.Locked) - mprintf(St(MListLock)); - } - } - while(Arc.ReadHeader()>0) - { - int HeaderType=Arc.GetHeaderType(); - if (HeaderType==ENDARC_HEAD) - break; - switch(HeaderType) - { - case FILE_HEAD: - IntToExt(Arc.NewLhd.FileName,Arc.NewLhd.FileName); - if ((FileMatched=Cmd->IsProcessFile(Arc.NewLhd))==true) - { - ListFileHeader(Arc.NewLhd,Verbose,Technical,TitleShown,Bare); - if (!(Arc.NewLhd.Flags & LHD_SPLIT_BEFORE)) - { - TotalUnpSize+=Arc.NewLhd.FullUnpSize; - FileCount++; - } - TotalPackSize+=Arc.NewLhd.FullPackSize; - if (Technical) - ListSymLink(Arc); -#ifndef SFX_MODULE - if (Verbose) - Arc.ViewFileComment(); -#endif - } - break; -#ifndef SFX_MODULE - case SUB_HEAD: - if (Technical && FileMatched && !Bare) - ListOldSubHeader(Arc); - break; -#endif - case NEWSUB_HEAD: - if (FileMatched && !Bare) - { - if (Technical) - ListFileHeader(Arc.SubHead,Verbose,true,TitleShown,false); - ListNewSubHeader(Cmd,Arc,Technical); - } - break; - } - Arc.SeekToNext(); - } - if (!Bare) - if (TitleShown) - { - mprintf("\n"); - for (int I=0;I<79;I++) - mprintf("-"); - char UnpSizeText[20]; - itoa(TotalUnpSize,UnpSizeText); - - char PackSizeText[20]; - itoa(TotalPackSize,PackSizeText); - - mprintf("\n%5lu %16s %8s %3d%%",FileCount,UnpSizeText, - PackSizeText,ToPercentUnlim(TotalPackSize,TotalUnpSize)); - SumFileCount+=FileCount; - SumUnpSize+=TotalUnpSize; - SumPackSize+=TotalPackSize; -#ifndef SFX_MODULE - if (Arc.EndArcHead.Flags & EARC_VOLNUMBER) - { - mprintf(" "); - mprintf(St(MVolumeNumber),Arc.EndArcHead.VolNumber+1); - } -#endif - mprintf("\n"); - } - else - mprintf(St(MListNoFiles)); - - ArcCount++; - -#ifndef NOVOLUME - if (Cmd->VolSize!=0 && ((Arc.NewLhd.Flags & LHD_SPLIT_AFTER) || - Arc.GetHeaderType()==ENDARC_HEAD && - (Arc.EndArcHead.Flags & EARC_NEXT_VOLUME)!=0) && - MergeArchive(Arc,NULL,false,*Cmd->Command)) - { - Arc.Seek(0,SEEK_SET); - } - else -#endif - break; - } - else - { - if (Cmd->ArcNames->ItemsCount()<2 && !Bare) - mprintf(St(MNotRAR),Arc.FileName); - break; - } - } - } - if (ArcCount>1 && !Bare) - { - char UnpSizeText[20],PackSizeText[20]; - itoa(SumUnpSize,UnpSizeText); - itoa(SumPackSize,PackSizeText); - mprintf("\n%5lu %16s %8s %3d%%\n",SumFileCount,UnpSizeText, - PackSizeText,ToPercentUnlim(SumPackSize,SumUnpSize)); - } -} - - -void ListFileHeader(FileHeader &hd,bool Verbose,bool Technical,bool &TitleShown,bool Bare) -{ - if (!Bare) - { - if (!TitleShown) - { - if (Verbose) - mprintf(St(MListPathComm)); - else - mprintf(St(MListName)); - mprintf(St(MListTitle)); - if (Technical) - mprintf(St(MListTechTitle)); - for (int I=0;I<79;I++) - mprintf("-"); - TitleShown=true; - } - - if (hd.HeadType==NEWSUB_HEAD) - mprintf(St(MSubHeadType),hd.FileName); - - mprintf("\n%c",(hd.Flags & LHD_PASSWORD) ? '*' : ' '); - } - - char *Name=hd.FileName; - -#ifdef UNICODE_SUPPORTED - char ConvertedName[NM]; - if ((hd.Flags & LHD_UNICODE)!=0 && *hd.FileNameW!=0 && UnicodeEnabled()) - { - if (WideToChar(hd.FileNameW,ConvertedName) && *ConvertedName!=0) - Name=ConvertedName; - } -#endif - - if (Bare) - { - mprintf("%s\n",Verbose ? Name:PointToName(Name)); - return; - } - - if (Verbose) - mprintf("%s\n%12s ",Name,""); - else - mprintf("%-12s",PointToName(Name)); - - char UnpSizeText[20],PackSizeText[20]; - if (hd.FullUnpSize==INT64MAX) - strcpy(UnpSizeText,"?"); - else - itoa(hd.FullUnpSize,UnpSizeText); - itoa(hd.FullPackSize,PackSizeText); - - mprintf(" %8s %8s ",UnpSizeText,PackSizeText); - - if ((hd.Flags & LHD_SPLIT_BEFORE) && (hd.Flags & LHD_SPLIT_AFTER)) - mprintf(" <->"); - else - if (hd.Flags & LHD_SPLIT_BEFORE) - mprintf(" <--"); - else - if (hd.Flags & LHD_SPLIT_AFTER) - mprintf(" -->"); - else - mprintf("%3d%%",ToPercentUnlim(hd.FullPackSize,hd.FullUnpSize)); - - char DateStr[50]; - hd.mtime.GetText(DateStr,false); - mprintf(" %s ",DateStr); - - if (hd.HeadType==NEWSUB_HEAD) - mprintf(" %c....B ",(hd.SubFlags & SUBHEAD_FLAGS_INHERITED) ? 'I' : '.'); - else - ListFileAttr(hd.FileAttr,hd.HostOS); - - mprintf(" %8.8X",hd.FileCRC); - mprintf(" m%d",hd.Method-0x30); - if ((hd.Flags & LHD_WINDOWMASK)<=6*32) - mprintf("%c",((hd.Flags&LHD_WINDOWMASK)>>5)+'a'); - else - mprintf(" "); - mprintf(" %d.%d",hd.UnpVer/10,hd.UnpVer%10); - - static const char *RarOS[]={ - "DOS","OS/2","Win95/NT","Unix","MacOS","BeOS","WinCE","","","" - }; - - if (Technical) - mprintf("\n%22s %8s %4s", - (hd.HostOS",FileName); - } -} - - -void ListFileAttr(uint A,int HostOS) -{ - switch(HostOS) - { - case HOST_MSDOS: - case HOST_OS2: - case HOST_WIN32: - case HOST_MACOS: - mprintf(" %c%c%c%c%c%c%c ", - (A & 0x08) ? 'V' : '.', - (A & 0x10) ? 'D' : '.', - (A & 0x01) ? 'R' : '.', - (A & 0x02) ? 'H' : '.', - (A & 0x04) ? 'S' : '.', - (A & 0x20) ? 'A' : '.', - (A & 0x800) ? 'C' : '.'); - break; - case HOST_UNIX: - case HOST_BEOS: - switch (A & 0xF000) - { - case 0x4000: - mprintf("d"); - break; - case 0xA000: - mprintf("l"); - break; - default: - mprintf("-"); - break; - } - mprintf("%c%c%c%c%c%c%c%c%c", - (A & 0x0100) ? 'r' : '-', - (A & 0x0080) ? 'w' : '-', - (A & 0x0040) ? ((A & 0x0800) ? 's':'x'):((A & 0x0800) ? 'S':'-'), - (A & 0x0020) ? 'r' : '-', - (A & 0x0010) ? 'w' : '-', - (A & 0x0008) ? ((A & 0x0400) ? 's':'x'):((A & 0x0400) ? 'S':'-'), - (A & 0x0004) ? 'r' : '-', - (A & 0x0002) ? 'w' : '-', - (A & 0x0001) ? 'x' : '-'); - break; - } -} - - -#ifndef SFX_MODULE -void ListOldSubHeader(Archive &Arc) -{ - switch(Arc.SubBlockHead.SubType) - { - case EA_HEAD: - mprintf(St(MListEAHead)); - break; - case UO_HEAD: - mprintf(St(MListUOHead),Arc.UOHead.OwnerName,Arc.UOHead.GroupName); - break; - case MAC_HEAD: - mprintf(St(MListMACHead1),Arc.MACHead.fileType>>24,Arc.MACHead.fileType>>16,Arc.MACHead.fileType>>8,Arc.MACHead.fileType); - mprintf(St(MListMACHead2),Arc.MACHead.fileCreator>>24,Arc.MACHead.fileCreator>>16,Arc.MACHead.fileCreator>>8,Arc.MACHead.fileCreator); - break; - case BEEA_HEAD: - mprintf(St(MListBeEAHead)); - break; - case NTACL_HEAD: - mprintf(St(MListNTACLHead)); - break; - case STREAM_HEAD: - mprintf(St(MListStrmHead),Arc.StreamHead.StreamName); - break; - default: - mprintf(St(MListUnkHead),Arc.SubBlockHead.SubType); - break; - } -} -#endif - - -void ListNewSubHeader(CommandData *Cmd,Archive &Arc,bool Technical) -{ - if (Arc.SubHead.CmpName(SUBHEAD_TYPE_CMT) && - (Arc.SubHead.Flags & LHD_SPLIT_BEFORE)==0 && !Cmd->DisableComment) - { - Array CmtData; - int ReadSize=Arc.ReadCommentData(&CmtData,NULL); - if (ReadSize!=0) - { - mprintf(St(MFileComment)); - OutComment((char *)&CmtData[0],ReadSize); - } - } - if (Arc.SubHead.CmpName(SUBHEAD_TYPE_STREAM) && - (Arc.SubHead.Flags & LHD_SPLIT_BEFORE)==0) - { - int DestSize=Arc.SubHead.SubData.Size()/2; - wchar DestNameW[NM]; - char DestName[NM]; - if (DestSize - - " -#define MUNRARTitle1 "\nUsage: unrar - - " -#define MRARTitle2 "\n <@listfiles...> " -#define MCHelpCmd "\n\n" -#define MCHelpCmdA "\n a Add files to archive" -#define MCHelpCmdC "\n c Add archive comment" -#define MCHelpCmdCF "\n cf Add files comment" -#define MCHelpCmdCH "\n ch Change archive parameters" -#define MCHelpCmdCW "\n cw Write archive comment to file" -#define MCHelpCmdD "\n d Delete files from archive" -#define MCHelpCmdE "\n e Extract files to current directory" -#define MCHelpCmdF "\n f Freshen files in archive" -#define MCHelpCmdI "\n i[par]= Find string in archives" -#define MCHelpCmdK "\n k Lock archive" -#define MCHelpCmdL "\n l[t,b] List archive [technical, bare]" -#define MCHelpCmdM "\n m[f] Move to archive [files only]" -#define MCHelpCmdP "\n p Print file to stdout" -#define MCHelpCmdR "\n r Repair archive" -#define MCHelpCmdRC "\n rc Reconstruct missing volumes" -#define MCHelpCmdRN "\n rn Rename archived files" -#define MCHelpCmdRR "\n rr[N] Add data recovery record" -#define MCHelpCmdRV "\n rv[N] Create recovery volumes" -#define MCHelpCmdS "\n s[name|-] Convert archive to or from SFX" -#define MCHelpCmdT "\n t Test archive files" -#define MCHelpCmdU "\n u Update files in archive" -#define MCHelpCmdV "\n v[t,b] Verbosely list archive [technical,bare]" -#define MCHelpCmdX "\n x Extract files with full path" -#define MCHelpSw "\n\n" -#define MCHelpSwm "\n - Stop switches scanning" -#define MCHelpSwAC "\n ac Clear Archive attribute after compression or extraction" -#define MCHelpSwAD "\n ad Append archive name to destination path" -#define MCHelpSwAG "\n ag[format] Generate archive name using the current date" -#define MCHelpSwAO "\n ao Add files with Archive attribute set" -#define MCHelpSwAP "\n ap Set path inside archive" -#define MCHelpSwAS "\n as Synchronize archive contents" -#define MCHelpSwAV "\n av Put authenticity verification (registered versions only)" -#define MCHelpSwAVm "\n av- Disable authenticity verification check" -#define MCHelpSwCm "\n c- Disable comments show" -#define MCHelpSwCFGm "\n cfg- Disable read configuration" -#define MCHelpSwCL "\n cl Convert names to lower case" -#define MCHelpSwCU "\n cu Convert names to upper case" -#define MCHelpSwDF "\n df Delete files after archiving" -#define MCHelpSwDH "\n dh Open shared files" -#define MCHelpSwDS "\n ds Disable name sort for solid archive" -#define MCHelpSwEa "\n e[+] Set file exclude and include attributes" -#define MCHelpSwED "\n ed Do not add empty directories" -#define MCHelpSwEE "\n ee Do not save and extract extended attributes" -#define MCHelpSwEN "\n en Do not put 'end of archive' block" -#define MCHelpSwEP "\n ep Exclude paths from names" -#define MCHelpSwEP1 "\n ep1 Exclude base directory from names" -#define MCHelpSwEP2 "\n ep2 Expand paths to full" -#define MCHelpSwEP3 "\n ep3 Expand paths to full including the drive letter" -#define MCHelpSwF "\n f Freshen files" -#define MCHelpSwHP "\n hp[password] Encrypt both file data and headers" -#define MCHelpSwIDP "\n id[c,d,p,q] Disable messages" -#define MCHelpSwIEML "\n ieml[addr] Send archive by email" -#define MCHelpSwIERR "\n ierr Send all messages to stderr" -#define MCHelpSwILOG "\n ilog[name] Log errors to file (registered versions only)" -#define MCHelpSwINUL "\n inul Disable all messages" -#define MCHelpSwIOFF "\n ioff Turn PC off after completing an operation" -#define MCHelpSwISND "\n isnd Enable sound" -#define MCHelpSwK "\n k Lock archive" -#define MCHelpSwKB "\n kb Keep broken extracted files" -#define MCHelpSwMn "\n m<0..5> Set compression level (0-store...3-default...5-maximal)" -#define MCHelpSwMC "\n mc Set advanced compression parameters" -#define MCHelpSwMD "\n md Dictionary size in KB (64,128,256,512,1024,2048,4096 or A-G)" -#define MCHelpSwMS "\n ms[ext;ext] Specify file types to store" -#define MCHelpSwMT "\n mt Set the number of threads" -#define MCHelpSwN "\n n Include only specified file" -#define MCHelpSwNa "\n n@ Read file names to include from stdin" -#define MCHelpSwNal "\n n@ Include files in specified list file" -#define MCHelpSwOp "\n o+ Overwrite existing files" -#define MCHelpSwOm "\n o- Do not overwrite existing files" -#define MCHelpSwOC "\n oc Set NTFS Compressed attribute" -#define MCHelpSwOL "\n ol Save symbolic links as the link instead of the file" -#define MCHelpSwOR "\n or Rename files automatically" -#define MCHelpSwOS "\n os Save NTFS streams" -#define MCHelpSwOW "\n ow Save or restore file owner and group" -#define MCHelpSwP "\n p[password] Set password" -#define MCHelpSwPm "\n p- Do not query password" -#define MCHelpSwR "\n r Recurse subdirectories" -#define MCHelpSwR0 "\n r0 Recurse subdirectories for wildcard names only" -#define MCHelpSwRI "\n ri

[:] Set priority (0-default,1-min..15-max) and sleep time in ms" -#define MCHelpSwRR "\n rr[N] Add data recovery record" -#define MCHelpSwRV "\n rv[N] Create recovery volumes" -#define MCHelpSwS "\n s[,v[-],e] Create solid archive" -#define MCHelpSwSm "\n s- Disable solid archiving" -#define MCHelpSwSC "\n sc[obj] Specify the character set" -#define MCHelpSwSFX "\n sfx[name] Create SFX archive" -#define MCHelpSwSI "\n si[name] Read data from standard input (stdin)" -#define MCHelpSwSL "\n sl Process files with size less than specified" -#define MCHelpSwSM "\n sm Process files with size more than specified" -#define MCHelpSwT "\n t Test files after archiving" -#define MCHelpSwTK "\n tk Keep original archive time" -#define MCHelpSwTL "\n tl Set archive time to latest file" -#define MCHelpSwTN "\n tn